@wovin/connect-nftstorage 0.1.24 → 0.1.25
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 ws}from"./chunk-BKKH6BET.min.js";var wy=Object.create,Gf=Object.defineProperty,_y=Object.getOwnPropertyDescriptor,Ty=Object.getOwnPropertyNames,Ey=Object.getPrototypeOf,Oy=Object.prototype.hasOwnProperty,Gn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),xy=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ty(t))!Oy.call(e,i)&&i!==r&&Gf(e,i,{get:()=>t[i],enumerable:!(n=_y(t,i))||n.enumerable});return e},Ji=(e,t,r)=>(r=e!=null?wy(Ey(e)):{},xy(t||!e||!e.__esModule?Gf(r,"default",{value:e,enumerable:!0}):r,e)),Ay=Gn((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}}),Sy=Gn((e,t)=>{"use strict";t.exports=i;var r=128,n=127;function i(o,u){var s=0,u=u||0,l=0,f=u,d,$=o.length;do{if(f>=$||l>49)throw i.bytes=0,new RangeError("Could not decode varint");d=o[f++],s+=l<28?(d&n)<<l:(d&n)*Math.pow(2,l),l+=7}while(d>=r);return i.bytes=f-u,s}}),Iy=Gn((e,t)=>{"use strict";var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),a=Math.pow(2,35),s=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),f=Math.pow(2,63);t.exports=function(d){return d<r?1:d<n?2:d<i?3:d<o?4:d<a?5:d<s?6:d<u?7:d<l?8:d<f?9:10}}),Eu=Gn((e,t)=>{"use strict";t.exports={encode:Ay(),decode:Sy(),encodingLength:Iy()}}),$y=Gn(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}),ky=Gn((e,t)=>{"use strict";t.exports=function(r,n){n||(n={}),typeof n=="function"&&(n={cmp:n});var i=typeof n.cycles=="boolean"?n.cycles:!1,o=n.cmp&&function(s){return function(u){return function(l,f){var d={key:l,value:u[l]},$={key:f,value:u[f]};return s(d,$)}}}(n.cmp),a=[];return function s(u){if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u!==void 0){if(typeof u=="number")return isFinite(u)?""+u:"null";if(typeof u!="object")return JSON.stringify(u);var l,f;if(Array.isArray(u)){for(f="[",l=0;l<u.length;l++)l&&(f+=","),f+=s(u[l])||"null";return f+"]"}if(u===null)return"null";if(a.indexOf(u)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var d=a.push(u)-1,$=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<$.length;l++){var E=$[l],T=s(u[E]);T&&(f&&(f+=","),f+=JSON.stringify(E)+":"+T)}return a.splice(d,1),"{"+f+"}"}}(r)}}),jy=["Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function Ny(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return t==="string"||t==="number"||t==="bigint"||t==="symbol"?t:t==="function"?"Function":Array.isArray(e)?"Array":e instanceof Uint8Array?"Uint8Array":e.constructor===Object?"Object":Cy(e)||"Object"}function Cy(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(jy.includes(t))return t}var G=class{constructor(e,t,r){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=r}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}static equals(e,t){return e===t||e.major===t.major&&e.name===t.name}};G.uint=new G(0,"uint",!0);G.negint=new G(1,"negint",!0);G.bytes=new G(2,"bytes",!0);G.string=new G(3,"string",!0);G.array=new G(4,"array",!1);G.map=new G(5,"map",!1);G.tag=new G(6,"tag",!1);G.float=new G(7,"float",!0);G.false=new G(7,"false",!0);G.true=new G(7,"true",!0);G.null=new G(7,"null",!0);G.undefined=new G(7,"undefined",!0);G.break=new G(7,"break",!0);var me=class{constructor(e,t,r){this.type=e,this.value=t,this.encodedLength=r,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},Qi=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Uy=new TextEncoder;function Bo(e){return Qi&&globalThis.Buffer.isBuffer(e)}function Ou(e){return e instanceof Uint8Array?Bo(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Py=24,My=200,Ry=Qi?e=>e.length>=Py?globalThis.Buffer.from(e):Kl(e):e=>e.length>=My?Uy.encode(e):Kl(e),dr=e=>Uint8Array.from(e),Ly=Qi?(e,t,r)=>Bo(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Dy=Qi?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Ou(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},By=Qi?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Hf(e,t){if(Bo(e)&&Bo(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 Kl(e){let t=[],r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=i&63|128):(i&64512)===55296&&n+1<e.length&&(e.charCodeAt(n+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++n)&1023),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=i&63|128):(i>=55296&&i<=57343&&(i=65533),t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}var Vy=256,Wf=class{constructor(e=Vy){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=By(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=Ly(r,0,this.cursor)}else t=Dy(this.chunks,this.cursor);return e&&this.reset(),t}},Fy=class{constructor(e){this.dest=e,this.cursor=0,this.chunks=[e]}reset(){this.cursor=0}push(e){if(this.cursor+e.length>this.dest.length)throw new Error("write out of bounds, destination buffer is too small");this.dest.set(e,this.cursor),this.cursor+=e.length}toBytes(e=!1){let t=this.dest.subarray(0,this.cursor);return e&&this.reset(),t}},xe="CBOR decode error:",Jf="CBOR encode error:",Yi=[];Yi[23]=1;Yi[24]=2;Yi[25]=3;Yi[26]=5;Yi[27]=9;function Hn(e,t,r){if(e.length-t<r)throw new Error(`${xe} not enough data for type`)}var rt=[24,256,65536,4294967296,BigInt("18446744073709551616")];function fn(e,t,r){Hn(e,t,1);let n=e[t];if(r.strict===!0&&n<rt[0])throw new Error(`${xe} integer encoded in more bytes than necessary (strict decode)`);return n}function dn(e,t,r){Hn(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<rt[1])throw new Error(`${xe} integer encoded in more bytes than necessary (strict decode)`);return n}function pn(e,t,r){Hn(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<rt[2])throw new Error(`${xe} integer encoded in more bytes than necessary (strict decode)`);return n}function hn(e,t,r){Hn(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<rt[3])throw new Error(`${xe} 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(`${xe} integers outside of the safe integer range are not supported`)}function zy(e,t,r,n){return new me(G.uint,fn(e,t+1,n),2)}function Ky(e,t,r,n){return new me(G.uint,dn(e,t+1,n),3)}function qy(e,t,r,n){return new me(G.uint,pn(e,t+1,n),5)}function Gy(e,t,r,n){return new me(G.uint,hn(e,t+1,n),9)}function yn(e,t){return Lt(e,0,t.value)}function Lt(e,t,r){if(r<rt[0]){let n=Number(r);e.push([t|n])}else if(r<rt[1]){let n=Number(r);e.push([t|24,n])}else if(r<rt[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<rt[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<rt[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),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(`${xe} encountered BigInt larger than allowable range`)}}yn.encodedSize=function(e){return Lt.encodedSize(e.value)};Lt.encodedSize=function(e){return e<rt[0]?1:e<rt[1]?2:e<rt[2]?3:e<rt[3]?5:9};yn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function Hy(e,t,r,n){return new me(G.negint,-1-fn(e,t+1,n),2)}function Wy(e,t,r,n){return new me(G.negint,-1-dn(e,t+1,n),3)}function Jy(e,t,r,n){return new me(G.negint,-1-pn(e,t+1,n),5)}var xu=BigInt(-1),Qf=BigInt(1);function Qy(e,t,r,n){let i=hn(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new me(G.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${xe} integers outside of the safe integer range are not supported`);return new me(G.negint,xu-BigInt(i),9)}function Au(e,t){let r=t.value,n=typeof r=="bigint"?r*xu-Qf:r*-1-1;Lt(e,t.type.majorEncoded,n)}Au.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*xu-Qf:t*-1-1;return r<rt[0]?1:r<rt[1]?2:r<rt[2]?3:r<rt[3]?5:9};Au.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Xi(e,t,r,n){Hn(e,t,r+n);let i=e.slice(t+r,t+r+n);return new me(G.bytes,i,r+n)}function Yy(e,t,r,n){return Xi(e,t,1,r)}function Xy(e,t,r,n){return Xi(e,t,2,fn(e,t+1,n))}function Zy(e,t,r,n){return Xi(e,t,3,dn(e,t+1,n))}function eg(e,t,r,n){return Xi(e,t,5,pn(e,t+1,n))}function tg(e,t,r,n){let i=hn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${xe} 64-bit integer bytes lengths not supported`);return Xi(e,t,9,i)}function Vo(e){return e.encodedBytes===void 0&&(e.encodedBytes=G.equals(e.type,G.string)?Ry(e.value):e.value),e.encodedBytes}function ja(e,t){let r=Vo(t);Lt(e,t.type.majorEncoded,r.length),e.push(r)}ja.encodedSize=function(e){let t=Vo(e);return Lt.encodedSize(t.length)+t.length};ja.compareTokens=function(e,t){return rg(Vo(e),Vo(t))};function rg(e,t){return e.length<t.length?-1:e.length>t.length?1:Hf(e,t)}var ql=new TextDecoder,ng=32;function ig(e,t,r){if(r-t<ng){let n="";for(let i=t;i<r;i++){let o=e[i];if(o&128)return ql.decode(e.subarray(t,r));n+=String.fromCharCode(o)}return n}return ql.decode(e.subarray(t,r))}function Zi(e,t,r,n,i){let o=r+n;Hn(e,t,o);let a=new me(G.string,ig(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=e.slice(t+r,t+o)),a}function og(e,t,r,n){return Zi(e,t,1,r,n)}function ag(e,t,r,n){return Zi(e,t,2,fn(e,t+1,n),n)}function sg(e,t,r,n){return Zi(e,t,3,dn(e,t+1,n),n)}function ug(e,t,r,n){return Zi(e,t,5,pn(e,t+1,n),n)}function lg(e,t,r,n){let i=hn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${xe} 64-bit integer string lengths not supported`);return Zi(e,t,9,i,n)}var cg=ja;function Wn(e,t,r,n){return new me(G.array,n,r)}function fg(e,t,r,n){return Wn(e,t,1,r)}function dg(e,t,r,n){return Wn(e,t,2,fn(e,t+1,n))}function pg(e,t,r,n){return Wn(e,t,3,dn(e,t+1,n))}function hg(e,t,r,n){return Wn(e,t,5,pn(e,t+1,n))}function yg(e,t,r,n){let i=hn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${xe} 64-bit integer array lengths not supported`);return Wn(e,t,9,i)}function gg(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${xe} indefinite length items not allowed`);return Wn(e,t,1,1/0)}function Su(e,t){Lt(e,G.array.majorEncoded,t.value)}Su.compareTokens=yn.compareTokens;Su.encodedSize=function(e){return Lt.encodedSize(e.value)};function Jn(e,t,r,n){return new me(G.map,n,r)}function mg(e,t,r,n){return Jn(e,t,1,r)}function bg(e,t,r,n){return Jn(e,t,2,fn(e,t+1,n))}function vg(e,t,r,n){return Jn(e,t,3,dn(e,t+1,n))}function wg(e,t,r,n){return Jn(e,t,5,pn(e,t+1,n))}function _g(e,t,r,n){let i=hn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${xe} 64-bit integer map lengths not supported`);return Jn(e,t,9,i)}function Tg(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${xe} indefinite length items not allowed`);return Jn(e,t,1,1/0)}function Iu(e,t){Lt(e,G.map.majorEncoded,t.value)}Iu.compareTokens=yn.compareTokens;Iu.encodedSize=function(e){return Lt.encodedSize(e.value)};function Eg(e,t,r,n){return new me(G.tag,r,1)}function Og(e,t,r,n){return new me(G.tag,fn(e,t+1,n),2)}function xg(e,t,r,n){return new me(G.tag,dn(e,t+1,n),3)}function Ag(e,t,r,n){return new me(G.tag,pn(e,t+1,n),5)}function Sg(e,t,r,n){return new me(G.tag,hn(e,t+1,n),9)}function $u(e,t){Lt(e,G.tag.majorEncoded,t.value)}$u.compareTokens=yn.compareTokens;$u.encodedSize=function(e){return Lt.encodedSize(e.value)};var Yf=20,Xf=21,Zf=22,ed=23;function Ig(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${xe} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new me(G.null,null,1):new me(G.undefined,void 0,1)}function $g(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${xe} indefinite length items not allowed`);return new me(G.break,void 0,1)}function ku(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${xe} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${xe} Infinity values are not supported`)}return new me(G.float,e,t)}function kg(e,t,r,n){return ku(Nu(e,t+1),3,n)}function jg(e,t,r,n){return ku(Cu(e,t+1),5,n)}function Ng(e,t,r,n){return ku(id(e,t+1),9,n)}function ju(e,t,r){let n=t.value;if(n===!1)e.push([G.float.majorEncoded|Yf]);else if(n===!0)e.push([G.float.majorEncoded|Xf]);else if(n===null)e.push([G.float.majorEncoded|Zf]);else if(n===void 0)e.push([G.float.majorEncoded|ed]);else{let i,o=!1;(!r||r.float64!==!0)&&(rd(n),i=Nu(zt,1),n===i||Number.isNaN(n)?(zt[0]=249,e.push(zt.slice(0,3)),o=!0):(nd(n),i=Cu(zt,1),n===i&&(zt[0]=250,e.push(zt.slice(0,5)),o=!0))),o||(Cg(n),i=id(zt,1),zt[0]=251,e.push(zt.slice(0,9)))}}ju.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){rd(r);let n=Nu(zt,1);if(r===n||Number.isNaN(r))return 3;if(nd(r),n=Cu(zt,1),r===n)return 5}return 9};var td=new ArrayBuffer(9),xt=new DataView(td,1),zt=new Uint8Array(td,0);function rd(e){if(e===1/0)xt.setUint16(0,31744,!1);else if(e===-1/0)xt.setUint16(0,64512,!1);else if(Number.isNaN(e))xt.setUint16(0,32256,!1);else{xt.setFloat32(0,e);let t=xt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)xt.setUint16(0,31744,!1);else if(r===0)xt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?xt.setUint16(0,0):i<-14?xt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):xt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Nu(e,t){if(e.length-t<2)throw new Error(`${xe} 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 nd(e){xt.setFloat32(0,e,!1)}function Cu(e,t){if(e.length-t<4)throw new Error(`${xe} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function Cg(e){xt.setFloat64(0,e,!1)}function id(e,t){if(e.length-t<8)throw new Error(`${xe} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}ju.compareTokens=yn.compareTokens;function ke(e,t,r){throw new Error(`${xe} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Na(e){return()=>{throw new Error(`${xe} ${e}`)}}var ue=[];for(let e=0;e<=23;e++)ue[e]=ke;ue[24]=zy;ue[25]=Ky;ue[26]=qy;ue[27]=Gy;ue[28]=ke;ue[29]=ke;ue[30]=ke;ue[31]=ke;for(let e=32;e<=55;e++)ue[e]=ke;ue[56]=Hy;ue[57]=Wy;ue[58]=Jy;ue[59]=Qy;ue[60]=ke;ue[61]=ke;ue[62]=ke;ue[63]=ke;for(let e=64;e<=87;e++)ue[e]=Yy;ue[88]=Xy;ue[89]=Zy;ue[90]=eg;ue[91]=tg;ue[92]=ke;ue[93]=ke;ue[94]=ke;ue[95]=Na("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ue[e]=og;ue[120]=ag;ue[121]=sg;ue[122]=ug;ue[123]=lg;ue[124]=ke;ue[125]=ke;ue[126]=ke;ue[127]=Na("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ue[e]=fg;ue[152]=dg;ue[153]=pg;ue[154]=hg;ue[155]=yg;ue[156]=ke;ue[157]=ke;ue[158]=ke;ue[159]=gg;for(let e=160;e<=183;e++)ue[e]=mg;ue[184]=bg;ue[185]=vg;ue[186]=wg;ue[187]=_g;ue[188]=ke;ue[189]=ke;ue[190]=ke;ue[191]=Tg;for(let e=192;e<=215;e++)ue[e]=Eg;ue[216]=Og;ue[217]=xg;ue[218]=Ag;ue[219]=Sg;ue[220]=ke;ue[221]=ke;ue[222]=ke;ue[223]=ke;for(let e=224;e<=243;e++)ue[e]=Na("simple values are not supported");ue[244]=ke;ue[245]=ke;ue[246]=ke;ue[247]=Ig;ue[248]=Na("simple values are not supported");ue[249]=kg;ue[250]=jg;ue[251]=Ng;ue[252]=ke;ue[253]=ke;ue[254]=ke;ue[255]=$g;var ur=[];for(let e=0;e<24;e++)ur[e]=new me(G.uint,e,1);for(let e=-1;e>=-24;e--)ur[31-e]=new me(G.negint,e,1);ur[64]=new me(G.bytes,new Uint8Array(0),1);ur[96]=new me(G.string,"",1);ur[128]=new me(G.array,0,1);ur[160]=new me(G.map,0,1);ur[244]=new me(G.false,!1,1);ur[245]=new me(G.true,!0,1);ur[246]=new me(G.null,null,1);function Ug(e){switch(e.type){case G.false:return dr([244]);case G.true:return dr([245]);case G.null:return dr([246]);case G.bytes:return e.value.length?void 0:dr([64]);case G.string:return e.value===""?dr([96]):void 0;case G.array:return e.value===0?dr([128]):void 0;case G.map:return e.value===0?dr([160]):void 0;case G.uint:return e.value<24?dr([Number(e.value)]):void 0;case G.negint:if(e.value>=-24)return dr([31-Number(e.value)])}}var Pg=Object.freeze({float64:!0,mapSorter:Bg,quickEncodeToken:Ug});function Mg(){let e=[];return e[G.uint.major]=yn,e[G.negint.major]=Au,e[G.bytes.major]=ja,e[G.string.major]=cg,e[G.array.major]=Su,e[G.map.major]=Iu,e[G.tag.major]=$u,e[G.float.major]=ju,e}var Rg=Mg(),Lg=new Wf,Gl=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(`${Jf} object contains circular references`);return new od(r,t)}},Ir={null:new me(G.null,null),undefined:new me(G.undefined,void 0),true:new me(G.true,!0),false:new me(G.false,!1),emptyArray:new me(G.array,0),emptyMap:new me(G.map,0)},Vr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new me(G.float,e):e>=0?new me(G.uint,e):new me(G.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new me(G.uint,e):new me(G.negint,e)},Uint8Array(e,t,r,n){return new me(G.bytes,e)},string(e,t,r,n){return new me(G.string,e)},boolean(e,t,r,n){return e?Ir.true:Ir.false},null(e,t,r,n){return Ir.null},undefined(e,t,r,n){return Ir.undefined},ArrayBuffer(e,t,r,n){return new me(G.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new me(G.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Ir.emptyArray,new me(G.break)]:Ir.emptyArray;n=Gl.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=So(a,r,n);return r.addBreakTokens?[new me(G.array,e.length),i,new me(G.break)]:[new me(G.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length,s;if(a){s=new Array(a),n=Gl.createCheck(n,e);let u=!i&&r.ignoreUndefinedProperties,l=0;for(let f of o){let d=i?e.get(f):e[f];u&&d===void 0||(s[l++]=[So(f,r,n),So(d,r,n)])}l<a&&(s.length=l)}return s?.length?(Dg(s,r),r.addBreakTokens?[new me(G.map,s.length),s,new me(G.break)]:[new me(G.map,s.length),s]):r.addBreakTokens===!0?[Ir.emptyMap,new me(G.break)]:Ir.emptyMap}};Vr.Map=Vr.Object;Vr.Buffer=Vr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Vr[`${e}Array`]=Vr.DataView;function So(e,t={},r){let n=Ny(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Vr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=Vr[n];if(!o)throw new Error(`${Jf} unsupported type: ${n}`);return o(e,n,t,r)}function Dg(e,t){t.mapSorter&&e.sort(t.mapSorter)}function Bg(e,t){if(e[0]instanceof me&&t[0]instanceof me){let r=e[0],n=t[0];return r._keyBytes||(r._keyBytes=Hl(r.value)),n._keyBytes||(n._keyBytes=Hl(n.value)),Hf(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function Hl(e){return Vg(e,Rg,Pg)}function ad(e,t,r,n){if(Array.isArray(t))for(let i of t)ad(e,i,r,n);else r[t.type.major](e,t,n)}var Qj=G.uint.majorEncoded,Yj=G.negint.majorEncoded,Xj=G.bytes.majorEncoded,Zj=G.string.majorEncoded,eN=G.array.majorEncoded,tN=G.float.majorEncoded|Yf,rN=G.float.majorEncoded|Xf,nN=G.float.majorEncoded|Zf,iN=G.float.majorEncoded|ed,oN=BigInt(-1),aN=BigInt(1);function Vg(e,t,r,n){let i=n instanceof Uint8Array,o=i?new Fy(n):Lg,a=So(e,r);if(!Array.isArray(a)&&r.quickEncodeToken){let s=r.quickEncodeToken(a);if(s)return i?(o.push(s),o.toBytes()):s;let u=t[a.type.major];if(u.encodedSize){let l=u.encodedSize(a,r);if(i||(o=new Wf(l)),u(o,a,r),o.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${a} was wrong`);return i?o.toBytes():Ou(o.chunks[0])}}return o.reset(),ad(o,a,t,r),o.toBytes(!0)}var Fg={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},zg=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=ur[e];if(t===void 0){let r=ue[e];if(!r)throw new Error(`${xe} 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"),Ca=Symbol.for("BREAK");function Kg(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=Mi(t,r);if(o===Ca){if(e.value===1/0)break;throw new Error(`${xe} got unexpected break to lengthed array`)}if(o===Pi)throw new Error(`${xe} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function qg(e,t,r){let n=r.useMaps===!0,i=r.rejectDuplicateMapKeys===!0,o=n?void 0:{},a=n?new Map:void 0;for(let s=0;s<e.value;s++){let u=Mi(t,r);if(u===Ca){if(e.value===1/0)break;throw new Error(`${xe} got unexpected break to lengthed map`)}if(u===Pi)throw new Error(`${xe} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(!n&&typeof u!="string")throw new Error(`${xe} non-string keys not supported (got ${typeof u})`);if(i&&(n&&a.has(u)||!n&&Object.hasOwn(o,u)))throw new Error(`${xe} found repeat map key "${u}"`);let l=Mi(t,r);if(l===Pi)throw new Error(`${xe} found map but not enough entries (got ${s} [no value], expected ${e.value})`);n?a.set(u,l):o[u]=l}return n?a:o}function Mi(e,t){if(e.done())return Pi;let r=e.next();if(G.equals(r.type,G.break))return Ca;if(r.type.terminal)return r.value;if(G.equals(r.type,G.array))return Kg(r,e,t);if(G.equals(r.type,G.map))return qg(r,e,t);if(G.equals(r.type,G.tag)){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Mi(e,t);return t.tags[r.value](n)}throw new Error(`${xe} tag not supported (${r.value})`)}throw new Error("unsupported")}function Gg(e,t){if(!(e instanceof Uint8Array))throw new Error(`${xe} data to decode must be a Uint8Array`);t=Object.assign({},Fg,t);let r=Ou(e),n=t.tokenizer||new zg(r,t),i=Mi(n,t);if(i===Pi)throw new Error(`${xe} did not find any content to decode`);if(i===Ca)throw new Error(`${xe} got unexpected break`);return[i,e.subarray(n.pos())]}function Hg(e,t){let[r,n]=Gg(e,t);if(n.length>0)throw new Error(`${xe} too many terminals, data makes no sense`);return r}var sN=new Uint8Array(0);function Wg(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 Uu(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 Jg(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(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 B=0,W=0,R=0,k=T.length;R!==k&&T[R]===0;)R++,B++;for(var F=(k-R)*f+1>>>0,q=new Uint8Array(F);R!==k;){for(var L=T[R],Q=0,K=F-1;(L!==0||Q<W)&&K!==-1;K--,Q++)L+=256*q[K]>>>0,q[K]=L%s>>>0,L=L/s>>>0;if(L!==0)throw new Error("Non-zero carry");W=Q,R++}for(var te=F-W;te!==F&&q[te]===0;)te++;for(var j=u.repeat(B);te<F;++te)j+=e.charAt(q[te]);return j}function $(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return new Uint8Array;var B=0;if(T[B]!==" "){for(var W=0,R=0;T[B]===u;)W++,B++;for(var k=(T.length-B)*l+1>>>0,F=new Uint8Array(k);T[B];){var q=r[T.charCodeAt(B)];if(q===255)return;for(var L=0,Q=k-1;(q!==0||L<R)&&Q!==-1;Q--,L++)q+=s*F[Q]>>>0,F[Q]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");R=L,B++}if(T[B]!==" "){for(var K=k-R;K!==k&&F[K]===0;)K++;for(var te=new Uint8Array(W+(k-K)),j=W;K!==k;)te[j++]=F[K++];return te}}}function E(T){var B=$(T);if(B)return B;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:$,decode:E}}var Qg=Jg,Yg=Qg,Xg=Yg,Zg=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")}},em=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 sd(this,e)}},tm=class{decoders;constructor(e){this.decoders=e}or(e){return sd(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 sd(e,t){return new tm({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var rm=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 Zg(e,t,r),this.decoder=new em(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function ud({name:e,prefix:t,encode:r,decode:n}){return new rm(e,t,r,n)}function Ua({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Xg(r,e);return ud({prefix:t,name:e,encode:n,decode:o=>Uu(i(o))})}function nm(e,t,r,n){let i=e.length;for(;e[i-1]==="=";)--i;let o=new Uint8Array(i*r/8|0),a=0,s=0,u=0;for(let l=0;l<i;++l){let f=t[e[l]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);s=s<<r|f,a+=r,a>=8&&(a-=8,o[u++]=255&s>>a)}if(a>=r||255&s<<8-a)throw new SyntaxError("Unexpected end of data");return o}function im(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 om(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function _r({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=om(n);return ud({prefix:t,name:e,encode(o){return im(o,n,r)},decode(o){return nm(o,i,r,e)}})}var Io=_r({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),uN=_r({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),lN=_r({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),cN=_r({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),fN=_r({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),dN=_r({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),pN=_r({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),hN=_r({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),yN=_r({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),_s=Ua({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),gN=Ua({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Cr=Ua({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mN=Ua({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),am=ld,Wl=128,sm=127,um=~sm,lm=Math.pow(2,31);function ld(e,t,r){t=t||[],r=r||0;for(var n=r;e>=lm;)t[r++]=e&255|Wl,e/=128;for(;e&um;)t[r++]=e&255|Wl,e>>>=7;return t[r]=e|0,ld.bytes=r-n+1,t}var cm=Vs,fm=128,Jl=127;function Vs(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Vs.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Jl)<<i:(a&Jl)*Math.pow(2,i),i+=7}while(a>=fm);return Vs.bytes=o-n,r}var dm=Math.pow(2,7),pm=Math.pow(2,14),hm=Math.pow(2,21),ym=Math.pow(2,28),gm=Math.pow(2,35),mm=Math.pow(2,42),bm=Math.pow(2,49),vm=Math.pow(2,56),wm=Math.pow(2,63),_m=function(e){return e<dm?1:e<pm?2:e<hm?3:e<ym?4:e<gm?5:e<mm?6:e<bm?7:e<vm?8:e<wm?9:10},Tm={encode:am,decode:cm,encodingLength:_m},Em=Tm,Fo=Em;function Fs(e,t=0){return[Fo.decode(e,t),Fo.decode.bytes]}function zo(e,t,r=0){return Fo.encode(e,t,r),t}function Ko(e){return Fo.encodingLength(e)}function Om(e,t){let r=t.byteLength,n=Ko(e),i=n+Ko(r),o=new Uint8Array(i+r);return zo(e,o,0),zo(r,o,n),o.set(t,i),new Pu(e,r,t,o)}function xm(e){let t=Uu(e),[r,n]=Fs(t),[i,o]=Fs(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Pu(r,i,a,t)}function Am(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Wg(e.bytes,r.bytes)}}var Pu=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Ql(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return Im(r,zs(e),t??Cr.encoder);default:return $m(r,zs(e),t??Io.encoder)}}var Yl=new WeakMap;function zs(e){let t=Yl.get(e);if(t==null){let r=new Map;return Yl.set(e,r),r}return t}var cd=class st{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==vi)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 st.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=Om(t,r);return st.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return st.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&Am(t.multihash,n.multihash)}toString(t){return Ql(this,t)}toJSON(){return{"/":Ql(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof st)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new st(n,i,o,a??Xl(n,i,o.bytes))}else if(r[jm]===!0){let{version:n,multihash:i,code:o}=r,a=xm(i);return st.create(n,o,a)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==vi)throw new Error(`Version 0 CID must use dag-pb (code: ${vi}) block encoding`);return new st(t,r,n,n.bytes)}case 1:{let i=Xl(t,r,n.bytes);return new st(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return st.create(0,vi,t)}static createV1(t,r){return st.create(1,t,r)}static decode(t){let[r,n]=st.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=st.inspectBytes(t),n=r.size-r.multihashSize,i=Uu(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 Pu(r.multihashCode,r.digestSize,o,i);return[r.version===0?st.createV0(a):st.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,$]=Fs(t.subarray(r));return r+=$,d},i=n(),o=vi;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=Sm(t,r),o=st.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return zs(o).set(n,t),o}};function Sm(e,t){switch(e[0]){case"Q":{let r=t??Cr;return[Cr.prefix,r.decode(`${Cr.prefix}${e}`)]}case Cr.prefix:{let r=t??Cr;return[Cr.prefix,r.decode(e)]}case Io.prefix:{let r=t??Io;return[Io.prefix,r.decode(e)]}case _s.prefix:{let r=t??_s;return[_s.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 Im(e,t,r){let{prefix:n}=r;if(n!==Cr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function $m(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var vi=112,km=18;function Xl(e,t,r){let n=Ko(e),i=n+Ko(t),o=new Uint8Array(i+r.byteLength);return zo(e,o,0),zo(t,o,n),o.set(r,i),o}var jm=Symbol.for("@ipld/js-cid/CID"),fd=42;function Nm(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=cd.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new me(G.tag,fd),new me(G.bytes,r)]}function Cm(){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 Zl={float64:!0,typeEncoders:{Object:Nm,undefined:Cm,number:Um}},bN={...Zl,typeEncoders:{...Zl.typeEncoders}};function Pm(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return cd.decode(e.subarray(1))}var qo={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};qo.tags[fd]=Pm;var vN={...qo,tags:qo.tags.slice()},Mm=e=>Hg(e,qo),wN=new Uint8Array(0);function Rm(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 Mu(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 Lm(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(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 B=0,W=0,R=0,k=T.length;R!==k&&T[R]===0;)R++,B++;for(var F=(k-R)*f+1>>>0,q=new Uint8Array(F);R!==k;){for(var L=T[R],Q=0,K=F-1;(L!==0||Q<W)&&K!==-1;K--,Q++)L+=256*q[K]>>>0,q[K]=L%s>>>0,L=L/s>>>0;if(L!==0)throw new Error("Non-zero carry");W=Q,R++}for(var te=F-W;te!==F&&q[te]===0;)te++;for(var j=u.repeat(B);te<F;++te)j+=e.charAt(q[te]);return j}function $(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return new Uint8Array;var B=0;if(T[B]!==" "){for(var W=0,R=0;T[B]===u;)W++,B++;for(var k=(T.length-B)*l+1>>>0,F=new Uint8Array(k);T[B];){var q=r[T.charCodeAt(B)];if(q===255)return;for(var L=0,Q=k-1;(q!==0||L<R)&&Q!==-1;Q--,L++)q+=s*F[Q]>>>0,F[Q]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");R=L,B++}if(T[B]!==" "){for(var K=k-R;K!==k&&F[K]===0;)K++;for(var te=new Uint8Array(W+(k-K)),j=W;K!==k;)te[j++]=F[K++];return te}}}function E(T){var B=$(T);if(B)return B;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:$,decode:E}}var Dm=Lm,Bm=Dm,Vm=Bm,Fm=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")}},zm=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 dd(this,e)}},Km=class{decoders;constructor(e){this.decoders=e}or(e){return dd(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 dd(e,t){return new Km({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var qm=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 Fm(e,t,r),this.decoder=new zm(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function pd({name:e,prefix:t,encode:r,decode:n}){return new qm(e,t,r,n)}function hd({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Vm(r,e);return pd({prefix:t,name:e,encode:n,decode:o=>Mu(i(o))})}function Gm(e,t,r,n){let i={};for(let f=0;f<t.length;++f)i[t[f]]=f;let o=e.length;for(;e[o-1]==="=";)--o;let a=new Uint8Array(o*r/8|0),s=0,u=0,l=0;for(let f=0;f<o;++f){let d=i[e[f]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|d,s+=r,s>=8&&(s-=8,a[l++]=255&u>>s)}if(s>=r||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a}function Hm(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 Tr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return pd({prefix:t,name:e,encode(i){return Hm(i,n,r)},decode(i){return Gm(i,n,r,e)}})}var $o=Tr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),_N=Tr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),TN=Tr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),EN=Tr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ON=Tr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),xN=Tr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),AN=Tr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),SN=Tr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),IN=Tr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Ur=hd({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),$N=hd({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Wm=yd,ec=128,Jm=127,Qm=~Jm,Ym=Math.pow(2,31);function yd(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Ym;)t[r++]=e&255|ec,e/=128;for(;e&Qm;)t[r++]=e&255|ec,e>>>=7;return t[r]=e|0,yd.bytes=r-n+1,t}var Xm=Ks,Zm=128,tc=127;function Ks(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Ks.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&tc)<<i:(a&tc)*Math.pow(2,i),i+=7}while(a>=Zm);return Ks.bytes=o-n,r}var eb=Math.pow(2,7),tb=Math.pow(2,14),rb=Math.pow(2,21),nb=Math.pow(2,28),ib=Math.pow(2,35),ob=Math.pow(2,42),ab=Math.pow(2,49),sb=Math.pow(2,56),ub=Math.pow(2,63),lb=function(e){return e<eb?1:e<tb?2:e<rb?3:e<nb?4:e<ib?5:e<ob?6:e<ab?7:e<sb?8:e<ub?9:10},cb={encode:Wm,decode:Xm,encodingLength:lb},fb=cb,Go=fb;function qs(e,t=0){return[Go.decode(e,t),Go.decode.bytes]}function Ho(e,t,r=0){return Go.encode(e,t,r),t}function Wo(e){return Go.encodingLength(e)}function db(e,t){let r=t.byteLength,n=Wo(e),i=n+Wo(r),o=new Uint8Array(i+r);return Ho(e,o,0),Ho(r,o,n),o.set(t,i),new Ru(e,r,t,o)}function Gs(e){let t=Mu(e),[r,n]=qs(t),[i,o]=qs(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Ru(r,i,a,t)}function pb(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Rm(e.bytes,r.bytes)}}var Ru=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function rc(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return yb(r,Hs(e),t??Ur.encoder);default:return gb(r,Hs(e),t??$o.encoder)}}var nc=new WeakMap;function Hs(e){let t=nc.get(e);if(t==null){let r=new Map;return nc.set(e,r),r}return t}var ic=class ut{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!==wi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==mb)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return ut.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=db(t,r);return ut.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 ut.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&pb(t.multihash,n.multihash)}toString(t){return rc(this,t)}toJSON(){return{"/":rc(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 ut)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new ut(n,i,o,a??oc(n,i,o.bytes))}else if(r[bb]===!0){let{version:n,multihash:i,code:o}=r,a=Gs(i);return ut.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!==wi)throw new Error(`Version 0 CID must use dag-pb (code: ${wi}) block encoding`);return new ut(t,r,n,n.bytes)}case 1:{let i=oc(t,r,n.bytes);return new ut(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return ut.create(0,wi,t)}static createV1(t,r){return ut.create(1,t,r)}static decode(t){let[r,n]=ut.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=ut.inspectBytes(t),n=r.size-r.multihashSize,i=Mu(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 Ru(r.multihashCode,r.digestSize,o,i);return[r.version===0?ut.createV0(a):ut.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,$]=qs(t.subarray(r));return r+=$,d},i=n(),o=wi;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]=hb(t,r),o=ut.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Hs(o).set(n,t),o}};function hb(e,t){switch(e[0]){case"Q":{let r=t??Ur;return[Ur.prefix,r.decode(`${Ur.prefix}${e}`)]}case Ur.prefix:{let r=t??Ur;return[Ur.prefix,r.decode(e)]}case $o.prefix:{let r=t??$o;return[$o.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 yb(e,t,r){let{prefix:n}=r;if(n!==Ur.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 gb(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 wi=112,mb=18;function oc(e,t,r){let n=Wo(e),i=n+Wo(t),o=new Uint8Array(i+r.byteLength);return Ho(e,o,0),Ho(t,o,n),o.set(r,i),o}var bb=Symbol.for("@ipld/js-cid/CID"),nn=Ji(Eu(),1),Ts={SHA2_256:18,LENGTH:32,DAG_PB:112},vb=40;function Jo(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=nn.default.decode(e);return t.seek(nn.default.decode.bytes),r}function wb(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 _b(e){nn.default.decode(e);let t=nn.default.decode.bytes,r=nn.default.decode(e.subarray(nn.default.decode.bytes)),n=nn.default.decode.bytes;return t+n+r}var Rr={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},Ai={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Rr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Rr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Ai["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=Ai["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Rr.Int,CarV1HeaderOrV2Pragma:e=>{if(Rr.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=Ai["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=Ai.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}},Si={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Rr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Rr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Si["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=Si["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Rr.Int,CarV1HeaderOrV2Pragma:e=>{if(Rr.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=Si["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=Si.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}},Tb={toTyped:Ai.CarV1HeaderOrV2Pragma,toRepresentation:Si.CarV1HeaderOrV2Pragma},Eb=["string","number","bigint","symbol"],Ob=["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 xb(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return Eb.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":Ab(e)?"Buffer":Sb(e)||"Object"}function Ab(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function Sb(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Ob.includes(t))return t}var Y=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}};Y.uint=new Y(0,"uint",!0);Y.negint=new Y(1,"negint",!0);Y.bytes=new Y(2,"bytes",!0);Y.string=new Y(3,"string",!0);Y.array=new Y(4,"array",!1);Y.map=new Y(5,"map",!1);Y.tag=new Y(6,"tag",!1);Y.float=new Y(7,"float",!0);Y.false=new Y(7,"false",!0);Y.true=new Y(7,"true",!0);Y.null=new Y(7,"null",!0);Y.undefined=new Y(7,"undefined",!0);Y.break=new Y(7,"break",!0);var ge=class{constructor(e,t,r){this.type=e,this.value=t,this.encodedLength=r,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},Qn=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Ib=new TextDecoder,$b=new TextEncoder;function Qo(e){return Qn&&globalThis.Buffer.isBuffer(e)}function kb(e){return e instanceof Uint8Array?Qo(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var jb=Qn?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):sc(e,t,r):(e,t,r)=>r-t>64?Ib.decode(e.subarray(t,r)):sc(e,t,r),Nb=Qn?e=>e.length>64?globalThis.Buffer.from(e):ac(e):e=>e.length>64?$b.encode(e):ac(e),Lu=Qn?(e,t,r)=>Qo(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Cb=Qn?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),kb(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},Ub=Qn?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Pb(e,t){if(Qo(e)&&Qo(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}function ac(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 sc(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 Mb(n)}var uc=4096;function Mb(e){let t=e.length;if(t<=uc)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=uc));return r}var Rb=256,Lb=class{constructor(e=Rb){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=Ub(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=Lu(r,0,this.cursor)}else t=Cb(this.chunks,this.cursor);return e&&this.reset(),t}},Ve="CBOR decode error:",gd="CBOR encode error:",eo=[];eo[23]=1;eo[24]=2;eo[25]=3;eo[26]=5;eo[27]=9;function Yn(e,t,r){if(e.length-t<r)throw new Error(`${Ve} not enough data for type`)}var nt=[24,256,65536,4294967296,BigInt("18446744073709551616")];function gn(e,t,r){Yn(e,t,1);let n=e[t];if(r.strict===!0&&n<nt[0])throw new Error(`${Ve} integer encoded in more bytes than necessary (strict decode)`);return n}function mn(e,t,r){Yn(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<nt[1])throw new Error(`${Ve} integer encoded in more bytes than necessary (strict decode)`);return n}function bn(e,t,r){Yn(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<nt[2])throw new Error(`${Ve} integer encoded in more bytes than necessary (strict decode)`);return n}function vn(e,t,r){Yn(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<nt[3])throw new Error(`${Ve} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${Ve} integers outside of the safe integer range are not supported`)}function Db(e,t,r,n){return new ge(Y.uint,gn(e,t+1,n),2)}function Bb(e,t,r,n){return new ge(Y.uint,mn(e,t+1,n),3)}function Vb(e,t,r,n){return new ge(Y.uint,bn(e,t+1,n),5)}function Fb(e,t,r,n){return new ge(Y.uint,vn(e,t+1,n),9)}function wn(e,t){return Dt(e,0,t.value)}function Dt(e,t,r){if(r<nt[0]){let n=Number(r);e.push([t|n])}else if(r<nt[1]){let n=Number(r);e.push([t|24,n])}else if(r<nt[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<nt[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<nt[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(`${Ve} encountered BigInt larger than allowable range`)}}wn.encodedSize=function(e){return Dt.encodedSize(e.value)};Dt.encodedSize=function(e){return e<nt[0]?1:e<nt[1]?2:e<nt[2]?3:e<nt[3]?5:9};wn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function zb(e,t,r,n){return new ge(Y.negint,-1-gn(e,t+1,n),2)}function Kb(e,t,r,n){return new ge(Y.negint,-1-mn(e,t+1,n),3)}function qb(e,t,r,n){return new ge(Y.negint,-1-bn(e,t+1,n),5)}var Du=BigInt(-1),md=BigInt(1);function Gb(e,t,r,n){let i=vn(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ge(Y.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Ve} integers outside of the safe integer range are not supported`);return new ge(Y.negint,Du-BigInt(i),9)}function Bu(e,t){let r=t.value,n=typeof r=="bigint"?r*Du-md:r*-1-1;Dt(e,t.type.majorEncoded,n)}Bu.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*Du-md:t*-1-1;return r<nt[0]?1:r<nt[1]?2:r<nt[2]?3:r<nt[3]?5:9};Bu.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function to(e,t,r,n){Yn(e,t,r+n);let i=Lu(e,t+r,t+r+n);return new ge(Y.bytes,i,r+n)}function Hb(e,t,r,n){return to(e,t,1,r)}function Wb(e,t,r,n){return to(e,t,2,gn(e,t+1,n))}function Jb(e,t,r,n){return to(e,t,3,mn(e,t+1,n))}function Qb(e,t,r,n){return to(e,t,5,bn(e,t+1,n))}function Yb(e,t,r,n){let i=vn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ve} 64-bit integer bytes lengths not supported`);return to(e,t,9,i)}function Yo(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===Y.string?Nb(e.value):e.value),e.encodedBytes}function Pa(e,t){let r=Yo(t);Dt(e,t.type.majorEncoded,r.length),e.push(r)}Pa.encodedSize=function(e){let t=Yo(e);return Dt.encodedSize(t.length)+t.length};Pa.compareTokens=function(e,t){return Xb(Yo(e),Yo(t))};function Xb(e,t){return e.length<t.length?-1:e.length>t.length?1:Pb(e,t)}function ro(e,t,r,n,i){let o=r+n;Yn(e,t,o);let a=new ge(Y.string,jb(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=Lu(e,t+r,t+o)),a}function Zb(e,t,r,n){return ro(e,t,1,r,n)}function ev(e,t,r,n){return ro(e,t,2,gn(e,t+1,n),n)}function tv(e,t,r,n){return ro(e,t,3,mn(e,t+1,n),n)}function rv(e,t,r,n){return ro(e,t,5,bn(e,t+1,n),n)}function nv(e,t,r,n){let i=vn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ve} 64-bit integer string lengths not supported`);return ro(e,t,9,i,n)}var iv=Pa;function Xn(e,t,r,n){return new ge(Y.array,n,r)}function ov(e,t,r,n){return Xn(e,t,1,r)}function av(e,t,r,n){return Xn(e,t,2,gn(e,t+1,n))}function sv(e,t,r,n){return Xn(e,t,3,mn(e,t+1,n))}function uv(e,t,r,n){return Xn(e,t,5,bn(e,t+1,n))}function lv(e,t,r,n){let i=vn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ve} 64-bit integer array lengths not supported`);return Xn(e,t,9,i)}function cv(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ve} indefinite length items not allowed`);return Xn(e,t,1,1/0)}function Vu(e,t){Dt(e,Y.array.majorEncoded,t.value)}Vu.compareTokens=wn.compareTokens;Vu.encodedSize=function(e){return Dt.encodedSize(e.value)};function Zn(e,t,r,n){return new ge(Y.map,n,r)}function fv(e,t,r,n){return Zn(e,t,1,r)}function dv(e,t,r,n){return Zn(e,t,2,gn(e,t+1,n))}function pv(e,t,r,n){return Zn(e,t,3,mn(e,t+1,n))}function hv(e,t,r,n){return Zn(e,t,5,bn(e,t+1,n))}function yv(e,t,r,n){let i=vn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ve} 64-bit integer map lengths not supported`);return Zn(e,t,9,i)}function gv(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ve} indefinite length items not allowed`);return Zn(e,t,1,1/0)}function Fu(e,t){Dt(e,Y.map.majorEncoded,t.value)}Fu.compareTokens=wn.compareTokens;Fu.encodedSize=function(e){return Dt.encodedSize(e.value)};function mv(e,t,r,n){return new ge(Y.tag,r,1)}function bv(e,t,r,n){return new ge(Y.tag,gn(e,t+1,n),2)}function vv(e,t,r,n){return new ge(Y.tag,mn(e,t+1,n),3)}function wv(e,t,r,n){return new ge(Y.tag,bn(e,t+1,n),5)}function _v(e,t,r,n){return new ge(Y.tag,vn(e,t+1,n),9)}function zu(e,t){Dt(e,Y.tag.majorEncoded,t.value)}zu.compareTokens=wn.compareTokens;zu.encodedSize=function(e){return Dt.encodedSize(e.value)};var Tv=20,Ev=21,Ov=22,xv=23;function Av(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Ve} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ge(Y.null,null,1):new ge(Y.undefined,void 0,1)}function Sv(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ve} indefinite length items not allowed`);return new ge(Y.break,void 0,1)}function Ku(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Ve} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Ve} Infinity values are not supported`)}return new ge(Y.float,e,t)}function Iv(e,t,r,n){return Ku(Gu(e,t+1),3,n)}function $v(e,t,r,n){return Ku(Hu(e,t+1),5,n)}function kv(e,t,r,n){return Ku(_d(e,t+1),9,n)}function qu(e,t,r){let n=t.value;if(n===!1)e.push([Y.float.majorEncoded|Tv]);else if(n===!0)e.push([Y.float.majorEncoded|Ev]);else if(n===null)e.push([Y.float.majorEncoded|Ov]);else if(n===void 0)e.push([Y.float.majorEncoded|xv]);else{let i,o=!1;(!r||r.float64!==!0)&&(vd(n),i=Gu(Kt,1),n===i||Number.isNaN(n)?(Kt[0]=249,e.push(Kt.slice(0,3)),o=!0):(wd(n),i=Hu(Kt,1),n===i&&(Kt[0]=250,e.push(Kt.slice(0,5)),o=!0))),o||(jv(n),i=_d(Kt,1),Kt[0]=251,e.push(Kt.slice(0,9)))}}qu.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){vd(r);let n=Gu(Kt,1);if(r===n||Number.isNaN(r))return 3;if(wd(r),n=Hu(Kt,1),r===n)return 5}return 9};var bd=new ArrayBuffer(9),At=new DataView(bd,1),Kt=new Uint8Array(bd,0);function vd(e){if(e===1/0)At.setUint16(0,31744,!1);else if(e===-1/0)At.setUint16(0,64512,!1);else if(Number.isNaN(e))At.setUint16(0,32256,!1);else{At.setFloat32(0,e);let t=At.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)At.setUint16(0,31744,!1);else if(r===0)At.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?At.setUint16(0,0):i<-14?At.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):At.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Gu(e,t){if(e.length-t<2)throw new Error(`${Ve} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function wd(e){At.setFloat32(0,e,!1)}function Hu(e,t){if(e.length-t<4)throw new Error(`${Ve} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function jv(e){At.setFloat64(0,e,!1)}function _d(e,t){if(e.length-t<8)throw new Error(`${Ve} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}qu.compareTokens=wn.compareTokens;function je(e,t,r){throw new Error(`${Ve} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Ma(e){return()=>{throw new Error(`${Ve} ${e}`)}}var fe=[];for(let e=0;e<=23;e++)fe[e]=je;fe[24]=Db;fe[25]=Bb;fe[26]=Vb;fe[27]=Fb;fe[28]=je;fe[29]=je;fe[30]=je;fe[31]=je;for(let e=32;e<=55;e++)fe[e]=je;fe[56]=zb;fe[57]=Kb;fe[58]=qb;fe[59]=Gb;fe[60]=je;fe[61]=je;fe[62]=je;fe[63]=je;for(let e=64;e<=87;e++)fe[e]=Hb;fe[88]=Wb;fe[89]=Jb;fe[90]=Qb;fe[91]=Yb;fe[92]=je;fe[93]=je;fe[94]=je;fe[95]=Ma("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)fe[e]=Zb;fe[120]=ev;fe[121]=tv;fe[122]=rv;fe[123]=nv;fe[124]=je;fe[125]=je;fe[126]=je;fe[127]=Ma("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)fe[e]=ov;fe[152]=av;fe[153]=sv;fe[154]=uv;fe[155]=lv;fe[156]=je;fe[157]=je;fe[158]=je;fe[159]=cv;for(let e=160;e<=183;e++)fe[e]=fv;fe[184]=dv;fe[185]=pv;fe[186]=hv;fe[187]=yv;fe[188]=je;fe[189]=je;fe[190]=je;fe[191]=gv;for(let e=192;e<=215;e++)fe[e]=mv;fe[216]=bv;fe[217]=vv;fe[218]=wv;fe[219]=_v;fe[220]=je;fe[221]=je;fe[222]=je;fe[223]=je;for(let e=224;e<=243;e++)fe[e]=Ma("simple values are not supported");fe[244]=je;fe[245]=je;fe[246]=je;fe[247]=Av;fe[248]=Ma("simple values are not supported");fe[249]=Iv;fe[250]=$v;fe[251]=kv;fe[252]=je;fe[253]=je;fe[254]=je;fe[255]=Sv;var Er=[];for(let e=0;e<24;e++)Er[e]=new ge(Y.uint,e,1);for(let e=-1;e>=-24;e--)Er[31-e]=new ge(Y.negint,e,1);Er[64]=new ge(Y.bytes,new Uint8Array(0),1);Er[96]=new ge(Y.string,"",1);Er[128]=new ge(Y.array,0,1);Er[160]=new ge(Y.map,0,1);Er[244]=new ge(Y.false,!1,1);Er[245]=new ge(Y.true,!0,1);Er[246]=new ge(Y.null,null,1);function Td(){let e=[];return e[Y.uint.major]=wn,e[Y.negint.major]=Bu,e[Y.bytes.major]=Pa,e[Y.string.major]=iv,e[Y.array.major]=Vu,e[Y.map.major]=Fu,e[Y.tag.major]=zu,e[Y.float.major]=qu,e}var kN=Td(),jN=new Lb,lc=class Ed{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(`${gd} object contains circular references`);return new Ed(r,t)}},$r={null:new ge(Y.null,null),undefined:new ge(Y.undefined,void 0),true:new ge(Y.true,!0),false:new ge(Y.false,!1),emptyArray:new ge(Y.array,0),emptyMap:new ge(Y.map,0)},Fr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ge(Y.float,e):e>=0?new ge(Y.uint,e):new ge(Y.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ge(Y.uint,e):new ge(Y.negint,e)},Uint8Array(e,t,r,n){return new ge(Y.bytes,e)},string(e,t,r,n){return new ge(Y.string,e)},boolean(e,t,r,n){return e?$r.true:$r.false},null(e,t,r,n){return $r.null},undefined(e,t,r,n){return $r.undefined},ArrayBuffer(e,t,r,n){return new ge(Y.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ge(Y.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[$r.emptyArray,new ge(Y.break)]:$r.emptyArray;n=lc.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=Es(a,r,n);return r.addBreakTokens?[new ge(Y.array,e.length),i,new ge(Y.break)]:[new ge(Y.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?[$r.emptyMap,new ge(Y.break)]:$r.emptyMap;n=lc.createCheck(n,e);let s=[],u=0;for(let l of o)s[u++]=[Es(l,r,n),Es(i?e.get(l):e[l],r,n)];return Nv(s,r),r.addBreakTokens?[new ge(Y.map,a),s,new ge(Y.break)]:[new ge(Y.map,a),s]}};Fr.Map=Fr.Object;Fr.Buffer=Fr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Fr[`${e}Array`]=Fr.DataView;function Es(e,t={},r){let n=xb(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Fr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=Fr[n];if(!o)throw new Error(`${gd} unsupported type: ${n}`);return o(e,n,t,r)}function Nv(e,t){t.mapSorter&&e.sort(t.mapSorter)}var NN=Symbol.for("DONE"),CN=Symbol.for("BREAK"),UN=Td(),PN=Ji(Eu(),1),MN=[new ge(Y.map,2),new ge(Y.string,"version"),new ge(Y.uint,1),new ge(Y.string,"roots")],RN=new ge(Y.tag,42);async function Od(e,t){let r=Jo(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=Mm(n);if(Tb.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=wb(await e.exactly(vb,!0));e.seek(o.dataOffset-e.pos);let a=await Od(e,1);return Object.assign(a,o)}async function Cv(e){let t=await e.exactly(2,!1);if(t[0]===Ts.SHA2_256&&t[1]===Ts.LENGTH){let a=await e.exactly(34,!0),s=Gs(a);return ic.create(0,Ts.DAG_PB,s)}let r=Jo(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=Jo(await e.upTo(8),e),i=await e.exactly(_b(await e.upTo(8)),!0),o=Gs(i);return ic.create(r,n,o)}async function xd(e){let t=e.pos,r=Jo(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await Cv(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function Uv(e){let{cid:t,blockLength:r}=await xd(e);return{bytes:await e.exactly(r,!0),cid:t}}async function Pv(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await xd(e),o={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(o.blockLength),o}function Mv(e){let t=(async()=>{let r=await Od(e);if(r.version===2){let n=e.pos-r.dataOffset;e=Bv(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await Uv(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await Pv(e)}}}function Rv(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 Lv(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 Dv(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return Lv(r)}function Bv(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 Ad=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 cc(Rv(e))}static async fromIterable(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return cc(Dv(e))}};async function cc(e){let t=Mv(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new Ad(r,n)}var LN=Ji(Eu(),1),Vv=Object.create,Wu=Object.defineProperty,Fv=Object.getOwnPropertyDescriptor,Sd=Object.getOwnPropertyNames,zv=Object.getPrototypeOf,Kv=Object.prototype.hasOwnProperty,Ze=(e,t)=>function(){return t||(0,e[Sd(e)[0]])((t={exports:{}}).exports,t),t.exports},Id=(e,t)=>{for(var r in t)Wu(e,r,{get:t[r],enumerable:!0})},qv=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Sd(t))!Kv.call(e,i)&&i!==r&&Wu(e,i,{get:()=>t[i],enumerable:!(n=Fv(t,i))||n.enumerable});return e},Or=(e,t,r)=>(r=e!=null?Vv(zv(e)):{},qv(t||!e||!e.__esModule?Wu(r,"default",{value:e,enumerable:!0}):r,e)),Gr=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/typebox.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Type=e.JsonType=e.JavaScriptTypeBuilder=e.JsonTypeBuilder=e.TypeBuilder=e.TypeBuilderError=e.TransformEncodeBuilder=e.TransformDecodeBuilder=e.TemplateLiteralDslParser=e.TemplateLiteralGenerator=e.TemplateLiteralGeneratorError=e.TemplateLiteralFinite=e.TemplateLiteralFiniteError=e.TemplateLiteralParser=e.TemplateLiteralParserError=e.TemplateLiteralResolver=e.TemplateLiteralPattern=e.TemplateLiteralPatternError=e.UnionResolver=e.KeyArrayResolver=e.KeyArrayResolverError=e.KeyResolver=e.ObjectMap=e.Intrinsic=e.IndexedAccessor=e.TypeClone=e.TypeExtends=e.TypeExtendsResult=e.TypeExtendsError=e.ExtendsUndefined=e.TypeGuard=e.TypeGuardUnknownTypeError=e.ValueGuard=e.FormatRegistry=e.TypeBoxError=e.TypeRegistry=e.PatternStringExact=e.PatternNumberExact=e.PatternBooleanExact=e.PatternString=e.PatternNumber=e.PatternBoolean=e.Kind=e.Hint=e.Optional=e.Readonly=e.Transform=void 0,e.Transform=Symbol.for("TypeBox.Transform"),e.Readonly=Symbol.for("TypeBox.Readonly"),e.Optional=Symbol.for("TypeBox.Optional"),e.Hint=Symbol.for("TypeBox.Hint"),e.Kind=Symbol.for("TypeBox.Kind"),e.PatternBoolean="(true|false)",e.PatternNumber="(0|[1-9][0-9]*)",e.PatternString="(.*)",e.PatternBooleanExact=`^${e.PatternBoolean}$`,e.PatternNumberExact=`^${e.PatternNumber}$`,e.PatternStringExact=`^${e.PatternString}$`;var t;(function(p){let w=new Map;function A(){return new Map(w)}p.Entries=A;function M(){return w.clear()}p.Clear=M;function N(_){return w.delete(_)}p.Delete=N;function U(_){return w.has(_)}p.Has=U;function g(_,c){w.set(_,c)}p.Set=g;function x(_){return w.get(_)}p.Get=x})(t||(e.TypeRegistry=t={}));var r=class extends Error{constructor(p){super(p)}};e.TypeBoxError=r;var n;(function(p){let w=new Map;function A(){return new Map(w)}p.Entries=A;function M(){return w.clear()}p.Clear=M;function N(_){return w.delete(_)}p.Delete=N;function U(_){return w.has(_)}p.Has=U;function g(_,c){w.set(_,c)}p.Set=g;function x(_){return w.get(_)}p.Get=x})(n||(e.FormatRegistry=n={}));var i;(function(p){function w(v){return Array.isArray(v)}p.IsArray=w;function A(v){return typeof v=="bigint"}p.IsBigInt=A;function M(v){return typeof v=="boolean"}p.IsBoolean=M;function N(v){return v instanceof globalThis.Date}p.IsDate=N;function U(v){return v===null}p.IsNull=U;function g(v){return typeof v=="number"}p.IsNumber=g;function x(v){return typeof v=="object"&&v!==null}p.IsObject=x;function _(v){return typeof v=="string"}p.IsString=_;function c(v){return v instanceof globalThis.Uint8Array}p.IsUint8Array=c;function O(v){return v===void 0}p.IsUndefined=O})(i||(e.ValueGuard=i={}));var o=class extends r{};e.TypeGuardUnknownTypeError=o;var a;(function(p){function w(m){try{return new RegExp(m),!0}catch{return!1}}function A(m){if(!i.IsString(m))return!1;for(let Ue=0;Ue<m.length;Ue++){let Ot=m.charCodeAt(Ue);if(Ot>=7&&Ot<=13||Ot===27||Ot===127)return!1}return!0}function M(m){return g(m)||Ye(m)}function N(m){return i.IsUndefined(m)||i.IsBigInt(m)}function U(m){return i.IsUndefined(m)||i.IsNumber(m)}function g(m){return i.IsUndefined(m)||i.IsBoolean(m)}function x(m){return i.IsUndefined(m)||i.IsString(m)}function _(m){return i.IsUndefined(m)||i.IsString(m)&&A(m)&&w(m)}function c(m){return i.IsUndefined(m)||i.IsString(m)&&A(m)}function O(m){return i.IsUndefined(m)||Ye(m)}function v(m){return Te(m,"Any")&&x(m.$id)}p.TAny=v;function b(m){return Te(m,"Array")&&m.type==="array"&&x(m.$id)&&Ye(m.items)&&U(m.minItems)&&U(m.maxItems)&&g(m.uniqueItems)&&O(m.contains)&&U(m.minContains)&&U(m.maxContains)}p.TArray=b;function P(m){return Te(m,"AsyncIterator")&&m.type==="AsyncIterator"&&x(m.$id)&&Ye(m.items)}p.TAsyncIterator=P;function H(m){return Te(m,"BigInt")&&m.type==="bigint"&&x(m.$id)&&N(m.exclusiveMaximum)&&N(m.exclusiveMinimum)&&N(m.maximum)&&N(m.minimum)&&N(m.multipleOf)}p.TBigInt=H;function ie(m){return Te(m,"Boolean")&&m.type==="boolean"&&x(m.$id)}p.TBoolean=ie;function oe(m){return Te(m,"Constructor")&&m.type==="Constructor"&&x(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Ue=>Ye(Ue))&&Ye(m.returns)}p.TConstructor=oe;function ve(m){return Te(m,"Date")&&m.type==="Date"&&x(m.$id)&&U(m.exclusiveMaximumTimestamp)&&U(m.exclusiveMinimumTimestamp)&&U(m.maximumTimestamp)&&U(m.minimumTimestamp)&&U(m.multipleOfTimestamp)}p.TDate=ve;function Oe(m){return Te(m,"Function")&&m.type==="Function"&&x(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Ue=>Ye(Ue))&&Ye(m.returns)}p.TFunction=Oe;function Re(m){return Te(m,"Integer")&&m.type==="integer"&&x(m.$id)&&U(m.exclusiveMaximum)&&U(m.exclusiveMinimum)&&U(m.maximum)&&U(m.minimum)&&U(m.multipleOf)}p.TInteger=Re;function ze(m){return Te(m,"Intersect")&&!(i.IsString(m.type)&&m.type!=="object")&&i.IsArray(m.allOf)&&m.allOf.every(Ue=>Ye(Ue)&&!mi(Ue))&&x(m.type)&&(g(m.unevaluatedProperties)||O(m.unevaluatedProperties))&&x(m.$id)}p.TIntersect=ze;function Jr(m){return Te(m,"Iterator")&&m.type==="Iterator"&&x(m.$id)&&Ye(m.items)}p.TIterator=Jr;function Te(m,Ue){return Ar(m)&&m[e.Kind]===Ue}p.TKindOf=Te;function Ar(m){return i.IsObject(m)&&e.Kind in m&&i.IsString(m[e.Kind])}p.TKind=Ar;function Qr(m){return C(m)&&i.IsString(m.const)}p.TLiteralString=Qr;function S(m){return C(m)&&i.IsNumber(m.const)}p.TLiteralNumber=S;function pe(m){return C(m)&&i.IsBoolean(m.const)}p.TLiteralBoolean=pe;function C(m){return Te(m,"Literal")&&x(m.$id)&&(i.IsBoolean(m.const)||i.IsNumber(m.const)||i.IsString(m.const))}p.TLiteral=C;function _e(m){return Te(m,"Never")&&i.IsObject(m.not)&&Object.getOwnPropertyNames(m.not).length===0}p.TNever=_e;function ae(m){return Te(m,"Not")&&Ye(m.not)}p.TNot=ae;function he(m){return Te(m,"Null")&&m.type==="null"&&x(m.$id)}p.TNull=he;function Ce(m){return Te(m,"Number")&&m.type==="number"&&x(m.$id)&&U(m.exclusiveMaximum)&&U(m.exclusiveMinimum)&&U(m.maximum)&&U(m.minimum)&&U(m.multipleOf)}p.TNumber=Ce;function Ke(m){return Te(m,"Object")&&m.type==="object"&&x(m.$id)&&i.IsObject(m.properties)&&M(m.additionalProperties)&&U(m.minProperties)&&U(m.maxProperties)&&Object.entries(m.properties).every(([Ue,Ot])=>A(Ue)&&Ye(Ot))}p.TObject=Ke;function ft(m){return Te(m,"Promise")&&m.type==="Promise"&&x(m.$id)&&Ye(m.item)}p.TPromise=ft;function at(m){return Te(m,"Record")&&m.type==="object"&&x(m.$id)&&M(m.additionalProperties)&&i.IsObject(m.patternProperties)&&(Ue=>{let Ot=Object.getOwnPropertyNames(Ue.patternProperties);return Ot.length===1&&w(Ot[0])&&i.IsObject(Ue.patternProperties)&&Ye(Ue.patternProperties[Ot[0]])})(m)}p.TRecord=at;function pt(m){return i.IsObject(m)&&e.Hint in m&&m[e.Hint]==="Recursive"}p.TRecursive=pt;function Sr(m){return Te(m,"Ref")&&x(m.$id)&&i.IsString(m.$ref)}p.TRef=Sr;function kn(m){return Te(m,"String")&&m.type==="string"&&x(m.$id)&&U(m.minLength)&&U(m.maxLength)&&_(m.pattern)&&c(m.format)}p.TString=kn;function jn(m){return Te(m,"Symbol")&&m.type==="symbol"&&x(m.$id)}p.TSymbol=jn;function Yr(m){return Te(m,"TemplateLiteral")&&m.type==="string"&&i.IsString(m.pattern)&&m.pattern[0]==="^"&&m.pattern[m.pattern.length-1]==="$"}p.TTemplateLiteral=Yr;function bo(m){return Te(m,"This")&&x(m.$id)&&i.IsString(m.$ref)}p.TThis=bo;function mi(m){return i.IsObject(m)&&e.Transform in m}p.TTransform=mi;function Qe(m){return Te(m,"Tuple")&&m.type==="array"&&x(m.$id)&&i.IsNumber(m.minItems)&&i.IsNumber(m.maxItems)&&m.minItems===m.maxItems&&(i.IsUndefined(m.items)&&i.IsUndefined(m.additionalItems)&&m.minItems===0||i.IsArray(m.items)&&m.items.every(Ue=>Ye(Ue)))}p.TTuple=Qe;function vo(m){return Te(m,"Undefined")&&m.type==="undefined"&&x(m.$id)}p.TUndefined=vo;function gs(m){return Xr(m)&&m.anyOf.every(Ue=>Qr(Ue)||S(Ue))}p.TUnionLiteral=gs;function Xr(m){return Te(m,"Union")&&x(m.$id)&&i.IsObject(m)&&i.IsArray(m.anyOf)&&m.anyOf.every(Ue=>Ye(Ue))}p.TUnion=Xr;function Nn(m){return Te(m,"Uint8Array")&&m.type==="Uint8Array"&&x(m.$id)&&U(m.minByteLength)&&U(m.maxByteLength)}p.TUint8Array=Nn;function dt(m){return Te(m,"Unknown")&&x(m.$id)}p.TUnknown=dt;function wo(m){return Te(m,"Unsafe")}p.TUnsafe=wo;function bi(m){return Te(m,"Void")&&m.type==="void"&&x(m.$id)}p.TVoid=bi;function ms(m){return i.IsObject(m)&&m[e.Readonly]==="Readonly"}p.TReadonly=ms;function bs(m){return i.IsObject(m)&&m[e.Optional]==="Optional"}p.TOptional=bs;function Ye(m){return i.IsObject(m)&&(v(m)||b(m)||ie(m)||H(m)||P(m)||oe(m)||ve(m)||Oe(m)||Re(m)||ze(m)||Jr(m)||C(m)||_e(m)||ae(m)||he(m)||Ce(m)||Ke(m)||ft(m)||at(m)||Sr(m)||kn(m)||jn(m)||Yr(m)||bo(m)||Qe(m)||vo(m)||Xr(m)||Nn(m)||dt(m)||wo(m)||bi(m)||Ar(m)&&t.Has(m[e.Kind]))}p.TSchema=Ye})(a||(e.TypeGuard=a={}));var s;(function(p){function w(A){return A[e.Kind]==="Intersect"?A.allOf.every(M=>w(M)):A[e.Kind]==="Union"?A.anyOf.some(M=>w(M)):A[e.Kind]==="Undefined"?!0:A[e.Kind]==="Not"?!w(A.not):!1}p.Check=w})(s||(e.ExtendsUndefined=s={}));var u=class extends r{};e.TypeExtendsError=u;var l;(function(p){p[p.Union=0]="Union",p[p.True=1]="True",p[p.False=2]="False"})(l||(e.TypeExtendsResult=l={}));var f;(function(p){function w(y){return y===l.False?y:l.True}function A(y){throw new u(y)}function M(y){return a.TNever(y)||a.TIntersect(y)||a.TUnion(y)||a.TUnknown(y)||a.TAny(y)}function N(y,h){return a.TNever(h)?Te(y,h):a.TIntersect(h)?Oe(y,h):a.TUnion(h)?vs(y,h):a.TUnknown(h)?zl(y,h):a.TAny(h)?U(y,h):A("StructuralRight")}function U(y,h){return l.True}function g(y,h){return a.TIntersect(h)?Oe(y,h):a.TUnion(h)&&h.anyOf.some(Ie=>a.TAny(Ie)||a.TUnknown(Ie))?l.True:a.TUnion(h)?l.Union:a.TUnknown(h)||a.TAny(h)?l.True:l.Union}function x(y,h){return a.TUnknown(y)?l.False:a.TAny(y)?l.Union:a.TNever(y)?l.True:l.False}function _(y,h){return a.TObject(h)&&Yr(h)?l.True:M(h)?N(y,h):a.TArray(h)?w(Pe(y.items,h.items)):l.False}function c(y,h){return M(h)?N(y,h):a.TAsyncIterator(h)?w(Pe(y.items,h.items)):l.False}function O(y,h){return M(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TBigInt(h)?l.True:l.False}function v(y,h){return a.TLiteral(y)&&i.IsBoolean(y.const)||a.TBoolean(y)?l.True:l.False}function b(y,h){return M(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TBoolean(h)?l.True:l.False}function P(y,h){return M(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TConstructor(h)?y.parameters.length>h.parameters.length?l.False:y.parameters.every((Ie,fr)=>w(Pe(h.parameters[fr],Ie))===l.True)?w(Pe(y.returns,h.returns)):l.False:l.False}function H(y,h){return M(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TDate(h)?l.True:l.False}function ie(y,h){return M(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TFunction(h)?y.parameters.length>h.parameters.length?l.False:y.parameters.every((Ie,fr)=>w(Pe(h.parameters[fr],Ie))===l.True)?w(Pe(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 ve(y,h){return a.TInteger(h)||a.TNumber(h)?l.True:M(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):l.False}function Oe(y,h){return h.allOf.every(Ie=>Pe(y,Ie)===l.True)?l.True:l.False}function Re(y,h){return y.allOf.some(Ie=>Pe(Ie,h)===l.True)?l.True:l.False}function ze(y,h){return M(h)?N(y,h):a.TIterator(h)?w(Pe(y.items,h.items)):l.False}function Jr(y,h){return a.TLiteral(h)&&h.const===y.const?l.True:M(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TString(h)?bi(y,h):a.TNumber(h)?C(y,h):a.TInteger(h)?oe(y,h):a.TBoolean(h)?v(y,h):l.False}function Te(y,h){return l.False}function Ar(y,h){return l.True}function Qr(y){let[h,Ie]=[y,0];for(;a.TNot(h);)h=h.not,Ie+=1;return Ie%2===0?h:e.Type.Unknown()}function S(y,h){return a.TNot(y)?Pe(Qr(y),h):a.TNot(h)?Pe(y,Qr(h)):A("Invalid fallthrough for Not")}function pe(y,h){return M(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TNull(h)?l.True:l.False}function C(y,h){return a.TLiteralNumber(y)||a.TNumber(y)||a.TInteger(y)?l.True:l.False}function _e(y,h){return M(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TInteger(h)||a.TNumber(h)?l.True:l.False}function ae(y,h){return Object.getOwnPropertyNames(y.properties).length===h}function he(y){return Yr(y)}function Ce(y){return ae(y,0)||ae(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 Ke(y){return ae(y,0)}function ft(y){return ae(y,0)}function at(y){return ae(y,0)}function pt(y){return ae(y,0)}function Sr(y){return Yr(y)}function kn(y){let h=e.Type.Number();return ae(y,0)||ae(y,1)&&"length"in y.properties&&w(Pe(y.properties.length,h))===l.True}function jn(y){return ae(y,0)}function Yr(y){let h=e.Type.Number();return ae(y,0)||ae(y,1)&&"length"in y.properties&&w(Pe(y.properties.length,h))===l.True}function bo(y){let h=e.Type.Function([e.Type.Any()],e.Type.Any());return ae(y,0)||ae(y,1)&&"then"in y.properties&&w(Pe(y.properties.then,h))===l.True}function mi(y,h){return Pe(y,h)===l.False||a.TOptional(y)&&!a.TOptional(h)?l.False:l.True}function Qe(y,h){return a.TUnknown(y)?l.False:a.TAny(y)?l.Union:a.TNever(y)||a.TLiteralString(y)&&he(h)||a.TLiteralNumber(y)&&Ke(h)||a.TLiteralBoolean(y)&&ft(h)||a.TSymbol(y)&&Ce(h)||a.TBigInt(y)&&at(h)||a.TString(y)&&he(h)||a.TSymbol(y)&&Ce(h)||a.TNumber(y)&&Ke(h)||a.TInteger(y)&&Ke(h)||a.TBoolean(y)&&ft(h)||a.TUint8Array(y)&&Sr(h)||a.TDate(y)&&pt(h)||a.TConstructor(y)&&jn(h)||a.TFunction(y)&&kn(h)?l.True:a.TRecord(y)&&a.TString(Xr(y))?h[e.Hint]==="Record"?l.True:l.False:a.TRecord(y)&&a.TNumber(Xr(y))&&ae(h,0)?l.True:l.False}function vo(y,h){return M(h)?N(y,h):a.TRecord(h)?dt(y,h):a.TObject(h)?(()=>{for(let Ie of Object.getOwnPropertyNames(h.properties)){if(!(Ie in y.properties)&&!a.TOptional(h.properties[Ie]))return l.False;if(a.TOptional(h.properties[Ie]))return l.True;if(mi(y.properties[Ie],h.properties[Ie])===l.False)return l.False}return l.True})():l.False}function gs(y,h){return M(h)?N(y,h):a.TObject(h)&&bo(h)?l.True:a.TPromise(h)?w(Pe(y.item,h.item)):l.False}function Xr(y){return e.PatternNumberExact in y.patternProperties?e.Type.Number():e.PatternStringExact in y.patternProperties?e.Type.String():A("Unknown record key pattern")}function Nn(y){return e.PatternNumberExact in y.patternProperties?y.patternProperties[e.PatternNumberExact]:e.PatternStringExact in y.patternProperties?y.patternProperties[e.PatternStringExact]:A("Unable to get record value schema")}function dt(y,h){let[Ie,fr]=[Xr(h),Nn(h)];return a.TLiteralString(y)&&a.TNumber(Ie)&&w(Pe(y,fr))===l.True?l.True:a.TUint8Array(y)&&a.TNumber(Ie)||a.TString(y)&&a.TNumber(Ie)||a.TArray(y)&&a.TNumber(Ie)?Pe(y,fr):a.TObject(y)?(()=>{for(let vy of Object.getOwnPropertyNames(y.properties))if(mi(fr,y.properties[vy])===l.False)return l.False;return l.True})():l.False}function wo(y,h){return M(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?Pe(Nn(y),Nn(h)):l.False}function bi(y,h){return a.TLiteral(y)&&i.IsString(y.const)||a.TString(y)?l.True:l.False}function ms(y,h){return M(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TString(h)?l.True:l.False}function bs(y,h){return M(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TSymbol(h)?l.True:l.False}function Ye(y,h){return a.TTemplateLiteral(y)?Pe(L.Resolve(y),h):a.TTemplateLiteral(h)?Pe(y,L.Resolve(h)):A("Invalid fallthrough for TemplateLiteral")}function m(y,h){return a.TArray(h)&&y.items!==void 0&&y.items.every(Ie=>Pe(Ie,h.items)===l.True)}function Ue(y,h){return a.TNever(y)?l.True:a.TUnknown(y)?l.False:a.TAny(y)?l.Union:l.False}function Ot(y,h){return M(h)?N(y,h):a.TObject(h)&&Yr(h)||a.TArray(h)&&m(y,h)?l.True:a.TTuple(h)?i.IsUndefined(y.items)&&!i.IsUndefined(h.items)||!i.IsUndefined(y.items)&&i.IsUndefined(h.items)?l.False:i.IsUndefined(y.items)&&!i.IsUndefined(h.items)||y.items.every((Ie,fr)=>Pe(Ie,h.items[fr])===l.True)?l.True:l.False:l.False}function dy(y,h){return M(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TUint8Array(h)?l.True:l.False}function py(y,h){return M(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TVoid(h)?gy(y,h):a.TUndefined(h)?l.True:l.False}function vs(y,h){return h.anyOf.some(Ie=>Pe(y,Ie)===l.True)?l.True:l.False}function hy(y,h){return y.anyOf.every(Ie=>Pe(Ie,h)===l.True)?l.True:l.False}function zl(y,h){return l.True}function yy(y,h){return a.TNever(h)?Te(y,h):a.TIntersect(h)?Oe(y,h):a.TUnion(h)?vs(y,h):a.TAny(h)?U(y,h):a.TString(h)?bi(y,h):a.TNumber(h)?C(y,h):a.TInteger(h)?oe(y,h):a.TBoolean(h)?v(y,h):a.TArray(h)?x(y,h):a.TTuple(h)?Ue(y,h):a.TObject(h)?Qe(y,h):a.TUnknown(h)?l.True:l.False}function gy(y,h){return a.TUndefined(y)||a.TUndefined(y)?l.True:l.False}function my(y,h){return a.TIntersect(h)?Oe(y,h):a.TUnion(h)?vs(y,h):a.TUnknown(h)?zl(y,h):a.TAny(h)?U(y,h):a.TObject(h)?Qe(y,h):a.TVoid(h)?l.True:l.False}function Pe(y,h){return a.TTemplateLiteral(y)||a.TTemplateLiteral(h)?Ye(y,h):a.TNot(y)||a.TNot(h)?S(y,h):a.TAny(y)?g(y,h):a.TArray(y)?_(y,h):a.TBigInt(y)?O(y,h):a.TBoolean(y)?b(y,h):a.TAsyncIterator(y)?c(y,h):a.TConstructor(y)?P(y,h):a.TDate(y)?H(y,h):a.TFunction(y)?ie(y,h):a.TInteger(y)?ve(y,h):a.TIntersect(y)?Re(y,h):a.TIterator(y)?ze(y,h):a.TLiteral(y)?Jr(y,h):a.TNever(y)?Ar(y,h):a.TNull(y)?pe(y,h):a.TNumber(y)?_e(y,h):a.TObject(y)?vo(y,h):a.TRecord(y)?wo(y,h):a.TString(y)?ms(y,h):a.TSymbol(y)?bs(y,h):a.TTuple(y)?Ot(y,h):a.TPromise(y)?gs(y,h):a.TUint8Array(y)?dy(y,h):a.TUndefined(y)?py(y,h):a.TUnion(y)?hy(y,h):a.TUnknown(y)?yy(y,h):a.TVoid(y)?my(y,h):A(`Unknown left type operand '${y[e.Kind]}'`)}function by(y,h){return Pe(y,h)}p.Extends=by})(f||(e.TypeExtends=f={}));var d;(function(p){function w(_){return _.map(c=>U(c))}function A(_){return new Date(_.getTime())}function M(_){return new Uint8Array(_)}function N(_){let c=Object.getOwnPropertyNames(_).reduce((v,b)=>({...v,[b]:U(_[b])}),{}),O=Object.getOwnPropertySymbols(_).reduce((v,b)=>({...v,[b]:U(_[b])}),{});return{...c,...O}}function U(_){return i.IsArray(_)?w(_):i.IsDate(_)?A(_):i.IsUint8Array(_)?M(_):i.IsObject(_)?N(_):_}function g(_){return _.map(c=>x(c))}p.Rest=g;function x(_,c={}){return{...U(_),...c}}p.Type=x})(d||(e.TypeClone=d={}));var $;(function(p){function w(P){return P.map(H=>{let{[e.Optional]:ie,...oe}=d.Type(H);return oe})}function A(P){return P.every(H=>a.TOptional(H))}function M(P){return P.some(H=>a.TOptional(H))}function N(P){return A(P.allOf)?e.Type.Optional(e.Type.Intersect(w(P.allOf))):P}function U(P){return M(P.anyOf)?e.Type.Optional(e.Type.Union(w(P.anyOf))):P}function g(P){return P[e.Kind]==="Intersect"?N(P):P[e.Kind]==="Union"?U(P):P}function x(P,H){let ie=P.allOf.reduce((oe,ve)=>{let Oe=v(ve,H);return Oe[e.Kind]==="Never"?oe:[...oe,Oe]},[]);return g(e.Type.Intersect(ie))}function _(P,H){let ie=P.anyOf.map(oe=>v(oe,H));return g(e.Type.Union(ie))}function c(P,H){let ie=P.properties[H];return i.IsUndefined(ie)?e.Type.Never():e.Type.Union([ie])}function O(P,H){let ie=P.items;if(i.IsUndefined(ie))return e.Type.Never();let oe=ie[H];return i.IsUndefined(oe)?e.Type.Never():oe}function v(P,H){return P[e.Kind]==="Intersect"?x(P,H):P[e.Kind]==="Union"?_(P,H):P[e.Kind]==="Object"?c(P,H):P[e.Kind]==="Tuple"?O(P,H):e.Type.Never()}function b(P,H,ie={}){let oe=H.map(ve=>v(P,ve.toString()));return g(e.Type.Union(oe,ie))}p.Resolve=b})($||(e.IndexedAccessor=$={}));var E;(function(p){function w(O){let[v,b]=[O.slice(0,1),O.slice(1)];return`${v.toLowerCase()}${b}`}function A(O){let[v,b]=[O.slice(0,1),O.slice(1)];return`${v.toUpperCase()}${b}`}function M(O){return O.toUpperCase()}function N(O){return O.toLowerCase()}function U(O,v){let b=K.ParseExact(O.pattern);if(!j.Check(b))return{...O,pattern:g(O.pattern,v)};let P=[...z.Generate(b)].map(oe=>e.Type.Literal(oe)),H=x(P,v),ie=e.Type.Union(H);return e.Type.TemplateLiteral([ie])}function g(O,v){return typeof O=="string"?v==="Uncapitalize"?w(O):v==="Capitalize"?A(O):v==="Uppercase"?M(O):v==="Lowercase"?N(O):O:O.toString()}function x(O,v){if(O.length===0)return[];let[b,...P]=O;return[c(b,v),...x(P,v)]}function _(O,v){return a.TTemplateLiteral(O)?U(O,v):a.TUnion(O)?e.Type.Union(x(O.anyOf,v)):a.TLiteral(O)?e.Type.Literal(g(O.const,v)):O}function c(O,v){return _(O,v)}p.Map=c})(E||(e.Intrinsic=E={}));var T;(function(p){function w(g,x){return e.Type.Intersect(g.allOf.map(_=>N(_,x)),{...g})}function A(g,x){return e.Type.Union(g.anyOf.map(_=>N(_,x)),{...g})}function M(g,x){return x(g)}function N(g,x){return g[e.Kind]==="Intersect"?w(g,x):g[e.Kind]==="Union"?A(g,x):g[e.Kind]==="Object"?M(g,x):g}function U(g,x,_){return{...N(d.Type(g),x),..._}}p.Map=U})(T||(e.ObjectMap=T={}));var B;(function(p){function w(c){return c[0]==="^"&&c[c.length-1]==="$"?c.slice(1,c.length-1):c}function A(c,O){return c.allOf.reduce((v,b)=>[...v,...g(b,O)],[])}function M(c,O){let v=c.anyOf.map(b=>g(b,O));return[...v.reduce((b,P)=>P.map(H=>v.every(ie=>ie.includes(H))?b.add(H):b)[0],new Set)]}function N(c,O){return Object.getOwnPropertyNames(c.properties)}function U(c,O){return O.includePatterns?Object.getOwnPropertyNames(c.patternProperties):[]}function g(c,O){return a.TIntersect(c)?A(c,O):a.TUnion(c)?M(c,O):a.TObject(c)?N(c,O):a.TRecord(c)?U(c,O):[]}function x(c,O){return[...new Set(g(c,O))]}p.ResolveKeys=x;function _(c){return`^(${x(c,{includePatterns:!0}).map(O=>`(${w(O)})`).join("|")})$`}p.ResolvePattern=_})(B||(e.KeyResolver=B={}));var W=class extends r{};e.KeyArrayResolverError=W;var R;(function(p){function w(A){return Array.isArray(A)?A:a.TUnionLiteral(A)?A.anyOf.map(M=>M.const.toString()):a.TLiteral(A)?[A.const]:a.TTemplateLiteral(A)?(()=>{let M=K.ParseExact(A.pattern);if(!j.Check(M))throw new W("Cannot resolve keys from infinite template expression");return[...z.Generate(M)]})():[]}p.Resolve=w})(R||(e.KeyArrayResolver=R={}));var k;(function(p){function*w(M){for(let N of M.anyOf)N[e.Kind]==="Union"?yield*w(N):yield N}function A(M){return e.Type.Union([...w(M)],{...M})}p.Resolve=A})(k||(e.UnionResolver=k={}));var F=class extends r{};e.TemplateLiteralPatternError=F;var q;(function(p){function w(U){throw new F(U)}function A(U){return U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function M(U,g){return a.TTemplateLiteral(U)?U.pattern.slice(1,U.pattern.length-1):a.TUnion(U)?`(${U.anyOf.map(x=>M(x,g)).join("|")})`:a.TNumber(U)?`${g}${e.PatternNumber}`:a.TInteger(U)?`${g}${e.PatternNumber}`:a.TBigInt(U)?`${g}${e.PatternNumber}`:a.TString(U)?`${g}${e.PatternString}`:a.TLiteral(U)?`${g}${A(U.const.toString())}`:a.TBoolean(U)?`${g}${e.PatternBoolean}`:w(`Unexpected Kind '${U[e.Kind]}'`)}function N(U){return`^${U.map(g=>M(g,"")).join("")}$`}p.Create=N})(q||(e.TemplateLiteralPattern=q={}));var L;(function(p){function w(A){let M=K.ParseExact(A.pattern);if(!j.Check(M))return e.Type.String();let N=[...z.Generate(M)].map(U=>e.Type.Literal(U));return e.Type.Union(N)}p.Resolve=w})(L||(e.TemplateLiteralResolver=L={}));var Q=class extends r{};e.TemplateLiteralParserError=Q;var K;(function(p){function w(P,H,ie){return P[H]===ie&&P.charCodeAt(H-1)!==92}function A(P,H){return w(P,H,"(")}function M(P,H){return w(P,H,")")}function N(P,H){return w(P,H,"|")}function U(P){if(!(A(P,0)&&M(P,P.length-1)))return!1;let H=0;for(let ie=0;ie<P.length;ie++)if(A(P,ie)&&(H+=1),M(P,ie)&&(H-=1),H===0&&ie!==P.length-1)return!1;return!0}function g(P){return P.slice(1,P.length-1)}function x(P){let H=0;for(let ie=0;ie<P.length;ie++)if(A(P,ie)&&(H+=1),M(P,ie)&&(H-=1),N(P,ie)&&H===0)return!0;return!1}function _(P){for(let H=0;H<P.length;H++)if(A(P,H))return!0;return!1}function c(P){let[H,ie]=[0,0],oe=[];for(let Oe=0;Oe<P.length;Oe++)if(A(P,Oe)&&(H+=1),M(P,Oe)&&(H-=1),N(P,Oe)&&H===0){let Re=P.slice(ie,Oe);Re.length>0&&oe.push(v(Re)),ie=Oe+1}let ve=P.slice(ie);return ve.length>0&&oe.push(v(ve)),oe.length===0?{type:"const",const:""}:oe.length===1?oe[0]:{type:"or",expr:oe}}function O(P){function H(ve,Oe){if(!A(ve,Oe))throw new Q("TemplateLiteralParser: Index must point to open parens");let Re=0;for(let ze=Oe;ze<ve.length;ze++)if(A(ve,ze)&&(Re+=1),M(ve,ze)&&(Re-=1),Re===0)return[Oe,ze];throw new Q("TemplateLiteralParser: Unclosed group parens in expression")}function ie(ve,Oe){for(let Re=Oe;Re<ve.length;Re++)if(A(ve,Re))return[Oe,Re];return[Oe,ve.length]}let oe=[];for(let ve=0;ve<P.length;ve++)if(A(P,ve)){let[Oe,Re]=H(P,ve),ze=P.slice(Oe,Re+1);oe.push(v(ze)),ve=Re}else{let[Oe,Re]=ie(P,ve),ze=P.slice(Oe,Re);ze.length>0&&oe.push(v(ze)),ve=Re-1}return oe.length===0?{type:"const",const:""}:oe.length===1?oe[0]:{type:"and",expr:oe}}function v(P){return U(P)?v(g(P)):x(P)?c(P):_(P)?O(P):{type:"const",const:P}}p.Parse=v;function b(P){return v(P.slice(1,P.length-1))}p.ParseExact=b})(K||(e.TemplateLiteralParser=K={}));var te=class extends r{};e.TemplateLiteralFiniteError=te;var j;(function(p){function w(g){throw new te(g)}function A(g){return g.type==="or"&&g.expr.length===2&&g.expr[0].type==="const"&&g.expr[0].const==="0"&&g.expr[1].type==="const"&&g.expr[1].const==="[1-9][0-9]*"}function M(g){return g.type==="or"&&g.expr.length===2&&g.expr[0].type==="const"&&g.expr[0].const==="true"&&g.expr[1].type==="const"&&g.expr[1].const==="false"}function N(g){return g.type==="const"&&g.const===".*"}function U(g){return M(g)?!0:A(g)||N(g)?!1:g.type==="and"?g.expr.every(x=>U(x)):g.type==="or"?g.expr.every(x=>U(x)):g.type==="const"?!0:w("Unknown expression type")}p.Check=U})(j||(e.TemplateLiteralFinite=j={}));var D=class extends r{};e.TemplateLiteralGeneratorError=D;var z;(function(p){function*w(g){if(g.length===1)return yield*g[0];for(let x of g[0])for(let _ of w(g.slice(1)))yield`${x}${_}`}function*A(g){return yield*w(g.expr.map(x=>[...U(x)]))}function*M(g){for(let x of g.expr)yield*U(x)}function*N(g){return yield g.const}function*U(g){return g.type==="and"?yield*A(g):g.type==="or"?yield*M(g):g.type==="const"?yield*N(g):(()=>{throw new D("Unknown expression")})()}p.Generate=U})(z||(e.TemplateLiteralGenerator=z={}));var re;(function(p){function*w(U){let g=U.trim().replace(/"|'/g,"");return g==="boolean"?yield e.Type.Boolean():g==="number"?yield e.Type.Number():g==="bigint"?yield e.Type.BigInt():g==="string"?yield e.Type.String():yield(()=>{let x=g.split("|").map(_=>e.Type.Literal(_.trim()));return x.length===0?e.Type.Never():x.length===1?x[0]:e.Type.Union(x)})()}function*A(U){if(U[1]!=="{"){let g=e.Type.Literal("$"),x=M(U.slice(1));return yield*[g,...x]}for(let g=2;g<U.length;g++)if(U[g]==="}"){let x=w(U.slice(2,g)),_=M(U.slice(g+1));return yield*[...x,..._]}yield e.Type.Literal(U)}function*M(U){for(let g=0;g<U.length;g++)if(U[g]==="$"){let x=e.Type.Literal(U.slice(0,g)),_=A(U.slice(g));return yield*[x,..._]}yield e.Type.Literal(U)}function N(U){return[...M(U)]}p.Parse=N})(re||(e.TemplateLiteralDslParser=re={}));var se=class{constructor(p){this.schema=p}Decode(p){return new ee(this.schema,p)}};e.TransformDecodeBuilder=se;var ee=class{constructor(p,w){this.schema=p,this.decode=w}Encode(p){let w=d.Type(this.schema);return a.TTransform(w)?(()=>{let A={Encode:M=>w[e.Transform].Encode(p(M)),Decode:M=>this.decode(w[e.Transform].Decode(M))};return{...w,[e.Transform]:A}})():(()=>{let A={Decode:this.decode,Encode:p};return{...w,[e.Transform]:A}})()}};e.TransformEncodeBuilder=ee;var ce=0,V=class extends r{};e.TypeBuilderError=V;var J=class{Create(p){return p}Throw(p){throw new V(p)}Discard(p,w){return w.reduce((A,M)=>{let{[M]:N,...U}=A;return U},p)}Strict(p){return JSON.parse(JSON.stringify(p))}};e.TypeBuilder=J;var Z=class extends J{ReadonlyOptional(p){return this.Readonly(this.Optional(p))}Readonly(p){return{...d.Type(p),[e.Readonly]:"Readonly"}}Optional(p){return{...d.Type(p),[e.Optional]:"Optional"}}Any(p={}){return this.Create({...p,[e.Kind]:"Any"})}Array(p,w={}){return this.Create({...w,[e.Kind]:"Array",type:"array",items:d.Type(p)})}Boolean(p={}){return this.Create({...p,[e.Kind]:"Boolean",type:"boolean"})}Capitalize(p,w={}){return{...E.Map(d.Type(p),"Capitalize"),...w}}Composite(p,w){let A=e.Type.Intersect(p,{}),M=B.ResolveKeys(A,{includePatterns:!1}).reduce((N,U)=>({...N,[U]:e.Type.Index(A,[U])}),{});return e.Type.Object(M,w)}Enum(p,w={}){if(i.IsUndefined(p))return this.Throw("Enum undefined or empty");let A=Object.getOwnPropertyNames(p).filter(N=>isNaN(N)).map(N=>p[N]),M=[...new Set(A)].map(N=>e.Type.Literal(N));return this.Union(M,{...w,[e.Hint]:"Enum"})}Extends(p,w,A,M,N={}){switch(f.Extends(p,w)){case l.Union:return this.Union([d.Type(A,N),d.Type(M,N)]);case l.True:return d.Type(A,N);case l.False:return d.Type(M,N)}}Exclude(p,w,A={}){return a.TTemplateLiteral(p)?this.Exclude(L.Resolve(p),w,A):a.TTemplateLiteral(w)?this.Exclude(p,L.Resolve(w),A):a.TUnion(p)?(()=>{let M=p.anyOf.filter(N=>f.Extends(N,w)===l.False);return M.length===1?d.Type(M[0],A):this.Union(M,A)})():f.Extends(p,w)!==l.False?this.Never(A):d.Type(p,A)}Extract(p,w,A={}){return a.TTemplateLiteral(p)?this.Extract(L.Resolve(p),w,A):a.TTemplateLiteral(w)?this.Extract(p,L.Resolve(w),A):a.TUnion(p)?(()=>{let M=p.anyOf.filter(N=>f.Extends(N,w)!==l.False);return M.length===1?d.Type(M[0],A):this.Union(M,A)})():f.Extends(p,w)!==l.False?d.Type(p,A):this.Never(A)}Index(p,w,A={}){return a.TArray(p)&&a.TNumber(w)?d.Type(p.items,A):a.TTuple(p)&&a.TNumber(w)?(()=>{let M=(i.IsUndefined(p.items)?[]:p.items).map(N=>d.Type(N));return this.Union(M,A)})():(()=>{let M=R.Resolve(w),N=d.Type(p);return $.Resolve(N,M,A)})()}Integer(p={}){return this.Create({...p,[e.Kind]:"Integer",type:"integer"})}Intersect(p,w={}){if(p.length===0)return e.Type.Never();if(p.length===1)return d.Type(p[0],w);p.some(U=>a.TTransform(U))&&this.Throw("Cannot intersect transform types");let A=p.every(U=>a.TObject(U)),M=d.Rest(p),N=a.TSchema(w.unevaluatedProperties)?{unevaluatedProperties:d.Type(w.unevaluatedProperties)}:{};return w.unevaluatedProperties===!1||a.TSchema(w.unevaluatedProperties)||A?this.Create({...w,...N,[e.Kind]:"Intersect",type:"object",allOf:M}):this.Create({...w,...N,[e.Kind]:"Intersect",allOf:M})}KeyOf(p,w={}){return a.TRecord(p)?(()=>{let A=Object.getOwnPropertyNames(p.patternProperties)[0];return A===e.PatternNumberExact?this.Number(w):A===e.PatternStringExact?this.String(w):this.Throw("Unable to resolve key type from Record key pattern")})():a.TTuple(p)?(()=>{let A=(i.IsUndefined(p.items)?[]:p.items).map((M,N)=>e.Type.Literal(N.toString()));return this.Union(A,w)})():a.TArray(p)?this.Number(w):(()=>{let A=B.ResolveKeys(p,{includePatterns:!1});if(A.length===0)return this.Never(w);let M=A.map(N=>this.Literal(N));return this.Union(M,w)})()}Literal(p,w={}){return this.Create({...w,[e.Kind]:"Literal",const:p,type:typeof p})}Lowercase(p,w={}){return{...E.Map(d.Type(p),"Lowercase"),...w}}Never(p={}){return this.Create({...p,[e.Kind]:"Never",not:{}})}Not(p,w){return this.Create({...w,[e.Kind]:"Not",not:d.Type(p)})}Null(p={}){return this.Create({...p,[e.Kind]:"Null",type:"null"})}Number(p={}){return this.Create({...p,[e.Kind]:"Number",type:"number"})}Object(p,w={}){let A=Object.getOwnPropertyNames(p),M=A.filter(x=>a.TOptional(p[x])),N=A.filter(x=>!M.includes(x)),U=a.TSchema(w.additionalProperties)?{additionalProperties:d.Type(w.additionalProperties)}:{},g=A.reduce((x,_)=>({...x,[_]:d.Type(p[_])}),{});return N.length>0?this.Create({...w,...U,[e.Kind]:"Object",type:"object",properties:g,required:N}):this.Create({...w,...U,[e.Kind]:"Object",type:"object",properties:g})}Omit(p,w,A={}){let M=R.Resolve(w);return T.Map(this.Discard(d.Type(p),["$id",e.Transform]),N=>{i.IsArray(N.required)&&(N.required=N.required.filter(U=>!M.includes(U)),N.required.length===0&&delete N.required);for(let U of Object.getOwnPropertyNames(N.properties))M.includes(U)&&delete N.properties[U];return this.Create(N)},A)}Partial(p,w={}){return T.Map(this.Discard(d.Type(p),["$id",e.Transform]),A=>{let M=Object.getOwnPropertyNames(A.properties).reduce((N,U)=>({...N,[U]:this.Optional(A.properties[U])}),{});return this.Object(M,this.Discard(A,["required"]))},w)}Pick(p,w,A={}){let M=R.Resolve(w);return T.Map(this.Discard(d.Type(p),["$id",e.Transform]),N=>{i.IsArray(N.required)&&(N.required=N.required.filter(U=>M.includes(U)),N.required.length===0&&delete N.required);for(let U of Object.getOwnPropertyNames(N.properties))M.includes(U)||delete N.properties[U];return this.Create(N)},A)}Record(p,w,A={}){return a.TTemplateLiteral(p)?(()=>{let M=K.ParseExact(p.pattern);return j.Check(M)?this.Object([...z.Generate(M)].reduce((N,U)=>({...N,[U]:d.Type(w)}),{}),A):this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[p.pattern]:d.Type(w)}})})():a.TUnion(p)?(()=>{let M=k.Resolve(p);if(a.TUnionLiteral(M)){let N=M.anyOf.reduce((U,g)=>({...U,[g.const]:d.Type(w)}),{});return this.Object(N,{...A,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():a.TLiteral(p)?i.IsString(p.const)||i.IsNumber(p.const)?this.Object({[p.const]:d.Type(w)},A):this.Throw("Record key of type literal is not of type string or number"):a.TInteger(p)||a.TNumber(p)?this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:d.Type(w)}}):a.TString(p)?(()=>{let M=i.IsUndefined(p.pattern)?e.PatternStringExact:p.pattern;return this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[M]:d.Type(w)}})})():this.Never()}Recursive(p,w={}){i.IsUndefined(w.$id)&&(w.$id=`T${ce++}`);let A=p({[e.Kind]:"This",$ref:`${w.$id}`});return A.$id=w.$id,this.Create({...w,[e.Hint]:"Recursive",...A})}Ref(p,w={}){return i.IsString(p)?this.Create({...w,[e.Kind]:"Ref",$ref:p}):(i.IsUndefined(p.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({...w,[e.Kind]:"Ref",$ref:p.$id}))}Required(p,w={}){return T.Map(this.Discard(d.Type(p),["$id",e.Transform]),A=>{let M=Object.getOwnPropertyNames(A.properties).reduce((N,U)=>({...N,[U]:this.Discard(A.properties[U],[e.Optional])}),{});return this.Object(M,A)},w)}Rest(p){return a.TTuple(p)&&!i.IsUndefined(p.items)?d.Rest(p.items):a.TIntersect(p)?d.Rest(p.allOf):a.TUnion(p)?d.Rest(p.anyOf):[]}String(p={}){return this.Create({...p,[e.Kind]:"String",type:"string"})}TemplateLiteral(p,w={}){let A=i.IsString(p)?q.Create(re.Parse(p)):q.Create(p);return this.Create({...w,[e.Kind]:"TemplateLiteral",type:"string",pattern:A})}Transform(p){return new se(p)}Tuple(p,w={}){let[A,M,N]=[!1,p.length,p.length],U=d.Rest(p),g=p.length>0?{...w,[e.Kind]:"Tuple",type:"array",items:U,additionalItems:A,minItems:M,maxItems:N}:{...w,[e.Kind]:"Tuple",type:"array",minItems:M,maxItems:N};return this.Create(g)}Uncapitalize(p,w={}){return{...E.Map(d.Type(p),"Uncapitalize"),...w}}Union(p,w={}){return a.TTemplateLiteral(p)?L.Resolve(p):(()=>{let A=p;if(A.length===0)return this.Never(w);if(A.length===1)return this.Create(d.Type(A[0],w));let M=d.Rest(A);return this.Create({...w,[e.Kind]:"Union",anyOf:M})})()}Unknown(p={}){return this.Create({...p,[e.Kind]:"Unknown"})}Unsafe(p={}){return this.Create({...p,[e.Kind]:p[e.Kind]||"Unsafe"})}Uppercase(p,w={}){return{...E.Map(d.Type(p),"Uppercase"),...w}}};e.JsonTypeBuilder=Z;var ye=class extends Z{AsyncIterator(p,w={}){return this.Create({...w,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:d.Type(p)})}Awaited(p,w={}){let A=M=>M.length>0?(()=>{let[N,...U]=M;return[this.Awaited(N),...A(U)]})():M;return a.TIntersect(p)?e.Type.Intersect(A(p.allOf)):a.TUnion(p)?e.Type.Union(A(p.anyOf)):a.TPromise(p)?this.Awaited(p.item):d.Type(p,w)}BigInt(p={}){return this.Create({...p,[e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(p,w={}){return this.Tuple([...p.parameters],{...w})}Constructor(p,w,A){let[M,N]=[d.Rest(p),d.Type(w)];return this.Create({...A,[e.Kind]:"Constructor",type:"Constructor",parameters:M,returns:N})}Date(p={}){return this.Create({...p,[e.Kind]:"Date",type:"Date"})}Function(p,w,A){let[M,N]=[d.Rest(p),d.Type(w)];return this.Create({...A,[e.Kind]:"Function",type:"Function",parameters:M,returns:N})}InstanceType(p,w={}){return d.Type(p.returns,w)}Iterator(p,w={}){return this.Create({...w,[e.Kind]:"Iterator",type:"Iterator",items:d.Type(p)})}Parameters(p,w={}){return this.Tuple(p.parameters,{...w})}Promise(p,w={}){return this.Create({...w,[e.Kind]:"Promise",type:"Promise",item:d.Type(p)})}RegExp(p,w={}){let A=i.IsString(p)?p:p.source;return this.Create({...w,[e.Kind]:"String",type:"string",pattern:A})}RegEx(p,w={}){return this.RegExp(p,w)}ReturnType(p,w={}){return d.Type(p.returns,w)}Symbol(p){return this.Create({...p,[e.Kind]:"Symbol",type:"symbol"})}Undefined(p={}){return this.Create({...p,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(p={}){return this.Create({...p,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(p={}){return this.Create({...p,[e.Kind]:"Void",type:"void"})}};e.JavaScriptTypeBuilder=ye,e.JsonType=new Z,e.Type=new ye}}),ei=Or(Gr(),1),{String:Gv,Optional:Hv,Boolean:Wv,Object:Jv,Number:Qv}=ei.Type,Yv=Gv.bind(ei.Type),Xv=Qv.bind(ei.Type),DN=Jv.bind(ei.Type),BN=Hv.bind(ei.Type),Zv=Wv.bind(ei.Type),VN=Yv(),FN=Xv(),zN=Zv();function Xo(e){return Array.isArray(e)?e:[e]}var e0={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"},t0=e0;function de(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=typeof e=="string"?e:t0[e];throw typeof i=="function"&&(i=i.apply(null,r)),new Error("[MobX] "+i)}var r0={};function Ra(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:r0}var $d=Object.assign,Zo=Object.getOwnPropertyDescriptor,nr=Object.defineProperty,no=Object.prototype,ea=[];Object.freeze(ea);var Ju={};Object.freeze(Ju);var n0=typeof Proxy<"u",i0=Object.toString();function kd(){n0||de("`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`")}function _i(e){X.verifyProxies&&de("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+e)}function Bt(){return++X.mobxGuid}function Qu(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Mn=function(){};function Fe(e){return typeof e=="function"}function an(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function La(e){return e!==null&&typeof e=="object"}function Yt(e){if(!La(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()===i0}function jd(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Da(e,t,r){nr(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function Nd(e,t,r){nr(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function Hr(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(n){return La(n)&&n[r]===!0}}function ti(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function o0(e){var t=Object.getPrototypeOf(e),r=Object.getPrototypeOf(t),n=Object.getPrototypeOf(r);return n===null}function hr(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var Cd=typeof Object.getOwnPropertySymbols<"u";function a0(e){var t=Object.keys(e);if(!Cd)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return no.propertyIsEnumerable.call(e,n)})):t}var Ba=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Cd?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Ws(e){return typeof e=="string"?e:typeof e=="symbol"?e.toString():new String(e).toString()}function Ud(e){return e===null?null:typeof e=="object"?""+e:e}function Ut(e,t){return no.hasOwnProperty.call(e,t)}var s0=Object.getOwnPropertyDescriptors||function(e){var t={};return Ba(e).forEach(function(r){t[r]=Zo(e,r)}),t};function mt(e,t){return!!(e&t)}function bt(e,t,r){return r?e|=t:e&=~t,e}function fc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function dc(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,l0(n.key),n)}}function ri(e,t,r){return t&&dc(e.prototype,t),r&&dc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Rn(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=c0(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 br(){return br=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},br.apply(null,arguments)}function Pd(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Js(e,t)}function Js(e,t){return Js=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Js(e,t)}function u0(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function l0(e){var t=u0(e,"string");return typeof t=="symbol"?t:t+""}function c0(e,t){if(e){if(typeof e=="string")return fc(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?fc(e,t):void 0}}var gt=Symbol("mobx-stored-annotations");function ir(e){function t(r,n){if(oo(n))return e.decorate_20223_(r,n);io(r,n,e)}return Object.assign(t,e)}function io(e,t,r){if(Ut(e,gt)||Da(e,gt,br({},e[gt])),ta(r)&&!Ut(e[gt],t)){var n=e.constructor.name+".prototype."+t.toString();de("'"+n+"' is decorated with 'override', but no such decorated member was found on prototype.")}f0(e,r,t),ta(r)||(e[gt][t]=r)}function f0(e,t,r){if(!ta(t)&&Ut(e[gt],r)){var n=e.constructor.name+".prototype."+r.toString(),i=e[gt][r].annotationType_,o=t.annotationType_;de("Cannot apply '@"+o+"' to '"+n+"':"+(`
|
|
3
|
+
The field is already decorated with '@`+i+"'.")+`
|
|
4
|
+
Re-decorating fields is not allowed.
|
|
5
|
+
Use '@override' decorator for methods overridden by subclass.`)}}function d0(e){return Ut(e,gt)||Da(e,gt,br({},e[gt])),e[gt]}function oo(e){return typeof e=="object"&&typeof e.kind=="string"}function Va(e,t){t.includes(e.kind)||de("The decorator applied to '"+String(e.name)+"' cannot be used on a "+e.kind+" element")}var we=Symbol("mobx administration"),Wr=function(){function e(r){r===void 0&&(r="Atom@"+Bt()),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=$e.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 Yd(this)},t.reportChanged=function(){jt(),Xd(this),Nt()},t.toString=function(){return this.name_},ri(e,[{key:"isBeingObserved",get:function(){return mt(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=bt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return mt(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=bt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return mt(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=bt(this.flags_,e.diffValueMask_,r===1)}}])}();Wr.isBeingObservedMask_=1;Wr.isPendingUnobservationMask_=2;Wr.diffValueMask_=4;var Yu=Hr("Atom",Wr);function Md(e,t,r){t===void 0&&(t=Mn),r===void 0&&(r=Mn);var n=new Wr(e);return t!==Mn&&Ga(n,t),r!==Mn&&ii(n,r),n}function p0(e,t){return e===t}function h0(e,t){return il(e,t)}function y0(e,t){return il(e,t,1)}function g0(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Je={identity:p0,structural:h0,default:g0,shallow:y0};function ni(e,t,r){return Vn(e)?e:Array.isArray(e)?Be.array(e,{name:r}):Yt(e)?Be.object(e,void 0,{name:r}):ti(e)?Be.map(e,{name:r}):hr(e)?Be.set(e,{name:r}):typeof e=="function"&&!un(e)&&!Di(e)?jd(e)?Bn(e):Ri(r,e):e}function m0(e,t,r){if(e==null||ln(e)||ai(e)||lr(e)||Gt(e))return e;if(Array.isArray(e))return Be.array(e,{name:r,deep:!1});if(Yt(e))return Be.object(e,void 0,{name:r,deep:!1});if(ti(e))return Be.map(e,{name:r,deep:!1});if(hr(e))return Be.set(e,{name:r,deep:!1});de("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function Fa(e){return e}function b0(e,t){return Vn(e)&&de("observable.struct should not be used with observable values"),il(e,t)?t:e}var v0="override";function ta(e){return e.annotationType_===v0}function ao(e,t){return{annotationType_:e,options_:t,make_:w0,extend_:_0,decorate_20223_:T0}}function w0(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(un(r.value))return 1;var o=Rd(e,this,t,r,!1);return nr(n,t,o),2}function _0(e,t,r,n){var i=Rd(e,this,t,r);return e.defineProperty_(t,i,n)}function T0(e,t){Va(t,["method","field"]);var r=t.kind,n=t.name,i=t.addInitializer,o=this,a=function(u){var l,f,d,$;return sn((l=(f=o.options_)==null?void 0:f.name)!=null?l:n.toString(),u,(d=($=o.options_)==null?void 0:$.autoAction)!=null?d:!1)};if(r=="field")return function(u){var l,f=u;return un(f)||(f=a(f)),(l=o.options_)!=null&&l.bound&&(f=f.bind(this),f.isMobxAction=!0),f};if(r=="method"){var s;return un(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}de("Cannot apply '"+o.annotationType_+"' to '"+String(n)+"' (kind: "+r+"):"+(`
|
|
6
|
+
'`+o.annotationType_+"' can only be used on properties with a function value."))}function E0(e,t,r,n){var i=t.annotationType_,o=n.value;Fe(o)||de("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
7
|
+
'`+i+"' can only be used on properties with a function value."))}function Rd(e,t,r,n,i){var o,a,s,u,l,f,d;i===void 0&&(i=X.safeDescriptors),E0(e,t,r,n);var $=n.value;if((o=t.options_)!=null&&o.bound){var E;$=$.bind((E=e.proxy_)!=null?E:e.target_)}return{value:sn((a=(s=t.options_)==null?void 0:s.name)!=null?a:r.toString(),$,(u=(l=t.options_)==null?void 0:l.autoAction)!=null?u:!1,(f=t.options_)!=null&&f.bound?(d=e.proxy_)!=null?d:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function Ld(e,t){return{annotationType_:e,options_:t,make_:O0,extend_:x0,decorate_20223_:A0}}function O0(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&&(!Ut(e.target_,t)||!Di(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(Di(r.value))return 1;var o=Dd(e,this,t,r,!1,!1);return nr(n,t,o),2}function x0(e,t,r,n){var i,o=Dd(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,o,n)}function A0(e,t){var r;Va(t,["method"]);var n=t.name,i=t.addInitializer;return Di(e)||(e=Bn(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 S0(e,t,r,n){var i=t.annotationType_,o=n.value;Fe(o)||de("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
8
|
+
'`+i+"' can only be used on properties with a generator function value."))}function Dd(e,t,r,n,i,o){o===void 0&&(o=X.safeDescriptors),S0(e,t,r,n);var a=n.value;if(Di(a)||(a=Bn(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 Xu(e,t){return{annotationType_:e,options_:t,make_:I0,extend_:$0,decorate_20223_:k0}}function I0(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function $0(e,t,r,n){return j0(e,this,t,r),e.defineComputedProperty_(t,br({},this.options_,{get:r.get,set:r.set}),n)}function k0(e,t){Va(t,["getter"]);var r=this,n=t.name,i=t.addInitializer;return i(function(){var o=si(this)[we],a=br({},r.options_,{get:e,context:this});a.name||(a.name=o.name_+"."+n.toString()),o.values_.set(n,new Mt(a))}),function(){return this[we].getObservablePropValue_(n)}}function j0(e,t,r,n){var i=t.annotationType_,o=n.get;o||de("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
9
|
+
'`+i+"' can only be used on getter(+setter) properties."))}function za(e,t){return{annotationType_:e,options_:t,make_:N0,extend_:C0,decorate_20223_:U0}}function N0(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function C0(e,t,r,n){var i,o;return P0(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(o=this.options_)==null?void 0:o.enhancer)!=null?i:ni,n)}function U0(e,t){if(t.kind==="field")throw de("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");Va(t,["accessor"]);var r=this,n=t.kind,i=t.name,o=new WeakSet;function a(s,u){var l,f,d=si(s)[we],$=new Br(u,(l=(f=r.options_)==null?void 0:f.enhancer)!=null?l:ni,d.name_+"."+i.toString(),!1);d.values_.set(i,$),o.add(s)}if(n=="accessor")return{get:function(){return o.has(this)||a(this,e.get.call(this)),this[we].getObservablePropValue_(i)},set:function(s){return o.has(this)||a(this,s),this[we].setObservablePropValue_(i,s)},init:function(s){return o.has(this)||a(this,s),s}}}function P0(e,t,r,n){var i=t.annotationType_;"value"in n||de("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
10
|
+
'`+i+"' cannot be used on getter/setter properties"))}var M0="true",R0=Bd();function Bd(e){return{annotationType_:M0,options_:e,make_:L0,extend_:D0,decorate_20223_:B0}}function L0(e,t,r,n){var i,o;if(r.get)return He.make_(e,t,r,n);if(r.set){var a=sn(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:X.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(nr(n,t,{configurable:!0,set:a}),2)}if(n!==e.target_&&typeof r.value=="function"){var s;if(jd(r.value)){var u,l=(u=this.options_)!=null&&u.autoBind?Bn.bound:Bn;return l.make_(e,t,r,n)}var f=(s=this.options_)!=null&&s.autoBind?Ri.bound:Ri;return f.make_(e,t,r,n)}var d=((i=this.options_)==null?void 0:i.deep)===!1?Be.ref:Be;if(typeof r.value=="function"&&(o=this.options_)!=null&&o.autoBind){var $;r.value=r.value.bind(($=e.proxy_)!=null?$:e.target_)}return d.make_(e,t,r,n)}function D0(e,t,r,n){var i,o;if(r.get)return He.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:X.safeDescriptors?e.isPlainObject_:!0,set:sn(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?Be.ref:Be;return s.extend_(e,t,r,n)}function B0(e,t){de("'"+this.annotationType_+"' cannot be used as a decorator")}var V0="observable",F0="observable.ref",z0="observable.shallow",K0="observable.struct",Vd={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Vd);function _o(e){return e||Vd}var Qs=za(V0),q0=za(F0,{enhancer:Fa}),G0=za(z0,{enhancer:m0}),H0=za(K0,{enhancer:b0}),Fd=ir(Qs);function To(e){return e.deep===!0?ni:e.deep===!1?Fa:J0(e.defaultDecorator)}function W0(e){var t;return e?(t=e.defaultDecorator)!=null?t:Bd(e):void 0}function J0(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:ni}function zd(e,t,r){if(oo(t))return Qs.decorate_20223_(e,t);if(an(t)){io(e,t,Qs);return}return Vn(e)?e:Yt(e)?Be.object(e,t,r):Array.isArray(e)?Be.array(e,t):ti(e)?Be.map(e,t):hr(e)?Be.set(e,t):typeof e=="object"&&e!==null?e:Be.box(e,t)}$d(zd,Fd);var Q0={box:function(e,t){var r=_o(t);return new Br(e,To(r),r.name,!0,r.equals)},array:function(e,t){var r=_o(t);return(X.useProxies===!1||r.proxy===!1?e1:Kw)(e,To(r),r.name)},map:function(e,t){var r=_o(t);return new dp(e,To(r),r.name)},set:function(e,t){var r=_o(t);return new pp(e,To(r),r.name)},object:function(e,t,r){return Tn(function(){return Cw(X.useProxies===!1||r?.proxy===!1?si({},r):Vw({},r),e,t)})},ref:ir(q0),shallow:ir(G0),deep:Fd,struct:ir(H0)},Be=$d(zd,Q0),Kd="computed",Y0="computed.struct",Ys=Xu(Kd),X0=Xu(Y0,{equals:Je.structural}),He=function(e,t){if(oo(t))return Ys.decorate_20223_(e,t);if(an(t))return io(e,t,Ys);if(Yt(e))return ir(Xu(Kd,e));Fe(e)||de("First argument to `computed` should be an expression."),Fe(t)&&de("A setter as second argument is no longer supported, use `{ set: fn }` option instead");var r=Yt(t)?t:{};return r.get=e,r.name||(r.name=e.name||""),new Mt(r)};Object.assign(He,Ys);He.struct=ir(X0);var pc,hc,ra=0,Z0=1,ew=(pc=(hc=Zo(function(){},"name"))==null?void 0:hc.configurable)!=null?pc:!1,yc={value:"action",configurable:!0,writable:!1,enumerable:!1};function sn(e,t,r,n){r===void 0&&(r=!1),Fe(t)||de("`action` can only be invoked on functions"),(typeof e!="string"||!e)&&de("actions should have valid names, got: '"+e+"'");function i(){return qd(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},ew&&(yc.value=e,nr(i,"name",yc)),i}function qd(e,t,r,n,i){var o=tw(e,t,n,i);try{return r.apply(n,i)}catch(a){throw o.error_=a,a}finally{rw(o)}}function tw(e,t,r,n){var i=ot()&&!!e,o=0;if(i){o=Date.now();var a=n?Array.from(n):ea;vt({type:el,name:e,object:r,arguments:a})}var s=X.trackingDerivation,u=!t||!s;jt();var l=X.allowStateChanges;u&&(_n(),l=Ka(!0));var f=Zu(!0),d={runAsAction_:u,prevDerivation_:s,prevAllowStateChanges_:l,prevAllowStateReads_:f,notifySpy_:i,startTime_:o,actionId_:Z0++,parentActionId_:ra};return ra=d.actionId_,d}function rw(e){ra!==e.actionId_&&de(30),ra=e.parentActionId_,e.error_!==void 0&&(X.suppressReactionErrors=!0),qa(e.prevAllowStateChanges_),Ni(e.prevAllowStateReads_),Nt(),e.runAsAction_&&gr(e.prevDerivation_),e.notifySpy_&&wt({time:Date.now()-e.startTime_}),X.suppressReactionErrors=!1}function nw(e,t){var r=Ka(e);try{return t()}finally{qa(r)}}function Ka(e){var t=X.allowStateChanges;return X.allowStateChanges=e,t}function qa(e){X.allowStateChanges=e}var iw="create",Br=function(e){function t(n,i,o,a,s){var u;return o===void 0&&(o="ObservableValue@"+Bt()),a===void 0&&(a=!0),s===void 0&&(s=Je.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&&ot()&&Dn({type:iw,object:u,observableKind:"value",debugObjectName:u.name_,newValue:""+u.value_}),u}Pd(t,e);var r=t.prototype;return r.dehanceValue=function(n){return this.dehancer!==void 0?this.dehancer(n):n},r.set=function(n){var i=this.value_;if(n=this.prepareNewValue_(n),n!==X.UNCHANGED){var o=ot();o&&vt({type:Wt,object:this,observableKind:"value",debugObjectName:this.name_,newValue:n,oldValue:i}),this.setNewValue_(n),o&&wt()}},r.prepareNewValue_=function(n){if(rr(this),$t(this)){var i=kt(this,{object:this,type:Wt,newValue:n});if(!i)return X.UNCHANGED;n=i.newValue}return n=this.enhancer(n,this.value_,this.name_),this.equals(this.value_,n)?X.UNCHANGED:n},r.setNewValue_=function(n){var i=this.value_;this.value_=n,this.reportChanged(),Jt(this)&&Qt(this,{type:Wt,object:this,newValue:n,oldValue:i})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(n){return uo(this,n)},r.observe_=function(n,i){return i&&n({observableKind:"value",debugObjectName:this.name_,object:this,type:Wt,newValue:this.value_,oldValue:void 0}),lo(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 Ud(this.get())},r[Symbol.toPrimitive]=function(){return this.valueOf()},t}(Wr),ow=Hr("ObservableValue",Br),Mt=function(){function e(r){this.dependenciesState_=$e.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new na(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Pt.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,r.get||de(31),this.derivation=r.get,this.name_=r.name||"ComputedValue@"+Bt(),r.set&&(this.setter_=sn(this.name_+"-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?Je.structural:Je.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){gw(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&&de(32,this.name_,this.derivation),X.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)Xs(this)&&(this.warnAboutUntrackedRead_(),jt(),this.value_=this.computeValue_(!1),Nt());else if(Yd(this),Xs(this)){var r=X.trackingContext;this.keepAlive_&&!r&&(X.trackingContext=this),this.trackAndCompute()&&yw(this),X.trackingContext=r}var n=this.value_;if(ko(n))throw n.cause;return n},t.set=function(r){if(this.setter_){this.isRunningSetter&&de(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else de(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,n=this.dependenciesState_===$e.NOT_TRACKING_,i=this.computeValue_(!0),o=n||ko(r)||ko(i)||!this.equals_(r,i);return o&&(this.value_=i,ot()&&Dn({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:r,newValue:i})),o},t.computeValue_=function(r){this.isComputing=!0;var n=Ka(!1),i;if(r)i=Gd(this,this.derivation,this.scope_);else if(X.disableErrorBoundaries===!0)i=this.derivation.call(this.scope_);else try{i=this.derivation.call(this.scope_)}catch(o){i=new na(o)}return qa(n),this.isComputing=!1,i},t.suspend_=function(){this.keepAlive_||(Zs(this),this.value_=void 0,this.isTracing_!==Pt.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 Rt(function(){var s=i.get();if(!o||n){var u=_n();r({observableKind:"computed",debugObjectName:i.name_,type:Wt,object:i,newValue:s,oldValue:a}),gr(u)}o=!1,a=s})},t.warnAboutUntrackedRead_=function(){this.isTracing_!==Pt.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_:X.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 Ud(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},ri(e,[{key:"isComputing",get:function(){return mt(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=bt(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return mt(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=bt(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return mt(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=bt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return mt(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=bt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return mt(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=bt(this.flags_,e.diffValueMask_,r===1)}}])}();Mt.isComputingMask_=1;Mt.isRunningSetterMask_=2;Mt.isBeingObservedMask_=4;Mt.isPendingUnobservationMask_=8;Mt.diffValueMask_=16;var so=Hr("ComputedValue",Mt),$e;(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_"})($e||($e={}));var Pt;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(Pt||(Pt={}));var na=function(e){this.cause=void 0,this.cause=e};function ko(e){return e instanceof na}function Xs(e){switch(e.dependenciesState_){case $e.UP_TO_DATE_:return!1;case $e.NOT_TRACKING_:case $e.STALE_:return!0;case $e.POSSIBLY_STALE_:{for(var t=Zu(!0),r=_n(),n=e.observing_,i=n.length,o=0;o<i;o++){var a=n[o];if(so(a)){if(X.disableErrorBoundaries)a.get();else try{a.get()}catch{return gr(r),Ni(t),!0}if(e.dependenciesState_===$e.STALE_)return gr(r),Ni(t),!0}}return Hd(e),gr(r),Ni(t),!1}}}function aw(){return X.trackingDerivation!==null}function rr(e){var t=e.observers_.size>0;!X.allowStateChanges&&(t||X.enforceActions==="always")&&console.warn("[MobX] "+(X.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 sw(e){!X.allowStateReads&&X.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function Gd(e,t,r){var n=Zu(!0);Hd(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++X.runId;var i=X.trackingDerivation;X.trackingDerivation=e,X.inBatch++;var o;if(X.disableErrorBoundaries===!0)o=t.call(r);else try{o=t.call(r)}catch(a){o=new na(a)}return X.inBatch--,X.trackingDerivation=i,lw(e),uw(e),Ni(n),o}function uw(e){e.observing_.length===0&&(typeof e.requiresObservable_=="boolean"?e.requiresObservable_:X.reactionRequiresObservable)&&console.warn("[mobx] Derivation '"+e.name_+"' is created/updated without reading any observable value.")}function lw(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=$e.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&&Jd(u,e),u.diffValue=0}for(;i--;){var l=r[i];l.diffValue===1&&(l.diffValue=0,hw(l,e))}n!==$e.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function Zs(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)Jd(t[r],e);e.dependenciesState_=$e.NOT_TRACKING_}function De(e){var t=_n();try{return e()}finally{gr(t)}}function _n(){var e=X.trackingDerivation;return X.trackingDerivation=null,e}function gr(e){X.trackingDerivation=e}function Zu(e){var t=X.allowStateReads;return X.allowStateReads=e,t}function Ni(e){X.allowStateReads=e}function Hd(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=$e.UP_TO_DATE_}}var jo=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},No=!0,Wd=!1,X=function(){var e=Ra();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(No=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new jo().version&&(No=!1),No?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new jo):(setTimeout(function(){Wd||de(35)},1),new jo)}();function cw(){if((X.pendingReactions.length||X.inBatch||X.isRunningReactions)&&de(36),Wd=!0,No){var e=Ra();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),X=new jo}}function fw(){return X}function dw(e){return e.observers_&&e.observers_.size>0}function pw(e){return e.observers_}function hw(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Jd(e,t){e.observers_.delete(t),e.observers_.size===0&&Qd(e)}function Qd(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,X.pendingUnobservations.push(e))}function jt(){X.inBatch++}function Nt(){if(--X.inBatch===0){tp();for(var e=X.pendingUnobservations,t=0;t<e.length;t++){var r=e[t];r.isPendingUnobservation=!1,r.observers_.size===0&&(r.isBeingObserved&&(r.isBeingObserved=!1,r.onBUO()),r instanceof Mt&&r.suspend_())}X.pendingUnobservations=[]}}function Yd(e){sw(e);var t=X.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&X.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&X.inBatch>0&&Qd(e),!1)}function Xd(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===$e.UP_TO_DATE_&&(t.isTracing_!==Pt.NONE&&Zd(t,e),t.onBecomeStale_()),t.dependenciesState_=$e.STALE_}))}function yw(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===$e.POSSIBLY_STALE_?(t.dependenciesState_=$e.STALE_,t.isTracing_!==Pt.NONE&&Zd(t,e)):t.dependenciesState_===$e.UP_TO_DATE_&&(e.lowestObserverState_=$e.UP_TO_DATE_)}))}function gw(e){e.lowestObserverState_===$e.UP_TO_DATE_&&(e.lowestObserverState_=$e.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===$e.UP_TO_DATE_&&(t.dependenciesState_=$e.POSSIBLY_STALE_,t.onBecomeStale_())}))}function Zd(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===Pt.BREAK){var r=[];ep(Ha(e),r,1),new Function(`debugger;
|
|
11
|
+
/*
|
|
12
|
+
Tracing '`+e.name_+`'
|
|
13
|
+
|
|
14
|
+
You are entering this break point because derivation '`+e.name_+"' is being traced and '"+t.name_+`' is now forcing it to update.
|
|
15
|
+
Just follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update
|
|
16
|
+
The stackframe you are looking for is at least ~6-8 stack-frames up.
|
|
17
|
+
|
|
18
|
+
`+(e instanceof Mt?e.derivation.toString().replace(/[*]\//g,"/"):"")+`
|
|
19
|
+
|
|
20
|
+
The dependencies for this derivation are:
|
|
21
|
+
|
|
22
|
+
`+r.join(`
|
|
23
|
+
`)+`
|
|
24
|
+
*/
|
|
25
|
+
`)()}}function ep(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 ep(n,t,r+1)})}var ar=function(){function e(r,n,i,o){r===void 0&&(r="Reaction@"+Bt()),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Pt.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,X.pendingReactions.push(this),tp())},t.runReaction_=function(){if(!this.isDisposed){jt(),this.isScheduled=!1;var r=X.trackingContext;if(X.trackingContext=this,Xs(this)){this.isTrackPending=!0;try{this.onInvalidate_(),this.isTrackPending&&ot()&&Dn({name:this.name_,type:"scheduled-reaction"})}catch(n){this.reportExceptionInDerivation_(n)}}X.trackingContext=r,Nt()}},t.track=function(r){if(!this.isDisposed){jt();var n=ot(),i;n&&(i=Date.now(),vt({name:this.name_,type:"reaction"})),this.isRunning=!0;var o=X.trackingContext;X.trackingContext=this;var a=Gd(this,r,void 0);X.trackingContext=o,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Zs(this),ko(a)&&this.reportExceptionInDerivation_(a.cause),n&&wt({time:Date.now()-i}),Nt()}},t.reportExceptionInDerivation_=function(r){var n=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(X.disableErrorBoundaries)throw r;var i="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";X.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name_+"' suppressed, fix error of causing action below)"):console.error(i,r),ot()&&Dn({type:"error",name:this.name_,message:i,error:""+r}),X.globalReactionErrorHandlers.forEach(function(o){return o(r,n)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(jt(),Zs(this),Nt()))},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[we]=this,i},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){r===void 0&&(r=!1),cp(this,r)},ri(e,[{key:"isDisposed",get:function(){return mt(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=bt(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return mt(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=bt(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return mt(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=bt(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return mt(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=bt(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return mt(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=bt(this.flags_,e.diffValueMask_,r===1)}}])}();ar.isDisposedMask_=1;ar.isScheduledMask_=2;ar.isTrackPendingMask_=4;ar.isRunningMask_=8;ar.diffValueMask_=16;var gc=100,eu=function(e){return e()};function tp(){X.inBatch>0||X.isRunningReactions||eu(mw)}function mw(){X.isRunningReactions=!0;for(var e=X.pendingReactions,t=0;e.length>0;){++t===gc&&(console.error("Reaction doesn't converge to a stable state after "+gc+" 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_()}X.isRunningReactions=!1}var ia=Hr("Reaction",ar);function bw(e){var t=eu;eu=function(r){return e(function(){return t(r)})}}function ot(){return!!X.spyListeners.length}function Dn(e){if(X.spyListeners.length)for(var t=X.spyListeners,r=0,n=t.length;r<n;r++)t[r](e)}function vt(e){var t=br({},e,{spyReportStart:!0});Dn(t)}var vw={type:"report-end",spyReportEnd:!0};function wt(e){Dn(e?br({},e,{type:"report-end",spyReportEnd:!0}):vw)}function ww(e){return X.spyListeners.push(e),Qu(function(){X.spyListeners=X.spyListeners.filter(function(t){return t!==e})})}var el="action",_w="action.bound",rp="autoAction",Tw="autoAction.bound",np="<unnamed action>",tu=ao(el),Ew=ao(_w,{bound:!0}),ru=ao(rp,{autoAction:!0}),Ow=ao(Tw,{autoAction:!0,bound:!0});function ip(e){var t=function(r,n){if(Fe(r))return sn(r.name||np,r,e);if(Fe(n))return sn(r,n,e);if(oo(n))return(e?ru:tu).decorate_20223_(r,n);if(an(n))return io(r,n,e?ru:tu);if(an(r))return ir(ao(e?rp:el,{name:r,autoAction:e}));de("Invalid arguments for `action`")};return t}var Ct=ip(!1);Object.assign(Ct,tu);var Ri=ip(!0);Object.assign(Ri,ru);Ct.bound=ir(Ew);Ri.bound=ir(Ow);function Li(e){return qd(e.name||np,!1,e,this,void 0)}function un(e){return Fe(e)&&e.isMobxAction===!0}function Rt(e,t){var r,n,i,o;t===void 0&&(t=Ju),Fe(e)||de("Autorun expects a function as first argument"),un(e)&&de("Autorun does not accept actions since actions are untrackable");var a=(r=(n=t)==null?void 0:n.name)!=null?r:e.name||"Autorun@"+Bt(),s=!t.scheduler&&!t.delay,u;if(s)u=new ar(a,function(){this.track(d)},t.onError,t.requiresObservable);else{var l=op(t),f=!1;u=new ar(a,function(){f||(f=!0,l(function(){f=!1,u.isDisposed||u.track(d)}))},t.onError,t.requiresObservable)}function d(){e(u)}return(i=t)!=null&&(i=i.signal)!=null&&i.aborted||u.schedule_(),u.getDisposer_((o=t)==null?void 0:o.signal)}var xw=function(e){return e()};function op(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xw}function Aw(e,t,r){var n,i,o;r===void 0&&(r=Ju),(!Fe(e)||!Fe(t))&&de("First and second argument to reaction should be functions"),Yt(r)||de("Third argument of reactions should be an object");var a=(n=r.name)!=null?n:"Reaction@"+Bt(),s=Ct(a,r.onError?Sw(r.onError,t):t),u=!r.scheduler&&!r.delay,l=op(r),f=!0,d=!1,$,E=r.compareStructural?Je.structural:r.equals||Je.default,T=new ar(a,function(){f||u?B():d||(d=!0,l(B))},r.onError,r.requiresObservable);function B(){if(d=!1,!T.isDisposed){var W=!1,R=$;T.track(function(){var k=nw(!1,function(){return e(T)});W=f||!E($,k),$=k}),(f&&r.fireImmediately||!f&&W)&&s($,R,T),f=!1}}return(i=r)!=null&&(i=i.signal)!=null&&i.aborted||T.schedule_(),T.getDisposer_((o=r)==null?void 0:o.signal)}function Sw(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var Iw="onBO",$w="onBUO";function Ga(e,t,r){return ap(Iw,e,t,r)}function ii(e,t,r){return ap($w,e,t,r)}function ap(e,t,r,n){var i=typeof n=="function"?Xt(t,r):Xt(t),o=Fe(n)?n:r,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var s=i[a];s&&(s.delete(o),s.size===0&&delete i[a])}}var kw="never",Eo="always",jw="observed";function Nw(e){e.isolateGlobalState===!0&&cw();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(X.useProxies=t===Eo?!0:t===kw?!1:typeof Proxy<"u"),t==="ifavailable"&&(X.verifyProxies=!0),r!==void 0){var n=r===Eo?Eo:r===jw;X.enforceActions=n,X.allowStateChanges=!(n===!0||n===Eo)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(X[i]=!!e[i])}),X.allowStateReads=!X.observableRequiresReaction,X.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&bw(e.reactionScheduler)}function Cw(e,t,r,n){arguments.length>4&&de("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&de("'extendObservable' expects an object as first argument"),lr(e)&&de("'extendObservable' should not be used on maps, use map.merge instead"),Yt(t)||de("'extendObservable' only accepts plain objects as second argument"),(Vn(t)||Vn(r))&&de("Extending an object with another observable (object) is not supported");var i=s0(t);return Tn(function(){var o=si(e,n)[we];Ba(i).forEach(function(a){o.extend_(a,i[a],r&&a in r?r[a]:!0)})}),e}function Ha(e,t){return sp(Xt(e,t))}function sp(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=Uw(e.observing_).map(sp)),t}function oa(e,t){return up(Xt(e,t))}function up(e){var t={name:e.name_};return dw(e)&&(t.observers=Array.from(pw(e)).map(up)),t}function Uw(e){return Array.from(new Set(e))}var Pw=0;function lp(){this.message="FLOW_CANCELLED"}lp.prototype=Object.create(Error.prototype);var Os=Ld("flow"),Mw=Ld("flow.bound",{bound:!0}),Bn=Object.assign(function(e,t){if(oo(t))return Os.decorate_20223_(e,t);if(an(t))return io(e,t,Os);arguments.length!==1&&de("Flow expects single argument with generator function");var r=e,n=r.name||"<unnamed flow>",i=function(){var o=this,a=arguments,s=++Pw,u=Ct(n+" - runid: "+s+" - init",r).apply(o,a),l,f=void 0,d=new Promise(function($,E){var T=0;l=E;function B(k){f=void 0;var F;try{F=Ct(n+" - runid: "+s+" - yield "+T++,u.next).call(u,k)}catch(q){return E(q)}R(F)}function W(k){f=void 0;var F;try{F=Ct(n+" - runid: "+s+" - yield "+T++,u.throw).call(u,k)}catch(q){return E(q)}R(F)}function R(k){if(Fe(k?.then)){k.then(R,E);return}return k.done?$(k.value):(f=Promise.resolve(k.value),f.then(B,W))}B(void 0)});return d.cancel=Ct(n+" - runid: "+s+" - cancel",function(){try{f&&mc(f);var $=u.return(void 0),E=Promise.resolve($.value);E.then(Mn,Mn),mc(E),l(new lp)}catch(T){l(T)}}),d};return i.isMobXFlow=!0,i},Os);Bn.bound=ir(Mw);function mc(e){Fe(e.cancel)&&e.cancel()}function Di(e){return e?.isMobXFlow===!0}function Rw(e,t){return e?t!==void 0?lr(e)||ai(e)?de("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."):ln(e)?e[we].values_.has(t):!1:ln(e)||!!e[we]||Yu(e)||ia(e)||so(e):!1}function Vn(e){return arguments.length!==1&&de("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),Rw(e)}function Lw(e){if(ln(e))return e[we].ownKeys_();de(38)}function Oo(e,t,r){return e.set(t,r),r}function Un(e,t){if(e==null||typeof e!="object"||e instanceof Date||!Vn(e))return e;if(ow(e)||so(e))return Un(e.get(),t);if(t.has(e))return t.get(e);if(ai(e)){var r=Oo(t,e,new Array(e.length));return e.forEach(function(a,s){r[s]=Un(a,t)}),r}if(Gt(e)){var n=Oo(t,e,new Set);return e.forEach(function(a){n.add(Un(a,t))}),n}if(lr(e)){var i=Oo(t,e,new Map);return e.forEach(function(a,s){i.set(s,Un(a,t))}),i}else{var o=Oo(t,e,{});return Lw(e).forEach(function(a){no.propertyIsEnumerable.call(e,a)&&(o[a]=Un(e[a],t))}),o}}function mr(e,t){return t&&de("toJS no longer supports options"),Un(e,new Map)}function cp(){for(var e=!1,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];typeof r[r.length-1]=="boolean"&&(e=r.pop());var i=Dw(r);if(!i)return de("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");i.isTracing_===Pt.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled"),i.isTracing_=e?Pt.BREAK:Pt.LOG}function Dw(e){switch(e.length){case 0:return X.trackingDerivation;case 1:return Xt(e[0]);case 2:return Xt(e[0],e[1])}}function yr(e,t){t===void 0&&(t=void 0),jt();try{return e.apply(t)}finally{Nt()}}function Zr(e){return e[we]}var Bw={has:function(e,t){return X.trackingDerivation&&_i("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),Zr(e).has_(t)},get:function(e,t){return Zr(e).get_(t)},set:function(e,t,r){var n;return an(t)?(Zr(e).values_.has(t)||_i("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(n=Zr(e).set_(t,r,!0))!=null?n:!0):!1},deleteProperty:function(e,t){var r;return _i("delete properties from an observable object. Use 'remove' from 'mobx' instead."),an(t)?(r=Zr(e).delete_(t,!0))!=null?r:!0:!1},defineProperty:function(e,t,r){var n;return _i("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(n=Zr(e).defineProperty_(t,r))!=null?n:!0},ownKeys:function(e){return X.trackingDerivation&&_i("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),Zr(e).ownKeys_()},preventExtensions:function(e){de(13)}};function Vw(e,t){var r,n;return kd(),e=si(e,t),(n=(r=e[we]).proxy_)!=null?n:r.proxy_=new Proxy(e,Bw)}function $t(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function uo(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),Qu(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function kt(e,t){var r=_n();try{for(var n=[].concat(e.interceptors_||[]),i=0,o=n.length;i<o&&(t=n[i](t),t&&!t.type&&de(14),!!t);i++);return t}finally{gr(r)}}function Jt(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function lo(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),Qu(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Qt(e,t){var r=_n(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,o=n.length;i<o;i++)n[i](t);gr(r)}}function oi(e,t,r){return Tn(function(){var n,i=si(e,r)[we];t&&e[gt]&&de("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(n=t)!=null||(t=d0(e)),Ba(t).forEach(function(o){return i.make_(o,t[o])})}),e}var bc="splice",Wt="update",Fw=1e4,zw={get:function(e,t){var r=e[we];return t===we?r:t==="length"?r.getArrayLength_():typeof t=="string"&&!isNaN(t)?r.get_(parseInt(t)):Ut(aa,t)?aa[t]:e[t]},set:function(e,t,r){var n=e[we];return t==="length"&&n.setArrayLength_(r),typeof t=="symbol"||isNaN(t)?e[t]=r:n.set_(parseInt(t),r),!0},preventExtensions:function(){de(15)}},tl=function(){function e(r,n,i,o){r===void 0&&(r="ObservableArray@"+Bt()),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 Wr(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 uo(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}),lo(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&de("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_&&de(16),this.lastKnownLength_+=n,this.legacyMode_&&n>0&&gp(r+n+1)},t.spliceWithArray_=function(r,n,i){var o=this;rr(this.atom_);var a=this.values_.length;if(r===void 0?r=0:r>a?r=a:r<0&&(r=Math.max(0,a+r)),arguments.length===1?n=a-r:n==null?n=0:n=Math.max(0,Math.min(n,a-r)),i===void 0&&(i=ea),$t(this)){var s=kt(this,{object:this.proxy_,type:bc,index:r,removedCount:n,added:i});if(!s)return ea;n=s.removedCount,i=s.added}i=i.length===0?i:i.map(function(f){return o.enhancer_(f,void 0)}),this.legacyMode_;var u=i.length-n;this.updateArrayLength_(a,u);var l=this.spliceItemsIntoValues_(r,n,i);return(n!==0||i.length!==0)&&this.notifyArraySplice_(r,i,l),this.dehanceValues_(l)},t.spliceItemsIntoValues_=function(r,n,i){if(i.length<Fw){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_&&ot(),a=Jt(this),s=a||o?{observableKind:"array",object:this.proxy_,type:Wt,debugObjectName:this.atom_.name_,index:r,newValue:n,oldValue:i}:null;o&&vt(s),this.atom_.reportChanged(),a&&Qt(this,s),o&&wt()},t.notifyArraySplice_=function(r,n,i){var o=!this.owned_&&ot(),a=Jt(this),s=a||o?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:bc,index:r,removed:i,added:n,removedCount:i.length,addedCount:n.length}:null;o&&vt(s),this.atom_.reportChanged(),a&&Qt(this,s),o&&wt()},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&&de(17,r,i.length),r<i.length){rr(this.atom_);var o=i[r];if($t(this)){var a=kt(this,{type:Wt,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 Kw(e,t,r,n){return r===void 0&&(r="ObservableArray@"+Bt()),n===void 0&&(n=!1),kd(),Tn(function(){var i=new tl(r,t,n,!1);Nd(i.values_,we,i);var o=new Proxy(i.values_,zw);return i.proxy_=o,e&&e.length&&i.spliceWithArray_(0,0,e),o})}var aa={clear:function(){return this.splice(0)},replace:function(e){var t=this[we];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[we];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[we].spliceWithArray_(e,t,r)},push:function(){for(var e=this[we],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[we].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[we],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 X.trackingDerivation&&de(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){X.trackingDerivation&&de(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[we],r=t.dehanceValues_(t.values_).indexOf(e);return r>-1?(this.splice(r,1),!0):!1}};Me("at",_t);Me("concat",_t);Me("flat",_t);Me("includes",_t);Me("indexOf",_t);Me("join",_t);Me("lastIndexOf",_t);Me("slice",_t);Me("toString",_t);Me("toLocaleString",_t);Me("toSorted",_t);Me("toSpliced",_t);Me("with",_t);Me("every",er);Me("filter",er);Me("find",er);Me("findIndex",er);Me("findLast",er);Me("findLastIndex",er);Me("flatMap",er);Me("forEach",er);Me("map",er);Me("some",er);Me("toReversed",er);Me("reduce",fp);Me("reduceRight",fp);function Me(e,t){typeof Array.prototype[e]=="function"&&(aa[e]=t(e))}function _t(e){return function(){var t=this[we];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function er(e){return function(t,r){var n=this,i=this[we];i.atom_.reportObserved();var o=i.dehanceValues_(i.values_);return o[e](function(a,s){return t.call(r,a,s,n)})}}function fp(e){return function(){var t=this,r=this[we];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(o,a,s){return i(o,a,s,t)},n[e].apply(n,arguments)}}var qw=Hr("ObservableArrayAdministration",tl);function ai(e){return La(e)&&qw(e[we])}var Gw={},Lr="add",sa="delete",dp=function(){function e(r,n,i){var o=this;n===void 0&&(n=ni),i===void 0&&(i="ObservableMap@"+Bt()),this.enhancer_=void 0,this.name_=void 0,this[we]=Gw,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=i,Fe(Map)||de(18),Tn(function(){o.keysAtom_=Md(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(!X.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var o=i=new Br(this.has_(r),Fa,this.name_+"."+Ws(r)+"?",!1);this.hasMap_.set(r,o),ii(o,function(){return n.hasMap_.delete(r)})}return i.get()},t.set=function(r,n){var i=this.has_(r);if($t(this)){var o=kt(this,{type:i?Wt:Lr,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(rr(this.keysAtom_),$t(this)){var i=kt(this,{type:sa,object:this,name:r});if(!i)return!1}if(this.has_(r)){var o=ot(),a=Jt(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:sa,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return o&&vt(s),yr(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&&Qt(this,s),o&&wt(),!0}return!1},t.updateValue_=function(r,n){var i=this.data_.get(r);if(n=i.prepareNewValue_(n),n!==X.UNCHANGED){var o=ot(),a=Jt(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:Wt,object:this,oldValue:i.value_,name:r,newValue:n}:null;o&&vt(s),i.setNewValue_(n),a&&Qt(this,s),o&&wt()}},t.addValue_=function(r,n){var i=this;rr(this.keysAtom_),yr(function(){var u,l=new Br(n,i.enhancer_,i.name_+"."+Ws(r),!1);i.data_.set(r,l),n=l.value_,(u=i.hasMap_.get(r))==null||u.setNewValue_(!0),i.keysAtom_.reportChanged()});var o=ot(),a=Jt(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:Lr,object:this,name:r,newValue:n}:null;o&&vt(s),a&&Qt(this,s),o&&wt()},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 vc({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 vc({next:function(){var i=n.next(),o=i.done,a=i.value;return{done:o,value:o?void 0:[a,r.get(a)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(r,n){for(var i=Rn(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 lr(r)&&(r=new Map(r)),yr(function(){Yt(r)?a0(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)}):ti(r)?(o0(r)||de(19,r),r.forEach(function(i,o){return n.set(o,i)})):r!=null&&de(20,r)}),this},t.clear=function(){var r=this;yr(function(){De(function(){for(var n=Rn(r.keys()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.replace=function(r){var n=this;return yr(function(){for(var i=Hw(r),o=new Map,a=!1,s=Rn(n.data_.keys()),u;!(u=s()).done;){var l=u.value;if(!i.has(l)){var f=n.delete(l);if(f)a=!0;else{var d=n.data_.get(l);o.set(l,d)}}}for(var $=Rn(i.entries()),E;!(E=$()).done;){var T=E.value,B=T[0],W=T[1],R=n.data_.has(B);if(n.set(B,W),n.data_.has(B)){var k=n.data_.get(B);o.set(B,k),R||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var F=n.data_.keys(),q=o.keys(),L=F.next(),Q=q.next();!L.done;){if(L.value!==Q.value){n.keysAtom_.reportChanged();break}L=F.next(),Q=q.next()}n.data_=o}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,n){return n===!0&&de("`observe` doesn't support fireImmediately=true in combination with maps."),lo(this,r)},t.intercept_=function(r){return uo(this,r)},ri(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),lr=Hr("ObservableMap",dp);function vc(e){return e[Symbol.toStringTag]="MapIterator",ol(e)}function Hw(e){if(ti(e)||lr(e))return e;if(Array.isArray(e))return new Map(e);if(Yt(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return de(21,e)}var Ww={},pp=function(){function e(r,n,i){var o=this;n===void 0&&(n=ni),i===void 0&&(i="ObservableSet@"+Bt()),this.name_=void 0,this[we]=Ww,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=i,Fe(Set)||de(22),this.enhancer_=function(a,s){return n(a,s,i)},Tn(function(){o.atom_=Md(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;yr(function(){De(function(){for(var n=Rn(r.data_.values()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.forEach=function(r,n){for(var i=Rn(this),o;!(o=i()).done;){var a=o.value;r.call(n,a,a,this)}},t.add=function(r){var n=this;if(rr(this.atom_),$t(this)){var i=kt(this,{type:Lr,object:this,newValue:r});if(!i)return this;r=i.newValue}if(!this.has(r)){yr(function(){n.data_.add(n.enhancer_(r,void 0)),n.atom_.reportChanged()});var o=ot(),a=Jt(this),s=a||o?{observableKind:"set",debugObjectName:this.name_,type:Lr,object:this,newValue:r}:null;o&&vt(s),a&&Qt(this,s),o&&wt()}return this},t.delete=function(r){var n=this;if($t(this)){var i=kt(this,{type:sa,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var o=ot(),a=Jt(this),s=a||o?{observableKind:"set",debugObjectName:this.name_,type:sa,object:this,oldValue:r}:null;return o&&vt(s),yr(function(){n.atom_.reportChanged(),n.data_.delete(r)}),a&&Qt(this,s),o&&wt(),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=this.values();return wc({next:function(){var n=r.next(),i=n.value,o=n.done;return o?{value:void 0,done:o}:{value:[i,i],done:o}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,n=this.data_.values();return wc({next:function(){var i=n.next(),o=i.value,a=i.done;return a?{value:void 0,done:a}:{value:r.dehanceValue_(o),done:a}}})},t.intersection=function(r){if(hr(r)&&!Gt(r))return r.intersection(this);var n=new Set(this);return n.intersection(r)},t.union=function(r){if(hr(r)&&!Gt(r))return r.union(this);var n=new Set(this);return n.union(r)},t.difference=function(r){return new Set(this).difference(r)},t.symmetricDifference=function(r){if(hr(r)&&!Gt(r))return r.symmetricDifference(this);var n=new Set(this);return n.symmetricDifference(r)},t.isSubsetOf=function(r){return new Set(this).isSubsetOf(r)},t.isSupersetOf=function(r){return new Set(this).isSupersetOf(r)},t.isDisjointFrom=function(r){if(hr(r)&&!Gt(r))return r.isDisjointFrom(this);var n=new Set(this);return n.isDisjointFrom(r)},t.replace=function(r){var n=this;return Gt(r)&&(r=new Set(r)),yr(function(){Array.isArray(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):hr(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):r!=null&&de("Cannot initialize set from "+r)}),this},t.observe_=function(r,n){return n===!0&&de("`observe` doesn't support fireImmediately=true in combination with sets."),lo(this,r)},t.intercept_=function(r){return uo(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},ri(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),Gt=Hr("ObservableSet",pp);function wc(e){return e[Symbol.toStringTag]="SetIterator",ol(e)}var _c=Object.create(null),Tc="remove",nu=function(){function e(r,n,i,o){n===void 0&&(n=new Map),o===void 0&&(o=R0),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 Wr(this.name_+".keys"),this.isPlainObject_=Yt(this.target_),mp(this.defaultAnnotation_)||de("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 Mt)return i.set(n),!0;if($t(this)){var o=kt(this,{type:Wt,object:this.proxy_||this.target_,name:r,newValue:n});if(!o)return null;n=o.newValue}if(n=i.prepareNewValue_(n),n!==X.UNCHANGED){var a=Jt(this),s=ot(),u=a||s?{type:Wt,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:i.value_,name:r,newValue:n}:null;s&&vt(u),i.setNewValue_(n),a&&Qt(this,u),s&&wt()}return!0},t.get_=function(r){return X.trackingDerivation&&!Ut(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,n,i){return i===void 0&&(i=!1),Ut(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(!X.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_,Fa,this.name_+"."+Ws(r)+"?",!1),this.pendingKeys_.set(r,n)),n.get()},t.make_=function(r,n){if(n===!0&&(n=this.defaultAnnotation_),n!==!1){if(xc(this,n,r),!(r in this.target_)){var i;if((i=this.target_[gt])!=null&&i[r])return;de(1,n.annotationType_,this.name_+"."+r.toString())}for(var o=this.target_;o&&o!==no;){var a=Zo(o,r);if(a){var s=n.make_(this,r,a,o);if(s===0)return;if(s===1)break}o=Object.getPrototypeOf(o)}Oc(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);xc(this,i,r);var a=i.extend_(this,r,n,o);return a&&Oc(this,i,r),a},t.defineProperty_=function(r,n,i){i===void 0&&(i=!1),rr(this.keysAtom_);try{jt();var o=this.delete_(r);if(!o)return o;if($t(this)){var a=kt(this,{object:this.proxy_||this.target_,name:r,type:Lr,newValue:n.value});if(!a)return null;var s=a.newValue;n.value!==s&&(n=br({},n,{value:s}))}if(i){if(!Reflect.defineProperty(this.target_,r,n))return!1}else nr(this.target_,r,n);this.notifyPropertyAddition_(r,n.value)}finally{Nt()}return!0},t.defineObservableProperty_=function(r,n,i,o){o===void 0&&(o=!1),rr(this.keysAtom_);try{jt();var a=this.delete_(r);if(!a)return a;if($t(this)){var s=kt(this,{object:this.proxy_||this.target_,name:r,type:Lr,newValue:n});if(!s)return null;n=s.newValue}var u=Ec(r),l={configurable:X.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(o){if(!Reflect.defineProperty(this.target_,r,l))return!1}else nr(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{Nt()}return!0},t.defineComputedProperty_=function(r,n,i){i===void 0&&(i=!1),rr(this.keysAtom_);try{jt();var o=this.delete_(r);if(!o)return o;if($t(this)){var a=kt(this,{object:this.proxy_||this.target_,name:r,type:Lr,newValue:void 0});if(!a)return null}n.name||(n.name=this.name_+"."+r.toString()),n.context=this.proxy_||this.target_;var s=Ec(r),u={configurable:X.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:s.get,set:s.set};if(i){if(!Reflect.defineProperty(this.target_,r,u))return!1}else nr(this.target_,r,u);this.values_.set(r,new Mt(n)),this.notifyPropertyAddition_(r,void 0)}finally{Nt()}return!0},t.delete_=function(r,n){if(n===void 0&&(n=!1),rr(this.keysAtom_),!Ut(this.target_,r))return!0;if($t(this)){var i=kt(this,{object:this.proxy_||this.target_,name:r,type:Tc});if(!i)return null}try{var o;jt();var a=Jt(this),s=ot(),u=this.values_.get(r),l=void 0;if(!u&&(a||s)){var f;l=(f=Zo(this.target_,r))==null?void 0:f.value}if(n){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(delete this.appliedAnnotations_[r],u&&(this.values_.delete(r),u instanceof Br&&(l=u.value_),Xd(u)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(o=o.get(r))==null||o.set(r in this.target_),a||s){var d={type:Tc,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:l,name:r};s&&vt(d),a&&Qt(this,d),s&&wt()}}finally{Nt()}return!0},t.observe_=function(r,n){return n===!0&&de("`observe` doesn't support the fire immediately property for observable objects."),lo(this,r)},t.intercept_=function(r){return uo(this,r)},t.notifyPropertyAddition_=function(r,n){var i,o=Jt(this),a=ot();if(o||a){var s=o||a?{type:Lr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:n}:null;a&&vt(s),o&&Qt(this,s),a&&wt()}(i=this.pendingKeys_)==null||(i=i.get(r))==null||i.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Ba(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function si(e,t){var r;if(t&&ln(e)&&de("Options can't be provided for already observable objects."),Ut(e,we))return nl(e)instanceof nu||de("Cannot convert '"+ua(e)+`' into observable object:
|
|
26
|
+
The target is already observable of different type.
|
|
27
|
+
Extending builtins is not supported.`),e;Object.isExtensible(e)||de("Cannot make the designated object observable; it is not extensible");var n=(r=t?.name)!=null?r:(Yt(e)?"ObservableObject":e.constructor.name)+"@"+Bt(),i=new nu(e,new Map,String(n),W0(t));return Da(e,we,i),e}var Jw=Hr("ObservableObjectAdministration",nu);function Ec(e){return _c[e]||(_c[e]={get:function(){return this[we].getObservablePropValue_(e)},set:function(t){return this[we].setObservablePropValue_(e,t)}})}function ln(e){return La(e)?Jw(e[we]):!1}function Oc(e,t,r){var n;e.appliedAnnotations_[r]=t,(n=e.target_[gt])==null||delete n[r]}function xc(e,t,r){if(mp(t)||de("Cannot annotate '"+e.name_+"."+r.toString()+"': Invalid annotation."),!ta(t)&&Ut(e.appliedAnnotations_,r)){var n=e.name_+"."+r.toString(),i=e.appliedAnnotations_[r].annotationType_,o=t.annotationType_;de("Cannot apply '"+o+"' to '"+n+"':"+(`
|
|
28
|
+
The field is already annotated with '`+i+"'.")+`
|
|
29
|
+
Re-annotating fields is not allowed.
|
|
30
|
+
Use 'override' annotation for methods overridden by subclass.`)}}var Qw=yp(0),Yw=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),xs=0,hp=function(){};function Xw(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}Xw(hp,Array.prototype);var rl=function(e){function t(n,i,o,a){var s;return o===void 0&&(o="ObservableArray@"+Bt()),a===void 0&&(a=!1),s=e.call(this)||this,Tn(function(){var u=new tl(o,i,a,!0);u.proxy_=s,Nd(s,we,u),n&&n.length&&s.spliceWithArray(0,0,n),Yw&&Object.defineProperty(s,"0",Qw)}),s}Pd(t,e);var r=t.prototype;return r.concat=function(){this[we].atom_.reportObserved();for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return Array.prototype.concat.apply(this.slice(),i.map(function(a){return ai(a)?a.slice():a}))},r[Symbol.iterator]=function(){var n=this,i=0;return ol({next:function(){return i<n.length?{value:n[i++],done:!1}:{done:!0,value:void 0}}})},ri(t,[{key:"length",get:function(){return this[we].getArrayLength_()},set:function(n){this[we].setArrayLength_(n)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(hp);Object.entries(aa).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&Da(rl.prototype,t,r)});function yp(e){return{enumerable:!1,configurable:!0,get:function(){return this[we].get_(e)},set:function(t){this[we].set_(e,t)}}}function Zw(e){nr(rl.prototype,""+e,yp(e))}function gp(e){if(e>xs){for(var t=xs;t<e+100;t++)Zw(t);xs=e}}gp(1e3);function e1(e,t,r){return new rl(e,t,r)}function Xt(e,t){if(typeof e=="object"&&e!==null){if(ai(e))return t!==void 0&&de(23),e[we].atom_;if(Gt(e))return e.atom_;if(lr(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||de(25,t,ua(e)),r}if(ln(e)){if(!t)return de(26);var n=e[we].values_.get(t);return n||de(27,t,ua(e)),n}if(Yu(e)||so(e)||ia(e))return e}else if(Fe(e)&&ia(e[we]))return e[we];de(28)}function nl(e,t){if(e||de(29),t!==void 0)return nl(Xt(e,t));if(Yu(e)||so(e)||ia(e)||lr(e)||Gt(e))return e;if(e[we])return e[we];de(24,e)}function ua(e,t){var r;if(t!==void 0)r=Xt(e,t);else{if(un(e))return e.name;ln(e)||lr(e)||Gt(e)?r=nl(e):r=Xt(e)}return r.name_}function Tn(e){var t=_n(),r=Ka(!0);jt();try{return e()}finally{Nt(),qa(r),gr(t)}}var Ac=no.toString;function il(e,t,r){return r===void 0&&(r=-1),iu(e,t,r)}function iu(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=Ac.call(e);if(a!==Ac.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=Sc(e),t=Sc(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&&!(Fe(u)&&u instanceof u&&Fe(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(!iu(e[f],t[f],r-1,n,i))return!1}else{var d=Object.keys(e),$=d.length;if(Object.keys(t).length!==$)return!1;for(var E=0;E<$;E++){var T=d[E];if(!(Ut(t,T)&&iu(e[T],t[T],r-1,n,i)))return!1}}return n.pop(),i.pop(),!0}function Sc(e){return ai(e)?e.slice():ti(e)||lr(e)||hr(e)||Gt(e)?Array.from(e.entries()):e}var Ic,t1=((Ic=Ra().Iterator)==null?void 0:Ic.prototype)||{};function ol(e){return e[Symbol.iterator]=r1,Object.assign(Object.create(t1),e)}function r1(){return this}function mp(e){return e instanceof Object&&typeof e.annotationType_=="string"&&Fe(e.make_)&&Fe(e.extend_)}["Symbol","Map","Set"].forEach(function(e){var t=Ra();typeof t[e]>"u"&&de("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:ww,extras:{getDebugName:ua},$mobx:we});var n1=Ze({"../../../node_modules/.pnpm/browser-or-node@2.1.1/node_modules/browser-or-node/lib/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(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}}),i1=Ze({"../../../node_modules/.pnpm/fast-json-stable-stringify@2.1.0/node_modules/fast-json-stable-stringify/index.js"(e,t){"use strict";t.exports=function(r,n){n||(n={}),typeof n=="function"&&(n={cmp:n});var i=typeof n.cycles=="boolean"?n.cycles:!1,o=n.cmp&&function(s){return function(u){return function(l,f){var d={key:l,value:u[l]},$={key:f,value:u[f]};return s(d,$)}}}(n.cmp),a=[];return function s(u){if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u!==void 0){if(typeof u=="number")return isFinite(u)?""+u:"null";if(typeof u!="object")return JSON.stringify(u);var l,f;if(Array.isArray(u)){for(f="[",l=0;l<u.length;l++)l&&(f+=","),f+=s(u[l])||"null";return f+"]"}if(u===null)return"null";if(a.indexOf(u)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var d=a.push(u)-1,$=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<$.length;l++){var E=$[l],T=s(u[E]);T&&(f&&(f+=","),f+=JSON.stringify(E)+":"+T)}return a.splice(d,1),"{"+f+"}"}}(r)}}}),o1=Ze({"../../../node_modules/.pnpm/safe-stable-stringify@2.5.0/node_modules/safe-stable-stringify/index.js"(e,t){"use strict";var{hasOwnProperty:r}=Object.prototype,n=R();n.configure=R,n.stringify=n,n.default=n,e.stringify=n,e.configure=R,t.exports=n;var i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function o(k){return k.length<5e3&&!i.test(k)?`"${k}"`:JSON.stringify(k)}function a(k,F){if(k.length>200||F)return k.sort(F);for(let q=1;q<k.length;q++){let L=k[q],Q=q;for(;Q!==0&&k[Q-1]>L;)k[Q]=k[Q-1],Q--;k[Q]=L}return k}var s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function u(k){return s.call(k)!==void 0&&k.length!==0}function l(k,F,q){k.length<q&&(q=k.length);let L=F===","?"":" ",Q=`"0":${L}${k[0]}`;for(let K=1;K<q;K++)Q+=`${F}"${K}":${L}${k[K]}`;return Q}function f(k){if(r.call(k,"circularValue")){let F=k.circularValue;if(typeof F=="string")return`"${F}"`;if(F==null)return F;if(F===Error||F===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function d(k){let F;if(r.call(k,"deterministic")&&(F=k.deterministic,typeof F!="boolean"&&typeof F!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return F===void 0?!0:F}function $(k,F){let q;if(r.call(k,F)&&(q=k[F],typeof q!="boolean"))throw new TypeError(`The "${F}" argument must be of type boolean`);return q===void 0?!0:q}function E(k,F){let q;if(r.call(k,F)){if(q=k[F],typeof q!="number")throw new TypeError(`The "${F}" argument must be of type number`);if(!Number.isInteger(q))throw new TypeError(`The "${F}" argument must be an integer`);if(q<1)throw new RangeError(`The "${F}" argument must be >= 1`)}return q===void 0?1/0:q}function T(k){return k===1?"1 item":`${k} items`}function B(k){let F=new Set;for(let q of k)(typeof q=="string"||typeof q=="number")&&F.add(String(q));return F}function W(k){if(r.call(k,"strict")){let F=k.strict;if(typeof F!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(F)return q=>{let L=`Object can not safely be stringified. Received type ${typeof q}`;throw typeof q!="function"&&(L+=` (${q.toString()})`),new Error(L)}}}function R(k){k={...k};let F=W(k);F&&(k.bigint===void 0&&(k.bigint=!1),"circularValue"in k||(k.circularValue=Error));let q=f(k),L=$(k,"bigint"),Q=d(k),K=typeof Q=="function"?Q:void 0,te=E(k,"maximumDepth"),j=E(k,"maximumBreadth");function D(ce,V,J,Z,ye,p){let w=V[ce];switch(typeof w=="object"&&w!==null&&typeof w.toJSON=="function"&&(w=w.toJSON(ce)),w=Z.call(V,ce,w),typeof w){case"string":return o(w);case"object":{if(w===null)return"null";if(J.indexOf(w)!==-1)return q;let A="",M=",",N=p;if(Array.isArray(w)){if(w.length===0)return"[]";if(te<J.length+1)return'"[Array]"';J.push(w),ye!==""&&(p+=ye,A+=`
|
|
31
|
+
${p}`,M=`,
|
|
32
|
+
${p}`);let O=Math.min(w.length,j),v=0;for(;v<O-1;v++){let P=D(String(v),w,J,Z,ye,p);A+=P!==void 0?P:"null",A+=M}let b=D(String(v),w,J,Z,ye,p);if(A+=b!==void 0?b:"null",w.length-1>j){let P=w.length-j-1;A+=`${M}"... ${T(P)} not stringified"`}return ye!==""&&(A+=`
|
|
33
|
+
${N}`),J.pop(),`[${A}]`}let U=Object.keys(w),g=U.length;if(g===0)return"{}";if(te<J.length+1)return'"[Object]"';let x="",_="";ye!==""&&(p+=ye,M=`,
|
|
34
|
+
${p}`,x=" ");let c=Math.min(g,j);Q&&!u(w)&&(U=a(U,K)),J.push(w);for(let O=0;O<c;O++){let v=U[O],b=D(v,w,J,Z,ye,p);b!==void 0&&(A+=`${_}${o(v)}:${x}${b}`,_=M)}if(g>j){let O=g-j;A+=`${_}"...":${x}"${T(O)} not stringified"`,_=M}return ye!==""&&_.length>1&&(A=`
|
|
35
|
+
${p}${A}
|
|
36
|
+
${N}`),J.pop(),`{${A}}`}case"number":return isFinite(w)?String(w):F?F(w):"null";case"boolean":return w===!0?"true":"false";case"undefined":return;case"bigint":if(L)return String(w);default:return F?F(w):void 0}}function z(ce,V,J,Z,ye,p){switch(typeof V=="object"&&V!==null&&typeof V.toJSON=="function"&&(V=V.toJSON(ce)),typeof V){case"string":return o(V);case"object":{if(V===null)return"null";if(J.indexOf(V)!==-1)return q;let w=p,A="",M=",";if(Array.isArray(V)){if(V.length===0)return"[]";if(te<J.length+1)return'"[Array]"';J.push(V),ye!==""&&(p+=ye,A+=`
|
|
37
|
+
${p}`,M=`,
|
|
38
|
+
${p}`);let g=Math.min(V.length,j),x=0;for(;x<g-1;x++){let c=z(String(x),V[x],J,Z,ye,p);A+=c!==void 0?c:"null",A+=M}let _=z(String(x),V[x],J,Z,ye,p);if(A+=_!==void 0?_:"null",V.length-1>j){let c=V.length-j-1;A+=`${M}"... ${T(c)} not stringified"`}return ye!==""&&(A+=`
|
|
39
|
+
${w}`),J.pop(),`[${A}]`}J.push(V);let N="";ye!==""&&(p+=ye,M=`,
|
|
40
|
+
${p}`,N=" ");let U="";for(let g of Z){let x=z(g,V[g],J,Z,ye,p);x!==void 0&&(A+=`${U}${o(g)}:${N}${x}`,U=M)}return ye!==""&&U.length>1&&(A=`
|
|
41
|
+
${p}${A}
|
|
42
|
+
${w}`),J.pop(),`{${A}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(L)return String(V);default:return F?F(V):void 0}}function re(ce,V,J,Z,ye){switch(typeof V){case"string":return o(V);case"object":{if(V===null)return"null";if(typeof V.toJSON=="function"){if(V=V.toJSON(ce),typeof V!="object")return re(ce,V,J,Z,ye);if(V===null)return"null"}if(J.indexOf(V)!==-1)return q;let p=ye;if(Array.isArray(V)){if(V.length===0)return"[]";if(te<J.length+1)return'"[Array]"';J.push(V),ye+=Z;let x=`
|
|
43
|
+
${ye}`,_=`,
|
|
44
|
+
${ye}`,c=Math.min(V.length,j),O=0;for(;O<c-1;O++){let b=re(String(O),V[O],J,Z,ye);x+=b!==void 0?b:"null",x+=_}let v=re(String(O),V[O],J,Z,ye);if(x+=v!==void 0?v:"null",V.length-1>j){let b=V.length-j-1;x+=`${_}"... ${T(b)} not stringified"`}return x+=`
|
|
45
|
+
${p}`,J.pop(),`[${x}]`}let w=Object.keys(V),A=w.length;if(A===0)return"{}";if(te<J.length+1)return'"[Object]"';ye+=Z;let M=`,
|
|
46
|
+
${ye}`,N="",U="",g=Math.min(A,j);u(V)&&(N+=l(V,M,j),w=w.slice(V.length),g-=V.length,U=M),Q&&(w=a(w,K)),J.push(V);for(let x=0;x<g;x++){let _=w[x],c=re(_,V[_],J,Z,ye);c!==void 0&&(N+=`${U}${o(_)}: ${c}`,U=M)}if(A>j){let x=A-j;N+=`${U}"...": "${T(x)} not stringified"`,U=M}return U!==""&&(N=`
|
|
47
|
+
${ye}${N}
|
|
48
|
+
${p}`),J.pop(),`{${N}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(L)return String(V);default:return F?F(V):void 0}}function se(ce,V,J){switch(typeof V){case"string":return o(V);case"object":{if(V===null)return"null";if(typeof V.toJSON=="function"){if(V=V.toJSON(ce),typeof V!="object")return se(ce,V,J);if(V===null)return"null"}if(J.indexOf(V)!==-1)return q;let Z="",ye=V.length!==void 0;if(ye&&Array.isArray(V)){if(V.length===0)return"[]";if(te<J.length+1)return'"[Array]"';J.push(V);let N=Math.min(V.length,j),U=0;for(;U<N-1;U++){let x=se(String(U),V[U],J);Z+=x!==void 0?x:"null",Z+=","}let g=se(String(U),V[U],J);if(Z+=g!==void 0?g:"null",V.length-1>j){let x=V.length-j-1;Z+=`,"... ${T(x)} not stringified"`}return J.pop(),`[${Z}]`}let p=Object.keys(V),w=p.length;if(w===0)return"{}";if(te<J.length+1)return'"[Object]"';let A="",M=Math.min(w,j);ye&&u(V)&&(Z+=l(V,",",j),p=p.slice(V.length),M-=V.length,A=","),Q&&(p=a(p,K)),J.push(V);for(let N=0;N<M;N++){let U=p[N],g=se(U,V[U],J);g!==void 0&&(Z+=`${A}${o(U)}:${g}`,A=",")}if(w>j){let N=w-j;Z+=`${A}"...":"${T(N)} not stringified"`}return J.pop(),`{${Z}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(L)return String(V);default:return F?F(V):void 0}}function ee(ce,V,J){if(arguments.length>1){let Z="";if(typeof J=="number"?Z=" ".repeat(Math.min(J,10)):typeof J=="string"&&(Z=J.slice(0,10)),V!=null){if(typeof V=="function")return D("",{"":ce},[],V,Z,"");if(Array.isArray(V))return z("",ce,[],B(V),Z,"")}if(Z.length!==0)return re("",ce,[],Z,"")}return se("",ce,[])}return ee}}}),ui=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/guard.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IsValueType=e.IsSymbol=e.IsFunction=e.IsString=e.IsBigInt=e.IsInteger=e.IsNumber=e.IsBoolean=e.IsNull=e.IsUndefined=e.IsArray=e.IsObject=e.IsPlainObject=e.HasPropertyKey=e.IsDate=e.IsUint8Array=e.IsPromise=e.IsTypedArray=e.IsIterator=e.IsAsyncIterator=void 0;function t(L){return l(L)&&Symbol.asyncIterator in L}e.IsAsyncIterator=t;function r(L){return l(L)&&Symbol.iterator in L}e.IsIterator=r;function n(L){return ArrayBuffer.isView(L)}e.IsTypedArray=n;function i(L){return L instanceof Promise}e.IsPromise=i;function o(L){return L instanceof Uint8Array}e.IsUint8Array=o;function a(L){return L instanceof Date&&Number.isFinite(L.getTime())}e.IsDate=a;function s(L,Q){return Q in L}e.HasPropertyKey=s;function u(L){return l(L)&&k(L.constructor)&&L.constructor.name==="Object"}e.IsPlainObject=u;function l(L){return L!==null&&typeof L=="object"}e.IsObject=l;function f(L){return Array.isArray(L)&&!ArrayBuffer.isView(L)}e.IsArray=f;function d(L){return L===void 0}e.IsUndefined=d;function $(L){return L===null}e.IsNull=$;function E(L){return typeof L=="boolean"}e.IsBoolean=E;function T(L){return typeof L=="number"}e.IsNumber=T;function B(L){return T(L)&&Number.isInteger(L)}e.IsInteger=B;function W(L){return typeof L=="bigint"}e.IsBigInt=W;function R(L){return typeof L=="string"}e.IsString=R;function k(L){return typeof L=="function"}e.IsFunction=k;function F(L){return typeof L=="symbol"}e.IsSymbol=F;function q(L){return W(L)||E(L)||$(L)||T(L)||R(L)||F(L)||d(L)}e.IsValueType=q}}),bp=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/system/system.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultErrorFunction=e.TypeSystemPolicy=e.TypeSystemErrorFunction=e.TypeSystem=e.TypeSystemDuplicateFormat=e.TypeSystemDuplicateTypeKind=void 0;var t=ui(),r=Ja(),n=Gr(),i=class extends n.TypeBoxError{constructor(f){super(`Duplicate type kind '${f}' detected`)}};e.TypeSystemDuplicateTypeKind=i;var o=class extends n.TypeBoxError{constructor(f){super(`Duplicate string format '${f}' detected`)}};e.TypeSystemDuplicateFormat=o;var a;(function(f){function d(E,T){if(n.TypeRegistry.Has(E))throw new i(E);return n.TypeRegistry.Set(E,T),(B={})=>n.Type.Unsafe({...B,[n.Kind]:E})}f.Type=d;function $(E,T){if(n.FormatRegistry.Has(E))throw new o(E);return n.FormatRegistry.Set(E,T),E}f.Format=$})(a||(e.TypeSystem=a={}));var s;(function(f){let d=l;function $(){d=l}f.Reset=$;function E(B){d=B}f.Set=E;function T(){return d}f.Get=T})(s||(e.TypeSystemErrorFunction=s={}));var u;(function(f){f.ExactOptionalPropertyTypes=!1,f.AllowArrayObject=!1,f.AllowNaN=!1,f.AllowNullVoid=!1;function d(W,R){return f.ExactOptionalPropertyTypes?R in W:W[R]!==void 0}f.IsExactOptionalProperty=d;function $(W){let R=(0,t.IsObject)(W);return f.AllowArrayObject?R:R&&!(0,t.IsArray)(W)}f.IsObjectLike=$;function E(W){return $(W)&&!(W instanceof Date)&&!(W instanceof Uint8Array)}f.IsRecordLike=E;function T(W){let R=(0,t.IsNumber)(W);return f.AllowNaN?R:R&&Number.isFinite(W)}f.IsNumberLike=T;function B(W){let R=(0,t.IsUndefined)(W);return f.AllowNullVoid?R||W===null:R}f.IsVoidLike=B})(u||(e.TypeSystemPolicy=u={}));function l(f,d){switch(d){case r.ValueErrorType.ArrayContains:return"Expected array to contain at least one matching value";case r.ValueErrorType.ArrayMaxContains:return`Expected array to contain no more than ${f.maxContains} matching values`;case r.ValueErrorType.ArrayMinContains:return`Expected array to contain at least ${f.minContains} matching values`;case r.ValueErrorType.ArrayMaxItems:return`Expected array length to be less or equal to ${f.maxItems}`;case r.ValueErrorType.ArrayMinItems:return`Expected array length to be greater or equal to ${f.minItems}`;case r.ValueErrorType.ArrayUniqueItems:return"Expected array elements to be unique";case r.ValueErrorType.Array:return"Expected array";case r.ValueErrorType.AsyncIterator:return"Expected AsyncIterator";case r.ValueErrorType.BigIntExclusiveMaximum:return`Expected bigint to be less than ${f.exclusiveMaximum}`;case r.ValueErrorType.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.BigIntMaximum:return`Expected bigint to be less or equal to ${f.maximum}`;case r.ValueErrorType.BigIntMinimum:return`Expected bigint to be greater or equal to ${f.minimum}`;case r.ValueErrorType.BigIntMultipleOf:return`Expected bigint to be a multiple of ${f.multipleOf}`;case r.ValueErrorType.BigInt:return"Expected bigint";case r.ValueErrorType.Boolean:return"Expected boolean";case r.ValueErrorType.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${f.exclusiveMinimumTimestamp}`;case r.ValueErrorType.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${f.exclusiveMaximumTimestamp}`;case r.ValueErrorType.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${f.minimumTimestamp}`;case r.ValueErrorType.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${f.maximumTimestamp}`;case r.ValueErrorType.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${f.multipleOfTimestamp}`;case r.ValueErrorType.Date:return"Expected Date";case r.ValueErrorType.Function:return"Expected function";case r.ValueErrorType.IntegerExclusiveMaximum:return`Expected integer to be less than ${f.exclusiveMaximum}`;case r.ValueErrorType.IntegerExclusiveMinimum:return`Expected integer to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.IntegerMaximum:return`Expected integer to be less or equal to ${f.maximum}`;case r.ValueErrorType.IntegerMinimum:return`Expected integer to be greater or equal to ${f.minimum}`;case r.ValueErrorType.IntegerMultipleOf:return`Expected integer to be a multiple of ${f.multipleOf}`;case r.ValueErrorType.Integer:return"Expected integer";case r.ValueErrorType.IntersectUnevaluatedProperties:return"Unexpected property";case r.ValueErrorType.Intersect:return"Expected all values to match";case r.ValueErrorType.Iterator:return"Expected Iterator";case r.ValueErrorType.Literal:return`Expected ${typeof f.const=="string"?`'${f.const}'`:f.const}`;case r.ValueErrorType.Never:return"Never";case r.ValueErrorType.Not:return"Value should not match";case r.ValueErrorType.Null:return"Expected null";case r.ValueErrorType.NumberExclusiveMaximum:return`Expected number to be less than ${f.exclusiveMaximum}`;case r.ValueErrorType.NumberExclusiveMinimum:return`Expected number to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.NumberMaximum:return`Expected number to be less or equal to ${f.maximum}`;case r.ValueErrorType.NumberMinimum:return`Expected number to be greater or equal to ${f.minimum}`;case r.ValueErrorType.NumberMultipleOf:return`Expected number to be a multiple of ${f.multipleOf}`;case r.ValueErrorType.Number:return"Expected number";case r.ValueErrorType.Object:return"Expected object";case r.ValueErrorType.ObjectAdditionalProperties:return"Unexpected property";case r.ValueErrorType.ObjectMaxProperties:return`Expected object to have no more than ${f.maxProperties} properties`;case r.ValueErrorType.ObjectMinProperties:return`Expected object to have at least ${f.minProperties} properties`;case r.ValueErrorType.ObjectRequiredProperty:return"Required property";case r.ValueErrorType.Promise:return"Expected Promise";case r.ValueErrorType.StringFormatUnknown:return`Unknown format '${f.format}'`;case r.ValueErrorType.StringFormat:return`Expected string to match '${f.format}' format`;case r.ValueErrorType.StringMaxLength:return`Expected string length less or equal to ${f.maxLength}`;case r.ValueErrorType.StringMinLength:return`Expected string length greater or equal to ${f.minLength}`;case r.ValueErrorType.StringPattern:return`Expected string to match '${f.pattern}'`;case r.ValueErrorType.String:return"Expected string";case r.ValueErrorType.Symbol:return"Expected symbol";case r.ValueErrorType.TupleLength:return`Expected tuple to have ${f.maxItems||0} elements`;case r.ValueErrorType.Tuple:return"Expected tuple";case r.ValueErrorType.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${f.maxByteLength}`;case r.ValueErrorType.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${f.minByteLength}`;case r.ValueErrorType.Uint8Array:return"Expected Uint8Array";case r.ValueErrorType.Undefined:return"Expected undefined";case r.ValueErrorType.Union:return"Expected union value";case r.ValueErrorType.Void:return"Expected void";case r.ValueErrorType.Kind:return`Expected kind '${f[n.Kind]}'`;default:return"Unknown error type"}}e.DefaultErrorFunction=l}}),Wa=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/deref.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Deref=e.TypeDereferenceError=void 0;var t=Gr(),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}}),al=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/hash.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.ByteMarker=e.ValueHashError=void 0;var t=ui(),r=class extends Error{constructor(D){super("Unable to hash value"),this.value=D}};e.ValueHashError=r;var n;(function(D){D[D.Undefined=0]="Undefined",D[D.Null=1]="Null",D[D.Boolean=2]="Boolean",D[D.Number=3]="Number",D[D.String=4]="String",D[D.Object=5]="Object",D[D.Array=6]="Array",D[D.Date=7]="Date",D[D.Uint8Array=8]="Uint8Array",D[D.Symbol=9]="Symbol",D[D.BigInt=10]="BigInt"})(n||(e.ByteMarker=n={}));var i=BigInt("14695981039346656037"),[o,a]=[BigInt("1099511628211"),BigInt("2")**BigInt("64")],s=Array.from({length:256}).map((D,z)=>BigInt(z)),u=new Float64Array(1),l=new DataView(u.buffer),f=new Uint8Array(u.buffer);function*d(D){let z=D===0?1:Math.ceil(Math.floor(Math.log2(D)+1)/8);for(let re=0;re<z;re++)yield D>>8*(z-1-re)&255}function $(D){te(n.Array);for(let z of D)K(z)}function E(D){te(n.Boolean),te(D?1:0)}function T(D){te(n.BigInt),l.setBigInt64(0,D);for(let z of f)te(z)}function B(D){te(n.Date),K(D.getTime())}function W(D){te(n.Null)}function R(D){te(n.Number),l.setFloat64(0,D);for(let z of f)te(z)}function k(D){te(n.Object);for(let z of globalThis.Object.keys(D).sort())K(z),K(D[z])}function F(D){te(n.String);for(let z=0;z<D.length;z++)for(let re of d(D.charCodeAt(z)))te(re)}function q(D){te(n.Symbol),K(D.description)}function L(D){te(n.Uint8Array);for(let z=0;z<D.length;z++)te(D[z])}function Q(D){return te(n.Undefined)}function K(D){if((0,t.IsArray)(D))return $(D);if((0,t.IsBoolean)(D))return E(D);if((0,t.IsBigInt)(D))return T(D);if((0,t.IsDate)(D))return B(D);if((0,t.IsNull)(D))return W(D);if((0,t.IsNumber)(D))return R(D);if((0,t.IsPlainObject)(D))return k(D);if((0,t.IsString)(D))return F(D);if((0,t.IsSymbol)(D))return q(D);if((0,t.IsUint8Array)(D))return L(D);if((0,t.IsUndefined)(D))return Q(D);throw new r(D)}function te(D){i=i^s[D],i=i*o%a}function j(D){return i=BigInt("14695981039346656037"),K(D),i}e.Hash=j}}),Ja=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/errors/errors.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Errors=e.ValueErrorIterator=e.EscapeKey=e.ValueErrorsUnknownTypeError=e.ValueErrorType=void 0;var t=ui(),r=bp(),n=Wa(),i=al(),o=Gr(),a;(function(c){c[c.ArrayContains=0]="ArrayContains",c[c.ArrayMaxContains=1]="ArrayMaxContains",c[c.ArrayMaxItems=2]="ArrayMaxItems",c[c.ArrayMinContains=3]="ArrayMinContains",c[c.ArrayMinItems=4]="ArrayMinItems",c[c.ArrayUniqueItems=5]="ArrayUniqueItems",c[c.Array=6]="Array",c[c.AsyncIterator=7]="AsyncIterator",c[c.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",c[c.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",c[c.BigIntMaximum=10]="BigIntMaximum",c[c.BigIntMinimum=11]="BigIntMinimum",c[c.BigIntMultipleOf=12]="BigIntMultipleOf",c[c.BigInt=13]="BigInt",c[c.Boolean=14]="Boolean",c[c.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",c[c.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",c[c.DateMaximumTimestamp=17]="DateMaximumTimestamp",c[c.DateMinimumTimestamp=18]="DateMinimumTimestamp",c[c.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",c[c.Date=20]="Date",c[c.Function=21]="Function",c[c.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",c[c.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",c[c.IntegerMaximum=24]="IntegerMaximum",c[c.IntegerMinimum=25]="IntegerMinimum",c[c.IntegerMultipleOf=26]="IntegerMultipleOf",c[c.Integer=27]="Integer",c[c.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",c[c.Intersect=29]="Intersect",c[c.Iterator=30]="Iterator",c[c.Kind=31]="Kind",c[c.Literal=32]="Literal",c[c.Never=33]="Never",c[c.Not=34]="Not",c[c.Null=35]="Null",c[c.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",c[c.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",c[c.NumberMaximum=38]="NumberMaximum",c[c.NumberMinimum=39]="NumberMinimum",c[c.NumberMultipleOf=40]="NumberMultipleOf",c[c.Number=41]="Number",c[c.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",c[c.ObjectMaxProperties=43]="ObjectMaxProperties",c[c.ObjectMinProperties=44]="ObjectMinProperties",c[c.ObjectRequiredProperty=45]="ObjectRequiredProperty",c[c.Object=46]="Object",c[c.Promise=47]="Promise",c[c.StringFormatUnknown=48]="StringFormatUnknown",c[c.StringFormat=49]="StringFormat",c[c.StringMaxLength=50]="StringMaxLength",c[c.StringMinLength=51]="StringMinLength",c[c.StringPattern=52]="StringPattern",c[c.String=53]="String",c[c.Symbol=54]="Symbol",c[c.TupleLength=55]="TupleLength",c[c.Tuple=56]="Tuple",c[c.Uint8ArrayMaxByteLength=57]="Uint8ArrayMaxByteLength",c[c.Uint8ArrayMinByteLength=58]="Uint8ArrayMinByteLength",c[c.Uint8Array=59]="Uint8Array",c[c.Undefined=60]="Undefined",c[c.Union=61]="Union",c[c.Void=62]="Void"})(a||(e.ValueErrorType=a={}));var s=class extends o.TypeBoxError{constructor(c){super("Unknown type"),this.schema=c}};e.ValueErrorsUnknownTypeError=s;function u(c){return c.replace(/~/g,"~0").replace(/\//g,"~1")}e.EscapeKey=u;function l(c){return c!==void 0}var f=class{constructor(c){this.iterator=c}[Symbol.iterator](){return this.iterator}First(){let c=this.iterator.next();return c.done?void 0:c.value}};e.ValueErrorIterator=f;function d(c,O,v,b){return{type:c,schema:O,path:v,value:b,message:r.TypeSystemErrorFunction.Get()(O,c)}}function*$(c,O,v,b){}function*E(c,O,v,b){if(!(0,t.IsArray)(b))return yield d(a.Array,c,v,b);l(c.minItems)&&!(b.length>=c.minItems)&&(yield d(a.ArrayMinItems,c,v,b)),l(c.maxItems)&&!(b.length<=c.maxItems)&&(yield d(a.ArrayMaxItems,c,v,b));for(let ie=0;ie<b.length;ie++)yield*x(c.items,O,`${v}/${ie}`,b[ie]);if(c.uniqueItems===!0&&!function(){let ie=new Set;for(let oe of b){let ve=(0,i.Hash)(oe);if(ie.has(ve))return!1;ie.add(ve)}return!0}()&&(yield d(a.ArrayUniqueItems,c,v,b)),!(l(c.contains)||l(c.minContains)||l(c.maxContains)))return;let P=l(c.contains)?c.contains:o.Type.Never(),H=b.reduce((ie,oe,ve)=>x(P,O,`${v}${ve}`,oe).next().done===!0?ie+1:ie,0);H===0&&(yield d(a.ArrayContains,c,v,b)),(0,t.IsNumber)(c.minContains)&&H<c.minContains&&(yield d(a.ArrayMinContains,c,v,b)),(0,t.IsNumber)(c.maxContains)&&H>c.maxContains&&(yield d(a.ArrayMaxContains,c,v,b))}function*T(c,O,v,b){(0,t.IsAsyncIterator)(b)||(yield d(a.AsyncIterator,c,v,b))}function*B(c,O,v,b){if(!(0,t.IsBigInt)(b))return yield d(a.BigInt,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.BigIntExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.BigIntExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.BigIntMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.BigIntMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==BigInt(0)&&(yield d(a.BigIntMultipleOf,c,v,b))}function*W(c,O,v,b){(0,t.IsBoolean)(b)||(yield d(a.Boolean,c,v,b))}function*R(c,O,v,b){yield*x(c.returns,O,v,b.prototype)}function*k(c,O,v,b){if(!(0,t.IsDate)(b))return yield d(a.Date,c,v,b);l(c.exclusiveMaximumTimestamp)&&!(b.getTime()<c.exclusiveMaximumTimestamp)&&(yield d(a.DateExclusiveMaximumTimestamp,c,v,b)),l(c.exclusiveMinimumTimestamp)&&!(b.getTime()>c.exclusiveMinimumTimestamp)&&(yield d(a.DateExclusiveMinimumTimestamp,c,v,b)),l(c.maximumTimestamp)&&!(b.getTime()<=c.maximumTimestamp)&&(yield d(a.DateMaximumTimestamp,c,v,b)),l(c.minimumTimestamp)&&!(b.getTime()>=c.minimumTimestamp)&&(yield d(a.DateMinimumTimestamp,c,v,b)),l(c.multipleOfTimestamp)&&b.getTime()%c.multipleOfTimestamp!==0&&(yield d(a.DateMultipleOfTimestamp,c,v,b))}function*F(c,O,v,b){(0,t.IsFunction)(b)||(yield d(a.Function,c,v,b))}function*q(c,O,v,b){if(!(0,t.IsInteger)(b))return yield d(a.Integer,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.IntegerExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.IntegerExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.IntegerMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.IntegerMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==0&&(yield d(a.IntegerMultipleOf,c,v,b))}function*L(c,O,v,b){for(let P of c.allOf){let H=x(P,O,v,b).next();H.done||(yield d(a.Intersect,c,v,b),yield H.value)}if(c.unevaluatedProperties===!1){let P=new RegExp(o.KeyResolver.ResolvePattern(c));for(let H of Object.getOwnPropertyNames(b))P.test(H)||(yield d(a.IntersectUnevaluatedProperties,c,`${v}/${H}`,b))}if(typeof c.unevaluatedProperties=="object"){let P=new RegExp(o.KeyResolver.ResolvePattern(c));for(let H of Object.getOwnPropertyNames(b))if(!P.test(H)){let ie=x(c.unevaluatedProperties,O,`${v}/${H}`,b[H]).next();ie.done||(yield ie.value)}}}function*Q(c,O,v,b){(0,t.IsIterator)(b)||(yield d(a.Iterator,c,v,b))}function*K(c,O,v,b){b!==c.const&&(yield d(a.Literal,c,v,b))}function*te(c,O,v,b){yield d(a.Never,c,v,b)}function*j(c,O,v,b){x(c.not,O,v,b).next().done===!0&&(yield d(a.Not,c,v,b))}function*D(c,O,v,b){(0,t.IsNull)(b)||(yield d(a.Null,c,v,b))}function*z(c,O,v,b){if(!r.TypeSystemPolicy.IsNumberLike(b))return yield d(a.Number,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.NumberExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.NumberExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.NumberMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.NumberMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==0&&(yield d(a.NumberMultipleOf,c,v,b))}function*re(c,O,v,b){if(!r.TypeSystemPolicy.IsObjectLike(b))return yield d(a.Object,c,v,b);l(c.minProperties)&&!(Object.getOwnPropertyNames(b).length>=c.minProperties)&&(yield d(a.ObjectMinProperties,c,v,b)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=c.maxProperties)&&(yield d(a.ObjectMaxProperties,c,v,b));let P=Array.isArray(c.required)?c.required:[],H=Object.getOwnPropertyNames(c.properties),ie=Object.getOwnPropertyNames(b);for(let oe of P)ie.includes(oe)||(yield d(a.ObjectRequiredProperty,c.properties[oe],`${v}/${u(oe)}`,void 0));if(c.additionalProperties===!1)for(let oe of ie)H.includes(oe)||(yield d(a.ObjectAdditionalProperties,c,`${v}/${u(oe)}`,b[oe]));if(typeof c.additionalProperties=="object")for(let oe of ie)H.includes(oe)||(yield*x(c.additionalProperties,O,`${v}/${u(oe)}`,b[oe]));for(let oe of H){let ve=c.properties[oe];c.required&&c.required.includes(oe)?(yield*x(ve,O,`${v}/${u(oe)}`,b[oe]),o.ExtendsUndefined.Check(c)&&!(oe in b)&&(yield d(a.ObjectRequiredProperty,ve,`${v}/${u(oe)}`,void 0))):r.TypeSystemPolicy.IsExactOptionalProperty(b,oe)&&(yield*x(ve,O,`${v}/${u(oe)}`,b[oe]))}}function*se(c,O,v,b){(0,t.IsPromise)(b)||(yield d(a.Promise,c,v,b))}function*ee(c,O,v,b){if(!r.TypeSystemPolicy.IsRecordLike(b))return yield d(a.Object,c,v,b);l(c.minProperties)&&!(Object.getOwnPropertyNames(b).length>=c.minProperties)&&(yield d(a.ObjectMinProperties,c,v,b)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=c.maxProperties)&&(yield d(a.ObjectMaxProperties,c,v,b));let[P,H]=Object.entries(c.patternProperties)[0],ie=new RegExp(P);for(let[oe,ve]of Object.entries(b))ie.test(oe)&&(yield*x(H,O,`${v}/${u(oe)}`,ve));if(typeof c.additionalProperties=="object")for(let[oe,ve]of Object.entries(b))ie.test(oe)||(yield*x(c.additionalProperties,O,`${v}/${u(oe)}`,ve));if(c.additionalProperties===!1){for(let[oe,ve]of Object.entries(b))if(!ie.test(oe))return yield d(a.ObjectAdditionalProperties,c,`${v}/${u(oe)}`,ve)}}function*ce(c,O,v,b){yield*x((0,n.Deref)(c,O),O,v,b)}function*V(c,O,v,b){if(!(0,t.IsString)(b))return yield d(a.String,c,v,b);l(c.minLength)&&!(b.length>=c.minLength)&&(yield d(a.StringMinLength,c,v,b)),l(c.maxLength)&&!(b.length<=c.maxLength)&&(yield d(a.StringMaxLength,c,v,b)),(0,t.IsString)(c.pattern)&&(new RegExp(c.pattern).test(b)||(yield d(a.StringPattern,c,v,b))),(0,t.IsString)(c.format)&&(o.FormatRegistry.Has(c.format)?o.FormatRegistry.Get(c.format)(b)||(yield d(a.StringFormat,c,v,b)):yield d(a.StringFormatUnknown,c,v,b))}function*J(c,O,v,b){(0,t.IsSymbol)(b)||(yield d(a.Symbol,c,v,b))}function*Z(c,O,v,b){if(!(0,t.IsString)(b))return yield d(a.String,c,v,b);new RegExp(c.pattern).test(b)||(yield d(a.StringPattern,c,v,b))}function*ye(c,O,v,b){yield*x((0,n.Deref)(c,O),O,v,b)}function*p(c,O,v,b){if(!(0,t.IsArray)(b))return yield d(a.Tuple,c,v,b);if(c.items===void 0&&b.length!==0)return yield d(a.TupleLength,c,v,b);if(b.length!==c.maxItems)return yield d(a.TupleLength,c,v,b);if(c.items)for(let P=0;P<c.items.length;P++)yield*x(c.items[P],O,`${v}/${P}`,b[P])}function*w(c,O,v,b){(0,t.IsUndefined)(b)||(yield d(a.Undefined,c,v,b))}function*A(c,O,v,b){let P=0;for(let H of c.anyOf){let ie=[...x(H,O,v,b)];if(ie.length===0)return;P+=ie.length}P>0&&(yield d(a.Union,c,v,b))}function*M(c,O,v,b){if(!(0,t.IsUint8Array)(b))return yield d(a.Uint8Array,c,v,b);l(c.maxByteLength)&&!(b.length<=c.maxByteLength)&&(yield d(a.Uint8ArrayMaxByteLength,c,v,b)),l(c.minByteLength)&&!(b.length>=c.minByteLength)&&(yield d(a.Uint8ArrayMinByteLength,c,v,b))}function*N(c,O,v,b){}function*U(c,O,v,b){r.TypeSystemPolicy.IsVoidLike(b)||(yield d(a.Void,c,v,b))}function*g(c,O,v,b){o.TypeRegistry.Get(c[o.Kind])(c,b)||(yield d(a.Kind,c,v,b))}function*x(c,O,v,b){let P=l(c.$id)?[...O,c]:O,H=c;switch(H[o.Kind]){case"Any":return yield*$(H,P,v,b);case"Array":return yield*E(H,P,v,b);case"AsyncIterator":return yield*T(H,P,v,b);case"BigInt":return yield*B(H,P,v,b);case"Boolean":return yield*W(H,P,v,b);case"Constructor":return yield*R(H,P,v,b);case"Date":return yield*k(H,P,v,b);case"Function":return yield*F(H,P,v,b);case"Integer":return yield*q(H,P,v,b);case"Intersect":return yield*L(H,P,v,b);case"Iterator":return yield*Q(H,P,v,b);case"Literal":return yield*K(H,P,v,b);case"Never":return yield*te(H,P,v,b);case"Not":return yield*j(H,P,v,b);case"Null":return yield*D(H,P,v,b);case"Number":return yield*z(H,P,v,b);case"Object":return yield*re(H,P,v,b);case"Promise":return yield*se(H,P,v,b);case"Record":return yield*ee(H,P,v,b);case"Ref":return yield*ce(H,P,v,b);case"String":return yield*V(H,P,v,b);case"Symbol":return yield*J(H,P,v,b);case"TemplateLiteral":return yield*Z(H,P,v,b);case"This":return yield*ye(H,P,v,b);case"Tuple":return yield*p(H,P,v,b);case"Undefined":return yield*w(H,P,v,b);case"Union":return yield*A(H,P,v,b);case"Uint8Array":return yield*M(H,P,v,b);case"Unknown":return yield*N(H,P,v,b);case"Void":return yield*U(H,P,v,b);default:if(!o.TypeRegistry.Has(H[o.Kind]))throw new s(c);return yield*g(H,P,v,b)}}function _(...c){let O=c.length===3?x(c[0],c[1],"",c[2]):x(c[0],[],"",c[1]);return new f(O)}e.Errors=_}}),a1=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/errors/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(n,i,o,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(Ja(),e)}}),vp=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/system/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(i,o,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=Ja();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(bp(),e)}}),s1=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/check.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Check=e.ValueCheckUnknownTypeError=void 0;var t=ui(),r=vp(),n=Wa(),i=al(),o=Gr(),a=class extends o.TypeBoxError{constructor(g){super("Unknown type"),this.schema=g}};e.ValueCheckUnknownTypeError=a;function s(g){return g[o.Kind]==="Any"||g[o.Kind]==="Unknown"}function u(g){return g!==void 0}function l(g,x,_){return!0}function f(g,x,_){if(!(0,t.IsArray)(_)||u(g.minItems)&&!(_.length>=g.minItems)||u(g.maxItems)&&!(_.length<=g.maxItems)||!_.every(v=>N(g.items,x,v))||g.uniqueItems===!0&&!function(){let v=new Set;for(let b of _){let P=(0,i.Hash)(b);if(v.has(P))return!1;v.add(P)}return!0}())return!1;if(!(u(g.contains)||(0,t.IsNumber)(g.minContains)||(0,t.IsNumber)(g.maxContains)))return!0;let c=u(g.contains)?g.contains:o.Type.Never(),O=_.reduce((v,b)=>N(c,x,b)?v+1:v,0);return!(O===0||(0,t.IsNumber)(g.minContains)&&O<g.minContains||(0,t.IsNumber)(g.maxContains)&&O>g.maxContains)}function d(g,x,_){return(0,t.IsAsyncIterator)(_)}function $(g,x,_){return!(!(0,t.IsBigInt)(_)||u(g.exclusiveMaximum)&&!(_<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(_>g.exclusiveMinimum)||u(g.maximum)&&!(_<=g.maximum)||u(g.minimum)&&!(_>=g.minimum)||u(g.multipleOf)&&_%g.multipleOf!==BigInt(0))}function E(g,x,_){return(0,t.IsBoolean)(_)}function T(g,x,_){return N(g.returns,x,_.prototype)}function B(g,x,_){return!(!(0,t.IsDate)(_)||u(g.exclusiveMaximumTimestamp)&&!(_.getTime()<g.exclusiveMaximumTimestamp)||u(g.exclusiveMinimumTimestamp)&&!(_.getTime()>g.exclusiveMinimumTimestamp)||u(g.maximumTimestamp)&&!(_.getTime()<=g.maximumTimestamp)||u(g.minimumTimestamp)&&!(_.getTime()>=g.minimumTimestamp)||u(g.multipleOfTimestamp)&&_.getTime()%g.multipleOfTimestamp!==0)}function W(g,x,_){return(0,t.IsFunction)(_)}function R(g,x,_){return!(!(0,t.IsInteger)(_)||u(g.exclusiveMaximum)&&!(_<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(_>g.exclusiveMinimum)||u(g.maximum)&&!(_<=g.maximum)||u(g.minimum)&&!(_>=g.minimum)||u(g.multipleOf)&&_%g.multipleOf!==0)}function k(g,x,_){let c=g.allOf.every(O=>N(O,x,_));if(g.unevaluatedProperties===!1){let O=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(_).every(b=>O.test(b));return c&&v}else if(o.TypeGuard.TSchema(g.unevaluatedProperties)){let O=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(_).every(b=>O.test(b)||N(g.unevaluatedProperties,x,_[b]));return c&&v}else return c}function F(g,x,_){return(0,t.IsIterator)(_)}function q(g,x,_){return _===g.const}function L(g,x,_){return!1}function Q(g,x,_){return!N(g.not,x,_)}function K(g,x,_){return(0,t.IsNull)(_)}function te(g,x,_){return!(!r.TypeSystemPolicy.IsNumberLike(_)||u(g.exclusiveMaximum)&&!(_<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(_>g.exclusiveMinimum)||u(g.minimum)&&!(_>=g.minimum)||u(g.maximum)&&!(_<=g.maximum)||u(g.multipleOf)&&_%g.multipleOf!==0)}function j(g,x,_){if(!r.TypeSystemPolicy.IsObjectLike(_)||u(g.minProperties)&&!(Object.getOwnPropertyNames(_).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(_).length<=g.maxProperties))return!1;let c=Object.getOwnPropertyNames(g.properties);for(let O of c){let v=g.properties[O];if(g.required&&g.required.includes(O)){if(!N(v,x,_[O])||(o.ExtendsUndefined.Check(v)||s(v))&&!(O in _))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(_,O)&&!N(v,x,_[O]))return!1}if(g.additionalProperties===!1){let O=Object.getOwnPropertyNames(_);return g.required&&g.required.length===c.length&&O.length===c.length?!0:O.every(v=>c.includes(v))}else return typeof g.additionalProperties=="object"?Object.getOwnPropertyNames(_).every(O=>c.includes(O)||N(g.additionalProperties,x,_[O])):!0}function D(g,x,_){return(0,t.IsPromise)(_)}function z(g,x,_){if(!r.TypeSystemPolicy.IsRecordLike(_)||u(g.minProperties)&&!(Object.getOwnPropertyNames(_).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(_).length<=g.maxProperties))return!1;let[c,O]=Object.entries(g.patternProperties)[0],v=new RegExp(c),b=Object.entries(_).every(([ie,oe])=>v.test(ie)?N(O,x,oe):!0),P=typeof g.additionalProperties=="object"?Object.entries(_).every(([ie,oe])=>v.test(ie)?!0:N(g.additionalProperties,x,oe)):!0,H=g.additionalProperties===!1?Object.getOwnPropertyNames(_).every(ie=>v.test(ie)):!0;return b&&P&&H}function re(g,x,_){return N((0,n.Deref)(g,x),x,_)}function se(g,x,_){return!(0,t.IsString)(_)||u(g.minLength)&&!(_.length>=g.minLength)||u(g.maxLength)&&!(_.length<=g.maxLength)||u(g.pattern)&&!new RegExp(g.pattern).test(_)?!1:u(g.format)?o.FormatRegistry.Has(g.format)?o.FormatRegistry.Get(g.format)(_):!1:!0}function ee(g,x,_){return(0,t.IsSymbol)(_)}function ce(g,x,_){return(0,t.IsString)(_)&&new RegExp(g.pattern).test(_)}function V(g,x,_){return N((0,n.Deref)(g,x),x,_)}function J(g,x,_){if(!(0,t.IsArray)(_)||g.items===void 0&&_.length!==0||_.length!==g.maxItems)return!1;if(!g.items)return!0;for(let c=0;c<g.items.length;c++)if(!N(g.items[c],x,_[c]))return!1;return!0}function Z(g,x,_){return(0,t.IsUndefined)(_)}function ye(g,x,_){return g.anyOf.some(c=>N(c,x,_))}function p(g,x,_){return!(!(0,t.IsUint8Array)(_)||u(g.maxByteLength)&&!(_.length<=g.maxByteLength)||u(g.minByteLength)&&!(_.length>=g.minByteLength))}function w(g,x,_){return!0}function A(g,x,_){return r.TypeSystemPolicy.IsVoidLike(_)}function M(g,x,_){return o.TypeRegistry.Has(g[o.Kind])?o.TypeRegistry.Get(g[o.Kind])(g,_):!1}function N(g,x,_){let c=u(g.$id)?[...x,g]:x,O=g;switch(O[o.Kind]){case"Any":return l(O,c,_);case"Array":return f(O,c,_);case"AsyncIterator":return d(O,c,_);case"BigInt":return $(O,c,_);case"Boolean":return E(O,c,_);case"Constructor":return T(O,c,_);case"Date":return B(O,c,_);case"Function":return W(O,c,_);case"Integer":return R(O,c,_);case"Intersect":return k(O,c,_);case"Iterator":return F(O,c,_);case"Literal":return q(O,c,_);case"Never":return L(O,c,_);case"Not":return Q(O,c,_);case"Null":return K(O,c,_);case"Number":return te(O,c,_);case"Object":return j(O,c,_);case"Promise":return D(O,c,_);case"Record":return z(O,c,_);case"Ref":return re(O,c,_);case"String":return se(O,c,_);case"Symbol":return ee(O,c,_);case"TemplateLiteral":return ce(O,c,_);case"This":return V(O,c,_);case"Tuple":return J(O,c,_);case"Undefined":return Z(O,c,_);case"Union":return ye(O,c,_);case"Uint8Array":return p(O,c,_);case"Unknown":return w(O,c,_);case"Void":return A(O,c,_);default:if(!o.TypeRegistry.Has(O[o.Kind]))throw new a(O);return M(O,c,_)}}function U(...g){return g.length===3?N(g[0],g[1],g[2]):N(g[0],[],g[1])}e.Check=U}}),u1=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/transform.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EncodeTransform=e.DecodeTransform=e.HasTransform=e.TransformEncodeError=e.TransformDecodeError=e.TransformEncodeCheckError=e.TransformDecodeCheckError=void 0;var t=ui(),r=Wa(),n=s1(),i=Gr(),o=class extends i.TypeBoxError{constructor($,E,T){super("Unable to decode due to invalid value"),this.schema=$,this.value=E,this.error=T}};e.TransformDecodeCheckError=o;var a=class extends i.TypeBoxError{constructor($,E,T){super("Unable to encode due to invalid value"),this.schema=$,this.value=E,this.error=T}};e.TransformEncodeCheckError=a;var s=class extends i.TypeBoxError{constructor($,E,T){super(`${T instanceof Error?T.message:"Unknown error"}`),this.schema=$,this.value=E}};e.TransformDecodeError=s;var u=class extends i.TypeBoxError{constructor($,E,T){super(`${T instanceof Error?T.message:"Unknown error"}`),this.schema=$,this.value=E}};e.TransformEncodeError=u;var l;(function($){function E(ee,ce){return i.TypeGuard.TTransform(ee)||z(ee.items,ce)}function T(ee,ce){return i.TypeGuard.TTransform(ee)||z(ee.items,ce)}function B(ee,ce){return i.TypeGuard.TTransform(ee)||z(ee.returns,ce)||ee.parameters.some(V=>z(V,ce))}function W(ee,ce){return i.TypeGuard.TTransform(ee)||z(ee.returns,ce)||ee.parameters.some(V=>z(V,ce))}function R(ee,ce){return i.TypeGuard.TTransform(ee)||i.TypeGuard.TTransform(ee.unevaluatedProperties)||ee.allOf.some(V=>z(V,ce))}function k(ee,ce){return i.TypeGuard.TTransform(ee)||z(ee.items,ce)}function F(ee,ce){return i.TypeGuard.TTransform(ee)||z(ee.not,ce)}function q(ee,ce){return i.TypeGuard.TTransform(ee)||Object.values(ee.properties).some(V=>z(V,ce))||i.TypeGuard.TSchema(ee.additionalProperties)&&z(ee.additionalProperties,ce)}function L(ee,ce){return i.TypeGuard.TTransform(ee)||z(ee.item,ce)}function Q(ee,ce){let V=Object.getOwnPropertyNames(ee.patternProperties)[0],J=ee.patternProperties[V];return i.TypeGuard.TTransform(ee)||z(J,ce)||i.TypeGuard.TSchema(ee.additionalProperties)&&i.TypeGuard.TTransform(ee.additionalProperties)}function K(ee,ce){return i.TypeGuard.TTransform(ee)?!0:z((0,r.Deref)(ee,ce),ce)}function te(ee,ce){return i.TypeGuard.TTransform(ee)?!0:z((0,r.Deref)(ee,ce),ce)}function j(ee,ce){return i.TypeGuard.TTransform(ee)||!(0,t.IsUndefined)(ee.items)&&ee.items.some(V=>z(V,ce))}function D(ee,ce){return i.TypeGuard.TTransform(ee)||ee.anyOf.some(V=>z(V,ce))}function z(ee,ce){let V=(0,t.IsString)(ee.$id)?[...ce,ee]:ce,J=ee;if(ee.$id&&re.has(ee.$id))return!1;switch(ee.$id&&re.add(ee.$id),ee[i.Kind]){case"Array":return E(J,V);case"AsyncIterator":return T(J,V);case"Constructor":return B(J,V);case"Function":return W(J,V);case"Intersect":return R(J,V);case"Iterator":return k(J,V);case"Not":return F(J,V);case"Object":return q(J,V);case"Promise":return L(J,V);case"Record":return Q(J,V);case"Ref":return K(J,V);case"This":return te(J,V);case"Tuple":return j(J,V);case"Union":return D(J,V);default:return i.TypeGuard.TTransform(ee)}}let re=new Set;function se(ee,ce){return re.clear(),z(ee,ce)}$.Has=se})(l||(e.HasTransform=l={}));var f;(function($){function E(j,D){try{return i.TypeGuard.TTransform(j)?j[i.Transform].Decode(D):D}catch(z){throw new s(j,D,z)}}function T(j,D,z){return(0,t.IsArray)(z)?E(j,z.map(re=>K(j.items,D,re))):E(j,z)}function B(j,D,z){if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return E(j,z);let re=i.KeyResolver.ResolveKeys(j,{includePatterns:!1}),se=re.reduce((J,Z)=>Z in J?{...J,[Z]:K(i.IndexedAccessor.Resolve(j,[Z]),D,J[Z])}:J,z);if(!i.TypeGuard.TTransform(j.unevaluatedProperties))return E(j,se);let ee=Object.getOwnPropertyNames(se),ce=j.unevaluatedProperties,V=ee.reduce((J,Z)=>re.includes(Z)?J:{...J,[Z]:E(ce,J[Z])},se);return E(j,V)}function W(j,D,z){return E(j,K(j.not,D,z))}function R(j,D,z){if(!(0,t.IsPlainObject)(z))return E(j,z);let re=i.KeyResolver.ResolveKeys(j,{includePatterns:!1}),se=re.reduce((J,Z)=>Z in J?{...J,[Z]:K(j.properties[Z],D,J[Z])}:J,z);if(!i.TypeGuard.TSchema(j.additionalProperties))return E(j,se);let ee=Object.getOwnPropertyNames(se),ce=j.additionalProperties,V=ee.reduce((J,Z)=>re.includes(Z)?J:{...J,[Z]:E(ce,J[Z])},se);return E(j,V)}function k(j,D,z){if(!(0,t.IsPlainObject)(z))return E(j,z);let re=Object.getOwnPropertyNames(j.patternProperties)[0],se=new RegExp(re),ee=Object.getOwnPropertyNames(z).reduce((Z,ye)=>se.test(ye)?{...Z,[ye]:K(j.patternProperties[re],D,Z[ye])}:Z,z);if(!i.TypeGuard.TSchema(j.additionalProperties))return E(j,ee);let ce=Object.getOwnPropertyNames(ee),V=j.additionalProperties,J=ce.reduce((Z,ye)=>se.test(ye)?Z:{...Z,[ye]:E(V,Z[ye])},ee);return E(j,J)}function F(j,D,z){let re=(0,r.Deref)(j,D);return E(j,K(re,D,z))}function q(j,D,z){let re=(0,r.Deref)(j,D);return E(j,K(re,D,z))}function L(j,D,z){return(0,t.IsArray)(z)&&(0,t.IsArray)(j.items)?E(j,j.items.map((re,se)=>K(re,D,z[se]))):E(j,z)}function Q(j,D,z){let re=E(j,z);for(let se of j.anyOf)if((0,n.Check)(se,D,re))return K(se,D,re);return re}function K(j,D,z){let re=typeof j.$id=="string"?[...D,j]:D,se=j;switch(j[i.Kind]){case"Array":return T(se,re,z);case"Intersect":return B(se,re,z);case"Not":return W(se,re,z);case"Object":return R(se,re,z);case"Record":return k(se,re,z);case"Ref":return F(se,re,z);case"Symbol":return E(se,z);case"This":return q(se,re,z);case"Tuple":return L(se,re,z);case"Union":return Q(se,re,z);default:return E(se,z)}}function te(j,D,z){return K(j,D,z)}$.Decode=te})(f||(e.DecodeTransform=f={}));var d;(function($){function E(j,D){try{return i.TypeGuard.TTransform(j)?j[i.Transform].Encode(D):D}catch(z){throw new u(j,D,z)}}function T(j,D,z){let re=E(j,z);return(0,t.IsArray)(re)?re.map(se=>K(j.items,D,se)):re}function B(j,D,z){let re=E(j,z);if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return re;let se=i.KeyResolver.ResolveKeys(j,{includePatterns:!1}),ee=se.reduce((J,Z)=>Z in re?{...J,[Z]:K(i.IndexedAccessor.Resolve(j,[Z]),D,J[Z])}:J,re);if(!i.TypeGuard.TTransform(j.unevaluatedProperties))return E(j,ee);let ce=Object.getOwnPropertyNames(ee),V=j.unevaluatedProperties;return ce.reduce((J,Z)=>se.includes(Z)?J:{...J,[Z]:E(V,J[Z])},ee)}function W(j,D,z){return E(j.not,E(j,z))}function R(j,D,z){let re=E(j,z);if(!(0,t.IsPlainObject)(z))return re;let se=i.KeyResolver.ResolveKeys(j,{includePatterns:!1}),ee=se.reduce((J,Z)=>Z in J?{...J,[Z]:K(j.properties[Z],D,J[Z])}:J,re);if(!i.TypeGuard.TSchema(j.additionalProperties))return ee;let ce=Object.getOwnPropertyNames(ee),V=j.additionalProperties;return ce.reduce((J,Z)=>se.includes(Z)?J:{...J,[Z]:E(V,J[Z])},ee)}function k(j,D,z){let re=E(j,z);if(!(0,t.IsPlainObject)(z))return re;let se=Object.getOwnPropertyNames(j.patternProperties)[0],ee=new RegExp(se),ce=Object.getOwnPropertyNames(z).reduce((Z,ye)=>ee.test(ye)?{...Z,[ye]:K(j.patternProperties[se],D,Z[ye])}:Z,re);if(!i.TypeGuard.TSchema(j.additionalProperties))return E(j,ce);let V=Object.getOwnPropertyNames(ce),J=j.additionalProperties;return V.reduce((Z,ye)=>ee.test(ye)?Z:{...Z,[ye]:E(J,Z[ye])},ce)}function F(j,D,z){let re=(0,r.Deref)(j,D),se=K(re,D,z);return E(j,se)}function q(j,D,z){let re=(0,r.Deref)(j,D),se=K(re,D,z);return E(j,se)}function L(j,D,z){let re=E(j,z);return(0,t.IsArray)(j.items)?j.items.map((se,ee)=>K(se,D,re[ee])):[]}function Q(j,D,z){for(let re of j.anyOf){if(!(0,n.Check)(re,D,z))continue;let se=K(re,D,z);return E(j,se)}for(let re of j.anyOf){let se=K(re,D,z);if((0,n.Check)(j,D,se))return E(j,se)}return E(j,z)}function K(j,D,z){let re=typeof j.$id=="string"?[...D,j]:D,se=j;switch(j[i.Kind]){case"Array":return T(se,re,z);case"Intersect":return B(se,re,z);case"Not":return W(se,re,z);case"Object":return R(se,re,z);case"Record":return k(se,re,z);case"Ref":return F(se,re,z);case"This":return q(se,re,z);case"Tuple":return L(se,re,z);case"Union":return Q(se,re,z);default:return E(se,z)}}function te(j,D,z){return K(j,D,z)}$.Encode=te})(d||(e.EncodeTransform=d={}))}}),l1=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/compiler/compiler.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeCompiler=e.Policy=e.TypeCompilerTypeGuardError=e.TypeCompilerUnknownTypeError=e.TypeCheck=void 0;var t=u1(),r=ui(),n=Ja(),i=vp(),o=Wa(),a=al(),s=Gr(),u=class{constructor(R,k,F,q){this.schema=R,this.references=k,this.checkFunc=F,this.code=q,this.hasTransform=t.HasTransform.Has(R,k)}Code(){return this.code}Errors(R){return(0,n.Errors)(this.schema,this.references,R)}Check(R){return this.checkFunc(R)}Decode(R){if(!this.checkFunc(R))throw new t.TransformDecodeCheckError(this.schema,R,this.Errors(R).First());return this.hasTransform?t.DecodeTransform.Decode(this.schema,this.references,R):R}Encode(R){let k=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,R):R;if(!this.checkFunc(k))throw new t.TransformEncodeCheckError(this.schema,R,this.Errors(R).First());return k}};e.TypeCheck=u;var l;(function(R){function k(Q){return Q===36}R.DollarSign=k;function F(Q){return Q===95}R.IsUnderscore=F;function q(Q){return Q>=65&&Q<=90||Q>=97&&Q<=122}R.IsAlpha=q;function L(Q){return Q>=48&&Q<=57}R.IsNumeric=L})(l||(l={}));var f;(function(R){function k(Q){return Q.length===0?!1:l.IsNumeric(Q.charCodeAt(0))}function F(Q){if(k(Q))return!1;for(let K=0;K<Q.length;K++){let te=Q.charCodeAt(K);if(!(l.IsAlpha(te)||l.IsNumeric(te)||l.DollarSign(te)||l.IsUnderscore(te)))return!1}return!0}function q(Q){return Q.replace(/'/g,"\\'")}function L(Q,K){return F(K)?`${Q}.${K}`:`${Q}['${q(K)}']`}R.Encode=L})(f||(f={}));var d;(function(R){function k(F){let q=[];for(let L=0;L<F.length;L++){let Q=F.charCodeAt(L);l.IsNumeric(Q)||l.IsAlpha(Q)?q.push(F.charAt(L)):q.push(`_${Q}_`)}return q.join("").replace(/__/g,"_")}R.Encode=k})(d||(d={}));var $;(function(R){function k(F){return F.replace(/'/g,"\\'")}R.Escape=k})($||($={}));var E=class extends s.TypeBoxError{constructor(R){super("Unknown type"),this.schema=R}};e.TypeCompilerUnknownTypeError=E;var T=class extends s.TypeBoxError{constructor(R){super("Preflight validation check failed to guard for the given schema"),this.schema=R}};e.TypeCompilerTypeGuardError=T;var B;(function(R){function k(K,te,j){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${te}' in ${K} ? ${j} : true)`:`(${f.Encode(K,te)} !== undefined ? ${j} : true)`}R.IsExactOptionalProperty=k;function F(K){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${K} === 'object' && ${K} !== null)`:`(typeof ${K} === 'object' && ${K} !== null && !Array.isArray(${K}))`}R.IsObjectLike=F;function q(K){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${K} === 'object' && ${K} !== null && !(${K} instanceof Date) && !(${K} instanceof Uint8Array))`:`(typeof ${K} === 'object' && ${K} !== null && !Array.isArray(${K}) && !(${K} instanceof Date) && !(${K} instanceof Uint8Array))`}R.IsRecordLike=q;function L(K){return i.TypeSystemPolicy.AllowNaN?`typeof ${K} === 'number'`:`(typeof ${K} === 'number' && Number.isFinite(${K}))`}R.IsNumberLike=L;function Q(K){return i.TypeSystemPolicy.AllowNullVoid?`(${K} === undefined || ${K} === null)`:`${K} === undefined`}R.IsVoidLike=Q})(B||(e.Policy=B={}));var W;(function(R){function k(S){return S[s.Kind]==="Any"||S[s.Kind]==="Unknown"}function*F(S,pe,C){yield"true"}function*q(S,pe,C){yield`Array.isArray(${C})`;let[_e,ae]=[ze("value","any"),ze("acc","number")];(0,r.IsNumber)(S.maxItems)&&(yield`${C}.length <= ${S.maxItems}`),(0,r.IsNumber)(S.minItems)&&(yield`${C}.length >= ${S.minItems}`);let he=oe(S.items,pe,"value");if(yield`${C}.every((${_e}) => ${he})`,s.TypeGuard.TSchema(S.contains)||(0,r.IsNumber)(S.minContains)||(0,r.IsNumber)(S.maxContains)){let Ce=s.TypeGuard.TSchema(S.contains)?S.contains:s.Type.Never(),Ke=oe(Ce,pe,"value"),ft=(0,r.IsNumber)(S.minContains)?[`(count >= ${S.minContains})`]:[],at=(0,r.IsNumber)(S.maxContains)?[`(count <= ${S.maxContains})`]:[],pt=`const count = value.reduce((${ae}, ${_e}) => ${Ke} ? acc + 1 : acc, 0)`,Sr=["(count > 0)",...ft,...at].join(" && ");yield`((${_e}) => { ${pt}; return ${Sr}})(${C})`}S.uniqueItems===!0&&(yield`((${_e}) => { const set = new Set(); for(const element of value) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true } )(${C})`)}function*L(S,pe,C){yield`(typeof value === 'object' && Symbol.asyncIterator in ${C})`}function*Q(S,pe,C){yield`(typeof ${C} === 'bigint')`,(0,r.IsBigInt)(S.exclusiveMaximum)&&(yield`${C} < BigInt(${S.exclusiveMaximum})`),(0,r.IsBigInt)(S.exclusiveMinimum)&&(yield`${C} > BigInt(${S.exclusiveMinimum})`),(0,r.IsBigInt)(S.maximum)&&(yield`${C} <= BigInt(${S.maximum})`),(0,r.IsBigInt)(S.minimum)&&(yield`${C} >= BigInt(${S.minimum})`),(0,r.IsBigInt)(S.multipleOf)&&(yield`(${C} % BigInt(${S.multipleOf})) === 0`)}function*K(S,pe,C){yield`(typeof ${C} === 'boolean')`}function*te(S,pe,C){yield*H(S.returns,pe,`${C}.prototype`)}function*j(S,pe,C){yield`(${C} instanceof Date) && Number.isFinite(${C}.getTime())`,(0,r.IsNumber)(S.exclusiveMaximumTimestamp)&&(yield`${C}.getTime() < ${S.exclusiveMaximumTimestamp}`),(0,r.IsNumber)(S.exclusiveMinimumTimestamp)&&(yield`${C}.getTime() > ${S.exclusiveMinimumTimestamp}`),(0,r.IsNumber)(S.maximumTimestamp)&&(yield`${C}.getTime() <= ${S.maximumTimestamp}`),(0,r.IsNumber)(S.minimumTimestamp)&&(yield`${C}.getTime() >= ${S.minimumTimestamp}`),(0,r.IsNumber)(S.multipleOfTimestamp)&&(yield`(${C}.getTime() % ${S.multipleOfTimestamp}) === 0`)}function*D(S,pe,C){yield`(typeof ${C} === 'function')`}function*z(S,pe,C){yield`(typeof ${C} === 'number' && Number.isInteger(${C}))`,(0,r.IsNumber)(S.exclusiveMaximum)&&(yield`${C} < ${S.exclusiveMaximum}`),(0,r.IsNumber)(S.exclusiveMinimum)&&(yield`${C} > ${S.exclusiveMinimum}`),(0,r.IsNumber)(S.maximum)&&(yield`${C} <= ${S.maximum}`),(0,r.IsNumber)(S.minimum)&&(yield`${C} >= ${S.minimum}`),(0,r.IsNumber)(S.multipleOf)&&(yield`(${C} % ${S.multipleOf}) === 0`)}function*re(S,pe,C){let _e=S.allOf.map(ae=>oe(ae,pe,C)).join(" && ");if(S.unevaluatedProperties===!1){let ae=Oe(`${new RegExp(s.KeyResolver.ResolvePattern(S))};`),he=`Object.getOwnPropertyNames(${C}).every(key => ${ae}.test(key))`;yield`(${_e} && ${he})`}else if(s.TypeGuard.TSchema(S.unevaluatedProperties)){let ae=Oe(`${new RegExp(s.KeyResolver.ResolvePattern(S))};`),he=`Object.getOwnPropertyNames(${C}).every(key => ${ae}.test(key) || ${oe(S.unevaluatedProperties,pe,`${C}[key]`)})`;yield`(${_e} && ${he})`}else yield`(${_e})`}function*se(S,pe,C){yield`(typeof value === 'object' && Symbol.iterator in ${C})`}function*ee(S,pe,C){typeof S.const=="number"||typeof S.const=="boolean"?yield`(${C} === ${S.const})`:yield`(${C} === '${$.Escape(S.const)}')`}function*ce(S,pe,C){yield"false"}function*V(S,pe,C){yield`(!${oe(S.not,pe,C)})`}function*J(S,pe,C){yield`(${C} === null)`}function*Z(S,pe,C){yield B.IsNumberLike(C),(0,r.IsNumber)(S.exclusiveMaximum)&&(yield`${C} < ${S.exclusiveMaximum}`),(0,r.IsNumber)(S.exclusiveMinimum)&&(yield`${C} > ${S.exclusiveMinimum}`),(0,r.IsNumber)(S.maximum)&&(yield`${C} <= ${S.maximum}`),(0,r.IsNumber)(S.minimum)&&(yield`${C} >= ${S.minimum}`),(0,r.IsNumber)(S.multipleOf)&&(yield`(${C} % ${S.multipleOf}) === 0`)}function*ye(S,pe,C){yield B.IsObjectLike(C),(0,r.IsNumber)(S.minProperties)&&(yield`Object.getOwnPropertyNames(${C}).length >= ${S.minProperties}`),(0,r.IsNumber)(S.maxProperties)&&(yield`Object.getOwnPropertyNames(${C}).length <= ${S.maxProperties}`);let _e=Object.getOwnPropertyNames(S.properties);for(let ae of _e){let he=f.Encode(C,ae),Ce=S.properties[ae];if(S.required&&S.required.includes(ae))yield*H(Ce,pe,he),(s.ExtendsUndefined.Check(Ce)||k(Ce))&&(yield`('${ae}' in ${C})`);else{let Ke=oe(Ce,pe,he);yield B.IsExactOptionalProperty(C,ae,Ke)}}if(S.additionalProperties===!1)if(S.required&&S.required.length===_e.length)yield`Object.getOwnPropertyNames(${C}).length === ${_e.length}`;else{let ae=`[${_e.map(he=>`'${he}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${C}).every(key => ${ae}.includes(key))`}if(typeof S.additionalProperties=="object"){let ae=oe(S.additionalProperties,pe,`${C}[key]`),he=`[${_e.map(Ce=>`'${Ce}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${C}).every(key => ${he}.includes(key) || ${ae}))`}}function*p(S,pe,C){yield`(typeof value === 'object' && typeof ${C}.then === 'function')`}function*w(S,pe,C){yield B.IsRecordLike(C),(0,r.IsNumber)(S.minProperties)&&(yield`Object.getOwnPropertyNames(${C}).length >= ${S.minProperties}`),(0,r.IsNumber)(S.maxProperties)&&(yield`Object.getOwnPropertyNames(${C}).length <= ${S.maxProperties}`);let[_e,ae]=Object.entries(S.patternProperties)[0],he=Oe(`${new RegExp(_e)}`),Ce=oe(ae,pe,"value"),Ke=s.TypeGuard.TSchema(S.additionalProperties)?oe(S.additionalProperties,pe,C):S.additionalProperties===!1?"false":"true",ft=`(${he}.test(key) ? ${Ce} : ${Ke})`;yield`(Object.entries(${C}).every(([key, value]) => ${ft}))`}function*A(S,pe,C){let _e=(0,o.Deref)(S,pe);if(ie.functions.has(S.$ref))return yield`${ve(S.$ref)}(${C})`;yield*H(_e,pe,C)}function*M(S,pe,C){yield`(typeof ${C} === 'string')`,(0,r.IsNumber)(S.maxLength)&&(yield`${C}.length <= ${S.maxLength}`),(0,r.IsNumber)(S.minLength)&&(yield`${C}.length >= ${S.minLength}`),S.pattern!==void 0&&(yield`${Oe(`${new RegExp(S.pattern)};`)}.test(${C})`),S.format!==void 0&&(yield`format('${S.format}', ${C})`)}function*N(S,pe,C){yield`(typeof ${C} === 'symbol')`}function*U(S,pe,C){yield`(typeof ${C} === 'string')`,yield`${Oe(`${new RegExp(S.pattern)};`)}.test(${C})`}function*g(S,pe,C){yield`${ve(S.$ref)}(${C})`}function*x(S,pe,C){if(yield`Array.isArray(${C})`,S.items===void 0)return yield`${C}.length === 0`;yield`(${C}.length === ${S.maxItems})`;for(let _e=0;_e<S.items.length;_e++)yield`${oe(S.items[_e],pe,`${C}[${_e}]`)}`}function*_(S,pe,C){yield`${C} === undefined`}function*c(S,pe,C){yield`(${S.anyOf.map(_e=>oe(_e,pe,C)).join(" || ")})`}function*O(S,pe,C){yield`${C} instanceof Uint8Array`,(0,r.IsNumber)(S.maxByteLength)&&(yield`(${C}.length <= ${S.maxByteLength})`),(0,r.IsNumber)(S.minByteLength)&&(yield`(${C}.length >= ${S.minByteLength})`)}function*v(S,pe,C){yield"true"}function*b(S,pe,C){yield B.IsVoidLike(C)}function*P(S,pe,C){let _e=ie.instances.size;ie.instances.set(_e,S),yield`kind('${S[s.Kind]}', ${_e}, ${C})`}function*H(S,pe,C,_e=!0){let ae=(0,r.IsString)(S.$id)?[...pe,S]:pe,he=S;if(_e&&(0,r.IsString)(S.$id)){let Ce=ve(S.$id);if(ie.functions.has(Ce))return yield`${Ce}(${C})`;{let Ke=Re(Ce,S,pe,"value",!1);return ie.functions.set(Ce,Ke),yield`${Ce}(${C})`}}switch(he[s.Kind]){case"Any":return yield*F(he,ae,C);case"Array":return yield*q(he,ae,C);case"AsyncIterator":return yield*L(he,ae,C);case"BigInt":return yield*Q(he,ae,C);case"Boolean":return yield*K(he,ae,C);case"Constructor":return yield*te(he,ae,C);case"Date":return yield*j(he,ae,C);case"Function":return yield*D(he,ae,C);case"Integer":return yield*z(he,ae,C);case"Intersect":return yield*re(he,ae,C);case"Iterator":return yield*se(he,ae,C);case"Literal":return yield*ee(he,ae,C);case"Never":return yield*ce(he,ae,C);case"Not":return yield*V(he,ae,C);case"Null":return yield*J(he,ae,C);case"Number":return yield*Z(he,ae,C);case"Object":return yield*ye(he,ae,C);case"Promise":return yield*p(he,ae,C);case"Record":return yield*w(he,ae,C);case"Ref":return yield*A(he,ae,C);case"String":return yield*M(he,ae,C);case"Symbol":return yield*N(he,ae,C);case"TemplateLiteral":return yield*U(he,ae,C);case"This":return yield*g(he,ae,C);case"Tuple":return yield*x(he,ae,C);case"Undefined":return yield*_(he,ae,C);case"Union":return yield*c(he,ae,C);case"Uint8Array":return yield*O(he,ae,C);case"Unknown":return yield*v(he,ae,C);case"Void":return yield*b(he,ae,C);default:if(!s.TypeRegistry.Has(he[s.Kind]))throw new E(S);return yield*P(he,ae,C)}}let ie={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function oe(S,pe,C,_e=!0){return`(${[...H(S,pe,C,_e)].join(" && ")})`}function ve(S){return`check_${d.Encode(S)}`}function Oe(S){let pe=`local_${ie.variables.size}`;return ie.variables.set(pe,`const ${pe} = ${S}`),pe}function Re(S,pe,C,_e,ae=!0){let[he,Ce]=[`
|
|
49
|
+
`,pt=>"".padStart(pt," ")],Ke=ze("value","any"),ft=Jr("boolean"),at=[...H(pe,C,_e,ae)].map(pt=>`${Ce(4)}${pt}`).join(` &&${he}`);return`function ${S}(${Ke})${ft} {${he}${Ce(2)}return (${he}${at}${he}${Ce(2)})
|
|
50
|
+
}`}function ze(S,pe){let C=ie.language==="typescript"?`: ${pe}`:"";return`${S}${C}`}function Jr(S){return ie.language==="typescript"?`: ${S}`:""}function Te(S,pe,C){let _e=Re("check",S,pe,"value"),ae=ze("value","any"),he=Jr("boolean"),Ce=[...ie.functions.values()],Ke=[...ie.variables.values()],ft=(0,r.IsString)(S.$id)?`return function check(${ae})${he} {
|
|
51
|
+
return ${ve(S.$id)}(value)
|
|
52
|
+
}`:`return ${_e}`;return[...Ke,...Ce,ft].join(`
|
|
53
|
+
`)}function Ar(...S){let pe={language:"javascript"},[C,_e,ae]=S.length===2&&(0,r.IsArray)(S[1])?[S[0],S[1],pe]:S.length===2&&!(0,r.IsArray)(S[1])?[S[0],[],S[1]]:S.length===3?[S[0],S[1],S[2]]:S.length===1?[S[0],[],pe]:[null,[],pe];if(ie.language=ae.language,ie.variables.clear(),ie.functions.clear(),ie.instances.clear(),!s.TypeGuard.TSchema(C))throw new T(C);for(let he of _e)if(!s.TypeGuard.TSchema(he))throw new T(he);return Te(C,_e,ae)}R.Code=Ar;function Qr(S,pe=[]){let C=Ar(S,pe,{language:"javascript"}),_e=globalThis.Function("kind","format","hash",C),ae=new Map(ie.instances);function he(at,pt,Sr){if(!s.TypeRegistry.Has(at)||!ae.has(pt))return!1;let kn=s.TypeRegistry.Get(at),jn=ae.get(pt);return kn(jn,Sr)}function Ce(at,pt){return s.FormatRegistry.Has(at)?s.FormatRegistry.Get(at)(pt):!1}function Ke(at){return(0,a.Hash)(at)}let ft=_e(he,Ce,Ke);return new u(S,pe,ft,C)}R.Compile=Qr})(W||(e.TypeCompiler=W={}))}}),c1=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/compiler/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(i,o,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=a1();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return n.ValueErrorIterator}}),r(l1(),e)}}),la=Or(n1(),1),f1=Or(i1(),1),wp=!1,_p=!1;la.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(wp=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(_p=process?.env?.LOGGER_PERF_PREFIX==="true"));var d1={prefix:void 0,time:wp,delta:_p,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},As=[],Tp=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(",")}]`}},Ep=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Ii=!1,Ae=class ht{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=ht.INFO,r={}){r=Object.assign({},d1,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(...$){let E=$[$.length-1];return E===i?E():(o(...$.slice(0,-1)),(async()=>{try{let T=E();return T instanceof Promise?await T:T}finally{console.groupEnd()}})())}let d=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:l});return u?d:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:d})},s=a(t>=ht.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(s(...u),new Error(u.map(l=>typeof l=="string"?l:(0,f1.default)(l)).join(" "))),WARN:a(t>=ht.WARN,this.wrapLog(console.warn,r)),LOG:a(t>=ht.INFO,this.wrapLog(console.log,r)),DEBUG:a(t>=ht.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:a(t>=ht.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(la.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=la.isBrowser&&navigator.userAgent.includes("Chrome")?["",ht.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(Ii?n.push(new Ep("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();ht.firstLog||(ht.firstLog=i,ht.lastLog=i);let o=new Tp(i-ht.firstLog,i-ht.lastLog,t,r);return ht.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}}}};la.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(As&&As.length){for(let t of As)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof Tp))return null;Ii||(Ii=!0);let t=Ae.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof Ep?(Ii||(Ii=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var p1=typeof global=="object"&&global&&global.Object===Object&&global,Op=p1,h1=typeof self=="object"&&self&&self.Object===Object&&self,y1=Op||h1||Function("return this")(),Tt=y1,g1=Tt.Symbol,sr=g1,xp=Object.prototype,m1=xp.hasOwnProperty,b1=xp.toString,Ti=sr?sr.toStringTag:void 0;function v1(e){var t=m1.call(e,Ti),r=e[Ti];try{e[Ti]=void 0;var n=!0}catch{}var i=b1.call(e);return n&&(t?e[Ti]=r:delete e[Ti]),i}var w1=v1,_1=Object.prototype,T1=_1.toString;function E1(e){return T1.call(e)}var O1=E1,x1="[object Null]",A1="[object Undefined]",$c=sr?sr.toStringTag:void 0;function S1(e){return e==null?e===void 0?A1:x1:$c&&$c in Object(e)?w1(e):O1(e)}var li=S1;function I1(e){return e!=null&&typeof e=="object"}var zr=I1,$1="[object Symbol]";function k1(e){return typeof e=="symbol"||zr(e)&&li(e)==$1}var Fn=k1;function j1(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 Ap=j1,N1=Array.isArray,Zt=N1,C1=1/0,kc=sr?sr.prototype:void 0,jc=kc?kc.toString:void 0;function Sp(e){if(typeof e=="string")return e;if(Zt(e))return Ap(e,Sp)+"";if(Fn(e))return jc?jc.call(e):"";var t=e+"";return t=="0"&&1/e==-C1?"-0":t}var U1=Sp,P1=/\s/;function M1(e){for(var t=e.length;t--&&P1.test(e.charAt(t)););return t}var R1=M1,L1=/^\s+/;function D1(e){return e&&e.slice(0,R1(e)+1).replace(L1,"")}var B1=D1;function V1(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var vr=V1,Nc=NaN,F1=/^[-+]0x[0-9a-f]+$/i,z1=/^0b[01]+$/i,K1=/^0o[0-7]+$/i,q1=parseInt;function G1(e){if(typeof e=="number")return e;if(Fn(e))return Nc;if(vr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=vr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=B1(e);var r=z1.test(e);return r||K1.test(e)?q1(e.slice(2),r?2:8):F1.test(e)?Nc:+e}var H1=G1,Cc=1/0,W1=17976931348623157e292;function J1(e){if(!e)return e===0?e:0;if(e=H1(e),e===Cc||e===-Cc){var t=e<0?-1:1;return t*W1}return e===e?e:0}var Q1=J1;function Y1(e){var t=Q1(e),r=t%1;return t===t?r?t-r:t:0}var Uc=Y1;function X1(e){return e}var Qa=X1,Z1="[object AsyncFunction]",e_="[object Function]",t_="[object GeneratorFunction]",r_="[object Proxy]";function n_(e){if(!vr(e))return!1;var t=li(e);return t==e_||t==t_||t==Z1||t==r_}var Ip=n_,i_=Tt["__core-js_shared__"],Ss=i_,Pc=function(){var e=/[^.]+$/.exec(Ss&&Ss.keys&&Ss.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function o_(e){return!!Pc&&Pc in e}var a_=o_,s_=Function.prototype,u_=s_.toString;function l_(e){if(e!=null){try{return u_.call(e)}catch{}try{return e+""}catch{}}return""}var En=l_,c_=/[\\^$.*+?()[\]{}|]/g,f_=/^\[object .+?Constructor\]$/,d_=Function.prototype,p_=Object.prototype,h_=d_.toString,y_=p_.hasOwnProperty,g_=RegExp("^"+h_.call(y_).replace(c_,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m_(e){if(!vr(e)||a_(e))return!1;var t=Ip(e)?g_:f_;return t.test(En(e))}var b_=m_;function v_(e,t){return e?.[t]}var w_=v_;function __(e,t){var r=w_(e,t);return b_(r)?r:void 0}var On=__,T_=On(Tt,"WeakMap"),Bi=T_,E_=Bi&&new Bi,ca=E_,O_=ca?function(e,t){return ca.set(e,t),e}:Qa,$p=O_,Mc=Object.create,x_=function(){function e(){}return function(t){if(!vr(t))return{};if(Mc)return Mc(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),sl=x_;function A_(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=sl(e.prototype),n=e.apply(r,t);return vr(n)?n:r}}var Vi=A_,S_=1;function I_(e,t,r){var n=t&S_,i=Vi(e);function o(){var a=this&&this!==Tt&&this instanceof o?i:e;return a.apply(n?r:this,arguments)}return o}var $_=I_;function k_(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 ul=k_,j_=Math.max;function N_(e,t,r,n){for(var i=-1,o=e.length,a=r.length,s=-1,u=t.length,l=j_(o-a,0),f=Array(u+l),d=!n;++s<u;)f[s]=t[s];for(;++i<a;)(d||i<o)&&(f[r[i]]=e[i]);for(;l--;)f[s++]=e[i++];return f}var kp=N_,C_=Math.max;function U_(e,t,r,n){for(var i=-1,o=e.length,a=-1,s=r.length,u=-1,l=t.length,f=C_(o-s,0),d=Array(f+l),$=!n;++i<f;)d[i]=e[i];for(var E=i;++u<l;)d[E+u]=t[u];for(;++a<s;)($||i<o)&&(d[E+r[a]]=e[i++]);return d}var jp=U_;function P_(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var M_=P_;function R_(){}var ll=R_,L_=4294967295;function fa(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=L_,this.__views__=[]}fa.prototype=sl(ll.prototype);fa.prototype.constructor=fa;var cl=fa;function D_(){}var Np=D_,B_=ca?function(e){return ca.get(e)}:Np,Cp=B_,V_={},Rc=V_,F_=Object.prototype,z_=F_.hasOwnProperty;function K_(e){for(var t=e.name+"",r=Rc[t],n=z_.call(Rc,t)?r.length:0;n--;){var i=r[n],o=i.func;if(o==null||o==e)return i.name}return t}var q_=K_;function da(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}da.prototype=sl(ll.prototype);da.prototype.constructor=da;var ou=da;function G_(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var Up=G_;function H_(e){if(e instanceof cl)return e.clone();var t=new ou(e.__wrapped__,e.__chain__);return t.__actions__=Up(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var W_=H_,J_=Object.prototype,Q_=J_.hasOwnProperty;function pa(e){if(zr(e)&&!Zt(e)&&!(e instanceof cl)){if(e instanceof ou)return e;if(Q_.call(e,"__wrapped__"))return W_(e)}return new ou(e)}pa.prototype=ll.prototype;pa.prototype.constructor=pa;var Y_=pa;function X_(e){var t=q_(e),r=Y_[t];if(typeof r!="function"||!(t in cl.prototype))return!1;if(e===r)return!0;var n=Cp(r);return!!n&&e===n[0]}var Z_=X_,eT=800,tT=16,rT=Date.now;function nT(e){var t=0,r=0;return function(){var n=rT(),i=tT-(n-r);if(r=n,i>0){if(++t>=eT)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Pp=nT,iT=Pp($p),Mp=iT,oT=/\{\n\/\* \[wrapped with (.+)\] \*/,aT=/,? & /;function sT(e){var t=e.match(oT);return t?t[1].split(aT):[]}var uT=sT,lT=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function cT(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(lT,`{
|
|
55
|
+
/* [wrapped with `+t+`] */
|
|
56
|
+
`)}var fT=cT;function dT(e){return function(){return e}}var pT=dT,hT=function(){try{var e=On(Object,"defineProperty");return e({},"",{}),e}catch{}}(),ha=hT,yT=ha?function(e,t){return ha(e,"toString",{configurable:!0,enumerable:!1,value:pT(t),writable:!0})}:Qa,gT=yT,mT=Pp(gT),fl=mT;function bT(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var vT=bT;function wT(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 _T=wT;function TT(e){return e!==e}var ET=TT;function OT(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}var xT=OT;function AT(e,t,r){return t===t?xT(e,t,r):_T(e,ET,r)}var ST=AT;function IT(e,t){var r=e==null?0:e.length;return!!r&&ST(e,t,0)>-1}var Rp=IT,$T=1,kT=2,jT=8,NT=16,CT=32,UT=64,PT=128,MT=256,RT=512,LT=[["ary",PT],["bind",$T],["bindKey",kT],["curry",jT],["curryRight",NT],["flip",RT],["partial",CT],["partialRight",UT],["rearg",MT]];function DT(e,t){return vT(LT,function(r){var n="_."+r[0];t&r[1]&&!Rp(e,n)&&e.push(n)}),e.sort()}var BT=DT;function VT(e,t,r){var n=t+"";return fl(e,fT(n,BT(uT(n),r)))}var Lp=VT,FT=1,zT=2,KT=4,qT=8,Lc=32,Dc=64;function GT(e,t,r,n,i,o,a,s,u,l){var f=t&qT,d=f?a:void 0,$=f?void 0:a,E=f?o:void 0,T=f?void 0:o;t|=f?Lc:Dc,t&=~(f?Dc:Lc),t&KT||(t&=~(FT|zT));var B=[e,t,i,E,d,T,$,s,u,l],W=r.apply(void 0,B);return Z_(e)&&Mp(W,B),W.placeholder=n,Lp(W,e,t)}var Dp=GT;function HT(e){var t=e;return t.placeholder}var dl=HT,WT=9007199254740991,JT=/^(?:0|[1-9]\d*)$/;function QT(e,t){var r=typeof e;return t=t??WT,!!t&&(r=="number"||r!="symbol"&&JT.test(e))&&e>-1&&e%1==0&&e<t}var Ya=QT,YT=Math.min;function XT(e,t){for(var r=e.length,n=YT(t.length,r),i=Up(e);n--;){var o=t[n];e[n]=Ya(o,r)?i[o]:void 0}return e}var ZT=XT,Bc="__lodash_placeholder__";function eE(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r];(a===t||a===Bc)&&(e[r]=Bc,o[i++]=r)}return o}var Fi=eE,tE=1,rE=2,nE=8,iE=16,oE=128,aE=512;function Bp(e,t,r,n,i,o,a,s,u,l){var f=t&oE,d=t&tE,$=t&rE,E=t&(nE|iE),T=t&aE,B=$?void 0:Vi(e);function W(){for(var R=arguments.length,k=Array(R),F=R;F--;)k[F]=arguments[F];if(E)var q=dl(W),L=M_(k,q);if(n&&(k=kp(k,n,i,E)),o&&(k=jp(k,o,a,E)),R-=L,E&&R<l){var Q=Fi(k,q);return Dp(e,t,Bp,W.placeholder,r,k,Q,s,u,l-R)}var K=d?r:this,te=$?K[e]:e;return R=k.length,s?k=ZT(k,s):T&&R>1&&k.reverse(),f&&u<R&&(k.length=u),this&&this!==Tt&&this instanceof W&&(te=B||Vi(te)),te.apply(K,k)}return W}var Vp=Bp;function sE(e,t,r){var n=Vi(e);function i(){for(var o=arguments.length,a=Array(o),s=o,u=dl(i);s--;)a[s]=arguments[s];var l=o<3&&a[0]!==u&&a[o-1]!==u?[]:Fi(a,u);if(o-=l.length,o<r)return Dp(e,t,Vp,i.placeholder,void 0,a,l,void 0,void 0,r-o);var f=this&&this!==Tt&&this instanceof i?n:e;return ul(f,this,a)}return i}var uE=sE,lE=1;function cE(e,t,r,n){var i=t&lE,o=Vi(e);function a(){for(var s=-1,u=arguments.length,l=-1,f=n.length,d=Array(f+u),$=this&&this!==Tt&&this instanceof a?o:e;++l<f;)d[l]=n[l];for(;u--;)d[l++]=arguments[++s];return ul($,i?r:this,d)}return a}var fE=cE,Vc="__lodash_placeholder__",Is=1,dE=2,pE=4,Fc=8,Ei=128,zc=256,hE=Math.min;function yE(e,t){var r=e[1],n=t[1],i=r|n,o=i<(Is|dE|Ei),a=n==Ei&&r==Fc||n==Ei&&r==zc&&e[7].length<=t[8]||n==(Ei|zc)&&t[7].length<=t[8]&&r==Fc;if(!(o||a))return e;n&Is&&(e[2]=t[2],i|=r&Is?0:pE);var s=t[3];if(s){var u=e[3];e[3]=u?kp(u,s,t[4]):s,e[4]=u?Fi(e[3],Vc):t[4]}return s=t[5],s&&(u=e[5],e[5]=u?jp(u,s,t[6]):s,e[6]=u?Fi(e[5],Vc):t[6]),s=t[7],s&&(e[7]=s),n&Ei&&(e[8]=e[8]==null?t[8]:hE(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}var gE=yE,mE="Expected a function",Kc=1,bE=2,$s=8,ks=16,js=32,qc=64,Gc=Math.max;function vE(e,t,r,n,i,o,a,s){var u=t&bE;if(!u&&typeof e!="function")throw new TypeError(mE);var l=n?n.length:0;if(l||(t&=~(js|qc),n=i=void 0),a=a===void 0?a:Gc(Uc(a),0),s=s===void 0?s:Uc(s),l-=i?i.length:0,t&qc){var f=n,d=i;n=i=void 0}var $=u?void 0:Cp(e),E=[e,t,r,n,i,f,d,o,a,s];if($&&gE(E,$),e=E[0],t=E[1],r=E[2],n=E[3],i=E[4],s=E[9]=E[9]===void 0?u?0:e.length:Gc(E[9]-l,0),!s&&t&($s|ks)&&(t&=~($s|ks)),!t||t==Kc)var T=$_(e,t,r);else t==$s||t==ks?T=uE(e,t,s):(t==js||t==(Kc|js))&&!i.length?T=fE(e,t,r,n):T=Vp.apply(void 0,E);var B=$?$p:Mp;return Lp(B(T,E),e,t)}var wE=vE;function _E(e,t,r){t=="__proto__"&&ha?ha(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var TE=_E;function EE(e,t){return e===t||e!==e&&t!==t}var pl=EE,OE=Object.prototype,xE=OE.hasOwnProperty;function AE(e,t,r){var n=e[t];(!(xE.call(e,t)&&pl(n,r))||r===void 0&&!(t in e))&&TE(e,t,r)}var SE=AE,Hc=Math.max;function IE(e,t,r){return t=Hc(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=Hc(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),ul(e,this,s)}}var Fp=IE;function $E(e,t){return fl(Fp(e,t,Qa),e+"")}var zp=$E,kE=9007199254740991;function jE(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=kE}var hl=jE;function NE(e){return e!=null&&hl(e.length)&&!Ip(e)}var Kp=NE,CE=Object.prototype;function UE(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||CE;return e===r}var PE=UE;function ME(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var RE=ME,LE="[object Arguments]";function DE(e){return zr(e)&&li(e)==LE}var Wc=DE,qp=Object.prototype,BE=qp.hasOwnProperty,VE=qp.propertyIsEnumerable,FE=Wc(function(){return arguments}())?Wc:function(e){return zr(e)&&BE.call(e,"callee")&&!VE.call(e,"callee")},yl=FE;function zE(){return!1}var KE=zE,Gp=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Jc=Gp&&typeof module=="object"&&module&&!module.nodeType&&module,qE=Jc&&Jc.exports===Gp,Qc=qE?Tt.Buffer:void 0,GE=Qc?Qc.isBuffer:void 0,HE=GE||KE,au=HE,WE="[object Arguments]",JE="[object Array]",QE="[object Boolean]",YE="[object Date]",XE="[object Error]",ZE="[object Function]",e2="[object Map]",t2="[object Number]",r2="[object Object]",n2="[object RegExp]",i2="[object Set]",o2="[object String]",a2="[object WeakMap]",s2="[object ArrayBuffer]",u2="[object DataView]",l2="[object Float32Array]",c2="[object Float64Array]",f2="[object Int8Array]",d2="[object Int16Array]",p2="[object Int32Array]",h2="[object Uint8Array]",y2="[object Uint8ClampedArray]",g2="[object Uint16Array]",m2="[object Uint32Array]",Le={};Le[l2]=Le[c2]=Le[f2]=Le[d2]=Le[p2]=Le[h2]=Le[y2]=Le[g2]=Le[m2]=!0;Le[WE]=Le[JE]=Le[s2]=Le[QE]=Le[u2]=Le[YE]=Le[XE]=Le[ZE]=Le[e2]=Le[t2]=Le[r2]=Le[n2]=Le[i2]=Le[o2]=Le[a2]=!1;function b2(e){return zr(e)&&hl(e.length)&&!!Le[li(e)]}var v2=b2;function w2(e){return function(t){return e(t)}}var Hp=w2,Wp=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ci=Wp&&typeof module=="object"&&module&&!module.nodeType&&module,_2=Ci&&Ci.exports===Wp,Ns=_2&&Op.process,T2=function(){try{var e=Ci&&Ci.require&&Ci.require("util").types;return e||Ns&&Ns.binding&&Ns.binding("util")}catch{}}(),Yc=T2,Xc=Yc&&Yc.isTypedArray,E2=Xc?Hp(Xc):v2,Jp=E2,O2=Object.prototype,x2=O2.hasOwnProperty;function A2(e,t){var r=Zt(e),n=!r&&yl(e),i=!r&&!n&&au(e),o=!r&&!n&&!i&&Jp(e),a=r||n||i||o,s=a?RE(e.length,String):[],u=s.length;for(var l in e)(t||x2.call(e,l))&&!(a&&(l=="length"||i&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||Ya(l,u)))&&s.push(l);return s}var S2=A2;function I2(e,t){return function(r){return e(t(r))}}var $2=I2,k2=$2(Object.keys,Object),j2=k2,N2=Object.prototype,C2=N2.hasOwnProperty;function U2(e){if(!PE(e))return j2(e);var t=[];for(var r in Object(e))C2.call(e,r)&&r!="constructor"&&t.push(r);return t}var P2=U2;function M2(e){return Kp(e)?S2(e):P2(e)}var Qp=M2,R2=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,L2=/^\w*$/;function D2(e,t){if(Zt(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Fn(e)?!0:L2.test(e)||!R2.test(e)||t!=null&&e in Object(t)}var gl=D2,B2=On(Object,"create"),zi=B2;function V2(){this.__data__=zi?zi(null):{},this.size=0}var F2=V2;function z2(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var K2=z2,q2="__lodash_hash_undefined__",G2=Object.prototype,H2=G2.hasOwnProperty;function W2(e){var t=this.__data__;if(zi){var r=t[e];return r===q2?void 0:r}return H2.call(t,e)?t[e]:void 0}var J2=W2,Q2=Object.prototype,Y2=Q2.hasOwnProperty;function X2(e){var t=this.__data__;return zi?t[e]!==void 0:Y2.call(t,e)}var Z2=X2,eO="__lodash_hash_undefined__";function tO(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=zi&&t===void 0?eO:t,this}var rO=tO;function ci(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])}}ci.prototype.clear=F2;ci.prototype.delete=K2;ci.prototype.get=J2;ci.prototype.has=Z2;ci.prototype.set=rO;var Zc=ci;function nO(){this.__data__=[],this.size=0}var iO=nO;function oO(e,t){for(var r=e.length;r--;)if(pl(e[r][0],t))return r;return-1}var Xa=oO,aO=Array.prototype,sO=aO.splice;function uO(e){var t=this.__data__,r=Xa(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():sO.call(t,r,1),--this.size,!0}var lO=uO;function cO(e){var t=this.__data__,r=Xa(t,e);return r<0?void 0:t[r][1]}var fO=cO;function dO(e){return Xa(this.__data__,e)>-1}var pO=dO;function hO(e,t){var r=this.__data__,n=Xa(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var yO=hO;function fi(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])}}fi.prototype.clear=iO;fi.prototype.delete=lO;fi.prototype.get=fO;fi.prototype.has=pO;fi.prototype.set=yO;var Za=fi,gO=On(Tt,"Map"),Ki=gO;function mO(){this.size=0,this.__data__={hash:new Zc,map:new(Ki||Za),string:new Zc}}var bO=mO;function vO(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var wO=vO;function _O(e,t){var r=e.__data__;return wO(t)?r[typeof t=="string"?"string":"hash"]:r.map}var es=_O;function TO(e){var t=es(this,e).delete(e);return this.size-=t?1:0,t}var EO=TO;function OO(e){return es(this,e).get(e)}var xO=OO;function AO(e){return es(this,e).has(e)}var SO=AO;function IO(e,t){var r=es(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var $O=IO;function di(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])}}di.prototype.clear=bO;di.prototype.delete=EO;di.prototype.get=xO;di.prototype.has=SO;di.prototype.set=$O;var ts=di,kO="Expected a function";function ml(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(kO);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(ml.Cache||ts),r}ml.Cache=ts;var jO=ml,NO=500;function CO(e){var t=jO(e,function(n){return r.size===NO&&r.clear(),n}),r=t.cache;return t}var UO=CO,PO=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,MO=/\\(\\)?/g,RO=UO(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(PO,function(r,n,i,o){t.push(i?o.replace(MO,"$1"):n||r)}),t}),LO=RO;function DO(e){return e==null?"":U1(e)}var BO=DO;function VO(e,t){return Zt(e)?e:gl(e,t)?[e]:LO(BO(e))}var rs=VO,FO=1/0;function zO(e){if(typeof e=="string"||Fn(e))return e;var t=e+"";return t=="0"&&1/e==-FO?"-0":t}var co=zO;function KO(e,t){t=rs(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[co(t[r++])];return r&&r==n?e:void 0}var bl=KO;function qO(e,t,r){var n=e==null?void 0:bl(e,t);return n===void 0?r:n}var GO=qO;function HO(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var Yp=HO,ef=sr?sr.isConcatSpreadable:void 0;function WO(e){return Zt(e)||yl(e)||!!(ef&&e&&e[ef])}var JO=WO;function Xp(e,t,r,n,i){var o=-1,a=e.length;for(r||(r=JO),i||(i=[]);++o<a;){var s=e[o];t>0&&r(s)?t>1?Xp(s,t-1,r,n,i):Yp(i,s):n||(i[i.length]=s)}return i}var QO=Xp;function YO(e){var t=e==null?0:e.length;return t?QO(e,1):[]}var XO=YO;function ZO(e){return fl(Fp(e,void 0,XO),e+"")}var ex=ZO;function tx(){this.__data__=new Za,this.size=0}var rx=tx;function nx(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var ix=nx;function ox(e){return this.__data__.get(e)}var ax=ox;function sx(e){return this.__data__.has(e)}var ux=sx,lx=200;function cx(e,t){var r=this.__data__;if(r instanceof Za){var n=r.__data__;if(!Ki||n.length<lx-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new ts(n)}return r.set(e,t),this.size=r.size,this}var fx=cx;function pi(e){var t=this.__data__=new Za(e);this.size=t.size}pi.prototype.clear=rx;pi.prototype.delete=ix;pi.prototype.get=ax;pi.prototype.has=ux;pi.prototype.set=fx;var Co=pi;function dx(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 px=dx;function hx(){return[]}var yx=hx,gx=Object.prototype,mx=gx.propertyIsEnumerable,tf=Object.getOwnPropertySymbols,bx=tf?function(e){return e==null?[]:(e=Object(e),px(tf(e),function(t){return mx.call(e,t)}))}:yx,vx=bx;function wx(e,t,r){var n=t(e);return Zt(e)?n:Yp(n,r(e))}var _x=wx;function Tx(e){return _x(e,Qp,vx)}var rf=Tx,Ex=On(Tt,"DataView"),su=Ex,Ox=On(Tt,"Promise"),uu=Ox,xx=On(Tt,"Set"),Ln=xx,nf="[object Map]",Ax="[object Object]",of="[object Promise]",af="[object Set]",sf="[object WeakMap]",uf="[object DataView]",Sx=En(su),Ix=En(Ki),$x=En(uu),kx=En(Ln),jx=En(Bi),rn=li;(su&&rn(new su(new ArrayBuffer(1)))!=uf||Ki&&rn(new Ki)!=nf||uu&&rn(uu.resolve())!=of||Ln&&rn(new Ln)!=af||Bi&&rn(new Bi)!=sf)&&(rn=function(e){var t=li(e),r=t==Ax?e.constructor:void 0,n=r?En(r):"";if(n)switch(n){case Sx:return uf;case Ix:return nf;case $x:return of;case kx:return af;case jx:return sf}return t});var lf=rn,Nx=Tt.Uint8Array,cf=Nx,Cx="__lodash_hash_undefined__";function Ux(e){return this.__data__.set(e,Cx),this}var Px=Ux;function Mx(e){return this.__data__.has(e)}var Rx=Mx;function ya(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new ts;++t<r;)this.add(e[t])}ya.prototype.add=ya.prototype.push=Px;ya.prototype.has=Rx;var Zp=ya;function Lx(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 Dx=Lx;function Bx(e,t){return e.has(t)}var eh=Bx,Vx=1,Fx=2;function zx(e,t,r,n,i,o){var a=r&Vx,s=e.length,u=t.length;if(s!=u&&!(a&&u>s))return!1;var l=o.get(e),f=o.get(t);if(l&&f)return l==t&&f==e;var d=-1,$=!0,E=r&Fx?new Zp:void 0;for(o.set(e,t),o.set(t,e);++d<s;){var T=e[d],B=t[d];if(n)var W=a?n(B,T,d,t,e,o):n(T,B,d,e,t,o);if(W!==void 0){if(W)continue;$=!1;break}if(E){if(!Dx(t,function(R,k){if(!eh(E,k)&&(T===R||i(T,R,r,n,o)))return E.push(k)})){$=!1;break}}else if(!(T===B||i(T,B,r,n,o))){$=!1;break}}return o.delete(e),o.delete(t),$}var th=zx;function Kx(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var qx=Kx;function Gx(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var rh=Gx,Hx=1,Wx=2,Jx="[object Boolean]",Qx="[object Date]",Yx="[object Error]",Xx="[object Map]",Zx="[object Number]",eA="[object RegExp]",tA="[object Set]",rA="[object String]",nA="[object Symbol]",iA="[object ArrayBuffer]",oA="[object DataView]",ff=sr?sr.prototype:void 0,Cs=ff?ff.valueOf:void 0;function aA(e,t,r,n,i,o,a){switch(r){case oA:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case iA:return!(e.byteLength!=t.byteLength||!o(new cf(e),new cf(t)));case Jx:case Qx:case Zx:return pl(+e,+t);case Yx:return e.name==t.name&&e.message==t.message;case eA:case rA:return e==t+"";case Xx:var s=qx;case tA:var u=n&Hx;if(s||(s=rh),e.size!=t.size&&!u)return!1;var l=a.get(e);if(l)return l==t;n|=Wx,a.set(e,t);var f=th(s(e),s(t),n,i,o,a);return a.delete(e),f;case nA:if(Cs)return Cs.call(e)==Cs.call(t)}return!1}var sA=aA,uA=1,lA=Object.prototype,cA=lA.hasOwnProperty;function fA(e,t,r,n,i,o){var a=r&uA,s=rf(e),u=s.length,l=rf(t),f=l.length;if(u!=f&&!a)return!1;for(var d=u;d--;){var $=s[d];if(!(a?$ in t:cA.call(t,$)))return!1}var E=o.get(e),T=o.get(t);if(E&&T)return E==t&&T==e;var B=!0;o.set(e,t),o.set(t,e);for(var W=a;++d<u;){$=s[d];var R=e[$],k=t[$];if(n)var F=a?n(k,R,$,t,e,o):n(R,k,$,e,t,o);if(!(F===void 0?R===k||i(R,k,r,n,o):F)){B=!1;break}W||(W=$=="constructor")}if(B&&!W){var q=e.constructor,L=t.constructor;q!=L&&"constructor"in e&&"constructor"in t&&!(typeof q=="function"&&q instanceof q&&typeof L=="function"&&L instanceof L)&&(B=!1)}return o.delete(e),o.delete(t),B}var dA=fA,pA=1,df="[object Arguments]",pf="[object Array]",xo="[object Object]",hA=Object.prototype,hf=hA.hasOwnProperty;function yA(e,t,r,n,i,o){var a=Zt(e),s=Zt(t),u=a?pf:lf(e),l=s?pf:lf(t);u=u==df?xo:u,l=l==df?xo:l;var f=u==xo,d=l==xo,$=u==l;if($&&au(e)){if(!au(t))return!1;a=!0,f=!1}if($&&!f)return o||(o=new Co),a||Jp(e)?th(e,t,r,n,i,o):sA(e,t,u,r,n,i,o);if(!(r&pA)){var E=f&&hf.call(e,"__wrapped__"),T=d&&hf.call(t,"__wrapped__");if(E||T){var B=E?e.value():e,W=T?t.value():t;return o||(o=new Co),i(B,W,r,n,o)}}return $?(o||(o=new Co),dA(e,t,r,n,i,o)):!1}var gA=yA;function nh(e,t,r,n,i){return e===t?!0:e==null||t==null||!zr(e)&&!zr(t)?e!==e&&t!==t:gA(e,t,r,n,nh,i)}var ih=nh,mA=1,bA=2;function vA(e,t,r,n){var i=r.length,o=i,a=!n;if(e==null)return!o;for(e=Object(e);i--;){var s=r[i];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){s=r[i];var u=s[0],l=e[u],f=s[1];if(a&&s[2]){if(l===void 0&&!(u in e))return!1}else{var d=new Co;if(n)var $=n(l,f,u,e,t,d);if(!($===void 0?ih(f,l,mA|bA,n,d):$))return!1}}return!0}var wA=vA;function _A(e){return e===e&&!vr(e)}var oh=_A;function TA(e){for(var t=Qp(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,oh(i)]}return t}var EA=TA;function OA(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var ah=OA;function xA(e){var t=EA(e);return t.length==1&&t[0][2]?ah(t[0][0],t[0][1]):function(r){return r===e||wA(r,e,t)}}var AA=xA;function SA(e,t){return e!=null&&t in Object(e)}var IA=SA;function $A(e,t,r){t=rs(t,e);for(var n=-1,i=t.length,o=!1;++n<i;){var a=co(t[n]);if(!(o=e!=null&&r(e,a)))break;e=e[a]}return o||++n!=i?o:(i=e==null?0:e.length,!!i&&hl(i)&&Ya(a,i)&&(Zt(e)||yl(e)))}var kA=$A;function jA(e,t){return e!=null&&kA(e,t,IA)}var sh=jA,NA=1,CA=2;function UA(e,t){return gl(e)&&oh(t)?ah(co(e),t):function(r){var n=GO(r,e);return n===void 0&&n===t?sh(r,e):ih(t,n,NA|CA)}}var PA=UA;function MA(e){return function(t){return t?.[e]}}var RA=MA;function LA(e){return function(t){return bl(t,e)}}var DA=LA;function BA(e){return gl(e)?RA(co(e)):DA(e)}var VA=BA;function FA(e){return typeof e=="function"?e:e==null?Qa:typeof e=="object"?Zt(e)?PA(e[0],e[1]):AA(e):VA(e)}var zA=FA;function KA(e){return zr(e)&&Kp(e)}var qA=KA;function GA(e,t,r){for(var n=-1,i=e==null?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}var HA=GA,WA=200;function JA(e,t,r,n){var i=-1,o=Rp,a=!0,s=e.length,u=[],l=t.length;if(!s)return u;r&&(t=Ap(t,Hp(r))),n?(o=HA,a=!1):t.length>=WA&&(o=eh,a=!1,t=new Zp(t));e:for(;++i<s;){var f=e[i],d=r==null?f:r(f);if(f=n||f!==0?f:0,a&&d===d){for(var $=l;$--;)if(t[$]===d)continue e;u.push(f)}else o(t,d,n)||u.push(f)}return u}var QA=JA;function YA(e,t,r,n){if(!vr(e))return e;t=rs(t,e);for(var i=-1,o=t.length,a=o-1,s=e;s!=null&&++i<o;){var u=co(t[i]),l=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return e;if(i!=a){var f=s[u];l=n?n(f,u,s):void 0,l===void 0&&(l=vr(f)?f:Ya(t[i+1])?[]:{})}SE(s,u,l),s=s[u]}return e}var XA=YA;function ZA(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var a=t[n],s=bl(e,a);r(s,a)&&XA(o,rs(a,e),s)}return o}var eS=ZA,tS=32,vl=zp(function(e,t){var r=Fi(t,dl(vl));return wE(e,tS,void 0,t,r)});vl.placeholder={};var rS=vl;function nS(e,t){return eS(e,t,function(r,n){return sh(e,n)})}var iS=nS,oS=ex(function(e,t){return e==null?{}:iS(e,t)}),yf=oS,aS=4294967295,sS=aS-1,uS=Math.floor,lS=Math.min;function cS(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=Fn(t),l=t===void 0;i<o;){var f=uS((i+o)/2),d=r(e[f]),$=d!==void 0,E=d===null,T=d===d,B=Fn(d);if(a)var W=n||T;else l?W=T&&(n||$):s?W=T&&$&&(n||!E):u?W=T&&$&&!E&&(n||!B):E||B?W=!1:W=n?d<=t:d<t;W?i=f+1:o=f}return lS(o,sS)}var fS=cS;function dS(e,t,r){return fS(e,t,zA(r,2))}var pS=dS,hS=1/0,KN=Ln&&1/rh(new Ln([,-0]))[1]==hS?function(e){return new Ln(e)}:Np,yS=zp(function(e,t){return qA(e)?QA(e,t):[]}),gf=yS,uh=Or(o1(),1),qN=uh.default.configure,qi=uh.default,Us=100,{WARN:gS,LOG:GN,DEBUG:Xe,VERBOSE:Ee,ERROR:HN}=Ae.setup(Ae.INFO),ga=Be.set();Nw({enforceActions:"always"});if(!new class{xyz}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");var We=({caller:e,thread:t,pattern:r,args:n})=>De(()=>(n=n||r,`${!Array.isArray(t)&&t?.name?t.name+" | ":""}${e??"caller?"}${n?`{${typeof n=="string"?n:qi(n)}}`:""}`));function mS(e,t){return De(()=>Je.structural(e.get(),t.get()))}function fo(e,t){return Je.shallow(e.applogs,t.applogs)}function wl(e,t){if(e.size!==t.size)return!1;for(let r=0;r<e.size;r++){let n=e.nodes[r],i=t.nodes[r];if(Ee.isEnabled&&Ee("queryNodesComparer",r,n,i),!Je.structural(n.variables,i.variables))return Ee.isEnabled&&Ee("[queryNodesComparer] changed vars:",r,n,i),!1;if(!fo(n.logsOfThisNode,i.logsOfThisNode))return Ee.isEnabled&&Ee("[queryNodesComparer] changed logsOfThisNode:",r,n,i),!1}return Ee.isEnabled&&Ee("[queryNodesComparer] equal:",{a:e,b:t}),!0}var bS=0;function Ht(e,{name:t,equals:r}={}){let n=`observableArrayMap@${++bS}{${t}}`;Ee.isEnabled&&Ee(`[${n}] create`,{fnname:e.name,fn:e,name:t,equals:r});let i,o=lh(e,s=>{i?De(()=>(r??Je.structural)(i,s))?Xe.isEnabled&&Xe(`[${n}] update skipped`,{updatedItems:s,observableArr:i}):(i.replace(s),Xe.isEnabled&&Xe(`[${n}] updated`,{updatedItems:s,observableArr:i})):i=Be.array(s,{deep:!1,name:t,equals:r})},{name:n});if(n.includes("useRoots")){var a=Xt(i);Xe(`[${n}] deps`,{disposeAutorun:o,rootsAtom:a,observableArr:i,observers:oa(i)}),Li(()=>ga.add(a))}return Ee.isEnabled&&Ga(i,()=>{Ee(`[${n}] observed`,oa(i),{rootsAtom:a,observableArr:i})}),ii(i,()=>{Ee.isEnabled&&Ee(`[${n}] dispose`),a&&Li(()=>ga.delete(a)),o()}),i}var vS=0;function wS(e,{name:t}={}){let r=`observableSetMap@${++vS}{${t}}`;Ee.isEnabled&&Ee(`[${r}] create`,{fnname:e.name,fn:e,name:t});let n,i=lh(e,a=>{if(!n)n=Be.set(a,{deep:!1,name:t});else{let{deleted:s,added:u}=De(()=>{let l=new Set(n.values()),f=new Set;for(let d of a)n.has(d)?(Ee.isEnabled&&Ee(`[${r}] unchanged`,d,{updatedItems:a,observableSet:n}),l.delete(d)):f.add(d);return Xe.isEnabled&&Xe(`[${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=Xt(n);Xe.isEnabled&&Xe(`[${r}] deps`,{disposeAutorun:i,rootsAtom:o,observableSet:n,observers:oa(n)}),Li(()=>ga.add(o))}return Ee.isEnabled&&Ga(n,()=>{Ee(`[${r}] observed`,oa(n),{rootsAtom:o,observableSet:n})}),ii(n,()=>{Ee.isEnabled&&Ee(`[${r}] dispose`),o&&Li(()=>ga.delete(o)),i()}),n}function lh(e,t=null,{name:r}={}){Xe.isEnabled&&Xe("[autorunButAlsoImmediately] create",{fnname:e.name,fn:e,name:r});let n=`${r}.autorunImm`,i,o=new ar(n,function(...s){Xe.isEnabled&&Xe(`[${n}] reaction.invalidate`,s),a()});function a(){o.track(function(){let s=Us&&performance.now();Xe.isEnabled&&Xe(`[${n}] runAndTrack:`,{name:r??e.name,fn:e}),i=e(),Xe.isEnabled&&Xe(`[${n}] runAndTrack =>`,i),Li(()=>{t?.(i)}),Us&&performance.now()-s>Us&&gS(`[${n}] took ${performance.now()-s}ms`)})}return a(),Xe.isEnabled&&Xe(`[${n}] deps of reaction`,{reaction:o,result:i,deps:Ha(o)}),()=>{Ee.isEnabled&&Ee(`[${n}] dispose`),setTimeout(()=>o.dispose())}}function tt(e,t,r=!1){if(un(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=De(()=>{let E=s;for(let T=0;T<s.length;T++)s[T]instanceof zn&&s===E&&(E=s.slice());return E}),f=`computedFnDeepCompare(${e||t.name}#${++i})${o.argsDebugName?`{${o.argsDebugName(...s)}}`:""}`;for(let[E,T]of a.entries())if(TS(E,l)){u=T;break}else if(Ee.isEnabled)for(let B=0;B<E.length;B++)E[B]instanceof zn&&E[B].name===s[B].name&&Je.structural(gf(E,E[B]),gf(l,l[B]))&&Ee.force(`[${f}] threadState mismatch => cachebust`,{diffFields:Object.keys(E[B]).filter(W=>!Je.structural(E[B][W],s[B][W])),cacheArg:E[B],freshArg:s[B]});if(u){let E=u.get();return Ee.isEnabled&&Ee(`[${f}] cache hit`,{untrackedArgs:l,cachedResult:E}),E}if(!o.keepAlive&&!aw())return!n&&fw().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);Ee.isEnabled&&Ee(`[${f}] new computation`,{untrackedArgs:l});let d,$=He(()=>(Ee.isEnabled&&Ee(`[${f}] update->rerun`,De(()=>({args:s})),t),Ee.isEnabled&&cp(),d=t.apply(this,s)),{...o,name:f});if(Ee.isEnabled&&Ee(`[${f}] deps`,Ha($),{untrackedArgs:l}),a.set(l,$),!o.keepAlive){let E=ii($,()=>{Ee.isEnabled&&Ee(`[${f}] dispose`,$),E(),a.delete(l),o.onCleanup&&o.onCleanup(d,...s),d=void 0})}return $.get()}}function _S(e){let t=0,r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("?r+=o+`
|
|
57
|
+
`+" ".repeat(++t):o===")"?r+=`
|
|
58
|
+
`+" ".repeat(--t)+o:o===","&&n===0?r+=o+`
|
|
59
|
+
`+" ".repeat(t):o==="{"&&n===0?(n++,r+=o+`
|
|
60
|
+
`+" ".repeat(t+1)):o==="}"&&n===1?(n--,r+=`
|
|
61
|
+
`+" ".repeat(t)+o):o==="{"&&n>0?(n++,r+=o):(o==="}"&&n>1&&n--,r+=o)}return r}function TS(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]instanceof zn){if(t[r]!==e[r])return!1}else if(!Je.structural(e[r],t[r]))return!1;return!0}var{WARN:mf,LOG:WN,DEBUG:ES,VERBOSE:JN,ERROR:en}=Ae.setup(Ae.INFO,{prefix:"[thread]"});function Kr(e){return e.init!==void 0}var zn=class{constructor(e,t,r,n=[],i={}){this.name=e,this._applogs=n,this.parents=t===null?null:Xo(t),this.filters=r,De(()=>this.parents?.length===0)&&mf("[Thread] empty parents array",e),i.skipObservable||oi(this,{applogsCids:He,applogsByCid:He,insert:Ct,size:He,isEmpty:He,firstLog:He,latestLog:He},{name:`Thread{${e}}`})}filters;parents;_subscribers=[];get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}insert(e){if(this.readOnly)throw en("[Thread] insert() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw en("[Thread] insert() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw en("[Thread] insert() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insert(e)}insertRaw(e){if(this.readOnly)throw en("[Thread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw en("[Thread] insertRaw() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw en("[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):mf("unsubscribe called for non-existent",e)}notifySubscribers(e){ES(`[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 en("[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 De(()=>this.size)}get nameAndSizeUntracked(){return De(()=>`${this.name} (${this.size})`)}get prettyName(){return _S(this.name)}get hasParents(){return!!this.parents?.length}},OS=class ch extends zn{static fromArray(t,r){return new ch(r||"static",null,[],t)}constructor(t,r,n,i){super(t,r,n,i,{skipObservable:!0})}get readOnly(){return!0}},xS={};Id(xS,{code:()=>Nh,decode:()=>Cl,encode:()=>Nl,format:()=>If,name:()=>R$,parse:()=>D$,stringify:()=>If});var AS=["Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function SS(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return t==="string"||t==="number"||t==="bigint"||t==="symbol"?t:t==="function"?"Function":Array.isArray(e)?"Array":e instanceof Uint8Array?"Uint8Array":e.constructor===Object?"Object":IS(e)||"Object"}function IS(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(AS.includes(t))return t}var I=class{constructor(e,t,r){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=r}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}static equals(e,t){return e===t||e.major===t.major&&e.name===t.name}};I.uint=new I(0,"uint",!0);I.negint=new I(1,"negint",!0);I.bytes=new I(2,"bytes",!0);I.string=new I(3,"string",!0);I.array=new I(4,"array",!1);I.map=new I(5,"map",!1);I.tag=new I(6,"tag",!1);I.float=new I(7,"float",!0);I.false=new I(7,"false",!0);I.true=new I(7,"true",!0);I.null=new I(7,"null",!0);I.undefined=new I(7,"undefined",!0);I.break=new I(7,"break",!0);var ne=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}`}},po=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",$S=new TextEncoder;function ma(e){return po&&globalThis.Buffer.isBuffer(e)}function ns(e){return e instanceof Uint8Array?ma(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var kS=24,jS=200,fh=po?e=>e.length>=kS?globalThis.Buffer.from(e):bf(e):e=>e.length>=jS?$S.encode(e):bf(e),pr=e=>Uint8Array.from(e),NS=po?(e,t,r)=>ma(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),CS=po?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),ns(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},US=po?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function dh(e,t){if(ma(e)&&ma(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 bf(e){let t=[],r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=i&63|128):(i&64512)===55296&&n+1<e.length&&(e.charCodeAt(n+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++n)&1023),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=i&63|128):(i>=55296&&i<=57343&&(i=65533),t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}var vf=4096;function PS(e){let t=e.length;if(t<=vf)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=vf));return r}var MS=256,ph=class{constructor(e=MS){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=US(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=NS(r,0,this.cursor)}else t=CS(this.chunks,this.cursor);return e&&this.reset(),t}},RS=class{constructor(e){this.dest=e,this.cursor=0,this.chunks=[e]}reset(){this.cursor=0}push(e){if(this.cursor+e.length>this.dest.length)throw new Error("write out of bounds, destination buffer is too small");this.dest.set(e,this.cursor),this.cursor+=e.length}toBytes(e=!1){let t=this.dest.subarray(0,this.cursor);return e&&this.reset(),t}},be="CBOR decode error:",on="CBOR encode error:",ho=[];ho[23]=1;ho[24]=2;ho[25]=3;ho[26]=5;ho[27]=9;function hi(e,t,r){if(e.length-t<r)throw new Error(`${be} not enough data for type`)}var it=[24,256,65536,4294967296,BigInt("18446744073709551616")];function xn(e,t,r){hi(e,t,1);let n=e[t];if(r.strict===!0&&n<it[0])throw new Error(`${be} integer encoded in more bytes than necessary (strict decode)`);return n}function An(e,t,r){hi(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<it[1])throw new Error(`${be} integer encoded in more bytes than necessary (strict decode)`);return n}function Sn(e,t,r){hi(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<it[2])throw new Error(`${be} integer encoded in more bytes than necessary (strict decode)`);return n}function In(e,t,r){hi(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<it[3])throw new Error(`${be} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${be} integers outside of the safe integer range are not supported`)}function LS(e,t,r,n){return new ne(I.uint,xn(e,t+1,n),2)}function DS(e,t,r,n){return new ne(I.uint,An(e,t+1,n),3)}function BS(e,t,r,n){return new ne(I.uint,Sn(e,t+1,n),5)}function VS(e,t,r,n){return new ne(I.uint,In(e,t+1,n),9)}function $n(e,t){return Vt(e,0,t.value)}function Vt(e,t,r){if(r<it[0]){let n=Number(r);e.push([t|n])}else if(r<it[1]){let n=Number(r);e.push([t|24,n])}else if(r<it[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<it[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<it[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),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(`${be} encountered BigInt larger than allowable range`)}}$n.encodedSize=function(e){return Vt.encodedSize(e.value)};Vt.encodedSize=function(e){return e<it[0]?1:e<it[1]?2:e<it[2]?3:e<it[3]?5:9};$n.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function FS(e,t,r,n){return new ne(I.negint,-1-xn(e,t+1,n),2)}function zS(e,t,r,n){return new ne(I.negint,-1-An(e,t+1,n),3)}function KS(e,t,r,n){return new ne(I.negint,-1-Sn(e,t+1,n),5)}var _l=BigInt(-1),hh=BigInt(1);function qS(e,t,r,n){let i=In(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ne(I.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${be} integers outside of the safe integer range are not supported`);return new ne(I.negint,_l-BigInt(i),9)}function Tl(e,t){let r=t.value,n=typeof r=="bigint"?r*_l-hh:r*-1-1;Vt(e,t.type.majorEncoded,n)}Tl.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*_l-hh:t*-1-1;return r<it[0]?1:r<it[1]?2:r<it[2]?3:r<it[3]?5:9};Tl.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function yo(e,t,r,n){hi(e,t,r+n);let i=e.slice(t+r,t+r+n);return new ne(I.bytes,i,r+n)}function GS(e,t,r,n){return yo(e,t,1,r)}function HS(e,t,r,n){return yo(e,t,2,xn(e,t+1,n))}function WS(e,t,r,n){return yo(e,t,3,An(e,t+1,n))}function JS(e,t,r,n){return yo(e,t,5,Sn(e,t+1,n))}function QS(e,t,r,n){let i=In(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer bytes lengths not supported`);return yo(e,t,9,i)}function ba(e){return e.encodedBytes===void 0&&(e.encodedBytes=I.equals(e.type,I.string)?fh(e.value):e.value),e.encodedBytes}function is(e,t){let r=ba(t);Vt(e,t.type.majorEncoded,r.length),e.push(r)}is.encodedSize=function(e){let t=ba(e);return Vt.encodedSize(t.length)+t.length};is.compareTokens=function(e,t){return YS(ba(e),ba(t))};function YS(e,t){return e.length<t.length?-1:e.length>t.length?1:dh(e,t)}var wf=new TextDecoder,XS=32;function ZS(e,t,r){if(r-t<XS){let n="";for(let i=t;i<r;i++){let o=e[i];if(o&128)return wf.decode(e.subarray(t,r));n+=String.fromCharCode(o)}return n}return wf.decode(e.subarray(t,r))}function go(e,t,r,n,i){let o=r+n;hi(e,t,o);let a=new ne(I.string,ZS(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=e.slice(t+r,t+o)),a}function eI(e,t,r,n){return go(e,t,1,r,n)}function tI(e,t,r,n){return go(e,t,2,xn(e,t+1,n),n)}function rI(e,t,r,n){return go(e,t,3,An(e,t+1,n),n)}function nI(e,t,r,n){return go(e,t,5,Sn(e,t+1,n),n)}function iI(e,t,r,n){let i=In(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer string lengths not supported`);return go(e,t,9,i,n)}var oI=is;function yi(e,t,r,n){return new ne(I.array,n,r)}function aI(e,t,r,n){return yi(e,t,1,r)}function sI(e,t,r,n){return yi(e,t,2,xn(e,t+1,n))}function uI(e,t,r,n){return yi(e,t,3,An(e,t+1,n))}function lI(e,t,r,n){return yi(e,t,5,Sn(e,t+1,n))}function cI(e,t,r,n){let i=In(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer array lengths not supported`);return yi(e,t,9,i)}function fI(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${be} indefinite length items not allowed`);return yi(e,t,1,1/0)}function El(e,t){Vt(e,I.array.majorEncoded,t.value)}El.compareTokens=$n.compareTokens;El.encodedSize=function(e){return Vt.encodedSize(e.value)};function gi(e,t,r,n){return new ne(I.map,n,r)}function dI(e,t,r,n){return gi(e,t,1,r)}function pI(e,t,r,n){return gi(e,t,2,xn(e,t+1,n))}function hI(e,t,r,n){return gi(e,t,3,An(e,t+1,n))}function yI(e,t,r,n){return gi(e,t,5,Sn(e,t+1,n))}function gI(e,t,r,n){let i=In(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer map lengths not supported`);return gi(e,t,9,i)}function mI(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${be} indefinite length items not allowed`);return gi(e,t,1,1/0)}function Ol(e,t){Vt(e,I.map.majorEncoded,t.value)}Ol.compareTokens=$n.compareTokens;Ol.encodedSize=function(e){return Vt.encodedSize(e.value)};function bI(e,t,r,n){return new ne(I.tag,r,1)}function vI(e,t,r,n){return new ne(I.tag,xn(e,t+1,n),2)}function wI(e,t,r,n){return new ne(I.tag,An(e,t+1,n),3)}function _I(e,t,r,n){return new ne(I.tag,Sn(e,t+1,n),5)}function TI(e,t,r,n){return new ne(I.tag,In(e,t+1,n),9)}function xl(e,t){Vt(e,I.tag.majorEncoded,t.value)}xl.compareTokens=$n.compareTokens;xl.encodedSize=function(e){return Vt.encodedSize(e.value)};var yh=20,gh=21,mh=22,bh=23;function EI(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${be} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ne(I.null,null,1):new ne(I.undefined,void 0,1)}function OI(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${be} indefinite length items not allowed`);return new ne(I.break,void 0,1)}function Al(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${be} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${be} Infinity values are not supported`)}return new ne(I.float,e,t)}function xI(e,t,r,n){return Al(Il(e,t+1),3,n)}function AI(e,t,r,n){return Al($l(e,t+1),5,n)}function SI(e,t,r,n){return Al(Th(e,t+1),9,n)}function Sl(e,t,r){let n=t.value;if(n===!1)e.push([I.float.majorEncoded|yh]);else if(n===!0)e.push([I.float.majorEncoded|gh]);else if(n===null)e.push([I.float.majorEncoded|mh]);else if(n===void 0)e.push([I.float.majorEncoded|bh]);else{let i,o=!1;(!r||r.float64!==!0)&&(wh(n),i=Il(qt,1),n===i||Number.isNaN(n)?(qt[0]=249,e.push(qt.slice(0,3)),o=!0):(_h(n),i=$l(qt,1),n===i&&(qt[0]=250,e.push(qt.slice(0,5)),o=!0))),o||(II(n),i=Th(qt,1),qt[0]=251,e.push(qt.slice(0,9)))}}Sl.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){wh(r);let n=Il(qt,1);if(r===n||Number.isNaN(r))return 3;if(_h(r),n=$l(qt,1),r===n)return 5}return 9};var vh=new ArrayBuffer(9),St=new DataView(vh,1),qt=new Uint8Array(vh,0);function wh(e){if(e===1/0)St.setUint16(0,31744,!1);else if(e===-1/0)St.setUint16(0,64512,!1);else if(Number.isNaN(e))St.setUint16(0,32256,!1);else{St.setFloat32(0,e);let t=St.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)St.setUint16(0,31744,!1);else if(r===0)St.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?St.setUint16(0,0):i<-14?St.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):St.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Il(e,t){if(e.length-t<2)throw new Error(`${be} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function _h(e){St.setFloat32(0,e,!1)}function $l(e,t){if(e.length-t<4)throw new Error(`${be} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function II(e){St.setFloat64(0,e,!1)}function Th(e,t){if(e.length-t<8)throw new Error(`${be} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Sl.compareTokens=$n.compareTokens;function Ne(e,t,r){throw new Error(`${be} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function os(e){return()=>{throw new Error(`${be} ${e}`)}}var le=[];for(let e=0;e<=23;e++)le[e]=Ne;le[24]=LS;le[25]=DS;le[26]=BS;le[27]=VS;le[28]=Ne;le[29]=Ne;le[30]=Ne;le[31]=Ne;for(let e=32;e<=55;e++)le[e]=Ne;le[56]=FS;le[57]=zS;le[58]=KS;le[59]=qS;le[60]=Ne;le[61]=Ne;le[62]=Ne;le[63]=Ne;for(let e=64;e<=87;e++)le[e]=GS;le[88]=HS;le[89]=WS;le[90]=JS;le[91]=QS;le[92]=Ne;le[93]=Ne;le[94]=Ne;le[95]=os("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)le[e]=eI;le[120]=tI;le[121]=rI;le[122]=nI;le[123]=iI;le[124]=Ne;le[125]=Ne;le[126]=Ne;le[127]=os("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)le[e]=aI;le[152]=sI;le[153]=uI;le[154]=lI;le[155]=cI;le[156]=Ne;le[157]=Ne;le[158]=Ne;le[159]=fI;for(let e=160;e<=183;e++)le[e]=dI;le[184]=pI;le[185]=hI;le[186]=yI;le[187]=gI;le[188]=Ne;le[189]=Ne;le[190]=Ne;le[191]=mI;for(let e=192;e<=215;e++)le[e]=bI;le[216]=vI;le[217]=wI;le[218]=_I;le[219]=TI;le[220]=Ne;le[221]=Ne;le[222]=Ne;le[223]=Ne;for(let e=224;e<=243;e++)le[e]=os("simple values are not supported");le[244]=Ne;le[245]=Ne;le[246]=Ne;le[247]=EI;le[248]=os("simple values are not supported");le[249]=xI;le[250]=AI;le[251]=SI;le[252]=Ne;le[253]=Ne;le[254]=Ne;le[255]=OI;var cr=[];for(let e=0;e<24;e++)cr[e]=new ne(I.uint,e,1);for(let e=-1;e>=-24;e--)cr[31-e]=new ne(I.negint,e,1);cr[64]=new ne(I.bytes,new Uint8Array(0),1);cr[96]=new ne(I.string,"",1);cr[128]=new ne(I.array,0,1);cr[160]=new ne(I.map,0,1);cr[244]=new ne(I.false,!1,1);cr[245]=new ne(I.true,!0,1);cr[246]=new ne(I.null,null,1);function $I(e){switch(e.type){case I.false:return pr([244]);case I.true:return pr([245]);case I.null:return pr([246]);case I.bytes:return e.value.length?void 0:pr([64]);case I.string:return e.value===""?pr([96]):void 0;case I.array:return e.value===0?pr([128]):void 0;case I.map:return e.value===0?pr([160]):void 0;case I.uint:return e.value<24?pr([Number(e.value)]):void 0;case I.negint:if(e.value>=-24)return pr([31-Number(e.value)])}}var kI=Object.freeze({float64:!0,mapSorter:UI,quickEncodeToken:$I});function Eh(){let e=[];return e[I.uint.major]=$n,e[I.negint.major]=Tl,e[I.bytes.major]=is,e[I.string.major]=oI,e[I.array.major]=El,e[I.map.major]=Ol,e[I.tag.major]=xl,e[I.float.major]=Sl,e}var jI=Eh(),NI=new ph,_f=class Oh{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(`${on} object contains circular references`);return new Oh(r,t)}},kr={null:new ne(I.null,null),undefined:new ne(I.undefined,void 0),true:new ne(I.true,!0),false:new ne(I.false,!1),emptyArray:new ne(I.array,0),emptyMap:new ne(I.map,0)},qr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ne(I.float,e):e>=0?new ne(I.uint,e):new ne(I.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ne(I.uint,e):new ne(I.negint,e)},Uint8Array(e,t,r,n){return new ne(I.bytes,e)},string(e,t,r,n){return new ne(I.string,e)},boolean(e,t,r,n){return e?kr.true:kr.false},null(e,t,r,n){return kr.null},undefined(e,t,r,n){return kr.undefined},ArrayBuffer(e,t,r,n){return new ne(I.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ne(I.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[kr.emptyArray,new ne(I.break)]:kr.emptyArray;n=_f.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=Uo(a,r,n);return r.addBreakTokens?[new ne(I.array,e.length),i,new ne(I.break)]:[new ne(I.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length,s;if(a){s=new Array(a),n=_f.createCheck(n,e);let u=!i&&r.ignoreUndefinedProperties,l=0;for(let f of o){let d=i?e.get(f):e[f];u&&d===void 0||(s[l++]=[Uo(f,r,n),Uo(d,r,n)])}l<a&&(s.length=l)}return s?.length?(CI(s,r),r.addBreakTokens?[new ne(I.map,s.length),s,new ne(I.break)]:[new ne(I.map,s.length),s]):r.addBreakTokens===!0?[kr.emptyMap,new ne(I.break)]:kr.emptyMap}};qr.Map=qr.Object;qr.Buffer=qr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))qr[`${e}Array`]=qr.DataView;function Uo(e,t={},r){let n=SS(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||qr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=qr[n];if(!o)throw new Error(`${on} unsupported type: ${n}`);return o(e,n,t,r)}function CI(e,t){t.mapSorter&&e.sort(t.mapSorter)}function UI(e,t){if(e[0]instanceof ne&&t[0]instanceof ne){let r=e[0],n=t[0];return r._keyBytes||(r._keyBytes=Tf(r.value)),n._keyBytes||(n._keyBytes=Tf(n.value)),dh(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function Tf(e){return Ah(e,jI,kI)}function xh(e,t,r,n){if(Array.isArray(t))for(let i of t)xh(e,i,r,n);else r[t.type.major](e,t,n)}var QN=I.uint.majorEncoded,YN=I.negint.majorEncoded,XN=I.bytes.majorEncoded,ZN=I.string.majorEncoded,eC=I.array.majorEncoded,tC=I.float.majorEncoded|yh,rC=I.float.majorEncoded|gh,nC=I.float.majorEncoded|mh,iC=I.float.majorEncoded|bh,oC=BigInt(-1),aC=BigInt(1);function Ah(e,t,r,n){let i=n instanceof Uint8Array,o=i?new RS(n):NI,a=Uo(e,r);if(!Array.isArray(a)&&r.quickEncodeToken){let s=r.quickEncodeToken(a);if(s)return i?(o.push(s),o.toBytes()):s;let u=t[a.type.major];if(u.encodedSize){let l=u.encodedSize(a,r);if(i||(o=new ph(l)),u(o,a,r),o.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${a} was wrong`);return i?o.toBytes():ns(o.chunks[0])}}return o.reset(),xh(o,a,t,r),o.toBytes(!0)}var PI={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},MI=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=cr[e];if(t===void 0){let r=le[e];if(!r)throw new Error(`${be} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let n=e&31;t=r(this.data,this._pos,n,this.options)}return this._pos+=t.encodedLength,t}},Gi=Symbol.for("DONE"),as=Symbol.for("BREAK");function RI(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=Hi(t,r);if(o===as){if(e.value===1/0)break;throw new Error(`${be} got unexpected break to lengthed array`)}if(o===Gi)throw new Error(`${be} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function LI(e,t,r){let n=r.useMaps===!0,i=r.rejectDuplicateMapKeys===!0,o=n?void 0:{},a=n?new Map:void 0;for(let s=0;s<e.value;s++){let u=Hi(t,r);if(u===as){if(e.value===1/0)break;throw new Error(`${be} got unexpected break to lengthed map`)}if(u===Gi)throw new Error(`${be} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(!n&&typeof u!="string")throw new Error(`${be} non-string keys not supported (got ${typeof u})`);if(i&&(n&&a.has(u)||!n&&Object.hasOwn(o,u)))throw new Error(`${be} found repeat map key "${u}"`);let l=Hi(t,r);if(l===Gi)throw new Error(`${be} found map but not enough entries (got ${s} [no value], expected ${e.value})`);n?a.set(u,l):o[u]=l}return n?a:o}function Hi(e,t){if(e.done())return Gi;let r=e.next();if(I.equals(r.type,I.break))return as;if(r.type.terminal)return r.value;if(I.equals(r.type,I.array))return RI(r,e,t);if(I.equals(r.type,I.map))return LI(r,e,t);if(I.equals(r.type,I.tag)){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Hi(e,t);return t.tags[r.value](n)}throw new Error(`${be} tag not supported (${r.value})`)}throw new Error("unsupported")}function DI(e,t){if(!(e instanceof Uint8Array))throw new Error(`${be} data to decode must be a Uint8Array`);t=Object.assign({},PI,t);let r=ns(e),n=t.tokenizer||new MI(r,t),i=Hi(n,t);if(i===Gi)throw new Error(`${be} did not find any content to decode`);if(i===as)throw new Error(`${be} got unexpected break`);return[i,e.subarray(n.pos())]}function BI(e,t){let[r,n]=DI(e,t);if(n.length>0)throw new Error(`${be} too many terminals, data makes no sense`);return r}var VI=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(I.equals(t.type,I.array)&&(t.elements++,t.elements!==1&&e.push([44])),I.equals(t.type,I.map)&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[I.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)}[I.negint.major](e,t){this[I.uint.major](e,t)}[I.bytes.major](e,t){throw new Error(`${on} unsupported type: Uint8Array`)}[I.string.major](e,t){this.prefix(e);let r=fh(JSON.stringify(t.value));e.push(r.length>32?ns(r):r)}[I.array.major](e,t){this.prefix(e),this.inRecursive.push({type:I.array,elements:0}),e.push([91])}[I.map.major](e,t){this.prefix(e),this.inRecursive.push({type:I.map,elements:0}),e.push([123])}[I.tag.major](e,t){}[I.float.major](e,t){if(t.type.name==="break"){let o=this.inRecursive.pop();if(o){if(I.equals(o.type,I.array))e.push([93]);else if(I.equals(o.type,I.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(`${on} 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 FI(e,t){if(Array.isArray(e[0])||Array.isArray(t[0]))throw new Error(`${on} complex map keys are not supported`);let r=e[0],n=t[0];if(r.type!==I.string||n.type!==I.string)throw new Error(`${on} non-string map keys are not supported`);if(r<n)return-1;if(r>n)return 1;throw new Error(`${on} unexpected duplicate map keys, this is not supported`)}var zI={addBreakTokens:!0,mapSorter:FI};function KI(e,t){return t=Object.assign({},zI,t),Ah(e,new VI,t)}var Sh=class{constructor(e,t={}){this._pos=0,this.data=e,this.options=t,this.modeStack=["value"],this.lastToken=""}pos(){return this._pos}done(){return this._pos>=this.data.length}ch(){return this.data[this._pos]}currentMode(){return this.modeStack[this.modeStack.length-1]}skipWhitespace(){let e=this.ch();for(;e===32||e===9||e===13||e===10;)e=this.data[++this._pos]}expect(e){if(this.data.length-this._pos<e.length)throw new Error(`${be} unexpected end of input at position ${this._pos}`);for(let t=0;t<e.length;t++)if(this.data[this._pos++]!==e[t])throw new Error(`${be} unexpected token at position ${this._pos}, expected to find '${String.fromCharCode(...e)}'`)}parseNumber(){let e=this._pos,t=!1,r=!1,n=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 ne(I.uint,0,this._pos-e);if(n([48,49,50,51,52,53,54,55,56,57]),t&&this._pos===e+1)throw new Error(`${be} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(r)throw new Error(`${be} unexpected token at position ${this._pos}`);r=!0,this._pos++,n([48,49,50,51,52,53,54,55,56,57])}!this.done()&&(this.ch()===101||this.ch()===69)&&(r=!0,this._pos++,!this.done()&&(this.ch()===43||this.ch()===45)&&this._pos++,n([48,49,50,51,52,53,54,55,56,57]));let i=String.fromCharCode.apply(null,this.data.subarray(e,this._pos)),o=parseFloat(i);return r?new ne(I.float,o,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(o)?new ne(o>=0?I.uint:I.negint,o,this._pos-e):new ne(o>=0?I.uint:I.negint,BigInt(i),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${be} unexpected character at position ${this._pos}; this shouldn't happen`);this._pos++;for(let i=this._pos,o=0;i<this.data.length&&o<65536;i++,o++){let 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 ne(I.string,s,o)}}let e=this._pos,t=[],r=()=>{if(this._pos+4>=this.data.length)throw new Error(`${be} unexpected end of unicode escape sequence at position ${this._pos}`);let i=0;for(let o=0;o<4;o++){let 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(`${be} 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(`${be} 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(`${be} unexpected string termination at position ${this._pos}`);switch(o=this.ch(),this._pos++,o){case 34:case 39:case 92:case 47:t.push(o);break;case 98:t.push(8);break;case 116:t.push(9);break;case 110:t.push(10);break;case 102:t.push(12);break;case 114:t.push(13);break;case 117:t.push(r());break;default:throw new Error(`${be} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new ne(I.string,PS(t),this._pos-e);default:if(i<32)throw new Error(`${be} invalid control character at position ${this._pos}`);i<128?(t.push(i),this._pos++):n()}}throw new Error(`${be} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new ne(I.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new ne(I.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new ne(I.null,null,4);case 102:return this.expect([102,97,108,115,101]),new ne(I.false,!1,5);case 116:return this.expect([116,114,117,101]),new ne(I.true,!0,4);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.parseNumber();default:throw new Error(`${be} unexpected character at position ${this._pos}`)}}next(){switch(this.skipWhitespace(),this.currentMode()){case"value":return this.modeStack.pop(),this.parseValue();case"array-value":{if(this.modeStack.pop(),this.ch()===93)return this._pos++,this.skipWhitespace(),new ne(I.break,void 0,1);if(this.ch()!==44)throw new Error(`${be} unexpected character at position ${this._pos}, was expecting array delimiter but found '${String.fromCharCode(this.ch())}'`);return this._pos++,this.modeStack.push("array-value"),this.skipWhitespace(),this.parseValue()}case"array-start":return this.modeStack.pop(),this.ch()===93?(this._pos++,this.skipWhitespace(),new ne(I.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 ne(I.break,void 0,1);if(this.ch()!==44)throw new Error(`${be} unexpected character at position ${this._pos}, was expecting object delimiter but found '${String.fromCharCode(this.ch())}'`);this._pos++,this.skipWhitespace();case"obj-start":{if(this.modeStack.pop(),this.ch()===125)return this._pos++,this.skipWhitespace(),new ne(I.break,void 0,1);let e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${be} unexpected character at position ${this._pos}, was expecting key/value delimiter ':' but found '${String.fromCharCode(this.ch())}'`);return this._pos++,this.modeStack.push("obj-value"),e}case"obj-value":return this.modeStack.pop(),this.modeStack.push("obj-key"),this.skipWhitespace(),this.parseValue();default:throw new Error(`${be} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}};function qI(e,t){return t=Object.assign({tokenizer:new Sh(e,t)},t),BI(e,t)}var sC=new Uint8Array(0);function GI(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 kl(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 HI(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(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 B=0,W=0,R=0,k=T.length;R!==k&&T[R]===0;)R++,B++;for(var F=(k-R)*f+1>>>0,q=new Uint8Array(F);R!==k;){for(var L=T[R],Q=0,K=F-1;(L!==0||Q<W)&&K!==-1;K--,Q++)L+=256*q[K]>>>0,q[K]=L%s>>>0,L=L/s>>>0;if(L!==0)throw new Error("Non-zero carry");W=Q,R++}for(var te=F-W;te!==F&&q[te]===0;)te++;for(var j=u.repeat(B);te<F;++te)j+=e.charAt(q[te]);return j}function $(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return new Uint8Array;var B=0;if(T[B]!==" "){for(var W=0,R=0;T[B]===u;)W++,B++;for(var k=(T.length-B)*l+1>>>0,F=new Uint8Array(k);T[B];){var q=r[T.charCodeAt(B)];if(q===255)return;for(var L=0,Q=k-1;(q!==0||L<R)&&Q!==-1;Q--,L++)q+=s*F[Q]>>>0,F[Q]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");R=L,B++}if(T[B]!==" "){for(var K=k-R;K!==k&&F[K]===0;)K++;for(var te=new Uint8Array(W+(k-K)),j=W;K!==k;)te[j++]=F[K++];return te}}}function E(T){var B=$(T);if(B)return B;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:$,decode:E}}var WI=HI,JI=WI,QI=JI,YI=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")}},XI=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 Ih(this,e)}},ZI=class{decoders;constructor(e){this.decoders=e}or(e){return Ih(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 Ih(e,t){return new ZI({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var e$=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 YI(e,t,r),this.decoder=new XI(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function $h({name:e,prefix:t,encode:r,decode:n}){return new e$(e,t,r,n)}function ss({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=QI(r,e);return $h({prefix:t,name:e,encode:n,decode:o=>kl(i(o))})}function t$(e,t,r,n){let i=e.length;for(;e[i-1]==="=";)--i;let o=new Uint8Array(i*r/8|0),a=0,s=0,u=0;for(let l=0;l<i;++l){let f=t[e[l]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);s=s<<r|f,a+=r,a>=8&&(a-=8,o[u++]=255&s>>a)}if(a>=r||255&s<<8-a)throw new SyntaxError("Unexpected end of data");return o}function r$(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 n$(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function Et({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=n$(n);return $h({prefix:t,name:e,encode(o){return r$(o,n,r)},decode(o){return t$(o,i,r,e)}})}var Po=Et({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),uC=Et({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),lC=Et({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),cC=Et({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),fC=Et({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),dC=Et({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),pC=Et({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),hC=Et({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),yC=Et({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Ps=ss({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),gC=ss({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Pr=ss({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mC=ss({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),i$=kh,Ef=128,o$=127,a$=~o$,s$=Math.pow(2,31);function kh(e,t,r){t=t||[],r=r||0;for(var n=r;e>=s$;)t[r++]=e&255|Ef,e/=128;for(;e&a$;)t[r++]=e&255|Ef,e>>>=7;return t[r]=e|0,kh.bytes=r-n+1,t}var u$=lu,l$=128,Of=127;function lu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw lu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Of)<<i:(a&Of)*Math.pow(2,i),i+=7}while(a>=l$);return lu.bytes=o-n,r}var c$=Math.pow(2,7),f$=Math.pow(2,14),d$=Math.pow(2,21),p$=Math.pow(2,28),h$=Math.pow(2,35),y$=Math.pow(2,42),g$=Math.pow(2,49),m$=Math.pow(2,56),b$=Math.pow(2,63),v$=function(e){return e<c$?1:e<f$?2:e<d$?3:e<p$?4:e<h$?5:e<y$?6:e<g$?7:e<m$?8:e<b$?9:10},w$={encode:i$,decode:u$,encodingLength:v$},_$=w$,va=_$;function cu(e,t=0){return[va.decode(e,t),va.decode.bytes]}function wa(e,t,r=0){return va.encode(e,t,r),t}function _a(e){return va.encodingLength(e)}function T$(e,t){let r=t.byteLength,n=_a(e),i=n+_a(r),o=new Uint8Array(i+r);return wa(e,o,0),wa(r,o,n),o.set(t,i),new jl(e,r,t,o)}function E$(e){let t=kl(e),[r,n]=cu(t),[i,o]=cu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new jl(r,i,a,t)}function O$(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&GI(e.bytes,r.bytes)}}var jl=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function xf(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return A$(r,fu(e),t??Pr.encoder);default:return S$(r,fu(e),t??Po.encoder)}}var Af=new WeakMap;function fu(e){let t=Af.get(e);if(t==null){let r=new Map;return Af.set(e,r),r}return t}var us=class lt{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!==Oi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==I$)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return lt.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=T$(t,r);return lt.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 lt.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&O$(t.multihash,n.multihash)}toString(t){return xf(this,t)}toJSON(){return{"/":xf(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 lt)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new lt(n,i,o,a??Sf(n,i,o.bytes))}else if(r[$$]===!0){let{version:n,multihash:i,code:o}=r,a=E$(i);return lt.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!==Oi)throw new Error(`Version 0 CID must use dag-pb (code: ${Oi}) block encoding`);return new lt(t,r,n,n.bytes)}case 1:{let i=Sf(t,r,n.bytes);return new lt(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return lt.create(0,Oi,t)}static createV1(t,r){return lt.create(1,t,r)}static decode(t){let[r,n]=lt.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=lt.inspectBytes(t),n=r.size-r.multihashSize,i=kl(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 jl(r.multihashCode,r.digestSize,o,i);return[r.version===0?lt.createV0(a):lt.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,$]=cu(t.subarray(r));return r+=$,d},i=n(),o=Oi;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]=x$(t,r),o=lt.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return fu(o).set(n,t),o}};function x$(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 Po.prefix:{let r=t??Po;return[Po.prefix,r.decode(e)]}case Ps.prefix:{let r=t??Ps;return[Ps.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 A$(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 S$(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 Oi=112,I$=18;function Sf(e,t,r){let n=_a(e),i=n+_a(t),o=new Uint8Array(i+r.byteLength);return wa(e,o,0),wa(t,o,n),o.set(r,i),o}var $$=Symbol.for("@ipld/js-cid/CID"),jh=Et({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),bC=Et({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),vC=Et({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),wC=Et({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function k$(e){return e instanceof ArrayBuffer?new Uint8Array(e,0,e.byteLength):e}function j$(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=us.asCID(e);if(!t)return null;let r=t.toString();return[new ne(I.map,1/0,1),new ne(I.string,"/",1),new ne(I.string,r,r.length),new ne(I.break,void 0,1)]}function Ta(e){let t=jh.encode(e).slice(1);return[new ne(I.map,1/0,1),new ne(I.string,"/",1),new ne(I.map,1/0,1),new ne(I.string,"bytes",5),new ne(I.string,t,t.length),new ne(I.break,void 0,1),new ne(I.break,void 0,1)]}function Ft(e){return Ta(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function N$(e){return Ta(new Uint8Array(e))}function C$(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function U$(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 P$={typeEncoders:{Object:j$,Buffer:Ta,Uint8Array:Ta,Int8Array:Ft,Uint16Array:Ft,Int16Array:Ft,Uint32Array:Ft,Int32Array:Ft,Float32Array:Ft,Float64Array:Ft,Uint8ClampedArray:Ft,BigInt64Array:Ft,BigUint64Array:Ft,DataView:Ft,ArrayBuffer:N$,undefined:C$,number:U$}},M$=class extends Sh{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===I.map){let t=this._next();if(t.type===I.string&&t.value==="/"){let r=this._next();if(r.type===I.string){if(this._next().type!==I.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new ne(I.tag,42,0)}if(r.type===I.map){let n=this._next();if(n.type===I.string&&n.value==="bytes"){let i=this._next();if(i.type===I.string){for(let a=0;a<2;a++)if(this._next().type!==I.break)throw new Error("Invalid encoded Bytes form");let o=jh.decode(`m${i.value}`);return new ne(I.bytes,o,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(n)}this.tokenBuffer.push(r)}this.tokenBuffer.push(t)}return e}},du={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};du.tags[42]=us.parse;var R$="dag-json",Nh=297,Nl=e=>KI(e,P$),Cl=e=>{let t=k$(e),r=Object.assign(du,{tokenizer:new M$(t,du)});return qI(t,r)},If=e=>L$.decode(Nl(e)),L$=new TextDecoder,D$=e=>Cl(B$.encode(e)),B$=new TextEncoder;function V$(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Ch(e,t,r=""){let n=V$(e),i=e?.length,o=t!==void 0;if(!n||o&&i!==t){let a=r&&`"${r}" `,s=o?` of length ${t}`:"",u=n?`length=${i}`:`type=${typeof e}`;throw new Error(a+"expected Uint8Array"+s+", got "+u)}return e}function $f(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 F$(e,t){Ch(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw new Error('"digestInto() output" expected to be of length >='+r)}function pu(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ms(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function tr(e,t){return e<<32-t|e>>>t}function z$(e,t={}){let r=(i,o)=>e(o).update(i).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.create=i=>e(i),Object.assign(r,t),Object.freeze(r)}var K$=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function q$(e,t,r){return e&t^~e&r}function G$(e,t,r){return e&t^e&r^t&r}var H$=class{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,r,n){this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=Ms(this.buffer)}update(e){$f(this),Ch(e);let{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let o=0;o<i;){let a=Math.min(n-this.pos,i-o);if(a===n){let s=Ms(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){$f(this),F$(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:o}=this;t[o++]=128,pu(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let f=o;f<n;f++)t[f]=0;r.setBigUint64(n-8,BigInt(this.length*8),i),this.process(r,0);let a=Ms(e),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let u=s/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)a.setUint32(4*f,l[f],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:a}=this;return e.destroyed=o,e.finished=i,e.length=n,e.pos=a,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}},jr=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),W$=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Nr=new Uint32Array(64),J$=class extends H${constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:r,D:n,E:i,F:o,G:a,H:s}=this;return[e,t,r,n,i,o,a,s]}set(e,t,r,n,i,o,a,s){this.A=e|0,this.B=t|0,this.C=r|0,this.D=n|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=s|0}process(e,t){for(let f=0;f<16;f++,t+=4)Nr[f]=e.getUint32(t,!1);for(let f=16;f<64;f++){let d=Nr[f-15],$=Nr[f-2],E=tr(d,7)^tr(d,18)^d>>>3,T=tr($,17)^tr($,19)^$>>>10;Nr[f]=T+Nr[f-7]+E+Nr[f-16]|0}let{A:r,B:n,C:i,D:o,E:a,F:s,G:u,H:l}=this;for(let f=0;f<64;f++){let d=tr(a,6)^tr(a,11)^tr(a,25),$=l+d+q$(a,s,u)+W$[f]+Nr[f]|0,E=(tr(r,2)^tr(r,13)^tr(r,22))+G$(r,n,i)|0;l=u,u=s,s=a,a=o+$|0,o=i,i=n,n=r,r=$+E|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,n,i,o,a,s,u,l)}roundClean(){pu(Nr)}destroy(){this.set(0,0,0,0,0,0,0,0),pu(this.buffer)}},Q$=class extends J${A=jr[0]|0;B=jr[1]|0;C=jr[2]|0;D=jr[3]|0;E=jr[4]|0;F=jr[5]|0;G=jr[6]|0;H=jr[7]|0;constructor(){super(32)}},Y$=z$(()=>new Q$,K$(1)),_C=new Uint8Array(0);function X$(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 Ul(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 Z$(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(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 B=0,W=0,R=0,k=T.length;R!==k&&T[R]===0;)R++,B++;for(var F=(k-R)*f+1>>>0,q=new Uint8Array(F);R!==k;){for(var L=T[R],Q=0,K=F-1;(L!==0||Q<W)&&K!==-1;K--,Q++)L+=256*q[K]>>>0,q[K]=L%s>>>0,L=L/s>>>0;if(L!==0)throw new Error("Non-zero carry");W=Q,R++}for(var te=F-W;te!==F&&q[te]===0;)te++;for(var j=u.repeat(B);te<F;++te)j+=e.charAt(q[te]);return j}function $(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return new Uint8Array;var B=0;if(T[B]!==" "){for(var W=0,R=0;T[B]===u;)W++,B++;for(var k=(T.length-B)*l+1>>>0,F=new Uint8Array(k);T[B];){var q=r[T.charCodeAt(B)];if(q===255)return;for(var L=0,Q=k-1;(q!==0||L<R)&&Q!==-1;Q--,L++)q+=s*F[Q]>>>0,F[Q]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");R=L,B++}if(T[B]!==" "){for(var K=k-R;K!==k&&F[K]===0;)K++;for(var te=new Uint8Array(W+(k-K)),j=W;K!==k;)te[j++]=F[K++];return te}}}function E(T){var B=$(T);if(B)return B;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:$,decode:E}}var ek=Z$,tk=ek,rk=tk,nk=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")}},ik=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 Uh(this,e)}},ok=class{decoders;constructor(e){this.decoders=e}or(e){return Uh(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 Uh(e,t){return new ok({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var ak=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 nk(e,t,r),this.decoder=new ik(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Ph({name:e,prefix:t,encode:r,decode:n}){return new ak(e,t,r,n)}function ls({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=rk(r,e);return Ph({prefix:t,name:e,encode:n,decode:o=>Ul(i(o))})}function sk(e,t,r,n){let i=e.length;for(;e[i-1]==="=";)--i;let o=new Uint8Array(i*r/8|0),a=0,s=0,u=0;for(let l=0;l<i;++l){let f=t[e[l]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);s=s<<r|f,a+=r,a>=8&&(a-=8,o[u++]=255&s>>a)}if(a>=r||255&s<<8-a)throw new SyntaxError("Unexpected end of data");return o}function uk(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 lk(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function xr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=lk(n);return Ph({prefix:t,name:e,encode(o){return uk(o,n,r)},decode(o){return sk(o,i,r,e)}})}var Mo=xr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),TC=xr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),EC=xr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),OC=xr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),xC=xr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),AC=xr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),SC=xr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),IC=xr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),$C=xr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Ro=ls({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),kC=ls({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Mr=ls({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),jC=ls({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Mh={};Id(Mh,{Digest:()=>cs,create:()=>Pl,decode:()=>Lh,equals:()=>Dh,hasCode:()=>Ik});var ck=Rh,kf=128,fk=127,dk=~fk,pk=Math.pow(2,31);function Rh(e,t,r){t=t||[],r=r||0;for(var n=r;e>=pk;)t[r++]=e&255|kf,e/=128;for(;e&dk;)t[r++]=e&255|kf,e>>>=7;return t[r]=e|0,Rh.bytes=r-n+1,t}var hk=hu,yk=128,jf=127;function hu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw hu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&jf)<<i:(a&jf)*Math.pow(2,i),i+=7}while(a>=yk);return hu.bytes=o-n,r}var gk=Math.pow(2,7),mk=Math.pow(2,14),bk=Math.pow(2,21),vk=Math.pow(2,28),wk=Math.pow(2,35),_k=Math.pow(2,42),Tk=Math.pow(2,49),Ek=Math.pow(2,56),Ok=Math.pow(2,63),xk=function(e){return e<gk?1:e<mk?2:e<bk?3:e<vk?4:e<wk?5:e<_k?6:e<Tk?7:e<Ek?8:e<Ok?9:10},Ak={encode:ck,decode:hk,encodingLength:xk},Sk=Ak,Ea=Sk;function yu(e,t=0){return[Ea.decode(e,t),Ea.decode.bytes]}function Oa(e,t,r=0){return Ea.encode(e,t,r),t}function xa(e){return Ea.encodingLength(e)}function Pl(e,t){let r=t.byteLength,n=xa(e),i=n+xa(r),o=new Uint8Array(i+r);return Oa(e,o,0),Oa(r,o,n),o.set(t,i),new cs(e,r,t,o)}function Lh(e){let t=Ul(e),[r,n]=yu(t),[i,o]=yu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new cs(r,i,a,t)}function Dh(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&X$(e.bytes,r.bytes)}}var cs=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Ik(e,t){return e.code===t}function Nf(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return kk(r,gu(e),t??Mr.encoder);default:return jk(r,gu(e),t??Mo.encoder)}}var Cf=new WeakMap;function gu(e){let t=Cf.get(e);if(t==null){let r=new Map;return Cf.set(e,r),r}return t}var or=class ct{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!==xi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Nk)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return ct.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=Pl(t,r);return ct.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 ct.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&Dh(t.multihash,n.multihash)}toString(t){return Nf(this,t)}toJSON(){return{"/":Nf(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 ct)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new ct(n,i,o,a??Uf(n,i,o.bytes))}else if(r[Ck]===!0){let{version:n,multihash:i,code:o}=r,a=Lh(i);return ct.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!==xi)throw new Error(`Version 0 CID must use dag-pb (code: ${xi}) block encoding`);return new ct(t,r,n,n.bytes)}case 1:{let i=Uf(t,r,n.bytes);return new ct(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return ct.create(0,xi,t)}static createV1(t,r){return ct.create(1,t,r)}static decode(t){let[r,n]=ct.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=ct.inspectBytes(t),n=r.size-r.multihashSize,i=Ul(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 cs(r.multihashCode,r.digestSize,o,i);return[r.version===0?ct.createV0(a):ct.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,$]=yu(t.subarray(r));return r+=$,d},i=n(),o=xi;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]=$k(t,r),o=ct.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return gu(o).set(n,t),o}};function $k(e,t){switch(e[0]){case"Q":{let r=t??Mr;return[Mr.prefix,r.decode(`${Mr.prefix}${e}`)]}case Mr.prefix:{let r=t??Mr;return[Mr.prefix,r.decode(e)]}case Mo.prefix:{let r=t??Mo;return[Mo.prefix,r.decode(e)]}case Ro.prefix:{let r=t??Ro;return[Ro.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 kk(e,t,r){let{prefix:n}=r;if(n!==Mr.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 jk(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 xi=112,Nk=18;function Uf(e,t,r){let n=xa(e),i=n+xa(t),o=new Uint8Array(i+r.byteLength);return Oa(e,o,0),Oa(t,o,n),o.set(r,i),o}var Ck=Symbol.for("@ipld/js-cid/CID"),Uk=20;function Bh({name:e,code:t,encode:r,minDigestLength:n,maxDigestLength:i}){return new Pk(e,t,r,n,i)}var Pk=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,r,n,i){this.name=e,this.code=t,this.encode=r,this.minDigestLength=n??Uk,this.maxDigestLength=i}digest(e,t){if(t?.truncate!=null){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?Pf(r,this.code,t?.truncate):r.then(n=>Pf(n,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};function Pf(e,t,r){if(r!=null&&r!==e.byteLength){if(r>e.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${e.byteLength}`);e=e.subarray(0,r)}return Pl(t,e)}var et=Or(Gr(),1),Vh=Or(c1(),1),Mf=e=>et.Type.Union([e,et.Type.Null()]),Fh=/^(k51qz|baguq)[0-9a-z]{56,57}$/,Mk=/^[0-9A-Fa-f]{7,8}$/g;et.FormatRegistry.Set("EntityID",e=>!!e.match(Mk)||!!e.match(Fh));var Rk=et.Type.String(),mu=e=>e?.enc instanceof Uint8Array;et.FormatRegistry.Set("CID",e=>!!e.match(Fh));var zh=et.Type.String({format:"CID"}),Lk=/^http([s]?):\/\/.*\..*/;et.FormatRegistry.Set("URL",e=>!!e.match(Lk));var NC=et.Type.String({format:"URL"}),Kh=et.Type.Object({en:Rk,at:et.Type.String(),vl:Mf(et.Type.Union([et.Type.String(),et.Type.Boolean(),et.Type.Number()])),ts:et.Type.String(),ag:et.Type.String(),pv:Mf(zh)}),Rf=Vh.TypeCompiler.Compile(Kh),CC=Rf.Check.bind(Rf),Dk=et.Type.Composite([et.Type.Object({cid:zh}),Kh]),bu=Vh.TypeCompiler.Compile(Dk),Bk=e=>Array.from(bu.Errors(e)),qh=bu.Check.bind(bu);function Gh(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var Vk=Bh({name:"sha2-256",code:18,encode:Gh("SHA-256")}),UC=Bh({name:"sha2-512",code:19,encode:Gh("SHA-512")}),{WARN:Lf,LOG:PC,DEBUG:Fk,VERBOSE:Aa,ERROR:zk}=Ae.setup(Ae.INFO),Kk=114;function qk(e,t=["cid"]){if(!e)throw zk("falsy log",e);let r=e.cid;if(mu(e))return r||(r=Ml(Hh(e).bytes).toString()),Lf("preparing an encrypted applog - really?"),{log:e,cid:r};let n={};for(let[i,o]of Object.entries(e))o===void 0&&(Lf(`log.${i} is undefined, which is not allowed - encoding as null`,e),o=null),t.includes(i)?Aa("excluding app log",{key:i,val:o}):n[i]=o;return{log:n,cid:r}}function Gk(e){return Ml(Hk(e).bytes)}function Hk(e){return Hh(qk(e)?.log)}function Ml(e){let t=Y$(e),r=Mh.create(Vk.code,t),n=or.create(1,Nh,r);return Aa("[getCidSync]",{bytes:e,hash:t,digest:r,cid:n}),n}function Hh(e){Fk("[encodeBlock]",e);let t=Nl(e);return{bytes:t,cid:Ml(t)}}function Wk(e){let t=null,r=[];try{t=or.parse(e)}catch(n){Aa("[retrieveThread] couldn't parse pubID with default base"),r.push(n)}if(!t)try{t=or.parse(e,Ro)}catch(n){Aa("[retrieveThread] couldn't parse pubID with base36"),r.push(n)}return{cid:t,errors:t?null:r,isIpns:t&&Rl(t)}}function Rl(e){return e.code===Kk}function vu(e){return typeof e=="string"?or.parse(e):typeof e.toV1!="function"?or.decode(e.bytes):e}function Wh(e,t){if(!e||!t)throw new Error(`[areCidsEqual] invalid params: ${e}, ${t}`);if(e===t)return!0;let r=vu(e),n=vu(t);return r.toV1().toString()===n.toV1().toString()}function Df(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 Jk(e,t){let r=Df(e),n=Df(t);return+r<+n}var{WARN:Qk,LOG:MC,DEBUG:RC,VERBOSE:Sa,ERROR:Ia}=Ae.setup(Ae.INFO),Yk=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),Jh=(e,t,r)=>Je.structural(yf(t,e),yf(r,e)),Xk=(e,t,r="asc")=>Yk(e.ts,t.ts,r),LC=rS(Jh,["en","at"]);function Wi(e,t="asc"){return e.sort((r,n)=>Xk(r,n,t))}var Zk=(e,t)=>Jk(new Date(e.ts),new Date(t.ts)),ej=()=>{Qk("[removeDuplicateAppLogs] mode not set; pass 'safety' or 'cleanup' for optimal behavior")},Bf=e=>{let t=new Map,r=Sa.isEnabled;for(let n of e){if(!n)throw Ia("falsy entry in applogs",e),new Error("falsy entry in applogs");if(!n.cid)throw Ia("applog with missing CID",n),new Error("applog with missing CID");let i=n.cid,o=t.get(i);o?r&&Sa("Skipping duplicate applog:",[o,n]):t.set(i,n)}return Array.from(t.values())},tj=e=>{let t=new Set,r=Sa.isEnabled,n=r?new Map:null,i=null,o=0;for(let a of e){if(!a)throw Ia("falsy entry in applogs",e),new Error("falsy entry in applogs");if(!a.cid)throw Ia("applog with missing CID",a),new Error("applog with missing CID");let s=a.cid;t.has(s)?(i||(i=e.slice(0,o)),r&&Sa("Skipping duplicate applog:",[n?.get(s),a])):(t.add(s),n&&n.set(s,a),i&&i.push(a)),o++}return i??e},Qh=(e,t)=>t?t==="safety"?tj(e):Bf(e):(ej(),Bf(e));function rj(e){return typeof e=="string"&&e.startsWith("?")}function nj(e){return e.slice(1)}function Yh(e,t){let r={},n={};for(let[i,o]of Object.entries(e))if(rj(o)){let a=nj(o),s=t[a];s?n[i]=s:r[i]=a}else n[i]=o;return[n,r]}function ij(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 Xh=function(e){for(var t=0,r=0,n=e.length;r<n;r++)t+=e[r];return t},Vf=function(e){return Xh(e)/e.length},It={max:function(e){return Math.max.apply(null,e)},min:function(e){return Math.min.apply(null,e)},range:function(e){return It.max(e)-It.min(e)},midrange:function(e){return It.range(e)/2},sum:Xh,mean:Vf,average:Vf,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=It.mean(e);return It.mean(e.map(function(r){return Math.pow(r-t,2)}))},standardDeviation:function(e){return Math.sqrt(It.variance(e))},meanAbsoluteDeviation:function(e){var t=It.mean(e);return It.mean(e.map(function(r){return Math.abs(r-t)}))},zScores:function(e){var t=It.mean(e),r=It.standardDeviation(e);return e.map(function(n){return(n-t)/r})}};It.average=It.mean;function Zh(){return new Date().toISOString()}var{WARN:oj,LOG:DC,DEBUG:Ge,VERBOSE:BC,ERROR:$a}=Ae.setup(Ae.INFO);function aj(e,t){Ge(`[ensureTsPvAndFinalizeApplogs] ENTER - ${e.length} applogs, thread size=${t.size}`);let r=Zh(),n=t;Ge("[ensureTsPvAndFinalizeApplogs] About to map over applogs");let i=e.map((o,a)=>{Ge(`[ensureTsPvAndFinalizeApplogs] Processing applog ${a+1}/${e.length}`);let s=sj(o,{ts:r,threadForPv:n});return Ge(`[ensureTsPvAndFinalizeApplogs] Finalized applog ${a+1}/${e.length}`),s});return Ge(`[ensureTsPvAndFinalizeApplogs] EXIT - mapped ${i.length} applogs`),i}function sj(e,{ts:t,threadForPv:r}={}){Ge(`[finalizeApplogForInsert] ENTER - en=${e.en}, at=${e.at}`),Ge("[finalizeApplogForInsert] About to call withTs");let n=cj(e,t??Zh());Ge(`[finalizeApplogForInsert] About to call withPvFrom (thread size=${r?.size??"null"})`);let i=fj(n,r);Ge("[finalizeApplogForInsert] About to call encodeApplogAndGetCid");let o=Gk(i).toString();Ge(`[finalizeApplogForInsert] CID created: ${o}`),e.cid&&e.cid!==o&&oj("[finalizeApplogForInsert] overwriting wrong CID",{log:e,cid:o,logWithPv:i});let a={...i,cid:o};if(Ge("[finalizeApplogForInsert] About to validate applog"),!qh(a))throw $a(`Bogus Applog ${JSON.stringify(a)}`,Bk(a));return Ge(`[finalizeApplogForInsert] EXIT - CID=${o}`),Object.freeze(a)}function uj(e){return!!e.ts}function lj(e){return!!e.pv}function cj(e,t){return uj(e)?e:{...e,ts:t}}function fj(e,t){if(Ge(`[withPvFrom] ENTER - en=${e.en}, at=${e.at}, hasPv=${e.pv!==void 0}`),e.pv!==void 0)return Ge("[withPvFrom] EXIT early - pv already set"),e;if(t){let{en:r,at:n}=e;Ge(`[withPvFrom] About to call thread.findLast for en=${r}, at=${n}, thread.size=${t.size}`);let i=t.findLast(a=>a.en==r&&a.at==n);if(Ge(`[withPvFrom] findLast completed, found=${!!i}`),Ge("[withPvFrom] About to check equality"),Jh(["en","at","vl","ts","ag"],e,i))throw $a("[withPvFrom] Same as previous:",{log:e,pv:i,thread:t});let o=(e.pv!==void 0?e.pv:i?.cid)??null;return Ge(`[withPvFrom] EXIT - prevLogCid=${o}`),{...e,pv:o}}else{if(!lj(e))throw $a("[withPvFrom] no thread and no pv:",e);return Ge("[withPvFrom] EXIT - no thread, returning log with existing pv"),e}}function wu(e){let t=()=>(De(()=>e.length<2&&Ge(`joinThreads with count=${e.length}`)),Wi(Qh(e.flatMap(i=>{let o=i.applogs;if(!o)throw $a("falsy applogs of thread",i),new Error("falsy applogs of thread");return o}),"cleanup"))),r=De(()=>t()),n=Ct(function(i,o){return Kr(i)?{init:De(()=>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 fs(De(()=>`join(~ ${e.map(i=>i.name).join(", ")})`),e,["?"],r,n)}var{WARN:Ff,LOG:VC,DEBUG:zf,VERBOSE:tn,ERROR:Ao}=Ae.setup(Ae.INFO),fs=class _u extends zn{constructor(t,r,n,i,o,a=null,s){super(t,r,n,o?Be.array([...i],{deep:!1,name:`${t}.array`}):i),this.name=t,this._initialLogs=i,this._eventMapper=o,this._writeMapper=a,this._readOnly=s,oi(this,{onParentUpdate:Ct}),o&&this.subscribeToParents()}static mapWrites(t,r,n){return new _u(`${r}<${t.nameAndSizeUntracked}>`,t,t.filters,t._applogs,null,n)}static asReadOnly(t){return t.readOnly?t:new _u(`readOnly(${t.name})`,t,t.filters,t._applogs,null,null,!0)}_parentSubscriptions=null;insert(t){if(this.readOnly)throw Ao("[MappedThread] insert() called on read-only thread:",this.nameAndSizeUntracked);let r=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!r))return this.parents.forEach(n=>n.insert(r))}insertRaw(t){if(this.readOnly)throw Ao("[MappedThread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);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=Rt(()=>{this.parents.length||Ff("MappedThread has no parents",this),tn(`[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)&&tn(`[MappedThread: ${this.name}] Skipping re-sub to parent`,n.nameAndSizeUntracked),tn(`[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)tn(`[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 Ao("triggerRemap on a thread that is not actually mapping?!",this.nameAndSizeUntracked);zf(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.length!==1&&Ff(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap with parentCount=${this.parents.length} - not meant for this`),this.parents.forEach(t=>{this.onParentUpdate(t,{init:De(()=>mr(t.applogs))})})}onParentUpdate(t,r){tn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate`,r);let n=this._eventMapper?this._eventMapper(r,t):r;if(this._eventMapper)if(tn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => mapped`,n),Kr(n))this._applogs.replace([...n.init]);else{for(let i of n.added)this._applogs.splice(pS(this._applogs,i,"ts"),0,i);if(n.removed){for(let i of n.removed)if(!this._applogs.remove(i))if(!Kr(r)&&r.removed?.includes(i))zf("Ignoring remove event for non-existent because it was part of parent event's removed",i,r);else throw Ao(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,i,{thread:this,event:r,mapResult:n})}}tn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,Ha(this._applogs)),this.notifySubscribers(n)}get readOnly(){return this._readOnly??!1}},{WARN:FC,LOG:zC,DEBUG:KC,VERBOSE:Rs,ERROR:dj}=Ae.setup(Ae.INFO),Kn=tt("rollingFilter",function(e,t,r={}){let n=hj(t),i=Kf(n),o=Be.array(De(function(){return i(e.applogs)}),{deep:!1,name:`${e.name} | ${r.name||`rollingFilter.array{${qi(n)}}`}`}),a=f=>{let d;return Kr(f)?d={init:i(f.init)}:d={added:i(f.added),removed:f.removed},Rs(`rollingFilter{${e.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,n,f,"=>",d),d},s=new fs(`${e.name} | ${r.name||`rollingFilter{${qi(n)}}`}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],o,a),u=Aw(()=>mr(t),f=>{Rs(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,n,"=>",f),n=f,i=Kf(n),s.triggerRemap()}),l=ii(o,()=>{Rs(`rollingFilter<${De(()=>e.name)}>${r.name?` '${r.name}'`:""} unobserve`,n),u(),l()});return s},{equals:fo,argsDebugName:(e,t,r)=>We({caller:"rollingFilter",thread:e,pattern:t,args:r})}),pj=tt("rollingMapper",function(e,t,r={}){let n=De(()=>t.call(null,{init:e.applogs},e));if(!Kr(n))throw dj("Initial run must return init event");let i=n.init;return new fs(`${e.name} | ${r.name||"rollingMapper"}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],i,t)},{equals:fo,argsDebugName:(e,t,r)=>We({caller:"rollingMapper",thread:e,args:r})}),qC=tt("rollingAcc",function(e,t,r,n={}){let i=Ct(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}`:""}}`}),hj=function(e){let t=De(function(){return Object.fromEntries(Object.entries(mr(e)).map(([r,n])=>[mr(r),mr(n)]))});if(!Object.entries(t).length)throw new Error("Pattern is empty");return t};function Kf(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(!ij(n,i,o))return!1}return!0})}}var GC=fs.asReadOnly,{WARN:yj,LOG:gj,DEBUG:qe,VERBOSE:ey,ERROR:Lo}=Ae.setup(Ae.INFO),mj=class extends zn{constructor(e,t=[],r){super(e,null,r,t),oi(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){qe(`[WriteableThread.insert] ENTER - ${e.length} applogs for thread "${this.name}"`),qe("[WriteableThread.insert] About to call ensureTsPvAndFinalizeApplogs");let t=aj(e,this);qe(`[WriteableThread.insert] ensureTsPvAndFinalizeApplogs completed, mapped=${t.length} applogs`),qe("[WriteableThread.insert] About to call insertRaw");let r=this.insertRaw(t);return qe("[WriteableThread.insert] insertRaw completed"),r}insertMissing(e,t=!1){let r=e.filter(n=>!this.hasApplog(n,t));return r.length===0?(ey("[insertMissing] no missing applogs"),[]):this.insertRaw(r)??[]}insertRaw(e){qe(`[WriteableThread.insertRaw] ENTER - ${e.length} applogs for thread "${this.name}"`),qe("[WriteableThread.insertRaw] About to deduplicate");let t=Qh(e,"safety");if(t.length!==e.length)throw Lo(`[insertRaw] duplicate applogs passed: ${e.length-t.length}`,{appLogsToInsert:e,deduplicated:t});qe("[WriteableThread.insertRaw] Deduplication done"),qe("[WriteableThread.insertRaw] About to validate");let r=e.filter(o=>!qh(o));if(r.length)throw Lo(`[insertRaw] bogus applogs passed: ${r.length}`,{bogus:r});qe("[WriteableThread.insertRaw] Validation done"),qe("[WriteableThread.insertRaw] About to check for existing");let n=e.filter(o=>this.hasApplog(o,!1));if(n.length)throw Lo(`[insertRaw] already existing applogs passed: ${n.length}`,{existing:n});if(qe("[WriteableThread.insertRaw] Existing check done"),!e.length){yj("[insertRaw] skipping empty insert empty logs array");return}(!this.hasParents&&!(this instanceof mo)?gj:qe)("Inserting:",e.length===1?e[0]:e,{ds:this}),qe("[WriteableThread.insertRaw] About to sort applogs"),Wi(e);let i=this._applogs.length&&Zk(e[0],this._applogs[this._applogs.length-1]);return qe("[WriteableThread.insertRaw] About to push to _applogs array"),this._applogs.push(...e),i&&(qe("[WriteableThread.insertRaw] About to sort _applogs (sortNeeded=true)"),Wi(this._applogs)),qe("[WriteableThread.insertRaw] About to notify subscribers"),this.notifySubscribers({added:e,removed:null}),qe("[WriteableThread.insertRaw] Subscribers notified"),qe("[WriteableThread.insertRaw] About to call persist (void - not awaited)"),this.persist(e),qe(`[WriteableThread.insertRaw] EXIT - returning ${e.length} applogs`),e}get readOnly(){return!1}},mo=class Do extends mj{constructor(t,r,n,i){super(t,r,n),this._readOnly=i,oi(this,{_applogs:Be.shallow})}static empty(t){return Do.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new Do(r??"in-memory",t,[],n)}static fromReadOnlyArray(t,r){return new Do(r??"in-memory",t,[],!0)}get readOnly(){return this._readOnly}async persist(t){if(ey("[InMem.persist] no persist for",t),this.readOnly)throw Lo("[persist] called for readOnly thread")}},{WARN:HC,LOG:WC,DEBUG:JC,VERBOSE:QC,ERROR:YC}=Ae.setup(Ae.INFO),{WARN:XC,LOG:ZC,DEBUG:e5,VERBOSE:t5,ERROR:r5}=Ae.setup(Ae.INFO),bj=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=r,oi(this,{threadOfTrail:He})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?wu([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},ty=class{constructor(e){this.nodes=e,oi(this,{threadOfAllTrails:He,size:He,isEmpty:He})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return De(()=>this.records.length)}get records(){return Ht(()=>this.nodes.map(({variables:e})=>e),{name:"QueryResult.records"})}get leafNodeThread(){return wu(Ht(()=>this.nodes.map(({logsOfThisNode:e})=>e),{name:"QueryResult.leafNodeThread"}))}get leafNodeLogSet(){return Ht(()=>this.nodes.map(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogSet"})}get leafNodeLogs(){return Ht(()=>this.nodes.flatMap(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogs"})}get threadOfAllTrails(){return wu(Ht(()=>this.nodes.map(e=>e.threadOfTrail),{name:"QueryResult.threadOfAllTrails"}))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},{WARN:n5,LOG:ds,DEBUG:wr,VERBOSE:Se,ERROR:cn}=Ae.setup(Ae.INFO,{prefix:"[q]"}),Ls=null,i5=tt("lastWriteWins",function(e,{inverseToOnlyReturnFirstLogs:t,tolerateAlreadyFiltered:r}={}){if(Se(`lastWriteWins${t?".inversed":""} < ${e.nameAndSizeUntracked} > initializing`),e.filters.includes("lastWriteWins")){if(r)return wr("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),e;throw cn("thread already filtered lastWriteWins:",e.filters,{name:e.name})}let n,i=pj(e,function(o,a){let s=Kr(o),u,l=[],f=s?null:[];s?(n=new Map,u=o.init):u=o.added;let d;for(let $=t?0:u.length-1;t?$<u.length:$>=0;t?$++:$--){let E=u[$],T=E.en+"|"+E.at;if(d&&(t?d>E.ts:d<E.ts))throw cn("lastWriteWins.mapper logs not sorted:",d,t?">":"<",E.ts,{log:E,i:$,newLogs:u,inverseToOnlyReturnFirstLogs:t});d=E.ts;let B=n.get(T);(!B||(t?B.ts>E.ts:B.ts<E.ts))&&(B&&!s&&f.push(B),l.push(E),n.set(T,E))}return Wi(l),Se.isDisabled||Se(`lastWriteWins${t?".inversed":""}<${e.nameAndSizeUntracked}> mapped event`,s?{...Object.fromEntries(Object.entries(o).map(([$,E])=>[$,E?.length])),toAdd:l.length,toRemove:f}:{...o,toAdd:l,toRemove:f}),s?{init:l}:{added:l,removed:f}},{name:`lastWriteWins${t?".inversed":""}`,extraFilterName:"lastWriteWins"});return Se.isDisabled||Rt(()=>{Se(`lastWriteWins<${e.nameAndSizeUntracked}> filtered down to`,i.applogs.length)}),i},{equals:fo,argsDebugName:e=>We({caller:"lastWriteWins",thread:e})}),o5=tt("withoutDeleted",function(e){if(Se.isEnabled&&Se(`withoutDeleted<${e.nameAndSizeUntracked}>`),e.filters.includes("withoutDeleted"))throw cn("thread already filtered withoutDeleted:",e.filters,{name:e.name});let t=Kn(e,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});Se.isEnabled&&Se(`withoutDeleted<${e.nameAndSizeUntracked}> deletionLogs:`,De(function(){return[...t.applogs]}));let r=We({caller:"allDeletedEntities",thread:e}),n=wS(function(){return t.map(i=>i.en)},{name:r});return Se.isEnabled&&Rt(()=>{Se(`withoutDeleted<${e.nameAndSizeUntracked}> deleted:`,[...n])}),Kn(e,{"!en":n},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:fo}),ry=tt("query",function e(t,r,n={},i={}){Aj();let o=ny(t);wr(`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=vj(o,s,u,i);return Se.isDisabled||Rt(()=>Se("query result:",mr(l))),l},{equals:wl,argsDebugName:(e,t,r)=>We({caller:"query",thread:e,args:r?{pattern:t,startVars:r}:t})}),vj=tt("queryStep",function(e,t,r,n={}){if(wr(`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]=Yh(r,a?.variables??{});Se("[queryStep.doQuery] patternWithoutVars: ",s);let l=Kn(e,s),f=ps(u),d=Ht(function(){let $=l.map(E=>({log:E,vars:f(E)}));return Se.isEnabled&&Se("[queryStep.doQuery] step node:",a?.variables," =>",$,"from:",De(()=>l.applogs)),$.map(({log:E,vars:T})=>{let B=Object.assign({},a?.variables,T);return new bj(OS.fromArray([E],We({caller:"QueryNode",thread:l,pattern:`${qi(B)}@${qi(s)}`})),B,a)})},{name:We({caller:"doQuery.mapNodes",thread:l,pattern:r})});return Se.isEnabled&&Rt(()=>Se("[queryStep.doQuery] resultNodes:",[...d])),n.debug&&ds("[queryStep] step result:",De(()=>d.map(({variables:$,logsOfThisNode:E})=>({variables:$,thread:E})))),d}let o=Ht(function(){return wr(`[queryStep] Running with ${t?.nodes?.length} input nodes:`),t?[...t.nodes.flatMap(i)]:[...i(null)]},{name:We({caller:"queryStep",thread:e,pattern:r})});return Se.isEnabled&&Rt(()=>Se("[queryStep] observableResultNodes:",[...o])),new ty(o)},{equals:wl,argsDebugName:(e,t,r)=>We({caller:"queryStep",thread:e,pattern:r})}),a5=tt("queryNot",function(e,t,r,n={}){let i=t.nodes;wr(`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]=Yh(a,s??{});Se("[queryNot] patternWithoutVars: ",u);let f=Kn(e,u);return Se("[queryNot] step node:",s," =>",f.size,"applogs"),Se.isDisabled||Se("[queryNot] step node:",s," => empty?",De(()=>f.applogs)),n.debug&&ds("[queryNot] node result:",s,"=>",f.applogs),f.isEmpty})}return new ty(i)},{equals:wl,argsDebugName:(e,t,r)=>We({caller:"queryNot",thread:e,pattern:r})}),s5=tt("filterAndMap",function(e,t,r){wr(`filterAndMap<${e.nameAndSizeUntracked}>`,t);let n=Kn(e,t);Se.isEnabled&&(Se("[filterAndMap] filtered:",n.untrackedSize),Rt(()=>Se("[filterAndMap] filtered:",n.applogs)));let i=We({thread:e,pattern:t,caller:"filterAndMap"}),o=Ht(()=>Tj(n,r),{name:i});return Se.isDisabled||Rt(()=>Se("[filterAndMap] mapped:",o)),o},{equals:Je.structural,argsDebugName:(e,t)=>We({caller:"filterAndMap",thread:e,pattern:t})}),u5=tt("queryAndMap",function(e,t,r,n={}){let i=ny(e);wr(`queryAndMap<${i.nameAndSizeUntracked}>`,{patternOrPatterns:t,variables:n,map:r});let o=We({thread:i,caller:"queryAndMap"}),a=ry(i,t);Se("[queryAndMap] filtered count:",a.untrackedSize);let s=Ht(()=>Ej(a,r),{name:o});return Se.isDisabled||Rt(()=>Se("[queryAndMap] result:",mr(s))),s},{equals:Je.structural,argsDebugName:(e,t)=>We({caller:"queryAndMap",thread:e,pattern:t})}),l5=tt("queryEntity",function(e,t,r,n){wr(`queryEntity<${e.nameAndSizeUntracked}>`,r,t);let i=Kn(e,{en:r,at:Oj(t,n)});return Se("queryEntity applogs:",i.applogs),He(()=>i.isEmpty?null:Object.fromEntries(i.map(({at:o,vl:a})=>[o.slice(t.length+1),a])))},{equals:mS,argsDebugName:(e,t,r)=>We({caller:"queryEntity",thread:e,args:{name:t,entityID:r}})}),c5=tt("agentsOfThread",function(e){wr(`agentsOfThread<${e.nameAndSizeUntracked}>`);let t=Be.map(),r=Ct(i=>{for(let o of Kr(i)?i.init:i.added){let a=t.get(o.ag)??0;t.set(o.ag,a+1)}for(let o of!Kr(i)&&i.removed||[]){let a=t.get(o.ag);if(!a||a<1)throw cn("[agentsOfThread] number is now negative",{log:o,event:i,mapped:t,prev:a});t.set(o.ag,a-1)}ds(`agentsOfThread<${e.nameAndSizeUntracked}> processed event`,{event:i,mapped:t})});r({init:e.applogs});let n=e.subscribe(r);return Ga(t,n),t}),wj=tt("entityOverlap",function(e,t){return ds(`entityOverlap<${e.nameAndSizeUntracked}, ${t.nameAndSizeUntracked}>`),He(()=>{let r=new Set(e.map(i=>i.en)),n=new Set(t.map(i=>i.en));return[...r].filter(i=>n.has(i))})}),f5=tt("entityOverlapCount",function(e,t){return He(()=>wj(e,t).get().length)}),_j=tt("querySingle",function(e,t,r={}){let n=ry(e,t,r);return He(()=>{if(n.isEmpty)return null;if(n.size>1)throw cn("[querySingle] got",n.size,"results:",n);let i=n.nodes[0].logsOfThisNode;if(i.size!=1)throw cn("[querySingle] single result, but got",i.size,"logs:",i.applogs);return i.applogs[0]})},{equals:Je.structural,argsDebugName:(e,t)=>We({caller:"querySingle",thread:e,pattern:t})}),d5=tt("querySingleAndMap",function(e,t,r,n={}){let i=_j(e,t,n);return He(()=>{let o=i.get();if(o)return typeof r=="string"?o[r]:ps(r)(o)})},{equals:Je.structural,argsDebugName:(e,t)=>We({caller:"querySingleAndMap",thread:e,pattern:t})}),Tj=function(e,t){return typeof t=="function"?e.map(t):typeof t=="string"?e.map(r=>r[t]):e.map(ps(t))},Ej=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 cn(`not sure what to map (it's not a var and a result node log count of ${r.logsOfThisNode.size})`);return r.logsOfThisNode.firstLog[t]}return r.record[t]}):e.nodes.map(r=>ps(t)(e))};function ps(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function Oj(e,t){return t.map(r=>xj(e,r))}function xj(e,t){return`${e}/${t}`}function ny(e,t){return Array.isArray(e)?mo.fromArray(e,t||`threadFromArray[${e.length}]`,!0):e}function Aj(){if(Ls!=null&&performance.now()>=Ls)throw new Sj(Ls)}var Sj=class extends Error{constructor(e){super(e)}},Ij=Ze({"../../../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}}}),$j=Ze({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/decode.js"(e,t){"use strict";t.exports=i;var r=128,n=127;function i(o,u){var s=0,u=u||0,l=0,f=u,d,$=o.length;do{if(f>=$||l>49)throw i.bytes=0,new RangeError("Could not decode varint");d=o[f++],s+=l<28?(d&n)<<l:(d&n)*Math.pow(2,l),l+=7}while(d>=r);return i.bytes=f-u,s}}}),kj=Ze({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js"(e,t){"use strict";var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),a=Math.pow(2,35),s=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),f=Math.pow(2,63);t.exports=function(d){return d<r?1:d<n?2:d<i?3:d<o?4:d<a?5:d<s?6:d<u?7:d<l?8:d<f?9:10}}}),Ll=Ze({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js"(e,t){"use strict";t.exports={encode:Ij(),decode:$j(),encodingLength:kj()}}}),iy=42;function jj(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=us.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new ne(I.tag,iy),new ne(I.bytes,r)]}function Nj(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Cj(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}function Uj(e){for(let t of e.keys())if(typeof t!="string"||t.length===0)throw new Error("Non-string Map keys are not supported by the IPLD Data Model and cannot be encoded");return null}var qf={float64:!0,typeEncoders:{Map:Uj,Object:jj,undefined:Nj,number:Cj}},p5={...qf,typeEncoders:{...qf.typeEncoders}};function Pj(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return us.decode(e.subarray(1))}var Tu={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Tu.tags[iy]=Pj;var h5={...Tu,tags:Tu.tags.slice()},y5=Or(Ll(),1),Dr={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},$i={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Dr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Dr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=$i["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=$i["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Dr.Int,CarV1HeaderOrV2Pragma:e=>{if(Dr.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=$i["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=$i.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}},ki={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Dr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Dr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=ki["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=ki["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Dr.Int,CarV1HeaderOrV2Pragma:e=>{if(Dr.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=ki["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=ki.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}},g5={toTyped:$i.CarV1HeaderOrV2Pragma,toRepresentation:ki.CarV1HeaderOrV2Pragma},m5=Eh(),b5=Or(Ll(),1),v5=[new ne(I.map,2),new ne(I.string,"version"),new ne(I.uint,1),new ne(I.string,"roots")],w5=new ne(I.tag,42),_5=Or(Ll(),1),{WARN:oy,LOG:T5,DEBUG:Ds,VERBOSE:Dl,ERROR:Cn}=Ae.setup(Ae.INFO);async function Mj(e){let t=await Lj(e);return await Rj(t)}async function Rj({rootCID:e,blockStore:t},r=[],n){if(!e||!t)throw Cn("Empty roots/blocks",{rootCID:e,blockStore:t});let i=[],o=null,a=e,s=new Set,u=null;for(;a;){let f=a.toString();if(s.has(f))throw Cn("[decodePubFromBlocks] pub chain has a loop",{currentCID:f,visited:[...s]});s.add(f);let d=await Pn(t,a);if(Dl("[decodePubFromBlocks] root:",f,d,{blockStore:t}),!d)throw Cn("[decodePubFromBlocks] root not found in blockStore",{blockStore:t,currentCID:f});let $;if(d?.info){u||(u=d.applogs);let B=await Pn(t,d.applogs);$=await Vj(B,t),o||(o=await Pn(t,d.info),Ds("new format - infoLogs",o.logs.map(W=>({[W.toString()]:W}))))}else $=d.applogs;let E=async B=>{let W=B,R=await Pn(t,W);if(!R)throw Cn("Could not find applog CID in pub blocks:",W.toString(),{cid:W,root:d,blockStore:t}),new Error(`Could not find applog CID in pub blocks: ${W.toString()}`);return R.pv instanceof or&&(R.pv=R.pv.toV1().toString()),{...R,cid:W.toV1().toString()}},T=await Promise.all($.map(E));if(i=i.concat(T),!d.prev)break;if(n&&Wh(d.prev,n)){Ds("[decodePubFromBlocks] stopping at stopAtCID:",n.toString());break}if(!await t.get(d.prev))throw Cn("[decodePubFromBlocks] prev snapshot missing from blockStore",{currentCID:f,prev:d.prev.toString(),stopAtCID:n?.toString(),visited:[...s]});a=d.prev}let l={cid:e,info:o?{...o,logs:await Promise.all(o.logs.map(async f=>{let d=f,$=await Pn(t,d);if(!$)throw Cn("Could not find info log CID in pub blocks:",d.toString(),{cid:d,blockStore:t}),new Error(`Could not find info log CID in pub blocks: ${d.toString()}`);return $.pv instanceof or&&($.pv=$.pv.toV1().toString()),{...$,cid:d.toV1().toString()}}))}:null,applogsCID:u,applogs:i};return Ds("[decodePubFromBlocks] result:",l,{rootCID:e.toString(),blockStore:t,applogs:i}),l}async function Lj(e){let t=(await e.getRoots()).map(n=>(typeof n.toV1=="function"?n:or.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:or.decode(n.bytes);Dl({cidFromCarblocks:n,cid:o}),r.set(o.toV1().toString(),i)}return t.length!==1&&oy("Unexpected roots count:",t),{rootCID:or.parse(t[0]),blockStore:{get:n=>r.get(n.toV1().toString())}}}async function Pn(e,t){try{var r=await e.get(t);if(!r)return oy("returning null"),null}catch(n){if(n.message==="Not Found")return null;throw n}return Cl(r)}function Dj(e){return async function*(){for(;;){let{done:t,value:r}=await e.read();if(Dl("[car] chunk",{done:t,value:r}),t)break;yield r}}()}var{WARN:E5,LOG:O5,DEBUG:x5,VERBOSE:A5,ERROR:Bj}=Ae.setup(Ae.INFO);async function Vj(e,t){return Fj(e)?(await Promise.all(e.chunks.map(async r=>{let n=await Pn(t,r);if(!n.logs)throw Bj("Weird chunk",n);return n.logs}))).flat():e.logs}function Fj(e){return e.chunks}var ka=Ji($y(),1),zj=Ji(ky(),1),ay=!1,sy=!1;ka.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(ay=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(sy=process?.env?.LOGGER_PERF_PREFIX==="true"));var Kj={prefix:void 0,time:ay,delta:sy,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},Bs=[],uy=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(",")}]`}},ly=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},ji=!1,qn=class yt{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=yt.INFO,r={}){r=Object.assign({},Kj,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(...$){let E=$[$.length-1];return E===i?E():(o(...$.slice(0,-1)),(async()=>{try{let T=E();return T instanceof Promise?await T:T}finally{console.groupEnd()}})())}let d=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:l});return u?d:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:d})},s=a(t>=yt.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(s(...u),new Error((0,zj.default)(u))),WARN:a(t>=yt.WARN,this.wrapLog(console.warn,r)),LOG:a(t>=yt.INFO,this.wrapLog(console.log,r)),DEBUG:a(t>=yt.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:a(t>=yt.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(ka.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=ka.isBrowser&&navigator.userAgent.includes("Chrome")?["",yt.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(ji?n.push(new ly("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();yt.firstLog||(yt.firstLog=i,yt.lastLog=i);let o=new uy(i-yt.firstLog,i-yt.lastLog,t,r);return yt.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}}}};ka.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(Bs&&Bs.length){for(let t of Bs)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof uy))return null;ji||(ji=!0);let t=qn.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof ly?(ji||(ji=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var{WARN:qj,LOG:S5,DEBUG:Ui,VERBOSE:I5,ERROR:hs}=qn.setup(qn.INFO),Bl=["https://trustless-gateway.link/","https://ipfs.4everland.io/"].map(e=>({url:e}));async function Vl(e,{readOnly:t=!0,pinnedCID:r,gateways:n=Bl}={}){let{cid:i,errors:o,isIpns:a}=Wk(e);if(!i)throw hs("Failed to parse pubID",e,o);Ui("[retrieveThread] parsedPubID",{cid:i.toString(),errors:o,isIpns:a});let s=await cy(i),{applogs:u,info:l}=await Mj(s),f=u.filter(mu);f.length&&qj(`Found ${f.length} encrypted logs - skipping`);let d=u.filter(E=>!mu(E));Wi(d);let $=mo.fromArray(d,`preview${e&&e!==i.toString()?"-"+e:""}@${i.toString()}`,t);return{cid:i,info:l,thread:$,encryptedCount:f.length}}async function cy(e,t=Bl){return e=vu(e),Ui("Retrieving:",e,e.toString(),"from",t),await Fl(t,async(r,n)=>{var i=fy(r,e);n>1&&(i+=`&cache-bust=${performance.now()}`);let o=await fetch(i),a=await Gj(o,i);Ui("[retrieveCar] GW result",{result:a,gateway:r});let s=await Ad.fromIterable(a);Ui("[retrieveCar] GW decodeResult",{car:s,gateway:r});let u=(await s.getRoots())[0];if(!Rl(e)&&!Wh(e,u))throw hs("Fetched CAR has different CID",u.toString(),"than the one asked for:",e.toString());return s})}function fy(e,t,r="all"){let n=new URL(e.url),i=Rl(t),o=`${n}${i?"ipns/":"ipfs/"}${t.toString()}?format=car&dag-scope=${r}`;return Ui({isIpns:i,url:o}),o}async function Gj(e,t){if(!e?.ok||!e?.body)throw hs("[retrieveCar] unexpected response",e?.statusText,{url:t});return Dj(e.body.getReader())}async function Fl(e,t,r=1){try{return await Promise.any(Xo(e).map(async n=>{try{return await t(n,r)}catch(i){throw hs("still trying",i),i instanceof Error?i:new Error(`[retrieveCar] error: ${i}`)}}))}catch(n){if(r<3)return await Fl(e,t,r+1);throw new Error("[Gateway] no valid results after 3 attempts via: "+Xo(e).map(({url:i})=>i)+`
|
|
63
|
+
`+n.errors.map(i=>i.message))}}var{WARN:i8,LOG:o8,DEBUG:a8,VERBOSE:s8,ERROR:u8}=Ae.setup(Ae.INFO),{WARN:Hj,LOG:l8,DEBUG:Wj,VERBOSE:ys,ERROR:c8}=Ae.setup(Ae.INFO),f8=tt("queryDivergencesByPrev",function(e){Wj(`queryDivergencesByPrev<${e.nameAndSizeUntracked}>`),e.filters.includes("lastWriteWins")&&Hj("queryDivergencesByPrev on thread lastWriteWins",e);let t=Ht(()=>{let r=new Map,n=new Set;ys("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())),ys("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 mo(We({caller:"DivergenceLeaf",thread:e,pattern:`leaf: ${i}`}),r.get(i),e.filters,!0);return{log:o.latestLog,thread:o}})},{name:We({caller:"queryDivergencesByPrev",thread:e})});return ys.isDisabled||Rt(()=>ys("[queryDivergencesByPrev] result:",mr(t))),t},{equals:Je.structural}),{WARN:d8,LOG:p8,DEBUG:h8,VERBOSE:y8,ERROR:g8}=Ae.setup(Ae.INFO),{WARN:m8,LOG:b8,DEBUG:v8,VERBOSE:w8,ERROR:_8}=qn.setup(qn.INFO);var{WARN:x8,LOG:A8,DEBUG:S8,VERBOSE:I8,ERROR:$8}=ws.setup(ws.INFO),Jj="https://nftstorage.link";async function k8(e,{readOnly:t=!0,pinnedCID:r}={}){return Vl(e,{readOnly:t,pinnedCID:r,gateways:[{url:Jj}]})}export{Jj as a,k8 as b};
|
|
64
|
+
/*! Bundled license information:
|
|
65
|
+
|
|
66
|
+
lodash-es/lodash.js:
|
|
67
|
+
(**
|
|
68
|
+
* @license
|
|
69
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
70
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
71
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
72
|
+
* Released under MIT license <https://lodash.com/license>
|
|
73
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
74
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
75
|
+
*)
|
|
76
|
+
|
|
77
|
+
@noble/hashes/utils.js:
|
|
78
|
+
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
79
|
+
*/
|
|
80
|
+
//# sourceMappingURL=chunk-WIJG4LB2.min.js.map
|