@wovin/connect-nftstorage 0.0.10 → 0.0.11

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.
@@ -0,0 +1,80 @@
1
+ import{e as ja}from"./chunk-BKKH6BET.min.js";var Qp=Object.create,Lc=Object.defineProperty,Xp=Object.getOwnPropertyDescriptor,Yp=Object.getOwnPropertyNames,Zp=Object.getPrototypeOf,eh=Object.prototype.hasOwnProperty,mn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),th=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Yp(t))!eh.call(e,i)&&i!==r&&Lc(e,i,{get:()=>t[i],enumerable:!(n=Xp(t,i))||n.enumerable});return e},_i=(e,t,r)=>(r=e!=null?Qp(Zp(e)):{},th(t||!e||!e.__esModule?Lc(r,"default",{value:e,enumerable:!0}):r,e)),rh=mn((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}}),nh=mn((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,p,A=o.length;do{if(f>=A||l>49)throw i.bytes=0,new RangeError("Could not decode varint");p=o[f++],s+=l<28?(p&n)<<l:(p&n)*Math.pow(2,l),l+=7}while(p>=r);return i.bytes=f-u,s}}),ih=mn((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(p){return p<r?1:p<n?2:p<i?3:p<o?4:p<a?5:p<s?6:p<u?7:p<l?8:p<f?9:10}}),Cs=mn((e,t)=>{"use strict";t.exports={encode:rh(),decode:nh(),encodingLength:ih()}}),oh=mn(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}),ah=mn((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 p={key:l,value:u[l]},A={key:f,value:u[f]};return s(p,A)}}}(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 p=a.push(u)-1,A=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<A.length;l++){var O=A[l],T=s(u[O]);T&&(f&&(f+=","),f+=JSON.stringify(O)+":"+T)}return a.splice(p,1),"{"+f+"}"}}(r)}}),sh=["string","number","bigint","symbol"],uh=["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 lh(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return sh.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":ch(e)?"Buffer":fh(e)||"Object"}function ch(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function fh(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(uh.includes(t))return t}var J=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}};J.uint=new J(0,"uint",!0);J.negint=new J(1,"negint",!0);J.bytes=new J(2,"bytes",!0);J.string=new J(3,"string",!0);J.array=new J(4,"array",!1);J.map=new J(5,"map",!1);J.tag=new J(6,"tag",!1);J.float=new J(7,"float",!0);J.false=new J(7,"false",!0);J.true=new J(7,"true",!0);J.null=new J(7,"null",!0);J.undefined=new J(7,"undefined",!0);J.break=new J(7,"break",!0);var he=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}`}},gn=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",dh=new TextDecoder,ph=new TextEncoder;function oo(e){return gn&&globalThis.Buffer.isBuffer(e)}function hh(e){return e instanceof Uint8Array?oo(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var yh=gn?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Ju(e,t,r):(e,t,r)=>r-t>64?dh.decode(e.subarray(t,r)):Ju(e,t,r),mh=gn?e=>e.length>64?globalThis.Buffer.from(e):Wu(e):e=>e.length>64?ph.encode(e):Wu(e),Ps=gn?(e,t,r)=>oo(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),gh=gn?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),hh(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},vh=gn?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function bh(e,t){if(oo(e)&&oo(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 Wu(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 Ju(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 wh(n)}var Qu=4096;function wh(e){let t=e.length;if(t<=Qu)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Qu));return r}var _h=256,Th=class{constructor(e=_h){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=vh(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=Ps(r,0,this.cursor)}else t=gh(this.chunks,this.cursor);return e&&this.reset(),t}},_e="CBOR decode error:",Vc="CBOR encode error:",Ti=[];Ti[23]=1;Ti[24]=2;Ti[25]=3;Ti[26]=5;Ti[27]=9;function vn(e,t,r){if(e.length-t<r)throw new Error(`${_e} not enough data for type`)}var Je=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Vr(e,t,r){vn(e,t,1);let n=e[t];if(r.strict===!0&&n<Je[0])throw new Error(`${_e} integer encoded in more bytes than necessary (strict decode)`);return n}function zr(e,t,r){vn(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<Je[1])throw new Error(`${_e} integer encoded in more bytes than necessary (strict decode)`);return n}function Fr(e,t,r){vn(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<Je[2])throw new Error(`${_e} integer encoded in more bytes than necessary (strict decode)`);return n}function Gr(e,t,r){vn(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<Je[3])throw new Error(`${_e} 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(`${_e} integers outside of the safe integer range are not supported`)}function Oh(e,t,r,n){return new he(J.uint,Vr(e,t+1,n),2)}function xh(e,t,r,n){return new he(J.uint,zr(e,t+1,n),3)}function Eh(e,t,r,n){return new he(J.uint,Fr(e,t+1,n),5)}function Ih(e,t,r,n){return new he(J.uint,Gr(e,t+1,n),9)}function Kr(e,t){return It(e,0,t.value)}function It(e,t,r){if(r<Je[0]){let n=Number(r);e.push([t|n])}else if(r<Je[1]){let n=Number(r);e.push([t|24,n])}else if(r<Je[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<Je[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<Je[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(`${_e} encountered BigInt larger than allowable range`)}}Kr.encodedSize=function(e){return It.encodedSize(e.value)};It.encodedSize=function(e){return e<Je[0]?1:e<Je[1]?2:e<Je[2]?3:e<Je[3]?5:9};Kr.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function Sh(e,t,r,n){return new he(J.negint,-1-Vr(e,t+1,n),2)}function Ah(e,t,r,n){return new he(J.negint,-1-zr(e,t+1,n),3)}function $h(e,t,r,n){return new he(J.negint,-1-Fr(e,t+1,n),5)}var ks=BigInt(-1),zc=BigInt(1);function Nh(e,t,r,n){let i=Gr(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new he(J.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${_e} integers outside of the safe integer range are not supported`);return new he(J.negint,ks-BigInt(i),9)}function Us(e,t){let r=t.value,n=typeof r=="bigint"?r*ks-zc:r*-1-1;It(e,t.type.majorEncoded,n)}Us.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*ks-zc:t*-1-1;return r<Je[0]?1:r<Je[1]?2:r<Je[2]?3:r<Je[3]?5:9};Us.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Oi(e,t,r,n){vn(e,t,r+n);let i=Ps(e,t+r,t+r+n);return new he(J.bytes,i,r+n)}function jh(e,t,r,n){return Oi(e,t,1,r)}function Ch(e,t,r,n){return Oi(e,t,2,Vr(e,t+1,n))}function Ph(e,t,r,n){return Oi(e,t,3,zr(e,t+1,n))}function kh(e,t,r,n){return Oi(e,t,5,Fr(e,t+1,n))}function Uh(e,t,r,n){let i=Gr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${_e} 64-bit integer bytes lengths not supported`);return Oi(e,t,9,i)}function ao(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===J.string?mh(e.value):e.value),e.encodedBytes}function Wo(e,t){let r=ao(t);It(e,t.type.majorEncoded,r.length),e.push(r)}Wo.encodedSize=function(e){let t=ao(e);return It.encodedSize(t.length)+t.length};Wo.compareTokens=function(e,t){return Rh(ao(e),ao(t))};function Rh(e,t){return e.length<t.length?-1:e.length>t.length?1:bh(e,t)}function xi(e,t,r,n,i){let o=r+n;vn(e,t,o);let a=new he(J.string,yh(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=Ps(e,t+r,t+o)),a}function Dh(e,t,r,n){return xi(e,t,1,r,n)}function Bh(e,t,r,n){return xi(e,t,2,Vr(e,t+1,n),n)}function Mh(e,t,r,n){return xi(e,t,3,zr(e,t+1,n),n)}function Lh(e,t,r,n){return xi(e,t,5,Fr(e,t+1,n),n)}function Vh(e,t,r,n){let i=Gr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${_e} 64-bit integer string lengths not supported`);return xi(e,t,9,i,n)}var zh=Wo;function bn(e,t,r,n){return new he(J.array,n,r)}function Fh(e,t,r,n){return bn(e,t,1,r)}function Gh(e,t,r,n){return bn(e,t,2,Vr(e,t+1,n))}function Kh(e,t,r,n){return bn(e,t,3,zr(e,t+1,n))}function qh(e,t,r,n){return bn(e,t,5,Fr(e,t+1,n))}function Hh(e,t,r,n){let i=Gr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${_e} 64-bit integer array lengths not supported`);return bn(e,t,9,i)}function Wh(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${_e} indefinite length items not allowed`);return bn(e,t,1,1/0)}function Rs(e,t){It(e,J.array.majorEncoded,t.value)}Rs.compareTokens=Kr.compareTokens;Rs.encodedSize=function(e){return It.encodedSize(e.value)};function wn(e,t,r,n){return new he(J.map,n,r)}function Jh(e,t,r,n){return wn(e,t,1,r)}function Qh(e,t,r,n){return wn(e,t,2,Vr(e,t+1,n))}function Xh(e,t,r,n){return wn(e,t,3,zr(e,t+1,n))}function Yh(e,t,r,n){return wn(e,t,5,Fr(e,t+1,n))}function Zh(e,t,r,n){let i=Gr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${_e} 64-bit integer map lengths not supported`);return wn(e,t,9,i)}function ey(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${_e} indefinite length items not allowed`);return wn(e,t,1,1/0)}function Ds(e,t){It(e,J.map.majorEncoded,t.value)}Ds.compareTokens=Kr.compareTokens;Ds.encodedSize=function(e){return It.encodedSize(e.value)};function ty(e,t,r,n){return new he(J.tag,r,1)}function ry(e,t,r,n){return new he(J.tag,Vr(e,t+1,n),2)}function ny(e,t,r,n){return new he(J.tag,zr(e,t+1,n),3)}function iy(e,t,r,n){return new he(J.tag,Fr(e,t+1,n),5)}function oy(e,t,r,n){return new he(J.tag,Gr(e,t+1,n),9)}function Bs(e,t){It(e,J.tag.majorEncoded,t.value)}Bs.compareTokens=Kr.compareTokens;Bs.encodedSize=function(e){return It.encodedSize(e.value)};var ay=20,sy=21,uy=22,ly=23;function cy(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${_e} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new he(J.null,null,1):new he(J.undefined,void 0,1)}function fy(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${_e} indefinite length items not allowed`);return new he(J.break,void 0,1)}function Ms(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${_e} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${_e} Infinity values are not supported`)}return new he(J.float,e,t)}function dy(e,t,r,n){return Ms(Vs(e,t+1),3,n)}function py(e,t,r,n){return Ms(zs(e,t+1),5,n)}function hy(e,t,r,n){return Ms(qc(e,t+1),9,n)}function Ls(e,t,r){let n=t.value;if(n===!1)e.push([J.float.majorEncoded|ay]);else if(n===!0)e.push([J.float.majorEncoded|sy]);else if(n===null)e.push([J.float.majorEncoded|uy]);else if(n===void 0)e.push([J.float.majorEncoded|ly]);else{let i,o=!1;(!r||r.float64!==!0)&&(Gc(n),i=Vs(Nt,1),n===i||Number.isNaN(n)?(Nt[0]=249,e.push(Nt.slice(0,3)),o=!0):(Kc(n),i=zs(Nt,1),n===i&&(Nt[0]=250,e.push(Nt.slice(0,5)),o=!0))),o||(yy(n),i=qc(Nt,1),Nt[0]=251,e.push(Nt.slice(0,9)))}}Ls.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){Gc(r);let n=Vs(Nt,1);if(r===n||Number.isNaN(r))return 3;if(Kc(r),n=zs(Nt,1),r===n)return 5}return 9};var Fc=new ArrayBuffer(9),yt=new DataView(Fc,1),Nt=new Uint8Array(Fc,0);function Gc(e){if(e===1/0)yt.setUint16(0,31744,!1);else if(e===-1/0)yt.setUint16(0,64512,!1);else if(Number.isNaN(e))yt.setUint16(0,32256,!1);else{yt.setFloat32(0,e);let t=yt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)yt.setUint16(0,31744,!1);else if(r===0)yt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?yt.setUint16(0,0):i<-14?yt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):yt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Vs(e,t){if(e.length-t<2)throw new Error(`${_e} 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 Kc(e){yt.setFloat32(0,e,!1)}function zs(e,t){if(e.length-t<4)throw new Error(`${_e} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function yy(e){yt.setFloat64(0,e,!1)}function qc(e,t){if(e.length-t<8)throw new Error(`${_e} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Ls.compareTokens=Kr.compareTokens;function Ie(e,t,r){throw new Error(`${_e} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Jo(e){return()=>{throw new Error(`${_e} ${e}`)}}var ue=[];for(let e=0;e<=23;e++)ue[e]=Ie;ue[24]=Oh;ue[25]=xh;ue[26]=Eh;ue[27]=Ih;ue[28]=Ie;ue[29]=Ie;ue[30]=Ie;ue[31]=Ie;for(let e=32;e<=55;e++)ue[e]=Ie;ue[56]=Sh;ue[57]=Ah;ue[58]=$h;ue[59]=Nh;ue[60]=Ie;ue[61]=Ie;ue[62]=Ie;ue[63]=Ie;for(let e=64;e<=87;e++)ue[e]=jh;ue[88]=Ch;ue[89]=Ph;ue[90]=kh;ue[91]=Uh;ue[92]=Ie;ue[93]=Ie;ue[94]=Ie;ue[95]=Jo("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ue[e]=Dh;ue[120]=Bh;ue[121]=Mh;ue[122]=Lh;ue[123]=Vh;ue[124]=Ie;ue[125]=Ie;ue[126]=Ie;ue[127]=Jo("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ue[e]=Fh;ue[152]=Gh;ue[153]=Kh;ue[154]=qh;ue[155]=Hh;ue[156]=Ie;ue[157]=Ie;ue[158]=Ie;ue[159]=Wh;for(let e=160;e<=183;e++)ue[e]=Jh;ue[184]=Qh;ue[185]=Xh;ue[186]=Yh;ue[187]=Zh;ue[188]=Ie;ue[189]=Ie;ue[190]=Ie;ue[191]=ey;for(let e=192;e<=215;e++)ue[e]=ty;ue[216]=ry;ue[217]=ny;ue[218]=iy;ue[219]=oy;ue[220]=Ie;ue[221]=Ie;ue[222]=Ie;ue[223]=Ie;for(let e=224;e<=243;e++)ue[e]=Jo("simple values are not supported");ue[244]=Ie;ue[245]=Ie;ue[246]=Ie;ue[247]=cy;ue[248]=Jo("simple values are not supported");ue[249]=dy;ue[250]=py;ue[251]=hy;ue[252]=Ie;ue[253]=Ie;ue[254]=Ie;ue[255]=fy;var qt=[];for(let e=0;e<24;e++)qt[e]=new he(J.uint,e,1);for(let e=-1;e>=-24;e--)qt[31-e]=new he(J.negint,e,1);qt[64]=new he(J.bytes,new Uint8Array(0),1);qt[96]=new he(J.string,"",1);qt[128]=new he(J.array,0,1);qt[160]=new he(J.map,0,1);qt[244]=new he(J.false,!1,1);qt[245]=new he(J.true,!0,1);qt[246]=new he(J.null,null,1);function Hc(){let e=[];return e[J.uint.major]=Kr,e[J.negint.major]=Us,e[J.bytes.major]=Wo,e[J.string.major]=zh,e[J.array.major]=Rs,e[J.map.major]=Ds,e[J.tag.major]=Bs,e[J.float.major]=Ls,e}var s$=Hc(),u$=new Th,Xu=class Wc{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(`${Vc} object contains circular references`);return new Wc(r,t)}},ur={null:new he(J.null,null),undefined:new he(J.undefined,void 0),true:new he(J.true,!0),false:new he(J.false,!1),emptyArray:new he(J.array,0),emptyMap:new he(J.map,0)},wr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new he(J.float,e):e>=0?new he(J.uint,e):new he(J.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new he(J.uint,e):new he(J.negint,e)},Uint8Array(e,t,r,n){return new he(J.bytes,e)},string(e,t,r,n){return new he(J.string,e)},boolean(e,t,r,n){return e?ur.true:ur.false},null(e,t,r,n){return ur.null},undefined(e,t,r,n){return ur.undefined},ArrayBuffer(e,t,r,n){return new he(J.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new he(J.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[ur.emptyArray,new he(J.break)]:ur.emptyArray;n=Xu.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=Ca(a,r,n);return r.addBreakTokens?[new he(J.array,e.length),i,new he(J.break)]:[new he(J.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?[ur.emptyMap,new he(J.break)]:ur.emptyMap;n=Xu.createCheck(n,e);let s=[],u=0;for(let l of o)s[u++]=[Ca(l,r,n),Ca(i?e.get(l):e[l],r,n)];return my(s,r),r.addBreakTokens?[new he(J.map,a),s,new he(J.break)]:[new he(J.map,a),s]}};wr.Map=wr.Object;wr.Buffer=wr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))wr[`${e}Array`]=wr.DataView;function Ca(e,t={},r){let n=lh(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||wr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=wr[n];if(!o)throw new Error(`${Vc} unsupported type: ${n}`);return o(e,n,t,r)}function my(e,t){t.mapSorter&&e.sort(t.mapSorter)}var gy={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},vy=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=qt[e];if(t===void 0){let r=ue[e];if(!r)throw new Error(`${_e} 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}},oi=Symbol.for("DONE"),Qo=Symbol.for("BREAK");function by(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=ai(t,r);if(o===Qo){if(e.value===1/0)break;throw new Error(`${_e} got unexpected break to lengthed array`)}if(o===oi)throw new Error(`${_e} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function wy(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},o=n?new Map:void 0;for(let a=0;a<e.value;a++){let s=ai(t,r);if(s===Qo){if(e.value===1/0)break;throw new Error(`${_e} got unexpected break to lengthed map`)}if(s===oi)throw new Error(`${_e} found map but not enough entries (got ${a} [no key], expected ${e.value})`);if(n!==!0&&typeof s!="string")throw new Error(`${_e} non-string keys not supported (got ${typeof s})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(s)||!n&&s in i))throw new Error(`${_e} found repeat map key "${s}"`);let u=ai(t,r);if(u===oi)throw new Error(`${_e} 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 ai(e,t){if(e.done())return oi;let r=e.next();if(r.type===J.break)return Qo;if(r.type.terminal)return r.value;if(r.type===J.array)return by(r,e,t);if(r.type===J.map)return wy(r,e,t);if(r.type===J.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=ai(e,t);return t.tags[r.value](n)}throw new Error(`${_e} tag not supported (${r.value})`)}throw new Error("unsupported")}function _y(e,t){if(!(e instanceof Uint8Array))throw new Error(`${_e} data to decode must be a Uint8Array`);t=Object.assign({},gy,t);let r=t.tokenizer||new vy(e,t),n=ai(r,t);if(n===oi)throw new Error(`${_e} did not find any content to decode`);if(n===Qo)throw new Error(`${_e} got unexpected break`);return[n,e.subarray(r.pos())]}function Ty(e,t){let[r,n]=_y(e,t);if(n.length>0)throw new Error(`${_e} too many terminals, data makes no sense`);return r}var l$=new Uint8Array(0);function Oy(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 Fs(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function xy(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),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 p(T){if(T instanceof Uint8Array||(ArrayBuffer.isView(T)?T=new Uint8Array(T.buffer,T.byteOffset,T.byteLength):Array.isArray(T)&&(T=Uint8Array.from(T))),!(T instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(T.length===0)return"";for(var F=0,W=0,x=0,P=T.length;x!==P&&T[x]===0;)x++,F++;for(var G=(P-x)*f+1>>>0,q=new Uint8Array(G);x!==P;){for(var V=T[x],Q=0,L=G-1;(V!==0||Q<W)&&L!==-1;L--,Q++)V+=256*q[L]>>>0,q[L]=V%s>>>0,V=V/s>>>0;if(V!==0)throw new Error("Non-zero carry");W=Q,x++}for(var re=G-W;re!==G&&q[re]===0;)re++;for(var M=u.repeat(F);re<G;++re)M+=e.charAt(q[re]);return M}function A(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return new Uint8Array;var F=0;if(T[F]!==" "){for(var W=0,x=0;T[F]===u;)W++,F++;for(var P=(T.length-F)*l+1>>>0,G=new Uint8Array(P);T[F];){var q=r[T.charCodeAt(F)];if(q===255)return;for(var V=0,Q=P-1;(q!==0||V<x)&&Q!==-1;Q--,V++)q+=s*G[Q]>>>0,G[Q]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");x=V,F++}if(T[F]!==" "){for(var L=P-x;L!==P&&G[L]===0;)L++;for(var re=new Uint8Array(W+(P-L)),M=W;L!==P;)re[M++]=G[L++];return re}}}function O(T){var F=A(T);if(F)return F;throw new Error(`Non-${t} character`)}return{encode:p,decodeUnsafe:A,decode:O}}var Ey=xy,Iy=Ey,Sy=Iy,Ay=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")}},$y=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 Jc(this,e)}},Ny=class{decoders;constructor(e){this.decoders=e}or(e){return Jc(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 Jc(e,t){return new Ny({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var jy=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 Ay(e,t,r),this.decoder=new $y(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Qc({name:e,prefix:t,encode:r,decode:n}){return new jy(e,t,r,n)}function Xo({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Sy(r,e);return Qc({prefix:t,name:e,encode:n,decode:o=>Fs(i(o))})}function Cy(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 p=i[e[f]];if(p===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|p,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 Py(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 rr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return Qc({prefix:t,name:e,encode(i){return Py(i,n,r)},decode(i){return Cy(i,n,r,e)}})}var Wi=rr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),c$=rr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),f$=rr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),d$=rr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),p$=rr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),h$=rr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),y$=rr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),m$=rr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),g$=rr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Pa=Xo({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),v$=Xo({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),dr=Xo({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),b$=Xo({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),ky=Xc,Yu=128,Uy=127,Ry=~Uy,Dy=Math.pow(2,31);function Xc(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Dy;)t[r++]=e&255|Yu,e/=128;for(;e&Ry;)t[r++]=e&255|Yu,e>>>=7;return t[r]=e|0,Xc.bytes=r-n+1,t}var By=Xa,My=128,Zu=127;function Xa(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Xa.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Zu)<<i:(a&Zu)*Math.pow(2,i),i+=7}while(a>=My);return Xa.bytes=o-n,r}var Ly=Math.pow(2,7),Vy=Math.pow(2,14),zy=Math.pow(2,21),Fy=Math.pow(2,28),Gy=Math.pow(2,35),Ky=Math.pow(2,42),qy=Math.pow(2,49),Hy=Math.pow(2,56),Wy=Math.pow(2,63),Jy=function(e){return e<Ly?1:e<Vy?2:e<zy?3:e<Fy?4:e<Gy?5:e<Ky?6:e<qy?7:e<Hy?8:e<Wy?9:10},Qy={encode:ky,decode:By,encodingLength:Jy},Xy=Qy,so=Xy;function Ya(e,t=0){return[so.decode(e,t),so.decode.bytes]}function uo(e,t,r=0){return so.encode(e,t,r),t}function lo(e){return so.encodingLength(e)}function Yy(e,t){let r=t.byteLength,n=lo(e),i=n+lo(r),o=new Uint8Array(i+r);return uo(e,o,0),uo(r,o,n),o.set(t,i),new Gs(e,r,t,o)}function Zy(e){let t=Fs(e),[r,n]=Ya(t),[i,o]=Ya(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Gs(r,i,a,t)}function em(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Oy(e.bytes,r.bytes)}}var Gs=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function el(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return rm(r,Za(e),t??dr.encoder);default:return nm(r,Za(e),t??Wi.encoder)}}var tl=new WeakMap;function Za(e){let t=tl.get(e);if(t==null){let r=new Map;return tl.set(e,r),r}return t}var Yc=class Ze{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!==zn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==im)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Ze.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=Yy(t,r);return Ze.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 Ze.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&em(t.multihash,n.multihash)}toString(t){return el(this,t)}toJSON(){return{"/":el(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 Ze)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new Ze(n,i,o,a??rl(n,i,o.bytes))}else if(r[om]===!0){let{version:n,multihash:i,code:o}=r,a=Zy(i);return Ze.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!==zn)throw new Error(`Version 0 CID must use dag-pb (code: ${zn}) block encoding`);return new Ze(t,r,n,n.bytes)}case 1:{let i=rl(t,r,n.bytes);return new Ze(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return Ze.create(0,zn,t)}static createV1(t,r){return Ze.create(1,t,r)}static decode(t){let[r,n]=Ze.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=Ze.inspectBytes(t),n=r.size-r.multihashSize,i=Fs(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 Gs(r.multihashCode,r.digestSize,o,i);return[r.version===0?Ze.createV0(a):Ze.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[p,A]=Ya(t.subarray(r));return r+=A,p},i=n(),o=zn;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]=tm(t,r),o=Ze.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Za(o).set(n,t),o}};function tm(e,t){switch(e[0]){case"Q":{let r=t??dr;return[dr.prefix,r.decode(`${dr.prefix}${e}`)]}case dr.prefix:{let r=t??dr;return[dr.prefix,r.decode(e)]}case Wi.prefix:{let r=t??Wi;return[Wi.prefix,r.decode(e)]}case Pa.prefix:{let r=t??Pa;return[Pa.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 rm(e,t,r){let{prefix:n}=r;if(n!==dr.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 nm(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 zn=112,im=18;function rl(e,t,r){let n=lo(e),i=n+lo(t),o=new Uint8Array(i+r.byteLength);return uo(e,o,0),uo(t,o,n),o.set(r,i),o}var om=Symbol.for("@ipld/js-cid/CID"),Zc=42;function am(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Yc.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new he(J.tag,Zc),new he(J.bytes,r)]}function sm(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function um(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 nl={float64:!0,typeEncoders:{Object:am,undefined:sm,number:um}},w$={...nl,typeEncoders:{...nl.typeEncoders}};function lm(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Yc.decode(e.subarray(1))}var co={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};co.tags[Zc]=lm;var _$={...co,tags:co.tags.slice()},cm=e=>Ty(e,co),T$=new Uint8Array(0);function fm(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 Ks(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 dm(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 p(T){if(T instanceof Uint8Array||(ArrayBuffer.isView(T)?T=new Uint8Array(T.buffer,T.byteOffset,T.byteLength):Array.isArray(T)&&(T=Uint8Array.from(T))),!(T instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(T.length===0)return"";for(var F=0,W=0,x=0,P=T.length;x!==P&&T[x]===0;)x++,F++;for(var G=(P-x)*f+1>>>0,q=new Uint8Array(G);x!==P;){for(var V=T[x],Q=0,L=G-1;(V!==0||Q<W)&&L!==-1;L--,Q++)V+=256*q[L]>>>0,q[L]=V%s>>>0,V=V/s>>>0;if(V!==0)throw new Error("Non-zero carry");W=Q,x++}for(var re=G-W;re!==G&&q[re]===0;)re++;for(var M=u.repeat(F);re<G;++re)M+=e.charAt(q[re]);return M}function A(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return new Uint8Array;var F=0;if(T[F]!==" "){for(var W=0,x=0;T[F]===u;)W++,F++;for(var P=(T.length-F)*l+1>>>0,G=new Uint8Array(P);T[F];){var q=r[T.charCodeAt(F)];if(q===255)return;for(var V=0,Q=P-1;(q!==0||V<x)&&Q!==-1;Q--,V++)q+=s*G[Q]>>>0,G[Q]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");x=V,F++}if(T[F]!==" "){for(var L=P-x;L!==P&&G[L]===0;)L++;for(var re=new Uint8Array(W+(P-L)),M=W;L!==P;)re[M++]=G[L++];return re}}}function O(T){var F=A(T);if(F)return F;throw new Error(`Non-${t} character`)}return{encode:p,decodeUnsafe:A,decode:O}}var pm=dm,hm=pm,ym=hm,mm=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")}},gm=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 ef(this,e)}},vm=class{decoders;constructor(e){this.decoders=e}or(e){return ef(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 ef(e,t){return new vm({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var bm=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 mm(e,t,r),this.decoder=new gm(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function tf({name:e,prefix:t,encode:r,decode:n}){return new bm(e,t,r,n)}function rf({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=ym(r,e);return tf({prefix:t,name:e,encode:n,decode:o=>Ks(i(o))})}function wm(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 p=i[e[f]];if(p===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|p,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 _m(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 nr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return tf({prefix:t,name:e,encode(i){return _m(i,n,r)},decode(i){return wm(i,n,r,e)}})}var Ji=nr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),O$=nr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),x$=nr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),E$=nr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),I$=nr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),S$=nr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),A$=nr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),$$=nr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),N$=nr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),pr=rf({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),j$=rf({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Tm=nf,il=128,Om=127,xm=~Om,Em=Math.pow(2,31);function nf(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Em;)t[r++]=e&255|il,e/=128;for(;e&xm;)t[r++]=e&255|il,e>>>=7;return t[r]=e|0,nf.bytes=r-n+1,t}var Im=es,Sm=128,ol=127;function es(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw es.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&ol)<<i:(a&ol)*Math.pow(2,i),i+=7}while(a>=Sm);return es.bytes=o-n,r}var Am=Math.pow(2,7),$m=Math.pow(2,14),Nm=Math.pow(2,21),jm=Math.pow(2,28),Cm=Math.pow(2,35),Pm=Math.pow(2,42),km=Math.pow(2,49),Um=Math.pow(2,56),Rm=Math.pow(2,63),Dm=function(e){return e<Am?1:e<$m?2:e<Nm?3:e<jm?4:e<Cm?5:e<Pm?6:e<km?7:e<Um?8:e<Rm?9:10},Bm={encode:Tm,decode:Im,encodingLength:Dm},Mm=Bm,fo=Mm;function ts(e,t=0){return[fo.decode(e,t),fo.decode.bytes]}function po(e,t,r=0){return fo.encode(e,t,r),t}function ho(e){return fo.encodingLength(e)}function Lm(e,t){let r=t.byteLength,n=ho(e),i=n+ho(r),o=new Uint8Array(i+r);return po(e,o,0),po(r,o,n),o.set(t,i),new qs(e,r,t,o)}function rs(e){let t=Ks(e),[r,n]=ts(t),[i,o]=ts(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new qs(r,i,a,t)}function Vm(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&fm(e.bytes,r.bytes)}}var qs=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function al(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return Fm(r,ns(e),t??pr.encoder);default:return Gm(r,ns(e),t??Ji.encoder)}}var sl=new WeakMap;function ns(e){let t=sl.get(e);if(t==null){let r=new Map;return sl.set(e,r),r}return t}var ul=class et{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==Fn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Km)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return et.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=Lm(t,r);return et.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return et.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&Vm(t.multihash,n.multihash)}toString(t){return al(this,t)}toJSON(){return{"/":al(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof et)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new et(n,i,o,a??ll(n,i,o.bytes))}else if(r[qm]===!0){let{version:n,multihash:i,code:o}=r,a=rs(i);return et.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!==Fn)throw new Error(`Version 0 CID must use dag-pb (code: ${Fn}) block encoding`);return new et(t,r,n,n.bytes)}case 1:{let i=ll(t,r,n.bytes);return new et(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return et.create(0,Fn,t)}static createV1(t,r){return et.create(1,t,r)}static decode(t){let[r,n]=et.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=et.inspectBytes(t),n=r.size-r.multihashSize,i=Ks(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 qs(r.multihashCode,r.digestSize,o,i);return[r.version===0?et.createV0(a):et.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[p,A]=ts(t.subarray(r));return r+=A,p},i=n(),o=Fn;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]=zm(t,r),o=et.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ns(o).set(n,t),o}};function zm(e,t){switch(e[0]){case"Q":{let r=t??pr;return[pr.prefix,r.decode(`${pr.prefix}${e}`)]}case pr.prefix:{let r=t??pr;return[pr.prefix,r.decode(e)]}case Ji.prefix:{let r=t??Ji;return[Ji.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 Fm(e,t,r){let{prefix:n}=r;if(n!==pr.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 Gm(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 Fn=112,Km=18;function ll(e,t,r){let n=ho(e),i=n+ho(t),o=new Uint8Array(i+r.byteLength);return po(e,o,0),po(t,o,n),o.set(r,i),o}var qm=Symbol.for("@ipld/js-cid/CID"),Pr=_i(Cs(),1),ka={SHA2_256:18,LENGTH:32,DAG_PB:112},Hm=40;function yo(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=Pr.default.decode(e);return t.seek(Pr.default.decode.bytes),r}function Wm(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 Jm(e){Pr.default.decode(e);let t=Pr.default.decode.bytes,r=Pr.default.decode(e.subarray(Pr.default.decode.bytes)),n=Pr.default.decode.bytes;return t+n+r}var mr={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},Jn={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":mr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(mr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Jn["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=Jn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:mr.Int,CarV1HeaderOrV2Pragma:e=>{if(mr.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=Jn["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=Jn.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}},Qn={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":mr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(mr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Qn["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=Qn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:mr.Int,CarV1HeaderOrV2Pragma:e=>{if(mr.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=Qn["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=Qn.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}},Qm={toTyped:Jn.CarV1HeaderOrV2Pragma,toRepresentation:Qn.CarV1HeaderOrV2Pragma},C$=Hc(),P$=_i(Cs(),1),k$=[new he(J.map,2),new he(J.string,"version"),new he(J.uint,1),new he(J.string,"roots")],U$=new he(J.tag,42);async function of(e,t){let r=yo(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=cm(n);if(Qm.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=Wm(await e.exactly(Hm,!0));e.seek(o.dataOffset-e.pos);let a=await of(e,1);return Object.assign(a,o)}async function Xm(e){let t=await e.exactly(2,!1);if(t[0]===ka.SHA2_256&&t[1]===ka.LENGTH){let a=await e.exactly(34,!0),s=rs(a);return ul.create(0,ka.DAG_PB,s)}let r=yo(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=yo(await e.upTo(8),e),i=await e.exactly(Jm(await e.upTo(8)),!0),o=rs(i);return ul.create(r,n,o)}async function af(e){let t=e.pos,r=yo(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await Xm(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function Ym(e){let{cid:t,blockLength:r}=await af(e);return{bytes:await e.exactly(r,!0),cid:t}}async function Zm(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await af(e),o={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(o.blockLength),o}function eg(e){let t=(async()=>{let r=await of(e);if(r.version===2){let n=e.pos-r.dataOffset;e=ig(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await Ym(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await Zm(e)}}}function tg(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 rg(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 ng(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return rg(r)}function ig(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 sf=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 cl(tg(e))}static async fromIterable(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return cl(ng(e))}};async function cl(e){let t=eg(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new sf(r,n)}var R$=_i(Cs(),1),og={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"},ag=og;function ce(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:ag[e];throw typeof i=="function"&&(i=i.apply(null,r)),new Error("[MobX] "+i)}var sg={};function Hs(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:sg}var uf=Object.assign,mo=Object.getOwnPropertyDescriptor,Ft=Object.defineProperty,Ei=Object.prototype,go=[];Object.freeze(go);var Ws={};Object.freeze(Ws);var ug=typeof Proxy<"u",lg=Object.toString();function lf(){ug||ce("`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`")}function Gn(e){Y.verifyProxies&&ce("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+e)}function St(){return++Y.mobxGuid}function Js(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var sn=function(){};function De(e){return typeof e=="function"}function Ur(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function Yo(e){return e!==null&&typeof e=="object"}function Rt(e){if(!Yo(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()===lg}function cf(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Zo(e,t,r){Ft(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function ff(e,t,r){Ft(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function Or(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(n){return Yo(n)&&n[r]===!0}}function _n(e){return e instanceof Map}function Ii(e){return e instanceof Set}var df=typeof Object.getOwnPropertySymbols<"u";function cg(e){var t=Object.keys(e);if(!df)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return Ei.propertyIsEnumerable.call(e,n)})):t}var ea=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:df?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function is(e){return typeof e=="string"?e:typeof e=="symbol"?e.toString():new String(e).toString()}function pf(e){return e===null?null:typeof e=="object"?""+e:e}function Ot(e,t){return Ei.hasOwnProperty.call(e,t)}var fg=Object.getOwnPropertyDescriptors||function(e){var t={};return ea(e).forEach(function(r){t[r]=mo(e,r)}),t};function fl(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,hg(n.key),n)}}function Qs(e,t,r){return t&&fl(e.prototype,t),r&&fl(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Zt(){return Zt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zt.apply(this,arguments)}function hf(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,os(e,t)}function os(e,t){return os=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},os(e,t)}function Qi(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dg(e,t){if(e){if(typeof e=="string")return dl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return dl(e,t)}}function dl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function un(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=dg(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 pg(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hg(e){var t=pg(e,"string");return typeof t=="symbol"?t:String(t)}var ut=Symbol("mobx-stored-annotations");function Gt(e){function t(r,n){if(Si(n))return e.decorate_20223_(r,n);Tn(r,n,e)}return Object.assign(t,e)}function Tn(e,t,r){if(Ot(e,ut)||Zo(e,ut,Zt({},e[ut])),vo(r)&&!Ot(e[ut],t)){var n=e.constructor.name+".prototype."+t.toString();ce("'"+n+"' is decorated with 'override', but no such decorated member was found on prototype.")}yg(e,r,t),vo(r)||(e[ut][t]=r)}function yg(e,t,r){if(!vo(t)&&Ot(e[ut],r)){var n=e.constructor.name+".prototype."+r.toString(),i=e[ut][r].annotationType_,o=t.annotationType_;ce("Cannot apply '@"+o+"' to '"+n+"':"+(`
3
+ The field is already decorated with '@`+i+"'.")+`
4
+ Re-decorating fields is not allowed.
5
+ Use '@override' decorator for methods overridden by subclass.`)}}function mg(e){return Ot(e,ut)||Zo(e,ut,Zt({},e[ut])),e[ut]}function Si(e){return typeof e=="object"&&typeof e.kind=="string"}function ta(e,t){t.includes(e.kind)||ce("The decorator applied to '"+String(e.name)+"' cannot be used on a "+e.kind+" element")}var ge=Symbol("mobx administration"),Ai=function(){function e(r){r===void 0&&(r="Atom@"+St()),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ee.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 Cf(this)},t.reportChanged=function(){wt(),Pf(this),_t()},t.toString=function(){return this.name_},e}(),Xs=Or("Atom",Ai);function yf(e,t,r){t===void 0&&(t=sn),r===void 0&&(r=sn);var n=new Ai(e);return t!==sn&&aa(n,t),r!==sn&&En(n,r),n}function gg(e,t){return e===t}function vg(e,t){return iu(e,t)}function bg(e,t){return iu(e,t,1)}function wg(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var He={identity:gg,structural:vg,default:wg,shallow:bg};function On(e,t,r){return dn(e)?e:Array.isArray(e)?Re.array(e,{name:r}):Rt(e)?Re.object(e,void 0,{name:r}):_n(e)?Re.map(e,{name:r}):Ii(e)?Re.set(e,{name:r}):typeof e=="function"&&!xn(e)&&!ci(e)?cf(e)?fn(e):ui(r,e):e}function _g(e,t,r){if(e==null||Br(e)||Sn(e)||Ht(e)||Hr(e))return e;if(Array.isArray(e))return Re.array(e,{name:r,deep:!1});if(Rt(e))return Re.object(e,void 0,{name:r,deep:!1});if(_n(e))return Re.map(e,{name:r,deep:!1});if(Ii(e))return Re.set(e,{name:r,deep:!1});ce("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function ra(e){return e}function Tg(e,t){return dn(e)&&ce("observable.struct should not be used with observable values"),iu(e,t)?t:e}var Og="override";function vo(e){return e.annotationType_===Og}function $i(e,t){return{annotationType_:e,options_:t,make_:xg,extend_:Eg,decorate_20223_:Ig}}function xg(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(xn(r.value))return 1;var o=mf(e,this,t,r,!1);return Ft(n,t,o),2}function Eg(e,t,r,n){var i=mf(e,this,t,r);return e.defineProperty_(t,i,n)}function Ig(e,t){ta(t,["method","field"]);var r=t.kind,n=t.name,i=t.addInitializer,o=this,a=function(u){var l,f,p,A;return Rr((l=(f=o.options_)==null?void 0:f.name)!=null?l:n.toString(),u,(p=(A=o.options_)==null?void 0:A.autoAction)!=null?p:!1)};if(r=="field"){i(function(){Tn(this,n,o)});return}if(r=="method"){var s;return xn(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}ce("Cannot apply '"+o.annotationType_+"' to '"+String(n)+"' (kind: "+r+"):"+(`
6
+ '`+o.annotationType_+"' can only be used on properties with a function value."))}function Sg(e,t,r,n){var i=t.annotationType_,o=n.value;De(o)||ce("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
7
+ '`+i+"' can only be used on properties with a function value."))}function mf(e,t,r,n,i){var o,a,s,u,l,f,p;i===void 0&&(i=Y.safeDescriptors),Sg(e,t,r,n);var A=n.value;if((o=t.options_)!=null&&o.bound){var O;A=A.bind((O=e.proxy_)!=null?O:e.target_)}return{value:Rr((a=(s=t.options_)==null?void 0:s.name)!=null?a:r.toString(),A,(u=(l=t.options_)==null?void 0:l.autoAction)!=null?u:!1,(f=t.options_)!=null&&f.bound?(p=e.proxy_)!=null?p:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function gf(e,t){return{annotationType_:e,options_:t,make_:Ag,extend_:$g,decorate_20223_:Ng}}function Ag(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&&(!Ot(e.target_,t)||!ci(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(ci(r.value))return 1;var o=vf(e,this,t,r,!1,!1);return Ft(n,t,o),2}function $g(e,t,r,n){var i,o=vf(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,o,n)}function Ng(e,t){var r;ta(t,["method"]);var n=t.name,i=t.addInitializer;return ci(e)||(e=fn(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 jg(e,t,r,n){var i=t.annotationType_,o=n.value;De(o)||ce("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
8
+ '`+i+"' can only be used on properties with a generator function value."))}function vf(e,t,r,n,i,o){o===void 0&&(o=Y.safeDescriptors),jg(e,t,r,n);var a=n.value;if(ci(a)||(a=fn(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 Ys(e,t){return{annotationType_:e,options_:t,make_:Cg,extend_:Pg,decorate_20223_:kg}}function Cg(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function Pg(e,t,r,n){return Ug(e,this,t,r),e.defineComputedProperty_(t,Zt({},this.options_,{get:r.get,set:r.set}),n)}function kg(e,t){ta(t,["getter"]);var r=this,n=t.name,i=t.addInitializer;return i(function(){var o=An(this)[ge],a=Zt({},r.options_,{get:e,context:this});a.name||(a.name=o.name_+"."+n.toString()),o.values_.set(n,new Dr(a))}),function(){return this[ge].getObservablePropValue_(n)}}function Ug(e,t,r,n){var i=t.annotationType_,o=n.get;o||ce("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
9
+ '`+i+"' can only be used on getter(+setter) properties."))}function na(e,t){return{annotationType_:e,options_:t,make_:Rg,extend_:Dg,decorate_20223_:Bg}}function Rg(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function Dg(e,t,r,n){var i,o;return Mg(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(o=this.options_)==null?void 0:o.enhancer)!=null?i:On,n)}function Bg(e,t){if(t.kind==="field")throw ce("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");ta(t,["accessor"]);var r=this,n=t.kind,i=t.name,o=new WeakSet;function a(s,u){var l,f,p=An(s)[ge],A=new br(u,(l=(f=r.options_)==null?void 0:f.enhancer)!=null?l:On,p.name_+"."+i.toString(),!1);p.values_.set(i,A),o.add(s)}if(n=="accessor")return{get:function(){return o.has(this)||a(this,e.get.call(this)),this[ge].getObservablePropValue_(i)},set:function(s){return o.has(this)||a(this,s),this[ge].setObservablePropValue_(i,s)},init:function(s){return o.has(this)||a(this,s),s}}}function Mg(e,t,r,n){var i=t.annotationType_;"value"in n||ce("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
10
+ '`+i+"' cannot be used on getter/setter properties"))}var Lg="true",Vg=bf();function bf(e){return{annotationType_:Lg,options_:e,make_:zg,extend_:Fg,decorate_20223_:Gg}}function zg(e,t,r,n){var i,o;if(r.get)return Le.make_(e,t,r,n);if(r.set){var a=Rr(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:Y.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(Ft(n,t,{configurable:!0,set:a}),2)}if(n!==e.target_&&typeof r.value=="function"){var s;if(cf(r.value)){var u,l=(u=this.options_)!=null&&u.autoBind?fn.bound:fn;return l.make_(e,t,r,n)}var f=(s=this.options_)!=null&&s.autoBind?ui.bound:ui;return f.make_(e,t,r,n)}var p=((i=this.options_)==null?void 0:i.deep)===!1?Re.ref:Re;if(typeof r.value=="function"&&(o=this.options_)!=null&&o.autoBind){var A;r.value=r.value.bind((A=e.proxy_)!=null?A:e.target_)}return p.make_(e,t,r,n)}function Fg(e,t,r,n){var i,o;if(r.get)return Le.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:Y.safeDescriptors?e.isPlainObject_:!0,set:Rr(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?Re.ref:Re;return s.extend_(e,t,r,n)}function Gg(e,t){ce("'"+this.annotationType_+"' cannot be used as a decorator")}var Kg="observable",qg="observable.ref",Hg="observable.shallow",Wg="observable.struct",wf={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(wf);function zi(e){return e||wf}var as=na(Kg),Jg=na(qg,{enhancer:ra}),Qg=na(Hg,{enhancer:_g}),Xg=na(Wg,{enhancer:Tg}),_f=Gt(as);function Fi(e){return e.deep===!0?On:e.deep===!1?ra:Zg(e.defaultDecorator)}function Yg(e){var t;return e?(t=e.defaultDecorator)!=null?t:bf(e):void 0}function Zg(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:On}function Tf(e,t,r){if(Si(t))return as.decorate_20223_(e,t);if(Ur(t)){Tn(e,t,as);return}return dn(e)?e:Rt(e)?Re.object(e,t,r):Array.isArray(e)?Re.array(e,t):_n(e)?Re.map(e,t):Ii(e)?Re.set(e,t):typeof e=="object"&&e!==null?e:Re.box(e,t)}uf(Tf,_f);var ev={box:function(e,t){var r=zi(t);return new br(e,Fi(r),r.name,!0,r.equals)},array:function(e,t){var r=zi(t);return(Y.useProxies===!1||r.proxy===!1?ib:Wv)(e,Fi(r),r.name)},map:function(e,t){var r=zi(t);return new Jf(e,Fi(r),r.name)},set:function(e,t){var r=zi(t);return new Yf(e,Fi(r),r.name)},object:function(e,t,r){return Wr(function(){return Dv(Y.useProxies===!1||r?.proxy===!1?An({},r):Kv({},r),e,t)})},ref:Gt(Jg),shallow:Gt(Qg),deep:_f,struct:Gt(Xg)},Re=uf(Tf,ev),Of="computed",tv="computed.struct",ss=Ys(Of),rv=Ys(tv,{equals:He.structural}),Le=function(e,t){if(Si(t))return ss.decorate_20223_(e,t);if(Ur(t))return Tn(e,t,ss);if(Rt(e))return Gt(Ys(Of,e));De(e)||ce("First argument to `computed` should be an expression."),De(t)&&ce("A setter as second argument is no longer supported, use `{ set: fn }` option instead");var r=Rt(t)?t:{};return r.get=e,r.name||(r.name=e.name||""),new Dr(r)};Object.assign(Le,ss);Le.struct=Gt(rv);var pl,hl,bo=0,nv=1,iv=(pl=(hl=mo(function(){},"name"))==null?void 0:hl.configurable)!=null?pl:!1,yl={value:"action",configurable:!0,writable:!1,enumerable:!1};function Rr(e,t,r,n){r===void 0&&(r=!1),De(t)||ce("`action` can only be invoked on functions"),(typeof e!="string"||!e)&&ce("actions should have valid names, got: '"+e+"'");function i(){return xf(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},iv&&(yl.value=e,Ft(i,"name",yl)),i}function xf(e,t,r,n,i){var o=ov(e,t,n,i);try{return r.apply(n,i)}catch(a){throw o.error_=a,a}finally{av(o)}}function ov(e,t,r,n){var i=Xe()&&!!e,o=0;if(i){o=Date.now();var a=n?Array.from(n):go;lt({type:eu,name:e,object:r,arguments:a})}var s=Y.trackingDerivation,u=!t||!s;wt();var l=Y.allowStateChanges;u&&(qr(),l=ia(!0));var f=Zs(!0),p={runAsAction_:u,prevDerivation_:s,prevAllowStateChanges_:l,prevAllowStateReads_:f,notifySpy_:i,startTime_:o,actionId_:nv++,parentActionId_:bo};return bo=p.actionId_,p}function av(e){bo!==e.actionId_&&ce(30),bo=e.parentActionId_,e.error_!==void 0&&(Y.suppressReactionErrors=!0),oa(e.prevAllowStateChanges_),ri(e.prevAllowStateReads_),_t(),e.runAsAction_&&Xt(e.prevDerivation_),e.notifySpy_&&ct({time:Date.now()-e.startTime_}),Y.suppressReactionErrors=!1}function sv(e,t){var r=ia(e);try{return t()}finally{oa(r)}}function ia(e){var t=Y.allowStateChanges;return Y.allowStateChanges=e,t}function oa(e){Y.allowStateChanges=e}var Ef,uv="create";Ef=Symbol.toPrimitive;var br=function(e){hf(t,e);function t(n,i,o,a,s){var u;return o===void 0&&(o="ObservableValue@"+St()),a===void 0&&(a=!0),s===void 0&&(s=He.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&&Xe()&&cn({type:uv,object:Qi(u),observableKind:"value",debugObjectName:u.name_,newValue:""+u.value_}),u}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=Xe();o&&lt({type:Ct,object:this,observableKind:"value",debugObjectName:this.name_,newValue:n,oldValue:i}),this.setNewValue_(n),o&&ct()}},r.prepareNewValue_=function(n){if(Vt(this),vt(this)){var i=bt(this,{object:this,type:Ct,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(),Pt(this)&&kt(this,{type:Ct,object:this,newValue:n,oldValue:i})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(n){return ji(this,n)},r.observe_=function(n,i){return i&&n({observableKind:"value",debugObjectName:this.name_,object:this,type:Ct,newValue:this.value_,oldValue:void 0}),Ci(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 pf(this.get())},r[Ef]=function(){return this.valueOf()},t}(Ai),lv=Or("ObservableValue",br),If;If=Symbol.toPrimitive;var Dr=function(){function e(r){this.dependenciesState_=Ee.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.isBeingObserved_=!1,this.isPendingUnobservation_=!1,this.observers_=new Set,this.diffValue_=0,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ee.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new wo(null),this.name_=void 0,this.triggeredBy_=void 0,this.isComputing_=!1,this.isRunningSetter_=!1,this.derivation=void 0,this.setter_=void 0,this.isTracing_=xt.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||ce(31),this.derivation=r.get,this.name_=r.name||"ComputedValue@"+St(),r.set&&(this.setter_=Rr(this.name_+"-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?He.structural:He.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){wv(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_&&ce(32,this.name_,this.derivation),Y.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)us(this)&&(this.warnAboutUntrackedRead_(),wt(),this.value_=this.computeValue_(!1),_t());else if(Cf(this),us(this)){var r=Y.trackingContext;this.keepAlive_&&!r&&(Y.trackingContext=this),this.trackAndCompute()&&bv(this),Y.trackingContext=r}var n=this.value_;if(Xi(n))throw n.cause;return n},t.set=function(r){if(this.setter_){this.isRunningSetter_&&ce(33,this.name_),this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter_=!1}}else ce(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,n=this.dependenciesState_===Ee.NOT_TRACKING_,i=this.computeValue_(!0),o=n||Xi(r)||Xi(i)||!this.equals_(r,i);return o&&(this.value_=i,Xe()&&cn({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:r,newValue:i})),o},t.computeValue_=function(r){this.isComputing_=!0;var n=ia(!1),i;if(r)i=Sf(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 wo(o)}return oa(n),this.isComputing_=!1,i},t.suspend_=function(){this.keepAlive_||(ls(this),this.value_=void 0,this.isTracing_!==xt.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 Et(function(){var s=i.get();if(!o||n){var u=qr();r({observableKind:"computed",debugObjectName:i.name_,type:Ct,object:i,newValue:s,oldValue:a}),Xt(u)}o=!1,a=s})},t.warnAboutUntrackedRead_=function(){this.isTracing_!==xt.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 pf(this.get())},t[If]=function(){return this.valueOf()},e}(),Ni=Or("ComputedValue",Dr),Ee;(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_"})(Ee||(Ee={}));var xt;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(xt||(xt={}));var wo=function(e){this.cause=void 0,this.cause=e};function Xi(e){return e instanceof wo}function us(e){switch(e.dependenciesState_){case Ee.UP_TO_DATE_:return!1;case Ee.NOT_TRACKING_:case Ee.STALE_:return!0;case Ee.POSSIBLY_STALE_:{for(var t=Zs(!0),r=qr(),n=e.observing_,i=n.length,o=0;o<i;o++){var a=n[o];if(Ni(a)){if(Y.disableErrorBoundaries)a.get();else try{a.get()}catch{return Xt(r),ri(t),!0}if(e.dependenciesState_===Ee.STALE_)return Xt(r),ri(t),!0}}return Af(e),Xt(r),ri(t),!1}}}function cv(){return Y.trackingDerivation!==null}function Vt(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 fv(e){!Y.allowStateReads&&Y.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function Sf(e,t,r){var n=Zs(!0);Af(e),e.newObserving_=new Array(e.observing_.length+100),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 wo(a)}return Y.inBatch--,Y.trackingDerivation=i,pv(e),dv(e),ri(n),o}function dv(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 pv(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=Ee.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&&Nf(u,e),u.diffValue_=0}for(;i--;){var l=r[i];l.diffValue_===1&&(l.diffValue_=0,vv(l,e))}n!==Ee.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function ls(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)Nf(t[r],e);e.dependenciesState_=Ee.NOT_TRACKING_}function Ue(e){var t=qr();try{return e()}finally{Xt(t)}}function qr(){var e=Y.trackingDerivation;return Y.trackingDerivation=null,e}function Xt(e){Y.trackingDerivation=e}function Zs(e){var t=Y.allowStateReads;return Y.allowStateReads=e,t}function ri(e){Y.allowStateReads=e}function Af(e){if(e.dependenciesState_!==Ee.UP_TO_DATE_){e.dependenciesState_=Ee.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ee.UP_TO_DATE_}}var Yi=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},Zi=!0,$f=!1,Y=function(){var e=Hs();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Zi=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Yi().version&&(Zi=!1),Zi?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Yi):(setTimeout(function(){$f||ce(35)},1),new Yi)}();function hv(){if((Y.pendingReactions.length||Y.inBatch||Y.isRunningReactions)&&ce(36),$f=!0,Zi){var e=Hs();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),Y=new Yi}}function yv(){return Y}function mv(e){return e.observers_&&e.observers_.size>0}function gv(e){return e.observers_}function vv(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Nf(e,t){e.observers_.delete(t),e.observers_.size===0&&jf(e)}function jf(e){e.isPendingUnobservation_===!1&&(e.isPendingUnobservation_=!0,Y.pendingUnobservations.push(e))}function wt(){Y.inBatch++}function _t(){if(--Y.inBatch===0){Rf();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 Dr&&r.suspend_())}Y.pendingUnobservations=[]}}function Cf(e){fv(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&&jf(e),!1)}function Pf(e){e.lowestObserverState_!==Ee.STALE_&&(e.lowestObserverState_=Ee.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ee.UP_TO_DATE_&&(t.isTracing_!==xt.NONE&&kf(t,e),t.onBecomeStale_()),t.dependenciesState_=Ee.STALE_}))}function bv(e){e.lowestObserverState_!==Ee.STALE_&&(e.lowestObserverState_=Ee.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ee.POSSIBLY_STALE_?(t.dependenciesState_=Ee.STALE_,t.isTracing_!==xt.NONE&&kf(t,e)):t.dependenciesState_===Ee.UP_TO_DATE_&&(e.lowestObserverState_=Ee.UP_TO_DATE_)}))}function wv(e){e.lowestObserverState_===Ee.UP_TO_DATE_&&(e.lowestObserverState_=Ee.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ee.UP_TO_DATE_&&(t.dependenciesState_=Ee.POSSIBLY_STALE_,t.onBecomeStale_())}))}function kf(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===xt.BREAK){var r=[];Uf(sa(e),r,1),new Function(`debugger;
11
+ /*
12
+ Tracing '`+e.name_+`'
13
+
14
+ You are entering this break point because derivation '`+e.name_+"' is being traced and '"+t.name_+`' is now forcing it to update.
15
+ Just follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update
16
+ The stackframe you are looking for is at least ~6-8 stack-frames up.
17
+
18
+ `+(e instanceof Dr?e.derivation.toString().replace(/[*]\//g,"/"):"")+`
19
+
20
+ The dependencies for this derivation are:
21
+
22
+ `+r.join(`
23
+ `)+`
24
+ */
25
+ `)()}}function Uf(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 Uf(n,t,r+1)})}var si=function(){function e(r,n,i,o){r===void 0&&(r="Reaction@"+St()),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ee.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=xt.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),Rf())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){wt(),this.isScheduled_=!1;var r=Y.trackingContext;if(Y.trackingContext=this,us(this)){this.isTrackPending_=!0;try{this.onInvalidate_(),this.isTrackPending_&&Xe()&&cn({name:this.name_,type:"scheduled-reaction"})}catch(n){this.reportExceptionInDerivation_(n)}}Y.trackingContext=r,_t()}},t.track=function(r){if(!this.isDisposed_){wt();var n=Xe(),i;n&&(i=Date.now(),lt({name:this.name_,type:"reaction"})),this.isRunning_=!0;var o=Y.trackingContext;Y.trackingContext=this;var a=Sf(this,r,void 0);Y.trackingContext=o,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&ls(this),Xi(a)&&this.reportExceptionInDerivation_(a.cause),n&&ct({time:Date.now()-i}),_t()}},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),Xe()&&cn({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_||(wt(),ls(this),_t()))},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[ge]=this,i},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){r===void 0&&(r=!1),Kf(this,r)},e}(),ml=100,cs=function(e){return e()};function Rf(){Y.inBatch>0||Y.isRunningReactions||cs(_v)}function _v(){Y.isRunningReactions=!0;for(var e=Y.pendingReactions,t=0;e.length>0;){++t===ml&&(console.error("Reaction doesn't converge to a stable state after "+ml+" 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 _o=Or("Reaction",si);function Tv(e){var t=cs;cs=function(r){return e(function(){return t(r)})}}function Xe(){return!!Y.spyListeners.length}function cn(e){if(Y.spyListeners.length)for(var t=Y.spyListeners,r=0,n=t.length;r<n;r++)t[r](e)}function lt(e){var t=Zt({},e,{spyReportStart:!0});cn(t)}var Ov={type:"report-end",spyReportEnd:!0};function ct(e){cn(e?Zt({},e,{type:"report-end",spyReportEnd:!0}):Ov)}function xv(e){return Y.spyListeners.push(e),Js(function(){Y.spyListeners=Y.spyListeners.filter(function(t){return t!==e})})}var eu="action",Ev="action.bound",Df="autoAction",Iv="autoAction.bound",Bf="<unnamed action>",fs=$i(eu),Sv=$i(Ev,{bound:!0}),ds=$i(Df,{autoAction:!0}),Av=$i(Iv,{autoAction:!0,bound:!0});function Mf(e){var t=function(r,n){if(De(r))return Rr(r.name||Bf,r,e);if(De(n))return Rr(r,n,e);if(Si(n))return(e?ds:fs).decorate_20223_(r,n);if(Ur(n))return Tn(r,n,e?ds:fs);if(Ur(r))return Gt($i(e?Df:eu,{name:r,autoAction:e}));ce("Invalid arguments for `action`")};return t}var Tt=Mf(!1);Object.assign(Tt,fs);var ui=Mf(!0);Object.assign(ui,ds);Tt.bound=Gt(Sv);ui.bound=Gt(Av);function li(e){return xf(e.name||Bf,!1,e,this,void 0)}function xn(e){return De(e)&&e.isMobxAction===!0}function Et(e,t){var r,n,i,o,a;t===void 0&&(t=Ws),De(e)||ce("Autorun expects a function as first argument"),xn(e)&&ce("Autorun does not accept actions since actions are untrackable");var s=(r=(n=t)==null?void 0:n.name)!=null?r:e.name||"Autorun@"+St(),u=!t.scheduler&&!t.delay,l;if(u)l=new si(s,function(){this.track(A)},t.onError,t.requiresObservable);else{var f=Lf(t),p=!1;l=new si(s,function(){p||(p=!0,f(function(){p=!1,l.isDisposed_||l.track(A)}))},t.onError,t.requiresObservable)}function A(){e(l)}return(i=t)!=null&&(o=i.signal)!=null&&o.aborted||l.schedule_(),l.getDisposer_((a=t)==null?void 0:a.signal)}var $v=function(e){return e()};function Lf(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:$v}function Nv(e,t,r){var n,i,o,a;r===void 0&&(r=Ws),(!De(e)||!De(t))&&ce("First and second argument to reaction should be functions"),Rt(r)||ce("Third argument of reactions should be an object");var s=(n=r.name)!=null?n:"Reaction@"+St(),u=Tt(s,r.onError?jv(r.onError,t):t),l=!r.scheduler&&!r.delay,f=Lf(r),p=!0,A=!1,O,T,F=r.compareStructural?He.structural:r.equals||He.default,W=new si(s,function(){p||l?x():A||(A=!0,f(x))},r.onError,r.requiresObservable);function x(){if(A=!1,!W.isDisposed_){var P=!1;W.track(function(){var G=sv(!1,function(){return e(W)});P=p||!F(O,G),T=O,O=G}),(p&&r.fireImmediately||!p&&P)&&u(O,T,W),p=!1}}return(i=r)!=null&&(o=i.signal)!=null&&o.aborted||W.schedule_(),W.getDisposer_((a=r)==null?void 0:a.signal)}function jv(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var Cv="onBO",Pv="onBUO";function aa(e,t,r){return Vf(Cv,e,t,r)}function En(e,t,r){return Vf(Pv,e,t,r)}function Vf(e,t,r,n){var i=typeof n=="function"?Dt(t,r):Dt(t),o=De(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 kv="never",Gi="always",Uv="observed";function Rv(e){e.isolateGlobalState===!0&&hv();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(Y.useProxies=t===Gi?!0:t===kv?!1:typeof Proxy<"u"),t==="ifavailable"&&(Y.verifyProxies=!0),r!==void 0){var n=r===Gi?Gi:r===Uv;Y.enforceActions=n,Y.allowStateChanges=!(n===!0||n===Gi)}["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&&Tv(e.reactionScheduler)}function Dv(e,t,r,n){arguments.length>4&&ce("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&ce("'extendObservable' expects an object as first argument"),Ht(e)&&ce("'extendObservable' should not be used on maps, use map.merge instead"),Rt(t)||ce("'extendObservable' only accepts plain objects as second argument"),(dn(t)||dn(r))&&ce("Extending an object with another observable (object) is not supported");var i=fg(t);return Wr(function(){var o=An(e,n)[ge];ea(i).forEach(function(a){o.extend_(a,i[a],r&&a in r?r[a]:!0)})}),e}function sa(e,t){return zf(Dt(e,t))}function zf(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=Bv(e.observing_).map(zf)),t}function To(e,t){return Ff(Dt(e,t))}function Ff(e){var t={name:e.name_};return mv(e)&&(t.observers=Array.from(gv(e)).map(Ff)),t}function Bv(e){return Array.from(new Set(e))}var Mv=0;function Gf(){this.message="FLOW_CANCELLED"}Gf.prototype=Object.create(Error.prototype);var Ua=gf("flow"),Lv=gf("flow.bound",{bound:!0}),fn=Object.assign(function(e,t){if(Si(t))return Ua.decorate_20223_(e,t);if(Ur(t))return Tn(e,t,Ua);arguments.length!==1&&ce("Flow expects single argument with generator function");var r=e,n=r.name||"<unnamed flow>",i=function(){var o=this,a=arguments,s=++Mv,u=Tt(n+" - runid: "+s+" - init",r).apply(o,a),l,f=void 0,p=new Promise(function(A,O){var T=0;l=O;function F(P){f=void 0;var G;try{G=Tt(n+" - runid: "+s+" - yield "+T++,u.next).call(u,P)}catch(q){return O(q)}x(G)}function W(P){f=void 0;var G;try{G=Tt(n+" - runid: "+s+" - yield "+T++,u.throw).call(u,P)}catch(q){return O(q)}x(G)}function x(P){if(De(P?.then)){P.then(x,O);return}return P.done?A(P.value):(f=Promise.resolve(P.value),f.then(F,W))}F(void 0)});return p.cancel=Tt(n+" - runid: "+s+" - cancel",function(){try{f&&gl(f);var A=u.return(void 0),O=Promise.resolve(A.value);O.then(sn,sn),gl(O),l(new Gf)}catch(T){l(T)}}),p};return i.isMobXFlow=!0,i},Ua);fn.bound=Gt(Lv);function gl(e){De(e.cancel)&&e.cancel()}function ci(e){return e?.isMobXFlow===!0}function Vv(e,t){return e?t!==void 0?Ht(e)||Sn(e)?ce("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."):Br(e)?e[ge].values_.has(t):!1:Br(e)||!!e[ge]||Xs(e)||_o(e)||Ni(e):!1}function dn(e){return arguments.length!==1&&ce("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),Vv(e)}function zv(e){if(Br(e))return e[ge].ownKeys_();ce(38)}function Ki(e,t,r){return e.set(t,r),r}function an(e,t){if(e==null||typeof e!="object"||e instanceof Date||!dn(e))return e;if(lv(e)||Ni(e))return an(e.get(),t);if(t.has(e))return t.get(e);if(Sn(e)){var r=Ki(t,e,new Array(e.length));return e.forEach(function(a,s){r[s]=an(a,t)}),r}if(Hr(e)){var n=Ki(t,e,new Set);return e.forEach(function(a){n.add(an(a,t))}),n}if(Ht(e)){var i=Ki(t,e,new Map);return e.forEach(function(a,s){i.set(s,an(a,t))}),i}else{var o=Ki(t,e,{});return zv(e).forEach(function(a){Ei.propertyIsEnumerable.call(e,a)&&(o[a]=an(e[a],t))}),o}}function Yt(e,t){return t&&ce("toJS no longer supports options"),an(e,new Map)}function Kf(){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=Fv(r);if(!i)return ce("'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_===xt.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled"),i.isTracing_=e?xt.BREAK:xt.LOG}function Fv(e){switch(e.length){case 0:return Y.trackingDerivation;case 1:return Dt(e[0]);case 2:return Dt(e[0],e[1])}}function Qt(e,t){t===void 0&&(t=void 0),wt();try{return e.apply(t)}finally{_t()}}function $r(e){return e[ge]}var Gv={has:function(e,t){return Y.trackingDerivation&&Gn("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),$r(e).has_(t)},get:function(e,t){return $r(e).get_(t)},set:function(e,t,r){var n;return Ur(t)?($r(e).values_.has(t)||Gn("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(n=$r(e).set_(t,r,!0))!=null?n:!0):!1},deleteProperty:function(e,t){var r;return Gn("delete properties from an observable object. Use 'remove' from 'mobx' instead."),Ur(t)?(r=$r(e).delete_(t,!0))!=null?r:!0:!1},defineProperty:function(e,t,r){var n;return Gn("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(n=$r(e).defineProperty_(t,r))!=null?n:!0},ownKeys:function(e){return Y.trackingDerivation&&Gn("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),$r(e).ownKeys_()},preventExtensions:function(e){ce(13)}};function Kv(e,t){var r,n;return lf(),e=An(e,t),(n=(r=e[ge]).proxy_)!=null?n:r.proxy_=new Proxy(e,Gv)}function vt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function ji(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),Js(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function bt(e,t){var r=qr();try{for(var n=[].concat(e.interceptors_||[]),i=0,o=n.length;i<o&&(t=n[i](t),t&&!t.type&&ce(14),!!t);i++);return t}finally{Xt(r)}}function Pt(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function Ci(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),Js(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function kt(e,t){var r=qr(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,o=n.length;i<o;i++)n[i](t);Xt(r)}}function In(e,t,r){return Wr(function(){var n,i=An(e,r)[ge];t&&e[ut]&&ce("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(n=t)!=null||(t=mg(e)),ea(t).forEach(function(o){return i.make_(o,t[o])})}),e}var vl="splice",Ct="update",qv=1e4,Hv={get:function(e,t){var r=e[ge];return t===ge?r:t==="length"?r.getArrayLength_():typeof t=="string"&&!isNaN(t)?r.get_(parseInt(t)):Ot(Oo,t)?Oo[t]:e[t]},set:function(e,t,r){var n=e[ge];return t==="length"&&n.setArrayLength_(r),typeof t=="symbol"||isNaN(t)?e[t]=r:n.set_(parseInt(t),r),!0},preventExtensions:function(){ce(15)}},tu=function(){function e(r,n,i,o){r===void 0&&(r="ObservableArray@"+St()),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=i,this.legacyMode_=o,this.atom_=new Ai(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 ji(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}),Ci(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&ce("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_&&ce(16),this.lastKnownLength_+=n,this.legacyMode_&&n>0&&td(r+n+1)},t.spliceWithArray_=function(r,n,i){var o=this;Vt(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=go),vt(this)){var s=bt(this,{object:this.proxy_,type:vl,index:r,removedCount:n,added:i});if(!s)return go;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<qv){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_&&Xe(),a=Pt(this),s=a||o?{observableKind:"array",object:this.proxy_,type:Ct,debugObjectName:this.atom_.name_,index:r,newValue:n,oldValue:i}:null;o&&lt(s),this.atom_.reportChanged(),a&&kt(this,s),o&&ct()},t.notifyArraySplice_=function(r,n,i){var o=!this.owned_&&Xe(),a=Pt(this),s=a||o?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:vl,index:r,removed:i,added:n,removedCount:i.length,addedCount:n.length}:null;o&&lt(s),this.atom_.reportChanged(),a&&kt(this,s),o&&ct()},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&&ce(17,r,i.length),r<i.length){Vt(this.atom_);var o=i[r];if(vt(this)){var a=bt(this,{type:Ct,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 Wv(e,t,r,n){return r===void 0&&(r="ObservableArray@"+St()),n===void 0&&(n=!1),lf(),Wr(function(){var i=new tu(r,t,n,!1);ff(i.values_,ge,i);var o=new Proxy(i.values_,Hv);return i.proxy_=o,e&&e.length&&i.spliceWithArray_(0,0,e),o})}var Oo={clear:function(){return this.splice(0)},replace:function(e){var t=this[ge];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[ge];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[ge].spliceWithArray_(e,t,r)},push:function(){for(var e=this[ge],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[ge].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[ge],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&&ce(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Y.trackingDerivation&&ce(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[ge],r=t.dehanceValues_(t.values_).indexOf(e);return r>-1?(this.splice(r,1),!0):!1}};Ce("at",ft);Ce("concat",ft);Ce("flat",ft);Ce("includes",ft);Ce("indexOf",ft);Ce("join",ft);Ce("lastIndexOf",ft);Ce("slice",ft);Ce("toString",ft);Ce("toLocaleString",ft);Ce("toSorted",ft);Ce("toSpliced",ft);Ce("with",ft);Ce("every",Mt);Ce("filter",Mt);Ce("find",Mt);Ce("findIndex",Mt);Ce("findLast",Mt);Ce("findLastIndex",Mt);Ce("flatMap",Mt);Ce("forEach",Mt);Ce("map",Mt);Ce("some",Mt);Ce("toReversed",Mt);Ce("reduce",qf);Ce("reduceRight",qf);function Ce(e,t){typeof Array.prototype[e]=="function"&&(Oo[e]=t(e))}function ft(e){return function(){var t=this[ge];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function Mt(e){return function(t,r){var n=this,i=this[ge];i.atom_.reportObserved();var o=i.dehanceValues_(i.values_);return o[e](function(a,s){return t.call(r,a,s,n)})}}function qf(e){return function(){var t=this,r=this[ge];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 Jv=Or("ObservableArrayAdministration",tu);function Sn(e){return Yo(e)&&Jv(e[ge])}var Hf,Wf,Qv={},gr="add",xo="delete";Hf=Symbol.iterator;Wf=Symbol.toStringTag;var Jf=function(){function e(r,n,i){var o=this;n===void 0&&(n=On),i===void 0&&(i="ObservableMap@"+St()),this.enhancer_=void 0,this.name_=void 0,this[ge]=Qv,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,De(Map)||ce(18),Wr(function(){o.keysAtom_=yf(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 br(this.has_(r),ra,this.name_+"."+is(r)+"?",!1);this.hasMap_.set(r,o),En(o,function(){return n.hasMap_.delete(r)})}return i.get()},t.set=function(r,n){var i=this.has_(r);if(vt(this)){var o=bt(this,{type:i?Ct:gr,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(Vt(this.keysAtom_),vt(this)){var i=bt(this,{type:xo,object:this,name:r});if(!i)return!1}if(this.has_(r)){var o=Xe(),a=Pt(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:xo,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return o&&lt(s),Qt(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&&kt(this,s),o&&ct(),!0}return!1},t.updateValue_=function(r,n){var i=this.data_.get(r);if(n=i.prepareNewValue_(n),n!==Y.UNCHANGED){var o=Xe(),a=Pt(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:Ct,object:this,oldValue:i.value_,name:r,newValue:n}:null;o&&lt(s),i.setNewValue_(n),a&&kt(this,s),o&&ct()}},t.addValue_=function(r,n){var i=this;Vt(this.keysAtom_),Qt(function(){var u,l=new br(n,i.enhancer_,i.name_+"."+is(r),!1);i.data_.set(r,l),n=l.value_,(u=i.hasMap_.get(r))==null||u.setNewValue_(!0),i.keysAtom_.reportChanged()});var o=Xe(),a=Pt(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:gr,object:this,name:r,newValue:n}:null;o&&lt(s),a&&kt(this,s),o&&ct()},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 fi({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 fi({next:function(){var i=n.next(),o=i.done,a=i.value;return{done:o,value:o?void 0:[a,r.get(a)]}}})},t[Hf]=function(){return this.entries()},t.forEach=function(r,n){for(var i=un(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 Ht(r)&&(r=new Map(r)),Qt(function(){Rt(r)?cg(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)}):_n(r)?(r.constructor!==Map&&ce(19,r),r.forEach(function(i,o){return n.set(o,i)})):r!=null&&ce(20,r)}),this},t.clear=function(){var r=this;Qt(function(){Ue(function(){for(var n=un(r.keys()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.replace=function(r){var n=this;return Qt(function(){for(var i=Xv(r),o=new Map,a=!1,s=un(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 p=n.data_.get(l);o.set(l,p)}}}for(var A=un(i.entries()),O;!(O=A()).done;){var T=O.value,F=T[0],W=T[1],x=n.data_.has(F);if(n.set(F,W),n.data_.has(F)){var P=n.data_.get(F);o.set(F,P),x||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var G=n.data_.keys(),q=o.keys(),V=G.next(),Q=q.next();!V.done;){if(V.value!==Q.value){n.keysAtom_.reportChanged();break}V=G.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&&ce("`observe` doesn't support fireImmediately=true in combination with maps."),Ci(this,r)},t.intercept_=function(r){return ji(this,r)},Qs(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Wf,get:function(){return"Map"}}]),e}(),Ht=Or("ObservableMap",Jf);function Xv(e){if(_n(e)||Ht(e))return e;if(Array.isArray(e))return new Map(e);if(Rt(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return ce(21,e)}var Qf,Xf,Yv={};Qf=Symbol.iterator;Xf=Symbol.toStringTag;var Yf=function(){function e(r,n,i){var o=this;n===void 0&&(n=On),i===void 0&&(i="ObservableSet@"+St()),this.name_=void 0,this[ge]=Yv,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,De(Set)||ce(22),this.enhancer_=function(a,s){return n(a,s,i)},Wr(function(){o.atom_=yf(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;Qt(function(){Ue(function(){for(var n=un(r.data_.values()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.forEach=function(r,n){for(var i=un(this),o;!(o=i()).done;){var a=o.value;r.call(n,a,a,this)}},t.add=function(r){var n=this;if(Vt(this.atom_),vt(this)){var i=bt(this,{type:gr,object:this,newValue:r});if(!i)return this}if(!this.has(r)){Qt(function(){n.data_.add(n.enhancer_(r,void 0)),n.atom_.reportChanged()});var o=Xe(),a=Pt(this),s=a||o?{observableKind:"set",debugObjectName:this.name_,type:gr,object:this,newValue:r}:null;o&&lt(s),a&&kt(this,s),o&&ct()}return this},t.delete=function(r){var n=this;if(vt(this)){var i=bt(this,{type:xo,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var o=Xe(),a=Pt(this),s=a||o?{observableKind:"set",debugObjectName:this.name_,type:xo,object:this,oldValue:r}:null;return o&&lt(s),Qt(function(){n.atom_.reportChanged(),n.data_.delete(r)}),a&&kt(this,s),o&&ct(),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=0,n=Array.from(this.keys()),i=Array.from(this.values());return fi({next:function(){var o=r;return r+=1,o<i.length?{value:[n[o],i[o]],done:!1}:{done:!0}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,n=0,i=Array.from(this.data_.values());return fi({next:function(){return n<i.length?{value:r.dehanceValue_(i[n++]),done:!1}:{done:!0}}})},t.replace=function(r){var n=this;return Hr(r)&&(r=new Set(r)),Qt(function(){Array.isArray(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):Ii(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):r!=null&&ce("Cannot initialize set from "+r)}),this},t.observe_=function(r,n){return n===!0&&ce("`observe` doesn't support fireImmediately=true in combination with sets."),Ci(this,r)},t.intercept_=function(r){return ji(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Qf]=function(){return this.values()},Qs(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Xf,get:function(){return"Set"}}]),e}(),Hr=Or("ObservableSet",Yf),bl=Object.create(null),wl="remove",ps=function(){function e(r,n,i,o){n===void 0&&(n=new Map),o===void 0&&(o=Vg),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 Ai(this.name_+".keys"),this.isPlainObject_=Rt(this.target_),rd(this.defaultAnnotation_)||ce("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 Dr)return i.set(n),!0;if(vt(this)){var o=bt(this,{type:Ct,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=Pt(this),s=Xe(),u=a||s?{type:Ct,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:i.value_,name:r,newValue:n}:null;s&&lt(u),i.setNewValue_(n),a&&kt(this,u),s&&ct()}return!0},t.get_=function(r){return Y.trackingDerivation&&!Ot(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,n,i){return i===void 0&&(i=!1),Ot(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 br(r in this.target_,ra,this.name_+"."+is(r)+"?",!1),this.pendingKeys_.set(r,n)),n.get()},t.make_=function(r,n){if(n===!0&&(n=this.defaultAnnotation_),n!==!1){if(Ol(this,n,r),!(r in this.target_)){var i;if((i=this.target_[ut])!=null&&i[r])return;ce(1,n.annotationType_,this.name_+"."+r.toString())}for(var o=this.target_;o&&o!==Ei;){var a=mo(o,r);if(a){var s=n.make_(this,r,a,o);if(s===0)return;if(s===1)break}o=Object.getPrototypeOf(o)}Tl(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);Ol(this,i,r);var a=i.extend_(this,r,n,o);return a&&Tl(this,i,r),a},t.defineProperty_=function(r,n,i){i===void 0&&(i=!1),Vt(this.keysAtom_);try{wt();var o=this.delete_(r);if(!o)return o;if(vt(this)){var a=bt(this,{object:this.proxy_||this.target_,name:r,type:gr,newValue:n.value});if(!a)return null;var s=a.newValue;n.value!==s&&(n=Zt({},n,{value:s}))}if(i){if(!Reflect.defineProperty(this.target_,r,n))return!1}else Ft(this.target_,r,n);this.notifyPropertyAddition_(r,n.value)}finally{_t()}return!0},t.defineObservableProperty_=function(r,n,i,o){o===void 0&&(o=!1),Vt(this.keysAtom_);try{wt();var a=this.delete_(r);if(!a)return a;if(vt(this)){var s=bt(this,{object:this.proxy_||this.target_,name:r,type:gr,newValue:n});if(!s)return null;n=s.newValue}var u=_l(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 Ft(this.target_,r,l);var f=new br(n,i,this.name_+"."+r.toString(),!1);this.values_.set(r,f),this.notifyPropertyAddition_(r,f.value_)}finally{_t()}return!0},t.defineComputedProperty_=function(r,n,i){i===void 0&&(i=!1),Vt(this.keysAtom_);try{wt();var o=this.delete_(r);if(!o)return o;if(vt(this)){var a=bt(this,{object:this.proxy_||this.target_,name:r,type:gr,newValue:void 0});if(!a)return null}n.name||(n.name=this.name_+"."+r.toString()),n.context=this.proxy_||this.target_;var s=_l(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 Ft(this.target_,r,u);this.values_.set(r,new Dr(n)),this.notifyPropertyAddition_(r,void 0)}finally{_t()}return!0},t.delete_=function(r,n){if(n===void 0&&(n=!1),Vt(this.keysAtom_),!Ot(this.target_,r))return!0;if(vt(this)){var i=bt(this,{object:this.proxy_||this.target_,name:r,type:wl});if(!i)return null}try{var o,a;wt();var s=Pt(this),u=Xe(),l=this.values_.get(r),f=void 0;if(!l&&(s||u)){var p;f=(p=mo(this.target_,r))==null?void 0:p.value}if(n){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(delete this.appliedAnnotations_[r],l&&(this.values_.delete(r),l instanceof br&&(f=l.value_),Pf(l)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(a=o.get(r))==null||a.set(r in this.target_),s||u){var A={type:wl,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:f,name:r};u&&lt(A),s&&kt(this,A),u&&ct()}}finally{_t()}return!0},t.observe_=function(r,n){return n===!0&&ce("`observe` doesn't support the fire immediately property for observable objects."),Ci(this,r)},t.intercept_=function(r){return ji(this,r)},t.notifyPropertyAddition_=function(r,n){var i,o,a=Pt(this),s=Xe();if(a||s){var u=a||s?{type:gr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:n}:null;s&&lt(u),a&&kt(this,u),s&&ct()}(i=this.pendingKeys_)==null||(o=i.get(r))==null||o.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),ea(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function An(e,t){var r;if(t&&Br(e)&&ce("Options can't be provided for already observable objects."),Ot(e,ge))return nu(e)instanceof ps||ce("Cannot convert '"+Eo(e)+`' into observable object:
26
+ The target is already observable of different type.
27
+ Extending builtins is not supported.`),e;Object.isExtensible(e)||ce("Cannot make the designated object observable; it is not extensible");var n=(r=t?.name)!=null?r:(Rt(e)?"ObservableObject":e.constructor.name)+"@"+St(),i=new ps(e,new Map,String(n),Yg(t));return Zo(e,ge,i),e}var Zv=Or("ObservableObjectAdministration",ps);function _l(e){return bl[e]||(bl[e]={get:function(){return this[ge].getObservablePropValue_(e)},set:function(t){return this[ge].setObservablePropValue_(e,t)}})}function Br(e){return Yo(e)?Zv(e[ge]):!1}function Tl(e,t,r){var n;e.appliedAnnotations_[r]=t,(n=e.target_[ut])==null||delete n[r]}function Ol(e,t,r){if(rd(t)||ce("Cannot annotate '"+e.name_+"."+r.toString()+"': Invalid annotation."),!vo(t)&&Ot(e.appliedAnnotations_,r)){var n=e.name_+"."+r.toString(),i=e.appliedAnnotations_[r].annotationType_,o=t.annotationType_;ce("Cannot apply '"+o+"' to '"+n+"':"+(`
28
+ The field is already annotated with '`+i+"'.")+`
29
+ Re-annotating fields is not allowed.
30
+ Use 'override' annotation for methods overridden by subclass.`)}}var eb=ed(0),tb=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Ra=0,Zf=function(){};function rb(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}rb(Zf,Array.prototype);var ru=function(e,t,r){hf(n,e);function n(o,a,s,u){var l;return s===void 0&&(s="ObservableArray@"+St()),u===void 0&&(u=!1),l=e.call(this)||this,Wr(function(){var f=new tu(s,a,u,!0);f.proxy_=Qi(l),ff(Qi(l),ge,f),o&&o.length&&l.spliceWithArray(0,0,o),tb&&Object.defineProperty(Qi(l),"0",eb)}),l}var i=n.prototype;return i.concat=function(){this[ge].atom_.reportObserved();for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return Array.prototype.concat.apply(this.slice(),a.map(function(u){return Sn(u)?u.slice():u}))},i[r]=function(){var o=this,a=0;return fi({next:function(){return a<o.length?{value:o[a++],done:!1}:{done:!0,value:void 0}}})},Qs(n,[{key:"length",get:function(){return this[ge].getArrayLength_()},set:function(o){this[ge].setArrayLength_(o)}},{key:t,get:function(){return"Array"}}]),n}(Zf,Symbol.toStringTag,Symbol.iterator);Object.entries(Oo).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&Zo(ru.prototype,t,r)});function ed(e){return{enumerable:!1,configurable:!0,get:function(){return this[ge].get_(e)},set:function(t){this[ge].set_(e,t)}}}function nb(e){Ft(ru.prototype,""+e,ed(e))}function td(e){if(e>Ra){for(var t=Ra;t<e+100;t++)nb(t);Ra=e}}td(1e3);function ib(e,t,r){return new ru(e,t,r)}function Dt(e,t){if(typeof e=="object"&&e!==null){if(Sn(e))return t!==void 0&&ce(23),e[ge].atom_;if(Hr(e))return e.atom_;if(Ht(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||ce(25,t,Eo(e)),r}if(Br(e)){if(!t)return ce(26);var n=e[ge].values_.get(t);return n||ce(27,t,Eo(e)),n}if(Xs(e)||Ni(e)||_o(e))return e}else if(De(e)&&_o(e[ge]))return e[ge];ce(28)}function nu(e,t){if(e||ce(29),t!==void 0)return nu(Dt(e,t));if(Xs(e)||Ni(e)||_o(e)||Ht(e)||Hr(e))return e;if(e[ge])return e[ge];ce(24,e)}function Eo(e,t){var r;if(t!==void 0)r=Dt(e,t);else{if(xn(e))return e.name;Br(e)||Ht(e)||Hr(e)?r=nu(e):r=Dt(e)}return r.name_}function Wr(e){var t=qr(),r=ia(!0);wt();try{return e()}finally{_t(),oa(r),Xt(t)}}var xl=Ei.toString;function iu(e,t,r){return r===void 0&&(r=-1),hs(e,t,r)}function hs(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=xl.call(e);if(a!==xl.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=El(e),t=El(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&&!(De(u)&&u instanceof u&&De(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(!hs(e[f],t[f],r-1,n,i))return!1}else{var p=Object.keys(e),A;if(f=p.length,Object.keys(t).length!==f)return!1;for(;f--;)if(A=p[f],!(Ot(t,A)&&hs(e[A],t[A],r-1,n,i)))return!1}return n.pop(),i.pop(),!0}function El(e){return Sn(e)?e.slice():_n(e)||Ht(e)||Ii(e)||Hr(e)?Array.from(e.entries()):e}function fi(e){return e[Symbol.iterator]=ob,e}function ob(){return this}function rd(e){return e instanceof Object&&typeof e.annotationType_=="string"&&De(e.make_)&&De(e.extend_)}["Symbol","Map","Set"].forEach(function(e){var t=Hs();typeof t[e]>"u"&&ce("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:xv,extras:{getDebugName:Eo},$mobx:ge});var ab=Object.create,ou=Object.defineProperty,sb=Object.getOwnPropertyDescriptor,nd=Object.getOwnPropertyNames,ub=Object.getPrototypeOf,lb=Object.prototype.hasOwnProperty,Ke=(e,t)=>function(){return t||(0,e[nd(e)[0]])((t={exports:{}}).exports,t),t.exports},id=(e,t)=>{for(var r in t)ou(e,r,{get:t[r],enumerable:!0})},cb=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of nd(t))!lb.call(e,i)&&i!==r&&ou(e,i,{get:()=>t[i],enumerable:!(n=sb(t,i))||n.enumerable});return e},ir=(e,t,r)=>(r=e!=null?ab(ub(e)):{},cb(t||!e||!e.__esModule?ou(r,"default",{value:e,enumerable:!0}):r,e)),xr=Ke({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/typebox.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Type=e.JsonType=e.JavaScriptTypeBuilder=e.JsonTypeBuilder=e.TypeBuilder=e.TypeBuilderError=e.TransformEncodeBuilder=e.TransformDecodeBuilder=e.TemplateLiteralDslParser=e.TemplateLiteralGenerator=e.TemplateLiteralGeneratorError=e.TemplateLiteralFinite=e.TemplateLiteralFiniteError=e.TemplateLiteralParser=e.TemplateLiteralParserError=e.TemplateLiteralResolver=e.TemplateLiteralPattern=e.TemplateLiteralPatternError=e.UnionResolver=e.KeyArrayResolver=e.KeyArrayResolverError=e.KeyResolver=e.ObjectMap=e.Intrinsic=e.IndexedAccessor=e.TypeClone=e.TypeExtends=e.TypeExtendsResult=e.TypeExtendsError=e.ExtendsUndefined=e.TypeGuard=e.TypeGuardUnknownTypeError=e.ValueGuard=e.FormatRegistry=e.TypeBoxError=e.TypeRegistry=e.PatternStringExact=e.PatternNumberExact=e.PatternBooleanExact=e.PatternString=e.PatternNumber=e.PatternBoolean=e.Kind=e.Hint=e.Optional=e.Readonly=e.Transform=void 0,e.Transform=Symbol.for("TypeBox.Transform"),e.Readonly=Symbol.for("TypeBox.Readonly"),e.Optional=Symbol.for("TypeBox.Optional"),e.Hint=Symbol.for("TypeBox.Hint"),e.Kind=Symbol.for("TypeBox.Kind"),e.PatternBoolean="(true|false)",e.PatternNumber="(0|[1-9][0-9]*)",e.PatternString="(.*)",e.PatternBooleanExact=`^${e.PatternBoolean}$`,e.PatternNumberExact=`^${e.PatternNumber}$`,e.PatternStringExact=`^${e.PatternString}$`;var t;(function(d){let _=new Map;function $(){return new Map(_)}d.Entries=$;function U(){return _.clear()}d.Clear=U;function C(w){return _.delete(w)}d.Delete=C;function k(w){return _.has(w)}d.Has=k;function m(w,c){_.set(w,c)}d.Set=m;function N(w){return _.get(w)}d.Get=N})(t||(e.TypeRegistry=t={}));var r=class extends Error{constructor(d){super(d)}};e.TypeBoxError=r;var n;(function(d){let _=new Map;function $(){return new Map(_)}d.Entries=$;function U(){return _.clear()}d.Clear=U;function C(w){return _.delete(w)}d.Delete=C;function k(w){return _.has(w)}d.Has=k;function m(w,c){_.set(w,c)}d.Set=m;function N(w){return _.get(w)}d.Get=N})(n||(e.FormatRegistry=n={}));var i;(function(d){function _(b){return Array.isArray(b)}d.IsArray=_;function $(b){return typeof b=="bigint"}d.IsBigInt=$;function U(b){return typeof b=="boolean"}d.IsBoolean=U;function C(b){return b instanceof globalThis.Date}d.IsDate=C;function k(b){return b===null}d.IsNull=k;function m(b){return typeof b=="number"}d.IsNumber=m;function N(b){return typeof b=="object"&&b!==null}d.IsObject=N;function w(b){return typeof b=="string"}d.IsString=w;function c(b){return b instanceof globalThis.Uint8Array}d.IsUint8Array=c;function E(b){return b===void 0}d.IsUndefined=E})(i||(e.ValueGuard=i={}));var o=class extends r{};e.TypeGuardUnknownTypeError=o;var a;(function(d){function _(g){try{return new RegExp(g),!0}catch{return!1}}function $(g){if(!i.IsString(g))return!1;for(let Ne=0;Ne<g.length;Ne++){let ht=g.charCodeAt(Ne);if(ht>=7&&ht<=13||ht===27||ht===127)return!1}return!0}function U(g){return m(g)||Fe(g)}function C(g){return i.IsUndefined(g)||i.IsBigInt(g)}function k(g){return i.IsUndefined(g)||i.IsNumber(g)}function m(g){return i.IsUndefined(g)||i.IsBoolean(g)}function N(g){return i.IsUndefined(g)||i.IsString(g)}function w(g){return i.IsUndefined(g)||i.IsString(g)&&$(g)&&_(g)}function c(g){return i.IsUndefined(g)||i.IsString(g)&&$(g)}function E(g){return i.IsUndefined(g)||Fe(g)}function b(g){return be(g,"Any")&&N(g.$id)}d.TAny=b;function v(g){return be(g,"Array")&&g.type==="array"&&N(g.$id)&&Fe(g.items)&&k(g.minItems)&&k(g.maxItems)&&m(g.uniqueItems)&&E(g.contains)&&k(g.minContains)&&k(g.maxContains)}d.TArray=v;function R(g){return be(g,"AsyncIterator")&&g.type==="AsyncIterator"&&N(g.$id)&&Fe(g.items)}d.TAsyncIterator=R;function K(g){return be(g,"BigInt")&&g.type==="bigint"&&N(g.$id)&&C(g.exclusiveMaximum)&&C(g.exclusiveMinimum)&&C(g.maximum)&&C(g.minimum)&&C(g.multipleOf)}d.TBigInt=K;function ee(g){return be(g,"Boolean")&&g.type==="boolean"&&N(g.$id)}d.TBoolean=ee;function oe(g){return be(g,"Constructor")&&g.type==="Constructor"&&N(g.$id)&&i.IsArray(g.parameters)&&g.parameters.every(Ne=>Fe(Ne))&&Fe(g.returns)}d.TConstructor=oe;function me(g){return be(g,"Date")&&g.type==="Date"&&N(g.$id)&&k(g.exclusiveMaximumTimestamp)&&k(g.exclusiveMinimumTimestamp)&&k(g.maximumTimestamp)&&k(g.minimumTimestamp)&&k(g.multipleOfTimestamp)}d.TDate=me;function we(g){return be(g,"Function")&&g.type==="Function"&&N(g.$id)&&i.IsArray(g.parameters)&&g.parameters.every(Ne=>Fe(Ne))&&Fe(g.returns)}d.TFunction=we;function Pe(g){return be(g,"Integer")&&g.type==="integer"&&N(g.$id)&&k(g.exclusiveMaximum)&&k(g.exclusiveMinimum)&&k(g.maximum)&&k(g.minimum)&&k(g.multipleOf)}d.TInteger=Pe;function Be(g){return be(g,"Intersect")&&!(i.IsString(g.type)&&g.type!=="object")&&i.IsArray(g.allOf)&&g.allOf.every(Ne=>Fe(Ne)&&!Ln(Ne))&&N(g.type)&&(m(g.unevaluatedProperties)||E(g.unevaluatedProperties))&&N(g.$id)}d.TIntersect=Be;function Er(g){return be(g,"Iterator")&&g.type==="Iterator"&&N(g.$id)&&Fe(g.items)}d.TIterator=Er;function be(g,Ne){return ar(g)&&g[e.Kind]===Ne}d.TKindOf=be;function ar(g){return i.IsObject(g)&&e.Kind in g&&i.IsString(g[e.Kind])}d.TKind=ar;function Ir(g){return j(g)&&i.IsString(g.const)}d.TLiteralString=Ir;function I(g){return j(g)&&i.IsNumber(g.const)}d.TLiteralNumber=I;function fe(g){return j(g)&&i.IsBoolean(g.const)}d.TLiteralBoolean=fe;function j(g){return be(g,"Literal")&&N(g.$id)&&(i.IsBoolean(g.const)||i.IsNumber(g.const)||i.IsString(g.const))}d.TLiteral=j;function ve(g){return be(g,"Never")&&i.IsObject(g.not)&&Object.getOwnPropertyNames(g.not).length===0}d.TNever=ve;function se(g){return be(g,"Not")&&Fe(g.not)}d.TNot=se;function pe(g){return be(g,"Null")&&g.type==="null"&&N(g.$id)}d.TNull=pe;function Ae(g){return be(g,"Number")&&g.type==="number"&&N(g.$id)&&k(g.exclusiveMaximum)&&k(g.exclusiveMinimum)&&k(g.maximum)&&k(g.minimum)&&k(g.multipleOf)}d.TNumber=Ae;function Me(g){return be(g,"Object")&&g.type==="object"&&N(g.$id)&&i.IsObject(g.properties)&&U(g.additionalProperties)&&k(g.minProperties)&&k(g.maxProperties)&&Object.entries(g.properties).every(([Ne,ht])=>$(Ne)&&Fe(ht))}d.TObject=Me;function nt(g){return be(g,"Promise")&&g.type==="Promise"&&N(g.$id)&&Fe(g.item)}d.TPromise=nt;function Ye(g){return be(g,"Record")&&g.type==="object"&&N(g.$id)&&U(g.additionalProperties)&&i.IsObject(g.patternProperties)&&(Ne=>{let ht=Object.getOwnPropertyNames(Ne.patternProperties);return ht.length===1&&_(ht[0])&&i.IsObject(Ne.patternProperties)&&Fe(Ne.patternProperties[ht[0]])})(g)}d.TRecord=Ye;function ot(g){return i.IsObject(g)&&e.Hint in g&&g[e.Hint]==="Recursive"}d.TRecursive=ot;function sr(g){return be(g,"Ref")&&N(g.$id)&&i.IsString(g.$ref)}d.TRef=sr;function rn(g){return be(g,"String")&&g.type==="string"&&N(g.$id)&&k(g.minLength)&&k(g.maxLength)&&w(g.pattern)&&c(g.format)}d.TString=rn;function nn(g){return be(g,"Symbol")&&g.type==="symbol"&&N(g.$id)}d.TSymbol=nn;function Sr(g){return be(g,"TemplateLiteral")&&g.type==="string"&&i.IsString(g.pattern)&&g.pattern[0]==="^"&&g.pattern[g.pattern.length-1]==="$"}d.TTemplateLiteral=Sr;function Mi(g){return be(g,"This")&&N(g.$id)&&i.IsString(g.$ref)}d.TThis=Mi;function Ln(g){return i.IsObject(g)&&e.Transform in g}d.TTransform=Ln;function ze(g){return be(g,"Tuple")&&g.type==="array"&&N(g.$id)&&i.IsNumber(g.minItems)&&i.IsNumber(g.maxItems)&&g.minItems===g.maxItems&&(i.IsUndefined(g.items)&&i.IsUndefined(g.additionalItems)&&g.minItems===0||i.IsArray(g.items)&&g.items.every(Ne=>Fe(Ne)))}d.TTuple=ze;function Li(g){return be(g,"Undefined")&&g.type==="undefined"&&N(g.$id)}d.TUndefined=Li;function Sa(g){return Ar(g)&&g.anyOf.every(Ne=>Ir(Ne)||I(Ne))}d.TUnionLiteral=Sa;function Ar(g){return be(g,"Union")&&N(g.$id)&&i.IsObject(g)&&i.IsArray(g.anyOf)&&g.anyOf.every(Ne=>Fe(Ne))}d.TUnion=Ar;function on(g){return be(g,"Uint8Array")&&g.type==="Uint8Array"&&N(g.$id)&&k(g.minByteLength)&&k(g.maxByteLength)}d.TUint8Array=on;function it(g){return be(g,"Unknown")&&N(g.$id)}d.TUnknown=it;function Vi(g){return be(g,"Unsafe")}d.TUnsafe=Vi;function Vn(g){return be(g,"Void")&&g.type==="void"&&N(g.$id)}d.TVoid=Vn;function Aa(g){return i.IsObject(g)&&g[e.Readonly]==="Readonly"}d.TReadonly=Aa;function $a(g){return i.IsObject(g)&&g[e.Optional]==="Optional"}d.TOptional=$a;function Fe(g){return i.IsObject(g)&&(b(g)||v(g)||ee(g)||K(g)||R(g)||oe(g)||me(g)||we(g)||Pe(g)||Be(g)||Er(g)||j(g)||ve(g)||se(g)||pe(g)||Ae(g)||Me(g)||nt(g)||Ye(g)||sr(g)||rn(g)||nn(g)||Sr(g)||Mi(g)||ze(g)||Li(g)||Ar(g)||on(g)||it(g)||Vi(g)||Vn(g)||ar(g)&&t.Has(g[e.Kind]))}d.TSchema=Fe})(a||(e.TypeGuard=a={}));var s;(function(d){function _($){return $[e.Kind]==="Intersect"?$.allOf.every(U=>_(U)):$[e.Kind]==="Union"?$.anyOf.some(U=>_(U)):$[e.Kind]==="Undefined"?!0:$[e.Kind]==="Not"?!_($.not):!1}d.Check=_})(s||(e.ExtendsUndefined=s={}));var u=class extends r{};e.TypeExtendsError=u;var l;(function(d){d[d.Union=0]="Union",d[d.True=1]="True",d[d.False=2]="False"})(l||(e.TypeExtendsResult=l={}));var f;(function(d){function _(y){return y===l.False?y:l.True}function $(y){throw new u(y)}function U(y){return a.TNever(y)||a.TIntersect(y)||a.TUnion(y)||a.TUnknown(y)||a.TAny(y)}function C(y,h){return a.TNever(h)?be(y,h):a.TIntersect(h)?we(y,h):a.TUnion(h)?Na(y,h):a.TUnknown(h)?Hu(y,h):a.TAny(h)?k(y,h):$("StructuralRight")}function k(y,h){return l.True}function m(y,h){return a.TIntersect(h)?we(y,h):a.TUnion(h)&&h.anyOf.some(xe=>a.TAny(xe)||a.TUnknown(xe))?l.True:a.TUnion(h)?l.Union:a.TUnknown(h)||a.TAny(h)?l.True:l.Union}function N(y,h){return a.TUnknown(y)?l.False:a.TAny(y)?l.Union:a.TNever(y)?l.True:l.False}function w(y,h){return a.TObject(h)&&Sr(h)?l.True:U(h)?C(y,h):a.TArray(h)?_(je(y.items,h.items)):l.False}function c(y,h){return U(h)?C(y,h):a.TAsyncIterator(h)?_(je(y.items,h.items)):l.False}function E(y,h){return U(h)?C(y,h):a.TObject(h)?ze(y,h):a.TRecord(h)?it(y,h):a.TBigInt(h)?l.True:l.False}function b(y,h){return a.TLiteral(y)&&i.IsBoolean(y.const)||a.TBoolean(y)?l.True:l.False}function v(y,h){return U(h)?C(y,h):a.TObject(h)?ze(y,h):a.TRecord(h)?it(y,h):a.TBoolean(h)?l.True:l.False}function R(y,h){return U(h)?C(y,h):a.TObject(h)?ze(y,h):a.TConstructor(h)?y.parameters.length>h.parameters.length?l.False:y.parameters.every((xe,Jt)=>_(je(h.parameters[Jt],xe))===l.True)?_(je(y.returns,h.returns)):l.False:l.False}function K(y,h){return U(h)?C(y,h):a.TObject(h)?ze(y,h):a.TRecord(h)?it(y,h):a.TDate(h)?l.True:l.False}function ee(y,h){return U(h)?C(y,h):a.TObject(h)?ze(y,h):a.TFunction(h)?y.parameters.length>h.parameters.length?l.False:y.parameters.every((xe,Jt)=>_(je(h.parameters[Jt],xe))===l.True)?_(je(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 me(y,h){return a.TInteger(h)||a.TNumber(h)?l.True:U(h)?C(y,h):a.TObject(h)?ze(y,h):a.TRecord(h)?it(y,h):l.False}function we(y,h){return h.allOf.every(xe=>je(y,xe)===l.True)?l.True:l.False}function Pe(y,h){return y.allOf.some(xe=>je(xe,h)===l.True)?l.True:l.False}function Be(y,h){return U(h)?C(y,h):a.TIterator(h)?_(je(y.items,h.items)):l.False}function Er(y,h){return a.TLiteral(h)&&h.const===y.const?l.True:U(h)?C(y,h):a.TObject(h)?ze(y,h):a.TRecord(h)?it(y,h):a.TString(h)?Vn(y,h):a.TNumber(h)?j(y,h):a.TInteger(h)?oe(y,h):a.TBoolean(h)?b(y,h):l.False}function be(y,h){return l.False}function ar(y,h){return l.True}function Ir(y){let[h,xe]=[y,0];for(;a.TNot(h);)h=h.not,xe+=1;return xe%2===0?h:e.Type.Unknown()}function I(y,h){return a.TNot(y)?je(Ir(y),h):a.TNot(h)?je(y,Ir(h)):$("Invalid fallthrough for Not")}function fe(y,h){return U(h)?C(y,h):a.TObject(h)?ze(y,h):a.TRecord(h)?it(y,h):a.TNull(h)?l.True:l.False}function j(y,h){return a.TLiteralNumber(y)||a.TNumber(y)||a.TInteger(y)?l.True:l.False}function ve(y,h){return U(h)?C(y,h):a.TObject(h)?ze(y,h):a.TRecord(h)?it(y,h):a.TInteger(h)||a.TNumber(h)?l.True:l.False}function se(y,h){return Object.getOwnPropertyNames(y.properties).length===h}function pe(y){return Sr(y)}function Ae(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 Me(y){return se(y,0)}function nt(y){return se(y,0)}function Ye(y){return se(y,0)}function ot(y){return se(y,0)}function sr(y){return Sr(y)}function rn(y){let h=e.Type.Number();return se(y,0)||se(y,1)&&"length"in y.properties&&_(je(y.properties.length,h))===l.True}function nn(y){return se(y,0)}function Sr(y){let h=e.Type.Number();return se(y,0)||se(y,1)&&"length"in y.properties&&_(je(y.properties.length,h))===l.True}function Mi(y){let h=e.Type.Function([e.Type.Any()],e.Type.Any());return se(y,0)||se(y,1)&&"then"in y.properties&&_(je(y.properties.then,h))===l.True}function Ln(y,h){return je(y,h)===l.False||a.TOptional(y)&&!a.TOptional(h)?l.False:l.True}function ze(y,h){return a.TUnknown(y)?l.False:a.TAny(y)?l.Union:a.TNever(y)||a.TLiteralString(y)&&pe(h)||a.TLiteralNumber(y)&&Me(h)||a.TLiteralBoolean(y)&&nt(h)||a.TSymbol(y)&&Ae(h)||a.TBigInt(y)&&Ye(h)||a.TString(y)&&pe(h)||a.TSymbol(y)&&Ae(h)||a.TNumber(y)&&Me(h)||a.TInteger(y)&&Me(h)||a.TBoolean(y)&&nt(h)||a.TUint8Array(y)&&sr(h)||a.TDate(y)&&ot(h)||a.TConstructor(y)&&nn(h)||a.TFunction(y)&&rn(h)?l.True:a.TRecord(y)&&a.TString(Ar(y))?h[e.Hint]==="Record"?l.True:l.False:a.TRecord(y)&&a.TNumber(Ar(y))&&se(h,0)?l.True:l.False}function Li(y,h){return U(h)?C(y,h):a.TRecord(h)?it(y,h):a.TObject(h)?(()=>{for(let xe of Object.getOwnPropertyNames(h.properties)){if(!(xe in y.properties)&&!a.TOptional(h.properties[xe]))return l.False;if(a.TOptional(h.properties[xe]))return l.True;if(Ln(y.properties[xe],h.properties[xe])===l.False)return l.False}return l.True})():l.False}function Sa(y,h){return U(h)?C(y,h):a.TObject(h)&&Mi(h)?l.True:a.TPromise(h)?_(je(y.item,h.item)):l.False}function Ar(y){return e.PatternNumberExact in y.patternProperties?e.Type.Number():e.PatternStringExact in y.patternProperties?e.Type.String():$("Unknown record key pattern")}function on(y){return e.PatternNumberExact in y.patternProperties?y.patternProperties[e.PatternNumberExact]:e.PatternStringExact in y.patternProperties?y.patternProperties[e.PatternStringExact]:$("Unable to get record value schema")}function it(y,h){let[xe,Jt]=[Ar(h),on(h)];return a.TLiteralString(y)&&a.TNumber(xe)&&_(je(y,Jt))===l.True?l.True:a.TUint8Array(y)&&a.TNumber(xe)||a.TString(y)&&a.TNumber(xe)||a.TArray(y)&&a.TNumber(xe)?je(y,Jt):a.TObject(y)?(()=>{for(let Jp of Object.getOwnPropertyNames(y.properties))if(Ln(Jt,y.properties[Jp])===l.False)return l.False;return l.True})():l.False}function Vi(y,h){return U(h)?C(y,h):a.TObject(h)?ze(y,h):a.TRecord(h)?je(on(y),on(h)):l.False}function Vn(y,h){return a.TLiteral(y)&&i.IsString(y.const)||a.TString(y)?l.True:l.False}function Aa(y,h){return U(h)?C(y,h):a.TObject(h)?ze(y,h):a.TRecord(h)?it(y,h):a.TString(h)?l.True:l.False}function $a(y,h){return U(h)?C(y,h):a.TObject(h)?ze(y,h):a.TRecord(h)?it(y,h):a.TSymbol(h)?l.True:l.False}function Fe(y,h){return a.TTemplateLiteral(y)?je(V.Resolve(y),h):a.TTemplateLiteral(h)?je(y,V.Resolve(h)):$("Invalid fallthrough for TemplateLiteral")}function g(y,h){return a.TArray(h)&&y.items!==void 0&&y.items.every(xe=>je(xe,h.items)===l.True)}function Ne(y,h){return a.TNever(y)?l.True:a.TUnknown(y)?l.False:a.TAny(y)?l.Union:l.False}function ht(y,h){return U(h)?C(y,h):a.TObject(h)&&Sr(h)||a.TArray(h)&&g(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((xe,Jt)=>je(xe,h.items[Jt])===l.True)?l.True:l.False:l.False}function zp(y,h){return U(h)?C(y,h):a.TObject(h)?ze(y,h):a.TRecord(h)?it(y,h):a.TUint8Array(h)?l.True:l.False}function Fp(y,h){return U(h)?C(y,h):a.TObject(h)?ze(y,h):a.TRecord(h)?it(y,h):a.TVoid(h)?qp(y,h):a.TUndefined(h)?l.True:l.False}function Na(y,h){return h.anyOf.some(xe=>je(y,xe)===l.True)?l.True:l.False}function Gp(y,h){return y.anyOf.every(xe=>je(xe,h)===l.True)?l.True:l.False}function Hu(y,h){return l.True}function Kp(y,h){return a.TNever(h)?be(y,h):a.TIntersect(h)?we(y,h):a.TUnion(h)?Na(y,h):a.TAny(h)?k(y,h):a.TString(h)?Vn(y,h):a.TNumber(h)?j(y,h):a.TInteger(h)?oe(y,h):a.TBoolean(h)?b(y,h):a.TArray(h)?N(y,h):a.TTuple(h)?Ne(y,h):a.TObject(h)?ze(y,h):a.TUnknown(h)?l.True:l.False}function qp(y,h){return a.TUndefined(y)||a.TUndefined(y)?l.True:l.False}function Hp(y,h){return a.TIntersect(h)?we(y,h):a.TUnion(h)?Na(y,h):a.TUnknown(h)?Hu(y,h):a.TAny(h)?k(y,h):a.TObject(h)?ze(y,h):a.TVoid(h)?l.True:l.False}function je(y,h){return a.TTemplateLiteral(y)||a.TTemplateLiteral(h)?Fe(y,h):a.TNot(y)||a.TNot(h)?I(y,h):a.TAny(y)?m(y,h):a.TArray(y)?w(y,h):a.TBigInt(y)?E(y,h):a.TBoolean(y)?v(y,h):a.TAsyncIterator(y)?c(y,h):a.TConstructor(y)?R(y,h):a.TDate(y)?K(y,h):a.TFunction(y)?ee(y,h):a.TInteger(y)?me(y,h):a.TIntersect(y)?Pe(y,h):a.TIterator(y)?Be(y,h):a.TLiteral(y)?Er(y,h):a.TNever(y)?ar(y,h):a.TNull(y)?fe(y,h):a.TNumber(y)?ve(y,h):a.TObject(y)?Li(y,h):a.TRecord(y)?Vi(y,h):a.TString(y)?Aa(y,h):a.TSymbol(y)?$a(y,h):a.TTuple(y)?ht(y,h):a.TPromise(y)?Sa(y,h):a.TUint8Array(y)?zp(y,h):a.TUndefined(y)?Fp(y,h):a.TUnion(y)?Gp(y,h):a.TUnknown(y)?Kp(y,h):a.TVoid(y)?Hp(y,h):$(`Unknown left type operand '${y[e.Kind]}'`)}function Wp(y,h){return je(y,h)}d.Extends=Wp})(f||(e.TypeExtends=f={}));var p;(function(d){function _(w){return w.map(c=>k(c))}function $(w){return new Date(w.getTime())}function U(w){return new Uint8Array(w)}function C(w){let c=Object.getOwnPropertyNames(w).reduce((b,v)=>({...b,[v]:k(w[v])}),{}),E=Object.getOwnPropertySymbols(w).reduce((b,v)=>({...b,[v]:k(w[v])}),{});return{...c,...E}}function k(w){return i.IsArray(w)?_(w):i.IsDate(w)?$(w):i.IsUint8Array(w)?U(w):i.IsObject(w)?C(w):w}function m(w){return w.map(c=>N(c))}d.Rest=m;function N(w,c={}){return{...k(w),...c}}d.Type=N})(p||(e.TypeClone=p={}));var A;(function(d){function _(R){return R.map(K=>{let{[e.Optional]:ee,...oe}=p.Type(K);return oe})}function $(R){return R.every(K=>a.TOptional(K))}function U(R){return R.some(K=>a.TOptional(K))}function C(R){return $(R.allOf)?e.Type.Optional(e.Type.Intersect(_(R.allOf))):R}function k(R){return U(R.anyOf)?e.Type.Optional(e.Type.Union(_(R.anyOf))):R}function m(R){return R[e.Kind]==="Intersect"?C(R):R[e.Kind]==="Union"?k(R):R}function N(R,K){let ee=R.allOf.reduce((oe,me)=>{let we=b(me,K);return we[e.Kind]==="Never"?oe:[...oe,we]},[]);return m(e.Type.Intersect(ee))}function w(R,K){let ee=R.anyOf.map(oe=>b(oe,K));return m(e.Type.Union(ee))}function c(R,K){let ee=R.properties[K];return i.IsUndefined(ee)?e.Type.Never():e.Type.Union([ee])}function E(R,K){let ee=R.items;if(i.IsUndefined(ee))return e.Type.Never();let oe=ee[K];return i.IsUndefined(oe)?e.Type.Never():oe}function b(R,K){return R[e.Kind]==="Intersect"?N(R,K):R[e.Kind]==="Union"?w(R,K):R[e.Kind]==="Object"?c(R,K):R[e.Kind]==="Tuple"?E(R,K):e.Type.Never()}function v(R,K,ee={}){let oe=K.map(me=>b(R,me.toString()));return m(e.Type.Union(oe,ee))}d.Resolve=v})(A||(e.IndexedAccessor=A={}));var O;(function(d){function _(E){let[b,v]=[E.slice(0,1),E.slice(1)];return`${b.toLowerCase()}${v}`}function $(E){let[b,v]=[E.slice(0,1),E.slice(1)];return`${b.toUpperCase()}${v}`}function U(E){return E.toUpperCase()}function C(E){return E.toLowerCase()}function k(E,b){let v=L.ParseExact(E.pattern);if(!M.Check(v))return{...E,pattern:m(E.pattern,b)};let R=[...z.Generate(v)].map(oe=>e.Type.Literal(oe)),K=N(R,b),ee=e.Type.Union(K);return e.Type.TemplateLiteral([ee])}function m(E,b){return typeof E=="string"?b==="Uncapitalize"?_(E):b==="Capitalize"?$(E):b==="Uppercase"?U(E):b==="Lowercase"?C(E):E:E.toString()}function N(E,b){if(E.length===0)return[];let[v,...R]=E;return[c(v,b),...N(R,b)]}function w(E,b){return a.TTemplateLiteral(E)?k(E,b):a.TUnion(E)?e.Type.Union(N(E.anyOf,b)):a.TLiteral(E)?e.Type.Literal(m(E.const,b)):E}function c(E,b){return w(E,b)}d.Map=c})(O||(e.Intrinsic=O={}));var T;(function(d){function _(m,N){return e.Type.Intersect(m.allOf.map(w=>C(w,N)),{...m})}function $(m,N){return e.Type.Union(m.anyOf.map(w=>C(w,N)),{...m})}function U(m,N){return N(m)}function C(m,N){return m[e.Kind]==="Intersect"?_(m,N):m[e.Kind]==="Union"?$(m,N):m[e.Kind]==="Object"?U(m,N):m}function k(m,N,w){return{...C(p.Type(m),N),...w}}d.Map=k})(T||(e.ObjectMap=T={}));var F;(function(d){function _(c){return c[0]==="^"&&c[c.length-1]==="$"?c.slice(1,c.length-1):c}function $(c,E){return c.allOf.reduce((b,v)=>[...b,...m(v,E)],[])}function U(c,E){let b=c.anyOf.map(v=>m(v,E));return[...b.reduce((v,R)=>R.map(K=>b.every(ee=>ee.includes(K))?v.add(K):v)[0],new Set)]}function C(c,E){return Object.getOwnPropertyNames(c.properties)}function k(c,E){return E.includePatterns?Object.getOwnPropertyNames(c.patternProperties):[]}function m(c,E){return a.TIntersect(c)?$(c,E):a.TUnion(c)?U(c,E):a.TObject(c)?C(c,E):a.TRecord(c)?k(c,E):[]}function N(c,E){return[...new Set(m(c,E))]}d.ResolveKeys=N;function w(c){return`^(${N(c,{includePatterns:!0}).map(E=>`(${_(E)})`).join("|")})$`}d.ResolvePattern=w})(F||(e.KeyResolver=F={}));var W=class extends r{};e.KeyArrayResolverError=W;var x;(function(d){function _($){return Array.isArray($)?$:a.TUnionLiteral($)?$.anyOf.map(U=>U.const.toString()):a.TLiteral($)?[$.const]:a.TTemplateLiteral($)?(()=>{let U=L.ParseExact($.pattern);if(!M.Check(U))throw new W("Cannot resolve keys from infinite template expression");return[...z.Generate(U)]})():[]}d.Resolve=_})(x||(e.KeyArrayResolver=x={}));var P;(function(d){function*_(U){for(let C of U.anyOf)C[e.Kind]==="Union"?yield*_(C):yield C}function $(U){return e.Type.Union([..._(U)],{...U})}d.Resolve=$})(P||(e.UnionResolver=P={}));var G=class extends r{};e.TemplateLiteralPatternError=G;var q;(function(d){function _(k){throw new G(k)}function $(k){return k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function U(k,m){return a.TTemplateLiteral(k)?k.pattern.slice(1,k.pattern.length-1):a.TUnion(k)?`(${k.anyOf.map(N=>U(N,m)).join("|")})`:a.TNumber(k)?`${m}${e.PatternNumber}`:a.TInteger(k)?`${m}${e.PatternNumber}`:a.TBigInt(k)?`${m}${e.PatternNumber}`:a.TString(k)?`${m}${e.PatternString}`:a.TLiteral(k)?`${m}${$(k.const.toString())}`:a.TBoolean(k)?`${m}${e.PatternBoolean}`:_(`Unexpected Kind '${k[e.Kind]}'`)}function C(k){return`^${k.map(m=>U(m,"")).join("")}$`}d.Create=C})(q||(e.TemplateLiteralPattern=q={}));var V;(function(d){function _($){let U=L.ParseExact($.pattern);if(!M.Check(U))return e.Type.String();let C=[...z.Generate(U)].map(k=>e.Type.Literal(k));return e.Type.Union(C)}d.Resolve=_})(V||(e.TemplateLiteralResolver=V={}));var Q=class extends r{};e.TemplateLiteralParserError=Q;var L;(function(d){function _(R,K,ee){return R[K]===ee&&R.charCodeAt(K-1)!==92}function $(R,K){return _(R,K,"(")}function U(R,K){return _(R,K,")")}function C(R,K){return _(R,K,"|")}function k(R){if(!($(R,0)&&U(R,R.length-1)))return!1;let K=0;for(let ee=0;ee<R.length;ee++)if($(R,ee)&&(K+=1),U(R,ee)&&(K-=1),K===0&&ee!==R.length-1)return!1;return!0}function m(R){return R.slice(1,R.length-1)}function N(R){let K=0;for(let ee=0;ee<R.length;ee++)if($(R,ee)&&(K+=1),U(R,ee)&&(K-=1),C(R,ee)&&K===0)return!0;return!1}function w(R){for(let K=0;K<R.length;K++)if($(R,K))return!0;return!1}function c(R){let[K,ee]=[0,0],oe=[];for(let we=0;we<R.length;we++)if($(R,we)&&(K+=1),U(R,we)&&(K-=1),C(R,we)&&K===0){let Pe=R.slice(ee,we);Pe.length>0&&oe.push(b(Pe)),ee=we+1}let me=R.slice(ee);return me.length>0&&oe.push(b(me)),oe.length===0?{type:"const",const:""}:oe.length===1?oe[0]:{type:"or",expr:oe}}function E(R){function K(me,we){if(!$(me,we))throw new Q("TemplateLiteralParser: Index must point to open parens");let Pe=0;for(let Be=we;Be<me.length;Be++)if($(me,Be)&&(Pe+=1),U(me,Be)&&(Pe-=1),Pe===0)return[we,Be];throw new Q("TemplateLiteralParser: Unclosed group parens in expression")}function ee(me,we){for(let Pe=we;Pe<me.length;Pe++)if($(me,Pe))return[we,Pe];return[we,me.length]}let oe=[];for(let me=0;me<R.length;me++)if($(R,me)){let[we,Pe]=K(R,me),Be=R.slice(we,Pe+1);oe.push(b(Be)),me=Pe}else{let[we,Pe]=ee(R,me),Be=R.slice(we,Pe);Be.length>0&&oe.push(b(Be)),me=Pe-1}return oe.length===0?{type:"const",const:""}:oe.length===1?oe[0]:{type:"and",expr:oe}}function b(R){return k(R)?b(m(R)):N(R)?c(R):w(R)?E(R):{type:"const",const:R}}d.Parse=b;function v(R){return b(R.slice(1,R.length-1))}d.ParseExact=v})(L||(e.TemplateLiteralParser=L={}));var re=class extends r{};e.TemplateLiteralFiniteError=re;var M;(function(d){function _(m){throw new re(m)}function $(m){return m.type==="or"&&m.expr.length===2&&m.expr[0].type==="const"&&m.expr[0].const==="0"&&m.expr[1].type==="const"&&m.expr[1].const==="[1-9][0-9]*"}function U(m){return m.type==="or"&&m.expr.length===2&&m.expr[0].type==="const"&&m.expr[0].const==="true"&&m.expr[1].type==="const"&&m.expr[1].const==="false"}function C(m){return m.type==="const"&&m.const===".*"}function k(m){return U(m)?!0:$(m)||C(m)?!1:m.type==="and"?m.expr.every(N=>k(N)):m.type==="or"?m.expr.every(N=>k(N)):m.type==="const"?!0:_("Unknown expression type")}d.Check=k})(M||(e.TemplateLiteralFinite=M={}));var B=class extends r{};e.TemplateLiteralGeneratorError=B;var z;(function(d){function*_(m){if(m.length===1)return yield*m[0];for(let N of m[0])for(let w of _(m.slice(1)))yield`${N}${w}`}function*$(m){return yield*_(m.expr.map(N=>[...k(N)]))}function*U(m){for(let N of m.expr)yield*k(N)}function*C(m){return yield m.const}function*k(m){return m.type==="and"?yield*$(m):m.type==="or"?yield*U(m):m.type==="const"?yield*C(m):(()=>{throw new B("Unknown expression")})()}d.Generate=k})(z||(e.TemplateLiteralGenerator=z={}));var ie;(function(d){function*_(k){let m=k.trim().replace(/"|'/g,"");return m==="boolean"?yield e.Type.Boolean():m==="number"?yield e.Type.Number():m==="bigint"?yield e.Type.BigInt():m==="string"?yield e.Type.String():yield(()=>{let N=m.split("|").map(w=>e.Type.Literal(w.trim()));return N.length===0?e.Type.Never():N.length===1?N[0]:e.Type.Union(N)})()}function*$(k){if(k[1]!=="{"){let m=e.Type.Literal("$"),N=U(k.slice(1));return yield*[m,...N]}for(let m=2;m<k.length;m++)if(k[m]==="}"){let N=_(k.slice(2,m)),w=U(k.slice(m+1));return yield*[...N,...w]}yield e.Type.Literal(k)}function*U(k){for(let m=0;m<k.length;m++)if(k[m]==="$"){let N=e.Type.Literal(k.slice(0,m)),w=$(k.slice(m));return yield*[N,...w]}yield e.Type.Literal(k)}function C(k){return[...U(k)]}d.Parse=C})(ie||(e.TemplateLiteralDslParser=ie={}));var ne=class{constructor(d){this.schema=d}Decode(d){return new S(this.schema,d)}};e.TransformDecodeBuilder=ne;var S=class{constructor(d,_){this.schema=d,this.decode=_}Encode(d){let _=p.Type(this.schema);return a.TTransform(_)?(()=>{let $={Encode:U=>_[e.Transform].Encode(d(U)),Decode:U=>this.decode(_[e.Transform].Decode(U))};return{..._,[e.Transform]:$}})():(()=>{let $={Decode:this.decode,Encode:d};return{..._,[e.Transform]:$}})()}};e.TransformEncodeBuilder=S;var H=0,ae=class extends r{};e.TypeBuilderError=ae;var X=class{Create(d){return d}Throw(d){throw new ae(d)}Discard(d,_){return _.reduce(($,U)=>{let{[U]:C,...k}=$;return k},d)}Strict(d){return JSON.parse(JSON.stringify(d))}};e.TypeBuilder=X;var Z=class extends X{ReadonlyOptional(d){return this.Readonly(this.Optional(d))}Readonly(d){return{...p.Type(d),[e.Readonly]:"Readonly"}}Optional(d){return{...p.Type(d),[e.Optional]:"Optional"}}Any(d={}){return this.Create({...d,[e.Kind]:"Any"})}Array(d,_={}){return this.Create({..._,[e.Kind]:"Array",type:"array",items:p.Type(d)})}Boolean(d={}){return this.Create({...d,[e.Kind]:"Boolean",type:"boolean"})}Capitalize(d,_={}){return{...O.Map(p.Type(d),"Capitalize"),..._}}Composite(d,_){let $=e.Type.Intersect(d,{}),U=F.ResolveKeys($,{includePatterns:!1}).reduce((C,k)=>({...C,[k]:e.Type.Index($,[k])}),{});return e.Type.Object(U,_)}Enum(d,_={}){if(i.IsUndefined(d))return this.Throw("Enum undefined or empty");let $=Object.getOwnPropertyNames(d).filter(C=>isNaN(C)).map(C=>d[C]),U=[...new Set($)].map(C=>e.Type.Literal(C));return this.Union(U,{..._,[e.Hint]:"Enum"})}Extends(d,_,$,U,C={}){switch(f.Extends(d,_)){case l.Union:return this.Union([p.Type($,C),p.Type(U,C)]);case l.True:return p.Type($,C);case l.False:return p.Type(U,C)}}Exclude(d,_,$={}){return a.TTemplateLiteral(d)?this.Exclude(V.Resolve(d),_,$):a.TTemplateLiteral(_)?this.Exclude(d,V.Resolve(_),$):a.TUnion(d)?(()=>{let U=d.anyOf.filter(C=>f.Extends(C,_)===l.False);return U.length===1?p.Type(U[0],$):this.Union(U,$)})():f.Extends(d,_)!==l.False?this.Never($):p.Type(d,$)}Extract(d,_,$={}){return a.TTemplateLiteral(d)?this.Extract(V.Resolve(d),_,$):a.TTemplateLiteral(_)?this.Extract(d,V.Resolve(_),$):a.TUnion(d)?(()=>{let U=d.anyOf.filter(C=>f.Extends(C,_)!==l.False);return U.length===1?p.Type(U[0],$):this.Union(U,$)})():f.Extends(d,_)!==l.False?p.Type(d,$):this.Never($)}Index(d,_,$={}){return a.TArray(d)&&a.TNumber(_)?p.Type(d.items,$):a.TTuple(d)&&a.TNumber(_)?(()=>{let U=(i.IsUndefined(d.items)?[]:d.items).map(C=>p.Type(C));return this.Union(U,$)})():(()=>{let U=x.Resolve(_),C=p.Type(d);return A.Resolve(C,U,$)})()}Integer(d={}){return this.Create({...d,[e.Kind]:"Integer",type:"integer"})}Intersect(d,_={}){if(d.length===0)return e.Type.Never();if(d.length===1)return p.Type(d[0],_);d.some(k=>a.TTransform(k))&&this.Throw("Cannot intersect transform types");let $=d.every(k=>a.TObject(k)),U=p.Rest(d),C=a.TSchema(_.unevaluatedProperties)?{unevaluatedProperties:p.Type(_.unevaluatedProperties)}:{};return _.unevaluatedProperties===!1||a.TSchema(_.unevaluatedProperties)||$?this.Create({..._,...C,[e.Kind]:"Intersect",type:"object",allOf:U}):this.Create({..._,...C,[e.Kind]:"Intersect",allOf:U})}KeyOf(d,_={}){return a.TRecord(d)?(()=>{let $=Object.getOwnPropertyNames(d.patternProperties)[0];return $===e.PatternNumberExact?this.Number(_):$===e.PatternStringExact?this.String(_):this.Throw("Unable to resolve key type from Record key pattern")})():a.TTuple(d)?(()=>{let $=(i.IsUndefined(d.items)?[]:d.items).map((U,C)=>e.Type.Literal(C.toString()));return this.Union($,_)})():a.TArray(d)?this.Number(_):(()=>{let $=F.ResolveKeys(d,{includePatterns:!1});if($.length===0)return this.Never(_);let U=$.map(C=>this.Literal(C));return this.Union(U,_)})()}Literal(d,_={}){return this.Create({..._,[e.Kind]:"Literal",const:d,type:typeof d})}Lowercase(d,_={}){return{...O.Map(p.Type(d),"Lowercase"),..._}}Never(d={}){return this.Create({...d,[e.Kind]:"Never",not:{}})}Not(d,_){return this.Create({..._,[e.Kind]:"Not",not:p.Type(d)})}Null(d={}){return this.Create({...d,[e.Kind]:"Null",type:"null"})}Number(d={}){return this.Create({...d,[e.Kind]:"Number",type:"number"})}Object(d,_={}){let $=Object.getOwnPropertyNames(d),U=$.filter(N=>a.TOptional(d[N])),C=$.filter(N=>!U.includes(N)),k=a.TSchema(_.additionalProperties)?{additionalProperties:p.Type(_.additionalProperties)}:{},m=$.reduce((N,w)=>({...N,[w]:p.Type(d[w])}),{});return C.length>0?this.Create({..._,...k,[e.Kind]:"Object",type:"object",properties:m,required:C}):this.Create({..._,...k,[e.Kind]:"Object",type:"object",properties:m})}Omit(d,_,$={}){let U=x.Resolve(_);return T.Map(this.Discard(p.Type(d),["$id",e.Transform]),C=>{i.IsArray(C.required)&&(C.required=C.required.filter(k=>!U.includes(k)),C.required.length===0&&delete C.required);for(let k of Object.getOwnPropertyNames(C.properties))U.includes(k)&&delete C.properties[k];return this.Create(C)},$)}Partial(d,_={}){return T.Map(this.Discard(p.Type(d),["$id",e.Transform]),$=>{let U=Object.getOwnPropertyNames($.properties).reduce((C,k)=>({...C,[k]:this.Optional($.properties[k])}),{});return this.Object(U,this.Discard($,["required"]))},_)}Pick(d,_,$={}){let U=x.Resolve(_);return T.Map(this.Discard(p.Type(d),["$id",e.Transform]),C=>{i.IsArray(C.required)&&(C.required=C.required.filter(k=>U.includes(k)),C.required.length===0&&delete C.required);for(let k of Object.getOwnPropertyNames(C.properties))U.includes(k)||delete C.properties[k];return this.Create(C)},$)}Record(d,_,$={}){return a.TTemplateLiteral(d)?(()=>{let U=L.ParseExact(d.pattern);return M.Check(U)?this.Object([...z.Generate(U)].reduce((C,k)=>({...C,[k]:p.Type(_)}),{}),$):this.Create({...$,[e.Kind]:"Record",type:"object",patternProperties:{[d.pattern]:p.Type(_)}})})():a.TUnion(d)?(()=>{let U=P.Resolve(d);if(a.TUnionLiteral(U)){let C=U.anyOf.reduce((k,m)=>({...k,[m.const]:p.Type(_)}),{});return this.Object(C,{...$,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():a.TLiteral(d)?i.IsString(d.const)||i.IsNumber(d.const)?this.Object({[d.const]:p.Type(_)},$):this.Throw("Record key of type literal is not of type string or number"):a.TInteger(d)||a.TNumber(d)?this.Create({...$,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:p.Type(_)}}):a.TString(d)?(()=>{let U=i.IsUndefined(d.pattern)?e.PatternStringExact:d.pattern;return this.Create({...$,[e.Kind]:"Record",type:"object",patternProperties:{[U]:p.Type(_)}})})():this.Never()}Recursive(d,_={}){i.IsUndefined(_.$id)&&(_.$id=`T${H++}`);let $=d({[e.Kind]:"This",$ref:`${_.$id}`});return $.$id=_.$id,this.Create({..._,[e.Hint]:"Recursive",...$})}Ref(d,_={}){return i.IsString(d)?this.Create({..._,[e.Kind]:"Ref",$ref:d}):(i.IsUndefined(d.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({..._,[e.Kind]:"Ref",$ref:d.$id}))}Required(d,_={}){return T.Map(this.Discard(p.Type(d),["$id",e.Transform]),$=>{let U=Object.getOwnPropertyNames($.properties).reduce((C,k)=>({...C,[k]:this.Discard($.properties[k],[e.Optional])}),{});return this.Object(U,$)},_)}Rest(d){return a.TTuple(d)&&!i.IsUndefined(d.items)?p.Rest(d.items):a.TIntersect(d)?p.Rest(d.allOf):a.TUnion(d)?p.Rest(d.anyOf):[]}String(d={}){return this.Create({...d,[e.Kind]:"String",type:"string"})}TemplateLiteral(d,_={}){let $=i.IsString(d)?q.Create(ie.Parse(d)):q.Create(d);return this.Create({..._,[e.Kind]:"TemplateLiteral",type:"string",pattern:$})}Transform(d){return new ne(d)}Tuple(d,_={}){let[$,U,C]=[!1,d.length,d.length],k=p.Rest(d),m=d.length>0?{..._,[e.Kind]:"Tuple",type:"array",items:k,additionalItems:$,minItems:U,maxItems:C}:{..._,[e.Kind]:"Tuple",type:"array",minItems:U,maxItems:C};return this.Create(m)}Uncapitalize(d,_={}){return{...O.Map(p.Type(d),"Uncapitalize"),..._}}Union(d,_={}){return a.TTemplateLiteral(d)?V.Resolve(d):(()=>{let $=d;if($.length===0)return this.Never(_);if($.length===1)return this.Create(p.Type($[0],_));let U=p.Rest($);return this.Create({..._,[e.Kind]:"Union",anyOf:U})})()}Unknown(d={}){return this.Create({...d,[e.Kind]:"Unknown"})}Unsafe(d={}){return this.Create({...d,[e.Kind]:d[e.Kind]||"Unsafe"})}Uppercase(d,_={}){return{...O.Map(p.Type(d),"Uppercase"),..._}}};e.JsonTypeBuilder=Z;var de=class extends Z{AsyncIterator(d,_={}){return this.Create({..._,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:p.Type(d)})}Awaited(d,_={}){let $=U=>U.length>0?(()=>{let[C,...k]=U;return[this.Awaited(C),...$(k)]})():U;return a.TIntersect(d)?e.Type.Intersect($(d.allOf)):a.TUnion(d)?e.Type.Union($(d.anyOf)):a.TPromise(d)?this.Awaited(d.item):p.Type(d,_)}BigInt(d={}){return this.Create({...d,[e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(d,_={}){return this.Tuple([...d.parameters],{..._})}Constructor(d,_,$){let[U,C]=[p.Rest(d),p.Type(_)];return this.Create({...$,[e.Kind]:"Constructor",type:"Constructor",parameters:U,returns:C})}Date(d={}){return this.Create({...d,[e.Kind]:"Date",type:"Date"})}Function(d,_,$){let[U,C]=[p.Rest(d),p.Type(_)];return this.Create({...$,[e.Kind]:"Function",type:"Function",parameters:U,returns:C})}InstanceType(d,_={}){return p.Type(d.returns,_)}Iterator(d,_={}){return this.Create({..._,[e.Kind]:"Iterator",type:"Iterator",items:p.Type(d)})}Parameters(d,_={}){return this.Tuple(d.parameters,{..._})}Promise(d,_={}){return this.Create({..._,[e.Kind]:"Promise",type:"Promise",item:p.Type(d)})}RegExp(d,_={}){let $=i.IsString(d)?d:d.source;return this.Create({..._,[e.Kind]:"String",type:"string",pattern:$})}RegEx(d,_={}){return this.RegExp(d,_)}ReturnType(d,_={}){return p.Type(d.returns,_)}Symbol(d){return this.Create({...d,[e.Kind]:"Symbol",type:"symbol"})}Undefined(d={}){return this.Create({...d,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(d={}){return this.Create({...d,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(d={}){return this.Create({...d,[e.Kind]:"Void",type:"void"})}};e.JavaScriptTypeBuilder=de,e.JsonType=new Z,e.Type=new de}}),$n=ir(xr(),1),{String:fb,Optional:db,Boolean:pb,Object:hb,Number:yb}=$n.Type,mb=fb.bind($n.Type),gb=yb.bind($n.Type),D$=hb.bind($n.Type),B$=db.bind($n.Type),vb=pb.bind($n.Type),M$=mb(),L$=gb(),V$=vb();function Io(e){return Array.isArray(e)?e:[e]}var bb=Ke({"../../../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}}),wb=Ke({"../../../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 p={key:l,value:u[l]},A={key:f,value:u[f]};return s(p,A)}}}(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 p=a.push(u)-1,A=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<A.length;l++){var O=A[l],T=s(u[O]);T&&(f&&(f+=","),f+=JSON.stringify(O)+":"+T)}return a.splice(p,1),"{"+f+"}"}}(r)}}}),_b=Ke({"../../../node_modules/.pnpm/safe-stable-stringify@2.4.3/node_modules/safe-stable-stringify/index.js"(e,t){"use strict";var{hasOwnProperty:r}=Object.prototype,n=W();n.configure=W,n.stringify=n,n.default=n,e.stringify=n,e.configure=W,t.exports=n;var i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function o(x){return x.length<5e3&&!i.test(x)?`"${x}"`:JSON.stringify(x)}function a(x){if(x.length>200)return x.sort();for(let P=1;P<x.length;P++){let G=x[P],q=P;for(;q!==0&&x[q-1]>G;)x[q]=x[q-1],q--;x[q]=G}return x}var s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function u(x){return s.call(x)!==void 0&&x.length!==0}function l(x,P,G){x.length<G&&(G=x.length);let q=P===","?"":" ",V=`"0":${q}${x[0]}`;for(let Q=1;Q<G;Q++)V+=`${P}"${Q}":${q}${x[Q]}`;return V}function f(x){if(r.call(x,"circularValue")){let P=x.circularValue;if(typeof P=="string")return`"${P}"`;if(P==null)return P;if(P===Error||P===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function p(x,P){let G;if(r.call(x,P)&&(G=x[P],typeof G!="boolean"))throw new TypeError(`The "${P}" argument must be of type boolean`);return G===void 0?!0:G}function A(x,P){let G;if(r.call(x,P)){if(G=x[P],typeof G!="number")throw new TypeError(`The "${P}" argument must be of type number`);if(!Number.isInteger(G))throw new TypeError(`The "${P}" argument must be an integer`);if(G<1)throw new RangeError(`The "${P}" argument must be >= 1`)}return G===void 0?1/0:G}function O(x){return x===1?"1 item":`${x} items`}function T(x){let P=new Set;for(let G of x)(typeof G=="string"||typeof G=="number")&&P.add(String(G));return P}function F(x){if(r.call(x,"strict")){let P=x.strict;if(typeof P!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(P)return G=>{let q=`Object can not safely be stringified. Received type ${typeof G}`;throw typeof G!="function"&&(q+=` (${G.toString()})`),new Error(q)}}}function W(x){x={...x};let P=F(x);P&&(x.bigint===void 0&&(x.bigint=!1),"circularValue"in x||(x.circularValue=Error));let G=f(x),q=p(x,"bigint"),V=p(x,"deterministic"),Q=A(x,"maximumDepth"),L=A(x,"maximumBreadth");function re(ne,S,H,ae,X,Z){let de=S[ne];switch(typeof de=="object"&&de!==null&&typeof de.toJSON=="function"&&(de=de.toJSON(ne)),de=ae.call(S,ne,de),typeof de){case"string":return o(de);case"object":{if(de===null)return"null";if(H.indexOf(de)!==-1)return G;let d="",_=",",$=Z;if(Array.isArray(de)){if(de.length===0)return"[]";if(Q<H.length+1)return'"[Array]"';H.push(de),X!==""&&(Z+=X,d+=`
31
+ ${Z}`,_=`,
32
+ ${Z}`);let w=Math.min(de.length,L),c=0;for(;c<w-1;c++){let b=re(String(c),de,H,ae,X,Z);d+=b!==void 0?b:"null",d+=_}let E=re(String(c),de,H,ae,X,Z);if(d+=E!==void 0?E:"null",de.length-1>L){let b=de.length-L-1;d+=`${_}"... ${O(b)} not stringified"`}return X!==""&&(d+=`
33
+ ${$}`),H.pop(),`[${d}]`}let U=Object.keys(de),C=U.length;if(C===0)return"{}";if(Q<H.length+1)return'"[Object]"';let k="",m="";X!==""&&(Z+=X,_=`,
34
+ ${Z}`,k=" ");let N=Math.min(C,L);V&&!u(de)&&(U=a(U)),H.push(de);for(let w=0;w<N;w++){let c=U[w],E=re(c,de,H,ae,X,Z);E!==void 0&&(d+=`${m}${o(c)}:${k}${E}`,m=_)}if(C>L){let w=C-L;d+=`${m}"...":${k}"${O(w)} not stringified"`,m=_}return X!==""&&m.length>1&&(d=`
35
+ ${Z}${d}
36
+ ${$}`),H.pop(),`{${d}}`}case"number":return isFinite(de)?String(de):P?P(de):"null";case"boolean":return de===!0?"true":"false";case"undefined":return;case"bigint":if(q)return String(de);default:return P?P(de):void 0}}function M(ne,S,H,ae,X,Z){switch(typeof S=="object"&&S!==null&&typeof S.toJSON=="function"&&(S=S.toJSON(ne)),typeof S){case"string":return o(S);case"object":{if(S===null)return"null";if(H.indexOf(S)!==-1)return G;let de=Z,d="",_=",";if(Array.isArray(S)){if(S.length===0)return"[]";if(Q<H.length+1)return'"[Array]"';H.push(S),X!==""&&(Z+=X,d+=`
37
+ ${Z}`,_=`,
38
+ ${Z}`);let C=Math.min(S.length,L),k=0;for(;k<C-1;k++){let N=M(String(k),S[k],H,ae,X,Z);d+=N!==void 0?N:"null",d+=_}let m=M(String(k),S[k],H,ae,X,Z);if(d+=m!==void 0?m:"null",S.length-1>L){let N=S.length-L-1;d+=`${_}"... ${O(N)} not stringified"`}return X!==""&&(d+=`
39
+ ${de}`),H.pop(),`[${d}]`}H.push(S);let $="";X!==""&&(Z+=X,_=`,
40
+ ${Z}`,$=" ");let U="";for(let C of ae){let k=M(C,S[C],H,ae,X,Z);k!==void 0&&(d+=`${U}${o(C)}:${$}${k}`,U=_)}return X!==""&&U.length>1&&(d=`
41
+ ${Z}${d}
42
+ ${de}`),H.pop(),`{${d}}`}case"number":return isFinite(S)?String(S):P?P(S):"null";case"boolean":return S===!0?"true":"false";case"undefined":return;case"bigint":if(q)return String(S);default:return P?P(S):void 0}}function B(ne,S,H,ae,X){switch(typeof S){case"string":return o(S);case"object":{if(S===null)return"null";if(typeof S.toJSON=="function"){if(S=S.toJSON(ne),typeof S!="object")return B(ne,S,H,ae,X);if(S===null)return"null"}if(H.indexOf(S)!==-1)return G;let Z=X;if(Array.isArray(S)){if(S.length===0)return"[]";if(Q<H.length+1)return'"[Array]"';H.push(S),X+=ae;let k=`
43
+ ${X}`,m=`,
44
+ ${X}`,N=Math.min(S.length,L),w=0;for(;w<N-1;w++){let E=B(String(w),S[w],H,ae,X);k+=E!==void 0?E:"null",k+=m}let c=B(String(w),S[w],H,ae,X);if(k+=c!==void 0?c:"null",S.length-1>L){let E=S.length-L-1;k+=`${m}"... ${O(E)} not stringified"`}return k+=`
45
+ ${Z}`,H.pop(),`[${k}]`}let de=Object.keys(S),d=de.length;if(d===0)return"{}";if(Q<H.length+1)return'"[Object]"';X+=ae;let _=`,
46
+ ${X}`,$="",U="",C=Math.min(d,L);u(S)&&($+=l(S,_,L),de=de.slice(S.length),C-=S.length,U=_),V&&(de=a(de)),H.push(S);for(let k=0;k<C;k++){let m=de[k],N=B(m,S[m],H,ae,X);N!==void 0&&($+=`${U}${o(m)}: ${N}`,U=_)}if(d>L){let k=d-L;$+=`${U}"...": "${O(k)} not stringified"`,U=_}return U!==""&&($=`
47
+ ${X}${$}
48
+ ${Z}`),H.pop(),`{${$}}`}case"number":return isFinite(S)?String(S):P?P(S):"null";case"boolean":return S===!0?"true":"false";case"undefined":return;case"bigint":if(q)return String(S);default:return P?P(S):void 0}}function z(ne,S,H){switch(typeof S){case"string":return o(S);case"object":{if(S===null)return"null";if(typeof S.toJSON=="function"){if(S=S.toJSON(ne),typeof S!="object")return z(ne,S,H);if(S===null)return"null"}if(H.indexOf(S)!==-1)return G;let ae="";if(Array.isArray(S)){if(S.length===0)return"[]";if(Q<H.length+1)return'"[Array]"';H.push(S);let _=Math.min(S.length,L),$=0;for(;$<_-1;$++){let C=z(String($),S[$],H);ae+=C!==void 0?C:"null",ae+=","}let U=z(String($),S[$],H);if(ae+=U!==void 0?U:"null",S.length-1>L){let C=S.length-L-1;ae+=`,"... ${O(C)} not stringified"`}return H.pop(),`[${ae}]`}let X=Object.keys(S),Z=X.length;if(Z===0)return"{}";if(Q<H.length+1)return'"[Object]"';let de="",d=Math.min(Z,L);u(S)&&(ae+=l(S,",",L),X=X.slice(S.length),d-=S.length,de=","),V&&(X=a(X)),H.push(S);for(let _=0;_<d;_++){let $=X[_],U=z($,S[$],H);U!==void 0&&(ae+=`${de}${o($)}:${U}`,de=",")}if(Z>L){let _=Z-L;ae+=`${de}"...":"${O(_)} not stringified"`}return H.pop(),`{${ae}}`}case"number":return isFinite(S)?String(S):P?P(S):"null";case"boolean":return S===!0?"true":"false";case"undefined":return;case"bigint":if(q)return String(S);default:return P?P(S):void 0}}function ie(ne,S,H){if(arguments.length>1){let ae="";if(typeof H=="number"?ae=" ".repeat(Math.min(H,10)):typeof H=="string"&&(ae=H.slice(0,10)),S!=null){if(typeof S=="function")return re("",{"":ne},[],S,ae,"");if(Array.isArray(S))return M("",ne,[],T(S),ae,"")}if(ae.length!==0)return B("",ne,[],ae,"")}return z("",ne,[])}return ie}}}),Nn=Ke({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/guard.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IsValueType=e.IsSymbol=e.IsFunction=e.IsString=e.IsBigInt=e.IsInteger=e.IsNumber=e.IsBoolean=e.IsNull=e.IsUndefined=e.IsArray=e.IsObject=e.IsPlainObject=e.HasPropertyKey=e.IsDate=e.IsUint8Array=e.IsPromise=e.IsTypedArray=e.IsIterator=e.IsAsyncIterator=void 0;function t(V){return l(V)&&Symbol.asyncIterator in V}e.IsAsyncIterator=t;function r(V){return l(V)&&Symbol.iterator in V}e.IsIterator=r;function n(V){return ArrayBuffer.isView(V)}e.IsTypedArray=n;function i(V){return V instanceof Promise}e.IsPromise=i;function o(V){return V instanceof Uint8Array}e.IsUint8Array=o;function a(V){return V instanceof Date&&Number.isFinite(V.getTime())}e.IsDate=a;function s(V,Q){return Q in V}e.HasPropertyKey=s;function u(V){return l(V)&&P(V.constructor)&&V.constructor.name==="Object"}e.IsPlainObject=u;function l(V){return V!==null&&typeof V=="object"}e.IsObject=l;function f(V){return Array.isArray(V)&&!ArrayBuffer.isView(V)}e.IsArray=f;function p(V){return V===void 0}e.IsUndefined=p;function A(V){return V===null}e.IsNull=A;function O(V){return typeof V=="boolean"}e.IsBoolean=O;function T(V){return typeof V=="number"}e.IsNumber=T;function F(V){return T(V)&&Number.isInteger(V)}e.IsInteger=F;function W(V){return typeof V=="bigint"}e.IsBigInt=W;function x(V){return typeof V=="string"}e.IsString=x;function P(V){return typeof V=="function"}e.IsFunction=P;function G(V){return typeof V=="symbol"}e.IsSymbol=G;function q(V){return W(V)||O(V)||A(V)||T(V)||x(V)||G(V)||p(V)}e.IsValueType=q}}),od=Ke({"../../../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=Nn(),r=la(),n=xr(),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 p(O,T){if(n.TypeRegistry.Has(O))throw new i(O);return n.TypeRegistry.Set(O,T),(F={})=>n.Type.Unsafe({...F,[n.Kind]:O})}f.Type=p;function A(O,T){if(n.FormatRegistry.Has(O))throw new o(O);return n.FormatRegistry.Set(O,T),O}f.Format=A})(a||(e.TypeSystem=a={}));var s;(function(f){let p=l;function A(){p=l}f.Reset=A;function O(F){p=F}f.Set=O;function T(){return p}f.Get=T})(s||(e.TypeSystemErrorFunction=s={}));var u;(function(f){f.ExactOptionalPropertyTypes=!1,f.AllowArrayObject=!1,f.AllowNaN=!1,f.AllowNullVoid=!1;function p(W,x){return f.ExactOptionalPropertyTypes?x in W:W[x]!==void 0}f.IsExactOptionalProperty=p;function A(W){let x=(0,t.IsObject)(W);return f.AllowArrayObject?x:x&&!(0,t.IsArray)(W)}f.IsObjectLike=A;function O(W){return A(W)&&!(W instanceof Date)&&!(W instanceof Uint8Array)}f.IsRecordLike=O;function T(W){let x=(0,t.IsNumber)(W);return f.AllowNaN?x:x&&Number.isFinite(W)}f.IsNumberLike=T;function F(W){let x=(0,t.IsUndefined)(W);return f.AllowNullVoid?x||W===null:x}f.IsVoidLike=F})(u||(e.TypeSystemPolicy=u={}));function l(f,p){switch(p){case r.ValueErrorType.ArrayContains:return"Expected array to contain at least one matching value";case r.ValueErrorType.ArrayMaxContains:return`Expected array to contain no more than ${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}}),ua=Ke({"../../../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=xr(),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}}),au=Ke({"../../../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=Nn(),r=class extends Error{constructor(B){super("Unable to hash value"),this.value=B}};e.ValueHashError=r;var n;(function(B){B[B.Undefined=0]="Undefined",B[B.Null=1]="Null",B[B.Boolean=2]="Boolean",B[B.Number=3]="Number",B[B.String=4]="String",B[B.Object=5]="Object",B[B.Array=6]="Array",B[B.Date=7]="Date",B[B.Uint8Array=8]="Uint8Array",B[B.Symbol=9]="Symbol",B[B.BigInt=10]="BigInt"})(n||(e.ByteMarker=n={}));var i=BigInt("14695981039346656037"),[o,a]=[BigInt("1099511628211"),BigInt("2")**BigInt("64")],s=Array.from({length:256}).map((B,z)=>BigInt(z)),u=new Float64Array(1),l=new DataView(u.buffer),f=new Uint8Array(u.buffer);function*p(B){let z=B===0?1:Math.ceil(Math.floor(Math.log2(B)+1)/8);for(let ie=0;ie<z;ie++)yield B>>8*(z-1-ie)&255}function A(B){re(n.Array);for(let z of B)L(z)}function O(B){re(n.Boolean),re(B?1:0)}function T(B){re(n.BigInt),l.setBigInt64(0,B);for(let z of f)re(z)}function F(B){re(n.Date),L(B.getTime())}function W(B){re(n.Null)}function x(B){re(n.Number),l.setFloat64(0,B);for(let z of f)re(z)}function P(B){re(n.Object);for(let z of globalThis.Object.keys(B).sort())L(z),L(B[z])}function G(B){re(n.String);for(let z=0;z<B.length;z++)for(let ie of p(B.charCodeAt(z)))re(ie)}function q(B){re(n.Symbol),L(B.description)}function V(B){re(n.Uint8Array);for(let z=0;z<B.length;z++)re(B[z])}function Q(B){return re(n.Undefined)}function L(B){if((0,t.IsArray)(B))return A(B);if((0,t.IsBoolean)(B))return O(B);if((0,t.IsBigInt)(B))return T(B);if((0,t.IsDate)(B))return F(B);if((0,t.IsNull)(B))return W(B);if((0,t.IsNumber)(B))return x(B);if((0,t.IsPlainObject)(B))return P(B);if((0,t.IsString)(B))return G(B);if((0,t.IsSymbol)(B))return q(B);if((0,t.IsUint8Array)(B))return V(B);if((0,t.IsUndefined)(B))return Q(B);throw new r(B)}function re(B){i=i^s[B],i=i*o%a}function M(B){return i=BigInt("14695981039346656037"),L(B),i}e.Hash=M}}),la=Ke({"../../../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=Nn(),r=od(),n=ua(),i=au(),o=xr(),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 p(c,E,b,v){return{type:c,schema:E,path:b,value:v,message:r.TypeSystemErrorFunction.Get()(E,c)}}function*A(c,E,b,v){}function*O(c,E,b,v){if(!(0,t.IsArray)(v))return yield p(a.Array,c,b,v);l(c.minItems)&&!(v.length>=c.minItems)&&(yield p(a.ArrayMinItems,c,b,v)),l(c.maxItems)&&!(v.length<=c.maxItems)&&(yield p(a.ArrayMaxItems,c,b,v));for(let ee=0;ee<v.length;ee++)yield*N(c.items,E,`${b}/${ee}`,v[ee]);if(c.uniqueItems===!0&&!function(){let ee=new Set;for(let oe of v){let me=(0,i.Hash)(oe);if(ee.has(me))return!1;ee.add(me)}return!0}()&&(yield p(a.ArrayUniqueItems,c,b,v)),!(l(c.contains)||l(c.minContains)||l(c.maxContains)))return;let R=l(c.contains)?c.contains:o.Type.Never(),K=v.reduce((ee,oe,me)=>N(R,E,`${b}${me}`,oe).next().done===!0?ee+1:ee,0);K===0&&(yield p(a.ArrayContains,c,b,v)),(0,t.IsNumber)(c.minContains)&&K<c.minContains&&(yield p(a.ArrayMinContains,c,b,v)),(0,t.IsNumber)(c.maxContains)&&K>c.maxContains&&(yield p(a.ArrayMaxContains,c,b,v))}function*T(c,E,b,v){(0,t.IsAsyncIterator)(v)||(yield p(a.AsyncIterator,c,b,v))}function*F(c,E,b,v){if(!(0,t.IsBigInt)(v))return yield p(a.BigInt,c,b,v);l(c.exclusiveMaximum)&&!(v<c.exclusiveMaximum)&&(yield p(a.BigIntExclusiveMaximum,c,b,v)),l(c.exclusiveMinimum)&&!(v>c.exclusiveMinimum)&&(yield p(a.BigIntExclusiveMinimum,c,b,v)),l(c.maximum)&&!(v<=c.maximum)&&(yield p(a.BigIntMaximum,c,b,v)),l(c.minimum)&&!(v>=c.minimum)&&(yield p(a.BigIntMinimum,c,b,v)),l(c.multipleOf)&&v%c.multipleOf!==BigInt(0)&&(yield p(a.BigIntMultipleOf,c,b,v))}function*W(c,E,b,v){(0,t.IsBoolean)(v)||(yield p(a.Boolean,c,b,v))}function*x(c,E,b,v){yield*N(c.returns,E,b,v.prototype)}function*P(c,E,b,v){if(!(0,t.IsDate)(v))return yield p(a.Date,c,b,v);l(c.exclusiveMaximumTimestamp)&&!(v.getTime()<c.exclusiveMaximumTimestamp)&&(yield p(a.DateExclusiveMaximumTimestamp,c,b,v)),l(c.exclusiveMinimumTimestamp)&&!(v.getTime()>c.exclusiveMinimumTimestamp)&&(yield p(a.DateExclusiveMinimumTimestamp,c,b,v)),l(c.maximumTimestamp)&&!(v.getTime()<=c.maximumTimestamp)&&(yield p(a.DateMaximumTimestamp,c,b,v)),l(c.minimumTimestamp)&&!(v.getTime()>=c.minimumTimestamp)&&(yield p(a.DateMinimumTimestamp,c,b,v)),l(c.multipleOfTimestamp)&&v.getTime()%c.multipleOfTimestamp!==0&&(yield p(a.DateMultipleOfTimestamp,c,b,v))}function*G(c,E,b,v){(0,t.IsFunction)(v)||(yield p(a.Function,c,b,v))}function*q(c,E,b,v){if(!(0,t.IsInteger)(v))return yield p(a.Integer,c,b,v);l(c.exclusiveMaximum)&&!(v<c.exclusiveMaximum)&&(yield p(a.IntegerExclusiveMaximum,c,b,v)),l(c.exclusiveMinimum)&&!(v>c.exclusiveMinimum)&&(yield p(a.IntegerExclusiveMinimum,c,b,v)),l(c.maximum)&&!(v<=c.maximum)&&(yield p(a.IntegerMaximum,c,b,v)),l(c.minimum)&&!(v>=c.minimum)&&(yield p(a.IntegerMinimum,c,b,v)),l(c.multipleOf)&&v%c.multipleOf!==0&&(yield p(a.IntegerMultipleOf,c,b,v))}function*V(c,E,b,v){for(let R of c.allOf){let K=N(R,E,b,v).next();K.done||(yield p(a.Intersect,c,b,v),yield K.value)}if(c.unevaluatedProperties===!1){let R=new RegExp(o.KeyResolver.ResolvePattern(c));for(let K of Object.getOwnPropertyNames(v))R.test(K)||(yield p(a.IntersectUnevaluatedProperties,c,`${b}/${K}`,v))}if(typeof c.unevaluatedProperties=="object"){let R=new RegExp(o.KeyResolver.ResolvePattern(c));for(let K of Object.getOwnPropertyNames(v))if(!R.test(K)){let ee=N(c.unevaluatedProperties,E,`${b}/${K}`,v[K]).next();ee.done||(yield ee.value)}}}function*Q(c,E,b,v){(0,t.IsIterator)(v)||(yield p(a.Iterator,c,b,v))}function*L(c,E,b,v){v!==c.const&&(yield p(a.Literal,c,b,v))}function*re(c,E,b,v){yield p(a.Never,c,b,v)}function*M(c,E,b,v){N(c.not,E,b,v).next().done===!0&&(yield p(a.Not,c,b,v))}function*B(c,E,b,v){(0,t.IsNull)(v)||(yield p(a.Null,c,b,v))}function*z(c,E,b,v){if(!r.TypeSystemPolicy.IsNumberLike(v))return yield p(a.Number,c,b,v);l(c.exclusiveMaximum)&&!(v<c.exclusiveMaximum)&&(yield p(a.NumberExclusiveMaximum,c,b,v)),l(c.exclusiveMinimum)&&!(v>c.exclusiveMinimum)&&(yield p(a.NumberExclusiveMinimum,c,b,v)),l(c.maximum)&&!(v<=c.maximum)&&(yield p(a.NumberMaximum,c,b,v)),l(c.minimum)&&!(v>=c.minimum)&&(yield p(a.NumberMinimum,c,b,v)),l(c.multipleOf)&&v%c.multipleOf!==0&&(yield p(a.NumberMultipleOf,c,b,v))}function*ie(c,E,b,v){if(!r.TypeSystemPolicy.IsObjectLike(v))return yield p(a.Object,c,b,v);l(c.minProperties)&&!(Object.getOwnPropertyNames(v).length>=c.minProperties)&&(yield p(a.ObjectMinProperties,c,b,v)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(v).length<=c.maxProperties)&&(yield p(a.ObjectMaxProperties,c,b,v));let R=Array.isArray(c.required)?c.required:[],K=Object.getOwnPropertyNames(c.properties),ee=Object.getOwnPropertyNames(v);for(let oe of R)ee.includes(oe)||(yield p(a.ObjectRequiredProperty,c.properties[oe],`${b}/${u(oe)}`,void 0));if(c.additionalProperties===!1)for(let oe of ee)K.includes(oe)||(yield p(a.ObjectAdditionalProperties,c,`${b}/${u(oe)}`,v[oe]));if(typeof c.additionalProperties=="object")for(let oe of ee)K.includes(oe)||(yield*N(c.additionalProperties,E,`${b}/${u(oe)}`,v[oe]));for(let oe of K){let me=c.properties[oe];c.required&&c.required.includes(oe)?(yield*N(me,E,`${b}/${u(oe)}`,v[oe]),o.ExtendsUndefined.Check(c)&&!(oe in v)&&(yield p(a.ObjectRequiredProperty,me,`${b}/${u(oe)}`,void 0))):r.TypeSystemPolicy.IsExactOptionalProperty(v,oe)&&(yield*N(me,E,`${b}/${u(oe)}`,v[oe]))}}function*ne(c,E,b,v){(0,t.IsPromise)(v)||(yield p(a.Promise,c,b,v))}function*S(c,E,b,v){if(!r.TypeSystemPolicy.IsRecordLike(v))return yield p(a.Object,c,b,v);l(c.minProperties)&&!(Object.getOwnPropertyNames(v).length>=c.minProperties)&&(yield p(a.ObjectMinProperties,c,b,v)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(v).length<=c.maxProperties)&&(yield p(a.ObjectMaxProperties,c,b,v));let[R,K]=Object.entries(c.patternProperties)[0],ee=new RegExp(R);for(let[oe,me]of Object.entries(v))ee.test(oe)&&(yield*N(K,E,`${b}/${u(oe)}`,me));if(typeof c.additionalProperties=="object")for(let[oe,me]of Object.entries(v))ee.test(oe)||(yield*N(c.additionalProperties,E,`${b}/${u(oe)}`,me));if(c.additionalProperties===!1){for(let[oe,me]of Object.entries(v))if(!ee.test(oe))return yield p(a.ObjectAdditionalProperties,c,`${b}/${u(oe)}`,me)}}function*H(c,E,b,v){yield*N((0,n.Deref)(c,E),E,b,v)}function*ae(c,E,b,v){if(!(0,t.IsString)(v))return yield p(a.String,c,b,v);l(c.minLength)&&!(v.length>=c.minLength)&&(yield p(a.StringMinLength,c,b,v)),l(c.maxLength)&&!(v.length<=c.maxLength)&&(yield p(a.StringMaxLength,c,b,v)),(0,t.IsString)(c.pattern)&&(new RegExp(c.pattern).test(v)||(yield p(a.StringPattern,c,b,v))),(0,t.IsString)(c.format)&&(o.FormatRegistry.Has(c.format)?o.FormatRegistry.Get(c.format)(v)||(yield p(a.StringFormat,c,b,v)):yield p(a.StringFormatUnknown,c,b,v))}function*X(c,E,b,v){(0,t.IsSymbol)(v)||(yield p(a.Symbol,c,b,v))}function*Z(c,E,b,v){if(!(0,t.IsString)(v))return yield p(a.String,c,b,v);new RegExp(c.pattern).test(v)||(yield p(a.StringPattern,c,b,v))}function*de(c,E,b,v){yield*N((0,n.Deref)(c,E),E,b,v)}function*d(c,E,b,v){if(!(0,t.IsArray)(v))return yield p(a.Tuple,c,b,v);if(c.items===void 0&&v.length!==0)return yield p(a.TupleLength,c,b,v);if(v.length!==c.maxItems)return yield p(a.TupleLength,c,b,v);if(c.items)for(let R=0;R<c.items.length;R++)yield*N(c.items[R],E,`${b}/${R}`,v[R])}function*_(c,E,b,v){(0,t.IsUndefined)(v)||(yield p(a.Undefined,c,b,v))}function*$(c,E,b,v){let R=0;for(let K of c.anyOf){let ee=[...N(K,E,b,v)];if(ee.length===0)return;R+=ee.length}R>0&&(yield p(a.Union,c,b,v))}function*U(c,E,b,v){if(!(0,t.IsUint8Array)(v))return yield p(a.Uint8Array,c,b,v);l(c.maxByteLength)&&!(v.length<=c.maxByteLength)&&(yield p(a.Uint8ArrayMaxByteLength,c,b,v)),l(c.minByteLength)&&!(v.length>=c.minByteLength)&&(yield p(a.Uint8ArrayMinByteLength,c,b,v))}function*C(c,E,b,v){}function*k(c,E,b,v){r.TypeSystemPolicy.IsVoidLike(v)||(yield p(a.Void,c,b,v))}function*m(c,E,b,v){o.TypeRegistry.Get(c[o.Kind])(c,v)||(yield p(a.Kind,c,b,v))}function*N(c,E,b,v){let R=l(c.$id)?[...E,c]:E,K=c;switch(K[o.Kind]){case"Any":return yield*A(K,R,b,v);case"Array":return yield*O(K,R,b,v);case"AsyncIterator":return yield*T(K,R,b,v);case"BigInt":return yield*F(K,R,b,v);case"Boolean":return yield*W(K,R,b,v);case"Constructor":return yield*x(K,R,b,v);case"Date":return yield*P(K,R,b,v);case"Function":return yield*G(K,R,b,v);case"Integer":return yield*q(K,R,b,v);case"Intersect":return yield*V(K,R,b,v);case"Iterator":return yield*Q(K,R,b,v);case"Literal":return yield*L(K,R,b,v);case"Never":return yield*re(K,R,b,v);case"Not":return yield*M(K,R,b,v);case"Null":return yield*B(K,R,b,v);case"Number":return yield*z(K,R,b,v);case"Object":return yield*ie(K,R,b,v);case"Promise":return yield*ne(K,R,b,v);case"Record":return yield*S(K,R,b,v);case"Ref":return yield*H(K,R,b,v);case"String":return yield*ae(K,R,b,v);case"Symbol":return yield*X(K,R,b,v);case"TemplateLiteral":return yield*Z(K,R,b,v);case"This":return yield*de(K,R,b,v);case"Tuple":return yield*d(K,R,b,v);case"Undefined":return yield*_(K,R,b,v);case"Union":return yield*$(K,R,b,v);case"Uint8Array":return yield*U(K,R,b,v);case"Unknown":return yield*C(K,R,b,v);case"Void":return yield*k(K,R,b,v);default:if(!o.TypeRegistry.Has(K[o.Kind]))throw new s(c);return yield*m(K,R,b,v)}}function w(...c){let E=c.length===3?N(c[0],c[1],"",c[2]):N(c[0],[],"",c[1]);return new f(E)}e.Errors=w}}),Tb=Ke({"../../../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(la(),e)}}),ad=Ke({"../../../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=la();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(od(),e)}}),Ob=Ke({"../../../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=Nn(),r=ad(),n=ua(),i=au(),o=xr(),a=class extends o.TypeBoxError{constructor(m){super("Unknown type"),this.schema=m}};e.ValueCheckUnknownTypeError=a;function s(m){return m[o.Kind]==="Any"||m[o.Kind]==="Unknown"}function u(m){return m!==void 0}function l(m,N,w){return!0}function f(m,N,w){if(!(0,t.IsArray)(w)||u(m.minItems)&&!(w.length>=m.minItems)||u(m.maxItems)&&!(w.length<=m.maxItems)||!w.every(b=>C(m.items,N,b))||m.uniqueItems===!0&&!function(){let b=new Set;for(let v of w){let R=(0,i.Hash)(v);if(b.has(R))return!1;b.add(R)}return!0}())return!1;if(!(u(m.contains)||(0,t.IsNumber)(m.minContains)||(0,t.IsNumber)(m.maxContains)))return!0;let c=u(m.contains)?m.contains:o.Type.Never(),E=w.reduce((b,v)=>C(c,N,v)?b+1:b,0);return!(E===0||(0,t.IsNumber)(m.minContains)&&E<m.minContains||(0,t.IsNumber)(m.maxContains)&&E>m.maxContains)}function p(m,N,w){return(0,t.IsAsyncIterator)(w)}function A(m,N,w){return!(!(0,t.IsBigInt)(w)||u(m.exclusiveMaximum)&&!(w<m.exclusiveMaximum)||u(m.exclusiveMinimum)&&!(w>m.exclusiveMinimum)||u(m.maximum)&&!(w<=m.maximum)||u(m.minimum)&&!(w>=m.minimum)||u(m.multipleOf)&&w%m.multipleOf!==BigInt(0))}function O(m,N,w){return(0,t.IsBoolean)(w)}function T(m,N,w){return C(m.returns,N,w.prototype)}function F(m,N,w){return!(!(0,t.IsDate)(w)||u(m.exclusiveMaximumTimestamp)&&!(w.getTime()<m.exclusiveMaximumTimestamp)||u(m.exclusiveMinimumTimestamp)&&!(w.getTime()>m.exclusiveMinimumTimestamp)||u(m.maximumTimestamp)&&!(w.getTime()<=m.maximumTimestamp)||u(m.minimumTimestamp)&&!(w.getTime()>=m.minimumTimestamp)||u(m.multipleOfTimestamp)&&w.getTime()%m.multipleOfTimestamp!==0)}function W(m,N,w){return(0,t.IsFunction)(w)}function x(m,N,w){return!(!(0,t.IsInteger)(w)||u(m.exclusiveMaximum)&&!(w<m.exclusiveMaximum)||u(m.exclusiveMinimum)&&!(w>m.exclusiveMinimum)||u(m.maximum)&&!(w<=m.maximum)||u(m.minimum)&&!(w>=m.minimum)||u(m.multipleOf)&&w%m.multipleOf!==0)}function P(m,N,w){let c=m.allOf.every(E=>C(E,N,w));if(m.unevaluatedProperties===!1){let E=new RegExp(o.KeyResolver.ResolvePattern(m)),b=Object.getOwnPropertyNames(w).every(v=>E.test(v));return c&&b}else if(o.TypeGuard.TSchema(m.unevaluatedProperties)){let E=new RegExp(o.KeyResolver.ResolvePattern(m)),b=Object.getOwnPropertyNames(w).every(v=>E.test(v)||C(m.unevaluatedProperties,N,w[v]));return c&&b}else return c}function G(m,N,w){return(0,t.IsIterator)(w)}function q(m,N,w){return w===m.const}function V(m,N,w){return!1}function Q(m,N,w){return!C(m.not,N,w)}function L(m,N,w){return(0,t.IsNull)(w)}function re(m,N,w){return!(!r.TypeSystemPolicy.IsNumberLike(w)||u(m.exclusiveMaximum)&&!(w<m.exclusiveMaximum)||u(m.exclusiveMinimum)&&!(w>m.exclusiveMinimum)||u(m.minimum)&&!(w>=m.minimum)||u(m.maximum)&&!(w<=m.maximum)||u(m.multipleOf)&&w%m.multipleOf!==0)}function M(m,N,w){if(!r.TypeSystemPolicy.IsObjectLike(w)||u(m.minProperties)&&!(Object.getOwnPropertyNames(w).length>=m.minProperties)||u(m.maxProperties)&&!(Object.getOwnPropertyNames(w).length<=m.maxProperties))return!1;let c=Object.getOwnPropertyNames(m.properties);for(let E of c){let b=m.properties[E];if(m.required&&m.required.includes(E)){if(!C(b,N,w[E])||(o.ExtendsUndefined.Check(b)||s(b))&&!(E in w))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(w,E)&&!C(b,N,w[E]))return!1}if(m.additionalProperties===!1){let E=Object.getOwnPropertyNames(w);return m.required&&m.required.length===c.length&&E.length===c.length?!0:E.every(b=>c.includes(b))}else return typeof m.additionalProperties=="object"?Object.getOwnPropertyNames(w).every(E=>c.includes(E)||C(m.additionalProperties,N,w[E])):!0}function B(m,N,w){return(0,t.IsPromise)(w)}function z(m,N,w){if(!r.TypeSystemPolicy.IsRecordLike(w)||u(m.minProperties)&&!(Object.getOwnPropertyNames(w).length>=m.minProperties)||u(m.maxProperties)&&!(Object.getOwnPropertyNames(w).length<=m.maxProperties))return!1;let[c,E]=Object.entries(m.patternProperties)[0],b=new RegExp(c),v=Object.entries(w).every(([ee,oe])=>b.test(ee)?C(E,N,oe):!0),R=typeof m.additionalProperties=="object"?Object.entries(w).every(([ee,oe])=>b.test(ee)?!0:C(m.additionalProperties,N,oe)):!0,K=m.additionalProperties===!1?Object.getOwnPropertyNames(w).every(ee=>b.test(ee)):!0;return v&&R&&K}function ie(m,N,w){return C((0,n.Deref)(m,N),N,w)}function ne(m,N,w){return!(0,t.IsString)(w)||u(m.minLength)&&!(w.length>=m.minLength)||u(m.maxLength)&&!(w.length<=m.maxLength)||u(m.pattern)&&!new RegExp(m.pattern).test(w)?!1:u(m.format)?o.FormatRegistry.Has(m.format)?o.FormatRegistry.Get(m.format)(w):!1:!0}function S(m,N,w){return(0,t.IsSymbol)(w)}function H(m,N,w){return(0,t.IsString)(w)&&new RegExp(m.pattern).test(w)}function ae(m,N,w){return C((0,n.Deref)(m,N),N,w)}function X(m,N,w){if(!(0,t.IsArray)(w)||m.items===void 0&&w.length!==0||w.length!==m.maxItems)return!1;if(!m.items)return!0;for(let c=0;c<m.items.length;c++)if(!C(m.items[c],N,w[c]))return!1;return!0}function Z(m,N,w){return(0,t.IsUndefined)(w)}function de(m,N,w){return m.anyOf.some(c=>C(c,N,w))}function d(m,N,w){return!(!(0,t.IsUint8Array)(w)||u(m.maxByteLength)&&!(w.length<=m.maxByteLength)||u(m.minByteLength)&&!(w.length>=m.minByteLength))}function _(m,N,w){return!0}function $(m,N,w){return r.TypeSystemPolicy.IsVoidLike(w)}function U(m,N,w){return o.TypeRegistry.Has(m[o.Kind])?o.TypeRegistry.Get(m[o.Kind])(m,w):!1}function C(m,N,w){let c=u(m.$id)?[...N,m]:N,E=m;switch(E[o.Kind]){case"Any":return l(E,c,w);case"Array":return f(E,c,w);case"AsyncIterator":return p(E,c,w);case"BigInt":return A(E,c,w);case"Boolean":return O(E,c,w);case"Constructor":return T(E,c,w);case"Date":return F(E,c,w);case"Function":return W(E,c,w);case"Integer":return x(E,c,w);case"Intersect":return P(E,c,w);case"Iterator":return G(E,c,w);case"Literal":return q(E,c,w);case"Never":return V(E,c,w);case"Not":return Q(E,c,w);case"Null":return L(E,c,w);case"Number":return re(E,c,w);case"Object":return M(E,c,w);case"Promise":return B(E,c,w);case"Record":return z(E,c,w);case"Ref":return ie(E,c,w);case"String":return ne(E,c,w);case"Symbol":return S(E,c,w);case"TemplateLiteral":return H(E,c,w);case"This":return ae(E,c,w);case"Tuple":return X(E,c,w);case"Undefined":return Z(E,c,w);case"Union":return de(E,c,w);case"Uint8Array":return d(E,c,w);case"Unknown":return _(E,c,w);case"Void":return $(E,c,w);default:if(!o.TypeRegistry.Has(E[o.Kind]))throw new a(E);return U(E,c,w)}}function k(...m){return m.length===3?C(m[0],m[1],m[2]):C(m[0],[],m[1])}e.Check=k}}),xb=Ke({"../../../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=Nn(),r=ua(),n=Ob(),i=xr(),o=class extends i.TypeBoxError{constructor(A,O,T){super("Unable to decode due to invalid value"),this.schema=A,this.value=O,this.error=T}};e.TransformDecodeCheckError=o;var a=class extends i.TypeBoxError{constructor(A,O,T){super("Unable to encode due to invalid value"),this.schema=A,this.value=O,this.error=T}};e.TransformEncodeCheckError=a;var s=class extends i.TypeBoxError{constructor(A,O,T){super(`${T instanceof Error?T.message:"Unknown error"}`),this.schema=A,this.value=O}};e.TransformDecodeError=s;var u=class extends i.TypeBoxError{constructor(A,O,T){super(`${T instanceof Error?T.message:"Unknown error"}`),this.schema=A,this.value=O}};e.TransformEncodeError=u;var l;(function(A){function O(S,H){return i.TypeGuard.TTransform(S)||z(S.items,H)}function T(S,H){return i.TypeGuard.TTransform(S)||z(S.items,H)}function F(S,H){return i.TypeGuard.TTransform(S)||z(S.returns,H)||S.parameters.some(ae=>z(ae,H))}function W(S,H){return i.TypeGuard.TTransform(S)||z(S.returns,H)||S.parameters.some(ae=>z(ae,H))}function x(S,H){return i.TypeGuard.TTransform(S)||i.TypeGuard.TTransform(S.unevaluatedProperties)||S.allOf.some(ae=>z(ae,H))}function P(S,H){return i.TypeGuard.TTransform(S)||z(S.items,H)}function G(S,H){return i.TypeGuard.TTransform(S)||z(S.not,H)}function q(S,H){return i.TypeGuard.TTransform(S)||Object.values(S.properties).some(ae=>z(ae,H))||i.TypeGuard.TSchema(S.additionalProperties)&&z(S.additionalProperties,H)}function V(S,H){return i.TypeGuard.TTransform(S)||z(S.item,H)}function Q(S,H){let ae=Object.getOwnPropertyNames(S.patternProperties)[0],X=S.patternProperties[ae];return i.TypeGuard.TTransform(S)||z(X,H)||i.TypeGuard.TSchema(S.additionalProperties)&&i.TypeGuard.TTransform(S.additionalProperties)}function L(S,H){return i.TypeGuard.TTransform(S)?!0:z((0,r.Deref)(S,H),H)}function re(S,H){return i.TypeGuard.TTransform(S)?!0:z((0,r.Deref)(S,H),H)}function M(S,H){return i.TypeGuard.TTransform(S)||!(0,t.IsUndefined)(S.items)&&S.items.some(ae=>z(ae,H))}function B(S,H){return i.TypeGuard.TTransform(S)||S.anyOf.some(ae=>z(ae,H))}function z(S,H){let ae=(0,t.IsString)(S.$id)?[...H,S]:H,X=S;if(S.$id&&ie.has(S.$id))return!1;switch(S.$id&&ie.add(S.$id),S[i.Kind]){case"Array":return O(X,ae);case"AsyncIterator":return T(X,ae);case"Constructor":return F(X,ae);case"Function":return W(X,ae);case"Intersect":return x(X,ae);case"Iterator":return P(X,ae);case"Not":return G(X,ae);case"Object":return q(X,ae);case"Promise":return V(X,ae);case"Record":return Q(X,ae);case"Ref":return L(X,ae);case"This":return re(X,ae);case"Tuple":return M(X,ae);case"Union":return B(X,ae);default:return i.TypeGuard.TTransform(S)}}let ie=new Set;function ne(S,H){return ie.clear(),z(S,H)}A.Has=ne})(l||(e.HasTransform=l={}));var f;(function(A){function O(M,B){try{return i.TypeGuard.TTransform(M)?M[i.Transform].Decode(B):B}catch(z){throw new s(M,B,z)}}function T(M,B,z){return(0,t.IsArray)(z)?O(M,z.map(ie=>L(M.items,B,ie))):O(M,z)}function F(M,B,z){if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return O(M,z);let ie=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),ne=ie.reduce((X,Z)=>Z in X?{...X,[Z]:L(i.IndexedAccessor.Resolve(M,[Z]),B,X[Z])}:X,z);if(!i.TypeGuard.TTransform(M.unevaluatedProperties))return O(M,ne);let S=Object.getOwnPropertyNames(ne),H=M.unevaluatedProperties,ae=S.reduce((X,Z)=>ie.includes(Z)?X:{...X,[Z]:O(H,X[Z])},ne);return O(M,ae)}function W(M,B,z){return O(M,L(M.not,B,z))}function x(M,B,z){if(!(0,t.IsPlainObject)(z))return O(M,z);let ie=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),ne=ie.reduce((X,Z)=>Z in X?{...X,[Z]:L(M.properties[Z],B,X[Z])}:X,z);if(!i.TypeGuard.TSchema(M.additionalProperties))return O(M,ne);let S=Object.getOwnPropertyNames(ne),H=M.additionalProperties,ae=S.reduce((X,Z)=>ie.includes(Z)?X:{...X,[Z]:O(H,X[Z])},ne);return O(M,ae)}function P(M,B,z){if(!(0,t.IsPlainObject)(z))return O(M,z);let ie=Object.getOwnPropertyNames(M.patternProperties)[0],ne=new RegExp(ie),S=Object.getOwnPropertyNames(z).reduce((Z,de)=>ne.test(de)?{...Z,[de]:L(M.patternProperties[ie],B,Z[de])}:Z,z);if(!i.TypeGuard.TSchema(M.additionalProperties))return O(M,S);let H=Object.getOwnPropertyNames(S),ae=M.additionalProperties,X=H.reduce((Z,de)=>ne.test(de)?Z:{...Z,[de]:O(ae,Z[de])},S);return O(M,X)}function G(M,B,z){let ie=(0,r.Deref)(M,B);return O(M,L(ie,B,z))}function q(M,B,z){let ie=(0,r.Deref)(M,B);return O(M,L(ie,B,z))}function V(M,B,z){return(0,t.IsArray)(z)&&(0,t.IsArray)(M.items)?O(M,M.items.map((ie,ne)=>L(ie,B,z[ne]))):O(M,z)}function Q(M,B,z){let ie=O(M,z);for(let ne of M.anyOf)if((0,n.Check)(ne,B,ie))return L(ne,B,ie);return ie}function L(M,B,z){let ie=typeof M.$id=="string"?[...B,M]:B,ne=M;switch(M[i.Kind]){case"Array":return T(ne,ie,z);case"Intersect":return F(ne,ie,z);case"Not":return W(ne,ie,z);case"Object":return x(ne,ie,z);case"Record":return P(ne,ie,z);case"Ref":return G(ne,ie,z);case"Symbol":return O(ne,z);case"This":return q(ne,ie,z);case"Tuple":return V(ne,ie,z);case"Union":return Q(ne,ie,z);default:return O(ne,z)}}function re(M,B,z){return L(M,B,z)}A.Decode=re})(f||(e.DecodeTransform=f={}));var p;(function(A){function O(M,B){try{return i.TypeGuard.TTransform(M)?M[i.Transform].Encode(B):B}catch(z){throw new u(M,B,z)}}function T(M,B,z){let ie=O(M,z);return(0,t.IsArray)(ie)?ie.map(ne=>L(M.items,B,ne)):ie}function F(M,B,z){let ie=O(M,z);if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return ie;let ne=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),S=ne.reduce((X,Z)=>Z in ie?{...X,[Z]:L(i.IndexedAccessor.Resolve(M,[Z]),B,X[Z])}:X,ie);if(!i.TypeGuard.TTransform(M.unevaluatedProperties))return O(M,S);let H=Object.getOwnPropertyNames(S),ae=M.unevaluatedProperties;return H.reduce((X,Z)=>ne.includes(Z)?X:{...X,[Z]:O(ae,X[Z])},S)}function W(M,B,z){return O(M.not,O(M,z))}function x(M,B,z){let ie=O(M,z);if(!(0,t.IsPlainObject)(z))return ie;let ne=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),S=ne.reduce((X,Z)=>Z in X?{...X,[Z]:L(M.properties[Z],B,X[Z])}:X,ie);if(!i.TypeGuard.TSchema(M.additionalProperties))return S;let H=Object.getOwnPropertyNames(S),ae=M.additionalProperties;return H.reduce((X,Z)=>ne.includes(Z)?X:{...X,[Z]:O(ae,X[Z])},S)}function P(M,B,z){let ie=O(M,z);if(!(0,t.IsPlainObject)(z))return ie;let ne=Object.getOwnPropertyNames(M.patternProperties)[0],S=new RegExp(ne),H=Object.getOwnPropertyNames(z).reduce((Z,de)=>S.test(de)?{...Z,[de]:L(M.patternProperties[ne],B,Z[de])}:Z,ie);if(!i.TypeGuard.TSchema(M.additionalProperties))return O(M,H);let ae=Object.getOwnPropertyNames(H),X=M.additionalProperties;return ae.reduce((Z,de)=>S.test(de)?Z:{...Z,[de]:O(X,Z[de])},H)}function G(M,B,z){let ie=(0,r.Deref)(M,B),ne=L(ie,B,z);return O(M,ne)}function q(M,B,z){let ie=(0,r.Deref)(M,B),ne=L(ie,B,z);return O(M,ne)}function V(M,B,z){let ie=O(M,z);return(0,t.IsArray)(M.items)?M.items.map((ne,S)=>L(ne,B,ie[S])):[]}function Q(M,B,z){for(let ie of M.anyOf){if(!(0,n.Check)(ie,B,z))continue;let ne=L(ie,B,z);return O(M,ne)}for(let ie of M.anyOf){let ne=L(ie,B,z);if((0,n.Check)(M,B,ne))return O(M,ne)}return O(M,z)}function L(M,B,z){let ie=typeof M.$id=="string"?[...B,M]:B,ne=M;switch(M[i.Kind]){case"Array":return T(ne,ie,z);case"Intersect":return F(ne,ie,z);case"Not":return W(ne,ie,z);case"Object":return x(ne,ie,z);case"Record":return P(ne,ie,z);case"Ref":return G(ne,ie,z);case"This":return q(ne,ie,z);case"Tuple":return V(ne,ie,z);case"Union":return Q(ne,ie,z);default:return O(ne,z)}}function re(M,B,z){return L(M,B,z)}A.Encode=re})(p||(e.EncodeTransform=p={}))}}),Eb=Ke({"../../../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=xb(),r=Nn(),n=la(),i=ad(),o=ua(),a=au(),s=xr(),u=class{constructor(x,P,G,q){this.schema=x,this.references=P,this.checkFunc=G,this.code=q,this.hasTransform=t.HasTransform.Has(x,P)}Code(){return this.code}Errors(x){return(0,n.Errors)(this.schema,this.references,x)}Check(x){return this.checkFunc(x)}Decode(x){if(!this.checkFunc(x))throw new t.TransformDecodeCheckError(this.schema,x,this.Errors(x).First());return this.hasTransform?t.DecodeTransform.Decode(this.schema,this.references,x):x}Encode(x){let P=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,x):x;if(!this.checkFunc(P))throw new t.TransformEncodeCheckError(this.schema,x,this.Errors(x).First());return P}};e.TypeCheck=u;var l;(function(x){function P(Q){return Q===36}x.DollarSign=P;function G(Q){return Q===95}x.IsUnderscore=G;function q(Q){return Q>=65&&Q<=90||Q>=97&&Q<=122}x.IsAlpha=q;function V(Q){return Q>=48&&Q<=57}x.IsNumeric=V})(l||(l={}));var f;(function(x){function P(Q){return Q.length===0?!1:l.IsNumeric(Q.charCodeAt(0))}function G(Q){if(P(Q))return!1;for(let L=0;L<Q.length;L++){let re=Q.charCodeAt(L);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 V(Q,L){return G(L)?`${Q}.${L}`:`${Q}['${q(L)}']`}x.Encode=V})(f||(f={}));var p;(function(x){function P(G){let q=[];for(let V=0;V<G.length;V++){let Q=G.charCodeAt(V);l.IsNumeric(Q)||l.IsAlpha(Q)?q.push(G.charAt(V)):q.push(`_${Q}_`)}return q.join("").replace(/__/g,"_")}x.Encode=P})(p||(p={}));var A;(function(x){function P(G){return G.replace(/'/g,"\\'")}x.Escape=P})(A||(A={}));var O=class extends s.TypeBoxError{constructor(x){super("Unknown type"),this.schema=x}};e.TypeCompilerUnknownTypeError=O;var T=class extends s.TypeBoxError{constructor(x){super("Preflight validation check failed to guard for the given schema"),this.schema=x}};e.TypeCompilerTypeGuardError=T;var F;(function(x){function P(L,re,M){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${re}' in ${L} ? ${M} : true)`:`(${f.Encode(L,re)} !== undefined ? ${M} : true)`}x.IsExactOptionalProperty=P;function G(L){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${L} === 'object' && ${L} !== null)`:`(typeof ${L} === 'object' && ${L} !== null && !Array.isArray(${L}))`}x.IsObjectLike=G;function q(L){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${L} === 'object' && ${L} !== null && !(${L} instanceof Date) && !(${L} instanceof Uint8Array))`:`(typeof ${L} === 'object' && ${L} !== null && !Array.isArray(${L}) && !(${L} instanceof Date) && !(${L} instanceof Uint8Array))`}x.IsRecordLike=q;function V(L){return i.TypeSystemPolicy.AllowNaN?`typeof ${L} === 'number'`:`(typeof ${L} === 'number' && Number.isFinite(${L}))`}x.IsNumberLike=V;function Q(L){return i.TypeSystemPolicy.AllowNullVoid?`(${L} === undefined || ${L} === null)`:`${L} === undefined`}x.IsVoidLike=Q})(F||(e.Policy=F={}));var W;(function(x){function P(I){return I[s.Kind]==="Any"||I[s.Kind]==="Unknown"}function*G(I,fe,j){yield"true"}function*q(I,fe,j){yield`Array.isArray(${j})`;let[ve,se]=[Be("value","any"),Be("acc","number")];(0,r.IsNumber)(I.maxItems)&&(yield`${j}.length <= ${I.maxItems}`),(0,r.IsNumber)(I.minItems)&&(yield`${j}.length >= ${I.minItems}`);let pe=oe(I.items,fe,"value");if(yield`${j}.every((${ve}) => ${pe})`,s.TypeGuard.TSchema(I.contains)||(0,r.IsNumber)(I.minContains)||(0,r.IsNumber)(I.maxContains)){let Ae=s.TypeGuard.TSchema(I.contains)?I.contains:s.Type.Never(),Me=oe(Ae,fe,"value"),nt=(0,r.IsNumber)(I.minContains)?[`(count >= ${I.minContains})`]:[],Ye=(0,r.IsNumber)(I.maxContains)?[`(count <= ${I.maxContains})`]:[],ot=`const count = value.reduce((${se}, ${ve}) => ${Me} ? acc + 1 : acc, 0)`,sr=["(count > 0)",...nt,...Ye].join(" && ");yield`((${ve}) => { ${ot}; return ${sr}})(${j})`}I.uniqueItems===!0&&(yield`((${ve}) => { 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 } )(${j})`)}function*V(I,fe,j){yield`(typeof value === 'object' && Symbol.asyncIterator in ${j})`}function*Q(I,fe,j){yield`(typeof ${j} === 'bigint')`,(0,r.IsBigInt)(I.exclusiveMaximum)&&(yield`${j} < BigInt(${I.exclusiveMaximum})`),(0,r.IsBigInt)(I.exclusiveMinimum)&&(yield`${j} > BigInt(${I.exclusiveMinimum})`),(0,r.IsBigInt)(I.maximum)&&(yield`${j} <= BigInt(${I.maximum})`),(0,r.IsBigInt)(I.minimum)&&(yield`${j} >= BigInt(${I.minimum})`),(0,r.IsBigInt)(I.multipleOf)&&(yield`(${j} % BigInt(${I.multipleOf})) === 0`)}function*L(I,fe,j){yield`(typeof ${j} === 'boolean')`}function*re(I,fe,j){yield*K(I.returns,fe,`${j}.prototype`)}function*M(I,fe,j){yield`(${j} instanceof Date) && Number.isFinite(${j}.getTime())`,(0,r.IsNumber)(I.exclusiveMaximumTimestamp)&&(yield`${j}.getTime() < ${I.exclusiveMaximumTimestamp}`),(0,r.IsNumber)(I.exclusiveMinimumTimestamp)&&(yield`${j}.getTime() > ${I.exclusiveMinimumTimestamp}`),(0,r.IsNumber)(I.maximumTimestamp)&&(yield`${j}.getTime() <= ${I.maximumTimestamp}`),(0,r.IsNumber)(I.minimumTimestamp)&&(yield`${j}.getTime() >= ${I.minimumTimestamp}`),(0,r.IsNumber)(I.multipleOfTimestamp)&&(yield`(${j}.getTime() % ${I.multipleOfTimestamp}) === 0`)}function*B(I,fe,j){yield`(typeof ${j} === 'function')`}function*z(I,fe,j){yield`(typeof ${j} === 'number' && Number.isInteger(${j}))`,(0,r.IsNumber)(I.exclusiveMaximum)&&(yield`${j} < ${I.exclusiveMaximum}`),(0,r.IsNumber)(I.exclusiveMinimum)&&(yield`${j} > ${I.exclusiveMinimum}`),(0,r.IsNumber)(I.maximum)&&(yield`${j} <= ${I.maximum}`),(0,r.IsNumber)(I.minimum)&&(yield`${j} >= ${I.minimum}`),(0,r.IsNumber)(I.multipleOf)&&(yield`(${j} % ${I.multipleOf}) === 0`)}function*ie(I,fe,j){let ve=I.allOf.map(se=>oe(se,fe,j)).join(" && ");if(I.unevaluatedProperties===!1){let se=we(`${new RegExp(s.KeyResolver.ResolvePattern(I))};`),pe=`Object.getOwnPropertyNames(${j}).every(key => ${se}.test(key))`;yield`(${ve} && ${pe})`}else if(s.TypeGuard.TSchema(I.unevaluatedProperties)){let se=we(`${new RegExp(s.KeyResolver.ResolvePattern(I))};`),pe=`Object.getOwnPropertyNames(${j}).every(key => ${se}.test(key) || ${oe(I.unevaluatedProperties,fe,`${j}[key]`)})`;yield`(${ve} && ${pe})`}else yield`(${ve})`}function*ne(I,fe,j){yield`(typeof value === 'object' && Symbol.iterator in ${j})`}function*S(I,fe,j){typeof I.const=="number"||typeof I.const=="boolean"?yield`(${j} === ${I.const})`:yield`(${j} === '${A.Escape(I.const)}')`}function*H(I,fe,j){yield"false"}function*ae(I,fe,j){yield`(!${oe(I.not,fe,j)})`}function*X(I,fe,j){yield`(${j} === null)`}function*Z(I,fe,j){yield F.IsNumberLike(j),(0,r.IsNumber)(I.exclusiveMaximum)&&(yield`${j} < ${I.exclusiveMaximum}`),(0,r.IsNumber)(I.exclusiveMinimum)&&(yield`${j} > ${I.exclusiveMinimum}`),(0,r.IsNumber)(I.maximum)&&(yield`${j} <= ${I.maximum}`),(0,r.IsNumber)(I.minimum)&&(yield`${j} >= ${I.minimum}`),(0,r.IsNumber)(I.multipleOf)&&(yield`(${j} % ${I.multipleOf}) === 0`)}function*de(I,fe,j){yield F.IsObjectLike(j),(0,r.IsNumber)(I.minProperties)&&(yield`Object.getOwnPropertyNames(${j}).length >= ${I.minProperties}`),(0,r.IsNumber)(I.maxProperties)&&(yield`Object.getOwnPropertyNames(${j}).length <= ${I.maxProperties}`);let ve=Object.getOwnPropertyNames(I.properties);for(let se of ve){let pe=f.Encode(j,se),Ae=I.properties[se];if(I.required&&I.required.includes(se))yield*K(Ae,fe,pe),(s.ExtendsUndefined.Check(Ae)||P(Ae))&&(yield`('${se}' in ${j})`);else{let Me=oe(Ae,fe,pe);yield F.IsExactOptionalProperty(j,se,Me)}}if(I.additionalProperties===!1)if(I.required&&I.required.length===ve.length)yield`Object.getOwnPropertyNames(${j}).length === ${ve.length}`;else{let se=`[${ve.map(pe=>`'${pe}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${j}).every(key => ${se}.includes(key))`}if(typeof I.additionalProperties=="object"){let se=oe(I.additionalProperties,fe,`${j}[key]`),pe=`[${ve.map(Ae=>`'${Ae}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${j}).every(key => ${pe}.includes(key) || ${se}))`}}function*d(I,fe,j){yield`(typeof value === 'object' && typeof ${j}.then === 'function')`}function*_(I,fe,j){yield F.IsRecordLike(j),(0,r.IsNumber)(I.minProperties)&&(yield`Object.getOwnPropertyNames(${j}).length >= ${I.minProperties}`),(0,r.IsNumber)(I.maxProperties)&&(yield`Object.getOwnPropertyNames(${j}).length <= ${I.maxProperties}`);let[ve,se]=Object.entries(I.patternProperties)[0],pe=we(`${new RegExp(ve)}`),Ae=oe(se,fe,"value"),Me=s.TypeGuard.TSchema(I.additionalProperties)?oe(I.additionalProperties,fe,j):I.additionalProperties===!1?"false":"true",nt=`(${pe}.test(key) ? ${Ae} : ${Me})`;yield`(Object.entries(${j}).every(([key, value]) => ${nt}))`}function*$(I,fe,j){let ve=(0,o.Deref)(I,fe);if(ee.functions.has(I.$ref))return yield`${me(I.$ref)}(${j})`;yield*K(ve,fe,j)}function*U(I,fe,j){yield`(typeof ${j} === 'string')`,(0,r.IsNumber)(I.maxLength)&&(yield`${j}.length <= ${I.maxLength}`),(0,r.IsNumber)(I.minLength)&&(yield`${j}.length >= ${I.minLength}`),I.pattern!==void 0&&(yield`${we(`${new RegExp(I.pattern)};`)}.test(${j})`),I.format!==void 0&&(yield`format('${I.format}', ${j})`)}function*C(I,fe,j){yield`(typeof ${j} === 'symbol')`}function*k(I,fe,j){yield`(typeof ${j} === 'string')`,yield`${we(`${new RegExp(I.pattern)};`)}.test(${j})`}function*m(I,fe,j){yield`${me(I.$ref)}(${j})`}function*N(I,fe,j){if(yield`Array.isArray(${j})`,I.items===void 0)return yield`${j}.length === 0`;yield`(${j}.length === ${I.maxItems})`;for(let ve=0;ve<I.items.length;ve++)yield`${oe(I.items[ve],fe,`${j}[${ve}]`)}`}function*w(I,fe,j){yield`${j} === undefined`}function*c(I,fe,j){yield`(${I.anyOf.map(ve=>oe(ve,fe,j)).join(" || ")})`}function*E(I,fe,j){yield`${j} instanceof Uint8Array`,(0,r.IsNumber)(I.maxByteLength)&&(yield`(${j}.length <= ${I.maxByteLength})`),(0,r.IsNumber)(I.minByteLength)&&(yield`(${j}.length >= ${I.minByteLength})`)}function*b(I,fe,j){yield"true"}function*v(I,fe,j){yield F.IsVoidLike(j)}function*R(I,fe,j){let ve=ee.instances.size;ee.instances.set(ve,I),yield`kind('${I[s.Kind]}', ${ve}, ${j})`}function*K(I,fe,j,ve=!0){let se=(0,r.IsString)(I.$id)?[...fe,I]:fe,pe=I;if(ve&&(0,r.IsString)(I.$id)){let Ae=me(I.$id);if(ee.functions.has(Ae))return yield`${Ae}(${j})`;{let Me=Pe(Ae,I,fe,"value",!1);return ee.functions.set(Ae,Me),yield`${Ae}(${j})`}}switch(pe[s.Kind]){case"Any":return yield*G(pe,se,j);case"Array":return yield*q(pe,se,j);case"AsyncIterator":return yield*V(pe,se,j);case"BigInt":return yield*Q(pe,se,j);case"Boolean":return yield*L(pe,se,j);case"Constructor":return yield*re(pe,se,j);case"Date":return yield*M(pe,se,j);case"Function":return yield*B(pe,se,j);case"Integer":return yield*z(pe,se,j);case"Intersect":return yield*ie(pe,se,j);case"Iterator":return yield*ne(pe,se,j);case"Literal":return yield*S(pe,se,j);case"Never":return yield*H(pe,se,j);case"Not":return yield*ae(pe,se,j);case"Null":return yield*X(pe,se,j);case"Number":return yield*Z(pe,se,j);case"Object":return yield*de(pe,se,j);case"Promise":return yield*d(pe,se,j);case"Record":return yield*_(pe,se,j);case"Ref":return yield*$(pe,se,j);case"String":return yield*U(pe,se,j);case"Symbol":return yield*C(pe,se,j);case"TemplateLiteral":return yield*k(pe,se,j);case"This":return yield*m(pe,se,j);case"Tuple":return yield*N(pe,se,j);case"Undefined":return yield*w(pe,se,j);case"Union":return yield*c(pe,se,j);case"Uint8Array":return yield*E(pe,se,j);case"Unknown":return yield*b(pe,se,j);case"Void":return yield*v(pe,se,j);default:if(!s.TypeRegistry.Has(pe[s.Kind]))throw new O(I);return yield*R(pe,se,j)}}let ee={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function oe(I,fe,j,ve=!0){return`(${[...K(I,fe,j,ve)].join(" && ")})`}function me(I){return`check_${p.Encode(I)}`}function we(I){let fe=`local_${ee.variables.size}`;return ee.variables.set(fe,`const ${fe} = ${I}`),fe}function Pe(I,fe,j,ve,se=!0){let[pe,Ae]=[`
49
+ `,ot=>"".padStart(ot," ")],Me=Be("value","any"),nt=Er("boolean"),Ye=[...K(fe,j,ve,se)].map(ot=>`${Ae(4)}${ot}`).join(` &&${pe}`);return`function ${I}(${Me})${nt} {${pe}${Ae(2)}return (${pe}${Ye}${pe}${Ae(2)})
50
+ }`}function Be(I,fe){let j=ee.language==="typescript"?`: ${fe}`:"";return`${I}${j}`}function Er(I){return ee.language==="typescript"?`: ${I}`:""}function be(I,fe,j){let ve=Pe("check",I,fe,"value"),se=Be("value","any"),pe=Er("boolean"),Ae=[...ee.functions.values()],Me=[...ee.variables.values()],nt=(0,r.IsString)(I.$id)?`return function check(${se})${pe} {
51
+ return ${me(I.$id)}(value)
52
+ }`:`return ${ve}`;return[...Me,...Ae,nt].join(`
53
+ `)}function ar(...I){let fe={language:"javascript"},[j,ve,se]=I.length===2&&(0,r.IsArray)(I[1])?[I[0],I[1],fe]:I.length===2&&!(0,r.IsArray)(I[1])?[I[0],[],I[1]]:I.length===3?[I[0],I[1],I[2]]:I.length===1?[I[0],[],fe]:[null,[],fe];if(ee.language=se.language,ee.variables.clear(),ee.functions.clear(),ee.instances.clear(),!s.TypeGuard.TSchema(j))throw new T(j);for(let pe of ve)if(!s.TypeGuard.TSchema(pe))throw new T(pe);return be(j,ve,se)}x.Code=ar;function Ir(I,fe=[]){let j=ar(I,fe,{language:"javascript"}),ve=globalThis.Function("kind","format","hash",j),se=new Map(ee.instances);function pe(Ye,ot,sr){if(!s.TypeRegistry.Has(Ye)||!se.has(ot))return!1;let rn=s.TypeRegistry.Get(Ye),nn=se.get(ot);return rn(nn,sr)}function Ae(Ye,ot){return s.FormatRegistry.Has(Ye)?s.FormatRegistry.Get(Ye)(ot):!1}function Me(Ye){return(0,a.Hash)(Ye)}let nt=ve(pe,Ae,Me);return new u(I,fe,nt,j)}x.Compile=Ir})(W||(e.TypeCompiler=W={}))}}),Ib=Ke({"../../../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=Tb();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return n.ValueErrorIterator}}),r(Eb(),e)}}),So=ir(bb(),1),Sb=ir(wb(),1),sd=!1,ud=!1;So.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(sd=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(ud=process?.env?.LOGGER_PERF_PREFIX==="true"));var Ab={prefix:void 0,time:sd,delta:ud,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},Da=[],ld=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(",")}]`}},cd=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Xn=!1,$e=class at{static ERROR=2;static WARN=4;static INFO=6;static LOG=6;static DEBUG=8;static VERBOSE=10;static firstLog=0;static lastLog=0;static setup(t=at.INFO,r={}){r=Object.assign({},Ab,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(...A){let O=A[A.length-1];return O===i?O():(o(...A.slice(0,-1)),(async()=>{try{let T=O();return T instanceof Promise?await T:T}finally{console.groupEnd()}})())}let p=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:l});return u?p:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:p})},s=a(t>=at.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(s(...u),new Error((0,Sb.default)(u))),WARN:a(t>=at.WARN,this.wrapLog(console.warn,r)),LOG:a(t>=at.INFO,this.wrapLog(console.log,r)),DEBUG:a(t>=at.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:a(t>=at.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(So.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=So.isBrowser&&navigator.userAgent.includes("Chrome")?["",at.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(Xn?n.push(new cd("dim",r.prefix)):n.push(r.prefix)),t.bind(console,...n)}}static timeStr(t,r,n=0){if(!performance.now)return;let i=performance.now();at.firstLog||(at.firstLog=i,at.lastLog=i);let o=new ld(i-at.firstLog,i-at.lastLog,t,r);return at.lastLog=i,n?o.toString():o}static getOriginFromStack(t){let r=!1;for(let n of t.split(`
54
+ `)){let i=n.match(/^\s+at\s+(.*)/);if(i){if(r)return i[1].trim().replace(__dirname,"");r=!0}}}};So.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(Da&&Da.length){for(let t of Da)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof ld))return null;Xn||(Xn=!0);let t=$e.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof cd?(Xn||(Xn=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var fd=ir(_b(),1),z$=fd.default.configure,di=fd.default,Ba=100,{WARN:$b,LOG:F$,DEBUG:Ge,VERBOSE:Te,ERROR:G$}=$e.setup($e.INFO),Ao=Re.set();Rv({enforceActions:"always"});if(!new class{xyz}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");var Ve=({caller:e,thread:t,pattern:r,args:n})=>Ue(()=>(n=n||r,`${!Array.isArray(t)&&t?.name?t.name+" | ":""}${e??"caller?"}${n?`{${typeof n=="string"?n:di(n)}}`:""}`));function Nb(e,t){return Ue(()=>He.structural(e.get(),t.get()))}function Pi(e,t){return He.shallow(e.applogs,t.applogs)}function su(e,t){if(e.size!==t.size)return!1;for(let r=0;r<e.size;r++){let n=e.nodes[r],i=t.nodes[r];if(Te.isEnabled&&Te("queryNodesComparer",r,n,i),!He.structural(n.variables,i.variables))return Te.isEnabled&&Te("[queryNodesComparer] changed vars:",r,n,i),!1;if(!Pi(n.logsOfThisNode,i.logsOfThisNode))return Te.isEnabled&&Te("[queryNodesComparer] changed logsOfThisNode:",r,n,i),!1}return Te.isEnabled&&Te("[queryNodesComparer] equal:",{a:e,b:t}),!0}var jb=0;function zt(e,{name:t,equals:r}={}){let n=`observableArrayMap@${++jb}{${t}}`;Te.isEnabled&&Te(`[${n}] create`,{fnname:e.name,fn:e,name:t,equals:r});let i,o=dd(e,s=>{i?Ue(()=>(r??He.structural)(i,s))?Ge.isEnabled&&Ge(`[${n}] update skipped`,{updatedItems:s,observableArr:i}):(i.replace(s),Ge.isEnabled&&Ge(`[${n}] updated`,{updatedItems:s,observableArr:i})):i=Re.array(s,{deep:!1,name:t,equals:r})},{name:n});if(n.includes("useRoots")){var a=Dt(i);Ge(`[${n}] deps`,{disposeAutorun:o,rootsAtom:a,observableArr:i,observers:To(i)}),li(()=>Ao.add(a))}return Te.isEnabled&&aa(i,()=>{Te(`[${n}] observed`,To(i),{rootsAtom:a,observableArr:i})}),En(i,()=>{Te.isEnabled&&Te(`[${n}] dispose`),a&&li(()=>Ao.delete(a)),o()}),i}var Cb=0;function Pb(e,{name:t}={}){let r=`observableSetMap@${++Cb}{${t}}`;Te.isEnabled&&Te(`[${r}] create`,{fnname:e.name,fn:e,name:t});let n,i=dd(e,a=>{if(!n)n=Re.set(a,{deep:!1,name:t});else{let{deleted:s,added:u}=Ue(()=>{let l=new Set(n.values()),f=new Set;for(let p of a)n.has(p)?(Te.isEnabled&&Te(`[${r}] unchanged`,p,{updatedItems:a,observableSet:n}),l.delete(p)):f.add(p);return Ge.isEnabled&&Ge(`[${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=Dt(n);Ge.isEnabled&&Ge(`[${r}] deps`,{disposeAutorun:i,rootsAtom:o,observableSet:n,observers:To(n)}),li(()=>Ao.add(o))}return Te.isEnabled&&aa(n,()=>{Te(`[${r}] observed`,To(n),{rootsAtom:o,observableSet:n})}),En(n,()=>{Te.isEnabled&&Te(`[${r}] dispose`),o&&li(()=>Ao.delete(o)),i()}),n}function dd(e,t=null,{name:r}={}){Ge.isEnabled&&Ge("[autorunButAlsoImmediately] create",{fnname:e.name,fn:e,name:r});let n=`${r}.autorunImm`,i,o=new si(n,function(...s){Ge.isEnabled&&Ge(`[${n}] reaction.invalidate`,s),a()});function a(){o.track(function(){let s=Ba&&performance.now();Ge.isEnabled&&Ge(`[${n}] runAndTrack:`,{name:r??e.name,fn:e}),i=e(),Ge.isEnabled&&Ge(`[${n}] runAndTrack =>`,i),li(()=>{t?.(i)}),Ba&&performance.now()-s>Ba&&$b(`[${n}] took ${performance.now()-s}ms`)})}return a(),Ge.isEnabled&&Ge(`[${n}] deps of reaction`,{reaction:o,result:i,deps:sa(o)}),()=>{Te.isEnabled&&Te(`[${n}] dispose`),setTimeout(()=>o.dispose())}}function We(e,t,r=!1){if(xn(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=Ue(()=>s),f=`computedFnDeepCompare(${e||t.name}#${++i})${o.argsDebugName?`{${o.argsDebugName(...s)}}`:""}`;for(let[O,T]of a.entries())if(He.structural(O,l)){u=T;break}if(u){let O=u.get();return Te.isEnabled&&Te(`[${f}] cache hit`,{untrackedArgs:l,cachedResult:O}),O}if(!o.keepAlive&&!cv())return!n&&yv().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);Te.isEnabled&&Te(`[${f}] new computation`,{untrackedArgs:l});let p,A=Le(()=>(Te.isEnabled&&Te(`[${f}] update->rerun`,Ue(()=>({args:s})),t),Te.isEnabled&&Kf(),p=t.apply(this,s)),{...o,name:f});if(Te.isEnabled&&Te(`[${f}] deps`,sa(A),{untrackedArgs:l}),a.set(l,A),!o.keepAlive){let O=En(A,()=>{Te.isEnabled&&Te(`[${f}] dispose`,A),O(),a.delete(l),o.onCleanup&&o.onCleanup(p,...s),p=void 0})}return A.get()}}function kb(e){let t=0,r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("?r+=o+`
55
+ `+" ".repeat(++t):o===")"?r+=`
56
+ `+" ".repeat(--t)+o:o===","&&n===0?r+=o+`
57
+ `+" ".repeat(t):o==="{"&&n===0?(n++,r+=o+`
58
+ `+" ".repeat(t+1)):o==="}"&&n===1?(n--,r+=`
59
+ `+" ".repeat(t)+o):o==="{"&&n>0?(n++,r+=o):(o==="}"&&n>1&&n--,r+=o)}return r}var{WARN:Il,LOG:K$,DEBUG:Ub,VERBOSE:q$,ERROR:Nr}=$e.setup($e.INFO,{prefix:"[thread]"});function _r(e){return e.init!==void 0}var uu=class{constructor(e,t,r,n=[],i={}){this.name=e,this._applogs=n,this.parents=t===null?null:Io(t),this.filters=r,Ue(()=>this.parents?.length===0)&&Il("[Thread] empty parents array",e),i.skipObservable||In(this,{applogsCids:Le,applogsByCid:Le,insert:Tt,size:Le,isEmpty:Le,firstLog:Le,latestLog:Le},{name:`Thread{${e}}`})}filters;parents;_subscribers=[];get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}insert(e){if(this.readOnly)throw Nr("[Thread] insert() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw Nr("[Thread] insert() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw Nr("[Thread] insert() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insert(e)}insertRaw(e){if(this.readOnly)throw Nr("[Thread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw Nr("[Thread] insertRaw() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw Nr("[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):Il("unsubscribe called for non-existent",e)}notifySubscribers(e){Ub(`[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 Nr("[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 Ue(()=>this.size)}get nameAndSizeUntracked(){return Ue(()=>`${this.name} (${this.size})`)}get prettyName(){return kb(this.name)}get hasParents(){return!!this.parents?.length}},Rb=class pd extends uu{static fromArray(t,r){return new pd(r||"static",null,[],t)}constructor(t,r,n,i){super(t,r,n,i,{skipObservable:!0})}get readOnly(){return!0}},Db={};id(Db,{code:()=>kd,decode:()=>Tu,encode:()=>_u,format:()=>Rl,name:()=>Fw,parse:()=>Kw,stringify:()=>Rl});var Bb=["string","number","bigint","symbol"],Mb=["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 Lb(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return Bb.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":Vb(e)?"Buffer":zb(e)||"Object"}function Vb(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function zb(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Mb.includes(t))return t}var D=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}};D.uint=new D(0,"uint",!0);D.negint=new D(1,"negint",!0);D.bytes=new D(2,"bytes",!0);D.string=new D(3,"string",!0);D.array=new D(4,"array",!1);D.map=new D(5,"map",!1);D.tag=new D(6,"tag",!1);D.float=new D(7,"float",!0);D.false=new D(7,"false",!0);D.true=new D(7,"true",!0);D.null=new D(7,"null",!0);D.undefined=new D(7,"undefined",!0);D.break=new D(7,"break",!0);var te=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}`}},jn=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Fb=new TextDecoder,Gb=new TextEncoder;function $o(e){return jn&&globalThis.Buffer.isBuffer(e)}function lu(e){return e instanceof Uint8Array?$o(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Kb=jn?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Al(e,t,r):(e,t,r)=>r-t>64?Fb.decode(e.subarray(t,r)):Al(e,t,r),hd=jn?e=>e.length>64?globalThis.Buffer.from(e):Sl(e):e=>e.length>64?Gb.encode(e):Sl(e),cu=jn?(e,t,r)=>$o(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),qb=jn?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),lu(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},Hb=jn?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Wb(e,t){if($o(e)&&$o(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 Sl(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 Al(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 yd(n)}var $l=4096;function yd(e){let t=e.length;if(t<=$l)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=$l));return r}var Jb=256,md=class{constructor(e=Jb){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=Hb(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=cu(r,0,this.cursor)}else t=qb(this.chunks,this.cursor);return e&&this.reset(),t}},ye="CBOR decode error:",kr="CBOR encode error:",ki=[];ki[23]=1;ki[24]=2;ki[25]=3;ki[26]=5;ki[27]=9;function Cn(e,t,r){if(e.length-t<r)throw new Error(`${ye} not enough data for type`)}var Qe=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Jr(e,t,r){Cn(e,t,1);let n=e[t];if(r.strict===!0&&n<Qe[0])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);return n}function Qr(e,t,r){Cn(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<Qe[1])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);return n}function Xr(e,t,r){Cn(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<Qe[2])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);return n}function Yr(e,t,r){Cn(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<Qe[3])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${ye} integers outside of the safe integer range are not supported`)}function Qb(e,t,r,n){return new te(D.uint,Jr(e,t+1,n),2)}function Xb(e,t,r,n){return new te(D.uint,Qr(e,t+1,n),3)}function Yb(e,t,r,n){return new te(D.uint,Xr(e,t+1,n),5)}function Zb(e,t,r,n){return new te(D.uint,Yr(e,t+1,n),9)}function Zr(e,t){return At(e,0,t.value)}function At(e,t,r){if(r<Qe[0]){let n=Number(r);e.push([t|n])}else if(r<Qe[1]){let n=Number(r);e.push([t|24,n])}else if(r<Qe[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<Qe[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<Qe[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),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(`${ye} encountered BigInt larger than allowable range`)}}Zr.encodedSize=function(e){return At.encodedSize(e.value)};At.encodedSize=function(e){return e<Qe[0]?1:e<Qe[1]?2:e<Qe[2]?3:e<Qe[3]?5:9};Zr.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function e0(e,t,r,n){return new te(D.negint,-1-Jr(e,t+1,n),2)}function t0(e,t,r,n){return new te(D.negint,-1-Qr(e,t+1,n),3)}function r0(e,t,r,n){return new te(D.negint,-1-Xr(e,t+1,n),5)}var fu=BigInt(-1),gd=BigInt(1);function n0(e,t,r,n){let i=Yr(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new te(D.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${ye} integers outside of the safe integer range are not supported`);return new te(D.negint,fu-BigInt(i),9)}function du(e,t){let r=t.value,n=typeof r=="bigint"?r*fu-gd:r*-1-1;At(e,t.type.majorEncoded,n)}du.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*fu-gd:t*-1-1;return r<Qe[0]?1:r<Qe[1]?2:r<Qe[2]?3:r<Qe[3]?5:9};du.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Ui(e,t,r,n){Cn(e,t,r+n);let i=cu(e,t+r,t+r+n);return new te(D.bytes,i,r+n)}function i0(e,t,r,n){return Ui(e,t,1,r)}function o0(e,t,r,n){return Ui(e,t,2,Jr(e,t+1,n))}function a0(e,t,r,n){return Ui(e,t,3,Qr(e,t+1,n))}function s0(e,t,r,n){return Ui(e,t,5,Xr(e,t+1,n))}function u0(e,t,r,n){let i=Yr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer bytes lengths not supported`);return Ui(e,t,9,i)}function No(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===D.string?hd(e.value):e.value),e.encodedBytes}function ca(e,t){let r=No(t);At(e,t.type.majorEncoded,r.length),e.push(r)}ca.encodedSize=function(e){let t=No(e);return At.encodedSize(t.length)+t.length};ca.compareTokens=function(e,t){return l0(No(e),No(t))};function l0(e,t){return e.length<t.length?-1:e.length>t.length?1:Wb(e,t)}function Ri(e,t,r,n,i){let o=r+n;Cn(e,t,o);let a=new te(D.string,Kb(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=cu(e,t+r,t+o)),a}function c0(e,t,r,n){return Ri(e,t,1,r,n)}function f0(e,t,r,n){return Ri(e,t,2,Jr(e,t+1,n),n)}function d0(e,t,r,n){return Ri(e,t,3,Qr(e,t+1,n),n)}function p0(e,t,r,n){return Ri(e,t,5,Xr(e,t+1,n),n)}function h0(e,t,r,n){let i=Yr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer string lengths not supported`);return Ri(e,t,9,i,n)}var y0=ca;function Pn(e,t,r,n){return new te(D.array,n,r)}function m0(e,t,r,n){return Pn(e,t,1,r)}function g0(e,t,r,n){return Pn(e,t,2,Jr(e,t+1,n))}function v0(e,t,r,n){return Pn(e,t,3,Qr(e,t+1,n))}function b0(e,t,r,n){return Pn(e,t,5,Xr(e,t+1,n))}function w0(e,t,r,n){let i=Yr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer array lengths not supported`);return Pn(e,t,9,i)}function _0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ye} indefinite length items not allowed`);return Pn(e,t,1,1/0)}function pu(e,t){At(e,D.array.majorEncoded,t.value)}pu.compareTokens=Zr.compareTokens;pu.encodedSize=function(e){return At.encodedSize(e.value)};function kn(e,t,r,n){return new te(D.map,n,r)}function T0(e,t,r,n){return kn(e,t,1,r)}function O0(e,t,r,n){return kn(e,t,2,Jr(e,t+1,n))}function x0(e,t,r,n){return kn(e,t,3,Qr(e,t+1,n))}function E0(e,t,r,n){return kn(e,t,5,Xr(e,t+1,n))}function I0(e,t,r,n){let i=Yr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer map lengths not supported`);return kn(e,t,9,i)}function S0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ye} indefinite length items not allowed`);return kn(e,t,1,1/0)}function hu(e,t){At(e,D.map.majorEncoded,t.value)}hu.compareTokens=Zr.compareTokens;hu.encodedSize=function(e){return At.encodedSize(e.value)};function A0(e,t,r,n){return new te(D.tag,r,1)}function $0(e,t,r,n){return new te(D.tag,Jr(e,t+1,n),2)}function N0(e,t,r,n){return new te(D.tag,Qr(e,t+1,n),3)}function j0(e,t,r,n){return new te(D.tag,Xr(e,t+1,n),5)}function C0(e,t,r,n){return new te(D.tag,Yr(e,t+1,n),9)}function yu(e,t){At(e,D.tag.majorEncoded,t.value)}yu.compareTokens=Zr.compareTokens;yu.encodedSize=function(e){return At.encodedSize(e.value)};var P0=20,k0=21,U0=22,R0=23;function D0(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${ye} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new te(D.null,null,1):new te(D.undefined,void 0,1)}function B0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ye} indefinite length items not allowed`);return new te(D.break,void 0,1)}function mu(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${ye} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${ye} Infinity values are not supported`)}return new te(D.float,e,t)}function M0(e,t,r,n){return mu(vu(e,t+1),3,n)}function L0(e,t,r,n){return mu(bu(e,t+1),5,n)}function V0(e,t,r,n){return mu(_d(e,t+1),9,n)}function gu(e,t,r){let n=t.value;if(n===!1)e.push([D.float.majorEncoded|P0]);else if(n===!0)e.push([D.float.majorEncoded|k0]);else if(n===null)e.push([D.float.majorEncoded|U0]);else if(n===void 0)e.push([D.float.majorEncoded|R0]);else{let i,o=!1;(!r||r.float64!==!0)&&(bd(n),i=vu(jt,1),n===i||Number.isNaN(n)?(jt[0]=249,e.push(jt.slice(0,3)),o=!0):(wd(n),i=bu(jt,1),n===i&&(jt[0]=250,e.push(jt.slice(0,5)),o=!0))),o||(z0(n),i=_d(jt,1),jt[0]=251,e.push(jt.slice(0,9)))}}gu.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){bd(r);let n=vu(jt,1);if(r===n||Number.isNaN(r))return 3;if(wd(r),n=bu(jt,1),r===n)return 5}return 9};var vd=new ArrayBuffer(9),mt=new DataView(vd,1),jt=new Uint8Array(vd,0);function bd(e){if(e===1/0)mt.setUint16(0,31744,!1);else if(e===-1/0)mt.setUint16(0,64512,!1);else if(Number.isNaN(e))mt.setUint16(0,32256,!1);else{mt.setFloat32(0,e);let t=mt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)mt.setUint16(0,31744,!1);else if(r===0)mt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?mt.setUint16(0,0):i<-14?mt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):mt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function vu(e,t){if(e.length-t<2)throw new Error(`${ye} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function wd(e){mt.setFloat32(0,e,!1)}function bu(e,t){if(e.length-t<4)throw new Error(`${ye} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function z0(e){mt.setFloat64(0,e,!1)}function _d(e,t){if(e.length-t<8)throw new Error(`${ye} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}gu.compareTokens=Zr.compareTokens;function Se(e,t,r){throw new Error(`${ye} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function fa(e){return()=>{throw new Error(`${ye} ${e}`)}}var le=[];for(let e=0;e<=23;e++)le[e]=Se;le[24]=Qb;le[25]=Xb;le[26]=Yb;le[27]=Zb;le[28]=Se;le[29]=Se;le[30]=Se;le[31]=Se;for(let e=32;e<=55;e++)le[e]=Se;le[56]=e0;le[57]=t0;le[58]=r0;le[59]=n0;le[60]=Se;le[61]=Se;le[62]=Se;le[63]=Se;for(let e=64;e<=87;e++)le[e]=i0;le[88]=o0;le[89]=a0;le[90]=s0;le[91]=u0;le[92]=Se;le[93]=Se;le[94]=Se;le[95]=fa("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)le[e]=c0;le[120]=f0;le[121]=d0;le[122]=p0;le[123]=h0;le[124]=Se;le[125]=Se;le[126]=Se;le[127]=fa("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)le[e]=m0;le[152]=g0;le[153]=v0;le[154]=b0;le[155]=w0;le[156]=Se;le[157]=Se;le[158]=Se;le[159]=_0;for(let e=160;e<=183;e++)le[e]=T0;le[184]=O0;le[185]=x0;le[186]=E0;le[187]=I0;le[188]=Se;le[189]=Se;le[190]=Se;le[191]=S0;for(let e=192;e<=215;e++)le[e]=A0;le[216]=$0;le[217]=N0;le[218]=j0;le[219]=C0;le[220]=Se;le[221]=Se;le[222]=Se;le[223]=Se;for(let e=224;e<=243;e++)le[e]=fa("simple values are not supported");le[244]=Se;le[245]=Se;le[246]=Se;le[247]=D0;le[248]=fa("simple values are not supported");le[249]=M0;le[250]=L0;le[251]=V0;le[252]=Se;le[253]=Se;le[254]=Se;le[255]=B0;var Wt=[];for(let e=0;e<24;e++)Wt[e]=new te(D.uint,e,1);for(let e=-1;e>=-24;e--)Wt[31-e]=new te(D.negint,e,1);Wt[64]=new te(D.bytes,new Uint8Array(0),1);Wt[96]=new te(D.string,"",1);Wt[128]=new te(D.array,0,1);Wt[160]=new te(D.map,0,1);Wt[244]=new te(D.false,!1,1);Wt[245]=new te(D.true,!0,1);Wt[246]=new te(D.null,null,1);function Td(){let e=[];return e[D.uint.major]=Zr,e[D.negint.major]=du,e[D.bytes.major]=ca,e[D.string.major]=y0,e[D.array.major]=pu,e[D.map.major]=hu,e[D.tag.major]=yu,e[D.float.major]=gu,e}var H$=Td(),Ma=new md,Nl=class Od{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(`${kr} object contains circular references`);return new Od(r,t)}},lr={null:new te(D.null,null),undefined:new te(D.undefined,void 0),true:new te(D.true,!0),false:new te(D.false,!1),emptyArray:new te(D.array,0),emptyMap:new te(D.map,0)},Tr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new te(D.float,e):e>=0?new te(D.uint,e):new te(D.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new te(D.uint,e):new te(D.negint,e)},Uint8Array(e,t,r,n){return new te(D.bytes,e)},string(e,t,r,n){return new te(D.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 te(D.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new te(D.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[lr.emptyArray,new te(D.break)]:lr.emptyArray;n=Nl.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=eo(a,r,n);return r.addBreakTokens?[new te(D.array,e.length),i,new te(D.break)]:[new te(D.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 te(D.break)]:lr.emptyMap;n=Nl.createCheck(n,e);let s=[],u=0;for(let l of o)s[u++]=[eo(l,r,n),eo(i?e.get(l):e[l],r,n)];return F0(s,r),r.addBreakTokens?[new te(D.map,a),s,new te(D.break)]:[new te(D.map,a),s]}};Tr.Map=Tr.Object;Tr.Buffer=Tr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Tr[`${e}Array`]=Tr.DataView;function eo(e,t={},r){let n=Lb(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Tr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=Tr[n];if(!o)throw new Error(`${kr} unsupported type: ${n}`);return o(e,n,t,r)}function F0(e,t){t.mapSorter&&e.sort(t.mapSorter)}function xd(e,t,r,n){if(Array.isArray(t))for(let i of t)xd(e,i,r,n);else r[t.type.major](e,t,n)}function G0(e,t,r){let n=eo(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 md(a);if(o(s,n,r),s.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return lu(s.chunks[0])}}return Ma.reset(),xd(Ma,n,t,r),Ma.toBytes(!0)}var K0={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},q0=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=Wt[e];if(t===void 0){let r=le[e];if(!r)throw new Error(`${ye} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let n=e&31;t=r(this.data,this._pos,n,this.options)}return this._pos+=t.encodedLength,t}},pi=Symbol.for("DONE"),da=Symbol.for("BREAK");function H0(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=hi(t,r);if(o===da){if(e.value===1/0)break;throw new Error(`${ye} got unexpected break to lengthed array`)}if(o===pi)throw new Error(`${ye} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function W0(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=hi(t,r);if(s===da){if(e.value===1/0)break;throw new Error(`${ye} got unexpected break to lengthed map`)}if(s===pi)throw new Error(`${ye} found map but not enough entries (got ${a} [no key], expected ${e.value})`);if(n!==!0&&typeof s!="string")throw new Error(`${ye} non-string keys not supported (got ${typeof s})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(s)||!n&&s in i))throw new Error(`${ye} found repeat map key "${s}"`);let u=hi(t,r);if(u===pi)throw new Error(`${ye} 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 hi(e,t){if(e.done())return pi;let r=e.next();if(r.type===D.break)return da;if(r.type.terminal)return r.value;if(r.type===D.array)return H0(r,e,t);if(r.type===D.map)return W0(r,e,t);if(r.type===D.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=hi(e,t);return t.tags[r.value](n)}throw new Error(`${ye} tag not supported (${r.value})`)}throw new Error("unsupported")}function J0(e,t){if(!(e instanceof Uint8Array))throw new Error(`${ye} data to decode must be a Uint8Array`);t=Object.assign({},K0,t);let r=t.tokenizer||new q0(e,t),n=hi(r,t);if(n===pi)throw new Error(`${ye} did not find any content to decode`);if(n===da)throw new Error(`${ye} got unexpected break`);return[n,e.subarray(r.pos())]}function Q0(e,t){let[r,n]=J0(e,t);if(n.length>0)throw new Error(`${ye} too many terminals, data makes no sense`);return r}var X0=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(t.type===D.array&&(t.elements++,t.elements!==1&&e.push([44])),t.type===D.map&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[D.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)}[D.negint.major](e,t){this[D.uint.major](e,t)}[D.bytes.major](e,t){throw new Error(`${kr} unsupported type: Uint8Array`)}[D.string.major](e,t){this.prefix(e);let r=hd(JSON.stringify(t.value));e.push(r.length>32?lu(r):r)}[D.array.major](e,t){this.prefix(e),this.inRecursive.push({type:D.array,elements:0}),e.push([91])}[D.map.major](e,t){this.prefix(e),this.inRecursive.push({type:D.map,elements:0}),e.push([123])}[D.tag.major](e,t){}[D.float.major](e,t){if(t.type.name==="break"){let o=this.inRecursive.pop();if(o){if(o.type===D.array)e.push([93]);else if(o.type===D.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(`${kr} 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 Y0(e,t){if(Array.isArray(e[0])||Array.isArray(t[0]))throw new Error(`${kr} complex map keys are not supported`);let r=e[0],n=t[0];if(r.type!==D.string||n.type!==D.string)throw new Error(`${kr} non-string map keys are not supported`);if(r<n)return-1;if(r>n)return 1;throw new Error(`${kr} unexpected duplicate map keys, this is not supported`)}var Z0={addBreakTokens:!0,mapSorter:Y0};function ew(e,t){return t=Object.assign({},Z0,t),G0(e,new X0,t)}var Ed=class{constructor(e,t={}){this._pos=0,this.data=e,this.options=t,this.modeStack=["value"],this.lastToken=""}pos(){return this._pos}done(){return this._pos>=this.data.length}ch(){return this.data[this._pos]}currentMode(){return this.modeStack[this.modeStack.length-1]}skipWhitespace(){let e=this.ch();for(;e===32||e===9||e===13||e===10;)e=this.data[++this._pos]}expect(e){if(this.data.length-this._pos<e.length)throw new Error(`${ye} unexpected end of input at position ${this._pos}`);for(let t=0;t<e.length;t++)if(this.data[this._pos++]!==e[t])throw new Error(`${ye} unexpected token at position ${this._pos}, expected to find '${String.fromCharCode(...e)}'`)}parseNumber(){let e=this._pos,t=!1,r=!1,n=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 te(D.uint,0,this._pos-e);if(n([48,49,50,51,52,53,54,55,56,57]),t&&this._pos===e+1)throw new Error(`${ye} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(r)throw new Error(`${ye} unexpected token at position ${this._pos}`);r=!0,this._pos++,n([48,49,50,51,52,53,54,55,56,57])}!this.done()&&(this.ch()===101||this.ch()===69)&&(r=!0,this._pos++,!this.done()&&(this.ch()===43||this.ch()===45)&&this._pos++,n([48,49,50,51,52,53,54,55,56,57]));let i=String.fromCharCode.apply(null,this.data.subarray(e,this._pos)),o=parseFloat(i);return r?new te(D.float,o,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(o)?new te(o>=0?D.uint:D.negint,o,this._pos-e):new te(o>=0?D.uint:D.negint,BigInt(i),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${ye} unexpected character at position ${this._pos}; this shouldn't happen`);this._pos++;for(let i=this._pos,o=0;i<this.data.length&&o<65536;i++,o++){let 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 te(D.string,s,o)}}let e=this._pos,t=[],r=()=>{if(this._pos+4>=this.data.length)throw new Error(`${ye} unexpected end of unicode escape sequence at position ${this._pos}`);let i=0;for(let o=0;o<4;o++){let 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(`${ye} 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(`${ye} 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(`${ye} unexpected string termination at position ${this._pos}`);switch(o=this.ch(),this._pos++,o){case 34:case 39:case 92:case 47:t.push(o);break;case 98:t.push(8);break;case 116:t.push(9);break;case 110:t.push(10);break;case 102:t.push(12);break;case 114:t.push(13);break;case 117:t.push(r());break;default:throw new Error(`${ye} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new te(D.string,yd(t),this._pos-e);default:if(i<32)throw new Error(`${ye} invalid control character at position ${this._pos}`);i<128?(t.push(i),this._pos++):n()}}throw new Error(`${ye} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new te(D.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new te(D.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new te(D.null,null,4);case 102:return this.expect([102,97,108,115,101]),new te(D.false,!1,5);case 116:return this.expect([116,114,117,101]),new te(D.true,!0,4);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.parseNumber();default:throw new Error(`${ye} unexpected character at position ${this._pos}`)}}next(){switch(this.skipWhitespace(),this.currentMode()){case"value":return this.modeStack.pop(),this.parseValue();case"array-value":{if(this.modeStack.pop(),this.ch()===93)return this._pos++,this.skipWhitespace(),new te(D.break,void 0,1);if(this.ch()!==44)throw new Error(`${ye} unexpected character at position ${this._pos}, was expecting array delimiter but found '${String.fromCharCode(this.ch())}'`);return this._pos++,this.modeStack.push("array-value"),this.skipWhitespace(),this.parseValue()}case"array-start":return this.modeStack.pop(),this.ch()===93?(this._pos++,this.skipWhitespace(),new te(D.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 te(D.break,void 0,1);if(this.ch()!==44)throw new Error(`${ye} unexpected character at position ${this._pos}, was expecting object delimiter but found '${String.fromCharCode(this.ch())}'`);this._pos++,this.skipWhitespace();case"obj-start":{if(this.modeStack.pop(),this.ch()===125)return this._pos++,this.skipWhitespace(),new te(D.break,void 0,1);let e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${ye} unexpected character at position ${this._pos}, was expecting key/value delimiter ':' but found '${String.fromCharCode(this.ch())}'`);return this._pos++,this.modeStack.push("obj-value"),e}case"obj-value":return this.modeStack.pop(),this.modeStack.push("obj-key"),this.skipWhitespace(),this.parseValue();default:throw new Error(`${ye} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}};function tw(e,t){return t=Object.assign({tokenizer:new Ed(e,t)},t),Q0(e,t)}var W$=new Uint8Array(0);function rw(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 wu(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 nw(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 p(T){if(T instanceof Uint8Array||(ArrayBuffer.isView(T)?T=new Uint8Array(T.buffer,T.byteOffset,T.byteLength):Array.isArray(T)&&(T=Uint8Array.from(T))),!(T instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(T.length===0)return"";for(var F=0,W=0,x=0,P=T.length;x!==P&&T[x]===0;)x++,F++;for(var G=(P-x)*f+1>>>0,q=new Uint8Array(G);x!==P;){for(var V=T[x],Q=0,L=G-1;(V!==0||Q<W)&&L!==-1;L--,Q++)V+=256*q[L]>>>0,q[L]=V%s>>>0,V=V/s>>>0;if(V!==0)throw new Error("Non-zero carry");W=Q,x++}for(var re=G-W;re!==G&&q[re]===0;)re++;for(var M=u.repeat(F);re<G;++re)M+=e.charAt(q[re]);return M}function A(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return new Uint8Array;var F=0;if(T[F]!==" "){for(var W=0,x=0;T[F]===u;)W++,F++;for(var P=(T.length-F)*l+1>>>0,G=new Uint8Array(P);T[F];){var q=r[T.charCodeAt(F)];if(q===255)return;for(var V=0,Q=P-1;(q!==0||V<x)&&Q!==-1;Q--,V++)q+=s*G[Q]>>>0,G[Q]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");x=V,F++}if(T[F]!==" "){for(var L=P-x;L!==P&&G[L]===0;)L++;for(var re=new Uint8Array(W+(P-L)),M=W;L!==P;)re[M++]=G[L++];return re}}}function O(T){var F=A(T);if(F)return F;throw new Error(`Non-${t} character`)}return{encode:p,decodeUnsafe:A,decode:O}}var iw=nw,ow=iw,aw=ow,sw=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")}},uw=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 Id(this,e)}},lw=class{decoders;constructor(e){this.decoders=e}or(e){return Id(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 Id(e,t){return new lw({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var cw=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 sw(e,t,r),this.decoder=new uw(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Sd({name:e,prefix:t,encode:r,decode:n}){return new cw(e,t,r,n)}function pa({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=aw(r,e);return Sd({prefix:t,name:e,encode:n,decode:o=>wu(i(o))})}function fw(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 p=i[e[f]];if(p===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|p,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 dw(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 dt({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return Sd({prefix:t,name:e,encode(i){return dw(i,n,r)},decode(i){return fw(i,n,r,e)}})}var to=dt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),J$=dt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Q$=dt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),X$=dt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Y$=dt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Z$=dt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),eN=dt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),tN=dt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),rN=dt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),hr=pa({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),nN=pa({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Ad={};id(Ad,{Digest:()=>ha,create:()=>ko,decode:()=>Nd,equals:()=>jd});var pw=$d,jl=128,hw=127,yw=~hw,mw=Math.pow(2,31);function $d(e,t,r){t=t||[],r=r||0;for(var n=r;e>=mw;)t[r++]=e&255|jl,e/=128;for(;e&yw;)t[r++]=e&255|jl,e>>>=7;return t[r]=e|0,$d.bytes=r-n+1,t}var gw=ys,vw=128,Cl=127;function ys(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw ys.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Cl)<<i:(a&Cl)*Math.pow(2,i),i+=7}while(a>=vw);return ys.bytes=o-n,r}var bw=Math.pow(2,7),ww=Math.pow(2,14),_w=Math.pow(2,21),Tw=Math.pow(2,28),Ow=Math.pow(2,35),xw=Math.pow(2,42),Ew=Math.pow(2,49),Iw=Math.pow(2,56),Sw=Math.pow(2,63),Aw=function(e){return e<bw?1:e<ww?2:e<_w?3:e<Tw?4:e<Ow?5:e<xw?6:e<Ew?7:e<Iw?8:e<Sw?9:10},$w={encode:pw,decode:gw,encodingLength:Aw},Nw=$w,jo=Nw;function ms(e,t=0){return[jo.decode(e,t),jo.decode.bytes]}function Co(e,t,r=0){return jo.encode(e,t,r),t}function Po(e){return jo.encodingLength(e)}function ko(e,t){let r=t.byteLength,n=Po(e),i=n+Po(r),o=new Uint8Array(i+r);return Co(e,o,0),Co(r,o,n),o.set(t,i),new ha(e,r,t,o)}function Nd(e){let t=wu(e),[r,n]=ms(t),[i,o]=ms(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new ha(r,i,a,t)}function jd(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&rw(e.bytes,r.bytes)}}var ha=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Pl(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return Cw(r,gs(e),t??hr.encoder);default:return Pw(r,gs(e),t??to.encoder)}}var kl=new WeakMap;function gs(e){let t=kl.get(e);if(t==null){let r=new Map;return kl.set(e,r),r}return t}var Ut=class tt{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==Kn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==kw)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return tt.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=ko(t,r);return tt.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return tt.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&jd(t.multihash,n.multihash)}toString(t){return Pl(this,t)}toJSON(){return{"/":Pl(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof tt)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new tt(n,i,o,a??Ul(n,i,o.bytes))}else if(r[Uw]===!0){let{version:n,multihash:i,code:o}=r,a=Nd(i);return tt.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!==Kn)throw new Error(`Version 0 CID must use dag-pb (code: ${Kn}) block encoding`);return new tt(t,r,n,n.bytes)}case 1:{let i=Ul(t,r,n.bytes);return new tt(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return tt.create(0,Kn,t)}static createV1(t,r){return tt.create(1,t,r)}static decode(t){let[r,n]=tt.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=tt.inspectBytes(t),n=r.size-r.multihashSize,i=wu(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 ha(r.multihashCode,r.digestSize,o,i);return[r.version===0?tt.createV0(a):tt.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[p,A]=ms(t.subarray(r));return r+=A,p},i=n(),o=Kn;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]=jw(t,r),o=tt.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return gs(o).set(n,t),o}};function jw(e,t){switch(e[0]){case"Q":{let r=t??hr;return[hr.prefix,r.decode(`${hr.prefix}${e}`)]}case hr.prefix:{let r=t??hr;return[hr.prefix,r.decode(e)]}case to.prefix:{let r=t??to;return[to.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 Cw(e,t,r){let{prefix:n}=r;if(n!==hr.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 Pw(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 Kn=112,kw=18;function Ul(e,t,r){let n=Po(e),i=n+Po(t),o=new Uint8Array(i+r.byteLength);return Co(e,o,0),Co(t,o,n),o.set(r,i),o}var Uw=Symbol.for("@ipld/js-cid/CID");function Cd({name:e,code:t,encode:r}){return new Rw(e,t,r)}var Rw=class{name;code;encode;constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?ko(this.code,t):t.then(r=>ko(this.code,r))}else throw Error("Unknown type, must be binary type")}},Pd=dt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),iN=dt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),oN=dt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),aN=dt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function Dw(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Ut.asCID(e);if(!t)return null;let r=t.toString();return[new te(D.map,1/0,1),new te(D.string,"/",1),new te(D.string,r,r.length),new te(D.break,void 0,1)]}function Uo(e){let t=Pd.encode(e).slice(1);return[new te(D.map,1/0,1),new te(D.string,"/",1),new te(D.map,1/0,1),new te(D.string,"bytes",5),new te(D.string,t,t.length),new te(D.break,void 0,1),new te(D.break,void 0,1)]}function $t(e){return Uo(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function Bw(e){return Uo(new Uint8Array(e))}function Mw(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Lw(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 Vw={typeEncoders:{Object:Dw,Buffer:Uo,Uint8Array:Uo,Int8Array:$t,Uint16Array:$t,Int16Array:$t,Uint32Array:$t,Int32Array:$t,Float32Array:$t,Float64Array:$t,Uint8ClampedArray:$t,BigInt64Array:$t,BigUint64Array:$t,DataView:$t,ArrayBuffer:Bw,undefined:Mw,number:Lw}},zw=class extends Ed{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===D.map){let t=this._next();if(t.type===D.string&&t.value==="/"){let r=this._next();if(r.type===D.string){if(this._next().type!==D.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new te(D.tag,42,0)}if(r.type===D.map){let n=this._next();if(n.type===D.string&&n.value==="bytes"){let i=this._next();if(i.type===D.string){for(let a=0;a<2;a++)if(this._next().type!==D.break)throw new Error("Invalid encoded Bytes form");let o=Pd.decode(`m${i.value}`);return new te(D.bytes,o,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(n)}this.tokenBuffer.push(r)}this.tokenBuffer.push(t)}return e}},vs={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};vs.tags[42]=Ut.parse;var Fw="dag-json",kd=297,_u=e=>ew(e,Vw),Tu=e=>{let t=Object.assign(vs,{tokenizer:new zw(e,vs)});return tw(e,t)},Rl=e=>Gw.decode(_u(e)),Gw=new TextDecoder,Kw=e=>Tu(qw.encode(e)),qw=new TextEncoder;function Hw(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Ww(e,...t){if(!Hw(e))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function Dl(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 Jw(e,t){Ww(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}function Qw(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}var La=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Lt=(e,t)=>e<<32-t|e>>>t,Xw=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Xw)throw new Error("Non little-endian hardware is not supported");function Yw(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Ud(e){if(typeof e=="string"&&(e=Yw(e)),!Qw(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}var Zw=class{clone(){return this._cloneInto()}},sN={}.toString;function e1(e){let t=n=>e().update(Ud(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function t1(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let i=BigInt(32),o=BigInt(4294967295),a=Number(r>>i&o),s=Number(r&o),u=n?4:0,l=n?0:4;e.setUint32(t+u,a,n),e.setUint32(t+l,s,n)}var r1=class extends Zw{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=La(this.buffer)}update(e){Dl(this);let{view:t,buffer:r,blockLen:n}=this;e=Ud(e);let i=e.length;for(let o=0;o<i;){let a=Math.min(n-this.pos,i-o);if(a===n){let s=La(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){Dl(this),Jw(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let f=o;f<n;f++)t[f]=0;t1(r,n-8,BigInt(this.length*8),i),this.process(r,0);let a=La(e),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should 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||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:a}=this;return e.length=n,e.pos=a,e.finished=i,e.destroyed=o,n%t&&e.buffer.set(r),e}},n1=(e,t,r)=>e&t^~e&r,i1=(e,t,r)=>e&t^e&r^t&r,o1=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),cr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),fr=new Uint32Array(64),a1=class extends r1{constructor(){super(64,32,8,!1),this.A=cr[0]|0,this.B=cr[1]|0,this.C=cr[2]|0,this.D=cr[3]|0,this.E=cr[4]|0,this.F=cr[5]|0,this.G=cr[6]|0,this.H=cr[7]|0}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 p=fr[f-15],A=fr[f-2],O=Lt(p,7)^Lt(p,18)^p>>>3,T=Lt(A,17)^Lt(A,19)^A>>>10;fr[f]=T+fr[f-7]+O+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 p=Lt(a,6)^Lt(a,11)^Lt(a,25),A=l+p+n1(a,s,u)+o1[f]+fr[f]|0,O=(Lt(r,2)^Lt(r,13)^Lt(r,22))+i1(r,n,i)|0;l=u,u=s,s=a,a=o+A|0,o=i,i=n,n=r,r=A+O|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(){fr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},s1=e1(()=>new a1),qe=ir(xr(),1),Rd=ir(Ib(),1),Bl=e=>qe.Type.Union([e,qe.Type.Null()]),Dd=/^(k51qz|baguq)[0-9a-z]{56,57}$/,u1=/^[0-9A-Fa-f]{7,8}$/g;qe.FormatRegistry.Set("EntityID",e=>!!e.match(u1)||!!e.match(Dd));var l1=qe.Type.String(),bs=e=>e?.enc instanceof Uint8Array;qe.FormatRegistry.Set("CID",e=>!!e.match(Dd));var Bd=qe.Type.String({format:"CID"}),c1=/^http([s]?):\/\/.*\..*/;qe.FormatRegistry.Set("URL",e=>!!e.match(c1));var uN=qe.Type.String({format:"URL"}),Md=qe.Type.Object({en:l1,at:qe.Type.String(),vl:Bl(qe.Type.Union([qe.Type.String(),qe.Type.Boolean(),qe.Type.Number()])),ts:qe.Type.String(),ag:qe.Type.String(),pv:Bl(Bd)}),Ml=Rd.TypeCompiler.Compile(Md),lN=Ml.Check.bind(Ml),f1=qe.Type.Composite([qe.Type.Object({cid:Bd}),Md]),ws=Rd.TypeCompiler.Compile(f1),d1=e=>Array.from(ws.Errors(e)),Ld=ws.Check.bind(ws),p1=pa({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),cN=pa({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});function Vd(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var h1=Cd({name:"sha2-256",code:18,encode:Vd("SHA-256")}),fN=Cd({name:"sha2-512",code:19,encode:Vd("SHA-512")}),{WARN:Ll,LOG:dN,DEBUG:y1,VERBOSE:Ro,ERROR:m1}=$e.setup($e.INFO),g1=114;function v1(e,t=["cid"]){if(!e)throw m1("falsy log",e);let r=e.cid;if(bs(e))return r||(r=Ou(zd(e).bytes).toString()),Ll("preparing an encrypted applog - really?"),{log:e,cid:r};let n={};for(let[i,o]of Object.entries(e))o===void 0&&(Ll(`log.${i} is undefined, which is not allowed - encoding as null`,e),o=null),t.includes(i)?Ro("excluding app log",{key:i,val:o}):n[i]=o;return{log:n,cid:r}}function b1(e){return Ou(w1(e).bytes)}function w1(e){return zd(v1(e)?.log)}function Ou(e){let t=s1(e),r=Ad.create(h1.code,t),n=Ut.create(1,kd,r);return Ro("[getCidSync]",{bytes:e,hash:t,digest:r,cid:n}),n}function zd(e){y1("[encodeBlock]",e);let t=_u(e);return{bytes:t,cid:Ou(t)}}function _1(e){let t=null,r=[];try{t=Ut.parse(e)}catch(n){Ro("[retrieveThread] couldn't parse pubID with default base"),r.push(n)}if(!t)try{t=Ut.parse(e,p1)}catch(n){Ro("[retrieveThread] couldn't parse pubID with base36"),r.push(n)}return{cid:t,errors:t?null:r,isIpns:t&&xu(t)}}function xu(e){return e.code===g1}function _s(e){return typeof e=="string"?Ut.parse(e):typeof e.toV1!="function"?Ut.decode(e.bytes):e}function Eu(e,t){if(!e||!t)throw new Error(`[areCidsEqual] invalid params: ${e}, ${t}`);if(e===t)return!0;let r=_s(e),n=_s(t);return r.toV1().toString()===n.toV1().toString()}function T1(e,t){return e instanceof Set?e.has(typeof t=="string"?t:t.toV1().toString()):e.some(r=>Eu(r,t))}function Vl(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 O1(e,t){let r=Vl(e),n=Vl(t);return+r<+n}var x1=typeof global=="object"&&global&&global.Object===Object&&global,Fd=x1,E1=typeof self=="object"&&self&&self.Object===Object&&self,I1=Fd||E1||Function("return this")(),pt=I1,S1=pt.Symbol,Kt=S1,Gd=Object.prototype,A1=Gd.hasOwnProperty,$1=Gd.toString,qn=Kt?Kt.toStringTag:void 0;function N1(e){var t=A1.call(e,qn),r=e[qn];try{e[qn]=void 0;var n=!0}catch{}var i=$1.call(e);return n&&(t?e[qn]=r:delete e[qn]),i}var j1=N1,C1=Object.prototype,P1=C1.toString;function k1(e){return P1.call(e)}var U1=k1,R1="[object Null]",D1="[object Undefined]",zl=Kt?Kt.toStringTag:void 0;function B1(e){return e==null?e===void 0?D1:R1:zl&&zl in Object(e)?j1(e):U1(e)}var Un=B1;function M1(e){return e!=null&&typeof e=="object"}var Mr=M1,L1="[object Symbol]";function V1(e){return typeof e=="symbol"||Mr(e)&&Un(e)==L1}var pn=V1;function z1(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 F1=z1,G1=Array.isArray,Bt=G1,K1=1/0,Fl=Kt?Kt.prototype:void 0,Gl=Fl?Fl.toString:void 0;function Kd(e){if(typeof e=="string")return e;if(Bt(e))return F1(e,Kd)+"";if(pn(e))return Gl?Gl.call(e):"";var t=e+"";return t=="0"&&1/e==-K1?"-0":t}var q1=Kd,H1=/\s/;function W1(e){for(var t=e.length;t--&&H1.test(e.charAt(t)););return t}var J1=W1,Q1=/^\s+/;function X1(e){return e&&e.slice(0,J1(e)+1).replace(Q1,"")}var Y1=X1;function Z1(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var er=Z1,Kl=NaN,e_=/^[-+]0x[0-9a-f]+$/i,t_=/^0b[01]+$/i,r_=/^0o[0-7]+$/i,n_=parseInt;function i_(e){if(typeof e=="number")return e;if(pn(e))return Kl;if(er(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=er(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Y1(e);var r=t_.test(e);return r||r_.test(e)?n_(e.slice(2),r?2:8):e_.test(e)?Kl:+e}var o_=i_,ql=1/0,a_=17976931348623157e292;function s_(e){if(!e)return e===0?e:0;if(e=o_(e),e===ql||e===-ql){var t=e<0?-1:1;return t*a_}return e===e?e:0}var u_=s_;function l_(e){var t=u_(e),r=t%1;return t===t?r?t-r:t:0}var Hl=l_;function c_(e){return e}var ya=c_,f_="[object AsyncFunction]",d_="[object Function]",p_="[object GeneratorFunction]",h_="[object Proxy]";function y_(e){if(!er(e))return!1;var t=Un(e);return t==d_||t==p_||t==f_||t==h_}var qd=y_,m_=pt["__core-js_shared__"],Va=m_,Wl=function(){var e=/[^.]+$/.exec(Va&&Va.keys&&Va.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function g_(e){return!!Wl&&Wl in e}var v_=g_,b_=Function.prototype,w_=b_.toString;function __(e){if(e!=null){try{return w_.call(e)}catch{}try{return e+""}catch{}}return""}var en=__,T_=/[\\^$.*+?()[\]{}|]/g,O_=/^\[object .+?Constructor\]$/,x_=Function.prototype,E_=Object.prototype,I_=x_.toString,S_=E_.hasOwnProperty,A_=RegExp("^"+I_.call(S_).replace(T_,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function $_(e){if(!er(e)||v_(e))return!1;var t=qd(e)?A_:O_;return t.test(en(e))}var N_=$_;function j_(e,t){return e?.[t]}var C_=j_;function P_(e,t){var r=C_(e,t);return N_(r)?r:void 0}var tn=P_,k_=tn(pt,"WeakMap"),yi=k_,U_=yi&&new yi,Do=U_,R_=Do?function(e,t){return Do.set(e,t),e}:ya,Hd=R_,Jl=Object.create,D_=function(){function e(){}return function(t){if(!er(t))return{};if(Jl)return Jl(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),Iu=D_;function B_(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=Iu(e.prototype),n=e.apply(r,t);return er(n)?n:r}}var mi=B_,M_=1;function L_(e,t,r){var n=t&M_,i=mi(e);function o(){var a=this&&this!==pt&&this instanceof o?i:e;return a.apply(n?r:this,arguments)}return o}var V_=L_;function z_(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 Su=z_,F_=Math.max;function G_(e,t,r,n){for(var i=-1,o=e.length,a=r.length,s=-1,u=t.length,l=F_(o-a,0),f=Array(u+l),p=!n;++s<u;)f[s]=t[s];for(;++i<a;)(p||i<o)&&(f[r[i]]=e[i]);for(;l--;)f[s++]=e[i++];return f}var Wd=G_,K_=Math.max;function q_(e,t,r,n){for(var i=-1,o=e.length,a=-1,s=r.length,u=-1,l=t.length,f=K_(o-s,0),p=Array(f+l),A=!n;++i<f;)p[i]=e[i];for(var O=i;++u<l;)p[O+u]=t[u];for(;++a<s;)(A||i<o)&&(p[O+r[a]]=e[i++]);return p}var Jd=q_;function H_(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var W_=H_;function J_(){}var Au=J_,Q_=4294967295;function Bo(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Q_,this.__views__=[]}Bo.prototype=Iu(Au.prototype);Bo.prototype.constructor=Bo;var $u=Bo;function X_(){}var Qd=X_,Y_=Do?function(e){return Do.get(e)}:Qd,Xd=Y_,Z_={},Ql=Z_,eT=Object.prototype,tT=eT.hasOwnProperty;function rT(e){for(var t=e.name+"",r=Ql[t],n=tT.call(Ql,t)?r.length:0;n--;){var i=r[n],o=i.func;if(o==null||o==e)return i.name}return t}var nT=rT;function Mo(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}Mo.prototype=Iu(Au.prototype);Mo.prototype.constructor=Mo;var Ts=Mo;function iT(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var Yd=iT;function oT(e){if(e instanceof $u)return e.clone();var t=new Ts(e.__wrapped__,e.__chain__);return t.__actions__=Yd(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var aT=oT,sT=Object.prototype,uT=sT.hasOwnProperty;function Lo(e){if(Mr(e)&&!Bt(e)&&!(e instanceof $u)){if(e instanceof Ts)return e;if(uT.call(e,"__wrapped__"))return aT(e)}return new Ts(e)}Lo.prototype=Au.prototype;Lo.prototype.constructor=Lo;var lT=Lo;function cT(e){var t=nT(e),r=lT[t];if(typeof r!="function"||!(t in $u.prototype))return!1;if(e===r)return!0;var n=Xd(r);return!!n&&e===n[0]}var fT=cT,dT=800,pT=16,hT=Date.now;function yT(e){var t=0,r=0;return function(){var n=hT(),i=pT-(n-r);if(r=n,i>0){if(++t>=dT)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Zd=yT,mT=Zd(Hd),ep=mT,gT=/\{\n\/\* \[wrapped with (.+)\] \*/,vT=/,? & /;function bT(e){var t=e.match(gT);return t?t[1].split(vT):[]}var wT=bT,_T=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function TT(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(_T,`{
60
+ /* [wrapped with `+t+`] */
61
+ `)}var OT=TT;function xT(e){return function(){return e}}var ET=xT,IT=function(){try{var e=tn(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Vo=IT,ST=Vo?function(e,t){return Vo(e,"toString",{configurable:!0,enumerable:!1,value:ET(t),writable:!0})}:ya,AT=ST,$T=Zd(AT),Nu=$T;function NT(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var jT=NT;function CT(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 PT=CT;function kT(e){return e!==e}var UT=kT;function RT(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}var DT=RT;function BT(e,t,r){return t===t?DT(e,t,r):PT(e,UT,r)}var MT=BT;function LT(e,t){var r=e==null?0:e.length;return!!r&&MT(e,t,0)>-1}var VT=LT,zT=1,FT=2,GT=8,KT=16,qT=32,HT=64,WT=128,JT=256,QT=512,XT=[["ary",WT],["bind",zT],["bindKey",FT],["curry",GT],["curryRight",KT],["flip",QT],["partial",qT],["partialRight",HT],["rearg",JT]];function YT(e,t){return jT(XT,function(r){var n="_."+r[0];t&r[1]&&!VT(e,n)&&e.push(n)}),e.sort()}var ZT=YT;function eO(e,t,r){var n=t+"";return Nu(e,OT(n,ZT(wT(n),r)))}var tp=eO,tO=1,rO=2,nO=4,iO=8,Xl=32,Yl=64;function oO(e,t,r,n,i,o,a,s,u,l){var f=t&iO,p=f?a:void 0,A=f?void 0:a,O=f?o:void 0,T=f?void 0:o;t|=f?Xl:Yl,t&=~(f?Yl:Xl),t&nO||(t&=~(tO|rO));var F=[e,t,i,O,p,T,A,s,u,l],W=r.apply(void 0,F);return fT(e)&&ep(W,F),W.placeholder=n,tp(W,e,t)}var rp=oO;function aO(e){var t=e;return t.placeholder}var ju=aO,sO=9007199254740991,uO=/^(?:0|[1-9]\d*)$/;function lO(e,t){var r=typeof e;return t=t??sO,!!t&&(r=="number"||r!="symbol"&&uO.test(e))&&e>-1&&e%1==0&&e<t}var ma=lO,cO=Math.min;function fO(e,t){for(var r=e.length,n=cO(t.length,r),i=Yd(e);n--;){var o=t[n];e[n]=ma(o,r)?i[o]:void 0}return e}var dO=fO,Zl="__lodash_placeholder__";function pO(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r];(a===t||a===Zl)&&(e[r]=Zl,o[i++]=r)}return o}var gi=pO,hO=1,yO=2,mO=8,gO=16,vO=128,bO=512;function np(e,t,r,n,i,o,a,s,u,l){var f=t&vO,p=t&hO,A=t&yO,O=t&(mO|gO),T=t&bO,F=A?void 0:mi(e);function W(){for(var x=arguments.length,P=Array(x),G=x;G--;)P[G]=arguments[G];if(O)var q=ju(W),V=W_(P,q);if(n&&(P=Wd(P,n,i,O)),o&&(P=Jd(P,o,a,O)),x-=V,O&&x<l){var Q=gi(P,q);return rp(e,t,np,W.placeholder,r,P,Q,s,u,l-x)}var L=p?r:this,re=A?L[e]:e;return x=P.length,s?P=dO(P,s):T&&x>1&&P.reverse(),f&&u<x&&(P.length=u),this&&this!==pt&&this instanceof W&&(re=F||mi(re)),re.apply(L,P)}return W}var ip=np;function wO(e,t,r){var n=mi(e);function i(){for(var o=arguments.length,a=Array(o),s=o,u=ju(i);s--;)a[s]=arguments[s];var l=o<3&&a[0]!==u&&a[o-1]!==u?[]:gi(a,u);if(o-=l.length,o<r)return rp(e,t,ip,i.placeholder,void 0,a,l,void 0,void 0,r-o);var f=this&&this!==pt&&this instanceof i?n:e;return Su(f,this,a)}return i}var _O=wO,TO=1;function OO(e,t,r,n){var i=t&TO,o=mi(e);function a(){for(var s=-1,u=arguments.length,l=-1,f=n.length,p=Array(f+u),A=this&&this!==pt&&this instanceof a?o:e;++l<f;)p[l]=n[l];for(;u--;)p[l++]=arguments[++s];return Su(A,i?r:this,p)}return a}var xO=OO,ec="__lodash_placeholder__",za=1,EO=2,IO=4,tc=8,Hn=128,rc=256,SO=Math.min;function AO(e,t){var r=e[1],n=t[1],i=r|n,o=i<(za|EO|Hn),a=n==Hn&&r==tc||n==Hn&&r==rc&&e[7].length<=t[8]||n==(Hn|rc)&&t[7].length<=t[8]&&r==tc;if(!(o||a))return e;n&za&&(e[2]=t[2],i|=r&za?0:IO);var s=t[3];if(s){var u=e[3];e[3]=u?Wd(u,s,t[4]):s,e[4]=u?gi(e[3],ec):t[4]}return s=t[5],s&&(u=e[5],e[5]=u?Jd(u,s,t[6]):s,e[6]=u?gi(e[5],ec):t[6]),s=t[7],s&&(e[7]=s),n&Hn&&(e[8]=e[8]==null?t[8]:SO(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}var $O=AO,NO="Expected a function",nc=1,jO=2,Fa=8,Ga=16,Ka=32,ic=64,oc=Math.max;function CO(e,t,r,n,i,o,a,s){var u=t&jO;if(!u&&typeof e!="function")throw new TypeError(NO);var l=n?n.length:0;if(l||(t&=~(Ka|ic),n=i=void 0),a=a===void 0?a:oc(Hl(a),0),s=s===void 0?s:Hl(s),l-=i?i.length:0,t&ic){var f=n,p=i;n=i=void 0}var A=u?void 0:Xd(e),O=[e,t,r,n,i,f,p,o,a,s];if(A&&$O(O,A),e=O[0],t=O[1],r=O[2],n=O[3],i=O[4],s=O[9]=O[9]===void 0?u?0:e.length:oc(O[9]-l,0),!s&&t&(Fa|Ga)&&(t&=~(Fa|Ga)),!t||t==nc)var T=V_(e,t,r);else t==Fa||t==Ga?T=_O(e,t,s):(t==Ka||t==(nc|Ka))&&!i.length?T=xO(e,t,r,n):T=ip.apply(void 0,O);var F=A?Hd:ep;return tp(F(T,O),e,t)}var PO=CO;function kO(e,t,r){t=="__proto__"&&Vo?Vo(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var UO=kO;function RO(e,t){return e===t||e!==e&&t!==t}var Cu=RO,DO=Object.prototype,BO=DO.hasOwnProperty;function MO(e,t,r){var n=e[t];(!(BO.call(e,t)&&Cu(n,r))||r===void 0&&!(t in e))&&UO(e,t,r)}var LO=MO,ac=Math.max;function VO(e,t,r){return t=ac(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=ac(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),Su(e,this,s)}}var op=VO;function zO(e,t){return Nu(op(e,t,ya),e+"")}var FO=zO,GO=9007199254740991;function KO(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=GO}var Pu=KO;function qO(e){return e!=null&&Pu(e.length)&&!qd(e)}var HO=qO,WO=Object.prototype;function JO(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||WO;return e===r}var QO=JO;function XO(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var YO=XO,ZO="[object Arguments]";function e2(e){return Mr(e)&&Un(e)==ZO}var sc=e2,ap=Object.prototype,t2=ap.hasOwnProperty,r2=ap.propertyIsEnumerable,n2=sc(function(){return arguments}())?sc:function(e){return Mr(e)&&t2.call(e,"callee")&&!r2.call(e,"callee")},ku=n2;function i2(){return!1}var o2=i2,sp=typeof exports=="object"&&exports&&!exports.nodeType&&exports,uc=sp&&typeof module=="object"&&module&&!module.nodeType&&module,a2=uc&&uc.exports===sp,lc=a2?pt.Buffer:void 0,s2=lc?lc.isBuffer:void 0,u2=s2||o2,Os=u2,l2="[object Arguments]",c2="[object Array]",f2="[object Boolean]",d2="[object Date]",p2="[object Error]",h2="[object Function]",y2="[object Map]",m2="[object Number]",g2="[object Object]",v2="[object RegExp]",b2="[object Set]",w2="[object String]",_2="[object WeakMap]",T2="[object ArrayBuffer]",O2="[object DataView]",x2="[object Float32Array]",E2="[object Float64Array]",I2="[object Int8Array]",S2="[object Int16Array]",A2="[object Int32Array]",$2="[object Uint8Array]",N2="[object Uint8ClampedArray]",j2="[object Uint16Array]",C2="[object Uint32Array]",ke={};ke[x2]=ke[E2]=ke[I2]=ke[S2]=ke[A2]=ke[$2]=ke[N2]=ke[j2]=ke[C2]=!0;ke[l2]=ke[c2]=ke[T2]=ke[f2]=ke[O2]=ke[d2]=ke[p2]=ke[h2]=ke[y2]=ke[m2]=ke[g2]=ke[v2]=ke[b2]=ke[w2]=ke[_2]=!1;function P2(e){return Mr(e)&&Pu(e.length)&&!!ke[Un(e)]}var k2=P2;function U2(e){return function(t){return e(t)}}var R2=U2,up=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ni=up&&typeof module=="object"&&module&&!module.nodeType&&module,D2=ni&&ni.exports===up,qa=D2&&Fd.process,B2=function(){try{var e=ni&&ni.require&&ni.require("util").types;return e||qa&&qa.binding&&qa.binding("util")}catch{}}(),cc=B2,fc=cc&&cc.isTypedArray,M2=fc?R2(fc):k2,lp=M2,L2=Object.prototype,V2=L2.hasOwnProperty;function z2(e,t){var r=Bt(e),n=!r&&ku(e),i=!r&&!n&&Os(e),o=!r&&!n&&!i&&lp(e),a=r||n||i||o,s=a?YO(e.length,String):[],u=s.length;for(var l in e)(t||V2.call(e,l))&&!(a&&(l=="length"||i&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||ma(l,u)))&&s.push(l);return s}var F2=z2;function G2(e,t){return function(r){return e(t(r))}}var K2=G2,q2=K2(Object.keys,Object),H2=q2,W2=Object.prototype,J2=W2.hasOwnProperty;function Q2(e){if(!QO(e))return H2(e);var t=[];for(var r in Object(e))J2.call(e,r)&&r!="constructor"&&t.push(r);return t}var X2=Q2;function Y2(e){return HO(e)?F2(e):X2(e)}var cp=Y2,Z2=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ex=/^\w*$/;function tx(e,t){if(Bt(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||pn(e)?!0:ex.test(e)||!Z2.test(e)||t!=null&&e in Object(t)}var Uu=tx,rx=tn(Object,"create"),vi=rx;function nx(){this.__data__=vi?vi(null):{},this.size=0}var ix=nx;function ox(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var ax=ox,sx="__lodash_hash_undefined__",ux=Object.prototype,lx=ux.hasOwnProperty;function cx(e){var t=this.__data__;if(vi){var r=t[e];return r===sx?void 0:r}return lx.call(t,e)?t[e]:void 0}var fx=cx,dx=Object.prototype,px=dx.hasOwnProperty;function hx(e){var t=this.__data__;return vi?t[e]!==void 0:px.call(t,e)}var yx=hx,mx="__lodash_hash_undefined__";function gx(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=vi&&t===void 0?mx:t,this}var vx=gx;function Rn(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])}}Rn.prototype.clear=ix;Rn.prototype.delete=ax;Rn.prototype.get=fx;Rn.prototype.has=yx;Rn.prototype.set=vx;var dc=Rn;function bx(){this.__data__=[],this.size=0}var wx=bx;function _x(e,t){for(var r=e.length;r--;)if(Cu(e[r][0],t))return r;return-1}var ga=_x,Tx=Array.prototype,Ox=Tx.splice;function xx(e){var t=this.__data__,r=ga(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Ox.call(t,r,1),--this.size,!0}var Ex=xx;function Ix(e){var t=this.__data__,r=ga(t,e);return r<0?void 0:t[r][1]}var Sx=Ix;function Ax(e){return ga(this.__data__,e)>-1}var $x=Ax;function Nx(e,t){var r=this.__data__,n=ga(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var jx=Nx;function Dn(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])}}Dn.prototype.clear=wx;Dn.prototype.delete=Ex;Dn.prototype.get=Sx;Dn.prototype.has=$x;Dn.prototype.set=jx;var va=Dn,Cx=tn(pt,"Map"),bi=Cx;function Px(){this.size=0,this.__data__={hash:new dc,map:new(bi||va),string:new dc}}var kx=Px;function Ux(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Rx=Ux;function Dx(e,t){var r=e.__data__;return Rx(t)?r[typeof t=="string"?"string":"hash"]:r.map}var ba=Dx;function Bx(e){var t=ba(this,e).delete(e);return this.size-=t?1:0,t}var Mx=Bx;function Lx(e){return ba(this,e).get(e)}var Vx=Lx;function zx(e){return ba(this,e).has(e)}var Fx=zx;function Gx(e,t){var r=ba(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var Kx=Gx;function Bn(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])}}Bn.prototype.clear=kx;Bn.prototype.delete=Mx;Bn.prototype.get=Vx;Bn.prototype.has=Fx;Bn.prototype.set=Kx;var wa=Bn,qx="Expected a function";function Ru(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(qx);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(Ru.Cache||wa),r}Ru.Cache=wa;var Hx=Ru,Wx=500;function Jx(e){var t=Hx(e,function(n){return r.size===Wx&&r.clear(),n}),r=t.cache;return t}var Qx=Jx,Xx=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Yx=/\\(\\)?/g,Zx=Qx(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Xx,function(r,n,i,o){t.push(i?o.replace(Yx,"$1"):n||r)}),t}),eE=Zx;function tE(e){return e==null?"":q1(e)}var rE=tE;function nE(e,t){return Bt(e)?e:Uu(e,t)?[e]:eE(rE(e))}var _a=nE,iE=1/0;function oE(e){if(typeof e=="string"||pn(e))return e;var t=e+"";return t=="0"&&1/e==-iE?"-0":t}var Di=oE;function aE(e,t){t=_a(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Di(t[r++])];return r&&r==n?e:void 0}var Du=aE;function sE(e,t,r){var n=e==null?void 0:Du(e,t);return n===void 0?r:n}var uE=sE;function lE(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var fp=lE,pc=Kt?Kt.isConcatSpreadable:void 0;function cE(e){return Bt(e)||ku(e)||!!(pc&&e&&e[pc])}var fE=cE;function dp(e,t,r,n,i){var o=-1,a=e.length;for(r||(r=fE),i||(i=[]);++o<a;){var s=e[o];t>0&&r(s)?t>1?dp(s,t-1,r,n,i):fp(i,s):n||(i[i.length]=s)}return i}var dE=dp;function pE(e){var t=e==null?0:e.length;return t?dE(e,1):[]}var hE=pE;function yE(e){return Nu(op(e,void 0,hE),e+"")}var mE=yE;function gE(){this.__data__=new va,this.size=0}var vE=gE;function bE(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var wE=bE;function _E(e){return this.__data__.get(e)}var TE=_E;function OE(e){return this.__data__.has(e)}var xE=OE,EE=200;function IE(e,t){var r=this.__data__;if(r instanceof va){var n=r.__data__;if(!bi||n.length<EE-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new wa(n)}return r.set(e,t),this.size=r.size,this}var SE=IE;function Mn(e){var t=this.__data__=new va(e);this.size=t.size}Mn.prototype.clear=vE;Mn.prototype.delete=wE;Mn.prototype.get=TE;Mn.prototype.has=xE;Mn.prototype.set=SE;var ro=Mn;function AE(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 $E=AE;function NE(){return[]}var jE=NE,CE=Object.prototype,PE=CE.propertyIsEnumerable,hc=Object.getOwnPropertySymbols,kE=hc?function(e){return e==null?[]:(e=Object(e),$E(hc(e),function(t){return PE.call(e,t)}))}:jE,UE=kE;function RE(e,t,r){var n=t(e);return Bt(e)?n:fp(n,r(e))}var DE=RE;function BE(e){return DE(e,cp,UE)}var yc=BE,ME=tn(pt,"DataView"),xs=ME,LE=tn(pt,"Promise"),Es=LE,VE=tn(pt,"Set"),ln=VE,mc="[object Map]",zE="[object Object]",gc="[object Promise]",vc="[object Set]",bc="[object WeakMap]",wc="[object DataView]",FE=en(xs),GE=en(bi),KE=en(Es),qE=en(ln),HE=en(yi),Cr=Un;(xs&&Cr(new xs(new ArrayBuffer(1)))!=wc||bi&&Cr(new bi)!=mc||Es&&Cr(Es.resolve())!=gc||ln&&Cr(new ln)!=vc||yi&&Cr(new yi)!=bc)&&(Cr=function(e){var t=Un(e),r=t==zE?e.constructor:void 0,n=r?en(r):"";if(n)switch(n){case FE:return wc;case GE:return mc;case KE:return gc;case qE:return vc;case HE:return bc}return t});var _c=Cr,WE=pt.Uint8Array,Tc=WE,JE="__lodash_hash_undefined__";function QE(e){return this.__data__.set(e,JE),this}var XE=QE;function YE(e){return this.__data__.has(e)}var ZE=YE;function zo(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new wa;++t<r;)this.add(e[t])}zo.prototype.add=zo.prototype.push=XE;zo.prototype.has=ZE;var eI=zo;function tI(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 rI=tI;function nI(e,t){return e.has(t)}var iI=nI,oI=1,aI=2;function sI(e,t,r,n,i,o){var a=r&oI,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 p=-1,A=!0,O=r&aI?new eI:void 0;for(o.set(e,t),o.set(t,e);++p<s;){var T=e[p],F=t[p];if(n)var W=a?n(F,T,p,t,e,o):n(T,F,p,e,t,o);if(W!==void 0){if(W)continue;A=!1;break}if(O){if(!rI(t,function(x,P){if(!iI(O,P)&&(T===x||i(T,x,r,n,o)))return O.push(P)})){A=!1;break}}else if(!(T===F||i(T,F,r,n,o))){A=!1;break}}return o.delete(e),o.delete(t),A}var pp=sI;function uI(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var lI=uI;function cI(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var hp=cI,fI=1,dI=2,pI="[object Boolean]",hI="[object Date]",yI="[object Error]",mI="[object Map]",gI="[object Number]",vI="[object RegExp]",bI="[object Set]",wI="[object String]",_I="[object Symbol]",TI="[object ArrayBuffer]",OI="[object DataView]",Oc=Kt?Kt.prototype:void 0,Ha=Oc?Oc.valueOf:void 0;function xI(e,t,r,n,i,o,a){switch(r){case OI:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case TI:return!(e.byteLength!=t.byteLength||!o(new Tc(e),new Tc(t)));case pI:case hI:case gI:return Cu(+e,+t);case yI:return e.name==t.name&&e.message==t.message;case vI:case wI:return e==t+"";case mI:var s=lI;case bI:var u=n&fI;if(s||(s=hp),e.size!=t.size&&!u)return!1;var l=a.get(e);if(l)return l==t;n|=dI,a.set(e,t);var f=pp(s(e),s(t),n,i,o,a);return a.delete(e),f;case _I:if(Ha)return Ha.call(e)==Ha.call(t)}return!1}var EI=xI,II=1,SI=Object.prototype,AI=SI.hasOwnProperty;function $I(e,t,r,n,i,o){var a=r&II,s=yc(e),u=s.length,l=yc(t),f=l.length;if(u!=f&&!a)return!1;for(var p=u;p--;){var A=s[p];if(!(a?A in t:AI.call(t,A)))return!1}var O=o.get(e),T=o.get(t);if(O&&T)return O==t&&T==e;var F=!0;o.set(e,t),o.set(t,e);for(var W=a;++p<u;){A=s[p];var x=e[A],P=t[A];if(n)var G=a?n(P,x,A,t,e,o):n(x,P,A,e,t,o);if(!(G===void 0?x===P||i(x,P,r,n,o):G)){F=!1;break}W||(W=A=="constructor")}if(F&&!W){var q=e.constructor,V=t.constructor;q!=V&&"constructor"in e&&"constructor"in t&&!(typeof q=="function"&&q instanceof q&&typeof V=="function"&&V instanceof V)&&(F=!1)}return o.delete(e),o.delete(t),F}var NI=$I,jI=1,xc="[object Arguments]",Ec="[object Array]",qi="[object Object]",CI=Object.prototype,Ic=CI.hasOwnProperty;function PI(e,t,r,n,i,o){var a=Bt(e),s=Bt(t),u=a?Ec:_c(e),l=s?Ec:_c(t);u=u==xc?qi:u,l=l==xc?qi:l;var f=u==qi,p=l==qi,A=u==l;if(A&&Os(e)){if(!Os(t))return!1;a=!0,f=!1}if(A&&!f)return o||(o=new ro),a||lp(e)?pp(e,t,r,n,i,o):EI(e,t,u,r,n,i,o);if(!(r&jI)){var O=f&&Ic.call(e,"__wrapped__"),T=p&&Ic.call(t,"__wrapped__");if(O||T){var F=O?e.value():e,W=T?t.value():t;return o||(o=new ro),i(F,W,r,n,o)}}return A?(o||(o=new ro),NI(e,t,r,n,i,o)):!1}var kI=PI;function yp(e,t,r,n,i){return e===t?!0:e==null||t==null||!Mr(e)&&!Mr(t)?e!==e&&t!==t:kI(e,t,r,n,yp,i)}var mp=yp,UI=1,RI=2;function DI(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 p=new ro;if(n)var A=n(l,f,u,e,t,p);if(!(A===void 0?mp(f,l,UI|RI,n,p):A))return!1}}return!0}var BI=DI;function MI(e){return e===e&&!er(e)}var gp=MI;function LI(e){for(var t=cp(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,gp(i)]}return t}var VI=LI;function zI(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var vp=zI;function FI(e){var t=VI(e);return t.length==1&&t[0][2]?vp(t[0][0],t[0][1]):function(r){return r===e||BI(r,e,t)}}var GI=FI;function KI(e,t){return e!=null&&t in Object(e)}var qI=KI;function HI(e,t,r){t=_a(t,e);for(var n=-1,i=t.length,o=!1;++n<i;){var a=Di(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&&Pu(i)&&ma(a,i)&&(Bt(e)||ku(e)))}var WI=HI;function JI(e,t){return e!=null&&WI(e,t,qI)}var bp=JI,QI=1,XI=2;function YI(e,t){return Uu(e)&&gp(t)?vp(Di(e),t):function(r){var n=uE(r,e);return n===void 0&&n===t?bp(r,e):mp(t,n,QI|XI)}}var ZI=YI;function eS(e){return function(t){return t?.[e]}}var tS=eS;function rS(e){return function(t){return Du(t,e)}}var nS=rS;function iS(e){return Uu(e)?tS(Di(e)):nS(e)}var oS=iS;function aS(e){return typeof e=="function"?e:e==null?ya:typeof e=="object"?Bt(e)?ZI(e[0],e[1]):GI(e):oS(e)}var sS=aS;function uS(e,t,r,n){if(!er(e))return e;t=_a(t,e);for(var i=-1,o=t.length,a=o-1,s=e;s!=null&&++i<o;){var u=Di(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=er(f)?f:ma(t[i+1])?[]:{})}LO(s,u,l),s=s[u]}return e}var lS=uS;function cS(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var a=t[n],s=Du(e,a);r(s,a)&&lS(o,_a(a,e),s)}return o}var fS=cS,dS=32,Bu=FO(function(e,t){var r=gi(t,ju(Bu));return PO(e,dS,void 0,t,r)});Bu.placeholder={};var pS=Bu;function hS(e,t){return fS(e,t,function(r,n){return bp(e,n)})}var yS=hS,mS=mE(function(e,t){return e==null?{}:yS(e,t)}),Sc=mS,gS=4294967295,vS=gS-1,bS=Math.floor,wS=Math.min;function _S(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=pn(t),l=t===void 0;i<o;){var f=bS((i+o)/2),p=r(e[f]),A=p!==void 0,O=p===null,T=p===p,F=pn(p);if(a)var W=n||T;else l?W=T&&(n||A):s?W=T&&A&&(n||!O):u?W=T&&A&&!O&&(n||!F):O||F?W=!1:W=n?p<=t:p<t;W?i=f+1:o=f}return wS(o,vS)}var TS=_S;function OS(e,t,r){return TS(e,t,sS(r,2))}var xS=OS,ES=1/0,pN=ln&&1/hp(new ln([,-0]))[1]==ES?function(e){return new ln(e)}:Qd,{WARN:hN,LOG:yN,DEBUG:mN,VERBOSE:IS,ERROR:SS}=$e.setup($e.INFO),AS=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),wp=(e,t,r)=>He.structural(Sc(t,e),Sc(r,e)),$S=(e,t,r="asc")=>AS(e.ts,t.ts,r),gN=pS(wp,["en","at"]);function wi(e,t="asc"){return e.sort((r,n)=>$S(r,n,t))}var NS=(e,t)=>O1(new Date(e.ts),new Date(t.ts)),_p=e=>{let t=new Map;for(let r of e){if(!r)throw SS("falsy entry in applogs",e),new Error("falsy entry in applogs");let n=r.cid;t.has(n)?IS("Skipping duplicate applog:",[t.get(n),r]):t.set(n,r)}return Array.from(t.values())};function jS(e){return typeof e=="string"&&e.startsWith("?")}function CS(e){return e.slice(1)}function Tp(e,t){let r={},n={};for(let[i,o]of Object.entries(e))if(jS(o)){let a=CS(o),s=t[a];s?n[i]=s:r[i]=a}else n[i]=o;return[n,r]}function PS(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 Op=function(e){for(var t=0,r=0,n=e.length;r<n;r++)t+=e[r];return t},Ac=function(e){return Op(e)/e.length},gt={max:function(e){return Math.max.apply(null,e)},min:function(e){return Math.min.apply(null,e)},range:function(e){return gt.max(e)-gt.min(e)},midrange:function(e){return gt.range(e)/2},sum:Op,mean:Ac,average:Ac,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=gt.mean(e);return gt.mean(e.map(function(r){return Math.pow(r-t,2)}))},standardDeviation:function(e){return Math.sqrt(gt.variance(e))},meanAbsoluteDeviation:function(e){var t=gt.mean(e);return gt.mean(e.map(function(r){return Math.abs(r-t)}))},zScores:function(e){var t=gt.mean(e),r=gt.standardDeviation(e);return e.map(function(n){return(n-t)/r})}};gt.average=gt.mean;function xp(){return new Date().toISOString()}var{WARN:kS,LOG:vN,DEBUG:US,VERBOSE:bN,ERROR:Fo}=$e.setup($e.INFO);function RS(e,t){let r=xp(),n=t;return e.map(i=>DS(i,{ts:r,threadForPv:n}))}function DS(e,{ts:t,threadForPv:r}={}){let n=LS(e,t??xp()),i=VS(n,r),o=b1(i).toString();e.cid&&e.cid!==o&&kS("[finalizeApplogForInsert] overwriting wrong CID",{log:e,cid:o,logWithPv:i});let a={...i,cid:o};if(!Ld(a))throw Fo(`Bogus Applog ${JSON.stringify(a)}`,d1(a));return Object.freeze(a)}function BS(e){return!!e.ts}function MS(e){return!!e.pv}function LS(e,t){return BS(e)?e:{...e,ts:t}}function VS(e,t){if(e.pv!==void 0)return e;if(t){let{en:r,at:n}=e,i=t.findLast(a=>a.en==r&&a.at==n);if(wp(["en","at","vl","ts","ag"],e,i))throw Fo("[withPvFrom] Same as previous:",{log:e,pv:i,thread:t});let o=(e.pv!==void 0?e.pv:i?.cid)??null;return{...e,pv:o}}else{if(!MS(e))throw Fo("[withPvFrom] no thread and no pv:",e);return e}}function Is(e){let t=()=>(Ue(()=>e.length<2&&US(`joinThreads with count=${e.length}`)),wi(_p(e.flatMap(i=>{let o=i.applogs;if(!o)throw Fo("falsy applogs of thread",i),new Error("falsy applogs of thread");return o})))),r=Ue(()=>t()),n=Tt(function(i,o){return _r(i)?{init:Ue(()=>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 Mu(Ue(()=>`join(~ ${e.map(i=>i.name).join(", ")})`),e,["?"],r,n)}var{WARN:$c,LOG:wN,DEBUG:Nc,VERBOSE:jr,ERROR:jc}=$e.setup($e.INFO),Mu=class Ep extends uu{constructor(t,r,n,i,o,a=null){super(t,r,n,o?Re.array([...i],{deep:!1,name:`${t}.array`}):i),this.name=t,this._initialLogs=i,this._eventMapper=o,this._writeMapper=a,In(this,{onParentUpdate:Tt}),o&&this.subscribeToParents()}static mapWrites(t,r,n){return new Ep(`${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=Et(()=>{this.parents.length||$c("MappedThread has no parents",this),jr(`[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)&&jr(`[MappedThread: ${this.name}] Skipping re-sub to parent`,n.nameAndSizeUntracked),jr(`[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)jr(`[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 jc("triggerRemap on a thread that is not actually mapping?!",this.nameAndSizeUntracked);Nc(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.length!==1&&$c(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap with parentCount=${this.parents.length} - not meant for this`),this.parents.forEach(t=>{this.onParentUpdate(t,{init:Ue(()=>Yt(t.applogs))})})}onParentUpdate(t,r){jr(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate`,r);let n=this._eventMapper?this._eventMapper(r,t):r;if(this._eventMapper)if(jr(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => mapped`,n),_r(n))this._applogs.replace([...n.init]);else{for(let i of n.added)this._applogs.splice(xS(this._applogs,i,"ts"),0,i);if(n.removed){for(let i of n.removed)if(!this._applogs.remove(i))if(!_r(r)&&r.removed?.includes(i))Nc("Ignoring remove event for non-existent because it was part of parent event's removed",i,r);else throw jc(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,i,{thread:this,event:r,mapResult:n})}}jr(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,sa(this._applogs)),this.notifySubscribers(n)}get readOnly(){return!1}},{WARN:_N,LOG:TN,DEBUG:ON,VERBOSE:Wa,ERROR:zS}=$e.setup($e.INFO),hn=We("rollingFilter",function(e,t,r={}){let n=GS(t),i=Cc(n),o=Re.array(Ue(function(){return i(e.applogs)}),{deep:!1,name:`${e.name} | ${r.name||`rollingFilter.array{${di(n)}}`}`}),a=f=>{let p;return _r(f)?p={init:i(f.init)}:p={added:i(f.added),removed:f.removed},Wa(`rollingFilter{${e.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,n,f,"=>",p),p},s=new Mu(`${e.name} | ${r.name||`rollingFilter{${di(n)}}`}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],o,a),u=Nv(()=>Yt(t),f=>{Wa(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,n,"=>",f),n=f,i=Cc(n),s.triggerRemap()}),l=En(o,()=>{Wa(`rollingFilter<${Ue(()=>e.name)}>${r.name?` '${r.name}'`:""} unobserve`,n),u(),l()});return s},{equals:Pi,argsDebugName:(e,t,r)=>Ve({caller:"rollingFilter",thread:e,pattern:t,args:r})}),FS=We("rollingMapper",function(e,t,r={}){let n=Ue(()=>t.call(null,{init:e.applogs},e));if(!_r(n))throw zS("Initial run must return init event");let i=n.init;return new Mu(`${e.name} | ${r.name||"rollingMapper"}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],i,t)},{equals:Pi,argsDebugName:(e,t,r)=>Ve({caller:"rollingMapper",thread:e,args:r})}),xN=We("rollingAcc",function(e,t,r,n={}){let i=Tt(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}`:""}}`}),GS=function(e){let t=Ue(function(){return Object.fromEntries(Object.entries(Yt(e)).map(([r,n])=>[Yt(r),Yt(n)]))});if(!Object.entries(t).length)throw new Error("Pattern is empty");return t};function Cc(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(!PS(n,i,o))return!1}return!0})}}var{WARN:KS,LOG:qS,DEBUG:HS,VERBOSE:WS,ERROR:no}=$e.setup($e.INFO),JS=class extends uu{constructor(e,t=[],r){super(e,null,r,t),In(this,{})}purge(e){let t=this.applogs.length;return this._applogs=this.applogs.filter(r=>!e.includes(r.cid)),t-this.applogs.length}insert(e){let t=RS(e,this);return this.insertRaw(t)}insertRaw(e){let t=_p(e);if(t.length!==e.length)throw no(`[insertRaw] duplicate applogs passed: ${e.length-t.length}`,{appLogsToInsert:e,deduplicated:t});let r=e.filter(o=>!Ld(o));if(r.length)throw no(`[insertRaw] bogus applogs passed: ${r.length}`,{bogus:r});let n=e.filter(o=>this.hasApplog(o,!1));if(n.length)throw no(`[insertRaw] already existing applogs passed: ${n.length}`,{existing:n});if(!e.length){KS("[insertRaw] skipping empty insert empty logs array");return}(!this.hasParents&&!(this instanceof Bi)?qS:HS)("Inserting:",e.length===1?e[0]:e,{ds:this}),wi(e);let i=this._applogs.length&&NS(e[0],this._applogs[this._applogs.length-1]);return this._applogs.push(...e),i&&wi(this._applogs),this.notifySubscribers({added:e,removed:null}),this.persist(e),e}get readOnly(){return!1}},Bi=class Ss extends JS{constructor(t,r,n,i){super(t,r,n),this._readOnly=i,In(this,{_applogs:Re.shallow})}static empty(t){return Ss.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new Ss(r??"in-memory",t,[],n)}get readOnly(){return this._readOnly}async persist(t){if(WS("[InMem.persist] no persist for",t),this.readOnly)throw no("[persist] called for readOnly thread")}},{WARN:EN,LOG:IN,DEBUG:SN,VERBOSE:AN,ERROR:$N}=$e.setup($e.INFO),QS=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=r,In(this,{threadOfTrail:Le})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?Is([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},Ip=class{constructor(e){this.nodes=e,In(this,{threadOfAllTrails:Le,size:Le,isEmpty:Le})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return Ue(()=>this.records.length)}get records(){return zt(()=>this.nodes.map(({variables:e})=>e),{name:"QueryResult.records"})}get leafNodeThread(){return Is(zt(()=>this.nodes.map(({logsOfThisNode:e})=>e),{name:"QueryResult.leafNodeThread"}))}get leafNodeLogs(){return zt(()=>this.nodes.map(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogs"})}get threadOfAllTrails(){return Is(zt(()=>this.nodes.map(e=>e.threadOfTrail),{name:"QueryResult.threadOfAllTrails"}))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},{WARN:NN,LOG:Ta,DEBUG:tr,VERBOSE:Oe,ERROR:Lr}=$e.setup($e.INFO,{prefix:"[q]"}),jN=We("lastWriteWins",function(e,{inverseToOnlyReturnFirstLogs:t,tolerateAlreadyFiltered:r}={}){if(Oe(`lastWriteWins${t?".inversed":""} < ${e.nameAndSizeUntracked} > initializing`),e.filters.includes("lastWriteWins")){if(r)return tr("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),e;throw Lr("thread already filtered lastWriteWins:",e.filters,{name:e.name})}let n,i=FS(e,function(o,a){let s=_r(o),u,l=[],f=s?null:[];s?(n=new Map,u=o.init):u=o.added;let p;for(let A=t?0:u.length-1;t?A<u.length:A>=0;t?A++:A--){let O=u[A],T=O.en+"|"+O.at;if(p&&(t?p>O.ts:p<O.ts))throw Lr("lastWriteWins.mapper logs not sorted:",p,t?">":"<",O.ts,{log:O,i:A,newLogs:u,inverseToOnlyReturnFirstLogs:t});p=O.ts;let F=n.get(T);(!F||(t?F.ts>O.ts:F.ts<O.ts))&&(F&&!s&&f.push(F),l.push(O),n.set(T,O))}return wi(l),Oe.isDisabled||Oe(`lastWriteWins${t?".inversed":""}<${e.nameAndSizeUntracked}> mapped event`,s?{...Object.fromEntries(Object.entries(o).map(([A,O])=>[A,O?.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 Oe.isDisabled||Et(()=>{Oe(`lastWriteWins<${e.nameAndSizeUntracked}> filtered down to`,i.applogs.length)}),i},{equals:Pi,argsDebugName:e=>Ve({caller:"lastWriteWins",thread:e})}),CN=We("withoutDeleted",function(e){if(Oe.isEnabled&&Oe(`withoutDeleted<${e.nameAndSizeUntracked}>`),e.filters.includes("withoutDeleted"))throw Lr("thread already filtered withoutDeleted:",e.filters,{name:e.name});let t=hn(e,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});Oe.isEnabled&&Oe(`withoutDeleted<${e.nameAndSizeUntracked}> deletionLogs:`,Ue(function(){return[...t.applogs]}));let r=Ve({caller:"allDeletedEntities",thread:e}),n=Pb(function(){return t.map(i=>i.en)},{name:r});return Oe.isEnabled&&Et(()=>{Oe(`withoutDeleted<${e.nameAndSizeUntracked}> deleted:`,[...n])}),hn(e,{"!en":n},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:Pi}),Sp=We("query",function e(t,r,n={},i={}){let o=Ap(t);tr(`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=XS(o,s,u,i);return Oe.isDisabled||Et(()=>Oe("query result:",Yt(l))),l},{equals:su,argsDebugName:(e,t,r)=>Ve({caller:"query",thread:e,args:r?{pattern:t,startVars:r}:t})}),XS=We("queryStep",function(e,t,r,n={}){if(tr(`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]=Tp(r,a?.variables??{});Oe("[queryStep.doQuery] patternWithoutVars: ",s);let l=hn(e,s),f=Oa(u),p=zt(function(){let A=l.map(O=>({log:O,vars:f(O)}));return Oe.isEnabled&&Oe("[queryStep.doQuery] step node:",a?.variables," =>",A,"from:",Ue(()=>l.applogs)),A.map(({log:O,vars:T})=>{let F=Object.assign({},a?.variables,T);return new QS(Rb.fromArray([O],Ve({caller:"QueryNode",thread:l,pattern:`${di(F)}@${di(s)}`})),F,a)})},{name:Ve({caller:"doQuery.mapNodes",thread:l,pattern:r})});return Oe.isEnabled&&Et(()=>Oe("[queryStep.doQuery] resultNodes:",[...p])),n.debug&&Ta("[queryStep] step result:",Ue(()=>p.map(({variables:A,logsOfThisNode:O})=>({variables:A,thread:O})))),p}let o=zt(function(){return tr(`[queryStep] Running with ${t?.nodes?.length} input nodes:`),t?[...t.nodes.flatMap(i)]:[...i(null)]},{name:Ve({caller:"queryStep",thread:e,pattern:r})});return Oe.isEnabled&&Et(()=>Oe("[queryStep] observableResultNodes:",[...o])),new Ip(o)},{equals:su,argsDebugName:(e,t,r)=>Ve({caller:"queryStep",thread:e,pattern:r})}),PN=We("queryNot",function(e,t,r,n={}){let i=t.nodes;tr.force(`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]=Tp(a,s??{});Oe("[queryNot] patternWithoutVars: ",u);let f=hn(e,u);return Oe("[queryNot] step node:",s," =>",f.size,"applogs"),Oe.isDisabled||Oe("[queryNot] step node:",s," => empty?",Ue(()=>f.applogs)),n.debug&&Ta("[queryNot] node result:",s,"=>",f.applogs),f.isEmpty})}return new Ip(i)},{equals:su,argsDebugName:(e,t,r)=>Ve({caller:"queryNot",thread:e,pattern:r})}),kN=We("filterAndMap",function(e,t,r){tr(`filterAndMap<${e.nameAndSizeUntracked}>`,t);let n=hn(e,t);Oe("[filterAndMap] filtered:",n.untrackedSize),Oe.isDisabled||Et(()=>Oe("[filterAndMap] filtered:",n.applogs));let i=Ve({thread:e,pattern:t,caller:"filterAndMap"}),o=zt(()=>eA(n,r),{name:i});return Oe.isDisabled||Et(()=>Oe("[filterAndMap] mapped:",o)),o},{equals:He.structural,argsDebugName:(e,t)=>Ve({caller:"filterAndMap",thread:e,pattern:t})}),UN=We("queryAndMap",function(e,t,r,n={}){let i=Ap(e);tr(`queryAndMap<${i.nameAndSizeUntracked}>`,{patternOrPatterns:t,variables:n,map:r});let o=Ve({thread:i,caller:"queryAndMap"}),a=Sp(i,t);Oe("[queryAndMap] filtered count:",a.untrackedSize);let s=zt(()=>tA(a,r),{name:o});return Oe.isDisabled||Et(()=>Oe("[queryAndMap] result:",Yt(s))),s},{equals:He.structural,argsDebugName:(e,t)=>Ve({caller:"queryAndMap",thread:e,pattern:t})}),RN=We("queryEntity",function(e,t,r,n){tr(`queryEntity<${e.nameAndSizeUntracked}>`,r,t);let i=hn(e,{en:r,at:rA(t,n)});return Oe("queryEntity applogs:",i.applogs),Le(()=>i.isEmpty?null:Object.fromEntries(i.map(({at:o,vl:a})=>[o.slice(t.length+1),a])))},{equals:Nb,argsDebugName:(e,t,r)=>Ve({caller:"queryEntity",thread:e,args:{name:t,entityID:r}})}),DN=We("agentsOfThread",function(e){tr(`agentsOfThread<${e.nameAndSizeUntracked}>`);let t=Re.map(),r=Tt(i=>{for(let o of _r(i)?i.init:i.added){let a=t.get(o.ag)??0;t.set(o.ag,a+1)}for(let o of!_r(i)&&i.removed||[]){let a=t.get(o.ag);if(!a||a<1)throw Lr("[agentsOfThread] number is now negative",{log:o,event:i,mapped:t,prev:a});t.set(o.ag,a-1)}Ta(`agentsOfThread<${e.nameAndSizeUntracked}> processed event`,{event:i,mapped:t})});r({init:e.applogs});let n=e.subscribe(r);return aa(t,n),t}),YS=We("entityOverlap",function(e,t){return Ta(`entityOverlap<${e.nameAndSizeUntracked}, ${t.nameAndSizeUntracked}>`),Le(()=>{let r=new Set(e.map(i=>i.en)),n=new Set(t.map(i=>i.en));return[...r].filter(i=>n.has(i))})}),BN=We("entityOverlapCount",function(e,t){return Le(()=>YS(e,t).get().length)}),ZS=We("querySingle",function(e,t,r={}){let n=Sp(e,t,r);return Le(()=>{if(n.isEmpty)return null;if(n.size>1)throw Lr("[querySingle] got",n.size,"results:",n);let i=n.nodes[0].logsOfThisNode;if(i.size!=1)throw Lr("[querySingle] single result, but got",i.size,"logs:",i.applogs);return i.applogs[0]})},{equals:He.structural,argsDebugName:(e,t)=>Ve({caller:"querySingle",thread:e,pattern:t})}),MN=We("querySingleAndMap",function(e,t,r,n={}){let i=ZS(e,t,n);return Le(()=>{let o=i.get();if(o)return typeof r=="string"?o[r]:Oa(r)(o)})},{equals:He.structural,argsDebugName:(e,t)=>Ve({caller:"querySingleAndMap",thread:e,pattern:t})}),eA=function(e,t){return typeof t=="function"?e.map(t):typeof t=="string"?e.map(r=>r[t]):e.map(Oa(t))},tA=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 Lr(`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=>Oa(t)(e))};function Oa(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function rA(e,t){return t.map(r=>nA(e,r))}function nA(e,t){return`${e}/${t}`}function Ap(e){return Array.isArray(e)?Bi.fromArray(e,`threadFromArray[${e.length}]`,!0):e}var iA=Ke({"../../../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}}}),oA=Ke({"../../../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,p,A=o.length;do{if(f>=A||l>49)throw i.bytes=0,new RangeError("Could not decode varint");p=o[f++],s+=l<28?(p&n)<<l:(p&n)*Math.pow(2,l),l+=7}while(p>=r);return i.bytes=f-u,s}}}),aA=Ke({"../../../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(p){return p<r?1:p<n?2:p<i?3:p<o?4:p<a?5:p<s?6:p<u?7:p<l?8:p<f?9:10}}}),Lu=Ke({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js"(e,t){"use strict";t.exports={encode:iA(),decode:oA(),encodingLength:aA()}}}),LN=new Uint8Array(0);function sA(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 Vu(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 uA(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 p(T){if(T instanceof Uint8Array||(ArrayBuffer.isView(T)?T=new Uint8Array(T.buffer,T.byteOffset,T.byteLength):Array.isArray(T)&&(T=Uint8Array.from(T))),!(T instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(T.length===0)return"";for(var F=0,W=0,x=0,P=T.length;x!==P&&T[x]===0;)x++,F++;for(var G=(P-x)*f+1>>>0,q=new Uint8Array(G);x!==P;){for(var V=T[x],Q=0,L=G-1;(V!==0||Q<W)&&L!==-1;L--,Q++)V+=256*q[L]>>>0,q[L]=V%s>>>0,V=V/s>>>0;if(V!==0)throw new Error("Non-zero carry");W=Q,x++}for(var re=G-W;re!==G&&q[re]===0;)re++;for(var M=u.repeat(F);re<G;++re)M+=e.charAt(q[re]);return M}function A(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return new Uint8Array;var F=0;if(T[F]!==" "){for(var W=0,x=0;T[F]===u;)W++,F++;for(var P=(T.length-F)*l+1>>>0,G=new Uint8Array(P);T[F];){var q=r[T.charCodeAt(F)];if(q===255)return;for(var V=0,Q=P-1;(q!==0||V<x)&&Q!==-1;Q--,V++)q+=s*G[Q]>>>0,G[Q]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");x=V,F++}if(T[F]!==" "){for(var L=P-x;L!==P&&G[L]===0;)L++;for(var re=new Uint8Array(W+(P-L)),M=W;L!==P;)re[M++]=G[L++];return re}}}function O(T){var F=A(T);if(F)return F;throw new Error(`Non-${t} character`)}return{encode:p,decodeUnsafe:A,decode:O}}var lA=uA,cA=lA,fA=cA,dA=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")}},pA=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 $p(this,e)}},hA=class{decoders;constructor(e){this.decoders=e}or(e){return $p(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 $p(e,t){return new hA({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var yA=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 dA(e,t,r),this.decoder=new pA(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Np({name:e,prefix:t,encode:r,decode:n}){return new yA(e,t,r,n)}function xa({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=fA(r,e);return Np({prefix:t,name:e,encode:n,decode:o=>Vu(i(o))})}function mA(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 p=i[e[f]];if(p===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|p,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 gA(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 or({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return Np({prefix:t,name:e,encode(i){return gA(i,n,r)},decode(i){return mA(i,n,r,e)}})}var io=or({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),VN=or({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),zN=or({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),FN=or({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),GN=or({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),KN=or({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),qN=or({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),HN=or({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),WN=or({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Ja=xa({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),JN=xa({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),yr=xa({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),QN=xa({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),vA=jp,Pc=128,bA=127,wA=~bA,_A=Math.pow(2,31);function jp(e,t,r){t=t||[],r=r||0;for(var n=r;e>=_A;)t[r++]=e&255|Pc,e/=128;for(;e&wA;)t[r++]=e&255|Pc,e>>>=7;return t[r]=e|0,jp.bytes=r-n+1,t}var TA=As,OA=128,kc=127;function As(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw As.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&kc)<<i:(a&kc)*Math.pow(2,i),i+=7}while(a>=OA);return As.bytes=o-n,r}var xA=Math.pow(2,7),EA=Math.pow(2,14),IA=Math.pow(2,21),SA=Math.pow(2,28),AA=Math.pow(2,35),$A=Math.pow(2,42),NA=Math.pow(2,49),jA=Math.pow(2,56),CA=Math.pow(2,63),PA=function(e){return e<xA?1:e<EA?2:e<IA?3:e<SA?4:e<AA?5:e<$A?6:e<NA?7:e<jA?8:e<CA?9:10},kA={encode:vA,decode:TA,encodingLength:PA},UA=kA,Go=UA;function $s(e,t=0){return[Go.decode(e,t),Go.decode.bytes]}function Ko(e,t,r=0){return Go.encode(e,t,r),t}function qo(e){return Go.encodingLength(e)}function RA(e,t){let r=t.byteLength,n=qo(e),i=n+qo(r),o=new Uint8Array(i+r);return Ko(e,o,0),Ko(r,o,n),o.set(t,i),new zu(e,r,t,o)}function DA(e){let t=Vu(e),[r,n]=$s(t),[i,o]=$s(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new zu(r,i,a,t)}function BA(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&sA(e.bytes,r.bytes)}}var zu=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Uc(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return LA(r,Ns(e),t??yr.encoder);default:return VA(r,Ns(e),t??io.encoder)}}var Rc=new WeakMap;function Ns(e){let t=Rc.get(e);if(t==null){let r=new Map;return Rc.set(e,r),r}return t}var Cp=class rt{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!==Wn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==zA)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return rt.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=RA(t,r);return rt.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 rt.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&BA(t.multihash,n.multihash)}toString(t){return Uc(this,t)}toJSON(){return{"/":Uc(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 rt)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new rt(n,i,o,a??Dc(n,i,o.bytes))}else if(r[FA]===!0){let{version:n,multihash:i,code:o}=r,a=DA(i);return rt.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!==Wn)throw new Error(`Version 0 CID must use dag-pb (code: ${Wn}) block encoding`);return new rt(t,r,n,n.bytes)}case 1:{let i=Dc(t,r,n.bytes);return new rt(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return rt.create(0,Wn,t)}static createV1(t,r){return rt.create(1,t,r)}static decode(t){let[r,n]=rt.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=rt.inspectBytes(t),n=r.size-r.multihashSize,i=Vu(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 zu(r.multihashCode,r.digestSize,o,i);return[r.version===0?rt.createV0(a):rt.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[p,A]=$s(t.subarray(r));return r+=A,p},i=n(),o=Wn;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]=MA(t,r),o=rt.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ns(o).set(n,t),o}};function MA(e,t){switch(e[0]){case"Q":{let r=t??yr;return[yr.prefix,r.decode(`${yr.prefix}${e}`)]}case yr.prefix:{let r=t??yr;return[yr.prefix,r.decode(e)]}case io.prefix:{let r=t??io;return[io.prefix,r.decode(e)]}case Ja.prefix:{let r=t??Ja;return[Ja.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 LA(e,t,r){let{prefix:n}=r;if(n!==yr.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 VA(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 Wn=112,zA=18;function Dc(e,t,r){let n=qo(e),i=n+qo(t),o=new Uint8Array(i+r.byteLength);return Ko(e,o,0),Ko(t,o,n),o.set(r,i),o}var FA=Symbol.for("@ipld/js-cid/CID"),Pp=42;function GA(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Cp.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new te(D.tag,Pp),new te(D.bytes,r)]}function KA(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function qA(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:GA,undefined:KA,number:qA}},XN={...Bc,typeEncoders:{...Bc.typeEncoders}};function HA(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Cp.decode(e.subarray(1))}var js={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};js.tags[Pp]=HA;var YN={...js,tags:js.tags.slice()},ZN=ir(Lu(),1),vr={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},Yn={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":vr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(vr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Yn["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=Yn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:vr.Int,CarV1HeaderOrV2Pragma:e=>{if(vr.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=Yn["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=Yn.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}},Zn={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":vr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(vr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Zn["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=Zn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:vr.Int,CarV1HeaderOrV2Pragma:e=>{if(vr.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=Zn["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=Zn.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}},ej={toTyped:Yn.CarV1HeaderOrV2Pragma,toRepresentation:Zn.CarV1HeaderOrV2Pragma},tj=Td(),rj=ir(Lu(),1),nj=[new te(D.map,2),new te(D.string,"version"),new te(D.uint,1),new te(D.string,"roots")],ij=new te(D.tag,42),oj=ir(Lu(),1),{WARN:kp,LOG:aj,DEBUG:Mc,VERBOSE:Fu,ERROR:Hi}=$e.setup($e.INFO);async function WA(e){let t=await JA(e);return await Up(t)}async function Up({rootCID:e,blockStore:t},r=[]){if(!e||!t)throw Hi("Empty roots/blocks",{rootCID:e,blockStore:t});let n=await ei(t,e),i,o=null,a=null;if(Fu("[decodePubFromBlocks] root:",e.toString(),n,{blockStore:t}),!n)throw Hi("root not found in blockStore",{blockStore:t,rootCID:e});if(n?.info){o=n.applogs;let f=await ei(t,o);i=await YA(f,t),a=await ei(t,n.info),Mc("new format - infoLogs",a.logs.map(p=>({[p.toString()]:p})))}else i=n.applogs;let s=async f=>{let p=f,A=await ei(t,p);if(!A)throw Hi("Could not find applog CID in pub blocks:",p.toString(),{cid:p,root:n,blockStore:t}),new Error(`Could not find applog CID in pub blocks: ${p.toString()}`);return A.pv instanceof Ut&&(A.pv=A.pv.toV1().toString()),{...A,cid:p.toV1().toString()}},u;if(u=await Promise.all(i.map(s)),n.prev){if(Eu(n.prev,e)||T1(r,n.prev))throw Hi("[pubFromBlocks] pub chain has a loop",{rootCID:e,prev:n.prev,recursionTrace:r});u.push(...(await Up({rootCID:n.prev,blockStore:t},[...r,e])).applogs)}let l={cid:e,info:{...a,logs:await Promise.all(a.logs.map(s))},applogsCID:o,applogs:u};return Mc("[decodePubFromBlocks] result:",l,{rootCID:e.toString(),root:n,blockStore:t,applogs:u,info:a}),l}async function JA(e){let t=(await e.getRoots()).map(n=>(typeof n.toV1=="function"?n:Ut.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:Ut.decode(n.bytes);Fu({cidFromCarblocks:n,cid:o}),r.set(o.toV1().toString(),i)}return t.length!==1&&kp("Unexpected roots count:",t),{rootCID:Ut.parse(t[0]),blockStore:{get:n=>r.get(n.toV1().toString())}}}async function ei(e,t){try{var r=await e.get(t);if(!r)return kp("returning null"),null}catch(n){if(n.message==="Not Found")return null;throw n}return Tu(r)}function QA(e){return async function*(){for(;;){let{done:t,value:r}=await e.read();if(Fu("[car] chunk",{done:t,value:r}),t)break;yield r}}()}var{WARN:sj,LOG:uj,DEBUG:lj,VERBOSE:cj,ERROR:XA}=$e.setup($e.INFO);async function YA(e,t){return ZA(e)?(await Promise.all(e.chunks.map(async r=>{let n=await ei(t,r);if(!n.logs)throw XA("Weird chunk",n);return n.logs}))).flat():e.logs}function ZA(e){return e.chunks}var Ho=_i(oh(),1),e$=_i(ah(),1),Rp=!1,Dp=!1;Ho.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(Rp=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(Dp=process?.env?.LOGGER_PERF_PREFIX==="true"));var t$={prefix:void 0,time:Rp,delta:Dp,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},Qa=[],Bp=class{sinceFirst=0;sinceLast=0;time=!1;delta=!1;constructor(e,t,r,n){Object.assign(this,{sinceFirst:e,sinceLast:t,time:r,delta:n})}toString(){let e=this.sinceFirst*.001,t=e.toFixed(e<5?2:1),r=this.sinceLast<1e3?`${this.sinceLast.toFixed(0)}`.padStart(5," "):`${`${(this.sinceLast*.001).toFixed(this.sinceLast<1e4?1:0)}`.padStart(4," ")}s`;return`[${[this.time?t:null,this.delta?r:null].filter(n=>n!=null).join(",")}]`}},Mp=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},ti=!1,yn=class st{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=st.INFO,r={}){r=Object.assign({},t$,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(...A){let O=A[A.length-1];return O===i?O():(o(...A.slice(0,-1)),(async()=>{try{let T=O();return T instanceof Promise?await T:T}finally{console.groupEnd()}})())}let p=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:l});return u?p:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:p})},s=a(t>=st.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(s(...u),new Error((0,e$.default)(u))),WARN:a(t>=st.WARN,this.wrapLog(console.warn,r)),LOG:a(t>=st.INFO,this.wrapLog(console.log,r)),DEBUG:a(t>=st.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:a(t>=st.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(Ho.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=Ho.isBrowser&&navigator.userAgent.includes("Chrome")?["",st.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(ti?n.push(new Mp("dim",r.prefix)):n.push(r.prefix)),t.bind(console,...n)}}static timeStr(t,r,n=0){if(!performance.now)return;let i=performance.now();st.firstLog||(st.firstLog=i,st.lastLog=i);let o=new Bp(i-st.firstLog,i-st.lastLog,t,r);return st.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}}}};Ho.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(Qa&&Qa.length){for(let t of Qa)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof Bp))return null;ti||(ti=!0);let t=yn.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof Mp?(ti||(ti=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var{WARN:r$,LOG:fj,DEBUG:ii,VERBOSE:dj,ERROR:Ea}=yn.setup(yn.DEBUG),Gu=["https://cloudflare-ipfs.com/","https://ipfs.4everland.io/"].map(e=>({url:e}));async function Ku(e,{readOnly:t=!0,pinnedCID:r,gateways:n=Gu}={}){let{cid:i,errors:o,isIpns:a}=_1(e);if(!i)throw Ea("Failed to parse pubID",e,o);ii("[retrieveThread] parsedPubID",{cid:i.toString(),errors:o,isIpns:a});let s=await Lp(i),{applogs:u,info:l}=await WA(s),f=u.filter(bs);f.length&&r$(`Found ${f.length} encrypted logs - skipping`);let p=u.filter(O=>!bs(O));wi(p);let A=Bi.fromArray(p,`preview${e&&e!==i.toString()?"-"+e:""}@${i.toString()}`,t);return{cid:i,info:l,thread:A,encryptedCount:f.length}}async function Lp(e,t=Gu){return e=_s(e),ii("Retrieving:",e,e.toString(),"from",t),await qu(t,async(r,n)=>{var i=Vp(r,e);n>1&&(i+=`&cache-bust=${performance.now()}`);let o=await fetch(i),a=await n$(o,i);ii("[retrieveCar] GW result",{result:a,gateway:r});let s=await sf.fromIterable(a);ii("[retrieveCar] GW decodeResult",{car:s,gateway:r});let u=(await s.getRoots())[0];if(!xu(e)&&!Eu(e,u))throw Ea("Fetched CAR has different CID",u.toString(),"than the one asked for:",e.toString());return s})}function Vp(e,t){let r=new URL(e.url),n=xu(t),i=`${r}${n?"ipns/":"ipfs/"}${t.toString()}?format=car&dag-scope=all`;return ii({isIpns:n,url:i}),i}async function n$(e,t){if(!e?.ok||!e?.body)throw Ea("[retrieveCar] unexpected response",e?.statusText,{url:t});return QA(e.body.getReader())}async function qu(e,t,r=1){try{return await Promise.any(Io(e).map(async n=>{try{return await t(n,r)}catch(i){throw Ea("still trying",i),i instanceof Error?i:new Error(`[retrieveCar] error: ${i}`)}}))}catch(n){if(r<3)return await qu(e,t,r+1);throw new Error("[Gateway] no valid results after 3 attempts via: "+Io(e).map(({url:i})=>i)+`
63
+ `+n.errors.map(i=>i.message))}}var{WARN:UC,LOG:RC,DEBUG:DC,VERBOSE:BC,ERROR:MC}=$e.setup($e.INFO),{WARN:i$,LOG:LC,DEBUG:o$,VERBOSE:Ia,ERROR:VC}=$e.setup($e.INFO),zC=We("queryDivergencesByPrev",function(e){o$(`queryDivergencesByPrev<${e.nameAndSizeUntracked}>`),e.filters.includes("lastWriteWins")&&i$("queryDivergencesByPrev on thread lastWriteWins",e);let t=zt(()=>{let r=new Map,n=new Set;Ia("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())),Ia("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 Bi(Ve({caller:"DivergenceLeaf",thread:e,pattern:`leaf: ${i}`}),r.get(i),e.filters,!0);return{log:o.latestLog,thread:o}})},{name:Ve({caller:"queryDivergencesByPrev",thread:e})});return Ia.isDisabled||Et(()=>Ia("[queryDivergencesByPrev] result:",Yt(t))),t},{equals:He.structural}),{WARN:FC,LOG:GC,DEBUG:KC,VERBOSE:qC,ERROR:HC}=yn.setup(yn.DEBUG);var{WARN:XC,LOG:YC,DEBUG:ZC,VERBOSE:eP,ERROR:tP}=ja.setup(ja.DEBUG),a$="https://nftstorage.link";async function rP(e,{readOnly:t=!0,pinnedCID:r}={}){return Ku(e,{readOnly:t,pinnedCID:r,gateways:[{url:a$}]})}export{a$ as a,rP as b};
64
+ /*! Bundled license information:
65
+
66
+ @noble/hashes/esm/utils.js:
67
+ (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
68
+
69
+ lodash-es/lodash.js:
70
+ (**
71
+ * @license
72
+ * Lodash (Custom Build) <https://lodash.com/>
73
+ * Build: `lodash modularize exports="es" -o ./`
74
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
75
+ * Released under MIT license <https://lodash.com/license>
76
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
77
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
78
+ *)
79
+ */
80
+ //# sourceMappingURL=chunk-ZPBUA66Z.min.js.map