@wovin/connect-nftstorage 0.1.11 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
- import{e as qs}from"./chunk-BKKH6BET.min.js";var vg=Object.create,Nd=Object.defineProperty,wg=Object.getOwnPropertyDescriptor,Tg=Object.getOwnPropertyNames,_g=Object.getPrototypeOf,Eg=Object.prototype.hasOwnProperty,li=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),xg=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Tg(t))!Eg.call(e,i)&&i!==r&&Nd(e,i,{get:()=>t[i],enumerable:!(n=wg(t,i))||n.enumerable});return e},mo=(e,t,r)=>(r=e!=null?vg(_g(e)):{},xg(t||!e||!e.__esModule?Nd(r,"default",{value:e,enumerable:!0}):r,e)),Og=li((e,t)=>{"use strict";t.exports=a;var r=128,n=127,i=~n,o=Math.pow(2,31);function a(s,u,l){if(Number.MAX_SAFE_INTEGER&&s>Number.MAX_SAFE_INTEGER)throw a.bytes=0,new RangeError("Could not encode varint");u=u||[],l=l||0;for(var f=l;s>=o;)u[l++]=s&255|r,s/=128;for(;s&i;)u[l++]=s&255|r,s>>>=7;return u[l]=s|0,a.bytes=l-f+1,u}}),Ag=li((e,t)=>{"use strict";t.exports=i;var r=128,n=127;function i(o,u){var s=0,u=u||0,l=0,f=u,d,I=o.length;do{if(f>=I||l>49)throw i.bytes=0,new RangeError("Could not decode varint");d=o[f++],s+=l<28?(d&n)<<l:(d&n)*Math.pow(2,l),l+=7}while(d>=r);return i.bytes=f-u,s}}),Sg=li((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),a=Math.pow(2,35),s=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),f=Math.pow(2,63);t.exports=function(d){return d<r?1:d<n?2:d<i?3:d<o?4:d<a?5:d<s?6:d<u?7:d<l?8:d<f?9:10}}),Hu=li((e,t)=>{"use strict";t.exports={encode:Og(),decode:Ag(),encodingLength:Sg()}}),Ig=li(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},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")),a=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=a}),kg=li((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(s){return function(u){return function(l,f){var d={key:l,value:u[l]},I={key:f,value:u[f]};return s(d,I)}}}(n.cmp),a=[];return function s(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 l,f;if(Array.isArray(u)){for(f="[",l=0;l<u.length;l++)l&&(f+=","),f+=s(u[l])||"null";return f+"]"}if(u===null)return"null";if(a.indexOf(u)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var d=a.push(u)-1,I=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<I.length;l++){var E=I[l],_=s(u[E]);_&&(f&&(f+=","),f+=JSON.stringify(E)+":"+_)}return a.splice(d,1),"{"+f+"}"}}(r)}}),$g=["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 jg(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return t==="string"||t==="number"||t==="bigint"||t==="symbol"?t:t==="function"?"Function":Array.isArray(e)?"Array":e instanceof Uint8Array?"Uint8Array":e.constructor===Object?"Object":Cg(e)||"Object"}function Cg(e){let t=Object.prototype.toString.call(e).slice(8,-1);if($g.includes(t))return t}var G=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}};G.uint=new G(0,"uint",!0);G.negint=new G(1,"negint",!0);G.bytes=new G(2,"bytes",!0);G.string=new G(3,"string",!0);G.array=new G(4,"array",!1);G.map=new G(5,"map",!1);G.tag=new G(6,"tag",!1);G.float=new G(7,"float",!0);G.false=new G(7,"false",!0);G.true=new G(7,"true",!0);G.null=new G(7,"null",!0);G.undefined=new G(7,"undefined",!0);G.break=new G(7,"break",!0);var we=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}`}},bo=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Ng=new TextEncoder;function ca(e){return bo&&globalThis.Buffer.isBuffer(e)}function Ju(e){return e instanceof Uint8Array?ca(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Ug=24,Pg=200,Bg=bo?e=>e.length>=Ug?globalThis.Buffer.from(e):Sc(e):e=>e.length>=Pg?Ng.encode(e):Sc(e),Tr=e=>Uint8Array.from(e),Rg=bo?(e,t,r)=>ca(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Dg=bo?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Ju(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},Mg=bo?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Ud(e,t){if(ca(e)&&ca(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 Sc(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 Lg=256,Pd=class{constructor(e=Lg){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 r=t.length-(this.maxCursor-this.cursor)-1;t.set(e,r)}else{if(t){let r=t.length-(this.maxCursor-this.cursor)-1;r<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,r),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=Mg(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=Rg(r,0,this.cursor)}else t=Dg(this.chunks,this.cursor);return e&&this.reset(),t}},Vg=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}},Ie="CBOR decode error:",Bd="CBOR encode error:",vo=[];vo[23]=1;vo[24]=2;vo[25]=3;vo[26]=5;vo[27]=9;function ci(e,t,r){if(e.length-t<r)throw new Error(`${Ie} not enough data for type`)}var st=[24,256,65536,4294967296,BigInt("18446744073709551616")];function En(e,t,r){ci(e,t,1);let n=e[t];if(r.strict===!0&&n<st[0])throw new Error(`${Ie} integer encoded in more bytes than necessary (strict decode)`);return n}function xn(e,t,r){ci(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<st[1])throw new Error(`${Ie} integer encoded in more bytes than necessary (strict decode)`);return n}function On(e,t,r){ci(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<st[2])throw new Error(`${Ie} integer encoded in more bytes than necessary (strict decode)`);return n}function An(e,t,r){ci(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<st[3])throw new Error(`${Ie} 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(`${Ie} integers outside of the safe integer range are not supported`)}function Fg(e,t,r,n){return new we(G.uint,En(e,t+1,n),2)}function zg(e,t,r,n){return new we(G.uint,xn(e,t+1,n),3)}function Kg(e,t,r,n){return new we(G.uint,On(e,t+1,n),5)}function qg(e,t,r,n){return new we(G.uint,An(e,t+1,n),9)}function Sn(e,t){return Gt(e,0,t.value)}function Gt(e,t,r){if(r<st[0]){let n=Number(r);e.push([t|n])}else if(r<st[1]){let n=Number(r);e.push([t|24,n])}else if(r<st[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<st[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<st[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=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]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,e.push(i)}else throw new Error(`${Ie} encountered BigInt larger than allowable range`)}}Sn.encodedSize=function(e){return Gt.encodedSize(e.value)};Gt.encodedSize=function(e){return e<st[0]?1:e<st[1]?2:e<st[2]?3:e<st[3]?5:9};Sn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function Gg(e,t,r,n){return new we(G.negint,-1-En(e,t+1,n),2)}function Wg(e,t,r,n){return new we(G.negint,-1-xn(e,t+1,n),3)}function Hg(e,t,r,n){return new we(G.negint,-1-On(e,t+1,n),5)}var Xu=BigInt(-1),Rd=BigInt(1);function Jg(e,t,r,n){let i=An(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new we(G.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Ie} integers outside of the safe integer range are not supported`);return new we(G.negint,Xu-BigInt(i),9)}function Qu(e,t){let r=t.value,n=typeof r=="bigint"?r*Xu-Rd:r*-1-1;Gt(e,t.type.majorEncoded,n)}Qu.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*Xu-Rd:t*-1-1;return r<st[0]?1:r<st[1]?2:r<st[2]?3:r<st[3]?5:9};Qu.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function wo(e,t,r,n){ci(e,t,r+n);let i=e.slice(t+r,t+r+n);return new we(G.bytes,i,r+n)}function Xg(e,t,r,n){return wo(e,t,1,r)}function Qg(e,t,r,n){return wo(e,t,2,En(e,t+1,n))}function Zg(e,t,r,n){return wo(e,t,3,xn(e,t+1,n))}function Yg(e,t,r,n){return wo(e,t,5,On(e,t+1,n))}function em(e,t,r,n){let i=An(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ie} 64-bit integer bytes lengths not supported`);return wo(e,t,9,i)}function fa(e){return e.encodedBytes===void 0&&(e.encodedBytes=G.equals(e.type,G.string)?Bg(e.value):e.value),e.encodedBytes}function ns(e,t){let r=fa(t);Gt(e,t.type.majorEncoded,r.length),e.push(r)}ns.encodedSize=function(e){let t=fa(e);return Gt.encodedSize(t.length)+t.length};ns.compareTokens=function(e,t){return tm(fa(e),fa(t))};function tm(e,t){return e.length<t.length?-1:e.length>t.length?1:Ud(e,t)}var Ic=new TextDecoder,rm=32;function nm(e,t,r){if(r-t<rm){let n="";for(let i=t;i<r;i++){let o=e[i];if(o&128)return Ic.decode(e.subarray(t,r));n+=String.fromCharCode(o)}return n}return Ic.decode(e.subarray(t,r))}function To(e,t,r,n,i){let o=r+n;ci(e,t,o);let a=new we(G.string,nm(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=e.slice(t+r,t+o)),a}function im(e,t,r,n){return To(e,t,1,r,n)}function om(e,t,r,n){return To(e,t,2,En(e,t+1,n),n)}function am(e,t,r,n){return To(e,t,3,xn(e,t+1,n),n)}function sm(e,t,r,n){return To(e,t,5,On(e,t+1,n),n)}function um(e,t,r,n){let i=An(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ie} 64-bit integer string lengths not supported`);return To(e,t,9,i,n)}var lm=ns;function fi(e,t,r,n){return new we(G.array,n,r)}function cm(e,t,r,n){return fi(e,t,1,r)}function fm(e,t,r,n){return fi(e,t,2,En(e,t+1,n))}function dm(e,t,r,n){return fi(e,t,3,xn(e,t+1,n))}function pm(e,t,r,n){return fi(e,t,5,On(e,t+1,n))}function hm(e,t,r,n){let i=An(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ie} 64-bit integer array lengths not supported`);return fi(e,t,9,i)}function ym(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ie} indefinite length items not allowed`);return fi(e,t,1,1/0)}function Zu(e,t){Gt(e,G.array.majorEncoded,t.value)}Zu.compareTokens=Sn.compareTokens;Zu.encodedSize=function(e){return Gt.encodedSize(e.value)};function di(e,t,r,n){return new we(G.map,n,r)}function gm(e,t,r,n){return di(e,t,1,r)}function mm(e,t,r,n){return di(e,t,2,En(e,t+1,n))}function bm(e,t,r,n){return di(e,t,3,xn(e,t+1,n))}function vm(e,t,r,n){return di(e,t,5,On(e,t+1,n))}function wm(e,t,r,n){let i=An(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ie} 64-bit integer map lengths not supported`);return di(e,t,9,i)}function Tm(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ie} indefinite length items not allowed`);return di(e,t,1,1/0)}function Yu(e,t){Gt(e,G.map.majorEncoded,t.value)}Yu.compareTokens=Sn.compareTokens;Yu.encodedSize=function(e){return Gt.encodedSize(e.value)};function _m(e,t,r,n){return new we(G.tag,r,1)}function Em(e,t,r,n){return new we(G.tag,En(e,t+1,n),2)}function xm(e,t,r,n){return new we(G.tag,xn(e,t+1,n),3)}function Om(e,t,r,n){return new we(G.tag,On(e,t+1,n),5)}function Am(e,t,r,n){return new we(G.tag,An(e,t+1,n),9)}function el(e,t){Gt(e,G.tag.majorEncoded,t.value)}el.compareTokens=Sn.compareTokens;el.encodedSize=function(e){return Gt.encodedSize(e.value)};var Dd=20,Md=21,Ld=22,Vd=23;function Sm(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Ie} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new we(G.null,null,1):new we(G.undefined,void 0,1)}function Im(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ie} indefinite length items not allowed`);return new we(G.break,void 0,1)}function tl(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Ie} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Ie} Infinity values are not supported`)}return new we(G.float,e,t)}function km(e,t,r,n){return tl(nl(e,t+1),3,n)}function $m(e,t,r,n){return tl(il(e,t+1),5,n)}function jm(e,t,r,n){return tl(qd(e,t+1),9,n)}function rl(e,t,r){let n=t.value;if(n===!1)e.push([G.float.majorEncoded|Dd]);else if(n===!0)e.push([G.float.majorEncoded|Md]);else if(n===null)e.push([G.float.majorEncoded|Ld]);else if(n===void 0)e.push([G.float.majorEncoded|Vd]);else{let i,o=!1;(!r||r.float64!==!0)&&(zd(n),i=nl(Zt,1),n===i||Number.isNaN(n)?(Zt[0]=249,e.push(Zt.slice(0,3)),o=!0):(Kd(n),i=il(Zt,1),n===i&&(Zt[0]=250,e.push(Zt.slice(0,5)),o=!0))),o||(Cm(n),i=qd(Zt,1),Zt[0]=251,e.push(Zt.slice(0,9)))}}rl.encodedSize=function(e,t){let r=e.value;if(r===!1||r===!0||r===null||r===void 0)return 1;if(!t||t.float64!==!0){zd(r);let n=nl(Zt,1);if(r===n||Number.isNaN(r))return 3;if(Kd(r),n=il(Zt,1),r===n)return 5}return 9};var Fd=new ArrayBuffer(9),jt=new DataView(Fd,1),Zt=new Uint8Array(Fd,0);function zd(e){if(e===1/0)jt.setUint16(0,31744,!1);else if(e===-1/0)jt.setUint16(0,64512,!1);else if(Number.isNaN(e))jt.setUint16(0,32256,!1);else{jt.setFloat32(0,e);let t=jt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)jt.setUint16(0,31744,!1);else if(r===0)jt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?jt.setUint16(0,0):i<-14?jt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):jt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function nl(e,t){if(e.length-t<2)throw new Error(`${Ie} 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 Kd(e){jt.setFloat32(0,e,!1)}function il(e,t){if(e.length-t<4)throw new Error(`${Ie} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function Cm(e){jt.setFloat64(0,e,!1)}function qd(e,t){if(e.length-t<8)throw new Error(`${Ie} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}rl.compareTokens=Sn.compareTokens;function Ne(e,t,r){throw new Error(`${Ie} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function is(e){return()=>{throw new Error(`${Ie} ${e}`)}}var le=[];for(let e=0;e<=23;e++)le[e]=Ne;le[24]=Fg;le[25]=zg;le[26]=Kg;le[27]=qg;le[28]=Ne;le[29]=Ne;le[30]=Ne;le[31]=Ne;for(let e=32;e<=55;e++)le[e]=Ne;le[56]=Gg;le[57]=Wg;le[58]=Hg;le[59]=Jg;le[60]=Ne;le[61]=Ne;le[62]=Ne;le[63]=Ne;for(let e=64;e<=87;e++)le[e]=Xg;le[88]=Qg;le[89]=Zg;le[90]=Yg;le[91]=em;le[92]=Ne;le[93]=Ne;le[94]=Ne;le[95]=is("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)le[e]=im;le[120]=om;le[121]=am;le[122]=sm;le[123]=um;le[124]=Ne;le[125]=Ne;le[126]=Ne;le[127]=is("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)le[e]=cm;le[152]=fm;le[153]=dm;le[154]=pm;le[155]=hm;le[156]=Ne;le[157]=Ne;le[158]=Ne;le[159]=ym;for(let e=160;e<=183;e++)le[e]=gm;le[184]=mm;le[185]=bm;le[186]=vm;le[187]=wm;le[188]=Ne;le[189]=Ne;le[190]=Ne;le[191]=Tm;for(let e=192;e<=215;e++)le[e]=_m;le[216]=Em;le[217]=xm;le[218]=Om;le[219]=Am;le[220]=Ne;le[221]=Ne;le[222]=Ne;le[223]=Ne;for(let e=224;e<=243;e++)le[e]=is("simple values are not supported");le[244]=Ne;le[245]=Ne;le[246]=Ne;le[247]=Sm;le[248]=is("simple values are not supported");le[249]=km;le[250]=$m;le[251]=jm;le[252]=Ne;le[253]=Ne;le[254]=Ne;le[255]=Im;var mr=[];for(let e=0;e<24;e++)mr[e]=new we(G.uint,e,1);for(let e=-1;e>=-24;e--)mr[31-e]=new we(G.negint,e,1);mr[64]=new we(G.bytes,new Uint8Array(0),1);mr[96]=new we(G.string,"",1);mr[128]=new we(G.array,0,1);mr[160]=new we(G.map,0,1);mr[244]=new we(G.false,!1,1);mr[245]=new we(G.true,!0,1);mr[246]=new we(G.null,null,1);function Nm(e){switch(e.type){case G.false:return Tr([244]);case G.true:return Tr([245]);case G.null:return Tr([246]);case G.bytes:return e.value.length?void 0:Tr([64]);case G.string:return e.value===""?Tr([96]):void 0;case G.array:return e.value===0?Tr([128]):void 0;case G.map:return e.value===0?Tr([160]):void 0;case G.uint:return e.value<24?Tr([Number(e.value)]):void 0;case G.negint:if(e.value>=-24)return Tr([31-Number(e.value)])}}var Um=Object.freeze({float64:!0,mapSorter:Mm,quickEncodeToken:Nm});function Pm(){let e=[];return e[G.uint.major]=Sn,e[G.negint.major]=Qu,e[G.bytes.major]=ns,e[G.string.major]=lm,e[G.array.major]=Zu,e[G.map.major]=Yu,e[G.tag.major]=el,e[G.float.major]=rl,e}var Bm=Pm(),Rm=new Pd,kc=class Gd{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(`${Bd} object contains circular references`);return new Gd(r,t)}},Dr={null:new we(G.null,null),undefined:new we(G.undefined,void 0),true:new we(G.true,!0),false:new we(G.false,!1),emptyArray:new we(G.array,0),emptyMap:new we(G.map,0)},Zr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new we(G.float,e):e>=0?new we(G.uint,e):new we(G.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new we(G.uint,e):new we(G.negint,e)},Uint8Array(e,t,r,n){return new we(G.bytes,e)},string(e,t,r,n){return new we(G.string,e)},boolean(e,t,r,n){return e?Dr.true:Dr.false},null(e,t,r,n){return Dr.null},undefined(e,t,r,n){return Dr.undefined},ArrayBuffer(e,t,r,n){return new we(G.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new we(G.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Dr.emptyArray,new we(G.break)]:Dr.emptyArray;n=kc.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=Xo(a,r,n);return r.addBreakTokens?[new we(G.array,e.length),i,new we(G.break)]:[new we(G.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length,s;if(a){s=new Array(a),n=kc.createCheck(n,e);let u=!i&&r.ignoreUndefinedProperties,l=0;for(let f of o){let d=i?e.get(f):e[f];u&&d===void 0||(s[l++]=[Xo(f,r,n),Xo(d,r,n)])}l<a&&(s.length=l)}return s?.length?(Dm(s,r),r.addBreakTokens?[new we(G.map,s.length),s,new we(G.break)]:[new we(G.map,s.length),s]):r.addBreakTokens===!0?[Dr.emptyMap,new we(G.break)]:Dr.emptyMap}};Zr.Map=Zr.Object;Zr.Buffer=Zr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Zr[`${e}Array`]=Zr.DataView;function Xo(e,t={},r){let n=jg(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Zr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=Zr[n];if(!o)throw new Error(`${Bd} unsupported type: ${n}`);return o(e,n,t,r)}function Dm(e,t){t.mapSorter&&e.sort(t.mapSorter)}function Mm(e,t){if(e[0]instanceof we&&t[0]instanceof we){let r=e[0],n=t[0];return r._keyBytes||(r._keyBytes=$c(r.value)),n._keyBytes||(n._keyBytes=$c(n.value)),Ud(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function $c(e){return Lm(e,Bm,Um)}function Wd(e,t,r,n){if(Array.isArray(t))for(let i of t)Wd(e,i,r,n);else r[t.type.major](e,t,n)}var iN=G.uint.majorEncoded,oN=G.negint.majorEncoded,aN=G.bytes.majorEncoded,sN=G.string.majorEncoded,uN=G.array.majorEncoded,lN=G.float.majorEncoded|Dd,cN=G.float.majorEncoded|Md,fN=G.float.majorEncoded|Ld,dN=G.float.majorEncoded|Vd,pN=BigInt(-1),hN=BigInt(1);function Lm(e,t,r,n){let i=n instanceof Uint8Array,o=i?new Vg(n):Rm,a=Xo(e,r);if(!Array.isArray(a)&&r.quickEncodeToken){let s=r.quickEncodeToken(a);if(s)return i?(o.push(s),o.toBytes()):s;let u=t[a.type.major];if(u.encodedSize){let l=u.encodedSize(a,r);if(i||(o=new Pd(l)),u(o,a,r),o.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${a} was wrong`);return i?o.toBytes():Ju(o.chunks[0])}}return o.reset(),Wd(o,a,t,r),o.toBytes(!0)}var Vm={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Fm=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=mr[e];if(t===void 0){let r=le[e];if(!r)throw new Error(`${Ie} 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"),os=Symbol.for("BREAK");function zm(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=no(t,r);if(o===os){if(e.value===1/0)break;throw new Error(`${Ie} got unexpected break to lengthed array`)}if(o===ro)throw new Error(`${Ie} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function Km(e,t,r){let n=r.useMaps===!0,i=r.rejectDuplicateMapKeys===!0,o=n?void 0:{},a=n?new Map:void 0;for(let s=0;s<e.value;s++){let u=no(t,r);if(u===os){if(e.value===1/0)break;throw new Error(`${Ie} got unexpected break to lengthed map`)}if(u===ro)throw new Error(`${Ie} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(!n&&typeof u!="string")throw new Error(`${Ie} non-string keys not supported (got ${typeof u})`);if(i&&(n&&a.has(u)||!n&&Object.hasOwn(o,u)))throw new Error(`${Ie} found repeat map key "${u}"`);let l=no(t,r);if(l===ro)throw new Error(`${Ie} found map but not enough entries (got ${s} [no value], expected ${e.value})`);n?a.set(u,l):o[u]=l}return n?a:o}function no(e,t){if(e.done())return ro;let r=e.next();if(G.equals(r.type,G.break))return os;if(r.type.terminal)return r.value;if(G.equals(r.type,G.array))return zm(r,e,t);if(G.equals(r.type,G.map))return Km(r,e,t);if(G.equals(r.type,G.tag)){if(t.tags&&typeof t.tags[r.value]=="function"){let n=no(e,t);return t.tags[r.value](n)}throw new Error(`${Ie} tag not supported (${r.value})`)}throw new Error("unsupported")}function qm(e,t){if(!(e instanceof Uint8Array))throw new Error(`${Ie} data to decode must be a Uint8Array`);t=Object.assign({},Vm,t);let r=Ju(e),n=t.tokenizer||new Fm(r,t),i=no(n,t);if(i===ro)throw new Error(`${Ie} did not find any content to decode`);if(i===os)throw new Error(`${Ie} got unexpected break`);return[i,e.subarray(n.pos())]}function Gm(e,t){let[r,n]=qm(e,t);if(n.length>0)throw new Error(`${Ie} too many terminals, data makes no sense`);return r}var yN=new Uint8Array(0);function Wm(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 ol(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 Hm(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),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(_){if(_ instanceof Uint8Array||(ArrayBuffer.isView(_)?_=new Uint8Array(_.buffer,_.byteOffset,_.byteLength):Array.isArray(_)&&(_=Uint8Array.from(_))),!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(_.length===0)return"";for(var L=0,J=0,B=0,k=_.length;B!==k&&_[B]===0;)B++,L++;for(var F=(k-B)*f+1>>>0,q=new Uint8Array(F);B!==k;){for(var R=_[B],Q=0,K=F-1;(R!==0||Q<J)&&K!==-1;K--,Q++)R+=256*q[K]>>>0,q[K]=R%s>>>0,R=R/s>>>0;if(R!==0)throw new Error("Non-zero carry");J=Q,B++}for(var re=F-J;re!==F&&q[re]===0;)re++;for(var $=u.repeat(L);re<F;++re)$+=e.charAt(q[re]);return $}function I(_){if(typeof _!="string")throw new TypeError("Expected String");if(_.length===0)return new Uint8Array;var L=0;if(_[L]!==" "){for(var J=0,B=0;_[L]===u;)J++,L++;for(var k=(_.length-L)*l+1>>>0,F=new Uint8Array(k);_[L];){var q=r[_.charCodeAt(L)];if(q===255)return;for(var R=0,Q=k-1;(q!==0||R<B)&&Q!==-1;Q--,R++)q+=s*F[Q]>>>0,F[Q]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");B=R,L++}if(_[L]!==" "){for(var K=k-B;K!==k&&F[K]===0;)K++;for(var re=new Uint8Array(J+(k-K)),$=J;K!==k;)re[$++]=F[K++];return re}}}function E(_){var L=I(_);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:I,decode:E}}var Jm=Hm,Xm=Jm,Qm=Xm,Zm=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")}},Ym=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 Hd(this,e)}},eb=class{decoders;constructor(e){this.decoders=e}or(e){return Hd(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 Hd(e,t){return new eb({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var tb=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 Zm(e,t,r),this.decoder=new Ym(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Jd({name:e,prefix:t,encode:r,decode:n}){return new tb(e,t,r,n)}function as({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Qm(r,e);return Jd({prefix:t,name:e,encode:n,decode:o=>ol(i(o))})}function rb(e,t,r,n){let i=e.length;for(;e[i-1]==="=";)--i;let o=new Uint8Array(i*r/8|0),a=0,s=0,u=0;for(let l=0;l<i;++l){let f=t[e[l]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);s=s<<r|f,a+=r,a>=8&&(a-=8,o[u++]=255&s>>a)}if(a>=r||255&s<<8-a)throw new SyntaxError("Unexpected end of data");return o}function nb(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",a=0,s=0;for(let u=0;u<e.length;++u)for(s=s<<8|e[u],a+=8;a>r;)a-=r,o+=t[i&s>>a];if(a!==0&&(o+=t[i&s<<r-a]),n)for(;o.length*r&7;)o+="=";return o}function ib(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function $r({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=ib(n);return Jd({prefix:t,name:e,encode(o){return nb(o,n,r)},decode(o){return rb(o,i,r,e)}})}var Qo=$r({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),gN=$r({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),mN=$r({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),bN=$r({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),vN=$r({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),wN=$r({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),TN=$r({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),_N=$r({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),EN=$r({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Gs=as({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),xN=as({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Kr=as({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ON=as({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),ob=Xd,jc=128,ab=127,sb=~ab,ub=Math.pow(2,31);function Xd(e,t,r){t=t||[],r=r||0;for(var n=r;e>=ub;)t[r++]=e&255|jc,e/=128;for(;e&sb;)t[r++]=e&255|jc,e>>>=7;return t[r]=e|0,Xd.bytes=r-n+1,t}var lb=pu,cb=128,Cc=127;function pu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw pu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Cc)<<i:(a&Cc)*Math.pow(2,i),i+=7}while(a>=cb);return pu.bytes=o-n,r}var fb=Math.pow(2,7),db=Math.pow(2,14),pb=Math.pow(2,21),hb=Math.pow(2,28),yb=Math.pow(2,35),gb=Math.pow(2,42),mb=Math.pow(2,49),bb=Math.pow(2,56),vb=Math.pow(2,63),wb=function(e){return e<fb?1:e<db?2:e<pb?3:e<hb?4:e<yb?5:e<gb?6:e<mb?7:e<bb?8:e<vb?9:10},Tb={encode:ob,decode:lb,encodingLength:wb},_b=Tb,da=_b;function hu(e,t=0){return[da.decode(e,t),da.decode.bytes]}function pa(e,t,r=0){return da.encode(e,t,r),t}function ha(e){return da.encodingLength(e)}function Eb(e,t){let r=t.byteLength,n=ha(e),i=n+ha(r),o=new Uint8Array(i+r);return pa(e,o,0),pa(r,o,n),o.set(t,i),new al(e,r,t,o)}function xb(e){let t=ol(e),[r,n]=hu(t),[i,o]=hu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new al(r,i,a,t)}function Ob(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Wm(e.bytes,r.bytes)}}var al=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Nc(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return Sb(r,yu(e),t??Kr.encoder);default:return Ib(r,yu(e),t??Qo.encoder)}}var Uc=new WeakMap;function yu(e){let t=Uc.get(e);if(t==null){let r=new Map;return Uc.set(e,r),r}return t}var Qd=class pt{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!==Li)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==kb)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return pt.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=Eb(t,r);return pt.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 pt.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&Ob(t.multihash,n.multihash)}toString(t){return Nc(this,t)}toJSON(){return{"/":Nc(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 pt)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new pt(n,i,o,a??Pc(n,i,o.bytes))}else if(r[$b]===!0){let{version:n,multihash:i,code:o}=r,a=xb(i);return pt.create(n,o,a)}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!==Li)throw new Error(`Version 0 CID must use dag-pb (code: ${Li}) block encoding`);return new pt(t,r,n,n.bytes)}case 1:{let i=Pc(t,r,n.bytes);return new pt(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return pt.create(0,Li,t)}static createV1(t,r){return pt.create(1,t,r)}static decode(t){let[r,n]=pt.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=pt.inspectBytes(t),n=r.size-r.multihashSize,i=ol(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),a=new al(r.multihashCode,r.digestSize,o,i);return[r.version===0?pt.createV0(a):pt.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,I]=hu(t.subarray(r));return r+=I,d},i=n(),o=Li;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=Ab(t,r),o=pt.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return yu(o).set(n,t),o}};function Ab(e,t){switch(e[0]){case"Q":{let r=t??Kr;return[Kr.prefix,r.decode(`${Kr.prefix}${e}`)]}case Kr.prefix:{let r=t??Kr;return[Kr.prefix,r.decode(e)]}case Qo.prefix:{let r=t??Qo;return[Qo.prefix,r.decode(e)]}case Gs.prefix:{let r=t??Gs;return[Gs.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 Sb(e,t,r){let{prefix:n}=r;if(n!==Kr.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 Ib(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 Li=112,kb=18;function Pc(e,t,r){let n=ha(e),i=n+ha(t),o=new Uint8Array(i+r.byteLength);return pa(e,o,0),pa(t,o,n),o.set(r,i),o}var $b=Symbol.for("@ipld/js-cid/CID"),Zd=42;function jb(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Qd.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new we(G.tag,Zd),new we(G.bytes,r)]}function Cb(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Nb(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 Bc={float64:!0,typeEncoders:{Object:jb,undefined:Cb,number:Nb}},AN={...Bc,typeEncoders:{...Bc.typeEncoders}};function Ub(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Qd.decode(e.subarray(1))}var ya={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};ya.tags[Zd]=Ub;var SN={...ya,tags:ya.tags.slice()},Pb=e=>Gm(e,ya),IN=new Uint8Array(0);function Bb(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 sl(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 Rb(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),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(_){if(_ instanceof Uint8Array||(ArrayBuffer.isView(_)?_=new Uint8Array(_.buffer,_.byteOffset,_.byteLength):Array.isArray(_)&&(_=Uint8Array.from(_))),!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(_.length===0)return"";for(var L=0,J=0,B=0,k=_.length;B!==k&&_[B]===0;)B++,L++;for(var F=(k-B)*f+1>>>0,q=new Uint8Array(F);B!==k;){for(var R=_[B],Q=0,K=F-1;(R!==0||Q<J)&&K!==-1;K--,Q++)R+=256*q[K]>>>0,q[K]=R%s>>>0,R=R/s>>>0;if(R!==0)throw new Error("Non-zero carry");J=Q,B++}for(var re=F-J;re!==F&&q[re]===0;)re++;for(var $=u.repeat(L);re<F;++re)$+=e.charAt(q[re]);return $}function I(_){if(typeof _!="string")throw new TypeError("Expected String");if(_.length===0)return new Uint8Array;var L=0;if(_[L]!==" "){for(var J=0,B=0;_[L]===u;)J++,L++;for(var k=(_.length-L)*l+1>>>0,F=new Uint8Array(k);_[L];){var q=r[_.charCodeAt(L)];if(q===255)return;for(var R=0,Q=k-1;(q!==0||R<B)&&Q!==-1;Q--,R++)q+=s*F[Q]>>>0,F[Q]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");B=R,L++}if(_[L]!==" "){for(var K=k-B;K!==k&&F[K]===0;)K++;for(var re=new Uint8Array(J+(k-K)),$=J;K!==k;)re[$++]=F[K++];return re}}}function E(_){var L=I(_);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:I,decode:E}}var Db=Rb,Mb=Db,Lb=Mb,Vb=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")}},Fb=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,r){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Yd(this,e)}},zb=class{decoders;constructor(e){this.decoders=e}or(e){return Yd(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 Yd(e,t){return new zb({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Kb=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 Vb(e,t,r),this.decoder=new Fb(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function ep({name:e,prefix:t,encode:r,decode:n}){return new Kb(e,t,r,n)}function tp({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Lb(r,e);return ep({prefix:t,name:e,encode:n,decode:o=>sl(i(o))})}function qb(e,t,r,n){let i={};for(let f=0;f<t.length;++f)i[t[f]]=f;let o=e.length;for(;e[o-1]==="=";)--o;let a=new Uint8Array(o*r/8|0),s=0,u=0,l=0;for(let f=0;f<o;++f){let d=i[e[f]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|d,s+=r,s>=8&&(s-=8,a[l++]=255&u>>s)}if(s>=r||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a}function Gb(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",a=0,s=0;for(let u=0;u<e.length;++u)for(s=s<<8|e[u],a+=8;a>r;)a-=r,o+=t[i&s>>a];if(a!==0&&(o+=t[i&s<<r-a]),n)for(;o.length*r&7;)o+="=";return o}function jr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return ep({prefix:t,name:e,encode(i){return Gb(i,n,r)},decode(i){return qb(i,n,r,e)}})}var Zo=jr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),kN=jr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),$N=jr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),jN=jr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),CN=jr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),NN=jr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),UN=jr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),PN=jr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),BN=jr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),qr=tp({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),RN=tp({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Wb=rp,Rc=128,Hb=127,Jb=~Hb,Xb=Math.pow(2,31);function rp(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Xb;)t[r++]=e&255|Rc,e/=128;for(;e&Jb;)t[r++]=e&255|Rc,e>>>=7;return t[r]=e|0,rp.bytes=r-n+1,t}var Qb=gu,Zb=128,Dc=127;function gu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw gu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Dc)<<i:(a&Dc)*Math.pow(2,i),i+=7}while(a>=Zb);return gu.bytes=o-n,r}var Yb=Math.pow(2,7),ev=Math.pow(2,14),tv=Math.pow(2,21),rv=Math.pow(2,28),nv=Math.pow(2,35),iv=Math.pow(2,42),ov=Math.pow(2,49),av=Math.pow(2,56),sv=Math.pow(2,63),uv=function(e){return e<Yb?1:e<ev?2:e<tv?3:e<rv?4:e<nv?5:e<iv?6:e<ov?7:e<av?8:e<sv?9:10},lv={encode:Wb,decode:Qb,encodingLength:uv},cv=lv,ga=cv;function mu(e,t=0){return[ga.decode(e,t),ga.decode.bytes]}function ma(e,t,r=0){return ga.encode(e,t,r),t}function ba(e){return ga.encodingLength(e)}function fv(e,t){let r=t.byteLength,n=ba(e),i=n+ba(r),o=new Uint8Array(i+r);return ma(e,o,0),ma(r,o,n),o.set(t,i),new ul(e,r,t,o)}function bu(e){let t=sl(e),[r,n]=mu(t),[i,o]=mu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new ul(r,i,a,t)}function dv(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Bb(e.bytes,r.bytes)}}var ul=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Mc(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return hv(r,vu(e),t??qr.encoder);default:return yv(r,vu(e),t??Zo.encoder)}}var Lc=new WeakMap;function vu(e){let t=Lc.get(e);if(t==null){let r=new Map;return Lc.set(e,r),r}return t}var Vc=class ht{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!==Vi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==gv)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return ht.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=fv(t,r);return ht.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 ht.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&dv(t.multihash,n.multihash)}toString(t){return Mc(this,t)}toJSON(){return{"/":Mc(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 ht)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new ht(n,i,o,a??Fc(n,i,o.bytes))}else if(r[mv]===!0){let{version:n,multihash:i,code:o}=r,a=bu(i);return ht.create(n,o,a)}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!==Vi)throw new Error(`Version 0 CID must use dag-pb (code: ${Vi}) block encoding`);return new ht(t,r,n,n.bytes)}case 1:{let i=Fc(t,r,n.bytes);return new ht(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return ht.create(0,Vi,t)}static createV1(t,r){return ht.create(1,t,r)}static decode(t){let[r,n]=ht.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=ht.inspectBytes(t),n=r.size-r.multihashSize,i=sl(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),a=new ul(r.multihashCode,r.digestSize,o,i);return[r.version===0?ht.createV0(a):ht.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,I]=mu(t.subarray(r));return r+=I,d},i=n(),o=Vi;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=pv(t,r),o=ht.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return vu(o).set(n,t),o}};function pv(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 Zo.prefix:{let r=t??Zo;return[Zo.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function hv(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 yv(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 Vi=112,gv=18;function Fc(e,t,r){let n=ba(e),i=n+ba(t),o=new Uint8Array(i+r.byteLength);return ma(e,o,0),ma(t,o,n),o.set(r,i),o}var mv=Symbol.for("@ipld/js-cid/CID"),gn=mo(Hu(),1),Ws={SHA2_256:18,LENGTH:32,DAG_PB:112},bv=40;function va(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=gn.default.decode(e);return t.seek(gn.default.decode.bytes),r}function vv(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 wv(e){gn.default.decode(e);let t=gn.default.decode.bytes,r=gn.default.decode(e.subarray(gn.default.decode.bytes)),n=gn.default.decode.bytes;return t+n+r}var Hr={Null:e=>e===null?e:void 0,Int:e=>Number.isInteger(e)?e:void 0,Float:e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,String:e=>typeof e=="string"?e:void 0,Bool:e=>typeof e=="boolean"?e:void 0,Bytes:e=>e instanceof Uint8Array?e:void 0,Link:e=>e!==null&&typeof e=="object"&&e.asCID===e?e:void 0,List:e=>Array.isArray(e)?e:void 0,Map:e=>e!==null&&typeof e=="object"&&e.asCID!==e&&!Array.isArray(e)&&!(e instanceof Uint8Array)?e:void 0},Wi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Hr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Hr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Wi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Wi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Hr.Int,CarV1HeaderOrV2Pragma:e=>{if(Hr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,a]=t[i];switch(o){case"roots":{let s=Wi["CarV1HeaderOrV2Pragma > roots (anon)"](e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=Wi.Int(e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},Hi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Hr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Hr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Hi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Hi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Hr.Int,CarV1HeaderOrV2Pragma:e=>{if(Hr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,a]=t[i];switch(o){case"roots":{let s=Hi["CarV1HeaderOrV2Pragma > roots (anon)"](a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=Hi.Int(a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},Tv={toTyped:Wi.CarV1HeaderOrV2Pragma,toRepresentation:Hi.CarV1HeaderOrV2Pragma},_v=["string","number","bigint","symbol"],Ev=["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 xv(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return _v.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":Ov(e)?"Buffer":Av(e)||"Object"}function Ov(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function Av(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Ev.includes(t))return t}var Z=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}};Z.uint=new Z(0,"uint",!0);Z.negint=new Z(1,"negint",!0);Z.bytes=new Z(2,"bytes",!0);Z.string=new Z(3,"string",!0);Z.array=new Z(4,"array",!1);Z.map=new Z(5,"map",!1);Z.tag=new Z(6,"tag",!1);Z.float=new Z(7,"float",!0);Z.false=new Z(7,"false",!0);Z.true=new Z(7,"true",!0);Z.null=new Z(7,"null",!0);Z.undefined=new Z(7,"undefined",!0);Z.break=new Z(7,"break",!0);var ve=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}`}},pi=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Sv=new TextDecoder,Iv=new TextEncoder;function wa(e){return pi&&globalThis.Buffer.isBuffer(e)}function kv(e){return e instanceof Uint8Array?wa(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var $v=pi?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Kc(e,t,r):(e,t,r)=>r-t>64?Sv.decode(e.subarray(t,r)):Kc(e,t,r),jv=pi?e=>e.length>64?globalThis.Buffer.from(e):zc(e):e=>e.length>64?Iv.encode(e):zc(e),ll=pi?(e,t,r)=>wa(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Cv=pi?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),kv(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},Nv=pi?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Uv(e,t){if(wa(e)&&wa(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 zc(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 Kc(e,t,r){let n=[];for(;t<r;){let i=e[t],o=null,a=i>239?4:i>223?3:i>191?2:1;if(t+a<=r){let s,u,l,f;switch(a){case 1:i<128&&(o=i);break;case 2:s=e[t+1],(s&192)===128&&(f=(i&31)<<6|s&63,f>127&&(o=f));break;case 3:s=e[t+1],u=e[t+2],(s&192)===128&&(u&192)===128&&(f=(i&15)<<12|(s&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:s=e[t+1],u=e[t+2],l=e[t+3],(s&192)===128&&(u&192)===128&&(l&192)===128&&(f=(i&15)<<18|(s&63)<<12|(u&63)<<6|l&63,f>65535&&f<1114112&&(o=f))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),t+=a}return Pv(n)}var qc=4096;function Pv(e){let t=e.length;if(t<=qc)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=qc));return r}var Bv=256,Rv=class{constructor(e=Bv){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 r=t.length-(this.maxCursor-this.cursor)-1;t.set(e,r)}else{if(t){let r=t.length-(this.maxCursor-this.cursor)-1;r<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,r),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=Nv(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=ll(r,0,this.cursor)}else t=Cv(this.chunks,this.cursor);return e&&this.reset(),t}},qe="CBOR decode error:",np="CBOR encode error:",_o=[];_o[23]=1;_o[24]=2;_o[25]=3;_o[26]=5;_o[27]=9;function hi(e,t,r){if(e.length-t<r)throw new Error(`${qe} not enough data for type`)}var ut=[24,256,65536,4294967296,BigInt("18446744073709551616")];function In(e,t,r){hi(e,t,1);let n=e[t];if(r.strict===!0&&n<ut[0])throw new Error(`${qe} integer encoded in more bytes than necessary (strict decode)`);return n}function kn(e,t,r){hi(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<ut[1])throw new Error(`${qe} integer encoded in more bytes than necessary (strict decode)`);return n}function $n(e,t,r){hi(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<ut[2])throw new Error(`${qe} integer encoded in more bytes than necessary (strict decode)`);return n}function jn(e,t,r){hi(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<ut[3])throw new Error(`${qe} 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(`${qe} integers outside of the safe integer range are not supported`)}function Dv(e,t,r,n){return new ve(Z.uint,In(e,t+1,n),2)}function Mv(e,t,r,n){return new ve(Z.uint,kn(e,t+1,n),3)}function Lv(e,t,r,n){return new ve(Z.uint,$n(e,t+1,n),5)}function Vv(e,t,r,n){return new ve(Z.uint,jn(e,t+1,n),9)}function Cn(e,t){return Wt(e,0,t.value)}function Wt(e,t,r){if(r<ut[0]){let n=Number(r);e.push([t|n])}else if(r<ut[1]){let n=Number(r);e.push([t|24,n])}else if(r<ut[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<ut[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<ut[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=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]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,e.push(i)}else throw new Error(`${qe} encountered BigInt larger than allowable range`)}}Cn.encodedSize=function(e){return Wt.encodedSize(e.value)};Wt.encodedSize=function(e){return e<ut[0]?1:e<ut[1]?2:e<ut[2]?3:e<ut[3]?5:9};Cn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function Fv(e,t,r,n){return new ve(Z.negint,-1-In(e,t+1,n),2)}function zv(e,t,r,n){return new ve(Z.negint,-1-kn(e,t+1,n),3)}function Kv(e,t,r,n){return new ve(Z.negint,-1-$n(e,t+1,n),5)}var cl=BigInt(-1),ip=BigInt(1);function qv(e,t,r,n){let i=jn(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ve(Z.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${qe} integers outside of the safe integer range are not supported`);return new ve(Z.negint,cl-BigInt(i),9)}function fl(e,t){let r=t.value,n=typeof r=="bigint"?r*cl-ip:r*-1-1;Wt(e,t.type.majorEncoded,n)}fl.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*cl-ip:t*-1-1;return r<ut[0]?1:r<ut[1]?2:r<ut[2]?3:r<ut[3]?5:9};fl.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Eo(e,t,r,n){hi(e,t,r+n);let i=ll(e,t+r,t+r+n);return new ve(Z.bytes,i,r+n)}function Gv(e,t,r,n){return Eo(e,t,1,r)}function Wv(e,t,r,n){return Eo(e,t,2,In(e,t+1,n))}function Hv(e,t,r,n){return Eo(e,t,3,kn(e,t+1,n))}function Jv(e,t,r,n){return Eo(e,t,5,$n(e,t+1,n))}function Xv(e,t,r,n){let i=jn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${qe} 64-bit integer bytes lengths not supported`);return Eo(e,t,9,i)}function Ta(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===Z.string?jv(e.value):e.value),e.encodedBytes}function ss(e,t){let r=Ta(t);Wt(e,t.type.majorEncoded,r.length),e.push(r)}ss.encodedSize=function(e){let t=Ta(e);return Wt.encodedSize(t.length)+t.length};ss.compareTokens=function(e,t){return Qv(Ta(e),Ta(t))};function Qv(e,t){return e.length<t.length?-1:e.length>t.length?1:Uv(e,t)}function xo(e,t,r,n,i){let o=r+n;hi(e,t,o);let a=new ve(Z.string,$v(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=ll(e,t+r,t+o)),a}function Zv(e,t,r,n){return xo(e,t,1,r,n)}function Yv(e,t,r,n){return xo(e,t,2,In(e,t+1,n),n)}function e0(e,t,r,n){return xo(e,t,3,kn(e,t+1,n),n)}function t0(e,t,r,n){return xo(e,t,5,$n(e,t+1,n),n)}function r0(e,t,r,n){let i=jn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${qe} 64-bit integer string lengths not supported`);return xo(e,t,9,i,n)}var n0=ss;function yi(e,t,r,n){return new ve(Z.array,n,r)}function i0(e,t,r,n){return yi(e,t,1,r)}function o0(e,t,r,n){return yi(e,t,2,In(e,t+1,n))}function a0(e,t,r,n){return yi(e,t,3,kn(e,t+1,n))}function s0(e,t,r,n){return yi(e,t,5,$n(e,t+1,n))}function u0(e,t,r,n){let i=jn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${qe} 64-bit integer array lengths not supported`);return yi(e,t,9,i)}function l0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${qe} indefinite length items not allowed`);return yi(e,t,1,1/0)}function dl(e,t){Wt(e,Z.array.majorEncoded,t.value)}dl.compareTokens=Cn.compareTokens;dl.encodedSize=function(e){return Wt.encodedSize(e.value)};function gi(e,t,r,n){return new ve(Z.map,n,r)}function c0(e,t,r,n){return gi(e,t,1,r)}function f0(e,t,r,n){return gi(e,t,2,In(e,t+1,n))}function d0(e,t,r,n){return gi(e,t,3,kn(e,t+1,n))}function p0(e,t,r,n){return gi(e,t,5,$n(e,t+1,n))}function h0(e,t,r,n){let i=jn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${qe} 64-bit integer map lengths not supported`);return gi(e,t,9,i)}function y0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${qe} indefinite length items not allowed`);return gi(e,t,1,1/0)}function pl(e,t){Wt(e,Z.map.majorEncoded,t.value)}pl.compareTokens=Cn.compareTokens;pl.encodedSize=function(e){return Wt.encodedSize(e.value)};function g0(e,t,r,n){return new ve(Z.tag,r,1)}function m0(e,t,r,n){return new ve(Z.tag,In(e,t+1,n),2)}function b0(e,t,r,n){return new ve(Z.tag,kn(e,t+1,n),3)}function v0(e,t,r,n){return new ve(Z.tag,$n(e,t+1,n),5)}function w0(e,t,r,n){return new ve(Z.tag,jn(e,t+1,n),9)}function hl(e,t){Wt(e,Z.tag.majorEncoded,t.value)}hl.compareTokens=Cn.compareTokens;hl.encodedSize=function(e){return Wt.encodedSize(e.value)};var T0=20,_0=21,E0=22,x0=23;function O0(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${qe} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ve(Z.null,null,1):new ve(Z.undefined,void 0,1)}function A0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${qe} indefinite length items not allowed`);return new ve(Z.break,void 0,1)}function yl(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${qe} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${qe} Infinity values are not supported`)}return new ve(Z.float,e,t)}function S0(e,t,r,n){return yl(ml(e,t+1),3,n)}function I0(e,t,r,n){return yl(bl(e,t+1),5,n)}function k0(e,t,r,n){return yl(up(e,t+1),9,n)}function gl(e,t,r){let n=t.value;if(n===!1)e.push([Z.float.majorEncoded|T0]);else if(n===!0)e.push([Z.float.majorEncoded|_0]);else if(n===null)e.push([Z.float.majorEncoded|E0]);else if(n===void 0)e.push([Z.float.majorEncoded|x0]);else{let i,o=!1;(!r||r.float64!==!0)&&(ap(n),i=ml(Yt,1),n===i||Number.isNaN(n)?(Yt[0]=249,e.push(Yt.slice(0,3)),o=!0):(sp(n),i=bl(Yt,1),n===i&&(Yt[0]=250,e.push(Yt.slice(0,5)),o=!0))),o||($0(n),i=up(Yt,1),Yt[0]=251,e.push(Yt.slice(0,9)))}}gl.encodedSize=function(e,t){let r=e.value;if(r===!1||r===!0||r===null||r===void 0)return 1;if(!t||t.float64!==!0){ap(r);let n=ml(Yt,1);if(r===n||Number.isNaN(r))return 3;if(sp(r),n=bl(Yt,1),r===n)return 5}return 9};var op=new ArrayBuffer(9),Ct=new DataView(op,1),Yt=new Uint8Array(op,0);function ap(e){if(e===1/0)Ct.setUint16(0,31744,!1);else if(e===-1/0)Ct.setUint16(0,64512,!1);else if(Number.isNaN(e))Ct.setUint16(0,32256,!1);else{Ct.setFloat32(0,e);let t=Ct.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Ct.setUint16(0,31744,!1);else if(r===0)Ct.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Ct.setUint16(0,0):i<-14?Ct.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):Ct.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function ml(e,t){if(e.length-t<2)throw new Error(`${qe} 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 sp(e){Ct.setFloat32(0,e,!1)}function bl(e,t){if(e.length-t<4)throw new Error(`${qe} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function $0(e){Ct.setFloat64(0,e,!1)}function up(e,t){if(e.length-t<8)throw new Error(`${qe} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}gl.compareTokens=Cn.compareTokens;function Ue(e,t,r){throw new Error(`${qe} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function us(e){return()=>{throw new Error(`${qe} ${e}`)}}var de=[];for(let e=0;e<=23;e++)de[e]=Ue;de[24]=Dv;de[25]=Mv;de[26]=Lv;de[27]=Vv;de[28]=Ue;de[29]=Ue;de[30]=Ue;de[31]=Ue;for(let e=32;e<=55;e++)de[e]=Ue;de[56]=Fv;de[57]=zv;de[58]=Kv;de[59]=qv;de[60]=Ue;de[61]=Ue;de[62]=Ue;de[63]=Ue;for(let e=64;e<=87;e++)de[e]=Gv;de[88]=Wv;de[89]=Hv;de[90]=Jv;de[91]=Xv;de[92]=Ue;de[93]=Ue;de[94]=Ue;de[95]=us("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)de[e]=Zv;de[120]=Yv;de[121]=e0;de[122]=t0;de[123]=r0;de[124]=Ue;de[125]=Ue;de[126]=Ue;de[127]=us("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)de[e]=i0;de[152]=o0;de[153]=a0;de[154]=s0;de[155]=u0;de[156]=Ue;de[157]=Ue;de[158]=Ue;de[159]=l0;for(let e=160;e<=183;e++)de[e]=c0;de[184]=f0;de[185]=d0;de[186]=p0;de[187]=h0;de[188]=Ue;de[189]=Ue;de[190]=Ue;de[191]=y0;for(let e=192;e<=215;e++)de[e]=g0;de[216]=m0;de[217]=b0;de[218]=v0;de[219]=w0;de[220]=Ue;de[221]=Ue;de[222]=Ue;de[223]=Ue;for(let e=224;e<=243;e++)de[e]=us("simple values are not supported");de[244]=Ue;de[245]=Ue;de[246]=Ue;de[247]=O0;de[248]=us("simple values are not supported");de[249]=S0;de[250]=I0;de[251]=k0;de[252]=Ue;de[253]=Ue;de[254]=Ue;de[255]=A0;var Cr=[];for(let e=0;e<24;e++)Cr[e]=new ve(Z.uint,e,1);for(let e=-1;e>=-24;e--)Cr[31-e]=new ve(Z.negint,e,1);Cr[64]=new ve(Z.bytes,new Uint8Array(0),1);Cr[96]=new ve(Z.string,"",1);Cr[128]=new ve(Z.array,0,1);Cr[160]=new ve(Z.map,0,1);Cr[244]=new ve(Z.false,!1,1);Cr[245]=new ve(Z.true,!0,1);Cr[246]=new ve(Z.null,null,1);function lp(){let e=[];return e[Z.uint.major]=Cn,e[Z.negint.major]=fl,e[Z.bytes.major]=ss,e[Z.string.major]=n0,e[Z.array.major]=dl,e[Z.map.major]=pl,e[Z.tag.major]=hl,e[Z.float.major]=gl,e}var DN=lp(),MN=new Rv,Gc=class cp{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(`${np} object contains circular references`);return new cp(r,t)}},Mr={null:new ve(Z.null,null),undefined:new ve(Z.undefined,void 0),true:new ve(Z.true,!0),false:new ve(Z.false,!1),emptyArray:new ve(Z.array,0),emptyMap:new ve(Z.map,0)},Yr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ve(Z.float,e):e>=0?new ve(Z.uint,e):new ve(Z.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ve(Z.uint,e):new ve(Z.negint,e)},Uint8Array(e,t,r,n){return new ve(Z.bytes,e)},string(e,t,r,n){return new ve(Z.string,e)},boolean(e,t,r,n){return e?Mr.true:Mr.false},null(e,t,r,n){return Mr.null},undefined(e,t,r,n){return Mr.undefined},ArrayBuffer(e,t,r,n){return new ve(Z.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ve(Z.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Mr.emptyArray,new ve(Z.break)]:Mr.emptyArray;n=Gc.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=Hs(a,r,n);return r.addBreakTokens?[new ve(Z.array,e.length),i,new ve(Z.break)]:[new ve(Z.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length;if(!a)return r.addBreakTokens===!0?[Mr.emptyMap,new ve(Z.break)]:Mr.emptyMap;n=Gc.createCheck(n,e);let s=[],u=0;for(let l of o)s[u++]=[Hs(l,r,n),Hs(i?e.get(l):e[l],r,n)];return j0(s,r),r.addBreakTokens?[new ve(Z.map,a),s,new ve(Z.break)]:[new ve(Z.map,a),s]}};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 Hs(e,t={},r){let n=xv(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Yr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=Yr[n];if(!o)throw new Error(`${np} unsupported type: ${n}`);return o(e,n,t,r)}function j0(e,t){t.mapSorter&&e.sort(t.mapSorter)}var LN=Symbol.for("DONE"),VN=Symbol.for("BREAK"),FN=lp(),zN=mo(Hu(),1),KN=[new ve(Z.map,2),new ve(Z.string,"version"),new ve(Z.uint,1),new ve(Z.string,"roots")],qN=new ve(Z.tag,42);async function fp(e,t){let r=va(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=Pb(n);if(Tv.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=vv(await e.exactly(bv,!0));e.seek(o.dataOffset-e.pos);let a=await fp(e,1);return Object.assign(a,o)}async function C0(e){let t=await e.exactly(2,!1);if(t[0]===Ws.SHA2_256&&t[1]===Ws.LENGTH){let a=await e.exactly(34,!0),s=bu(a);return Vc.create(0,Ws.DAG_PB,s)}let r=va(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=va(await e.upTo(8),e),i=await e.exactly(wv(await e.upTo(8)),!0),o=bu(i);return Vc.create(r,n,o)}async function dp(e){let t=e.pos,r=va(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await C0(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function N0(e){let{cid:t,blockLength:r}=await dp(e);return{bytes:await e.exactly(r,!0),cid:t}}async function U0(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await dp(e),o={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(o.blockLength),o}function P0(e){let t=(async()=>{let r=await fp(e);if(r.version===2){let n=e.pos-r.dataOffset;e=M0(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await N0(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await U0(e)}}}function B0(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 R0(e){let t=0,r=0,n=0,i=new Uint8Array(0),o=async a=>{r=i.length-n;let s=[i.subarray(n)];for(;r<a;){let l=await e();if(l==null)break;r<0?l.length>r&&s.push(l.subarray(-r)):s.push(l),r+=l.length}i=new Uint8Array(s.reduce((l,f)=>l+f.length,0));let u=0;for(let l of s)i.set(l,u),u+=l.length;n=0};return{async upTo(a){return i.length-n<a&&await o(a),i.subarray(n,n+Math.min(i.length-n,a))},async exactly(a,s=!1){if(i.length-n<a&&await o(a),i.length-n<a)throw new Error("Unexpected end of data");let u=i.subarray(n,n+a);return s&&(t+=a,n+=a),u},seek(a){t+=a,n+=a},get pos(){return t}}}function D0(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return R0(r)}function M0(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 pp=class{constructor(e,t){this._header=e,this._blocks=t,this._keys=t.map(r=>r.cid.toString())}get version(){return this._header.version}async getRoots(){return this._header.roots}async has(e){return this._keys.indexOf(e.toString())>-1}async get(e){let t=this._keys.indexOf(e.toString());return t>-1?this._blocks[t]:void 0}async*blocks(){for(let e of this._blocks)yield e}async*cids(){for(let e of this._blocks)yield e.cid}static async fromBytes(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Wc(B0(e))}static async fromIterable(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Wc(D0(e))}};async function Wc(e){let t=P0(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new pp(r,n)}var GN=mo(Hu(),1),L0={0:"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'",1:function(e,t){return"Cannot apply '"+e+"' to '"+t.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(e,t){return"[mobx.array] Index out of bounds, "+e+" is larger than "+t},18:"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js",19:function(e){return"Cannot initialize from classes that inherit from Map: "+e.constructor.name},20:function(e){return"Cannot initialize map from "+e},21:function(e){return"Cannot convert to map from '"+e+"'"},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(e){return"Cannot obtain administration from "+e},25:function(e,t){return"the entry '"+e+"' does not exist in the observable map '"+t+"'"},26:"please specify a property",27:function(e,t){return"no observable property '"+e.toString()+"' found on the observable object '"+t+"'"},28:function(e){return"Cannot obtain atom from "+e},29:"Expecting some object",30:"invalid action stack. did you forget to finish an action?",31:"missing option for computed: get",32:function(e,t){return"Cycle detected in computation "+e+": "+t},33:function(e){return"The setter of computed value '"+e+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"},34:function(e){return"[ComputedValue '"+e+"'] 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(e){return"[mobx] `observableArray."+e+"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice()."+e+"()` instead"},38:"'ownKeys()' can only be used on observable objects",39:"'defineProperty()' can only be used on observable objects"},V0=L0;function he(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:V0[e];throw typeof i=="function"&&(i=i.apply(null,r)),new Error("[MobX] "+i)}var F0={};function ls(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:F0}var hp=Object.assign,_a=Object.getOwnPropertyDescriptor,pr=Object.defineProperty,Oo=Object.prototype,Ea=[];Object.freeze(Ea);var vl={};Object.freeze(vl);var z0=typeof Proxy<"u",K0=Object.toString();function yp(){z0||he("`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`")}function Fi(e){Y.verifyProxies&&he("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+e)}function Ht(){return++Y.mobxGuid}function wl(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Yn=function(){};function We(e){return typeof e=="function"}function bn(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function cs(e){return e!==null&&typeof e=="object"}function sr(e){if(!cs(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()===K0}function gp(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function fs(e,t,r){pr(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function mp(e,t,r){pr(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function on(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(n){return cs(n)&&n[r]===!0}}function mi(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function q0(e){var t=Object.getPrototypeOf(e),r=Object.getPrototypeOf(t),n=Object.getPrototypeOf(r);return n===null}function Er(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var bp=typeof Object.getOwnPropertySymbols<"u";function G0(e){var t=Object.keys(e);if(!bp)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return Oo.propertyIsEnumerable.call(e,n)})):t}var ds=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:bp?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function wu(e){return typeof e=="string"?e:typeof e=="symbol"?e.toString():new String(e).toString()}function vp(e){return e===null?null:typeof e=="object"?""+e:e}function Vt(e,t){return Oo.hasOwnProperty.call(e,t)}var W0=Object.getOwnPropertyDescriptors||function(e){var t={};return ds(e).forEach(function(r){t[r]=_a(e,r)}),t};function Et(e,t){return!!(e&t)}function xt(e,t,r){return r?e|=t:e&=~t,e}function Hc(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 Jc(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,J0(n.key),n)}}function bi(e,t,r){return t&&Jc(e.prototype,t),r&&Jc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ei(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=X0(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 Sr(){return Sr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Sr.apply(null,arguments)}function wp(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Tu(e,t)}function Tu(e,t){return Tu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Tu(e,t)}function H0(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 J0(e){var t=H0(e,"string");return typeof t=="symbol"?t:t+""}function X0(e,t){if(e){if(typeof e=="string")return Hc(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)?Hc(e,t):void 0}}var _t=Symbol("mobx-stored-annotations");function hr(e){function t(r,n){if(So(n))return e.decorate_20223_(r,n);Ao(r,n,e)}return Object.assign(t,e)}function Ao(e,t,r){if(Vt(e,_t)||fs(e,_t,Sr({},e[_t])),xa(r)&&!Vt(e[_t],t)){var n=e.constructor.name+".prototype."+t.toString();he("'"+n+"' is decorated with 'override', but no such decorated member was found on prototype.")}Q0(e,r,t),xa(r)||(e[_t][t]=r)}function Q0(e,t,r){if(!xa(t)&&Vt(e[_t],r)){var n=e.constructor.name+".prototype."+r.toString(),i=e[_t][r].annotationType_,o=t.annotationType_;he("Cannot apply '@"+o+"' to '"+n+"':"+(`
1
+ import{e as Gs}from"./chunk-BKKH6BET.min.js";var vg=Object.create,Nd=Object.defineProperty,wg=Object.getOwnPropertyDescriptor,Tg=Object.getOwnPropertyNames,_g=Object.getPrototypeOf,Eg=Object.prototype.hasOwnProperty,li=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),xg=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Tg(t))!Eg.call(e,i)&&i!==r&&Nd(e,i,{get:()=>t[i],enumerable:!(n=wg(t,i))||n.enumerable});return e},mo=(e,t,r)=>(r=e!=null?vg(_g(e)):{},xg(t||!e||!e.__esModule?Nd(r,"default",{value:e,enumerable:!0}):r,e)),Og=li((e,t)=>{"use strict";t.exports=a;var r=128,n=127,i=~n,o=Math.pow(2,31);function a(s,u,l){if(Number.MAX_SAFE_INTEGER&&s>Number.MAX_SAFE_INTEGER)throw a.bytes=0,new RangeError("Could not encode varint");u=u||[],l=l||0;for(var f=l;s>=o;)u[l++]=s&255|r,s/=128;for(;s&i;)u[l++]=s&255|r,s>>>=7;return u[l]=s|0,a.bytes=l-f+1,u}}),Ag=li((e,t)=>{"use strict";t.exports=i;var r=128,n=127;function i(o,u){var s=0,u=u||0,l=0,f=u,d,I=o.length;do{if(f>=I||l>49)throw i.bytes=0,new RangeError("Could not decode varint");d=o[f++],s+=l<28?(d&n)<<l:(d&n)*Math.pow(2,l),l+=7}while(d>=r);return i.bytes=f-u,s}}),Sg=li((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),a=Math.pow(2,35),s=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),f=Math.pow(2,63);t.exports=function(d){return d<r?1:d<n?2:d<i?3:d<o?4:d<a?5:d<s?6:d<u?7:d<l?8:d<f?9:10}}),Hu=li((e,t)=>{"use strict";t.exports={encode:Og(),decode:Ag(),encodingLength:Sg()}}),Ig=li(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},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")),a=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=a}),kg=li((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(s){return function(u){return function(l,f){var d={key:l,value:u[l]},I={key:f,value:u[f]};return s(d,I)}}}(n.cmp),a=[];return function s(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 l,f;if(Array.isArray(u)){for(f="[",l=0;l<u.length;l++)l&&(f+=","),f+=s(u[l])||"null";return f+"]"}if(u===null)return"null";if(a.indexOf(u)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var d=a.push(u)-1,I=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<I.length;l++){var E=I[l],_=s(u[E]);_&&(f&&(f+=","),f+=JSON.stringify(E)+":"+_)}return a.splice(d,1),"{"+f+"}"}}(r)}}),$g=["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 jg(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return t==="string"||t==="number"||t==="bigint"||t==="symbol"?t:t==="function"?"Function":Array.isArray(e)?"Array":e instanceof Uint8Array?"Uint8Array":e.constructor===Object?"Object":Cg(e)||"Object"}function Cg(e){let t=Object.prototype.toString.call(e).slice(8,-1);if($g.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 we=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}`}},bo=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Ng=new TextEncoder;function ca(e){return bo&&globalThis.Buffer.isBuffer(e)}function Ju(e){return e instanceof Uint8Array?ca(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Ug=24,Pg=200,Bg=bo?e=>e.length>=Ug?globalThis.Buffer.from(e):Sc(e):e=>e.length>=Pg?Ng.encode(e):Sc(e),Tr=e=>Uint8Array.from(e),Rg=bo?(e,t,r)=>ca(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Dg=bo?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Ju(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},Mg=bo?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Ud(e,t){if(ca(e)&&ca(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 Sc(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 Lg=256,Pd=class{constructor(e=Lg){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 r=t.length-(this.maxCursor-this.cursor)-1;t.set(e,r)}else{if(t){let r=t.length-(this.maxCursor-this.cursor)-1;r<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,r),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=Mg(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=Rg(r,0,this.cursor)}else t=Dg(this.chunks,this.cursor);return e&&this.reset(),t}},Vg=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}},Ie="CBOR decode error:",Bd="CBOR encode error:",vo=[];vo[23]=1;vo[24]=2;vo[25]=3;vo[26]=5;vo[27]=9;function ci(e,t,r){if(e.length-t<r)throw new Error(`${Ie} not enough data for type`)}var st=[24,256,65536,4294967296,BigInt("18446744073709551616")];function En(e,t,r){ci(e,t,1);let n=e[t];if(r.strict===!0&&n<st[0])throw new Error(`${Ie} integer encoded in more bytes than necessary (strict decode)`);return n}function xn(e,t,r){ci(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<st[1])throw new Error(`${Ie} integer encoded in more bytes than necessary (strict decode)`);return n}function On(e,t,r){ci(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<st[2])throw new Error(`${Ie} integer encoded in more bytes than necessary (strict decode)`);return n}function An(e,t,r){ci(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<st[3])throw new Error(`${Ie} 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(`${Ie} integers outside of the safe integer range are not supported`)}function Fg(e,t,r,n){return new we(q.uint,En(e,t+1,n),2)}function zg(e,t,r,n){return new we(q.uint,xn(e,t+1,n),3)}function Kg(e,t,r,n){return new we(q.uint,On(e,t+1,n),5)}function Gg(e,t,r,n){return new we(q.uint,An(e,t+1,n),9)}function Sn(e,t){return qt(e,0,t.value)}function qt(e,t,r){if(r<st[0]){let n=Number(r);e.push([t|n])}else if(r<st[1]){let n=Number(r);e.push([t|24,n])}else if(r<st[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<st[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<st[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=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]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,e.push(i)}else throw new Error(`${Ie} encountered BigInt larger than allowable range`)}}Sn.encodedSize=function(e){return qt.encodedSize(e.value)};qt.encodedSize=function(e){return e<st[0]?1:e<st[1]?2:e<st[2]?3:e<st[3]?5:9};Sn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function qg(e,t,r,n){return new we(q.negint,-1-En(e,t+1,n),2)}function Wg(e,t,r,n){return new we(q.negint,-1-xn(e,t+1,n),3)}function Hg(e,t,r,n){return new we(q.negint,-1-On(e,t+1,n),5)}var Xu=BigInt(-1),Rd=BigInt(1);function Jg(e,t,r,n){let i=An(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new we(q.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Ie} integers outside of the safe integer range are not supported`);return new we(q.negint,Xu-BigInt(i),9)}function Qu(e,t){let r=t.value,n=typeof r=="bigint"?r*Xu-Rd:r*-1-1;qt(e,t.type.majorEncoded,n)}Qu.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*Xu-Rd:t*-1-1;return r<st[0]?1:r<st[1]?2:r<st[2]?3:r<st[3]?5:9};Qu.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function wo(e,t,r,n){ci(e,t,r+n);let i=e.slice(t+r,t+r+n);return new we(q.bytes,i,r+n)}function Xg(e,t,r,n){return wo(e,t,1,r)}function Qg(e,t,r,n){return wo(e,t,2,En(e,t+1,n))}function Zg(e,t,r,n){return wo(e,t,3,xn(e,t+1,n))}function Yg(e,t,r,n){return wo(e,t,5,On(e,t+1,n))}function em(e,t,r,n){let i=An(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ie} 64-bit integer bytes lengths not supported`);return wo(e,t,9,i)}function fa(e){return e.encodedBytes===void 0&&(e.encodedBytes=q.equals(e.type,q.string)?Bg(e.value):e.value),e.encodedBytes}function ns(e,t){let r=fa(t);qt(e,t.type.majorEncoded,r.length),e.push(r)}ns.encodedSize=function(e){let t=fa(e);return qt.encodedSize(t.length)+t.length};ns.compareTokens=function(e,t){return tm(fa(e),fa(t))};function tm(e,t){return e.length<t.length?-1:e.length>t.length?1:Ud(e,t)}var Ic=new TextDecoder,rm=32;function nm(e,t,r){if(r-t<rm){let n="";for(let i=t;i<r;i++){let o=e[i];if(o&128)return Ic.decode(e.subarray(t,r));n+=String.fromCharCode(o)}return n}return Ic.decode(e.subarray(t,r))}function To(e,t,r,n,i){let o=r+n;ci(e,t,o);let a=new we(q.string,nm(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=e.slice(t+r,t+o)),a}function im(e,t,r,n){return To(e,t,1,r,n)}function om(e,t,r,n){return To(e,t,2,En(e,t+1,n),n)}function am(e,t,r,n){return To(e,t,3,xn(e,t+1,n),n)}function sm(e,t,r,n){return To(e,t,5,On(e,t+1,n),n)}function um(e,t,r,n){let i=An(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ie} 64-bit integer string lengths not supported`);return To(e,t,9,i,n)}var lm=ns;function fi(e,t,r,n){return new we(q.array,n,r)}function cm(e,t,r,n){return fi(e,t,1,r)}function fm(e,t,r,n){return fi(e,t,2,En(e,t+1,n))}function dm(e,t,r,n){return fi(e,t,3,xn(e,t+1,n))}function pm(e,t,r,n){return fi(e,t,5,On(e,t+1,n))}function hm(e,t,r,n){let i=An(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ie} 64-bit integer array lengths not supported`);return fi(e,t,9,i)}function ym(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ie} indefinite length items not allowed`);return fi(e,t,1,1/0)}function Zu(e,t){qt(e,q.array.majorEncoded,t.value)}Zu.compareTokens=Sn.compareTokens;Zu.encodedSize=function(e){return qt.encodedSize(e.value)};function di(e,t,r,n){return new we(q.map,n,r)}function gm(e,t,r,n){return di(e,t,1,r)}function mm(e,t,r,n){return di(e,t,2,En(e,t+1,n))}function bm(e,t,r,n){return di(e,t,3,xn(e,t+1,n))}function vm(e,t,r,n){return di(e,t,5,On(e,t+1,n))}function wm(e,t,r,n){let i=An(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ie} 64-bit integer map lengths not supported`);return di(e,t,9,i)}function Tm(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ie} indefinite length items not allowed`);return di(e,t,1,1/0)}function Yu(e,t){qt(e,q.map.majorEncoded,t.value)}Yu.compareTokens=Sn.compareTokens;Yu.encodedSize=function(e){return qt.encodedSize(e.value)};function _m(e,t,r,n){return new we(q.tag,r,1)}function Em(e,t,r,n){return new we(q.tag,En(e,t+1,n),2)}function xm(e,t,r,n){return new we(q.tag,xn(e,t+1,n),3)}function Om(e,t,r,n){return new we(q.tag,On(e,t+1,n),5)}function Am(e,t,r,n){return new we(q.tag,An(e,t+1,n),9)}function el(e,t){qt(e,q.tag.majorEncoded,t.value)}el.compareTokens=Sn.compareTokens;el.encodedSize=function(e){return qt.encodedSize(e.value)};var Dd=20,Md=21,Ld=22,Vd=23;function Sm(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Ie} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new we(q.null,null,1):new we(q.undefined,void 0,1)}function Im(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ie} indefinite length items not allowed`);return new we(q.break,void 0,1)}function tl(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Ie} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Ie} Infinity values are not supported`)}return new we(q.float,e,t)}function km(e,t,r,n){return tl(nl(e,t+1),3,n)}function $m(e,t,r,n){return tl(il(e,t+1),5,n)}function jm(e,t,r,n){return tl(Gd(e,t+1),9,n)}function rl(e,t,r){let n=t.value;if(n===!1)e.push([q.float.majorEncoded|Dd]);else if(n===!0)e.push([q.float.majorEncoded|Md]);else if(n===null)e.push([q.float.majorEncoded|Ld]);else if(n===void 0)e.push([q.float.majorEncoded|Vd]);else{let i,o=!1;(!r||r.float64!==!0)&&(zd(n),i=nl(Zt,1),n===i||Number.isNaN(n)?(Zt[0]=249,e.push(Zt.slice(0,3)),o=!0):(Kd(n),i=il(Zt,1),n===i&&(Zt[0]=250,e.push(Zt.slice(0,5)),o=!0))),o||(Cm(n),i=Gd(Zt,1),Zt[0]=251,e.push(Zt.slice(0,9)))}}rl.encodedSize=function(e,t){let r=e.value;if(r===!1||r===!0||r===null||r===void 0)return 1;if(!t||t.float64!==!0){zd(r);let n=nl(Zt,1);if(r===n||Number.isNaN(r))return 3;if(Kd(r),n=il(Zt,1),r===n)return 5}return 9};var Fd=new ArrayBuffer(9),jt=new DataView(Fd,1),Zt=new Uint8Array(Fd,0);function zd(e){if(e===1/0)jt.setUint16(0,31744,!1);else if(e===-1/0)jt.setUint16(0,64512,!1);else if(Number.isNaN(e))jt.setUint16(0,32256,!1);else{jt.setFloat32(0,e);let t=jt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)jt.setUint16(0,31744,!1);else if(r===0)jt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?jt.setUint16(0,0):i<-14?jt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):jt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function nl(e,t){if(e.length-t<2)throw new Error(`${Ie} 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 Kd(e){jt.setFloat32(0,e,!1)}function il(e,t){if(e.length-t<4)throw new Error(`${Ie} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function Cm(e){jt.setFloat64(0,e,!1)}function Gd(e,t){if(e.length-t<8)throw new Error(`${Ie} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}rl.compareTokens=Sn.compareTokens;function Ne(e,t,r){throw new Error(`${Ie} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function is(e){return()=>{throw new Error(`${Ie} ${e}`)}}var le=[];for(let e=0;e<=23;e++)le[e]=Ne;le[24]=Fg;le[25]=zg;le[26]=Kg;le[27]=Gg;le[28]=Ne;le[29]=Ne;le[30]=Ne;le[31]=Ne;for(let e=32;e<=55;e++)le[e]=Ne;le[56]=qg;le[57]=Wg;le[58]=Hg;le[59]=Jg;le[60]=Ne;le[61]=Ne;le[62]=Ne;le[63]=Ne;for(let e=64;e<=87;e++)le[e]=Xg;le[88]=Qg;le[89]=Zg;le[90]=Yg;le[91]=em;le[92]=Ne;le[93]=Ne;le[94]=Ne;le[95]=is("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)le[e]=im;le[120]=om;le[121]=am;le[122]=sm;le[123]=um;le[124]=Ne;le[125]=Ne;le[126]=Ne;le[127]=is("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)le[e]=cm;le[152]=fm;le[153]=dm;le[154]=pm;le[155]=hm;le[156]=Ne;le[157]=Ne;le[158]=Ne;le[159]=ym;for(let e=160;e<=183;e++)le[e]=gm;le[184]=mm;le[185]=bm;le[186]=vm;le[187]=wm;le[188]=Ne;le[189]=Ne;le[190]=Ne;le[191]=Tm;for(let e=192;e<=215;e++)le[e]=_m;le[216]=Em;le[217]=xm;le[218]=Om;le[219]=Am;le[220]=Ne;le[221]=Ne;le[222]=Ne;le[223]=Ne;for(let e=224;e<=243;e++)le[e]=is("simple values are not supported");le[244]=Ne;le[245]=Ne;le[246]=Ne;le[247]=Sm;le[248]=is("simple values are not supported");le[249]=km;le[250]=$m;le[251]=jm;le[252]=Ne;le[253]=Ne;le[254]=Ne;le[255]=Im;var mr=[];for(let e=0;e<24;e++)mr[e]=new we(q.uint,e,1);for(let e=-1;e>=-24;e--)mr[31-e]=new we(q.negint,e,1);mr[64]=new we(q.bytes,new Uint8Array(0),1);mr[96]=new we(q.string,"",1);mr[128]=new we(q.array,0,1);mr[160]=new we(q.map,0,1);mr[244]=new we(q.false,!1,1);mr[245]=new we(q.true,!0,1);mr[246]=new we(q.null,null,1);function Nm(e){switch(e.type){case q.false:return Tr([244]);case q.true:return Tr([245]);case q.null:return Tr([246]);case q.bytes:return e.value.length?void 0:Tr([64]);case q.string:return e.value===""?Tr([96]):void 0;case q.array:return e.value===0?Tr([128]):void 0;case q.map:return e.value===0?Tr([160]):void 0;case q.uint:return e.value<24?Tr([Number(e.value)]):void 0;case q.negint:if(e.value>=-24)return Tr([31-Number(e.value)])}}var Um=Object.freeze({float64:!0,mapSorter:Mm,quickEncodeToken:Nm});function Pm(){let e=[];return e[q.uint.major]=Sn,e[q.negint.major]=Qu,e[q.bytes.major]=ns,e[q.string.major]=lm,e[q.array.major]=Zu,e[q.map.major]=Yu,e[q.tag.major]=el,e[q.float.major]=rl,e}var Bm=Pm(),Rm=new Pd,kc=class qd{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(`${Bd} object contains circular references`);return new qd(r,t)}},Dr={null:new we(q.null,null),undefined:new we(q.undefined,void 0),true:new we(q.true,!0),false:new we(q.false,!1),emptyArray:new we(q.array,0),emptyMap:new we(q.map,0)},Zr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new we(q.float,e):e>=0?new we(q.uint,e):new we(q.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new we(q.uint,e):new we(q.negint,e)},Uint8Array(e,t,r,n){return new we(q.bytes,e)},string(e,t,r,n){return new we(q.string,e)},boolean(e,t,r,n){return e?Dr.true:Dr.false},null(e,t,r,n){return Dr.null},undefined(e,t,r,n){return Dr.undefined},ArrayBuffer(e,t,r,n){return new we(q.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new we(q.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Dr.emptyArray,new we(q.break)]:Dr.emptyArray;n=kc.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=Xo(a,r,n);return r.addBreakTokens?[new we(q.array,e.length),i,new we(q.break)]:[new we(q.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length,s;if(a){s=new Array(a),n=kc.createCheck(n,e);let u=!i&&r.ignoreUndefinedProperties,l=0;for(let f of o){let d=i?e.get(f):e[f];u&&d===void 0||(s[l++]=[Xo(f,r,n),Xo(d,r,n)])}l<a&&(s.length=l)}return s?.length?(Dm(s,r),r.addBreakTokens?[new we(q.map,s.length),s,new we(q.break)]:[new we(q.map,s.length),s]):r.addBreakTokens===!0?[Dr.emptyMap,new we(q.break)]:Dr.emptyMap}};Zr.Map=Zr.Object;Zr.Buffer=Zr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Zr[`${e}Array`]=Zr.DataView;function Xo(e,t={},r){let n=jg(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Zr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=Zr[n];if(!o)throw new Error(`${Bd} unsupported type: ${n}`);return o(e,n,t,r)}function Dm(e,t){t.mapSorter&&e.sort(t.mapSorter)}function Mm(e,t){if(e[0]instanceof we&&t[0]instanceof we){let r=e[0],n=t[0];return r._keyBytes||(r._keyBytes=$c(r.value)),n._keyBytes||(n._keyBytes=$c(n.value)),Ud(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function $c(e){return Lm(e,Bm,Um)}function Wd(e,t,r,n){if(Array.isArray(t))for(let i of t)Wd(e,i,r,n);else r[t.type.major](e,t,n)}var iN=q.uint.majorEncoded,oN=q.negint.majorEncoded,aN=q.bytes.majorEncoded,sN=q.string.majorEncoded,uN=q.array.majorEncoded,lN=q.float.majorEncoded|Dd,cN=q.float.majorEncoded|Md,fN=q.float.majorEncoded|Ld,dN=q.float.majorEncoded|Vd,pN=BigInt(-1),hN=BigInt(1);function Lm(e,t,r,n){let i=n instanceof Uint8Array,o=i?new Vg(n):Rm,a=Xo(e,r);if(!Array.isArray(a)&&r.quickEncodeToken){let s=r.quickEncodeToken(a);if(s)return i?(o.push(s),o.toBytes()):s;let u=t[a.type.major];if(u.encodedSize){let l=u.encodedSize(a,r);if(i||(o=new Pd(l)),u(o,a,r),o.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${a} was wrong`);return i?o.toBytes():Ju(o.chunks[0])}}return o.reset(),Wd(o,a,t,r),o.toBytes(!0)}var Vm={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Fm=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=mr[e];if(t===void 0){let r=le[e];if(!r)throw new Error(`${Ie} 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"),os=Symbol.for("BREAK");function zm(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=no(t,r);if(o===os){if(e.value===1/0)break;throw new Error(`${Ie} got unexpected break to lengthed array`)}if(o===ro)throw new Error(`${Ie} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function Km(e,t,r){let n=r.useMaps===!0,i=r.rejectDuplicateMapKeys===!0,o=n?void 0:{},a=n?new Map:void 0;for(let s=0;s<e.value;s++){let u=no(t,r);if(u===os){if(e.value===1/0)break;throw new Error(`${Ie} got unexpected break to lengthed map`)}if(u===ro)throw new Error(`${Ie} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(!n&&typeof u!="string")throw new Error(`${Ie} non-string keys not supported (got ${typeof u})`);if(i&&(n&&a.has(u)||!n&&Object.hasOwn(o,u)))throw new Error(`${Ie} found repeat map key "${u}"`);let l=no(t,r);if(l===ro)throw new Error(`${Ie} found map but not enough entries (got ${s} [no value], expected ${e.value})`);n?a.set(u,l):o[u]=l}return n?a:o}function no(e,t){if(e.done())return ro;let r=e.next();if(q.equals(r.type,q.break))return os;if(r.type.terminal)return r.value;if(q.equals(r.type,q.array))return zm(r,e,t);if(q.equals(r.type,q.map))return Km(r,e,t);if(q.equals(r.type,q.tag)){if(t.tags&&typeof t.tags[r.value]=="function"){let n=no(e,t);return t.tags[r.value](n)}throw new Error(`${Ie} tag not supported (${r.value})`)}throw new Error("unsupported")}function Gm(e,t){if(!(e instanceof Uint8Array))throw new Error(`${Ie} data to decode must be a Uint8Array`);t=Object.assign({},Vm,t);let r=Ju(e),n=t.tokenizer||new Fm(r,t),i=no(n,t);if(i===ro)throw new Error(`${Ie} did not find any content to decode`);if(i===os)throw new Error(`${Ie} got unexpected break`);return[i,e.subarray(n.pos())]}function qm(e,t){let[r,n]=Gm(e,t);if(n.length>0)throw new Error(`${Ie} too many terminals, data makes no sense`);return r}var yN=new Uint8Array(0);function Wm(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 ol(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 Hm(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),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(_){if(_ instanceof Uint8Array||(ArrayBuffer.isView(_)?_=new Uint8Array(_.buffer,_.byteOffset,_.byteLength):Array.isArray(_)&&(_=Uint8Array.from(_))),!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(_.length===0)return"";for(var L=0,J=0,B=0,k=_.length;B!==k&&_[B]===0;)B++,L++;for(var F=(k-B)*f+1>>>0,G=new Uint8Array(F);B!==k;){for(var R=_[B],Q=0,K=F-1;(R!==0||Q<J)&&K!==-1;K--,Q++)R+=256*G[K]>>>0,G[K]=R%s>>>0,R=R/s>>>0;if(R!==0)throw new Error("Non-zero carry");J=Q,B++}for(var re=F-J;re!==F&&G[re]===0;)re++;for(var $=u.repeat(L);re<F;++re)$+=e.charAt(G[re]);return $}function I(_){if(typeof _!="string")throw new TypeError("Expected String");if(_.length===0)return new Uint8Array;var L=0;if(_[L]!==" "){for(var J=0,B=0;_[L]===u;)J++,L++;for(var k=(_.length-L)*l+1>>>0,F=new Uint8Array(k);_[L];){var G=r[_.charCodeAt(L)];if(G===255)return;for(var R=0,Q=k-1;(G!==0||R<B)&&Q!==-1;Q--,R++)G+=s*F[Q]>>>0,F[Q]=G%256>>>0,G=G/256>>>0;if(G!==0)throw new Error("Non-zero carry");B=R,L++}if(_[L]!==" "){for(var K=k-B;K!==k&&F[K]===0;)K++;for(var re=new Uint8Array(J+(k-K)),$=J;K!==k;)re[$++]=F[K++];return re}}}function E(_){var L=I(_);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:I,decode:E}}var Jm=Hm,Xm=Jm,Qm=Xm,Zm=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")}},Ym=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 Hd(this,e)}},eb=class{decoders;constructor(e){this.decoders=e}or(e){return Hd(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 Hd(e,t){return new eb({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var tb=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 Zm(e,t,r),this.decoder=new Ym(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Jd({name:e,prefix:t,encode:r,decode:n}){return new tb(e,t,r,n)}function as({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Qm(r,e);return Jd({prefix:t,name:e,encode:n,decode:o=>ol(i(o))})}function rb(e,t,r,n){let i=e.length;for(;e[i-1]==="=";)--i;let o=new Uint8Array(i*r/8|0),a=0,s=0,u=0;for(let l=0;l<i;++l){let f=t[e[l]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);s=s<<r|f,a+=r,a>=8&&(a-=8,o[u++]=255&s>>a)}if(a>=r||255&s<<8-a)throw new SyntaxError("Unexpected end of data");return o}function nb(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",a=0,s=0;for(let u=0;u<e.length;++u)for(s=s<<8|e[u],a+=8;a>r;)a-=r,o+=t[i&s>>a];if(a!==0&&(o+=t[i&s<<r-a]),n)for(;o.length*r&7;)o+="=";return o}function ib(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function $r({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=ib(n);return Jd({prefix:t,name:e,encode(o){return nb(o,n,r)},decode(o){return rb(o,i,r,e)}})}var Qo=$r({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),gN=$r({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),mN=$r({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),bN=$r({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),vN=$r({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),wN=$r({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),TN=$r({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),_N=$r({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),EN=$r({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),qs=as({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),xN=as({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Kr=as({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ON=as({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),ob=Xd,jc=128,ab=127,sb=~ab,ub=Math.pow(2,31);function Xd(e,t,r){t=t||[],r=r||0;for(var n=r;e>=ub;)t[r++]=e&255|jc,e/=128;for(;e&sb;)t[r++]=e&255|jc,e>>>=7;return t[r]=e|0,Xd.bytes=r-n+1,t}var lb=pu,cb=128,Cc=127;function pu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw pu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Cc)<<i:(a&Cc)*Math.pow(2,i),i+=7}while(a>=cb);return pu.bytes=o-n,r}var fb=Math.pow(2,7),db=Math.pow(2,14),pb=Math.pow(2,21),hb=Math.pow(2,28),yb=Math.pow(2,35),gb=Math.pow(2,42),mb=Math.pow(2,49),bb=Math.pow(2,56),vb=Math.pow(2,63),wb=function(e){return e<fb?1:e<db?2:e<pb?3:e<hb?4:e<yb?5:e<gb?6:e<mb?7:e<bb?8:e<vb?9:10},Tb={encode:ob,decode:lb,encodingLength:wb},_b=Tb,da=_b;function hu(e,t=0){return[da.decode(e,t),da.decode.bytes]}function pa(e,t,r=0){return da.encode(e,t,r),t}function ha(e){return da.encodingLength(e)}function Eb(e,t){let r=t.byteLength,n=ha(e),i=n+ha(r),o=new Uint8Array(i+r);return pa(e,o,0),pa(r,o,n),o.set(t,i),new al(e,r,t,o)}function xb(e){let t=ol(e),[r,n]=hu(t),[i,o]=hu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new al(r,i,a,t)}function Ob(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Wm(e.bytes,r.bytes)}}var al=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Nc(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return Sb(r,yu(e),t??Kr.encoder);default:return Ib(r,yu(e),t??Qo.encoder)}}var Uc=new WeakMap;function yu(e){let t=Uc.get(e);if(t==null){let r=new Map;return Uc.set(e,r),r}return t}var Qd=class pt{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!==Li)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==kb)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return pt.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=Eb(t,r);return pt.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 pt.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&Ob(t.multihash,n.multihash)}toString(t){return Nc(this,t)}toJSON(){return{"/":Nc(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 pt)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new pt(n,i,o,a??Pc(n,i,o.bytes))}else if(r[$b]===!0){let{version:n,multihash:i,code:o}=r,a=xb(i);return pt.create(n,o,a)}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!==Li)throw new Error(`Version 0 CID must use dag-pb (code: ${Li}) block encoding`);return new pt(t,r,n,n.bytes)}case 1:{let i=Pc(t,r,n.bytes);return new pt(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return pt.create(0,Li,t)}static createV1(t,r){return pt.create(1,t,r)}static decode(t){let[r,n]=pt.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=pt.inspectBytes(t),n=r.size-r.multihashSize,i=ol(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),a=new al(r.multihashCode,r.digestSize,o,i);return[r.version===0?pt.createV0(a):pt.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,I]=hu(t.subarray(r));return r+=I,d},i=n(),o=Li;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=Ab(t,r),o=pt.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return yu(o).set(n,t),o}};function Ab(e,t){switch(e[0]){case"Q":{let r=t??Kr;return[Kr.prefix,r.decode(`${Kr.prefix}${e}`)]}case Kr.prefix:{let r=t??Kr;return[Kr.prefix,r.decode(e)]}case Qo.prefix:{let r=t??Qo;return[Qo.prefix,r.decode(e)]}case qs.prefix:{let r=t??qs;return[qs.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 Sb(e,t,r){let{prefix:n}=r;if(n!==Kr.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 Ib(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 Li=112,kb=18;function Pc(e,t,r){let n=ha(e),i=n+ha(t),o=new Uint8Array(i+r.byteLength);return pa(e,o,0),pa(t,o,n),o.set(r,i),o}var $b=Symbol.for("@ipld/js-cid/CID"),Zd=42;function jb(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Qd.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new we(q.tag,Zd),new we(q.bytes,r)]}function Cb(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Nb(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 Bc={float64:!0,typeEncoders:{Object:jb,undefined:Cb,number:Nb}},AN={...Bc,typeEncoders:{...Bc.typeEncoders}};function Ub(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Qd.decode(e.subarray(1))}var ya={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};ya.tags[Zd]=Ub;var SN={...ya,tags:ya.tags.slice()},Pb=e=>qm(e,ya),IN=new Uint8Array(0);function Bb(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 sl(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 Rb(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),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(_){if(_ instanceof Uint8Array||(ArrayBuffer.isView(_)?_=new Uint8Array(_.buffer,_.byteOffset,_.byteLength):Array.isArray(_)&&(_=Uint8Array.from(_))),!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(_.length===0)return"";for(var L=0,J=0,B=0,k=_.length;B!==k&&_[B]===0;)B++,L++;for(var F=(k-B)*f+1>>>0,G=new Uint8Array(F);B!==k;){for(var R=_[B],Q=0,K=F-1;(R!==0||Q<J)&&K!==-1;K--,Q++)R+=256*G[K]>>>0,G[K]=R%s>>>0,R=R/s>>>0;if(R!==0)throw new Error("Non-zero carry");J=Q,B++}for(var re=F-J;re!==F&&G[re]===0;)re++;for(var $=u.repeat(L);re<F;++re)$+=e.charAt(G[re]);return $}function I(_){if(typeof _!="string")throw new TypeError("Expected String");if(_.length===0)return new Uint8Array;var L=0;if(_[L]!==" "){for(var J=0,B=0;_[L]===u;)J++,L++;for(var k=(_.length-L)*l+1>>>0,F=new Uint8Array(k);_[L];){var G=r[_.charCodeAt(L)];if(G===255)return;for(var R=0,Q=k-1;(G!==0||R<B)&&Q!==-1;Q--,R++)G+=s*F[Q]>>>0,F[Q]=G%256>>>0,G=G/256>>>0;if(G!==0)throw new Error("Non-zero carry");B=R,L++}if(_[L]!==" "){for(var K=k-B;K!==k&&F[K]===0;)K++;for(var re=new Uint8Array(J+(k-K)),$=J;K!==k;)re[$++]=F[K++];return re}}}function E(_){var L=I(_);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:I,decode:E}}var Db=Rb,Mb=Db,Lb=Mb,Vb=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")}},Fb=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,r){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Yd(this,e)}},zb=class{decoders;constructor(e){this.decoders=e}or(e){return Yd(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 Yd(e,t){return new zb({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Kb=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 Vb(e,t,r),this.decoder=new Fb(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function ep({name:e,prefix:t,encode:r,decode:n}){return new Kb(e,t,r,n)}function tp({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Lb(r,e);return ep({prefix:t,name:e,encode:n,decode:o=>sl(i(o))})}function Gb(e,t,r,n){let i={};for(let f=0;f<t.length;++f)i[t[f]]=f;let o=e.length;for(;e[o-1]==="=";)--o;let a=new Uint8Array(o*r/8|0),s=0,u=0,l=0;for(let f=0;f<o;++f){let d=i[e[f]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|d,s+=r,s>=8&&(s-=8,a[l++]=255&u>>s)}if(s>=r||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a}function qb(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",a=0,s=0;for(let u=0;u<e.length;++u)for(s=s<<8|e[u],a+=8;a>r;)a-=r,o+=t[i&s>>a];if(a!==0&&(o+=t[i&s<<r-a]),n)for(;o.length*r&7;)o+="=";return o}function jr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return ep({prefix:t,name:e,encode(i){return qb(i,n,r)},decode(i){return Gb(i,n,r,e)}})}var Zo=jr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),kN=jr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),$N=jr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),jN=jr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),CN=jr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),NN=jr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),UN=jr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),PN=jr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),BN=jr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Gr=tp({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),RN=tp({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Wb=rp,Rc=128,Hb=127,Jb=~Hb,Xb=Math.pow(2,31);function rp(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Xb;)t[r++]=e&255|Rc,e/=128;for(;e&Jb;)t[r++]=e&255|Rc,e>>>=7;return t[r]=e|0,rp.bytes=r-n+1,t}var Qb=gu,Zb=128,Dc=127;function gu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw gu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Dc)<<i:(a&Dc)*Math.pow(2,i),i+=7}while(a>=Zb);return gu.bytes=o-n,r}var Yb=Math.pow(2,7),ev=Math.pow(2,14),tv=Math.pow(2,21),rv=Math.pow(2,28),nv=Math.pow(2,35),iv=Math.pow(2,42),ov=Math.pow(2,49),av=Math.pow(2,56),sv=Math.pow(2,63),uv=function(e){return e<Yb?1:e<ev?2:e<tv?3:e<rv?4:e<nv?5:e<iv?6:e<ov?7:e<av?8:e<sv?9:10},lv={encode:Wb,decode:Qb,encodingLength:uv},cv=lv,ga=cv;function mu(e,t=0){return[ga.decode(e,t),ga.decode.bytes]}function ma(e,t,r=0){return ga.encode(e,t,r),t}function ba(e){return ga.encodingLength(e)}function fv(e,t){let r=t.byteLength,n=ba(e),i=n+ba(r),o=new Uint8Array(i+r);return ma(e,o,0),ma(r,o,n),o.set(t,i),new ul(e,r,t,o)}function bu(e){let t=sl(e),[r,n]=mu(t),[i,o]=mu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new ul(r,i,a,t)}function dv(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Bb(e.bytes,r.bytes)}}var ul=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Mc(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return hv(r,vu(e),t??Gr.encoder);default:return yv(r,vu(e),t??Zo.encoder)}}var Lc=new WeakMap;function vu(e){let t=Lc.get(e);if(t==null){let r=new Map;return Lc.set(e,r),r}return t}var Vc=class ht{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!==Vi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==gv)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return ht.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=fv(t,r);return ht.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 ht.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&dv(t.multihash,n.multihash)}toString(t){return Mc(this,t)}toJSON(){return{"/":Mc(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 ht)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new ht(n,i,o,a??Fc(n,i,o.bytes))}else if(r[mv]===!0){let{version:n,multihash:i,code:o}=r,a=bu(i);return ht.create(n,o,a)}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!==Vi)throw new Error(`Version 0 CID must use dag-pb (code: ${Vi}) block encoding`);return new ht(t,r,n,n.bytes)}case 1:{let i=Fc(t,r,n.bytes);return new ht(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return ht.create(0,Vi,t)}static createV1(t,r){return ht.create(1,t,r)}static decode(t){let[r,n]=ht.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=ht.inspectBytes(t),n=r.size-r.multihashSize,i=sl(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),a=new ul(r.multihashCode,r.digestSize,o,i);return[r.version===0?ht.createV0(a):ht.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,I]=mu(t.subarray(r));return r+=I,d},i=n(),o=Vi;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=pv(t,r),o=ht.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return vu(o).set(n,t),o}};function pv(e,t){switch(e[0]){case"Q":{let r=t??Gr;return[Gr.prefix,r.decode(`${Gr.prefix}${e}`)]}case Gr.prefix:{let r=t??Gr;return[Gr.prefix,r.decode(e)]}case Zo.prefix:{let r=t??Zo;return[Zo.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function hv(e,t,r){let{prefix:n}=r;if(n!==Gr.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 yv(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 Vi=112,gv=18;function Fc(e,t,r){let n=ba(e),i=n+ba(t),o=new Uint8Array(i+r.byteLength);return ma(e,o,0),ma(t,o,n),o.set(r,i),o}var mv=Symbol.for("@ipld/js-cid/CID"),gn=mo(Hu(),1),Ws={SHA2_256:18,LENGTH:32,DAG_PB:112},bv=40;function va(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=gn.default.decode(e);return t.seek(gn.default.decode.bytes),r}function vv(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 wv(e){gn.default.decode(e);let t=gn.default.decode.bytes,r=gn.default.decode(e.subarray(gn.default.decode.bytes)),n=gn.default.decode.bytes;return t+n+r}var Hr={Null:e=>e===null?e:void 0,Int:e=>Number.isInteger(e)?e:void 0,Float:e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,String:e=>typeof e=="string"?e:void 0,Bool:e=>typeof e=="boolean"?e:void 0,Bytes:e=>e instanceof Uint8Array?e:void 0,Link:e=>e!==null&&typeof e=="object"&&e.asCID===e?e:void 0,List:e=>Array.isArray(e)?e:void 0,Map:e=>e!==null&&typeof e=="object"&&e.asCID!==e&&!Array.isArray(e)&&!(e instanceof Uint8Array)?e:void 0},Wi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Hr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Hr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Wi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Wi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Hr.Int,CarV1HeaderOrV2Pragma:e=>{if(Hr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,a]=t[i];switch(o){case"roots":{let s=Wi["CarV1HeaderOrV2Pragma > roots (anon)"](e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=Wi.Int(e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},Hi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Hr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Hr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Hi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Hi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Hr.Int,CarV1HeaderOrV2Pragma:e=>{if(Hr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,a]=t[i];switch(o){case"roots":{let s=Hi["CarV1HeaderOrV2Pragma > roots (anon)"](a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=Hi.Int(a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},Tv={toTyped:Wi.CarV1HeaderOrV2Pragma,toRepresentation:Hi.CarV1HeaderOrV2Pragma},_v=["string","number","bigint","symbol"],Ev=["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 xv(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return _v.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":Ov(e)?"Buffer":Av(e)||"Object"}function Ov(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function Av(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Ev.includes(t))return t}var Z=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}};Z.uint=new Z(0,"uint",!0);Z.negint=new Z(1,"negint",!0);Z.bytes=new Z(2,"bytes",!0);Z.string=new Z(3,"string",!0);Z.array=new Z(4,"array",!1);Z.map=new Z(5,"map",!1);Z.tag=new Z(6,"tag",!1);Z.float=new Z(7,"float",!0);Z.false=new Z(7,"false",!0);Z.true=new Z(7,"true",!0);Z.null=new Z(7,"null",!0);Z.undefined=new Z(7,"undefined",!0);Z.break=new Z(7,"break",!0);var ve=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}`}},pi=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Sv=new TextDecoder,Iv=new TextEncoder;function wa(e){return pi&&globalThis.Buffer.isBuffer(e)}function kv(e){return e instanceof Uint8Array?wa(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var $v=pi?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Kc(e,t,r):(e,t,r)=>r-t>64?Sv.decode(e.subarray(t,r)):Kc(e,t,r),jv=pi?e=>e.length>64?globalThis.Buffer.from(e):zc(e):e=>e.length>64?Iv.encode(e):zc(e),ll=pi?(e,t,r)=>wa(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Cv=pi?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),kv(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},Nv=pi?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Uv(e,t){if(wa(e)&&wa(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 zc(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 Kc(e,t,r){let n=[];for(;t<r;){let i=e[t],o=null,a=i>239?4:i>223?3:i>191?2:1;if(t+a<=r){let s,u,l,f;switch(a){case 1:i<128&&(o=i);break;case 2:s=e[t+1],(s&192)===128&&(f=(i&31)<<6|s&63,f>127&&(o=f));break;case 3:s=e[t+1],u=e[t+2],(s&192)===128&&(u&192)===128&&(f=(i&15)<<12|(s&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:s=e[t+1],u=e[t+2],l=e[t+3],(s&192)===128&&(u&192)===128&&(l&192)===128&&(f=(i&15)<<18|(s&63)<<12|(u&63)<<6|l&63,f>65535&&f<1114112&&(o=f))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),t+=a}return Pv(n)}var Gc=4096;function Pv(e){let t=e.length;if(t<=Gc)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Gc));return r}var Bv=256,Rv=class{constructor(e=Bv){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 r=t.length-(this.maxCursor-this.cursor)-1;t.set(e,r)}else{if(t){let r=t.length-(this.maxCursor-this.cursor)-1;r<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,r),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=Nv(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=ll(r,0,this.cursor)}else t=Cv(this.chunks,this.cursor);return e&&this.reset(),t}},Ge="CBOR decode error:",np="CBOR encode error:",_o=[];_o[23]=1;_o[24]=2;_o[25]=3;_o[26]=5;_o[27]=9;function hi(e,t,r){if(e.length-t<r)throw new Error(`${Ge} not enough data for type`)}var ut=[24,256,65536,4294967296,BigInt("18446744073709551616")];function In(e,t,r){hi(e,t,1);let n=e[t];if(r.strict===!0&&n<ut[0])throw new Error(`${Ge} integer encoded in more bytes than necessary (strict decode)`);return n}function kn(e,t,r){hi(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<ut[1])throw new Error(`${Ge} integer encoded in more bytes than necessary (strict decode)`);return n}function $n(e,t,r){hi(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<ut[2])throw new Error(`${Ge} integer encoded in more bytes than necessary (strict decode)`);return n}function jn(e,t,r){hi(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<ut[3])throw new Error(`${Ge} 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(`${Ge} integers outside of the safe integer range are not supported`)}function Dv(e,t,r,n){return new ve(Z.uint,In(e,t+1,n),2)}function Mv(e,t,r,n){return new ve(Z.uint,kn(e,t+1,n),3)}function Lv(e,t,r,n){return new ve(Z.uint,$n(e,t+1,n),5)}function Vv(e,t,r,n){return new ve(Z.uint,jn(e,t+1,n),9)}function Cn(e,t){return Wt(e,0,t.value)}function Wt(e,t,r){if(r<ut[0]){let n=Number(r);e.push([t|n])}else if(r<ut[1]){let n=Number(r);e.push([t|24,n])}else if(r<ut[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<ut[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<ut[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=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]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,e.push(i)}else throw new Error(`${Ge} encountered BigInt larger than allowable range`)}}Cn.encodedSize=function(e){return Wt.encodedSize(e.value)};Wt.encodedSize=function(e){return e<ut[0]?1:e<ut[1]?2:e<ut[2]?3:e<ut[3]?5:9};Cn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function Fv(e,t,r,n){return new ve(Z.negint,-1-In(e,t+1,n),2)}function zv(e,t,r,n){return new ve(Z.negint,-1-kn(e,t+1,n),3)}function Kv(e,t,r,n){return new ve(Z.negint,-1-$n(e,t+1,n),5)}var cl=BigInt(-1),ip=BigInt(1);function Gv(e,t,r,n){let i=jn(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ve(Z.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Ge} integers outside of the safe integer range are not supported`);return new ve(Z.negint,cl-BigInt(i),9)}function fl(e,t){let r=t.value,n=typeof r=="bigint"?r*cl-ip:r*-1-1;Wt(e,t.type.majorEncoded,n)}fl.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*cl-ip:t*-1-1;return r<ut[0]?1:r<ut[1]?2:r<ut[2]?3:r<ut[3]?5:9};fl.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Eo(e,t,r,n){hi(e,t,r+n);let i=ll(e,t+r,t+r+n);return new ve(Z.bytes,i,r+n)}function qv(e,t,r,n){return Eo(e,t,1,r)}function Wv(e,t,r,n){return Eo(e,t,2,In(e,t+1,n))}function Hv(e,t,r,n){return Eo(e,t,3,kn(e,t+1,n))}function Jv(e,t,r,n){return Eo(e,t,5,$n(e,t+1,n))}function Xv(e,t,r,n){let i=jn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ge} 64-bit integer bytes lengths not supported`);return Eo(e,t,9,i)}function Ta(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===Z.string?jv(e.value):e.value),e.encodedBytes}function ss(e,t){let r=Ta(t);Wt(e,t.type.majorEncoded,r.length),e.push(r)}ss.encodedSize=function(e){let t=Ta(e);return Wt.encodedSize(t.length)+t.length};ss.compareTokens=function(e,t){return Qv(Ta(e),Ta(t))};function Qv(e,t){return e.length<t.length?-1:e.length>t.length?1:Uv(e,t)}function xo(e,t,r,n,i){let o=r+n;hi(e,t,o);let a=new ve(Z.string,$v(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=ll(e,t+r,t+o)),a}function Zv(e,t,r,n){return xo(e,t,1,r,n)}function Yv(e,t,r,n){return xo(e,t,2,In(e,t+1,n),n)}function e0(e,t,r,n){return xo(e,t,3,kn(e,t+1,n),n)}function t0(e,t,r,n){return xo(e,t,5,$n(e,t+1,n),n)}function r0(e,t,r,n){let i=jn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ge} 64-bit integer string lengths not supported`);return xo(e,t,9,i,n)}var n0=ss;function yi(e,t,r,n){return new ve(Z.array,n,r)}function i0(e,t,r,n){return yi(e,t,1,r)}function o0(e,t,r,n){return yi(e,t,2,In(e,t+1,n))}function a0(e,t,r,n){return yi(e,t,3,kn(e,t+1,n))}function s0(e,t,r,n){return yi(e,t,5,$n(e,t+1,n))}function u0(e,t,r,n){let i=jn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ge} 64-bit integer array lengths not supported`);return yi(e,t,9,i)}function l0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ge} indefinite length items not allowed`);return yi(e,t,1,1/0)}function dl(e,t){Wt(e,Z.array.majorEncoded,t.value)}dl.compareTokens=Cn.compareTokens;dl.encodedSize=function(e){return Wt.encodedSize(e.value)};function gi(e,t,r,n){return new ve(Z.map,n,r)}function c0(e,t,r,n){return gi(e,t,1,r)}function f0(e,t,r,n){return gi(e,t,2,In(e,t+1,n))}function d0(e,t,r,n){return gi(e,t,3,kn(e,t+1,n))}function p0(e,t,r,n){return gi(e,t,5,$n(e,t+1,n))}function h0(e,t,r,n){let i=jn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ge} 64-bit integer map lengths not supported`);return gi(e,t,9,i)}function y0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ge} indefinite length items not allowed`);return gi(e,t,1,1/0)}function pl(e,t){Wt(e,Z.map.majorEncoded,t.value)}pl.compareTokens=Cn.compareTokens;pl.encodedSize=function(e){return Wt.encodedSize(e.value)};function g0(e,t,r,n){return new ve(Z.tag,r,1)}function m0(e,t,r,n){return new ve(Z.tag,In(e,t+1,n),2)}function b0(e,t,r,n){return new ve(Z.tag,kn(e,t+1,n),3)}function v0(e,t,r,n){return new ve(Z.tag,$n(e,t+1,n),5)}function w0(e,t,r,n){return new ve(Z.tag,jn(e,t+1,n),9)}function hl(e,t){Wt(e,Z.tag.majorEncoded,t.value)}hl.compareTokens=Cn.compareTokens;hl.encodedSize=function(e){return Wt.encodedSize(e.value)};var T0=20,_0=21,E0=22,x0=23;function O0(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Ge} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ve(Z.null,null,1):new ve(Z.undefined,void 0,1)}function A0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ge} indefinite length items not allowed`);return new ve(Z.break,void 0,1)}function yl(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Ge} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Ge} Infinity values are not supported`)}return new ve(Z.float,e,t)}function S0(e,t,r,n){return yl(ml(e,t+1),3,n)}function I0(e,t,r,n){return yl(bl(e,t+1),5,n)}function k0(e,t,r,n){return yl(up(e,t+1),9,n)}function gl(e,t,r){let n=t.value;if(n===!1)e.push([Z.float.majorEncoded|T0]);else if(n===!0)e.push([Z.float.majorEncoded|_0]);else if(n===null)e.push([Z.float.majorEncoded|E0]);else if(n===void 0)e.push([Z.float.majorEncoded|x0]);else{let i,o=!1;(!r||r.float64!==!0)&&(ap(n),i=ml(Yt,1),n===i||Number.isNaN(n)?(Yt[0]=249,e.push(Yt.slice(0,3)),o=!0):(sp(n),i=bl(Yt,1),n===i&&(Yt[0]=250,e.push(Yt.slice(0,5)),o=!0))),o||($0(n),i=up(Yt,1),Yt[0]=251,e.push(Yt.slice(0,9)))}}gl.encodedSize=function(e,t){let r=e.value;if(r===!1||r===!0||r===null||r===void 0)return 1;if(!t||t.float64!==!0){ap(r);let n=ml(Yt,1);if(r===n||Number.isNaN(r))return 3;if(sp(r),n=bl(Yt,1),r===n)return 5}return 9};var op=new ArrayBuffer(9),Ct=new DataView(op,1),Yt=new Uint8Array(op,0);function ap(e){if(e===1/0)Ct.setUint16(0,31744,!1);else if(e===-1/0)Ct.setUint16(0,64512,!1);else if(Number.isNaN(e))Ct.setUint16(0,32256,!1);else{Ct.setFloat32(0,e);let t=Ct.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Ct.setUint16(0,31744,!1);else if(r===0)Ct.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Ct.setUint16(0,0):i<-14?Ct.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):Ct.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function ml(e,t){if(e.length-t<2)throw new Error(`${Ge} 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 sp(e){Ct.setFloat32(0,e,!1)}function bl(e,t){if(e.length-t<4)throw new Error(`${Ge} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function $0(e){Ct.setFloat64(0,e,!1)}function up(e,t){if(e.length-t<8)throw new Error(`${Ge} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}gl.compareTokens=Cn.compareTokens;function Ue(e,t,r){throw new Error(`${Ge} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function us(e){return()=>{throw new Error(`${Ge} ${e}`)}}var de=[];for(let e=0;e<=23;e++)de[e]=Ue;de[24]=Dv;de[25]=Mv;de[26]=Lv;de[27]=Vv;de[28]=Ue;de[29]=Ue;de[30]=Ue;de[31]=Ue;for(let e=32;e<=55;e++)de[e]=Ue;de[56]=Fv;de[57]=zv;de[58]=Kv;de[59]=Gv;de[60]=Ue;de[61]=Ue;de[62]=Ue;de[63]=Ue;for(let e=64;e<=87;e++)de[e]=qv;de[88]=Wv;de[89]=Hv;de[90]=Jv;de[91]=Xv;de[92]=Ue;de[93]=Ue;de[94]=Ue;de[95]=us("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)de[e]=Zv;de[120]=Yv;de[121]=e0;de[122]=t0;de[123]=r0;de[124]=Ue;de[125]=Ue;de[126]=Ue;de[127]=us("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)de[e]=i0;de[152]=o0;de[153]=a0;de[154]=s0;de[155]=u0;de[156]=Ue;de[157]=Ue;de[158]=Ue;de[159]=l0;for(let e=160;e<=183;e++)de[e]=c0;de[184]=f0;de[185]=d0;de[186]=p0;de[187]=h0;de[188]=Ue;de[189]=Ue;de[190]=Ue;de[191]=y0;for(let e=192;e<=215;e++)de[e]=g0;de[216]=m0;de[217]=b0;de[218]=v0;de[219]=w0;de[220]=Ue;de[221]=Ue;de[222]=Ue;de[223]=Ue;for(let e=224;e<=243;e++)de[e]=us("simple values are not supported");de[244]=Ue;de[245]=Ue;de[246]=Ue;de[247]=O0;de[248]=us("simple values are not supported");de[249]=S0;de[250]=I0;de[251]=k0;de[252]=Ue;de[253]=Ue;de[254]=Ue;de[255]=A0;var Cr=[];for(let e=0;e<24;e++)Cr[e]=new ve(Z.uint,e,1);for(let e=-1;e>=-24;e--)Cr[31-e]=new ve(Z.negint,e,1);Cr[64]=new ve(Z.bytes,new Uint8Array(0),1);Cr[96]=new ve(Z.string,"",1);Cr[128]=new ve(Z.array,0,1);Cr[160]=new ve(Z.map,0,1);Cr[244]=new ve(Z.false,!1,1);Cr[245]=new ve(Z.true,!0,1);Cr[246]=new ve(Z.null,null,1);function lp(){let e=[];return e[Z.uint.major]=Cn,e[Z.negint.major]=fl,e[Z.bytes.major]=ss,e[Z.string.major]=n0,e[Z.array.major]=dl,e[Z.map.major]=pl,e[Z.tag.major]=hl,e[Z.float.major]=gl,e}var DN=lp(),MN=new Rv,qc=class cp{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(`${np} object contains circular references`);return new cp(r,t)}},Mr={null:new ve(Z.null,null),undefined:new ve(Z.undefined,void 0),true:new ve(Z.true,!0),false:new ve(Z.false,!1),emptyArray:new ve(Z.array,0),emptyMap:new ve(Z.map,0)},Yr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ve(Z.float,e):e>=0?new ve(Z.uint,e):new ve(Z.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ve(Z.uint,e):new ve(Z.negint,e)},Uint8Array(e,t,r,n){return new ve(Z.bytes,e)},string(e,t,r,n){return new ve(Z.string,e)},boolean(e,t,r,n){return e?Mr.true:Mr.false},null(e,t,r,n){return Mr.null},undefined(e,t,r,n){return Mr.undefined},ArrayBuffer(e,t,r,n){return new ve(Z.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ve(Z.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Mr.emptyArray,new ve(Z.break)]:Mr.emptyArray;n=qc.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=Hs(a,r,n);return r.addBreakTokens?[new ve(Z.array,e.length),i,new ve(Z.break)]:[new ve(Z.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length;if(!a)return r.addBreakTokens===!0?[Mr.emptyMap,new ve(Z.break)]:Mr.emptyMap;n=qc.createCheck(n,e);let s=[],u=0;for(let l of o)s[u++]=[Hs(l,r,n),Hs(i?e.get(l):e[l],r,n)];return j0(s,r),r.addBreakTokens?[new ve(Z.map,a),s,new ve(Z.break)]:[new ve(Z.map,a),s]}};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 Hs(e,t={},r){let n=xv(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Yr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=Yr[n];if(!o)throw new Error(`${np} unsupported type: ${n}`);return o(e,n,t,r)}function j0(e,t){t.mapSorter&&e.sort(t.mapSorter)}var LN=Symbol.for("DONE"),VN=Symbol.for("BREAK"),FN=lp(),zN=mo(Hu(),1),KN=[new ve(Z.map,2),new ve(Z.string,"version"),new ve(Z.uint,1),new ve(Z.string,"roots")],GN=new ve(Z.tag,42);async function fp(e,t){let r=va(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=Pb(n);if(Tv.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=vv(await e.exactly(bv,!0));e.seek(o.dataOffset-e.pos);let a=await fp(e,1);return Object.assign(a,o)}async function C0(e){let t=await e.exactly(2,!1);if(t[0]===Ws.SHA2_256&&t[1]===Ws.LENGTH){let a=await e.exactly(34,!0),s=bu(a);return Vc.create(0,Ws.DAG_PB,s)}let r=va(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=va(await e.upTo(8),e),i=await e.exactly(wv(await e.upTo(8)),!0),o=bu(i);return Vc.create(r,n,o)}async function dp(e){let t=e.pos,r=va(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await C0(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function N0(e){let{cid:t,blockLength:r}=await dp(e);return{bytes:await e.exactly(r,!0),cid:t}}async function U0(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await dp(e),o={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(o.blockLength),o}function P0(e){let t=(async()=>{let r=await fp(e);if(r.version===2){let n=e.pos-r.dataOffset;e=M0(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await N0(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await U0(e)}}}function B0(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 R0(e){let t=0,r=0,n=0,i=new Uint8Array(0),o=async a=>{r=i.length-n;let s=[i.subarray(n)];for(;r<a;){let l=await e();if(l==null)break;r<0?l.length>r&&s.push(l.subarray(-r)):s.push(l),r+=l.length}i=new Uint8Array(s.reduce((l,f)=>l+f.length,0));let u=0;for(let l of s)i.set(l,u),u+=l.length;n=0};return{async upTo(a){return i.length-n<a&&await o(a),i.subarray(n,n+Math.min(i.length-n,a))},async exactly(a,s=!1){if(i.length-n<a&&await o(a),i.length-n<a)throw new Error("Unexpected end of data");let u=i.subarray(n,n+a);return s&&(t+=a,n+=a),u},seek(a){t+=a,n+=a},get pos(){return t}}}function D0(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return R0(r)}function M0(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 pp=class{constructor(e,t){this._header=e,this._blocks=t,this._keys=t.map(r=>r.cid.toString())}get version(){return this._header.version}async getRoots(){return this._header.roots}async has(e){return this._keys.indexOf(e.toString())>-1}async get(e){let t=this._keys.indexOf(e.toString());return t>-1?this._blocks[t]:void 0}async*blocks(){for(let e of this._blocks)yield e}async*cids(){for(let e of this._blocks)yield e.cid}static async fromBytes(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Wc(B0(e))}static async fromIterable(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Wc(D0(e))}};async function Wc(e){let t=P0(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new pp(r,n)}var qN=mo(Hu(),1),L0=Object.create,vl=Object.defineProperty,V0=Object.getOwnPropertyDescriptor,hp=Object.getOwnPropertyNames,F0=Object.getPrototypeOf,z0=Object.prototype.hasOwnProperty,it=(e,t)=>function(){return t||(0,e[hp(e)[0]])((t={exports:{}}).exports,t),t.exports},yp=(e,t)=>{for(var r in t)vl(e,r,{get:t[r],enumerable:!0})},K0=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of hp(t))!z0.call(e,i)&&i!==r&&vl(e,i,{get:()=>t[i],enumerable:!(n=V0(t,i))||n.enumerable});return e},Nr=(e,t,r)=>(r=e!=null?L0(F0(e)):{},K0(t||!e||!e.__esModule?vl(r,"default",{value:e,enumerable:!0}):r,e)),on=it({"../../../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(p){let w=new Map;function A(){return new Map(w)}p.Entries=A;function P(){return w.clear()}p.Clear=P;function j(T){return w.delete(T)}p.Delete=j;function N(T){return w.has(T)}p.Has=N;function g(T,c){w.set(T,c)}p.Set=g;function O(T){return w.get(T)}p.Get=O})(t||(e.TypeRegistry=t={}));var r=class extends Error{constructor(p){super(p)}};e.TypeBoxError=r;var n;(function(p){let w=new Map;function A(){return new Map(w)}p.Entries=A;function P(){return w.clear()}p.Clear=P;function j(T){return w.delete(T)}p.Delete=j;function N(T){return w.has(T)}p.Has=N;function g(T,c){w.set(T,c)}p.Set=g;function O(T){return w.get(T)}p.Get=O})(n||(e.FormatRegistry=n={}));var i;(function(p){function w(v){return Array.isArray(v)}p.IsArray=w;function A(v){return typeof v=="bigint"}p.IsBigInt=A;function P(v){return typeof v=="boolean"}p.IsBoolean=P;function j(v){return v instanceof globalThis.Date}p.IsDate=j;function N(v){return v===null}p.IsNull=N;function g(v){return typeof v=="number"}p.IsNumber=g;function O(v){return typeof v=="object"&&v!==null}p.IsObject=O;function T(v){return typeof v=="string"}p.IsString=T;function c(v){return v instanceof globalThis.Uint8Array}p.IsUint8Array=c;function x(v){return v===void 0}p.IsUndefined=x})(i||(e.ValueGuard=i={}));var o=class extends r{};e.TypeGuardUnknownTypeError=o;var a;(function(p){function w(m){try{return new RegExp(m),!0}catch{return!1}}function A(m){if(!i.IsString(m))return!1;for(let De=0;De<m.length;De++){let $t=m.charCodeAt(De);if($t>=7&&$t<=13||$t===27||$t===127)return!1}return!0}function P(m){return g(m)||rt(m)}function j(m){return i.IsUndefined(m)||i.IsBigInt(m)}function N(m){return i.IsUndefined(m)||i.IsNumber(m)}function g(m){return i.IsUndefined(m)||i.IsBoolean(m)}function O(m){return i.IsUndefined(m)||i.IsString(m)}function T(m){return i.IsUndefined(m)||i.IsString(m)&&A(m)&&w(m)}function c(m){return i.IsUndefined(m)||i.IsString(m)&&A(m)}function x(m){return i.IsUndefined(m)||rt(m)}function v(m){return Oe(m,"Any")&&O(m.$id)}p.TAny=v;function b(m){return Oe(m,"Array")&&m.type==="array"&&O(m.$id)&&rt(m.items)&&N(m.minItems)&&N(m.maxItems)&&g(m.uniqueItems)&&x(m.contains)&&N(m.minContains)&&N(m.maxContains)}p.TArray=b;function U(m){return Oe(m,"AsyncIterator")&&m.type==="AsyncIterator"&&O(m.$id)&&rt(m.items)}p.TAsyncIterator=U;function H(m){return Oe(m,"BigInt")&&m.type==="bigint"&&O(m.$id)&&j(m.exclusiveMaximum)&&j(m.exclusiveMinimum)&&j(m.maximum)&&j(m.minimum)&&j(m.multipleOf)}p.TBigInt=H;function ie(m){return Oe(m,"Boolean")&&m.type==="boolean"&&O(m.$id)}p.TBoolean=ie;function oe(m){return Oe(m,"Constructor")&&m.type==="Constructor"&&O(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(De=>rt(De))&&rt(m.returns)}p.TConstructor=oe;function _e(m){return Oe(m,"Date")&&m.type==="Date"&&O(m.$id)&&N(m.exclusiveMaximumTimestamp)&&N(m.exclusiveMinimumTimestamp)&&N(m.maximumTimestamp)&&N(m.minimumTimestamp)&&N(m.multipleOfTimestamp)}p.TDate=_e;function Se(m){return Oe(m,"Function")&&m.type==="Function"&&O(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(De=>rt(De))&&rt(m.returns)}p.TFunction=Se;function Ve(m){return Oe(m,"Integer")&&m.type==="integer"&&O(m.$id)&&N(m.exclusiveMaximum)&&N(m.exclusiveMinimum)&&N(m.maximum)&&N(m.minimum)&&N(m.multipleOf)}p.TInteger=Ve;function He(m){return Oe(m,"Intersect")&&!(i.IsString(m.type)&&m.type!=="object")&&i.IsArray(m.allOf)&&m.allOf.every(De=>rt(De)&&!Di(De))&&O(m.type)&&(g(m.unevaluatedProperties)||x(m.unevaluatedProperties))&&O(m.$id)}p.TIntersect=He;function un(m){return Oe(m,"Iterator")&&m.type==="Iterator"&&O(m.$id)&&rt(m.items)}p.TIterator=un;function Oe(m,De){return Br(m)&&m[e.Kind]===De}p.TKindOf=Oe;function Br(m){return i.IsObject(m)&&e.Kind in m&&i.IsString(m[e.Kind])}p.TKind=Br;function ln(m){return C(m)&&i.IsString(m.const)}p.TLiteralString=ln;function S(m){return C(m)&&i.IsNumber(m.const)}p.TLiteralNumber=S;function ye(m){return C(m)&&i.IsBoolean(m.const)}p.TLiteralBoolean=ye;function C(m){return Oe(m,"Literal")&&O(m.$id)&&(i.IsBoolean(m.const)||i.IsNumber(m.const)||i.IsString(m.const))}p.TLiteral=C;function xe(m){return Oe(m,"Never")&&i.IsObject(m.not)&&Object.getOwnPropertyNames(m.not).length===0}p.TNever=xe;function se(m){return Oe(m,"Not")&&rt(m.not)}p.TNot=se;function ge(m){return Oe(m,"Null")&&m.type==="null"&&O(m.$id)}p.TNull=ge;function Re(m){return Oe(m,"Number")&&m.type==="number"&&O(m.$id)&&N(m.exclusiveMaximum)&&N(m.exclusiveMinimum)&&N(m.maximum)&&N(m.minimum)&&N(m.multipleOf)}p.TNumber=Re;function Je(m){return Oe(m,"Object")&&m.type==="object"&&O(m.$id)&&i.IsObject(m.properties)&&P(m.additionalProperties)&&N(m.minProperties)&&N(m.maxProperties)&&Object.entries(m.properties).every(([De,$t])=>A(De)&&rt($t))}p.TObject=Je;function mt(m){return Oe(m,"Promise")&&m.type==="Promise"&&O(m.$id)&&rt(m.item)}p.TPromise=mt;function dt(m){return Oe(m,"Record")&&m.type==="object"&&O(m.$id)&&P(m.additionalProperties)&&i.IsObject(m.patternProperties)&&(De=>{let $t=Object.getOwnPropertyNames(De.patternProperties);return $t.length===1&&w($t[0])&&i.IsObject(De.patternProperties)&&rt(De.patternProperties[$t[0]])})(m)}p.TRecord=dt;function vt(m){return i.IsObject(m)&&e.Hint in m&&m[e.Hint]==="Recursive"}p.TRecursive=vt;function Rr(m){return Oe(m,"Ref")&&O(m.$id)&&i.IsString(m.$ref)}p.TRef=Rr;function Wn(m){return Oe(m,"String")&&m.type==="string"&&O(m.$id)&&N(m.minLength)&&N(m.maxLength)&&T(m.pattern)&&c(m.format)}p.TString=Wn;function Hn(m){return Oe(m,"Symbol")&&m.type==="symbol"&&O(m.$id)}p.TSymbol=Hn;function cn(m){return Oe(m,"TemplateLiteral")&&m.type==="string"&&i.IsString(m.pattern)&&m.pattern[0]==="^"&&m.pattern[m.pattern.length-1]==="$"}p.TTemplateLiteral=cn;function Fo(m){return Oe(m,"This")&&O(m.$id)&&i.IsString(m.$ref)}p.TThis=Fo;function Di(m){return i.IsObject(m)&&e.Transform in m}p.TTransform=Di;function tt(m){return Oe(m,"Tuple")&&m.type==="array"&&O(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(De=>rt(De)))}p.TTuple=tt;function zo(m){return Oe(m,"Undefined")&&m.type==="undefined"&&O(m.$id)}p.TUndefined=zo;function Vs(m){return fn(m)&&m.anyOf.every(De=>ln(De)||S(De))}p.TUnionLiteral=Vs;function fn(m){return Oe(m,"Union")&&O(m.$id)&&i.IsObject(m)&&i.IsArray(m.anyOf)&&m.anyOf.every(De=>rt(De))}p.TUnion=fn;function Jn(m){return Oe(m,"Uint8Array")&&m.type==="Uint8Array"&&O(m.$id)&&N(m.minByteLength)&&N(m.maxByteLength)}p.TUint8Array=Jn;function bt(m){return Oe(m,"Unknown")&&O(m.$id)}p.TUnknown=bt;function Ko(m){return Oe(m,"Unsafe")}p.TUnsafe=Ko;function Mi(m){return Oe(m,"Void")&&m.type==="void"&&O(m.$id)}p.TVoid=Mi;function Fs(m){return i.IsObject(m)&&m[e.Readonly]==="Readonly"}p.TReadonly=Fs;function zs(m){return i.IsObject(m)&&m[e.Optional]==="Optional"}p.TOptional=zs;function rt(m){return i.IsObject(m)&&(v(m)||b(m)||ie(m)||H(m)||U(m)||oe(m)||_e(m)||Se(m)||Ve(m)||He(m)||un(m)||C(m)||xe(m)||se(m)||ge(m)||Re(m)||Je(m)||mt(m)||dt(m)||Rr(m)||Wn(m)||Hn(m)||cn(m)||Fo(m)||tt(m)||zo(m)||fn(m)||Jn(m)||bt(m)||Ko(m)||Mi(m)||Br(m)&&t.Has(m[e.Kind]))}p.TSchema=rt})(a||(e.TypeGuard=a={}));var s;(function(p){function w(A){return A[e.Kind]==="Intersect"?A.allOf.every(P=>w(P)):A[e.Kind]==="Union"?A.anyOf.some(P=>w(P)):A[e.Kind]==="Undefined"?!0:A[e.Kind]==="Not"?!w(A.not):!1}p.Check=w})(s||(e.ExtendsUndefined=s={}));var u=class extends r{};e.TypeExtendsError=u;var l;(function(p){p[p.Union=0]="Union",p[p.True=1]="True",p[p.False=2]="False"})(l||(e.TypeExtendsResult=l={}));var f;(function(p){function w(y){return y===l.False?y:l.True}function A(y){throw new u(y)}function P(y){return a.TNever(y)||a.TIntersect(y)||a.TUnion(y)||a.TUnknown(y)||a.TAny(y)}function j(y,h){return a.TNever(h)?Oe(y,h):a.TIntersect(h)?Se(y,h):a.TUnion(h)?Ks(y,h):a.TUnknown(h)?Ac(y,h):a.TAny(h)?N(y,h):A("StructuralRight")}function N(y,h){return l.True}function g(y,h){return a.TIntersect(h)?Se(y,h):a.TUnion(h)&&h.anyOf.some(je=>a.TAny(je)||a.TUnknown(je))?l.True:a.TUnion(h)?l.Union:a.TUnknown(h)||a.TAny(h)?l.True:l.Union}function O(y,h){return a.TUnknown(y)?l.False:a.TAny(y)?l.Union:a.TNever(y)?l.True:l.False}function T(y,h){return a.TObject(h)&&cn(h)?l.True:P(h)?j(y,h):a.TArray(h)?w(Me(y.items,h.items)):l.False}function c(y,h){return P(h)?j(y,h):a.TAsyncIterator(h)?w(Me(y.items,h.items)):l.False}function x(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TBigInt(h)?l.True:l.False}function v(y,h){return a.TLiteral(y)&&i.IsBoolean(y.const)||a.TBoolean(y)?l.True:l.False}function b(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TBoolean(h)?l.True:l.False}function U(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TConstructor(h)?y.parameters.length>h.parameters.length?l.False:y.parameters.every((je,wr)=>w(Me(h.parameters[wr],je))===l.True)?w(Me(y.returns,h.returns)):l.False:l.False}function H(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TDate(h)?l.True:l.False}function ie(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TFunction(h)?y.parameters.length>h.parameters.length?l.False:y.parameters.every((je,wr)=>w(Me(h.parameters[wr],je))===l.True)?w(Me(y.returns,h.returns)):l.False:l.False}function oe(y,h){return a.TLiteral(y)&&i.IsNumber(y.const)||a.TNumber(y)||a.TInteger(y)?l.True:l.False}function _e(y,h){return a.TInteger(h)||a.TNumber(h)?l.True:P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):l.False}function Se(y,h){return h.allOf.every(je=>Me(y,je)===l.True)?l.True:l.False}function Ve(y,h){return y.allOf.some(je=>Me(je,h)===l.True)?l.True:l.False}function He(y,h){return P(h)?j(y,h):a.TIterator(h)?w(Me(y.items,h.items)):l.False}function un(y,h){return a.TLiteral(h)&&h.const===y.const?l.True:P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TString(h)?Mi(y,h):a.TNumber(h)?C(y,h):a.TInteger(h)?oe(y,h):a.TBoolean(h)?v(y,h):l.False}function Oe(y,h){return l.False}function Br(y,h){return l.True}function ln(y){let[h,je]=[y,0];for(;a.TNot(h);)h=h.not,je+=1;return je%2===0?h:e.Type.Unknown()}function S(y,h){return a.TNot(y)?Me(ln(y),h):a.TNot(h)?Me(y,ln(h)):A("Invalid fallthrough for Not")}function ye(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TNull(h)?l.True:l.False}function C(y,h){return a.TLiteralNumber(y)||a.TNumber(y)||a.TInteger(y)?l.True:l.False}function xe(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TInteger(h)||a.TNumber(h)?l.True:l.False}function se(y,h){return Object.getOwnPropertyNames(y.properties).length===h}function ge(y){return cn(y)}function Re(y){return se(y,0)||se(y,1)&&"description"in y.properties&&a.TUnion(y.properties.description)&&y.properties.description.anyOf.length===2&&(a.TString(y.properties.description.anyOf[0])&&a.TUndefined(y.properties.description.anyOf[1])||a.TString(y.properties.description.anyOf[1])&&a.TUndefined(y.properties.description.anyOf[0]))}function Je(y){return se(y,0)}function mt(y){return se(y,0)}function dt(y){return se(y,0)}function vt(y){return se(y,0)}function Rr(y){return cn(y)}function Wn(y){let h=e.Type.Number();return se(y,0)||se(y,1)&&"length"in y.properties&&w(Me(y.properties.length,h))===l.True}function Hn(y){return se(y,0)}function cn(y){let h=e.Type.Number();return se(y,0)||se(y,1)&&"length"in y.properties&&w(Me(y.properties.length,h))===l.True}function Fo(y){let h=e.Type.Function([e.Type.Any()],e.Type.Any());return se(y,0)||se(y,1)&&"then"in y.properties&&w(Me(y.properties.then,h))===l.True}function Di(y,h){return Me(y,h)===l.False||a.TOptional(y)&&!a.TOptional(h)?l.False:l.True}function tt(y,h){return a.TUnknown(y)?l.False:a.TAny(y)?l.Union:a.TNever(y)||a.TLiteralString(y)&&ge(h)||a.TLiteralNumber(y)&&Je(h)||a.TLiteralBoolean(y)&&mt(h)||a.TSymbol(y)&&Re(h)||a.TBigInt(y)&&dt(h)||a.TString(y)&&ge(h)||a.TSymbol(y)&&Re(h)||a.TNumber(y)&&Je(h)||a.TInteger(y)&&Je(h)||a.TBoolean(y)&&mt(h)||a.TUint8Array(y)&&Rr(h)||a.TDate(y)&&vt(h)||a.TConstructor(y)&&Hn(h)||a.TFunction(y)&&Wn(h)?l.True:a.TRecord(y)&&a.TString(fn(y))?h[e.Hint]==="Record"?l.True:l.False:a.TRecord(y)&&a.TNumber(fn(y))&&se(h,0)?l.True:l.False}function zo(y,h){return P(h)?j(y,h):a.TRecord(h)?bt(y,h):a.TObject(h)?(()=>{for(let je of Object.getOwnPropertyNames(h.properties)){if(!(je in y.properties)&&!a.TOptional(h.properties[je]))return l.False;if(a.TOptional(h.properties[je]))return l.True;if(Di(y.properties[je],h.properties[je])===l.False)return l.False}return l.True})():l.False}function Vs(y,h){return P(h)?j(y,h):a.TObject(h)&&Fo(h)?l.True:a.TPromise(h)?w(Me(y.item,h.item)):l.False}function fn(y){return e.PatternNumberExact in y.patternProperties?e.Type.Number():e.PatternStringExact in y.patternProperties?e.Type.String():A("Unknown record key pattern")}function Jn(y){return e.PatternNumberExact in y.patternProperties?y.patternProperties[e.PatternNumberExact]:e.PatternStringExact in y.patternProperties?y.patternProperties[e.PatternStringExact]:A("Unable to get record value schema")}function bt(y,h){let[je,wr]=[fn(h),Jn(h)];return a.TLiteralString(y)&&a.TNumber(je)&&w(Me(y,wr))===l.True?l.True:a.TUint8Array(y)&&a.TNumber(je)||a.TString(y)&&a.TNumber(je)||a.TArray(y)&&a.TNumber(je)?Me(y,wr):a.TObject(y)?(()=>{for(let bg of Object.getOwnPropertyNames(y.properties))if(Di(wr,y.properties[bg])===l.False)return l.False;return l.True})():l.False}function Ko(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?Me(Jn(y),Jn(h)):l.False}function Mi(y,h){return a.TLiteral(y)&&i.IsString(y.const)||a.TString(y)?l.True:l.False}function Fs(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TString(h)?l.True:l.False}function zs(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TSymbol(h)?l.True:l.False}function rt(y,h){return a.TTemplateLiteral(y)?Me(R.Resolve(y),h):a.TTemplateLiteral(h)?Me(y,R.Resolve(h)):A("Invalid fallthrough for TemplateLiteral")}function m(y,h){return a.TArray(h)&&y.items!==void 0&&y.items.every(je=>Me(je,h.items)===l.True)}function De(y,h){return a.TNever(y)?l.True:a.TUnknown(y)?l.False:a.TAny(y)?l.Union:l.False}function $t(y,h){return P(h)?j(y,h):a.TObject(h)&&cn(h)||a.TArray(h)&&m(y,h)?l.True:a.TTuple(h)?i.IsUndefined(y.items)&&!i.IsUndefined(h.items)||!i.IsUndefined(y.items)&&i.IsUndefined(h.items)?l.False:i.IsUndefined(y.items)&&!i.IsUndefined(h.items)||y.items.every((je,wr)=>Me(je,h.items[wr])===l.True)?l.True:l.False:l.False}function fg(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TUint8Array(h)?l.True:l.False}function dg(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TVoid(h)?yg(y,h):a.TUndefined(h)?l.True:l.False}function Ks(y,h){return h.anyOf.some(je=>Me(y,je)===l.True)?l.True:l.False}function pg(y,h){return y.anyOf.every(je=>Me(je,h)===l.True)?l.True:l.False}function Ac(y,h){return l.True}function hg(y,h){return a.TNever(h)?Oe(y,h):a.TIntersect(h)?Se(y,h):a.TUnion(h)?Ks(y,h):a.TAny(h)?N(y,h):a.TString(h)?Mi(y,h):a.TNumber(h)?C(y,h):a.TInteger(h)?oe(y,h):a.TBoolean(h)?v(y,h):a.TArray(h)?O(y,h):a.TTuple(h)?De(y,h):a.TObject(h)?tt(y,h):a.TUnknown(h)?l.True:l.False}function yg(y,h){return a.TUndefined(y)||a.TUndefined(y)?l.True:l.False}function gg(y,h){return a.TIntersect(h)?Se(y,h):a.TUnion(h)?Ks(y,h):a.TUnknown(h)?Ac(y,h):a.TAny(h)?N(y,h):a.TObject(h)?tt(y,h):a.TVoid(h)?l.True:l.False}function Me(y,h){return a.TTemplateLiteral(y)||a.TTemplateLiteral(h)?rt(y,h):a.TNot(y)||a.TNot(h)?S(y,h):a.TAny(y)?g(y,h):a.TArray(y)?T(y,h):a.TBigInt(y)?x(y,h):a.TBoolean(y)?b(y,h):a.TAsyncIterator(y)?c(y,h):a.TConstructor(y)?U(y,h):a.TDate(y)?H(y,h):a.TFunction(y)?ie(y,h):a.TInteger(y)?_e(y,h):a.TIntersect(y)?Ve(y,h):a.TIterator(y)?He(y,h):a.TLiteral(y)?un(y,h):a.TNever(y)?Br(y,h):a.TNull(y)?ye(y,h):a.TNumber(y)?xe(y,h):a.TObject(y)?zo(y,h):a.TRecord(y)?Ko(y,h):a.TString(y)?Fs(y,h):a.TSymbol(y)?zs(y,h):a.TTuple(y)?$t(y,h):a.TPromise(y)?Vs(y,h):a.TUint8Array(y)?fg(y,h):a.TUndefined(y)?dg(y,h):a.TUnion(y)?pg(y,h):a.TUnknown(y)?hg(y,h):a.TVoid(y)?gg(y,h):A(`Unknown left type operand '${y[e.Kind]}'`)}function mg(y,h){return Me(y,h)}p.Extends=mg})(f||(e.TypeExtends=f={}));var d;(function(p){function w(T){return T.map(c=>N(c))}function A(T){return new Date(T.getTime())}function P(T){return new Uint8Array(T)}function j(T){let c=Object.getOwnPropertyNames(T).reduce((v,b)=>({...v,[b]:N(T[b])}),{}),x=Object.getOwnPropertySymbols(T).reduce((v,b)=>({...v,[b]:N(T[b])}),{});return{...c,...x}}function N(T){return i.IsArray(T)?w(T):i.IsDate(T)?A(T):i.IsUint8Array(T)?P(T):i.IsObject(T)?j(T):T}function g(T){return T.map(c=>O(c))}p.Rest=g;function O(T,c={}){return{...N(T),...c}}p.Type=O})(d||(e.TypeClone=d={}));var I;(function(p){function w(U){return U.map(H=>{let{[e.Optional]:ie,...oe}=d.Type(H);return oe})}function A(U){return U.every(H=>a.TOptional(H))}function P(U){return U.some(H=>a.TOptional(H))}function j(U){return A(U.allOf)?e.Type.Optional(e.Type.Intersect(w(U.allOf))):U}function N(U){return P(U.anyOf)?e.Type.Optional(e.Type.Union(w(U.anyOf))):U}function g(U){return U[e.Kind]==="Intersect"?j(U):U[e.Kind]==="Union"?N(U):U}function O(U,H){let ie=U.allOf.reduce((oe,_e)=>{let Se=v(_e,H);return Se[e.Kind]==="Never"?oe:[...oe,Se]},[]);return g(e.Type.Intersect(ie))}function T(U,H){let ie=U.anyOf.map(oe=>v(oe,H));return g(e.Type.Union(ie))}function c(U,H){let ie=U.properties[H];return i.IsUndefined(ie)?e.Type.Never():e.Type.Union([ie])}function x(U,H){let ie=U.items;if(i.IsUndefined(ie))return e.Type.Never();let oe=ie[H];return i.IsUndefined(oe)?e.Type.Never():oe}function v(U,H){return U[e.Kind]==="Intersect"?O(U,H):U[e.Kind]==="Union"?T(U,H):U[e.Kind]==="Object"?c(U,H):U[e.Kind]==="Tuple"?x(U,H):e.Type.Never()}function b(U,H,ie={}){let oe=H.map(_e=>v(U,_e.toString()));return g(e.Type.Union(oe,ie))}p.Resolve=b})(I||(e.IndexedAccessor=I={}));var E;(function(p){function w(x){let[v,b]=[x.slice(0,1),x.slice(1)];return`${v.toLowerCase()}${b}`}function A(x){let[v,b]=[x.slice(0,1),x.slice(1)];return`${v.toUpperCase()}${b}`}function P(x){return x.toUpperCase()}function j(x){return x.toLowerCase()}function N(x,v){let b=K.ParseExact(x.pattern);if(!$.Check(b))return{...x,pattern:g(x.pattern,v)};let U=[...z.Generate(b)].map(oe=>e.Type.Literal(oe)),H=O(U,v),ie=e.Type.Union(H);return e.Type.TemplateLiteral([ie])}function g(x,v){return typeof x=="string"?v==="Uncapitalize"?w(x):v==="Capitalize"?A(x):v==="Uppercase"?P(x):v==="Lowercase"?j(x):x:x.toString()}function O(x,v){if(x.length===0)return[];let[b,...U]=x;return[c(b,v),...O(U,v)]}function T(x,v){return a.TTemplateLiteral(x)?N(x,v):a.TUnion(x)?e.Type.Union(O(x.anyOf,v)):a.TLiteral(x)?e.Type.Literal(g(x.const,v)):x}function c(x,v){return T(x,v)}p.Map=c})(E||(e.Intrinsic=E={}));var _;(function(p){function w(g,O){return e.Type.Intersect(g.allOf.map(T=>j(T,O)),{...g})}function A(g,O){return e.Type.Union(g.anyOf.map(T=>j(T,O)),{...g})}function P(g,O){return O(g)}function j(g,O){return g[e.Kind]==="Intersect"?w(g,O):g[e.Kind]==="Union"?A(g,O):g[e.Kind]==="Object"?P(g,O):g}function N(g,O,T){return{...j(d.Type(g),O),...T}}p.Map=N})(_||(e.ObjectMap=_={}));var L;(function(p){function w(c){return c[0]==="^"&&c[c.length-1]==="$"?c.slice(1,c.length-1):c}function A(c,x){return c.allOf.reduce((v,b)=>[...v,...g(b,x)],[])}function P(c,x){let v=c.anyOf.map(b=>g(b,x));return[...v.reduce((b,U)=>U.map(H=>v.every(ie=>ie.includes(H))?b.add(H):b)[0],new Set)]}function j(c,x){return Object.getOwnPropertyNames(c.properties)}function N(c,x){return x.includePatterns?Object.getOwnPropertyNames(c.patternProperties):[]}function g(c,x){return a.TIntersect(c)?A(c,x):a.TUnion(c)?P(c,x):a.TObject(c)?j(c,x):a.TRecord(c)?N(c,x):[]}function O(c,x){return[...new Set(g(c,x))]}p.ResolveKeys=O;function T(c){return`^(${O(c,{includePatterns:!0}).map(x=>`(${w(x)})`).join("|")})$`}p.ResolvePattern=T})(L||(e.KeyResolver=L={}));var J=class extends r{};e.KeyArrayResolverError=J;var B;(function(p){function w(A){return Array.isArray(A)?A:a.TUnionLiteral(A)?A.anyOf.map(P=>P.const.toString()):a.TLiteral(A)?[A.const]:a.TTemplateLiteral(A)?(()=>{let P=K.ParseExact(A.pattern);if(!$.Check(P))throw new J("Cannot resolve keys from infinite template expression");return[...z.Generate(P)]})():[]}p.Resolve=w})(B||(e.KeyArrayResolver=B={}));var k;(function(p){function*w(P){for(let j of P.anyOf)j[e.Kind]==="Union"?yield*w(j):yield j}function A(P){return e.Type.Union([...w(P)],{...P})}p.Resolve=A})(k||(e.UnionResolver=k={}));var F=class extends r{};e.TemplateLiteralPatternError=F;var G;(function(p){function w(N){throw new F(N)}function A(N){return N.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function P(N,g){return a.TTemplateLiteral(N)?N.pattern.slice(1,N.pattern.length-1):a.TUnion(N)?`(${N.anyOf.map(O=>P(O,g)).join("|")})`:a.TNumber(N)?`${g}${e.PatternNumber}`:a.TInteger(N)?`${g}${e.PatternNumber}`:a.TBigInt(N)?`${g}${e.PatternNumber}`:a.TString(N)?`${g}${e.PatternString}`:a.TLiteral(N)?`${g}${A(N.const.toString())}`:a.TBoolean(N)?`${g}${e.PatternBoolean}`:w(`Unexpected Kind '${N[e.Kind]}'`)}function j(N){return`^${N.map(g=>P(g,"")).join("")}$`}p.Create=j})(G||(e.TemplateLiteralPattern=G={}));var R;(function(p){function w(A){let P=K.ParseExact(A.pattern);if(!$.Check(P))return e.Type.String();let j=[...z.Generate(P)].map(N=>e.Type.Literal(N));return e.Type.Union(j)}p.Resolve=w})(R||(e.TemplateLiteralResolver=R={}));var Q=class extends r{};e.TemplateLiteralParserError=Q;var K;(function(p){function w(U,H,ie){return U[H]===ie&&U.charCodeAt(H-1)!==92}function A(U,H){return w(U,H,"(")}function P(U,H){return w(U,H,")")}function j(U,H){return w(U,H,"|")}function N(U){if(!(A(U,0)&&P(U,U.length-1)))return!1;let H=0;for(let ie=0;ie<U.length;ie++)if(A(U,ie)&&(H+=1),P(U,ie)&&(H-=1),H===0&&ie!==U.length-1)return!1;return!0}function g(U){return U.slice(1,U.length-1)}function O(U){let H=0;for(let ie=0;ie<U.length;ie++)if(A(U,ie)&&(H+=1),P(U,ie)&&(H-=1),j(U,ie)&&H===0)return!0;return!1}function T(U){for(let H=0;H<U.length;H++)if(A(U,H))return!0;return!1}function c(U){let[H,ie]=[0,0],oe=[];for(let Se=0;Se<U.length;Se++)if(A(U,Se)&&(H+=1),P(U,Se)&&(H-=1),j(U,Se)&&H===0){let Ve=U.slice(ie,Se);Ve.length>0&&oe.push(v(Ve)),ie=Se+1}let _e=U.slice(ie);return _e.length>0&&oe.push(v(_e)),oe.length===0?{type:"const",const:""}:oe.length===1?oe[0]:{type:"or",expr:oe}}function x(U){function H(_e,Se){if(!A(_e,Se))throw new Q("TemplateLiteralParser: Index must point to open parens");let Ve=0;for(let He=Se;He<_e.length;He++)if(A(_e,He)&&(Ve+=1),P(_e,He)&&(Ve-=1),Ve===0)return[Se,He];throw new Q("TemplateLiteralParser: Unclosed group parens in expression")}function ie(_e,Se){for(let Ve=Se;Ve<_e.length;Ve++)if(A(_e,Ve))return[Se,Ve];return[Se,_e.length]}let oe=[];for(let _e=0;_e<U.length;_e++)if(A(U,_e)){let[Se,Ve]=H(U,_e),He=U.slice(Se,Ve+1);oe.push(v(He)),_e=Ve}else{let[Se,Ve]=ie(U,_e),He=U.slice(Se,Ve);He.length>0&&oe.push(v(He)),_e=Ve-1}return oe.length===0?{type:"const",const:""}:oe.length===1?oe[0]:{type:"and",expr:oe}}function v(U){return N(U)?v(g(U)):O(U)?c(U):T(U)?x(U):{type:"const",const:U}}p.Parse=v;function b(U){return v(U.slice(1,U.length-1))}p.ParseExact=b})(K||(e.TemplateLiteralParser=K={}));var re=class extends r{};e.TemplateLiteralFiniteError=re;var $;(function(p){function w(g){throw new re(g)}function A(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 P(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 j(g){return g.type==="const"&&g.const===".*"}function N(g){return P(g)?!0:A(g)||j(g)?!1:g.type==="and"?g.expr.every(O=>N(O)):g.type==="or"?g.expr.every(O=>N(O)):g.type==="const"?!0:w("Unknown expression type")}p.Check=N})($||(e.TemplateLiteralFinite=$={}));var D=class extends r{};e.TemplateLiteralGeneratorError=D;var z;(function(p){function*w(g){if(g.length===1)return yield*g[0];for(let O of g[0])for(let T of w(g.slice(1)))yield`${O}${T}`}function*A(g){return yield*w(g.expr.map(O=>[...N(O)]))}function*P(g){for(let O of g.expr)yield*N(O)}function*j(g){return yield g.const}function*N(g){return g.type==="and"?yield*A(g):g.type==="or"?yield*P(g):g.type==="const"?yield*j(g):(()=>{throw new D("Unknown expression")})()}p.Generate=N})(z||(e.TemplateLiteralGenerator=z={}));var ne;(function(p){function*w(N){let g=N.trim().replace(/"|'/g,"");return g==="boolean"?yield e.Type.Boolean():g==="number"?yield e.Type.Number():g==="bigint"?yield e.Type.BigInt():g==="string"?yield e.Type.String():yield(()=>{let O=g.split("|").map(T=>e.Type.Literal(T.trim()));return O.length===0?e.Type.Never():O.length===1?O[0]:e.Type.Union(O)})()}function*A(N){if(N[1]!=="{"){let g=e.Type.Literal("$"),O=P(N.slice(1));return yield*[g,...O]}for(let g=2;g<N.length;g++)if(N[g]==="}"){let O=w(N.slice(2,g)),T=P(N.slice(g+1));return yield*[...O,...T]}yield e.Type.Literal(N)}function*P(N){for(let g=0;g<N.length;g++)if(N[g]==="$"){let O=e.Type.Literal(N.slice(0,g)),T=A(N.slice(g));return yield*[O,...T]}yield e.Type.Literal(N)}function j(N){return[...P(N)]}p.Parse=j})(ne||(e.TemplateLiteralDslParser=ne={}));var ue=class{constructor(p){this.schema=p}Decode(p){return new te(this.schema,p)}};e.TransformDecodeBuilder=ue;var te=class{constructor(p,w){this.schema=p,this.decode=w}Encode(p){let w=d.Type(this.schema);return a.TTransform(w)?(()=>{let A={Encode:P=>w[e.Transform].Encode(p(P)),Decode:P=>this.decode(w[e.Transform].Decode(P))};return{...w,[e.Transform]:A}})():(()=>{let A={Decode:this.decode,Encode:p};return{...w,[e.Transform]:A}})()}};e.TransformEncodeBuilder=te;var fe=0,V=class extends r{};e.TypeBuilderError=V;var X=class{Create(p){return p}Throw(p){throw new V(p)}Discard(p,w){return w.reduce((A,P)=>{let{[P]:j,...N}=A;return N},p)}Strict(p){return JSON.parse(JSON.stringify(p))}};e.TypeBuilder=X;var ee=class extends X{ReadonlyOptional(p){return this.Readonly(this.Optional(p))}Readonly(p){return{...d.Type(p),[e.Readonly]:"Readonly"}}Optional(p){return{...d.Type(p),[e.Optional]:"Optional"}}Any(p={}){return this.Create({...p,[e.Kind]:"Any"})}Array(p,w={}){return this.Create({...w,[e.Kind]:"Array",type:"array",items:d.Type(p)})}Boolean(p={}){return this.Create({...p,[e.Kind]:"Boolean",type:"boolean"})}Capitalize(p,w={}){return{...E.Map(d.Type(p),"Capitalize"),...w}}Composite(p,w){let A=e.Type.Intersect(p,{}),P=L.ResolveKeys(A,{includePatterns:!1}).reduce((j,N)=>({...j,[N]:e.Type.Index(A,[N])}),{});return e.Type.Object(P,w)}Enum(p,w={}){if(i.IsUndefined(p))return this.Throw("Enum undefined or empty");let A=Object.getOwnPropertyNames(p).filter(j=>isNaN(j)).map(j=>p[j]),P=[...new Set(A)].map(j=>e.Type.Literal(j));return this.Union(P,{...w,[e.Hint]:"Enum"})}Extends(p,w,A,P,j={}){switch(f.Extends(p,w)){case l.Union:return this.Union([d.Type(A,j),d.Type(P,j)]);case l.True:return d.Type(A,j);case l.False:return d.Type(P,j)}}Exclude(p,w,A={}){return a.TTemplateLiteral(p)?this.Exclude(R.Resolve(p),w,A):a.TTemplateLiteral(w)?this.Exclude(p,R.Resolve(w),A):a.TUnion(p)?(()=>{let P=p.anyOf.filter(j=>f.Extends(j,w)===l.False);return P.length===1?d.Type(P[0],A):this.Union(P,A)})():f.Extends(p,w)!==l.False?this.Never(A):d.Type(p,A)}Extract(p,w,A={}){return a.TTemplateLiteral(p)?this.Extract(R.Resolve(p),w,A):a.TTemplateLiteral(w)?this.Extract(p,R.Resolve(w),A):a.TUnion(p)?(()=>{let P=p.anyOf.filter(j=>f.Extends(j,w)!==l.False);return P.length===1?d.Type(P[0],A):this.Union(P,A)})():f.Extends(p,w)!==l.False?d.Type(p,A):this.Never(A)}Index(p,w,A={}){return a.TArray(p)&&a.TNumber(w)?d.Type(p.items,A):a.TTuple(p)&&a.TNumber(w)?(()=>{let P=(i.IsUndefined(p.items)?[]:p.items).map(j=>d.Type(j));return this.Union(P,A)})():(()=>{let P=B.Resolve(w),j=d.Type(p);return I.Resolve(j,P,A)})()}Integer(p={}){return this.Create({...p,[e.Kind]:"Integer",type:"integer"})}Intersect(p,w={}){if(p.length===0)return e.Type.Never();if(p.length===1)return d.Type(p[0],w);p.some(N=>a.TTransform(N))&&this.Throw("Cannot intersect transform types");let A=p.every(N=>a.TObject(N)),P=d.Rest(p),j=a.TSchema(w.unevaluatedProperties)?{unevaluatedProperties:d.Type(w.unevaluatedProperties)}:{};return w.unevaluatedProperties===!1||a.TSchema(w.unevaluatedProperties)||A?this.Create({...w,...j,[e.Kind]:"Intersect",type:"object",allOf:P}):this.Create({...w,...j,[e.Kind]:"Intersect",allOf:P})}KeyOf(p,w={}){return a.TRecord(p)?(()=>{let A=Object.getOwnPropertyNames(p.patternProperties)[0];return A===e.PatternNumberExact?this.Number(w):A===e.PatternStringExact?this.String(w):this.Throw("Unable to resolve key type from Record key pattern")})():a.TTuple(p)?(()=>{let A=(i.IsUndefined(p.items)?[]:p.items).map((P,j)=>e.Type.Literal(j.toString()));return this.Union(A,w)})():a.TArray(p)?this.Number(w):(()=>{let A=L.ResolveKeys(p,{includePatterns:!1});if(A.length===0)return this.Never(w);let P=A.map(j=>this.Literal(j));return this.Union(P,w)})()}Literal(p,w={}){return this.Create({...w,[e.Kind]:"Literal",const:p,type:typeof p})}Lowercase(p,w={}){return{...E.Map(d.Type(p),"Lowercase"),...w}}Never(p={}){return this.Create({...p,[e.Kind]:"Never",not:{}})}Not(p,w){return this.Create({...w,[e.Kind]:"Not",not:d.Type(p)})}Null(p={}){return this.Create({...p,[e.Kind]:"Null",type:"null"})}Number(p={}){return this.Create({...p,[e.Kind]:"Number",type:"number"})}Object(p,w={}){let A=Object.getOwnPropertyNames(p),P=A.filter(O=>a.TOptional(p[O])),j=A.filter(O=>!P.includes(O)),N=a.TSchema(w.additionalProperties)?{additionalProperties:d.Type(w.additionalProperties)}:{},g=A.reduce((O,T)=>({...O,[T]:d.Type(p[T])}),{});return j.length>0?this.Create({...w,...N,[e.Kind]:"Object",type:"object",properties:g,required:j}):this.Create({...w,...N,[e.Kind]:"Object",type:"object",properties:g})}Omit(p,w,A={}){let P=B.Resolve(w);return _.Map(this.Discard(d.Type(p),["$id",e.Transform]),j=>{i.IsArray(j.required)&&(j.required=j.required.filter(N=>!P.includes(N)),j.required.length===0&&delete j.required);for(let N of Object.getOwnPropertyNames(j.properties))P.includes(N)&&delete j.properties[N];return this.Create(j)},A)}Partial(p,w={}){return _.Map(this.Discard(d.Type(p),["$id",e.Transform]),A=>{let P=Object.getOwnPropertyNames(A.properties).reduce((j,N)=>({...j,[N]:this.Optional(A.properties[N])}),{});return this.Object(P,this.Discard(A,["required"]))},w)}Pick(p,w,A={}){let P=B.Resolve(w);return _.Map(this.Discard(d.Type(p),["$id",e.Transform]),j=>{i.IsArray(j.required)&&(j.required=j.required.filter(N=>P.includes(N)),j.required.length===0&&delete j.required);for(let N of Object.getOwnPropertyNames(j.properties))P.includes(N)||delete j.properties[N];return this.Create(j)},A)}Record(p,w,A={}){return a.TTemplateLiteral(p)?(()=>{let P=K.ParseExact(p.pattern);return $.Check(P)?this.Object([...z.Generate(P)].reduce((j,N)=>({...j,[N]:d.Type(w)}),{}),A):this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[p.pattern]:d.Type(w)}})})():a.TUnion(p)?(()=>{let P=k.Resolve(p);if(a.TUnionLiteral(P)){let j=P.anyOf.reduce((N,g)=>({...N,[g.const]:d.Type(w)}),{});return this.Object(j,{...A,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():a.TLiteral(p)?i.IsString(p.const)||i.IsNumber(p.const)?this.Object({[p.const]:d.Type(w)},A):this.Throw("Record key of type literal is not of type string or number"):a.TInteger(p)||a.TNumber(p)?this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:d.Type(w)}}):a.TString(p)?(()=>{let P=i.IsUndefined(p.pattern)?e.PatternStringExact:p.pattern;return this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[P]:d.Type(w)}})})():this.Never()}Recursive(p,w={}){i.IsUndefined(w.$id)&&(w.$id=`T${fe++}`);let A=p({[e.Kind]:"This",$ref:`${w.$id}`});return A.$id=w.$id,this.Create({...w,[e.Hint]:"Recursive",...A})}Ref(p,w={}){return i.IsString(p)?this.Create({...w,[e.Kind]:"Ref",$ref:p}):(i.IsUndefined(p.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({...w,[e.Kind]:"Ref",$ref:p.$id}))}Required(p,w={}){return _.Map(this.Discard(d.Type(p),["$id",e.Transform]),A=>{let P=Object.getOwnPropertyNames(A.properties).reduce((j,N)=>({...j,[N]:this.Discard(A.properties[N],[e.Optional])}),{});return this.Object(P,A)},w)}Rest(p){return a.TTuple(p)&&!i.IsUndefined(p.items)?d.Rest(p.items):a.TIntersect(p)?d.Rest(p.allOf):a.TUnion(p)?d.Rest(p.anyOf):[]}String(p={}){return this.Create({...p,[e.Kind]:"String",type:"string"})}TemplateLiteral(p,w={}){let A=i.IsString(p)?G.Create(ne.Parse(p)):G.Create(p);return this.Create({...w,[e.Kind]:"TemplateLiteral",type:"string",pattern:A})}Transform(p){return new ue(p)}Tuple(p,w={}){let[A,P,j]=[!1,p.length,p.length],N=d.Rest(p),g=p.length>0?{...w,[e.Kind]:"Tuple",type:"array",items:N,additionalItems:A,minItems:P,maxItems:j}:{...w,[e.Kind]:"Tuple",type:"array",minItems:P,maxItems:j};return this.Create(g)}Uncapitalize(p,w={}){return{...E.Map(d.Type(p),"Uncapitalize"),...w}}Union(p,w={}){return a.TTemplateLiteral(p)?R.Resolve(p):(()=>{let A=p;if(A.length===0)return this.Never(w);if(A.length===1)return this.Create(d.Type(A[0],w));let P=d.Rest(A);return this.Create({...w,[e.Kind]:"Union",anyOf:P})})()}Unknown(p={}){return this.Create({...p,[e.Kind]:"Unknown"})}Unsafe(p={}){return this.Create({...p,[e.Kind]:p[e.Kind]||"Unsafe"})}Uppercase(p,w={}){return{...E.Map(d.Type(p),"Uppercase"),...w}}};e.JsonTypeBuilder=ee;var be=class extends ee{AsyncIterator(p,w={}){return this.Create({...w,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:d.Type(p)})}Awaited(p,w={}){let A=P=>P.length>0?(()=>{let[j,...N]=P;return[this.Awaited(j),...A(N)]})():P;return a.TIntersect(p)?e.Type.Intersect(A(p.allOf)):a.TUnion(p)?e.Type.Union(A(p.anyOf)):a.TPromise(p)?this.Awaited(p.item):d.Type(p,w)}BigInt(p={}){return this.Create({...p,[e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(p,w={}){return this.Tuple([...p.parameters],{...w})}Constructor(p,w,A){let[P,j]=[d.Rest(p),d.Type(w)];return this.Create({...A,[e.Kind]:"Constructor",type:"Constructor",parameters:P,returns:j})}Date(p={}){return this.Create({...p,[e.Kind]:"Date",type:"Date"})}Function(p,w,A){let[P,j]=[d.Rest(p),d.Type(w)];return this.Create({...A,[e.Kind]:"Function",type:"Function",parameters:P,returns:j})}InstanceType(p,w={}){return d.Type(p.returns,w)}Iterator(p,w={}){return this.Create({...w,[e.Kind]:"Iterator",type:"Iterator",items:d.Type(p)})}Parameters(p,w={}){return this.Tuple(p.parameters,{...w})}Promise(p,w={}){return this.Create({...w,[e.Kind]:"Promise",type:"Promise",item:d.Type(p)})}RegExp(p,w={}){let A=i.IsString(p)?p:p.source;return this.Create({...w,[e.Kind]:"String",type:"string",pattern:A})}RegEx(p,w={}){return this.RegExp(p,w)}ReturnType(p,w={}){return d.Type(p.returns,w)}Symbol(p){return this.Create({...p,[e.Kind]:"Symbol",type:"symbol"})}Undefined(p={}){return this.Create({...p,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(p={}){return this.Create({...p,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(p={}){return this.Create({...p,[e.Kind]:"Void",type:"void"})}};e.JavaScriptTypeBuilder=be,e.JsonType=new ee,e.Type=new be}}),mi=Nr(on(),1),{String:G0,Optional:q0,Boolean:W0,Object:H0,Number:J0}=mi.Type,X0=G0.bind(mi.Type),Q0=J0.bind(mi.Type),WN=H0.bind(mi.Type),HN=q0.bind(mi.Type),Z0=W0.bind(mi.Type),JN=X0(),XN=Q0(),QN=Z0();function _a(e){return Array.isArray(e)?e:[e]}var Y0={0:"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'",1:function(e,t){return"Cannot apply '"+e+"' to '"+t.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(e,t){return"[mobx.array] Index out of bounds, "+e+" is larger than "+t},18:"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js",19:function(e){return"Cannot initialize from classes that inherit from Map: "+e.constructor.name},20:function(e){return"Cannot initialize map from "+e},21:function(e){return"Cannot convert to map from '"+e+"'"},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(e){return"Cannot obtain administration from "+e},25:function(e,t){return"the entry '"+e+"' does not exist in the observable map '"+t+"'"},26:"please specify a property",27:function(e,t){return"no observable property '"+e.toString()+"' found on the observable object '"+t+"'"},28:function(e){return"Cannot obtain atom from "+e},29:"Expecting some object",30:"invalid action stack. did you forget to finish an action?",31:"missing option for computed: get",32:function(e,t){return"Cycle detected in computation "+e+": "+t},33:function(e){return"The setter of computed value '"+e+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"},34:function(e){return"[ComputedValue '"+e+"'] 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(e){return"[mobx] `observableArray."+e+"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice()."+e+"()` instead"},38:"'ownKeys()' can only be used on observable objects",39:"'defineProperty()' can only be used on observable objects"},e1=Y0;function he(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:e1[e];throw typeof i=="function"&&(i=i.apply(null,r)),new Error("[MobX] "+i)}var t1={};function ls(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:t1}var gp=Object.assign,Ea=Object.getOwnPropertyDescriptor,pr=Object.defineProperty,Oo=Object.prototype,xa=[];Object.freeze(xa);var wl={};Object.freeze(wl);var r1=typeof Proxy<"u",n1=Object.toString();function mp(){r1||he("`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`")}function Fi(e){Y.verifyProxies&&he("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+e)}function Ht(){return++Y.mobxGuid}function Tl(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Yn=function(){};function We(e){return typeof e=="function"}function bn(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function cs(e){return e!==null&&typeof e=="object"}function sr(e){if(!cs(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()===n1}function bp(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function fs(e,t,r){pr(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function vp(e,t,r){pr(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function an(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(n){return cs(n)&&n[r]===!0}}function bi(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function i1(e){var t=Object.getPrototypeOf(e),r=Object.getPrototypeOf(t),n=Object.getPrototypeOf(r);return n===null}function Er(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var wp=typeof Object.getOwnPropertySymbols<"u";function o1(e){var t=Object.keys(e);if(!wp)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return Oo.propertyIsEnumerable.call(e,n)})):t}var ds=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:wp?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function wu(e){return typeof e=="string"?e:typeof e=="symbol"?e.toString():new String(e).toString()}function Tp(e){return e===null?null:typeof e=="object"?""+e:e}function Vt(e,t){return Oo.hasOwnProperty.call(e,t)}var a1=Object.getOwnPropertyDescriptors||function(e){var t={};return ds(e).forEach(function(r){t[r]=Ea(e,r)}),t};function Et(e,t){return!!(e&t)}function xt(e,t,r){return r?e|=t:e&=~t,e}function Hc(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 Jc(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,u1(n.key),n)}}function vi(e,t,r){return t&&Jc(e.prototype,t),r&&Jc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ei(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=l1(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 Sr(){return Sr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Sr.apply(null,arguments)}function _p(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Tu(e,t)}function Tu(e,t){return Tu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Tu(e,t)}function s1(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 u1(e){var t=s1(e,"string");return typeof t=="symbol"?t:t+""}function l1(e,t){if(e){if(typeof e=="string")return Hc(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)?Hc(e,t):void 0}}var _t=Symbol("mobx-stored-annotations");function hr(e){function t(r,n){if(So(n))return e.decorate_20223_(r,n);Ao(r,n,e)}return Object.assign(t,e)}function Ao(e,t,r){if(Vt(e,_t)||fs(e,_t,Sr({},e[_t])),Oa(r)&&!Vt(e[_t],t)){var n=e.constructor.name+".prototype."+t.toString();he("'"+n+"' is decorated with 'override', but no such decorated member was found on prototype.")}c1(e,r,t),Oa(r)||(e[_t][t]=r)}function c1(e,t,r){if(!Oa(t)&&Vt(e[_t],r)){var n=e.constructor.name+".prototype."+r.toString(),i=e[_t][r].annotationType_,o=t.annotationType_;he("Cannot apply '@"+o+"' to '"+n+"':"+(`
3
3
  The field is already decorated with '@`+i+"'.")+`
4
4
  Re-decorating fields is not allowed.
5
- Use '@override' decorator for methods overridden by subclass.`)}}function Z0(e){return Vt(e,_t)||fs(e,_t,Sr({},e[_t])),e[_t]}function So(e){return typeof e=="object"&&typeof e.kind=="string"}function ps(e,t){t.includes(e.kind)||he("The decorator applied to '"+String(e.name)+"' cannot be used on a "+e.kind+" element")}var Ee=Symbol("mobx administration"),an=function(){function e(r){r===void 0&&(r="Atom@"+Ht()),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=je.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(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.reportObserved=function(){return Bp(this)},t.reportChanged=function(){Dt(),Rp(this),Mt()},t.toString=function(){return this.name_},bi(e,[{key:"isBeingObserved",get:function(){return Et(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=xt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return Et(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=xt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return Et(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=xt(this.flags_,e.diffValueMask_,r===1)}}])}();an.isBeingObservedMask_=1;an.isPendingUnobservationMask_=2;an.diffValueMask_=4;var Tl=on("Atom",an);function Tp(e,t,r){t===void 0&&(t=Yn),r===void 0&&(r=Yn);var n=new an(e);return t!==Yn&&bs(n,t),r!==Yn&&wi(n,r),n}function Y0(e,t){return e===t}function e1(e,t){return Il(e,t)}function t1(e,t){return Il(e,t,1)}function r1(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var et={identity:Y0,structural:e1,default:r1,shallow:t1};function vi(e,t,r){return ii(e)?e:Array.isArray(e)?Ke.array(e,{name:r}):sr(e)?Ke.object(e,void 0,{name:r}):mi(e)?Ke.map(e,{name:r}):Er(e)?Ke.set(e,{name:r}):typeof e=="function"&&!wn(e)&&!ao(e)?gp(e)?ni(e):io(r,e):e}function n1(e,t,r){if(e==null||Tn(e)||_i(e)||br(e)||rr(e))return e;if(Array.isArray(e))return Ke.array(e,{name:r,deep:!1});if(sr(e))return Ke.object(e,void 0,{name:r,deep:!1});if(mi(e))return Ke.map(e,{name:r,deep:!1});if(Er(e))return Ke.set(e,{name:r,deep:!1});he("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function hs(e){return e}function i1(e,t){return ii(e)&&he("observable.struct should not be used with observable values"),Il(e,t)?t:e}var o1="override";function xa(e){return e.annotationType_===o1}function Io(e,t){return{annotationType_:e,options_:t,make_:a1,extend_:s1,decorate_20223_:u1}}function a1(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(wn(r.value))return 1;var o=_p(e,this,t,r,!1);return pr(n,t,o),2}function s1(e,t,r,n){var i=_p(e,this,t,r);return e.defineProperty_(t,i,n)}function u1(e,t){ps(t,["method","field"]);var r=t.kind,n=t.name,i=t.addInitializer,o=this,a=function(u){var l,f,d,I;return vn((l=(f=o.options_)==null?void 0:f.name)!=null?l:n.toString(),u,(d=(I=o.options_)==null?void 0:I.autoAction)!=null?d:!1)};if(r=="field")return function(u){var l,f=u;return wn(f)||(f=a(f)),(l=o.options_)!=null&&l.bound&&(f=f.bind(this),f.isMobxAction=!0),f};if(r=="method"){var s;return wn(e)||(e=a(e)),(s=this.options_)!=null&&s.bound&&i(function(){var u=this,l=u[n].bind(u);l.isMobxAction=!0,u[n]=l}),e}he("Cannot apply '"+o.annotationType_+"' to '"+String(n)+"' (kind: "+r+"):"+(`
6
- '`+o.annotationType_+"' can only be used on properties with a function value."))}function l1(e,t,r,n){var i=t.annotationType_,o=n.value;We(o)||he("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
7
- '`+i+"' can only be used on properties with a function value."))}function _p(e,t,r,n,i){var o,a,s,u,l,f,d;i===void 0&&(i=Y.safeDescriptors),l1(e,t,r,n);var I=n.value;if((o=t.options_)!=null&&o.bound){var E;I=I.bind((E=e.proxy_)!=null?E:e.target_)}return{value:vn((a=(s=t.options_)==null?void 0:s.name)!=null?a:r.toString(),I,(u=(l=t.options_)==null?void 0:l.autoAction)!=null?u:!1,(f=t.options_)!=null&&f.bound?(d=e.proxy_)!=null?d:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function Ep(e,t){return{annotationType_:e,options_:t,make_:c1,extend_:f1,decorate_20223_:d1}}function c1(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&&(!Vt(e.target_,t)||!ao(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(ao(r.value))return 1;var o=xp(e,this,t,r,!1,!1);return pr(n,t,o),2}function f1(e,t,r,n){var i,o=xp(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,o,n)}function d1(e,t){var r;ps(t,["method"]);var n=t.name,i=t.addInitializer;return ao(e)||(e=ni(e)),(r=this.options_)!=null&&r.bound&&i(function(){var o=this,a=o[n].bind(o);a.isMobXFlow=!0,o[n]=a}),e}function p1(e,t,r,n){var i=t.annotationType_,o=n.value;We(o)||he("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
8
- '`+i+"' can only be used on properties with a generator function value."))}function xp(e,t,r,n,i,o){o===void 0&&(o=Y.safeDescriptors),p1(e,t,r,n);var a=n.value;if(ao(a)||(a=ni(a)),i){var s;a=a.bind((s=e.proxy_)!=null?s:e.target_),a.isMobXFlow=!0}return{value:a,configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function _l(e,t){return{annotationType_:e,options_:t,make_:h1,extend_:y1,decorate_20223_:g1}}function h1(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function y1(e,t,r,n){return m1(e,this,t,r),e.defineComputedProperty_(t,Sr({},this.options_,{get:r.get,set:r.set}),n)}function g1(e,t){ps(t,["getter"]);var r=this,n=t.name,i=t.addInitializer;return i(function(){var o=Ei(this)[Ee],a=Sr({},r.options_,{get:e,context:this});a.name||(a.name=o.name_+"."+n.toString()),o.values_.set(n,new Kt(a))}),function(){return this[Ee].getObservablePropValue_(n)}}function m1(e,t,r,n){var i=t.annotationType_,o=n.get;o||he("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
9
- '`+i+"' can only be used on getter(+setter) properties."))}function ys(e,t){return{annotationType_:e,options_:t,make_:b1,extend_:v1,decorate_20223_:w1}}function b1(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function v1(e,t,r,n){var i,o;return T1(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(o=this.options_)==null?void 0:o.enhancer)!=null?i:vi,n)}function w1(e,t){if(t.kind==="field")throw he("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");ps(t,["accessor"]);var r=this,n=t.kind,i=t.name,o=new WeakSet;function a(s,u){var l,f,d=Ei(s)[Ee],I=new Qr(u,(l=(f=r.options_)==null?void 0:f.enhancer)!=null?l:vi,d.name_+"."+i.toString(),!1);d.values_.set(i,I),o.add(s)}if(n=="accessor")return{get:function(){return o.has(this)||a(this,e.get.call(this)),this[Ee].getObservablePropValue_(i)},set:function(s){return o.has(this)||a(this,s),this[Ee].setObservablePropValue_(i,s)},init:function(s){return o.has(this)||a(this,s),s}}}function T1(e,t,r,n){var i=t.annotationType_;"value"in n||he("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
10
- '`+i+"' cannot be used on getter/setter properties"))}var _1="true",E1=Op();function Op(e){return{annotationType_:_1,options_:e,make_:x1,extend_:O1,decorate_20223_:A1}}function x1(e,t,r,n){var i,o;if(r.get)return Ze.make_(e,t,r,n);if(r.set){var a=vn(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:Y.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(pr(n,t,{configurable:!0,set:a}),2)}if(n!==e.target_&&typeof r.value=="function"){var s;if(gp(r.value)){var u,l=(u=this.options_)!=null&&u.autoBind?ni.bound:ni;return l.make_(e,t,r,n)}var f=(s=this.options_)!=null&&s.autoBind?io.bound:io;return f.make_(e,t,r,n)}var d=((i=this.options_)==null?void 0:i.deep)===!1?Ke.ref:Ke;if(typeof r.value=="function"&&(o=this.options_)!=null&&o.autoBind){var I;r.value=r.value.bind((I=e.proxy_)!=null?I:e.target_)}return d.make_(e,t,r,n)}function O1(e,t,r,n){var i,o;if(r.get)return Ze.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:Y.safeDescriptors?e.isPlainObject_:!0,set:vn(t.toString(),r.set)},n);if(typeof r.value=="function"&&(i=this.options_)!=null&&i.autoBind){var a;r.value=r.value.bind((a=e.proxy_)!=null?a:e.target_)}var s=((o=this.options_)==null?void 0:o.deep)===!1?Ke.ref:Ke;return s.extend_(e,t,r,n)}function A1(e,t){he("'"+this.annotationType_+"' cannot be used as a decorator")}var S1="observable",I1="observable.ref",k1="observable.shallow",$1="observable.struct",Ap={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Ap);function qo(e){return e||Ap}var _u=ys(S1),j1=ys(I1,{enhancer:hs}),C1=ys(k1,{enhancer:n1}),N1=ys($1,{enhancer:i1}),Sp=hr(_u);function Go(e){return e.deep===!0?vi:e.deep===!1?hs:P1(e.defaultDecorator)}function U1(e){var t;return e?(t=e.defaultDecorator)!=null?t:Op(e):void 0}function P1(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:vi}function Ip(e,t,r){if(So(t))return _u.decorate_20223_(e,t);if(bn(t)){Ao(e,t,_u);return}return ii(e)?e:sr(e)?Ke.object(e,t,r):Array.isArray(e)?Ke.array(e,t):mi(e)?Ke.map(e,t):Er(e)?Ke.set(e,t):typeof e=="object"&&e!==null?e:Ke.box(e,t)}hp(Ip,Sp);var B1={box:function(e,t){var r=qo(t);return new Qr(e,Go(r),r.name,!0,r.equals)},array:function(e,t){var r=qo(t);return(Y.useProxies===!1||r.proxy===!1?Lw:$w)(e,Go(r),r.name)},map:function(e,t){var r=qo(t);return new Qp(e,Go(r),r.name)},set:function(e,t){var r=qo(t);return new Zp(e,Go(r),r.name)},object:function(e,t,r){return Un(function(){return vw(Y.useProxies===!1||r?.proxy===!1?Ei({},r):Sw({},r),e,t)})},ref:hr(j1),shallow:hr(C1),deep:Sp,struct:hr(N1)},Ke=hp(Ip,B1),kp="computed",R1="computed.struct",Eu=_l(kp),D1=_l(R1,{equals:et.structural}),Ze=function(e,t){if(So(t))return Eu.decorate_20223_(e,t);if(bn(t))return Ao(e,t,Eu);if(sr(e))return hr(_l(kp,e));We(e)||he("First argument to `computed` should be an expression."),We(t)&&he("A setter as second argument is no longer supported, use `{ set: fn }` option instead");var r=sr(t)?t:{};return r.get=e,r.name||(r.name=e.name||""),new Kt(r)};Object.assign(Ze,Eu);Ze.struct=hr(D1);var Xc,Qc,Oa=0,M1=1,L1=(Xc=(Qc=_a(function(){},"name"))==null?void 0:Qc.configurable)!=null?Xc:!1,Zc={value:"action",configurable:!0,writable:!1,enumerable:!1};function vn(e,t,r,n){r===void 0&&(r=!1),We(t)||he("`action` can only be invoked on functions"),(typeof e!="string"||!e)&&he("actions should have valid names, got: '"+e+"'");function i(){return $p(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},L1&&(Zc.value=e,pr(i,"name",Zc)),i}function $p(e,t,r,n,i){var o=V1(e,t,n,i);try{return r.apply(n,i)}catch(a){throw o.error_=a,a}finally{F1(o)}}function V1(e,t,r,n){var i=ft()&&!!e,o=0;if(i){o=Date.now();var a=n?Array.from(n):Ea;Ot({type:xl,name:e,object:r,arguments:a})}var s=Y.trackingDerivation,u=!t||!s;Dt();var l=Y.allowStateChanges;u&&(Nn(),l=gs(!0));var f=El(!0),d={runAsAction_:u,prevDerivation_:s,prevAllowStateChanges_:l,prevAllowStateReads_:f,notifySpy_:i,startTime_:o,actionId_:M1++,parentActionId_:Oa};return Oa=d.actionId_,d}function F1(e){Oa!==e.actionId_&&he(30),Oa=e.parentActionId_,e.error_!==void 0&&(Y.suppressReactionErrors=!0),ms(e.prevAllowStateChanges_),Yi(e.prevAllowStateReads_),Mt(),e.runAsAction_&&Or(e.prevDerivation_),e.notifySpy_&&At({time:Date.now()-e.startTime_}),Y.suppressReactionErrors=!1}function z1(e,t){var r=gs(e);try{return t()}finally{ms(r)}}function gs(e){var t=Y.allowStateChanges;return Y.allowStateChanges=e,t}function ms(e){Y.allowStateChanges=e}var K1="create",Qr=function(e){function t(n,i,o,a,s){var u;return o===void 0&&(o="ObservableValue@"+Ht()),a===void 0&&(a=!0),s===void 0&&(s=et.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=s,u.value_=i(n,void 0,o),a&&ft()&&ri({type:K1,object:u,observableKind:"value",debugObjectName:u.name_,newValue:""+u.value_}),u}wp(t,e);var r=t.prototype;return r.dehanceValue=function(n){return this.dehancer!==void 0?this.dehancer(n):n},r.set=function(n){var i=this.value_;if(n=this.prepareNewValue_(n),n!==Y.UNCHANGED){var o=ft();o&&Ot({type:ir,object:this,observableKind:"value",debugObjectName:this.name_,newValue:n,oldValue:i}),this.setNewValue_(n),o&&At()}},r.prepareNewValue_=function(n){if(dr(this),Bt(this)){var i=Rt(this,{object:this,type:ir,newValue:n});if(!i)return Y.UNCHANGED;n=i.newValue}return n=this.enhancer(n,this.value_,this.name_),this.equals(this.value_,n)?Y.UNCHANGED:n},r.setNewValue_=function(n){var i=this.value_;this.value_=n,this.reportChanged(),or(this)&&ar(this,{type:ir,object:this,newValue:n,oldValue:i})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(n){return $o(this,n)},r.observe_=function(n,i){return i&&n({observableKind:"value",debugObjectName:this.name_,object:this,type:ir,newValue:this.value_,oldValue:void 0}),jo(this,n)},r.raw=function(){return this.value_},r.toJSON=function(){return this.get()},r.toString=function(){return this.name_+"["+this.value_+"]"},r.valueOf=function(){return vp(this.get())},r[Symbol.toPrimitive]=function(){return this.valueOf()},t}(an),q1=on("ObservableValue",Qr),Kt=function(){function e(r){this.dependenciesState_=je.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=je.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Aa(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Ft.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||he(31),this.derivation=r.get,this.name_=r.name||"ComputedValue@"+Ht(),r.set&&(this.setter_=vn(this.name_+"-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?et.structural:et.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){rw(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.get=function(){if(this.isComputing&&he(32,this.name_,this.derivation),Y.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)xu(this)&&(this.warnAboutUntrackedRead_(),Dt(),this.value_=this.computeValue_(!1),Mt());else if(Bp(this),xu(this)){var r=Y.trackingContext;this.keepAlive_&&!r&&(Y.trackingContext=this),this.trackAndCompute()&&tw(this),Y.trackingContext=r}var n=this.value_;if(Yo(n))throw n.cause;return n},t.set=function(r){if(this.setter_){this.isRunningSetter&&he(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else he(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,n=this.dependenciesState_===je.NOT_TRACKING_,i=this.computeValue_(!0),o=n||Yo(r)||Yo(i)||!this.equals_(r,i);return o&&(this.value_=i,ft()&&ri({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:r,newValue:i})),o},t.computeValue_=function(r){this.isComputing=!0;var n=gs(!1),i;if(r)i=jp(this,this.derivation,this.scope_);else if(Y.disableErrorBoundaries===!0)i=this.derivation.call(this.scope_);else try{i=this.derivation.call(this.scope_)}catch(o){i=new Aa(o)}return ms(n),this.isComputing=!1,i},t.suspend_=function(){this.keepAlive_||(Ou(this),this.value_=void 0,this.isTracing_!==Ft.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' was suspended and it will recompute on the next access."))},t.observe_=function(r,n){var i=this,o=!0,a=void 0;return qt(function(){var s=i.get();if(!o||n){var u=Nn();r({observableKind:"computed",debugObjectName:i.name_,type:ir,object:i,newValue:s,oldValue:a}),Or(u)}o=!1,a=s})},t.warnAboutUntrackedRead_=function(){this.isTracing_!==Ft.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 vp(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},bi(e,[{key:"isComputing",get:function(){return Et(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=xt(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return Et(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=xt(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return Et(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=xt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return Et(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=xt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return Et(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=xt(this.flags_,e.diffValueMask_,r===1)}}])}();Kt.isComputingMask_=1;Kt.isRunningSetterMask_=2;Kt.isBeingObservedMask_=4;Kt.isPendingUnobservationMask_=8;Kt.diffValueMask_=16;var ko=on("ComputedValue",Kt),je;(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_"})(je||(je={}));var Ft;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(Ft||(Ft={}));var Aa=function(e){this.cause=void 0,this.cause=e};function Yo(e){return e instanceof Aa}function xu(e){switch(e.dependenciesState_){case je.UP_TO_DATE_:return!1;case je.NOT_TRACKING_:case je.STALE_:return!0;case je.POSSIBLY_STALE_:{for(var t=El(!0),r=Nn(),n=e.observing_,i=n.length,o=0;o<i;o++){var a=n[o];if(ko(a)){if(Y.disableErrorBoundaries)a.get();else try{a.get()}catch{return Or(r),Yi(t),!0}if(e.dependenciesState_===je.STALE_)return Or(r),Yi(t),!0}}return Cp(e),Or(r),Yi(t),!1}}}function G1(){return Y.trackingDerivation!==null}function dr(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 W1(e){!Y.allowStateReads&&Y.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function jp(e,t,r){var n=El(!0);Cp(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(a){o=new Aa(a)}return Y.inBatch--,Y.trackingDerivation=i,J1(e),H1(e),Yi(n),o}function H1(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 J1(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=je.UP_TO_DATE_,i=0,o=e.unboundDepsCount_,a=0;a<o;a++){var s=r[a];s.diffValue===0&&(s.diffValue=1,i!==a&&(r[i]=s),i++),s.dependenciesState_>n&&(n=s.dependenciesState_)}for(r.length=i,e.newObserving_=null,o=t.length;o--;){var u=t[o];u.diffValue===0&&Up(u,e),u.diffValue=0}for(;i--;){var l=r[i];l.diffValue===1&&(l.diffValue=0,ew(l,e))}n!==je.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function Ou(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)Up(t[r],e);e.dependenciesState_=je.NOT_TRACKING_}function ze(e){var t=Nn();try{return e()}finally{Or(t)}}function Nn(){var e=Y.trackingDerivation;return Y.trackingDerivation=null,e}function Or(e){Y.trackingDerivation=e}function El(e){var t=Y.allowStateReads;return Y.allowStateReads=e,t}function Yi(e){Y.allowStateReads=e}function Cp(e){if(e.dependenciesState_!==je.UP_TO_DATE_){e.dependenciesState_=je.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=je.UP_TO_DATE_}}var ea=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},ta=!0,Np=!1,Y=function(){var e=ls();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ta=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new ea().version&&(ta=!1),ta?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new ea):(setTimeout(function(){Np||he(35)},1),new ea)}();function X1(){if((Y.pendingReactions.length||Y.inBatch||Y.isRunningReactions)&&he(36),Np=!0,ta){var e=ls();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),Y=new ea}}function Q1(){return Y}function Z1(e){return e.observers_&&e.observers_.size>0}function Y1(e){return e.observers_}function ew(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Up(e,t){e.observers_.delete(t),e.observers_.size===0&&Pp(e)}function Pp(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,Y.pendingUnobservations.push(e))}function Dt(){Y.inBatch++}function Mt(){if(--Y.inBatch===0){Lp();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 Kt&&r.suspend_())}Y.pendingUnobservations=[]}}function Bp(e){W1(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&&Pp(e),!1)}function Rp(e){e.lowestObserverState_!==je.STALE_&&(e.lowestObserverState_=je.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===je.UP_TO_DATE_&&(t.isTracing_!==Ft.NONE&&Dp(t,e),t.onBecomeStale_()),t.dependenciesState_=je.STALE_}))}function tw(e){e.lowestObserverState_!==je.STALE_&&(e.lowestObserverState_=je.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===je.POSSIBLY_STALE_?(t.dependenciesState_=je.STALE_,t.isTracing_!==Ft.NONE&&Dp(t,e)):t.dependenciesState_===je.UP_TO_DATE_&&(e.lowestObserverState_=je.UP_TO_DATE_)}))}function rw(e){e.lowestObserverState_===je.UP_TO_DATE_&&(e.lowestObserverState_=je.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===je.UP_TO_DATE_&&(t.dependenciesState_=je.POSSIBLY_STALE_,t.onBecomeStale_())}))}function Dp(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===Ft.BREAK){var r=[];Mp(vs(e),r,1),new Function(`debugger;
5
+ Use '@override' decorator for methods overridden by subclass.`)}}function f1(e){return Vt(e,_t)||fs(e,_t,Sr({},e[_t])),e[_t]}function So(e){return typeof e=="object"&&typeof e.kind=="string"}function ps(e,t){t.includes(e.kind)||he("The decorator applied to '"+String(e.name)+"' cannot be used on a "+e.kind+" element")}var Ee=Symbol("mobx administration"),sn=function(){function e(r){r===void 0&&(r="Atom@"+Ht()),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(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.reportObserved=function(){return Dp(this)},t.reportChanged=function(){Dt(),Mp(this),Mt()},t.toString=function(){return this.name_},vi(e,[{key:"isBeingObserved",get:function(){return Et(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=xt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return Et(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=xt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return Et(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=xt(this.flags_,e.diffValueMask_,r===1)}}])}();sn.isBeingObservedMask_=1;sn.isPendingUnobservationMask_=2;sn.diffValueMask_=4;var _l=an("Atom",sn);function Ep(e,t,r){t===void 0&&(t=Yn),r===void 0&&(r=Yn);var n=new sn(e);return t!==Yn&&bs(n,t),r!==Yn&&Ti(n,r),n}function d1(e,t){return e===t}function p1(e,t){return kl(e,t)}function h1(e,t){return kl(e,t,1)}function y1(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var et={identity:d1,structural:p1,default:y1,shallow:h1};function wi(e,t,r){return ii(e)?e:Array.isArray(e)?Ke.array(e,{name:r}):sr(e)?Ke.object(e,void 0,{name:r}):bi(e)?Ke.map(e,{name:r}):Er(e)?Ke.set(e,{name:r}):typeof e=="function"&&!wn(e)&&!ao(e)?bp(e)?ni(e):io(r,e):e}function g1(e,t,r){if(e==null||Tn(e)||Ei(e)||br(e)||rr(e))return e;if(Array.isArray(e))return Ke.array(e,{name:r,deep:!1});if(sr(e))return Ke.object(e,void 0,{name:r,deep:!1});if(bi(e))return Ke.map(e,{name:r,deep:!1});if(Er(e))return Ke.set(e,{name:r,deep:!1});he("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function hs(e){return e}function m1(e,t){return ii(e)&&he("observable.struct should not be used with observable values"),kl(e,t)?t:e}var b1="override";function Oa(e){return e.annotationType_===b1}function Io(e,t){return{annotationType_:e,options_:t,make_:v1,extend_:w1,decorate_20223_:T1}}function v1(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(wn(r.value))return 1;var o=xp(e,this,t,r,!1);return pr(n,t,o),2}function w1(e,t,r,n){var i=xp(e,this,t,r);return e.defineProperty_(t,i,n)}function T1(e,t){ps(t,["method","field"]);var r=t.kind,n=t.name,i=t.addInitializer,o=this,a=function(u){var l,f,d,I;return vn((l=(f=o.options_)==null?void 0:f.name)!=null?l:n.toString(),u,(d=(I=o.options_)==null?void 0:I.autoAction)!=null?d:!1)};if(r=="field")return function(u){var l,f=u;return wn(f)||(f=a(f)),(l=o.options_)!=null&&l.bound&&(f=f.bind(this),f.isMobxAction=!0),f};if(r=="method"){var s;return wn(e)||(e=a(e)),(s=this.options_)!=null&&s.bound&&i(function(){var u=this,l=u[n].bind(u);l.isMobxAction=!0,u[n]=l}),e}he("Cannot apply '"+o.annotationType_+"' to '"+String(n)+"' (kind: "+r+"):"+(`
6
+ '`+o.annotationType_+"' can only be used on properties with a function value."))}function _1(e,t,r,n){var i=t.annotationType_,o=n.value;We(o)||he("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
7
+ '`+i+"' can only be used on properties with a function value."))}function xp(e,t,r,n,i){var o,a,s,u,l,f,d;i===void 0&&(i=Y.safeDescriptors),_1(e,t,r,n);var I=n.value;if((o=t.options_)!=null&&o.bound){var E;I=I.bind((E=e.proxy_)!=null?E:e.target_)}return{value:vn((a=(s=t.options_)==null?void 0:s.name)!=null?a:r.toString(),I,(u=(l=t.options_)==null?void 0:l.autoAction)!=null?u:!1,(f=t.options_)!=null&&f.bound?(d=e.proxy_)!=null?d:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function Op(e,t){return{annotationType_:e,options_:t,make_:E1,extend_:x1,decorate_20223_:O1}}function E1(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&&(!Vt(e.target_,t)||!ao(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(ao(r.value))return 1;var o=Ap(e,this,t,r,!1,!1);return pr(n,t,o),2}function x1(e,t,r,n){var i,o=Ap(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,o,n)}function O1(e,t){var r;ps(t,["method"]);var n=t.name,i=t.addInitializer;return ao(e)||(e=ni(e)),(r=this.options_)!=null&&r.bound&&i(function(){var o=this,a=o[n].bind(o);a.isMobXFlow=!0,o[n]=a}),e}function A1(e,t,r,n){var i=t.annotationType_,o=n.value;We(o)||he("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
8
+ '`+i+"' can only be used on properties with a generator function value."))}function Ap(e,t,r,n,i,o){o===void 0&&(o=Y.safeDescriptors),A1(e,t,r,n);var a=n.value;if(ao(a)||(a=ni(a)),i){var s;a=a.bind((s=e.proxy_)!=null?s:e.target_),a.isMobXFlow=!0}return{value:a,configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function El(e,t){return{annotationType_:e,options_:t,make_:S1,extend_:I1,decorate_20223_:k1}}function S1(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function I1(e,t,r,n){return $1(e,this,t,r),e.defineComputedProperty_(t,Sr({},this.options_,{get:r.get,set:r.set}),n)}function k1(e,t){ps(t,["getter"]);var r=this,n=t.name,i=t.addInitializer;return i(function(){var o=xi(this)[Ee],a=Sr({},r.options_,{get:e,context:this});a.name||(a.name=o.name_+"."+n.toString()),o.values_.set(n,new Kt(a))}),function(){return this[Ee].getObservablePropValue_(n)}}function $1(e,t,r,n){var i=t.annotationType_,o=n.get;o||he("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
9
+ '`+i+"' can only be used on getter(+setter) properties."))}function ys(e,t){return{annotationType_:e,options_:t,make_:j1,extend_:C1,decorate_20223_:N1}}function j1(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function C1(e,t,r,n){var i,o;return U1(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(o=this.options_)==null?void 0:o.enhancer)!=null?i:wi,n)}function N1(e,t){if(t.kind==="field")throw he("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");ps(t,["accessor"]);var r=this,n=t.kind,i=t.name,o=new WeakSet;function a(s,u){var l,f,d=xi(s)[Ee],I=new Qr(u,(l=(f=r.options_)==null?void 0:f.enhancer)!=null?l:wi,d.name_+"."+i.toString(),!1);d.values_.set(i,I),o.add(s)}if(n=="accessor")return{get:function(){return o.has(this)||a(this,e.get.call(this)),this[Ee].getObservablePropValue_(i)},set:function(s){return o.has(this)||a(this,s),this[Ee].setObservablePropValue_(i,s)},init:function(s){return o.has(this)||a(this,s),s}}}function U1(e,t,r,n){var i=t.annotationType_;"value"in n||he("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
10
+ '`+i+"' cannot be used on getter/setter properties"))}var P1="true",B1=Sp();function Sp(e){return{annotationType_:P1,options_:e,make_:R1,extend_:D1,decorate_20223_:M1}}function R1(e,t,r,n){var i,o;if(r.get)return Ze.make_(e,t,r,n);if(r.set){var a=vn(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:Y.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(pr(n,t,{configurable:!0,set:a}),2)}if(n!==e.target_&&typeof r.value=="function"){var s;if(bp(r.value)){var u,l=(u=this.options_)!=null&&u.autoBind?ni.bound:ni;return l.make_(e,t,r,n)}var f=(s=this.options_)!=null&&s.autoBind?io.bound:io;return f.make_(e,t,r,n)}var d=((i=this.options_)==null?void 0:i.deep)===!1?Ke.ref:Ke;if(typeof r.value=="function"&&(o=this.options_)!=null&&o.autoBind){var I;r.value=r.value.bind((I=e.proxy_)!=null?I:e.target_)}return d.make_(e,t,r,n)}function D1(e,t,r,n){var i,o;if(r.get)return Ze.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:Y.safeDescriptors?e.isPlainObject_:!0,set:vn(t.toString(),r.set)},n);if(typeof r.value=="function"&&(i=this.options_)!=null&&i.autoBind){var a;r.value=r.value.bind((a=e.proxy_)!=null?a:e.target_)}var s=((o=this.options_)==null?void 0:o.deep)===!1?Ke.ref:Ke;return s.extend_(e,t,r,n)}function M1(e,t){he("'"+this.annotationType_+"' cannot be used as a decorator")}var L1="observable",V1="observable.ref",F1="observable.shallow",z1="observable.struct",Ip={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Ip);function Go(e){return e||Ip}var _u=ys(L1),K1=ys(V1,{enhancer:hs}),G1=ys(F1,{enhancer:g1}),q1=ys(z1,{enhancer:m1}),kp=hr(_u);function qo(e){return e.deep===!0?wi:e.deep===!1?hs:H1(e.defaultDecorator)}function W1(e){var t;return e?(t=e.defaultDecorator)!=null?t:Sp(e):void 0}function H1(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:wi}function $p(e,t,r){if(So(t))return _u.decorate_20223_(e,t);if(bn(t)){Ao(e,t,_u);return}return ii(e)?e:sr(e)?Ke.object(e,t,r):Array.isArray(e)?Ke.array(e,t):bi(e)?Ke.map(e,t):Er(e)?Ke.set(e,t):typeof e=="object"&&e!==null?e:Ke.box(e,t)}gp($p,kp);var J1={box:function(e,t){var r=Go(t);return new Qr(e,qo(r),r.name,!0,r.equals)},array:function(e,t){var r=Go(t);return(Y.useProxies===!1||r.proxy===!1?Yw:zw)(e,qo(r),r.name)},map:function(e,t){var r=Go(t);return new Yp(e,qo(r),r.name)},set:function(e,t){var r=Go(t);return new eh(e,qo(r),r.name)},object:function(e,t,r){return Un(function(){return Cw(Y.useProxies===!1||r?.proxy===!1?xi({},r):Lw({},r),e,t)})},ref:hr(K1),shallow:hr(G1),deep:kp,struct:hr(q1)},Ke=gp($p,J1),jp="computed",X1="computed.struct",Eu=El(jp),Q1=El(X1,{equals:et.structural}),Ze=function(e,t){if(So(t))return Eu.decorate_20223_(e,t);if(bn(t))return Ao(e,t,Eu);if(sr(e))return hr(El(jp,e));We(e)||he("First argument to `computed` should be an expression."),We(t)&&he("A setter as second argument is no longer supported, use `{ set: fn }` option instead");var r=sr(t)?t:{};return r.get=e,r.name||(r.name=e.name||""),new Kt(r)};Object.assign(Ze,Eu);Ze.struct=hr(Q1);var Xc,Qc,Aa=0,Z1=1,Y1=(Xc=(Qc=Ea(function(){},"name"))==null?void 0:Qc.configurable)!=null?Xc:!1,Zc={value:"action",configurable:!0,writable:!1,enumerable:!1};function vn(e,t,r,n){r===void 0&&(r=!1),We(t)||he("`action` can only be invoked on functions"),(typeof e!="string"||!e)&&he("actions should have valid names, got: '"+e+"'");function i(){return Cp(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},Y1&&(Zc.value=e,pr(i,"name",Zc)),i}function Cp(e,t,r,n,i){var o=ew(e,t,n,i);try{return r.apply(n,i)}catch(a){throw o.error_=a,a}finally{tw(o)}}function ew(e,t,r,n){var i=ft()&&!!e,o=0;if(i){o=Date.now();var a=n?Array.from(n):xa;Ot({type:Ol,name:e,object:r,arguments:a})}var s=Y.trackingDerivation,u=!t||!s;Dt();var l=Y.allowStateChanges;u&&(Nn(),l=gs(!0));var f=xl(!0),d={runAsAction_:u,prevDerivation_:s,prevAllowStateChanges_:l,prevAllowStateReads_:f,notifySpy_:i,startTime_:o,actionId_:Z1++,parentActionId_:Aa};return Aa=d.actionId_,d}function tw(e){Aa!==e.actionId_&&he(30),Aa=e.parentActionId_,e.error_!==void 0&&(Y.suppressReactionErrors=!0),ms(e.prevAllowStateChanges_),Yi(e.prevAllowStateReads_),Mt(),e.runAsAction_&&Or(e.prevDerivation_),e.notifySpy_&&At({time:Date.now()-e.startTime_}),Y.suppressReactionErrors=!1}function rw(e,t){var r=gs(e);try{return t()}finally{ms(r)}}function gs(e){var t=Y.allowStateChanges;return Y.allowStateChanges=e,t}function ms(e){Y.allowStateChanges=e}var nw="create",Qr=function(e){function t(n,i,o,a,s){var u;return o===void 0&&(o="ObservableValue@"+Ht()),a===void 0&&(a=!0),s===void 0&&(s=et.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=s,u.value_=i(n,void 0,o),a&&ft()&&ri({type:nw,object:u,observableKind:"value",debugObjectName:u.name_,newValue:""+u.value_}),u}_p(t,e);var r=t.prototype;return r.dehanceValue=function(n){return this.dehancer!==void 0?this.dehancer(n):n},r.set=function(n){var i=this.value_;if(n=this.prepareNewValue_(n),n!==Y.UNCHANGED){var o=ft();o&&Ot({type:ir,object:this,observableKind:"value",debugObjectName:this.name_,newValue:n,oldValue:i}),this.setNewValue_(n),o&&At()}},r.prepareNewValue_=function(n){if(dr(this),Bt(this)){var i=Rt(this,{object:this,type:ir,newValue:n});if(!i)return Y.UNCHANGED;n=i.newValue}return n=this.enhancer(n,this.value_,this.name_),this.equals(this.value_,n)?Y.UNCHANGED:n},r.setNewValue_=function(n){var i=this.value_;this.value_=n,this.reportChanged(),or(this)&&ar(this,{type:ir,object:this,newValue:n,oldValue:i})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(n){return $o(this,n)},r.observe_=function(n,i){return i&&n({observableKind:"value",debugObjectName:this.name_,object:this,type:ir,newValue:this.value_,oldValue:void 0}),jo(this,n)},r.raw=function(){return this.value_},r.toJSON=function(){return this.get()},r.toString=function(){return this.name_+"["+this.value_+"]"},r.valueOf=function(){return Tp(this.get())},r[Symbol.toPrimitive]=function(){return this.valueOf()},t}(sn),iw=an("ObservableValue",Qr),Kt=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 Sa(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Ft.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||he(31),this.derivation=r.get,this.name_=r.name||"ComputedValue@"+Ht(),r.set&&(this.setter_=vn(this.name_+"-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?et.structural:et.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){yw(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.get=function(){if(this.isComputing&&he(32,this.name_,this.derivation),Y.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)xu(this)&&(this.warnAboutUntrackedRead_(),Dt(),this.value_=this.computeValue_(!1),Mt());else if(Dp(this),xu(this)){var r=Y.trackingContext;this.keepAlive_&&!r&&(Y.trackingContext=this),this.trackAndCompute()&&hw(this),Y.trackingContext=r}var n=this.value_;if(Yo(n))throw n.cause;return n},t.set=function(r){if(this.setter_){this.isRunningSetter&&he(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else he(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,n=this.dependenciesState_===Ce.NOT_TRACKING_,i=this.computeValue_(!0),o=n||Yo(r)||Yo(i)||!this.equals_(r,i);return o&&(this.value_=i,ft()&&ri({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:r,newValue:i})),o},t.computeValue_=function(r){this.isComputing=!0;var n=gs(!1),i;if(r)i=Np(this,this.derivation,this.scope_);else if(Y.disableErrorBoundaries===!0)i=this.derivation.call(this.scope_);else try{i=this.derivation.call(this.scope_)}catch(o){i=new Sa(o)}return ms(n),this.isComputing=!1,i},t.suspend_=function(){this.keepAlive_||(Ou(this),this.value_=void 0,this.isTracing_!==Ft.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' was suspended and it will recompute on the next access."))},t.observe_=function(r,n){var i=this,o=!0,a=void 0;return Gt(function(){var s=i.get();if(!o||n){var u=Nn();r({observableKind:"computed",debugObjectName:i.name_,type:ir,object:i,newValue:s,oldValue:a}),Or(u)}o=!1,a=s})},t.warnAboutUntrackedRead_=function(){this.isTracing_!==Ft.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 Tp(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},vi(e,[{key:"isComputing",get:function(){return Et(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=xt(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return Et(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=xt(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return Et(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=xt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return Et(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=xt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return Et(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=xt(this.flags_,e.diffValueMask_,r===1)}}])}();Kt.isComputingMask_=1;Kt.isRunningSetterMask_=2;Kt.isBeingObservedMask_=4;Kt.isPendingUnobservationMask_=8;Kt.diffValueMask_=16;var ko=an("ComputedValue",Kt),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 Ft;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(Ft||(Ft={}));var Sa=function(e){this.cause=void 0,this.cause=e};function Yo(e){return e instanceof Sa}function xu(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=xl(!0),r=Nn(),n=e.observing_,i=n.length,o=0;o<i;o++){var a=n[o];if(ko(a)){if(Y.disableErrorBoundaries)a.get();else try{a.get()}catch{return Or(r),Yi(t),!0}if(e.dependenciesState_===Ce.STALE_)return Or(r),Yi(t),!0}}return Up(e),Or(r),Yi(t),!1}}}function ow(){return Y.trackingDerivation!==null}function dr(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 aw(e){!Y.allowStateReads&&Y.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function Np(e,t,r){var n=xl(!0);Up(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(a){o=new Sa(a)}return Y.inBatch--,Y.trackingDerivation=i,uw(e),sw(e),Yi(n),o}function sw(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 uw(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=Ce.UP_TO_DATE_,i=0,o=e.unboundDepsCount_,a=0;a<o;a++){var s=r[a];s.diffValue===0&&(s.diffValue=1,i!==a&&(r[i]=s),i++),s.dependenciesState_>n&&(n=s.dependenciesState_)}for(r.length=i,e.newObserving_=null,o=t.length;o--;){var u=t[o];u.diffValue===0&&Bp(u,e),u.diffValue=0}for(;i--;){var l=r[i];l.diffValue===1&&(l.diffValue=0,pw(l,e))}n!==Ce.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function Ou(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)Bp(t[r],e);e.dependenciesState_=Ce.NOT_TRACKING_}function ze(e){var t=Nn();try{return e()}finally{Or(t)}}function Nn(){var e=Y.trackingDerivation;return Y.trackingDerivation=null,e}function Or(e){Y.trackingDerivation=e}function xl(e){var t=Y.allowStateReads;return Y.allowStateReads=e,t}function Yi(e){Y.allowStateReads=e}function Up(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 ea=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},ta=!0,Pp=!1,Y=function(){var e=ls();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ta=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new ea().version&&(ta=!1),ta?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new ea):(setTimeout(function(){Pp||he(35)},1),new ea)}();function lw(){if((Y.pendingReactions.length||Y.inBatch||Y.isRunningReactions)&&he(36),Pp=!0,ta){var e=ls();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),Y=new ea}}function cw(){return Y}function fw(e){return e.observers_&&e.observers_.size>0}function dw(e){return e.observers_}function pw(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Bp(e,t){e.observers_.delete(t),e.observers_.size===0&&Rp(e)}function Rp(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,Y.pendingUnobservations.push(e))}function Dt(){Y.inBatch++}function Mt(){if(--Y.inBatch===0){Fp();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 Kt&&r.suspend_())}Y.pendingUnobservations=[]}}function Dp(e){aw(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&&Rp(e),!1)}function Mp(e){e.lowestObserverState_!==Ce.STALE_&&(e.lowestObserverState_=Ce.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ce.UP_TO_DATE_&&(t.isTracing_!==Ft.NONE&&Lp(t,e),t.onBecomeStale_()),t.dependenciesState_=Ce.STALE_}))}function hw(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_!==Ft.NONE&&Lp(t,e)):t.dependenciesState_===Ce.UP_TO_DATE_&&(e.lowestObserverState_=Ce.UP_TO_DATE_)}))}function yw(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 Lp(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===Ft.BREAK){var r=[];Vp(vs(e),r,1),new Function(`debugger;
11
11
  /*
12
12
  Tracing '`+e.name_+`'
13
13
 
@@ -22,45 +22,45 @@ The dependencies for this derivation are:
22
22
  `+r.join(`
23
23
  `)+`
24
24
  */
25
- `)()}}function Mp(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 Mp(n,t,r+1)})}var yr=function(){function e(r,n,i,o){r===void 0&&(r="Reaction@"+Ht()),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=je.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Ft.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),Lp())},t.runReaction_=function(){if(!this.isDisposed){Dt(),this.isScheduled=!1;var r=Y.trackingContext;if(Y.trackingContext=this,xu(this)){this.isTrackPending=!0;try{this.onInvalidate_(),this.isTrackPending&&ft()&&ri({name:this.name_,type:"scheduled-reaction"})}catch(n){this.reportExceptionInDerivation_(n)}}Y.trackingContext=r,Mt()}},t.track=function(r){if(!this.isDisposed){Dt();var n=ft(),i;n&&(i=Date.now(),Ot({name:this.name_,type:"reaction"})),this.isRunning=!0;var o=Y.trackingContext;Y.trackingContext=this;var a=jp(this,r,void 0);Y.trackingContext=o,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Ou(this),Yo(a)&&this.reportExceptionInDerivation_(a.cause),n&&At({time:Date.now()-i}),Mt()}},t.reportExceptionInDerivation_=function(r){var n=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(Y.disableErrorBoundaries)throw r;var i="[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(i,r),ft()&&ri({type:"error",name:this.name_,message:i,error:""+r}),Y.globalReactionErrorHandlers.forEach(function(o){return o(r,n)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Dt(),Ou(this),Mt()))},t.getDisposer_=function(r){var n=this,i=function o(){n.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",o)};return r==null||r.addEventListener==null||r.addEventListener("abort",i),i[Ee]=this,i},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){r===void 0&&(r=!1),Jp(this,r)},bi(e,[{key:"isDisposed",get:function(){return Et(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=xt(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return Et(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=xt(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return Et(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=xt(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return Et(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=xt(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return Et(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=xt(this.flags_,e.diffValueMask_,r===1)}}])}();yr.isDisposedMask_=1;yr.isScheduledMask_=2;yr.isTrackPendingMask_=4;yr.isRunningMask_=8;yr.diffValueMask_=16;var Yc=100,Au=function(e){return e()};function Lp(){Y.inBatch>0||Y.isRunningReactions||Au(nw)}function nw(){Y.isRunningReactions=!0;for(var e=Y.pendingReactions,t=0;e.length>0;){++t===Yc&&(console.error("Reaction doesn't converge to a stable state after "+Yc+" 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 Sa=on("Reaction",yr);function iw(e){var t=Au;Au=function(r){return e(function(){return t(r)})}}function ft(){return!!Y.spyListeners.length}function ri(e){if(Y.spyListeners.length)for(var t=Y.spyListeners,r=0,n=t.length;r<n;r++)t[r](e)}function Ot(e){var t=Sr({},e,{spyReportStart:!0});ri(t)}var ow={type:"report-end",spyReportEnd:!0};function At(e){ri(e?Sr({},e,{type:"report-end",spyReportEnd:!0}):ow)}function aw(e){return Y.spyListeners.push(e),wl(function(){Y.spyListeners=Y.spyListeners.filter(function(t){return t!==e})})}var xl="action",sw="action.bound",Vp="autoAction",uw="autoAction.bound",Fp="<unnamed action>",Su=Io(xl),lw=Io(sw,{bound:!0}),Iu=Io(Vp,{autoAction:!0}),cw=Io(uw,{autoAction:!0,bound:!0});function zp(e){var t=function(r,n){if(We(r))return vn(r.name||Fp,r,e);if(We(n))return vn(r,n,e);if(So(n))return(e?Iu:Su).decorate_20223_(r,n);if(bn(n))return Ao(r,n,e?Iu:Su);if(bn(r))return hr(Io(e?Vp:xl,{name:r,autoAction:e}));he("Invalid arguments for `action`")};return t}var Lt=zp(!1);Object.assign(Lt,Su);var io=zp(!0);Object.assign(io,Iu);Lt.bound=hr(lw);io.bound=hr(cw);function oo(e){return $p(e.name||Fp,!1,e,this,void 0)}function wn(e){return We(e)&&e.isMobxAction===!0}function qt(e,t){var r,n,i,o;t===void 0&&(t=vl),We(e)||he("Autorun expects a function as first argument"),wn(e)&&he("Autorun does not accept actions since actions are untrackable");var a=(r=(n=t)==null?void 0:n.name)!=null?r:e.name||"Autorun@"+Ht(),s=!t.scheduler&&!t.delay,u;if(s)u=new yr(a,function(){this.track(d)},t.onError,t.requiresObservable);else{var l=Kp(t),f=!1;u=new yr(a,function(){f||(f=!0,l(function(){f=!1,u.isDisposed||u.track(d)}))},t.onError,t.requiresObservable)}function d(){e(u)}return(i=t)!=null&&(i=i.signal)!=null&&i.aborted||u.schedule_(),u.getDisposer_((o=t)==null?void 0:o.signal)}var fw=function(e){return e()};function Kp(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:fw}function dw(e,t,r){var n,i,o;r===void 0&&(r=vl),(!We(e)||!We(t))&&he("First and second argument to reaction should be functions"),sr(r)||he("Third argument of reactions should be an object");var a=(n=r.name)!=null?n:"Reaction@"+Ht(),s=Lt(a,r.onError?pw(r.onError,t):t),u=!r.scheduler&&!r.delay,l=Kp(r),f=!0,d=!1,I,E=r.compareStructural?et.structural:r.equals||et.default,_=new yr(a,function(){f||u?L():d||(d=!0,l(L))},r.onError,r.requiresObservable);function L(){if(d=!1,!_.isDisposed){var J=!1,B=I;_.track(function(){var k=z1(!1,function(){return e(_)});J=f||!E(I,k),I=k}),(f&&r.fireImmediately||!f&&J)&&s(I,B,_),f=!1}}return(i=r)!=null&&(i=i.signal)!=null&&i.aborted||_.schedule_(),_.getDisposer_((o=r)==null?void 0:o.signal)}function pw(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var hw="onBO",yw="onBUO";function bs(e,t,r){return qp(hw,e,t,r)}function wi(e,t,r){return qp(yw,e,t,r)}function qp(e,t,r,n){var i=typeof n=="function"?ur(t,r):ur(t),o=We(n)?n:r,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var s=i[a];s&&(s.delete(o),s.size===0&&delete i[a])}}var gw="never",Wo="always",mw="observed";function bw(e){e.isolateGlobalState===!0&&X1();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(Y.useProxies=t===Wo?!0:t===gw?!1:typeof Proxy<"u"),t==="ifavailable"&&(Y.verifyProxies=!0),r!==void 0){var n=r===Wo?Wo:r===mw;Y.enforceActions=n,Y.allowStateChanges=!(n===!0||n===Wo)}["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&&iw(e.reactionScheduler)}function vw(e,t,r,n){arguments.length>4&&he("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&he("'extendObservable' expects an object as first argument"),br(e)&&he("'extendObservable' should not be used on maps, use map.merge instead"),sr(t)||he("'extendObservable' only accepts plain objects as second argument"),(ii(t)||ii(r))&&he("Extending an object with another observable (object) is not supported");var i=W0(t);return Un(function(){var o=Ei(e,n)[Ee];ds(i).forEach(function(a){o.extend_(a,i[a],r&&a in r?r[a]:!0)})}),e}function vs(e,t){return Gp(ur(e,t))}function Gp(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=ww(e.observing_).map(Gp)),t}function Ia(e,t){return Wp(ur(e,t))}function Wp(e){var t={name:e.name_};return Z1(e)&&(t.observers=Array.from(Y1(e)).map(Wp)),t}function ww(e){return Array.from(new Set(e))}var Tw=0;function Hp(){this.message="FLOW_CANCELLED"}Hp.prototype=Object.create(Error.prototype);var Js=Ep("flow"),_w=Ep("flow.bound",{bound:!0}),ni=Object.assign(function(e,t){if(So(t))return Js.decorate_20223_(e,t);if(bn(t))return Ao(e,t,Js);arguments.length!==1&&he("Flow expects single argument with generator function");var r=e,n=r.name||"<unnamed flow>",i=function(){var o=this,a=arguments,s=++Tw,u=Lt(n+" - runid: "+s+" - init",r).apply(o,a),l,f=void 0,d=new Promise(function(I,E){var _=0;l=E;function L(k){f=void 0;var F;try{F=Lt(n+" - runid: "+s+" - yield "+_++,u.next).call(u,k)}catch(q){return E(q)}B(F)}function J(k){f=void 0;var F;try{F=Lt(n+" - runid: "+s+" - yield "+_++,u.throw).call(u,k)}catch(q){return E(q)}B(F)}function B(k){if(We(k?.then)){k.then(B,E);return}return k.done?I(k.value):(f=Promise.resolve(k.value),f.then(L,J))}L(void 0)});return d.cancel=Lt(n+" - runid: "+s+" - cancel",function(){try{f&&ef(f);var I=u.return(void 0),E=Promise.resolve(I.value);E.then(Yn,Yn),ef(E),l(new Hp)}catch(_){l(_)}}),d};return i.isMobXFlow=!0,i},Js);ni.bound=hr(_w);function ef(e){We(e.cancel)&&e.cancel()}function ao(e){return e?.isMobXFlow===!0}function Ew(e,t){return e?t!==void 0?br(e)||_i(e)?he("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."):Tn(e)?e[Ee].values_.has(t):!1:Tn(e)||!!e[Ee]||Tl(e)||Sa(e)||ko(e):!1}function ii(e){return arguments.length!==1&&he("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),Ew(e)}function xw(e){if(Tn(e))return e[Ee].ownKeys_();he(38)}function Ho(e,t,r){return e.set(t,r),r}function Qn(e,t){if(e==null||typeof e!="object"||e instanceof Date||!ii(e))return e;if(q1(e)||ko(e))return Qn(e.get(),t);if(t.has(e))return t.get(e);if(_i(e)){var r=Ho(t,e,new Array(e.length));return e.forEach(function(a,s){r[s]=Qn(a,t)}),r}if(rr(e)){var n=Ho(t,e,new Set);return e.forEach(function(a){n.add(Qn(a,t))}),n}if(br(e)){var i=Ho(t,e,new Map);return e.forEach(function(a,s){i.set(s,Qn(a,t))}),i}else{var o=Ho(t,e,{});return xw(e).forEach(function(a){Oo.propertyIsEnumerable.call(e,a)&&(o[a]=Qn(e[a],t))}),o}}function Ar(e,t){return t&&he("toJS no longer supports options"),Qn(e,new Map)}function Jp(){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=Ow(r);if(!i)return he("'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_===Ft.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled"),i.isTracing_=e?Ft.BREAK:Ft.LOG}function Ow(e){switch(e.length){case 0:return Y.trackingDerivation;case 1:return ur(e[0]);case 2:return ur(e[0],e[1])}}function xr(e,t){t===void 0&&(t=void 0),Dt();try{return e.apply(t)}finally{Mt()}}function dn(e){return e[Ee]}var Aw={has:function(e,t){return Y.trackingDerivation&&Fi("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),dn(e).has_(t)},get:function(e,t){return dn(e).get_(t)},set:function(e,t,r){var n;return bn(t)?(dn(e).values_.has(t)||Fi("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(n=dn(e).set_(t,r,!0))!=null?n:!0):!1},deleteProperty:function(e,t){var r;return Fi("delete properties from an observable object. Use 'remove' from 'mobx' instead."),bn(t)?(r=dn(e).delete_(t,!0))!=null?r:!0:!1},defineProperty:function(e,t,r){var n;return Fi("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(n=dn(e).defineProperty_(t,r))!=null?n:!0},ownKeys:function(e){return Y.trackingDerivation&&Fi("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),dn(e).ownKeys_()},preventExtensions:function(e){he(13)}};function Sw(e,t){var r,n;return yp(),e=Ei(e,t),(n=(r=e[Ee]).proxy_)!=null?n:r.proxy_=new Proxy(e,Aw)}function Bt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function $o(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),wl(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Rt(e,t){var r=Nn();try{for(var n=[].concat(e.interceptors_||[]),i=0,o=n.length;i<o&&(t=n[i](t),t&&!t.type&&he(14),!!t);i++);return t}finally{Or(r)}}function or(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function jo(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),wl(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function ar(e,t){var r=Nn(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,o=n.length;i<o;i++)n[i](t);Or(r)}}function Ti(e,t,r){return Un(function(){var n,i=Ei(e,r)[Ee];t&&e[_t]&&he("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(n=t)!=null||(t=Z0(e)),ds(t).forEach(function(o){return i.make_(o,t[o])})}),e}var tf="splice",ir="update",Iw=1e4,kw={get:function(e,t){var r=e[Ee];return t===Ee?r:t==="length"?r.getArrayLength_():typeof t=="string"&&!isNaN(t)?r.get_(parseInt(t)):Vt(ka,t)?ka[t]:e[t]},set:function(e,t,r){var n=e[Ee];return t==="length"&&n.setArrayLength_(r),typeof t=="symbol"||isNaN(t)?e[t]=r:n.set_(parseInt(t),r),!0},preventExtensions:function(){he(15)}},Ol=function(){function e(r,n,i,o){r===void 0&&(r="ObservableArray@"+Ht()),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 an(r),this.enhancer_=function(a,s){return n(a,s,r+"[..]")}}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.dehanceValues_=function(r){return this.dehancer!==void 0&&r.length>0?r.map(this.dehancer):r},t.intercept_=function(r){return $o(this,r)},t.observe_=function(r,n){return n===void 0&&(n=!1),n&&r({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),jo(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&he("Out of range: "+r);var n=this.values_.length;if(r!==n)if(r>n){for(var i=new Array(r-n),o=0;o<r-n;o++)i[o]=void 0;this.spliceWithArray_(n,0,i)}else this.spliceWithArray_(r,n-r)},t.updateArrayLength_=function(r,n){r!==this.lastKnownLength_&&he(16),this.lastKnownLength_+=n,this.legacyMode_&&n>0&&th(r+n+1)},t.spliceWithArray_=function(r,n,i){var o=this;dr(this.atom_);var a=this.values_.length;if(r===void 0?r=0:r>a?r=a:r<0&&(r=Math.max(0,a+r)),arguments.length===1?n=a-r:n==null?n=0:n=Math.max(0,Math.min(n,a-r)),i===void 0&&(i=Ea),Bt(this)){var s=Rt(this,{object:this.proxy_,type:tf,index:r,removedCount:n,added:i});if(!s)return Ea;n=s.removedCount,i=s.added}i=i.length===0?i:i.map(function(f){return o.enhancer_(f,void 0)}),this.legacyMode_;var u=i.length-n;this.updateArrayLength_(a,u);var l=this.spliceItemsIntoValues_(r,n,i);return(n!==0||i.length!==0)&&this.notifyArraySplice_(r,i,l),this.dehanceValues_(l)},t.spliceItemsIntoValues_=function(r,n,i){if(i.length<Iw){var o;return(o=this.values_).splice.apply(o,[r,n].concat(i))}else{var a=this.values_.slice(r,r+n),s=this.values_.slice(r+n);this.values_.length+=i.length-n;for(var u=0;u<i.length;u++)this.values_[r+u]=i[u];for(var l=0;l<s.length;l++)this.values_[r+i.length+l]=s[l];return a}},t.notifyArrayChildUpdate_=function(r,n,i){var o=!this.owned_&&ft(),a=or(this),s=a||o?{observableKind:"array",object:this.proxy_,type:ir,debugObjectName:this.atom_.name_,index:r,newValue:n,oldValue:i}:null;o&&Ot(s),this.atom_.reportChanged(),a&&ar(this,s),o&&At()},t.notifyArraySplice_=function(r,n,i){var o=!this.owned_&&ft(),a=or(this),s=a||o?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:tf,index:r,removed:i,added:n,removedCount:i.length,addedCount:n.length}:null;o&&Ot(s),this.atom_.reportChanged(),a&&ar(this,s),o&&At()},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx.array] Attempt to read an array index ("+r+") 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_[r])},t.set_=function(r,n){var i=this.values_;if(this.legacyMode_&&r>i.length&&he(17,r,i.length),r<i.length){dr(this.atom_);var o=i[r];if(Bt(this)){var a=Rt(this,{type:ir,object:this.proxy_,index:r,newValue:n});if(!a)return;n=a.newValue}n=this.enhancer_(n,o);var s=n!==o;s&&(i[r]=n,this.notifyArrayChildUpdate_(r,n,o))}else{for(var u=new Array(r+1-i.length),l=0;l<u.length-1;l++)u[l]=void 0;u[u.length-1]=n,this.spliceWithArray_(i.length,0,u)}},e}();function $w(e,t,r,n){return r===void 0&&(r="ObservableArray@"+Ht()),n===void 0&&(n=!1),yp(),Un(function(){var i=new Ol(r,t,n,!1);mp(i.values_,Ee,i);var o=new Proxy(i.values_,kw);return i.proxy_=o,e&&e.length&&i.spliceWithArray_(0,0,e),o})}var ka={clear:function(){return this.splice(0)},replace:function(e){var t=this[Ee];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];var o=this[Ee];switch(arguments.length){case 0:return[];case 1:return o.spliceWithArray_(e);case 2:return o.spliceWithArray_(e,t)}return o.spliceWithArray_(e,t,n)},spliceWithArray:function(e,t,r){return this[Ee].spliceWithArray_(e,t,r)},push:function(){for(var e=this[Ee],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.spliceWithArray_(e.values_.length,0,r),e.values_.length},pop:function(){return this.splice(Math.max(this[Ee].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[Ee],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.spliceWithArray_(0,0,r),e.values_.length},reverse:function(){return Y.trackingDerivation&&he(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Y.trackingDerivation&&he(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[Ee],r=t.dehanceValues_(t.values_).indexOf(e);return r>-1?(this.splice(r,1),!0):!1}};Le("at",St);Le("concat",St);Le("flat",St);Le("includes",St);Le("indexOf",St);Le("join",St);Le("lastIndexOf",St);Le("slice",St);Le("toString",St);Le("toLocaleString",St);Le("toSorted",St);Le("toSpliced",St);Le("with",St);Le("every",cr);Le("filter",cr);Le("find",cr);Le("findIndex",cr);Le("findLast",cr);Le("findLastIndex",cr);Le("flatMap",cr);Le("forEach",cr);Le("map",cr);Le("some",cr);Le("toReversed",cr);Le("reduce",Xp);Le("reduceRight",Xp);function Le(e,t){typeof Array.prototype[e]=="function"&&(ka[e]=t(e))}function St(e){return function(){var t=this[Ee];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function cr(e){return function(t,r){var n=this,i=this[Ee];i.atom_.reportObserved();var o=i.dehanceValues_(i.values_);return o[e](function(a,s){return t.call(r,a,s,n)})}}function Xp(e){return function(){var t=this,r=this[Ee];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(o,a,s){return i(o,a,s,t)},n[e].apply(n,arguments)}}var jw=on("ObservableArrayAdministration",Ol);function _i(e){return cs(e)&&jw(e[Ee])}var Cw={},Jr="add",$a="delete",Qp=function(){function e(r,n,i){var o=this;n===void 0&&(n=vi),i===void 0&&(i="ObservableMap@"+Ht()),this.enhancer_=void 0,this.name_=void 0,this[Ee]=Cw,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,We(Map)||he(18),Un(function(){o.keysAtom_=Tp(o.name_+".keys()"),o.data_=new Map,o.hasMap_=new Map,r&&o.merge(r)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var n=this;if(!Y.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var o=i=new Qr(this.has_(r),hs,this.name_+"."+wu(r)+"?",!1);this.hasMap_.set(r,o),wi(o,function(){return n.hasMap_.delete(r)})}return i.get()},t.set=function(r,n){var i=this.has_(r);if(Bt(this)){var o=Rt(this,{type:i?ir:Jr,object:this,newValue:n,name:r});if(!o)return this;n=o.newValue}return i?this.updateValue_(r,n):this.addValue_(r,n),this},t.delete=function(r){var n=this;if(dr(this.keysAtom_),Bt(this)){var i=Rt(this,{type:$a,object:this,name:r});if(!i)return!1}if(this.has_(r)){var o=ft(),a=or(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:$a,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return o&&Ot(s),xr(function(){var u;n.keysAtom_.reportChanged(),(u=n.hasMap_.get(r))==null||u.setNewValue_(!1);var l=n.data_.get(r);l.setNewValue_(void 0),n.data_.delete(r)}),a&&ar(this,s),o&&At(),!0}return!1},t.updateValue_=function(r,n){var i=this.data_.get(r);if(n=i.prepareNewValue_(n),n!==Y.UNCHANGED){var o=ft(),a=or(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:ir,object:this,oldValue:i.value_,name:r,newValue:n}:null;o&&Ot(s),i.setNewValue_(n),a&&ar(this,s),o&&At()}},t.addValue_=function(r,n){var i=this;dr(this.keysAtom_),xr(function(){var u,l=new Qr(n,i.enhancer_,i.name_+"."+wu(r),!1);i.data_.set(r,l),n=l.value_,(u=i.hasMap_.get(r))==null||u.setNewValue_(!0),i.keysAtom_.reportChanged()});var o=ft(),a=or(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:Jr,object:this,name:r,newValue:n}:null;o&&Ot(s),a&&ar(this,s),o&&At()},t.get=function(r){return this.has(r)?this.dehanceValue_(this.data_.get(r).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var r=this,n=this.keys();return rf({next:function(){var i=n.next(),o=i.done,a=i.value;return{done:o,value:o?void 0:r.get(a)}}})},t.entries=function(){var r=this,n=this.keys();return rf({next:function(){var i=n.next(),o=i.done,a=i.value;return{done:o,value:o?void 0:[a,r.get(a)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(r,n){for(var i=ei(this),o;!(o=i()).done;){var a=o.value,s=a[0],u=a[1];r.call(n,u,s,this)}},t.merge=function(r){var n=this;return br(r)&&(r=new Map(r)),xr(function(){sr(r)?G0(r).forEach(function(i){return n.set(i,r[i])}):Array.isArray(r)?r.forEach(function(i){var o=i[0],a=i[1];return n.set(o,a)}):mi(r)?(q0(r)||he(19,r),r.forEach(function(i,o){return n.set(o,i)})):r!=null&&he(20,r)}),this},t.clear=function(){var r=this;xr(function(){ze(function(){for(var n=ei(r.keys()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.replace=function(r){var n=this;return xr(function(){for(var i=Nw(r),o=new Map,a=!1,s=ei(n.data_.keys()),u;!(u=s()).done;){var l=u.value;if(!i.has(l)){var f=n.delete(l);if(f)a=!0;else{var d=n.data_.get(l);o.set(l,d)}}}for(var I=ei(i.entries()),E;!(E=I()).done;){var _=E.value,L=_[0],J=_[1],B=n.data_.has(L);if(n.set(L,J),n.data_.has(L)){var k=n.data_.get(L);o.set(L,k),B||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var F=n.data_.keys(),q=o.keys(),R=F.next(),Q=q.next();!R.done;){if(R.value!==Q.value){n.keysAtom_.reportChanged();break}R=F.next(),Q=q.next()}n.data_=o}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,n){return n===!0&&he("`observe` doesn't support fireImmediately=true in combination with maps."),jo(this,r)},t.intercept_=function(r){return $o(this,r)},bi(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),br=on("ObservableMap",Qp);function rf(e){return e[Symbol.toStringTag]="MapIterator",kl(e)}function Nw(e){if(mi(e)||br(e))return e;if(Array.isArray(e))return new Map(e);if(sr(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return he(21,e)}var Uw={},Zp=function(){function e(r,n,i){var o=this;n===void 0&&(n=vi),i===void 0&&(i="ObservableSet@"+Ht()),this.name_=void 0,this[Ee]=Uw,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,We(Set)||he(22),this.enhancer_=function(a,s){return n(a,s,i)},Un(function(){o.atom_=Tp(o.name_),r&&o.replace(r)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;xr(function(){ze(function(){for(var n=ei(r.data_.values()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.forEach=function(r,n){for(var i=ei(this),o;!(o=i()).done;){var a=o.value;r.call(n,a,a,this)}},t.add=function(r){var n=this;if(dr(this.atom_),Bt(this)){var i=Rt(this,{type:Jr,object:this,newValue:r});if(!i)return this;r=i.newValue}if(!this.has(r)){xr(function(){n.data_.add(n.enhancer_(r,void 0)),n.atom_.reportChanged()});var o=ft(),a=or(this),s=a||o?{observableKind:"set",debugObjectName:this.name_,type:Jr,object:this,newValue:r}:null;o&&Ot(s),a&&ar(this,s),o&&At()}return this},t.delete=function(r){var n=this;if(Bt(this)){var i=Rt(this,{type:$a,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var o=ft(),a=or(this),s=a||o?{observableKind:"set",debugObjectName:this.name_,type:$a,object:this,oldValue:r}:null;return o&&Ot(s),xr(function(){n.atom_.reportChanged(),n.data_.delete(r)}),a&&ar(this,s),o&&At(),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=this.values();return nf({next:function(){var n=r.next(),i=n.value,o=n.done;return o?{value:void 0,done:o}:{value:[i,i],done:o}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,n=this.data_.values();return nf({next:function(){var i=n.next(),o=i.value,a=i.done;return a?{value:void 0,done:a}:{value:r.dehanceValue_(o),done:a}}})},t.intersection=function(r){if(Er(r)&&!rr(r))return r.intersection(this);var n=new Set(this);return n.intersection(r)},t.union=function(r){if(Er(r)&&!rr(r))return r.union(this);var n=new Set(this);return n.union(r)},t.difference=function(r){return new Set(this).difference(r)},t.symmetricDifference=function(r){if(Er(r)&&!rr(r))return r.symmetricDifference(this);var n=new Set(this);return n.symmetricDifference(r)},t.isSubsetOf=function(r){return new Set(this).isSubsetOf(r)},t.isSupersetOf=function(r){return new Set(this).isSupersetOf(r)},t.isDisjointFrom=function(r){if(Er(r)&&!rr(r))return r.isDisjointFrom(this);var n=new Set(this);return n.isDisjointFrom(r)},t.replace=function(r){var n=this;return rr(r)&&(r=new Set(r)),xr(function(){Array.isArray(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):Er(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):r!=null&&he("Cannot initialize set from "+r)}),this},t.observe_=function(r,n){return n===!0&&he("`observe` doesn't support fireImmediately=true in combination with sets."),jo(this,r)},t.intercept_=function(r){return $o(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},bi(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),rr=on("ObservableSet",Zp);function nf(e){return e[Symbol.toStringTag]="SetIterator",kl(e)}var of=Object.create(null),af="remove",ku=function(){function e(r,n,i,o){n===void 0&&(n=new Map),o===void 0&&(o=E1),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 an(this.name_+".keys"),this.isPlainObject_=sr(this.target_),rh(this.defaultAnnotation_)||he("defaultAnnotation must be valid annotation"),this.appliedAnnotations_={}}var t=e.prototype;return t.getObservablePropValue_=function(r){return this.values_.get(r).get()},t.setObservablePropValue_=function(r,n){var i=this.values_.get(r);if(i instanceof Kt)return i.set(n),!0;if(Bt(this)){var o=Rt(this,{type:ir,object:this.proxy_||this.target_,name:r,newValue:n});if(!o)return null;n=o.newValue}if(n=i.prepareNewValue_(n),n!==Y.UNCHANGED){var a=or(this),s=ft(),u=a||s?{type:ir,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:i.value_,name:r,newValue:n}:null;s&&Ot(u),i.setNewValue_(n),a&&ar(this,u),s&&At()}return!0},t.get_=function(r){return Y.trackingDerivation&&!Vt(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,n,i){return i===void 0&&(i=!1),Vt(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,n):i?Reflect.set(this.target_,r,n):(this.target_[r]=n,!0):this.extend_(r,{value:n,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,i)},t.has_=function(r){if(!Y.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var n=this.pendingKeys_.get(r);return n||(n=new Qr(r in this.target_,hs,this.name_+"."+wu(r)+"?",!1),this.pendingKeys_.set(r,n)),n.get()},t.make_=function(r,n){if(n===!0&&(n=this.defaultAnnotation_),n!==!1){if(lf(this,n,r),!(r in this.target_)){var i;if((i=this.target_[_t])!=null&&i[r])return;he(1,n.annotationType_,this.name_+"."+r.toString())}for(var o=this.target_;o&&o!==Oo;){var a=_a(o,r);if(a){var s=n.make_(this,r,a,o);if(s===0)return;if(s===1)break}o=Object.getPrototypeOf(o)}uf(this,n,r)}},t.extend_=function(r,n,i,o){if(o===void 0&&(o=!1),i===!0&&(i=this.defaultAnnotation_),i===!1)return this.defineProperty_(r,n,o);lf(this,i,r);var a=i.extend_(this,r,n,o);return a&&uf(this,i,r),a},t.defineProperty_=function(r,n,i){i===void 0&&(i=!1),dr(this.keysAtom_);try{Dt();var o=this.delete_(r);if(!o)return o;if(Bt(this)){var a=Rt(this,{object:this.proxy_||this.target_,name:r,type:Jr,newValue:n.value});if(!a)return null;var s=a.newValue;n.value!==s&&(n=Sr({},n,{value:s}))}if(i){if(!Reflect.defineProperty(this.target_,r,n))return!1}else pr(this.target_,r,n);this.notifyPropertyAddition_(r,n.value)}finally{Mt()}return!0},t.defineObservableProperty_=function(r,n,i,o){o===void 0&&(o=!1),dr(this.keysAtom_);try{Dt();var a=this.delete_(r);if(!a)return a;if(Bt(this)){var s=Rt(this,{object:this.proxy_||this.target_,name:r,type:Jr,newValue:n});if(!s)return null;n=s.newValue}var u=sf(r),l={configurable:Y.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(o){if(!Reflect.defineProperty(this.target_,r,l))return!1}else pr(this.target_,r,l);var f=new Qr(n,i,this.name_+"."+r.toString(),!1);this.values_.set(r,f),this.notifyPropertyAddition_(r,f.value_)}finally{Mt()}return!0},t.defineComputedProperty_=function(r,n,i){i===void 0&&(i=!1),dr(this.keysAtom_);try{Dt();var o=this.delete_(r);if(!o)return o;if(Bt(this)){var a=Rt(this,{object:this.proxy_||this.target_,name:r,type:Jr,newValue:void 0});if(!a)return null}n.name||(n.name=this.name_+"."+r.toString()),n.context=this.proxy_||this.target_;var s=sf(r),u={configurable:Y.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:s.get,set:s.set};if(i){if(!Reflect.defineProperty(this.target_,r,u))return!1}else pr(this.target_,r,u);this.values_.set(r,new Kt(n)),this.notifyPropertyAddition_(r,void 0)}finally{Mt()}return!0},t.delete_=function(r,n){if(n===void 0&&(n=!1),dr(this.keysAtom_),!Vt(this.target_,r))return!0;if(Bt(this)){var i=Rt(this,{object:this.proxy_||this.target_,name:r,type:af});if(!i)return null}try{var o;Dt();var a=or(this),s=ft(),u=this.values_.get(r),l=void 0;if(!u&&(a||s)){var f;l=(f=_a(this.target_,r))==null?void 0:f.value}if(n){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(delete this.appliedAnnotations_[r],u&&(this.values_.delete(r),u instanceof Qr&&(l=u.value_),Rp(u)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(o=o.get(r))==null||o.set(r in this.target_),a||s){var d={type:af,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:l,name:r};s&&Ot(d),a&&ar(this,d),s&&At()}}finally{Mt()}return!0},t.observe_=function(r,n){return n===!0&&he("`observe` doesn't support the fire immediately property for observable objects."),jo(this,r)},t.intercept_=function(r){return $o(this,r)},t.notifyPropertyAddition_=function(r,n){var i,o=or(this),a=ft();if(o||a){var s=o||a?{type:Jr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:n}:null;a&&Ot(s),o&&ar(this,s),a&&At()}(i=this.pendingKeys_)==null||(i=i.get(r))==null||i.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),ds(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Ei(e,t){var r;if(t&&Tn(e)&&he("Options can't be provided for already observable objects."),Vt(e,Ee))return Sl(e)instanceof ku||he("Cannot convert '"+ja(e)+`' into observable object:
25
+ `)()}}function Vp(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 Vp(n,t,r+1)})}var yr=function(){function e(r,n,i,o){r===void 0&&(r="Reaction@"+Ht()),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_=Ft.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),Fp())},t.runReaction_=function(){if(!this.isDisposed){Dt(),this.isScheduled=!1;var r=Y.trackingContext;if(Y.trackingContext=this,xu(this)){this.isTrackPending=!0;try{this.onInvalidate_(),this.isTrackPending&&ft()&&ri({name:this.name_,type:"scheduled-reaction"})}catch(n){this.reportExceptionInDerivation_(n)}}Y.trackingContext=r,Mt()}},t.track=function(r){if(!this.isDisposed){Dt();var n=ft(),i;n&&(i=Date.now(),Ot({name:this.name_,type:"reaction"})),this.isRunning=!0;var o=Y.trackingContext;Y.trackingContext=this;var a=Np(this,r,void 0);Y.trackingContext=o,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Ou(this),Yo(a)&&this.reportExceptionInDerivation_(a.cause),n&&At({time:Date.now()-i}),Mt()}},t.reportExceptionInDerivation_=function(r){var n=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(Y.disableErrorBoundaries)throw r;var i="[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(i,r),ft()&&ri({type:"error",name:this.name_,message:i,error:""+r}),Y.globalReactionErrorHandlers.forEach(function(o){return o(r,n)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Dt(),Ou(this),Mt()))},t.getDisposer_=function(r){var n=this,i=function o(){n.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",o)};return r==null||r.addEventListener==null||r.addEventListener("abort",i),i[Ee]=this,i},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){r===void 0&&(r=!1),Qp(this,r)},vi(e,[{key:"isDisposed",get:function(){return Et(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=xt(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return Et(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=xt(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return Et(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=xt(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return Et(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=xt(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return Et(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=xt(this.flags_,e.diffValueMask_,r===1)}}])}();yr.isDisposedMask_=1;yr.isScheduledMask_=2;yr.isTrackPendingMask_=4;yr.isRunningMask_=8;yr.diffValueMask_=16;var Yc=100,Au=function(e){return e()};function Fp(){Y.inBatch>0||Y.isRunningReactions||Au(gw)}function gw(){Y.isRunningReactions=!0;for(var e=Y.pendingReactions,t=0;e.length>0;){++t===Yc&&(console.error("Reaction doesn't converge to a stable state after "+Yc+" 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 Ia=an("Reaction",yr);function mw(e){var t=Au;Au=function(r){return e(function(){return t(r)})}}function ft(){return!!Y.spyListeners.length}function ri(e){if(Y.spyListeners.length)for(var t=Y.spyListeners,r=0,n=t.length;r<n;r++)t[r](e)}function Ot(e){var t=Sr({},e,{spyReportStart:!0});ri(t)}var bw={type:"report-end",spyReportEnd:!0};function At(e){ri(e?Sr({},e,{type:"report-end",spyReportEnd:!0}):bw)}function vw(e){return Y.spyListeners.push(e),Tl(function(){Y.spyListeners=Y.spyListeners.filter(function(t){return t!==e})})}var Ol="action",ww="action.bound",zp="autoAction",Tw="autoAction.bound",Kp="<unnamed action>",Su=Io(Ol),_w=Io(ww,{bound:!0}),Iu=Io(zp,{autoAction:!0}),Ew=Io(Tw,{autoAction:!0,bound:!0});function Gp(e){var t=function(r,n){if(We(r))return vn(r.name||Kp,r,e);if(We(n))return vn(r,n,e);if(So(n))return(e?Iu:Su).decorate_20223_(r,n);if(bn(n))return Ao(r,n,e?Iu:Su);if(bn(r))return hr(Io(e?zp:Ol,{name:r,autoAction:e}));he("Invalid arguments for `action`")};return t}var Lt=Gp(!1);Object.assign(Lt,Su);var io=Gp(!0);Object.assign(io,Iu);Lt.bound=hr(_w);io.bound=hr(Ew);function oo(e){return Cp(e.name||Kp,!1,e,this,void 0)}function wn(e){return We(e)&&e.isMobxAction===!0}function Gt(e,t){var r,n,i,o;t===void 0&&(t=wl),We(e)||he("Autorun expects a function as first argument"),wn(e)&&he("Autorun does not accept actions since actions are untrackable");var a=(r=(n=t)==null?void 0:n.name)!=null?r:e.name||"Autorun@"+Ht(),s=!t.scheduler&&!t.delay,u;if(s)u=new yr(a,function(){this.track(d)},t.onError,t.requiresObservable);else{var l=qp(t),f=!1;u=new yr(a,function(){f||(f=!0,l(function(){f=!1,u.isDisposed||u.track(d)}))},t.onError,t.requiresObservable)}function d(){e(u)}return(i=t)!=null&&(i=i.signal)!=null&&i.aborted||u.schedule_(),u.getDisposer_((o=t)==null?void 0:o.signal)}var xw=function(e){return e()};function qp(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xw}function Ow(e,t,r){var n,i,o;r===void 0&&(r=wl),(!We(e)||!We(t))&&he("First and second argument to reaction should be functions"),sr(r)||he("Third argument of reactions should be an object");var a=(n=r.name)!=null?n:"Reaction@"+Ht(),s=Lt(a,r.onError?Aw(r.onError,t):t),u=!r.scheduler&&!r.delay,l=qp(r),f=!0,d=!1,I,E=r.compareStructural?et.structural:r.equals||et.default,_=new yr(a,function(){f||u?L():d||(d=!0,l(L))},r.onError,r.requiresObservable);function L(){if(d=!1,!_.isDisposed){var J=!1,B=I;_.track(function(){var k=rw(!1,function(){return e(_)});J=f||!E(I,k),I=k}),(f&&r.fireImmediately||!f&&J)&&s(I,B,_),f=!1}}return(i=r)!=null&&(i=i.signal)!=null&&i.aborted||_.schedule_(),_.getDisposer_((o=r)==null?void 0:o.signal)}function Aw(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var Sw="onBO",Iw="onBUO";function bs(e,t,r){return Wp(Sw,e,t,r)}function Ti(e,t,r){return Wp(Iw,e,t,r)}function Wp(e,t,r,n){var i=typeof n=="function"?ur(t,r):ur(t),o=We(n)?n:r,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var s=i[a];s&&(s.delete(o),s.size===0&&delete i[a])}}var kw="never",Wo="always",$w="observed";function jw(e){e.isolateGlobalState===!0&&lw();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(Y.useProxies=t===Wo?!0:t===kw?!1:typeof Proxy<"u"),t==="ifavailable"&&(Y.verifyProxies=!0),r!==void 0){var n=r===Wo?Wo:r===$w;Y.enforceActions=n,Y.allowStateChanges=!(n===!0||n===Wo)}["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&&mw(e.reactionScheduler)}function Cw(e,t,r,n){arguments.length>4&&he("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&he("'extendObservable' expects an object as first argument"),br(e)&&he("'extendObservable' should not be used on maps, use map.merge instead"),sr(t)||he("'extendObservable' only accepts plain objects as second argument"),(ii(t)||ii(r))&&he("Extending an object with another observable (object) is not supported");var i=a1(t);return Un(function(){var o=xi(e,n)[Ee];ds(i).forEach(function(a){o.extend_(a,i[a],r&&a in r?r[a]:!0)})}),e}function vs(e,t){return Hp(ur(e,t))}function Hp(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=Nw(e.observing_).map(Hp)),t}function ka(e,t){return Jp(ur(e,t))}function Jp(e){var t={name:e.name_};return fw(e)&&(t.observers=Array.from(dw(e)).map(Jp)),t}function Nw(e){return Array.from(new Set(e))}var Uw=0;function Xp(){this.message="FLOW_CANCELLED"}Xp.prototype=Object.create(Error.prototype);var Js=Op("flow"),Pw=Op("flow.bound",{bound:!0}),ni=Object.assign(function(e,t){if(So(t))return Js.decorate_20223_(e,t);if(bn(t))return Ao(e,t,Js);arguments.length!==1&&he("Flow expects single argument with generator function");var r=e,n=r.name||"<unnamed flow>",i=function(){var o=this,a=arguments,s=++Uw,u=Lt(n+" - runid: "+s+" - init",r).apply(o,a),l,f=void 0,d=new Promise(function(I,E){var _=0;l=E;function L(k){f=void 0;var F;try{F=Lt(n+" - runid: "+s+" - yield "+_++,u.next).call(u,k)}catch(G){return E(G)}B(F)}function J(k){f=void 0;var F;try{F=Lt(n+" - runid: "+s+" - yield "+_++,u.throw).call(u,k)}catch(G){return E(G)}B(F)}function B(k){if(We(k?.then)){k.then(B,E);return}return k.done?I(k.value):(f=Promise.resolve(k.value),f.then(L,J))}L(void 0)});return d.cancel=Lt(n+" - runid: "+s+" - cancel",function(){try{f&&ef(f);var I=u.return(void 0),E=Promise.resolve(I.value);E.then(Yn,Yn),ef(E),l(new Xp)}catch(_){l(_)}}),d};return i.isMobXFlow=!0,i},Js);ni.bound=hr(Pw);function ef(e){We(e.cancel)&&e.cancel()}function ao(e){return e?.isMobXFlow===!0}function Bw(e,t){return e?t!==void 0?br(e)||Ei(e)?he("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."):Tn(e)?e[Ee].values_.has(t):!1:Tn(e)||!!e[Ee]||_l(e)||Ia(e)||ko(e):!1}function ii(e){return arguments.length!==1&&he("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),Bw(e)}function Rw(e){if(Tn(e))return e[Ee].ownKeys_();he(38)}function Ho(e,t,r){return e.set(t,r),r}function Qn(e,t){if(e==null||typeof e!="object"||e instanceof Date||!ii(e))return e;if(iw(e)||ko(e))return Qn(e.get(),t);if(t.has(e))return t.get(e);if(Ei(e)){var r=Ho(t,e,new Array(e.length));return e.forEach(function(a,s){r[s]=Qn(a,t)}),r}if(rr(e)){var n=Ho(t,e,new Set);return e.forEach(function(a){n.add(Qn(a,t))}),n}if(br(e)){var i=Ho(t,e,new Map);return e.forEach(function(a,s){i.set(s,Qn(a,t))}),i}else{var o=Ho(t,e,{});return Rw(e).forEach(function(a){Oo.propertyIsEnumerable.call(e,a)&&(o[a]=Qn(e[a],t))}),o}}function Ar(e,t){return t&&he("toJS no longer supports options"),Qn(e,new Map)}function Qp(){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=Dw(r);if(!i)return he("'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_===Ft.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled"),i.isTracing_=e?Ft.BREAK:Ft.LOG}function Dw(e){switch(e.length){case 0:return Y.trackingDerivation;case 1:return ur(e[0]);case 2:return ur(e[0],e[1])}}function xr(e,t){t===void 0&&(t=void 0),Dt();try{return e.apply(t)}finally{Mt()}}function dn(e){return e[Ee]}var Mw={has:function(e,t){return Y.trackingDerivation&&Fi("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),dn(e).has_(t)},get:function(e,t){return dn(e).get_(t)},set:function(e,t,r){var n;return bn(t)?(dn(e).values_.has(t)||Fi("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(n=dn(e).set_(t,r,!0))!=null?n:!0):!1},deleteProperty:function(e,t){var r;return Fi("delete properties from an observable object. Use 'remove' from 'mobx' instead."),bn(t)?(r=dn(e).delete_(t,!0))!=null?r:!0:!1},defineProperty:function(e,t,r){var n;return Fi("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(n=dn(e).defineProperty_(t,r))!=null?n:!0},ownKeys:function(e){return Y.trackingDerivation&&Fi("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),dn(e).ownKeys_()},preventExtensions:function(e){he(13)}};function Lw(e,t){var r,n;return mp(),e=xi(e,t),(n=(r=e[Ee]).proxy_)!=null?n:r.proxy_=new Proxy(e,Mw)}function Bt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function $o(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),Tl(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Rt(e,t){var r=Nn();try{for(var n=[].concat(e.interceptors_||[]),i=0,o=n.length;i<o&&(t=n[i](t),t&&!t.type&&he(14),!!t);i++);return t}finally{Or(r)}}function or(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function jo(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),Tl(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function ar(e,t){var r=Nn(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,o=n.length;i<o;i++)n[i](t);Or(r)}}function _i(e,t,r){return Un(function(){var n,i=xi(e,r)[Ee];t&&e[_t]&&he("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(n=t)!=null||(t=f1(e)),ds(t).forEach(function(o){return i.make_(o,t[o])})}),e}var tf="splice",ir="update",Vw=1e4,Fw={get:function(e,t){var r=e[Ee];return t===Ee?r:t==="length"?r.getArrayLength_():typeof t=="string"&&!isNaN(t)?r.get_(parseInt(t)):Vt($a,t)?$a[t]:e[t]},set:function(e,t,r){var n=e[Ee];return t==="length"&&n.setArrayLength_(r),typeof t=="symbol"||isNaN(t)?e[t]=r:n.set_(parseInt(t),r),!0},preventExtensions:function(){he(15)}},Al=function(){function e(r,n,i,o){r===void 0&&(r="ObservableArray@"+Ht()),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 sn(r),this.enhancer_=function(a,s){return n(a,s,r+"[..]")}}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.dehanceValues_=function(r){return this.dehancer!==void 0&&r.length>0?r.map(this.dehancer):r},t.intercept_=function(r){return $o(this,r)},t.observe_=function(r,n){return n===void 0&&(n=!1),n&&r({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),jo(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&he("Out of range: "+r);var n=this.values_.length;if(r!==n)if(r>n){for(var i=new Array(r-n),o=0;o<r-n;o++)i[o]=void 0;this.spliceWithArray_(n,0,i)}else this.spliceWithArray_(r,n-r)},t.updateArrayLength_=function(r,n){r!==this.lastKnownLength_&&he(16),this.lastKnownLength_+=n,this.legacyMode_&&n>0&&nh(r+n+1)},t.spliceWithArray_=function(r,n,i){var o=this;dr(this.atom_);var a=this.values_.length;if(r===void 0?r=0:r>a?r=a:r<0&&(r=Math.max(0,a+r)),arguments.length===1?n=a-r:n==null?n=0:n=Math.max(0,Math.min(n,a-r)),i===void 0&&(i=xa),Bt(this)){var s=Rt(this,{object:this.proxy_,type:tf,index:r,removedCount:n,added:i});if(!s)return xa;n=s.removedCount,i=s.added}i=i.length===0?i:i.map(function(f){return o.enhancer_(f,void 0)}),this.legacyMode_;var u=i.length-n;this.updateArrayLength_(a,u);var l=this.spliceItemsIntoValues_(r,n,i);return(n!==0||i.length!==0)&&this.notifyArraySplice_(r,i,l),this.dehanceValues_(l)},t.spliceItemsIntoValues_=function(r,n,i){if(i.length<Vw){var o;return(o=this.values_).splice.apply(o,[r,n].concat(i))}else{var a=this.values_.slice(r,r+n),s=this.values_.slice(r+n);this.values_.length+=i.length-n;for(var u=0;u<i.length;u++)this.values_[r+u]=i[u];for(var l=0;l<s.length;l++)this.values_[r+i.length+l]=s[l];return a}},t.notifyArrayChildUpdate_=function(r,n,i){var o=!this.owned_&&ft(),a=or(this),s=a||o?{observableKind:"array",object:this.proxy_,type:ir,debugObjectName:this.atom_.name_,index:r,newValue:n,oldValue:i}:null;o&&Ot(s),this.atom_.reportChanged(),a&&ar(this,s),o&&At()},t.notifyArraySplice_=function(r,n,i){var o=!this.owned_&&ft(),a=or(this),s=a||o?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:tf,index:r,removed:i,added:n,removedCount:i.length,addedCount:n.length}:null;o&&Ot(s),this.atom_.reportChanged(),a&&ar(this,s),o&&At()},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx.array] Attempt to read an array index ("+r+") 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_[r])},t.set_=function(r,n){var i=this.values_;if(this.legacyMode_&&r>i.length&&he(17,r,i.length),r<i.length){dr(this.atom_);var o=i[r];if(Bt(this)){var a=Rt(this,{type:ir,object:this.proxy_,index:r,newValue:n});if(!a)return;n=a.newValue}n=this.enhancer_(n,o);var s=n!==o;s&&(i[r]=n,this.notifyArrayChildUpdate_(r,n,o))}else{for(var u=new Array(r+1-i.length),l=0;l<u.length-1;l++)u[l]=void 0;u[u.length-1]=n,this.spliceWithArray_(i.length,0,u)}},e}();function zw(e,t,r,n){return r===void 0&&(r="ObservableArray@"+Ht()),n===void 0&&(n=!1),mp(),Un(function(){var i=new Al(r,t,n,!1);vp(i.values_,Ee,i);var o=new Proxy(i.values_,Fw);return i.proxy_=o,e&&e.length&&i.spliceWithArray_(0,0,e),o})}var $a={clear:function(){return this.splice(0)},replace:function(e){var t=this[Ee];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];var o=this[Ee];switch(arguments.length){case 0:return[];case 1:return o.spliceWithArray_(e);case 2:return o.spliceWithArray_(e,t)}return o.spliceWithArray_(e,t,n)},spliceWithArray:function(e,t,r){return this[Ee].spliceWithArray_(e,t,r)},push:function(){for(var e=this[Ee],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.spliceWithArray_(e.values_.length,0,r),e.values_.length},pop:function(){return this.splice(Math.max(this[Ee].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[Ee],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.spliceWithArray_(0,0,r),e.values_.length},reverse:function(){return Y.trackingDerivation&&he(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Y.trackingDerivation&&he(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[Ee],r=t.dehanceValues_(t.values_).indexOf(e);return r>-1?(this.splice(r,1),!0):!1}};Le("at",St);Le("concat",St);Le("flat",St);Le("includes",St);Le("indexOf",St);Le("join",St);Le("lastIndexOf",St);Le("slice",St);Le("toString",St);Le("toLocaleString",St);Le("toSorted",St);Le("toSpliced",St);Le("with",St);Le("every",cr);Le("filter",cr);Le("find",cr);Le("findIndex",cr);Le("findLast",cr);Le("findLastIndex",cr);Le("flatMap",cr);Le("forEach",cr);Le("map",cr);Le("some",cr);Le("toReversed",cr);Le("reduce",Zp);Le("reduceRight",Zp);function Le(e,t){typeof Array.prototype[e]=="function"&&($a[e]=t(e))}function St(e){return function(){var t=this[Ee];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function cr(e){return function(t,r){var n=this,i=this[Ee];i.atom_.reportObserved();var o=i.dehanceValues_(i.values_);return o[e](function(a,s){return t.call(r,a,s,n)})}}function Zp(e){return function(){var t=this,r=this[Ee];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(o,a,s){return i(o,a,s,t)},n[e].apply(n,arguments)}}var Kw=an("ObservableArrayAdministration",Al);function Ei(e){return cs(e)&&Kw(e[Ee])}var Gw={},Jr="add",ja="delete",Yp=function(){function e(r,n,i){var o=this;n===void 0&&(n=wi),i===void 0&&(i="ObservableMap@"+Ht()),this.enhancer_=void 0,this.name_=void 0,this[Ee]=Gw,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,We(Map)||he(18),Un(function(){o.keysAtom_=Ep(o.name_+".keys()"),o.data_=new Map,o.hasMap_=new Map,r&&o.merge(r)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var n=this;if(!Y.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var o=i=new Qr(this.has_(r),hs,this.name_+"."+wu(r)+"?",!1);this.hasMap_.set(r,o),Ti(o,function(){return n.hasMap_.delete(r)})}return i.get()},t.set=function(r,n){var i=this.has_(r);if(Bt(this)){var o=Rt(this,{type:i?ir:Jr,object:this,newValue:n,name:r});if(!o)return this;n=o.newValue}return i?this.updateValue_(r,n):this.addValue_(r,n),this},t.delete=function(r){var n=this;if(dr(this.keysAtom_),Bt(this)){var i=Rt(this,{type:ja,object:this,name:r});if(!i)return!1}if(this.has_(r)){var o=ft(),a=or(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:ja,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return o&&Ot(s),xr(function(){var u;n.keysAtom_.reportChanged(),(u=n.hasMap_.get(r))==null||u.setNewValue_(!1);var l=n.data_.get(r);l.setNewValue_(void 0),n.data_.delete(r)}),a&&ar(this,s),o&&At(),!0}return!1},t.updateValue_=function(r,n){var i=this.data_.get(r);if(n=i.prepareNewValue_(n),n!==Y.UNCHANGED){var o=ft(),a=or(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:ir,object:this,oldValue:i.value_,name:r,newValue:n}:null;o&&Ot(s),i.setNewValue_(n),a&&ar(this,s),o&&At()}},t.addValue_=function(r,n){var i=this;dr(this.keysAtom_),xr(function(){var u,l=new Qr(n,i.enhancer_,i.name_+"."+wu(r),!1);i.data_.set(r,l),n=l.value_,(u=i.hasMap_.get(r))==null||u.setNewValue_(!0),i.keysAtom_.reportChanged()});var o=ft(),a=or(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:Jr,object:this,name:r,newValue:n}:null;o&&Ot(s),a&&ar(this,s),o&&At()},t.get=function(r){return this.has(r)?this.dehanceValue_(this.data_.get(r).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var r=this,n=this.keys();return rf({next:function(){var i=n.next(),o=i.done,a=i.value;return{done:o,value:o?void 0:r.get(a)}}})},t.entries=function(){var r=this,n=this.keys();return rf({next:function(){var i=n.next(),o=i.done,a=i.value;return{done:o,value:o?void 0:[a,r.get(a)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(r,n){for(var i=ei(this),o;!(o=i()).done;){var a=o.value,s=a[0],u=a[1];r.call(n,u,s,this)}},t.merge=function(r){var n=this;return br(r)&&(r=new Map(r)),xr(function(){sr(r)?o1(r).forEach(function(i){return n.set(i,r[i])}):Array.isArray(r)?r.forEach(function(i){var o=i[0],a=i[1];return n.set(o,a)}):bi(r)?(i1(r)||he(19,r),r.forEach(function(i,o){return n.set(o,i)})):r!=null&&he(20,r)}),this},t.clear=function(){var r=this;xr(function(){ze(function(){for(var n=ei(r.keys()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.replace=function(r){var n=this;return xr(function(){for(var i=qw(r),o=new Map,a=!1,s=ei(n.data_.keys()),u;!(u=s()).done;){var l=u.value;if(!i.has(l)){var f=n.delete(l);if(f)a=!0;else{var d=n.data_.get(l);o.set(l,d)}}}for(var I=ei(i.entries()),E;!(E=I()).done;){var _=E.value,L=_[0],J=_[1],B=n.data_.has(L);if(n.set(L,J),n.data_.has(L)){var k=n.data_.get(L);o.set(L,k),B||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var F=n.data_.keys(),G=o.keys(),R=F.next(),Q=G.next();!R.done;){if(R.value!==Q.value){n.keysAtom_.reportChanged();break}R=F.next(),Q=G.next()}n.data_=o}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,n){return n===!0&&he("`observe` doesn't support fireImmediately=true in combination with maps."),jo(this,r)},t.intercept_=function(r){return $o(this,r)},vi(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),br=an("ObservableMap",Yp);function rf(e){return e[Symbol.toStringTag]="MapIterator",$l(e)}function qw(e){if(bi(e)||br(e))return e;if(Array.isArray(e))return new Map(e);if(sr(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return he(21,e)}var Ww={},eh=function(){function e(r,n,i){var o=this;n===void 0&&(n=wi),i===void 0&&(i="ObservableSet@"+Ht()),this.name_=void 0,this[Ee]=Ww,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,We(Set)||he(22),this.enhancer_=function(a,s){return n(a,s,i)},Un(function(){o.atom_=Ep(o.name_),r&&o.replace(r)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;xr(function(){ze(function(){for(var n=ei(r.data_.values()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.forEach=function(r,n){for(var i=ei(this),o;!(o=i()).done;){var a=o.value;r.call(n,a,a,this)}},t.add=function(r){var n=this;if(dr(this.atom_),Bt(this)){var i=Rt(this,{type:Jr,object:this,newValue:r});if(!i)return this;r=i.newValue}if(!this.has(r)){xr(function(){n.data_.add(n.enhancer_(r,void 0)),n.atom_.reportChanged()});var o=ft(),a=or(this),s=a||o?{observableKind:"set",debugObjectName:this.name_,type:Jr,object:this,newValue:r}:null;o&&Ot(s),a&&ar(this,s),o&&At()}return this},t.delete=function(r){var n=this;if(Bt(this)){var i=Rt(this,{type:ja,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var o=ft(),a=or(this),s=a||o?{observableKind:"set",debugObjectName:this.name_,type:ja,object:this,oldValue:r}:null;return o&&Ot(s),xr(function(){n.atom_.reportChanged(),n.data_.delete(r)}),a&&ar(this,s),o&&At(),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=this.values();return nf({next:function(){var n=r.next(),i=n.value,o=n.done;return o?{value:void 0,done:o}:{value:[i,i],done:o}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,n=this.data_.values();return nf({next:function(){var i=n.next(),o=i.value,a=i.done;return a?{value:void 0,done:a}:{value:r.dehanceValue_(o),done:a}}})},t.intersection=function(r){if(Er(r)&&!rr(r))return r.intersection(this);var n=new Set(this);return n.intersection(r)},t.union=function(r){if(Er(r)&&!rr(r))return r.union(this);var n=new Set(this);return n.union(r)},t.difference=function(r){return new Set(this).difference(r)},t.symmetricDifference=function(r){if(Er(r)&&!rr(r))return r.symmetricDifference(this);var n=new Set(this);return n.symmetricDifference(r)},t.isSubsetOf=function(r){return new Set(this).isSubsetOf(r)},t.isSupersetOf=function(r){return new Set(this).isSupersetOf(r)},t.isDisjointFrom=function(r){if(Er(r)&&!rr(r))return r.isDisjointFrom(this);var n=new Set(this);return n.isDisjointFrom(r)},t.replace=function(r){var n=this;return rr(r)&&(r=new Set(r)),xr(function(){Array.isArray(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):Er(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):r!=null&&he("Cannot initialize set from "+r)}),this},t.observe_=function(r,n){return n===!0&&he("`observe` doesn't support fireImmediately=true in combination with sets."),jo(this,r)},t.intercept_=function(r){return $o(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},vi(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),rr=an("ObservableSet",eh);function nf(e){return e[Symbol.toStringTag]="SetIterator",$l(e)}var of=Object.create(null),af="remove",ku=function(){function e(r,n,i,o){n===void 0&&(n=new Map),o===void 0&&(o=B1),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 sn(this.name_+".keys"),this.isPlainObject_=sr(this.target_),ih(this.defaultAnnotation_)||he("defaultAnnotation must be valid annotation"),this.appliedAnnotations_={}}var t=e.prototype;return t.getObservablePropValue_=function(r){return this.values_.get(r).get()},t.setObservablePropValue_=function(r,n){var i=this.values_.get(r);if(i instanceof Kt)return i.set(n),!0;if(Bt(this)){var o=Rt(this,{type:ir,object:this.proxy_||this.target_,name:r,newValue:n});if(!o)return null;n=o.newValue}if(n=i.prepareNewValue_(n),n!==Y.UNCHANGED){var a=or(this),s=ft(),u=a||s?{type:ir,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:i.value_,name:r,newValue:n}:null;s&&Ot(u),i.setNewValue_(n),a&&ar(this,u),s&&At()}return!0},t.get_=function(r){return Y.trackingDerivation&&!Vt(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,n,i){return i===void 0&&(i=!1),Vt(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,n):i?Reflect.set(this.target_,r,n):(this.target_[r]=n,!0):this.extend_(r,{value:n,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,i)},t.has_=function(r){if(!Y.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var n=this.pendingKeys_.get(r);return n||(n=new Qr(r in this.target_,hs,this.name_+"."+wu(r)+"?",!1),this.pendingKeys_.set(r,n)),n.get()},t.make_=function(r,n){if(n===!0&&(n=this.defaultAnnotation_),n!==!1){if(lf(this,n,r),!(r in this.target_)){var i;if((i=this.target_[_t])!=null&&i[r])return;he(1,n.annotationType_,this.name_+"."+r.toString())}for(var o=this.target_;o&&o!==Oo;){var a=Ea(o,r);if(a){var s=n.make_(this,r,a,o);if(s===0)return;if(s===1)break}o=Object.getPrototypeOf(o)}uf(this,n,r)}},t.extend_=function(r,n,i,o){if(o===void 0&&(o=!1),i===!0&&(i=this.defaultAnnotation_),i===!1)return this.defineProperty_(r,n,o);lf(this,i,r);var a=i.extend_(this,r,n,o);return a&&uf(this,i,r),a},t.defineProperty_=function(r,n,i){i===void 0&&(i=!1),dr(this.keysAtom_);try{Dt();var o=this.delete_(r);if(!o)return o;if(Bt(this)){var a=Rt(this,{object:this.proxy_||this.target_,name:r,type:Jr,newValue:n.value});if(!a)return null;var s=a.newValue;n.value!==s&&(n=Sr({},n,{value:s}))}if(i){if(!Reflect.defineProperty(this.target_,r,n))return!1}else pr(this.target_,r,n);this.notifyPropertyAddition_(r,n.value)}finally{Mt()}return!0},t.defineObservableProperty_=function(r,n,i,o){o===void 0&&(o=!1),dr(this.keysAtom_);try{Dt();var a=this.delete_(r);if(!a)return a;if(Bt(this)){var s=Rt(this,{object:this.proxy_||this.target_,name:r,type:Jr,newValue:n});if(!s)return null;n=s.newValue}var u=sf(r),l={configurable:Y.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(o){if(!Reflect.defineProperty(this.target_,r,l))return!1}else pr(this.target_,r,l);var f=new Qr(n,i,this.name_+"."+r.toString(),!1);this.values_.set(r,f),this.notifyPropertyAddition_(r,f.value_)}finally{Mt()}return!0},t.defineComputedProperty_=function(r,n,i){i===void 0&&(i=!1),dr(this.keysAtom_);try{Dt();var o=this.delete_(r);if(!o)return o;if(Bt(this)){var a=Rt(this,{object:this.proxy_||this.target_,name:r,type:Jr,newValue:void 0});if(!a)return null}n.name||(n.name=this.name_+"."+r.toString()),n.context=this.proxy_||this.target_;var s=sf(r),u={configurable:Y.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:s.get,set:s.set};if(i){if(!Reflect.defineProperty(this.target_,r,u))return!1}else pr(this.target_,r,u);this.values_.set(r,new Kt(n)),this.notifyPropertyAddition_(r,void 0)}finally{Mt()}return!0},t.delete_=function(r,n){if(n===void 0&&(n=!1),dr(this.keysAtom_),!Vt(this.target_,r))return!0;if(Bt(this)){var i=Rt(this,{object:this.proxy_||this.target_,name:r,type:af});if(!i)return null}try{var o;Dt();var a=or(this),s=ft(),u=this.values_.get(r),l=void 0;if(!u&&(a||s)){var f;l=(f=Ea(this.target_,r))==null?void 0:f.value}if(n){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(delete this.appliedAnnotations_[r],u&&(this.values_.delete(r),u instanceof Qr&&(l=u.value_),Mp(u)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(o=o.get(r))==null||o.set(r in this.target_),a||s){var d={type:af,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:l,name:r};s&&Ot(d),a&&ar(this,d),s&&At()}}finally{Mt()}return!0},t.observe_=function(r,n){return n===!0&&he("`observe` doesn't support the fire immediately property for observable objects."),jo(this,r)},t.intercept_=function(r){return $o(this,r)},t.notifyPropertyAddition_=function(r,n){var i,o=or(this),a=ft();if(o||a){var s=o||a?{type:Jr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:n}:null;a&&Ot(s),o&&ar(this,s),a&&At()}(i=this.pendingKeys_)==null||(i=i.get(r))==null||i.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),ds(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function xi(e,t){var r;if(t&&Tn(e)&&he("Options can't be provided for already observable objects."),Vt(e,Ee))return Il(e)instanceof ku||he("Cannot convert '"+Ca(e)+`' into observable object:
26
26
  The target is already observable of different type.
27
- Extending builtins is not supported.`),e;Object.isExtensible(e)||he("Cannot make the designated object observable; it is not extensible");var n=(r=t?.name)!=null?r:(sr(e)?"ObservableObject":e.constructor.name)+"@"+Ht(),i=new ku(e,new Map,String(n),U1(t));return fs(e,Ee,i),e}var Pw=on("ObservableObjectAdministration",ku);function sf(e){return of[e]||(of[e]={get:function(){return this[Ee].getObservablePropValue_(e)},set:function(t){return this[Ee].setObservablePropValue_(e,t)}})}function Tn(e){return cs(e)?Pw(e[Ee]):!1}function uf(e,t,r){var n;e.appliedAnnotations_[r]=t,(n=e.target_[_t])==null||delete n[r]}function lf(e,t,r){if(rh(t)||he("Cannot annotate '"+e.name_+"."+r.toString()+"': Invalid annotation."),!xa(t)&&Vt(e.appliedAnnotations_,r)){var n=e.name_+"."+r.toString(),i=e.appliedAnnotations_[r].annotationType_,o=t.annotationType_;he("Cannot apply '"+o+"' to '"+n+"':"+(`
27
+ Extending builtins is not supported.`),e;Object.isExtensible(e)||he("Cannot make the designated object observable; it is not extensible");var n=(r=t?.name)!=null?r:(sr(e)?"ObservableObject":e.constructor.name)+"@"+Ht(),i=new ku(e,new Map,String(n),W1(t));return fs(e,Ee,i),e}var Hw=an("ObservableObjectAdministration",ku);function sf(e){return of[e]||(of[e]={get:function(){return this[Ee].getObservablePropValue_(e)},set:function(t){return this[Ee].setObservablePropValue_(e,t)}})}function Tn(e){return cs(e)?Hw(e[Ee]):!1}function uf(e,t,r){var n;e.appliedAnnotations_[r]=t,(n=e.target_[_t])==null||delete n[r]}function lf(e,t,r){if(ih(t)||he("Cannot annotate '"+e.name_+"."+r.toString()+"': Invalid annotation."),!Oa(t)&&Vt(e.appliedAnnotations_,r)){var n=e.name_+"."+r.toString(),i=e.appliedAnnotations_[r].annotationType_,o=t.annotationType_;he("Cannot apply '"+o+"' to '"+n+"':"+(`
28
28
  The field is already annotated with '`+i+"'.")+`
29
29
  Re-annotating fields is not allowed.
30
- Use 'override' annotation for methods overridden by subclass.`)}}var Bw=eh(0),Rw=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Xs=0,Yp=function(){};function Dw(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}Dw(Yp,Array.prototype);var Al=function(e){function t(n,i,o,a){var s;return o===void 0&&(o="ObservableArray@"+Ht()),a===void 0&&(a=!1),s=e.call(this)||this,Un(function(){var u=new Ol(o,i,a,!0);u.proxy_=s,mp(s,Ee,u),n&&n.length&&s.spliceWithArray(0,0,n),Rw&&Object.defineProperty(s,"0",Bw)}),s}wp(t,e);var r=t.prototype;return r.concat=function(){this[Ee].atom_.reportObserved();for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return Array.prototype.concat.apply(this.slice(),i.map(function(a){return _i(a)?a.slice():a}))},r[Symbol.iterator]=function(){var n=this,i=0;return kl({next:function(){return i<n.length?{value:n[i++],done:!1}:{done:!0,value:void 0}}})},bi(t,[{key:"length",get:function(){return this[Ee].getArrayLength_()},set:function(n){this[Ee].setArrayLength_(n)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(Yp);Object.entries(ka).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&fs(Al.prototype,t,r)});function eh(e){return{enumerable:!1,configurable:!0,get:function(){return this[Ee].get_(e)},set:function(t){this[Ee].set_(e,t)}}}function Mw(e){pr(Al.prototype,""+e,eh(e))}function th(e){if(e>Xs){for(var t=Xs;t<e+100;t++)Mw(t);Xs=e}}th(1e3);function Lw(e,t,r){return new Al(e,t,r)}function ur(e,t){if(typeof e=="object"&&e!==null){if(_i(e))return t!==void 0&&he(23),e[Ee].atom_;if(rr(e))return e.atom_;if(br(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||he(25,t,ja(e)),r}if(Tn(e)){if(!t)return he(26);var n=e[Ee].values_.get(t);return n||he(27,t,ja(e)),n}if(Tl(e)||ko(e)||Sa(e))return e}else if(We(e)&&Sa(e[Ee]))return e[Ee];he(28)}function Sl(e,t){if(e||he(29),t!==void 0)return Sl(ur(e,t));if(Tl(e)||ko(e)||Sa(e)||br(e)||rr(e))return e;if(e[Ee])return e[Ee];he(24,e)}function ja(e,t){var r;if(t!==void 0)r=ur(e,t);else{if(wn(e))return e.name;Tn(e)||br(e)||rr(e)?r=Sl(e):r=ur(e)}return r.name_}function Un(e){var t=Nn(),r=gs(!0);Dt();try{return e()}finally{Mt(),ms(r),Or(t)}}var cf=Oo.toString;function Il(e,t,r){return r===void 0&&(r=-1),$u(e,t,r)}function $u(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 a=cf.call(e);if(a!==cf.call(t))return!1;switch(a){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=ff(e),t=ff(t);var s=a==="[object Array]";if(!s){if(typeof e!="object"||typeof t!="object")return!1;var u=e.constructor,l=t.constructor;if(u!==l&&!(We(u)&&u instanceof u&&We(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(r===0)return!1;r<0&&(r=-1),n=n||[],i=i||[];for(var f=n.length;f--;)if(n[f]===e)return i[f]===t;if(n.push(e),i.push(t),s){if(f=e.length,f!==t.length)return!1;for(;f--;)if(!$u(e[f],t[f],r-1,n,i))return!1}else{var d=Object.keys(e),I=d.length;if(Object.keys(t).length!==I)return!1;for(var E=0;E<I;E++){var _=d[E];if(!(Vt(t,_)&&$u(e[_],t[_],r-1,n,i)))return!1}}return n.pop(),i.pop(),!0}function ff(e){return _i(e)?e.slice():mi(e)||br(e)||Er(e)||rr(e)?Array.from(e.entries()):e}var df,Vw=((df=ls().Iterator)==null?void 0:df.prototype)||{};function kl(e){return e[Symbol.iterator]=Fw,Object.assign(Object.create(Vw),e)}function Fw(){return this}function rh(e){return e instanceof Object&&typeof e.annotationType_=="string"&&We(e.make_)&&We(e.extend_)}["Symbol","Map","Set"].forEach(function(e){var t=ls();typeof t[e]>"u"&&he("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:aw,extras:{getDebugName:ja},$mobx:Ee});var zw=Object.create,$l=Object.defineProperty,Kw=Object.getOwnPropertyDescriptor,nh=Object.getOwnPropertyNames,qw=Object.getPrototypeOf,Gw=Object.prototype.hasOwnProperty,it=(e,t)=>function(){return t||(0,e[nh(e)[0]])((t={exports:{}}).exports,t),t.exports},ih=(e,t)=>{for(var r in t)$l(e,r,{get:t[r],enumerable:!0})},Ww=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of nh(t))!Gw.call(e,i)&&i!==r&&$l(e,i,{get:()=>t[i],enumerable:!(n=Kw(t,i))||n.enumerable});return e},Nr=(e,t,r)=>(r=e!=null?zw(qw(e)):{},Ww(t||!e||!e.__esModule?$l(r,"default",{value:e,enumerable:!0}):r,e)),sn=it({"../../../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(p){let w=new Map;function A(){return new Map(w)}p.Entries=A;function P(){return w.clear()}p.Clear=P;function j(T){return w.delete(T)}p.Delete=j;function N(T){return w.has(T)}p.Has=N;function g(T,c){w.set(T,c)}p.Set=g;function O(T){return w.get(T)}p.Get=O})(t||(e.TypeRegistry=t={}));var r=class extends Error{constructor(p){super(p)}};e.TypeBoxError=r;var n;(function(p){let w=new Map;function A(){return new Map(w)}p.Entries=A;function P(){return w.clear()}p.Clear=P;function j(T){return w.delete(T)}p.Delete=j;function N(T){return w.has(T)}p.Has=N;function g(T,c){w.set(T,c)}p.Set=g;function O(T){return w.get(T)}p.Get=O})(n||(e.FormatRegistry=n={}));var i;(function(p){function w(v){return Array.isArray(v)}p.IsArray=w;function A(v){return typeof v=="bigint"}p.IsBigInt=A;function P(v){return typeof v=="boolean"}p.IsBoolean=P;function j(v){return v instanceof globalThis.Date}p.IsDate=j;function N(v){return v===null}p.IsNull=N;function g(v){return typeof v=="number"}p.IsNumber=g;function O(v){return typeof v=="object"&&v!==null}p.IsObject=O;function T(v){return typeof v=="string"}p.IsString=T;function c(v){return v instanceof globalThis.Uint8Array}p.IsUint8Array=c;function x(v){return v===void 0}p.IsUndefined=x})(i||(e.ValueGuard=i={}));var o=class extends r{};e.TypeGuardUnknownTypeError=o;var a;(function(p){function w(m){try{return new RegExp(m),!0}catch{return!1}}function A(m){if(!i.IsString(m))return!1;for(let De=0;De<m.length;De++){let $t=m.charCodeAt(De);if($t>=7&&$t<=13||$t===27||$t===127)return!1}return!0}function P(m){return g(m)||rt(m)}function j(m){return i.IsUndefined(m)||i.IsBigInt(m)}function N(m){return i.IsUndefined(m)||i.IsNumber(m)}function g(m){return i.IsUndefined(m)||i.IsBoolean(m)}function O(m){return i.IsUndefined(m)||i.IsString(m)}function T(m){return i.IsUndefined(m)||i.IsString(m)&&A(m)&&w(m)}function c(m){return i.IsUndefined(m)||i.IsString(m)&&A(m)}function x(m){return i.IsUndefined(m)||rt(m)}function v(m){return Oe(m,"Any")&&O(m.$id)}p.TAny=v;function b(m){return Oe(m,"Array")&&m.type==="array"&&O(m.$id)&&rt(m.items)&&N(m.minItems)&&N(m.maxItems)&&g(m.uniqueItems)&&x(m.contains)&&N(m.minContains)&&N(m.maxContains)}p.TArray=b;function U(m){return Oe(m,"AsyncIterator")&&m.type==="AsyncIterator"&&O(m.$id)&&rt(m.items)}p.TAsyncIterator=U;function H(m){return Oe(m,"BigInt")&&m.type==="bigint"&&O(m.$id)&&j(m.exclusiveMaximum)&&j(m.exclusiveMinimum)&&j(m.maximum)&&j(m.minimum)&&j(m.multipleOf)}p.TBigInt=H;function ie(m){return Oe(m,"Boolean")&&m.type==="boolean"&&O(m.$id)}p.TBoolean=ie;function oe(m){return Oe(m,"Constructor")&&m.type==="Constructor"&&O(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(De=>rt(De))&&rt(m.returns)}p.TConstructor=oe;function _e(m){return Oe(m,"Date")&&m.type==="Date"&&O(m.$id)&&N(m.exclusiveMaximumTimestamp)&&N(m.exclusiveMinimumTimestamp)&&N(m.maximumTimestamp)&&N(m.minimumTimestamp)&&N(m.multipleOfTimestamp)}p.TDate=_e;function Se(m){return Oe(m,"Function")&&m.type==="Function"&&O(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(De=>rt(De))&&rt(m.returns)}p.TFunction=Se;function Ve(m){return Oe(m,"Integer")&&m.type==="integer"&&O(m.$id)&&N(m.exclusiveMaximum)&&N(m.exclusiveMinimum)&&N(m.maximum)&&N(m.minimum)&&N(m.multipleOf)}p.TInteger=Ve;function He(m){return Oe(m,"Intersect")&&!(i.IsString(m.type)&&m.type!=="object")&&i.IsArray(m.allOf)&&m.allOf.every(De=>rt(De)&&!Di(De))&&O(m.type)&&(g(m.unevaluatedProperties)||x(m.unevaluatedProperties))&&O(m.$id)}p.TIntersect=He;function un(m){return Oe(m,"Iterator")&&m.type==="Iterator"&&O(m.$id)&&rt(m.items)}p.TIterator=un;function Oe(m,De){return Br(m)&&m[e.Kind]===De}p.TKindOf=Oe;function Br(m){return i.IsObject(m)&&e.Kind in m&&i.IsString(m[e.Kind])}p.TKind=Br;function ln(m){return C(m)&&i.IsString(m.const)}p.TLiteralString=ln;function S(m){return C(m)&&i.IsNumber(m.const)}p.TLiteralNumber=S;function ye(m){return C(m)&&i.IsBoolean(m.const)}p.TLiteralBoolean=ye;function C(m){return Oe(m,"Literal")&&O(m.$id)&&(i.IsBoolean(m.const)||i.IsNumber(m.const)||i.IsString(m.const))}p.TLiteral=C;function xe(m){return Oe(m,"Never")&&i.IsObject(m.not)&&Object.getOwnPropertyNames(m.not).length===0}p.TNever=xe;function se(m){return Oe(m,"Not")&&rt(m.not)}p.TNot=se;function ge(m){return Oe(m,"Null")&&m.type==="null"&&O(m.$id)}p.TNull=ge;function Re(m){return Oe(m,"Number")&&m.type==="number"&&O(m.$id)&&N(m.exclusiveMaximum)&&N(m.exclusiveMinimum)&&N(m.maximum)&&N(m.minimum)&&N(m.multipleOf)}p.TNumber=Re;function Je(m){return Oe(m,"Object")&&m.type==="object"&&O(m.$id)&&i.IsObject(m.properties)&&P(m.additionalProperties)&&N(m.minProperties)&&N(m.maxProperties)&&Object.entries(m.properties).every(([De,$t])=>A(De)&&rt($t))}p.TObject=Je;function mt(m){return Oe(m,"Promise")&&m.type==="Promise"&&O(m.$id)&&rt(m.item)}p.TPromise=mt;function dt(m){return Oe(m,"Record")&&m.type==="object"&&O(m.$id)&&P(m.additionalProperties)&&i.IsObject(m.patternProperties)&&(De=>{let $t=Object.getOwnPropertyNames(De.patternProperties);return $t.length===1&&w($t[0])&&i.IsObject(De.patternProperties)&&rt(De.patternProperties[$t[0]])})(m)}p.TRecord=dt;function vt(m){return i.IsObject(m)&&e.Hint in m&&m[e.Hint]==="Recursive"}p.TRecursive=vt;function Rr(m){return Oe(m,"Ref")&&O(m.$id)&&i.IsString(m.$ref)}p.TRef=Rr;function Wn(m){return Oe(m,"String")&&m.type==="string"&&O(m.$id)&&N(m.minLength)&&N(m.maxLength)&&T(m.pattern)&&c(m.format)}p.TString=Wn;function Hn(m){return Oe(m,"Symbol")&&m.type==="symbol"&&O(m.$id)}p.TSymbol=Hn;function cn(m){return Oe(m,"TemplateLiteral")&&m.type==="string"&&i.IsString(m.pattern)&&m.pattern[0]==="^"&&m.pattern[m.pattern.length-1]==="$"}p.TTemplateLiteral=cn;function Fo(m){return Oe(m,"This")&&O(m.$id)&&i.IsString(m.$ref)}p.TThis=Fo;function Di(m){return i.IsObject(m)&&e.Transform in m}p.TTransform=Di;function tt(m){return Oe(m,"Tuple")&&m.type==="array"&&O(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(De=>rt(De)))}p.TTuple=tt;function zo(m){return Oe(m,"Undefined")&&m.type==="undefined"&&O(m.$id)}p.TUndefined=zo;function Vs(m){return fn(m)&&m.anyOf.every(De=>ln(De)||S(De))}p.TUnionLiteral=Vs;function fn(m){return Oe(m,"Union")&&O(m.$id)&&i.IsObject(m)&&i.IsArray(m.anyOf)&&m.anyOf.every(De=>rt(De))}p.TUnion=fn;function Jn(m){return Oe(m,"Uint8Array")&&m.type==="Uint8Array"&&O(m.$id)&&N(m.minByteLength)&&N(m.maxByteLength)}p.TUint8Array=Jn;function bt(m){return Oe(m,"Unknown")&&O(m.$id)}p.TUnknown=bt;function Ko(m){return Oe(m,"Unsafe")}p.TUnsafe=Ko;function Mi(m){return Oe(m,"Void")&&m.type==="void"&&O(m.$id)}p.TVoid=Mi;function Fs(m){return i.IsObject(m)&&m[e.Readonly]==="Readonly"}p.TReadonly=Fs;function zs(m){return i.IsObject(m)&&m[e.Optional]==="Optional"}p.TOptional=zs;function rt(m){return i.IsObject(m)&&(v(m)||b(m)||ie(m)||H(m)||U(m)||oe(m)||_e(m)||Se(m)||Ve(m)||He(m)||un(m)||C(m)||xe(m)||se(m)||ge(m)||Re(m)||Je(m)||mt(m)||dt(m)||Rr(m)||Wn(m)||Hn(m)||cn(m)||Fo(m)||tt(m)||zo(m)||fn(m)||Jn(m)||bt(m)||Ko(m)||Mi(m)||Br(m)&&t.Has(m[e.Kind]))}p.TSchema=rt})(a||(e.TypeGuard=a={}));var s;(function(p){function w(A){return A[e.Kind]==="Intersect"?A.allOf.every(P=>w(P)):A[e.Kind]==="Union"?A.anyOf.some(P=>w(P)):A[e.Kind]==="Undefined"?!0:A[e.Kind]==="Not"?!w(A.not):!1}p.Check=w})(s||(e.ExtendsUndefined=s={}));var u=class extends r{};e.TypeExtendsError=u;var l;(function(p){p[p.Union=0]="Union",p[p.True=1]="True",p[p.False=2]="False"})(l||(e.TypeExtendsResult=l={}));var f;(function(p){function w(y){return y===l.False?y:l.True}function A(y){throw new u(y)}function P(y){return a.TNever(y)||a.TIntersect(y)||a.TUnion(y)||a.TUnknown(y)||a.TAny(y)}function j(y,h){return a.TNever(h)?Oe(y,h):a.TIntersect(h)?Se(y,h):a.TUnion(h)?Ks(y,h):a.TUnknown(h)?Ac(y,h):a.TAny(h)?N(y,h):A("StructuralRight")}function N(y,h){return l.True}function g(y,h){return a.TIntersect(h)?Se(y,h):a.TUnion(h)&&h.anyOf.some($e=>a.TAny($e)||a.TUnknown($e))?l.True:a.TUnion(h)?l.Union:a.TUnknown(h)||a.TAny(h)?l.True:l.Union}function O(y,h){return a.TUnknown(y)?l.False:a.TAny(y)?l.Union:a.TNever(y)?l.True:l.False}function T(y,h){return a.TObject(h)&&cn(h)?l.True:P(h)?j(y,h):a.TArray(h)?w(Me(y.items,h.items)):l.False}function c(y,h){return P(h)?j(y,h):a.TAsyncIterator(h)?w(Me(y.items,h.items)):l.False}function x(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TBigInt(h)?l.True:l.False}function v(y,h){return a.TLiteral(y)&&i.IsBoolean(y.const)||a.TBoolean(y)?l.True:l.False}function b(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TBoolean(h)?l.True:l.False}function U(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TConstructor(h)?y.parameters.length>h.parameters.length?l.False:y.parameters.every(($e,wr)=>w(Me(h.parameters[wr],$e))===l.True)?w(Me(y.returns,h.returns)):l.False:l.False}function H(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TDate(h)?l.True:l.False}function ie(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TFunction(h)?y.parameters.length>h.parameters.length?l.False:y.parameters.every(($e,wr)=>w(Me(h.parameters[wr],$e))===l.True)?w(Me(y.returns,h.returns)):l.False:l.False}function oe(y,h){return a.TLiteral(y)&&i.IsNumber(y.const)||a.TNumber(y)||a.TInteger(y)?l.True:l.False}function _e(y,h){return a.TInteger(h)||a.TNumber(h)?l.True:P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):l.False}function Se(y,h){return h.allOf.every($e=>Me(y,$e)===l.True)?l.True:l.False}function Ve(y,h){return y.allOf.some($e=>Me($e,h)===l.True)?l.True:l.False}function He(y,h){return P(h)?j(y,h):a.TIterator(h)?w(Me(y.items,h.items)):l.False}function un(y,h){return a.TLiteral(h)&&h.const===y.const?l.True:P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TString(h)?Mi(y,h):a.TNumber(h)?C(y,h):a.TInteger(h)?oe(y,h):a.TBoolean(h)?v(y,h):l.False}function Oe(y,h){return l.False}function Br(y,h){return l.True}function ln(y){let[h,$e]=[y,0];for(;a.TNot(h);)h=h.not,$e+=1;return $e%2===0?h:e.Type.Unknown()}function S(y,h){return a.TNot(y)?Me(ln(y),h):a.TNot(h)?Me(y,ln(h)):A("Invalid fallthrough for Not")}function ye(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TNull(h)?l.True:l.False}function C(y,h){return a.TLiteralNumber(y)||a.TNumber(y)||a.TInteger(y)?l.True:l.False}function xe(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TInteger(h)||a.TNumber(h)?l.True:l.False}function se(y,h){return Object.getOwnPropertyNames(y.properties).length===h}function ge(y){return cn(y)}function Re(y){return se(y,0)||se(y,1)&&"description"in y.properties&&a.TUnion(y.properties.description)&&y.properties.description.anyOf.length===2&&(a.TString(y.properties.description.anyOf[0])&&a.TUndefined(y.properties.description.anyOf[1])||a.TString(y.properties.description.anyOf[1])&&a.TUndefined(y.properties.description.anyOf[0]))}function Je(y){return se(y,0)}function mt(y){return se(y,0)}function dt(y){return se(y,0)}function vt(y){return se(y,0)}function Rr(y){return cn(y)}function Wn(y){let h=e.Type.Number();return se(y,0)||se(y,1)&&"length"in y.properties&&w(Me(y.properties.length,h))===l.True}function Hn(y){return se(y,0)}function cn(y){let h=e.Type.Number();return se(y,0)||se(y,1)&&"length"in y.properties&&w(Me(y.properties.length,h))===l.True}function Fo(y){let h=e.Type.Function([e.Type.Any()],e.Type.Any());return se(y,0)||se(y,1)&&"then"in y.properties&&w(Me(y.properties.then,h))===l.True}function Di(y,h){return Me(y,h)===l.False||a.TOptional(y)&&!a.TOptional(h)?l.False:l.True}function tt(y,h){return a.TUnknown(y)?l.False:a.TAny(y)?l.Union:a.TNever(y)||a.TLiteralString(y)&&ge(h)||a.TLiteralNumber(y)&&Je(h)||a.TLiteralBoolean(y)&&mt(h)||a.TSymbol(y)&&Re(h)||a.TBigInt(y)&&dt(h)||a.TString(y)&&ge(h)||a.TSymbol(y)&&Re(h)||a.TNumber(y)&&Je(h)||a.TInteger(y)&&Je(h)||a.TBoolean(y)&&mt(h)||a.TUint8Array(y)&&Rr(h)||a.TDate(y)&&vt(h)||a.TConstructor(y)&&Hn(h)||a.TFunction(y)&&Wn(h)?l.True:a.TRecord(y)&&a.TString(fn(y))?h[e.Hint]==="Record"?l.True:l.False:a.TRecord(y)&&a.TNumber(fn(y))&&se(h,0)?l.True:l.False}function zo(y,h){return P(h)?j(y,h):a.TRecord(h)?bt(y,h):a.TObject(h)?(()=>{for(let $e of Object.getOwnPropertyNames(h.properties)){if(!($e in y.properties)&&!a.TOptional(h.properties[$e]))return l.False;if(a.TOptional(h.properties[$e]))return l.True;if(Di(y.properties[$e],h.properties[$e])===l.False)return l.False}return l.True})():l.False}function Vs(y,h){return P(h)?j(y,h):a.TObject(h)&&Fo(h)?l.True:a.TPromise(h)?w(Me(y.item,h.item)):l.False}function fn(y){return e.PatternNumberExact in y.patternProperties?e.Type.Number():e.PatternStringExact in y.patternProperties?e.Type.String():A("Unknown record key pattern")}function Jn(y){return e.PatternNumberExact in y.patternProperties?y.patternProperties[e.PatternNumberExact]:e.PatternStringExact in y.patternProperties?y.patternProperties[e.PatternStringExact]:A("Unable to get record value schema")}function bt(y,h){let[$e,wr]=[fn(h),Jn(h)];return a.TLiteralString(y)&&a.TNumber($e)&&w(Me(y,wr))===l.True?l.True:a.TUint8Array(y)&&a.TNumber($e)||a.TString(y)&&a.TNumber($e)||a.TArray(y)&&a.TNumber($e)?Me(y,wr):a.TObject(y)?(()=>{for(let bg of Object.getOwnPropertyNames(y.properties))if(Di(wr,y.properties[bg])===l.False)return l.False;return l.True})():l.False}function Ko(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?Me(Jn(y),Jn(h)):l.False}function Mi(y,h){return a.TLiteral(y)&&i.IsString(y.const)||a.TString(y)?l.True:l.False}function Fs(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TString(h)?l.True:l.False}function zs(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TSymbol(h)?l.True:l.False}function rt(y,h){return a.TTemplateLiteral(y)?Me(R.Resolve(y),h):a.TTemplateLiteral(h)?Me(y,R.Resolve(h)):A("Invalid fallthrough for TemplateLiteral")}function m(y,h){return a.TArray(h)&&y.items!==void 0&&y.items.every($e=>Me($e,h.items)===l.True)}function De(y,h){return a.TNever(y)?l.True:a.TUnknown(y)?l.False:a.TAny(y)?l.Union:l.False}function $t(y,h){return P(h)?j(y,h):a.TObject(h)&&cn(h)||a.TArray(h)&&m(y,h)?l.True:a.TTuple(h)?i.IsUndefined(y.items)&&!i.IsUndefined(h.items)||!i.IsUndefined(y.items)&&i.IsUndefined(h.items)?l.False:i.IsUndefined(y.items)&&!i.IsUndefined(h.items)||y.items.every(($e,wr)=>Me($e,h.items[wr])===l.True)?l.True:l.False:l.False}function fg(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TUint8Array(h)?l.True:l.False}function dg(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TVoid(h)?yg(y,h):a.TUndefined(h)?l.True:l.False}function Ks(y,h){return h.anyOf.some($e=>Me(y,$e)===l.True)?l.True:l.False}function pg(y,h){return y.anyOf.every($e=>Me($e,h)===l.True)?l.True:l.False}function Ac(y,h){return l.True}function hg(y,h){return a.TNever(h)?Oe(y,h):a.TIntersect(h)?Se(y,h):a.TUnion(h)?Ks(y,h):a.TAny(h)?N(y,h):a.TString(h)?Mi(y,h):a.TNumber(h)?C(y,h):a.TInteger(h)?oe(y,h):a.TBoolean(h)?v(y,h):a.TArray(h)?O(y,h):a.TTuple(h)?De(y,h):a.TObject(h)?tt(y,h):a.TUnknown(h)?l.True:l.False}function yg(y,h){return a.TUndefined(y)||a.TUndefined(y)?l.True:l.False}function gg(y,h){return a.TIntersect(h)?Se(y,h):a.TUnion(h)?Ks(y,h):a.TUnknown(h)?Ac(y,h):a.TAny(h)?N(y,h):a.TObject(h)?tt(y,h):a.TVoid(h)?l.True:l.False}function Me(y,h){return a.TTemplateLiteral(y)||a.TTemplateLiteral(h)?rt(y,h):a.TNot(y)||a.TNot(h)?S(y,h):a.TAny(y)?g(y,h):a.TArray(y)?T(y,h):a.TBigInt(y)?x(y,h):a.TBoolean(y)?b(y,h):a.TAsyncIterator(y)?c(y,h):a.TConstructor(y)?U(y,h):a.TDate(y)?H(y,h):a.TFunction(y)?ie(y,h):a.TInteger(y)?_e(y,h):a.TIntersect(y)?Ve(y,h):a.TIterator(y)?He(y,h):a.TLiteral(y)?un(y,h):a.TNever(y)?Br(y,h):a.TNull(y)?ye(y,h):a.TNumber(y)?xe(y,h):a.TObject(y)?zo(y,h):a.TRecord(y)?Ko(y,h):a.TString(y)?Fs(y,h):a.TSymbol(y)?zs(y,h):a.TTuple(y)?$t(y,h):a.TPromise(y)?Vs(y,h):a.TUint8Array(y)?fg(y,h):a.TUndefined(y)?dg(y,h):a.TUnion(y)?pg(y,h):a.TUnknown(y)?hg(y,h):a.TVoid(y)?gg(y,h):A(`Unknown left type operand '${y[e.Kind]}'`)}function mg(y,h){return Me(y,h)}p.Extends=mg})(f||(e.TypeExtends=f={}));var d;(function(p){function w(T){return T.map(c=>N(c))}function A(T){return new Date(T.getTime())}function P(T){return new Uint8Array(T)}function j(T){let c=Object.getOwnPropertyNames(T).reduce((v,b)=>({...v,[b]:N(T[b])}),{}),x=Object.getOwnPropertySymbols(T).reduce((v,b)=>({...v,[b]:N(T[b])}),{});return{...c,...x}}function N(T){return i.IsArray(T)?w(T):i.IsDate(T)?A(T):i.IsUint8Array(T)?P(T):i.IsObject(T)?j(T):T}function g(T){return T.map(c=>O(c))}p.Rest=g;function O(T,c={}){return{...N(T),...c}}p.Type=O})(d||(e.TypeClone=d={}));var I;(function(p){function w(U){return U.map(H=>{let{[e.Optional]:ie,...oe}=d.Type(H);return oe})}function A(U){return U.every(H=>a.TOptional(H))}function P(U){return U.some(H=>a.TOptional(H))}function j(U){return A(U.allOf)?e.Type.Optional(e.Type.Intersect(w(U.allOf))):U}function N(U){return P(U.anyOf)?e.Type.Optional(e.Type.Union(w(U.anyOf))):U}function g(U){return U[e.Kind]==="Intersect"?j(U):U[e.Kind]==="Union"?N(U):U}function O(U,H){let ie=U.allOf.reduce((oe,_e)=>{let Se=v(_e,H);return Se[e.Kind]==="Never"?oe:[...oe,Se]},[]);return g(e.Type.Intersect(ie))}function T(U,H){let ie=U.anyOf.map(oe=>v(oe,H));return g(e.Type.Union(ie))}function c(U,H){let ie=U.properties[H];return i.IsUndefined(ie)?e.Type.Never():e.Type.Union([ie])}function x(U,H){let ie=U.items;if(i.IsUndefined(ie))return e.Type.Never();let oe=ie[H];return i.IsUndefined(oe)?e.Type.Never():oe}function v(U,H){return U[e.Kind]==="Intersect"?O(U,H):U[e.Kind]==="Union"?T(U,H):U[e.Kind]==="Object"?c(U,H):U[e.Kind]==="Tuple"?x(U,H):e.Type.Never()}function b(U,H,ie={}){let oe=H.map(_e=>v(U,_e.toString()));return g(e.Type.Union(oe,ie))}p.Resolve=b})(I||(e.IndexedAccessor=I={}));var E;(function(p){function w(x){let[v,b]=[x.slice(0,1),x.slice(1)];return`${v.toLowerCase()}${b}`}function A(x){let[v,b]=[x.slice(0,1),x.slice(1)];return`${v.toUpperCase()}${b}`}function P(x){return x.toUpperCase()}function j(x){return x.toLowerCase()}function N(x,v){let b=K.ParseExact(x.pattern);if(!$.Check(b))return{...x,pattern:g(x.pattern,v)};let U=[...z.Generate(b)].map(oe=>e.Type.Literal(oe)),H=O(U,v),ie=e.Type.Union(H);return e.Type.TemplateLiteral([ie])}function g(x,v){return typeof x=="string"?v==="Uncapitalize"?w(x):v==="Capitalize"?A(x):v==="Uppercase"?P(x):v==="Lowercase"?j(x):x:x.toString()}function O(x,v){if(x.length===0)return[];let[b,...U]=x;return[c(b,v),...O(U,v)]}function T(x,v){return a.TTemplateLiteral(x)?N(x,v):a.TUnion(x)?e.Type.Union(O(x.anyOf,v)):a.TLiteral(x)?e.Type.Literal(g(x.const,v)):x}function c(x,v){return T(x,v)}p.Map=c})(E||(e.Intrinsic=E={}));var _;(function(p){function w(g,O){return e.Type.Intersect(g.allOf.map(T=>j(T,O)),{...g})}function A(g,O){return e.Type.Union(g.anyOf.map(T=>j(T,O)),{...g})}function P(g,O){return O(g)}function j(g,O){return g[e.Kind]==="Intersect"?w(g,O):g[e.Kind]==="Union"?A(g,O):g[e.Kind]==="Object"?P(g,O):g}function N(g,O,T){return{...j(d.Type(g),O),...T}}p.Map=N})(_||(e.ObjectMap=_={}));var L;(function(p){function w(c){return c[0]==="^"&&c[c.length-1]==="$"?c.slice(1,c.length-1):c}function A(c,x){return c.allOf.reduce((v,b)=>[...v,...g(b,x)],[])}function P(c,x){let v=c.anyOf.map(b=>g(b,x));return[...v.reduce((b,U)=>U.map(H=>v.every(ie=>ie.includes(H))?b.add(H):b)[0],new Set)]}function j(c,x){return Object.getOwnPropertyNames(c.properties)}function N(c,x){return x.includePatterns?Object.getOwnPropertyNames(c.patternProperties):[]}function g(c,x){return a.TIntersect(c)?A(c,x):a.TUnion(c)?P(c,x):a.TObject(c)?j(c,x):a.TRecord(c)?N(c,x):[]}function O(c,x){return[...new Set(g(c,x))]}p.ResolveKeys=O;function T(c){return`^(${O(c,{includePatterns:!0}).map(x=>`(${w(x)})`).join("|")})$`}p.ResolvePattern=T})(L||(e.KeyResolver=L={}));var J=class extends r{};e.KeyArrayResolverError=J;var B;(function(p){function w(A){return Array.isArray(A)?A:a.TUnionLiteral(A)?A.anyOf.map(P=>P.const.toString()):a.TLiteral(A)?[A.const]:a.TTemplateLiteral(A)?(()=>{let P=K.ParseExact(A.pattern);if(!$.Check(P))throw new J("Cannot resolve keys from infinite template expression");return[...z.Generate(P)]})():[]}p.Resolve=w})(B||(e.KeyArrayResolver=B={}));var k;(function(p){function*w(P){for(let j of P.anyOf)j[e.Kind]==="Union"?yield*w(j):yield j}function A(P){return e.Type.Union([...w(P)],{...P})}p.Resolve=A})(k||(e.UnionResolver=k={}));var F=class extends r{};e.TemplateLiteralPatternError=F;var q;(function(p){function w(N){throw new F(N)}function A(N){return N.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function P(N,g){return a.TTemplateLiteral(N)?N.pattern.slice(1,N.pattern.length-1):a.TUnion(N)?`(${N.anyOf.map(O=>P(O,g)).join("|")})`:a.TNumber(N)?`${g}${e.PatternNumber}`:a.TInteger(N)?`${g}${e.PatternNumber}`:a.TBigInt(N)?`${g}${e.PatternNumber}`:a.TString(N)?`${g}${e.PatternString}`:a.TLiteral(N)?`${g}${A(N.const.toString())}`:a.TBoolean(N)?`${g}${e.PatternBoolean}`:w(`Unexpected Kind '${N[e.Kind]}'`)}function j(N){return`^${N.map(g=>P(g,"")).join("")}$`}p.Create=j})(q||(e.TemplateLiteralPattern=q={}));var R;(function(p){function w(A){let P=K.ParseExact(A.pattern);if(!$.Check(P))return e.Type.String();let j=[...z.Generate(P)].map(N=>e.Type.Literal(N));return e.Type.Union(j)}p.Resolve=w})(R||(e.TemplateLiteralResolver=R={}));var Q=class extends r{};e.TemplateLiteralParserError=Q;var K;(function(p){function w(U,H,ie){return U[H]===ie&&U.charCodeAt(H-1)!==92}function A(U,H){return w(U,H,"(")}function P(U,H){return w(U,H,")")}function j(U,H){return w(U,H,"|")}function N(U){if(!(A(U,0)&&P(U,U.length-1)))return!1;let H=0;for(let ie=0;ie<U.length;ie++)if(A(U,ie)&&(H+=1),P(U,ie)&&(H-=1),H===0&&ie!==U.length-1)return!1;return!0}function g(U){return U.slice(1,U.length-1)}function O(U){let H=0;for(let ie=0;ie<U.length;ie++)if(A(U,ie)&&(H+=1),P(U,ie)&&(H-=1),j(U,ie)&&H===0)return!0;return!1}function T(U){for(let H=0;H<U.length;H++)if(A(U,H))return!0;return!1}function c(U){let[H,ie]=[0,0],oe=[];for(let Se=0;Se<U.length;Se++)if(A(U,Se)&&(H+=1),P(U,Se)&&(H-=1),j(U,Se)&&H===0){let Ve=U.slice(ie,Se);Ve.length>0&&oe.push(v(Ve)),ie=Se+1}let _e=U.slice(ie);return _e.length>0&&oe.push(v(_e)),oe.length===0?{type:"const",const:""}:oe.length===1?oe[0]:{type:"or",expr:oe}}function x(U){function H(_e,Se){if(!A(_e,Se))throw new Q("TemplateLiteralParser: Index must point to open parens");let Ve=0;for(let He=Se;He<_e.length;He++)if(A(_e,He)&&(Ve+=1),P(_e,He)&&(Ve-=1),Ve===0)return[Se,He];throw new Q("TemplateLiteralParser: Unclosed group parens in expression")}function ie(_e,Se){for(let Ve=Se;Ve<_e.length;Ve++)if(A(_e,Ve))return[Se,Ve];return[Se,_e.length]}let oe=[];for(let _e=0;_e<U.length;_e++)if(A(U,_e)){let[Se,Ve]=H(U,_e),He=U.slice(Se,Ve+1);oe.push(v(He)),_e=Ve}else{let[Se,Ve]=ie(U,_e),He=U.slice(Se,Ve);He.length>0&&oe.push(v(He)),_e=Ve-1}return oe.length===0?{type:"const",const:""}:oe.length===1?oe[0]:{type:"and",expr:oe}}function v(U){return N(U)?v(g(U)):O(U)?c(U):T(U)?x(U):{type:"const",const:U}}p.Parse=v;function b(U){return v(U.slice(1,U.length-1))}p.ParseExact=b})(K||(e.TemplateLiteralParser=K={}));var re=class extends r{};e.TemplateLiteralFiniteError=re;var $;(function(p){function w(g){throw new re(g)}function A(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 P(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 j(g){return g.type==="const"&&g.const===".*"}function N(g){return P(g)?!0:A(g)||j(g)?!1:g.type==="and"?g.expr.every(O=>N(O)):g.type==="or"?g.expr.every(O=>N(O)):g.type==="const"?!0:w("Unknown expression type")}p.Check=N})($||(e.TemplateLiteralFinite=$={}));var D=class extends r{};e.TemplateLiteralGeneratorError=D;var z;(function(p){function*w(g){if(g.length===1)return yield*g[0];for(let O of g[0])for(let T of w(g.slice(1)))yield`${O}${T}`}function*A(g){return yield*w(g.expr.map(O=>[...N(O)]))}function*P(g){for(let O of g.expr)yield*N(O)}function*j(g){return yield g.const}function*N(g){return g.type==="and"?yield*A(g):g.type==="or"?yield*P(g):g.type==="const"?yield*j(g):(()=>{throw new D("Unknown expression")})()}p.Generate=N})(z||(e.TemplateLiteralGenerator=z={}));var ne;(function(p){function*w(N){let g=N.trim().replace(/"|'/g,"");return g==="boolean"?yield e.Type.Boolean():g==="number"?yield e.Type.Number():g==="bigint"?yield e.Type.BigInt():g==="string"?yield e.Type.String():yield(()=>{let O=g.split("|").map(T=>e.Type.Literal(T.trim()));return O.length===0?e.Type.Never():O.length===1?O[0]:e.Type.Union(O)})()}function*A(N){if(N[1]!=="{"){let g=e.Type.Literal("$"),O=P(N.slice(1));return yield*[g,...O]}for(let g=2;g<N.length;g++)if(N[g]==="}"){let O=w(N.slice(2,g)),T=P(N.slice(g+1));return yield*[...O,...T]}yield e.Type.Literal(N)}function*P(N){for(let g=0;g<N.length;g++)if(N[g]==="$"){let O=e.Type.Literal(N.slice(0,g)),T=A(N.slice(g));return yield*[O,...T]}yield e.Type.Literal(N)}function j(N){return[...P(N)]}p.Parse=j})(ne||(e.TemplateLiteralDslParser=ne={}));var ue=class{constructor(p){this.schema=p}Decode(p){return new te(this.schema,p)}};e.TransformDecodeBuilder=ue;var te=class{constructor(p,w){this.schema=p,this.decode=w}Encode(p){let w=d.Type(this.schema);return a.TTransform(w)?(()=>{let A={Encode:P=>w[e.Transform].Encode(p(P)),Decode:P=>this.decode(w[e.Transform].Decode(P))};return{...w,[e.Transform]:A}})():(()=>{let A={Decode:this.decode,Encode:p};return{...w,[e.Transform]:A}})()}};e.TransformEncodeBuilder=te;var fe=0,V=class extends r{};e.TypeBuilderError=V;var X=class{Create(p){return p}Throw(p){throw new V(p)}Discard(p,w){return w.reduce((A,P)=>{let{[P]:j,...N}=A;return N},p)}Strict(p){return JSON.parse(JSON.stringify(p))}};e.TypeBuilder=X;var ee=class extends X{ReadonlyOptional(p){return this.Readonly(this.Optional(p))}Readonly(p){return{...d.Type(p),[e.Readonly]:"Readonly"}}Optional(p){return{...d.Type(p),[e.Optional]:"Optional"}}Any(p={}){return this.Create({...p,[e.Kind]:"Any"})}Array(p,w={}){return this.Create({...w,[e.Kind]:"Array",type:"array",items:d.Type(p)})}Boolean(p={}){return this.Create({...p,[e.Kind]:"Boolean",type:"boolean"})}Capitalize(p,w={}){return{...E.Map(d.Type(p),"Capitalize"),...w}}Composite(p,w){let A=e.Type.Intersect(p,{}),P=L.ResolveKeys(A,{includePatterns:!1}).reduce((j,N)=>({...j,[N]:e.Type.Index(A,[N])}),{});return e.Type.Object(P,w)}Enum(p,w={}){if(i.IsUndefined(p))return this.Throw("Enum undefined or empty");let A=Object.getOwnPropertyNames(p).filter(j=>isNaN(j)).map(j=>p[j]),P=[...new Set(A)].map(j=>e.Type.Literal(j));return this.Union(P,{...w,[e.Hint]:"Enum"})}Extends(p,w,A,P,j={}){switch(f.Extends(p,w)){case l.Union:return this.Union([d.Type(A,j),d.Type(P,j)]);case l.True:return d.Type(A,j);case l.False:return d.Type(P,j)}}Exclude(p,w,A={}){return a.TTemplateLiteral(p)?this.Exclude(R.Resolve(p),w,A):a.TTemplateLiteral(w)?this.Exclude(p,R.Resolve(w),A):a.TUnion(p)?(()=>{let P=p.anyOf.filter(j=>f.Extends(j,w)===l.False);return P.length===1?d.Type(P[0],A):this.Union(P,A)})():f.Extends(p,w)!==l.False?this.Never(A):d.Type(p,A)}Extract(p,w,A={}){return a.TTemplateLiteral(p)?this.Extract(R.Resolve(p),w,A):a.TTemplateLiteral(w)?this.Extract(p,R.Resolve(w),A):a.TUnion(p)?(()=>{let P=p.anyOf.filter(j=>f.Extends(j,w)!==l.False);return P.length===1?d.Type(P[0],A):this.Union(P,A)})():f.Extends(p,w)!==l.False?d.Type(p,A):this.Never(A)}Index(p,w,A={}){return a.TArray(p)&&a.TNumber(w)?d.Type(p.items,A):a.TTuple(p)&&a.TNumber(w)?(()=>{let P=(i.IsUndefined(p.items)?[]:p.items).map(j=>d.Type(j));return this.Union(P,A)})():(()=>{let P=B.Resolve(w),j=d.Type(p);return I.Resolve(j,P,A)})()}Integer(p={}){return this.Create({...p,[e.Kind]:"Integer",type:"integer"})}Intersect(p,w={}){if(p.length===0)return e.Type.Never();if(p.length===1)return d.Type(p[0],w);p.some(N=>a.TTransform(N))&&this.Throw("Cannot intersect transform types");let A=p.every(N=>a.TObject(N)),P=d.Rest(p),j=a.TSchema(w.unevaluatedProperties)?{unevaluatedProperties:d.Type(w.unevaluatedProperties)}:{};return w.unevaluatedProperties===!1||a.TSchema(w.unevaluatedProperties)||A?this.Create({...w,...j,[e.Kind]:"Intersect",type:"object",allOf:P}):this.Create({...w,...j,[e.Kind]:"Intersect",allOf:P})}KeyOf(p,w={}){return a.TRecord(p)?(()=>{let A=Object.getOwnPropertyNames(p.patternProperties)[0];return A===e.PatternNumberExact?this.Number(w):A===e.PatternStringExact?this.String(w):this.Throw("Unable to resolve key type from Record key pattern")})():a.TTuple(p)?(()=>{let A=(i.IsUndefined(p.items)?[]:p.items).map((P,j)=>e.Type.Literal(j.toString()));return this.Union(A,w)})():a.TArray(p)?this.Number(w):(()=>{let A=L.ResolveKeys(p,{includePatterns:!1});if(A.length===0)return this.Never(w);let P=A.map(j=>this.Literal(j));return this.Union(P,w)})()}Literal(p,w={}){return this.Create({...w,[e.Kind]:"Literal",const:p,type:typeof p})}Lowercase(p,w={}){return{...E.Map(d.Type(p),"Lowercase"),...w}}Never(p={}){return this.Create({...p,[e.Kind]:"Never",not:{}})}Not(p,w){return this.Create({...w,[e.Kind]:"Not",not:d.Type(p)})}Null(p={}){return this.Create({...p,[e.Kind]:"Null",type:"null"})}Number(p={}){return this.Create({...p,[e.Kind]:"Number",type:"number"})}Object(p,w={}){let A=Object.getOwnPropertyNames(p),P=A.filter(O=>a.TOptional(p[O])),j=A.filter(O=>!P.includes(O)),N=a.TSchema(w.additionalProperties)?{additionalProperties:d.Type(w.additionalProperties)}:{},g=A.reduce((O,T)=>({...O,[T]:d.Type(p[T])}),{});return j.length>0?this.Create({...w,...N,[e.Kind]:"Object",type:"object",properties:g,required:j}):this.Create({...w,...N,[e.Kind]:"Object",type:"object",properties:g})}Omit(p,w,A={}){let P=B.Resolve(w);return _.Map(this.Discard(d.Type(p),["$id",e.Transform]),j=>{i.IsArray(j.required)&&(j.required=j.required.filter(N=>!P.includes(N)),j.required.length===0&&delete j.required);for(let N of Object.getOwnPropertyNames(j.properties))P.includes(N)&&delete j.properties[N];return this.Create(j)},A)}Partial(p,w={}){return _.Map(this.Discard(d.Type(p),["$id",e.Transform]),A=>{let P=Object.getOwnPropertyNames(A.properties).reduce((j,N)=>({...j,[N]:this.Optional(A.properties[N])}),{});return this.Object(P,this.Discard(A,["required"]))},w)}Pick(p,w,A={}){let P=B.Resolve(w);return _.Map(this.Discard(d.Type(p),["$id",e.Transform]),j=>{i.IsArray(j.required)&&(j.required=j.required.filter(N=>P.includes(N)),j.required.length===0&&delete j.required);for(let N of Object.getOwnPropertyNames(j.properties))P.includes(N)||delete j.properties[N];return this.Create(j)},A)}Record(p,w,A={}){return a.TTemplateLiteral(p)?(()=>{let P=K.ParseExact(p.pattern);return $.Check(P)?this.Object([...z.Generate(P)].reduce((j,N)=>({...j,[N]:d.Type(w)}),{}),A):this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[p.pattern]:d.Type(w)}})})():a.TUnion(p)?(()=>{let P=k.Resolve(p);if(a.TUnionLiteral(P)){let j=P.anyOf.reduce((N,g)=>({...N,[g.const]:d.Type(w)}),{});return this.Object(j,{...A,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():a.TLiteral(p)?i.IsString(p.const)||i.IsNumber(p.const)?this.Object({[p.const]:d.Type(w)},A):this.Throw("Record key of type literal is not of type string or number"):a.TInteger(p)||a.TNumber(p)?this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:d.Type(w)}}):a.TString(p)?(()=>{let P=i.IsUndefined(p.pattern)?e.PatternStringExact:p.pattern;return this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[P]:d.Type(w)}})})():this.Never()}Recursive(p,w={}){i.IsUndefined(w.$id)&&(w.$id=`T${fe++}`);let A=p({[e.Kind]:"This",$ref:`${w.$id}`});return A.$id=w.$id,this.Create({...w,[e.Hint]:"Recursive",...A})}Ref(p,w={}){return i.IsString(p)?this.Create({...w,[e.Kind]:"Ref",$ref:p}):(i.IsUndefined(p.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({...w,[e.Kind]:"Ref",$ref:p.$id}))}Required(p,w={}){return _.Map(this.Discard(d.Type(p),["$id",e.Transform]),A=>{let P=Object.getOwnPropertyNames(A.properties).reduce((j,N)=>({...j,[N]:this.Discard(A.properties[N],[e.Optional])}),{});return this.Object(P,A)},w)}Rest(p){return a.TTuple(p)&&!i.IsUndefined(p.items)?d.Rest(p.items):a.TIntersect(p)?d.Rest(p.allOf):a.TUnion(p)?d.Rest(p.anyOf):[]}String(p={}){return this.Create({...p,[e.Kind]:"String",type:"string"})}TemplateLiteral(p,w={}){let A=i.IsString(p)?q.Create(ne.Parse(p)):q.Create(p);return this.Create({...w,[e.Kind]:"TemplateLiteral",type:"string",pattern:A})}Transform(p){return new ue(p)}Tuple(p,w={}){let[A,P,j]=[!1,p.length,p.length],N=d.Rest(p),g=p.length>0?{...w,[e.Kind]:"Tuple",type:"array",items:N,additionalItems:A,minItems:P,maxItems:j}:{...w,[e.Kind]:"Tuple",type:"array",minItems:P,maxItems:j};return this.Create(g)}Uncapitalize(p,w={}){return{...E.Map(d.Type(p),"Uncapitalize"),...w}}Union(p,w={}){return a.TTemplateLiteral(p)?R.Resolve(p):(()=>{let A=p;if(A.length===0)return this.Never(w);if(A.length===1)return this.Create(d.Type(A[0],w));let P=d.Rest(A);return this.Create({...w,[e.Kind]:"Union",anyOf:P})})()}Unknown(p={}){return this.Create({...p,[e.Kind]:"Unknown"})}Unsafe(p={}){return this.Create({...p,[e.Kind]:p[e.Kind]||"Unsafe"})}Uppercase(p,w={}){return{...E.Map(d.Type(p),"Uppercase"),...w}}};e.JsonTypeBuilder=ee;var be=class extends ee{AsyncIterator(p,w={}){return this.Create({...w,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:d.Type(p)})}Awaited(p,w={}){let A=P=>P.length>0?(()=>{let[j,...N]=P;return[this.Awaited(j),...A(N)]})():P;return a.TIntersect(p)?e.Type.Intersect(A(p.allOf)):a.TUnion(p)?e.Type.Union(A(p.anyOf)):a.TPromise(p)?this.Awaited(p.item):d.Type(p,w)}BigInt(p={}){return this.Create({...p,[e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(p,w={}){return this.Tuple([...p.parameters],{...w})}Constructor(p,w,A){let[P,j]=[d.Rest(p),d.Type(w)];return this.Create({...A,[e.Kind]:"Constructor",type:"Constructor",parameters:P,returns:j})}Date(p={}){return this.Create({...p,[e.Kind]:"Date",type:"Date"})}Function(p,w,A){let[P,j]=[d.Rest(p),d.Type(w)];return this.Create({...A,[e.Kind]:"Function",type:"Function",parameters:P,returns:j})}InstanceType(p,w={}){return d.Type(p.returns,w)}Iterator(p,w={}){return this.Create({...w,[e.Kind]:"Iterator",type:"Iterator",items:d.Type(p)})}Parameters(p,w={}){return this.Tuple(p.parameters,{...w})}Promise(p,w={}){return this.Create({...w,[e.Kind]:"Promise",type:"Promise",item:d.Type(p)})}RegExp(p,w={}){let A=i.IsString(p)?p:p.source;return this.Create({...w,[e.Kind]:"String",type:"string",pattern:A})}RegEx(p,w={}){return this.RegExp(p,w)}ReturnType(p,w={}){return d.Type(p.returns,w)}Symbol(p){return this.Create({...p,[e.Kind]:"Symbol",type:"symbol"})}Undefined(p={}){return this.Create({...p,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(p={}){return this.Create({...p,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(p={}){return this.Create({...p,[e.Kind]:"Void",type:"void"})}};e.JavaScriptTypeBuilder=be,e.JsonType=new ee,e.Type=new be}}),xi=Nr(sn(),1),{String:Hw,Optional:Jw,Boolean:Xw,Object:Qw,Number:Zw}=xi.Type,Yw=Hw.bind(xi.Type),e2=Zw.bind(xi.Type),WN=Qw.bind(xi.Type),HN=Jw.bind(xi.Type),t2=Xw.bind(xi.Type),JN=Yw(),XN=e2(),QN=t2();function Ca(e){return Array.isArray(e)?e:[e]}var r2=it({"../../../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(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},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")),a=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=a}}),n2=it({"../../../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(s){return function(u){return function(l,f){var d={key:l,value:u[l]},I={key:f,value:u[f]};return s(d,I)}}}(n.cmp),a=[];return function s(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 l,f;if(Array.isArray(u)){for(f="[",l=0;l<u.length;l++)l&&(f+=","),f+=s(u[l])||"null";return f+"]"}if(u===null)return"null";if(a.indexOf(u)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var d=a.push(u)-1,I=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<I.length;l++){var E=I[l],_=s(u[E]);_&&(f&&(f+=","),f+=JSON.stringify(E)+":"+_)}return a.splice(d,1),"{"+f+"}"}}(r)}}}),i2=it({"../../../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=B();n.configure=B,n.stringify=n,n.default=n,e.stringify=n,e.configure=B,t.exports=n;var i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function o(k){return k.length<5e3&&!i.test(k)?`"${k}"`:JSON.stringify(k)}function a(k,F){if(k.length>200||F)return k.sort(F);for(let q=1;q<k.length;q++){let R=k[q],Q=q;for(;Q!==0&&k[Q-1]>R;)k[Q]=k[Q-1],Q--;k[Q]=R}return k}var s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function u(k){return s.call(k)!==void 0&&k.length!==0}function l(k,F,q){k.length<q&&(q=k.length);let R=F===","?"":" ",Q=`"0":${R}${k[0]}`;for(let K=1;K<q;K++)Q+=`${F}"${K}":${R}${k[K]}`;return Q}function f(k){if(r.call(k,"circularValue")){let F=k.circularValue;if(typeof F=="string")return`"${F}"`;if(F==null)return F;if(F===Error||F===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 d(k){let F;if(r.call(k,"deterministic")&&(F=k.deterministic,typeof F!="boolean"&&typeof F!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return F===void 0?!0:F}function I(k,F){let q;if(r.call(k,F)&&(q=k[F],typeof q!="boolean"))throw new TypeError(`The "${F}" argument must be of type boolean`);return q===void 0?!0:q}function E(k,F){let q;if(r.call(k,F)){if(q=k[F],typeof q!="number")throw new TypeError(`The "${F}" argument must be of type number`);if(!Number.isInteger(q))throw new TypeError(`The "${F}" argument must be an integer`);if(q<1)throw new RangeError(`The "${F}" argument must be >= 1`)}return q===void 0?1/0:q}function _(k){return k===1?"1 item":`${k} items`}function L(k){let F=new Set;for(let q of k)(typeof q=="string"||typeof q=="number")&&F.add(String(q));return F}function J(k){if(r.call(k,"strict")){let F=k.strict;if(typeof F!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(F)return q=>{let R=`Object can not safely be stringified. Received type ${typeof q}`;throw typeof q!="function"&&(R+=` (${q.toString()})`),new Error(R)}}}function B(k){k={...k};let F=J(k);F&&(k.bigint===void 0&&(k.bigint=!1),"circularValue"in k||(k.circularValue=Error));let q=f(k),R=I(k,"bigint"),Q=d(k),K=typeof Q=="function"?Q:void 0,re=E(k,"maximumDepth"),$=E(k,"maximumBreadth");function D(fe,V,X,ee,be,p){let w=V[fe];switch(typeof w=="object"&&w!==null&&typeof w.toJSON=="function"&&(w=w.toJSON(fe)),w=ee.call(V,fe,w),typeof w){case"string":return o(w);case"object":{if(w===null)return"null";if(X.indexOf(w)!==-1)return q;let A="",P=",",j=p;if(Array.isArray(w)){if(w.length===0)return"[]";if(re<X.length+1)return'"[Array]"';X.push(w),be!==""&&(p+=be,A+=`
30
+ Use 'override' annotation for methods overridden by subclass.`)}}var Jw=rh(0),Xw=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Xs=0,th=function(){};function Qw(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}Qw(th,Array.prototype);var Sl=function(e){function t(n,i,o,a){var s;return o===void 0&&(o="ObservableArray@"+Ht()),a===void 0&&(a=!1),s=e.call(this)||this,Un(function(){var u=new Al(o,i,a,!0);u.proxy_=s,vp(s,Ee,u),n&&n.length&&s.spliceWithArray(0,0,n),Xw&&Object.defineProperty(s,"0",Jw)}),s}_p(t,e);var r=t.prototype;return r.concat=function(){this[Ee].atom_.reportObserved();for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return Array.prototype.concat.apply(this.slice(),i.map(function(a){return Ei(a)?a.slice():a}))},r[Symbol.iterator]=function(){var n=this,i=0;return $l({next:function(){return i<n.length?{value:n[i++],done:!1}:{done:!0,value:void 0}}})},vi(t,[{key:"length",get:function(){return this[Ee].getArrayLength_()},set:function(n){this[Ee].setArrayLength_(n)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(th);Object.entries($a).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&fs(Sl.prototype,t,r)});function rh(e){return{enumerable:!1,configurable:!0,get:function(){return this[Ee].get_(e)},set:function(t){this[Ee].set_(e,t)}}}function Zw(e){pr(Sl.prototype,""+e,rh(e))}function nh(e){if(e>Xs){for(var t=Xs;t<e+100;t++)Zw(t);Xs=e}}nh(1e3);function Yw(e,t,r){return new Sl(e,t,r)}function ur(e,t){if(typeof e=="object"&&e!==null){if(Ei(e))return t!==void 0&&he(23),e[Ee].atom_;if(rr(e))return e.atom_;if(br(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||he(25,t,Ca(e)),r}if(Tn(e)){if(!t)return he(26);var n=e[Ee].values_.get(t);return n||he(27,t,Ca(e)),n}if(_l(e)||ko(e)||Ia(e))return e}else if(We(e)&&Ia(e[Ee]))return e[Ee];he(28)}function Il(e,t){if(e||he(29),t!==void 0)return Il(ur(e,t));if(_l(e)||ko(e)||Ia(e)||br(e)||rr(e))return e;if(e[Ee])return e[Ee];he(24,e)}function Ca(e,t){var r;if(t!==void 0)r=ur(e,t);else{if(wn(e))return e.name;Tn(e)||br(e)||rr(e)?r=Il(e):r=ur(e)}return r.name_}function Un(e){var t=Nn(),r=gs(!0);Dt();try{return e()}finally{Mt(),ms(r),Or(t)}}var cf=Oo.toString;function kl(e,t,r){return r===void 0&&(r=-1),$u(e,t,r)}function $u(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 a=cf.call(e);if(a!==cf.call(t))return!1;switch(a){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=ff(e),t=ff(t);var s=a==="[object Array]";if(!s){if(typeof e!="object"||typeof t!="object")return!1;var u=e.constructor,l=t.constructor;if(u!==l&&!(We(u)&&u instanceof u&&We(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(r===0)return!1;r<0&&(r=-1),n=n||[],i=i||[];for(var f=n.length;f--;)if(n[f]===e)return i[f]===t;if(n.push(e),i.push(t),s){if(f=e.length,f!==t.length)return!1;for(;f--;)if(!$u(e[f],t[f],r-1,n,i))return!1}else{var d=Object.keys(e),I=d.length;if(Object.keys(t).length!==I)return!1;for(var E=0;E<I;E++){var _=d[E];if(!(Vt(t,_)&&$u(e[_],t[_],r-1,n,i)))return!1}}return n.pop(),i.pop(),!0}function ff(e){return Ei(e)?e.slice():bi(e)||br(e)||Er(e)||rr(e)?Array.from(e.entries()):e}var df,e2=((df=ls().Iterator)==null?void 0:df.prototype)||{};function $l(e){return e[Symbol.iterator]=t2,Object.assign(Object.create(e2),e)}function t2(){return this}function ih(e){return e instanceof Object&&typeof e.annotationType_=="string"&&We(e.make_)&&We(e.extend_)}["Symbol","Map","Set"].forEach(function(e){var t=ls();typeof t[e]>"u"&&he("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:vw,extras:{getDebugName:Ca},$mobx:Ee});var r2=it({"../../../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(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},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")),a=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=a}}),n2=it({"../../../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(s){return function(u){return function(l,f){var d={key:l,value:u[l]},I={key:f,value:u[f]};return s(d,I)}}}(n.cmp),a=[];return function s(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 l,f;if(Array.isArray(u)){for(f="[",l=0;l<u.length;l++)l&&(f+=","),f+=s(u[l])||"null";return f+"]"}if(u===null)return"null";if(a.indexOf(u)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var d=a.push(u)-1,I=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<I.length;l++){var E=I[l],_=s(u[E]);_&&(f&&(f+=","),f+=JSON.stringify(E)+":"+_)}return a.splice(d,1),"{"+f+"}"}}(r)}}}),i2=it({"../../../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=B();n.configure=B,n.stringify=n,n.default=n,e.stringify=n,e.configure=B,t.exports=n;var i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function o(k){return k.length<5e3&&!i.test(k)?`"${k}"`:JSON.stringify(k)}function a(k,F){if(k.length>200||F)return k.sort(F);for(let G=1;G<k.length;G++){let R=k[G],Q=G;for(;Q!==0&&k[Q-1]>R;)k[Q]=k[Q-1],Q--;k[Q]=R}return k}var s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function u(k){return s.call(k)!==void 0&&k.length!==0}function l(k,F,G){k.length<G&&(G=k.length);let R=F===","?"":" ",Q=`"0":${R}${k[0]}`;for(let K=1;K<G;K++)Q+=`${F}"${K}":${R}${k[K]}`;return Q}function f(k){if(r.call(k,"circularValue")){let F=k.circularValue;if(typeof F=="string")return`"${F}"`;if(F==null)return F;if(F===Error||F===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 d(k){let F;if(r.call(k,"deterministic")&&(F=k.deterministic,typeof F!="boolean"&&typeof F!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return F===void 0?!0:F}function I(k,F){let G;if(r.call(k,F)&&(G=k[F],typeof G!="boolean"))throw new TypeError(`The "${F}" argument must be of type boolean`);return G===void 0?!0:G}function E(k,F){let G;if(r.call(k,F)){if(G=k[F],typeof G!="number")throw new TypeError(`The "${F}" argument must be of type number`);if(!Number.isInteger(G))throw new TypeError(`The "${F}" argument must be an integer`);if(G<1)throw new RangeError(`The "${F}" argument must be >= 1`)}return G===void 0?1/0:G}function _(k){return k===1?"1 item":`${k} items`}function L(k){let F=new Set;for(let G of k)(typeof G=="string"||typeof G=="number")&&F.add(String(G));return F}function J(k){if(r.call(k,"strict")){let F=k.strict;if(typeof F!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(F)return G=>{let R=`Object can not safely be stringified. Received type ${typeof G}`;throw typeof G!="function"&&(R+=` (${G.toString()})`),new Error(R)}}}function B(k){k={...k};let F=J(k);F&&(k.bigint===void 0&&(k.bigint=!1),"circularValue"in k||(k.circularValue=Error));let G=f(k),R=I(k,"bigint"),Q=d(k),K=typeof Q=="function"?Q:void 0,re=E(k,"maximumDepth"),$=E(k,"maximumBreadth");function D(fe,V,X,ee,be,p){let w=V[fe];switch(typeof w=="object"&&w!==null&&typeof w.toJSON=="function"&&(w=w.toJSON(fe)),w=ee.call(V,fe,w),typeof w){case"string":return o(w);case"object":{if(w===null)return"null";if(X.indexOf(w)!==-1)return G;let A="",P=",",j=p;if(Array.isArray(w)){if(w.length===0)return"[]";if(re<X.length+1)return'"[Array]"';X.push(w),be!==""&&(p+=be,A+=`
31
31
  ${p}`,P=`,
32
32
  ${p}`);let x=Math.min(w.length,$),v=0;for(;v<x-1;v++){let U=D(String(v),w,X,ee,be,p);A+=U!==void 0?U:"null",A+=P}let b=D(String(v),w,X,ee,be,p);if(A+=b!==void 0?b:"null",w.length-1>$){let U=w.length-$-1;A+=`${P}"... ${_(U)} not stringified"`}return be!==""&&(A+=`
33
33
  ${j}`),X.pop(),`[${A}]`}let N=Object.keys(w),g=N.length;if(g===0)return"{}";if(re<X.length+1)return'"[Object]"';let O="",T="";be!==""&&(p+=be,P=`,
34
34
  ${p}`,O=" ");let c=Math.min(g,$);Q&&!u(w)&&(N=a(N,K)),X.push(w);for(let x=0;x<c;x++){let v=N[x],b=D(v,w,X,ee,be,p);b!==void 0&&(A+=`${T}${o(v)}:${O}${b}`,T=P)}if(g>$){let x=g-$;A+=`${T}"...":${O}"${_(x)} not stringified"`,T=P}return be!==""&&T.length>1&&(A=`
35
35
  ${p}${A}
36
- ${j}`),X.pop(),`{${A}}`}case"number":return isFinite(w)?String(w):F?F(w):"null";case"boolean":return w===!0?"true":"false";case"undefined":return;case"bigint":if(R)return String(w);default:return F?F(w):void 0}}function z(fe,V,X,ee,be,p){switch(typeof V=="object"&&V!==null&&typeof V.toJSON=="function"&&(V=V.toJSON(fe)),typeof V){case"string":return o(V);case"object":{if(V===null)return"null";if(X.indexOf(V)!==-1)return q;let w=p,A="",P=",";if(Array.isArray(V)){if(V.length===0)return"[]";if(re<X.length+1)return'"[Array]"';X.push(V),be!==""&&(p+=be,A+=`
36
+ ${j}`),X.pop(),`{${A}}`}case"number":return isFinite(w)?String(w):F?F(w):"null";case"boolean":return w===!0?"true":"false";case"undefined":return;case"bigint":if(R)return String(w);default:return F?F(w):void 0}}function z(fe,V,X,ee,be,p){switch(typeof V=="object"&&V!==null&&typeof V.toJSON=="function"&&(V=V.toJSON(fe)),typeof V){case"string":return o(V);case"object":{if(V===null)return"null";if(X.indexOf(V)!==-1)return G;let w=p,A="",P=",";if(Array.isArray(V)){if(V.length===0)return"[]";if(re<X.length+1)return'"[Array]"';X.push(V),be!==""&&(p+=be,A+=`
37
37
  ${p}`,P=`,
38
38
  ${p}`);let g=Math.min(V.length,$),O=0;for(;O<g-1;O++){let c=z(String(O),V[O],X,ee,be,p);A+=c!==void 0?c:"null",A+=P}let T=z(String(O),V[O],X,ee,be,p);if(A+=T!==void 0?T:"null",V.length-1>$){let c=V.length-$-1;A+=`${P}"... ${_(c)} not stringified"`}return be!==""&&(A+=`
39
39
  ${w}`),X.pop(),`[${A}]`}X.push(V);let j="";be!==""&&(p+=be,P=`,
40
40
  ${p}`,j=" ");let N="";for(let g of ee){let O=z(g,V[g],X,ee,be,p);O!==void 0&&(A+=`${N}${o(g)}:${j}${O}`,N=P)}return be!==""&&N.length>1&&(A=`
41
41
  ${p}${A}
42
- ${w}`),X.pop(),`{${A}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(R)return String(V);default:return F?F(V):void 0}}function ne(fe,V,X,ee,be){switch(typeof V){case"string":return o(V);case"object":{if(V===null)return"null";if(typeof V.toJSON=="function"){if(V=V.toJSON(fe),typeof V!="object")return ne(fe,V,X,ee,be);if(V===null)return"null"}if(X.indexOf(V)!==-1)return q;let p=be;if(Array.isArray(V)){if(V.length===0)return"[]";if(re<X.length+1)return'"[Array]"';X.push(V),be+=ee;let O=`
42
+ ${w}`),X.pop(),`{${A}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(R)return String(V);default:return F?F(V):void 0}}function ne(fe,V,X,ee,be){switch(typeof V){case"string":return o(V);case"object":{if(V===null)return"null";if(typeof V.toJSON=="function"){if(V=V.toJSON(fe),typeof V!="object")return ne(fe,V,X,ee,be);if(V===null)return"null"}if(X.indexOf(V)!==-1)return G;let p=be;if(Array.isArray(V)){if(V.length===0)return"[]";if(re<X.length+1)return'"[Array]"';X.push(V),be+=ee;let O=`
43
43
  ${be}`,T=`,
44
44
  ${be}`,c=Math.min(V.length,$),x=0;for(;x<c-1;x++){let b=ne(String(x),V[x],X,ee,be);O+=b!==void 0?b:"null",O+=T}let v=ne(String(x),V[x],X,ee,be);if(O+=v!==void 0?v:"null",V.length-1>$){let b=V.length-$-1;O+=`${T}"... ${_(b)} not stringified"`}return O+=`
45
45
  ${p}`,X.pop(),`[${O}]`}let w=Object.keys(V),A=w.length;if(A===0)return"{}";if(re<X.length+1)return'"[Object]"';be+=ee;let P=`,
46
46
  ${be}`,j="",N="",g=Math.min(A,$);u(V)&&(j+=l(V,P,$),w=w.slice(V.length),g-=V.length,N=P),Q&&(w=a(w,K)),X.push(V);for(let O=0;O<g;O++){let T=w[O],c=ne(T,V[T],X,ee,be);c!==void 0&&(j+=`${N}${o(T)}: ${c}`,N=P)}if(A>$){let O=A-$;j+=`${N}"...": "${_(O)} not stringified"`,N=P}return N!==""&&(j=`
47
47
  ${be}${j}
48
- ${p}`),X.pop(),`{${j}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(R)return String(V);default:return F?F(V):void 0}}function ue(fe,V,X){switch(typeof V){case"string":return o(V);case"object":{if(V===null)return"null";if(typeof V.toJSON=="function"){if(V=V.toJSON(fe),typeof V!="object")return ue(fe,V,X);if(V===null)return"null"}if(X.indexOf(V)!==-1)return q;let ee="",be=V.length!==void 0;if(be&&Array.isArray(V)){if(V.length===0)return"[]";if(re<X.length+1)return'"[Array]"';X.push(V);let j=Math.min(V.length,$),N=0;for(;N<j-1;N++){let O=ue(String(N),V[N],X);ee+=O!==void 0?O:"null",ee+=","}let g=ue(String(N),V[N],X);if(ee+=g!==void 0?g:"null",V.length-1>$){let O=V.length-$-1;ee+=`,"... ${_(O)} not stringified"`}return X.pop(),`[${ee}]`}let p=Object.keys(V),w=p.length;if(w===0)return"{}";if(re<X.length+1)return'"[Object]"';let A="",P=Math.min(w,$);be&&u(V)&&(ee+=l(V,",",$),p=p.slice(V.length),P-=V.length,A=","),Q&&(p=a(p,K)),X.push(V);for(let j=0;j<P;j++){let N=p[j],g=ue(N,V[N],X);g!==void 0&&(ee+=`${A}${o(N)}:${g}`,A=",")}if(w>$){let j=w-$;ee+=`${A}"...":"${_(j)} not stringified"`}return X.pop(),`{${ee}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(R)return String(V);default:return F?F(V):void 0}}function te(fe,V,X){if(arguments.length>1){let ee="";if(typeof X=="number"?ee=" ".repeat(Math.min(X,10)):typeof X=="string"&&(ee=X.slice(0,10)),V!=null){if(typeof V=="function")return D("",{"":fe},[],V,ee,"");if(Array.isArray(V))return z("",fe,[],L(V),ee,"")}if(ee.length!==0)return ne("",fe,[],ee,"")}return ue("",fe,[])}return te}}}),Oi=it({"../../../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(R){return l(R)&&Symbol.asyncIterator in R}e.IsAsyncIterator=t;function r(R){return l(R)&&Symbol.iterator in R}e.IsIterator=r;function n(R){return ArrayBuffer.isView(R)}e.IsTypedArray=n;function i(R){return R instanceof Promise}e.IsPromise=i;function o(R){return R instanceof Uint8Array}e.IsUint8Array=o;function a(R){return R instanceof Date&&Number.isFinite(R.getTime())}e.IsDate=a;function s(R,Q){return Q in R}e.HasPropertyKey=s;function u(R){return l(R)&&k(R.constructor)&&R.constructor.name==="Object"}e.IsPlainObject=u;function l(R){return R!==null&&typeof R=="object"}e.IsObject=l;function f(R){return Array.isArray(R)&&!ArrayBuffer.isView(R)}e.IsArray=f;function d(R){return R===void 0}e.IsUndefined=d;function I(R){return R===null}e.IsNull=I;function E(R){return typeof R=="boolean"}e.IsBoolean=E;function _(R){return typeof R=="number"}e.IsNumber=_;function L(R){return _(R)&&Number.isInteger(R)}e.IsInteger=L;function J(R){return typeof R=="bigint"}e.IsBigInt=J;function B(R){return typeof R=="string"}e.IsString=B;function k(R){return typeof R=="function"}e.IsFunction=k;function F(R){return typeof R=="symbol"}e.IsSymbol=F;function q(R){return J(R)||E(R)||I(R)||_(R)||B(R)||F(R)||d(R)}e.IsValueType=q}}),oh=it({"../../../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=Oi(),r=Ts(),n=sn(),i=class extends n.TypeBoxError{constructor(f){super(`Duplicate type kind '${f}' detected`)}};e.TypeSystemDuplicateTypeKind=i;var o=class extends n.TypeBoxError{constructor(f){super(`Duplicate string format '${f}' detected`)}};e.TypeSystemDuplicateFormat=o;var a;(function(f){function d(E,_){if(n.TypeRegistry.Has(E))throw new i(E);return n.TypeRegistry.Set(E,_),(L={})=>n.Type.Unsafe({...L,[n.Kind]:E})}f.Type=d;function I(E,_){if(n.FormatRegistry.Has(E))throw new o(E);return n.FormatRegistry.Set(E,_),E}f.Format=I})(a||(e.TypeSystem=a={}));var s;(function(f){let d=l;function I(){d=l}f.Reset=I;function E(L){d=L}f.Set=E;function _(){return d}f.Get=_})(s||(e.TypeSystemErrorFunction=s={}));var u;(function(f){f.ExactOptionalPropertyTypes=!1,f.AllowArrayObject=!1,f.AllowNaN=!1,f.AllowNullVoid=!1;function d(J,B){return f.ExactOptionalPropertyTypes?B in J:J[B]!==void 0}f.IsExactOptionalProperty=d;function I(J){let B=(0,t.IsObject)(J);return f.AllowArrayObject?B:B&&!(0,t.IsArray)(J)}f.IsObjectLike=I;function E(J){return I(J)&&!(J instanceof Date)&&!(J instanceof Uint8Array)}f.IsRecordLike=E;function _(J){let B=(0,t.IsNumber)(J);return f.AllowNaN?B:B&&Number.isFinite(J)}f.IsNumberLike=_;function L(J){let B=(0,t.IsUndefined)(J);return f.AllowNullVoid?B||J===null:B}f.IsVoidLike=L})(u||(e.TypeSystemPolicy=u={}));function l(f,d){switch(d){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 ${f.maxContains} matching values`;case r.ValueErrorType.ArrayMinContains:return`Expected array to contain at least ${f.minContains} matching values`;case r.ValueErrorType.ArrayMaxItems:return`Expected array length to be less or equal to ${f.maxItems}`;case r.ValueErrorType.ArrayMinItems:return`Expected array length to be greater or equal to ${f.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 ${f.exclusiveMaximum}`;case r.ValueErrorType.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.BigIntMaximum:return`Expected bigint to be less or equal to ${f.maximum}`;case r.ValueErrorType.BigIntMinimum:return`Expected bigint to be greater or equal to ${f.minimum}`;case r.ValueErrorType.BigIntMultipleOf:return`Expected bigint to be a multiple of ${f.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 ${f.exclusiveMinimumTimestamp}`;case r.ValueErrorType.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${f.exclusiveMaximumTimestamp}`;case r.ValueErrorType.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${f.minimumTimestamp}`;case r.ValueErrorType.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${f.maximumTimestamp}`;case r.ValueErrorType.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${f.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 ${f.exclusiveMaximum}`;case r.ValueErrorType.IntegerExclusiveMinimum:return`Expected integer to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.IntegerMaximum:return`Expected integer to be less or equal to ${f.maximum}`;case r.ValueErrorType.IntegerMinimum:return`Expected integer to be greater or equal to ${f.minimum}`;case r.ValueErrorType.IntegerMultipleOf:return`Expected integer to be a multiple of ${f.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 f.const=="string"?`'${f.const}'`:f.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 ${f.exclusiveMaximum}`;case r.ValueErrorType.NumberExclusiveMinimum:return`Expected number to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.NumberMaximum:return`Expected number to be less or equal to ${f.maximum}`;case r.ValueErrorType.NumberMinimum:return`Expected number to be greater or equal to ${f.minimum}`;case r.ValueErrorType.NumberMultipleOf:return`Expected number to be a multiple of ${f.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 ${f.maxProperties} properties`;case r.ValueErrorType.ObjectMinProperties:return`Expected object to have at least ${f.minProperties} properties`;case r.ValueErrorType.ObjectRequiredProperty:return"Required property";case r.ValueErrorType.Promise:return"Expected Promise";case r.ValueErrorType.StringFormatUnknown:return`Unknown format '${f.format}'`;case r.ValueErrorType.StringFormat:return`Expected string to match '${f.format}' format`;case r.ValueErrorType.StringMaxLength:return`Expected string length less or equal to ${f.maxLength}`;case r.ValueErrorType.StringMinLength:return`Expected string length greater or equal to ${f.minLength}`;case r.ValueErrorType.StringPattern:return`Expected string to match '${f.pattern}'`;case r.ValueErrorType.String:return"Expected string";case r.ValueErrorType.Symbol:return"Expected symbol";case r.ValueErrorType.TupleLength:return`Expected tuple to have ${f.maxItems||0} elements`;case r.ValueErrorType.Tuple:return"Expected tuple";case r.ValueErrorType.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${f.maxByteLength}`;case r.ValueErrorType.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${f.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 '${f[n.Kind]}'`;default:return"Unknown error type"}}e.DefaultErrorFunction=l}}),ws=it({"../../../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=sn(),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 a=o.findIndex(s=>s.$id===i.$ref);if(a===-1)throw new r(i);return o[a]}e.Deref=n}}),jl=it({"../../../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=Oi(),r=class extends Error{constructor(D){super("Unable to hash value"),this.value=D}};e.ValueHashError=r;var n;(function(D){D[D.Undefined=0]="Undefined",D[D.Null=1]="Null",D[D.Boolean=2]="Boolean",D[D.Number=3]="Number",D[D.String=4]="String",D[D.Object=5]="Object",D[D.Array=6]="Array",D[D.Date=7]="Date",D[D.Uint8Array=8]="Uint8Array",D[D.Symbol=9]="Symbol",D[D.BigInt=10]="BigInt"})(n||(e.ByteMarker=n={}));var i=BigInt("14695981039346656037"),[o,a]=[BigInt("1099511628211"),BigInt("2")**BigInt("64")],s=Array.from({length:256}).map((D,z)=>BigInt(z)),u=new Float64Array(1),l=new DataView(u.buffer),f=new Uint8Array(u.buffer);function*d(D){let z=D===0?1:Math.ceil(Math.floor(Math.log2(D)+1)/8);for(let ne=0;ne<z;ne++)yield D>>8*(z-1-ne)&255}function I(D){re(n.Array);for(let z of D)K(z)}function E(D){re(n.Boolean),re(D?1:0)}function _(D){re(n.BigInt),l.setBigInt64(0,D);for(let z of f)re(z)}function L(D){re(n.Date),K(D.getTime())}function J(D){re(n.Null)}function B(D){re(n.Number),l.setFloat64(0,D);for(let z of f)re(z)}function k(D){re(n.Object);for(let z of globalThis.Object.keys(D).sort())K(z),K(D[z])}function F(D){re(n.String);for(let z=0;z<D.length;z++)for(let ne of d(D.charCodeAt(z)))re(ne)}function q(D){re(n.Symbol),K(D.description)}function R(D){re(n.Uint8Array);for(let z=0;z<D.length;z++)re(D[z])}function Q(D){return re(n.Undefined)}function K(D){if((0,t.IsArray)(D))return I(D);if((0,t.IsBoolean)(D))return E(D);if((0,t.IsBigInt)(D))return _(D);if((0,t.IsDate)(D))return L(D);if((0,t.IsNull)(D))return J(D);if((0,t.IsNumber)(D))return B(D);if((0,t.IsPlainObject)(D))return k(D);if((0,t.IsString)(D))return F(D);if((0,t.IsSymbol)(D))return q(D);if((0,t.IsUint8Array)(D))return R(D);if((0,t.IsUndefined)(D))return Q(D);throw new r(D)}function re(D){i=i^s[D],i=i*o%a}function $(D){return i=BigInt("14695981039346656037"),K(D),i}e.Hash=$}}),Ts=it({"../../../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=Oi(),r=oh(),n=ws(),i=jl(),o=sn(),a;(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"})(a||(e.ValueErrorType=a={}));var s=class extends o.TypeBoxError{constructor(c){super("Unknown type"),this.schema=c}};e.ValueErrorsUnknownTypeError=s;function u(c){return c.replace(/~/g,"~0").replace(/\//g,"~1")}e.EscapeKey=u;function l(c){return c!==void 0}var f=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=f;function d(c,x,v,b){return{type:c,schema:x,path:v,value:b,message:r.TypeSystemErrorFunction.Get()(x,c)}}function*I(c,x,v,b){}function*E(c,x,v,b){if(!(0,t.IsArray)(b))return yield d(a.Array,c,v,b);l(c.minItems)&&!(b.length>=c.minItems)&&(yield d(a.ArrayMinItems,c,v,b)),l(c.maxItems)&&!(b.length<=c.maxItems)&&(yield d(a.ArrayMaxItems,c,v,b));for(let ie=0;ie<b.length;ie++)yield*O(c.items,x,`${v}/${ie}`,b[ie]);if(c.uniqueItems===!0&&!function(){let ie=new Set;for(let oe of b){let _e=(0,i.Hash)(oe);if(ie.has(_e))return!1;ie.add(_e)}return!0}()&&(yield d(a.ArrayUniqueItems,c,v,b)),!(l(c.contains)||l(c.minContains)||l(c.maxContains)))return;let U=l(c.contains)?c.contains:o.Type.Never(),H=b.reduce((ie,oe,_e)=>O(U,x,`${v}${_e}`,oe).next().done===!0?ie+1:ie,0);H===0&&(yield d(a.ArrayContains,c,v,b)),(0,t.IsNumber)(c.minContains)&&H<c.minContains&&(yield d(a.ArrayMinContains,c,v,b)),(0,t.IsNumber)(c.maxContains)&&H>c.maxContains&&(yield d(a.ArrayMaxContains,c,v,b))}function*_(c,x,v,b){(0,t.IsAsyncIterator)(b)||(yield d(a.AsyncIterator,c,v,b))}function*L(c,x,v,b){if(!(0,t.IsBigInt)(b))return yield d(a.BigInt,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.BigIntExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.BigIntExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.BigIntMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.BigIntMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==BigInt(0)&&(yield d(a.BigIntMultipleOf,c,v,b))}function*J(c,x,v,b){(0,t.IsBoolean)(b)||(yield d(a.Boolean,c,v,b))}function*B(c,x,v,b){yield*O(c.returns,x,v,b.prototype)}function*k(c,x,v,b){if(!(0,t.IsDate)(b))return yield d(a.Date,c,v,b);l(c.exclusiveMaximumTimestamp)&&!(b.getTime()<c.exclusiveMaximumTimestamp)&&(yield d(a.DateExclusiveMaximumTimestamp,c,v,b)),l(c.exclusiveMinimumTimestamp)&&!(b.getTime()>c.exclusiveMinimumTimestamp)&&(yield d(a.DateExclusiveMinimumTimestamp,c,v,b)),l(c.maximumTimestamp)&&!(b.getTime()<=c.maximumTimestamp)&&(yield d(a.DateMaximumTimestamp,c,v,b)),l(c.minimumTimestamp)&&!(b.getTime()>=c.minimumTimestamp)&&(yield d(a.DateMinimumTimestamp,c,v,b)),l(c.multipleOfTimestamp)&&b.getTime()%c.multipleOfTimestamp!==0&&(yield d(a.DateMultipleOfTimestamp,c,v,b))}function*F(c,x,v,b){(0,t.IsFunction)(b)||(yield d(a.Function,c,v,b))}function*q(c,x,v,b){if(!(0,t.IsInteger)(b))return yield d(a.Integer,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.IntegerExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.IntegerExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.IntegerMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.IntegerMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==0&&(yield d(a.IntegerMultipleOf,c,v,b))}function*R(c,x,v,b){for(let U of c.allOf){let H=O(U,x,v,b).next();H.done||(yield d(a.Intersect,c,v,b),yield H.value)}if(c.unevaluatedProperties===!1){let U=new RegExp(o.KeyResolver.ResolvePattern(c));for(let H of Object.getOwnPropertyNames(b))U.test(H)||(yield d(a.IntersectUnevaluatedProperties,c,`${v}/${H}`,b))}if(typeof c.unevaluatedProperties=="object"){let U=new RegExp(o.KeyResolver.ResolvePattern(c));for(let H of Object.getOwnPropertyNames(b))if(!U.test(H)){let ie=O(c.unevaluatedProperties,x,`${v}/${H}`,b[H]).next();ie.done||(yield ie.value)}}}function*Q(c,x,v,b){(0,t.IsIterator)(b)||(yield d(a.Iterator,c,v,b))}function*K(c,x,v,b){b!==c.const&&(yield d(a.Literal,c,v,b))}function*re(c,x,v,b){yield d(a.Never,c,v,b)}function*$(c,x,v,b){O(c.not,x,v,b).next().done===!0&&(yield d(a.Not,c,v,b))}function*D(c,x,v,b){(0,t.IsNull)(b)||(yield d(a.Null,c,v,b))}function*z(c,x,v,b){if(!r.TypeSystemPolicy.IsNumberLike(b))return yield d(a.Number,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.NumberExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.NumberExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.NumberMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.NumberMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==0&&(yield d(a.NumberMultipleOf,c,v,b))}function*ne(c,x,v,b){if(!r.TypeSystemPolicy.IsObjectLike(b))return yield d(a.Object,c,v,b);l(c.minProperties)&&!(Object.getOwnPropertyNames(b).length>=c.minProperties)&&(yield d(a.ObjectMinProperties,c,v,b)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=c.maxProperties)&&(yield d(a.ObjectMaxProperties,c,v,b));let U=Array.isArray(c.required)?c.required:[],H=Object.getOwnPropertyNames(c.properties),ie=Object.getOwnPropertyNames(b);for(let oe of U)ie.includes(oe)||(yield d(a.ObjectRequiredProperty,c.properties[oe],`${v}/${u(oe)}`,void 0));if(c.additionalProperties===!1)for(let oe of ie)H.includes(oe)||(yield d(a.ObjectAdditionalProperties,c,`${v}/${u(oe)}`,b[oe]));if(typeof c.additionalProperties=="object")for(let oe of ie)H.includes(oe)||(yield*O(c.additionalProperties,x,`${v}/${u(oe)}`,b[oe]));for(let oe of H){let _e=c.properties[oe];c.required&&c.required.includes(oe)?(yield*O(_e,x,`${v}/${u(oe)}`,b[oe]),o.ExtendsUndefined.Check(c)&&!(oe in b)&&(yield d(a.ObjectRequiredProperty,_e,`${v}/${u(oe)}`,void 0))):r.TypeSystemPolicy.IsExactOptionalProperty(b,oe)&&(yield*O(_e,x,`${v}/${u(oe)}`,b[oe]))}}function*ue(c,x,v,b){(0,t.IsPromise)(b)||(yield d(a.Promise,c,v,b))}function*te(c,x,v,b){if(!r.TypeSystemPolicy.IsRecordLike(b))return yield d(a.Object,c,v,b);l(c.minProperties)&&!(Object.getOwnPropertyNames(b).length>=c.minProperties)&&(yield d(a.ObjectMinProperties,c,v,b)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=c.maxProperties)&&(yield d(a.ObjectMaxProperties,c,v,b));let[U,H]=Object.entries(c.patternProperties)[0],ie=new RegExp(U);for(let[oe,_e]of Object.entries(b))ie.test(oe)&&(yield*O(H,x,`${v}/${u(oe)}`,_e));if(typeof c.additionalProperties=="object")for(let[oe,_e]of Object.entries(b))ie.test(oe)||(yield*O(c.additionalProperties,x,`${v}/${u(oe)}`,_e));if(c.additionalProperties===!1){for(let[oe,_e]of Object.entries(b))if(!ie.test(oe))return yield d(a.ObjectAdditionalProperties,c,`${v}/${u(oe)}`,_e)}}function*fe(c,x,v,b){yield*O((0,n.Deref)(c,x),x,v,b)}function*V(c,x,v,b){if(!(0,t.IsString)(b))return yield d(a.String,c,v,b);l(c.minLength)&&!(b.length>=c.minLength)&&(yield d(a.StringMinLength,c,v,b)),l(c.maxLength)&&!(b.length<=c.maxLength)&&(yield d(a.StringMaxLength,c,v,b)),(0,t.IsString)(c.pattern)&&(new RegExp(c.pattern).test(b)||(yield d(a.StringPattern,c,v,b))),(0,t.IsString)(c.format)&&(o.FormatRegistry.Has(c.format)?o.FormatRegistry.Get(c.format)(b)||(yield d(a.StringFormat,c,v,b)):yield d(a.StringFormatUnknown,c,v,b))}function*X(c,x,v,b){(0,t.IsSymbol)(b)||(yield d(a.Symbol,c,v,b))}function*ee(c,x,v,b){if(!(0,t.IsString)(b))return yield d(a.String,c,v,b);new RegExp(c.pattern).test(b)||(yield d(a.StringPattern,c,v,b))}function*be(c,x,v,b){yield*O((0,n.Deref)(c,x),x,v,b)}function*p(c,x,v,b){if(!(0,t.IsArray)(b))return yield d(a.Tuple,c,v,b);if(c.items===void 0&&b.length!==0)return yield d(a.TupleLength,c,v,b);if(b.length!==c.maxItems)return yield d(a.TupleLength,c,v,b);if(c.items)for(let U=0;U<c.items.length;U++)yield*O(c.items[U],x,`${v}/${U}`,b[U])}function*w(c,x,v,b){(0,t.IsUndefined)(b)||(yield d(a.Undefined,c,v,b))}function*A(c,x,v,b){let U=0;for(let H of c.anyOf){let ie=[...O(H,x,v,b)];if(ie.length===0)return;U+=ie.length}U>0&&(yield d(a.Union,c,v,b))}function*P(c,x,v,b){if(!(0,t.IsUint8Array)(b))return yield d(a.Uint8Array,c,v,b);l(c.maxByteLength)&&!(b.length<=c.maxByteLength)&&(yield d(a.Uint8ArrayMaxByteLength,c,v,b)),l(c.minByteLength)&&!(b.length>=c.minByteLength)&&(yield d(a.Uint8ArrayMinByteLength,c,v,b))}function*j(c,x,v,b){}function*N(c,x,v,b){r.TypeSystemPolicy.IsVoidLike(b)||(yield d(a.Void,c,v,b))}function*g(c,x,v,b){o.TypeRegistry.Get(c[o.Kind])(c,b)||(yield d(a.Kind,c,v,b))}function*O(c,x,v,b){let U=l(c.$id)?[...x,c]:x,H=c;switch(H[o.Kind]){case"Any":return yield*I(H,U,v,b);case"Array":return yield*E(H,U,v,b);case"AsyncIterator":return yield*_(H,U,v,b);case"BigInt":return yield*L(H,U,v,b);case"Boolean":return yield*J(H,U,v,b);case"Constructor":return yield*B(H,U,v,b);case"Date":return yield*k(H,U,v,b);case"Function":return yield*F(H,U,v,b);case"Integer":return yield*q(H,U,v,b);case"Intersect":return yield*R(H,U,v,b);case"Iterator":return yield*Q(H,U,v,b);case"Literal":return yield*K(H,U,v,b);case"Never":return yield*re(H,U,v,b);case"Not":return yield*$(H,U,v,b);case"Null":return yield*D(H,U,v,b);case"Number":return yield*z(H,U,v,b);case"Object":return yield*ne(H,U,v,b);case"Promise":return yield*ue(H,U,v,b);case"Record":return yield*te(H,U,v,b);case"Ref":return yield*fe(H,U,v,b);case"String":return yield*V(H,U,v,b);case"Symbol":return yield*X(H,U,v,b);case"TemplateLiteral":return yield*ee(H,U,v,b);case"This":return yield*be(H,U,v,b);case"Tuple":return yield*p(H,U,v,b);case"Undefined":return yield*w(H,U,v,b);case"Union":return yield*A(H,U,v,b);case"Uint8Array":return yield*P(H,U,v,b);case"Unknown":return yield*j(H,U,v,b);case"Void":return yield*N(H,U,v,b);default:if(!o.TypeRegistry.Has(H[o.Kind]))throw new s(c);return yield*g(H,U,v,b)}}function T(...c){let x=c.length===3?O(c[0],c[1],"",c[2]):O(c[0],[],"",c[1]);return new f(x)}e.Errors=T}}),o2=it({"../../../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,a){a===void 0&&(a=o);var s=Object.getOwnPropertyDescriptor(i,o);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(n,a,s)}:function(n,i,o,a){a===void 0&&(a=o),n[a]=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(Ts(),e)}}),ah=it({"../../../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,a,s){s===void 0&&(s=a);var u=Object.getOwnPropertyDescriptor(o,a);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(i,s,u)}:function(i,o,a,s){s===void 0&&(s=a),i[s]=o[a]}),r=e&&e.__exportStar||function(i,o){for(var a in i)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorType=void 0;var n=Ts();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(oh(),e)}}),a2=it({"../../../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=Oi(),r=ah(),n=ws(),i=jl(),o=sn(),a=class extends o.TypeBoxError{constructor(g){super("Unknown type"),this.schema=g}};e.ValueCheckUnknownTypeError=a;function s(g){return g[o.Kind]==="Any"||g[o.Kind]==="Unknown"}function u(g){return g!==void 0}function l(g,O,T){return!0}function f(g,O,T){if(!(0,t.IsArray)(T)||u(g.minItems)&&!(T.length>=g.minItems)||u(g.maxItems)&&!(T.length<=g.maxItems)||!T.every(v=>j(g.items,O,v))||g.uniqueItems===!0&&!function(){let v=new Set;for(let b of T){let U=(0,i.Hash)(b);if(v.has(U))return!1;v.add(U)}return!0}())return!1;if(!(u(g.contains)||(0,t.IsNumber)(g.minContains)||(0,t.IsNumber)(g.maxContains)))return!0;let c=u(g.contains)?g.contains:o.Type.Never(),x=T.reduce((v,b)=>j(c,O,b)?v+1:v,0);return!(x===0||(0,t.IsNumber)(g.minContains)&&x<g.minContains||(0,t.IsNumber)(g.maxContains)&&x>g.maxContains)}function d(g,O,T){return(0,t.IsAsyncIterator)(T)}function I(g,O,T){return!(!(0,t.IsBigInt)(T)||u(g.exclusiveMaximum)&&!(T<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(T>g.exclusiveMinimum)||u(g.maximum)&&!(T<=g.maximum)||u(g.minimum)&&!(T>=g.minimum)||u(g.multipleOf)&&T%g.multipleOf!==BigInt(0))}function E(g,O,T){return(0,t.IsBoolean)(T)}function _(g,O,T){return j(g.returns,O,T.prototype)}function L(g,O,T){return!(!(0,t.IsDate)(T)||u(g.exclusiveMaximumTimestamp)&&!(T.getTime()<g.exclusiveMaximumTimestamp)||u(g.exclusiveMinimumTimestamp)&&!(T.getTime()>g.exclusiveMinimumTimestamp)||u(g.maximumTimestamp)&&!(T.getTime()<=g.maximumTimestamp)||u(g.minimumTimestamp)&&!(T.getTime()>=g.minimumTimestamp)||u(g.multipleOfTimestamp)&&T.getTime()%g.multipleOfTimestamp!==0)}function J(g,O,T){return(0,t.IsFunction)(T)}function B(g,O,T){return!(!(0,t.IsInteger)(T)||u(g.exclusiveMaximum)&&!(T<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(T>g.exclusiveMinimum)||u(g.maximum)&&!(T<=g.maximum)||u(g.minimum)&&!(T>=g.minimum)||u(g.multipleOf)&&T%g.multipleOf!==0)}function k(g,O,T){let c=g.allOf.every(x=>j(x,O,T));if(g.unevaluatedProperties===!1){let x=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(T).every(b=>x.test(b));return c&&v}else if(o.TypeGuard.TSchema(g.unevaluatedProperties)){let x=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(T).every(b=>x.test(b)||j(g.unevaluatedProperties,O,T[b]));return c&&v}else return c}function F(g,O,T){return(0,t.IsIterator)(T)}function q(g,O,T){return T===g.const}function R(g,O,T){return!1}function Q(g,O,T){return!j(g.not,O,T)}function K(g,O,T){return(0,t.IsNull)(T)}function re(g,O,T){return!(!r.TypeSystemPolicy.IsNumberLike(T)||u(g.exclusiveMaximum)&&!(T<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(T>g.exclusiveMinimum)||u(g.minimum)&&!(T>=g.minimum)||u(g.maximum)&&!(T<=g.maximum)||u(g.multipleOf)&&T%g.multipleOf!==0)}function $(g,O,T){if(!r.TypeSystemPolicy.IsObjectLike(T)||u(g.minProperties)&&!(Object.getOwnPropertyNames(T).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(T).length<=g.maxProperties))return!1;let c=Object.getOwnPropertyNames(g.properties);for(let x of c){let v=g.properties[x];if(g.required&&g.required.includes(x)){if(!j(v,O,T[x])||(o.ExtendsUndefined.Check(v)||s(v))&&!(x in T))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(T,x)&&!j(v,O,T[x]))return!1}if(g.additionalProperties===!1){let x=Object.getOwnPropertyNames(T);return g.required&&g.required.length===c.length&&x.length===c.length?!0:x.every(v=>c.includes(v))}else return typeof g.additionalProperties=="object"?Object.getOwnPropertyNames(T).every(x=>c.includes(x)||j(g.additionalProperties,O,T[x])):!0}function D(g,O,T){return(0,t.IsPromise)(T)}function z(g,O,T){if(!r.TypeSystemPolicy.IsRecordLike(T)||u(g.minProperties)&&!(Object.getOwnPropertyNames(T).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(T).length<=g.maxProperties))return!1;let[c,x]=Object.entries(g.patternProperties)[0],v=new RegExp(c),b=Object.entries(T).every(([ie,oe])=>v.test(ie)?j(x,O,oe):!0),U=typeof g.additionalProperties=="object"?Object.entries(T).every(([ie,oe])=>v.test(ie)?!0:j(g.additionalProperties,O,oe)):!0,H=g.additionalProperties===!1?Object.getOwnPropertyNames(T).every(ie=>v.test(ie)):!0;return b&&U&&H}function ne(g,O,T){return j((0,n.Deref)(g,O),O,T)}function ue(g,O,T){return!(0,t.IsString)(T)||u(g.minLength)&&!(T.length>=g.minLength)||u(g.maxLength)&&!(T.length<=g.maxLength)||u(g.pattern)&&!new RegExp(g.pattern).test(T)?!1:u(g.format)?o.FormatRegistry.Has(g.format)?o.FormatRegistry.Get(g.format)(T):!1:!0}function te(g,O,T){return(0,t.IsSymbol)(T)}function fe(g,O,T){return(0,t.IsString)(T)&&new RegExp(g.pattern).test(T)}function V(g,O,T){return j((0,n.Deref)(g,O),O,T)}function X(g,O,T){if(!(0,t.IsArray)(T)||g.items===void 0&&T.length!==0||T.length!==g.maxItems)return!1;if(!g.items)return!0;for(let c=0;c<g.items.length;c++)if(!j(g.items[c],O,T[c]))return!1;return!0}function ee(g,O,T){return(0,t.IsUndefined)(T)}function be(g,O,T){return g.anyOf.some(c=>j(c,O,T))}function p(g,O,T){return!(!(0,t.IsUint8Array)(T)||u(g.maxByteLength)&&!(T.length<=g.maxByteLength)||u(g.minByteLength)&&!(T.length>=g.minByteLength))}function w(g,O,T){return!0}function A(g,O,T){return r.TypeSystemPolicy.IsVoidLike(T)}function P(g,O,T){return o.TypeRegistry.Has(g[o.Kind])?o.TypeRegistry.Get(g[o.Kind])(g,T):!1}function j(g,O,T){let c=u(g.$id)?[...O,g]:O,x=g;switch(x[o.Kind]){case"Any":return l(x,c,T);case"Array":return f(x,c,T);case"AsyncIterator":return d(x,c,T);case"BigInt":return I(x,c,T);case"Boolean":return E(x,c,T);case"Constructor":return _(x,c,T);case"Date":return L(x,c,T);case"Function":return J(x,c,T);case"Integer":return B(x,c,T);case"Intersect":return k(x,c,T);case"Iterator":return F(x,c,T);case"Literal":return q(x,c,T);case"Never":return R(x,c,T);case"Not":return Q(x,c,T);case"Null":return K(x,c,T);case"Number":return re(x,c,T);case"Object":return $(x,c,T);case"Promise":return D(x,c,T);case"Record":return z(x,c,T);case"Ref":return ne(x,c,T);case"String":return ue(x,c,T);case"Symbol":return te(x,c,T);case"TemplateLiteral":return fe(x,c,T);case"This":return V(x,c,T);case"Tuple":return X(x,c,T);case"Undefined":return ee(x,c,T);case"Union":return be(x,c,T);case"Uint8Array":return p(x,c,T);case"Unknown":return w(x,c,T);case"Void":return A(x,c,T);default:if(!o.TypeRegistry.Has(x[o.Kind]))throw new a(x);return P(x,c,T)}}function N(...g){return g.length===3?j(g[0],g[1],g[2]):j(g[0],[],g[1])}e.Check=N}}),s2=it({"../../../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=Oi(),r=ws(),n=a2(),i=sn(),o=class extends i.TypeBoxError{constructor(I,E,_){super("Unable to decode due to invalid value"),this.schema=I,this.value=E,this.error=_}};e.TransformDecodeCheckError=o;var a=class extends i.TypeBoxError{constructor(I,E,_){super("Unable to encode due to invalid value"),this.schema=I,this.value=E,this.error=_}};e.TransformEncodeCheckError=a;var s=class extends i.TypeBoxError{constructor(I,E,_){super(`${_ instanceof Error?_.message:"Unknown error"}`),this.schema=I,this.value=E}};e.TransformDecodeError=s;var u=class extends i.TypeBoxError{constructor(I,E,_){super(`${_ instanceof Error?_.message:"Unknown error"}`),this.schema=I,this.value=E}};e.TransformEncodeError=u;var l;(function(I){function E(te,fe){return i.TypeGuard.TTransform(te)||z(te.items,fe)}function _(te,fe){return i.TypeGuard.TTransform(te)||z(te.items,fe)}function L(te,fe){return i.TypeGuard.TTransform(te)||z(te.returns,fe)||te.parameters.some(V=>z(V,fe))}function J(te,fe){return i.TypeGuard.TTransform(te)||z(te.returns,fe)||te.parameters.some(V=>z(V,fe))}function B(te,fe){return i.TypeGuard.TTransform(te)||i.TypeGuard.TTransform(te.unevaluatedProperties)||te.allOf.some(V=>z(V,fe))}function k(te,fe){return i.TypeGuard.TTransform(te)||z(te.items,fe)}function F(te,fe){return i.TypeGuard.TTransform(te)||z(te.not,fe)}function q(te,fe){return i.TypeGuard.TTransform(te)||Object.values(te.properties).some(V=>z(V,fe))||i.TypeGuard.TSchema(te.additionalProperties)&&z(te.additionalProperties,fe)}function R(te,fe){return i.TypeGuard.TTransform(te)||z(te.item,fe)}function Q(te,fe){let V=Object.getOwnPropertyNames(te.patternProperties)[0],X=te.patternProperties[V];return i.TypeGuard.TTransform(te)||z(X,fe)||i.TypeGuard.TSchema(te.additionalProperties)&&i.TypeGuard.TTransform(te.additionalProperties)}function K(te,fe){return i.TypeGuard.TTransform(te)?!0:z((0,r.Deref)(te,fe),fe)}function re(te,fe){return i.TypeGuard.TTransform(te)?!0:z((0,r.Deref)(te,fe),fe)}function $(te,fe){return i.TypeGuard.TTransform(te)||!(0,t.IsUndefined)(te.items)&&te.items.some(V=>z(V,fe))}function D(te,fe){return i.TypeGuard.TTransform(te)||te.anyOf.some(V=>z(V,fe))}function z(te,fe){let V=(0,t.IsString)(te.$id)?[...fe,te]:fe,X=te;if(te.$id&&ne.has(te.$id))return!1;switch(te.$id&&ne.add(te.$id),te[i.Kind]){case"Array":return E(X,V);case"AsyncIterator":return _(X,V);case"Constructor":return L(X,V);case"Function":return J(X,V);case"Intersect":return B(X,V);case"Iterator":return k(X,V);case"Not":return F(X,V);case"Object":return q(X,V);case"Promise":return R(X,V);case"Record":return Q(X,V);case"Ref":return K(X,V);case"This":return re(X,V);case"Tuple":return $(X,V);case"Union":return D(X,V);default:return i.TypeGuard.TTransform(te)}}let ne=new Set;function ue(te,fe){return ne.clear(),z(te,fe)}I.Has=ue})(l||(e.HasTransform=l={}));var f;(function(I){function E($,D){try{return i.TypeGuard.TTransform($)?$[i.Transform].Decode(D):D}catch(z){throw new s($,D,z)}}function _($,D,z){return(0,t.IsArray)(z)?E($,z.map(ne=>K($.items,D,ne))):E($,z)}function L($,D,z){if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return E($,z);let ne=i.KeyResolver.ResolveKeys($,{includePatterns:!1}),ue=ne.reduce((X,ee)=>ee in X?{...X,[ee]:K(i.IndexedAccessor.Resolve($,[ee]),D,X[ee])}:X,z);if(!i.TypeGuard.TTransform($.unevaluatedProperties))return E($,ue);let te=Object.getOwnPropertyNames(ue),fe=$.unevaluatedProperties,V=te.reduce((X,ee)=>ne.includes(ee)?X:{...X,[ee]:E(fe,X[ee])},ue);return E($,V)}function J($,D,z){return E($,K($.not,D,z))}function B($,D,z){if(!(0,t.IsPlainObject)(z))return E($,z);let ne=i.KeyResolver.ResolveKeys($,{includePatterns:!1}),ue=ne.reduce((X,ee)=>ee in X?{...X,[ee]:K($.properties[ee],D,X[ee])}:X,z);if(!i.TypeGuard.TSchema($.additionalProperties))return E($,ue);let te=Object.getOwnPropertyNames(ue),fe=$.additionalProperties,V=te.reduce((X,ee)=>ne.includes(ee)?X:{...X,[ee]:E(fe,X[ee])},ue);return E($,V)}function k($,D,z){if(!(0,t.IsPlainObject)(z))return E($,z);let ne=Object.getOwnPropertyNames($.patternProperties)[0],ue=new RegExp(ne),te=Object.getOwnPropertyNames(z).reduce((ee,be)=>ue.test(be)?{...ee,[be]:K($.patternProperties[ne],D,ee[be])}:ee,z);if(!i.TypeGuard.TSchema($.additionalProperties))return E($,te);let fe=Object.getOwnPropertyNames(te),V=$.additionalProperties,X=fe.reduce((ee,be)=>ue.test(be)?ee:{...ee,[be]:E(V,ee[be])},te);return E($,X)}function F($,D,z){let ne=(0,r.Deref)($,D);return E($,K(ne,D,z))}function q($,D,z){let ne=(0,r.Deref)($,D);return E($,K(ne,D,z))}function R($,D,z){return(0,t.IsArray)(z)&&(0,t.IsArray)($.items)?E($,$.items.map((ne,ue)=>K(ne,D,z[ue]))):E($,z)}function Q($,D,z){let ne=E($,z);for(let ue of $.anyOf)if((0,n.Check)(ue,D,ne))return K(ue,D,ne);return ne}function K($,D,z){let ne=typeof $.$id=="string"?[...D,$]:D,ue=$;switch($[i.Kind]){case"Array":return _(ue,ne,z);case"Intersect":return L(ue,ne,z);case"Not":return J(ue,ne,z);case"Object":return B(ue,ne,z);case"Record":return k(ue,ne,z);case"Ref":return F(ue,ne,z);case"Symbol":return E(ue,z);case"This":return q(ue,ne,z);case"Tuple":return R(ue,ne,z);case"Union":return Q(ue,ne,z);default:return E(ue,z)}}function re($,D,z){return K($,D,z)}I.Decode=re})(f||(e.DecodeTransform=f={}));var d;(function(I){function E($,D){try{return i.TypeGuard.TTransform($)?$[i.Transform].Encode(D):D}catch(z){throw new u($,D,z)}}function _($,D,z){let ne=E($,z);return(0,t.IsArray)(ne)?ne.map(ue=>K($.items,D,ue)):ne}function L($,D,z){let ne=E($,z);if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return ne;let ue=i.KeyResolver.ResolveKeys($,{includePatterns:!1}),te=ue.reduce((X,ee)=>ee in ne?{...X,[ee]:K(i.IndexedAccessor.Resolve($,[ee]),D,X[ee])}:X,ne);if(!i.TypeGuard.TTransform($.unevaluatedProperties))return E($,te);let fe=Object.getOwnPropertyNames(te),V=$.unevaluatedProperties;return fe.reduce((X,ee)=>ue.includes(ee)?X:{...X,[ee]:E(V,X[ee])},te)}function J($,D,z){return E($.not,E($,z))}function B($,D,z){let ne=E($,z);if(!(0,t.IsPlainObject)(z))return ne;let ue=i.KeyResolver.ResolveKeys($,{includePatterns:!1}),te=ue.reduce((X,ee)=>ee in X?{...X,[ee]:K($.properties[ee],D,X[ee])}:X,ne);if(!i.TypeGuard.TSchema($.additionalProperties))return te;let fe=Object.getOwnPropertyNames(te),V=$.additionalProperties;return fe.reduce((X,ee)=>ue.includes(ee)?X:{...X,[ee]:E(V,X[ee])},te)}function k($,D,z){let ne=E($,z);if(!(0,t.IsPlainObject)(z))return ne;let ue=Object.getOwnPropertyNames($.patternProperties)[0],te=new RegExp(ue),fe=Object.getOwnPropertyNames(z).reduce((ee,be)=>te.test(be)?{...ee,[be]:K($.patternProperties[ue],D,ee[be])}:ee,ne);if(!i.TypeGuard.TSchema($.additionalProperties))return E($,fe);let V=Object.getOwnPropertyNames(fe),X=$.additionalProperties;return V.reduce((ee,be)=>te.test(be)?ee:{...ee,[be]:E(X,ee[be])},fe)}function F($,D,z){let ne=(0,r.Deref)($,D),ue=K(ne,D,z);return E($,ue)}function q($,D,z){let ne=(0,r.Deref)($,D),ue=K(ne,D,z);return E($,ue)}function R($,D,z){let ne=E($,z);return(0,t.IsArray)($.items)?$.items.map((ue,te)=>K(ue,D,ne[te])):[]}function Q($,D,z){for(let ne of $.anyOf){if(!(0,n.Check)(ne,D,z))continue;let ue=K(ne,D,z);return E($,ue)}for(let ne of $.anyOf){let ue=K(ne,D,z);if((0,n.Check)($,D,ue))return E($,ue)}return E($,z)}function K($,D,z){let ne=typeof $.$id=="string"?[...D,$]:D,ue=$;switch($[i.Kind]){case"Array":return _(ue,ne,z);case"Intersect":return L(ue,ne,z);case"Not":return J(ue,ne,z);case"Object":return B(ue,ne,z);case"Record":return k(ue,ne,z);case"Ref":return F(ue,ne,z);case"This":return q(ue,ne,z);case"Tuple":return R(ue,ne,z);case"Union":return Q(ue,ne,z);default:return E(ue,z)}}function re($,D,z){return K($,D,z)}I.Encode=re})(d||(e.EncodeTransform=d={}))}}),u2=it({"../../../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=s2(),r=Oi(),n=Ts(),i=ah(),o=ws(),a=jl(),s=sn(),u=class{constructor(B,k,F,q){this.schema=B,this.references=k,this.checkFunc=F,this.code=q,this.hasTransform=t.HasTransform.Has(B,k)}Code(){return this.code}Errors(B){return(0,n.Errors)(this.schema,this.references,B)}Check(B){return this.checkFunc(B)}Decode(B){if(!this.checkFunc(B))throw new t.TransformDecodeCheckError(this.schema,B,this.Errors(B).First());return this.hasTransform?t.DecodeTransform.Decode(this.schema,this.references,B):B}Encode(B){let k=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,B):B;if(!this.checkFunc(k))throw new t.TransformEncodeCheckError(this.schema,B,this.Errors(B).First());return k}};e.TypeCheck=u;var l;(function(B){function k(Q){return Q===36}B.DollarSign=k;function F(Q){return Q===95}B.IsUnderscore=F;function q(Q){return Q>=65&&Q<=90||Q>=97&&Q<=122}B.IsAlpha=q;function R(Q){return Q>=48&&Q<=57}B.IsNumeric=R})(l||(l={}));var f;(function(B){function k(Q){return Q.length===0?!1:l.IsNumeric(Q.charCodeAt(0))}function F(Q){if(k(Q))return!1;for(let K=0;K<Q.length;K++){let re=Q.charCodeAt(K);if(!(l.IsAlpha(re)||l.IsNumeric(re)||l.DollarSign(re)||l.IsUnderscore(re)))return!1}return!0}function q(Q){return Q.replace(/'/g,"\\'")}function R(Q,K){return F(K)?`${Q}.${K}`:`${Q}['${q(K)}']`}B.Encode=R})(f||(f={}));var d;(function(B){function k(F){let q=[];for(let R=0;R<F.length;R++){let Q=F.charCodeAt(R);l.IsNumeric(Q)||l.IsAlpha(Q)?q.push(F.charAt(R)):q.push(`_${Q}_`)}return q.join("").replace(/__/g,"_")}B.Encode=k})(d||(d={}));var I;(function(B){function k(F){return F.replace(/'/g,"\\'")}B.Escape=k})(I||(I={}));var E=class extends s.TypeBoxError{constructor(B){super("Unknown type"),this.schema=B}};e.TypeCompilerUnknownTypeError=E;var _=class extends s.TypeBoxError{constructor(B){super("Preflight validation check failed to guard for the given schema"),this.schema=B}};e.TypeCompilerTypeGuardError=_;var L;(function(B){function k(K,re,$){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${re}' in ${K} ? ${$} : true)`:`(${f.Encode(K,re)} !== undefined ? ${$} : true)`}B.IsExactOptionalProperty=k;function F(K){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${K} === 'object' && ${K} !== null)`:`(typeof ${K} === 'object' && ${K} !== null && !Array.isArray(${K}))`}B.IsObjectLike=F;function q(K){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${K} === 'object' && ${K} !== null && !(${K} instanceof Date) && !(${K} instanceof Uint8Array))`:`(typeof ${K} === 'object' && ${K} !== null && !Array.isArray(${K}) && !(${K} instanceof Date) && !(${K} instanceof Uint8Array))`}B.IsRecordLike=q;function R(K){return i.TypeSystemPolicy.AllowNaN?`typeof ${K} === 'number'`:`(typeof ${K} === 'number' && Number.isFinite(${K}))`}B.IsNumberLike=R;function Q(K){return i.TypeSystemPolicy.AllowNullVoid?`(${K} === undefined || ${K} === null)`:`${K} === undefined`}B.IsVoidLike=Q})(L||(e.Policy=L={}));var J;(function(B){function k(S){return S[s.Kind]==="Any"||S[s.Kind]==="Unknown"}function*F(S,ye,C){yield"true"}function*q(S,ye,C){yield`Array.isArray(${C})`;let[xe,se]=[He("value","any"),He("acc","number")];(0,r.IsNumber)(S.maxItems)&&(yield`${C}.length <= ${S.maxItems}`),(0,r.IsNumber)(S.minItems)&&(yield`${C}.length >= ${S.minItems}`);let ge=oe(S.items,ye,"value");if(yield`${C}.every((${xe}) => ${ge})`,s.TypeGuard.TSchema(S.contains)||(0,r.IsNumber)(S.minContains)||(0,r.IsNumber)(S.maxContains)){let Re=s.TypeGuard.TSchema(S.contains)?S.contains:s.Type.Never(),Je=oe(Re,ye,"value"),mt=(0,r.IsNumber)(S.minContains)?[`(count >= ${S.minContains})`]:[],dt=(0,r.IsNumber)(S.maxContains)?[`(count <= ${S.maxContains})`]:[],vt=`const count = value.reduce((${se}, ${xe}) => ${Je} ? acc + 1 : acc, 0)`,Rr=["(count > 0)",...mt,...dt].join(" && ");yield`((${xe}) => { ${vt}; return ${Rr}})(${C})`}S.uniqueItems===!0&&(yield`((${xe}) => { 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 } )(${C})`)}function*R(S,ye,C){yield`(typeof value === 'object' && Symbol.asyncIterator in ${C})`}function*Q(S,ye,C){yield`(typeof ${C} === 'bigint')`,(0,r.IsBigInt)(S.exclusiveMaximum)&&(yield`${C} < BigInt(${S.exclusiveMaximum})`),(0,r.IsBigInt)(S.exclusiveMinimum)&&(yield`${C} > BigInt(${S.exclusiveMinimum})`),(0,r.IsBigInt)(S.maximum)&&(yield`${C} <= BigInt(${S.maximum})`),(0,r.IsBigInt)(S.minimum)&&(yield`${C} >= BigInt(${S.minimum})`),(0,r.IsBigInt)(S.multipleOf)&&(yield`(${C} % BigInt(${S.multipleOf})) === 0`)}function*K(S,ye,C){yield`(typeof ${C} === 'boolean')`}function*re(S,ye,C){yield*H(S.returns,ye,`${C}.prototype`)}function*$(S,ye,C){yield`(${C} instanceof Date) && Number.isFinite(${C}.getTime())`,(0,r.IsNumber)(S.exclusiveMaximumTimestamp)&&(yield`${C}.getTime() < ${S.exclusiveMaximumTimestamp}`),(0,r.IsNumber)(S.exclusiveMinimumTimestamp)&&(yield`${C}.getTime() > ${S.exclusiveMinimumTimestamp}`),(0,r.IsNumber)(S.maximumTimestamp)&&(yield`${C}.getTime() <= ${S.maximumTimestamp}`),(0,r.IsNumber)(S.minimumTimestamp)&&(yield`${C}.getTime() >= ${S.minimumTimestamp}`),(0,r.IsNumber)(S.multipleOfTimestamp)&&(yield`(${C}.getTime() % ${S.multipleOfTimestamp}) === 0`)}function*D(S,ye,C){yield`(typeof ${C} === 'function')`}function*z(S,ye,C){yield`(typeof ${C} === 'number' && Number.isInteger(${C}))`,(0,r.IsNumber)(S.exclusiveMaximum)&&(yield`${C} < ${S.exclusiveMaximum}`),(0,r.IsNumber)(S.exclusiveMinimum)&&(yield`${C} > ${S.exclusiveMinimum}`),(0,r.IsNumber)(S.maximum)&&(yield`${C} <= ${S.maximum}`),(0,r.IsNumber)(S.minimum)&&(yield`${C} >= ${S.minimum}`),(0,r.IsNumber)(S.multipleOf)&&(yield`(${C} % ${S.multipleOf}) === 0`)}function*ne(S,ye,C){let xe=S.allOf.map(se=>oe(se,ye,C)).join(" && ");if(S.unevaluatedProperties===!1){let se=Se(`${new RegExp(s.KeyResolver.ResolvePattern(S))};`),ge=`Object.getOwnPropertyNames(${C}).every(key => ${se}.test(key))`;yield`(${xe} && ${ge})`}else if(s.TypeGuard.TSchema(S.unevaluatedProperties)){let se=Se(`${new RegExp(s.KeyResolver.ResolvePattern(S))};`),ge=`Object.getOwnPropertyNames(${C}).every(key => ${se}.test(key) || ${oe(S.unevaluatedProperties,ye,`${C}[key]`)})`;yield`(${xe} && ${ge})`}else yield`(${xe})`}function*ue(S,ye,C){yield`(typeof value === 'object' && Symbol.iterator in ${C})`}function*te(S,ye,C){typeof S.const=="number"||typeof S.const=="boolean"?yield`(${C} === ${S.const})`:yield`(${C} === '${I.Escape(S.const)}')`}function*fe(S,ye,C){yield"false"}function*V(S,ye,C){yield`(!${oe(S.not,ye,C)})`}function*X(S,ye,C){yield`(${C} === null)`}function*ee(S,ye,C){yield L.IsNumberLike(C),(0,r.IsNumber)(S.exclusiveMaximum)&&(yield`${C} < ${S.exclusiveMaximum}`),(0,r.IsNumber)(S.exclusiveMinimum)&&(yield`${C} > ${S.exclusiveMinimum}`),(0,r.IsNumber)(S.maximum)&&(yield`${C} <= ${S.maximum}`),(0,r.IsNumber)(S.minimum)&&(yield`${C} >= ${S.minimum}`),(0,r.IsNumber)(S.multipleOf)&&(yield`(${C} % ${S.multipleOf}) === 0`)}function*be(S,ye,C){yield L.IsObjectLike(C),(0,r.IsNumber)(S.minProperties)&&(yield`Object.getOwnPropertyNames(${C}).length >= ${S.minProperties}`),(0,r.IsNumber)(S.maxProperties)&&(yield`Object.getOwnPropertyNames(${C}).length <= ${S.maxProperties}`);let xe=Object.getOwnPropertyNames(S.properties);for(let se of xe){let ge=f.Encode(C,se),Re=S.properties[se];if(S.required&&S.required.includes(se))yield*H(Re,ye,ge),(s.ExtendsUndefined.Check(Re)||k(Re))&&(yield`('${se}' in ${C})`);else{let Je=oe(Re,ye,ge);yield L.IsExactOptionalProperty(C,se,Je)}}if(S.additionalProperties===!1)if(S.required&&S.required.length===xe.length)yield`Object.getOwnPropertyNames(${C}).length === ${xe.length}`;else{let se=`[${xe.map(ge=>`'${ge}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${C}).every(key => ${se}.includes(key))`}if(typeof S.additionalProperties=="object"){let se=oe(S.additionalProperties,ye,`${C}[key]`),ge=`[${xe.map(Re=>`'${Re}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${C}).every(key => ${ge}.includes(key) || ${se}))`}}function*p(S,ye,C){yield`(typeof value === 'object' && typeof ${C}.then === 'function')`}function*w(S,ye,C){yield L.IsRecordLike(C),(0,r.IsNumber)(S.minProperties)&&(yield`Object.getOwnPropertyNames(${C}).length >= ${S.minProperties}`),(0,r.IsNumber)(S.maxProperties)&&(yield`Object.getOwnPropertyNames(${C}).length <= ${S.maxProperties}`);let[xe,se]=Object.entries(S.patternProperties)[0],ge=Se(`${new RegExp(xe)}`),Re=oe(se,ye,"value"),Je=s.TypeGuard.TSchema(S.additionalProperties)?oe(S.additionalProperties,ye,C):S.additionalProperties===!1?"false":"true",mt=`(${ge}.test(key) ? ${Re} : ${Je})`;yield`(Object.entries(${C}).every(([key, value]) => ${mt}))`}function*A(S,ye,C){let xe=(0,o.Deref)(S,ye);if(ie.functions.has(S.$ref))return yield`${_e(S.$ref)}(${C})`;yield*H(xe,ye,C)}function*P(S,ye,C){yield`(typeof ${C} === 'string')`,(0,r.IsNumber)(S.maxLength)&&(yield`${C}.length <= ${S.maxLength}`),(0,r.IsNumber)(S.minLength)&&(yield`${C}.length >= ${S.minLength}`),S.pattern!==void 0&&(yield`${Se(`${new RegExp(S.pattern)};`)}.test(${C})`),S.format!==void 0&&(yield`format('${S.format}', ${C})`)}function*j(S,ye,C){yield`(typeof ${C} === 'symbol')`}function*N(S,ye,C){yield`(typeof ${C} === 'string')`,yield`${Se(`${new RegExp(S.pattern)};`)}.test(${C})`}function*g(S,ye,C){yield`${_e(S.$ref)}(${C})`}function*O(S,ye,C){if(yield`Array.isArray(${C})`,S.items===void 0)return yield`${C}.length === 0`;yield`(${C}.length === ${S.maxItems})`;for(let xe=0;xe<S.items.length;xe++)yield`${oe(S.items[xe],ye,`${C}[${xe}]`)}`}function*T(S,ye,C){yield`${C} === undefined`}function*c(S,ye,C){yield`(${S.anyOf.map(xe=>oe(xe,ye,C)).join(" || ")})`}function*x(S,ye,C){yield`${C} instanceof Uint8Array`,(0,r.IsNumber)(S.maxByteLength)&&(yield`(${C}.length <= ${S.maxByteLength})`),(0,r.IsNumber)(S.minByteLength)&&(yield`(${C}.length >= ${S.minByteLength})`)}function*v(S,ye,C){yield"true"}function*b(S,ye,C){yield L.IsVoidLike(C)}function*U(S,ye,C){let xe=ie.instances.size;ie.instances.set(xe,S),yield`kind('${S[s.Kind]}', ${xe}, ${C})`}function*H(S,ye,C,xe=!0){let se=(0,r.IsString)(S.$id)?[...ye,S]:ye,ge=S;if(xe&&(0,r.IsString)(S.$id)){let Re=_e(S.$id);if(ie.functions.has(Re))return yield`${Re}(${C})`;{let Je=Ve(Re,S,ye,"value",!1);return ie.functions.set(Re,Je),yield`${Re}(${C})`}}switch(ge[s.Kind]){case"Any":return yield*F(ge,se,C);case"Array":return yield*q(ge,se,C);case"AsyncIterator":return yield*R(ge,se,C);case"BigInt":return yield*Q(ge,se,C);case"Boolean":return yield*K(ge,se,C);case"Constructor":return yield*re(ge,se,C);case"Date":return yield*$(ge,se,C);case"Function":return yield*D(ge,se,C);case"Integer":return yield*z(ge,se,C);case"Intersect":return yield*ne(ge,se,C);case"Iterator":return yield*ue(ge,se,C);case"Literal":return yield*te(ge,se,C);case"Never":return yield*fe(ge,se,C);case"Not":return yield*V(ge,se,C);case"Null":return yield*X(ge,se,C);case"Number":return yield*ee(ge,se,C);case"Object":return yield*be(ge,se,C);case"Promise":return yield*p(ge,se,C);case"Record":return yield*w(ge,se,C);case"Ref":return yield*A(ge,se,C);case"String":return yield*P(ge,se,C);case"Symbol":return yield*j(ge,se,C);case"TemplateLiteral":return yield*N(ge,se,C);case"This":return yield*g(ge,se,C);case"Tuple":return yield*O(ge,se,C);case"Undefined":return yield*T(ge,se,C);case"Union":return yield*c(ge,se,C);case"Uint8Array":return yield*x(ge,se,C);case"Unknown":return yield*v(ge,se,C);case"Void":return yield*b(ge,se,C);default:if(!s.TypeRegistry.Has(ge[s.Kind]))throw new E(S);return yield*U(ge,se,C)}}let ie={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function oe(S,ye,C,xe=!0){return`(${[...H(S,ye,C,xe)].join(" && ")})`}function _e(S){return`check_${d.Encode(S)}`}function Se(S){let ye=`local_${ie.variables.size}`;return ie.variables.set(ye,`const ${ye} = ${S}`),ye}function Ve(S,ye,C,xe,se=!0){let[ge,Re]=[`
48
+ ${p}`),X.pop(),`{${j}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(R)return String(V);default:return F?F(V):void 0}}function ue(fe,V,X){switch(typeof V){case"string":return o(V);case"object":{if(V===null)return"null";if(typeof V.toJSON=="function"){if(V=V.toJSON(fe),typeof V!="object")return ue(fe,V,X);if(V===null)return"null"}if(X.indexOf(V)!==-1)return G;let ee="",be=V.length!==void 0;if(be&&Array.isArray(V)){if(V.length===0)return"[]";if(re<X.length+1)return'"[Array]"';X.push(V);let j=Math.min(V.length,$),N=0;for(;N<j-1;N++){let O=ue(String(N),V[N],X);ee+=O!==void 0?O:"null",ee+=","}let g=ue(String(N),V[N],X);if(ee+=g!==void 0?g:"null",V.length-1>$){let O=V.length-$-1;ee+=`,"... ${_(O)} not stringified"`}return X.pop(),`[${ee}]`}let p=Object.keys(V),w=p.length;if(w===0)return"{}";if(re<X.length+1)return'"[Object]"';let A="",P=Math.min(w,$);be&&u(V)&&(ee+=l(V,",",$),p=p.slice(V.length),P-=V.length,A=","),Q&&(p=a(p,K)),X.push(V);for(let j=0;j<P;j++){let N=p[j],g=ue(N,V[N],X);g!==void 0&&(ee+=`${A}${o(N)}:${g}`,A=",")}if(w>$){let j=w-$;ee+=`${A}"...":"${_(j)} not stringified"`}return X.pop(),`{${ee}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(R)return String(V);default:return F?F(V):void 0}}function te(fe,V,X){if(arguments.length>1){let ee="";if(typeof X=="number"?ee=" ".repeat(Math.min(X,10)):typeof X=="string"&&(ee=X.slice(0,10)),V!=null){if(typeof V=="function")return D("",{"":fe},[],V,ee,"");if(Array.isArray(V))return z("",fe,[],L(V),ee,"")}if(ee.length!==0)return ne("",fe,[],ee,"")}return ue("",fe,[])}return te}}}),Oi=it({"../../../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(R){return l(R)&&Symbol.asyncIterator in R}e.IsAsyncIterator=t;function r(R){return l(R)&&Symbol.iterator in R}e.IsIterator=r;function n(R){return ArrayBuffer.isView(R)}e.IsTypedArray=n;function i(R){return R instanceof Promise}e.IsPromise=i;function o(R){return R instanceof Uint8Array}e.IsUint8Array=o;function a(R){return R instanceof Date&&Number.isFinite(R.getTime())}e.IsDate=a;function s(R,Q){return Q in R}e.HasPropertyKey=s;function u(R){return l(R)&&k(R.constructor)&&R.constructor.name==="Object"}e.IsPlainObject=u;function l(R){return R!==null&&typeof R=="object"}e.IsObject=l;function f(R){return Array.isArray(R)&&!ArrayBuffer.isView(R)}e.IsArray=f;function d(R){return R===void 0}e.IsUndefined=d;function I(R){return R===null}e.IsNull=I;function E(R){return typeof R=="boolean"}e.IsBoolean=E;function _(R){return typeof R=="number"}e.IsNumber=_;function L(R){return _(R)&&Number.isInteger(R)}e.IsInteger=L;function J(R){return typeof R=="bigint"}e.IsBigInt=J;function B(R){return typeof R=="string"}e.IsString=B;function k(R){return typeof R=="function"}e.IsFunction=k;function F(R){return typeof R=="symbol"}e.IsSymbol=F;function G(R){return J(R)||E(R)||I(R)||_(R)||B(R)||F(R)||d(R)}e.IsValueType=G}}),oh=it({"../../../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=Oi(),r=Ts(),n=on(),i=class extends n.TypeBoxError{constructor(f){super(`Duplicate type kind '${f}' detected`)}};e.TypeSystemDuplicateTypeKind=i;var o=class extends n.TypeBoxError{constructor(f){super(`Duplicate string format '${f}' detected`)}};e.TypeSystemDuplicateFormat=o;var a;(function(f){function d(E,_){if(n.TypeRegistry.Has(E))throw new i(E);return n.TypeRegistry.Set(E,_),(L={})=>n.Type.Unsafe({...L,[n.Kind]:E})}f.Type=d;function I(E,_){if(n.FormatRegistry.Has(E))throw new o(E);return n.FormatRegistry.Set(E,_),E}f.Format=I})(a||(e.TypeSystem=a={}));var s;(function(f){let d=l;function I(){d=l}f.Reset=I;function E(L){d=L}f.Set=E;function _(){return d}f.Get=_})(s||(e.TypeSystemErrorFunction=s={}));var u;(function(f){f.ExactOptionalPropertyTypes=!1,f.AllowArrayObject=!1,f.AllowNaN=!1,f.AllowNullVoid=!1;function d(J,B){return f.ExactOptionalPropertyTypes?B in J:J[B]!==void 0}f.IsExactOptionalProperty=d;function I(J){let B=(0,t.IsObject)(J);return f.AllowArrayObject?B:B&&!(0,t.IsArray)(J)}f.IsObjectLike=I;function E(J){return I(J)&&!(J instanceof Date)&&!(J instanceof Uint8Array)}f.IsRecordLike=E;function _(J){let B=(0,t.IsNumber)(J);return f.AllowNaN?B:B&&Number.isFinite(J)}f.IsNumberLike=_;function L(J){let B=(0,t.IsUndefined)(J);return f.AllowNullVoid?B||J===null:B}f.IsVoidLike=L})(u||(e.TypeSystemPolicy=u={}));function l(f,d){switch(d){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 ${f.maxContains} matching values`;case r.ValueErrorType.ArrayMinContains:return`Expected array to contain at least ${f.minContains} matching values`;case r.ValueErrorType.ArrayMaxItems:return`Expected array length to be less or equal to ${f.maxItems}`;case r.ValueErrorType.ArrayMinItems:return`Expected array length to be greater or equal to ${f.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 ${f.exclusiveMaximum}`;case r.ValueErrorType.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.BigIntMaximum:return`Expected bigint to be less or equal to ${f.maximum}`;case r.ValueErrorType.BigIntMinimum:return`Expected bigint to be greater or equal to ${f.minimum}`;case r.ValueErrorType.BigIntMultipleOf:return`Expected bigint to be a multiple of ${f.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 ${f.exclusiveMinimumTimestamp}`;case r.ValueErrorType.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${f.exclusiveMaximumTimestamp}`;case r.ValueErrorType.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${f.minimumTimestamp}`;case r.ValueErrorType.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${f.maximumTimestamp}`;case r.ValueErrorType.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${f.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 ${f.exclusiveMaximum}`;case r.ValueErrorType.IntegerExclusiveMinimum:return`Expected integer to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.IntegerMaximum:return`Expected integer to be less or equal to ${f.maximum}`;case r.ValueErrorType.IntegerMinimum:return`Expected integer to be greater or equal to ${f.minimum}`;case r.ValueErrorType.IntegerMultipleOf:return`Expected integer to be a multiple of ${f.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 f.const=="string"?`'${f.const}'`:f.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 ${f.exclusiveMaximum}`;case r.ValueErrorType.NumberExclusiveMinimum:return`Expected number to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.NumberMaximum:return`Expected number to be less or equal to ${f.maximum}`;case r.ValueErrorType.NumberMinimum:return`Expected number to be greater or equal to ${f.minimum}`;case r.ValueErrorType.NumberMultipleOf:return`Expected number to be a multiple of ${f.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 ${f.maxProperties} properties`;case r.ValueErrorType.ObjectMinProperties:return`Expected object to have at least ${f.minProperties} properties`;case r.ValueErrorType.ObjectRequiredProperty:return"Required property";case r.ValueErrorType.Promise:return"Expected Promise";case r.ValueErrorType.StringFormatUnknown:return`Unknown format '${f.format}'`;case r.ValueErrorType.StringFormat:return`Expected string to match '${f.format}' format`;case r.ValueErrorType.StringMaxLength:return`Expected string length less or equal to ${f.maxLength}`;case r.ValueErrorType.StringMinLength:return`Expected string length greater or equal to ${f.minLength}`;case r.ValueErrorType.StringPattern:return`Expected string to match '${f.pattern}'`;case r.ValueErrorType.String:return"Expected string";case r.ValueErrorType.Symbol:return"Expected symbol";case r.ValueErrorType.TupleLength:return`Expected tuple to have ${f.maxItems||0} elements`;case r.ValueErrorType.Tuple:return"Expected tuple";case r.ValueErrorType.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${f.maxByteLength}`;case r.ValueErrorType.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${f.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 '${f[n.Kind]}'`;default:return"Unknown error type"}}e.DefaultErrorFunction=l}}),ws=it({"../../../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=on(),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 a=o.findIndex(s=>s.$id===i.$ref);if(a===-1)throw new r(i);return o[a]}e.Deref=n}}),jl=it({"../../../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=Oi(),r=class extends Error{constructor(D){super("Unable to hash value"),this.value=D}};e.ValueHashError=r;var n;(function(D){D[D.Undefined=0]="Undefined",D[D.Null=1]="Null",D[D.Boolean=2]="Boolean",D[D.Number=3]="Number",D[D.String=4]="String",D[D.Object=5]="Object",D[D.Array=6]="Array",D[D.Date=7]="Date",D[D.Uint8Array=8]="Uint8Array",D[D.Symbol=9]="Symbol",D[D.BigInt=10]="BigInt"})(n||(e.ByteMarker=n={}));var i=BigInt("14695981039346656037"),[o,a]=[BigInt("1099511628211"),BigInt("2")**BigInt("64")],s=Array.from({length:256}).map((D,z)=>BigInt(z)),u=new Float64Array(1),l=new DataView(u.buffer),f=new Uint8Array(u.buffer);function*d(D){let z=D===0?1:Math.ceil(Math.floor(Math.log2(D)+1)/8);for(let ne=0;ne<z;ne++)yield D>>8*(z-1-ne)&255}function I(D){re(n.Array);for(let z of D)K(z)}function E(D){re(n.Boolean),re(D?1:0)}function _(D){re(n.BigInt),l.setBigInt64(0,D);for(let z of f)re(z)}function L(D){re(n.Date),K(D.getTime())}function J(D){re(n.Null)}function B(D){re(n.Number),l.setFloat64(0,D);for(let z of f)re(z)}function k(D){re(n.Object);for(let z of globalThis.Object.keys(D).sort())K(z),K(D[z])}function F(D){re(n.String);for(let z=0;z<D.length;z++)for(let ne of d(D.charCodeAt(z)))re(ne)}function G(D){re(n.Symbol),K(D.description)}function R(D){re(n.Uint8Array);for(let z=0;z<D.length;z++)re(D[z])}function Q(D){return re(n.Undefined)}function K(D){if((0,t.IsArray)(D))return I(D);if((0,t.IsBoolean)(D))return E(D);if((0,t.IsBigInt)(D))return _(D);if((0,t.IsDate)(D))return L(D);if((0,t.IsNull)(D))return J(D);if((0,t.IsNumber)(D))return B(D);if((0,t.IsPlainObject)(D))return k(D);if((0,t.IsString)(D))return F(D);if((0,t.IsSymbol)(D))return G(D);if((0,t.IsUint8Array)(D))return R(D);if((0,t.IsUndefined)(D))return Q(D);throw new r(D)}function re(D){i=i^s[D],i=i*o%a}function $(D){return i=BigInt("14695981039346656037"),K(D),i}e.Hash=$}}),Ts=it({"../../../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=Oi(),r=oh(),n=ws(),i=jl(),o=on(),a;(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"})(a||(e.ValueErrorType=a={}));var s=class extends o.TypeBoxError{constructor(c){super("Unknown type"),this.schema=c}};e.ValueErrorsUnknownTypeError=s;function u(c){return c.replace(/~/g,"~0").replace(/\//g,"~1")}e.EscapeKey=u;function l(c){return c!==void 0}var f=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=f;function d(c,x,v,b){return{type:c,schema:x,path:v,value:b,message:r.TypeSystemErrorFunction.Get()(x,c)}}function*I(c,x,v,b){}function*E(c,x,v,b){if(!(0,t.IsArray)(b))return yield d(a.Array,c,v,b);l(c.minItems)&&!(b.length>=c.minItems)&&(yield d(a.ArrayMinItems,c,v,b)),l(c.maxItems)&&!(b.length<=c.maxItems)&&(yield d(a.ArrayMaxItems,c,v,b));for(let ie=0;ie<b.length;ie++)yield*O(c.items,x,`${v}/${ie}`,b[ie]);if(c.uniqueItems===!0&&!function(){let ie=new Set;for(let oe of b){let _e=(0,i.Hash)(oe);if(ie.has(_e))return!1;ie.add(_e)}return!0}()&&(yield d(a.ArrayUniqueItems,c,v,b)),!(l(c.contains)||l(c.minContains)||l(c.maxContains)))return;let U=l(c.contains)?c.contains:o.Type.Never(),H=b.reduce((ie,oe,_e)=>O(U,x,`${v}${_e}`,oe).next().done===!0?ie+1:ie,0);H===0&&(yield d(a.ArrayContains,c,v,b)),(0,t.IsNumber)(c.minContains)&&H<c.minContains&&(yield d(a.ArrayMinContains,c,v,b)),(0,t.IsNumber)(c.maxContains)&&H>c.maxContains&&(yield d(a.ArrayMaxContains,c,v,b))}function*_(c,x,v,b){(0,t.IsAsyncIterator)(b)||(yield d(a.AsyncIterator,c,v,b))}function*L(c,x,v,b){if(!(0,t.IsBigInt)(b))return yield d(a.BigInt,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.BigIntExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.BigIntExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.BigIntMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.BigIntMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==BigInt(0)&&(yield d(a.BigIntMultipleOf,c,v,b))}function*J(c,x,v,b){(0,t.IsBoolean)(b)||(yield d(a.Boolean,c,v,b))}function*B(c,x,v,b){yield*O(c.returns,x,v,b.prototype)}function*k(c,x,v,b){if(!(0,t.IsDate)(b))return yield d(a.Date,c,v,b);l(c.exclusiveMaximumTimestamp)&&!(b.getTime()<c.exclusiveMaximumTimestamp)&&(yield d(a.DateExclusiveMaximumTimestamp,c,v,b)),l(c.exclusiveMinimumTimestamp)&&!(b.getTime()>c.exclusiveMinimumTimestamp)&&(yield d(a.DateExclusiveMinimumTimestamp,c,v,b)),l(c.maximumTimestamp)&&!(b.getTime()<=c.maximumTimestamp)&&(yield d(a.DateMaximumTimestamp,c,v,b)),l(c.minimumTimestamp)&&!(b.getTime()>=c.minimumTimestamp)&&(yield d(a.DateMinimumTimestamp,c,v,b)),l(c.multipleOfTimestamp)&&b.getTime()%c.multipleOfTimestamp!==0&&(yield d(a.DateMultipleOfTimestamp,c,v,b))}function*F(c,x,v,b){(0,t.IsFunction)(b)||(yield d(a.Function,c,v,b))}function*G(c,x,v,b){if(!(0,t.IsInteger)(b))return yield d(a.Integer,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.IntegerExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.IntegerExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.IntegerMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.IntegerMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==0&&(yield d(a.IntegerMultipleOf,c,v,b))}function*R(c,x,v,b){for(let U of c.allOf){let H=O(U,x,v,b).next();H.done||(yield d(a.Intersect,c,v,b),yield H.value)}if(c.unevaluatedProperties===!1){let U=new RegExp(o.KeyResolver.ResolvePattern(c));for(let H of Object.getOwnPropertyNames(b))U.test(H)||(yield d(a.IntersectUnevaluatedProperties,c,`${v}/${H}`,b))}if(typeof c.unevaluatedProperties=="object"){let U=new RegExp(o.KeyResolver.ResolvePattern(c));for(let H of Object.getOwnPropertyNames(b))if(!U.test(H)){let ie=O(c.unevaluatedProperties,x,`${v}/${H}`,b[H]).next();ie.done||(yield ie.value)}}}function*Q(c,x,v,b){(0,t.IsIterator)(b)||(yield d(a.Iterator,c,v,b))}function*K(c,x,v,b){b!==c.const&&(yield d(a.Literal,c,v,b))}function*re(c,x,v,b){yield d(a.Never,c,v,b)}function*$(c,x,v,b){O(c.not,x,v,b).next().done===!0&&(yield d(a.Not,c,v,b))}function*D(c,x,v,b){(0,t.IsNull)(b)||(yield d(a.Null,c,v,b))}function*z(c,x,v,b){if(!r.TypeSystemPolicy.IsNumberLike(b))return yield d(a.Number,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.NumberExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.NumberExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.NumberMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.NumberMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==0&&(yield d(a.NumberMultipleOf,c,v,b))}function*ne(c,x,v,b){if(!r.TypeSystemPolicy.IsObjectLike(b))return yield d(a.Object,c,v,b);l(c.minProperties)&&!(Object.getOwnPropertyNames(b).length>=c.minProperties)&&(yield d(a.ObjectMinProperties,c,v,b)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=c.maxProperties)&&(yield d(a.ObjectMaxProperties,c,v,b));let U=Array.isArray(c.required)?c.required:[],H=Object.getOwnPropertyNames(c.properties),ie=Object.getOwnPropertyNames(b);for(let oe of U)ie.includes(oe)||(yield d(a.ObjectRequiredProperty,c.properties[oe],`${v}/${u(oe)}`,void 0));if(c.additionalProperties===!1)for(let oe of ie)H.includes(oe)||(yield d(a.ObjectAdditionalProperties,c,`${v}/${u(oe)}`,b[oe]));if(typeof c.additionalProperties=="object")for(let oe of ie)H.includes(oe)||(yield*O(c.additionalProperties,x,`${v}/${u(oe)}`,b[oe]));for(let oe of H){let _e=c.properties[oe];c.required&&c.required.includes(oe)?(yield*O(_e,x,`${v}/${u(oe)}`,b[oe]),o.ExtendsUndefined.Check(c)&&!(oe in b)&&(yield d(a.ObjectRequiredProperty,_e,`${v}/${u(oe)}`,void 0))):r.TypeSystemPolicy.IsExactOptionalProperty(b,oe)&&(yield*O(_e,x,`${v}/${u(oe)}`,b[oe]))}}function*ue(c,x,v,b){(0,t.IsPromise)(b)||(yield d(a.Promise,c,v,b))}function*te(c,x,v,b){if(!r.TypeSystemPolicy.IsRecordLike(b))return yield d(a.Object,c,v,b);l(c.minProperties)&&!(Object.getOwnPropertyNames(b).length>=c.minProperties)&&(yield d(a.ObjectMinProperties,c,v,b)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=c.maxProperties)&&(yield d(a.ObjectMaxProperties,c,v,b));let[U,H]=Object.entries(c.patternProperties)[0],ie=new RegExp(U);for(let[oe,_e]of Object.entries(b))ie.test(oe)&&(yield*O(H,x,`${v}/${u(oe)}`,_e));if(typeof c.additionalProperties=="object")for(let[oe,_e]of Object.entries(b))ie.test(oe)||(yield*O(c.additionalProperties,x,`${v}/${u(oe)}`,_e));if(c.additionalProperties===!1){for(let[oe,_e]of Object.entries(b))if(!ie.test(oe))return yield d(a.ObjectAdditionalProperties,c,`${v}/${u(oe)}`,_e)}}function*fe(c,x,v,b){yield*O((0,n.Deref)(c,x),x,v,b)}function*V(c,x,v,b){if(!(0,t.IsString)(b))return yield d(a.String,c,v,b);l(c.minLength)&&!(b.length>=c.minLength)&&(yield d(a.StringMinLength,c,v,b)),l(c.maxLength)&&!(b.length<=c.maxLength)&&(yield d(a.StringMaxLength,c,v,b)),(0,t.IsString)(c.pattern)&&(new RegExp(c.pattern).test(b)||(yield d(a.StringPattern,c,v,b))),(0,t.IsString)(c.format)&&(o.FormatRegistry.Has(c.format)?o.FormatRegistry.Get(c.format)(b)||(yield d(a.StringFormat,c,v,b)):yield d(a.StringFormatUnknown,c,v,b))}function*X(c,x,v,b){(0,t.IsSymbol)(b)||(yield d(a.Symbol,c,v,b))}function*ee(c,x,v,b){if(!(0,t.IsString)(b))return yield d(a.String,c,v,b);new RegExp(c.pattern).test(b)||(yield d(a.StringPattern,c,v,b))}function*be(c,x,v,b){yield*O((0,n.Deref)(c,x),x,v,b)}function*p(c,x,v,b){if(!(0,t.IsArray)(b))return yield d(a.Tuple,c,v,b);if(c.items===void 0&&b.length!==0)return yield d(a.TupleLength,c,v,b);if(b.length!==c.maxItems)return yield d(a.TupleLength,c,v,b);if(c.items)for(let U=0;U<c.items.length;U++)yield*O(c.items[U],x,`${v}/${U}`,b[U])}function*w(c,x,v,b){(0,t.IsUndefined)(b)||(yield d(a.Undefined,c,v,b))}function*A(c,x,v,b){let U=0;for(let H of c.anyOf){let ie=[...O(H,x,v,b)];if(ie.length===0)return;U+=ie.length}U>0&&(yield d(a.Union,c,v,b))}function*P(c,x,v,b){if(!(0,t.IsUint8Array)(b))return yield d(a.Uint8Array,c,v,b);l(c.maxByteLength)&&!(b.length<=c.maxByteLength)&&(yield d(a.Uint8ArrayMaxByteLength,c,v,b)),l(c.minByteLength)&&!(b.length>=c.minByteLength)&&(yield d(a.Uint8ArrayMinByteLength,c,v,b))}function*j(c,x,v,b){}function*N(c,x,v,b){r.TypeSystemPolicy.IsVoidLike(b)||(yield d(a.Void,c,v,b))}function*g(c,x,v,b){o.TypeRegistry.Get(c[o.Kind])(c,b)||(yield d(a.Kind,c,v,b))}function*O(c,x,v,b){let U=l(c.$id)?[...x,c]:x,H=c;switch(H[o.Kind]){case"Any":return yield*I(H,U,v,b);case"Array":return yield*E(H,U,v,b);case"AsyncIterator":return yield*_(H,U,v,b);case"BigInt":return yield*L(H,U,v,b);case"Boolean":return yield*J(H,U,v,b);case"Constructor":return yield*B(H,U,v,b);case"Date":return yield*k(H,U,v,b);case"Function":return yield*F(H,U,v,b);case"Integer":return yield*G(H,U,v,b);case"Intersect":return yield*R(H,U,v,b);case"Iterator":return yield*Q(H,U,v,b);case"Literal":return yield*K(H,U,v,b);case"Never":return yield*re(H,U,v,b);case"Not":return yield*$(H,U,v,b);case"Null":return yield*D(H,U,v,b);case"Number":return yield*z(H,U,v,b);case"Object":return yield*ne(H,U,v,b);case"Promise":return yield*ue(H,U,v,b);case"Record":return yield*te(H,U,v,b);case"Ref":return yield*fe(H,U,v,b);case"String":return yield*V(H,U,v,b);case"Symbol":return yield*X(H,U,v,b);case"TemplateLiteral":return yield*ee(H,U,v,b);case"This":return yield*be(H,U,v,b);case"Tuple":return yield*p(H,U,v,b);case"Undefined":return yield*w(H,U,v,b);case"Union":return yield*A(H,U,v,b);case"Uint8Array":return yield*P(H,U,v,b);case"Unknown":return yield*j(H,U,v,b);case"Void":return yield*N(H,U,v,b);default:if(!o.TypeRegistry.Has(H[o.Kind]))throw new s(c);return yield*g(H,U,v,b)}}function T(...c){let x=c.length===3?O(c[0],c[1],"",c[2]):O(c[0],[],"",c[1]);return new f(x)}e.Errors=T}}),o2=it({"../../../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,a){a===void 0&&(a=o);var s=Object.getOwnPropertyDescriptor(i,o);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(n,a,s)}:function(n,i,o,a){a===void 0&&(a=o),n[a]=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(Ts(),e)}}),ah=it({"../../../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,a,s){s===void 0&&(s=a);var u=Object.getOwnPropertyDescriptor(o,a);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(i,s,u)}:function(i,o,a,s){s===void 0&&(s=a),i[s]=o[a]}),r=e&&e.__exportStar||function(i,o){for(var a in i)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorType=void 0;var n=Ts();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(oh(),e)}}),a2=it({"../../../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=Oi(),r=ah(),n=ws(),i=jl(),o=on(),a=class extends o.TypeBoxError{constructor(g){super("Unknown type"),this.schema=g}};e.ValueCheckUnknownTypeError=a;function s(g){return g[o.Kind]==="Any"||g[o.Kind]==="Unknown"}function u(g){return g!==void 0}function l(g,O,T){return!0}function f(g,O,T){if(!(0,t.IsArray)(T)||u(g.minItems)&&!(T.length>=g.minItems)||u(g.maxItems)&&!(T.length<=g.maxItems)||!T.every(v=>j(g.items,O,v))||g.uniqueItems===!0&&!function(){let v=new Set;for(let b of T){let U=(0,i.Hash)(b);if(v.has(U))return!1;v.add(U)}return!0}())return!1;if(!(u(g.contains)||(0,t.IsNumber)(g.minContains)||(0,t.IsNumber)(g.maxContains)))return!0;let c=u(g.contains)?g.contains:o.Type.Never(),x=T.reduce((v,b)=>j(c,O,b)?v+1:v,0);return!(x===0||(0,t.IsNumber)(g.minContains)&&x<g.minContains||(0,t.IsNumber)(g.maxContains)&&x>g.maxContains)}function d(g,O,T){return(0,t.IsAsyncIterator)(T)}function I(g,O,T){return!(!(0,t.IsBigInt)(T)||u(g.exclusiveMaximum)&&!(T<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(T>g.exclusiveMinimum)||u(g.maximum)&&!(T<=g.maximum)||u(g.minimum)&&!(T>=g.minimum)||u(g.multipleOf)&&T%g.multipleOf!==BigInt(0))}function E(g,O,T){return(0,t.IsBoolean)(T)}function _(g,O,T){return j(g.returns,O,T.prototype)}function L(g,O,T){return!(!(0,t.IsDate)(T)||u(g.exclusiveMaximumTimestamp)&&!(T.getTime()<g.exclusiveMaximumTimestamp)||u(g.exclusiveMinimumTimestamp)&&!(T.getTime()>g.exclusiveMinimumTimestamp)||u(g.maximumTimestamp)&&!(T.getTime()<=g.maximumTimestamp)||u(g.minimumTimestamp)&&!(T.getTime()>=g.minimumTimestamp)||u(g.multipleOfTimestamp)&&T.getTime()%g.multipleOfTimestamp!==0)}function J(g,O,T){return(0,t.IsFunction)(T)}function B(g,O,T){return!(!(0,t.IsInteger)(T)||u(g.exclusiveMaximum)&&!(T<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(T>g.exclusiveMinimum)||u(g.maximum)&&!(T<=g.maximum)||u(g.minimum)&&!(T>=g.minimum)||u(g.multipleOf)&&T%g.multipleOf!==0)}function k(g,O,T){let c=g.allOf.every(x=>j(x,O,T));if(g.unevaluatedProperties===!1){let x=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(T).every(b=>x.test(b));return c&&v}else if(o.TypeGuard.TSchema(g.unevaluatedProperties)){let x=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(T).every(b=>x.test(b)||j(g.unevaluatedProperties,O,T[b]));return c&&v}else return c}function F(g,O,T){return(0,t.IsIterator)(T)}function G(g,O,T){return T===g.const}function R(g,O,T){return!1}function Q(g,O,T){return!j(g.not,O,T)}function K(g,O,T){return(0,t.IsNull)(T)}function re(g,O,T){return!(!r.TypeSystemPolicy.IsNumberLike(T)||u(g.exclusiveMaximum)&&!(T<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(T>g.exclusiveMinimum)||u(g.minimum)&&!(T>=g.minimum)||u(g.maximum)&&!(T<=g.maximum)||u(g.multipleOf)&&T%g.multipleOf!==0)}function $(g,O,T){if(!r.TypeSystemPolicy.IsObjectLike(T)||u(g.minProperties)&&!(Object.getOwnPropertyNames(T).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(T).length<=g.maxProperties))return!1;let c=Object.getOwnPropertyNames(g.properties);for(let x of c){let v=g.properties[x];if(g.required&&g.required.includes(x)){if(!j(v,O,T[x])||(o.ExtendsUndefined.Check(v)||s(v))&&!(x in T))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(T,x)&&!j(v,O,T[x]))return!1}if(g.additionalProperties===!1){let x=Object.getOwnPropertyNames(T);return g.required&&g.required.length===c.length&&x.length===c.length?!0:x.every(v=>c.includes(v))}else return typeof g.additionalProperties=="object"?Object.getOwnPropertyNames(T).every(x=>c.includes(x)||j(g.additionalProperties,O,T[x])):!0}function D(g,O,T){return(0,t.IsPromise)(T)}function z(g,O,T){if(!r.TypeSystemPolicy.IsRecordLike(T)||u(g.minProperties)&&!(Object.getOwnPropertyNames(T).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(T).length<=g.maxProperties))return!1;let[c,x]=Object.entries(g.patternProperties)[0],v=new RegExp(c),b=Object.entries(T).every(([ie,oe])=>v.test(ie)?j(x,O,oe):!0),U=typeof g.additionalProperties=="object"?Object.entries(T).every(([ie,oe])=>v.test(ie)?!0:j(g.additionalProperties,O,oe)):!0,H=g.additionalProperties===!1?Object.getOwnPropertyNames(T).every(ie=>v.test(ie)):!0;return b&&U&&H}function ne(g,O,T){return j((0,n.Deref)(g,O),O,T)}function ue(g,O,T){return!(0,t.IsString)(T)||u(g.minLength)&&!(T.length>=g.minLength)||u(g.maxLength)&&!(T.length<=g.maxLength)||u(g.pattern)&&!new RegExp(g.pattern).test(T)?!1:u(g.format)?o.FormatRegistry.Has(g.format)?o.FormatRegistry.Get(g.format)(T):!1:!0}function te(g,O,T){return(0,t.IsSymbol)(T)}function fe(g,O,T){return(0,t.IsString)(T)&&new RegExp(g.pattern).test(T)}function V(g,O,T){return j((0,n.Deref)(g,O),O,T)}function X(g,O,T){if(!(0,t.IsArray)(T)||g.items===void 0&&T.length!==0||T.length!==g.maxItems)return!1;if(!g.items)return!0;for(let c=0;c<g.items.length;c++)if(!j(g.items[c],O,T[c]))return!1;return!0}function ee(g,O,T){return(0,t.IsUndefined)(T)}function be(g,O,T){return g.anyOf.some(c=>j(c,O,T))}function p(g,O,T){return!(!(0,t.IsUint8Array)(T)||u(g.maxByteLength)&&!(T.length<=g.maxByteLength)||u(g.minByteLength)&&!(T.length>=g.minByteLength))}function w(g,O,T){return!0}function A(g,O,T){return r.TypeSystemPolicy.IsVoidLike(T)}function P(g,O,T){return o.TypeRegistry.Has(g[o.Kind])?o.TypeRegistry.Get(g[o.Kind])(g,T):!1}function j(g,O,T){let c=u(g.$id)?[...O,g]:O,x=g;switch(x[o.Kind]){case"Any":return l(x,c,T);case"Array":return f(x,c,T);case"AsyncIterator":return d(x,c,T);case"BigInt":return I(x,c,T);case"Boolean":return E(x,c,T);case"Constructor":return _(x,c,T);case"Date":return L(x,c,T);case"Function":return J(x,c,T);case"Integer":return B(x,c,T);case"Intersect":return k(x,c,T);case"Iterator":return F(x,c,T);case"Literal":return G(x,c,T);case"Never":return R(x,c,T);case"Not":return Q(x,c,T);case"Null":return K(x,c,T);case"Number":return re(x,c,T);case"Object":return $(x,c,T);case"Promise":return D(x,c,T);case"Record":return z(x,c,T);case"Ref":return ne(x,c,T);case"String":return ue(x,c,T);case"Symbol":return te(x,c,T);case"TemplateLiteral":return fe(x,c,T);case"This":return V(x,c,T);case"Tuple":return X(x,c,T);case"Undefined":return ee(x,c,T);case"Union":return be(x,c,T);case"Uint8Array":return p(x,c,T);case"Unknown":return w(x,c,T);case"Void":return A(x,c,T);default:if(!o.TypeRegistry.Has(x[o.Kind]))throw new a(x);return P(x,c,T)}}function N(...g){return g.length===3?j(g[0],g[1],g[2]):j(g[0],[],g[1])}e.Check=N}}),s2=it({"../../../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=Oi(),r=ws(),n=a2(),i=on(),o=class extends i.TypeBoxError{constructor(I,E,_){super("Unable to decode due to invalid value"),this.schema=I,this.value=E,this.error=_}};e.TransformDecodeCheckError=o;var a=class extends i.TypeBoxError{constructor(I,E,_){super("Unable to encode due to invalid value"),this.schema=I,this.value=E,this.error=_}};e.TransformEncodeCheckError=a;var s=class extends i.TypeBoxError{constructor(I,E,_){super(`${_ instanceof Error?_.message:"Unknown error"}`),this.schema=I,this.value=E}};e.TransformDecodeError=s;var u=class extends i.TypeBoxError{constructor(I,E,_){super(`${_ instanceof Error?_.message:"Unknown error"}`),this.schema=I,this.value=E}};e.TransformEncodeError=u;var l;(function(I){function E(te,fe){return i.TypeGuard.TTransform(te)||z(te.items,fe)}function _(te,fe){return i.TypeGuard.TTransform(te)||z(te.items,fe)}function L(te,fe){return i.TypeGuard.TTransform(te)||z(te.returns,fe)||te.parameters.some(V=>z(V,fe))}function J(te,fe){return i.TypeGuard.TTransform(te)||z(te.returns,fe)||te.parameters.some(V=>z(V,fe))}function B(te,fe){return i.TypeGuard.TTransform(te)||i.TypeGuard.TTransform(te.unevaluatedProperties)||te.allOf.some(V=>z(V,fe))}function k(te,fe){return i.TypeGuard.TTransform(te)||z(te.items,fe)}function F(te,fe){return i.TypeGuard.TTransform(te)||z(te.not,fe)}function G(te,fe){return i.TypeGuard.TTransform(te)||Object.values(te.properties).some(V=>z(V,fe))||i.TypeGuard.TSchema(te.additionalProperties)&&z(te.additionalProperties,fe)}function R(te,fe){return i.TypeGuard.TTransform(te)||z(te.item,fe)}function Q(te,fe){let V=Object.getOwnPropertyNames(te.patternProperties)[0],X=te.patternProperties[V];return i.TypeGuard.TTransform(te)||z(X,fe)||i.TypeGuard.TSchema(te.additionalProperties)&&i.TypeGuard.TTransform(te.additionalProperties)}function K(te,fe){return i.TypeGuard.TTransform(te)?!0:z((0,r.Deref)(te,fe),fe)}function re(te,fe){return i.TypeGuard.TTransform(te)?!0:z((0,r.Deref)(te,fe),fe)}function $(te,fe){return i.TypeGuard.TTransform(te)||!(0,t.IsUndefined)(te.items)&&te.items.some(V=>z(V,fe))}function D(te,fe){return i.TypeGuard.TTransform(te)||te.anyOf.some(V=>z(V,fe))}function z(te,fe){let V=(0,t.IsString)(te.$id)?[...fe,te]:fe,X=te;if(te.$id&&ne.has(te.$id))return!1;switch(te.$id&&ne.add(te.$id),te[i.Kind]){case"Array":return E(X,V);case"AsyncIterator":return _(X,V);case"Constructor":return L(X,V);case"Function":return J(X,V);case"Intersect":return B(X,V);case"Iterator":return k(X,V);case"Not":return F(X,V);case"Object":return G(X,V);case"Promise":return R(X,V);case"Record":return Q(X,V);case"Ref":return K(X,V);case"This":return re(X,V);case"Tuple":return $(X,V);case"Union":return D(X,V);default:return i.TypeGuard.TTransform(te)}}let ne=new Set;function ue(te,fe){return ne.clear(),z(te,fe)}I.Has=ue})(l||(e.HasTransform=l={}));var f;(function(I){function E($,D){try{return i.TypeGuard.TTransform($)?$[i.Transform].Decode(D):D}catch(z){throw new s($,D,z)}}function _($,D,z){return(0,t.IsArray)(z)?E($,z.map(ne=>K($.items,D,ne))):E($,z)}function L($,D,z){if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return E($,z);let ne=i.KeyResolver.ResolveKeys($,{includePatterns:!1}),ue=ne.reduce((X,ee)=>ee in X?{...X,[ee]:K(i.IndexedAccessor.Resolve($,[ee]),D,X[ee])}:X,z);if(!i.TypeGuard.TTransform($.unevaluatedProperties))return E($,ue);let te=Object.getOwnPropertyNames(ue),fe=$.unevaluatedProperties,V=te.reduce((X,ee)=>ne.includes(ee)?X:{...X,[ee]:E(fe,X[ee])},ue);return E($,V)}function J($,D,z){return E($,K($.not,D,z))}function B($,D,z){if(!(0,t.IsPlainObject)(z))return E($,z);let ne=i.KeyResolver.ResolveKeys($,{includePatterns:!1}),ue=ne.reduce((X,ee)=>ee in X?{...X,[ee]:K($.properties[ee],D,X[ee])}:X,z);if(!i.TypeGuard.TSchema($.additionalProperties))return E($,ue);let te=Object.getOwnPropertyNames(ue),fe=$.additionalProperties,V=te.reduce((X,ee)=>ne.includes(ee)?X:{...X,[ee]:E(fe,X[ee])},ue);return E($,V)}function k($,D,z){if(!(0,t.IsPlainObject)(z))return E($,z);let ne=Object.getOwnPropertyNames($.patternProperties)[0],ue=new RegExp(ne),te=Object.getOwnPropertyNames(z).reduce((ee,be)=>ue.test(be)?{...ee,[be]:K($.patternProperties[ne],D,ee[be])}:ee,z);if(!i.TypeGuard.TSchema($.additionalProperties))return E($,te);let fe=Object.getOwnPropertyNames(te),V=$.additionalProperties,X=fe.reduce((ee,be)=>ue.test(be)?ee:{...ee,[be]:E(V,ee[be])},te);return E($,X)}function F($,D,z){let ne=(0,r.Deref)($,D);return E($,K(ne,D,z))}function G($,D,z){let ne=(0,r.Deref)($,D);return E($,K(ne,D,z))}function R($,D,z){return(0,t.IsArray)(z)&&(0,t.IsArray)($.items)?E($,$.items.map((ne,ue)=>K(ne,D,z[ue]))):E($,z)}function Q($,D,z){let ne=E($,z);for(let ue of $.anyOf)if((0,n.Check)(ue,D,ne))return K(ue,D,ne);return ne}function K($,D,z){let ne=typeof $.$id=="string"?[...D,$]:D,ue=$;switch($[i.Kind]){case"Array":return _(ue,ne,z);case"Intersect":return L(ue,ne,z);case"Not":return J(ue,ne,z);case"Object":return B(ue,ne,z);case"Record":return k(ue,ne,z);case"Ref":return F(ue,ne,z);case"Symbol":return E(ue,z);case"This":return G(ue,ne,z);case"Tuple":return R(ue,ne,z);case"Union":return Q(ue,ne,z);default:return E(ue,z)}}function re($,D,z){return K($,D,z)}I.Decode=re})(f||(e.DecodeTransform=f={}));var d;(function(I){function E($,D){try{return i.TypeGuard.TTransform($)?$[i.Transform].Encode(D):D}catch(z){throw new u($,D,z)}}function _($,D,z){let ne=E($,z);return(0,t.IsArray)(ne)?ne.map(ue=>K($.items,D,ue)):ne}function L($,D,z){let ne=E($,z);if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return ne;let ue=i.KeyResolver.ResolveKeys($,{includePatterns:!1}),te=ue.reduce((X,ee)=>ee in ne?{...X,[ee]:K(i.IndexedAccessor.Resolve($,[ee]),D,X[ee])}:X,ne);if(!i.TypeGuard.TTransform($.unevaluatedProperties))return E($,te);let fe=Object.getOwnPropertyNames(te),V=$.unevaluatedProperties;return fe.reduce((X,ee)=>ue.includes(ee)?X:{...X,[ee]:E(V,X[ee])},te)}function J($,D,z){return E($.not,E($,z))}function B($,D,z){let ne=E($,z);if(!(0,t.IsPlainObject)(z))return ne;let ue=i.KeyResolver.ResolveKeys($,{includePatterns:!1}),te=ue.reduce((X,ee)=>ee in X?{...X,[ee]:K($.properties[ee],D,X[ee])}:X,ne);if(!i.TypeGuard.TSchema($.additionalProperties))return te;let fe=Object.getOwnPropertyNames(te),V=$.additionalProperties;return fe.reduce((X,ee)=>ue.includes(ee)?X:{...X,[ee]:E(V,X[ee])},te)}function k($,D,z){let ne=E($,z);if(!(0,t.IsPlainObject)(z))return ne;let ue=Object.getOwnPropertyNames($.patternProperties)[0],te=new RegExp(ue),fe=Object.getOwnPropertyNames(z).reduce((ee,be)=>te.test(be)?{...ee,[be]:K($.patternProperties[ue],D,ee[be])}:ee,ne);if(!i.TypeGuard.TSchema($.additionalProperties))return E($,fe);let V=Object.getOwnPropertyNames(fe),X=$.additionalProperties;return V.reduce((ee,be)=>te.test(be)?ee:{...ee,[be]:E(X,ee[be])},fe)}function F($,D,z){let ne=(0,r.Deref)($,D),ue=K(ne,D,z);return E($,ue)}function G($,D,z){let ne=(0,r.Deref)($,D),ue=K(ne,D,z);return E($,ue)}function R($,D,z){let ne=E($,z);return(0,t.IsArray)($.items)?$.items.map((ue,te)=>K(ue,D,ne[te])):[]}function Q($,D,z){for(let ne of $.anyOf){if(!(0,n.Check)(ne,D,z))continue;let ue=K(ne,D,z);return E($,ue)}for(let ne of $.anyOf){let ue=K(ne,D,z);if((0,n.Check)($,D,ue))return E($,ue)}return E($,z)}function K($,D,z){let ne=typeof $.$id=="string"?[...D,$]:D,ue=$;switch($[i.Kind]){case"Array":return _(ue,ne,z);case"Intersect":return L(ue,ne,z);case"Not":return J(ue,ne,z);case"Object":return B(ue,ne,z);case"Record":return k(ue,ne,z);case"Ref":return F(ue,ne,z);case"This":return G(ue,ne,z);case"Tuple":return R(ue,ne,z);case"Union":return Q(ue,ne,z);default:return E(ue,z)}}function re($,D,z){return K($,D,z)}I.Encode=re})(d||(e.EncodeTransform=d={}))}}),u2=it({"../../../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=s2(),r=Oi(),n=Ts(),i=ah(),o=ws(),a=jl(),s=on(),u=class{constructor(B,k,F,G){this.schema=B,this.references=k,this.checkFunc=F,this.code=G,this.hasTransform=t.HasTransform.Has(B,k)}Code(){return this.code}Errors(B){return(0,n.Errors)(this.schema,this.references,B)}Check(B){return this.checkFunc(B)}Decode(B){if(!this.checkFunc(B))throw new t.TransformDecodeCheckError(this.schema,B,this.Errors(B).First());return this.hasTransform?t.DecodeTransform.Decode(this.schema,this.references,B):B}Encode(B){let k=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,B):B;if(!this.checkFunc(k))throw new t.TransformEncodeCheckError(this.schema,B,this.Errors(B).First());return k}};e.TypeCheck=u;var l;(function(B){function k(Q){return Q===36}B.DollarSign=k;function F(Q){return Q===95}B.IsUnderscore=F;function G(Q){return Q>=65&&Q<=90||Q>=97&&Q<=122}B.IsAlpha=G;function R(Q){return Q>=48&&Q<=57}B.IsNumeric=R})(l||(l={}));var f;(function(B){function k(Q){return Q.length===0?!1:l.IsNumeric(Q.charCodeAt(0))}function F(Q){if(k(Q))return!1;for(let K=0;K<Q.length;K++){let re=Q.charCodeAt(K);if(!(l.IsAlpha(re)||l.IsNumeric(re)||l.DollarSign(re)||l.IsUnderscore(re)))return!1}return!0}function G(Q){return Q.replace(/'/g,"\\'")}function R(Q,K){return F(K)?`${Q}.${K}`:`${Q}['${G(K)}']`}B.Encode=R})(f||(f={}));var d;(function(B){function k(F){let G=[];for(let R=0;R<F.length;R++){let Q=F.charCodeAt(R);l.IsNumeric(Q)||l.IsAlpha(Q)?G.push(F.charAt(R)):G.push(`_${Q}_`)}return G.join("").replace(/__/g,"_")}B.Encode=k})(d||(d={}));var I;(function(B){function k(F){return F.replace(/'/g,"\\'")}B.Escape=k})(I||(I={}));var E=class extends s.TypeBoxError{constructor(B){super("Unknown type"),this.schema=B}};e.TypeCompilerUnknownTypeError=E;var _=class extends s.TypeBoxError{constructor(B){super("Preflight validation check failed to guard for the given schema"),this.schema=B}};e.TypeCompilerTypeGuardError=_;var L;(function(B){function k(K,re,$){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${re}' in ${K} ? ${$} : true)`:`(${f.Encode(K,re)} !== undefined ? ${$} : true)`}B.IsExactOptionalProperty=k;function F(K){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${K} === 'object' && ${K} !== null)`:`(typeof ${K} === 'object' && ${K} !== null && !Array.isArray(${K}))`}B.IsObjectLike=F;function G(K){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${K} === 'object' && ${K} !== null && !(${K} instanceof Date) && !(${K} instanceof Uint8Array))`:`(typeof ${K} === 'object' && ${K} !== null && !Array.isArray(${K}) && !(${K} instanceof Date) && !(${K} instanceof Uint8Array))`}B.IsRecordLike=G;function R(K){return i.TypeSystemPolicy.AllowNaN?`typeof ${K} === 'number'`:`(typeof ${K} === 'number' && Number.isFinite(${K}))`}B.IsNumberLike=R;function Q(K){return i.TypeSystemPolicy.AllowNullVoid?`(${K} === undefined || ${K} === null)`:`${K} === undefined`}B.IsVoidLike=Q})(L||(e.Policy=L={}));var J;(function(B){function k(S){return S[s.Kind]==="Any"||S[s.Kind]==="Unknown"}function*F(S,ye,C){yield"true"}function*G(S,ye,C){yield`Array.isArray(${C})`;let[xe,se]=[He("value","any"),He("acc","number")];(0,r.IsNumber)(S.maxItems)&&(yield`${C}.length <= ${S.maxItems}`),(0,r.IsNumber)(S.minItems)&&(yield`${C}.length >= ${S.minItems}`);let ge=oe(S.items,ye,"value");if(yield`${C}.every((${xe}) => ${ge})`,s.TypeGuard.TSchema(S.contains)||(0,r.IsNumber)(S.minContains)||(0,r.IsNumber)(S.maxContains)){let Re=s.TypeGuard.TSchema(S.contains)?S.contains:s.Type.Never(),Je=oe(Re,ye,"value"),mt=(0,r.IsNumber)(S.minContains)?[`(count >= ${S.minContains})`]:[],dt=(0,r.IsNumber)(S.maxContains)?[`(count <= ${S.maxContains})`]:[],vt=`const count = value.reduce((${se}, ${xe}) => ${Je} ? acc + 1 : acc, 0)`,Rr=["(count > 0)",...mt,...dt].join(" && ");yield`((${xe}) => { ${vt}; return ${Rr}})(${C})`}S.uniqueItems===!0&&(yield`((${xe}) => { 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 } )(${C})`)}function*R(S,ye,C){yield`(typeof value === 'object' && Symbol.asyncIterator in ${C})`}function*Q(S,ye,C){yield`(typeof ${C} === 'bigint')`,(0,r.IsBigInt)(S.exclusiveMaximum)&&(yield`${C} < BigInt(${S.exclusiveMaximum})`),(0,r.IsBigInt)(S.exclusiveMinimum)&&(yield`${C} > BigInt(${S.exclusiveMinimum})`),(0,r.IsBigInt)(S.maximum)&&(yield`${C} <= BigInt(${S.maximum})`),(0,r.IsBigInt)(S.minimum)&&(yield`${C} >= BigInt(${S.minimum})`),(0,r.IsBigInt)(S.multipleOf)&&(yield`(${C} % BigInt(${S.multipleOf})) === 0`)}function*K(S,ye,C){yield`(typeof ${C} === 'boolean')`}function*re(S,ye,C){yield*H(S.returns,ye,`${C}.prototype`)}function*$(S,ye,C){yield`(${C} instanceof Date) && Number.isFinite(${C}.getTime())`,(0,r.IsNumber)(S.exclusiveMaximumTimestamp)&&(yield`${C}.getTime() < ${S.exclusiveMaximumTimestamp}`),(0,r.IsNumber)(S.exclusiveMinimumTimestamp)&&(yield`${C}.getTime() > ${S.exclusiveMinimumTimestamp}`),(0,r.IsNumber)(S.maximumTimestamp)&&(yield`${C}.getTime() <= ${S.maximumTimestamp}`),(0,r.IsNumber)(S.minimumTimestamp)&&(yield`${C}.getTime() >= ${S.minimumTimestamp}`),(0,r.IsNumber)(S.multipleOfTimestamp)&&(yield`(${C}.getTime() % ${S.multipleOfTimestamp}) === 0`)}function*D(S,ye,C){yield`(typeof ${C} === 'function')`}function*z(S,ye,C){yield`(typeof ${C} === 'number' && Number.isInteger(${C}))`,(0,r.IsNumber)(S.exclusiveMaximum)&&(yield`${C} < ${S.exclusiveMaximum}`),(0,r.IsNumber)(S.exclusiveMinimum)&&(yield`${C} > ${S.exclusiveMinimum}`),(0,r.IsNumber)(S.maximum)&&(yield`${C} <= ${S.maximum}`),(0,r.IsNumber)(S.minimum)&&(yield`${C} >= ${S.minimum}`),(0,r.IsNumber)(S.multipleOf)&&(yield`(${C} % ${S.multipleOf}) === 0`)}function*ne(S,ye,C){let xe=S.allOf.map(se=>oe(se,ye,C)).join(" && ");if(S.unevaluatedProperties===!1){let se=Se(`${new RegExp(s.KeyResolver.ResolvePattern(S))};`),ge=`Object.getOwnPropertyNames(${C}).every(key => ${se}.test(key))`;yield`(${xe} && ${ge})`}else if(s.TypeGuard.TSchema(S.unevaluatedProperties)){let se=Se(`${new RegExp(s.KeyResolver.ResolvePattern(S))};`),ge=`Object.getOwnPropertyNames(${C}).every(key => ${se}.test(key) || ${oe(S.unevaluatedProperties,ye,`${C}[key]`)})`;yield`(${xe} && ${ge})`}else yield`(${xe})`}function*ue(S,ye,C){yield`(typeof value === 'object' && Symbol.iterator in ${C})`}function*te(S,ye,C){typeof S.const=="number"||typeof S.const=="boolean"?yield`(${C} === ${S.const})`:yield`(${C} === '${I.Escape(S.const)}')`}function*fe(S,ye,C){yield"false"}function*V(S,ye,C){yield`(!${oe(S.not,ye,C)})`}function*X(S,ye,C){yield`(${C} === null)`}function*ee(S,ye,C){yield L.IsNumberLike(C),(0,r.IsNumber)(S.exclusiveMaximum)&&(yield`${C} < ${S.exclusiveMaximum}`),(0,r.IsNumber)(S.exclusiveMinimum)&&(yield`${C} > ${S.exclusiveMinimum}`),(0,r.IsNumber)(S.maximum)&&(yield`${C} <= ${S.maximum}`),(0,r.IsNumber)(S.minimum)&&(yield`${C} >= ${S.minimum}`),(0,r.IsNumber)(S.multipleOf)&&(yield`(${C} % ${S.multipleOf}) === 0`)}function*be(S,ye,C){yield L.IsObjectLike(C),(0,r.IsNumber)(S.minProperties)&&(yield`Object.getOwnPropertyNames(${C}).length >= ${S.minProperties}`),(0,r.IsNumber)(S.maxProperties)&&(yield`Object.getOwnPropertyNames(${C}).length <= ${S.maxProperties}`);let xe=Object.getOwnPropertyNames(S.properties);for(let se of xe){let ge=f.Encode(C,se),Re=S.properties[se];if(S.required&&S.required.includes(se))yield*H(Re,ye,ge),(s.ExtendsUndefined.Check(Re)||k(Re))&&(yield`('${se}' in ${C})`);else{let Je=oe(Re,ye,ge);yield L.IsExactOptionalProperty(C,se,Je)}}if(S.additionalProperties===!1)if(S.required&&S.required.length===xe.length)yield`Object.getOwnPropertyNames(${C}).length === ${xe.length}`;else{let se=`[${xe.map(ge=>`'${ge}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${C}).every(key => ${se}.includes(key))`}if(typeof S.additionalProperties=="object"){let se=oe(S.additionalProperties,ye,`${C}[key]`),ge=`[${xe.map(Re=>`'${Re}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${C}).every(key => ${ge}.includes(key) || ${se}))`}}function*p(S,ye,C){yield`(typeof value === 'object' && typeof ${C}.then === 'function')`}function*w(S,ye,C){yield L.IsRecordLike(C),(0,r.IsNumber)(S.minProperties)&&(yield`Object.getOwnPropertyNames(${C}).length >= ${S.minProperties}`),(0,r.IsNumber)(S.maxProperties)&&(yield`Object.getOwnPropertyNames(${C}).length <= ${S.maxProperties}`);let[xe,se]=Object.entries(S.patternProperties)[0],ge=Se(`${new RegExp(xe)}`),Re=oe(se,ye,"value"),Je=s.TypeGuard.TSchema(S.additionalProperties)?oe(S.additionalProperties,ye,C):S.additionalProperties===!1?"false":"true",mt=`(${ge}.test(key) ? ${Re} : ${Je})`;yield`(Object.entries(${C}).every(([key, value]) => ${mt}))`}function*A(S,ye,C){let xe=(0,o.Deref)(S,ye);if(ie.functions.has(S.$ref))return yield`${_e(S.$ref)}(${C})`;yield*H(xe,ye,C)}function*P(S,ye,C){yield`(typeof ${C} === 'string')`,(0,r.IsNumber)(S.maxLength)&&(yield`${C}.length <= ${S.maxLength}`),(0,r.IsNumber)(S.minLength)&&(yield`${C}.length >= ${S.minLength}`),S.pattern!==void 0&&(yield`${Se(`${new RegExp(S.pattern)};`)}.test(${C})`),S.format!==void 0&&(yield`format('${S.format}', ${C})`)}function*j(S,ye,C){yield`(typeof ${C} === 'symbol')`}function*N(S,ye,C){yield`(typeof ${C} === 'string')`,yield`${Se(`${new RegExp(S.pattern)};`)}.test(${C})`}function*g(S,ye,C){yield`${_e(S.$ref)}(${C})`}function*O(S,ye,C){if(yield`Array.isArray(${C})`,S.items===void 0)return yield`${C}.length === 0`;yield`(${C}.length === ${S.maxItems})`;for(let xe=0;xe<S.items.length;xe++)yield`${oe(S.items[xe],ye,`${C}[${xe}]`)}`}function*T(S,ye,C){yield`${C} === undefined`}function*c(S,ye,C){yield`(${S.anyOf.map(xe=>oe(xe,ye,C)).join(" || ")})`}function*x(S,ye,C){yield`${C} instanceof Uint8Array`,(0,r.IsNumber)(S.maxByteLength)&&(yield`(${C}.length <= ${S.maxByteLength})`),(0,r.IsNumber)(S.minByteLength)&&(yield`(${C}.length >= ${S.minByteLength})`)}function*v(S,ye,C){yield"true"}function*b(S,ye,C){yield L.IsVoidLike(C)}function*U(S,ye,C){let xe=ie.instances.size;ie.instances.set(xe,S),yield`kind('${S[s.Kind]}', ${xe}, ${C})`}function*H(S,ye,C,xe=!0){let se=(0,r.IsString)(S.$id)?[...ye,S]:ye,ge=S;if(xe&&(0,r.IsString)(S.$id)){let Re=_e(S.$id);if(ie.functions.has(Re))return yield`${Re}(${C})`;{let Je=Ve(Re,S,ye,"value",!1);return ie.functions.set(Re,Je),yield`${Re}(${C})`}}switch(ge[s.Kind]){case"Any":return yield*F(ge,se,C);case"Array":return yield*G(ge,se,C);case"AsyncIterator":return yield*R(ge,se,C);case"BigInt":return yield*Q(ge,se,C);case"Boolean":return yield*K(ge,se,C);case"Constructor":return yield*re(ge,se,C);case"Date":return yield*$(ge,se,C);case"Function":return yield*D(ge,se,C);case"Integer":return yield*z(ge,se,C);case"Intersect":return yield*ne(ge,se,C);case"Iterator":return yield*ue(ge,se,C);case"Literal":return yield*te(ge,se,C);case"Never":return yield*fe(ge,se,C);case"Not":return yield*V(ge,se,C);case"Null":return yield*X(ge,se,C);case"Number":return yield*ee(ge,se,C);case"Object":return yield*be(ge,se,C);case"Promise":return yield*p(ge,se,C);case"Record":return yield*w(ge,se,C);case"Ref":return yield*A(ge,se,C);case"String":return yield*P(ge,se,C);case"Symbol":return yield*j(ge,se,C);case"TemplateLiteral":return yield*N(ge,se,C);case"This":return yield*g(ge,se,C);case"Tuple":return yield*O(ge,se,C);case"Undefined":return yield*T(ge,se,C);case"Union":return yield*c(ge,se,C);case"Uint8Array":return yield*x(ge,se,C);case"Unknown":return yield*v(ge,se,C);case"Void":return yield*b(ge,se,C);default:if(!s.TypeRegistry.Has(ge[s.Kind]))throw new E(S);return yield*U(ge,se,C)}}let ie={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function oe(S,ye,C,xe=!0){return`(${[...H(S,ye,C,xe)].join(" && ")})`}function _e(S){return`check_${d.Encode(S)}`}function Se(S){let ye=`local_${ie.variables.size}`;return ie.variables.set(ye,`const ${ye} = ${S}`),ye}function Ve(S,ye,C,xe,se=!0){let[ge,Re]=[`
49
49
  `,vt=>"".padStart(vt," ")],Je=He("value","any"),mt=un("boolean"),dt=[...H(ye,C,xe,se)].map(vt=>`${Re(4)}${vt}`).join(` &&${ge}`);return`function ${S}(${Je})${mt} {${ge}${Re(2)}return (${ge}${dt}${ge}${Re(2)})
50
50
  }`}function He(S,ye){let C=ie.language==="typescript"?`: ${ye}`:"";return`${S}${C}`}function un(S){return ie.language==="typescript"?`: ${S}`:""}function Oe(S,ye,C){let xe=Ve("check",S,ye,"value"),se=He("value","any"),ge=un("boolean"),Re=[...ie.functions.values()],Je=[...ie.variables.values()],mt=(0,r.IsString)(S.$id)?`return function check(${se})${ge} {
51
51
  return ${_e(S.$id)}(value)
52
52
  }`:`return ${xe}`;return[...Je,...Re,mt].join(`
53
- `)}function Br(...S){let ye={language:"javascript"},[C,xe,se]=S.length===2&&(0,r.IsArray)(S[1])?[S[0],S[1],ye]:S.length===2&&!(0,r.IsArray)(S[1])?[S[0],[],S[1]]:S.length===3?[S[0],S[1],S[2]]:S.length===1?[S[0],[],ye]:[null,[],ye];if(ie.language=se.language,ie.variables.clear(),ie.functions.clear(),ie.instances.clear(),!s.TypeGuard.TSchema(C))throw new _(C);for(let ge of xe)if(!s.TypeGuard.TSchema(ge))throw new _(ge);return Oe(C,xe,se)}B.Code=Br;function ln(S,ye=[]){let C=Br(S,ye,{language:"javascript"}),xe=globalThis.Function("kind","format","hash",C),se=new Map(ie.instances);function ge(dt,vt,Rr){if(!s.TypeRegistry.Has(dt)||!se.has(vt))return!1;let Wn=s.TypeRegistry.Get(dt),Hn=se.get(vt);return Wn(Hn,Rr)}function Re(dt,vt){return s.FormatRegistry.Has(dt)?s.FormatRegistry.Get(dt)(vt):!1}function Je(dt){return(0,a.Hash)(dt)}let mt=xe(ge,Re,Je);return new u(S,ye,mt,C)}B.Compile=ln})(J||(e.TypeCompiler=J={}))}}),l2=it({"../../../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,a,s){s===void 0&&(s=a);var u=Object.getOwnPropertyDescriptor(o,a);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(i,s,u)}:function(i,o,a,s){s===void 0&&(s=a),i[s]=o[a]}),r=e&&e.__exportStar||function(i,o){for(var a in i)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorIterator=e.ValueErrorType=void 0;var n=o2();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return n.ValueErrorIterator}}),r(u2(),e)}}),Na=Nr(r2(),1),c2=Nr(n2(),1),sh=!1,uh=!1;Na.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(sh=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(uh=process?.env?.LOGGER_PERF_PREFIX==="true"));var f2={prefix:void 0,time:sh,delta:uh,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},Qs=[],lh=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(",")}]`}},ch=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Ji=!1,Ce=class wt{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=wt.INFO,r={}){r=Object.assign({},f2,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),a=(u,l)=>{function f(...I){let E=I[I.length-1];return E===i?E():(o(...I.slice(0,-1)),(async()=>{try{let _=E();return _ instanceof Promise?await _:_}finally{console.groupEnd()}})())}let d=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:l});return u?d:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:d})},s=a(t>=wt.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(s(...u),new Error(u.map(l=>typeof l=="string"?l:(0,c2.default)(l)).join(" "))),WARN:a(t>=wt.WARN,this.wrapLog(console.warn,r)),LOG:a(t>=wt.INFO,this.wrapLog(console.log,r)),DEBUG:a(t>=wt.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:a(t>=wt.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(Na.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=Na.isBrowser&&navigator.userAgent.includes("Chrome")?["",wt.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(Ji?n.push(new ch("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();wt.firstLog||(wt.firstLog=i,wt.lastLog=i);let o=new lh(i-wt.firstLog,i-wt.lastLog,t,r);return wt.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}}}};Na.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(Qs&&Qs.length){for(let t of Qs)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof lh))return null;Ji||(Ji=!0);let t=Ce.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof ch?(Ji||(Ji=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var d2=typeof global=="object"&&global&&global.Object===Object&&global,fh=d2,p2=typeof self=="object"&&self&&self.Object===Object&&self,h2=fh||p2||Function("return this")(),It=h2,y2=It.Symbol,gr=y2,dh=Object.prototype,g2=dh.hasOwnProperty,m2=dh.toString,zi=gr?gr.toStringTag:void 0;function b2(e){var t=g2.call(e,zi),r=e[zi];try{e[zi]=void 0;var n=!0}catch{}var i=m2.call(e);return n&&(t?e[zi]=r:delete e[zi]),i}var v2=b2,w2=Object.prototype,T2=w2.toString;function _2(e){return T2.call(e)}var E2=_2,x2="[object Null]",O2="[object Undefined]",pf=gr?gr.toStringTag:void 0;function A2(e){return e==null?e===void 0?O2:x2:pf&&pf in Object(e)?v2(e):E2(e)}var Ai=A2;function S2(e){return e!=null&&typeof e=="object"}var en=S2,I2="[object Symbol]";function k2(e){return typeof e=="symbol"||en(e)&&Ai(e)==I2}var oi=k2;function $2(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 ph=$2,j2=Array.isArray,lr=j2,C2=1/0,hf=gr?gr.prototype:void 0,yf=hf?hf.toString:void 0;function hh(e){if(typeof e=="string")return e;if(lr(e))return ph(e,hh)+"";if(oi(e))return yf?yf.call(e):"";var t=e+"";return t=="0"&&1/e==-C2?"-0":t}var N2=hh,U2=/\s/;function P2(e){for(var t=e.length;t--&&U2.test(e.charAt(t)););return t}var B2=P2,R2=/^\s+/;function D2(e){return e&&e.slice(0,B2(e)+1).replace(R2,"")}var M2=D2;function L2(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ir=L2,gf=NaN,V2=/^[-+]0x[0-9a-f]+$/i,F2=/^0b[01]+$/i,z2=/^0o[0-7]+$/i,K2=parseInt;function q2(e){if(typeof e=="number")return e;if(oi(e))return gf;if(Ir(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ir(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=M2(e);var r=F2.test(e);return r||z2.test(e)?K2(e.slice(2),r?2:8):V2.test(e)?gf:+e}var G2=q2,mf=1/0,W2=17976931348623157e292;function H2(e){if(!e)return e===0?e:0;if(e=G2(e),e===mf||e===-mf){var t=e<0?-1:1;return t*W2}return e===e?e:0}var J2=H2;function X2(e){var t=J2(e),r=t%1;return t===t?r?t-r:t:0}var bf=X2;function Q2(e){return e}var _s=Q2,Z2="[object AsyncFunction]",Y2="[object Function]",eT="[object GeneratorFunction]",tT="[object Proxy]";function rT(e){if(!Ir(e))return!1;var t=Ai(e);return t==Y2||t==eT||t==Z2||t==tT}var yh=rT,nT=It["__core-js_shared__"],Zs=nT,vf=function(){var e=/[^.]+$/.exec(Zs&&Zs.keys&&Zs.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function iT(e){return!!vf&&vf in e}var oT=iT,aT=Function.prototype,sT=aT.toString;function uT(e){if(e!=null){try{return sT.call(e)}catch{}try{return e+""}catch{}}return""}var Pn=uT,lT=/[\\^$.*+?()[\]{}|]/g,cT=/^\[object .+?Constructor\]$/,fT=Function.prototype,dT=Object.prototype,pT=fT.toString,hT=dT.hasOwnProperty,yT=RegExp("^"+pT.call(hT).replace(lT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function gT(e){if(!Ir(e)||oT(e))return!1;var t=yh(e)?yT:cT;return t.test(Pn(e))}var mT=gT;function bT(e,t){return e?.[t]}var vT=bT;function wT(e,t){var r=vT(e,t);return mT(r)?r:void 0}var Bn=wT,TT=Bn(It,"WeakMap"),so=TT,_T=so&&new so,Ua=_T,ET=Ua?function(e,t){return Ua.set(e,t),e}:_s,gh=ET,wf=Object.create,xT=function(){function e(){}return function(t){if(!Ir(t))return{};if(wf)return wf(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),Cl=xT;function OT(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=Cl(e.prototype),n=e.apply(r,t);return Ir(n)?n:r}}var uo=OT,AT=1;function ST(e,t,r){var n=t&AT,i=uo(e);function o(){var a=this&&this!==It&&this instanceof o?i:e;return a.apply(n?r:this,arguments)}return o}var IT=ST;function kT(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 Nl=kT,$T=Math.max;function jT(e,t,r,n){for(var i=-1,o=e.length,a=r.length,s=-1,u=t.length,l=$T(o-a,0),f=Array(u+l),d=!n;++s<u;)f[s]=t[s];for(;++i<a;)(d||i<o)&&(f[r[i]]=e[i]);for(;l--;)f[s++]=e[i++];return f}var mh=jT,CT=Math.max;function NT(e,t,r,n){for(var i=-1,o=e.length,a=-1,s=r.length,u=-1,l=t.length,f=CT(o-s,0),d=Array(f+l),I=!n;++i<f;)d[i]=e[i];for(var E=i;++u<l;)d[E+u]=t[u];for(;++a<s;)(I||i<o)&&(d[E+r[a]]=e[i++]);return d}var bh=NT;function UT(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var PT=UT;function BT(){}var Ul=BT,RT=4294967295;function Pa(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=RT,this.__views__=[]}Pa.prototype=Cl(Ul.prototype);Pa.prototype.constructor=Pa;var Pl=Pa;function DT(){}var vh=DT,MT=Ua?function(e){return Ua.get(e)}:vh,wh=MT,LT={},Tf=LT,VT=Object.prototype,FT=VT.hasOwnProperty;function zT(e){for(var t=e.name+"",r=Tf[t],n=FT.call(Tf,t)?r.length:0;n--;){var i=r[n],o=i.func;if(o==null||o==e)return i.name}return t}var KT=zT;function Ba(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}Ba.prototype=Cl(Ul.prototype);Ba.prototype.constructor=Ba;var ju=Ba;function qT(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var Th=qT;function GT(e){if(e instanceof Pl)return e.clone();var t=new ju(e.__wrapped__,e.__chain__);return t.__actions__=Th(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var WT=GT,HT=Object.prototype,JT=HT.hasOwnProperty;function Ra(e){if(en(e)&&!lr(e)&&!(e instanceof Pl)){if(e instanceof ju)return e;if(JT.call(e,"__wrapped__"))return WT(e)}return new ju(e)}Ra.prototype=Ul.prototype;Ra.prototype.constructor=Ra;var XT=Ra;function QT(e){var t=KT(e),r=XT[t];if(typeof r!="function"||!(t in Pl.prototype))return!1;if(e===r)return!0;var n=wh(r);return!!n&&e===n[0]}var ZT=QT,YT=800,e_=16,t_=Date.now;function r_(e){var t=0,r=0;return function(){var n=t_(),i=e_-(n-r);if(r=n,i>0){if(++t>=YT)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var _h=r_,n_=_h(gh),Eh=n_,i_=/\{\n\/\* \[wrapped with (.+)\] \*/,o_=/,? & /;function a_(e){var t=e.match(i_);return t?t[1].split(o_):[]}var s_=a_,u_=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function l_(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(u_,`{
53
+ `)}function Br(...S){let ye={language:"javascript"},[C,xe,se]=S.length===2&&(0,r.IsArray)(S[1])?[S[0],S[1],ye]:S.length===2&&!(0,r.IsArray)(S[1])?[S[0],[],S[1]]:S.length===3?[S[0],S[1],S[2]]:S.length===1?[S[0],[],ye]:[null,[],ye];if(ie.language=se.language,ie.variables.clear(),ie.functions.clear(),ie.instances.clear(),!s.TypeGuard.TSchema(C))throw new _(C);for(let ge of xe)if(!s.TypeGuard.TSchema(ge))throw new _(ge);return Oe(C,xe,se)}B.Code=Br;function ln(S,ye=[]){let C=Br(S,ye,{language:"javascript"}),xe=globalThis.Function("kind","format","hash",C),se=new Map(ie.instances);function ge(dt,vt,Rr){if(!s.TypeRegistry.Has(dt)||!se.has(vt))return!1;let Wn=s.TypeRegistry.Get(dt),Hn=se.get(vt);return Wn(Hn,Rr)}function Re(dt,vt){return s.FormatRegistry.Has(dt)?s.FormatRegistry.Get(dt)(vt):!1}function Je(dt){return(0,a.Hash)(dt)}let mt=xe(ge,Re,Je);return new u(S,ye,mt,C)}B.Compile=ln})(J||(e.TypeCompiler=J={}))}}),l2=it({"../../../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,a,s){s===void 0&&(s=a);var u=Object.getOwnPropertyDescriptor(o,a);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(i,s,u)}:function(i,o,a,s){s===void 0&&(s=a),i[s]=o[a]}),r=e&&e.__exportStar||function(i,o){for(var a in i)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorIterator=e.ValueErrorType=void 0;var n=o2();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return n.ValueErrorIterator}}),r(u2(),e)}}),Na=Nr(r2(),1),c2=Nr(n2(),1),sh=!1,uh=!1;Na.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(sh=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(uh=process?.env?.LOGGER_PERF_PREFIX==="true"));var f2={prefix:void 0,time:sh,delta:uh,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},Qs=[],lh=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(",")}]`}},ch=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Ji=!1,ke=class wt{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=wt.INFO,r={}){r=Object.assign({},f2,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),a=(u,l)=>{function f(...I){let E=I[I.length-1];return E===i?E():(o(...I.slice(0,-1)),(async()=>{try{let _=E();return _ instanceof Promise?await _:_}finally{console.groupEnd()}})())}let d=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:l});return u?d:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:d})},s=a(t>=wt.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(s(...u),new Error(u.map(l=>typeof l=="string"?l:(0,c2.default)(l)).join(" "))),WARN:a(t>=wt.WARN,this.wrapLog(console.warn,r)),LOG:a(t>=wt.INFO,this.wrapLog(console.log,r)),DEBUG:a(t>=wt.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:a(t>=wt.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(Na.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=Na.isBrowser&&navigator.userAgent.includes("Chrome")?["",wt.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(Ji?n.push(new ch("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();wt.firstLog||(wt.firstLog=i,wt.lastLog=i);let o=new lh(i-wt.firstLog,i-wt.lastLog,t,r);return wt.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}}}};Na.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(Qs&&Qs.length){for(let t of Qs)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof lh))return null;Ji||(Ji=!0);let t=ke.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof ch?(Ji||(Ji=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var d2=typeof global=="object"&&global&&global.Object===Object&&global,fh=d2,p2=typeof self=="object"&&self&&self.Object===Object&&self,h2=fh||p2||Function("return this")(),It=h2,y2=It.Symbol,gr=y2,dh=Object.prototype,g2=dh.hasOwnProperty,m2=dh.toString,zi=gr?gr.toStringTag:void 0;function b2(e){var t=g2.call(e,zi),r=e[zi];try{e[zi]=void 0;var n=!0}catch{}var i=m2.call(e);return n&&(t?e[zi]=r:delete e[zi]),i}var v2=b2,w2=Object.prototype,T2=w2.toString;function _2(e){return T2.call(e)}var E2=_2,x2="[object Null]",O2="[object Undefined]",pf=gr?gr.toStringTag:void 0;function A2(e){return e==null?e===void 0?O2:x2:pf&&pf in Object(e)?v2(e):E2(e)}var Ai=A2;function S2(e){return e!=null&&typeof e=="object"}var en=S2,I2="[object Symbol]";function k2(e){return typeof e=="symbol"||en(e)&&Ai(e)==I2}var oi=k2;function $2(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 ph=$2,j2=Array.isArray,lr=j2,C2=1/0,hf=gr?gr.prototype:void 0,yf=hf?hf.toString:void 0;function hh(e){if(typeof e=="string")return e;if(lr(e))return ph(e,hh)+"";if(oi(e))return yf?yf.call(e):"";var t=e+"";return t=="0"&&1/e==-C2?"-0":t}var N2=hh,U2=/\s/;function P2(e){for(var t=e.length;t--&&U2.test(e.charAt(t)););return t}var B2=P2,R2=/^\s+/;function D2(e){return e&&e.slice(0,B2(e)+1).replace(R2,"")}var M2=D2;function L2(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ir=L2,gf=NaN,V2=/^[-+]0x[0-9a-f]+$/i,F2=/^0b[01]+$/i,z2=/^0o[0-7]+$/i,K2=parseInt;function G2(e){if(typeof e=="number")return e;if(oi(e))return gf;if(Ir(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ir(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=M2(e);var r=F2.test(e);return r||z2.test(e)?K2(e.slice(2),r?2:8):V2.test(e)?gf:+e}var q2=G2,mf=1/0,W2=17976931348623157e292;function H2(e){if(!e)return e===0?e:0;if(e=q2(e),e===mf||e===-mf){var t=e<0?-1:1;return t*W2}return e===e?e:0}var J2=H2;function X2(e){var t=J2(e),r=t%1;return t===t?r?t-r:t:0}var bf=X2;function Q2(e){return e}var _s=Q2,Z2="[object AsyncFunction]",Y2="[object Function]",eT="[object GeneratorFunction]",tT="[object Proxy]";function rT(e){if(!Ir(e))return!1;var t=Ai(e);return t==Y2||t==eT||t==Z2||t==tT}var yh=rT,nT=It["__core-js_shared__"],Zs=nT,vf=function(){var e=/[^.]+$/.exec(Zs&&Zs.keys&&Zs.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function iT(e){return!!vf&&vf in e}var oT=iT,aT=Function.prototype,sT=aT.toString;function uT(e){if(e!=null){try{return sT.call(e)}catch{}try{return e+""}catch{}}return""}var Pn=uT,lT=/[\\^$.*+?()[\]{}|]/g,cT=/^\[object .+?Constructor\]$/,fT=Function.prototype,dT=Object.prototype,pT=fT.toString,hT=dT.hasOwnProperty,yT=RegExp("^"+pT.call(hT).replace(lT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function gT(e){if(!Ir(e)||oT(e))return!1;var t=yh(e)?yT:cT;return t.test(Pn(e))}var mT=gT;function bT(e,t){return e?.[t]}var vT=bT;function wT(e,t){var r=vT(e,t);return mT(r)?r:void 0}var Bn=wT,TT=Bn(It,"WeakMap"),so=TT,_T=so&&new so,Ua=_T,ET=Ua?function(e,t){return Ua.set(e,t),e}:_s,gh=ET,wf=Object.create,xT=function(){function e(){}return function(t){if(!Ir(t))return{};if(wf)return wf(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),Cl=xT;function OT(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=Cl(e.prototype),n=e.apply(r,t);return Ir(n)?n:r}}var uo=OT,AT=1;function ST(e,t,r){var n=t&AT,i=uo(e);function o(){var a=this&&this!==It&&this instanceof o?i:e;return a.apply(n?r:this,arguments)}return o}var IT=ST;function kT(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 Nl=kT,$T=Math.max;function jT(e,t,r,n){for(var i=-1,o=e.length,a=r.length,s=-1,u=t.length,l=$T(o-a,0),f=Array(u+l),d=!n;++s<u;)f[s]=t[s];for(;++i<a;)(d||i<o)&&(f[r[i]]=e[i]);for(;l--;)f[s++]=e[i++];return f}var mh=jT,CT=Math.max;function NT(e,t,r,n){for(var i=-1,o=e.length,a=-1,s=r.length,u=-1,l=t.length,f=CT(o-s,0),d=Array(f+l),I=!n;++i<f;)d[i]=e[i];for(var E=i;++u<l;)d[E+u]=t[u];for(;++a<s;)(I||i<o)&&(d[E+r[a]]=e[i++]);return d}var bh=NT;function UT(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var PT=UT;function BT(){}var Ul=BT,RT=4294967295;function Pa(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=RT,this.__views__=[]}Pa.prototype=Cl(Ul.prototype);Pa.prototype.constructor=Pa;var Pl=Pa;function DT(){}var vh=DT,MT=Ua?function(e){return Ua.get(e)}:vh,wh=MT,LT={},Tf=LT,VT=Object.prototype,FT=VT.hasOwnProperty;function zT(e){for(var t=e.name+"",r=Tf[t],n=FT.call(Tf,t)?r.length:0;n--;){var i=r[n],o=i.func;if(o==null||o==e)return i.name}return t}var KT=zT;function Ba(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}Ba.prototype=Cl(Ul.prototype);Ba.prototype.constructor=Ba;var ju=Ba;function GT(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var Th=GT;function qT(e){if(e instanceof Pl)return e.clone();var t=new ju(e.__wrapped__,e.__chain__);return t.__actions__=Th(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var WT=qT,HT=Object.prototype,JT=HT.hasOwnProperty;function Ra(e){if(en(e)&&!lr(e)&&!(e instanceof Pl)){if(e instanceof ju)return e;if(JT.call(e,"__wrapped__"))return WT(e)}return new ju(e)}Ra.prototype=Ul.prototype;Ra.prototype.constructor=Ra;var XT=Ra;function QT(e){var t=KT(e),r=XT[t];if(typeof r!="function"||!(t in Pl.prototype))return!1;if(e===r)return!0;var n=wh(r);return!!n&&e===n[0]}var ZT=QT,YT=800,e_=16,t_=Date.now;function r_(e){var t=0,r=0;return function(){var n=t_(),i=e_-(n-r);if(r=n,i>0){if(++t>=YT)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var _h=r_,n_=_h(gh),Eh=n_,i_=/\{\n\/\* \[wrapped with (.+)\] \*/,o_=/,? & /;function a_(e){var t=e.match(i_);return t?t[1].split(o_):[]}var s_=a_,u_=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function l_(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(u_,`{
55
55
  /* [wrapped with `+t+`] */
56
- `)}var c_=l_;function f_(e){return function(){return e}}var d_=f_,p_=function(){try{var e=Bn(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Da=p_,h_=Da?function(e,t){return Da(e,"toString",{configurable:!0,enumerable:!1,value:d_(t),writable:!0})}:_s,y_=h_,g_=_h(y_),Bl=g_;function m_(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var b_=m_;function v_(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 w_=v_;function T_(e){return e!==e}var __=T_;function E_(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}var x_=E_;function O_(e,t,r){return t===t?x_(e,t,r):w_(e,__,r)}var A_=O_;function S_(e,t){var r=e==null?0:e.length;return!!r&&A_(e,t,0)>-1}var xh=S_,I_=1,k_=2,$_=8,j_=16,C_=32,N_=64,U_=128,P_=256,B_=512,R_=[["ary",U_],["bind",I_],["bindKey",k_],["curry",$_],["curryRight",j_],["flip",B_],["partial",C_],["partialRight",N_],["rearg",P_]];function D_(e,t){return b_(R_,function(r){var n="_."+r[0];t&r[1]&&!xh(e,n)&&e.push(n)}),e.sort()}var M_=D_;function L_(e,t,r){var n=t+"";return Bl(e,c_(n,M_(s_(n),r)))}var Oh=L_,V_=1,F_=2,z_=4,K_=8,_f=32,Ef=64;function q_(e,t,r,n,i,o,a,s,u,l){var f=t&K_,d=f?a:void 0,I=f?void 0:a,E=f?o:void 0,_=f?void 0:o;t|=f?_f:Ef,t&=~(f?Ef:_f),t&z_||(t&=~(V_|F_));var L=[e,t,i,E,d,_,I,s,u,l],J=r.apply(void 0,L);return ZT(e)&&Eh(J,L),J.placeholder=n,Oh(J,e,t)}var Ah=q_;function G_(e){var t=e;return t.placeholder}var Rl=G_,W_=9007199254740991,H_=/^(?:0|[1-9]\d*)$/;function J_(e,t){var r=typeof e;return t=t??W_,!!t&&(r=="number"||r!="symbol"&&H_.test(e))&&e>-1&&e%1==0&&e<t}var Es=J_,X_=Math.min;function Q_(e,t){for(var r=e.length,n=X_(t.length,r),i=Th(e);n--;){var o=t[n];e[n]=Es(o,r)?i[o]:void 0}return e}var Z_=Q_,xf="__lodash_placeholder__";function Y_(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r];(a===t||a===xf)&&(e[r]=xf,o[i++]=r)}return o}var lo=Y_,eE=1,tE=2,rE=8,nE=16,iE=128,oE=512;function Sh(e,t,r,n,i,o,a,s,u,l){var f=t&iE,d=t&eE,I=t&tE,E=t&(rE|nE),_=t&oE,L=I?void 0:uo(e);function J(){for(var B=arguments.length,k=Array(B),F=B;F--;)k[F]=arguments[F];if(E)var q=Rl(J),R=PT(k,q);if(n&&(k=mh(k,n,i,E)),o&&(k=bh(k,o,a,E)),B-=R,E&&B<l){var Q=lo(k,q);return Ah(e,t,Sh,J.placeholder,r,k,Q,s,u,l-B)}var K=d?r:this,re=I?K[e]:e;return B=k.length,s?k=Z_(k,s):_&&B>1&&k.reverse(),f&&u<B&&(k.length=u),this&&this!==It&&this instanceof J&&(re=L||uo(re)),re.apply(K,k)}return J}var Ih=Sh;function aE(e,t,r){var n=uo(e);function i(){for(var o=arguments.length,a=Array(o),s=o,u=Rl(i);s--;)a[s]=arguments[s];var l=o<3&&a[0]!==u&&a[o-1]!==u?[]:lo(a,u);if(o-=l.length,o<r)return Ah(e,t,Ih,i.placeholder,void 0,a,l,void 0,void 0,r-o);var f=this&&this!==It&&this instanceof i?n:e;return Nl(f,this,a)}return i}var sE=aE,uE=1;function lE(e,t,r,n){var i=t&uE,o=uo(e);function a(){for(var s=-1,u=arguments.length,l=-1,f=n.length,d=Array(f+u),I=this&&this!==It&&this instanceof a?o:e;++l<f;)d[l]=n[l];for(;u--;)d[l++]=arguments[++s];return Nl(I,i?r:this,d)}return a}var cE=lE,Of="__lodash_placeholder__",Ys=1,fE=2,dE=4,Af=8,Ki=128,Sf=256,pE=Math.min;function hE(e,t){var r=e[1],n=t[1],i=r|n,o=i<(Ys|fE|Ki),a=n==Ki&&r==Af||n==Ki&&r==Sf&&e[7].length<=t[8]||n==(Ki|Sf)&&t[7].length<=t[8]&&r==Af;if(!(o||a))return e;n&Ys&&(e[2]=t[2],i|=r&Ys?0:dE);var s=t[3];if(s){var u=e[3];e[3]=u?mh(u,s,t[4]):s,e[4]=u?lo(e[3],Of):t[4]}return s=t[5],s&&(u=e[5],e[5]=u?bh(u,s,t[6]):s,e[6]=u?lo(e[5],Of):t[6]),s=t[7],s&&(e[7]=s),n&Ki&&(e[8]=e[8]==null?t[8]:pE(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}var yE=hE,gE="Expected a function",If=1,mE=2,eu=8,tu=16,ru=32,kf=64,$f=Math.max;function bE(e,t,r,n,i,o,a,s){var u=t&mE;if(!u&&typeof e!="function")throw new TypeError(gE);var l=n?n.length:0;if(l||(t&=~(ru|kf),n=i=void 0),a=a===void 0?a:$f(bf(a),0),s=s===void 0?s:bf(s),l-=i?i.length:0,t&kf){var f=n,d=i;n=i=void 0}var I=u?void 0:wh(e),E=[e,t,r,n,i,f,d,o,a,s];if(I&&yE(E,I),e=E[0],t=E[1],r=E[2],n=E[3],i=E[4],s=E[9]=E[9]===void 0?u?0:e.length:$f(E[9]-l,0),!s&&t&(eu|tu)&&(t&=~(eu|tu)),!t||t==If)var _=IT(e,t,r);else t==eu||t==tu?_=sE(e,t,s):(t==ru||t==(If|ru))&&!i.length?_=cE(e,t,r,n):_=Ih.apply(void 0,E);var L=I?gh:Eh;return Oh(L(_,E),e,t)}var vE=bE;function wE(e,t,r){t=="__proto__"&&Da?Da(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var TE=wE;function _E(e,t){return e===t||e!==e&&t!==t}var Dl=_E,EE=Object.prototype,xE=EE.hasOwnProperty;function OE(e,t,r){var n=e[t];(!(xE.call(e,t)&&Dl(n,r))||r===void 0&&!(t in e))&&TE(e,t,r)}var AE=OE,jf=Math.max;function SE(e,t,r){return t=jf(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=jf(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),Nl(e,this,s)}}var kh=SE;function IE(e,t){return Bl(kh(e,t,_s),e+"")}var $h=IE,kE=9007199254740991;function $E(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=kE}var Ml=$E;function jE(e){return e!=null&&Ml(e.length)&&!yh(e)}var jh=jE,CE=Object.prototype;function NE(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||CE;return e===r}var UE=NE;function PE(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var BE=PE,RE="[object Arguments]";function DE(e){return en(e)&&Ai(e)==RE}var Cf=DE,Ch=Object.prototype,ME=Ch.hasOwnProperty,LE=Ch.propertyIsEnumerable,VE=Cf(function(){return arguments}())?Cf:function(e){return en(e)&&ME.call(e,"callee")&&!LE.call(e,"callee")},Ll=VE;function FE(){return!1}var zE=FE,Nh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Nf=Nh&&typeof module=="object"&&module&&!module.nodeType&&module,KE=Nf&&Nf.exports===Nh,Uf=KE?It.Buffer:void 0,qE=Uf?Uf.isBuffer:void 0,GE=qE||zE,Cu=GE,WE="[object Arguments]",HE="[object Array]",JE="[object Boolean]",XE="[object Date]",QE="[object Error]",ZE="[object Function]",YE="[object Map]",ex="[object Number]",tx="[object Object]",rx="[object RegExp]",nx="[object Set]",ix="[object String]",ox="[object WeakMap]",ax="[object ArrayBuffer]",sx="[object DataView]",ux="[object Float32Array]",lx="[object Float64Array]",cx="[object Int8Array]",fx="[object Int16Array]",dx="[object Int32Array]",px="[object Uint8Array]",hx="[object Uint8ClampedArray]",yx="[object Uint16Array]",gx="[object Uint32Array]",Fe={};Fe[ux]=Fe[lx]=Fe[cx]=Fe[fx]=Fe[dx]=Fe[px]=Fe[hx]=Fe[yx]=Fe[gx]=!0;Fe[WE]=Fe[HE]=Fe[ax]=Fe[JE]=Fe[sx]=Fe[XE]=Fe[QE]=Fe[ZE]=Fe[YE]=Fe[ex]=Fe[tx]=Fe[rx]=Fe[nx]=Fe[ix]=Fe[ox]=!1;function mx(e){return en(e)&&Ml(e.length)&&!!Fe[Ai(e)]}var bx=mx;function vx(e){return function(t){return e(t)}}var Uh=vx,Ph=typeof exports=="object"&&exports&&!exports.nodeType&&exports,eo=Ph&&typeof module=="object"&&module&&!module.nodeType&&module,wx=eo&&eo.exports===Ph,nu=wx&&fh.process,Tx=function(){try{var e=eo&&eo.require&&eo.require("util").types;return e||nu&&nu.binding&&nu.binding("util")}catch{}}(),Pf=Tx,Bf=Pf&&Pf.isTypedArray,_x=Bf?Uh(Bf):bx,Bh=_x,Ex=Object.prototype,xx=Ex.hasOwnProperty;function Ox(e,t){var r=lr(e),n=!r&&Ll(e),i=!r&&!n&&Cu(e),o=!r&&!n&&!i&&Bh(e),a=r||n||i||o,s=a?BE(e.length,String):[],u=s.length;for(var l in e)(t||xx.call(e,l))&&!(a&&(l=="length"||i&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||Es(l,u)))&&s.push(l);return s}var Ax=Ox;function Sx(e,t){return function(r){return e(t(r))}}var Ix=Sx,kx=Ix(Object.keys,Object),$x=kx,jx=Object.prototype,Cx=jx.hasOwnProperty;function Nx(e){if(!UE(e))return $x(e);var t=[];for(var r in Object(e))Cx.call(e,r)&&r!="constructor"&&t.push(r);return t}var Ux=Nx;function Px(e){return jh(e)?Ax(e):Ux(e)}var Rh=Px,Bx=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Rx=/^\w*$/;function Dx(e,t){if(lr(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||oi(e)?!0:Rx.test(e)||!Bx.test(e)||t!=null&&e in Object(t)}var Vl=Dx,Mx=Bn(Object,"create"),co=Mx;function Lx(){this.__data__=co?co(null):{},this.size=0}var Vx=Lx;function Fx(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var zx=Fx,Kx="__lodash_hash_undefined__",qx=Object.prototype,Gx=qx.hasOwnProperty;function Wx(e){var t=this.__data__;if(co){var r=t[e];return r===Kx?void 0:r}return Gx.call(t,e)?t[e]:void 0}var Hx=Wx,Jx=Object.prototype,Xx=Jx.hasOwnProperty;function Qx(e){var t=this.__data__;return co?t[e]!==void 0:Xx.call(t,e)}var Zx=Qx,Yx="__lodash_hash_undefined__";function eO(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=co&&t===void 0?Yx:t,this}var tO=eO;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=Vx;Si.prototype.delete=zx;Si.prototype.get=Hx;Si.prototype.has=Zx;Si.prototype.set=tO;var Rf=Si;function rO(){this.__data__=[],this.size=0}var nO=rO;function iO(e,t){for(var r=e.length;r--;)if(Dl(e[r][0],t))return r;return-1}var xs=iO,oO=Array.prototype,aO=oO.splice;function sO(e){var t=this.__data__,r=xs(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():aO.call(t,r,1),--this.size,!0}var uO=sO;function lO(e){var t=this.__data__,r=xs(t,e);return r<0?void 0:t[r][1]}var cO=lO;function fO(e){return xs(this.__data__,e)>-1}var dO=fO;function pO(e,t){var r=this.__data__,n=xs(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var hO=pO;function Ii(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])}}Ii.prototype.clear=nO;Ii.prototype.delete=uO;Ii.prototype.get=cO;Ii.prototype.has=dO;Ii.prototype.set=hO;var Os=Ii,yO=Bn(It,"Map"),fo=yO;function gO(){this.size=0,this.__data__={hash:new Rf,map:new(fo||Os),string:new Rf}}var mO=gO;function bO(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var vO=bO;function wO(e,t){var r=e.__data__;return vO(t)?r[typeof t=="string"?"string":"hash"]:r.map}var As=wO;function TO(e){var t=As(this,e).delete(e);return this.size-=t?1:0,t}var _O=TO;function EO(e){return As(this,e).get(e)}var xO=EO;function OO(e){return As(this,e).has(e)}var AO=OO;function SO(e,t){var r=As(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var IO=SO;function ki(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])}}ki.prototype.clear=mO;ki.prototype.delete=_O;ki.prototype.get=xO;ki.prototype.has=AO;ki.prototype.set=IO;var Ss=ki,kO="Expected a function";function Fl(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(kO);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 a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(Fl.Cache||Ss),r}Fl.Cache=Ss;var $O=Fl,jO=500;function CO(e){var t=$O(e,function(n){return r.size===jO&&r.clear(),n}),r=t.cache;return t}var NO=CO,UO=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,PO=/\\(\\)?/g,BO=NO(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(UO,function(r,n,i,o){t.push(i?o.replace(PO,"$1"):n||r)}),t}),RO=BO;function DO(e){return e==null?"":N2(e)}var MO=DO;function LO(e,t){return lr(e)?e:Vl(e,t)?[e]:RO(MO(e))}var Is=LO,VO=1/0;function FO(e){if(typeof e=="string"||oi(e))return e;var t=e+"";return t=="0"&&1/e==-VO?"-0":t}var Co=FO;function zO(e,t){t=Is(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Co(t[r++])];return r&&r==n?e:void 0}var zl=zO;function KO(e,t,r){var n=e==null?void 0:zl(e,t);return n===void 0?r:n}var qO=KO;function GO(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var Dh=GO,Df=gr?gr.isConcatSpreadable:void 0;function WO(e){return lr(e)||Ll(e)||!!(Df&&e&&e[Df])}var HO=WO;function Mh(e,t,r,n,i){var o=-1,a=e.length;for(r||(r=HO),i||(i=[]);++o<a;){var s=e[o];t>0&&r(s)?t>1?Mh(s,t-1,r,n,i):Dh(i,s):n||(i[i.length]=s)}return i}var JO=Mh;function XO(e){var t=e==null?0:e.length;return t?JO(e,1):[]}var QO=XO;function ZO(e){return Bl(kh(e,void 0,QO),e+"")}var YO=ZO;function eA(){this.__data__=new Os,this.size=0}var tA=eA;function rA(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var nA=rA;function iA(e){return this.__data__.get(e)}var oA=iA;function aA(e){return this.__data__.has(e)}var sA=aA,uA=200;function lA(e,t){var r=this.__data__;if(r instanceof Os){var n=r.__data__;if(!fo||n.length<uA-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ss(n)}return r.set(e,t),this.size=r.size,this}var cA=lA;function $i(e){var t=this.__data__=new Os(e);this.size=t.size}$i.prototype.clear=tA;$i.prototype.delete=nA;$i.prototype.get=oA;$i.prototype.has=sA;$i.prototype.set=cA;var ra=$i;function fA(e,t){for(var r=-1,n=e==null?0:e.length,i=0,o=[];++r<n;){var a=e[r];t(a,r,e)&&(o[i++]=a)}return o}var dA=fA;function pA(){return[]}var hA=pA,yA=Object.prototype,gA=yA.propertyIsEnumerable,Mf=Object.getOwnPropertySymbols,mA=Mf?function(e){return e==null?[]:(e=Object(e),dA(Mf(e),function(t){return gA.call(e,t)}))}:hA,bA=mA;function vA(e,t,r){var n=t(e);return lr(e)?n:Dh(n,r(e))}var wA=vA;function TA(e){return wA(e,Rh,bA)}var Lf=TA,_A=Bn(It,"DataView"),Nu=_A,EA=Bn(It,"Promise"),Uu=EA,xA=Bn(It,"Set"),ti=xA,Vf="[object Map]",OA="[object Object]",Ff="[object Promise]",zf="[object Set]",Kf="[object WeakMap]",qf="[object DataView]",AA=Pn(Nu),SA=Pn(fo),IA=Pn(Uu),kA=Pn(ti),$A=Pn(so),yn=Ai;(Nu&&yn(new Nu(new ArrayBuffer(1)))!=qf||fo&&yn(new fo)!=Vf||Uu&&yn(Uu.resolve())!=Ff||ti&&yn(new ti)!=zf||so&&yn(new so)!=Kf)&&(yn=function(e){var t=Ai(e),r=t==OA?e.constructor:void 0,n=r?Pn(r):"";if(n)switch(n){case AA:return qf;case SA:return Vf;case IA:return Ff;case kA:return zf;case $A:return Kf}return t});var Gf=yn,jA=It.Uint8Array,Wf=jA,CA="__lodash_hash_undefined__";function NA(e){return this.__data__.set(e,CA),this}var UA=NA;function PA(e){return this.__data__.has(e)}var BA=PA;function Ma(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Ss;++t<r;)this.add(e[t])}Ma.prototype.add=Ma.prototype.push=UA;Ma.prototype.has=BA;var Lh=Ma;function RA(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 DA=RA;function MA(e,t){return e.has(t)}var Vh=MA,LA=1,VA=2;function FA(e,t,r,n,i,o){var a=r&LA,s=e.length,u=t.length;if(s!=u&&!(a&&u>s))return!1;var l=o.get(e),f=o.get(t);if(l&&f)return l==t&&f==e;var d=-1,I=!0,E=r&VA?new Lh:void 0;for(o.set(e,t),o.set(t,e);++d<s;){var _=e[d],L=t[d];if(n)var J=a?n(L,_,d,t,e,o):n(_,L,d,e,t,o);if(J!==void 0){if(J)continue;I=!1;break}if(E){if(!DA(t,function(B,k){if(!Vh(E,k)&&(_===B||i(_,B,r,n,o)))return E.push(k)})){I=!1;break}}else if(!(_===L||i(_,L,r,n,o))){I=!1;break}}return o.delete(e),o.delete(t),I}var Fh=FA;function zA(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var KA=zA;function qA(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var zh=qA,GA=1,WA=2,HA="[object Boolean]",JA="[object Date]",XA="[object Error]",QA="[object Map]",ZA="[object Number]",YA="[object RegExp]",eS="[object Set]",tS="[object String]",rS="[object Symbol]",nS="[object ArrayBuffer]",iS="[object DataView]",Hf=gr?gr.prototype:void 0,iu=Hf?Hf.valueOf:void 0;function oS(e,t,r,n,i,o,a){switch(r){case iS:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case nS:return!(e.byteLength!=t.byteLength||!o(new Wf(e),new Wf(t)));case HA:case JA:case ZA:return Dl(+e,+t);case XA:return e.name==t.name&&e.message==t.message;case YA:case tS:return e==t+"";case QA:var s=KA;case eS:var u=n&GA;if(s||(s=zh),e.size!=t.size&&!u)return!1;var l=a.get(e);if(l)return l==t;n|=WA,a.set(e,t);var f=Fh(s(e),s(t),n,i,o,a);return a.delete(e),f;case rS:if(iu)return iu.call(e)==iu.call(t)}return!1}var aS=oS,sS=1,uS=Object.prototype,lS=uS.hasOwnProperty;function cS(e,t,r,n,i,o){var a=r&sS,s=Lf(e),u=s.length,l=Lf(t),f=l.length;if(u!=f&&!a)return!1;for(var d=u;d--;){var I=s[d];if(!(a?I in t:lS.call(t,I)))return!1}var E=o.get(e),_=o.get(t);if(E&&_)return E==t&&_==e;var L=!0;o.set(e,t),o.set(t,e);for(var J=a;++d<u;){I=s[d];var B=e[I],k=t[I];if(n)var F=a?n(k,B,I,t,e,o):n(B,k,I,e,t,o);if(!(F===void 0?B===k||i(B,k,r,n,o):F)){L=!1;break}J||(J=I=="constructor")}if(L&&!J){var q=e.constructor,R=t.constructor;q!=R&&"constructor"in e&&"constructor"in t&&!(typeof q=="function"&&q instanceof q&&typeof R=="function"&&R instanceof R)&&(L=!1)}return o.delete(e),o.delete(t),L}var fS=cS,dS=1,Jf="[object Arguments]",Xf="[object Array]",Jo="[object Object]",pS=Object.prototype,Qf=pS.hasOwnProperty;function hS(e,t,r,n,i,o){var a=lr(e),s=lr(t),u=a?Xf:Gf(e),l=s?Xf:Gf(t);u=u==Jf?Jo:u,l=l==Jf?Jo:l;var f=u==Jo,d=l==Jo,I=u==l;if(I&&Cu(e)){if(!Cu(t))return!1;a=!0,f=!1}if(I&&!f)return o||(o=new ra),a||Bh(e)?Fh(e,t,r,n,i,o):aS(e,t,u,r,n,i,o);if(!(r&dS)){var E=f&&Qf.call(e,"__wrapped__"),_=d&&Qf.call(t,"__wrapped__");if(E||_){var L=E?e.value():e,J=_?t.value():t;return o||(o=new ra),i(L,J,r,n,o)}}return I?(o||(o=new ra),fS(e,t,r,n,i,o)):!1}var yS=hS;function Kh(e,t,r,n,i){return e===t?!0:e==null||t==null||!en(e)&&!en(t)?e!==e&&t!==t:yS(e,t,r,n,Kh,i)}var qh=Kh,gS=1,mS=2;function bS(e,t,r,n){var i=r.length,o=i,a=!n;if(e==null)return!o;for(e=Object(e);i--;){var s=r[i];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){s=r[i];var u=s[0],l=e[u],f=s[1];if(a&&s[2]){if(l===void 0&&!(u in e))return!1}else{var d=new ra;if(n)var I=n(l,f,u,e,t,d);if(!(I===void 0?qh(f,l,gS|mS,n,d):I))return!1}}return!0}var vS=bS;function wS(e){return e===e&&!Ir(e)}var Gh=wS;function TS(e){for(var t=Rh(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Gh(i)]}return t}var _S=TS;function ES(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var Wh=ES;function xS(e){var t=_S(e);return t.length==1&&t[0][2]?Wh(t[0][0],t[0][1]):function(r){return r===e||vS(r,e,t)}}var OS=xS;function AS(e,t){return e!=null&&t in Object(e)}var SS=AS;function IS(e,t,r){t=Is(t,e);for(var n=-1,i=t.length,o=!1;++n<i;){var a=Co(t[n]);if(!(o=e!=null&&r(e,a)))break;e=e[a]}return o||++n!=i?o:(i=e==null?0:e.length,!!i&&Ml(i)&&Es(a,i)&&(lr(e)||Ll(e)))}var kS=IS;function $S(e,t){return e!=null&&kS(e,t,SS)}var Hh=$S,jS=1,CS=2;function NS(e,t){return Vl(e)&&Gh(t)?Wh(Co(e),t):function(r){var n=qO(r,e);return n===void 0&&n===t?Hh(r,e):qh(t,n,jS|CS)}}var US=NS;function PS(e){return function(t){return t?.[e]}}var BS=PS;function RS(e){return function(t){return zl(t,e)}}var DS=RS;function MS(e){return Vl(e)?BS(Co(e)):DS(e)}var LS=MS;function VS(e){return typeof e=="function"?e:e==null?_s:typeof e=="object"?lr(e)?US(e[0],e[1]):OS(e):LS(e)}var FS=VS;function zS(e){return en(e)&&jh(e)}var KS=zS;function qS(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 GS=qS,WS=200;function HS(e,t,r,n){var i=-1,o=xh,a=!0,s=e.length,u=[],l=t.length;if(!s)return u;r&&(t=ph(t,Uh(r))),n?(o=GS,a=!1):t.length>=WS&&(o=Vh,a=!1,t=new Lh(t));e:for(;++i<s;){var f=e[i],d=r==null?f:r(f);if(f=n||f!==0?f:0,a&&d===d){for(var I=l;I--;)if(t[I]===d)continue e;u.push(f)}else o(t,d,n)||u.push(f)}return u}var JS=HS;function XS(e,t,r,n){if(!Ir(e))return e;t=Is(t,e);for(var i=-1,o=t.length,a=o-1,s=e;s!=null&&++i<o;){var u=Co(t[i]),l=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return e;if(i!=a){var f=s[u];l=n?n(f,u,s):void 0,l===void 0&&(l=Ir(f)?f:Es(t[i+1])?[]:{})}AE(s,u,l),s=s[u]}return e}var QS=XS;function ZS(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var a=t[n],s=zl(e,a);r(s,a)&&QS(o,Is(a,e),s)}return o}var YS=ZS,eI=32,Kl=$h(function(e,t){var r=lo(t,Rl(Kl));return vE(e,eI,void 0,t,r)});Kl.placeholder={};var tI=Kl;function rI(e,t){return YS(e,t,function(r,n){return Hh(e,n)})}var nI=rI,iI=YO(function(e,t){return e==null?{}:nI(e,t)}),Zf=iI,oI=4294967295,aI=oI-1,sI=Math.floor,uI=Math.min;function lI(e,t,r,n){var i=0,o=e==null?0:e.length;if(o===0)return 0;t=r(t);for(var a=t!==t,s=t===null,u=oi(t),l=t===void 0;i<o;){var f=sI((i+o)/2),d=r(e[f]),I=d!==void 0,E=d===null,_=d===d,L=oi(d);if(a)var J=n||_;else l?J=_&&(n||I):s?J=_&&I&&(n||!E):u?J=_&&I&&!E&&(n||!L):E||L?J=!1:J=n?d<=t:d<t;J?i=f+1:o=f}return uI(o,aI)}var cI=lI;function fI(e,t,r){return cI(e,t,FS(r,2))}var dI=fI,pI=1/0,ZN=ti&&1/zh(new ti([,-0]))[1]==pI?function(e){return new ti(e)}:vh,hI=$h(function(e,t){return KS(e)?JS(e,t):[]}),Yf=hI,Jh=Nr(i2(),1),YN=Jh.default.configure,po=Jh.default,ou=100,{WARN:yI,LOG:eU,DEBUG:nt,VERBOSE:Ae,ERROR:tU}=Ce.setup(Ce.INFO),La=Ke.set();bw({enforceActions:"always"});if(!new class{xyz}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");var Ye=({caller:e,thread:t,pattern:r,args:n})=>ze(()=>(n=n||r,`${!Array.isArray(t)&&t?.name?t.name+" | ":""}${e??"caller?"}${n?`{${typeof n=="string"?n:po(n)}}`:""}`));function gI(e,t){return ze(()=>et.structural(e.get(),t.get()))}function No(e,t){return et.shallow(e.applogs,t.applogs)}function ql(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(Ae.isEnabled&&Ae("queryNodesComparer",r,n,i),!et.structural(n.variables,i.variables))return Ae.isEnabled&&Ae("[queryNodesComparer] changed vars:",r,n,i),!1;if(!No(n.logsOfThisNode,i.logsOfThisNode))return Ae.isEnabled&&Ae("[queryNodesComparer] changed logsOfThisNode:",r,n,i),!1}return Ae.isEnabled&&Ae("[queryNodesComparer] equal:",{a:e,b:t}),!0}var mI=0;function nr(e,{name:t,equals:r}={}){let n=`observableArrayMap@${++mI}{${t}}`;Ae.isEnabled&&Ae(`[${n}] create`,{fnname:e.name,fn:e,name:t,equals:r});let i,o=Xh(e,s=>{i?ze(()=>(r??et.structural)(i,s))?nt.isEnabled&&nt(`[${n}] update skipped`,{updatedItems:s,observableArr:i}):(i.replace(s),nt.isEnabled&&nt(`[${n}] updated`,{updatedItems:s,observableArr:i})):i=Ke.array(s,{deep:!1,name:t,equals:r})},{name:n});if(n.includes("useRoots")){var a=ur(i);nt(`[${n}] deps`,{disposeAutorun:o,rootsAtom:a,observableArr:i,observers:Ia(i)}),oo(()=>La.add(a))}return Ae.isEnabled&&bs(i,()=>{Ae(`[${n}] observed`,Ia(i),{rootsAtom:a,observableArr:i})}),wi(i,()=>{Ae.isEnabled&&Ae(`[${n}] dispose`),a&&oo(()=>La.delete(a)),o()}),i}var bI=0;function vI(e,{name:t}={}){let r=`observableSetMap@${++bI}{${t}}`;Ae.isEnabled&&Ae(`[${r}] create`,{fnname:e.name,fn:e,name:t});let n,i=Xh(e,a=>{if(!n)n=Ke.set(a,{deep:!1,name:t});else{let{deleted:s,added:u}=ze(()=>{let l=new Set(n.values()),f=new Set;for(let d of a)n.has(d)?(Ae.isEnabled&&Ae(`[${r}] unchanged`,d,{updatedItems:a,observableSet:n}),l.delete(d)):f.add(d);return nt.isEnabled&&nt(`[${r}] updated:`,{unseen:l,added:f,updatedItems:a,observableSet:n}),{added:f,deleted:l}});for(let l of s)n.delete(l);for(let l of u)n.add(l)}},{name:r});if(r.includes("useRoots")){var o=ur(n);nt.isEnabled&&nt(`[${r}] deps`,{disposeAutorun:i,rootsAtom:o,observableSet:n,observers:Ia(n)}),oo(()=>La.add(o))}return Ae.isEnabled&&bs(n,()=>{Ae(`[${r}] observed`,Ia(n),{rootsAtom:o,observableSet:n})}),wi(n,()=>{Ae.isEnabled&&Ae(`[${r}] dispose`),o&&oo(()=>La.delete(o)),i()}),n}function Xh(e,t=null,{name:r}={}){nt.isEnabled&&nt("[autorunButAlsoImmediately] create",{fnname:e.name,fn:e,name:r});let n=`${r}.autorunImm`,i,o=new yr(n,function(...s){nt.isEnabled&&nt(`[${n}] reaction.invalidate`,s),a()});function a(){o.track(function(){let s=ou&&performance.now();nt.isEnabled&&nt(`[${n}] runAndTrack:`,{name:r??e.name,fn:e}),i=e(),nt.isEnabled&&nt(`[${n}] runAndTrack =>`,i),oo(()=>{t?.(i)}),ou&&performance.now()-s>ou&&yI(`[${n}] took ${performance.now()-s}ms`)})}return a(),nt.isEnabled&&nt(`[${n}] deps of reaction`,{reaction:o,result:i,deps:vs(o)}),()=>{Ae.isEnabled&&Ae(`[${n}] dispose`),setTimeout(()=>o.dispose())}}function at(e,t,r=!1){if(wn(t))throw new Error("computedFnDeepCompare shouldn't be used on actions");let n=!1,i=0,o=typeof r=="boolean"?{keepAlive:r}:r,a=new Map;return function(...s){let u,l=ze(()=>{let E=s;for(let _=0;_<s.length;_++)s[_]instanceof ai&&s===E&&(E=s.slice());return E}),f=`computedFnDeepCompare(${e||t.name}#${++i})${o.argsDebugName?`{${o.argsDebugName(...s)}}`:""}`;for(let[E,_]of a.entries())if(TI(E,l)){u=_;break}else if(Ae.isEnabled)for(let L=0;L<E.length;L++)E[L]instanceof ai&&E[L].name===s[L].name&&et.structural(Yf(E,E[L]),Yf(l,l[L]))&&Ae.force(`[${f}] threadState mismatch => cachebust`,{diffFields:Object.keys(E[L]).filter(J=>!et.structural(E[L][J],s[L][J])),cacheArg:E[L],freshArg:s[L]});if(u){let E=u.get();return Ae.isEnabled&&Ae(`[${f}] cache hit`,{untrackedArgs:l,cachedResult:E}),E}if(!o.keepAlive&&!G1())return!n&&Q1().computedRequiresReaction&&(console.warn("invoking a computedFn from outside an reactive context won't be memoized, unless keepAlive is set"),n=!0),t.apply(this,s);Ae.isEnabled&&Ae(`[${f}] new computation`,{untrackedArgs:l});let d,I=Ze(()=>(Ae.isEnabled&&Ae(`[${f}] update->rerun`,ze(()=>({args:s})),t),Ae.isEnabled&&Jp(),d=t.apply(this,s)),{...o,name:f});if(Ae.isEnabled&&Ae(`[${f}] deps`,vs(I),{untrackedArgs:l}),a.set(l,I),!o.keepAlive){let E=wi(I,()=>{Ae.isEnabled&&Ae(`[${f}] dispose`,I),E(),a.delete(l),o.onCleanup&&o.onCleanup(d,...s),d=void 0})}return I.get()}}function wI(e){let t=0,r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("?r+=o+`
56
+ `)}var c_=l_;function f_(e){return function(){return e}}var d_=f_,p_=function(){try{var e=Bn(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Da=p_,h_=Da?function(e,t){return Da(e,"toString",{configurable:!0,enumerable:!1,value:d_(t),writable:!0})}:_s,y_=h_,g_=_h(y_),Bl=g_;function m_(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var b_=m_;function v_(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 w_=v_;function T_(e){return e!==e}var __=T_;function E_(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}var x_=E_;function O_(e,t,r){return t===t?x_(e,t,r):w_(e,__,r)}var A_=O_;function S_(e,t){var r=e==null?0:e.length;return!!r&&A_(e,t,0)>-1}var xh=S_,I_=1,k_=2,$_=8,j_=16,C_=32,N_=64,U_=128,P_=256,B_=512,R_=[["ary",U_],["bind",I_],["bindKey",k_],["curry",$_],["curryRight",j_],["flip",B_],["partial",C_],["partialRight",N_],["rearg",P_]];function D_(e,t){return b_(R_,function(r){var n="_."+r[0];t&r[1]&&!xh(e,n)&&e.push(n)}),e.sort()}var M_=D_;function L_(e,t,r){var n=t+"";return Bl(e,c_(n,M_(s_(n),r)))}var Oh=L_,V_=1,F_=2,z_=4,K_=8,_f=32,Ef=64;function G_(e,t,r,n,i,o,a,s,u,l){var f=t&K_,d=f?a:void 0,I=f?void 0:a,E=f?o:void 0,_=f?void 0:o;t|=f?_f:Ef,t&=~(f?Ef:_f),t&z_||(t&=~(V_|F_));var L=[e,t,i,E,d,_,I,s,u,l],J=r.apply(void 0,L);return ZT(e)&&Eh(J,L),J.placeholder=n,Oh(J,e,t)}var Ah=G_;function q_(e){var t=e;return t.placeholder}var Rl=q_,W_=9007199254740991,H_=/^(?:0|[1-9]\d*)$/;function J_(e,t){var r=typeof e;return t=t??W_,!!t&&(r=="number"||r!="symbol"&&H_.test(e))&&e>-1&&e%1==0&&e<t}var Es=J_,X_=Math.min;function Q_(e,t){for(var r=e.length,n=X_(t.length,r),i=Th(e);n--;){var o=t[n];e[n]=Es(o,r)?i[o]:void 0}return e}var Z_=Q_,xf="__lodash_placeholder__";function Y_(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r];(a===t||a===xf)&&(e[r]=xf,o[i++]=r)}return o}var lo=Y_,eE=1,tE=2,rE=8,nE=16,iE=128,oE=512;function Sh(e,t,r,n,i,o,a,s,u,l){var f=t&iE,d=t&eE,I=t&tE,E=t&(rE|nE),_=t&oE,L=I?void 0:uo(e);function J(){for(var B=arguments.length,k=Array(B),F=B;F--;)k[F]=arguments[F];if(E)var G=Rl(J),R=PT(k,G);if(n&&(k=mh(k,n,i,E)),o&&(k=bh(k,o,a,E)),B-=R,E&&B<l){var Q=lo(k,G);return Ah(e,t,Sh,J.placeholder,r,k,Q,s,u,l-B)}var K=d?r:this,re=I?K[e]:e;return B=k.length,s?k=Z_(k,s):_&&B>1&&k.reverse(),f&&u<B&&(k.length=u),this&&this!==It&&this instanceof J&&(re=L||uo(re)),re.apply(K,k)}return J}var Ih=Sh;function aE(e,t,r){var n=uo(e);function i(){for(var o=arguments.length,a=Array(o),s=o,u=Rl(i);s--;)a[s]=arguments[s];var l=o<3&&a[0]!==u&&a[o-1]!==u?[]:lo(a,u);if(o-=l.length,o<r)return Ah(e,t,Ih,i.placeholder,void 0,a,l,void 0,void 0,r-o);var f=this&&this!==It&&this instanceof i?n:e;return Nl(f,this,a)}return i}var sE=aE,uE=1;function lE(e,t,r,n){var i=t&uE,o=uo(e);function a(){for(var s=-1,u=arguments.length,l=-1,f=n.length,d=Array(f+u),I=this&&this!==It&&this instanceof a?o:e;++l<f;)d[l]=n[l];for(;u--;)d[l++]=arguments[++s];return Nl(I,i?r:this,d)}return a}var cE=lE,Of="__lodash_placeholder__",Ys=1,fE=2,dE=4,Af=8,Ki=128,Sf=256,pE=Math.min;function hE(e,t){var r=e[1],n=t[1],i=r|n,o=i<(Ys|fE|Ki),a=n==Ki&&r==Af||n==Ki&&r==Sf&&e[7].length<=t[8]||n==(Ki|Sf)&&t[7].length<=t[8]&&r==Af;if(!(o||a))return e;n&Ys&&(e[2]=t[2],i|=r&Ys?0:dE);var s=t[3];if(s){var u=e[3];e[3]=u?mh(u,s,t[4]):s,e[4]=u?lo(e[3],Of):t[4]}return s=t[5],s&&(u=e[5],e[5]=u?bh(u,s,t[6]):s,e[6]=u?lo(e[5],Of):t[6]),s=t[7],s&&(e[7]=s),n&Ki&&(e[8]=e[8]==null?t[8]:pE(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}var yE=hE,gE="Expected a function",If=1,mE=2,eu=8,tu=16,ru=32,kf=64,$f=Math.max;function bE(e,t,r,n,i,o,a,s){var u=t&mE;if(!u&&typeof e!="function")throw new TypeError(gE);var l=n?n.length:0;if(l||(t&=~(ru|kf),n=i=void 0),a=a===void 0?a:$f(bf(a),0),s=s===void 0?s:bf(s),l-=i?i.length:0,t&kf){var f=n,d=i;n=i=void 0}var I=u?void 0:wh(e),E=[e,t,r,n,i,f,d,o,a,s];if(I&&yE(E,I),e=E[0],t=E[1],r=E[2],n=E[3],i=E[4],s=E[9]=E[9]===void 0?u?0:e.length:$f(E[9]-l,0),!s&&t&(eu|tu)&&(t&=~(eu|tu)),!t||t==If)var _=IT(e,t,r);else t==eu||t==tu?_=sE(e,t,s):(t==ru||t==(If|ru))&&!i.length?_=cE(e,t,r,n):_=Ih.apply(void 0,E);var L=I?gh:Eh;return Oh(L(_,E),e,t)}var vE=bE;function wE(e,t,r){t=="__proto__"&&Da?Da(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var TE=wE;function _E(e,t){return e===t||e!==e&&t!==t}var Dl=_E,EE=Object.prototype,xE=EE.hasOwnProperty;function OE(e,t,r){var n=e[t];(!(xE.call(e,t)&&Dl(n,r))||r===void 0&&!(t in e))&&TE(e,t,r)}var AE=OE,jf=Math.max;function SE(e,t,r){return t=jf(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=jf(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),Nl(e,this,s)}}var kh=SE;function IE(e,t){return Bl(kh(e,t,_s),e+"")}var $h=IE,kE=9007199254740991;function $E(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=kE}var Ml=$E;function jE(e){return e!=null&&Ml(e.length)&&!yh(e)}var jh=jE,CE=Object.prototype;function NE(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||CE;return e===r}var UE=NE;function PE(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var BE=PE,RE="[object Arguments]";function DE(e){return en(e)&&Ai(e)==RE}var Cf=DE,Ch=Object.prototype,ME=Ch.hasOwnProperty,LE=Ch.propertyIsEnumerable,VE=Cf(function(){return arguments}())?Cf:function(e){return en(e)&&ME.call(e,"callee")&&!LE.call(e,"callee")},Ll=VE;function FE(){return!1}var zE=FE,Nh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Nf=Nh&&typeof module=="object"&&module&&!module.nodeType&&module,KE=Nf&&Nf.exports===Nh,Uf=KE?It.Buffer:void 0,GE=Uf?Uf.isBuffer:void 0,qE=GE||zE,Cu=qE,WE="[object Arguments]",HE="[object Array]",JE="[object Boolean]",XE="[object Date]",QE="[object Error]",ZE="[object Function]",YE="[object Map]",ex="[object Number]",tx="[object Object]",rx="[object RegExp]",nx="[object Set]",ix="[object String]",ox="[object WeakMap]",ax="[object ArrayBuffer]",sx="[object DataView]",ux="[object Float32Array]",lx="[object Float64Array]",cx="[object Int8Array]",fx="[object Int16Array]",dx="[object Int32Array]",px="[object Uint8Array]",hx="[object Uint8ClampedArray]",yx="[object Uint16Array]",gx="[object Uint32Array]",Fe={};Fe[ux]=Fe[lx]=Fe[cx]=Fe[fx]=Fe[dx]=Fe[px]=Fe[hx]=Fe[yx]=Fe[gx]=!0;Fe[WE]=Fe[HE]=Fe[ax]=Fe[JE]=Fe[sx]=Fe[XE]=Fe[QE]=Fe[ZE]=Fe[YE]=Fe[ex]=Fe[tx]=Fe[rx]=Fe[nx]=Fe[ix]=Fe[ox]=!1;function mx(e){return en(e)&&Ml(e.length)&&!!Fe[Ai(e)]}var bx=mx;function vx(e){return function(t){return e(t)}}var Uh=vx,Ph=typeof exports=="object"&&exports&&!exports.nodeType&&exports,eo=Ph&&typeof module=="object"&&module&&!module.nodeType&&module,wx=eo&&eo.exports===Ph,nu=wx&&fh.process,Tx=function(){try{var e=eo&&eo.require&&eo.require("util").types;return e||nu&&nu.binding&&nu.binding("util")}catch{}}(),Pf=Tx,Bf=Pf&&Pf.isTypedArray,_x=Bf?Uh(Bf):bx,Bh=_x,Ex=Object.prototype,xx=Ex.hasOwnProperty;function Ox(e,t){var r=lr(e),n=!r&&Ll(e),i=!r&&!n&&Cu(e),o=!r&&!n&&!i&&Bh(e),a=r||n||i||o,s=a?BE(e.length,String):[],u=s.length;for(var l in e)(t||xx.call(e,l))&&!(a&&(l=="length"||i&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||Es(l,u)))&&s.push(l);return s}var Ax=Ox;function Sx(e,t){return function(r){return e(t(r))}}var Ix=Sx,kx=Ix(Object.keys,Object),$x=kx,jx=Object.prototype,Cx=jx.hasOwnProperty;function Nx(e){if(!UE(e))return $x(e);var t=[];for(var r in Object(e))Cx.call(e,r)&&r!="constructor"&&t.push(r);return t}var Ux=Nx;function Px(e){return jh(e)?Ax(e):Ux(e)}var Rh=Px,Bx=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Rx=/^\w*$/;function Dx(e,t){if(lr(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||oi(e)?!0:Rx.test(e)||!Bx.test(e)||t!=null&&e in Object(t)}var Vl=Dx,Mx=Bn(Object,"create"),co=Mx;function Lx(){this.__data__=co?co(null):{},this.size=0}var Vx=Lx;function Fx(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var zx=Fx,Kx="__lodash_hash_undefined__",Gx=Object.prototype,qx=Gx.hasOwnProperty;function Wx(e){var t=this.__data__;if(co){var r=t[e];return r===Kx?void 0:r}return qx.call(t,e)?t[e]:void 0}var Hx=Wx,Jx=Object.prototype,Xx=Jx.hasOwnProperty;function Qx(e){var t=this.__data__;return co?t[e]!==void 0:Xx.call(t,e)}var Zx=Qx,Yx="__lodash_hash_undefined__";function eO(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=co&&t===void 0?Yx:t,this}var tO=eO;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=Vx;Si.prototype.delete=zx;Si.prototype.get=Hx;Si.prototype.has=Zx;Si.prototype.set=tO;var Rf=Si;function rO(){this.__data__=[],this.size=0}var nO=rO;function iO(e,t){for(var r=e.length;r--;)if(Dl(e[r][0],t))return r;return-1}var xs=iO,oO=Array.prototype,aO=oO.splice;function sO(e){var t=this.__data__,r=xs(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():aO.call(t,r,1),--this.size,!0}var uO=sO;function lO(e){var t=this.__data__,r=xs(t,e);return r<0?void 0:t[r][1]}var cO=lO;function fO(e){return xs(this.__data__,e)>-1}var dO=fO;function pO(e,t){var r=this.__data__,n=xs(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var hO=pO;function Ii(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])}}Ii.prototype.clear=nO;Ii.prototype.delete=uO;Ii.prototype.get=cO;Ii.prototype.has=dO;Ii.prototype.set=hO;var Os=Ii,yO=Bn(It,"Map"),fo=yO;function gO(){this.size=0,this.__data__={hash:new Rf,map:new(fo||Os),string:new Rf}}var mO=gO;function bO(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var vO=bO;function wO(e,t){var r=e.__data__;return vO(t)?r[typeof t=="string"?"string":"hash"]:r.map}var As=wO;function TO(e){var t=As(this,e).delete(e);return this.size-=t?1:0,t}var _O=TO;function EO(e){return As(this,e).get(e)}var xO=EO;function OO(e){return As(this,e).has(e)}var AO=OO;function SO(e,t){var r=As(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var IO=SO;function ki(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])}}ki.prototype.clear=mO;ki.prototype.delete=_O;ki.prototype.get=xO;ki.prototype.has=AO;ki.prototype.set=IO;var Ss=ki,kO="Expected a function";function Fl(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(kO);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 a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(Fl.Cache||Ss),r}Fl.Cache=Ss;var $O=Fl,jO=500;function CO(e){var t=$O(e,function(n){return r.size===jO&&r.clear(),n}),r=t.cache;return t}var NO=CO,UO=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,PO=/\\(\\)?/g,BO=NO(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(UO,function(r,n,i,o){t.push(i?o.replace(PO,"$1"):n||r)}),t}),RO=BO;function DO(e){return e==null?"":N2(e)}var MO=DO;function LO(e,t){return lr(e)?e:Vl(e,t)?[e]:RO(MO(e))}var Is=LO,VO=1/0;function FO(e){if(typeof e=="string"||oi(e))return e;var t=e+"";return t=="0"&&1/e==-VO?"-0":t}var Co=FO;function zO(e,t){t=Is(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Co(t[r++])];return r&&r==n?e:void 0}var zl=zO;function KO(e,t,r){var n=e==null?void 0:zl(e,t);return n===void 0?r:n}var GO=KO;function qO(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var Dh=qO,Df=gr?gr.isConcatSpreadable:void 0;function WO(e){return lr(e)||Ll(e)||!!(Df&&e&&e[Df])}var HO=WO;function Mh(e,t,r,n,i){var o=-1,a=e.length;for(r||(r=HO),i||(i=[]);++o<a;){var s=e[o];t>0&&r(s)?t>1?Mh(s,t-1,r,n,i):Dh(i,s):n||(i[i.length]=s)}return i}var JO=Mh;function XO(e){var t=e==null?0:e.length;return t?JO(e,1):[]}var QO=XO;function ZO(e){return Bl(kh(e,void 0,QO),e+"")}var YO=ZO;function eA(){this.__data__=new Os,this.size=0}var tA=eA;function rA(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var nA=rA;function iA(e){return this.__data__.get(e)}var oA=iA;function aA(e){return this.__data__.has(e)}var sA=aA,uA=200;function lA(e,t){var r=this.__data__;if(r instanceof Os){var n=r.__data__;if(!fo||n.length<uA-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ss(n)}return r.set(e,t),this.size=r.size,this}var cA=lA;function $i(e){var t=this.__data__=new Os(e);this.size=t.size}$i.prototype.clear=tA;$i.prototype.delete=nA;$i.prototype.get=oA;$i.prototype.has=sA;$i.prototype.set=cA;var ra=$i;function fA(e,t){for(var r=-1,n=e==null?0:e.length,i=0,o=[];++r<n;){var a=e[r];t(a,r,e)&&(o[i++]=a)}return o}var dA=fA;function pA(){return[]}var hA=pA,yA=Object.prototype,gA=yA.propertyIsEnumerable,Mf=Object.getOwnPropertySymbols,mA=Mf?function(e){return e==null?[]:(e=Object(e),dA(Mf(e),function(t){return gA.call(e,t)}))}:hA,bA=mA;function vA(e,t,r){var n=t(e);return lr(e)?n:Dh(n,r(e))}var wA=vA;function TA(e){return wA(e,Rh,bA)}var Lf=TA,_A=Bn(It,"DataView"),Nu=_A,EA=Bn(It,"Promise"),Uu=EA,xA=Bn(It,"Set"),ti=xA,Vf="[object Map]",OA="[object Object]",Ff="[object Promise]",zf="[object Set]",Kf="[object WeakMap]",Gf="[object DataView]",AA=Pn(Nu),SA=Pn(fo),IA=Pn(Uu),kA=Pn(ti),$A=Pn(so),yn=Ai;(Nu&&yn(new Nu(new ArrayBuffer(1)))!=Gf||fo&&yn(new fo)!=Vf||Uu&&yn(Uu.resolve())!=Ff||ti&&yn(new ti)!=zf||so&&yn(new so)!=Kf)&&(yn=function(e){var t=Ai(e),r=t==OA?e.constructor:void 0,n=r?Pn(r):"";if(n)switch(n){case AA:return Gf;case SA:return Vf;case IA:return Ff;case kA:return zf;case $A:return Kf}return t});var qf=yn,jA=It.Uint8Array,Wf=jA,CA="__lodash_hash_undefined__";function NA(e){return this.__data__.set(e,CA),this}var UA=NA;function PA(e){return this.__data__.has(e)}var BA=PA;function Ma(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Ss;++t<r;)this.add(e[t])}Ma.prototype.add=Ma.prototype.push=UA;Ma.prototype.has=BA;var Lh=Ma;function RA(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 DA=RA;function MA(e,t){return e.has(t)}var Vh=MA,LA=1,VA=2;function FA(e,t,r,n,i,o){var a=r&LA,s=e.length,u=t.length;if(s!=u&&!(a&&u>s))return!1;var l=o.get(e),f=o.get(t);if(l&&f)return l==t&&f==e;var d=-1,I=!0,E=r&VA?new Lh:void 0;for(o.set(e,t),o.set(t,e);++d<s;){var _=e[d],L=t[d];if(n)var J=a?n(L,_,d,t,e,o):n(_,L,d,e,t,o);if(J!==void 0){if(J)continue;I=!1;break}if(E){if(!DA(t,function(B,k){if(!Vh(E,k)&&(_===B||i(_,B,r,n,o)))return E.push(k)})){I=!1;break}}else if(!(_===L||i(_,L,r,n,o))){I=!1;break}}return o.delete(e),o.delete(t),I}var Fh=FA;function zA(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var KA=zA;function GA(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var zh=GA,qA=1,WA=2,HA="[object Boolean]",JA="[object Date]",XA="[object Error]",QA="[object Map]",ZA="[object Number]",YA="[object RegExp]",eS="[object Set]",tS="[object String]",rS="[object Symbol]",nS="[object ArrayBuffer]",iS="[object DataView]",Hf=gr?gr.prototype:void 0,iu=Hf?Hf.valueOf:void 0;function oS(e,t,r,n,i,o,a){switch(r){case iS:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case nS:return!(e.byteLength!=t.byteLength||!o(new Wf(e),new Wf(t)));case HA:case JA:case ZA:return Dl(+e,+t);case XA:return e.name==t.name&&e.message==t.message;case YA:case tS:return e==t+"";case QA:var s=KA;case eS:var u=n&qA;if(s||(s=zh),e.size!=t.size&&!u)return!1;var l=a.get(e);if(l)return l==t;n|=WA,a.set(e,t);var f=Fh(s(e),s(t),n,i,o,a);return a.delete(e),f;case rS:if(iu)return iu.call(e)==iu.call(t)}return!1}var aS=oS,sS=1,uS=Object.prototype,lS=uS.hasOwnProperty;function cS(e,t,r,n,i,o){var a=r&sS,s=Lf(e),u=s.length,l=Lf(t),f=l.length;if(u!=f&&!a)return!1;for(var d=u;d--;){var I=s[d];if(!(a?I in t:lS.call(t,I)))return!1}var E=o.get(e),_=o.get(t);if(E&&_)return E==t&&_==e;var L=!0;o.set(e,t),o.set(t,e);for(var J=a;++d<u;){I=s[d];var B=e[I],k=t[I];if(n)var F=a?n(k,B,I,t,e,o):n(B,k,I,e,t,o);if(!(F===void 0?B===k||i(B,k,r,n,o):F)){L=!1;break}J||(J=I=="constructor")}if(L&&!J){var G=e.constructor,R=t.constructor;G!=R&&"constructor"in e&&"constructor"in t&&!(typeof G=="function"&&G instanceof G&&typeof R=="function"&&R instanceof R)&&(L=!1)}return o.delete(e),o.delete(t),L}var fS=cS,dS=1,Jf="[object Arguments]",Xf="[object Array]",Jo="[object Object]",pS=Object.prototype,Qf=pS.hasOwnProperty;function hS(e,t,r,n,i,o){var a=lr(e),s=lr(t),u=a?Xf:qf(e),l=s?Xf:qf(t);u=u==Jf?Jo:u,l=l==Jf?Jo:l;var f=u==Jo,d=l==Jo,I=u==l;if(I&&Cu(e)){if(!Cu(t))return!1;a=!0,f=!1}if(I&&!f)return o||(o=new ra),a||Bh(e)?Fh(e,t,r,n,i,o):aS(e,t,u,r,n,i,o);if(!(r&dS)){var E=f&&Qf.call(e,"__wrapped__"),_=d&&Qf.call(t,"__wrapped__");if(E||_){var L=E?e.value():e,J=_?t.value():t;return o||(o=new ra),i(L,J,r,n,o)}}return I?(o||(o=new ra),fS(e,t,r,n,i,o)):!1}var yS=hS;function Kh(e,t,r,n,i){return e===t?!0:e==null||t==null||!en(e)&&!en(t)?e!==e&&t!==t:yS(e,t,r,n,Kh,i)}var Gh=Kh,gS=1,mS=2;function bS(e,t,r,n){var i=r.length,o=i,a=!n;if(e==null)return!o;for(e=Object(e);i--;){var s=r[i];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){s=r[i];var u=s[0],l=e[u],f=s[1];if(a&&s[2]){if(l===void 0&&!(u in e))return!1}else{var d=new ra;if(n)var I=n(l,f,u,e,t,d);if(!(I===void 0?Gh(f,l,gS|mS,n,d):I))return!1}}return!0}var vS=bS;function wS(e){return e===e&&!Ir(e)}var qh=wS;function TS(e){for(var t=Rh(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,qh(i)]}return t}var _S=TS;function ES(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var Wh=ES;function xS(e){var t=_S(e);return t.length==1&&t[0][2]?Wh(t[0][0],t[0][1]):function(r){return r===e||vS(r,e,t)}}var OS=xS;function AS(e,t){return e!=null&&t in Object(e)}var SS=AS;function IS(e,t,r){t=Is(t,e);for(var n=-1,i=t.length,o=!1;++n<i;){var a=Co(t[n]);if(!(o=e!=null&&r(e,a)))break;e=e[a]}return o||++n!=i?o:(i=e==null?0:e.length,!!i&&Ml(i)&&Es(a,i)&&(lr(e)||Ll(e)))}var kS=IS;function $S(e,t){return e!=null&&kS(e,t,SS)}var Hh=$S,jS=1,CS=2;function NS(e,t){return Vl(e)&&qh(t)?Wh(Co(e),t):function(r){var n=GO(r,e);return n===void 0&&n===t?Hh(r,e):Gh(t,n,jS|CS)}}var US=NS;function PS(e){return function(t){return t?.[e]}}var BS=PS;function RS(e){return function(t){return zl(t,e)}}var DS=RS;function MS(e){return Vl(e)?BS(Co(e)):DS(e)}var LS=MS;function VS(e){return typeof e=="function"?e:e==null?_s:typeof e=="object"?lr(e)?US(e[0],e[1]):OS(e):LS(e)}var FS=VS;function zS(e){return en(e)&&jh(e)}var KS=zS;function GS(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 qS=GS,WS=200;function HS(e,t,r,n){var i=-1,o=xh,a=!0,s=e.length,u=[],l=t.length;if(!s)return u;r&&(t=ph(t,Uh(r))),n?(o=qS,a=!1):t.length>=WS&&(o=Vh,a=!1,t=new Lh(t));e:for(;++i<s;){var f=e[i],d=r==null?f:r(f);if(f=n||f!==0?f:0,a&&d===d){for(var I=l;I--;)if(t[I]===d)continue e;u.push(f)}else o(t,d,n)||u.push(f)}return u}var JS=HS;function XS(e,t,r,n){if(!Ir(e))return e;t=Is(t,e);for(var i=-1,o=t.length,a=o-1,s=e;s!=null&&++i<o;){var u=Co(t[i]),l=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return e;if(i!=a){var f=s[u];l=n?n(f,u,s):void 0,l===void 0&&(l=Ir(f)?f:Es(t[i+1])?[]:{})}AE(s,u,l),s=s[u]}return e}var QS=XS;function ZS(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var a=t[n],s=zl(e,a);r(s,a)&&QS(o,Is(a,e),s)}return o}var YS=ZS,eI=32,Kl=$h(function(e,t){var r=lo(t,Rl(Kl));return vE(e,eI,void 0,t,r)});Kl.placeholder={};var tI=Kl;function rI(e,t){return YS(e,t,function(r,n){return Hh(e,n)})}var nI=rI,iI=YO(function(e,t){return e==null?{}:nI(e,t)}),Zf=iI,oI=4294967295,aI=oI-1,sI=Math.floor,uI=Math.min;function lI(e,t,r,n){var i=0,o=e==null?0:e.length;if(o===0)return 0;t=r(t);for(var a=t!==t,s=t===null,u=oi(t),l=t===void 0;i<o;){var f=sI((i+o)/2),d=r(e[f]),I=d!==void 0,E=d===null,_=d===d,L=oi(d);if(a)var J=n||_;else l?J=_&&(n||I):s?J=_&&I&&(n||!E):u?J=_&&I&&!E&&(n||!L):E||L?J=!1:J=n?d<=t:d<t;J?i=f+1:o=f}return uI(o,aI)}var cI=lI;function fI(e,t,r){return cI(e,t,FS(r,2))}var dI=fI,pI=1/0,ZN=ti&&1/zh(new ti([,-0]))[1]==pI?function(e){return new ti(e)}:vh,hI=$h(function(e,t){return KS(e)?JS(e,t):[]}),Yf=hI,Jh=Nr(i2(),1),YN=Jh.default.configure,po=Jh.default,ou=100,{WARN:yI,LOG:eU,DEBUG:nt,VERBOSE:Ae,ERROR:tU}=ke.setup(ke.INFO),La=Ke.set();jw({enforceActions:"always"});if(!new class{xyz}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");var Ye=({caller:e,thread:t,pattern:r,args:n})=>ze(()=>(n=n||r,`${!Array.isArray(t)&&t?.name?t.name+" | ":""}${e??"caller?"}${n?`{${typeof n=="string"?n:po(n)}}`:""}`));function gI(e,t){return ze(()=>et.structural(e.get(),t.get()))}function No(e,t){return et.shallow(e.applogs,t.applogs)}function Gl(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(Ae.isEnabled&&Ae("queryNodesComparer",r,n,i),!et.structural(n.variables,i.variables))return Ae.isEnabled&&Ae("[queryNodesComparer] changed vars:",r,n,i),!1;if(!No(n.logsOfThisNode,i.logsOfThisNode))return Ae.isEnabled&&Ae("[queryNodesComparer] changed logsOfThisNode:",r,n,i),!1}return Ae.isEnabled&&Ae("[queryNodesComparer] equal:",{a:e,b:t}),!0}var mI=0;function nr(e,{name:t,equals:r}={}){let n=`observableArrayMap@${++mI}{${t}}`;Ae.isEnabled&&Ae(`[${n}] create`,{fnname:e.name,fn:e,name:t,equals:r});let i,o=Xh(e,s=>{i?ze(()=>(r??et.structural)(i,s))?nt.isEnabled&&nt(`[${n}] update skipped`,{updatedItems:s,observableArr:i}):(i.replace(s),nt.isEnabled&&nt(`[${n}] updated`,{updatedItems:s,observableArr:i})):i=Ke.array(s,{deep:!1,name:t,equals:r})},{name:n});if(n.includes("useRoots")){var a=ur(i);nt(`[${n}] deps`,{disposeAutorun:o,rootsAtom:a,observableArr:i,observers:ka(i)}),oo(()=>La.add(a))}return Ae.isEnabled&&bs(i,()=>{Ae(`[${n}] observed`,ka(i),{rootsAtom:a,observableArr:i})}),Ti(i,()=>{Ae.isEnabled&&Ae(`[${n}] dispose`),a&&oo(()=>La.delete(a)),o()}),i}var bI=0;function vI(e,{name:t}={}){let r=`observableSetMap@${++bI}{${t}}`;Ae.isEnabled&&Ae(`[${r}] create`,{fnname:e.name,fn:e,name:t});let n,i=Xh(e,a=>{if(!n)n=Ke.set(a,{deep:!1,name:t});else{let{deleted:s,added:u}=ze(()=>{let l=new Set(n.values()),f=new Set;for(let d of a)n.has(d)?(Ae.isEnabled&&Ae(`[${r}] unchanged`,d,{updatedItems:a,observableSet:n}),l.delete(d)):f.add(d);return nt.isEnabled&&nt(`[${r}] updated:`,{unseen:l,added:f,updatedItems:a,observableSet:n}),{added:f,deleted:l}});for(let l of s)n.delete(l);for(let l of u)n.add(l)}},{name:r});if(r.includes("useRoots")){var o=ur(n);nt.isEnabled&&nt(`[${r}] deps`,{disposeAutorun:i,rootsAtom:o,observableSet:n,observers:ka(n)}),oo(()=>La.add(o))}return Ae.isEnabled&&bs(n,()=>{Ae(`[${r}] observed`,ka(n),{rootsAtom:o,observableSet:n})}),Ti(n,()=>{Ae.isEnabled&&Ae(`[${r}] dispose`),o&&oo(()=>La.delete(o)),i()}),n}function Xh(e,t=null,{name:r}={}){nt.isEnabled&&nt("[autorunButAlsoImmediately] create",{fnname:e.name,fn:e,name:r});let n=`${r}.autorunImm`,i,o=new yr(n,function(...s){nt.isEnabled&&nt(`[${n}] reaction.invalidate`,s),a()});function a(){o.track(function(){let s=ou&&performance.now();nt.isEnabled&&nt(`[${n}] runAndTrack:`,{name:r??e.name,fn:e}),i=e(),nt.isEnabled&&nt(`[${n}] runAndTrack =>`,i),oo(()=>{t?.(i)}),ou&&performance.now()-s>ou&&yI(`[${n}] took ${performance.now()-s}ms`)})}return a(),nt.isEnabled&&nt(`[${n}] deps of reaction`,{reaction:o,result:i,deps:vs(o)}),()=>{Ae.isEnabled&&Ae(`[${n}] dispose`),setTimeout(()=>o.dispose())}}function at(e,t,r=!1){if(wn(t))throw new Error("computedFnDeepCompare shouldn't be used on actions");let n=!1,i=0,o=typeof r=="boolean"?{keepAlive:r}:r,a=new Map;return function(...s){let u,l=ze(()=>{let E=s;for(let _=0;_<s.length;_++)s[_]instanceof ai&&s===E&&(E=s.slice());return E}),f=`computedFnDeepCompare(${e||t.name}#${++i})${o.argsDebugName?`{${o.argsDebugName(...s)}}`:""}`;for(let[E,_]of a.entries())if(TI(E,l)){u=_;break}else if(Ae.isEnabled)for(let L=0;L<E.length;L++)E[L]instanceof ai&&E[L].name===s[L].name&&et.structural(Yf(E,E[L]),Yf(l,l[L]))&&Ae.force(`[${f}] threadState mismatch => cachebust`,{diffFields:Object.keys(E[L]).filter(J=>!et.structural(E[L][J],s[L][J])),cacheArg:E[L],freshArg:s[L]});if(u){let E=u.get();return Ae.isEnabled&&Ae(`[${f}] cache hit`,{untrackedArgs:l,cachedResult:E}),E}if(!o.keepAlive&&!ow())return!n&&cw().computedRequiresReaction&&(console.warn("invoking a computedFn from outside an reactive context won't be memoized, unless keepAlive is set"),n=!0),t.apply(this,s);Ae.isEnabled&&Ae(`[${f}] new computation`,{untrackedArgs:l});let d,I=Ze(()=>(Ae.isEnabled&&Ae(`[${f}] update->rerun`,ze(()=>({args:s})),t),Ae.isEnabled&&Qp(),d=t.apply(this,s)),{...o,name:f});if(Ae.isEnabled&&Ae(`[${f}] deps`,vs(I),{untrackedArgs:l}),a.set(l,I),!o.keepAlive){let E=Ti(I,()=>{Ae.isEnabled&&Ae(`[${f}] dispose`,I),E(),a.delete(l),o.onCleanup&&o.onCleanup(d,...s),d=void 0})}return I.get()}}function wI(e){let t=0,r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("?r+=o+`
57
57
  `+" ".repeat(++t):o===")"?r+=`
58
58
  `+" ".repeat(--t)+o:o===","&&n===0?r+=o+`
59
59
  `+" ".repeat(t):o==="{"&&n===0?(n++,r+=o+`
60
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 TI(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]instanceof ai){if(t[r]!==e[r])return!1}else if(!et.structural(e[r],t[r]))return!1;return!0}var{WARN:ed,LOG:rU,DEBUG:_I,VERBOSE:nU,ERROR:pn}=Ce.setup(Ce.INFO,{prefix:"[thread]"});function tn(e){return e.init!==void 0}var ai=class{constructor(e,t,r,n=[],i={}){this.name=e,this._applogs=n,this.parents=t===null?null:Ca(t),this.filters=r,ze(()=>this.parents?.length===0)&&ed("[Thread] empty parents array",e),i.skipObservable||Ti(this,{applogsCids:Ze,applogsByCid:Ze,insert:Lt,size:Ze,isEmpty:Ze,firstLog:Ze,latestLog:Ze},{name:`Thread{${e}}`})}filters;parents;_subscribers=[];get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}insert(e){if(this.readOnly)throw pn("[Thread] insert() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw pn("[Thread] insert() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw pn("[Thread] insert() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insert(e)}insertRaw(e){if(this.readOnly)throw pn("[Thread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw pn("[Thread] insertRaw() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw pn("[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):ed("unsubscribe called for non-existent",e)}notifySubscribers(e){_I(`[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 pn("[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 ze(()=>this.size)}get nameAndSizeUntracked(){return ze(()=>`${this.name} (${this.size})`)}get prettyName(){return wI(this.name)}get hasParents(){return!!this.parents?.length}},EI=class Qh extends ai{static fromArray(t,r){return new Qh(r||"static",null,[],t)}constructor(t,r,n,i){super(t,r,n,i,{skipObservable:!0})}get readOnly(){return!0}},xI={};ih(xI,{code:()=>my,decode:()=>ac,encode:()=>oc,format:()=>fd,name:()=>P$,parse:()=>R$,stringify:()=>fd});var OI=["string","number","bigint","symbol"],AI=["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 SI(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return OI.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":II(e)?"Buffer":kI(e)||"Object"}function II(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function kI(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(AI.includes(t))return t}var M=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}};M.uint=new M(0,"uint",!0);M.negint=new M(1,"negint",!0);M.bytes=new M(2,"bytes",!0);M.string=new M(3,"string",!0);M.array=new M(4,"array",!1);M.map=new M(5,"map",!1);M.tag=new M(6,"tag",!1);M.float=new M(7,"float",!0);M.false=new M(7,"false",!0);M.true=new M(7,"true",!0);M.null=new M(7,"null",!0);M.undefined=new M(7,"undefined",!0);M.break=new M(7,"break",!0);var ae=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}`}},ji=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",$I=new TextDecoder,jI=new TextEncoder;function Va(e){return ji&&globalThis.Buffer.isBuffer(e)}function Gl(e){return e instanceof Uint8Array?Va(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var CI=ji?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):rd(e,t,r):(e,t,r)=>r-t>64?$I.decode(e.subarray(t,r)):rd(e,t,r),Zh=ji?e=>e.length>64?globalThis.Buffer.from(e):td(e):e=>e.length>64?jI.encode(e):td(e),Wl=ji?(e,t,r)=>Va(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),NI=ji?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Gl(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},UI=ji?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function PI(e,t){if(Va(e)&&Va(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 td(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 rd(e,t,r){let n=[];for(;t<r;){let i=e[t],o=null,a=i>239?4:i>223?3:i>191?2:1;if(t+a<=r){let s,u,l,f;switch(a){case 1:i<128&&(o=i);break;case 2:s=e[t+1],(s&192)===128&&(f=(i&31)<<6|s&63,f>127&&(o=f));break;case 3:s=e[t+1],u=e[t+2],(s&192)===128&&(u&192)===128&&(f=(i&15)<<12|(s&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:s=e[t+1],u=e[t+2],l=e[t+3],(s&192)===128&&(u&192)===128&&(l&192)===128&&(f=(i&15)<<18|(s&63)<<12|(u&63)<<6|l&63,f>65535&&f<1114112&&(o=f))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),t+=a}return Yh(n)}var nd=4096;function Yh(e){let t=e.length;if(t<=nd)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=nd));return r}var BI=256,ey=class{constructor(e=BI){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 r=t.length-(this.maxCursor-this.cursor)-1;t.set(e,r)}else{if(t){let r=t.length-(this.maxCursor-this.cursor)-1;r<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,r),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=UI(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=Wl(r,0,this.cursor)}else t=NI(this.chunks,this.cursor);return e&&this.reset(),t}},Te="CBOR decode error:",mn="CBOR encode error:",Uo=[];Uo[23]=1;Uo[24]=2;Uo[25]=3;Uo[26]=5;Uo[27]=9;function Ci(e,t,r){if(e.length-t<r)throw new Error(`${Te} not enough data for type`)}var lt=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Rn(e,t,r){Ci(e,t,1);let n=e[t];if(r.strict===!0&&n<lt[0])throw new Error(`${Te} integer encoded in more bytes than necessary (strict decode)`);return n}function Dn(e,t,r){Ci(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<lt[1])throw new Error(`${Te} integer encoded in more bytes than necessary (strict decode)`);return n}function Mn(e,t,r){Ci(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<lt[2])throw new Error(`${Te} integer encoded in more bytes than necessary (strict decode)`);return n}function Ln(e,t,r){Ci(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<lt[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 RI(e,t,r,n){return new ae(M.uint,Rn(e,t+1,n),2)}function DI(e,t,r,n){return new ae(M.uint,Dn(e,t+1,n),3)}function MI(e,t,r,n){return new ae(M.uint,Mn(e,t+1,n),5)}function LI(e,t,r,n){return new ae(M.uint,Ln(e,t+1,n),9)}function Vn(e,t){return Jt(e,0,t.value)}function Jt(e,t,r){if(r<lt[0]){let n=Number(r);e.push([t|n])}else if(r<lt[1]){let n=Number(r);e.push([t|24,n])}else if(r<lt[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<lt[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<lt[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=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]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,e.push(i)}else throw new Error(`${Te} encountered BigInt larger than allowable range`)}}Vn.encodedSize=function(e){return Jt.encodedSize(e.value)};Jt.encodedSize=function(e){return e<lt[0]?1:e<lt[1]?2:e<lt[2]?3:e<lt[3]?5:9};Vn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function VI(e,t,r,n){return new ae(M.negint,-1-Rn(e,t+1,n),2)}function FI(e,t,r,n){return new ae(M.negint,-1-Dn(e,t+1,n),3)}function zI(e,t,r,n){return new ae(M.negint,-1-Mn(e,t+1,n),5)}var Hl=BigInt(-1),ty=BigInt(1);function KI(e,t,r,n){let i=Ln(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ae(M.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Te} integers outside of the safe integer range are not supported`);return new ae(M.negint,Hl-BigInt(i),9)}function Jl(e,t){let r=t.value,n=typeof r=="bigint"?r*Hl-ty:r*-1-1;Jt(e,t.type.majorEncoded,n)}Jl.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*Hl-ty:t*-1-1;return r<lt[0]?1:r<lt[1]?2:r<lt[2]?3:r<lt[3]?5:9};Jl.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Po(e,t,r,n){Ci(e,t,r+n);let i=Wl(e,t+r,t+r+n);return new ae(M.bytes,i,r+n)}function qI(e,t,r,n){return Po(e,t,1,r)}function GI(e,t,r,n){return Po(e,t,2,Rn(e,t+1,n))}function WI(e,t,r,n){return Po(e,t,3,Dn(e,t+1,n))}function HI(e,t,r,n){return Po(e,t,5,Mn(e,t+1,n))}function JI(e,t,r,n){let i=Ln(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Te} 64-bit integer bytes lengths not supported`);return Po(e,t,9,i)}function Fa(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===M.string?Zh(e.value):e.value),e.encodedBytes}function ks(e,t){let r=Fa(t);Jt(e,t.type.majorEncoded,r.length),e.push(r)}ks.encodedSize=function(e){let t=Fa(e);return Jt.encodedSize(t.length)+t.length};ks.compareTokens=function(e,t){return XI(Fa(e),Fa(t))};function XI(e,t){return e.length<t.length?-1:e.length>t.length?1:PI(e,t)}function Bo(e,t,r,n,i){let o=r+n;Ci(e,t,o);let a=new ae(M.string,CI(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=Wl(e,t+r,t+o)),a}function QI(e,t,r,n){return Bo(e,t,1,r,n)}function ZI(e,t,r,n){return Bo(e,t,2,Rn(e,t+1,n),n)}function YI(e,t,r,n){return Bo(e,t,3,Dn(e,t+1,n),n)}function ek(e,t,r,n){return Bo(e,t,5,Mn(e,t+1,n),n)}function tk(e,t,r,n){let i=Ln(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Te} 64-bit integer string lengths not supported`);return Bo(e,t,9,i,n)}var rk=ks;function Ni(e,t,r,n){return new ae(M.array,n,r)}function nk(e,t,r,n){return Ni(e,t,1,r)}function ik(e,t,r,n){return Ni(e,t,2,Rn(e,t+1,n))}function ok(e,t,r,n){return Ni(e,t,3,Dn(e,t+1,n))}function ak(e,t,r,n){return Ni(e,t,5,Mn(e,t+1,n))}function sk(e,t,r,n){let i=Ln(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Te} 64-bit integer array lengths not supported`);return Ni(e,t,9,i)}function uk(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Te} indefinite length items not allowed`);return Ni(e,t,1,1/0)}function Xl(e,t){Jt(e,M.array.majorEncoded,t.value)}Xl.compareTokens=Vn.compareTokens;Xl.encodedSize=function(e){return Jt.encodedSize(e.value)};function Ui(e,t,r,n){return new ae(M.map,n,r)}function lk(e,t,r,n){return Ui(e,t,1,r)}function ck(e,t,r,n){return Ui(e,t,2,Rn(e,t+1,n))}function fk(e,t,r,n){return Ui(e,t,3,Dn(e,t+1,n))}function dk(e,t,r,n){return Ui(e,t,5,Mn(e,t+1,n))}function pk(e,t,r,n){let i=Ln(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Te} 64-bit integer map lengths not supported`);return Ui(e,t,9,i)}function hk(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Te} indefinite length items not allowed`);return Ui(e,t,1,1/0)}function Ql(e,t){Jt(e,M.map.majorEncoded,t.value)}Ql.compareTokens=Vn.compareTokens;Ql.encodedSize=function(e){return Jt.encodedSize(e.value)};function yk(e,t,r,n){return new ae(M.tag,r,1)}function gk(e,t,r,n){return new ae(M.tag,Rn(e,t+1,n),2)}function mk(e,t,r,n){return new ae(M.tag,Dn(e,t+1,n),3)}function bk(e,t,r,n){return new ae(M.tag,Mn(e,t+1,n),5)}function vk(e,t,r,n){return new ae(M.tag,Ln(e,t+1,n),9)}function Zl(e,t){Jt(e,M.tag.majorEncoded,t.value)}Zl.compareTokens=Vn.compareTokens;Zl.encodedSize=function(e){return Jt.encodedSize(e.value)};var wk=20,Tk=21,_k=22,Ek=23;function xk(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Te} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ae(M.null,null,1):new ae(M.undefined,void 0,1)}function Ok(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Te} indefinite length items not allowed`);return new ae(M.break,void 0,1)}function Yl(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 ae(M.float,e,t)}function Ak(e,t,r,n){return Yl(tc(e,t+1),3,n)}function Sk(e,t,r,n){return Yl(rc(e,t+1),5,n)}function Ik(e,t,r,n){return Yl(oy(e,t+1),9,n)}function ec(e,t,r){let n=t.value;if(n===!1)e.push([M.float.majorEncoded|wk]);else if(n===!0)e.push([M.float.majorEncoded|Tk]);else if(n===null)e.push([M.float.majorEncoded|_k]);else if(n===void 0)e.push([M.float.majorEncoded|Ek]);else{let i,o=!1;(!r||r.float64!==!0)&&(ny(n),i=tc(er,1),n===i||Number.isNaN(n)?(er[0]=249,e.push(er.slice(0,3)),o=!0):(iy(n),i=rc(er,1),n===i&&(er[0]=250,e.push(er.slice(0,5)),o=!0))),o||(kk(n),i=oy(er,1),er[0]=251,e.push(er.slice(0,9)))}}ec.encodedSize=function(e,t){let r=e.value;if(r===!1||r===!0||r===null||r===void 0)return 1;if(!t||t.float64!==!0){ny(r);let n=tc(er,1);if(r===n||Number.isNaN(r))return 3;if(iy(r),n=rc(er,1),r===n)return 5}return 9};var ry=new ArrayBuffer(9),Nt=new DataView(ry,1),er=new Uint8Array(ry,0);function ny(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 tc(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 iy(e){Nt.setFloat32(0,e,!1)}function rc(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 kk(e){Nt.setFloat64(0,e,!1)}function oy(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)}ec.compareTokens=Vn.compareTokens;function Pe(e,t,r){throw new Error(`${Te} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function $s(e){return()=>{throw new Error(`${Te} ${e}`)}}var ce=[];for(let e=0;e<=23;e++)ce[e]=Pe;ce[24]=RI;ce[25]=DI;ce[26]=MI;ce[27]=LI;ce[28]=Pe;ce[29]=Pe;ce[30]=Pe;ce[31]=Pe;for(let e=32;e<=55;e++)ce[e]=Pe;ce[56]=VI;ce[57]=FI;ce[58]=zI;ce[59]=KI;ce[60]=Pe;ce[61]=Pe;ce[62]=Pe;ce[63]=Pe;for(let e=64;e<=87;e++)ce[e]=qI;ce[88]=GI;ce[89]=WI;ce[90]=HI;ce[91]=JI;ce[92]=Pe;ce[93]=Pe;ce[94]=Pe;ce[95]=$s("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ce[e]=QI;ce[120]=ZI;ce[121]=YI;ce[122]=ek;ce[123]=tk;ce[124]=Pe;ce[125]=Pe;ce[126]=Pe;ce[127]=$s("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ce[e]=nk;ce[152]=ik;ce[153]=ok;ce[154]=ak;ce[155]=sk;ce[156]=Pe;ce[157]=Pe;ce[158]=Pe;ce[159]=uk;for(let e=160;e<=183;e++)ce[e]=lk;ce[184]=ck;ce[185]=fk;ce[186]=dk;ce[187]=pk;ce[188]=Pe;ce[189]=Pe;ce[190]=Pe;ce[191]=hk;for(let e=192;e<=215;e++)ce[e]=yk;ce[216]=gk;ce[217]=mk;ce[218]=bk;ce[219]=vk;ce[220]=Pe;ce[221]=Pe;ce[222]=Pe;ce[223]=Pe;for(let e=224;e<=243;e++)ce[e]=$s("simple values are not supported");ce[244]=Pe;ce[245]=Pe;ce[246]=Pe;ce[247]=xk;ce[248]=$s("simple values are not supported");ce[249]=Ak;ce[250]=Sk;ce[251]=Ik;ce[252]=Pe;ce[253]=Pe;ce[254]=Pe;ce[255]=Ok;var vr=[];for(let e=0;e<24;e++)vr[e]=new ae(M.uint,e,1);for(let e=-1;e>=-24;e--)vr[31-e]=new ae(M.negint,e,1);vr[64]=new ae(M.bytes,new Uint8Array(0),1);vr[96]=new ae(M.string,"",1);vr[128]=new ae(M.array,0,1);vr[160]=new ae(M.map,0,1);vr[244]=new ae(M.false,!1,1);vr[245]=new ae(M.true,!0,1);vr[246]=new ae(M.null,null,1);function $k(){let e=[];return e[M.uint.major]=Vn,e[M.negint.major]=Jl,e[M.bytes.major]=ks,e[M.string.major]=rk,e[M.array.major]=Xl,e[M.map.major]=Ql,e[M.tag.major]=Zl,e[M.float.major]=ec,e}var iU=$k(),au=new ey,id=class ay{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 ay(r,t)}},Lr={null:new ae(M.null,null),undefined:new ae(M.undefined,void 0),true:new ae(M.true,!0),false:new ae(M.false,!1),emptyArray:new ae(M.array,0),emptyMap:new ae(M.map,0)},rn={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ae(M.float,e):e>=0?new ae(M.uint,e):new ae(M.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ae(M.uint,e):new ae(M.negint,e)},Uint8Array(e,t,r,n){return new ae(M.bytes,e)},string(e,t,r,n){return new ae(M.string,e)},boolean(e,t,r,n){return e?Lr.true:Lr.false},null(e,t,r,n){return Lr.null},undefined(e,t,r,n){return Lr.undefined},ArrayBuffer(e,t,r,n){return new ae(M.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ae(M.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Lr.emptyArray,new ae(M.break)]:Lr.emptyArray;n=id.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=na(a,r,n);return r.addBreakTokens?[new ae(M.array,e.length),i,new ae(M.break)]:[new ae(M.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length;if(!a)return r.addBreakTokens===!0?[Lr.emptyMap,new ae(M.break)]:Lr.emptyMap;n=id.createCheck(n,e);let s=[],u=0;for(let l of o)s[u++]=[na(l,r,n),na(i?e.get(l):e[l],r,n)];return jk(s,r),r.addBreakTokens?[new ae(M.map,a),s,new ae(M.break)]:[new ae(M.map,a),s]}};rn.Map=rn.Object;rn.Buffer=rn.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))rn[`${e}Array`]=rn.DataView;function na(e,t={},r){let n=SI(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||rn[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=rn[n];if(!o)throw new Error(`${mn} unsupported type: ${n}`);return o(e,n,t,r)}function jk(e,t){t.mapSorter&&e.sort(t.mapSorter)}function sy(e,t,r,n){if(Array.isArray(t))for(let i of t)sy(e,i,r,n);else r[t.type.major](e,t,n)}function Ck(e,t,r){let n=na(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 a=o.encodedSize(n,r),s=new ey(a);if(o(s,n,r),s.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return Gl(s.chunks[0])}}return au.reset(),sy(au,n,t,r),au.toBytes(!0)}var Nk={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Uk=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=vr[e];if(t===void 0){let r=ce[e];if(!r)throw new Error(`${Te} 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}},ho=Symbol.for("DONE"),js=Symbol.for("BREAK");function Pk(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=yo(t,r);if(o===js){if(e.value===1/0)break;throw new Error(`${Te} got unexpected break to lengthed array`)}if(o===ho)throw new Error(`${Te} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function Bk(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},o=n?new Map:void 0;for(let a=0;a<e.value;a++){let s=yo(t,r);if(s===js){if(e.value===1/0)break;throw new Error(`${Te} got unexpected break to lengthed map`)}if(s===ho)throw new Error(`${Te} found map but not enough entries (got ${a} [no key], expected ${e.value})`);if(n!==!0&&typeof s!="string")throw new Error(`${Te} non-string keys not supported (got ${typeof s})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(s)||!n&&s in i))throw new Error(`${Te} found repeat map key "${s}"`);let u=yo(t,r);if(u===ho)throw new Error(`${Te} found map but not enough entries (got ${a} [no value], expected ${e.value})`);n?o.set(s,u):i[s]=u}return n?o:i}function yo(e,t){if(e.done())return ho;let r=e.next();if(r.type===M.break)return js;if(r.type.terminal)return r.value;if(r.type===M.array)return Pk(r,e,t);if(r.type===M.map)return Bk(r,e,t);if(r.type===M.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=yo(e,t);return t.tags[r.value](n)}throw new Error(`${Te} tag not supported (${r.value})`)}throw new Error("unsupported")}function Rk(e,t){if(!(e instanceof Uint8Array))throw new Error(`${Te} data to decode must be a Uint8Array`);t=Object.assign({},Nk,t);let r=t.tokenizer||new Uk(e,t),n=yo(r,t);if(n===ho)throw new Error(`${Te} did not find any content to decode`);if(n===js)throw new Error(`${Te} got unexpected break`);return[n,e.subarray(r.pos())]}function Dk(e,t){let[r,n]=Rk(e,t);if(n.length>0)throw new Error(`${Te} too many terminals, data makes no sense`);return r}var Mk=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(t.type===M.array&&(t.elements++,t.elements!==1&&e.push([44])),t.type===M.map&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[M.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)}[M.negint.major](e,t){this[M.uint.major](e,t)}[M.bytes.major](e,t){throw new Error(`${mn} unsupported type: Uint8Array`)}[M.string.major](e,t){this.prefix(e);let r=Zh(JSON.stringify(t.value));e.push(r.length>32?Gl(r):r)}[M.array.major](e,t){this.prefix(e),this.inRecursive.push({type:M.array,elements:0}),e.push([91])}[M.map.major](e,t){this.prefix(e),this.inRecursive.push({type:M.map,elements:0}),e.push([123])}[M.tag.major](e,t){}[M.float.major](e,t){if(t.type.name==="break"){let o=this.inRecursive.pop();if(o){if(o.type===M.array)e.push([93]);else if(o.type===M.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 Lk(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!==M.string||n.type!==M.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 Vk={addBreakTokens:!0,mapSorter:Lk};function Fk(e,t){return t=Object.assign({},Vk,t),Ck(e,new Mk,t)}var uy=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(`${Te} 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(`${Te} unexpected token at position ${this._pos}, expected to find '${String.fromCharCode(...e)}'`)}parseNumber(){let e=this._pos,t=!1,r=!1,n=a=>{for(;!this.done();){let s=this.ch();if(a.includes(s))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 ae(M.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(`${Te} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(r)throw new Error(`${Te} 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 ae(M.float,o,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(o)?new ae(o>=0?M.uint:M.negint,o,this._pos-e):new ae(o>=0?M.uint:M.negint,BigInt(i),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${Te} 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 a=this.data[i];if(a===92||a<32||a>=128)break;if(a===34){let s=String.fromCharCode.apply(null,this.data.subarray(this._pos,i));return this._pos=i+1,new ae(M.string,s,o)}}let e=this._pos,t=[],r=()=>{if(this._pos+4>=this.data.length)throw new Error(`${Te} unexpected end of unicode escape sequence at position ${this._pos}`);let i=0;for(let o=0;o<4;o++){let a=this.ch();if(a>=48&&a<=57)a-=48;else if(a>=97&&a<=102)a=a-97+10;else if(a>=65&&a<=70)a=a-65+10;else throw new Error(`${Te} unexpected unicode escape character at position ${this._pos}`);i=i*16+a,this._pos++}return i},n=()=>{let i=this.ch(),o=null,a=i>239?4:i>223?3:i>191?2:1;if(this._pos+a>this.data.length)throw new Error(`${Te} unexpected unicode sequence at position ${this._pos}`);let s,u,l,f;switch(a){case 1:i<128&&(o=i);break;case 2:s=this.data[this._pos+1],(s&192)===128&&(f=(i&31)<<6|s&63,f>127&&(o=f));break;case 3:s=this.data[this._pos+1],u=this.data[this._pos+2],(s&192)===128&&(u&192)===128&&(f=(i&15)<<12|(s&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:s=this.data[this._pos+1],u=this.data[this._pos+2],l=this.data[this._pos+3],(s&192)===128&&(u&192)===128&&(l&192)===128&&(f=(i&15)<<18|(s&63)<<12|(u&63)<<6|l&63,f>65535&&f<1114112&&(o=f))}o===null?(o=65533,a=1):o>65535&&(o-=65536,t.push(o>>>10&1023|55296),o=56320|o&1023),t.push(o),this._pos+=a};for(;!this.done();){let i=this.ch(),o;switch(i){case 92:if(this._pos++,this.done())throw new Error(`${Te} 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(`${Te} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new ae(M.string,Yh(t),this._pos-e);default:if(i<32)throw new Error(`${Te} invalid control character at position ${this._pos}`);i<128?(t.push(i),this._pos++):n()}}throw new Error(`${Te} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new ae(M.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new ae(M.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new ae(M.null,null,4);case 102:return this.expect([102,97,108,115,101]),new ae(M.false,!1,5);case 116:return this.expect([116,114,117,101]),new ae(M.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(`${Te} 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 ae(M.break,void 0,1);if(this.ch()!==44)throw new Error(`${Te} 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 ae(M.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 ae(M.break,void 0,1);if(this.ch()!==44)throw new Error(`${Te} 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 ae(M.break,void 0,1);let e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${Te} 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(`${Te} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}};function zk(e,t){return t=Object.assign({tokenizer:new uy(e,t)},t),Dk(e,t)}var oU=new Uint8Array(0);function Kk(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 nc(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 qk(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),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(_){if(_ instanceof Uint8Array||(ArrayBuffer.isView(_)?_=new Uint8Array(_.buffer,_.byteOffset,_.byteLength):Array.isArray(_)&&(_=Uint8Array.from(_))),!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(_.length===0)return"";for(var L=0,J=0,B=0,k=_.length;B!==k&&_[B]===0;)B++,L++;for(var F=(k-B)*f+1>>>0,q=new Uint8Array(F);B!==k;){for(var R=_[B],Q=0,K=F-1;(R!==0||Q<J)&&K!==-1;K--,Q++)R+=256*q[K]>>>0,q[K]=R%s>>>0,R=R/s>>>0;if(R!==0)throw new Error("Non-zero carry");J=Q,B++}for(var re=F-J;re!==F&&q[re]===0;)re++;for(var $=u.repeat(L);re<F;++re)$+=e.charAt(q[re]);return $}function I(_){if(typeof _!="string")throw new TypeError("Expected String");if(_.length===0)return new Uint8Array;var L=0;if(_[L]!==" "){for(var J=0,B=0;_[L]===u;)J++,L++;for(var k=(_.length-L)*l+1>>>0,F=new Uint8Array(k);_[L];){var q=r[_.charCodeAt(L)];if(q===255)return;for(var R=0,Q=k-1;(q!==0||R<B)&&Q!==-1;Q--,R++)q+=s*F[Q]>>>0,F[Q]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");B=R,L++}if(_[L]!==" "){for(var K=k-B;K!==k&&F[K]===0;)K++;for(var re=new Uint8Array(J+(k-K)),$=J;K!==k;)re[$++]=F[K++];return re}}}function E(_){var L=I(_);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:I,decode:E}}var Gk=qk,Wk=Gk,Hk=Wk,Jk=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")}},Xk=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 ly(this,e)}},Qk=class{decoders;constructor(e){this.decoders=e}or(e){return ly(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 ly(e,t){return new Qk({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Zk=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 Jk(e,t,r),this.decoder=new Xk(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function cy({name:e,prefix:t,encode:r,decode:n}){return new Zk(e,t,r,n)}function Cs({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Hk(r,e);return cy({prefix:t,name:e,encode:n,decode:o=>nc(i(o))})}function Yk(e,t,r,n){let i=e.length;for(;e[i-1]==="=";)--i;let o=new Uint8Array(i*r/8|0),a=0,s=0,u=0;for(let l=0;l<i;++l){let f=t[e[l]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);s=s<<r|f,a+=r,a>=8&&(a-=8,o[u++]=255&s>>a)}if(a>=r||255&s<<8-a)throw new SyntaxError("Unexpected end of data");return o}function e$(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",a=0,s=0;for(let u=0;u<e.length;++u)for(s=s<<8|e[u],a+=8;a>r;)a-=r,o+=t[i&s>>a];if(a!==0&&(o+=t[i&s<<r-a]),n)for(;o.length*r&7;)o+="=";return o}function t$(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function kt({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=t$(n);return cy({prefix:t,name:e,encode(o){return e$(o,n,r)},decode(o){return Yk(o,i,r,e)}})}var ia=kt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),aU=kt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),sU=kt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),uU=kt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),lU=kt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),cU=kt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),fU=kt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),dU=kt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),pU=kt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),oa=Cs({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),hU=Cs({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Gr=Cs({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),yU=Cs({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),fy={};ih(fy,{Digest:()=>Ns,create:()=>ic,decode:()=>py,equals:()=>hy,hasCode:()=>w$});var r$=dy,od=128,n$=127,i$=~n$,o$=Math.pow(2,31);function dy(e,t,r){t=t||[],r=r||0;for(var n=r;e>=o$;)t[r++]=e&255|od,e/=128;for(;e&i$;)t[r++]=e&255|od,e>>>=7;return t[r]=e|0,dy.bytes=r-n+1,t}var a$=Pu,s$=128,ad=127;function Pu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Pu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&ad)<<i:(a&ad)*Math.pow(2,i),i+=7}while(a>=s$);return Pu.bytes=o-n,r}var u$=Math.pow(2,7),l$=Math.pow(2,14),c$=Math.pow(2,21),f$=Math.pow(2,28),d$=Math.pow(2,35),p$=Math.pow(2,42),h$=Math.pow(2,49),y$=Math.pow(2,56),g$=Math.pow(2,63),m$=function(e){return e<u$?1:e<l$?2:e<c$?3:e<f$?4:e<d$?5:e<p$?6:e<h$?7:e<y$?8:e<g$?9:10},b$={encode:r$,decode:a$,encodingLength:m$},v$=b$,za=v$;function Bu(e,t=0){return[za.decode(e,t),za.decode.bytes]}function Ka(e,t,r=0){return za.encode(e,t,r),t}function qa(e){return za.encodingLength(e)}function ic(e,t){let r=t.byteLength,n=qa(e),i=n+qa(r),o=new Uint8Array(i+r);return Ka(e,o,0),Ka(r,o,n),o.set(t,i),new Ns(e,r,t,o)}function py(e){let t=nc(e),[r,n]=Bu(t),[i,o]=Bu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Ns(r,i,a,t)}function hy(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Kk(e.bytes,r.bytes)}}var Ns=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function w$(e,t){return e.code===t}function sd(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return _$(r,Ru(e),t??Gr.encoder);default:return E$(r,Ru(e),t??ia.encoder)}}var ud=new WeakMap;function Ru(e){let t=ud.get(e);if(t==null){let r=new Map;return ud.set(e,r),r}return t}var zt=class yt{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!==qi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==x$)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return yt.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=ic(t,r);return yt.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 yt.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&hy(t.multihash,n.multihash)}toString(t){return sd(this,t)}toJSON(){return{"/":sd(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 yt)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new yt(n,i,o,a??ld(n,i,o.bytes))}else if(r[O$]===!0){let{version:n,multihash:i,code:o}=r,a=py(i);return yt.create(n,o,a)}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!==qi)throw new Error(`Version 0 CID must use dag-pb (code: ${qi}) block encoding`);return new yt(t,r,n,n.bytes)}case 1:{let i=ld(t,r,n.bytes);return new yt(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return yt.create(0,qi,t)}static createV1(t,r){return yt.create(1,t,r)}static decode(t){let[r,n]=yt.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=yt.inspectBytes(t),n=r.size-r.multihashSize,i=nc(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),a=new Ns(r.multihashCode,r.digestSize,o,i);return[r.version===0?yt.createV0(a):yt.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,I]=Bu(t.subarray(r));return r+=I,d},i=n(),o=qi;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=T$(t,r),o=yt.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ru(o).set(n,t),o}};function T$(e,t){switch(e[0]){case"Q":{let r=t??Gr;return[Gr.prefix,r.decode(`${Gr.prefix}${e}`)]}case Gr.prefix:{let r=t??Gr;return[Gr.prefix,r.decode(e)]}case ia.prefix:{let r=t??ia;return[ia.prefix,r.decode(e)]}case oa.prefix:{let r=t??oa;return[oa.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 _$(e,t,r){let{prefix:n}=r;if(n!==Gr.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 E$(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 qi=112,x$=18;function ld(e,t,r){let n=qa(e),i=n+qa(t),o=new Uint8Array(i+r.byteLength);return Ka(e,o,0),Ka(t,o,n),o.set(r,i),o}var O$=Symbol.for("@ipld/js-cid/CID"),A$=20;function yy({name:e,code:t,encode:r,minDigestLength:n,maxDigestLength:i}){return new S$(e,t,r,n,i)}var S$=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,r,n,i){this.name=e,this.code=t,this.encode=r,this.minDigestLength=n??A$,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?cd(r,this.code,t?.truncate):r.then(n=>cd(n,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};function cd(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 ic(t,e)}var gy=kt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),gU=kt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),mU=kt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),bU=kt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function I$(e){return e instanceof ArrayBuffer?new Uint8Array(e,0,e.byteLength):e}function k$(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=zt.asCID(e);if(!t)return null;let r=t.toString();return[new ae(M.map,1/0,1),new ae(M.string,"/",1),new ae(M.string,r,r.length),new ae(M.break,void 0,1)]}function Ga(e){let t=gy.encode(e).slice(1);return[new ae(M.map,1/0,1),new ae(M.string,"/",1),new ae(M.map,1/0,1),new ae(M.string,"bytes",5),new ae(M.string,t,t.length),new ae(M.break,void 0,1),new ae(M.break,void 0,1)]}function Qt(e){return Ga(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function $$(e){return Ga(new Uint8Array(e))}function j$(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function C$(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 N$={typeEncoders:{Object:k$,Buffer:Ga,Uint8Array:Ga,Int8Array:Qt,Uint16Array:Qt,Int16Array:Qt,Uint32Array:Qt,Int32Array:Qt,Float32Array:Qt,Float64Array:Qt,Uint8ClampedArray:Qt,BigInt64Array:Qt,BigUint64Array:Qt,DataView:Qt,ArrayBuffer:$$,undefined:j$,number:C$}},U$=class extends uy{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===M.map){let t=this._next();if(t.type===M.string&&t.value==="/"){let r=this._next();if(r.type===M.string){if(this._next().type!==M.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new ae(M.tag,42,0)}if(r.type===M.map){let n=this._next();if(n.type===M.string&&n.value==="bytes"){let i=this._next();if(i.type===M.string){for(let a=0;a<2;a++)if(this._next().type!==M.break)throw new Error("Invalid encoded Bytes form");let o=gy.decode(`m${i.value}`);return new ae(M.bytes,o,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(n)}this.tokenBuffer.push(r)}this.tokenBuffer.push(t)}return e}},Du={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Du.tags[42]=zt.parse;var P$="dag-json",my=297,oc=e=>Fk(e,N$),ac=e=>{let t=I$(e),r=Object.assign(Du,{tokenizer:new U$(t,Du)});return zk(t,r)},fd=e=>B$.decode(oc(e)),B$=new TextDecoder,R$=e=>ac(D$.encode(e)),D$=new TextEncoder;function M$(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function by(e,t,r=""){let n=M$(e),i=e?.length,o=t!==void 0;if(!n||o&&i!==t){let a=r&&`"${r}" `,s=o?` of length ${t}`:"",u=n?`length=${i}`:`type=${typeof e}`;throw new Error(a+"expected Uint8Array"+s+", got "+u)}return e}function dd(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 L$(e,t){by(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 Mu(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function su(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function fr(e,t){return e<<32-t|e>>>t}function V$(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 F$=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function z$(e,t,r){return e&t^~e&r}function K$(e,t,r){return e&t^e&r^t&r}var q$=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=su(this.buffer)}update(e){dd(this),by(e);let{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let o=0;o<i;){let a=Math.min(n-this.pos,i-o);if(a===n){let s=su(e);for(;n<=i-o;o+=n)this.process(s,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){dd(this),L$(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:o}=this;t[o++]=128,Mu(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let f=o;f<n;f++)t[f]=0;r.setBigUint64(n-8,BigInt(this.length*8),i),this.process(r,0);let a=su(e),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let u=s/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)a.setUint32(4*f,l[f],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:a}=this;return e.destroyed=o,e.finished=i,e.length=n,e.pos=a,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}},Vr=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),G$=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]),Fr=new Uint32Array(64),W$=class extends q${constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:r,D:n,E:i,F:o,G:a,H:s}=this;return[e,t,r,n,i,o,a,s]}set(e,t,r,n,i,o,a,s){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=a|0,this.H=s|0}process(e,t){for(let f=0;f<16;f++,t+=4)Fr[f]=e.getUint32(t,!1);for(let f=16;f<64;f++){let d=Fr[f-15],I=Fr[f-2],E=fr(d,7)^fr(d,18)^d>>>3,_=fr(I,17)^fr(I,19)^I>>>10;Fr[f]=_+Fr[f-7]+E+Fr[f-16]|0}let{A:r,B:n,C:i,D:o,E:a,F:s,G:u,H:l}=this;for(let f=0;f<64;f++){let d=fr(a,6)^fr(a,11)^fr(a,25),I=l+d+z$(a,s,u)+G$[f]+Fr[f]|0,E=(fr(r,2)^fr(r,13)^fr(r,22))+K$(r,n,i)|0;l=u,u=s,s=a,a=o+I|0,o=i,i=n,n=r,r=I+E|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,n,i,o,a,s,u,l)}roundClean(){Mu(Fr)}destroy(){this.set(0,0,0,0,0,0,0,0),Mu(this.buffer)}},H$=class extends W${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)}},J$=V$(()=>new H$,F$(1)),ot=Nr(sn(),1),vy=Nr(l2(),1),pd=e=>ot.Type.Union([e,ot.Type.Null()]),wy=/^(k51qz|baguq)[0-9a-z]{56,57}$/,X$=/^[0-9A-Fa-f]{7,8}$/g;ot.FormatRegistry.Set("EntityID",e=>!!e.match(X$)||!!e.match(wy));var Q$=ot.Type.String(),Lu=e=>e?.enc instanceof Uint8Array;ot.FormatRegistry.Set("CID",e=>!!e.match(wy));var Ty=ot.Type.String({format:"CID"}),Z$=/^http([s]?):\/\/.*\..*/;ot.FormatRegistry.Set("URL",e=>!!e.match(Z$));var vU=ot.Type.String({format:"URL"}),_y=ot.Type.Object({en:Q$,at:ot.Type.String(),vl:pd(ot.Type.Union([ot.Type.String(),ot.Type.Boolean(),ot.Type.Number()])),ts:ot.Type.String(),ag:ot.Type.String(),pv:pd(Ty)}),hd=vy.TypeCompiler.Compile(_y),wU=hd.Check.bind(hd),Y$=ot.Type.Composite([ot.Type.Object({cid:Ty}),_y]),Vu=vy.TypeCompiler.Compile(Y$),ej=e=>Array.from(Vu.Errors(e)),Ey=Vu.Check.bind(Vu);function xy(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var tj=yy({name:"sha2-256",code:18,encode:xy("SHA-256")}),TU=yy({name:"sha2-512",code:19,encode:xy("SHA-512")}),{WARN:yd,LOG:_U,DEBUG:rj,VERBOSE:Wa,ERROR:nj}=Ce.setup(Ce.INFO),ij=114;function oj(e,t=["cid"]){if(!e)throw nj("falsy log",e);let r=e.cid;if(Lu(e))return r||(r=sc(Oy(e).bytes).toString()),yd("preparing an encrypted applog - really?"),{log:e,cid:r};let n={};for(let[i,o]of Object.entries(e))o===void 0&&(yd(`log.${i} is undefined, which is not allowed - encoding as null`,e),o=null),t.includes(i)?Wa("excluding app log",{key:i,val:o}):n[i]=o;return{log:n,cid:r}}function aj(e){return sc(sj(e).bytes)}function sj(e){return Oy(oj(e)?.log)}function sc(e){let t=J$(e),r=fy.create(tj.code,t),n=zt.create(1,my,r);return Wa("[getCidSync]",{bytes:e,hash:t,digest:r,cid:n}),n}function Oy(e){rj("[encodeBlock]",e);let t=oc(e);return{bytes:t,cid:sc(t)}}function uj(e){let t=null,r=[];try{t=zt.parse(e)}catch(n){Wa("[retrieveThread] couldn't parse pubID with default base"),r.push(n)}if(!t)try{t=zt.parse(e,oa)}catch(n){Wa("[retrieveThread] couldn't parse pubID with base36"),r.push(n)}return{cid:t,errors:t?null:r,isIpns:t&&uc(t)}}function uc(e){return e.code===ij}function Fu(e){return typeof e=="string"?zt.parse(e):typeof e.toV1!="function"?zt.decode(e.bytes):e}function Ay(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 gd(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 lj(e,t){let r=gd(e),n=gd(t);return+r<+n}var{WARN:cj,LOG:EU,DEBUG:xU,VERBOSE:Ha,ERROR:Ja}=Ce.setup(Ce.INFO),fj=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),Sy=(e,t,r)=>et.structural(Zf(t,e),Zf(r,e)),dj=(e,t,r="asc")=>fj(e.ts,t.ts,r),OU=tI(Sy,["en","at"]);function go(e,t="asc"){return e.sort((r,n)=>dj(r,n,t))}var pj=(e,t)=>lj(new Date(e.ts),new Date(t.ts)),hj=()=>{cj("[removeDuplicateAppLogs] mode not set; pass 'safety' or 'cleanup' for optimal behavior")},md=e=>{let t=new Map,r=Ha.isEnabled;for(let n of e){if(!n)throw Ja("falsy entry in applogs",e),new Error("falsy entry in applogs");if(!n.cid)throw Ja("applog with missing CID",n),new Error("applog with missing CID");let i=n.cid,o=t.get(i);o?r&&Ha("Skipping duplicate applog:",[o,n]):t.set(i,n)}return Array.from(t.values())},yj=e=>{let t=new Set,r=Ha.isEnabled,n=r?new Map:null,i=null,o=0;for(let a of e){if(!a)throw Ja("falsy entry in applogs",e),new Error("falsy entry in applogs");if(!a.cid)throw Ja("applog with missing CID",a),new Error("applog with missing CID");let s=a.cid;t.has(s)?(i||(i=e.slice(0,o)),r&&Ha("Skipping duplicate applog:",[n?.get(s),a])):(t.add(s),n&&n.set(s,a),i&&i.push(a)),o++}return i??e},Iy=(e,t)=>t?t==="safety"?yj(e):md(e):(hj(),md(e));function gj(e){return typeof e=="string"&&e.startsWith("?")}function mj(e){return e.slice(1)}function ky(e,t){let r={},n={};for(let[i,o]of Object.entries(e))if(gj(o)){let a=mj(o),s=t[a];s?n[i]=s:r[i]=a}else n[i]=o;return[n,r]}function bj(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 $y=function(e){for(var t=0,r=0,n=e.length;r<n;r++)t+=e[r];return t},bd=function(e){return $y(e)/e.length},Ut={max:function(e){return Math.max.apply(null,e)},min:function(e){return Math.min.apply(null,e)},range:function(e){return Ut.max(e)-Ut.min(e)},midrange:function(e){return Ut.range(e)/2},sum:$y,mean:bd,average:bd,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=Ut.mean(e);return Ut.mean(e.map(function(r){return Math.pow(r-t,2)}))},standardDeviation:function(e){return Math.sqrt(Ut.variance(e))},meanAbsoluteDeviation:function(e){var t=Ut.mean(e);return Ut.mean(e.map(function(r){return Math.abs(r-t)}))},zScores:function(e){var t=Ut.mean(e),r=Ut.standardDeviation(e);return e.map(function(n){return(n-t)/r})}};Ut.average=Ut.mean;function jy(){return new Date().toISOString()}var{WARN:vj,LOG:AU,DEBUG:Qe,VERBOSE:SU,ERROR:Xa}=Ce.setup(Ce.INFO);function wj(e,t){Qe(`[ensureTsPvAndFinalizeApplogs] ENTER - ${e.length} applogs, thread size=${t.size}`);let r=jy(),n=t;Qe("[ensureTsPvAndFinalizeApplogs] About to map over applogs");let i=e.map((o,a)=>{Qe(`[ensureTsPvAndFinalizeApplogs] Processing applog ${a+1}/${e.length}`);let s=Tj(o,{ts:r,threadForPv:n});return Qe(`[ensureTsPvAndFinalizeApplogs] Finalized applog ${a+1}/${e.length}`),s});return Qe(`[ensureTsPvAndFinalizeApplogs] EXIT - mapped ${i.length} applogs`),i}function Tj(e,{ts:t,threadForPv:r}={}){Qe(`[finalizeApplogForInsert] ENTER - en=${e.en}, at=${e.at}`),Qe("[finalizeApplogForInsert] About to call withTs");let n=xj(e,t??jy());Qe(`[finalizeApplogForInsert] About to call withPvFrom (thread size=${r?.size??"null"})`);let i=Oj(n,r);Qe("[finalizeApplogForInsert] About to call encodeApplogAndGetCid");let o=aj(i).toString();Qe(`[finalizeApplogForInsert] CID created: ${o}`),e.cid&&e.cid!==o&&vj("[finalizeApplogForInsert] overwriting wrong CID",{log:e,cid:o,logWithPv:i});let a={...i,cid:o};if(Qe("[finalizeApplogForInsert] About to validate applog"),!Ey(a))throw Xa(`Bogus Applog ${JSON.stringify(a)}`,ej(a));return Qe(`[finalizeApplogForInsert] EXIT - CID=${o}`),Object.freeze(a)}function _j(e){return!!e.ts}function Ej(e){return!!e.pv}function xj(e,t){return _j(e)?e:{...e,ts:t}}function Oj(e,t){if(Qe(`[withPvFrom] ENTER - en=${e.en}, at=${e.at}, hasPv=${e.pv!==void 0}`),e.pv!==void 0)return Qe("[withPvFrom] EXIT early - pv already set"),e;if(t){let{en:r,at:n}=e;Qe(`[withPvFrom] About to call thread.findLast for en=${r}, at=${n}, thread.size=${t.size}`);let i=t.findLast(a=>a.en==r&&a.at==n);if(Qe(`[withPvFrom] findLast completed, found=${!!i}`),Qe("[withPvFrom] About to check equality"),Sy(["en","at","vl","ts","ag"],e,i))throw Xa("[withPvFrom] Same as previous:",{log:e,pv:i,thread:t});let o=(e.pv!==void 0?e.pv:i?.cid)??null;return Qe(`[withPvFrom] EXIT - prevLogCid=${o}`),{...e,pv:o}}else{if(!Ej(e))throw Xa("[withPvFrom] no thread and no pv:",e);return Qe("[withPvFrom] EXIT - no thread, returning log with existing pv"),e}}function zu(e){let t=()=>(ze(()=>e.length<2&&Qe(`joinThreads with count=${e.length}`)),go(Iy(e.flatMap(i=>{let o=i.applogs;if(!o)throw Xa("falsy applogs of thread",i),new Error("falsy applogs of thread");return o}),"cleanup"))),r=ze(()=>t()),n=Lt(function(i,o){return tn(i)?{init:ze(()=>t())}:{added:i.added.filter(a=>!this.hasApplog(a,!0)),removed:i.removed?.filter(a=>!!this.parents.some(s=>s===o?!1:s.hasApplog(a,!0)))}});return new lc(ze(()=>`join(~ ${e.map(i=>i.name).join(", ")})`),e,["?"],r,n)}var{WARN:vd,LOG:IU,DEBUG:wd,VERBOSE:hn,ERROR:Td}=Ce.setup(Ce.INFO),lc=class Cy extends ai{constructor(t,r,n,i,o,a=null){super(t,r,n,o?Ke.array([...i],{deep:!1,name:`${t}.array`}):i),this.name=t,this._initialLogs=i,this._eventMapper=o,this._writeMapper=a,Ti(this,{onParentUpdate:Lt}),o&&this.subscribeToParents()}static mapWrites(t,r,n){return new Cy(`${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=qt(()=>{this.parents.length||vd("MappedThread has no parents",this),hn(`[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)&&hn(`[MappedThread: ${this.name}] Skipping re-sub to parent`,n.nameAndSizeUntracked),hn(`[MappedThread: ${this.name}] sub to new parent`,n.nameAndSizeUntracked);let i=this.onParentUpdate.bind(this,n),o=n.subscribe(i);this._parentSubscriptions.set(n,o)}for(let n of r)hn(`[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 Td("triggerRemap on a thread that is not actually mapping?!",this.nameAndSizeUntracked);wd(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.length!==1&&vd(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap with parentCount=${this.parents.length} - not meant for this`),this.parents.forEach(t=>{this.onParentUpdate(t,{init:ze(()=>Ar(t.applogs))})})}onParentUpdate(t,r){hn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate`,r);let n=this._eventMapper?this._eventMapper(r,t):r;if(this._eventMapper)if(hn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => mapped`,n),tn(n))this._applogs.replace([...n.init]);else{for(let i of n.added)this._applogs.splice(dI(this._applogs,i,"ts"),0,i);if(n.removed){for(let i of n.removed)if(!this._applogs.remove(i))if(!tn(r)&&r.removed?.includes(i))wd("Ignoring remove event for non-existent because it was part of parent event's removed",i,r);else throw Td(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,i,{thread:this,event:r,mapResult:n})}}hn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,vs(this._applogs)),this.notifySubscribers(n)}get readOnly(){return!1}},{WARN:kU,LOG:$U,DEBUG:jU,VERBOSE:uu,ERROR:Aj}=Ce.setup(Ce.INFO),si=at("rollingFilter",function(e,t,r={}){let n=Ij(t),i=_d(n),o=Ke.array(ze(function(){return i(e.applogs)}),{deep:!1,name:`${e.name} | ${r.name||`rollingFilter.array{${po(n)}}`}`}),a=f=>{let d;return tn(f)?d={init:i(f.init)}:d={added:i(f.added),removed:f.removed},uu(`rollingFilter{${e.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,n,f,"=>",d),d},s=new lc(`${e.name} | ${r.name||`rollingFilter{${po(n)}}`}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],o,a),u=dw(()=>Ar(t),f=>{uu(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,n,"=>",f),n=f,i=_d(n),s.triggerRemap()}),l=wi(o,()=>{uu(`rollingFilter<${ze(()=>e.name)}>${r.name?` '${r.name}'`:""} unobserve`,n),u(),l()});return s},{equals:No,argsDebugName:(e,t,r)=>Ye({caller:"rollingFilter",thread:e,pattern:t,args:r})}),Sj=at("rollingMapper",function(e,t,r={}){let n=ze(()=>t.call(null,{init:e.applogs},e));if(!tn(n))throw Aj("Initial run must return init event");let i=n.init;return new lc(`${e.name} | ${r.name||"rollingMapper"}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],i,t)},{equals:No,argsDebugName:(e,t,r)=>Ye({caller:"rollingMapper",thread:e,args:r})}),CU=at("rollingAcc",function(e,t,r,n={}){let i=Lt(r);return i({init:e.applogs},t),e.subscribe(o=>{i(o,t)}),t},{argsDebugName:(e,t,r,n)=>`rollingAcc{${e.nameAndSizeUntracked}${n?.name?` | ${n?.name}`:""}}`}),Ij=function(e){let t=ze(function(){return Object.fromEntries(Object.entries(Ar(e)).map(([r,n])=>[Ar(r),Ar(n)]))});if(!Object.entries(t).length)throw new Error("Pattern is empty");return t};function _d(e){return function(t){return t.filter(function(r){for(let n of Object.keys(e)){let i=e[n];if(i===void 0)continue;let o=r[n.startsWith("!")?n.slice(1):n];if(!bj(n,i,o))return!1}return!0})}}var{WARN:kj,LOG:$j,DEBUG:Xe,VERBOSE:Ny,ERROR:aa}=Ce.setup(Ce.INFO),jj=class extends ai{constructor(e,t=[],r){super(e,null,r,t),Ti(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){Xe(`[WriteableThread.insert] ENTER - ${e.length} applogs for thread "${this.name}"`),Xe("[WriteableThread.insert] About to call ensureTsPvAndFinalizeApplogs");let t=wj(e,this);Xe(`[WriteableThread.insert] ensureTsPvAndFinalizeApplogs completed, mapped=${t.length} applogs`),Xe("[WriteableThread.insert] About to call insertRaw");let r=this.insertRaw(t);return Xe("[WriteableThread.insert] insertRaw completed"),r}insertMissing(e,t=!1){let r=e.filter(n=>!this.hasApplog(n,t));return r.length===0?(Ny("[insertMissing] no missing applogs"),[]):this.insertRaw(r)??[]}insertRaw(e){Xe(`[WriteableThread.insertRaw] ENTER - ${e.length} applogs for thread "${this.name}"`),Xe("[WriteableThread.insertRaw] About to deduplicate");let t=Iy(e,"safety");if(t.length!==e.length)throw aa(`[insertRaw] duplicate applogs passed: ${e.length-t.length}`,{appLogsToInsert:e,deduplicated:t});Xe("[WriteableThread.insertRaw] Deduplication done"),Xe("[WriteableThread.insertRaw] About to validate");let r=e.filter(o=>!Ey(o));if(r.length)throw aa(`[insertRaw] bogus applogs passed: ${r.length}`,{bogus:r});Xe("[WriteableThread.insertRaw] Validation done"),Xe("[WriteableThread.insertRaw] About to check for existing");let n=e.filter(o=>this.hasApplog(o,!1));if(n.length)throw aa(`[insertRaw] already existing applogs passed: ${n.length}`,{existing:n});if(Xe("[WriteableThread.insertRaw] Existing check done"),!e.length){kj("[insertRaw] skipping empty insert empty logs array");return}(!this.hasParents&&!(this instanceof Ro)?$j:Xe)("Inserting:",e.length===1?e[0]:e,{ds:this}),Xe("[WriteableThread.insertRaw] About to sort applogs"),go(e);let i=this._applogs.length&&pj(e[0],this._applogs[this._applogs.length-1]);return Xe("[WriteableThread.insertRaw] About to push to _applogs array"),this._applogs.push(...e),i&&(Xe("[WriteableThread.insertRaw] About to sort _applogs (sortNeeded=true)"),go(this._applogs)),Xe("[WriteableThread.insertRaw] About to notify subscribers"),this.notifySubscribers({added:e,removed:null}),Xe("[WriteableThread.insertRaw] Subscribers notified"),Xe("[WriteableThread.insertRaw] About to call persist (void - not awaited)"),this.persist(e),Xe(`[WriteableThread.insertRaw] EXIT - returning ${e.length} applogs`),e}get readOnly(){return!1}},Ro=class sa extends jj{constructor(t,r,n,i){super(t,r,n),this._readOnly=i,Ti(this,{_applogs:Ke.shallow})}static empty(t){return sa.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new sa(r??"in-memory",t,[],n)}static fromReadOnlyArray(t,r){return new sa(r??"in-memory",t,[],!0)}get readOnly(){return this._readOnly}async persist(t){if(Ny("[InMem.persist] no persist for",t),this.readOnly)throw aa("[persist] called for readOnly thread")}},{WARN:NU,LOG:UU,DEBUG:PU,VERBOSE:BU,ERROR:RU}=Ce.setup(Ce.INFO),{WARN:DU,LOG:MU,DEBUG:LU,VERBOSE:VU,ERROR:FU}=Ce.setup(Ce.INFO),Cj=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=r,Ti(this,{threadOfTrail:Ze})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?zu([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},Uy=class{constructor(e){this.nodes=e,Ti(this,{threadOfAllTrails:Ze,size:Ze,isEmpty:Ze})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return ze(()=>this.records.length)}get records(){return nr(()=>this.nodes.map(({variables:e})=>e),{name:"QueryResult.records"})}get leafNodeThread(){return zu(nr(()=>this.nodes.map(({logsOfThisNode:e})=>e),{name:"QueryResult.leafNodeThread"}))}get leafNodeLogSet(){return nr(()=>this.nodes.map(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogSet"})}get leafNodeLogs(){return nr(()=>this.nodes.flatMap(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogs"})}get threadOfAllTrails(){return zu(nr(()=>this.nodes.map(e=>e.threadOfTrail),{name:"QueryResult.threadOfAllTrails"}))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},{WARN:zU,LOG:Us,DEBUG:kr,VERBOSE:ke,ERROR:_n}=Ce.setup(Ce.INFO,{prefix:"[q]"}),lu=null,KU=at("lastWriteWins",function(e,{inverseToOnlyReturnFirstLogs:t,tolerateAlreadyFiltered:r}={}){if(ke(`lastWriteWins${t?".inversed":""} < ${e.nameAndSizeUntracked} > initializing`),e.filters.includes("lastWriteWins")){if(r)return kr("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),e;throw _n("thread already filtered lastWriteWins:",e.filters,{name:e.name})}let n,i=Sj(e,function(o,a){let s=tn(o),u,l=[],f=s?null:[];s?(n=new Map,u=o.init):u=o.added;let d;for(let I=t?0:u.length-1;t?I<u.length:I>=0;t?I++:I--){let E=u[I],_=E.en+"|"+E.at;if(d&&(t?d>E.ts:d<E.ts))throw _n("lastWriteWins.mapper logs not sorted:",d,t?">":"<",E.ts,{log:E,i:I,newLogs:u,inverseToOnlyReturnFirstLogs:t});d=E.ts;let L=n.get(_);(!L||(t?L.ts>E.ts:L.ts<E.ts))&&(L&&!s&&f.push(L),l.push(E),n.set(_,E))}return go(l),ke.isDisabled||ke(`lastWriteWins${t?".inversed":""}<${e.nameAndSizeUntracked}> mapped event`,s?{...Object.fromEntries(Object.entries(o).map(([I,E])=>[I,E?.length])),toAdd:l.length,toRemove:f}:{...o,toAdd:l,toRemove:f}),s?{init:l}:{added:l,removed:f}},{name:`lastWriteWins${t?".inversed":""}`,extraFilterName:"lastWriteWins"});return ke.isDisabled||qt(()=>{ke(`lastWriteWins<${e.nameAndSizeUntracked}> filtered down to`,i.applogs.length)}),i},{equals:No,argsDebugName:e=>Ye({caller:"lastWriteWins",thread:e})}),qU=at("withoutDeleted",function(e){if(ke.isEnabled&&ke(`withoutDeleted<${e.nameAndSizeUntracked}>`),e.filters.includes("withoutDeleted"))throw _n("thread already filtered withoutDeleted:",e.filters,{name:e.name});let t=si(e,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});ke.isEnabled&&ke(`withoutDeleted<${e.nameAndSizeUntracked}> deletionLogs:`,ze(function(){return[...t.applogs]}));let r=Ye({caller:"allDeletedEntities",thread:e}),n=vI(function(){return t.map(i=>i.en)},{name:r});return ke.isEnabled&&qt(()=>{ke(`withoutDeleted<${e.nameAndSizeUntracked}> deleted:`,[...n])}),si(e,{"!en":n},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:No}),Py=at("query",function e(t,r,n={},i={}){Lj();let o=By(t);kr(`query<${o.nameAndSizeUntracked}>:`,r);let a=Array.isArray(r)?r:[r],s;if(a.length===1)s=null;else{let f=a.slice(0,-1);s=e(o,f,n,i)}let u=a[a.length-1],l=Nj(o,s,u,i);return ke.isDisabled||qt(()=>ke("query result:",Ar(l))),l},{equals:ql,argsDebugName:(e,t,r)=>Ye({caller:"query",thread:e,args:r?{pattern:t,startVars:r}:t})}),Nj=at("queryStep",function(e,t,r,n={}){if(kr(`queryStep<${e.nameAndSizeUntracked}> with`,t?.untrackedSize??"all","nodes, pattern:",r),!Object.entries(r).length)throw new Error("Pattern is empty");function i(a){let[s,u]=ky(r,a?.variables??{});ke("[queryStep.doQuery] patternWithoutVars: ",s);let l=si(e,s),f=Ps(u),d=nr(function(){let I=l.map(E=>({log:E,vars:f(E)}));return ke.isEnabled&&ke("[queryStep.doQuery] step node:",a?.variables," =>",I,"from:",ze(()=>l.applogs)),I.map(({log:E,vars:_})=>{let L=Object.assign({},a?.variables,_);return new Cj(EI.fromArray([E],Ye({caller:"QueryNode",thread:l,pattern:`${po(L)}@${po(s)}`})),L,a)})},{name:Ye({caller:"doQuery.mapNodes",thread:l,pattern:r})});return ke.isEnabled&&qt(()=>ke("[queryStep.doQuery] resultNodes:",[...d])),n.debug&&Us("[queryStep] step result:",ze(()=>d.map(({variables:I,logsOfThisNode:E})=>({variables:I,thread:E})))),d}let o=nr(function(){return kr(`[queryStep] Running with ${t?.nodes?.length} input nodes:`),t?[...t.nodes.flatMap(i)]:[...i(null)]},{name:Ye({caller:"queryStep",thread:e,pattern:r})});return ke.isEnabled&&qt(()=>ke("[queryStep] observableResultNodes:",[...o])),new Uy(o)},{equals:ql,argsDebugName:(e,t,r)=>Ye({caller:"queryStep",thread:e,pattern:r})}),GU=at("queryNot",function(e,t,r,n={}){let i=t.nodes;kr(`queryNot<${e.nameAndSizeUntracked}> from: ${i.length} nodes`);let o=Array.isArray(r)?r:[r];for(let a of o){if(!Object.entries(r).length)throw new Error("Pattern is empty");i=i.filter(function({variables:s}){let[u,l]=ky(a,s??{});ke("[queryNot] patternWithoutVars: ",u);let f=si(e,u);return ke("[queryNot] step node:",s," =>",f.size,"applogs"),ke.isDisabled||ke("[queryNot] step node:",s," => empty?",ze(()=>f.applogs)),n.debug&&Us("[queryNot] node result:",s,"=>",f.applogs),f.isEmpty})}return new Uy(i)},{equals:ql,argsDebugName:(e,t,r)=>Ye({caller:"queryNot",thread:e,pattern:r})}),WU=at("filterAndMap",function(e,t,r){kr(`filterAndMap<${e.nameAndSizeUntracked}>`,t);let n=si(e,t);ke.isEnabled&&(ke("[filterAndMap] filtered:",n.untrackedSize),qt(()=>ke("[filterAndMap] filtered:",n.applogs)));let i=Ye({thread:e,pattern:t,caller:"filterAndMap"}),o=nr(()=>Bj(n,r),{name:i});return ke.isDisabled||qt(()=>ke("[filterAndMap] mapped:",o)),o},{equals:et.structural,argsDebugName:(e,t)=>Ye({caller:"filterAndMap",thread:e,pattern:t})}),HU=at("queryAndMap",function(e,t,r,n={}){let i=By(e);kr(`queryAndMap<${i.nameAndSizeUntracked}>`,{patternOrPatterns:t,variables:n,map:r});let o=Ye({thread:i,caller:"queryAndMap"}),a=Py(i,t);ke("[queryAndMap] filtered count:",a.untrackedSize);let s=nr(()=>Rj(a,r),{name:o});return ke.isDisabled||qt(()=>ke("[queryAndMap] result:",Ar(s))),s},{equals:et.structural,argsDebugName:(e,t)=>Ye({caller:"queryAndMap",thread:e,pattern:t})}),JU=at("queryEntity",function(e,t,r,n){kr(`queryEntity<${e.nameAndSizeUntracked}>`,r,t);let i=si(e,{en:r,at:Dj(t,n)});return ke("queryEntity applogs:",i.applogs),Ze(()=>i.isEmpty?null:Object.fromEntries(i.map(({at:o,vl:a})=>[o.slice(t.length+1),a])))},{equals:gI,argsDebugName:(e,t,r)=>Ye({caller:"queryEntity",thread:e,args:{name:t,entityID:r}})}),XU=at("agentsOfThread",function(e){kr(`agentsOfThread<${e.nameAndSizeUntracked}>`);let t=Ke.map(),r=Lt(i=>{for(let o of tn(i)?i.init:i.added){let a=t.get(o.ag)??0;t.set(o.ag,a+1)}for(let o of!tn(i)&&i.removed||[]){let a=t.get(o.ag);if(!a||a<1)throw _n("[agentsOfThread] number is now negative",{log:o,event:i,mapped:t,prev:a});t.set(o.ag,a-1)}Us(`agentsOfThread<${e.nameAndSizeUntracked}> processed event`,{event:i,mapped:t})});r({init:e.applogs});let n=e.subscribe(r);return bs(t,n),t}),Uj=at("entityOverlap",function(e,t){return Us(`entityOverlap<${e.nameAndSizeUntracked}, ${t.nameAndSizeUntracked}>`),Ze(()=>{let r=new Set(e.map(i=>i.en)),n=new Set(t.map(i=>i.en));return[...r].filter(i=>n.has(i))})}),QU=at("entityOverlapCount",function(e,t){return Ze(()=>Uj(e,t).get().length)}),Pj=at("querySingle",function(e,t,r={}){let n=Py(e,t,r);return Ze(()=>{if(n.isEmpty)return null;if(n.size>1)throw _n("[querySingle] got",n.size,"results:",n);let i=n.nodes[0].logsOfThisNode;if(i.size!=1)throw _n("[querySingle] single result, but got",i.size,"logs:",i.applogs);return i.applogs[0]})},{equals:et.structural,argsDebugName:(e,t)=>Ye({caller:"querySingle",thread:e,pattern:t})}),ZU=at("querySingleAndMap",function(e,t,r,n={}){let i=Pj(e,t,n);return Ze(()=>{let o=i.get();if(o)return typeof r=="string"?o[r]:Ps(r)(o)})},{equals:et.structural,argsDebugName:(e,t)=>Ye({caller:"querySingleAndMap",thread:e,pattern:t})}),Bj=function(e,t){return typeof t=="function"?e.map(t):typeof t=="string"?e.map(r=>r[t]):e.map(Ps(t))},Rj=function(e,t){return typeof t=="function"?e.records.map(t):typeof t=="string"?e.nodes.map(r=>{if(!Object.hasOwn(r.record,t)){if(r.logsOfThisNode.size!==1)throw _n(`not sure what to map (it's not a var and a result node log count of ${r.logsOfThisNode.size})`);return r.logsOfThisNode.firstLog[t]}return r.record[t]}):e.nodes.map(r=>Ps(t)(e))};function Ps(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function Dj(e,t){return t.map(r=>Mj(e,r))}function Mj(e,t){return`${e}/${t}`}function By(e,t){return Array.isArray(e)?Ro.fromArray(e,t||`threadFromArray[${e.length}]`,!0):e}function Lj(){if(lu!=null&&performance.now()>=lu)throw new Vj(lu)}var Vj=class extends Error{constructor(e){super(e)}},Fj=it({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js"(e,t){"use strict";t.exports=a;var r=128,n=127,i=~n,o=Math.pow(2,31);function a(s,u,l){if(Number.MAX_SAFE_INTEGER&&s>Number.MAX_SAFE_INTEGER)throw a.bytes=0,new RangeError("Could not encode varint");u=u||[],l=l||0;for(var f=l;s>=o;)u[l++]=s&255|r,s/=128;for(;s&i;)u[l++]=s&255|r,s>>>=7;return u[l]=s|0,a.bytes=l-f+1,u}}}),zj=it({"../../../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 s=0,u=u||0,l=0,f=u,d,I=o.length;do{if(f>=I||l>49)throw i.bytes=0,new RangeError("Could not decode varint");d=o[f++],s+=l<28?(d&n)<<l:(d&n)*Math.pow(2,l),l+=7}while(d>=r);return i.bytes=f-u,s}}}),Kj=it({"../../../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),a=Math.pow(2,35),s=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),f=Math.pow(2,63);t.exports=function(d){return d<r?1:d<n?2:d<i?3:d<o?4:d<a?5:d<s?6:d<u?7:d<l?8:d<f?9:10}}}),cc=it({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js"(e,t){"use strict";t.exports={encode:Fj(),decode:zj(),encodingLength:Kj()}}}),qj=["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 Gj(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return t==="string"||t==="number"||t==="bigint"||t==="symbol"?t:t==="function"?"Function":Array.isArray(e)?"Array":e instanceof Uint8Array?"Uint8Array":e.constructor===Object?"Object":Wj(e)||"Object"}function Wj(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(qj.includes(t))return t}var W=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}};W.uint=new W(0,"uint",!0);W.negint=new W(1,"negint",!0);W.bytes=new W(2,"bytes",!0);W.string=new W(3,"string",!0);W.array=new W(4,"array",!1);W.map=new W(5,"map",!1);W.tag=new W(6,"tag",!1);W.float=new W(7,"float",!0);W.false=new W(7,"false",!0);W.true=new W(7,"true",!0);W.null=new W(7,"null",!0);W.undefined=new W(7,"undefined",!0);W.break=new W(7,"break",!0);var me=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}`}},Do=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Hj=new TextEncoder;function Qa(e){return Do&&globalThis.Buffer.isBuffer(e)}function Ry(e){return e instanceof Uint8Array?Qa(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Jj=24,Xj=200,Qj=Do?e=>e.length>=Jj?globalThis.Buffer.from(e):Ed(e):e=>e.length>=Xj?Hj.encode(e):Ed(e),_r=e=>Uint8Array.from(e),Zj=Do?(e,t,r)=>Qa(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Yj=Do?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Ry(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},e5=Do?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Dy(e,t){if(Qa(e)&&Qa(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 Ed(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 t5=256,My=class{constructor(e=t5){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 r=t.length-(this.maxCursor-this.cursor)-1;t.set(e,r)}else{if(t){let r=t.length-(this.maxCursor-this.cursor)-1;r<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,r),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=e5(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=Zj(r,0,this.cursor)}else t=Yj(this.chunks,this.cursor);return e&&this.reset(),t}},r5=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}},Ge="CBOR decode error:",Ly="CBOR encode error:",Mo=[];Mo[23]=1;Mo[24]=2;Mo[25]=3;Mo[26]=5;Mo[27]=9;function Pi(e,t,r){if(e.length-t<r)throw new Error(`${Ge} not enough data for type`)}var ct=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Fn(e,t,r){Pi(e,t,1);let n=e[t];if(r.strict===!0&&n<ct[0])throw new Error(`${Ge} integer encoded in more bytes than necessary (strict decode)`);return n}function zn(e,t,r){Pi(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<ct[1])throw new Error(`${Ge} integer encoded in more bytes than necessary (strict decode)`);return n}function Kn(e,t,r){Pi(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<ct[2])throw new Error(`${Ge} integer encoded in more bytes than necessary (strict decode)`);return n}function qn(e,t,r){Pi(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<ct[3])throw new Error(`${Ge} 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(`${Ge} integers outside of the safe integer range are not supported`)}function n5(e,t,r,n){return new me(W.uint,Fn(e,t+1,n),2)}function i5(e,t,r,n){return new me(W.uint,zn(e,t+1,n),3)}function o5(e,t,r,n){return new me(W.uint,Kn(e,t+1,n),5)}function a5(e,t,r,n){return new me(W.uint,qn(e,t+1,n),9)}function Gn(e,t){return Xt(e,0,t.value)}function Xt(e,t,r){if(r<ct[0]){let n=Number(r);e.push([t|n])}else if(r<ct[1]){let n=Number(r);e.push([t|24,n])}else if(r<ct[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<ct[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<ct[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=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]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,e.push(i)}else throw new Error(`${Ge} encountered BigInt larger than allowable range`)}}Gn.encodedSize=function(e){return Xt.encodedSize(e.value)};Xt.encodedSize=function(e){return e<ct[0]?1:e<ct[1]?2:e<ct[2]?3:e<ct[3]?5:9};Gn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function s5(e,t,r,n){return new me(W.negint,-1-Fn(e,t+1,n),2)}function u5(e,t,r,n){return new me(W.negint,-1-zn(e,t+1,n),3)}function l5(e,t,r,n){return new me(W.negint,-1-Kn(e,t+1,n),5)}var fc=BigInt(-1),Vy=BigInt(1);function c5(e,t,r,n){let i=qn(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new me(W.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Ge} integers outside of the safe integer range are not supported`);return new me(W.negint,fc-BigInt(i),9)}function dc(e,t){let r=t.value,n=typeof r=="bigint"?r*fc-Vy:r*-1-1;Xt(e,t.type.majorEncoded,n)}dc.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*fc-Vy:t*-1-1;return r<ct[0]?1:r<ct[1]?2:r<ct[2]?3:r<ct[3]?5:9};dc.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Lo(e,t,r,n){Pi(e,t,r+n);let i=e.slice(t+r,t+r+n);return new me(W.bytes,i,r+n)}function f5(e,t,r,n){return Lo(e,t,1,r)}function d5(e,t,r,n){return Lo(e,t,2,Fn(e,t+1,n))}function p5(e,t,r,n){return Lo(e,t,3,zn(e,t+1,n))}function h5(e,t,r,n){return Lo(e,t,5,Kn(e,t+1,n))}function y5(e,t,r,n){let i=qn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ge} 64-bit integer bytes lengths not supported`);return Lo(e,t,9,i)}function Za(e){return e.encodedBytes===void 0&&(e.encodedBytes=W.equals(e.type,W.string)?Qj(e.value):e.value),e.encodedBytes}function Bs(e,t){let r=Za(t);Xt(e,t.type.majorEncoded,r.length),e.push(r)}Bs.encodedSize=function(e){let t=Za(e);return Xt.encodedSize(t.length)+t.length};Bs.compareTokens=function(e,t){return g5(Za(e),Za(t))};function g5(e,t){return e.length<t.length?-1:e.length>t.length?1:Dy(e,t)}var xd=new TextDecoder,m5=32;function b5(e,t,r){if(r-t<m5){let n="";for(let i=t;i<r;i++){let o=e[i];if(o&128)return xd.decode(e.subarray(t,r));n+=String.fromCharCode(o)}return n}return xd.decode(e.subarray(t,r))}function Vo(e,t,r,n,i){let o=r+n;Pi(e,t,o);let a=new me(W.string,b5(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=e.slice(t+r,t+o)),a}function v5(e,t,r,n){return Vo(e,t,1,r,n)}function w5(e,t,r,n){return Vo(e,t,2,Fn(e,t+1,n),n)}function T5(e,t,r,n){return Vo(e,t,3,zn(e,t+1,n),n)}function _5(e,t,r,n){return Vo(e,t,5,Kn(e,t+1,n),n)}function E5(e,t,r,n){let i=qn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ge} 64-bit integer string lengths not supported`);return Vo(e,t,9,i,n)}var x5=Bs;function Bi(e,t,r,n){return new me(W.array,n,r)}function O5(e,t,r,n){return Bi(e,t,1,r)}function A5(e,t,r,n){return Bi(e,t,2,Fn(e,t+1,n))}function S5(e,t,r,n){return Bi(e,t,3,zn(e,t+1,n))}function I5(e,t,r,n){return Bi(e,t,5,Kn(e,t+1,n))}function k5(e,t,r,n){let i=qn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ge} 64-bit integer array lengths not supported`);return Bi(e,t,9,i)}function $5(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ge} indefinite length items not allowed`);return Bi(e,t,1,1/0)}function pc(e,t){Xt(e,W.array.majorEncoded,t.value)}pc.compareTokens=Gn.compareTokens;pc.encodedSize=function(e){return Xt.encodedSize(e.value)};function Ri(e,t,r,n){return new me(W.map,n,r)}function j5(e,t,r,n){return Ri(e,t,1,r)}function C5(e,t,r,n){return Ri(e,t,2,Fn(e,t+1,n))}function N5(e,t,r,n){return Ri(e,t,3,zn(e,t+1,n))}function U5(e,t,r,n){return Ri(e,t,5,Kn(e,t+1,n))}function P5(e,t,r,n){let i=qn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ge} 64-bit integer map lengths not supported`);return Ri(e,t,9,i)}function B5(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ge} indefinite length items not allowed`);return Ri(e,t,1,1/0)}function hc(e,t){Xt(e,W.map.majorEncoded,t.value)}hc.compareTokens=Gn.compareTokens;hc.encodedSize=function(e){return Xt.encodedSize(e.value)};function R5(e,t,r,n){return new me(W.tag,r,1)}function D5(e,t,r,n){return new me(W.tag,Fn(e,t+1,n),2)}function M5(e,t,r,n){return new me(W.tag,zn(e,t+1,n),3)}function L5(e,t,r,n){return new me(W.tag,Kn(e,t+1,n),5)}function V5(e,t,r,n){return new me(W.tag,qn(e,t+1,n),9)}function yc(e,t){Xt(e,W.tag.majorEncoded,t.value)}yc.compareTokens=Gn.compareTokens;yc.encodedSize=function(e){return Xt.encodedSize(e.value)};var Fy=20,zy=21,Ky=22,qy=23;function F5(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Ge} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new me(W.null,null,1):new me(W.undefined,void 0,1)}function z5(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ge} indefinite length items not allowed`);return new me(W.break,void 0,1)}function gc(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Ge} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Ge} Infinity values are not supported`)}return new me(W.float,e,t)}function K5(e,t,r,n){return gc(bc(e,t+1),3,n)}function q5(e,t,r,n){return gc(vc(e,t+1),5,n)}function G5(e,t,r,n){return gc(Jy(e,t+1),9,n)}function mc(e,t,r){let n=t.value;if(n===!1)e.push([W.float.majorEncoded|Fy]);else if(n===!0)e.push([W.float.majorEncoded|zy]);else if(n===null)e.push([W.float.majorEncoded|Ky]);else if(n===void 0)e.push([W.float.majorEncoded|qy]);else{let i,o=!1;(!r||r.float64!==!0)&&(Wy(n),i=bc(tr,1),n===i||Number.isNaN(n)?(tr[0]=249,e.push(tr.slice(0,3)),o=!0):(Hy(n),i=vc(tr,1),n===i&&(tr[0]=250,e.push(tr.slice(0,5)),o=!0))),o||(W5(n),i=Jy(tr,1),tr[0]=251,e.push(tr.slice(0,9)))}}mc.encodedSize=function(e,t){let r=e.value;if(r===!1||r===!0||r===null||r===void 0)return 1;if(!t||t.float64!==!0){Wy(r);let n=bc(tr,1);if(r===n||Number.isNaN(r))return 3;if(Hy(r),n=vc(tr,1),r===n)return 5}return 9};var Gy=new ArrayBuffer(9),Pt=new DataView(Gy,1),tr=new Uint8Array(Gy,0);function Wy(e){if(e===1/0)Pt.setUint16(0,31744,!1);else if(e===-1/0)Pt.setUint16(0,64512,!1);else if(Number.isNaN(e))Pt.setUint16(0,32256,!1);else{Pt.setFloat32(0,e);let t=Pt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Pt.setUint16(0,31744,!1);else if(r===0)Pt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Pt.setUint16(0,0):i<-14?Pt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):Pt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function bc(e,t){if(e.length-t<2)throw new Error(`${Ge} 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 Hy(e){Pt.setFloat32(0,e,!1)}function vc(e,t){if(e.length-t<4)throw new Error(`${Ge} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function W5(e){Pt.setFloat64(0,e,!1)}function Jy(e,t){if(e.length-t<8)throw new Error(`${Ge} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}mc.compareTokens=Gn.compareTokens;function Be(e,t,r){throw new Error(`${Ge} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Rs(e){return()=>{throw new Error(`${Ge} ${e}`)}}var pe=[];for(let e=0;e<=23;e++)pe[e]=Be;pe[24]=n5;pe[25]=i5;pe[26]=o5;pe[27]=a5;pe[28]=Be;pe[29]=Be;pe[30]=Be;pe[31]=Be;for(let e=32;e<=55;e++)pe[e]=Be;pe[56]=s5;pe[57]=u5;pe[58]=l5;pe[59]=c5;pe[60]=Be;pe[61]=Be;pe[62]=Be;pe[63]=Be;for(let e=64;e<=87;e++)pe[e]=f5;pe[88]=d5;pe[89]=p5;pe[90]=h5;pe[91]=y5;pe[92]=Be;pe[93]=Be;pe[94]=Be;pe[95]=Rs("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)pe[e]=v5;pe[120]=w5;pe[121]=T5;pe[122]=_5;pe[123]=E5;pe[124]=Be;pe[125]=Be;pe[126]=Be;pe[127]=Rs("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)pe[e]=O5;pe[152]=A5;pe[153]=S5;pe[154]=I5;pe[155]=k5;pe[156]=Be;pe[157]=Be;pe[158]=Be;pe[159]=$5;for(let e=160;e<=183;e++)pe[e]=j5;pe[184]=C5;pe[185]=N5;pe[186]=U5;pe[187]=P5;pe[188]=Be;pe[189]=Be;pe[190]=Be;pe[191]=B5;for(let e=192;e<=215;e++)pe[e]=R5;pe[216]=D5;pe[217]=M5;pe[218]=L5;pe[219]=V5;pe[220]=Be;pe[221]=Be;pe[222]=Be;pe[223]=Be;for(let e=224;e<=243;e++)pe[e]=Rs("simple values are not supported");pe[244]=Be;pe[245]=Be;pe[246]=Be;pe[247]=F5;pe[248]=Rs("simple values are not supported");pe[249]=K5;pe[250]=q5;pe[251]=G5;pe[252]=Be;pe[253]=Be;pe[254]=Be;pe[255]=z5;var Ur=[];for(let e=0;e<24;e++)Ur[e]=new me(W.uint,e,1);for(let e=-1;e>=-24;e--)Ur[31-e]=new me(W.negint,e,1);Ur[64]=new me(W.bytes,new Uint8Array(0),1);Ur[96]=new me(W.string,"",1);Ur[128]=new me(W.array,0,1);Ur[160]=new me(W.map,0,1);Ur[244]=new me(W.false,!1,1);Ur[245]=new me(W.true,!0,1);Ur[246]=new me(W.null,null,1);function H5(e){switch(e.type){case W.false:return _r([244]);case W.true:return _r([245]);case W.null:return _r([246]);case W.bytes:return e.value.length?void 0:_r([64]);case W.string:return e.value===""?_r([96]):void 0;case W.array:return e.value===0?_r([128]):void 0;case W.map:return e.value===0?_r([160]):void 0;case W.uint:return e.value<24?_r([Number(e.value)]):void 0;case W.negint:if(e.value>=-24)return _r([31-Number(e.value)])}}var J5=Object.freeze({float64:!0,mapSorter:Y5,quickEncodeToken:H5});function Xy(){let e=[];return e[W.uint.major]=Gn,e[W.negint.major]=dc,e[W.bytes.major]=Bs,e[W.string.major]=x5,e[W.array.major]=pc,e[W.map.major]=hc,e[W.tag.major]=yc,e[W.float.major]=mc,e}var X5=Xy(),Q5=new My,Od=class Qy{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(`${Ly} object contains circular references`);return new Qy(r,t)}},zr={null:new me(W.null,null),undefined:new me(W.undefined,void 0),true:new me(W.true,!0),false:new me(W.false,!1),emptyArray:new me(W.array,0),emptyMap:new me(W.map,0)},nn={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new me(W.float,e):e>=0?new me(W.uint,e):new me(W.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new me(W.uint,e):new me(W.negint,e)},Uint8Array(e,t,r,n){return new me(W.bytes,e)},string(e,t,r,n){return new me(W.string,e)},boolean(e,t,r,n){return e?zr.true:zr.false},null(e,t,r,n){return zr.null},undefined(e,t,r,n){return zr.undefined},ArrayBuffer(e,t,r,n){return new me(W.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new me(W.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[zr.emptyArray,new me(W.break)]:zr.emptyArray;n=Od.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=ua(a,r,n);return r.addBreakTokens?[new me(W.array,e.length),i,new me(W.break)]:[new me(W.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length,s;if(a){s=new Array(a),n=Od.createCheck(n,e);let u=!i&&r.ignoreUndefinedProperties,l=0;for(let f of o){let d=i?e.get(f):e[f];u&&d===void 0||(s[l++]=[ua(f,r,n),ua(d,r,n)])}l<a&&(s.length=l)}return s?.length?(Z5(s,r),r.addBreakTokens?[new me(W.map,s.length),s,new me(W.break)]:[new me(W.map,s.length),s]):r.addBreakTokens===!0?[zr.emptyMap,new me(W.break)]:zr.emptyMap}};nn.Map=nn.Object;nn.Buffer=nn.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))nn[`${e}Array`]=nn.DataView;function ua(e,t={},r){let n=Gj(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||nn[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=nn[n];if(!o)throw new Error(`${Ly} unsupported type: ${n}`);return o(e,n,t,r)}function Z5(e,t){t.mapSorter&&e.sort(t.mapSorter)}function Y5(e,t){if(e[0]instanceof me&&t[0]instanceof me){let r=e[0],n=t[0];return r._keyBytes||(r._keyBytes=Ad(r.value)),n._keyBytes||(n._keyBytes=Ad(n.value)),Dy(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function Ad(e){return eC(e,X5,J5)}function Zy(e,t,r,n){if(Array.isArray(t))for(let i of t)Zy(e,i,r,n);else r[t.type.major](e,t,n)}var YU=W.uint.majorEncoded,e6=W.negint.majorEncoded,t6=W.bytes.majorEncoded,r6=W.string.majorEncoded,n6=W.array.majorEncoded,i6=W.float.majorEncoded|Fy,o6=W.float.majorEncoded|zy,a6=W.float.majorEncoded|Ky,s6=W.float.majorEncoded|qy,u6=BigInt(-1),l6=BigInt(1);function eC(e,t,r,n){let i=n instanceof Uint8Array,o=i?new r5(n):Q5,a=ua(e,r);if(!Array.isArray(a)&&r.quickEncodeToken){let s=r.quickEncodeToken(a);if(s)return i?(o.push(s),o.toBytes()):s;let u=t[a.type.major];if(u.encodedSize){let l=u.encodedSize(a,r);if(i||(o=new My(l)),u(o,a,r),o.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${a} was wrong`);return i?o.toBytes():Ry(o.chunks[0])}}return o.reset(),Zy(o,a,t,r),o.toBytes(!0)}var c6=Symbol.for("DONE"),f6=Symbol.for("BREAK"),d6=new Uint8Array(0);function tC(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 wc(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 rC(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),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(_){if(_ instanceof Uint8Array||(ArrayBuffer.isView(_)?_=new Uint8Array(_.buffer,_.byteOffset,_.byteLength):Array.isArray(_)&&(_=Uint8Array.from(_))),!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(_.length===0)return"";for(var L=0,J=0,B=0,k=_.length;B!==k&&_[B]===0;)B++,L++;for(var F=(k-B)*f+1>>>0,q=new Uint8Array(F);B!==k;){for(var R=_[B],Q=0,K=F-1;(R!==0||Q<J)&&K!==-1;K--,Q++)R+=256*q[K]>>>0,q[K]=R%s>>>0,R=R/s>>>0;if(R!==0)throw new Error("Non-zero carry");J=Q,B++}for(var re=F-J;re!==F&&q[re]===0;)re++;for(var $=u.repeat(L);re<F;++re)$+=e.charAt(q[re]);return $}function I(_){if(typeof _!="string")throw new TypeError("Expected String");if(_.length===0)return new Uint8Array;var L=0;if(_[L]!==" "){for(var J=0,B=0;_[L]===u;)J++,L++;for(var k=(_.length-L)*l+1>>>0,F=new Uint8Array(k);_[L];){var q=r[_.charCodeAt(L)];if(q===255)return;for(var R=0,Q=k-1;(q!==0||R<B)&&Q!==-1;Q--,R++)q+=s*F[Q]>>>0,F[Q]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");B=R,L++}if(_[L]!==" "){for(var K=k-B;K!==k&&F[K]===0;)K++;for(var re=new Uint8Array(J+(k-K)),$=J;K!==k;)re[$++]=F[K++];return re}}}function E(_){var L=I(_);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:I,decode:E}}var nC=rC,iC=nC,oC=iC,aC=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")}},sC=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 Yy(this,e)}},uC=class{decoders;constructor(e){this.decoders=e}or(e){return Yy(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 Yy(e,t){return new uC({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var lC=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 aC(e,t,r),this.decoder=new sC(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function eg({name:e,prefix:t,encode:r,decode:n}){return new lC(e,t,r,n)}function Ds({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=oC(r,e);return eg({prefix:t,name:e,encode:n,decode:o=>wc(i(o))})}function cC(e,t,r,n){let i=e.length;for(;e[i-1]==="=";)--i;let o=new Uint8Array(i*r/8|0),a=0,s=0,u=0;for(let l=0;l<i;++l){let f=t[e[l]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);s=s<<r|f,a+=r,a>=8&&(a-=8,o[u++]=255&s>>a)}if(a>=r||255&s<<8-a)throw new SyntaxError("Unexpected end of data");return o}function fC(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",a=0,s=0;for(let u=0;u<e.length;++u)for(s=s<<8|e[u],a+=8;a>r;)a-=r,o+=t[i&s>>a];if(a!==0&&(o+=t[i&s<<r-a]),n)for(;o.length*r&7;)o+="=";return o}function dC(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function Pr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=dC(n);return eg({prefix:t,name:e,encode(o){return fC(o,n,r)},decode(o){return cC(o,i,r,e)}})}var la=Pr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),p6=Pr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),h6=Pr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),y6=Pr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),g6=Pr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),m6=Pr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),b6=Pr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),v6=Pr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),w6=Pr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),cu=Ds({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),T6=Ds({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Wr=Ds({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),_6=Ds({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),pC=tg,Sd=128,hC=127,yC=~hC,gC=Math.pow(2,31);function tg(e,t,r){t=t||[],r=r||0;for(var n=r;e>=gC;)t[r++]=e&255|Sd,e/=128;for(;e&yC;)t[r++]=e&255|Sd,e>>>=7;return t[r]=e|0,tg.bytes=r-n+1,t}var mC=Ku,bC=128,Id=127;function Ku(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Ku.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Id)<<i:(a&Id)*Math.pow(2,i),i+=7}while(a>=bC);return Ku.bytes=o-n,r}var vC=Math.pow(2,7),wC=Math.pow(2,14),TC=Math.pow(2,21),_C=Math.pow(2,28),EC=Math.pow(2,35),xC=Math.pow(2,42),OC=Math.pow(2,49),AC=Math.pow(2,56),SC=Math.pow(2,63),IC=function(e){return e<vC?1:e<wC?2:e<TC?3:e<_C?4:e<EC?5:e<xC?6:e<OC?7:e<AC?8:e<SC?9:10},kC={encode:pC,decode:mC,encodingLength:IC},$C=kC,Ya=$C;function qu(e,t=0){return[Ya.decode(e,t),Ya.decode.bytes]}function es(e,t,r=0){return Ya.encode(e,t,r),t}function ts(e){return Ya.encodingLength(e)}function jC(e,t){let r=t.byteLength,n=ts(e),i=n+ts(r),o=new Uint8Array(i+r);return es(e,o,0),es(r,o,n),o.set(t,i),new Tc(e,r,t,o)}function CC(e){let t=wc(e),[r,n]=qu(t),[i,o]=qu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Tc(r,i,a,t)}function NC(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&tC(e.bytes,r.bytes)}}var Tc=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function kd(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return PC(r,Gu(e),t??Wr.encoder);default:return BC(r,Gu(e),t??la.encoder)}}var $d=new WeakMap;function Gu(e){let t=$d.get(e);if(t==null){let r=new Map;return $d.set(e,r),r}return t}var rg=class gt{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==Gi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==RC)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return gt.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=jC(t,r);return gt.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 gt.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&NC(t.multihash,n.multihash)}toString(t){return kd(this,t)}toJSON(){return{"/":kd(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 gt)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new gt(n,i,o,a??jd(n,i,o.bytes))}else if(r[DC]===!0){let{version:n,multihash:i,code:o}=r,a=CC(i);return gt.create(n,o,a)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==Gi)throw new Error(`Version 0 CID must use dag-pb (code: ${Gi}) block encoding`);return new gt(t,r,n,n.bytes)}case 1:{let i=jd(t,r,n.bytes);return new gt(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return gt.create(0,Gi,t)}static createV1(t,r){return gt.create(1,t,r)}static decode(t){let[r,n]=gt.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=gt.inspectBytes(t),n=r.size-r.multihashSize,i=wc(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),a=new Tc(r.multihashCode,r.digestSize,o,i);return[r.version===0?gt.createV0(a):gt.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,I]=qu(t.subarray(r));return r+=I,d},i=n(),o=Gi;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=UC(t,r),o=gt.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Gu(o).set(n,t),o}};function UC(e,t){switch(e[0]){case"Q":{let r=t??Wr;return[Wr.prefix,r.decode(`${Wr.prefix}${e}`)]}case Wr.prefix:{let r=t??Wr;return[Wr.prefix,r.decode(e)]}case la.prefix:{let r=t??la;return[la.prefix,r.decode(e)]}case cu.prefix:{let r=t??cu;return[cu.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 PC(e,t,r){let{prefix:n}=r;if(n!==Wr.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 BC(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var Gi=112,RC=18;function jd(e,t,r){let n=ts(e),i=n+ts(t),o=new Uint8Array(i+r.byteLength);return es(e,o,0),es(t,o,n),o.set(r,i),o}var DC=Symbol.for("@ipld/js-cid/CID"),ng=42;function MC(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=rg.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new me(W.tag,ng),new me(W.bytes,r)]}function LC(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function VC(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 FC(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 Cd={float64:!0,typeEncoders:{Map:FC,Object:MC,undefined:LC,number:VC}},E6={...Cd,typeEncoders:{...Cd.typeEncoders}};function zC(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return rg.decode(e.subarray(1))}var Wu={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Wu.tags[ng]=zC;var x6={...Wu,tags:Wu.tags.slice()},O6=Nr(cc(),1),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},Xi={"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=Xi["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=Xi["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,a]=t[i];switch(o){case"roots":{let s=Xi["CarV1HeaderOrV2Pragma > roots (anon)"](e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=Xi.Int(e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},Qi={"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=Qi["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=Qi["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,a]=t[i];switch(o){case"roots":{let s=Qi["CarV1HeaderOrV2Pragma > roots (anon)"](a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=Qi.Int(a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},A6={toTyped:Xi.CarV1HeaderOrV2Pragma,toRepresentation:Qi.CarV1HeaderOrV2Pragma},S6=Xy(),I6=Nr(cc(),1),k6=[new me(W.map,2),new me(W.string,"version"),new me(W.uint,1),new me(W.string,"roots")],$6=new me(W.tag,42),j6=Nr(cc(),1),{WARN:ig,LOG:C6,DEBUG:fu,VERBOSE:_c,ERROR:Xn}=Ce.setup(Ce.INFO);async function KC(e){let t=await GC(e);return await qC(t)}async function qC({rootCID:e,blockStore:t},r=[],n){if(!e||!t)throw Xn("Empty roots/blocks",{rootCID:e,blockStore:t});let i=[],o=null,a=e,s=new Set,u=null;for(;a;){let f=a.toString();if(s.has(f))throw Xn("[decodePubFromBlocks] pub chain has a loop",{currentCID:f,visited:[...s]});s.add(f);let d=await Zn(t,a);if(_c("[decodePubFromBlocks] root:",f,d,{blockStore:t}),!d)throw Xn("[decodePubFromBlocks] root not found in blockStore",{blockStore:t,currentCID:f});let I;if(d?.info){u||(u=d.applogs);let L=await Zn(t,d.applogs);I=await JC(L,t),o||(o=await Zn(t,d.info),fu("new format - infoLogs",o.logs.map(J=>({[J.toString()]:J}))))}else I=d.applogs;let E=async L=>{let J=L,B=await Zn(t,J);if(!B)throw Xn("Could not find applog CID in pub blocks:",J.toString(),{cid:J,root:d,blockStore:t}),new Error(`Could not find applog CID in pub blocks: ${J.toString()}`);return B.pv instanceof zt&&(B.pv=B.pv.toV1().toString()),{...B,cid:J.toV1().toString()}},_=await Promise.all(I.map(E));if(i=i.concat(_),!d.prev)break;if(n&&Ay(d.prev,n)){fu("[decodePubFromBlocks] stopping at stopAtCID:",n.toString());break}if(!await t.get(d.prev))throw Xn("[decodePubFromBlocks] prev snapshot missing from blockStore",{currentCID:f,prev:d.prev.toString(),stopAtCID:n?.toString(),visited:[...s]});a=d.prev}let l={cid:e,info:o?{...o,logs:await Promise.all(o.logs.map(async f=>{let d=f,I=await Zn(t,d);if(!I)throw Xn("Could not find info log CID in pub blocks:",d.toString(),{cid:d,blockStore:t}),new Error(`Could not find info log CID in pub blocks: ${d.toString()}`);return I.pv instanceof zt&&(I.pv=I.pv.toV1().toString()),{...I,cid:d.toV1().toString()}}))}:null,applogsCID:u,applogs:i};return fu("[decodePubFromBlocks] result:",l,{rootCID:e.toString(),blockStore:t,applogs:i}),l}async function GC(e){let t=(await e.getRoots()).map(n=>(typeof n.toV1=="function"?n:zt.decode(n.bytes)).toV1().toString()),r=new Map;for await(let{cid:n,bytes:i}of e.blocks()){let o=typeof n.toV1=="function"?n:zt.decode(n.bytes);_c({cidFromCarblocks:n,cid:o}),r.set(o.toV1().toString(),i)}return t.length!==1&&ig("Unexpected roots count:",t),{rootCID:zt.parse(t[0]),blockStore:{get:n=>r.get(n.toV1().toString())}}}async function Zn(e,t){try{var r=await e.get(t);if(!r)return ig("returning null"),null}catch(n){if(n.message==="Not Found")return null;throw n}return ac(r)}function WC(e){return async function*(){for(;;){let{done:t,value:r}=await e.read();if(_c("[car] chunk",{done:t,value:r}),t)break;yield r}}()}var{WARN:N6,LOG:U6,DEBUG:P6,VERBOSE:B6,ERROR:HC}=Ce.setup(Ce.INFO);async function JC(e,t){return XC(e)?(await Promise.all(e.chunks.map(async r=>{let n=await Zn(t,r);if(!n.logs)throw HC("Weird chunk",n);return n.logs}))).flat():e.logs}function XC(e){return e.chunks}var rs=mo(Ig(),1),QC=mo(kg(),1),og=!1,ag=!1;rs.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(og=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(ag=process?.env?.LOGGER_PERF_PREFIX==="true"));var ZC={prefix:void 0,time:og,delta:ag,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},du=[],sg=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(",")}]`}},ug=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Zi=!1,ui=class Tt{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=Tt.INFO,r={}){r=Object.assign({},ZC,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),a=(u,l)=>{function f(...I){let E=I[I.length-1];return E===i?E():(o(...I.slice(0,-1)),(async()=>{try{let _=E();return _ instanceof Promise?await _:_}finally{console.groupEnd()}})())}let d=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:l});return u?d:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:d})},s=a(t>=Tt.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(s(...u),new Error((0,QC.default)(u))),WARN:a(t>=Tt.WARN,this.wrapLog(console.warn,r)),LOG:a(t>=Tt.INFO,this.wrapLog(console.log,r)),DEBUG:a(t>=Tt.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:a(t>=Tt.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(rs.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=rs.isBrowser&&navigator.userAgent.includes("Chrome")?["",Tt.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(Zi?n.push(new ug("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();Tt.firstLog||(Tt.firstLog=i,Tt.lastLog=i);let o=new sg(i-Tt.firstLog,i-Tt.lastLog,t,r);return Tt.lastLog=i,n?o.toString():o}static getOriginFromStack(t){let r=!1;for(let n of t.split(`
62
- `)){let i=n.match(/^\s+at\s+(.*)/);if(i){if(r)return i[1].trim().replace(__dirname,"");r=!0}}}};rs.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(du&&du.length){for(let t of du)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof sg))return null;Zi||(Zi=!0);let t=ui.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof ug?(Zi||(Zi=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var{WARN:YC,LOG:R6,DEBUG:to,VERBOSE:D6,ERROR:Ms}=ui.setup(ui.INFO),Ec=["https://trustless-gateway.link/","https://ipfs.4everland.io/"].map(e=>({url:e}));async function xc(e,{readOnly:t=!0,pinnedCID:r,gateways:n=Ec}={}){let{cid:i,errors:o,isIpns:a}=uj(e);if(!i)throw Ms("Failed to parse pubID",e,o);to("[retrieveThread] parsedPubID",{cid:i.toString(),errors:o,isIpns:a});let s=await lg(i),{applogs:u,info:l}=await KC(s),f=u.filter(Lu);f.length&&YC(`Found ${f.length} encrypted logs - skipping`);let d=u.filter(E=>!Lu(E));go(d);let I=Ro.fromArray(d,`preview${e&&e!==i.toString()?"-"+e:""}@${i.toString()}`,t);return{cid:i,info:l,thread:I,encryptedCount:f.length}}async function lg(e,t=Ec){return e=Fu(e),to("Retrieving:",e,e.toString(),"from",t),await Oc(t,async(r,n)=>{var i=cg(r,e);n>1&&(i+=`&cache-bust=${performance.now()}`);let o=await fetch(i),a=await eN(o,i);to("[retrieveCar] GW result",{result:a,gateway:r});let s=await pp.fromIterable(a);to("[retrieveCar] GW decodeResult",{car:s,gateway:r});let u=(await s.getRoots())[0];if(!uc(e)&&!Ay(e,u))throw Ms("Fetched CAR has different CID",u.toString(),"than the one asked for:",e.toString());return s})}function cg(e,t,r="all"){let n=new URL(e.url),i=uc(t),o=`${n}${i?"ipns/":"ipfs/"}${t.toString()}?format=car&dag-scope=${r}`;return to({isIpns:i,url:o}),o}async function eN(e,t){if(!e?.ok||!e?.body)throw Ms("[retrieveCar] unexpected response",e?.statusText,{url:t});return WC(e.body.getReader())}async function Oc(e,t,r=1){try{return await Promise.any(Ca(e).map(async n=>{try{return await t(n,r)}catch(i){throw Ms("still trying",i),i instanceof Error?i:new Error(`[retrieveCar] error: ${i}`)}}))}catch(n){if(r<3)return await Oc(e,t,r+1);throw new Error("[Gateway] no valid results after 3 attempts via: "+Ca(e).map(({url:i})=>i)+`
63
- `+n.errors.map(i=>i.message))}}var{WARN:m8,LOG:b8,DEBUG:v8,VERBOSE:w8,ERROR:T8}=Ce.setup(Ce.INFO),{WARN:tN,LOG:_8,DEBUG:rN,VERBOSE:Ls,ERROR:E8}=Ce.setup(Ce.INFO),x8=at("queryDivergencesByPrev",function(e){rN(`queryDivergencesByPrev<${e.nameAndSizeUntracked}>`),e.filters.includes("lastWriteWins")&&tN("queryDivergencesByPrev on thread lastWriteWins",e);let t=nr(()=>{let r=new Map,n=new Set;Ls("all applogs:",e.applogs);for(let i of e.applogs){let o;i.pv&&(o=i.pv&&r.get(i.pv.toString()),n.delete(i.pv.toString())),Ls("traversing log",{log:i,prevLogs:o,leafs:Array.from(n)}),r.set(i.cid,o?[...o,i]:[i]),n.add(i.cid)}return Array.from(n).map(i=>{let o=new Ro(Ye({caller:"DivergenceLeaf",thread:e,pattern:`leaf: ${i}`}),r.get(i),e.filters,!0);return{log:o.latestLog,thread:o}})},{name:Ye({caller:"queryDivergencesByPrev",thread:e})});return Ls.isDisabled||qt(()=>Ls("[queryDivergencesByPrev] result:",Ar(t))),t},{equals:et.structural}),{WARN:O8,LOG:A8,DEBUG:S8,VERBOSE:I8,ERROR:k8}=ui.setup(ui.INFO);var{WARN:N8,LOG:U8,DEBUG:P8,VERBOSE:B8,ERROR:R8}=qs.setup(qs.INFO),nN="https://nftstorage.link";async function D8(e,{readOnly:t=!0,pinnedCID:r}={}){return xc(e,{readOnly:t,pinnedCID:r,gateways:[{url:nN}]})}export{nN as a,D8 as b};
61
+ `+" ".repeat(t)+o):o==="{"&&n>0?(n++,r+=o):(o==="}"&&n>1&&n--,r+=o)}return r}function TI(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]instanceof ai){if(t[r]!==e[r])return!1}else if(!et.structural(e[r],t[r]))return!1;return!0}var{WARN:ed,LOG:rU,DEBUG:_I,VERBOSE:nU,ERROR:pn}=ke.setup(ke.INFO,{prefix:"[thread]"});function tn(e){return e.init!==void 0}var ai=class{constructor(e,t,r,n=[],i={}){this.name=e,this._applogs=n,this.parents=t===null?null:_a(t),this.filters=r,ze(()=>this.parents?.length===0)&&ed("[Thread] empty parents array",e),i.skipObservable||_i(this,{applogsCids:Ze,applogsByCid:Ze,insert:Lt,size:Ze,isEmpty:Ze,firstLog:Ze,latestLog:Ze},{name:`Thread{${e}}`})}filters;parents;_subscribers=[];get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}insert(e){if(this.readOnly)throw pn("[Thread] insert() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw pn("[Thread] insert() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw pn("[Thread] insert() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insert(e)}insertRaw(e){if(this.readOnly)throw pn("[Thread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw pn("[Thread] insertRaw() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw pn("[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):ed("unsubscribe called for non-existent",e)}notifySubscribers(e){_I(`[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 pn("[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 ze(()=>this.size)}get nameAndSizeUntracked(){return ze(()=>`${this.name} (${this.size})`)}get prettyName(){return wI(this.name)}get hasParents(){return!!this.parents?.length}},EI=class Qh extends ai{static fromArray(t,r){return new Qh(r||"static",null,[],t)}constructor(t,r,n,i){super(t,r,n,i,{skipObservable:!0})}get readOnly(){return!0}},xI={};yp(xI,{code:()=>my,decode:()=>ac,encode:()=>oc,format:()=>fd,name:()=>P$,parse:()=>R$,stringify:()=>fd});var OI=["string","number","bigint","symbol"],AI=["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 SI(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return OI.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":II(e)?"Buffer":kI(e)||"Object"}function II(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function kI(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(AI.includes(t))return t}var M=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}};M.uint=new M(0,"uint",!0);M.negint=new M(1,"negint",!0);M.bytes=new M(2,"bytes",!0);M.string=new M(3,"string",!0);M.array=new M(4,"array",!1);M.map=new M(5,"map",!1);M.tag=new M(6,"tag",!1);M.float=new M(7,"float",!0);M.false=new M(7,"false",!0);M.true=new M(7,"true",!0);M.null=new M(7,"null",!0);M.undefined=new M(7,"undefined",!0);M.break=new M(7,"break",!0);var ae=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}`}},ji=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",$I=new TextDecoder,jI=new TextEncoder;function Va(e){return ji&&globalThis.Buffer.isBuffer(e)}function ql(e){return e instanceof Uint8Array?Va(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var CI=ji?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):rd(e,t,r):(e,t,r)=>r-t>64?$I.decode(e.subarray(t,r)):rd(e,t,r),Zh=ji?e=>e.length>64?globalThis.Buffer.from(e):td(e):e=>e.length>64?jI.encode(e):td(e),Wl=ji?(e,t,r)=>Va(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),NI=ji?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),ql(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},UI=ji?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function PI(e,t){if(Va(e)&&Va(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 td(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 rd(e,t,r){let n=[];for(;t<r;){let i=e[t],o=null,a=i>239?4:i>223?3:i>191?2:1;if(t+a<=r){let s,u,l,f;switch(a){case 1:i<128&&(o=i);break;case 2:s=e[t+1],(s&192)===128&&(f=(i&31)<<6|s&63,f>127&&(o=f));break;case 3:s=e[t+1],u=e[t+2],(s&192)===128&&(u&192)===128&&(f=(i&15)<<12|(s&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:s=e[t+1],u=e[t+2],l=e[t+3],(s&192)===128&&(u&192)===128&&(l&192)===128&&(f=(i&15)<<18|(s&63)<<12|(u&63)<<6|l&63,f>65535&&f<1114112&&(o=f))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),t+=a}return Yh(n)}var nd=4096;function Yh(e){let t=e.length;if(t<=nd)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=nd));return r}var BI=256,ey=class{constructor(e=BI){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 r=t.length-(this.maxCursor-this.cursor)-1;t.set(e,r)}else{if(t){let r=t.length-(this.maxCursor-this.cursor)-1;r<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,r),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=UI(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=Wl(r,0,this.cursor)}else t=NI(this.chunks,this.cursor);return e&&this.reset(),t}},Te="CBOR decode error:",mn="CBOR encode error:",Uo=[];Uo[23]=1;Uo[24]=2;Uo[25]=3;Uo[26]=5;Uo[27]=9;function Ci(e,t,r){if(e.length-t<r)throw new Error(`${Te} not enough data for type`)}var lt=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Rn(e,t,r){Ci(e,t,1);let n=e[t];if(r.strict===!0&&n<lt[0])throw new Error(`${Te} integer encoded in more bytes than necessary (strict decode)`);return n}function Dn(e,t,r){Ci(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<lt[1])throw new Error(`${Te} integer encoded in more bytes than necessary (strict decode)`);return n}function Mn(e,t,r){Ci(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<lt[2])throw new Error(`${Te} integer encoded in more bytes than necessary (strict decode)`);return n}function Ln(e,t,r){Ci(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<lt[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 RI(e,t,r,n){return new ae(M.uint,Rn(e,t+1,n),2)}function DI(e,t,r,n){return new ae(M.uint,Dn(e,t+1,n),3)}function MI(e,t,r,n){return new ae(M.uint,Mn(e,t+1,n),5)}function LI(e,t,r,n){return new ae(M.uint,Ln(e,t+1,n),9)}function Vn(e,t){return Jt(e,0,t.value)}function Jt(e,t,r){if(r<lt[0]){let n=Number(r);e.push([t|n])}else if(r<lt[1]){let n=Number(r);e.push([t|24,n])}else if(r<lt[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<lt[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<lt[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=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]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,e.push(i)}else throw new Error(`${Te} encountered BigInt larger than allowable range`)}}Vn.encodedSize=function(e){return Jt.encodedSize(e.value)};Jt.encodedSize=function(e){return e<lt[0]?1:e<lt[1]?2:e<lt[2]?3:e<lt[3]?5:9};Vn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function VI(e,t,r,n){return new ae(M.negint,-1-Rn(e,t+1,n),2)}function FI(e,t,r,n){return new ae(M.negint,-1-Dn(e,t+1,n),3)}function zI(e,t,r,n){return new ae(M.negint,-1-Mn(e,t+1,n),5)}var Hl=BigInt(-1),ty=BigInt(1);function KI(e,t,r,n){let i=Ln(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ae(M.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Te} integers outside of the safe integer range are not supported`);return new ae(M.negint,Hl-BigInt(i),9)}function Jl(e,t){let r=t.value,n=typeof r=="bigint"?r*Hl-ty:r*-1-1;Jt(e,t.type.majorEncoded,n)}Jl.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*Hl-ty:t*-1-1;return r<lt[0]?1:r<lt[1]?2:r<lt[2]?3:r<lt[3]?5:9};Jl.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Po(e,t,r,n){Ci(e,t,r+n);let i=Wl(e,t+r,t+r+n);return new ae(M.bytes,i,r+n)}function GI(e,t,r,n){return Po(e,t,1,r)}function qI(e,t,r,n){return Po(e,t,2,Rn(e,t+1,n))}function WI(e,t,r,n){return Po(e,t,3,Dn(e,t+1,n))}function HI(e,t,r,n){return Po(e,t,5,Mn(e,t+1,n))}function JI(e,t,r,n){let i=Ln(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Te} 64-bit integer bytes lengths not supported`);return Po(e,t,9,i)}function Fa(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===M.string?Zh(e.value):e.value),e.encodedBytes}function ks(e,t){let r=Fa(t);Jt(e,t.type.majorEncoded,r.length),e.push(r)}ks.encodedSize=function(e){let t=Fa(e);return Jt.encodedSize(t.length)+t.length};ks.compareTokens=function(e,t){return XI(Fa(e),Fa(t))};function XI(e,t){return e.length<t.length?-1:e.length>t.length?1:PI(e,t)}function Bo(e,t,r,n,i){let o=r+n;Ci(e,t,o);let a=new ae(M.string,CI(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=Wl(e,t+r,t+o)),a}function QI(e,t,r,n){return Bo(e,t,1,r,n)}function ZI(e,t,r,n){return Bo(e,t,2,Rn(e,t+1,n),n)}function YI(e,t,r,n){return Bo(e,t,3,Dn(e,t+1,n),n)}function ek(e,t,r,n){return Bo(e,t,5,Mn(e,t+1,n),n)}function tk(e,t,r,n){let i=Ln(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Te} 64-bit integer string lengths not supported`);return Bo(e,t,9,i,n)}var rk=ks;function Ni(e,t,r,n){return new ae(M.array,n,r)}function nk(e,t,r,n){return Ni(e,t,1,r)}function ik(e,t,r,n){return Ni(e,t,2,Rn(e,t+1,n))}function ok(e,t,r,n){return Ni(e,t,3,Dn(e,t+1,n))}function ak(e,t,r,n){return Ni(e,t,5,Mn(e,t+1,n))}function sk(e,t,r,n){let i=Ln(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Te} 64-bit integer array lengths not supported`);return Ni(e,t,9,i)}function uk(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Te} indefinite length items not allowed`);return Ni(e,t,1,1/0)}function Xl(e,t){Jt(e,M.array.majorEncoded,t.value)}Xl.compareTokens=Vn.compareTokens;Xl.encodedSize=function(e){return Jt.encodedSize(e.value)};function Ui(e,t,r,n){return new ae(M.map,n,r)}function lk(e,t,r,n){return Ui(e,t,1,r)}function ck(e,t,r,n){return Ui(e,t,2,Rn(e,t+1,n))}function fk(e,t,r,n){return Ui(e,t,3,Dn(e,t+1,n))}function dk(e,t,r,n){return Ui(e,t,5,Mn(e,t+1,n))}function pk(e,t,r,n){let i=Ln(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Te} 64-bit integer map lengths not supported`);return Ui(e,t,9,i)}function hk(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Te} indefinite length items not allowed`);return Ui(e,t,1,1/0)}function Ql(e,t){Jt(e,M.map.majorEncoded,t.value)}Ql.compareTokens=Vn.compareTokens;Ql.encodedSize=function(e){return Jt.encodedSize(e.value)};function yk(e,t,r,n){return new ae(M.tag,r,1)}function gk(e,t,r,n){return new ae(M.tag,Rn(e,t+1,n),2)}function mk(e,t,r,n){return new ae(M.tag,Dn(e,t+1,n),3)}function bk(e,t,r,n){return new ae(M.tag,Mn(e,t+1,n),5)}function vk(e,t,r,n){return new ae(M.tag,Ln(e,t+1,n),9)}function Zl(e,t){Jt(e,M.tag.majorEncoded,t.value)}Zl.compareTokens=Vn.compareTokens;Zl.encodedSize=function(e){return Jt.encodedSize(e.value)};var wk=20,Tk=21,_k=22,Ek=23;function xk(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Te} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ae(M.null,null,1):new ae(M.undefined,void 0,1)}function Ok(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Te} indefinite length items not allowed`);return new ae(M.break,void 0,1)}function Yl(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 ae(M.float,e,t)}function Ak(e,t,r,n){return Yl(tc(e,t+1),3,n)}function Sk(e,t,r,n){return Yl(rc(e,t+1),5,n)}function Ik(e,t,r,n){return Yl(oy(e,t+1),9,n)}function ec(e,t,r){let n=t.value;if(n===!1)e.push([M.float.majorEncoded|wk]);else if(n===!0)e.push([M.float.majorEncoded|Tk]);else if(n===null)e.push([M.float.majorEncoded|_k]);else if(n===void 0)e.push([M.float.majorEncoded|Ek]);else{let i,o=!1;(!r||r.float64!==!0)&&(ny(n),i=tc(er,1),n===i||Number.isNaN(n)?(er[0]=249,e.push(er.slice(0,3)),o=!0):(iy(n),i=rc(er,1),n===i&&(er[0]=250,e.push(er.slice(0,5)),o=!0))),o||(kk(n),i=oy(er,1),er[0]=251,e.push(er.slice(0,9)))}}ec.encodedSize=function(e,t){let r=e.value;if(r===!1||r===!0||r===null||r===void 0)return 1;if(!t||t.float64!==!0){ny(r);let n=tc(er,1);if(r===n||Number.isNaN(r))return 3;if(iy(r),n=rc(er,1),r===n)return 5}return 9};var ry=new ArrayBuffer(9),Nt=new DataView(ry,1),er=new Uint8Array(ry,0);function ny(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 tc(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 iy(e){Nt.setFloat32(0,e,!1)}function rc(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 kk(e){Nt.setFloat64(0,e,!1)}function oy(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)}ec.compareTokens=Vn.compareTokens;function Pe(e,t,r){throw new Error(`${Te} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function $s(e){return()=>{throw new Error(`${Te} ${e}`)}}var ce=[];for(let e=0;e<=23;e++)ce[e]=Pe;ce[24]=RI;ce[25]=DI;ce[26]=MI;ce[27]=LI;ce[28]=Pe;ce[29]=Pe;ce[30]=Pe;ce[31]=Pe;for(let e=32;e<=55;e++)ce[e]=Pe;ce[56]=VI;ce[57]=FI;ce[58]=zI;ce[59]=KI;ce[60]=Pe;ce[61]=Pe;ce[62]=Pe;ce[63]=Pe;for(let e=64;e<=87;e++)ce[e]=GI;ce[88]=qI;ce[89]=WI;ce[90]=HI;ce[91]=JI;ce[92]=Pe;ce[93]=Pe;ce[94]=Pe;ce[95]=$s("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ce[e]=QI;ce[120]=ZI;ce[121]=YI;ce[122]=ek;ce[123]=tk;ce[124]=Pe;ce[125]=Pe;ce[126]=Pe;ce[127]=$s("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ce[e]=nk;ce[152]=ik;ce[153]=ok;ce[154]=ak;ce[155]=sk;ce[156]=Pe;ce[157]=Pe;ce[158]=Pe;ce[159]=uk;for(let e=160;e<=183;e++)ce[e]=lk;ce[184]=ck;ce[185]=fk;ce[186]=dk;ce[187]=pk;ce[188]=Pe;ce[189]=Pe;ce[190]=Pe;ce[191]=hk;for(let e=192;e<=215;e++)ce[e]=yk;ce[216]=gk;ce[217]=mk;ce[218]=bk;ce[219]=vk;ce[220]=Pe;ce[221]=Pe;ce[222]=Pe;ce[223]=Pe;for(let e=224;e<=243;e++)ce[e]=$s("simple values are not supported");ce[244]=Pe;ce[245]=Pe;ce[246]=Pe;ce[247]=xk;ce[248]=$s("simple values are not supported");ce[249]=Ak;ce[250]=Sk;ce[251]=Ik;ce[252]=Pe;ce[253]=Pe;ce[254]=Pe;ce[255]=Ok;var vr=[];for(let e=0;e<24;e++)vr[e]=new ae(M.uint,e,1);for(let e=-1;e>=-24;e--)vr[31-e]=new ae(M.negint,e,1);vr[64]=new ae(M.bytes,new Uint8Array(0),1);vr[96]=new ae(M.string,"",1);vr[128]=new ae(M.array,0,1);vr[160]=new ae(M.map,0,1);vr[244]=new ae(M.false,!1,1);vr[245]=new ae(M.true,!0,1);vr[246]=new ae(M.null,null,1);function $k(){let e=[];return e[M.uint.major]=Vn,e[M.negint.major]=Jl,e[M.bytes.major]=ks,e[M.string.major]=rk,e[M.array.major]=Xl,e[M.map.major]=Ql,e[M.tag.major]=Zl,e[M.float.major]=ec,e}var iU=$k(),au=new ey,id=class ay{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 ay(r,t)}},Lr={null:new ae(M.null,null),undefined:new ae(M.undefined,void 0),true:new ae(M.true,!0),false:new ae(M.false,!1),emptyArray:new ae(M.array,0),emptyMap:new ae(M.map,0)},rn={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ae(M.float,e):e>=0?new ae(M.uint,e):new ae(M.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ae(M.uint,e):new ae(M.negint,e)},Uint8Array(e,t,r,n){return new ae(M.bytes,e)},string(e,t,r,n){return new ae(M.string,e)},boolean(e,t,r,n){return e?Lr.true:Lr.false},null(e,t,r,n){return Lr.null},undefined(e,t,r,n){return Lr.undefined},ArrayBuffer(e,t,r,n){return new ae(M.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ae(M.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Lr.emptyArray,new ae(M.break)]:Lr.emptyArray;n=id.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=na(a,r,n);return r.addBreakTokens?[new ae(M.array,e.length),i,new ae(M.break)]:[new ae(M.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length;if(!a)return r.addBreakTokens===!0?[Lr.emptyMap,new ae(M.break)]:Lr.emptyMap;n=id.createCheck(n,e);let s=[],u=0;for(let l of o)s[u++]=[na(l,r,n),na(i?e.get(l):e[l],r,n)];return jk(s,r),r.addBreakTokens?[new ae(M.map,a),s,new ae(M.break)]:[new ae(M.map,a),s]}};rn.Map=rn.Object;rn.Buffer=rn.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))rn[`${e}Array`]=rn.DataView;function na(e,t={},r){let n=SI(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||rn[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=rn[n];if(!o)throw new Error(`${mn} unsupported type: ${n}`);return o(e,n,t,r)}function jk(e,t){t.mapSorter&&e.sort(t.mapSorter)}function sy(e,t,r,n){if(Array.isArray(t))for(let i of t)sy(e,i,r,n);else r[t.type.major](e,t,n)}function Ck(e,t,r){let n=na(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 a=o.encodedSize(n,r),s=new ey(a);if(o(s,n,r),s.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return ql(s.chunks[0])}}return au.reset(),sy(au,n,t,r),au.toBytes(!0)}var Nk={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Uk=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=vr[e];if(t===void 0){let r=ce[e];if(!r)throw new Error(`${Te} 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}},ho=Symbol.for("DONE"),js=Symbol.for("BREAK");function Pk(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=yo(t,r);if(o===js){if(e.value===1/0)break;throw new Error(`${Te} got unexpected break to lengthed array`)}if(o===ho)throw new Error(`${Te} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function Bk(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},o=n?new Map:void 0;for(let a=0;a<e.value;a++){let s=yo(t,r);if(s===js){if(e.value===1/0)break;throw new Error(`${Te} got unexpected break to lengthed map`)}if(s===ho)throw new Error(`${Te} found map but not enough entries (got ${a} [no key], expected ${e.value})`);if(n!==!0&&typeof s!="string")throw new Error(`${Te} non-string keys not supported (got ${typeof s})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(s)||!n&&s in i))throw new Error(`${Te} found repeat map key "${s}"`);let u=yo(t,r);if(u===ho)throw new Error(`${Te} found map but not enough entries (got ${a} [no value], expected ${e.value})`);n?o.set(s,u):i[s]=u}return n?o:i}function yo(e,t){if(e.done())return ho;let r=e.next();if(r.type===M.break)return js;if(r.type.terminal)return r.value;if(r.type===M.array)return Pk(r,e,t);if(r.type===M.map)return Bk(r,e,t);if(r.type===M.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=yo(e,t);return t.tags[r.value](n)}throw new Error(`${Te} tag not supported (${r.value})`)}throw new Error("unsupported")}function Rk(e,t){if(!(e instanceof Uint8Array))throw new Error(`${Te} data to decode must be a Uint8Array`);t=Object.assign({},Nk,t);let r=t.tokenizer||new Uk(e,t),n=yo(r,t);if(n===ho)throw new Error(`${Te} did not find any content to decode`);if(n===js)throw new Error(`${Te} got unexpected break`);return[n,e.subarray(r.pos())]}function Dk(e,t){let[r,n]=Rk(e,t);if(n.length>0)throw new Error(`${Te} too many terminals, data makes no sense`);return r}var Mk=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(t.type===M.array&&(t.elements++,t.elements!==1&&e.push([44])),t.type===M.map&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[M.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)}[M.negint.major](e,t){this[M.uint.major](e,t)}[M.bytes.major](e,t){throw new Error(`${mn} unsupported type: Uint8Array`)}[M.string.major](e,t){this.prefix(e);let r=Zh(JSON.stringify(t.value));e.push(r.length>32?ql(r):r)}[M.array.major](e,t){this.prefix(e),this.inRecursive.push({type:M.array,elements:0}),e.push([91])}[M.map.major](e,t){this.prefix(e),this.inRecursive.push({type:M.map,elements:0}),e.push([123])}[M.tag.major](e,t){}[M.float.major](e,t){if(t.type.name==="break"){let o=this.inRecursive.pop();if(o){if(o.type===M.array)e.push([93]);else if(o.type===M.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 Lk(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!==M.string||n.type!==M.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 Vk={addBreakTokens:!0,mapSorter:Lk};function Fk(e,t){return t=Object.assign({},Vk,t),Ck(e,new Mk,t)}var uy=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(`${Te} 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(`${Te} unexpected token at position ${this._pos}, expected to find '${String.fromCharCode(...e)}'`)}parseNumber(){let e=this._pos,t=!1,r=!1,n=a=>{for(;!this.done();){let s=this.ch();if(a.includes(s))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 ae(M.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(`${Te} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(r)throw new Error(`${Te} 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 ae(M.float,o,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(o)?new ae(o>=0?M.uint:M.negint,o,this._pos-e):new ae(o>=0?M.uint:M.negint,BigInt(i),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${Te} 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 a=this.data[i];if(a===92||a<32||a>=128)break;if(a===34){let s=String.fromCharCode.apply(null,this.data.subarray(this._pos,i));return this._pos=i+1,new ae(M.string,s,o)}}let e=this._pos,t=[],r=()=>{if(this._pos+4>=this.data.length)throw new Error(`${Te} unexpected end of unicode escape sequence at position ${this._pos}`);let i=0;for(let o=0;o<4;o++){let a=this.ch();if(a>=48&&a<=57)a-=48;else if(a>=97&&a<=102)a=a-97+10;else if(a>=65&&a<=70)a=a-65+10;else throw new Error(`${Te} unexpected unicode escape character at position ${this._pos}`);i=i*16+a,this._pos++}return i},n=()=>{let i=this.ch(),o=null,a=i>239?4:i>223?3:i>191?2:1;if(this._pos+a>this.data.length)throw new Error(`${Te} unexpected unicode sequence at position ${this._pos}`);let s,u,l,f;switch(a){case 1:i<128&&(o=i);break;case 2:s=this.data[this._pos+1],(s&192)===128&&(f=(i&31)<<6|s&63,f>127&&(o=f));break;case 3:s=this.data[this._pos+1],u=this.data[this._pos+2],(s&192)===128&&(u&192)===128&&(f=(i&15)<<12|(s&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:s=this.data[this._pos+1],u=this.data[this._pos+2],l=this.data[this._pos+3],(s&192)===128&&(u&192)===128&&(l&192)===128&&(f=(i&15)<<18|(s&63)<<12|(u&63)<<6|l&63,f>65535&&f<1114112&&(o=f))}o===null?(o=65533,a=1):o>65535&&(o-=65536,t.push(o>>>10&1023|55296),o=56320|o&1023),t.push(o),this._pos+=a};for(;!this.done();){let i=this.ch(),o;switch(i){case 92:if(this._pos++,this.done())throw new Error(`${Te} 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(`${Te} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new ae(M.string,Yh(t),this._pos-e);default:if(i<32)throw new Error(`${Te} invalid control character at position ${this._pos}`);i<128?(t.push(i),this._pos++):n()}}throw new Error(`${Te} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new ae(M.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new ae(M.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new ae(M.null,null,4);case 102:return this.expect([102,97,108,115,101]),new ae(M.false,!1,5);case 116:return this.expect([116,114,117,101]),new ae(M.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(`${Te} 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 ae(M.break,void 0,1);if(this.ch()!==44)throw new Error(`${Te} 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 ae(M.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 ae(M.break,void 0,1);if(this.ch()!==44)throw new Error(`${Te} 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 ae(M.break,void 0,1);let e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${Te} 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(`${Te} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}};function zk(e,t){return t=Object.assign({tokenizer:new uy(e,t)},t),Dk(e,t)}var oU=new Uint8Array(0);function Kk(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 nc(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 Gk(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),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(_){if(_ instanceof Uint8Array||(ArrayBuffer.isView(_)?_=new Uint8Array(_.buffer,_.byteOffset,_.byteLength):Array.isArray(_)&&(_=Uint8Array.from(_))),!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(_.length===0)return"";for(var L=0,J=0,B=0,k=_.length;B!==k&&_[B]===0;)B++,L++;for(var F=(k-B)*f+1>>>0,G=new Uint8Array(F);B!==k;){for(var R=_[B],Q=0,K=F-1;(R!==0||Q<J)&&K!==-1;K--,Q++)R+=256*G[K]>>>0,G[K]=R%s>>>0,R=R/s>>>0;if(R!==0)throw new Error("Non-zero carry");J=Q,B++}for(var re=F-J;re!==F&&G[re]===0;)re++;for(var $=u.repeat(L);re<F;++re)$+=e.charAt(G[re]);return $}function I(_){if(typeof _!="string")throw new TypeError("Expected String");if(_.length===0)return new Uint8Array;var L=0;if(_[L]!==" "){for(var J=0,B=0;_[L]===u;)J++,L++;for(var k=(_.length-L)*l+1>>>0,F=new Uint8Array(k);_[L];){var G=r[_.charCodeAt(L)];if(G===255)return;for(var R=0,Q=k-1;(G!==0||R<B)&&Q!==-1;Q--,R++)G+=s*F[Q]>>>0,F[Q]=G%256>>>0,G=G/256>>>0;if(G!==0)throw new Error("Non-zero carry");B=R,L++}if(_[L]!==" "){for(var K=k-B;K!==k&&F[K]===0;)K++;for(var re=new Uint8Array(J+(k-K)),$=J;K!==k;)re[$++]=F[K++];return re}}}function E(_){var L=I(_);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:I,decode:E}}var qk=Gk,Wk=qk,Hk=Wk,Jk=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")}},Xk=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 ly(this,e)}},Qk=class{decoders;constructor(e){this.decoders=e}or(e){return ly(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 ly(e,t){return new Qk({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Zk=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 Jk(e,t,r),this.decoder=new Xk(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function cy({name:e,prefix:t,encode:r,decode:n}){return new Zk(e,t,r,n)}function Cs({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Hk(r,e);return cy({prefix:t,name:e,encode:n,decode:o=>nc(i(o))})}function Yk(e,t,r,n){let i=e.length;for(;e[i-1]==="=";)--i;let o=new Uint8Array(i*r/8|0),a=0,s=0,u=0;for(let l=0;l<i;++l){let f=t[e[l]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);s=s<<r|f,a+=r,a>=8&&(a-=8,o[u++]=255&s>>a)}if(a>=r||255&s<<8-a)throw new SyntaxError("Unexpected end of data");return o}function e$(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",a=0,s=0;for(let u=0;u<e.length;++u)for(s=s<<8|e[u],a+=8;a>r;)a-=r,o+=t[i&s>>a];if(a!==0&&(o+=t[i&s<<r-a]),n)for(;o.length*r&7;)o+="=";return o}function t$(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function kt({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=t$(n);return cy({prefix:t,name:e,encode(o){return e$(o,n,r)},decode(o){return Yk(o,i,r,e)}})}var ia=kt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),aU=kt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),sU=kt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),uU=kt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),lU=kt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),cU=kt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),fU=kt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),dU=kt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),pU=kt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),oa=Cs({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),hU=Cs({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),qr=Cs({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),yU=Cs({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),fy={};yp(fy,{Digest:()=>Ns,create:()=>ic,decode:()=>py,equals:()=>hy,hasCode:()=>w$});var r$=dy,od=128,n$=127,i$=~n$,o$=Math.pow(2,31);function dy(e,t,r){t=t||[],r=r||0;for(var n=r;e>=o$;)t[r++]=e&255|od,e/=128;for(;e&i$;)t[r++]=e&255|od,e>>>=7;return t[r]=e|0,dy.bytes=r-n+1,t}var a$=Pu,s$=128,ad=127;function Pu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Pu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&ad)<<i:(a&ad)*Math.pow(2,i),i+=7}while(a>=s$);return Pu.bytes=o-n,r}var u$=Math.pow(2,7),l$=Math.pow(2,14),c$=Math.pow(2,21),f$=Math.pow(2,28),d$=Math.pow(2,35),p$=Math.pow(2,42),h$=Math.pow(2,49),y$=Math.pow(2,56),g$=Math.pow(2,63),m$=function(e){return e<u$?1:e<l$?2:e<c$?3:e<f$?4:e<d$?5:e<p$?6:e<h$?7:e<y$?8:e<g$?9:10},b$={encode:r$,decode:a$,encodingLength:m$},v$=b$,za=v$;function Bu(e,t=0){return[za.decode(e,t),za.decode.bytes]}function Ka(e,t,r=0){return za.encode(e,t,r),t}function Ga(e){return za.encodingLength(e)}function ic(e,t){let r=t.byteLength,n=Ga(e),i=n+Ga(r),o=new Uint8Array(i+r);return Ka(e,o,0),Ka(r,o,n),o.set(t,i),new Ns(e,r,t,o)}function py(e){let t=nc(e),[r,n]=Bu(t),[i,o]=Bu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Ns(r,i,a,t)}function hy(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Kk(e.bytes,r.bytes)}}var Ns=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function w$(e,t){return e.code===t}function sd(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return _$(r,Ru(e),t??qr.encoder);default:return E$(r,Ru(e),t??ia.encoder)}}var ud=new WeakMap;function Ru(e){let t=ud.get(e);if(t==null){let r=new Map;return ud.set(e,r),r}return t}var zt=class yt{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==Gi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==x$)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return yt.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=ic(t,r);return yt.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 yt.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&hy(t.multihash,n.multihash)}toString(t){return sd(this,t)}toJSON(){return{"/":sd(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 yt)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new yt(n,i,o,a??ld(n,i,o.bytes))}else if(r[O$]===!0){let{version:n,multihash:i,code:o}=r,a=py(i);return yt.create(n,o,a)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==Gi)throw new Error(`Version 0 CID must use dag-pb (code: ${Gi}) block encoding`);return new yt(t,r,n,n.bytes)}case 1:{let i=ld(t,r,n.bytes);return new yt(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return yt.create(0,Gi,t)}static createV1(t,r){return yt.create(1,t,r)}static decode(t){let[r,n]=yt.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=yt.inspectBytes(t),n=r.size-r.multihashSize,i=nc(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),a=new Ns(r.multihashCode,r.digestSize,o,i);return[r.version===0?yt.createV0(a):yt.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,I]=Bu(t.subarray(r));return r+=I,d},i=n(),o=Gi;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=T$(t,r),o=yt.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ru(o).set(n,t),o}};function T$(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 ia.prefix:{let r=t??ia;return[ia.prefix,r.decode(e)]}case oa.prefix:{let r=t??oa;return[oa.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 _$(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 E$(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var Gi=112,x$=18;function ld(e,t,r){let n=Ga(e),i=n+Ga(t),o=new Uint8Array(i+r.byteLength);return Ka(e,o,0),Ka(t,o,n),o.set(r,i),o}var O$=Symbol.for("@ipld/js-cid/CID"),A$=20;function yy({name:e,code:t,encode:r,minDigestLength:n,maxDigestLength:i}){return new S$(e,t,r,n,i)}var S$=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,r,n,i){this.name=e,this.code=t,this.encode=r,this.minDigestLength=n??A$,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?cd(r,this.code,t?.truncate):r.then(n=>cd(n,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};function cd(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 ic(t,e)}var gy=kt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),gU=kt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),mU=kt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),bU=kt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function I$(e){return e instanceof ArrayBuffer?new Uint8Array(e,0,e.byteLength):e}function k$(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=zt.asCID(e);if(!t)return null;let r=t.toString();return[new ae(M.map,1/0,1),new ae(M.string,"/",1),new ae(M.string,r,r.length),new ae(M.break,void 0,1)]}function qa(e){let t=gy.encode(e).slice(1);return[new ae(M.map,1/0,1),new ae(M.string,"/",1),new ae(M.map,1/0,1),new ae(M.string,"bytes",5),new ae(M.string,t,t.length),new ae(M.break,void 0,1),new ae(M.break,void 0,1)]}function Qt(e){return qa(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function $$(e){return qa(new Uint8Array(e))}function j$(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function C$(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 N$={typeEncoders:{Object:k$,Buffer:qa,Uint8Array:qa,Int8Array:Qt,Uint16Array:Qt,Int16Array:Qt,Uint32Array:Qt,Int32Array:Qt,Float32Array:Qt,Float64Array:Qt,Uint8ClampedArray:Qt,BigInt64Array:Qt,BigUint64Array:Qt,DataView:Qt,ArrayBuffer:$$,undefined:j$,number:C$}},U$=class extends uy{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===M.map){let t=this._next();if(t.type===M.string&&t.value==="/"){let r=this._next();if(r.type===M.string){if(this._next().type!==M.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new ae(M.tag,42,0)}if(r.type===M.map){let n=this._next();if(n.type===M.string&&n.value==="bytes"){let i=this._next();if(i.type===M.string){for(let a=0;a<2;a++)if(this._next().type!==M.break)throw new Error("Invalid encoded Bytes form");let o=gy.decode(`m${i.value}`);return new ae(M.bytes,o,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(n)}this.tokenBuffer.push(r)}this.tokenBuffer.push(t)}return e}},Du={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Du.tags[42]=zt.parse;var P$="dag-json",my=297,oc=e=>Fk(e,N$),ac=e=>{let t=I$(e),r=Object.assign(Du,{tokenizer:new U$(t,Du)});return zk(t,r)},fd=e=>B$.decode(oc(e)),B$=new TextDecoder,R$=e=>ac(D$.encode(e)),D$=new TextEncoder;function M$(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function by(e,t,r=""){let n=M$(e),i=e?.length,o=t!==void 0;if(!n||o&&i!==t){let a=r&&`"${r}" `,s=o?` of length ${t}`:"",u=n?`length=${i}`:`type=${typeof e}`;throw new Error(a+"expected Uint8Array"+s+", got "+u)}return e}function dd(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 L$(e,t){by(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 Mu(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function su(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function fr(e,t){return e<<32-t|e>>>t}function V$(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 F$=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function z$(e,t,r){return e&t^~e&r}function K$(e,t,r){return e&t^e&r^t&r}var G$=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=su(this.buffer)}update(e){dd(this),by(e);let{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let o=0;o<i;){let a=Math.min(n-this.pos,i-o);if(a===n){let s=su(e);for(;n<=i-o;o+=n)this.process(s,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){dd(this),L$(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:o}=this;t[o++]=128,Mu(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let f=o;f<n;f++)t[f]=0;r.setBigUint64(n-8,BigInt(this.length*8),i),this.process(r,0);let a=su(e),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let u=s/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)a.setUint32(4*f,l[f],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:a}=this;return e.destroyed=o,e.finished=i,e.length=n,e.pos=a,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}},Vr=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),q$=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]),Fr=new Uint32Array(64),W$=class extends G${constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:r,D:n,E:i,F:o,G:a,H:s}=this;return[e,t,r,n,i,o,a,s]}set(e,t,r,n,i,o,a,s){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=a|0,this.H=s|0}process(e,t){for(let f=0;f<16;f++,t+=4)Fr[f]=e.getUint32(t,!1);for(let f=16;f<64;f++){let d=Fr[f-15],I=Fr[f-2],E=fr(d,7)^fr(d,18)^d>>>3,_=fr(I,17)^fr(I,19)^I>>>10;Fr[f]=_+Fr[f-7]+E+Fr[f-16]|0}let{A:r,B:n,C:i,D:o,E:a,F:s,G:u,H:l}=this;for(let f=0;f<64;f++){let d=fr(a,6)^fr(a,11)^fr(a,25),I=l+d+z$(a,s,u)+q$[f]+Fr[f]|0,E=(fr(r,2)^fr(r,13)^fr(r,22))+K$(r,n,i)|0;l=u,u=s,s=a,a=o+I|0,o=i,i=n,n=r,r=I+E|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,n,i,o,a,s,u,l)}roundClean(){Mu(Fr)}destroy(){this.set(0,0,0,0,0,0,0,0),Mu(this.buffer)}},H$=class extends W${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)}},J$=V$(()=>new H$,F$(1)),ot=Nr(on(),1),vy=Nr(l2(),1),pd=e=>ot.Type.Union([e,ot.Type.Null()]),wy=/^(k51qz|baguq)[0-9a-z]{56,57}$/,X$=/^[0-9A-Fa-f]{7,8}$/g;ot.FormatRegistry.Set("EntityID",e=>!!e.match(X$)||!!e.match(wy));var Q$=ot.Type.String(),Lu=e=>e?.enc instanceof Uint8Array;ot.FormatRegistry.Set("CID",e=>!!e.match(wy));var Ty=ot.Type.String({format:"CID"}),Z$=/^http([s]?):\/\/.*\..*/;ot.FormatRegistry.Set("URL",e=>!!e.match(Z$));var vU=ot.Type.String({format:"URL"}),_y=ot.Type.Object({en:Q$,at:ot.Type.String(),vl:pd(ot.Type.Union([ot.Type.String(),ot.Type.Boolean(),ot.Type.Number()])),ts:ot.Type.String(),ag:ot.Type.String(),pv:pd(Ty)}),hd=vy.TypeCompiler.Compile(_y),wU=hd.Check.bind(hd),Y$=ot.Type.Composite([ot.Type.Object({cid:Ty}),_y]),Vu=vy.TypeCompiler.Compile(Y$),ej=e=>Array.from(Vu.Errors(e)),Ey=Vu.Check.bind(Vu);function xy(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var tj=yy({name:"sha2-256",code:18,encode:xy("SHA-256")}),TU=yy({name:"sha2-512",code:19,encode:xy("SHA-512")}),{WARN:yd,LOG:_U,DEBUG:rj,VERBOSE:Wa,ERROR:nj}=ke.setup(ke.INFO),ij=114;function oj(e,t=["cid"]){if(!e)throw nj("falsy log",e);let r=e.cid;if(Lu(e))return r||(r=sc(Oy(e).bytes).toString()),yd("preparing an encrypted applog - really?"),{log:e,cid:r};let n={};for(let[i,o]of Object.entries(e))o===void 0&&(yd(`log.${i} is undefined, which is not allowed - encoding as null`,e),o=null),t.includes(i)?Wa("excluding app log",{key:i,val:o}):n[i]=o;return{log:n,cid:r}}function aj(e){return sc(sj(e).bytes)}function sj(e){return Oy(oj(e)?.log)}function sc(e){let t=J$(e),r=fy.create(tj.code,t),n=zt.create(1,my,r);return Wa("[getCidSync]",{bytes:e,hash:t,digest:r,cid:n}),n}function Oy(e){rj("[encodeBlock]",e);let t=oc(e);return{bytes:t,cid:sc(t)}}function uj(e){let t=null,r=[];try{t=zt.parse(e)}catch(n){Wa("[retrieveThread] couldn't parse pubID with default base"),r.push(n)}if(!t)try{t=zt.parse(e,oa)}catch(n){Wa("[retrieveThread] couldn't parse pubID with base36"),r.push(n)}return{cid:t,errors:t?null:r,isIpns:t&&uc(t)}}function uc(e){return e.code===ij}function Fu(e){return typeof e=="string"?zt.parse(e):typeof e.toV1!="function"?zt.decode(e.bytes):e}function Ay(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 gd(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 lj(e,t){let r=gd(e),n=gd(t);return+r<+n}var{WARN:cj,LOG:EU,DEBUG:xU,VERBOSE:Ha,ERROR:Ja}=ke.setup(ke.INFO),fj=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),Sy=(e,t,r)=>et.structural(Zf(t,e),Zf(r,e)),dj=(e,t,r="asc")=>fj(e.ts,t.ts,r),OU=tI(Sy,["en","at"]);function go(e,t="asc"){return e.sort((r,n)=>dj(r,n,t))}var pj=(e,t)=>lj(new Date(e.ts),new Date(t.ts)),hj=()=>{cj("[removeDuplicateAppLogs] mode not set; pass 'safety' or 'cleanup' for optimal behavior")},md=e=>{let t=new Map,r=Ha.isEnabled;for(let n of e){if(!n)throw Ja("falsy entry in applogs",e),new Error("falsy entry in applogs");if(!n.cid)throw Ja("applog with missing CID",n),new Error("applog with missing CID");let i=n.cid,o=t.get(i);o?r&&Ha("Skipping duplicate applog:",[o,n]):t.set(i,n)}return Array.from(t.values())},yj=e=>{let t=new Set,r=Ha.isEnabled,n=r?new Map:null,i=null,o=0;for(let a of e){if(!a)throw Ja("falsy entry in applogs",e),new Error("falsy entry in applogs");if(!a.cid)throw Ja("applog with missing CID",a),new Error("applog with missing CID");let s=a.cid;t.has(s)?(i||(i=e.slice(0,o)),r&&Ha("Skipping duplicate applog:",[n?.get(s),a])):(t.add(s),n&&n.set(s,a),i&&i.push(a)),o++}return i??e},Iy=(e,t)=>t?t==="safety"?yj(e):md(e):(hj(),md(e));function gj(e){return typeof e=="string"&&e.startsWith("?")}function mj(e){return e.slice(1)}function ky(e,t){let r={},n={};for(let[i,o]of Object.entries(e))if(gj(o)){let a=mj(o),s=t[a];s?n[i]=s:r[i]=a}else n[i]=o;return[n,r]}function bj(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 $y=function(e){for(var t=0,r=0,n=e.length;r<n;r++)t+=e[r];return t},bd=function(e){return $y(e)/e.length},Ut={max:function(e){return Math.max.apply(null,e)},min:function(e){return Math.min.apply(null,e)},range:function(e){return Ut.max(e)-Ut.min(e)},midrange:function(e){return Ut.range(e)/2},sum:$y,mean:bd,average:bd,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=Ut.mean(e);return Ut.mean(e.map(function(r){return Math.pow(r-t,2)}))},standardDeviation:function(e){return Math.sqrt(Ut.variance(e))},meanAbsoluteDeviation:function(e){var t=Ut.mean(e);return Ut.mean(e.map(function(r){return Math.abs(r-t)}))},zScores:function(e){var t=Ut.mean(e),r=Ut.standardDeviation(e);return e.map(function(n){return(n-t)/r})}};Ut.average=Ut.mean;function jy(){return new Date().toISOString()}var{WARN:vj,LOG:AU,DEBUG:Qe,VERBOSE:SU,ERROR:Xa}=ke.setup(ke.INFO);function wj(e,t){Qe(`[ensureTsPvAndFinalizeApplogs] ENTER - ${e.length} applogs, thread size=${t.size}`);let r=jy(),n=t;Qe("[ensureTsPvAndFinalizeApplogs] About to map over applogs");let i=e.map((o,a)=>{Qe(`[ensureTsPvAndFinalizeApplogs] Processing applog ${a+1}/${e.length}`);let s=Tj(o,{ts:r,threadForPv:n});return Qe(`[ensureTsPvAndFinalizeApplogs] Finalized applog ${a+1}/${e.length}`),s});return Qe(`[ensureTsPvAndFinalizeApplogs] EXIT - mapped ${i.length} applogs`),i}function Tj(e,{ts:t,threadForPv:r}={}){Qe(`[finalizeApplogForInsert] ENTER - en=${e.en}, at=${e.at}`),Qe("[finalizeApplogForInsert] About to call withTs");let n=xj(e,t??jy());Qe(`[finalizeApplogForInsert] About to call withPvFrom (thread size=${r?.size??"null"})`);let i=Oj(n,r);Qe("[finalizeApplogForInsert] About to call encodeApplogAndGetCid");let o=aj(i).toString();Qe(`[finalizeApplogForInsert] CID created: ${o}`),e.cid&&e.cid!==o&&vj("[finalizeApplogForInsert] overwriting wrong CID",{log:e,cid:o,logWithPv:i});let a={...i,cid:o};if(Qe("[finalizeApplogForInsert] About to validate applog"),!Ey(a))throw Xa(`Bogus Applog ${JSON.stringify(a)}`,ej(a));return Qe(`[finalizeApplogForInsert] EXIT - CID=${o}`),Object.freeze(a)}function _j(e){return!!e.ts}function Ej(e){return!!e.pv}function xj(e,t){return _j(e)?e:{...e,ts:t}}function Oj(e,t){if(Qe(`[withPvFrom] ENTER - en=${e.en}, at=${e.at}, hasPv=${e.pv!==void 0}`),e.pv!==void 0)return Qe("[withPvFrom] EXIT early - pv already set"),e;if(t){let{en:r,at:n}=e;Qe(`[withPvFrom] About to call thread.findLast for en=${r}, at=${n}, thread.size=${t.size}`);let i=t.findLast(a=>a.en==r&&a.at==n);if(Qe(`[withPvFrom] findLast completed, found=${!!i}`),Qe("[withPvFrom] About to check equality"),Sy(["en","at","vl","ts","ag"],e,i))throw Xa("[withPvFrom] Same as previous:",{log:e,pv:i,thread:t});let o=(e.pv!==void 0?e.pv:i?.cid)??null;return Qe(`[withPvFrom] EXIT - prevLogCid=${o}`),{...e,pv:o}}else{if(!Ej(e))throw Xa("[withPvFrom] no thread and no pv:",e);return Qe("[withPvFrom] EXIT - no thread, returning log with existing pv"),e}}function zu(e){let t=()=>(ze(()=>e.length<2&&Qe(`joinThreads with count=${e.length}`)),go(Iy(e.flatMap(i=>{let o=i.applogs;if(!o)throw Xa("falsy applogs of thread",i),new Error("falsy applogs of thread");return o}),"cleanup"))),r=ze(()=>t()),n=Lt(function(i,o){return tn(i)?{init:ze(()=>t())}:{added:i.added.filter(a=>!this.hasApplog(a,!0)),removed:i.removed?.filter(a=>!!this.parents.some(s=>s===o?!1:s.hasApplog(a,!0)))}});return new lc(ze(()=>`join(~ ${e.map(i=>i.name).join(", ")})`),e,["?"],r,n)}var{WARN:vd,LOG:IU,DEBUG:wd,VERBOSE:hn,ERROR:Td}=ke.setup(ke.INFO),lc=class Cy extends ai{constructor(t,r,n,i,o,a=null){super(t,r,n,o?Ke.array([...i],{deep:!1,name:`${t}.array`}):i),this.name=t,this._initialLogs=i,this._eventMapper=o,this._writeMapper=a,_i(this,{onParentUpdate:Lt}),o&&this.subscribeToParents()}static mapWrites(t,r,n){return new Cy(`${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=Gt(()=>{this.parents.length||vd("MappedThread has no parents",this),hn(`[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)&&hn(`[MappedThread: ${this.name}] Skipping re-sub to parent`,n.nameAndSizeUntracked),hn(`[MappedThread: ${this.name}] sub to new parent`,n.nameAndSizeUntracked);let i=this.onParentUpdate.bind(this,n),o=n.subscribe(i);this._parentSubscriptions.set(n,o)}for(let n of r)hn(`[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 Td("triggerRemap on a thread that is not actually mapping?!",this.nameAndSizeUntracked);wd(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.length!==1&&vd(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap with parentCount=${this.parents.length} - not meant for this`),this.parents.forEach(t=>{this.onParentUpdate(t,{init:ze(()=>Ar(t.applogs))})})}onParentUpdate(t,r){hn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate`,r);let n=this._eventMapper?this._eventMapper(r,t):r;if(this._eventMapper)if(hn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => mapped`,n),tn(n))this._applogs.replace([...n.init]);else{for(let i of n.added)this._applogs.splice(dI(this._applogs,i,"ts"),0,i);if(n.removed){for(let i of n.removed)if(!this._applogs.remove(i))if(!tn(r)&&r.removed?.includes(i))wd("Ignoring remove event for non-existent because it was part of parent event's removed",i,r);else throw Td(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,i,{thread:this,event:r,mapResult:n})}}hn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,vs(this._applogs)),this.notifySubscribers(n)}get readOnly(){return!1}},{WARN:kU,LOG:$U,DEBUG:jU,VERBOSE:uu,ERROR:Aj}=ke.setup(ke.INFO),si=at("rollingFilter",function(e,t,r={}){let n=Ij(t),i=_d(n),o=Ke.array(ze(function(){return i(e.applogs)}),{deep:!1,name:`${e.name} | ${r.name||`rollingFilter.array{${po(n)}}`}`}),a=f=>{let d;return tn(f)?d={init:i(f.init)}:d={added:i(f.added),removed:f.removed},uu(`rollingFilter{${e.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,n,f,"=>",d),d},s=new lc(`${e.name} | ${r.name||`rollingFilter{${po(n)}}`}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],o,a),u=Ow(()=>Ar(t),f=>{uu(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,n,"=>",f),n=f,i=_d(n),s.triggerRemap()}),l=Ti(o,()=>{uu(`rollingFilter<${ze(()=>e.name)}>${r.name?` '${r.name}'`:""} unobserve`,n),u(),l()});return s},{equals:No,argsDebugName:(e,t,r)=>Ye({caller:"rollingFilter",thread:e,pattern:t,args:r})}),Sj=at("rollingMapper",function(e,t,r={}){let n=ze(()=>t.call(null,{init:e.applogs},e));if(!tn(n))throw Aj("Initial run must return init event");let i=n.init;return new lc(`${e.name} | ${r.name||"rollingMapper"}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],i,t)},{equals:No,argsDebugName:(e,t,r)=>Ye({caller:"rollingMapper",thread:e,args:r})}),CU=at("rollingAcc",function(e,t,r,n={}){let i=Lt(r);return i({init:e.applogs},t),e.subscribe(o=>{i(o,t)}),t},{argsDebugName:(e,t,r,n)=>`rollingAcc{${e.nameAndSizeUntracked}${n?.name?` | ${n?.name}`:""}}`}),Ij=function(e){let t=ze(function(){return Object.fromEntries(Object.entries(Ar(e)).map(([r,n])=>[Ar(r),Ar(n)]))});if(!Object.entries(t).length)throw new Error("Pattern is empty");return t};function _d(e){return function(t){return t.filter(function(r){for(let n of Object.keys(e)){let i=e[n];if(i===void 0)continue;let o=r[n.startsWith("!")?n.slice(1):n];if(!bj(n,i,o))return!1}return!0})}}var{WARN:kj,LOG:$j,DEBUG:Xe,VERBOSE:Ny,ERROR:aa}=ke.setup(ke.INFO),jj=class extends ai{constructor(e,t=[],r){super(e,null,r,t),_i(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){Xe(`[WriteableThread.insert] ENTER - ${e.length} applogs for thread "${this.name}"`),Xe("[WriteableThread.insert] About to call ensureTsPvAndFinalizeApplogs");let t=wj(e,this);Xe(`[WriteableThread.insert] ensureTsPvAndFinalizeApplogs completed, mapped=${t.length} applogs`),Xe("[WriteableThread.insert] About to call insertRaw");let r=this.insertRaw(t);return Xe("[WriteableThread.insert] insertRaw completed"),r}insertMissing(e,t=!1){let r=e.filter(n=>!this.hasApplog(n,t));return r.length===0?(Ny("[insertMissing] no missing applogs"),[]):this.insertRaw(r)??[]}insertRaw(e){Xe(`[WriteableThread.insertRaw] ENTER - ${e.length} applogs for thread "${this.name}"`),Xe("[WriteableThread.insertRaw] About to deduplicate");let t=Iy(e,"safety");if(t.length!==e.length)throw aa(`[insertRaw] duplicate applogs passed: ${e.length-t.length}`,{appLogsToInsert:e,deduplicated:t});Xe("[WriteableThread.insertRaw] Deduplication done"),Xe("[WriteableThread.insertRaw] About to validate");let r=e.filter(o=>!Ey(o));if(r.length)throw aa(`[insertRaw] bogus applogs passed: ${r.length}`,{bogus:r});Xe("[WriteableThread.insertRaw] Validation done"),Xe("[WriteableThread.insertRaw] About to check for existing");let n=e.filter(o=>this.hasApplog(o,!1));if(n.length)throw aa(`[insertRaw] already existing applogs passed: ${n.length}`,{existing:n});if(Xe("[WriteableThread.insertRaw] Existing check done"),!e.length){kj("[insertRaw] skipping empty insert empty logs array");return}(!this.hasParents&&!(this instanceof Ro)?$j:Xe)("Inserting:",e.length===1?e[0]:e,{ds:this}),Xe("[WriteableThread.insertRaw] About to sort applogs"),go(e);let i=this._applogs.length&&pj(e[0],this._applogs[this._applogs.length-1]);return Xe("[WriteableThread.insertRaw] About to push to _applogs array"),this._applogs.push(...e),i&&(Xe("[WriteableThread.insertRaw] About to sort _applogs (sortNeeded=true)"),go(this._applogs)),Xe("[WriteableThread.insertRaw] About to notify subscribers"),this.notifySubscribers({added:e,removed:null}),Xe("[WriteableThread.insertRaw] Subscribers notified"),Xe("[WriteableThread.insertRaw] About to call persist (void - not awaited)"),this.persist(e),Xe(`[WriteableThread.insertRaw] EXIT - returning ${e.length} applogs`),e}get readOnly(){return!1}},Ro=class sa extends jj{constructor(t,r,n,i){super(t,r,n),this._readOnly=i,_i(this,{_applogs:Ke.shallow})}static empty(t){return sa.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new sa(r??"in-memory",t,[],n)}static fromReadOnlyArray(t,r){return new sa(r??"in-memory",t,[],!0)}get readOnly(){return this._readOnly}async persist(t){if(Ny("[InMem.persist] no persist for",t),this.readOnly)throw aa("[persist] called for readOnly thread")}},{WARN:NU,LOG:UU,DEBUG:PU,VERBOSE:BU,ERROR:RU}=ke.setup(ke.INFO),{WARN:DU,LOG:MU,DEBUG:LU,VERBOSE:VU,ERROR:FU}=ke.setup(ke.INFO),Cj=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=r,_i(this,{threadOfTrail:Ze})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?zu([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},Uy=class{constructor(e){this.nodes=e,_i(this,{threadOfAllTrails:Ze,size:Ze,isEmpty:Ze})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return ze(()=>this.records.length)}get records(){return nr(()=>this.nodes.map(({variables:e})=>e),{name:"QueryResult.records"})}get leafNodeThread(){return zu(nr(()=>this.nodes.map(({logsOfThisNode:e})=>e),{name:"QueryResult.leafNodeThread"}))}get leafNodeLogSet(){return nr(()=>this.nodes.map(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogSet"})}get leafNodeLogs(){return nr(()=>this.nodes.flatMap(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogs"})}get threadOfAllTrails(){return zu(nr(()=>this.nodes.map(e=>e.threadOfTrail),{name:"QueryResult.threadOfAllTrails"}))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},{WARN:zU,LOG:Us,DEBUG:kr,VERBOSE:$e,ERROR:_n}=ke.setup(ke.INFO,{prefix:"[q]"}),lu=null,KU=at("lastWriteWins",function(e,{inverseToOnlyReturnFirstLogs:t,tolerateAlreadyFiltered:r}={}){if($e(`lastWriteWins${t?".inversed":""} < ${e.nameAndSizeUntracked} > initializing`),e.filters.includes("lastWriteWins")){if(r)return kr("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),e;throw _n("thread already filtered lastWriteWins:",e.filters,{name:e.name})}let n,i=Sj(e,function(o,a){let s=tn(o),u,l=[],f=s?null:[];s?(n=new Map,u=o.init):u=o.added;let d;for(let I=t?0:u.length-1;t?I<u.length:I>=0;t?I++:I--){let E=u[I],_=E.en+"|"+E.at;if(d&&(t?d>E.ts:d<E.ts))throw _n("lastWriteWins.mapper logs not sorted:",d,t?">":"<",E.ts,{log:E,i:I,newLogs:u,inverseToOnlyReturnFirstLogs:t});d=E.ts;let L=n.get(_);(!L||(t?L.ts>E.ts:L.ts<E.ts))&&(L&&!s&&f.push(L),l.push(E),n.set(_,E))}return go(l),$e.isDisabled||$e(`lastWriteWins${t?".inversed":""}<${e.nameAndSizeUntracked}> mapped event`,s?{...Object.fromEntries(Object.entries(o).map(([I,E])=>[I,E?.length])),toAdd:l.length,toRemove:f}:{...o,toAdd:l,toRemove:f}),s?{init:l}:{added:l,removed:f}},{name:`lastWriteWins${t?".inversed":""}`,extraFilterName:"lastWriteWins"});return $e.isDisabled||Gt(()=>{$e(`lastWriteWins<${e.nameAndSizeUntracked}> filtered down to`,i.applogs.length)}),i},{equals:No,argsDebugName:e=>Ye({caller:"lastWriteWins",thread:e})}),GU=at("withoutDeleted",function(e){if($e.isEnabled&&$e(`withoutDeleted<${e.nameAndSizeUntracked}>`),e.filters.includes("withoutDeleted"))throw _n("thread already filtered withoutDeleted:",e.filters,{name:e.name});let t=si(e,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});$e.isEnabled&&$e(`withoutDeleted<${e.nameAndSizeUntracked}> deletionLogs:`,ze(function(){return[...t.applogs]}));let r=Ye({caller:"allDeletedEntities",thread:e}),n=vI(function(){return t.map(i=>i.en)},{name:r});return $e.isEnabled&&Gt(()=>{$e(`withoutDeleted<${e.nameAndSizeUntracked}> deleted:`,[...n])}),si(e,{"!en":n},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:No}),Py=at("query",function e(t,r,n={},i={}){Lj();let o=By(t);kr(`query<${o.nameAndSizeUntracked}>:`,r);let a=Array.isArray(r)?r:[r],s;if(a.length===1)s=null;else{let f=a.slice(0,-1);s=e(o,f,n,i)}let u=a[a.length-1],l=Nj(o,s,u,i);return $e.isDisabled||Gt(()=>$e("query result:",Ar(l))),l},{equals:Gl,argsDebugName:(e,t,r)=>Ye({caller:"query",thread:e,args:r?{pattern:t,startVars:r}:t})}),Nj=at("queryStep",function(e,t,r,n={}){if(kr(`queryStep<${e.nameAndSizeUntracked}> with`,t?.untrackedSize??"all","nodes, pattern:",r),!Object.entries(r).length)throw new Error("Pattern is empty");function i(a){let[s,u]=ky(r,a?.variables??{});$e("[queryStep.doQuery] patternWithoutVars: ",s);let l=si(e,s),f=Ps(u),d=nr(function(){let I=l.map(E=>({log:E,vars:f(E)}));return $e.isEnabled&&$e("[queryStep.doQuery] step node:",a?.variables," =>",I,"from:",ze(()=>l.applogs)),I.map(({log:E,vars:_})=>{let L=Object.assign({},a?.variables,_);return new Cj(EI.fromArray([E],Ye({caller:"QueryNode",thread:l,pattern:`${po(L)}@${po(s)}`})),L,a)})},{name:Ye({caller:"doQuery.mapNodes",thread:l,pattern:r})});return $e.isEnabled&&Gt(()=>$e("[queryStep.doQuery] resultNodes:",[...d])),n.debug&&Us("[queryStep] step result:",ze(()=>d.map(({variables:I,logsOfThisNode:E})=>({variables:I,thread:E})))),d}let o=nr(function(){return kr(`[queryStep] Running with ${t?.nodes?.length} input nodes:`),t?[...t.nodes.flatMap(i)]:[...i(null)]},{name:Ye({caller:"queryStep",thread:e,pattern:r})});return $e.isEnabled&&Gt(()=>$e("[queryStep] observableResultNodes:",[...o])),new Uy(o)},{equals:Gl,argsDebugName:(e,t,r)=>Ye({caller:"queryStep",thread:e,pattern:r})}),qU=at("queryNot",function(e,t,r,n={}){let i=t.nodes;kr(`queryNot<${e.nameAndSizeUntracked}> from: ${i.length} nodes`);let o=Array.isArray(r)?r:[r];for(let a of o){if(!Object.entries(r).length)throw new Error("Pattern is empty");i=i.filter(function({variables:s}){let[u,l]=ky(a,s??{});$e("[queryNot] patternWithoutVars: ",u);let f=si(e,u);return $e("[queryNot] step node:",s," =>",f.size,"applogs"),$e.isDisabled||$e("[queryNot] step node:",s," => empty?",ze(()=>f.applogs)),n.debug&&Us("[queryNot] node result:",s,"=>",f.applogs),f.isEmpty})}return new Uy(i)},{equals:Gl,argsDebugName:(e,t,r)=>Ye({caller:"queryNot",thread:e,pattern:r})}),WU=at("filterAndMap",function(e,t,r){kr(`filterAndMap<${e.nameAndSizeUntracked}>`,t);let n=si(e,t);$e.isEnabled&&($e("[filterAndMap] filtered:",n.untrackedSize),Gt(()=>$e("[filterAndMap] filtered:",n.applogs)));let i=Ye({thread:e,pattern:t,caller:"filterAndMap"}),o=nr(()=>Bj(n,r),{name:i});return $e.isDisabled||Gt(()=>$e("[filterAndMap] mapped:",o)),o},{equals:et.structural,argsDebugName:(e,t)=>Ye({caller:"filterAndMap",thread:e,pattern:t})}),HU=at("queryAndMap",function(e,t,r,n={}){let i=By(e);kr(`queryAndMap<${i.nameAndSizeUntracked}>`,{patternOrPatterns:t,variables:n,map:r});let o=Ye({thread:i,caller:"queryAndMap"}),a=Py(i,t);$e("[queryAndMap] filtered count:",a.untrackedSize);let s=nr(()=>Rj(a,r),{name:o});return $e.isDisabled||Gt(()=>$e("[queryAndMap] result:",Ar(s))),s},{equals:et.structural,argsDebugName:(e,t)=>Ye({caller:"queryAndMap",thread:e,pattern:t})}),JU=at("queryEntity",function(e,t,r,n){kr(`queryEntity<${e.nameAndSizeUntracked}>`,r,t);let i=si(e,{en:r,at:Dj(t,n)});return $e("queryEntity applogs:",i.applogs),Ze(()=>i.isEmpty?null:Object.fromEntries(i.map(({at:o,vl:a})=>[o.slice(t.length+1),a])))},{equals:gI,argsDebugName:(e,t,r)=>Ye({caller:"queryEntity",thread:e,args:{name:t,entityID:r}})}),XU=at("agentsOfThread",function(e){kr(`agentsOfThread<${e.nameAndSizeUntracked}>`);let t=Ke.map(),r=Lt(i=>{for(let o of tn(i)?i.init:i.added){let a=t.get(o.ag)??0;t.set(o.ag,a+1)}for(let o of!tn(i)&&i.removed||[]){let a=t.get(o.ag);if(!a||a<1)throw _n("[agentsOfThread] number is now negative",{log:o,event:i,mapped:t,prev:a});t.set(o.ag,a-1)}Us(`agentsOfThread<${e.nameAndSizeUntracked}> processed event`,{event:i,mapped:t})});r({init:e.applogs});let n=e.subscribe(r);return bs(t,n),t}),Uj=at("entityOverlap",function(e,t){return Us(`entityOverlap<${e.nameAndSizeUntracked}, ${t.nameAndSizeUntracked}>`),Ze(()=>{let r=new Set(e.map(i=>i.en)),n=new Set(t.map(i=>i.en));return[...r].filter(i=>n.has(i))})}),QU=at("entityOverlapCount",function(e,t){return Ze(()=>Uj(e,t).get().length)}),Pj=at("querySingle",function(e,t,r={}){let n=Py(e,t,r);return Ze(()=>{if(n.isEmpty)return null;if(n.size>1)throw _n("[querySingle] got",n.size,"results:",n);let i=n.nodes[0].logsOfThisNode;if(i.size!=1)throw _n("[querySingle] single result, but got",i.size,"logs:",i.applogs);return i.applogs[0]})},{equals:et.structural,argsDebugName:(e,t)=>Ye({caller:"querySingle",thread:e,pattern:t})}),ZU=at("querySingleAndMap",function(e,t,r,n={}){let i=Pj(e,t,n);return Ze(()=>{let o=i.get();if(o)return typeof r=="string"?o[r]:Ps(r)(o)})},{equals:et.structural,argsDebugName:(e,t)=>Ye({caller:"querySingleAndMap",thread:e,pattern:t})}),Bj=function(e,t){return typeof t=="function"?e.map(t):typeof t=="string"?e.map(r=>r[t]):e.map(Ps(t))},Rj=function(e,t){return typeof t=="function"?e.records.map(t):typeof t=="string"?e.nodes.map(r=>{if(!Object.hasOwn(r.record,t)){if(r.logsOfThisNode.size!==1)throw _n(`not sure what to map (it's not a var and a result node log count of ${r.logsOfThisNode.size})`);return r.logsOfThisNode.firstLog[t]}return r.record[t]}):e.nodes.map(r=>Ps(t)(e))};function Ps(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function Dj(e,t){return t.map(r=>Mj(e,r))}function Mj(e,t){return`${e}/${t}`}function By(e,t){return Array.isArray(e)?Ro.fromArray(e,t||`threadFromArray[${e.length}]`,!0):e}function Lj(){if(lu!=null&&performance.now()>=lu)throw new Vj(lu)}var Vj=class extends Error{constructor(e){super(e)}},Fj=it({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js"(e,t){"use strict";t.exports=a;var r=128,n=127,i=~n,o=Math.pow(2,31);function a(s,u,l){if(Number.MAX_SAFE_INTEGER&&s>Number.MAX_SAFE_INTEGER)throw a.bytes=0,new RangeError("Could not encode varint");u=u||[],l=l||0;for(var f=l;s>=o;)u[l++]=s&255|r,s/=128;for(;s&i;)u[l++]=s&255|r,s>>>=7;return u[l]=s|0,a.bytes=l-f+1,u}}}),zj=it({"../../../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 s=0,u=u||0,l=0,f=u,d,I=o.length;do{if(f>=I||l>49)throw i.bytes=0,new RangeError("Could not decode varint");d=o[f++],s+=l<28?(d&n)<<l:(d&n)*Math.pow(2,l),l+=7}while(d>=r);return i.bytes=f-u,s}}}),Kj=it({"../../../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),a=Math.pow(2,35),s=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),f=Math.pow(2,63);t.exports=function(d){return d<r?1:d<n?2:d<i?3:d<o?4:d<a?5:d<s?6:d<u?7:d<l?8:d<f?9:10}}}),cc=it({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js"(e,t){"use strict";t.exports={encode:Fj(),decode:zj(),encodingLength:Kj()}}}),Gj=["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 qj(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return t==="string"||t==="number"||t==="bigint"||t==="symbol"?t:t==="function"?"Function":Array.isArray(e)?"Array":e instanceof Uint8Array?"Uint8Array":e.constructor===Object?"Object":Wj(e)||"Object"}function Wj(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Gj.includes(t))return t}var W=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}};W.uint=new W(0,"uint",!0);W.negint=new W(1,"negint",!0);W.bytes=new W(2,"bytes",!0);W.string=new W(3,"string",!0);W.array=new W(4,"array",!1);W.map=new W(5,"map",!1);W.tag=new W(6,"tag",!1);W.float=new W(7,"float",!0);W.false=new W(7,"false",!0);W.true=new W(7,"true",!0);W.null=new W(7,"null",!0);W.undefined=new W(7,"undefined",!0);W.break=new W(7,"break",!0);var me=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}`}},Do=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Hj=new TextEncoder;function Qa(e){return Do&&globalThis.Buffer.isBuffer(e)}function Ry(e){return e instanceof Uint8Array?Qa(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Jj=24,Xj=200,Qj=Do?e=>e.length>=Jj?globalThis.Buffer.from(e):Ed(e):e=>e.length>=Xj?Hj.encode(e):Ed(e),_r=e=>Uint8Array.from(e),Zj=Do?(e,t,r)=>Qa(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Yj=Do?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Ry(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},e5=Do?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Dy(e,t){if(Qa(e)&&Qa(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 Ed(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 t5=256,My=class{constructor(e=t5){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 r=t.length-(this.maxCursor-this.cursor)-1;t.set(e,r)}else{if(t){let r=t.length-(this.maxCursor-this.cursor)-1;r<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,r),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=e5(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=Zj(r,0,this.cursor)}else t=Yj(this.chunks,this.cursor);return e&&this.reset(),t}},r5=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}},qe="CBOR decode error:",Ly="CBOR encode error:",Mo=[];Mo[23]=1;Mo[24]=2;Mo[25]=3;Mo[26]=5;Mo[27]=9;function Pi(e,t,r){if(e.length-t<r)throw new Error(`${qe} not enough data for type`)}var ct=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Fn(e,t,r){Pi(e,t,1);let n=e[t];if(r.strict===!0&&n<ct[0])throw new Error(`${qe} integer encoded in more bytes than necessary (strict decode)`);return n}function zn(e,t,r){Pi(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<ct[1])throw new Error(`${qe} integer encoded in more bytes than necessary (strict decode)`);return n}function Kn(e,t,r){Pi(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<ct[2])throw new Error(`${qe} integer encoded in more bytes than necessary (strict decode)`);return n}function Gn(e,t,r){Pi(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<ct[3])throw new Error(`${qe} 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(`${qe} integers outside of the safe integer range are not supported`)}function n5(e,t,r,n){return new me(W.uint,Fn(e,t+1,n),2)}function i5(e,t,r,n){return new me(W.uint,zn(e,t+1,n),3)}function o5(e,t,r,n){return new me(W.uint,Kn(e,t+1,n),5)}function a5(e,t,r,n){return new me(W.uint,Gn(e,t+1,n),9)}function qn(e,t){return Xt(e,0,t.value)}function Xt(e,t,r){if(r<ct[0]){let n=Number(r);e.push([t|n])}else if(r<ct[1]){let n=Number(r);e.push([t|24,n])}else if(r<ct[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<ct[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<ct[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=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]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,e.push(i)}else throw new Error(`${qe} encountered BigInt larger than allowable range`)}}qn.encodedSize=function(e){return Xt.encodedSize(e.value)};Xt.encodedSize=function(e){return e<ct[0]?1:e<ct[1]?2:e<ct[2]?3:e<ct[3]?5:9};qn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function s5(e,t,r,n){return new me(W.negint,-1-Fn(e,t+1,n),2)}function u5(e,t,r,n){return new me(W.negint,-1-zn(e,t+1,n),3)}function l5(e,t,r,n){return new me(W.negint,-1-Kn(e,t+1,n),5)}var fc=BigInt(-1),Vy=BigInt(1);function c5(e,t,r,n){let i=Gn(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new me(W.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${qe} integers outside of the safe integer range are not supported`);return new me(W.negint,fc-BigInt(i),9)}function dc(e,t){let r=t.value,n=typeof r=="bigint"?r*fc-Vy:r*-1-1;Xt(e,t.type.majorEncoded,n)}dc.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*fc-Vy:t*-1-1;return r<ct[0]?1:r<ct[1]?2:r<ct[2]?3:r<ct[3]?5:9};dc.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Lo(e,t,r,n){Pi(e,t,r+n);let i=e.slice(t+r,t+r+n);return new me(W.bytes,i,r+n)}function f5(e,t,r,n){return Lo(e,t,1,r)}function d5(e,t,r,n){return Lo(e,t,2,Fn(e,t+1,n))}function p5(e,t,r,n){return Lo(e,t,3,zn(e,t+1,n))}function h5(e,t,r,n){return Lo(e,t,5,Kn(e,t+1,n))}function y5(e,t,r,n){let i=Gn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${qe} 64-bit integer bytes lengths not supported`);return Lo(e,t,9,i)}function Za(e){return e.encodedBytes===void 0&&(e.encodedBytes=W.equals(e.type,W.string)?Qj(e.value):e.value),e.encodedBytes}function Bs(e,t){let r=Za(t);Xt(e,t.type.majorEncoded,r.length),e.push(r)}Bs.encodedSize=function(e){let t=Za(e);return Xt.encodedSize(t.length)+t.length};Bs.compareTokens=function(e,t){return g5(Za(e),Za(t))};function g5(e,t){return e.length<t.length?-1:e.length>t.length?1:Dy(e,t)}var xd=new TextDecoder,m5=32;function b5(e,t,r){if(r-t<m5){let n="";for(let i=t;i<r;i++){let o=e[i];if(o&128)return xd.decode(e.subarray(t,r));n+=String.fromCharCode(o)}return n}return xd.decode(e.subarray(t,r))}function Vo(e,t,r,n,i){let o=r+n;Pi(e,t,o);let a=new me(W.string,b5(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=e.slice(t+r,t+o)),a}function v5(e,t,r,n){return Vo(e,t,1,r,n)}function w5(e,t,r,n){return Vo(e,t,2,Fn(e,t+1,n),n)}function T5(e,t,r,n){return Vo(e,t,3,zn(e,t+1,n),n)}function _5(e,t,r,n){return Vo(e,t,5,Kn(e,t+1,n),n)}function E5(e,t,r,n){let i=Gn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${qe} 64-bit integer string lengths not supported`);return Vo(e,t,9,i,n)}var x5=Bs;function Bi(e,t,r,n){return new me(W.array,n,r)}function O5(e,t,r,n){return Bi(e,t,1,r)}function A5(e,t,r,n){return Bi(e,t,2,Fn(e,t+1,n))}function S5(e,t,r,n){return Bi(e,t,3,zn(e,t+1,n))}function I5(e,t,r,n){return Bi(e,t,5,Kn(e,t+1,n))}function k5(e,t,r,n){let i=Gn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${qe} 64-bit integer array lengths not supported`);return Bi(e,t,9,i)}function $5(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${qe} indefinite length items not allowed`);return Bi(e,t,1,1/0)}function pc(e,t){Xt(e,W.array.majorEncoded,t.value)}pc.compareTokens=qn.compareTokens;pc.encodedSize=function(e){return Xt.encodedSize(e.value)};function Ri(e,t,r,n){return new me(W.map,n,r)}function j5(e,t,r,n){return Ri(e,t,1,r)}function C5(e,t,r,n){return Ri(e,t,2,Fn(e,t+1,n))}function N5(e,t,r,n){return Ri(e,t,3,zn(e,t+1,n))}function U5(e,t,r,n){return Ri(e,t,5,Kn(e,t+1,n))}function P5(e,t,r,n){let i=Gn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${qe} 64-bit integer map lengths not supported`);return Ri(e,t,9,i)}function B5(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${qe} indefinite length items not allowed`);return Ri(e,t,1,1/0)}function hc(e,t){Xt(e,W.map.majorEncoded,t.value)}hc.compareTokens=qn.compareTokens;hc.encodedSize=function(e){return Xt.encodedSize(e.value)};function R5(e,t,r,n){return new me(W.tag,r,1)}function D5(e,t,r,n){return new me(W.tag,Fn(e,t+1,n),2)}function M5(e,t,r,n){return new me(W.tag,zn(e,t+1,n),3)}function L5(e,t,r,n){return new me(W.tag,Kn(e,t+1,n),5)}function V5(e,t,r,n){return new me(W.tag,Gn(e,t+1,n),9)}function yc(e,t){Xt(e,W.tag.majorEncoded,t.value)}yc.compareTokens=qn.compareTokens;yc.encodedSize=function(e){return Xt.encodedSize(e.value)};var Fy=20,zy=21,Ky=22,Gy=23;function F5(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${qe} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new me(W.null,null,1):new me(W.undefined,void 0,1)}function z5(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${qe} indefinite length items not allowed`);return new me(W.break,void 0,1)}function gc(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${qe} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${qe} Infinity values are not supported`)}return new me(W.float,e,t)}function K5(e,t,r,n){return gc(bc(e,t+1),3,n)}function G5(e,t,r,n){return gc(vc(e,t+1),5,n)}function q5(e,t,r,n){return gc(Jy(e,t+1),9,n)}function mc(e,t,r){let n=t.value;if(n===!1)e.push([W.float.majorEncoded|Fy]);else if(n===!0)e.push([W.float.majorEncoded|zy]);else if(n===null)e.push([W.float.majorEncoded|Ky]);else if(n===void 0)e.push([W.float.majorEncoded|Gy]);else{let i,o=!1;(!r||r.float64!==!0)&&(Wy(n),i=bc(tr,1),n===i||Number.isNaN(n)?(tr[0]=249,e.push(tr.slice(0,3)),o=!0):(Hy(n),i=vc(tr,1),n===i&&(tr[0]=250,e.push(tr.slice(0,5)),o=!0))),o||(W5(n),i=Jy(tr,1),tr[0]=251,e.push(tr.slice(0,9)))}}mc.encodedSize=function(e,t){let r=e.value;if(r===!1||r===!0||r===null||r===void 0)return 1;if(!t||t.float64!==!0){Wy(r);let n=bc(tr,1);if(r===n||Number.isNaN(r))return 3;if(Hy(r),n=vc(tr,1),r===n)return 5}return 9};var qy=new ArrayBuffer(9),Pt=new DataView(qy,1),tr=new Uint8Array(qy,0);function Wy(e){if(e===1/0)Pt.setUint16(0,31744,!1);else if(e===-1/0)Pt.setUint16(0,64512,!1);else if(Number.isNaN(e))Pt.setUint16(0,32256,!1);else{Pt.setFloat32(0,e);let t=Pt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Pt.setUint16(0,31744,!1);else if(r===0)Pt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Pt.setUint16(0,0):i<-14?Pt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):Pt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function bc(e,t){if(e.length-t<2)throw new Error(`${qe} 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 Hy(e){Pt.setFloat32(0,e,!1)}function vc(e,t){if(e.length-t<4)throw new Error(`${qe} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function W5(e){Pt.setFloat64(0,e,!1)}function Jy(e,t){if(e.length-t<8)throw new Error(`${qe} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}mc.compareTokens=qn.compareTokens;function Be(e,t,r){throw new Error(`${qe} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Rs(e){return()=>{throw new Error(`${qe} ${e}`)}}var pe=[];for(let e=0;e<=23;e++)pe[e]=Be;pe[24]=n5;pe[25]=i5;pe[26]=o5;pe[27]=a5;pe[28]=Be;pe[29]=Be;pe[30]=Be;pe[31]=Be;for(let e=32;e<=55;e++)pe[e]=Be;pe[56]=s5;pe[57]=u5;pe[58]=l5;pe[59]=c5;pe[60]=Be;pe[61]=Be;pe[62]=Be;pe[63]=Be;for(let e=64;e<=87;e++)pe[e]=f5;pe[88]=d5;pe[89]=p5;pe[90]=h5;pe[91]=y5;pe[92]=Be;pe[93]=Be;pe[94]=Be;pe[95]=Rs("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)pe[e]=v5;pe[120]=w5;pe[121]=T5;pe[122]=_5;pe[123]=E5;pe[124]=Be;pe[125]=Be;pe[126]=Be;pe[127]=Rs("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)pe[e]=O5;pe[152]=A5;pe[153]=S5;pe[154]=I5;pe[155]=k5;pe[156]=Be;pe[157]=Be;pe[158]=Be;pe[159]=$5;for(let e=160;e<=183;e++)pe[e]=j5;pe[184]=C5;pe[185]=N5;pe[186]=U5;pe[187]=P5;pe[188]=Be;pe[189]=Be;pe[190]=Be;pe[191]=B5;for(let e=192;e<=215;e++)pe[e]=R5;pe[216]=D5;pe[217]=M5;pe[218]=L5;pe[219]=V5;pe[220]=Be;pe[221]=Be;pe[222]=Be;pe[223]=Be;for(let e=224;e<=243;e++)pe[e]=Rs("simple values are not supported");pe[244]=Be;pe[245]=Be;pe[246]=Be;pe[247]=F5;pe[248]=Rs("simple values are not supported");pe[249]=K5;pe[250]=G5;pe[251]=q5;pe[252]=Be;pe[253]=Be;pe[254]=Be;pe[255]=z5;var Ur=[];for(let e=0;e<24;e++)Ur[e]=new me(W.uint,e,1);for(let e=-1;e>=-24;e--)Ur[31-e]=new me(W.negint,e,1);Ur[64]=new me(W.bytes,new Uint8Array(0),1);Ur[96]=new me(W.string,"",1);Ur[128]=new me(W.array,0,1);Ur[160]=new me(W.map,0,1);Ur[244]=new me(W.false,!1,1);Ur[245]=new me(W.true,!0,1);Ur[246]=new me(W.null,null,1);function H5(e){switch(e.type){case W.false:return _r([244]);case W.true:return _r([245]);case W.null:return _r([246]);case W.bytes:return e.value.length?void 0:_r([64]);case W.string:return e.value===""?_r([96]):void 0;case W.array:return e.value===0?_r([128]):void 0;case W.map:return e.value===0?_r([160]):void 0;case W.uint:return e.value<24?_r([Number(e.value)]):void 0;case W.negint:if(e.value>=-24)return _r([31-Number(e.value)])}}var J5=Object.freeze({float64:!0,mapSorter:Y5,quickEncodeToken:H5});function Xy(){let e=[];return e[W.uint.major]=qn,e[W.negint.major]=dc,e[W.bytes.major]=Bs,e[W.string.major]=x5,e[W.array.major]=pc,e[W.map.major]=hc,e[W.tag.major]=yc,e[W.float.major]=mc,e}var X5=Xy(),Q5=new My,Od=class Qy{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(`${Ly} object contains circular references`);return new Qy(r,t)}},zr={null:new me(W.null,null),undefined:new me(W.undefined,void 0),true:new me(W.true,!0),false:new me(W.false,!1),emptyArray:new me(W.array,0),emptyMap:new me(W.map,0)},nn={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new me(W.float,e):e>=0?new me(W.uint,e):new me(W.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new me(W.uint,e):new me(W.negint,e)},Uint8Array(e,t,r,n){return new me(W.bytes,e)},string(e,t,r,n){return new me(W.string,e)},boolean(e,t,r,n){return e?zr.true:zr.false},null(e,t,r,n){return zr.null},undefined(e,t,r,n){return zr.undefined},ArrayBuffer(e,t,r,n){return new me(W.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new me(W.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[zr.emptyArray,new me(W.break)]:zr.emptyArray;n=Od.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=ua(a,r,n);return r.addBreakTokens?[new me(W.array,e.length),i,new me(W.break)]:[new me(W.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length,s;if(a){s=new Array(a),n=Od.createCheck(n,e);let u=!i&&r.ignoreUndefinedProperties,l=0;for(let f of o){let d=i?e.get(f):e[f];u&&d===void 0||(s[l++]=[ua(f,r,n),ua(d,r,n)])}l<a&&(s.length=l)}return s?.length?(Z5(s,r),r.addBreakTokens?[new me(W.map,s.length),s,new me(W.break)]:[new me(W.map,s.length),s]):r.addBreakTokens===!0?[zr.emptyMap,new me(W.break)]:zr.emptyMap}};nn.Map=nn.Object;nn.Buffer=nn.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))nn[`${e}Array`]=nn.DataView;function ua(e,t={},r){let n=qj(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||nn[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=nn[n];if(!o)throw new Error(`${Ly} unsupported type: ${n}`);return o(e,n,t,r)}function Z5(e,t){t.mapSorter&&e.sort(t.mapSorter)}function Y5(e,t){if(e[0]instanceof me&&t[0]instanceof me){let r=e[0],n=t[0];return r._keyBytes||(r._keyBytes=Ad(r.value)),n._keyBytes||(n._keyBytes=Ad(n.value)),Dy(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function Ad(e){return eC(e,X5,J5)}function Zy(e,t,r,n){if(Array.isArray(t))for(let i of t)Zy(e,i,r,n);else r[t.type.major](e,t,n)}var YU=W.uint.majorEncoded,e6=W.negint.majorEncoded,t6=W.bytes.majorEncoded,r6=W.string.majorEncoded,n6=W.array.majorEncoded,i6=W.float.majorEncoded|Fy,o6=W.float.majorEncoded|zy,a6=W.float.majorEncoded|Ky,s6=W.float.majorEncoded|Gy,u6=BigInt(-1),l6=BigInt(1);function eC(e,t,r,n){let i=n instanceof Uint8Array,o=i?new r5(n):Q5,a=ua(e,r);if(!Array.isArray(a)&&r.quickEncodeToken){let s=r.quickEncodeToken(a);if(s)return i?(o.push(s),o.toBytes()):s;let u=t[a.type.major];if(u.encodedSize){let l=u.encodedSize(a,r);if(i||(o=new My(l)),u(o,a,r),o.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${a} was wrong`);return i?o.toBytes():Ry(o.chunks[0])}}return o.reset(),Zy(o,a,t,r),o.toBytes(!0)}var c6=Symbol.for("DONE"),f6=Symbol.for("BREAK"),d6=new Uint8Array(0);function tC(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 wc(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 rC(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),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(_){if(_ instanceof Uint8Array||(ArrayBuffer.isView(_)?_=new Uint8Array(_.buffer,_.byteOffset,_.byteLength):Array.isArray(_)&&(_=Uint8Array.from(_))),!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(_.length===0)return"";for(var L=0,J=0,B=0,k=_.length;B!==k&&_[B]===0;)B++,L++;for(var F=(k-B)*f+1>>>0,G=new Uint8Array(F);B!==k;){for(var R=_[B],Q=0,K=F-1;(R!==0||Q<J)&&K!==-1;K--,Q++)R+=256*G[K]>>>0,G[K]=R%s>>>0,R=R/s>>>0;if(R!==0)throw new Error("Non-zero carry");J=Q,B++}for(var re=F-J;re!==F&&G[re]===0;)re++;for(var $=u.repeat(L);re<F;++re)$+=e.charAt(G[re]);return $}function I(_){if(typeof _!="string")throw new TypeError("Expected String");if(_.length===0)return new Uint8Array;var L=0;if(_[L]!==" "){for(var J=0,B=0;_[L]===u;)J++,L++;for(var k=(_.length-L)*l+1>>>0,F=new Uint8Array(k);_[L];){var G=r[_.charCodeAt(L)];if(G===255)return;for(var R=0,Q=k-1;(G!==0||R<B)&&Q!==-1;Q--,R++)G+=s*F[Q]>>>0,F[Q]=G%256>>>0,G=G/256>>>0;if(G!==0)throw new Error("Non-zero carry");B=R,L++}if(_[L]!==" "){for(var K=k-B;K!==k&&F[K]===0;)K++;for(var re=new Uint8Array(J+(k-K)),$=J;K!==k;)re[$++]=F[K++];return re}}}function E(_){var L=I(_);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:I,decode:E}}var nC=rC,iC=nC,oC=iC,aC=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")}},sC=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 Yy(this,e)}},uC=class{decoders;constructor(e){this.decoders=e}or(e){return Yy(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 Yy(e,t){return new uC({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var lC=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 aC(e,t,r),this.decoder=new sC(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function eg({name:e,prefix:t,encode:r,decode:n}){return new lC(e,t,r,n)}function Ds({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=oC(r,e);return eg({prefix:t,name:e,encode:n,decode:o=>wc(i(o))})}function cC(e,t,r,n){let i=e.length;for(;e[i-1]==="=";)--i;let o=new Uint8Array(i*r/8|0),a=0,s=0,u=0;for(let l=0;l<i;++l){let f=t[e[l]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);s=s<<r|f,a+=r,a>=8&&(a-=8,o[u++]=255&s>>a)}if(a>=r||255&s<<8-a)throw new SyntaxError("Unexpected end of data");return o}function fC(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",a=0,s=0;for(let u=0;u<e.length;++u)for(s=s<<8|e[u],a+=8;a>r;)a-=r,o+=t[i&s>>a];if(a!==0&&(o+=t[i&s<<r-a]),n)for(;o.length*r&7;)o+="=";return o}function dC(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function Pr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=dC(n);return eg({prefix:t,name:e,encode(o){return fC(o,n,r)},decode(o){return cC(o,i,r,e)}})}var la=Pr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),p6=Pr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),h6=Pr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),y6=Pr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),g6=Pr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),m6=Pr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),b6=Pr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),v6=Pr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),w6=Pr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),cu=Ds({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),T6=Ds({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Wr=Ds({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),_6=Ds({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),pC=tg,Sd=128,hC=127,yC=~hC,gC=Math.pow(2,31);function tg(e,t,r){t=t||[],r=r||0;for(var n=r;e>=gC;)t[r++]=e&255|Sd,e/=128;for(;e&yC;)t[r++]=e&255|Sd,e>>>=7;return t[r]=e|0,tg.bytes=r-n+1,t}var mC=Ku,bC=128,Id=127;function Ku(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Ku.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Id)<<i:(a&Id)*Math.pow(2,i),i+=7}while(a>=bC);return Ku.bytes=o-n,r}var vC=Math.pow(2,7),wC=Math.pow(2,14),TC=Math.pow(2,21),_C=Math.pow(2,28),EC=Math.pow(2,35),xC=Math.pow(2,42),OC=Math.pow(2,49),AC=Math.pow(2,56),SC=Math.pow(2,63),IC=function(e){return e<vC?1:e<wC?2:e<TC?3:e<_C?4:e<EC?5:e<xC?6:e<OC?7:e<AC?8:e<SC?9:10},kC={encode:pC,decode:mC,encodingLength:IC},$C=kC,Ya=$C;function Gu(e,t=0){return[Ya.decode(e,t),Ya.decode.bytes]}function es(e,t,r=0){return Ya.encode(e,t,r),t}function ts(e){return Ya.encodingLength(e)}function jC(e,t){let r=t.byteLength,n=ts(e),i=n+ts(r),o=new Uint8Array(i+r);return es(e,o,0),es(r,o,n),o.set(t,i),new Tc(e,r,t,o)}function CC(e){let t=wc(e),[r,n]=Gu(t),[i,o]=Gu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Tc(r,i,a,t)}function NC(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&tC(e.bytes,r.bytes)}}var Tc=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function kd(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return PC(r,qu(e),t??Wr.encoder);default:return BC(r,qu(e),t??la.encoder)}}var $d=new WeakMap;function qu(e){let t=$d.get(e);if(t==null){let r=new Map;return $d.set(e,r),r}return t}var rg=class gt{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!==qi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==RC)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return gt.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=jC(t,r);return gt.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 gt.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&NC(t.multihash,n.multihash)}toString(t){return kd(this,t)}toJSON(){return{"/":kd(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 gt)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new gt(n,i,o,a??jd(n,i,o.bytes))}else if(r[DC]===!0){let{version:n,multihash:i,code:o}=r,a=CC(i);return gt.create(n,o,a)}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!==qi)throw new Error(`Version 0 CID must use dag-pb (code: ${qi}) block encoding`);return new gt(t,r,n,n.bytes)}case 1:{let i=jd(t,r,n.bytes);return new gt(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return gt.create(0,qi,t)}static createV1(t,r){return gt.create(1,t,r)}static decode(t){let[r,n]=gt.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=gt.inspectBytes(t),n=r.size-r.multihashSize,i=wc(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),a=new Tc(r.multihashCode,r.digestSize,o,i);return[r.version===0?gt.createV0(a):gt.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,I]=Gu(t.subarray(r));return r+=I,d},i=n(),o=qi;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=UC(t,r),o=gt.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return qu(o).set(n,t),o}};function UC(e,t){switch(e[0]){case"Q":{let r=t??Wr;return[Wr.prefix,r.decode(`${Wr.prefix}${e}`)]}case Wr.prefix:{let r=t??Wr;return[Wr.prefix,r.decode(e)]}case la.prefix:{let r=t??la;return[la.prefix,r.decode(e)]}case cu.prefix:{let r=t??cu;return[cu.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 PC(e,t,r){let{prefix:n}=r;if(n!==Wr.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 BC(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 qi=112,RC=18;function jd(e,t,r){let n=ts(e),i=n+ts(t),o=new Uint8Array(i+r.byteLength);return es(e,o,0),es(t,o,n),o.set(r,i),o}var DC=Symbol.for("@ipld/js-cid/CID"),ng=42;function MC(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=rg.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new me(W.tag,ng),new me(W.bytes,r)]}function LC(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function VC(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 FC(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 Cd={float64:!0,typeEncoders:{Map:FC,Object:MC,undefined:LC,number:VC}},E6={...Cd,typeEncoders:{...Cd.typeEncoders}};function zC(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return rg.decode(e.subarray(1))}var Wu={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Wu.tags[ng]=zC;var x6={...Wu,tags:Wu.tags.slice()},O6=Nr(cc(),1),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},Xi={"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=Xi["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=Xi["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,a]=t[i];switch(o){case"roots":{let s=Xi["CarV1HeaderOrV2Pragma > roots (anon)"](e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=Xi.Int(e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},Qi={"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=Qi["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=Qi["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,a]=t[i];switch(o){case"roots":{let s=Qi["CarV1HeaderOrV2Pragma > roots (anon)"](a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=Qi.Int(a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},A6={toTyped:Xi.CarV1HeaderOrV2Pragma,toRepresentation:Qi.CarV1HeaderOrV2Pragma},S6=Xy(),I6=Nr(cc(),1),k6=[new me(W.map,2),new me(W.string,"version"),new me(W.uint,1),new me(W.string,"roots")],$6=new me(W.tag,42),j6=Nr(cc(),1),{WARN:ig,LOG:C6,DEBUG:fu,VERBOSE:_c,ERROR:Xn}=ke.setup(ke.INFO);async function KC(e){let t=await qC(e);return await GC(t)}async function GC({rootCID:e,blockStore:t},r=[],n){if(!e||!t)throw Xn("Empty roots/blocks",{rootCID:e,blockStore:t});let i=[],o=null,a=e,s=new Set,u=null;for(;a;){let f=a.toString();if(s.has(f))throw Xn("[decodePubFromBlocks] pub chain has a loop",{currentCID:f,visited:[...s]});s.add(f);let d=await Zn(t,a);if(_c("[decodePubFromBlocks] root:",f,d,{blockStore:t}),!d)throw Xn("[decodePubFromBlocks] root not found in blockStore",{blockStore:t,currentCID:f});let I;if(d?.info){u||(u=d.applogs);let L=await Zn(t,d.applogs);I=await JC(L,t),o||(o=await Zn(t,d.info),fu("new format - infoLogs",o.logs.map(J=>({[J.toString()]:J}))))}else I=d.applogs;let E=async L=>{let J=L,B=await Zn(t,J);if(!B)throw Xn("Could not find applog CID in pub blocks:",J.toString(),{cid:J,root:d,blockStore:t}),new Error(`Could not find applog CID in pub blocks: ${J.toString()}`);return B.pv instanceof zt&&(B.pv=B.pv.toV1().toString()),{...B,cid:J.toV1().toString()}},_=await Promise.all(I.map(E));if(i=i.concat(_),!d.prev)break;if(n&&Ay(d.prev,n)){fu("[decodePubFromBlocks] stopping at stopAtCID:",n.toString());break}if(!await t.get(d.prev))throw Xn("[decodePubFromBlocks] prev snapshot missing from blockStore",{currentCID:f,prev:d.prev.toString(),stopAtCID:n?.toString(),visited:[...s]});a=d.prev}let l={cid:e,info:o?{...o,logs:await Promise.all(o.logs.map(async f=>{let d=f,I=await Zn(t,d);if(!I)throw Xn("Could not find info log CID in pub blocks:",d.toString(),{cid:d,blockStore:t}),new Error(`Could not find info log CID in pub blocks: ${d.toString()}`);return I.pv instanceof zt&&(I.pv=I.pv.toV1().toString()),{...I,cid:d.toV1().toString()}}))}:null,applogsCID:u,applogs:i};return fu("[decodePubFromBlocks] result:",l,{rootCID:e.toString(),blockStore:t,applogs:i}),l}async function qC(e){let t=(await e.getRoots()).map(n=>(typeof n.toV1=="function"?n:zt.decode(n.bytes)).toV1().toString()),r=new Map;for await(let{cid:n,bytes:i}of e.blocks()){let o=typeof n.toV1=="function"?n:zt.decode(n.bytes);_c({cidFromCarblocks:n,cid:o}),r.set(o.toV1().toString(),i)}return t.length!==1&&ig("Unexpected roots count:",t),{rootCID:zt.parse(t[0]),blockStore:{get:n=>r.get(n.toV1().toString())}}}async function Zn(e,t){try{var r=await e.get(t);if(!r)return ig("returning null"),null}catch(n){if(n.message==="Not Found")return null;throw n}return ac(r)}function WC(e){return async function*(){for(;;){let{done:t,value:r}=await e.read();if(_c("[car] chunk",{done:t,value:r}),t)break;yield r}}()}var{WARN:N6,LOG:U6,DEBUG:P6,VERBOSE:B6,ERROR:HC}=ke.setup(ke.INFO);async function JC(e,t){return XC(e)?(await Promise.all(e.chunks.map(async r=>{let n=await Zn(t,r);if(!n.logs)throw HC("Weird chunk",n);return n.logs}))).flat():e.logs}function XC(e){return e.chunks}var rs=mo(Ig(),1),QC=mo(kg(),1),og=!1,ag=!1;rs.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(og=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(ag=process?.env?.LOGGER_PERF_PREFIX==="true"));var ZC={prefix:void 0,time:og,delta:ag,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},du=[],sg=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(",")}]`}},ug=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Zi=!1,ui=class Tt{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=Tt.INFO,r={}){r=Object.assign({},ZC,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),a=(u,l)=>{function f(...I){let E=I[I.length-1];return E===i?E():(o(...I.slice(0,-1)),(async()=>{try{let _=E();return _ instanceof Promise?await _:_}finally{console.groupEnd()}})())}let d=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:l});return u?d:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:d})},s=a(t>=Tt.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(s(...u),new Error((0,QC.default)(u))),WARN:a(t>=Tt.WARN,this.wrapLog(console.warn,r)),LOG:a(t>=Tt.INFO,this.wrapLog(console.log,r)),DEBUG:a(t>=Tt.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:a(t>=Tt.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(rs.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=rs.isBrowser&&navigator.userAgent.includes("Chrome")?["",Tt.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(Zi?n.push(new ug("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();Tt.firstLog||(Tt.firstLog=i,Tt.lastLog=i);let o=new sg(i-Tt.firstLog,i-Tt.lastLog,t,r);return Tt.lastLog=i,n?o.toString():o}static getOriginFromStack(t){let r=!1;for(let n of t.split(`
62
+ `)){let i=n.match(/^\s+at\s+(.*)/);if(i){if(r)return i[1].trim().replace(__dirname,"");r=!0}}}};rs.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(du&&du.length){for(let t of du)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof sg))return null;Zi||(Zi=!0);let t=ui.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof ug?(Zi||(Zi=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var{WARN:YC,LOG:R6,DEBUG:to,VERBOSE:D6,ERROR:Ms}=ui.setup(ui.INFO),Ec=["https://trustless-gateway.link/","https://ipfs.4everland.io/"].map(e=>({url:e}));async function xc(e,{readOnly:t=!0,pinnedCID:r,gateways:n=Ec}={}){let{cid:i,errors:o,isIpns:a}=uj(e);if(!i)throw Ms("Failed to parse pubID",e,o);to("[retrieveThread] parsedPubID",{cid:i.toString(),errors:o,isIpns:a});let s=await lg(i),{applogs:u,info:l}=await KC(s),f=u.filter(Lu);f.length&&YC(`Found ${f.length} encrypted logs - skipping`);let d=u.filter(E=>!Lu(E));go(d);let I=Ro.fromArray(d,`preview${e&&e!==i.toString()?"-"+e:""}@${i.toString()}`,t);return{cid:i,info:l,thread:I,encryptedCount:f.length}}async function lg(e,t=Ec){return e=Fu(e),to("Retrieving:",e,e.toString(),"from",t),await Oc(t,async(r,n)=>{var i=cg(r,e);n>1&&(i+=`&cache-bust=${performance.now()}`);let o=await fetch(i),a=await eN(o,i);to("[retrieveCar] GW result",{result:a,gateway:r});let s=await pp.fromIterable(a);to("[retrieveCar] GW decodeResult",{car:s,gateway:r});let u=(await s.getRoots())[0];if(!uc(e)&&!Ay(e,u))throw Ms("Fetched CAR has different CID",u.toString(),"than the one asked for:",e.toString());return s})}function cg(e,t,r="all"){let n=new URL(e.url),i=uc(t),o=`${n}${i?"ipns/":"ipfs/"}${t.toString()}?format=car&dag-scope=${r}`;return to({isIpns:i,url:o}),o}async function eN(e,t){if(!e?.ok||!e?.body)throw Ms("[retrieveCar] unexpected response",e?.statusText,{url:t});return WC(e.body.getReader())}async function Oc(e,t,r=1){try{return await Promise.any(_a(e).map(async n=>{try{return await t(n,r)}catch(i){throw Ms("still trying",i),i instanceof Error?i:new Error(`[retrieveCar] error: ${i}`)}}))}catch(n){if(r<3)return await Oc(e,t,r+1);throw new Error("[Gateway] no valid results after 3 attempts via: "+_a(e).map(({url:i})=>i)+`
63
+ `+n.errors.map(i=>i.message))}}var{WARN:m8,LOG:b8,DEBUG:v8,VERBOSE:w8,ERROR:T8}=ke.setup(ke.INFO),{WARN:tN,LOG:_8,DEBUG:rN,VERBOSE:Ls,ERROR:E8}=ke.setup(ke.INFO),x8=at("queryDivergencesByPrev",function(e){rN(`queryDivergencesByPrev<${e.nameAndSizeUntracked}>`),e.filters.includes("lastWriteWins")&&tN("queryDivergencesByPrev on thread lastWriteWins",e);let t=nr(()=>{let r=new Map,n=new Set;Ls("all applogs:",e.applogs);for(let i of e.applogs){let o;i.pv&&(o=i.pv&&r.get(i.pv.toString()),n.delete(i.pv.toString())),Ls("traversing log",{log:i,prevLogs:o,leafs:Array.from(n)}),r.set(i.cid,o?[...o,i]:[i]),n.add(i.cid)}return Array.from(n).map(i=>{let o=new Ro(Ye({caller:"DivergenceLeaf",thread:e,pattern:`leaf: ${i}`}),r.get(i),e.filters,!0);return{log:o.latestLog,thread:o}})},{name:Ye({caller:"queryDivergencesByPrev",thread:e})});return Ls.isDisabled||Gt(()=>Ls("[queryDivergencesByPrev] result:",Ar(t))),t},{equals:et.structural}),{WARN:O8,LOG:A8,DEBUG:S8,VERBOSE:I8,ERROR:k8}=ke.setup(ke.INFO),{WARN:$8,LOG:j8,DEBUG:C8,VERBOSE:N8,ERROR:U8}=ui.setup(ui.INFO);var{WARN:D8,LOG:M8,DEBUG:L8,VERBOSE:V8,ERROR:F8}=Gs.setup(Gs.INFO),nN="https://nftstorage.link";async function z8(e,{readOnly:t=!0,pinnedCID:r}={}){return xc(e,{readOnly:t,pinnedCID:r,gateways:[{url:nN}]})}export{nN as a,z8 as b};
64
64
  /*! Bundled license information:
65
65
 
66
66
  lodash-es/lodash.js:
@@ -77,4 +77,4 @@ lodash-es/lodash.js:
77
77
  @noble/hashes/utils.js:
78
78
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
79
79
  */
80
- //# sourceMappingURL=chunk-TVWQKLVE.min.js.map
80
+ //# sourceMappingURL=chunk-ES6LKAEP.min.js.map