@wovin/connect-nftstorage 0.1.32 → 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{e as Es}from"./chunk-BKKH6BET.min.js";var wy=Object.create,Wf=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&&Wf(e,i,{get:()=>t[i],enumerable:!(n=_y(t,i))||n.enumerable});return e},Yi=(e,t,r)=>(r=e!=null?wy(Ey(e)):{},xy(t||!e||!e.__esModule?Wf(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,k=o.length;do{if(f>=k||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}}),xu=Gn((e,t)=>{"use strict";t.exports={encode:Ay(),decode:Sy(),encodingLength:Iy()}}),ky=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}),$y=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]},k={key:f,value:u[f]};return s(d,k)}}}(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,k=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<k.length;l++){var E=k[l],T=s(u[E]);T&&(f&&(f+=","),f+=JSON.stringify(E)+":"+T)}return a.splice(d,1),"{"+f+"}"}}(r)}}),Ny=["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 jy(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(Ny.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}`}},Xi=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Uy=new TextEncoder;function Fo(e){return Xi&&globalThis.Buffer.isBuffer(e)}function Au(e){return e instanceof Uint8Array?Fo(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Py=24,Ry=200,Dy=Xi?e=>e.length>=Py?globalThis.Buffer.from(e):Hl(e):e=>e.length>=Ry?Uy.encode(e):Hl(e),dr=e=>Uint8Array.from(e),My=Xi?(e,t,r)=>Fo(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Ly=Xi?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Au(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=Xi?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Jf(e,t){if(Fo(e)&&Fo(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 Hl(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,Qf=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=My(r,0,this.cursor)}else t=Ly(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:",Yf="CBOR encode error:",Zi=[];Zi[23]=1;Zi[24]=2;Zi[25]=3;Zi[26]=5;Zi[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 qy(e,t,r,n){return new me(G.uint,dn(e,t+1,n),3)}function Ky(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 Mt(e,0,t.value)}function Mt(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 Mt.encodedSize(e.value)};Mt.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 Su=BigInt(-1),Xf=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,Su-BigInt(i),9)}function Iu(e,t){let r=t.value,n=typeof r=="bigint"?r*Su-Xf:r*-1-1;Mt(e,t.type.majorEncoded,n)}Iu.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*Su-Xf:t*-1-1;return r<rt[0]?1:r<rt[1]?2:r<rt[2]?3:r<rt[3]?5:9};Iu.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function eo(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 eo(e,t,1,r)}function Xy(e,t,r,n){return eo(e,t,2,fn(e,t+1,n))}function Zy(e,t,r,n){return eo(e,t,3,dn(e,t+1,n))}function eg(e,t,r,n){return eo(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 eo(e,t,9,i)}function zo(e){return e.encodedBytes===void 0&&(e.encodedBytes=G.equals(e.type,G.string)?Dy(e.value):e.value),e.encodedBytes}function Ua(e,t){let r=zo(t);Mt(e,t.type.majorEncoded,r.length),e.push(r)}Ua.encodedSize=function(e){let t=zo(e);return Mt.encodedSize(t.length)+t.length};Ua.compareTokens=function(e,t){return rg(zo(e),zo(t))};function rg(e,t){return e.length<t.length?-1:e.length>t.length?1:Jf(e,t)}var Wl=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 Wl.decode(e.subarray(t,r));n+=String.fromCharCode(o)}return n}return Wl.decode(e.subarray(t,r))}function to(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 to(e,t,1,r,n)}function ag(e,t,r,n){return to(e,t,2,fn(e,t+1,n),n)}function sg(e,t,r,n){return to(e,t,3,dn(e,t+1,n),n)}function ug(e,t,r,n){return to(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 to(e,t,9,i,n)}var cg=Ua;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 ku(e,t){Mt(e,G.array.majorEncoded,t.value)}ku.compareTokens=yn.compareTokens;ku.encodedSize=function(e){return Mt.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 $u(e,t){Mt(e,G.map.majorEncoded,t.value)}$u.compareTokens=yn.compareTokens;$u.encodedSize=function(e){return Mt.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 Nu(e,t){Mt(e,G.tag.majorEncoded,t.value)}Nu.compareTokens=yn.compareTokens;Nu.encodedSize=function(e){return Mt.encodedSize(e.value)};var Zf=20,ed=21,td=22,rd=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 kg(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 ju(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 $g(e,t,r,n){return ju(Uu(e,t+1),3,n)}function Ng(e,t,r,n){return ju(Pu(e,t+1),5,n)}function jg(e,t,r,n){return ju(ad(e,t+1),9,n)}function Cu(e,t,r){let n=t.value;if(n===!1)e.push([G.float.majorEncoded|Zf]);else if(n===!0)e.push([G.float.majorEncoded|ed]);else if(n===null)e.push([G.float.majorEncoded|td]);else if(n===void 0)e.push([G.float.majorEncoded|rd]);else{let i,o=!1;(!r||r.float64!==!0)&&(id(n),i=Uu(zt,1),n===i||Number.isNaN(n)?(zt[0]=249,e.push(zt.slice(0,3)),o=!0):(od(n),i=Pu(zt,1),n===i&&(zt[0]=250,e.push(zt.slice(0,5)),o=!0))),o||(Cg(n),i=ad(zt,1),zt[0]=251,e.push(zt.slice(0,9)))}}Cu.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){id(r);let n=Uu(zt,1);if(r===n||Number.isNaN(r))return 3;if(od(r),n=Pu(zt,1),r===n)return 5}return 9};var nd=new ArrayBuffer(9),xt=new DataView(nd,1),zt=new Uint8Array(nd,0);function id(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 Uu(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 od(e){xt.setFloat32(0,e,!1)}function Pu(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 ad(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)}Cu.compareTokens=yn.compareTokens;function $e(e,t,r){throw new Error(`${xe} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Pa(e){return()=>{throw new Error(`${xe} ${e}`)}}var ue=[];for(let e=0;e<=23;e++)ue[e]=$e;ue[24]=zy;ue[25]=qy;ue[26]=Ky;ue[27]=Gy;ue[28]=$e;ue[29]=$e;ue[30]=$e;ue[31]=$e;for(let e=32;e<=55;e++)ue[e]=$e;ue[56]=Hy;ue[57]=Wy;ue[58]=Jy;ue[59]=Qy;ue[60]=$e;ue[61]=$e;ue[62]=$e;ue[63]=$e;for(let e=64;e<=87;e++)ue[e]=Yy;ue[88]=Xy;ue[89]=Zy;ue[90]=eg;ue[91]=tg;ue[92]=$e;ue[93]=$e;ue[94]=$e;ue[95]=Pa("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]=$e;ue[125]=$e;ue[126]=$e;ue[127]=Pa("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]=$e;ue[157]=$e;ue[158]=$e;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]=$e;ue[189]=$e;ue[190]=$e;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]=$e;ue[221]=$e;ue[222]=$e;ue[223]=$e;for(let e=224;e<=243;e++)ue[e]=Pa("simple values are not supported");ue[244]=$e;ue[245]=$e;ue[246]=$e;ue[247]=Ig;ue[248]=Pa("simple values are not supported");ue[249]=$g;ue[250]=Ng;ue[251]=jg;ue[252]=$e;ue[253]=$e;ue[254]=$e;ue[255]=kg;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 Rg(){let e=[];return e[G.uint.major]=yn,e[G.negint.major]=Iu,e[G.bytes.major]=Ua,e[G.string.major]=cg,e[G.array.major]=ku,e[G.map.major]=$u,e[G.tag.major]=Nu,e[G.float.major]=Cu,e}var Dg=Rg(),Mg=new Qf,Jl=class sd{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(`${Yf} object contains circular references`);return new sd(r,t)}},kr={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?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 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?[kr.emptyArray,new me(G.break)]:kr.emptyArray;n=Jl.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=ko(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=Jl.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++]=[ko(f,r,n),ko(d,r,n)])}l<a&&(s.length=l)}return s?.length?(Lg(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?[kr.emptyMap,new me(G.break)]:kr.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 ko(e,t={},r){let n=jy(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(`${Yf} unsupported type: ${n}`);return o(e,n,t,r)}function Lg(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=Ql(r.value)),n._keyBytes||(n._keyBytes=Ql(n.value)),Jf(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function Ql(e){return Vg(e,Dg,Pg)}function ud(e,t,r,n){if(Array.isArray(t))for(let i of t)ud(e,i,r,n);else r[t.type.major](e,t,n)}var dj=G.uint.majorEncoded,pj=G.negint.majorEncoded,hj=G.bytes.majorEncoded,yj=G.string.majorEncoded,gj=G.array.majorEncoded,mj=G.float.majorEncoded|Zf,bj=G.float.majorEncoded|ed,vj=G.float.majorEncoded|td,wj=G.float.majorEncoded|rd,_j=BigInt(-1),Tj=BigInt(1);function Vg(e,t,r,n){let i=n instanceof Uint8Array,o=i?new Fy(n):Mg,a=ko(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 Qf(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():Au(o.chunks[0])}}return o.reset(),ud(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}},Di=Symbol.for("DONE"),Ra=Symbol.for("BREAK");function qg(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=Mi(t,r);if(o===Ra){if(e.value===1/0)break;throw new Error(`${xe} got unexpected break to lengthed array`)}if(o===Di)throw new Error(`${xe} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function Kg(e,t,r){let n=r.useMaps===!0,i=r.rejectDuplicateMapKeys===!0,o=n?void 0:{},a=n?new Map:void 0;for(let s=0;s<e.value;s++){let u=Mi(t,r);if(u===Ra){if(e.value===1/0)break;throw new Error(`${xe} got unexpected break to lengthed map`)}if(u===Di)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===Di)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 Di;let r=e.next();if(G.equals(r.type,G.break))return Ra;if(r.type.terminal)return r.value;if(G.equals(r.type,G.array))return qg(r,e,t);if(G.equals(r.type,G.map))return Kg(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=Au(e),n=t.tokenizer||new zg(r,t),i=Mi(n,t);if(i===Di)throw new Error(`${xe} did not find any content to decode`);if(i===Ra)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 Ej=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 Ru(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,D=0,$=T.length;D!==$&&T[D]===0;)D++,B++;for(var F=($-D)*f+1>>>0,K=new Uint8Array(F);D!==$;){for(var M=T[D],Q=0,q=F-1;(M!==0||Q<W)&&q!==-1;q--,Q++)M+=256*K[q]>>>0,K[q]=M%s>>>0,M=M/s>>>0;if(M!==0)throw new Error("Non-zero carry");W=Q,D++}for(var te=F-W;te!==F&&K[te]===0;)te++;for(var N=u.repeat(B);te<F;++te)N+=e.charAt(K[te]);return N}function k(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,D=0;T[B]===u;)W++,B++;for(var $=(T.length-B)*l+1>>>0,F=new Uint8Array($);T[B];){var K=r[T.charCodeAt(B)];if(K===255)return;for(var M=0,Q=$-1;(K!==0||M<D)&&Q!==-1;Q--,M++)K+=s*F[Q]>>>0,F[Q]=K%256>>>0,K=K/256>>>0;if(K!==0)throw new Error("Non-zero carry");D=M,B++}if(T[B]!==" "){for(var q=$-D;q!==$&&F[q]===0;)q++;for(var te=new Uint8Array(W+($-q)),N=W;q!==$;)te[N++]=F[q++];return te}}}function E(T){var B=k(T);if(B)return B;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:k,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 ld(this,e)}},tm=class{decoders;constructor(e){this.decoders=e}or(e){return ld(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 ld(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 cd({name:e,prefix:t,encode:r,decode:n}){return new rm(e,t,r,n)}function Da({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Xg(r,e);return cd({prefix:t,name:e,encode:n,decode:o=>Ru(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 Tr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=om(n);return cd({prefix:t,name:e,encode(o){return im(o,n,r)},decode(o){return nm(o,i,r,e)}})}var $o=Tr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Oj=Tr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),xj=Tr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Aj=Tr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Sj=Tr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ij=Tr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),kj=Tr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),$j=Tr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Nj=Tr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Os=Da({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),jj=Da({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Ur=Da({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Cj=Da({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),am=fd,Yl=128,sm=127,um=~sm,lm=Math.pow(2,31);function fd(e,t,r){t=t||[],r=r||0;for(var n=r;e>=lm;)t[r++]=e&255|Yl,e/=128;for(;e&um;)t[r++]=e&255|Yl,e>>>=7;return t[r]=e|0,fd.bytes=r-n+1,t}var cm=zs,fm=128,Xl=127;function zs(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw zs.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Xl)<<i:(a&Xl)*Math.pow(2,i),i+=7}while(a>=fm);return zs.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,qo=Em;function qs(e,t=0){return[qo.decode(e,t),qo.decode.bytes]}function Ko(e,t,r=0){return qo.encode(e,t,r),t}function Go(e){return qo.encodingLength(e)}function Om(e,t){let r=t.byteLength,n=Go(e),i=n+Go(r),o=new Uint8Array(i+r);return Ko(e,o,0),Ko(r,o,n),o.set(t,i),new Du(e,r,t,o)}function Ks(e){let t=Ru(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 Du(r,i,a,t)}function xm(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 Du=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Zl(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return Sm(r,Gs(e),t??Ur.encoder);default:return Im(r,Gs(e),t??$o.encoder)}}var ec=new WeakMap;function Gs(e){let t=ec.get(e);if(t==null){let r=new Map;return ec.set(e,r),r}return t}var Ho=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!==wi)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&&xm(t.multihash,n.multihash)}toString(t){return Zl(this,t)}toJSON(){return{"/":Zl(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??tc(n,i,o.bytes))}else if(r[$m]===!0){let{version:n,multihash:i,code:o}=r,a=Ks(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!==wi)throw new Error(`Version 0 CID must use dag-pb (code: ${wi}) block encoding`);return new st(t,r,n,n.bytes)}case 1:{let i=tc(t,r,n.bytes);return new st(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return st.create(0,wi,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=Ru(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 Du(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,k]=qs(t.subarray(r));return r+=k,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]=Am(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 Gs(o).set(n,t),o}};function Am(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)]}case Os.prefix:{let r=t??Os;return[Os.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 Sm(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 Im(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,km=18;function tc(e,t,r){let n=Go(e),i=n+Go(t),o=new Uint8Array(i+r.byteLength);return Ko(e,o,0),Ko(t,o,n),o.set(r,i),o}var $m=Symbol.for("@ipld/js-cid/CID"),dd=42;function Nm(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Ho.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new me(G.tag,dd),new me(G.bytes,r)]}function jm(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Cm(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 rc={float64:!0,typeEncoders:{Object:Nm,undefined:jm,number:Cm}},Uj={...rc,typeEncoders:{...rc.typeEncoders}};function Um(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Ho.decode(e.subarray(1))}var Wo={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Wo.tags[dd]=Um;var Pj={...Wo,tags:Wo.tags.slice()},Pm=e=>Hg(e,Wo),nn=Yi(xu(),1),xs={SHA2_256:18,LENGTH:32,DAG_PB:112},Rm=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 Dm(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 Mm(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 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},Si={"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=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: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=Si["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=Si.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}},Ii={"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=Ii["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=Ii["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=Ii["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=Ii.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}},Lm={toTyped:Si.CarV1HeaderOrV2Pragma,toRepresentation:Ii.CarV1HeaderOrV2Pragma},Bm=["string","number","bigint","symbol"],Vm=["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 Fm(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return Bm.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":zm(e)?"Buffer":qm(e)||"Object"}function zm(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function qm(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Vm.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",Km=new TextDecoder,Gm=new TextEncoder;function Qo(e){return Qn&&globalThis.Buffer.isBuffer(e)}function Hm(e){return e instanceof Uint8Array?Qo(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Wm=Qn?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):ic(e,t,r):(e,t,r)=>r-t>64?Km.decode(e.subarray(t,r)):ic(e,t,r),Jm=Qn?e=>e.length>64?globalThis.Buffer.from(e):nc(e):e=>e.length>64?Gm.encode(e):nc(e),Mu=Qn?(e,t,r)=>Qo(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Qm=Qn?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Hm(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},Ym=Qn?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Xm(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 nc(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 ic(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 Zm(n)}var oc=4096;function Zm(e){let t=e.length;if(t<=oc)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=oc));return r}var eb=256,tb=class{constructor(e=eb){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=Ym(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=Mu(r,0,this.cursor)}else t=Qm(this.chunks,this.cursor);return e&&this.reset(),t}},Ve="CBOR decode error:",pd="CBOR encode error:",ro=[];ro[23]=1;ro[24]=2;ro[25]=3;ro[26]=5;ro[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 rb(e,t,r,n){return new ge(Y.uint,gn(e,t+1,n),2)}function nb(e,t,r,n){return new ge(Y.uint,mn(e,t+1,n),3)}function ib(e,t,r,n){return new ge(Y.uint,bn(e,t+1,n),5)}function ob(e,t,r,n){return new ge(Y.uint,vn(e,t+1,n),9)}function wn(e,t){return Lt(e,0,t.value)}function Lt(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 Lt.encodedSize(e.value)};Lt.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 ab(e,t,r,n){return new ge(Y.negint,-1-gn(e,t+1,n),2)}function sb(e,t,r,n){return new ge(Y.negint,-1-mn(e,t+1,n),3)}function ub(e,t,r,n){return new ge(Y.negint,-1-bn(e,t+1,n),5)}var Lu=BigInt(-1),hd=BigInt(1);function lb(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,Lu-BigInt(i),9)}function Bu(e,t){let r=t.value,n=typeof r=="bigint"?r*Lu-hd:r*-1-1;Lt(e,t.type.majorEncoded,n)}Bu.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*Lu-hd: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 no(e,t,r,n){Yn(e,t,r+n);let i=Mu(e,t+r,t+r+n);return new ge(Y.bytes,i,r+n)}function cb(e,t,r,n){return no(e,t,1,r)}function fb(e,t,r,n){return no(e,t,2,gn(e,t+1,n))}function db(e,t,r,n){return no(e,t,3,mn(e,t+1,n))}function pb(e,t,r,n){return no(e,t,5,bn(e,t+1,n))}function hb(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 no(e,t,9,i)}function Yo(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===Y.string?Jm(e.value):e.value),e.encodedBytes}function Ma(e,t){let r=Yo(t);Lt(e,t.type.majorEncoded,r.length),e.push(r)}Ma.encodedSize=function(e){let t=Yo(e);return Lt.encodedSize(t.length)+t.length};Ma.compareTokens=function(e,t){return yb(Yo(e),Yo(t))};function yb(e,t){return e.length<t.length?-1:e.length>t.length?1:Xm(e,t)}function io(e,t,r,n,i){let o=r+n;Yn(e,t,o);let a=new ge(Y.string,Wm(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=Mu(e,t+r,t+o)),a}function gb(e,t,r,n){return io(e,t,1,r,n)}function mb(e,t,r,n){return io(e,t,2,gn(e,t+1,n),n)}function bb(e,t,r,n){return io(e,t,3,mn(e,t+1,n),n)}function vb(e,t,r,n){return io(e,t,5,bn(e,t+1,n),n)}function wb(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 io(e,t,9,i,n)}var _b=Ma;function Xn(e,t,r,n){return new ge(Y.array,n,r)}function Tb(e,t,r,n){return Xn(e,t,1,r)}function Eb(e,t,r,n){return Xn(e,t,2,gn(e,t+1,n))}function Ob(e,t,r,n){return Xn(e,t,3,mn(e,t+1,n))}function xb(e,t,r,n){return Xn(e,t,5,bn(e,t+1,n))}function Ab(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 Sb(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){Lt(e,Y.array.majorEncoded,t.value)}Vu.compareTokens=wn.compareTokens;Vu.encodedSize=function(e){return Lt.encodedSize(e.value)};function Zn(e,t,r,n){return new ge(Y.map,n,r)}function Ib(e,t,r,n){return Zn(e,t,1,r)}function kb(e,t,r,n){return Zn(e,t,2,gn(e,t+1,n))}function $b(e,t,r,n){return Zn(e,t,3,mn(e,t+1,n))}function Nb(e,t,r,n){return Zn(e,t,5,bn(e,t+1,n))}function jb(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 Cb(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){Lt(e,Y.map.majorEncoded,t.value)}Fu.compareTokens=wn.compareTokens;Fu.encodedSize=function(e){return Lt.encodedSize(e.value)};function Ub(e,t,r,n){return new ge(Y.tag,r,1)}function Pb(e,t,r,n){return new ge(Y.tag,gn(e,t+1,n),2)}function Rb(e,t,r,n){return new ge(Y.tag,mn(e,t+1,n),3)}function Db(e,t,r,n){return new ge(Y.tag,bn(e,t+1,n),5)}function Mb(e,t,r,n){return new ge(Y.tag,vn(e,t+1,n),9)}function zu(e,t){Lt(e,Y.tag.majorEncoded,t.value)}zu.compareTokens=wn.compareTokens;zu.encodedSize=function(e){return Lt.encodedSize(e.value)};var Lb=20,Bb=21,Vb=22,Fb=23;function zb(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 qb(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 qu(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 Kb(e,t,r,n){return qu(Gu(e,t+1),3,n)}function Gb(e,t,r,n){return qu(Hu(e,t+1),5,n)}function Hb(e,t,r,n){return qu(bd(e,t+1),9,n)}function Ku(e,t,r){let n=t.value;if(n===!1)e.push([Y.float.majorEncoded|Lb]);else if(n===!0)e.push([Y.float.majorEncoded|Bb]);else if(n===null)e.push([Y.float.majorEncoded|Vb]);else if(n===void 0)e.push([Y.float.majorEncoded|Fb]);else{let i,o=!1;(!r||r.float64!==!0)&&(gd(n),i=Gu(qt,1),n===i||Number.isNaN(n)?(qt[0]=249,e.push(qt.slice(0,3)),o=!0):(md(n),i=Hu(qt,1),n===i&&(qt[0]=250,e.push(qt.slice(0,5)),o=!0))),o||(Wb(n),i=bd(qt,1),qt[0]=251,e.push(qt.slice(0,9)))}}Ku.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){gd(r);let n=Gu(qt,1);if(r===n||Number.isNaN(r))return 3;if(md(r),n=Hu(qt,1),r===n)return 5}return 9};var yd=new ArrayBuffer(9),At=new DataView(yd,1),qt=new Uint8Array(yd,0);function gd(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 md(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 Wb(e){At.setFloat64(0,e,!1)}function bd(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)}Ku.compareTokens=wn.compareTokens;function Ne(e,t,r){throw new Error(`${Ve} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function La(e){return()=>{throw new Error(`${Ve} ${e}`)}}var fe=[];for(let e=0;e<=23;e++)fe[e]=Ne;fe[24]=rb;fe[25]=nb;fe[26]=ib;fe[27]=ob;fe[28]=Ne;fe[29]=Ne;fe[30]=Ne;fe[31]=Ne;for(let e=32;e<=55;e++)fe[e]=Ne;fe[56]=ab;fe[57]=sb;fe[58]=ub;fe[59]=lb;fe[60]=Ne;fe[61]=Ne;fe[62]=Ne;fe[63]=Ne;for(let e=64;e<=87;e++)fe[e]=cb;fe[88]=fb;fe[89]=db;fe[90]=pb;fe[91]=hb;fe[92]=Ne;fe[93]=Ne;fe[94]=Ne;fe[95]=La("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)fe[e]=gb;fe[120]=mb;fe[121]=bb;fe[122]=vb;fe[123]=wb;fe[124]=Ne;fe[125]=Ne;fe[126]=Ne;fe[127]=La("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)fe[e]=Tb;fe[152]=Eb;fe[153]=Ob;fe[154]=xb;fe[155]=Ab;fe[156]=Ne;fe[157]=Ne;fe[158]=Ne;fe[159]=Sb;for(let e=160;e<=183;e++)fe[e]=Ib;fe[184]=kb;fe[185]=$b;fe[186]=Nb;fe[187]=jb;fe[188]=Ne;fe[189]=Ne;fe[190]=Ne;fe[191]=Cb;for(let e=192;e<=215;e++)fe[e]=Ub;fe[216]=Pb;fe[217]=Rb;fe[218]=Db;fe[219]=Mb;fe[220]=Ne;fe[221]=Ne;fe[222]=Ne;fe[223]=Ne;for(let e=224;e<=243;e++)fe[e]=La("simple values are not supported");fe[244]=Ne;fe[245]=Ne;fe[246]=Ne;fe[247]=zb;fe[248]=La("simple values are not supported");fe[249]=Kb;fe[250]=Gb;fe[251]=Hb;fe[252]=Ne;fe[253]=Ne;fe[254]=Ne;fe[255]=qb;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 vd(){let e=[];return e[Y.uint.major]=wn,e[Y.negint.major]=Bu,e[Y.bytes.major]=Ma,e[Y.string.major]=_b,e[Y.array.major]=Vu,e[Y.map.major]=Fu,e[Y.tag.major]=zu,e[Y.float.major]=Ku,e}var Rj=vd(),Dj=new tb,ac=class wd{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(`${pd} object contains circular references`);return new wd(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=ac.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=As(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=ac.createCheck(n,e);let s=[],u=0;for(let l of o)s[u++]=[As(l,r,n),As(i?e.get(l):e[l],r,n)];return Jb(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 As(e,t={},r){let n=Fm(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(`${pd} unsupported type: ${n}`);return o(e,n,t,r)}function Jb(e,t){t.mapSorter&&e.sort(t.mapSorter)}var Mj=Symbol.for("DONE"),Lj=Symbol.for("BREAK"),Bj=vd(),Vj=Yi(xu(),1),Fj=[new ge(Y.map,2),new ge(Y.string,"version"),new ge(Y.uint,1),new ge(Y.string,"roots")],zj=new ge(Y.tag,42);async function _d(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=Pm(n);if(Lm.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=Dm(await e.exactly(Rm,!0));e.seek(o.dataOffset-e.pos);let a=await _d(e,1);return Object.assign(a,o)}async function Qb(e){let t=await e.exactly(2,!1);if(t[0]===xs.SHA2_256&&t[1]===xs.LENGTH){let a=await e.exactly(34,!0),s=Ks(a);return Ho.create(0,xs.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(Mm(await e.upTo(8)),!0),o=Ks(i);return Ho.create(r,n,o)}async function Td(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 Qb(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function Yb(e){let{cid:t,blockLength:r}=await Td(e);return{bytes:await e.exactly(r,!0),cid:t}}async function Xb(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await Td(e),o={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(o.blockLength),o}function Zb(e){let t=(async()=>{let r=await _d(e);if(r.version===2){let n=e.pos-r.dataOffset;e=nv(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await Yb(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await Xb(e)}}}function ev(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 tv(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 rv(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return tv(r)}function nv(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 Ed=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 sc(ev(e))}static async fromIterable(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return sc(rv(e))}};async function sc(e){let t=Zb(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new Ed(r,n)}var qj=Yi(xu(),1),iv=Object.create,Wu=Object.defineProperty,ov=Object.getOwnPropertyDescriptor,Od=Object.getOwnPropertyNames,av=Object.getPrototypeOf,sv=Object.prototype.hasOwnProperty,Ze=(e,t)=>function(){return t||(0,e[Od(e)[0]])((t={exports:{}}).exports,t),t.exports},ei=(e,t)=>{for(var r in t)Wu(e,r,{get:t[r],enumerable:!0})},uv=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Od(t))!sv.call(e,i)&&i!==r&&Wu(e,i,{get:()=>t[i],enumerable:!(n=ov(t,i))||n.enumerable});return e},Or=(e,t,r)=>(r=e!=null?iv(av(e)):{},uv(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 R(){return w.clear()}p.Clear=R;function j(_){return w.delete(_)}p.Delete=j;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 R(){return w.clear()}p.Clear=R;function j(_){return w.delete(_)}p.Delete=j;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 R(v){return typeof v=="boolean"}p.IsBoolean=R;function j(v){return v instanceof globalThis.Date}p.IsDate=j;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 R(m){return g(m)||Ye(m)}function j(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)&&j(m.exclusiveMaximum)&&j(m.exclusiveMinimum)&&j(m.maximum)&&j(m.minimum)&&j(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 De(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=De;function ze(m){return Te(m,"Intersect")&&!(i.IsString(m.type)&&m.type!=="object")&&i.IsArray(m.allOf)&&m.allOf.every(Ue=>Ye(Ue)&&!bi(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 Sr(m)&&m[e.Kind]===Ue}p.TKindOf=Te;function Sr(m){return i.IsObject(m)&&e.Kind in m&&i.IsString(m[e.Kind])}p.TKind=Sr;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 qe(m){return Te(m,"Object")&&m.type==="object"&&x(m.$id)&&i.IsObject(m.properties)&&R(m.additionalProperties)&&U(m.minProperties)&&U(m.maxProperties)&&Object.entries(m.properties).every(([Ue,Ot])=>A(Ue)&&Ye(Ot))}p.TObject=qe;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)&&R(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 Ir(m){return Te(m,"Ref")&&x(m.$id)&&i.IsString(m.$ref)}p.TRef=Ir;function $n(m){return Te(m,"String")&&m.type==="string"&&x(m.$id)&&U(m.minLength)&&U(m.maxLength)&&_(m.pattern)&&c(m.format)}p.TString=$n;function Nn(m){return Te(m,"Symbol")&&m.type==="symbol"&&x(m.$id)}p.TSymbol=Nn;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 wo(m){return Te(m,"This")&&x(m.$id)&&i.IsString(m.$ref)}p.TThis=wo;function bi(m){return i.IsObject(m)&&e.Transform in m}p.TTransform=bi;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 _o(m){return Te(m,"Undefined")&&m.type==="undefined"&&x(m.$id)}p.TUndefined=_o;function vs(m){return Xr(m)&&m.anyOf.every(Ue=>Qr(Ue)||S(Ue))}p.TUnionLiteral=vs;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 jn(m){return Te(m,"Uint8Array")&&m.type==="Uint8Array"&&x(m.$id)&&U(m.minByteLength)&&U(m.maxByteLength)}p.TUint8Array=jn;function dt(m){return Te(m,"Unknown")&&x(m.$id)}p.TUnknown=dt;function To(m){return Te(m,"Unsafe")}p.TUnsafe=To;function vi(m){return Te(m,"Void")&&m.type==="void"&&x(m.$id)}p.TVoid=vi;function ws(m){return i.IsObject(m)&&m[e.Readonly]==="Readonly"}p.TReadonly=ws;function _s(m){return i.IsObject(m)&&m[e.Optional]==="Optional"}p.TOptional=_s;function Ye(m){return i.IsObject(m)&&(v(m)||b(m)||ie(m)||H(m)||P(m)||oe(m)||ve(m)||Oe(m)||De(m)||ze(m)||Jr(m)||C(m)||_e(m)||ae(m)||he(m)||Ce(m)||qe(m)||ft(m)||at(m)||Ir(m)||$n(m)||Nn(m)||Yr(m)||wo(m)||Qe(m)||_o(m)||Xr(m)||jn(m)||dt(m)||To(m)||vi(m)||Sr(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(R=>w(R)):A[e.Kind]==="Union"?A.anyOf.some(R=>w(R)):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 R(y){return a.TNever(y)||a.TIntersect(y)||a.TUnion(y)||a.TUnknown(y)||a.TAny(y)}function j(y,h){return a.TNever(h)?Te(y,h):a.TIntersect(h)?Oe(y,h):a.TUnion(h)?Ts(y,h):a.TUnknown(h)?Gl(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:R(h)?j(y,h):a.TArray(h)?w(Pe(y.items,h.items)):l.False}function c(y,h){return R(h)?j(y,h):a.TAsyncIterator(h)?w(Pe(y.items,h.items)):l.False}function O(y,h){return R(h)?j(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 R(h)?j(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 R(h)?j(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 R(h)?j(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 R(h)?j(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:R(h)?j(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 De(y,h){return y.allOf.some(Ie=>Pe(Ie,h)===l.True)?l.True:l.False}function ze(y,h){return R(h)?j(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:R(h)?j(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TString(h)?vi(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 Sr(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 R(h)?j(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 R(h)?j(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 qe(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 Ir(y){return Yr(y)}function $n(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 Nn(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 wo(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 bi(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)&&qe(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)&&qe(h)||a.TInteger(y)&&qe(h)||a.TBoolean(y)&&ft(h)||a.TUint8Array(y)&&Ir(h)||a.TDate(y)&&pt(h)||a.TConstructor(y)&&Nn(h)||a.TFunction(y)&&$n(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 _o(y,h){return R(h)?j(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(bi(y.properties[Ie],h.properties[Ie])===l.False)return l.False}return l.True})():l.False}function vs(y,h){return R(h)?j(y,h):a.TObject(h)&&wo(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 jn(y){return e.PatternNumberExact in y.patternProperties?y.patternProperties[e.PatternNumberExact]:e.PatternStringExact in y.patternProperties?y.patternProperties[e.PatternStringExact]:A("Unable to get record value schema")}function dt(y,h){let[Ie,fr]=[Xr(h),jn(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(bi(fr,y.properties[vy])===l.False)return l.False;return l.True})():l.False}function To(y,h){return R(h)?j(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?Pe(jn(y),jn(h)):l.False}function vi(y,h){return a.TLiteral(y)&&i.IsString(y.const)||a.TString(y)?l.True:l.False}function ws(y,h){return R(h)?j(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TString(h)?l.True:l.False}function _s(y,h){return R(h)?j(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(M.Resolve(y),h):a.TTemplateLiteral(h)?Pe(y,M.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 R(h)?j(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 R(h)?j(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 R(h)?j(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 Ts(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 Gl(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)?Ts(y,h):a.TAny(h)?U(y,h):a.TString(h)?vi(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)?Ts(y,h):a.TUnknown(h)?Gl(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)?De(y,h):a.TIterator(y)?ze(y,h):a.TLiteral(y)?Jr(y,h):a.TNever(y)?Sr(y,h):a.TNull(y)?pe(y,h):a.TNumber(y)?_e(y,h):a.TObject(y)?_o(y,h):a.TRecord(y)?To(y,h):a.TString(y)?ws(y,h):a.TSymbol(y)?_s(y,h):a.TTuple(y)?Ot(y,h):a.TPromise(y)?vs(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 R(_){return new Uint8Array(_)}function j(_){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(_)?R(_):i.IsObject(_)?j(_):_}function g(_){return _.map(c=>x(c))}p.Rest=g;function x(_,c={}){return{...U(_),...c}}p.Type=x})(d||(e.TypeClone=d={}));var k;(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 R(P){return P.some(H=>a.TOptional(H))}function j(P){return A(P.allOf)?e.Type.Optional(e.Type.Intersect(w(P.allOf))):P}function U(P){return R(P.anyOf)?e.Type.Optional(e.Type.Union(w(P.anyOf))):P}function g(P){return P[e.Kind]==="Intersect"?j(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})(k||(e.IndexedAccessor=k={}));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 R(O){return O.toUpperCase()}function j(O){return O.toLowerCase()}function U(O,v){let b=q.ParseExact(O.pattern);if(!N.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"?R(O):v==="Lowercase"?j(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(_=>j(_,x)),{...g})}function A(g,x){return e.Type.Union(g.anyOf.map(_=>j(_,x)),{...g})}function R(g,x){return x(g)}function j(g,x){return g[e.Kind]==="Intersect"?w(g,x):g[e.Kind]==="Union"?A(g,x):g[e.Kind]==="Object"?R(g,x):g}function U(g,x,_){return{...j(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 R(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 j(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)?R(c,O):a.TObject(c)?j(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 D;(function(p){function w(A){return Array.isArray(A)?A:a.TUnionLiteral(A)?A.anyOf.map(R=>R.const.toString()):a.TLiteral(A)?[A.const]:a.TTemplateLiteral(A)?(()=>{let R=q.ParseExact(A.pattern);if(!N.Check(R))throw new W("Cannot resolve keys from infinite template expression");return[...z.Generate(R)]})():[]}p.Resolve=w})(D||(e.KeyArrayResolver=D={}));var $;(function(p){function*w(R){for(let j of R.anyOf)j[e.Kind]==="Union"?yield*w(j):yield j}function A(R){return e.Type.Union([...w(R)],{...R})}p.Resolve=A})($||(e.UnionResolver=$={}));var F=class extends r{};e.TemplateLiteralPatternError=F;var K;(function(p){function w(U){throw new F(U)}function A(U){return U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function R(U,g){return a.TTemplateLiteral(U)?U.pattern.slice(1,U.pattern.length-1):a.TUnion(U)?`(${U.anyOf.map(x=>R(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 j(U){return`^${U.map(g=>R(g,"")).join("")}$`}p.Create=j})(K||(e.TemplateLiteralPattern=K={}));var M;(function(p){function w(A){let R=q.ParseExact(A.pattern);if(!N.Check(R))return e.Type.String();let j=[...z.Generate(R)].map(U=>e.Type.Literal(U));return e.Type.Union(j)}p.Resolve=w})(M||(e.TemplateLiteralResolver=M={}));var Q=class extends r{};e.TemplateLiteralParserError=Q;var q;(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 R(P,H){return w(P,H,")")}function j(P,H){return w(P,H,"|")}function U(P){if(!(A(P,0)&&R(P,P.length-1)))return!1;let H=0;for(let ie=0;ie<P.length;ie++)if(A(P,ie)&&(H+=1),R(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),R(P,ie)&&(H-=1),j(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),R(P,Oe)&&(H-=1),j(P,Oe)&&H===0){let De=P.slice(ie,Oe);De.length>0&&oe.push(v(De)),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 De=0;for(let ze=Oe;ze<ve.length;ze++)if(A(ve,ze)&&(De+=1),R(ve,ze)&&(De-=1),De===0)return[Oe,ze];throw new Q("TemplateLiteralParser: Unclosed group parens in expression")}function ie(ve,Oe){for(let De=Oe;De<ve.length;De++)if(A(ve,De))return[Oe,De];return[Oe,ve.length]}let oe=[];for(let ve=0;ve<P.length;ve++)if(A(P,ve)){let[Oe,De]=H(P,ve),ze=P.slice(Oe,De+1);oe.push(v(ze)),ve=De}else{let[Oe,De]=ie(P,ve),ze=P.slice(Oe,De);ze.length>0&&oe.push(v(ze)),ve=De-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})(q||(e.TemplateLiteralParser=q={}));var te=class extends r{};e.TemplateLiteralFiniteError=te;var N;(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 R(g){return g.type==="or"&&g.expr.length===2&&g.expr[0].type==="const"&&g.expr[0].const==="true"&&g.expr[1].type==="const"&&g.expr[1].const==="false"}function j(g){return g.type==="const"&&g.const===".*"}function U(g){return R(g)?!0:A(g)||j(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})(N||(e.TemplateLiteralFinite=N={}));var L=class extends r{};e.TemplateLiteralGeneratorError=L;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*R(g){for(let x of g.expr)yield*U(x)}function*j(g){return yield g.const}function*U(g){return g.type==="and"?yield*A(g):g.type==="or"?yield*R(g):g.type==="const"?yield*j(g):(()=>{throw new L("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=R(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)),_=R(U.slice(g+1));return yield*[...x,..._]}yield e.Type.Literal(U)}function*R(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 j(U){return[...R(U)]}p.Parse=j})(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:R=>w[e.Transform].Encode(p(R)),Decode:R=>this.decode(w[e.Transform].Decode(R))};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,R)=>{let{[R]:j,...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,{}),R=B.ResolveKeys(A,{includePatterns:!1}).reduce((j,U)=>({...j,[U]:e.Type.Index(A,[U])}),{});return e.Type.Object(R,w)}Enum(p,w={}){if(i.IsUndefined(p))return this.Throw("Enum undefined or empty");let A=Object.getOwnPropertyNames(p).filter(j=>isNaN(j)).map(j=>p[j]),R=[...new Set(A)].map(j=>e.Type.Literal(j));return this.Union(R,{...w,[e.Hint]:"Enum"})}Extends(p,w,A,R,j={}){switch(f.Extends(p,w)){case l.Union:return this.Union([d.Type(A,j),d.Type(R,j)]);case l.True:return d.Type(A,j);case l.False:return d.Type(R,j)}}Exclude(p,w,A={}){return a.TTemplateLiteral(p)?this.Exclude(M.Resolve(p),w,A):a.TTemplateLiteral(w)?this.Exclude(p,M.Resolve(w),A):a.TUnion(p)?(()=>{let R=p.anyOf.filter(j=>f.Extends(j,w)===l.False);return R.length===1?d.Type(R[0],A):this.Union(R,A)})():f.Extends(p,w)!==l.False?this.Never(A):d.Type(p,A)}Extract(p,w,A={}){return a.TTemplateLiteral(p)?this.Extract(M.Resolve(p),w,A):a.TTemplateLiteral(w)?this.Extract(p,M.Resolve(w),A):a.TUnion(p)?(()=>{let R=p.anyOf.filter(j=>f.Extends(j,w)!==l.False);return R.length===1?d.Type(R[0],A):this.Union(R,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 R=(i.IsUndefined(p.items)?[]:p.items).map(j=>d.Type(j));return this.Union(R,A)})():(()=>{let R=D.Resolve(w),j=d.Type(p);return k.Resolve(j,R,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)),R=d.Rest(p),j=a.TSchema(w.unevaluatedProperties)?{unevaluatedProperties:d.Type(w.unevaluatedProperties)}:{};return w.unevaluatedProperties===!1||a.TSchema(w.unevaluatedProperties)||A?this.Create({...w,...j,[e.Kind]:"Intersect",type:"object",allOf:R}):this.Create({...w,...j,[e.Kind]:"Intersect",allOf:R})}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((R,j)=>e.Type.Literal(j.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 R=A.map(j=>this.Literal(j));return this.Union(R,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),R=A.filter(x=>a.TOptional(p[x])),j=A.filter(x=>!R.includes(x)),U=a.TSchema(w.additionalProperties)?{additionalProperties:d.Type(w.additionalProperties)}:{},g=A.reduce((x,_)=>({...x,[_]:d.Type(p[_])}),{});return j.length>0?this.Create({...w,...U,[e.Kind]:"Object",type:"object",properties:g,required:j}):this.Create({...w,...U,[e.Kind]:"Object",type:"object",properties:g})}Omit(p,w,A={}){let R=D.Resolve(w);return T.Map(this.Discard(d.Type(p),["$id",e.Transform]),j=>{i.IsArray(j.required)&&(j.required=j.required.filter(U=>!R.includes(U)),j.required.length===0&&delete j.required);for(let U of Object.getOwnPropertyNames(j.properties))R.includes(U)&&delete j.properties[U];return this.Create(j)},A)}Partial(p,w={}){return T.Map(this.Discard(d.Type(p),["$id",e.Transform]),A=>{let R=Object.getOwnPropertyNames(A.properties).reduce((j,U)=>({...j,[U]:this.Optional(A.properties[U])}),{});return this.Object(R,this.Discard(A,["required"]))},w)}Pick(p,w,A={}){let R=D.Resolve(w);return T.Map(this.Discard(d.Type(p),["$id",e.Transform]),j=>{i.IsArray(j.required)&&(j.required=j.required.filter(U=>R.includes(U)),j.required.length===0&&delete j.required);for(let U of Object.getOwnPropertyNames(j.properties))R.includes(U)||delete j.properties[U];return this.Create(j)},A)}Record(p,w,A={}){return a.TTemplateLiteral(p)?(()=>{let R=q.ParseExact(p.pattern);return N.Check(R)?this.Object([...z.Generate(R)].reduce((j,U)=>({...j,[U]:d.Type(w)}),{}),A):this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[p.pattern]:d.Type(w)}})})():a.TUnion(p)?(()=>{let R=$.Resolve(p);if(a.TUnionLiteral(R)){let j=R.anyOf.reduce((U,g)=>({...U,[g.const]:d.Type(w)}),{});return this.Object(j,{...A,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():a.TLiteral(p)?i.IsString(p.const)||i.IsNumber(p.const)?this.Object({[p.const]:d.Type(w)},A):this.Throw("Record key of type literal is not of type string or number"):a.TInteger(p)||a.TNumber(p)?this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:d.Type(w)}}):a.TString(p)?(()=>{let R=i.IsUndefined(p.pattern)?e.PatternStringExact:p.pattern;return this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[R]: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 R=Object.getOwnPropertyNames(A.properties).reduce((j,U)=>({...j,[U]:this.Discard(A.properties[U],[e.Optional])}),{});return this.Object(R,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)?K.Create(re.Parse(p)):K.Create(p);return this.Create({...w,[e.Kind]:"TemplateLiteral",type:"string",pattern:A})}Transform(p){return new se(p)}Tuple(p,w={}){let[A,R,j]=[!1,p.length,p.length],U=d.Rest(p),g=p.length>0?{...w,[e.Kind]:"Tuple",type:"array",items:U,additionalItems:A,minItems:R,maxItems:j}:{...w,[e.Kind]:"Tuple",type:"array",minItems:R,maxItems:j};return this.Create(g)}Uncapitalize(p,w={}){return{...E.Map(d.Type(p),"Uncapitalize"),...w}}Union(p,w={}){return a.TTemplateLiteral(p)?M.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 R=d.Rest(A);return this.Create({...w,[e.Kind]:"Union",anyOf:R})})()}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=R=>R.length>0?(()=>{let[j,...U]=R;return[this.Awaited(j),...A(U)]})():R;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[R,j]=[d.Rest(p),d.Type(w)];return this.Create({...A,[e.Kind]:"Constructor",type:"Constructor",parameters:R,returns:j})}Date(p={}){return this.Create({...p,[e.Kind]:"Date",type:"Date"})}Function(p,w,A){let[R,j]=[d.Rest(p),d.Type(w)];return this.Create({...A,[e.Kind]:"Function",type:"Function",parameters:R,returns:j})}InstanceType(p,w={}){return d.Type(p.returns,w)}Iterator(p,w={}){return this.Create({...w,[e.Kind]:"Iterator",type:"Iterator",items:d.Type(p)})}Parameters(p,w={}){return this.Tuple(p.parameters,{...w})}Promise(p,w={}){return this.Create({...w,[e.Kind]:"Promise",type:"Promise",item:d.Type(p)})}RegExp(p,w={}){let A=i.IsString(p)?p:p.source;return this.Create({...w,[e.Kind]:"String",type:"string",pattern:A})}RegEx(p,w={}){return this.RegExp(p,w)}ReturnType(p,w={}){return d.Type(p.returns,w)}Symbol(p){return this.Create({...p,[e.Kind]:"Symbol",type:"symbol"})}Undefined(p={}){return this.Create({...p,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(p={}){return this.Create({...p,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(p={}){return this.Create({...p,[e.Kind]:"Void",type:"void"})}};e.JavaScriptTypeBuilder=ye,e.JsonType=new Z,e.Type=new ye}}),ti=Or(Gr(),1),{String:lv,Optional:cv,Boolean:fv,Object:dv,Number:pv}=ti.Type,hv=lv.bind(ti.Type),yv=pv.bind(ti.Type),Kj=dv.bind(ti.Type),Gj=cv.bind(ti.Type),gv=fv.bind(ti.Type),Hj=hv(),Wj=yv(),Jj=gv();function Xo(e){return Array.isArray(e)?e:[e]}var mv=["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 bv(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":vv(e)||"Object"}function vv(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(mv.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}`}},oo=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",wv=new TextEncoder;function Zo(e){return oo&&globalThis.Buffer.isBuffer(e)}function Ba(e){return e instanceof Uint8Array?Zo(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var _v=24,Tv=200,xd=oo?e=>e.length>=_v?globalThis.Buffer.from(e):uc(e):e=>e.length>=Tv?wv.encode(e):uc(e),pr=e=>Uint8Array.from(e),Ev=oo?(e,t,r)=>Zo(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Ov=oo?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Ba(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},xv=oo?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Ad(e,t){if(Zo(e)&&Zo(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 uc(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 lc=4096;function Av(e){let t=e.length;if(t<=lc)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=lc));return r}var Sv=256,Sd=class{constructor(e=Sv){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=xv(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=Ev(r,0,this.cursor)}else t=Ov(this.chunks,this.cursor);return e&&this.reset(),t}},Iv=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:",ao=[];ao[23]=1;ao[24]=2;ao[25]=3;ao[26]=5;ao[27]=9;function ri(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 _n(e,t,r){ri(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 Tn(e,t,r){ri(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 En(e,t,r){ri(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 On(e,t,r){ri(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 kv(e,t,r,n){return new ne(I.uint,_n(e,t+1,n),2)}function $v(e,t,r,n){return new ne(I.uint,Tn(e,t+1,n),3)}function Nv(e,t,r,n){return new ne(I.uint,En(e,t+1,n),5)}function jv(e,t,r,n){return new ne(I.uint,On(e,t+1,n),9)}function xn(e,t){return Bt(e,0,t.value)}function Bt(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`)}}xn.encodedSize=function(e){return Bt.encodedSize(e.value)};Bt.encodedSize=function(e){return e<it[0]?1:e<it[1]?2:e<it[2]?3:e<it[3]?5:9};xn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function Cv(e,t,r,n){return new ne(I.negint,-1-_n(e,t+1,n),2)}function Uv(e,t,r,n){return new ne(I.negint,-1-Tn(e,t+1,n),3)}function Pv(e,t,r,n){return new ne(I.negint,-1-En(e,t+1,n),5)}var Ju=BigInt(-1),Id=BigInt(1);function Rv(e,t,r,n){let i=On(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new 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,Ju-BigInt(i),9)}function Qu(e,t){let r=t.value,n=typeof r=="bigint"?r*Ju-Id:r*-1-1;Bt(e,t.type.majorEncoded,n)}Qu.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*Ju-Id:t*-1-1;return r<it[0]?1:r<it[1]?2:r<it[2]?3:r<it[3]?5:9};Qu.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function so(e,t,r,n){ri(e,t,r+n);let i=e.slice(t+r,t+r+n);return new ne(I.bytes,i,r+n)}function Dv(e,t,r,n){return so(e,t,1,r)}function Mv(e,t,r,n){return so(e,t,2,_n(e,t+1,n))}function Lv(e,t,r,n){return so(e,t,3,Tn(e,t+1,n))}function Bv(e,t,r,n){return so(e,t,5,En(e,t+1,n))}function Vv(e,t,r,n){let i=On(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer bytes lengths not supported`);return so(e,t,9,i)}function ea(e){return e.encodedBytes===void 0&&(e.encodedBytes=I.equals(e.type,I.string)?xd(e.value):e.value),e.encodedBytes}function Va(e,t){let r=ea(t);Bt(e,t.type.majorEncoded,r.length),e.push(r)}Va.encodedSize=function(e){let t=ea(e);return Bt.encodedSize(t.length)+t.length};Va.compareTokens=function(e,t){return Fv(ea(e),ea(t))};function Fv(e,t){return e.length<t.length?-1:e.length>t.length?1:Ad(e,t)}var cc=new TextDecoder,zv=32;function qv(e,t,r){if(r-t<zv){let n="";for(let i=t;i<r;i++){let o=e[i];if(o&128)return cc.decode(e.subarray(t,r));n+=String.fromCharCode(o)}return n}return cc.decode(e.subarray(t,r))}function uo(e,t,r,n,i){let o=r+n;ri(e,t,o);let a=new ne(I.string,qv(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=e.slice(t+r,t+o)),a}function Kv(e,t,r,n){return uo(e,t,1,r,n)}function Gv(e,t,r,n){return uo(e,t,2,_n(e,t+1,n),n)}function Hv(e,t,r,n){return uo(e,t,3,Tn(e,t+1,n),n)}function Wv(e,t,r,n){return uo(e,t,5,En(e,t+1,n),n)}function Jv(e,t,r,n){let i=On(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer string lengths not supported`);return uo(e,t,9,i,n)}var Qv=Va;function ni(e,t,r,n){return new ne(I.array,n,r)}function Yv(e,t,r,n){return ni(e,t,1,r)}function Xv(e,t,r,n){return ni(e,t,2,_n(e,t+1,n))}function Zv(e,t,r,n){return ni(e,t,3,Tn(e,t+1,n))}function e0(e,t,r,n){return ni(e,t,5,En(e,t+1,n))}function t0(e,t,r,n){let i=On(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer array lengths not supported`);return ni(e,t,9,i)}function r0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${be} indefinite length items not allowed`);return ni(e,t,1,1/0)}function Yu(e,t){Bt(e,I.array.majorEncoded,t.value)}Yu.compareTokens=xn.compareTokens;Yu.encodedSize=function(e){return Bt.encodedSize(e.value)};function ii(e,t,r,n){return new ne(I.map,n,r)}function n0(e,t,r,n){return ii(e,t,1,r)}function i0(e,t,r,n){return ii(e,t,2,_n(e,t+1,n))}function o0(e,t,r,n){return ii(e,t,3,Tn(e,t+1,n))}function a0(e,t,r,n){return ii(e,t,5,En(e,t+1,n))}function s0(e,t,r,n){let i=On(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer map lengths not supported`);return ii(e,t,9,i)}function u0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${be} indefinite length items not allowed`);return ii(e,t,1,1/0)}function Xu(e,t){Bt(e,I.map.majorEncoded,t.value)}Xu.compareTokens=xn.compareTokens;Xu.encodedSize=function(e){return Bt.encodedSize(e.value)};function l0(e,t,r,n){return new ne(I.tag,r,1)}function c0(e,t,r,n){return new ne(I.tag,_n(e,t+1,n),2)}function f0(e,t,r,n){return new ne(I.tag,Tn(e,t+1,n),3)}function d0(e,t,r,n){return new ne(I.tag,En(e,t+1,n),5)}function p0(e,t,r,n){return new ne(I.tag,On(e,t+1,n),9)}function Zu(e,t){Bt(e,I.tag.majorEncoded,t.value)}Zu.compareTokens=xn.compareTokens;Zu.encodedSize=function(e){return Bt.encodedSize(e.value)};var kd=20,$d=21,Nd=22,jd=23;function h0(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 y0(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 el(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 g0(e,t,r,n){return el(rl(e,t+1),3,n)}function m0(e,t,r,n){return el(nl(e,t+1),5,n)}function b0(e,t,r,n){return el(Rd(e,t+1),9,n)}function tl(e,t,r){let n=t.value;if(n===!1)e.push([I.float.majorEncoded|kd]);else if(n===!0)e.push([I.float.majorEncoded|$d]);else if(n===null)e.push([I.float.majorEncoded|Nd]);else if(n===void 0)e.push([I.float.majorEncoded|jd]);else{let i,o=!1;(!r||r.float64!==!0)&&(Ud(n),i=rl(Kt,1),n===i||Number.isNaN(n)?(Kt[0]=249,e.push(Kt.slice(0,3)),o=!0):(Pd(n),i=nl(Kt,1),n===i&&(Kt[0]=250,e.push(Kt.slice(0,5)),o=!0))),o||(v0(n),i=Rd(Kt,1),Kt[0]=251,e.push(Kt.slice(0,9)))}}tl.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){Ud(r);let n=rl(Kt,1);if(r===n||Number.isNaN(r))return 3;if(Pd(r),n=nl(Kt,1),r===n)return 5}return 9};var Cd=new ArrayBuffer(9),St=new DataView(Cd,1),Kt=new Uint8Array(Cd,0);function Ud(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 rl(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 Pd(e){St.setFloat32(0,e,!1)}function nl(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 v0(e){St.setFloat64(0,e,!1)}function Rd(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)}tl.compareTokens=xn.compareTokens;function je(e,t,r){throw new Error(`${be} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Fa(e){return()=>{throw new Error(`${be} ${e}`)}}var le=[];for(let e=0;e<=23;e++)le[e]=je;le[24]=kv;le[25]=$v;le[26]=Nv;le[27]=jv;le[28]=je;le[29]=je;le[30]=je;le[31]=je;for(let e=32;e<=55;e++)le[e]=je;le[56]=Cv;le[57]=Uv;le[58]=Pv;le[59]=Rv;le[60]=je;le[61]=je;le[62]=je;le[63]=je;for(let e=64;e<=87;e++)le[e]=Dv;le[88]=Mv;le[89]=Lv;le[90]=Bv;le[91]=Vv;le[92]=je;le[93]=je;le[94]=je;le[95]=Fa("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)le[e]=Kv;le[120]=Gv;le[121]=Hv;le[122]=Wv;le[123]=Jv;le[124]=je;le[125]=je;le[126]=je;le[127]=Fa("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)le[e]=Yv;le[152]=Xv;le[153]=Zv;le[154]=e0;le[155]=t0;le[156]=je;le[157]=je;le[158]=je;le[159]=r0;for(let e=160;e<=183;e++)le[e]=n0;le[184]=i0;le[185]=o0;le[186]=a0;le[187]=s0;le[188]=je;le[189]=je;le[190]=je;le[191]=u0;for(let e=192;e<=215;e++)le[e]=l0;le[216]=c0;le[217]=f0;le[218]=d0;le[219]=p0;le[220]=je;le[221]=je;le[222]=je;le[223]=je;for(let e=224;e<=243;e++)le[e]=Fa("simple values are not supported");le[244]=je;le[245]=je;le[246]=je;le[247]=h0;le[248]=Fa("simple values are not supported");le[249]=g0;le[250]=m0;le[251]=b0;le[252]=je;le[253]=je;le[254]=je;le[255]=y0;var lr=[];for(let e=0;e<24;e++)lr[e]=new ne(I.uint,e,1);for(let e=-1;e>=-24;e--)lr[31-e]=new ne(I.negint,e,1);lr[64]=new ne(I.bytes,new Uint8Array(0),1);lr[96]=new ne(I.string,"",1);lr[128]=new ne(I.array,0,1);lr[160]=new ne(I.map,0,1);lr[244]=new ne(I.false,!1,1);lr[245]=new ne(I.true,!0,1);lr[246]=new ne(I.null,null,1);function w0(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 _0=Object.freeze({float64:!0,mapSorter:x0,quickEncodeToken:w0});function Dd(){let e=[];return e[I.uint.major]=xn,e[I.negint.major]=Qu,e[I.bytes.major]=Va,e[I.string.major]=Qv,e[I.array.major]=Yu,e[I.map.major]=Xu,e[I.tag.major]=Zu,e[I.float.major]=tl,e}var T0=Dd(),E0=new Sd,fc=class Md{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 Md(r,t)}},Nr={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)},zr={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?Nr.true:Nr.false},null(e,t,r,n){return Nr.null},undefined(e,t,r,n){return Nr.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?[Nr.emptyArray,new ne(I.break)]:Nr.emptyArray;n=fc.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=No(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=fc.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++]=[No(f,r,n),No(d,r,n)])}l<a&&(s.length=l)}return s?.length?(O0(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?[Nr.emptyMap,new ne(I.break)]:Nr.emptyMap}};zr.Map=zr.Object;zr.Buffer=zr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))zr[`${e}Array`]=zr.DataView;function No(e,t={},r){let n=bv(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||zr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=zr[n];if(!o)throw new Error(`${on} unsupported type: ${n}`);return o(e,n,t,r)}function O0(e,t){t.mapSorter&&e.sort(t.mapSorter)}function x0(e,t){if(e[0]instanceof ne&&t[0]instanceof ne){let r=e[0],n=t[0];return r._keyBytes||(r._keyBytes=dc(r.value)),n._keyBytes||(n._keyBytes=dc(n.value)),Ad(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function dc(e){return Bd(e,T0,_0)}function Ld(e,t,r,n){if(Array.isArray(t))for(let i of t)Ld(e,i,r,n);else r[t.type.major](e,t,n)}var Qj=I.uint.majorEncoded,Yj=I.negint.majorEncoded,Xj=I.bytes.majorEncoded,Zj=I.string.majorEncoded,eC=I.array.majorEncoded,tC=I.float.majorEncoded|kd,rC=I.float.majorEncoded|$d,nC=I.float.majorEncoded|Nd,iC=I.float.majorEncoded|jd,oC=BigInt(-1),aC=BigInt(1);function Bd(e,t,r,n){let i=n instanceof Uint8Array,o=i?new Iv(n):E0,a=No(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 Sd(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():Ba(o.chunks[0])}}return o.reset(),Ld(o,a,t,r),o.toBytes(!0)}var A0={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},S0=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=lr[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}},Li=Symbol.for("DONE"),za=Symbol.for("BREAK");function I0(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=Bi(t,r);if(o===za){if(e.value===1/0)break;throw new Error(`${be} got unexpected break to lengthed array`)}if(o===Li)throw new Error(`${be} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function k0(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=Bi(t,r);if(u===za){if(e.value===1/0)break;throw new Error(`${be} got unexpected break to lengthed map`)}if(u===Li)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=Bi(t,r);if(l===Li)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 Bi(e,t){if(e.done())return Li;let r=e.next();if(I.equals(r.type,I.break))return za;if(r.type.terminal)return r.value;if(I.equals(r.type,I.array))return I0(r,e,t);if(I.equals(r.type,I.map))return k0(r,e,t);if(I.equals(r.type,I.tag)){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Bi(e,t);return t.tags[r.value](n)}throw new Error(`${be} tag not supported (${r.value})`)}throw new Error("unsupported")}function $0(e,t){if(!(e instanceof Uint8Array))throw new Error(`${be} data to decode must be a Uint8Array`);t=Object.assign({},A0,t);let r=Ba(e),n=t.tokenizer||new S0(r,t),i=Bi(n,t);if(i===Li)throw new Error(`${be} did not find any content to decode`);if(i===za)throw new Error(`${be} got unexpected break`);return[i,e.subarray(n.pos())]}function N0(e,t){let[r,n]=$0(e,t);if(n.length>0)throw new Error(`${be} too many terminals, data makes no sense`);return r}var j0={};ei(j0,{base36:()=>jo,base36upper:()=>K0});var sC=new Uint8Array(0);function C0(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 il(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 U0(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,D=0,$=T.length;D!==$&&T[D]===0;)D++,B++;for(var F=($-D)*f+1>>>0,K=new Uint8Array(F);D!==$;){for(var M=T[D],Q=0,q=F-1;(M!==0||Q<W)&&q!==-1;q--,Q++)M+=256*K[q]>>>0,K[q]=M%s>>>0,M=M/s>>>0;if(M!==0)throw new Error("Non-zero carry");W=Q,D++}for(var te=F-W;te!==F&&K[te]===0;)te++;for(var N=u.repeat(B);te<F;++te)N+=e.charAt(K[te]);return N}function k(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,D=0;T[B]===u;)W++,B++;for(var $=(T.length-B)*l+1>>>0,F=new Uint8Array($);T[B];){var K=r[T.charCodeAt(B)];if(K===255)return;for(var M=0,Q=$-1;(K!==0||M<D)&&Q!==-1;Q--,M++)K+=s*F[Q]>>>0,F[Q]=K%256>>>0,K=K/256>>>0;if(K!==0)throw new Error("Non-zero carry");D=M,B++}if(T[B]!==" "){for(var q=$-D;q!==$&&F[q]===0;)q++;for(var te=new Uint8Array(W+($-q)),N=W;q!==$;)te[N++]=F[q++];return te}}}function E(T){var B=k(T);if(B)return B;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:k,decode:E}}var P0=U0,R0=P0,D0=R0,M0=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")}},L0=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 Vd(this,e)}},B0=class{decoders;constructor(e){this.decoders=e}or(e){return Vd(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 Vd(e,t){return new B0({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var V0=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 M0(e,t,r),this.decoder=new L0(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Fd({name:e,prefix:t,encode:r,decode:n}){return new V0(e,t,r,n)}function qa({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=D0(r,e);return Fd({prefix:t,name:e,encode:n,decode:o=>il(i(o))})}function F0(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 z0(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 q0(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function _t({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=q0(n);return Fd({prefix:t,name:e,encode(o){return z0(o,n,r)},decode(o){return F0(o,i,r,e)}})}var jo=qa({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),K0=qa({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),G0=zd,pc=128,H0=127,W0=~H0,J0=Math.pow(2,31);function zd(e,t,r){t=t||[],r=r||0;for(var n=r;e>=J0;)t[r++]=e&255|pc,e/=128;for(;e&W0;)t[r++]=e&255|pc,e>>>=7;return t[r]=e|0,zd.bytes=r-n+1,t}var Q0=Hs,Y0=128,hc=127;function Hs(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Hs.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&hc)<<i:(a&hc)*Math.pow(2,i),i+=7}while(a>=Y0);return Hs.bytes=o-n,r}var X0=Math.pow(2,7),Z0=Math.pow(2,14),ew=Math.pow(2,21),tw=Math.pow(2,28),rw=Math.pow(2,35),nw=Math.pow(2,42),iw=Math.pow(2,49),ow=Math.pow(2,56),aw=Math.pow(2,63),sw=function(e){return e<X0?1:e<Z0?2:e<ew?3:e<tw?4:e<rw?5:e<nw?6:e<iw?7:e<ow?8:e<aw?9:10},uw={encode:G0,decode:Q0,encodingLength:sw},lw=uw,ta=lw;function Ws(e,t=0){return[ta.decode(e,t),ta.decode.bytes]}function ra(e,t,r=0){return ta.encode(e,t,r),t}function na(e){return ta.encodingLength(e)}function cw(e,t){let r=t.byteLength,n=na(e),i=n+na(r),o=new Uint8Array(i+r);return ra(e,o,0),ra(r,o,n),o.set(t,i),new ol(e,r,t,o)}function fw(e){let t=il(e),[r,n]=Ws(t),[i,o]=Ws(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new ol(r,i,a,t)}function dw(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&C0(e.bytes,r.bytes)}}var ol=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}},pw={};ei(pw,{base32:()=>Ci,base32hex:()=>mw,base32hexpad:()=>vw,base32hexpadupper:()=>ww,base32hexupper:()=>bw,base32pad:()=>yw,base32padupper:()=>gw,base32upper:()=>hw,base32z:()=>_w});var Ci=_t({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),hw=_t({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),yw=_t({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),gw=_t({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),mw=_t({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),bw=_t({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),vw=_t({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ww=_t({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),_w=_t({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Tw={};ei(Tw,{base58btc:()=>hr,base58flickr:()=>Ew});var hr=qa({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ew=qa({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});function yc(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return xw(r,Js(e),t??hr.encoder);default:return Aw(r,Js(e),t??Ci.encoder)}}var gc=new WeakMap;function Js(e){let t=gc.get(e);if(t==null){let r=new Map;return gc.set(e,r),r}return t}var Ka=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!==_i)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Sw)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=cw(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&&dw(t.multihash,n.multihash)}toString(t){return yc(this,t)}toJSON(){return{"/":yc(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??mc(n,i,o.bytes))}else if(r[Iw]===!0){let{version:n,multihash:i,code:o}=r,a=fw(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!==_i)throw new Error(`Version 0 CID must use dag-pb (code: ${_i}) block encoding`);return new ut(t,r,n,n.bytes)}case 1:{let i=mc(t,r,n.bytes);return new ut(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return ut.create(0,_i,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=il(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 ol(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,k]=Ws(t.subarray(r));return r+=k,d},i=n(),o=_i;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]=Ow(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 Js(o).set(n,t),o}};function Ow(e,t){switch(e[0]){case"Q":{let r=t??hr;return[hr.prefix,r.decode(`${hr.prefix}${e}`)]}case hr.prefix:{let r=t??hr;return[hr.prefix,r.decode(e)]}case Ci.prefix:{let r=t??Ci;return[Ci.prefix,r.decode(e)]}case jo.prefix:{let r=t??jo;return[jo.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 xw(e,t,r){let{prefix:n}=r;if(n!==hr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function Aw(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 _i=112,Sw=18;function mc(e,t,r){let n=na(e),i=n+na(t),o=new Uint8Array(i+r.byteLength);return ra(e,o,0),ra(t,o,n),o.set(r,i),o}var Iw=Symbol.for("@ipld/js-cid/CID");function kw(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function qd(e,t,r=""){let n=kw(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 bc(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 $w(e,t){qd(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 Qs(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ss(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function tr(e,t){return e<<32-t|e>>>t}function Nw(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 jw=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function Cw(e,t,r){return e&t^~e&r}function Uw(e,t,r){return e&t^e&r^t&r}var Pw=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=Ss(this.buffer)}update(e){bc(this),qd(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=Ss(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){bc(this),$w(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:o}=this;t[o++]=128,Qs(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=Ss(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]),uC=BigInt(2**32-1),Rw=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]),Cr=new Uint32Array(64),Dw=class extends Pw{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)Cr[f]=e.getUint32(t,!1);for(let f=16;f<64;f++){let d=Cr[f-15],k=Cr[f-2],E=tr(d,7)^tr(d,18)^d>>>3,T=tr(k,17)^tr(k,19)^k>>>10;Cr[f]=T+Cr[f-7]+E+Cr[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),k=l+d+Cw(a,s,u)+Rw[f]+Cr[f]|0,E=(tr(r,2)^tr(r,13)^tr(r,22))+Uw(r,n,i)|0;l=u,u=s,s=a,a=o+k|0,o=i,i=n,n=r,r=k+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(){Qs(Cr)}destroy(){this.set(0,0,0,0,0,0,0,0),Qs(this.buffer)}},Mw=class extends Dw{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)}},Lw=Nw(()=>new Mw,jw(1)),lC=new Uint8Array(0);function Bw(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 al(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 Vw(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,D=0,$=T.length;D!==$&&T[D]===0;)D++,B++;for(var F=($-D)*f+1>>>0,K=new Uint8Array(F);D!==$;){for(var M=T[D],Q=0,q=F-1;(M!==0||Q<W)&&q!==-1;q--,Q++)M+=256*K[q]>>>0,K[q]=M%s>>>0,M=M/s>>>0;if(M!==0)throw new Error("Non-zero carry");W=Q,D++}for(var te=F-W;te!==F&&K[te]===0;)te++;for(var N=u.repeat(B);te<F;++te)N+=e.charAt(K[te]);return N}function k(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,D=0;T[B]===u;)W++,B++;for(var $=(T.length-B)*l+1>>>0,F=new Uint8Array($);T[B];){var K=r[T.charCodeAt(B)];if(K===255)return;for(var M=0,Q=$-1;(K!==0||M<D)&&Q!==-1;Q--,M++)K+=s*F[Q]>>>0,F[Q]=K%256>>>0,K=K/256>>>0;if(K!==0)throw new Error("Non-zero carry");D=M,B++}if(T[B]!==" "){for(var q=$-D;q!==$&&F[q]===0;)q++;for(var te=new Uint8Array(W+($-q)),N=W;q!==$;)te[N++]=F[q++];return te}}}function E(T){var B=k(T);if(B)return B;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:k,decode:E}}var Fw=Vw,zw=Fw,qw=zw,Kw=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")}},Gw=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 Kd(this,e)}},Hw=class{decoders;constructor(e){this.decoders=e}or(e){return Kd(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 Kd(e,t){return new Hw({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Ww=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 Kw(e,t,r),this.decoder=new Gw(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Gd({name:e,prefix:t,encode:r,decode:n}){return new Ww(e,t,r,n)}function Ga({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=qw(r,e);return Gd({prefix:t,name:e,encode:n,decode:o=>al(i(o))})}function Jw(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 Qw(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 Yw(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=Yw(n);return Gd({prefix:t,name:e,encode(o){return Qw(o,n,r)},decode(o){return Jw(o,i,r,e)}})}var Co=Ga({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),cC=Ga({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Xw={};ei(Xw,{base64:()=>sl,base64pad:()=>Zw,base64url:()=>e1,base64urlpad:()=>t1});var sl=_t({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Zw=_t({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),e1=_t({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),t1=_t({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),r1={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"},n1=r1;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:n1[e];throw typeof i=="function"&&(i=i.apply(null,r)),new Error("[MobX] "+i)}var i1={};function Ha(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:i1}var Hd=Object.assign,ia=Object.getOwnPropertyDescriptor,nr=Object.defineProperty,lo=Object.prototype,oa=[];Object.freeze(oa);var ul={};Object.freeze(ul);var o1=typeof Proxy<"u",a1=Object.toString();function Wd(){o1||de("`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`")}function Ti(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 Vt(){return++X.mobxGuid}function ll(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Rn=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 Wa(e){return e!==null&&typeof e=="object"}function Yt(e){if(!Wa(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()===a1}function Jd(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Ja(e,t,r){nr(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function Qd(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 Wa(n)&&n[r]===!0}}function oi(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function s1(e){var t=Object.getPrototypeOf(e),r=Object.getPrototypeOf(t),n=Object.getPrototypeOf(r);return n===null}function yr(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var Yd=typeof Object.getOwnPropertySymbols<"u";function u1(e){var t=Object.keys(e);if(!Yd)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return lo.propertyIsEnumerable.call(e,n)})):t}var Qa=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Yd?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Ys(e){return typeof e=="string"?e:typeof e=="symbol"?e.toString():new String(e).toString()}function Xd(e){return e===null?null:typeof e=="object"?""+e:e}function Ut(e,t){return lo.hasOwnProperty.call(e,t)}var l1=Object.getOwnPropertyDescriptors||function(e){var t={};return Qa(e).forEach(function(r){t[r]=ia(e,r)}),t};function mt(e,t){return!!(e&t)}function bt(e,t,r){return r?e|=t:e&=~t,e}function vc(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 wc(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,f1(n.key),n)}}function ai(e,t,r){return t&&wc(e.prototype,t),r&&wc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Dn(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=d1(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 vr(){return vr=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},vr.apply(null,arguments)}function Zd(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,
|
|
1
|
+
import{e as Ts}from"./chunk-BKKH6BET.min.js";var wy=Object.create,Wf=Object.defineProperty,_y=Object.getOwnPropertyDescriptor,Ty=Object.getOwnPropertyNames,Ey=Object.getPrototypeOf,xy=Object.prototype.hasOwnProperty,Hn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Oy=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ty(t))!xy.call(e,i)&&i!==r&&Wf(e,i,{get:()=>t[i],enumerable:!(n=_y(t,i))||n.enumerable});return e},Yi=(e,t,r)=>(r=e!=null?wy(Ey(e)):{},Oy(t||!e||!e.__esModule?Wf(r,"default",{value:e,enumerable:!0}):r,e)),Ay=Hn((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=Hn((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,k=o.length;do{if(f>=k||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=Hn((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}}),xu=Hn((e,t)=>{"use strict";t.exports={encode:Ay(),decode:Sy(),encodingLength:Iy()}}),ky=Hn(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}),$y=Hn((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]},k={key:f,value:u[f]};return s(d,k)}}}(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,k=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<k.length;l++){var E=k[l],T=s(u[E]);T&&(f&&(f+=","),f+=JSON.stringify(E)+":"+T)}return a.splice(d,1),"{"+f+"}"}}(r)}}),Ny=["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 jy(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(Ny.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}`}},Xi=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Uy=new TextEncoder;function Fo(e){return Xi&&globalThis.Buffer.isBuffer(e)}function Ou(e){return e instanceof Uint8Array?Fo(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Py=24,Ry=200,Dy=Xi?e=>e.length>=Py?globalThis.Buffer.from(e):Hl(e):e=>e.length>=Ry?Uy.encode(e):Hl(e),dr=e=>Uint8Array.from(e),My=Xi?(e,t,r)=>Fo(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Ly=Xi?(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=Xi?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Jf(e,t){if(Fo(e)&&Fo(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 Hl(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,Qf=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=My(r,0,this.cursor)}else t=Ly(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}},Oe="CBOR decode error:",Yf="CBOR encode error:",Zi=[];Zi[23]=1;Zi[24]=2;Zi[25]=3;Zi[26]=5;Zi[27]=9;function Wn(e,t,r){if(e.length-t<r)throw new Error(`${Oe} not enough data for type`)}var rt=[24,256,65536,4294967296,BigInt("18446744073709551616")];function fn(e,t,r){Wn(e,t,1);let n=e[t];if(r.strict===!0&&n<rt[0])throw new Error(`${Oe} integer encoded in more bytes than necessary (strict decode)`);return n}function dn(e,t,r){Wn(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<rt[1])throw new Error(`${Oe} integer encoded in more bytes than necessary (strict decode)`);return n}function pn(e,t,r){Wn(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(`${Oe} integer encoded in more bytes than necessary (strict decode)`);return n}function hn(e,t,r){Wn(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(`${Oe} 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(`${Oe} 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 qy(e,t,r,n){return new me(G.uint,dn(e,t+1,n),3)}function Ky(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 Mt(e,0,t.value)}function Mt(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(`${Oe} encountered BigInt larger than allowable range`)}}yn.encodedSize=function(e){return Mt.encodedSize(e.value)};Mt.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 Au=BigInt(-1),Xf=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(`${Oe} integers outside of the safe integer range are not supported`);return new me(G.negint,Au-BigInt(i),9)}function Su(e,t){let r=t.value,n=typeof r=="bigint"?r*Au-Xf:r*-1-1;Mt(e,t.type.majorEncoded,n)}Su.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*Au-Xf:t*-1-1;return r<rt[0]?1:r<rt[1]?2:r<rt[2]?3:r<rt[3]?5:9};Su.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function eo(e,t,r,n){Wn(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 eo(e,t,1,r)}function Xy(e,t,r,n){return eo(e,t,2,fn(e,t+1,n))}function Zy(e,t,r,n){return eo(e,t,3,dn(e,t+1,n))}function eg(e,t,r,n){return eo(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(`${Oe} 64-bit integer bytes lengths not supported`);return eo(e,t,9,i)}function zo(e){return e.encodedBytes===void 0&&(e.encodedBytes=G.equals(e.type,G.string)?Dy(e.value):e.value),e.encodedBytes}function Ua(e,t){let r=zo(t);Mt(e,t.type.majorEncoded,r.length),e.push(r)}Ua.encodedSize=function(e){let t=zo(e);return Mt.encodedSize(t.length)+t.length};Ua.compareTokens=function(e,t){return rg(zo(e),zo(t))};function rg(e,t){return e.length<t.length?-1:e.length>t.length?1:Jf(e,t)}var Wl=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 Wl.decode(e.subarray(t,r));n+=String.fromCharCode(o)}return n}return Wl.decode(e.subarray(t,r))}function to(e,t,r,n,i){let o=r+n;Wn(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 to(e,t,1,r,n)}function ag(e,t,r,n){return to(e,t,2,fn(e,t+1,n),n)}function sg(e,t,r,n){return to(e,t,3,dn(e,t+1,n),n)}function ug(e,t,r,n){return to(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(`${Oe} 64-bit integer string lengths not supported`);return to(e,t,9,i,n)}var cg=Ua;function Jn(e,t,r,n){return new me(G.array,n,r)}function fg(e,t,r,n){return Jn(e,t,1,r)}function dg(e,t,r,n){return Jn(e,t,2,fn(e,t+1,n))}function pg(e,t,r,n){return Jn(e,t,3,dn(e,t+1,n))}function hg(e,t,r,n){return Jn(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(`${Oe} 64-bit integer array lengths not supported`);return Jn(e,t,9,i)}function gg(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Oe} indefinite length items not allowed`);return Jn(e,t,1,1/0)}function Iu(e,t){Mt(e,G.array.majorEncoded,t.value)}Iu.compareTokens=yn.compareTokens;Iu.encodedSize=function(e){return Mt.encodedSize(e.value)};function Qn(e,t,r,n){return new me(G.map,n,r)}function mg(e,t,r,n){return Qn(e,t,1,r)}function bg(e,t,r,n){return Qn(e,t,2,fn(e,t+1,n))}function vg(e,t,r,n){return Qn(e,t,3,dn(e,t+1,n))}function wg(e,t,r,n){return Qn(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(`${Oe} 64-bit integer map lengths not supported`);return Qn(e,t,9,i)}function Tg(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Oe} indefinite length items not allowed`);return Qn(e,t,1,1/0)}function ku(e,t){Mt(e,G.map.majorEncoded,t.value)}ku.compareTokens=yn.compareTokens;ku.encodedSize=function(e){return Mt.encodedSize(e.value)};function Eg(e,t,r,n){return new me(G.tag,r,1)}function xg(e,t,r,n){return new me(G.tag,fn(e,t+1,n),2)}function Og(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){Mt(e,G.tag.majorEncoded,t.value)}$u.compareTokens=yn.compareTokens;$u.encodedSize=function(e){return Mt.encodedSize(e.value)};var Zf=20,ed=21,td=22,rd=23;function Ig(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Oe} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new me(G.null,null,1):new me(G.undefined,void 0,1)}function kg(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Oe} indefinite length items not allowed`);return new me(G.break,void 0,1)}function Nu(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Oe} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Oe} Infinity values are not supported`)}return new me(G.float,e,t)}function $g(e,t,r,n){return Nu(Cu(e,t+1),3,n)}function Ng(e,t,r,n){return Nu(Uu(e,t+1),5,n)}function jg(e,t,r,n){return Nu(ad(e,t+1),9,n)}function ju(e,t,r){let n=t.value;if(n===!1)e.push([G.float.majorEncoded|Zf]);else if(n===!0)e.push([G.float.majorEncoded|ed]);else if(n===null)e.push([G.float.majorEncoded|td]);else if(n===void 0)e.push([G.float.majorEncoded|rd]);else{let i,o=!1;(!r||r.float64!==!0)&&(id(n),i=Cu(zt,1),n===i||Number.isNaN(n)?(zt[0]=249,e.push(zt.slice(0,3)),o=!0):(od(n),i=Uu(zt,1),n===i&&(zt[0]=250,e.push(zt.slice(0,5)),o=!0))),o||(Cg(n),i=ad(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){id(r);let n=Cu(zt,1);if(r===n||Number.isNaN(r))return 3;if(od(r),n=Uu(zt,1),r===n)return 5}return 9};var nd=new ArrayBuffer(9),At=new DataView(nd,1),zt=new Uint8Array(nd,0);function id(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 Cu(e,t){if(e.length-t<2)throw new Error(`${Oe} 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 od(e){At.setFloat32(0,e,!1)}function Uu(e,t){if(e.length-t<4)throw new Error(`${Oe} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function Cg(e){At.setFloat64(0,e,!1)}function ad(e,t){if(e.length-t<8)throw new Error(`${Oe} 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 $e(e,t,r){throw new Error(`${Oe} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Pa(e){return()=>{throw new Error(`${Oe} ${e}`)}}var ue=[];for(let e=0;e<=23;e++)ue[e]=$e;ue[24]=zy;ue[25]=qy;ue[26]=Ky;ue[27]=Gy;ue[28]=$e;ue[29]=$e;ue[30]=$e;ue[31]=$e;for(let e=32;e<=55;e++)ue[e]=$e;ue[56]=Hy;ue[57]=Wy;ue[58]=Jy;ue[59]=Qy;ue[60]=$e;ue[61]=$e;ue[62]=$e;ue[63]=$e;for(let e=64;e<=87;e++)ue[e]=Yy;ue[88]=Xy;ue[89]=Zy;ue[90]=eg;ue[91]=tg;ue[92]=$e;ue[93]=$e;ue[94]=$e;ue[95]=Pa("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]=$e;ue[125]=$e;ue[126]=$e;ue[127]=Pa("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]=$e;ue[157]=$e;ue[158]=$e;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]=$e;ue[189]=$e;ue[190]=$e;ue[191]=Tg;for(let e=192;e<=215;e++)ue[e]=Eg;ue[216]=xg;ue[217]=Og;ue[218]=Ag;ue[219]=Sg;ue[220]=$e;ue[221]=$e;ue[222]=$e;ue[223]=$e;for(let e=224;e<=243;e++)ue[e]=Pa("simple values are not supported");ue[244]=$e;ue[245]=$e;ue[246]=$e;ue[247]=Ig;ue[248]=Pa("simple values are not supported");ue[249]=$g;ue[250]=Ng;ue[251]=jg;ue[252]=$e;ue[253]=$e;ue[254]=$e;ue[255]=kg;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 Rg(){let e=[];return e[G.uint.major]=yn,e[G.negint.major]=Su,e[G.bytes.major]=Ua,e[G.string.major]=cg,e[G.array.major]=Iu,e[G.map.major]=ku,e[G.tag.major]=$u,e[G.float.major]=ju,e}var Dg=Rg(),Mg=new Qf,Jl=class sd{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(`${Yf} object contains circular references`);return new sd(r,t)}},kr={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?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 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?[kr.emptyArray,new me(G.break)]:kr.emptyArray;n=Jl.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=ko(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=Jl.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++]=[ko(f,r,n),ko(d,r,n)])}l<a&&(s.length=l)}return s?.length?(Lg(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?[kr.emptyMap,new me(G.break)]:kr.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 ko(e,t={},r){let n=jy(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(`${Yf} unsupported type: ${n}`);return o(e,n,t,r)}function Lg(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=Ql(r.value)),n._keyBytes||(n._keyBytes=Ql(n.value)),Jf(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function Ql(e){return Vg(e,Dg,Pg)}function ud(e,t,r,n){if(Array.isArray(t))for(let i of t)ud(e,i,r,n);else r[t.type.major](e,t,n)}var dj=G.uint.majorEncoded,pj=G.negint.majorEncoded,hj=G.bytes.majorEncoded,yj=G.string.majorEncoded,gj=G.array.majorEncoded,mj=G.float.majorEncoded|Zf,bj=G.float.majorEncoded|ed,vj=G.float.majorEncoded|td,wj=G.float.majorEncoded|rd,_j=BigInt(-1),Tj=BigInt(1);function Vg(e,t,r,n){let i=n instanceof Uint8Array,o=i?new Fy(n):Mg,a=ko(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 Qf(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(),ud(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(`${Oe} 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}},Di=Symbol.for("DONE"),Ra=Symbol.for("BREAK");function qg(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=Mi(t,r);if(o===Ra){if(e.value===1/0)break;throw new Error(`${Oe} got unexpected break to lengthed array`)}if(o===Di)throw new Error(`${Oe} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function Kg(e,t,r){let n=r.useMaps===!0,i=r.rejectDuplicateMapKeys===!0,o=n?void 0:{},a=n?new Map:void 0;for(let s=0;s<e.value;s++){let u=Mi(t,r);if(u===Ra){if(e.value===1/0)break;throw new Error(`${Oe} got unexpected break to lengthed map`)}if(u===Di)throw new Error(`${Oe} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(!n&&typeof u!="string")throw new Error(`${Oe} non-string keys not supported (got ${typeof u})`);if(i&&(n&&a.has(u)||!n&&Object.hasOwn(o,u)))throw new Error(`${Oe} found repeat map key "${u}"`);let l=Mi(t,r);if(l===Di)throw new Error(`${Oe} 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 Di;let r=e.next();if(G.equals(r.type,G.break))return Ra;if(r.type.terminal)return r.value;if(G.equals(r.type,G.array))return qg(r,e,t);if(G.equals(r.type,G.map))return Kg(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(`${Oe} tag not supported (${r.value})`)}throw new Error("unsupported")}function Gg(e,t){if(!(e instanceof Uint8Array))throw new Error(`${Oe} 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===Di)throw new Error(`${Oe} did not find any content to decode`);if(i===Ra)throw new Error(`${Oe} 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(`${Oe} too many terminals, data makes no sense`);return r}var Ej=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 Pu(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function 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,D=0,$=T.length;D!==$&&T[D]===0;)D++,B++;for(var F=($-D)*f+1>>>0,K=new Uint8Array(F);D!==$;){for(var M=T[D],Q=0,q=F-1;(M!==0||Q<W)&&q!==-1;q--,Q++)M+=256*K[q]>>>0,K[q]=M%s>>>0,M=M/s>>>0;if(M!==0)throw new Error("Non-zero carry");W=Q,D++}for(var te=F-W;te!==F&&K[te]===0;)te++;for(var N=u.repeat(B);te<F;++te)N+=e.charAt(K[te]);return N}function k(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,D=0;T[B]===u;)W++,B++;for(var $=(T.length-B)*l+1>>>0,F=new Uint8Array($);T[B];){var K=r[T.charCodeAt(B)];if(K===255)return;for(var M=0,Q=$-1;(K!==0||M<D)&&Q!==-1;Q--,M++)K+=s*F[Q]>>>0,F[Q]=K%256>>>0,K=K/256>>>0;if(K!==0)throw new Error("Non-zero carry");D=M,B++}if(T[B]!==" "){for(var q=$-D;q!==$&&F[q]===0;)q++;for(var te=new Uint8Array(W+($-q)),N=W;q!==$;)te[N++]=F[q++];return te}}}function E(T){var B=k(T);if(B)return B;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:k,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 ld(this,e)}},tm=class{decoders;constructor(e){this.decoders=e}or(e){return ld(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 ld(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 cd({name:e,prefix:t,encode:r,decode:n}){return new rm(e,t,r,n)}function Da({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Xg(r,e);return cd({prefix:t,name:e,encode:n,decode:o=>Pu(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 Tr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=om(n);return cd({prefix:t,name:e,encode(o){return im(o,n,r)},decode(o){return nm(o,i,r,e)}})}var $o=Tr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),xj=Tr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Oj=Tr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Aj=Tr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Sj=Tr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ij=Tr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),kj=Tr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),$j=Tr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Nj=Tr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Es=Da({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),jj=Da({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Ur=Da({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Cj=Da({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),am=fd,Yl=128,sm=127,um=~sm,lm=Math.pow(2,31);function fd(e,t,r){t=t||[],r=r||0;for(var n=r;e>=lm;)t[r++]=e&255|Yl,e/=128;for(;e&um;)t[r++]=e&255|Yl,e>>>=7;return t[r]=e|0,fd.bytes=r-n+1,t}var cm=Fs,fm=128,Xl=127;function Fs(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Fs.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Xl)<<i:(a&Xl)*Math.pow(2,i),i+=7}while(a>=fm);return Fs.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,qo=Em;function zs(e,t=0){return[qo.decode(e,t),qo.decode.bytes]}function Ko(e,t,r=0){return qo.encode(e,t,r),t}function Go(e){return qo.encodingLength(e)}function xm(e,t){let r=t.byteLength,n=Go(e),i=n+Go(r),o=new Uint8Array(i+r);return Ko(e,o,0),Ko(r,o,n),o.set(t,i),new Ru(e,r,t,o)}function qs(e){let t=Pu(e),[r,n]=zs(t),[i,o]=zs(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 Om(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 Ru=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Zl(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return Sm(r,Ks(e),t??Ur.encoder);default:return Im(r,Ks(e),t??$o.encoder)}}var ec=new WeakMap;function Ks(e){let t=ec.get(e);if(t==null){let r=new Map;return ec.set(e,r),r}return t}var Ho=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!==wi)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=xm(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&&Om(t.multihash,n.multihash)}toString(t){return Zl(this,t)}toJSON(){return{"/":Zl(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??tc(n,i,o.bytes))}else if(r[$m]===!0){let{version:n,multihash:i,code:o}=r,a=qs(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!==wi)throw new Error(`Version 0 CID must use dag-pb (code: ${wi}) block encoding`);return new st(t,r,n,n.bytes)}case 1:{let i=tc(t,r,n.bytes);return new st(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return st.create(0,wi,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=Pu(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),a=new Ru(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,k]=zs(t.subarray(r));return r+=k,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]=Am(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 Ks(o).set(n,t),o}};function Am(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)]}case Es.prefix:{let r=t??Es;return[Es.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 Sm(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 Im(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,km=18;function tc(e,t,r){let n=Go(e),i=n+Go(t),o=new Uint8Array(i+r.byteLength);return Ko(e,o,0),Ko(t,o,n),o.set(r,i),o}var $m=Symbol.for("@ipld/js-cid/CID"),dd=42;function Nm(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Ho.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new me(G.tag,dd),new me(G.bytes,r)]}function jm(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Cm(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 rc={float64:!0,typeEncoders:{Object:Nm,undefined:jm,number:Cm}},Uj={...rc,typeEncoders:{...rc.typeEncoders}};function Um(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Ho.decode(e.subarray(1))}var Wo={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Wo.tags[dd]=Um;var Pj={...Wo,tags:Wo.tags.slice()},Pm=e=>Hg(e,Wo),nn=Yi(xu(),1),xs={SHA2_256:18,LENGTH:32,DAG_PB:112},Rm=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 Dm(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 Mm(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 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},Si={"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=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: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=Si["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=Si.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}},Ii={"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=Ii["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=Ii["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=Ii["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=Ii.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}},Lm={toTyped:Si.CarV1HeaderOrV2Pragma,toRepresentation:Ii.CarV1HeaderOrV2Pragma},Bm=["string","number","bigint","symbol"],Vm=["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 Fm(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return Bm.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":zm(e)?"Buffer":qm(e)||"Object"}function zm(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function qm(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Vm.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}`}},Yn=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Km=new TextDecoder,Gm=new TextEncoder;function Qo(e){return Yn&&globalThis.Buffer.isBuffer(e)}function Hm(e){return e instanceof Uint8Array?Qo(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Wm=Yn?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):ic(e,t,r):(e,t,r)=>r-t>64?Km.decode(e.subarray(t,r)):ic(e,t,r),Jm=Yn?e=>e.length>64?globalThis.Buffer.from(e):nc(e):e=>e.length>64?Gm.encode(e):nc(e),Du=Yn?(e,t,r)=>Qo(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Qm=Yn?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Hm(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},Ym=Yn?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Xm(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 nc(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 ic(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 Zm(n)}var oc=4096;function Zm(e){let t=e.length;if(t<=oc)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=oc));return r}var eb=256,tb=class{constructor(e=eb){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=Ym(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=Du(r,0,this.cursor)}else t=Qm(this.chunks,this.cursor);return e&&this.reset(),t}},Ve="CBOR decode error:",pd="CBOR encode error:",ro=[];ro[23]=1;ro[24]=2;ro[25]=3;ro[26]=5;ro[27]=9;function Xn(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){Xn(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){Xn(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){Xn(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){Xn(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 rb(e,t,r,n){return new ge(Y.uint,gn(e,t+1,n),2)}function nb(e,t,r,n){return new ge(Y.uint,mn(e,t+1,n),3)}function ib(e,t,r,n){return new ge(Y.uint,bn(e,t+1,n),5)}function ob(e,t,r,n){return new ge(Y.uint,vn(e,t+1,n),9)}function wn(e,t){return Lt(e,0,t.value)}function Lt(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 Lt.encodedSize(e.value)};Lt.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 ab(e,t,r,n){return new ge(Y.negint,-1-gn(e,t+1,n),2)}function sb(e,t,r,n){return new ge(Y.negint,-1-mn(e,t+1,n),3)}function ub(e,t,r,n){return new ge(Y.negint,-1-bn(e,t+1,n),5)}var Mu=BigInt(-1),hd=BigInt(1);function lb(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,Mu-BigInt(i),9)}function Lu(e,t){let r=t.value,n=typeof r=="bigint"?r*Mu-hd:r*-1-1;Lt(e,t.type.majorEncoded,n)}Lu.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*Mu-hd:t*-1-1;return r<nt[0]?1:r<nt[1]?2:r<nt[2]?3:r<nt[3]?5:9};Lu.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function no(e,t,r,n){Xn(e,t,r+n);let i=Du(e,t+r,t+r+n);return new ge(Y.bytes,i,r+n)}function cb(e,t,r,n){return no(e,t,1,r)}function fb(e,t,r,n){return no(e,t,2,gn(e,t+1,n))}function db(e,t,r,n){return no(e,t,3,mn(e,t+1,n))}function pb(e,t,r,n){return no(e,t,5,bn(e,t+1,n))}function hb(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 no(e,t,9,i)}function Yo(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===Y.string?Jm(e.value):e.value),e.encodedBytes}function Ma(e,t){let r=Yo(t);Lt(e,t.type.majorEncoded,r.length),e.push(r)}Ma.encodedSize=function(e){let t=Yo(e);return Lt.encodedSize(t.length)+t.length};Ma.compareTokens=function(e,t){return yb(Yo(e),Yo(t))};function yb(e,t){return e.length<t.length?-1:e.length>t.length?1:Xm(e,t)}function io(e,t,r,n,i){let o=r+n;Xn(e,t,o);let a=new ge(Y.string,Wm(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=Du(e,t+r,t+o)),a}function gb(e,t,r,n){return io(e,t,1,r,n)}function mb(e,t,r,n){return io(e,t,2,gn(e,t+1,n),n)}function bb(e,t,r,n){return io(e,t,3,mn(e,t+1,n),n)}function vb(e,t,r,n){return io(e,t,5,bn(e,t+1,n),n)}function wb(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 io(e,t,9,i,n)}var _b=Ma;function Zn(e,t,r,n){return new ge(Y.array,n,r)}function Tb(e,t,r,n){return Zn(e,t,1,r)}function Eb(e,t,r,n){return Zn(e,t,2,gn(e,t+1,n))}function xb(e,t,r,n){return Zn(e,t,3,mn(e,t+1,n))}function Ob(e,t,r,n){return Zn(e,t,5,bn(e,t+1,n))}function Ab(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 Zn(e,t,9,i)}function Sb(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 Bu(e,t){Lt(e,Y.array.majorEncoded,t.value)}Bu.compareTokens=wn.compareTokens;Bu.encodedSize=function(e){return Lt.encodedSize(e.value)};function ei(e,t,r,n){return new ge(Y.map,n,r)}function Ib(e,t,r,n){return ei(e,t,1,r)}function kb(e,t,r,n){return ei(e,t,2,gn(e,t+1,n))}function $b(e,t,r,n){return ei(e,t,3,mn(e,t+1,n))}function Nb(e,t,r,n){return ei(e,t,5,bn(e,t+1,n))}function jb(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 ei(e,t,9,i)}function Cb(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ve} indefinite length items not allowed`);return ei(e,t,1,1/0)}function Vu(e,t){Lt(e,Y.map.majorEncoded,t.value)}Vu.compareTokens=wn.compareTokens;Vu.encodedSize=function(e){return Lt.encodedSize(e.value)};function Ub(e,t,r,n){return new ge(Y.tag,r,1)}function Pb(e,t,r,n){return new ge(Y.tag,gn(e,t+1,n),2)}function Rb(e,t,r,n){return new ge(Y.tag,mn(e,t+1,n),3)}function Db(e,t,r,n){return new ge(Y.tag,bn(e,t+1,n),5)}function Mb(e,t,r,n){return new ge(Y.tag,vn(e,t+1,n),9)}function Fu(e,t){Lt(e,Y.tag.majorEncoded,t.value)}Fu.compareTokens=wn.compareTokens;Fu.encodedSize=function(e){return Lt.encodedSize(e.value)};var Lb=20,Bb=21,Vb=22,Fb=23;function zb(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 qb(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 zu(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 Kb(e,t,r,n){return zu(Ku(e,t+1),3,n)}function Gb(e,t,r,n){return zu(Gu(e,t+1),5,n)}function Hb(e,t,r,n){return zu(bd(e,t+1),9,n)}function qu(e,t,r){let n=t.value;if(n===!1)e.push([Y.float.majorEncoded|Lb]);else if(n===!0)e.push([Y.float.majorEncoded|Bb]);else if(n===null)e.push([Y.float.majorEncoded|Vb]);else if(n===void 0)e.push([Y.float.majorEncoded|Fb]);else{let i,o=!1;(!r||r.float64!==!0)&&(gd(n),i=Ku(qt,1),n===i||Number.isNaN(n)?(qt[0]=249,e.push(qt.slice(0,3)),o=!0):(md(n),i=Gu(qt,1),n===i&&(qt[0]=250,e.push(qt.slice(0,5)),o=!0))),o||(Wb(n),i=bd(qt,1),qt[0]=251,e.push(qt.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){gd(r);let n=Ku(qt,1);if(r===n||Number.isNaN(r))return 3;if(md(r),n=Gu(qt,1),r===n)return 5}return 9};var yd=new ArrayBuffer(9),St=new DataView(yd,1),qt=new Uint8Array(yd,0);function gd(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 Ku(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 md(e){St.setFloat32(0,e,!1)}function Gu(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 Wb(e){St.setFloat64(0,e,!1)}function bd(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 Ne(e,t,r){throw new Error(`${Ve} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function La(e){return()=>{throw new Error(`${Ve} ${e}`)}}var fe=[];for(let e=0;e<=23;e++)fe[e]=Ne;fe[24]=rb;fe[25]=nb;fe[26]=ib;fe[27]=ob;fe[28]=Ne;fe[29]=Ne;fe[30]=Ne;fe[31]=Ne;for(let e=32;e<=55;e++)fe[e]=Ne;fe[56]=ab;fe[57]=sb;fe[58]=ub;fe[59]=lb;fe[60]=Ne;fe[61]=Ne;fe[62]=Ne;fe[63]=Ne;for(let e=64;e<=87;e++)fe[e]=cb;fe[88]=fb;fe[89]=db;fe[90]=pb;fe[91]=hb;fe[92]=Ne;fe[93]=Ne;fe[94]=Ne;fe[95]=La("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)fe[e]=gb;fe[120]=mb;fe[121]=bb;fe[122]=vb;fe[123]=wb;fe[124]=Ne;fe[125]=Ne;fe[126]=Ne;fe[127]=La("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)fe[e]=Tb;fe[152]=Eb;fe[153]=xb;fe[154]=Ob;fe[155]=Ab;fe[156]=Ne;fe[157]=Ne;fe[158]=Ne;fe[159]=Sb;for(let e=160;e<=183;e++)fe[e]=Ib;fe[184]=kb;fe[185]=$b;fe[186]=Nb;fe[187]=jb;fe[188]=Ne;fe[189]=Ne;fe[190]=Ne;fe[191]=Cb;for(let e=192;e<=215;e++)fe[e]=Ub;fe[216]=Pb;fe[217]=Rb;fe[218]=Db;fe[219]=Mb;fe[220]=Ne;fe[221]=Ne;fe[222]=Ne;fe[223]=Ne;for(let e=224;e<=243;e++)fe[e]=La("simple values are not supported");fe[244]=Ne;fe[245]=Ne;fe[246]=Ne;fe[247]=zb;fe[248]=La("simple values are not supported");fe[249]=Kb;fe[250]=Gb;fe[251]=Hb;fe[252]=Ne;fe[253]=Ne;fe[254]=Ne;fe[255]=qb;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 vd(){let e=[];return e[Y.uint.major]=wn,e[Y.negint.major]=Lu,e[Y.bytes.major]=Ma,e[Y.string.major]=_b,e[Y.array.major]=Bu,e[Y.map.major]=Vu,e[Y.tag.major]=Fu,e[Y.float.major]=qu,e}var Rj=vd(),Dj=new tb,ac=class wd{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(`${pd} object contains circular references`);return new wd(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=ac.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=Os(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=ac.createCheck(n,e);let s=[],u=0;for(let l of o)s[u++]=[Os(l,r,n),Os(i?e.get(l):e[l],r,n)];return Jb(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 Os(e,t={},r){let n=Fm(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(`${pd} unsupported type: ${n}`);return o(e,n,t,r)}function Jb(e,t){t.mapSorter&&e.sort(t.mapSorter)}var Mj=Symbol.for("DONE"),Lj=Symbol.for("BREAK"),Bj=vd(),Vj=Yi(xu(),1),Fj=[new ge(Y.map,2),new ge(Y.string,"version"),new ge(Y.uint,1),new ge(Y.string,"roots")],zj=new ge(Y.tag,42);async function _d(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=Pm(n);if(Lm.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=Dm(await e.exactly(Rm,!0));e.seek(o.dataOffset-e.pos);let a=await _d(e,1);return Object.assign(a,o)}async function Qb(e){let t=await e.exactly(2,!1);if(t[0]===xs.SHA2_256&&t[1]===xs.LENGTH){let a=await e.exactly(34,!0),s=qs(a);return Ho.create(0,xs.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(Mm(await e.upTo(8)),!0),o=qs(i);return Ho.create(r,n,o)}async function Td(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 Qb(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function Yb(e){let{cid:t,blockLength:r}=await Td(e);return{bytes:await e.exactly(r,!0),cid:t}}async function Xb(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await Td(e),o={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(o.blockLength),o}function Zb(e){let t=(async()=>{let r=await _d(e);if(r.version===2){let n=e.pos-r.dataOffset;e=nv(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await Yb(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await Xb(e)}}}function ev(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 tv(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 rv(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return tv(r)}function nv(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 Ed=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 sc(ev(e))}static async fromIterable(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return sc(rv(e))}};async function sc(e){let t=Zb(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new Ed(r,n)}var qj=Yi(xu(),1),iv=Object.create,Hu=Object.defineProperty,ov=Object.getOwnPropertyDescriptor,xd=Object.getOwnPropertyNames,av=Object.getPrototypeOf,sv=Object.prototype.hasOwnProperty,Ze=(e,t)=>function(){return t||(0,e[xd(e)[0]])((t={exports:{}}).exports,t),t.exports},ti=(e,t)=>{for(var r in t)Hu(e,r,{get:t[r],enumerable:!0})},uv=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of xd(t))!sv.call(e,i)&&i!==r&&Hu(e,i,{get:()=>t[i],enumerable:!(n=ov(t,i))||n.enumerable});return e},xr=(e,t,r)=>(r=e!=null?iv(av(e)):{},uv(t||!e||!e.__esModule?Hu(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 R(){return w.clear()}p.Clear=R;function j(_){return w.delete(_)}p.Delete=j;function U(_){return w.has(_)}p.Has=U;function g(_,c){w.set(_,c)}p.Set=g;function O(_){return w.get(_)}p.Get=O})(t||(e.TypeRegistry=t={}));var r=class extends Error{constructor(p){super(p)}};e.TypeBoxError=r;var n;(function(p){let w=new Map;function A(){return new Map(w)}p.Entries=A;function R(){return w.clear()}p.Clear=R;function j(_){return w.delete(_)}p.Delete=j;function U(_){return w.has(_)}p.Has=U;function g(_,c){w.set(_,c)}p.Set=g;function O(_){return w.get(_)}p.Get=O})(n||(e.FormatRegistry=n={}));var i;(function(p){function w(v){return Array.isArray(v)}p.IsArray=w;function A(v){return typeof v=="bigint"}p.IsBigInt=A;function R(v){return typeof v=="boolean"}p.IsBoolean=R;function j(v){return v instanceof globalThis.Date}p.IsDate=j;function U(v){return v===null}p.IsNull=U;function g(v){return typeof v=="number"}p.IsNumber=g;function O(v){return typeof v=="object"&&v!==null}p.IsObject=O;function _(v){return typeof v=="string"}p.IsString=_;function c(v){return v instanceof globalThis.Uint8Array}p.IsUint8Array=c;function x(v){return v===void 0}p.IsUndefined=x})(i||(e.ValueGuard=i={}));var o=class extends r{};e.TypeGuardUnknownTypeError=o;var a;(function(p){function w(m){try{return new RegExp(m),!0}catch{return!1}}function A(m){if(!i.IsString(m))return!1;for(let 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 R(m){return g(m)||Ye(m)}function j(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 O(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 x(m){return i.IsUndefined(m)||Ye(m)}function v(m){return Te(m,"Any")&&O(m.$id)}p.TAny=v;function b(m){return Te(m,"Array")&&m.type==="array"&&O(m.$id)&&Ye(m.items)&&U(m.minItems)&&U(m.maxItems)&&g(m.uniqueItems)&&x(m.contains)&&U(m.minContains)&&U(m.maxContains)}p.TArray=b;function P(m){return Te(m,"AsyncIterator")&&m.type==="AsyncIterator"&&O(m.$id)&&Ye(m.items)}p.TAsyncIterator=P;function H(m){return Te(m,"BigInt")&&m.type==="bigint"&&O(m.$id)&&j(m.exclusiveMaximum)&&j(m.exclusiveMinimum)&&j(m.maximum)&&j(m.minimum)&&j(m.multipleOf)}p.TBigInt=H;function ie(m){return Te(m,"Boolean")&&m.type==="boolean"&&O(m.$id)}p.TBoolean=ie;function oe(m){return Te(m,"Constructor")&&m.type==="Constructor"&&O(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"&&O(m.$id)&&U(m.exclusiveMaximumTimestamp)&&U(m.exclusiveMinimumTimestamp)&&U(m.maximumTimestamp)&&U(m.minimumTimestamp)&&U(m.multipleOfTimestamp)}p.TDate=ve;function xe(m){return Te(m,"Function")&&m.type==="Function"&&O(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Ue=>Ye(Ue))&&Ye(m.returns)}p.TFunction=xe;function De(m){return Te(m,"Integer")&&m.type==="integer"&&O(m.$id)&&U(m.exclusiveMaximum)&&U(m.exclusiveMinimum)&&U(m.maximum)&&U(m.minimum)&&U(m.multipleOf)}p.TInteger=De;function qe(m){return Te(m,"Intersect")&&!(i.IsString(m.type)&&m.type!=="object")&&i.IsArray(m.allOf)&&m.allOf.every(Ue=>Ye(Ue)&&!bi(Ue))&&O(m.type)&&(g(m.unevaluatedProperties)||x(m.unevaluatedProperties))&&O(m.$id)}p.TIntersect=qe;function Jr(m){return Te(m,"Iterator")&&m.type==="Iterator"&&O(m.$id)&&Ye(m.items)}p.TIterator=Jr;function Te(m,Ue){return Sr(m)&&m[e.Kind]===Ue}p.TKindOf=Te;function Sr(m){return i.IsObject(m)&&e.Kind in m&&i.IsString(m[e.Kind])}p.TKind=Sr;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")&&O(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"&&O(m.$id)}p.TNull=he;function Ce(m){return Te(m,"Number")&&m.type==="number"&&O(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"&&O(m.$id)&&i.IsObject(m.properties)&&R(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"&&O(m.$id)&&Ye(m.item)}p.TPromise=ft;function at(m){return Te(m,"Record")&&m.type==="object"&&O(m.$id)&&R(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 Ir(m){return Te(m,"Ref")&&O(m.$id)&&i.IsString(m.$ref)}p.TRef=Ir;function Nn(m){return Te(m,"String")&&m.type==="string"&&O(m.$id)&&U(m.minLength)&&U(m.maxLength)&&_(m.pattern)&&c(m.format)}p.TString=Nn;function jn(m){return Te(m,"Symbol")&&m.type==="symbol"&&O(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 wo(m){return Te(m,"This")&&O(m.$id)&&i.IsString(m.$ref)}p.TThis=wo;function bi(m){return i.IsObject(m)&&e.Transform in m}p.TTransform=bi;function Qe(m){return Te(m,"Tuple")&&m.type==="array"&&O(m.$id)&&i.IsNumber(m.minItems)&&i.IsNumber(m.maxItems)&&m.minItems===m.maxItems&&(i.IsUndefined(m.items)&&i.IsUndefined(m.additionalItems)&&m.minItems===0||i.IsArray(m.items)&&m.items.every(Ue=>Ye(Ue)))}p.TTuple=Qe;function _o(m){return Te(m,"Undefined")&&m.type==="undefined"&&O(m.$id)}p.TUndefined=_o;function bs(m){return Xr(m)&&m.anyOf.every(Ue=>Qr(Ue)||S(Ue))}p.TUnionLiteral=bs;function Xr(m){return Te(m,"Union")&&O(m.$id)&&i.IsObject(m)&&i.IsArray(m.anyOf)&&m.anyOf.every(Ue=>Ye(Ue))}p.TUnion=Xr;function Cn(m){return Te(m,"Uint8Array")&&m.type==="Uint8Array"&&O(m.$id)&&U(m.minByteLength)&&U(m.maxByteLength)}p.TUint8Array=Cn;function dt(m){return Te(m,"Unknown")&&O(m.$id)}p.TUnknown=dt;function To(m){return Te(m,"Unsafe")}p.TUnsafe=To;function vi(m){return Te(m,"Void")&&m.type==="void"&&O(m.$id)}p.TVoid=vi;function vs(m){return i.IsObject(m)&&m[e.Readonly]==="Readonly"}p.TReadonly=vs;function ws(m){return i.IsObject(m)&&m[e.Optional]==="Optional"}p.TOptional=ws;function Ye(m){return i.IsObject(m)&&(v(m)||b(m)||ie(m)||H(m)||P(m)||oe(m)||ve(m)||xe(m)||De(m)||qe(m)||Jr(m)||C(m)||_e(m)||ae(m)||he(m)||Ce(m)||Ke(m)||ft(m)||at(m)||Ir(m)||Nn(m)||jn(m)||Yr(m)||wo(m)||Qe(m)||_o(m)||Xr(m)||Cn(m)||dt(m)||To(m)||vi(m)||Sr(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(R=>w(R)):A[e.Kind]==="Union"?A.anyOf.some(R=>w(R)):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 R(y){return a.TNever(y)||a.TIntersect(y)||a.TUnion(y)||a.TUnknown(y)||a.TAny(y)}function j(y,h){return a.TNever(h)?Te(y,h):a.TIntersect(h)?xe(y,h):a.TUnion(h)?_s(y,h):a.TUnknown(h)?Gl(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)?xe(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 O(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:R(h)?j(y,h):a.TArray(h)?w(Pe(y.items,h.items)):l.False}function c(y,h){return R(h)?j(y,h):a.TAsyncIterator(h)?w(Pe(y.items,h.items)):l.False}function x(y,h){return R(h)?j(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 R(h)?j(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 R(h)?j(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 R(h)?j(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 R(h)?j(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:R(h)?j(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):l.False}function xe(y,h){return h.allOf.every(Ie=>Pe(y,Ie)===l.True)?l.True:l.False}function De(y,h){return y.allOf.some(Ie=>Pe(Ie,h)===l.True)?l.True:l.False}function qe(y,h){return R(h)?j(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:R(h)?j(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TString(h)?vi(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 Sr(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 R(h)?j(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 R(h)?j(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 Ir(y){return Yr(y)}function Nn(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 wo(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 bi(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)&&Ir(h)||a.TDate(y)&&pt(h)||a.TConstructor(y)&&jn(h)||a.TFunction(y)&&Nn(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 _o(y,h){return R(h)?j(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(bi(y.properties[Ie],h.properties[Ie])===l.False)return l.False}return l.True})():l.False}function bs(y,h){return R(h)?j(y,h):a.TObject(h)&&wo(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 Cn(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),Cn(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(bi(fr,y.properties[vy])===l.False)return l.False;return l.True})():l.False}function To(y,h){return R(h)?j(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?Pe(Cn(y),Cn(h)):l.False}function vi(y,h){return a.TLiteral(y)&&i.IsString(y.const)||a.TString(y)?l.True:l.False}function vs(y,h){return R(h)?j(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TString(h)?l.True:l.False}function ws(y,h){return R(h)?j(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(M.Resolve(y),h):a.TTemplateLiteral(h)?Pe(y,M.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 R(h)?j(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 R(h)?j(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 R(h)?j(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 _s(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 Gl(y,h){return l.True}function yy(y,h){return a.TNever(h)?Te(y,h):a.TIntersect(h)?xe(y,h):a.TUnion(h)?_s(y,h):a.TAny(h)?U(y,h):a.TString(h)?vi(y,h):a.TNumber(h)?C(y,h):a.TInteger(h)?oe(y,h):a.TBoolean(h)?v(y,h):a.TArray(h)?O(y,h):a.TTuple(h)?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)?xe(y,h):a.TUnion(h)?_s(y,h):a.TUnknown(h)?Gl(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)?x(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)?De(y,h):a.TIterator(y)?qe(y,h):a.TLiteral(y)?Jr(y,h):a.TNever(y)?Sr(y,h):a.TNull(y)?pe(y,h):a.TNumber(y)?_e(y,h):a.TObject(y)?_o(y,h):a.TRecord(y)?To(y,h):a.TString(y)?vs(y,h):a.TSymbol(y)?ws(y,h):a.TTuple(y)?Ot(y,h):a.TPromise(y)?bs(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 R(_){return new Uint8Array(_)}function j(_){let c=Object.getOwnPropertyNames(_).reduce((v,b)=>({...v,[b]:U(_[b])}),{}),x=Object.getOwnPropertySymbols(_).reduce((v,b)=>({...v,[b]:U(_[b])}),{});return{...c,...x}}function U(_){return i.IsArray(_)?w(_):i.IsDate(_)?A(_):i.IsUint8Array(_)?R(_):i.IsObject(_)?j(_):_}function g(_){return _.map(c=>O(c))}p.Rest=g;function O(_,c={}){return{...U(_),...c}}p.Type=O})(d||(e.TypeClone=d={}));var k;(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 R(P){return P.some(H=>a.TOptional(H))}function j(P){return A(P.allOf)?e.Type.Optional(e.Type.Intersect(w(P.allOf))):P}function U(P){return R(P.anyOf)?e.Type.Optional(e.Type.Union(w(P.anyOf))):P}function g(P){return P[e.Kind]==="Intersect"?j(P):P[e.Kind]==="Union"?U(P):P}function O(P,H){let ie=P.allOf.reduce((oe,ve)=>{let xe=v(ve,H);return xe[e.Kind]==="Never"?oe:[...oe,xe]},[]);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 x(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"?O(P,H):P[e.Kind]==="Union"?_(P,H):P[e.Kind]==="Object"?c(P,H):P[e.Kind]==="Tuple"?x(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})(k||(e.IndexedAccessor=k={}));var E;(function(p){function w(x){let[v,b]=[x.slice(0,1),x.slice(1)];return`${v.toLowerCase()}${b}`}function A(x){let[v,b]=[x.slice(0,1),x.slice(1)];return`${v.toUpperCase()}${b}`}function R(x){return x.toUpperCase()}function j(x){return x.toLowerCase()}function U(x,v){let b=q.ParseExact(x.pattern);if(!N.Check(b))return{...x,pattern:g(x.pattern,v)};let P=[...z.Generate(b)].map(oe=>e.Type.Literal(oe)),H=O(P,v),ie=e.Type.Union(H);return e.Type.TemplateLiteral([ie])}function g(x,v){return typeof x=="string"?v==="Uncapitalize"?w(x):v==="Capitalize"?A(x):v==="Uppercase"?R(x):v==="Lowercase"?j(x):x:x.toString()}function O(x,v){if(x.length===0)return[];let[b,...P]=x;return[c(b,v),...O(P,v)]}function _(x,v){return a.TTemplateLiteral(x)?U(x,v):a.TUnion(x)?e.Type.Union(O(x.anyOf,v)):a.TLiteral(x)?e.Type.Literal(g(x.const,v)):x}function c(x,v){return _(x,v)}p.Map=c})(E||(e.Intrinsic=E={}));var T;(function(p){function w(g,O){return e.Type.Intersect(g.allOf.map(_=>j(_,O)),{...g})}function A(g,O){return e.Type.Union(g.anyOf.map(_=>j(_,O)),{...g})}function R(g,O){return O(g)}function j(g,O){return g[e.Kind]==="Intersect"?w(g,O):g[e.Kind]==="Union"?A(g,O):g[e.Kind]==="Object"?R(g,O):g}function U(g,O,_){return{...j(d.Type(g),O),..._}}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,x){return c.allOf.reduce((v,b)=>[...v,...g(b,x)],[])}function R(c,x){let v=c.anyOf.map(b=>g(b,x));return[...v.reduce((b,P)=>P.map(H=>v.every(ie=>ie.includes(H))?b.add(H):b)[0],new Set)]}function j(c,x){return Object.getOwnPropertyNames(c.properties)}function U(c,x){return x.includePatterns?Object.getOwnPropertyNames(c.patternProperties):[]}function g(c,x){return a.TIntersect(c)?A(c,x):a.TUnion(c)?R(c,x):a.TObject(c)?j(c,x):a.TRecord(c)?U(c,x):[]}function O(c,x){return[...new Set(g(c,x))]}p.ResolveKeys=O;function _(c){return`^(${O(c,{includePatterns:!0}).map(x=>`(${w(x)})`).join("|")})$`}p.ResolvePattern=_})(B||(e.KeyResolver=B={}));var W=class extends r{};e.KeyArrayResolverError=W;var D;(function(p){function w(A){return Array.isArray(A)?A:a.TUnionLiteral(A)?A.anyOf.map(R=>R.const.toString()):a.TLiteral(A)?[A.const]:a.TTemplateLiteral(A)?(()=>{let R=q.ParseExact(A.pattern);if(!N.Check(R))throw new W("Cannot resolve keys from infinite template expression");return[...z.Generate(R)]})():[]}p.Resolve=w})(D||(e.KeyArrayResolver=D={}));var $;(function(p){function*w(R){for(let j of R.anyOf)j[e.Kind]==="Union"?yield*w(j):yield j}function A(R){return e.Type.Union([...w(R)],{...R})}p.Resolve=A})($||(e.UnionResolver=$={}));var F=class extends r{};e.TemplateLiteralPatternError=F;var K;(function(p){function w(U){throw new F(U)}function A(U){return U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function R(U,g){return a.TTemplateLiteral(U)?U.pattern.slice(1,U.pattern.length-1):a.TUnion(U)?`(${U.anyOf.map(O=>R(O,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 j(U){return`^${U.map(g=>R(g,"")).join("")}$`}p.Create=j})(K||(e.TemplateLiteralPattern=K={}));var M;(function(p){function w(A){let R=q.ParseExact(A.pattern);if(!N.Check(R))return e.Type.String();let j=[...z.Generate(R)].map(U=>e.Type.Literal(U));return e.Type.Union(j)}p.Resolve=w})(M||(e.TemplateLiteralResolver=M={}));var Q=class extends r{};e.TemplateLiteralParserError=Q;var q;(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 R(P,H){return w(P,H,")")}function j(P,H){return w(P,H,"|")}function U(P){if(!(A(P,0)&&R(P,P.length-1)))return!1;let H=0;for(let ie=0;ie<P.length;ie++)if(A(P,ie)&&(H+=1),R(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 O(P){let H=0;for(let ie=0;ie<P.length;ie++)if(A(P,ie)&&(H+=1),R(P,ie)&&(H-=1),j(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 xe=0;xe<P.length;xe++)if(A(P,xe)&&(H+=1),R(P,xe)&&(H-=1),j(P,xe)&&H===0){let De=P.slice(ie,xe);De.length>0&&oe.push(v(De)),ie=xe+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 x(P){function H(ve,xe){if(!A(ve,xe))throw new Q("TemplateLiteralParser: Index must point to open parens");let De=0;for(let qe=xe;qe<ve.length;qe++)if(A(ve,qe)&&(De+=1),R(ve,qe)&&(De-=1),De===0)return[xe,qe];throw new Q("TemplateLiteralParser: Unclosed group parens in expression")}function ie(ve,xe){for(let De=xe;De<ve.length;De++)if(A(ve,De))return[xe,De];return[xe,ve.length]}let oe=[];for(let ve=0;ve<P.length;ve++)if(A(P,ve)){let[xe,De]=H(P,ve),qe=P.slice(xe,De+1);oe.push(v(qe)),ve=De}else{let[xe,De]=ie(P,ve),qe=P.slice(xe,De);qe.length>0&&oe.push(v(qe)),ve=De-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)):O(P)?c(P):_(P)?x(P):{type:"const",const:P}}p.Parse=v;function b(P){return v(P.slice(1,P.length-1))}p.ParseExact=b})(q||(e.TemplateLiteralParser=q={}));var te=class extends r{};e.TemplateLiteralFiniteError=te;var N;(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 R(g){return g.type==="or"&&g.expr.length===2&&g.expr[0].type==="const"&&g.expr[0].const==="true"&&g.expr[1].type==="const"&&g.expr[1].const==="false"}function j(g){return g.type==="const"&&g.const===".*"}function U(g){return R(g)?!0:A(g)||j(g)?!1:g.type==="and"?g.expr.every(O=>U(O)):g.type==="or"?g.expr.every(O=>U(O)):g.type==="const"?!0:w("Unknown expression type")}p.Check=U})(N||(e.TemplateLiteralFinite=N={}));var L=class extends r{};e.TemplateLiteralGeneratorError=L;var z;(function(p){function*w(g){if(g.length===1)return yield*g[0];for(let O of g[0])for(let _ of w(g.slice(1)))yield`${O}${_}`}function*A(g){return yield*w(g.expr.map(O=>[...U(O)]))}function*R(g){for(let O of g.expr)yield*U(O)}function*j(g){return yield g.const}function*U(g){return g.type==="and"?yield*A(g):g.type==="or"?yield*R(g):g.type==="const"?yield*j(g):(()=>{throw new L("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 O=g.split("|").map(_=>e.Type.Literal(_.trim()));return O.length===0?e.Type.Never():O.length===1?O[0]:e.Type.Union(O)})()}function*A(U){if(U[1]!=="{"){let g=e.Type.Literal("$"),O=R(U.slice(1));return yield*[g,...O]}for(let g=2;g<U.length;g++)if(U[g]==="}"){let O=w(U.slice(2,g)),_=R(U.slice(g+1));return yield*[...O,..._]}yield e.Type.Literal(U)}function*R(U){for(let g=0;g<U.length;g++)if(U[g]==="$"){let O=e.Type.Literal(U.slice(0,g)),_=A(U.slice(g));return yield*[O,..._]}yield e.Type.Literal(U)}function j(U){return[...R(U)]}p.Parse=j})(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:R=>w[e.Transform].Encode(p(R)),Decode:R=>this.decode(w[e.Transform].Decode(R))};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,R)=>{let{[R]:j,...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,{}),R=B.ResolveKeys(A,{includePatterns:!1}).reduce((j,U)=>({...j,[U]:e.Type.Index(A,[U])}),{});return e.Type.Object(R,w)}Enum(p,w={}){if(i.IsUndefined(p))return this.Throw("Enum undefined or empty");let A=Object.getOwnPropertyNames(p).filter(j=>isNaN(j)).map(j=>p[j]),R=[...new Set(A)].map(j=>e.Type.Literal(j));return this.Union(R,{...w,[e.Hint]:"Enum"})}Extends(p,w,A,R,j={}){switch(f.Extends(p,w)){case l.Union:return this.Union([d.Type(A,j),d.Type(R,j)]);case l.True:return d.Type(A,j);case l.False:return d.Type(R,j)}}Exclude(p,w,A={}){return a.TTemplateLiteral(p)?this.Exclude(M.Resolve(p),w,A):a.TTemplateLiteral(w)?this.Exclude(p,M.Resolve(w),A):a.TUnion(p)?(()=>{let R=p.anyOf.filter(j=>f.Extends(j,w)===l.False);return R.length===1?d.Type(R[0],A):this.Union(R,A)})():f.Extends(p,w)!==l.False?this.Never(A):d.Type(p,A)}Extract(p,w,A={}){return a.TTemplateLiteral(p)?this.Extract(M.Resolve(p),w,A):a.TTemplateLiteral(w)?this.Extract(p,M.Resolve(w),A):a.TUnion(p)?(()=>{let R=p.anyOf.filter(j=>f.Extends(j,w)!==l.False);return R.length===1?d.Type(R[0],A):this.Union(R,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 R=(i.IsUndefined(p.items)?[]:p.items).map(j=>d.Type(j));return this.Union(R,A)})():(()=>{let R=D.Resolve(w),j=d.Type(p);return k.Resolve(j,R,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)),R=d.Rest(p),j=a.TSchema(w.unevaluatedProperties)?{unevaluatedProperties:d.Type(w.unevaluatedProperties)}:{};return w.unevaluatedProperties===!1||a.TSchema(w.unevaluatedProperties)||A?this.Create({...w,...j,[e.Kind]:"Intersect",type:"object",allOf:R}):this.Create({...w,...j,[e.Kind]:"Intersect",allOf:R})}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((R,j)=>e.Type.Literal(j.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 R=A.map(j=>this.Literal(j));return this.Union(R,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),R=A.filter(O=>a.TOptional(p[O])),j=A.filter(O=>!R.includes(O)),U=a.TSchema(w.additionalProperties)?{additionalProperties:d.Type(w.additionalProperties)}:{},g=A.reduce((O,_)=>({...O,[_]:d.Type(p[_])}),{});return j.length>0?this.Create({...w,...U,[e.Kind]:"Object",type:"object",properties:g,required:j}):this.Create({...w,...U,[e.Kind]:"Object",type:"object",properties:g})}Omit(p,w,A={}){let R=D.Resolve(w);return T.Map(this.Discard(d.Type(p),["$id",e.Transform]),j=>{i.IsArray(j.required)&&(j.required=j.required.filter(U=>!R.includes(U)),j.required.length===0&&delete j.required);for(let U of Object.getOwnPropertyNames(j.properties))R.includes(U)&&delete j.properties[U];return this.Create(j)},A)}Partial(p,w={}){return T.Map(this.Discard(d.Type(p),["$id",e.Transform]),A=>{let R=Object.getOwnPropertyNames(A.properties).reduce((j,U)=>({...j,[U]:this.Optional(A.properties[U])}),{});return this.Object(R,this.Discard(A,["required"]))},w)}Pick(p,w,A={}){let R=D.Resolve(w);return T.Map(this.Discard(d.Type(p),["$id",e.Transform]),j=>{i.IsArray(j.required)&&(j.required=j.required.filter(U=>R.includes(U)),j.required.length===0&&delete j.required);for(let U of Object.getOwnPropertyNames(j.properties))R.includes(U)||delete j.properties[U];return this.Create(j)},A)}Record(p,w,A={}){return a.TTemplateLiteral(p)?(()=>{let R=q.ParseExact(p.pattern);return N.Check(R)?this.Object([...z.Generate(R)].reduce((j,U)=>({...j,[U]:d.Type(w)}),{}),A):this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[p.pattern]:d.Type(w)}})})():a.TUnion(p)?(()=>{let R=$.Resolve(p);if(a.TUnionLiteral(R)){let j=R.anyOf.reduce((U,g)=>({...U,[g.const]:d.Type(w)}),{});return this.Object(j,{...A,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():a.TLiteral(p)?i.IsString(p.const)||i.IsNumber(p.const)?this.Object({[p.const]:d.Type(w)},A):this.Throw("Record key of type literal is not of type string or number"):a.TInteger(p)||a.TNumber(p)?this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:d.Type(w)}}):a.TString(p)?(()=>{let R=i.IsUndefined(p.pattern)?e.PatternStringExact:p.pattern;return this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[R]: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 R=Object.getOwnPropertyNames(A.properties).reduce((j,U)=>({...j,[U]:this.Discard(A.properties[U],[e.Optional])}),{});return this.Object(R,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)?K.Create(re.Parse(p)):K.Create(p);return this.Create({...w,[e.Kind]:"TemplateLiteral",type:"string",pattern:A})}Transform(p){return new se(p)}Tuple(p,w={}){let[A,R,j]=[!1,p.length,p.length],U=d.Rest(p),g=p.length>0?{...w,[e.Kind]:"Tuple",type:"array",items:U,additionalItems:A,minItems:R,maxItems:j}:{...w,[e.Kind]:"Tuple",type:"array",minItems:R,maxItems:j};return this.Create(g)}Uncapitalize(p,w={}){return{...E.Map(d.Type(p),"Uncapitalize"),...w}}Union(p,w={}){return a.TTemplateLiteral(p)?M.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 R=d.Rest(A);return this.Create({...w,[e.Kind]:"Union",anyOf:R})})()}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=R=>R.length>0?(()=>{let[j,...U]=R;return[this.Awaited(j),...A(U)]})():R;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[R,j]=[d.Rest(p),d.Type(w)];return this.Create({...A,[e.Kind]:"Constructor",type:"Constructor",parameters:R,returns:j})}Date(p={}){return this.Create({...p,[e.Kind]:"Date",type:"Date"})}Function(p,w,A){let[R,j]=[d.Rest(p),d.Type(w)];return this.Create({...A,[e.Kind]:"Function",type:"Function",parameters:R,returns:j})}InstanceType(p,w={}){return d.Type(p.returns,w)}Iterator(p,w={}){return this.Create({...w,[e.Kind]:"Iterator",type:"Iterator",items:d.Type(p)})}Parameters(p,w={}){return this.Tuple(p.parameters,{...w})}Promise(p,w={}){return this.Create({...w,[e.Kind]:"Promise",type:"Promise",item:d.Type(p)})}RegExp(p,w={}){let A=i.IsString(p)?p:p.source;return this.Create({...w,[e.Kind]:"String",type:"string",pattern:A})}RegEx(p,w={}){return this.RegExp(p,w)}ReturnType(p,w={}){return d.Type(p.returns,w)}Symbol(p){return this.Create({...p,[e.Kind]:"Symbol",type:"symbol"})}Undefined(p={}){return this.Create({...p,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(p={}){return this.Create({...p,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(p={}){return this.Create({...p,[e.Kind]:"Void",type:"void"})}};e.JavaScriptTypeBuilder=ye,e.JsonType=new Z,e.Type=new ye}}),ri=xr(Gr(),1),{String:lv,Optional:cv,Boolean:fv,Object:dv,Number:pv}=ri.Type,hv=lv.bind(ri.Type),yv=pv.bind(ri.Type),Kj=dv.bind(ri.Type),Gj=cv.bind(ri.Type),gv=fv.bind(ri.Type),Hj=hv(),Wj=yv(),Jj=gv();function Xo(e){return Array.isArray(e)?e:[e]}var mv=["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 bv(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":vv(e)||"Object"}function vv(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(mv.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}`}},oo=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",wv=new TextEncoder;function Zo(e){return oo&&globalThis.Buffer.isBuffer(e)}function Ba(e){return e instanceof Uint8Array?Zo(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var _v=24,Tv=200,Od=oo?e=>e.length>=_v?globalThis.Buffer.from(e):uc(e):e=>e.length>=Tv?wv.encode(e):uc(e),pr=e=>Uint8Array.from(e),Ev=oo?(e,t,r)=>Zo(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),xv=oo?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Ba(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},Ov=oo?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Ad(e,t){if(Zo(e)&&Zo(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 uc(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 lc=4096;function Av(e){let t=e.length;if(t<=lc)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=lc));return r}var Sv=256,Sd=class{constructor(e=Sv){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=Ov(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=Ev(r,0,this.cursor)}else t=xv(this.chunks,this.cursor);return e&&this.reset(),t}},Iv=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:",ao=[];ao[23]=1;ao[24]=2;ao[25]=3;ao[26]=5;ao[27]=9;function ni(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 _n(e,t,r){ni(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 Tn(e,t,r){ni(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 En(e,t,r){ni(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 xn(e,t,r){ni(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 kv(e,t,r,n){return new ne(I.uint,_n(e,t+1,n),2)}function $v(e,t,r,n){return new ne(I.uint,Tn(e,t+1,n),3)}function Nv(e,t,r,n){return new ne(I.uint,En(e,t+1,n),5)}function jv(e,t,r,n){return new ne(I.uint,xn(e,t+1,n),9)}function On(e,t){return Bt(e,0,t.value)}function Bt(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`)}}On.encodedSize=function(e){return Bt.encodedSize(e.value)};Bt.encodedSize=function(e){return e<it[0]?1:e<it[1]?2:e<it[2]?3:e<it[3]?5:9};On.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function Cv(e,t,r,n){return new ne(I.negint,-1-_n(e,t+1,n),2)}function Uv(e,t,r,n){return new ne(I.negint,-1-Tn(e,t+1,n),3)}function Pv(e,t,r,n){return new ne(I.negint,-1-En(e,t+1,n),5)}var Wu=BigInt(-1),Id=BigInt(1);function Rv(e,t,r,n){let i=xn(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,Wu-BigInt(i),9)}function Ju(e,t){let r=t.value,n=typeof r=="bigint"?r*Wu-Id:r*-1-1;Bt(e,t.type.majorEncoded,n)}Ju.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*Wu-Id:t*-1-1;return r<it[0]?1:r<it[1]?2:r<it[2]?3:r<it[3]?5:9};Ju.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function so(e,t,r,n){ni(e,t,r+n);let i=e.slice(t+r,t+r+n);return new ne(I.bytes,i,r+n)}function Dv(e,t,r,n){return so(e,t,1,r)}function Mv(e,t,r,n){return so(e,t,2,_n(e,t+1,n))}function Lv(e,t,r,n){return so(e,t,3,Tn(e,t+1,n))}function Bv(e,t,r,n){return so(e,t,5,En(e,t+1,n))}function Vv(e,t,r,n){let i=xn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer bytes lengths not supported`);return so(e,t,9,i)}function ea(e){return e.encodedBytes===void 0&&(e.encodedBytes=I.equals(e.type,I.string)?Od(e.value):e.value),e.encodedBytes}function Va(e,t){let r=ea(t);Bt(e,t.type.majorEncoded,r.length),e.push(r)}Va.encodedSize=function(e){let t=ea(e);return Bt.encodedSize(t.length)+t.length};Va.compareTokens=function(e,t){return Fv(ea(e),ea(t))};function Fv(e,t){return e.length<t.length?-1:e.length>t.length?1:Ad(e,t)}var cc=new TextDecoder,zv=32;function qv(e,t,r){if(r-t<zv){let n="";for(let i=t;i<r;i++){let o=e[i];if(o&128)return cc.decode(e.subarray(t,r));n+=String.fromCharCode(o)}return n}return cc.decode(e.subarray(t,r))}function uo(e,t,r,n,i){let o=r+n;ni(e,t,o);let a=new ne(I.string,qv(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=e.slice(t+r,t+o)),a}function Kv(e,t,r,n){return uo(e,t,1,r,n)}function Gv(e,t,r,n){return uo(e,t,2,_n(e,t+1,n),n)}function Hv(e,t,r,n){return uo(e,t,3,Tn(e,t+1,n),n)}function Wv(e,t,r,n){return uo(e,t,5,En(e,t+1,n),n)}function Jv(e,t,r,n){let i=xn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer string lengths not supported`);return uo(e,t,9,i,n)}var Qv=Va;function ii(e,t,r,n){return new ne(I.array,n,r)}function Yv(e,t,r,n){return ii(e,t,1,r)}function Xv(e,t,r,n){return ii(e,t,2,_n(e,t+1,n))}function Zv(e,t,r,n){return ii(e,t,3,Tn(e,t+1,n))}function e0(e,t,r,n){return ii(e,t,5,En(e,t+1,n))}function t0(e,t,r,n){let i=xn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer array lengths not supported`);return ii(e,t,9,i)}function r0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${be} indefinite length items not allowed`);return ii(e,t,1,1/0)}function Qu(e,t){Bt(e,I.array.majorEncoded,t.value)}Qu.compareTokens=On.compareTokens;Qu.encodedSize=function(e){return Bt.encodedSize(e.value)};function oi(e,t,r,n){return new ne(I.map,n,r)}function n0(e,t,r,n){return oi(e,t,1,r)}function i0(e,t,r,n){return oi(e,t,2,_n(e,t+1,n))}function o0(e,t,r,n){return oi(e,t,3,Tn(e,t+1,n))}function a0(e,t,r,n){return oi(e,t,5,En(e,t+1,n))}function s0(e,t,r,n){let i=xn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer map lengths not supported`);return oi(e,t,9,i)}function u0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${be} indefinite length items not allowed`);return oi(e,t,1,1/0)}function Yu(e,t){Bt(e,I.map.majorEncoded,t.value)}Yu.compareTokens=On.compareTokens;Yu.encodedSize=function(e){return Bt.encodedSize(e.value)};function l0(e,t,r,n){return new ne(I.tag,r,1)}function c0(e,t,r,n){return new ne(I.tag,_n(e,t+1,n),2)}function f0(e,t,r,n){return new ne(I.tag,Tn(e,t+1,n),3)}function d0(e,t,r,n){return new ne(I.tag,En(e,t+1,n),5)}function p0(e,t,r,n){return new ne(I.tag,xn(e,t+1,n),9)}function Xu(e,t){Bt(e,I.tag.majorEncoded,t.value)}Xu.compareTokens=On.compareTokens;Xu.encodedSize=function(e){return Bt.encodedSize(e.value)};var kd=20,$d=21,Nd=22,jd=23;function h0(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 y0(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 Zu(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 g0(e,t,r,n){return Zu(tl(e,t+1),3,n)}function m0(e,t,r,n){return Zu(rl(e,t+1),5,n)}function b0(e,t,r,n){return Zu(Rd(e,t+1),9,n)}function el(e,t,r){let n=t.value;if(n===!1)e.push([I.float.majorEncoded|kd]);else if(n===!0)e.push([I.float.majorEncoded|$d]);else if(n===null)e.push([I.float.majorEncoded|Nd]);else if(n===void 0)e.push([I.float.majorEncoded|jd]);else{let i,o=!1;(!r||r.float64!==!0)&&(Ud(n),i=tl(Kt,1),n===i||Number.isNaN(n)?(Kt[0]=249,e.push(Kt.slice(0,3)),o=!0):(Pd(n),i=rl(Kt,1),n===i&&(Kt[0]=250,e.push(Kt.slice(0,5)),o=!0))),o||(v0(n),i=Rd(Kt,1),Kt[0]=251,e.push(Kt.slice(0,9)))}}el.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){Ud(r);let n=tl(Kt,1);if(r===n||Number.isNaN(r))return 3;if(Pd(r),n=rl(Kt,1),r===n)return 5}return 9};var Cd=new ArrayBuffer(9),It=new DataView(Cd,1),Kt=new Uint8Array(Cd,0);function Ud(e){if(e===1/0)It.setUint16(0,31744,!1);else if(e===-1/0)It.setUint16(0,64512,!1);else if(Number.isNaN(e))It.setUint16(0,32256,!1);else{It.setFloat32(0,e);let t=It.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)It.setUint16(0,31744,!1);else if(r===0)It.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?It.setUint16(0,0):i<-14?It.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):It.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function tl(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 Pd(e){It.setFloat32(0,e,!1)}function rl(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 v0(e){It.setFloat64(0,e,!1)}function Rd(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)}el.compareTokens=On.compareTokens;function je(e,t,r){throw new Error(`${be} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Fa(e){return()=>{throw new Error(`${be} ${e}`)}}var le=[];for(let e=0;e<=23;e++)le[e]=je;le[24]=kv;le[25]=$v;le[26]=Nv;le[27]=jv;le[28]=je;le[29]=je;le[30]=je;le[31]=je;for(let e=32;e<=55;e++)le[e]=je;le[56]=Cv;le[57]=Uv;le[58]=Pv;le[59]=Rv;le[60]=je;le[61]=je;le[62]=je;le[63]=je;for(let e=64;e<=87;e++)le[e]=Dv;le[88]=Mv;le[89]=Lv;le[90]=Bv;le[91]=Vv;le[92]=je;le[93]=je;le[94]=je;le[95]=Fa("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)le[e]=Kv;le[120]=Gv;le[121]=Hv;le[122]=Wv;le[123]=Jv;le[124]=je;le[125]=je;le[126]=je;le[127]=Fa("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)le[e]=Yv;le[152]=Xv;le[153]=Zv;le[154]=e0;le[155]=t0;le[156]=je;le[157]=je;le[158]=je;le[159]=r0;for(let e=160;e<=183;e++)le[e]=n0;le[184]=i0;le[185]=o0;le[186]=a0;le[187]=s0;le[188]=je;le[189]=je;le[190]=je;le[191]=u0;for(let e=192;e<=215;e++)le[e]=l0;le[216]=c0;le[217]=f0;le[218]=d0;le[219]=p0;le[220]=je;le[221]=je;le[222]=je;le[223]=je;for(let e=224;e<=243;e++)le[e]=Fa("simple values are not supported");le[244]=je;le[245]=je;le[246]=je;le[247]=h0;le[248]=Fa("simple values are not supported");le[249]=g0;le[250]=m0;le[251]=b0;le[252]=je;le[253]=je;le[254]=je;le[255]=y0;var lr=[];for(let e=0;e<24;e++)lr[e]=new ne(I.uint,e,1);for(let e=-1;e>=-24;e--)lr[31-e]=new ne(I.negint,e,1);lr[64]=new ne(I.bytes,new Uint8Array(0),1);lr[96]=new ne(I.string,"",1);lr[128]=new ne(I.array,0,1);lr[160]=new ne(I.map,0,1);lr[244]=new ne(I.false,!1,1);lr[245]=new ne(I.true,!0,1);lr[246]=new ne(I.null,null,1);function w0(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 _0=Object.freeze({float64:!0,mapSorter:O0,quickEncodeToken:w0});function Dd(){let e=[];return e[I.uint.major]=On,e[I.negint.major]=Ju,e[I.bytes.major]=Va,e[I.string.major]=Qv,e[I.array.major]=Qu,e[I.map.major]=Yu,e[I.tag.major]=Xu,e[I.float.major]=el,e}var T0=Dd(),E0=new Sd,fc=class Md{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 Md(r,t)}},Nr={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)},zr={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?Nr.true:Nr.false},null(e,t,r,n){return Nr.null},undefined(e,t,r,n){return Nr.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?[Nr.emptyArray,new ne(I.break)]:Nr.emptyArray;n=fc.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=No(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=fc.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++]=[No(f,r,n),No(d,r,n)])}l<a&&(s.length=l)}return s?.length?(x0(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?[Nr.emptyMap,new ne(I.break)]:Nr.emptyMap}};zr.Map=zr.Object;zr.Buffer=zr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))zr[`${e}Array`]=zr.DataView;function No(e,t={},r){let n=bv(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||zr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=zr[n];if(!o)throw new Error(`${on} unsupported type: ${n}`);return o(e,n,t,r)}function x0(e,t){t.mapSorter&&e.sort(t.mapSorter)}function O0(e,t){if(e[0]instanceof ne&&t[0]instanceof ne){let r=e[0],n=t[0];return r._keyBytes||(r._keyBytes=dc(r.value)),n._keyBytes||(n._keyBytes=dc(n.value)),Ad(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function dc(e){return Bd(e,T0,_0)}function Ld(e,t,r,n){if(Array.isArray(t))for(let i of t)Ld(e,i,r,n);else r[t.type.major](e,t,n)}var Qj=I.uint.majorEncoded,Yj=I.negint.majorEncoded,Xj=I.bytes.majorEncoded,Zj=I.string.majorEncoded,eC=I.array.majorEncoded,tC=I.float.majorEncoded|kd,rC=I.float.majorEncoded|$d,nC=I.float.majorEncoded|Nd,iC=I.float.majorEncoded|jd,oC=BigInt(-1),aC=BigInt(1);function Bd(e,t,r,n){let i=n instanceof Uint8Array,o=i?new Iv(n):E0,a=No(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 Sd(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():Ba(o.chunks[0])}}return o.reset(),Ld(o,a,t,r),o.toBytes(!0)}var A0={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},S0=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=lr[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}},Li=Symbol.for("DONE"),za=Symbol.for("BREAK");function I0(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=Bi(t,r);if(o===za){if(e.value===1/0)break;throw new Error(`${be} got unexpected break to lengthed array`)}if(o===Li)throw new Error(`${be} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function k0(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=Bi(t,r);if(u===za){if(e.value===1/0)break;throw new Error(`${be} got unexpected break to lengthed map`)}if(u===Li)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=Bi(t,r);if(l===Li)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 Bi(e,t){if(e.done())return Li;let r=e.next();if(I.equals(r.type,I.break))return za;if(r.type.terminal)return r.value;if(I.equals(r.type,I.array))return I0(r,e,t);if(I.equals(r.type,I.map))return k0(r,e,t);if(I.equals(r.type,I.tag)){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Bi(e,t);return t.tags[r.value](n)}throw new Error(`${be} tag not supported (${r.value})`)}throw new Error("unsupported")}function $0(e,t){if(!(e instanceof Uint8Array))throw new Error(`${be} data to decode must be a Uint8Array`);t=Object.assign({},A0,t);let r=Ba(e),n=t.tokenizer||new S0(r,t),i=Bi(n,t);if(i===Li)throw new Error(`${be} did not find any content to decode`);if(i===za)throw new Error(`${be} got unexpected break`);return[i,e.subarray(n.pos())]}function N0(e,t){let[r,n]=$0(e,t);if(n.length>0)throw new Error(`${be} too many terminals, data makes no sense`);return r}var j0={};ti(j0,{base36:()=>jo,base36upper:()=>K0});var sC=new Uint8Array(0);function C0(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 nl(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 U0(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,D=0,$=T.length;D!==$&&T[D]===0;)D++,B++;for(var F=($-D)*f+1>>>0,K=new Uint8Array(F);D!==$;){for(var M=T[D],Q=0,q=F-1;(M!==0||Q<W)&&q!==-1;q--,Q++)M+=256*K[q]>>>0,K[q]=M%s>>>0,M=M/s>>>0;if(M!==0)throw new Error("Non-zero carry");W=Q,D++}for(var te=F-W;te!==F&&K[te]===0;)te++;for(var N=u.repeat(B);te<F;++te)N+=e.charAt(K[te]);return N}function k(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,D=0;T[B]===u;)W++,B++;for(var $=(T.length-B)*l+1>>>0,F=new Uint8Array($);T[B];){var K=r[T.charCodeAt(B)];if(K===255)return;for(var M=0,Q=$-1;(K!==0||M<D)&&Q!==-1;Q--,M++)K+=s*F[Q]>>>0,F[Q]=K%256>>>0,K=K/256>>>0;if(K!==0)throw new Error("Non-zero carry");D=M,B++}if(T[B]!==" "){for(var q=$-D;q!==$&&F[q]===0;)q++;for(var te=new Uint8Array(W+($-q)),N=W;q!==$;)te[N++]=F[q++];return te}}}function E(T){var B=k(T);if(B)return B;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:k,decode:E}}var P0=U0,R0=P0,D0=R0,M0=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")}},L0=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 Vd(this,e)}},B0=class{decoders;constructor(e){this.decoders=e}or(e){return Vd(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 Vd(e,t){return new B0({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var V0=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 M0(e,t,r),this.decoder=new L0(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Fd({name:e,prefix:t,encode:r,decode:n}){return new V0(e,t,r,n)}function qa({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=D0(r,e);return Fd({prefix:t,name:e,encode:n,decode:o=>nl(i(o))})}function F0(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 z0(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 q0(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function Tt({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=q0(n);return Fd({prefix:t,name:e,encode(o){return z0(o,n,r)},decode(o){return F0(o,i,r,e)}})}var jo=qa({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),K0=qa({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),G0=zd,pc=128,H0=127,W0=~H0,J0=Math.pow(2,31);function zd(e,t,r){t=t||[],r=r||0;for(var n=r;e>=J0;)t[r++]=e&255|pc,e/=128;for(;e&W0;)t[r++]=e&255|pc,e>>>=7;return t[r]=e|0,zd.bytes=r-n+1,t}var Q0=Gs,Y0=128,hc=127;function Gs(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Gs.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&hc)<<i:(a&hc)*Math.pow(2,i),i+=7}while(a>=Y0);return Gs.bytes=o-n,r}var X0=Math.pow(2,7),Z0=Math.pow(2,14),ew=Math.pow(2,21),tw=Math.pow(2,28),rw=Math.pow(2,35),nw=Math.pow(2,42),iw=Math.pow(2,49),ow=Math.pow(2,56),aw=Math.pow(2,63),sw=function(e){return e<X0?1:e<Z0?2:e<ew?3:e<tw?4:e<rw?5:e<nw?6:e<iw?7:e<ow?8:e<aw?9:10},uw={encode:G0,decode:Q0,encodingLength:sw},lw=uw,ta=lw;function Hs(e,t=0){return[ta.decode(e,t),ta.decode.bytes]}function ra(e,t,r=0){return ta.encode(e,t,r),t}function na(e){return ta.encodingLength(e)}function cw(e,t){let r=t.byteLength,n=na(e),i=n+na(r),o=new Uint8Array(i+r);return ra(e,o,0),ra(r,o,n),o.set(t,i),new il(e,r,t,o)}function fw(e){let t=nl(e),[r,n]=Hs(t),[i,o]=Hs(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new il(r,i,a,t)}function dw(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&C0(e.bytes,r.bytes)}}var il=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}},pw={};ti(pw,{base32:()=>Ci,base32hex:()=>mw,base32hexpad:()=>vw,base32hexpadupper:()=>ww,base32hexupper:()=>bw,base32pad:()=>yw,base32padupper:()=>gw,base32upper:()=>hw,base32z:()=>_w});var Ci=Tt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),hw=Tt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),yw=Tt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),gw=Tt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),mw=Tt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),bw=Tt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),vw=Tt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ww=Tt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),_w=Tt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Tw={};ti(Tw,{base58btc:()=>hr,base58flickr:()=>Ew});var hr=qa({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ew=qa({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});function yc(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return Ow(r,Ws(e),t??hr.encoder);default:return Aw(r,Ws(e),t??Ci.encoder)}}var gc=new WeakMap;function Ws(e){let t=gc.get(e);if(t==null){let r=new Map;return gc.set(e,r),r}return t}var Ka=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!==_i)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Sw)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=cw(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&&dw(t.multihash,n.multihash)}toString(t){return yc(this,t)}toJSON(){return{"/":yc(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??mc(n,i,o.bytes))}else if(r[Iw]===!0){let{version:n,multihash:i,code:o}=r,a=fw(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!==_i)throw new Error(`Version 0 CID must use dag-pb (code: ${_i}) block encoding`);return new ut(t,r,n,n.bytes)}case 1:{let i=mc(t,r,n.bytes);return new ut(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return ut.create(0,_i,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=nl(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 il(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,k]=Hs(t.subarray(r));return r+=k,d},i=n(),o=_i;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]=xw(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 Ws(o).set(n,t),o}};function xw(e,t){switch(e[0]){case"Q":{let r=t??hr;return[hr.prefix,r.decode(`${hr.prefix}${e}`)]}case hr.prefix:{let r=t??hr;return[hr.prefix,r.decode(e)]}case Ci.prefix:{let r=t??Ci;return[Ci.prefix,r.decode(e)]}case jo.prefix:{let r=t??jo;return[jo.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 Ow(e,t,r){let{prefix:n}=r;if(n!==hr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function Aw(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 _i=112,Sw=18;function mc(e,t,r){let n=na(e),i=n+na(t),o=new Uint8Array(i+r.byteLength);return ra(e,o,0),ra(t,o,n),o.set(r,i),o}var Iw=Symbol.for("@ipld/js-cid/CID");function kw(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function qd(e,t,r=""){let n=kw(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 bc(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 $w(e,t){qd(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 Js(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function As(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function tr(e,t){return e<<32-t|e>>>t}function Nw(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 jw=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function Cw(e,t,r){return e&t^~e&r}function Uw(e,t,r){return e&t^e&r^t&r}var Pw=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=As(this.buffer)}update(e){bc(this),qd(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=As(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){bc(this),$w(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:o}=this;t[o++]=128,Js(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=As(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]),uC=BigInt(2**32-1),Rw=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]),Cr=new Uint32Array(64),Dw=class extends Pw{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)Cr[f]=e.getUint32(t,!1);for(let f=16;f<64;f++){let d=Cr[f-15],k=Cr[f-2],E=tr(d,7)^tr(d,18)^d>>>3,T=tr(k,17)^tr(k,19)^k>>>10;Cr[f]=T+Cr[f-7]+E+Cr[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),k=l+d+Cw(a,s,u)+Rw[f]+Cr[f]|0,E=(tr(r,2)^tr(r,13)^tr(r,22))+Uw(r,n,i)|0;l=u,u=s,s=a,a=o+k|0,o=i,i=n,n=r,r=k+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(){Js(Cr)}destroy(){this.set(0,0,0,0,0,0,0,0),Js(this.buffer)}},Mw=class extends Dw{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)}},Lw=Nw(()=>new Mw,jw(1)),lC=new Uint8Array(0);function Bw(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function ol(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function Vw(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,D=0,$=T.length;D!==$&&T[D]===0;)D++,B++;for(var F=($-D)*f+1>>>0,K=new Uint8Array(F);D!==$;){for(var M=T[D],Q=0,q=F-1;(M!==0||Q<W)&&q!==-1;q--,Q++)M+=256*K[q]>>>0,K[q]=M%s>>>0,M=M/s>>>0;if(M!==0)throw new Error("Non-zero carry");W=Q,D++}for(var te=F-W;te!==F&&K[te]===0;)te++;for(var N=u.repeat(B);te<F;++te)N+=e.charAt(K[te]);return N}function k(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,D=0;T[B]===u;)W++,B++;for(var $=(T.length-B)*l+1>>>0,F=new Uint8Array($);T[B];){var K=r[T.charCodeAt(B)];if(K===255)return;for(var M=0,Q=$-1;(K!==0||M<D)&&Q!==-1;Q--,M++)K+=s*F[Q]>>>0,F[Q]=K%256>>>0,K=K/256>>>0;if(K!==0)throw new Error("Non-zero carry");D=M,B++}if(T[B]!==" "){for(var q=$-D;q!==$&&F[q]===0;)q++;for(var te=new Uint8Array(W+($-q)),N=W;q!==$;)te[N++]=F[q++];return te}}}function E(T){var B=k(T);if(B)return B;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:k,decode:E}}var Fw=Vw,zw=Fw,qw=zw,Kw=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")}},Gw=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 Kd(this,e)}},Hw=class{decoders;constructor(e){this.decoders=e}or(e){return Kd(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 Kd(e,t){return new Hw({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Ww=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 Kw(e,t,r),this.decoder=new Gw(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Gd({name:e,prefix:t,encode:r,decode:n}){return new Ww(e,t,r,n)}function Ga({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=qw(r,e);return Gd({prefix:t,name:e,encode:n,decode:o=>ol(i(o))})}function Jw(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 Qw(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 Yw(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function Or({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=Yw(n);return Gd({prefix:t,name:e,encode(o){return Qw(o,n,r)},decode(o){return Jw(o,i,r,e)}})}var Co=Ga({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),cC=Ga({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Xw={};ti(Xw,{base64:()=>al,base64pad:()=>Zw,base64url:()=>e1,base64urlpad:()=>t1});var al=Tt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Zw=Tt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),e1=Tt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),t1=Tt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),r1={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"},n1=r1;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:n1[e];throw typeof i=="function"&&(i=i.apply(null,r)),new Error("[MobX] "+i)}var i1={};function Ha(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:i1}var Hd=Object.assign,ia=Object.getOwnPropertyDescriptor,nr=Object.defineProperty,lo=Object.prototype,oa=[];Object.freeze(oa);var sl={};Object.freeze(sl);var o1=typeof Proxy<"u",a1=Object.toString();function Wd(){o1||de("`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`")}function Ti(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 Vt(){return++X.mobxGuid}function ul(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Dn=function(){};function ze(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 Wa(e){return e!==null&&typeof e=="object"}function Yt(e){if(!Wa(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()===a1}function Jd(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Ja(e,t,r){nr(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function Qd(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 Wa(n)&&n[r]===!0}}function ai(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function s1(e){var t=Object.getPrototypeOf(e),r=Object.getPrototypeOf(t),n=Object.getPrototypeOf(r);return n===null}function yr(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var Yd=typeof Object.getOwnPropertySymbols<"u";function u1(e){var t=Object.keys(e);if(!Yd)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return lo.propertyIsEnumerable.call(e,n)})):t}var Qa=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Yd?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Qs(e){return typeof e=="string"?e:typeof e=="symbol"?e.toString():new String(e).toString()}function Xd(e){return e===null?null:typeof e=="object"?""+e:e}function Ut(e,t){return lo.hasOwnProperty.call(e,t)}var l1=Object.getOwnPropertyDescriptors||function(e){var t={};return Qa(e).forEach(function(r){t[r]=ia(e,r)}),t};function bt(e,t){return!!(e&t)}function vt(e,t,r){return r?e|=t:e&=~t,e}function vc(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 wc(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,f1(n.key),n)}}function si(e,t,r){return t&&wc(e.prototype,t),r&&wc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mn(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=d1(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 vr(){return vr=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},vr.apply(null,arguments)}function Zd(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ys(e,t)}function Ys(e,t){return Ys=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Ys(e,t)}function c1(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 f1(e){var t=c1(e,"string");return typeof t=="symbol"?t:t+""}function d1(e,t){if(e){if(typeof e=="string")return vc(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)?vc(e,t):void 0}}var gt=Symbol("mobx-stored-annotations");function ir(e){function t(r,n){if(fo(n))return e.decorate_20223_(r,n);co(r,n,e)}return Object.assign(t,e)}function co(e,t,r){if(Ut(e,gt)||Ja(e,gt,vr({},e[gt])),aa(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.")}p1(e,r,t),aa(r)||(e[gt][t]=r)}function p1(e,t,r){if(!aa(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
3
|
The field is already decorated with '@`+i+"'.")+`
|
|
4
4
|
Re-decorating fields is not allowed.
|
|
5
|
-
Use '@override' decorator for methods overridden by subclass.`)}}function h1(e){return Ut(e,gt)||Ja(e,gt,vr({},e[gt])),e[gt]}function fo(e){return typeof e=="object"&&typeof e.kind=="string"}function Ya(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@"+Vt()),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=ke.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 yp(this)},t.reportChanged=function(){
|
|
6
|
-
'`+o.annotationType_+"' can only be used on properties with a function value."))}function
|
|
7
|
-
'`+i+"' can only be used on properties with a function value."))}function tp(e,t,r,n,i){var o,a,s,u,l,f,d;i===void 0&&(i=X.safeDescriptors),
|
|
8
|
-
'`+i+"' can only be used on properties with a generator function value."))}function np(e,t,r,n,i,o){o===void 0&&(o=X.safeDescriptors),k1(e,t,r,n);var a=n.value;if(zi(a)||(a=
|
|
9
|
-
'`+i+"' can only be used on getter(+setter) properties."))}function Za(e,t){return{annotationType_:e,options_:t,make_:U1,extend_:P1,decorate_20223_:R1}}function U1(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function P1(e,t,r,n){var i,o;return D1(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(o=this.options_)==null?void 0:o.enhancer)!=null?i:
|
|
10
|
-
'`+i+"' cannot be used on getter/setter properties"))}var M1="true",L1=ip();function ip(e){return{annotationType_:M1,options_:e,make_:B1,extend_:V1,decorate_20223_:F1}}function B1(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?Vi.bound:Vi;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 k;r.value=r.value.bind((k=e.proxy_)!=null?k:e.target_)}return d.make_(e,t,r,n)}function V1(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 F1(e,t){de("'"+this.annotationType_+"' cannot be used as a decorator")}var z1="observable",q1="observable.ref",K1="observable.shallow",G1="observable.struct",op={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(op);function Eo(e){return e||op}var Zs=Za(z1),H1=Za(q1,{enhancer:Xa}),W1=Za(K1,{enhancer:v1}),J1=Za(G1,{enhancer:w1}),ap=ir(Zs);function Oo(e){return e.deep===!0?si:e.deep===!1?Xa:Y1(e.defaultDecorator)}function Q1(e){var t;return e?(t=e.defaultDecorator)!=null?t:ip(e):void 0}function Y1(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:si}function sp(e,t,r){if(fo(t))return Zs.decorate_20223_(e,t);if(an(t)){co(e,t,Zs);return}return Vn(e)?e:Yt(e)?Be.object(e,t,r):Array.isArray(e)?Be.array(e,t):oi(e)?Be.map(e,t):yr(e)?Be.set(e,t):typeof e=="object"&&e!==null?e:Be.box(e,t)}Hd(sp,ap);var X1={box:function(e,t){var r=Eo(t);return new Br(e,Oo(r),r.name,!0,r.equals)},array:function(e,t){var r=Eo(t);return(X.useProxies===!1||r.proxy===!1?rT:G_)(e,Oo(r),r.name)},map:function(e,t){var r=Eo(t);return new $p(e,Oo(r),r.name)},set:function(e,t){var r=Eo(t);return new Np(e,Oo(r),r.name)},object:function(e,t,r){return Sn(function(){return P_(X.useProxies===!1||r?.proxy===!1?fi({},r):z_({},r),e,t)})},ref:ir(H1),shallow:ir(W1),deep:ap,struct:ir(J1)},Be=Hd(sp,X1),up="computed",Z1="computed.struct",eu=fl(up),e_=fl(Z1,{equals:Je.structural}),He=function(e,t){if(fo(t))return eu.decorate_20223_(e,t);if(an(t))return co(e,t,eu);if(Yt(e))return ir(fl(up,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 Rt(r)};Object.assign(He,eu);He.struct=ir(e_);var _c,Tc,sa=0,t_=1,r_=(_c=(Tc=ia(function(){},"name"))==null?void 0:Tc.configurable)!=null?_c:!1,Ec={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 lp(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},r_&&(Ec.value=e,nr(i,"name",Ec)),i}function lp(e,t,r,n,i){var o=n_(e,t,n,i);try{return r.apply(n,i)}catch(a){throw o.error_=a,a}finally{i_(o)}}function n_(e,t,r,n){var i=ot()&&!!e,o=0;if(i){o=Date.now();var a=n?Array.from(n):oa;vt({type:pl,name:e,object:r,arguments:a})}var s=X.trackingDerivation,u=!t||!s;Nt();var l=X.allowStateChanges;u&&(An(),l=es(!0));var f=dl(!0),d={runAsAction_:u,prevDerivation_:s,prevAllowStateChanges_:l,prevAllowStateReads_:f,notifySpy_:i,startTime_:o,actionId_:t_++,parentActionId_:sa};return sa=d.actionId_,d}function i_(e){sa!==e.actionId_&&de(30),sa=e.parentActionId_,e.error_!==void 0&&(X.suppressReactionErrors=!0),ts(e.prevAllowStateChanges_),Ui(e.prevAllowStateReads_),jt(),e.runAsAction_&&mr(e.prevDerivation_),e.notifySpy_&&wt({time:Date.now()-e.startTime_}),X.suppressReactionErrors=!1}function o_(e,t){var r=es(e);try{return t()}finally{ts(r)}}function es(e){var t=X.allowStateChanges;return X.allowStateChanges=e,t}function ts(e){X.allowStateChanges=e}var a_="create",Br=function(e){function t(n,i,o,a,s){var u;return o===void 0&&(o="ObservableValue@"+Vt()),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()&&Ln({type:a_,object:u,observableKind:"value",debugObjectName:u.name_,newValue:""+u.value_}),u}Zd(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),kt(this)){var i=$t(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 yo(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}),go(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 Xd(this.get())},r[Symbol.toPrimitive]=function(){return this.valueOf()},t}(Wr),s_=Hr("ObservableValue",Br),Rt=function(){function e(r){this.dependenciesState_=ke.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=ke.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new ua(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@"+Vt(),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(){b_(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_)tu(this)&&(this.warnAboutUntrackedRead_(),Nt(),this.value_=this.computeValue_(!1),jt());else if(yp(this),tu(this)){var r=X.trackingContext;this.keepAlive_&&!r&&(X.trackingContext=this),this.trackAndCompute()&&m_(this),X.trackingContext=r}var n=this.value_;if(Uo(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_===ke.NOT_TRACKING_,i=this.computeValue_(!0),o=n||Uo(r)||Uo(i)||!this.equals_(r,i);return o&&(this.value_=i,ot()&&Ln({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:r,newValue:i})),o},t.computeValue_=function(r){this.isComputing=!0;var n=es(!1),i;if(r)i=cp(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 ua(o)}return ts(n),this.isComputing=!1,i},t.suspend_=function(){this.keepAlive_||(ru(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 Dt(function(){var s=i.get();if(!o||n){var u=An();r({observableKind:"computed",debugObjectName:i.name_,type:Wt,object:i,newValue:s,oldValue:a}),mr(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 Xd(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},ai(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)}}])}();Rt.isComputingMask_=1;Rt.isRunningSetterMask_=2;Rt.isBeingObservedMask_=4;Rt.isPendingUnobservationMask_=8;Rt.diffValueMask_=16;var ho=Hr("ComputedValue",Rt),ke;(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_"})(ke||(ke={}));var Pt;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(Pt||(Pt={}));var ua=function(e){this.cause=void 0,this.cause=e};function Uo(e){return e instanceof ua}function tu(e){switch(e.dependenciesState_){case ke.UP_TO_DATE_:return!1;case ke.NOT_TRACKING_:case ke.STALE_:return!0;case ke.POSSIBLY_STALE_:{for(var t=dl(!0),r=An(),n=e.observing_,i=n.length,o=0;o<i;o++){var a=n[o];if(ho(a)){if(X.disableErrorBoundaries)a.get();else try{a.get()}catch{return mr(r),Ui(t),!0}if(e.dependenciesState_===ke.STALE_)return mr(r),Ui(t),!0}}return fp(e),mr(r),Ui(t),!1}}}function u_(){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 l_(e){!X.allowStateReads&&X.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function cp(e,t,r){var n=dl(!0);fp(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 ua(a)}return X.inBatch--,X.trackingDerivation=i,f_(e),c_(e),Ui(n),o}function c_(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 f_(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=ke.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&&pp(u,e),u.diffValue=0}for(;i--;){var l=r[i];l.diffValue===1&&(l.diffValue=0,g_(l,e))}n!==ke.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function ru(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)pp(t[r],e);e.dependenciesState_=ke.NOT_TRACKING_}function Le(e){var t=An();try{return e()}finally{mr(t)}}function An(){var e=X.trackingDerivation;return X.trackingDerivation=null,e}function mr(e){X.trackingDerivation=e}function dl(e){var t=X.allowStateReads;return X.allowStateReads=e,t}function Ui(e){X.allowStateReads=e}function fp(e){if(e.dependenciesState_!==ke.UP_TO_DATE_){e.dependenciesState_=ke.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=ke.UP_TO_DATE_}}var Po=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},Ro=!0,dp=!1,X=function(){var e=Ha();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Ro=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Po().version&&(Ro=!1),Ro?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Po):(setTimeout(function(){dp||de(35)},1),new Po)}();function d_(){if((X.pendingReactions.length||X.inBatch||X.isRunningReactions)&&de(36),dp=!0,Ro){var e=Ha();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),X=new Po}}function p_(){return X}function h_(e){return e.observers_&&e.observers_.size>0}function y_(e){return e.observers_}function g_(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function pp(e,t){e.observers_.delete(t),e.observers_.size===0&&hp(e)}function hp(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,X.pendingUnobservations.push(e))}function Nt(){X.inBatch++}function jt(){if(--X.inBatch===0){vp();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 Rt&&r.suspend_())}X.pendingUnobservations=[]}}function yp(e){l_(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&&hp(e),!1)}function gp(e){e.lowestObserverState_!==ke.STALE_&&(e.lowestObserverState_=ke.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ke.UP_TO_DATE_&&(t.isTracing_!==Pt.NONE&&mp(t,e),t.onBecomeStale_()),t.dependenciesState_=ke.STALE_}))}function m_(e){e.lowestObserverState_!==ke.STALE_&&(e.lowestObserverState_=ke.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ke.POSSIBLY_STALE_?(t.dependenciesState_=ke.STALE_,t.isTracing_!==Pt.NONE&&mp(t,e)):t.dependenciesState_===ke.UP_TO_DATE_&&(e.lowestObserverState_=ke.UP_TO_DATE_)}))}function b_(e){e.lowestObserverState_===ke.UP_TO_DATE_&&(e.lowestObserverState_=ke.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ke.UP_TO_DATE_&&(t.dependenciesState_=ke.POSSIBLY_STALE_,t.onBecomeStale_())}))}function mp(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===Pt.BREAK){var r=[];bp(ns(e),r,1),new Function(`debugger;
|
|
5
|
+
Use '@override' decorator for methods overridden by subclass.`)}}function h1(e){return Ut(e,gt)||Ja(e,gt,vr({},e[gt])),e[gt]}function fo(e){return typeof e=="object"&&typeof e.kind=="string"}function Ya(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@"+Vt()),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=ke.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 yp(this)},t.reportChanged=function(){jt(),gp(this),Ct()},t.toString=function(){return this.name_},si(e,[{key:"isBeingObserved",get:function(){return bt(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=vt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return bt(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=vt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return bt(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=vt(this.flags_,e.diffValueMask_,r===1)}}])}();Wr.isBeingObservedMask_=1;Wr.isPendingUnobservationMask_=2;Wr.diffValueMask_=4;var ll=Hr("Atom",Wr);function ep(e,t,r){t===void 0&&(t=Dn),r===void 0&&(r=Dn);var n=new Wr(e);return t!==Dn&&pl(n,t),r!==Dn&&Sn(n,r),n}function y1(e,t){return e===t}function g1(e,t){return ml(e,t)}function m1(e,t){return ml(e,t,1)}function b1(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Je={identity:y1,structural:g1,default:b1,shallow:m1};function ui(e,t,r){return Fn(e)?e:Array.isArray(e)?Be.array(e,{name:r}):Yt(e)?Be.object(e,void 0,{name:r}):ai(e)?Be.map(e,{name:r}):yr(e)?Be.set(e,{name:r}):typeof e=="function"&&!un(e)&&!zi(e)?Jd(e)?Vn(e):Vi(r,e):e}function v1(e,t,r){if(e==null||ln(e)||ci(e)||cr(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(ai(e))return Be.map(e,{name:r,deep:!1});if(yr(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 Xa(e){return e}function w1(e,t){return Fn(e)&&de("observable.struct should not be used with observable values"),ml(e,t)?t:e}var _1="override";function aa(e){return e.annotationType_===_1}function po(e,t){return{annotationType_:e,options_:t,make_:T1,extend_:E1,decorate_20223_:x1}}function T1(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=tp(e,this,t,r,!1);return nr(n,t,o),2}function E1(e,t,r,n){var i=tp(e,this,t,r);return e.defineProperty_(t,i,n)}function x1(e,t){Ya(t,["method","field"]);var r=t.kind,n=t.name,i=t.addInitializer,o=this,a=function(u){var l,f,d,k;return sn((l=(f=o.options_)==null?void 0:f.name)!=null?l:n.toString(),u,(d=(k=o.options_)==null?void 0:k.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 O1(e,t,r,n){var i=t.annotationType_,o=n.value;ze(o)||de("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
7
|
+
'`+i+"' can only be used on properties with a function value."))}function tp(e,t,r,n,i){var o,a,s,u,l,f,d;i===void 0&&(i=X.safeDescriptors),O1(e,t,r,n);var k=n.value;if((o=t.options_)!=null&&o.bound){var E;k=k.bind((E=e.proxy_)!=null?E:e.target_)}return{value:sn((a=(s=t.options_)==null?void 0:s.name)!=null?a:r.toString(),k,(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 rp(e,t){return{annotationType_:e,options_:t,make_:A1,extend_:S1,decorate_20223_:I1}}function A1(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)||!zi(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(zi(r.value))return 1;var o=np(e,this,t,r,!1,!1);return nr(n,t,o),2}function S1(e,t,r,n){var i,o=np(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,o,n)}function I1(e,t){var r;Ya(t,["method"]);var n=t.name,i=t.addInitializer;return zi(e)||(e=Vn(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 k1(e,t,r,n){var i=t.annotationType_,o=n.value;ze(o)||de("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
8
|
+
'`+i+"' can only be used on properties with a generator function value."))}function np(e,t,r,n,i,o){o===void 0&&(o=X.safeDescriptors),k1(e,t,r,n);var a=n.value;if(zi(a)||(a=Vn(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 cl(e,t){return{annotationType_:e,options_:t,make_:$1,extend_:N1,decorate_20223_:j1}}function $1(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function N1(e,t,r,n){return C1(e,this,t,r),e.defineComputedProperty_(t,vr({},this.options_,{get:r.get,set:r.set}),n)}function j1(e,t){Ya(t,["getter"]);var r=this,n=t.name,i=t.addInitializer;return i(function(){var o=fi(this)[we],a=vr({},r.options_,{get:e,context:this});a.name||(a.name=o.name_+"."+n.toString()),o.values_.set(n,new Rt(a))}),function(){return this[we].getObservablePropValue_(n)}}function C1(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_:U1,extend_:P1,decorate_20223_:R1}}function U1(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function P1(e,t,r,n){var i,o;return D1(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(o=this.options_)==null?void 0:o.enhancer)!=null?i:ui,n)}function R1(e,t){if(t.kind==="field")throw de("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");Ya(t,["accessor"]);var r=this,n=t.kind,i=t.name,o=new WeakSet;function a(s,u){var l,f,d=fi(s)[we],k=new Br(u,(l=(f=r.options_)==null?void 0:f.enhancer)!=null?l:ui,d.name_+"."+i.toString(),!1);d.values_.set(i,k),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 D1(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 M1="true",L1=ip();function ip(e){return{annotationType_:M1,options_:e,make_:B1,extend_:V1,decorate_20223_:F1}}function B1(e,t,r,n){var i,o;if(r.get)return Fe.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?Vn.bound:Vn;return l.make_(e,t,r,n)}var f=(s=this.options_)!=null&&s.autoBind?Vi.bound:Vi;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 k;r.value=r.value.bind((k=e.proxy_)!=null?k:e.target_)}return d.make_(e,t,r,n)}function V1(e,t,r,n){var i,o;if(r.get)return Fe.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 F1(e,t){de("'"+this.annotationType_+"' cannot be used as a decorator")}var z1="observable",q1="observable.ref",K1="observable.shallow",G1="observable.struct",op={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(op);function Eo(e){return e||op}var Xs=Za(z1),H1=Za(q1,{enhancer:Xa}),W1=Za(K1,{enhancer:v1}),J1=Za(G1,{enhancer:w1}),ap=ir(Xs);function xo(e){return e.deep===!0?ui:e.deep===!1?Xa:Y1(e.defaultDecorator)}function Q1(e){var t;return e?(t=e.defaultDecorator)!=null?t:ip(e):void 0}function Y1(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:ui}function sp(e,t,r){if(fo(t))return Xs.decorate_20223_(e,t);if(an(t)){co(e,t,Xs);return}return Fn(e)?e:Yt(e)?Be.object(e,t,r):Array.isArray(e)?Be.array(e,t):ai(e)?Be.map(e,t):yr(e)?Be.set(e,t):typeof e=="object"&&e!==null?e:Be.box(e,t)}Hd(sp,ap);var X1={box:function(e,t){var r=Eo(t);return new Br(e,xo(r),r.name,!0,r.equals)},array:function(e,t){var r=Eo(t);return(X.useProxies===!1||r.proxy===!1?rT:G_)(e,xo(r),r.name)},map:function(e,t){var r=Eo(t);return new $p(e,xo(r),r.name)},set:function(e,t){var r=Eo(t);return new Np(e,xo(r),r.name)},object:function(e,t,r){return In(function(){return P_(X.useProxies===!1||r?.proxy===!1?fi({},r):z_({},r),e,t)})},ref:ir(H1),shallow:ir(W1),deep:ap,struct:ir(J1)},Be=Hd(sp,X1),up="computed",Z1="computed.struct",Zs=cl(up),e_=cl(Z1,{equals:Je.structural}),Fe=function(e,t){if(fo(t))return Zs.decorate_20223_(e,t);if(an(t))return co(e,t,Zs);if(Yt(e))return ir(cl(up,e));ze(e)||de("First argument to `computed` should be an expression."),ze(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 Rt(r)};Object.assign(Fe,Zs);Fe.struct=ir(e_);var _c,Tc,sa=0,t_=1,r_=(_c=(Tc=ia(function(){},"name"))==null?void 0:Tc.configurable)!=null?_c:!1,Ec={value:"action",configurable:!0,writable:!1,enumerable:!1};function sn(e,t,r,n){r===void 0&&(r=!1),ze(t)||de("`action` can only be invoked on functions"),(typeof e!="string"||!e)&&de("actions should have valid names, got: '"+e+"'");function i(){return lp(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},r_&&(Ec.value=e,nr(i,"name",Ec)),i}function lp(e,t,r,n,i){var o=n_(e,t,n,i);try{return r.apply(n,i)}catch(a){throw o.error_=a,a}finally{i_(o)}}function n_(e,t,r,n){var i=ot()&&!!e,o=0;if(i){o=Date.now();var a=n?Array.from(n):oa;wt({type:dl,name:e,object:r,arguments:a})}var s=X.trackingDerivation,u=!t||!s;jt();var l=X.allowStateChanges;u&&(An(),l=es(!0));var f=fl(!0),d={runAsAction_:u,prevDerivation_:s,prevAllowStateChanges_:l,prevAllowStateReads_:f,notifySpy_:i,startTime_:o,actionId_:t_++,parentActionId_:sa};return sa=d.actionId_,d}function i_(e){sa!==e.actionId_&&de(30),sa=e.parentActionId_,e.error_!==void 0&&(X.suppressReactionErrors=!0),ts(e.prevAllowStateChanges_),Ui(e.prevAllowStateReads_),Ct(),e.runAsAction_&&mr(e.prevDerivation_),e.notifySpy_&&_t({time:Date.now()-e.startTime_}),X.suppressReactionErrors=!1}function o_(e,t){var r=es(e);try{return t()}finally{ts(r)}}function es(e){var t=X.allowStateChanges;return X.allowStateChanges=e,t}function ts(e){X.allowStateChanges=e}var a_="create",Br=function(e){function t(n,i,o,a,s){var u;return o===void 0&&(o="ObservableValue@"+Vt()),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()&&Bn({type:a_,object:u,observableKind:"value",debugObjectName:u.name_,newValue:""+u.value_}),u}Zd(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&&wt({type:Wt,object:this,observableKind:"value",debugObjectName:this.name_,newValue:n,oldValue:i}),this.setNewValue_(n),o&&_t()}},r.prepareNewValue_=function(n){if(rr(this),$t(this)){var i=Nt(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 yo(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}),go(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 Xd(this.get())},r[Symbol.toPrimitive]=function(){return this.valueOf()},t}(Wr),s_=Hr("ObservableValue",Br),Rt=function(){function e(r){this.dependenciesState_=ke.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=ke.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new ua(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@"+Vt(),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(){b_(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_)eu(this)&&(this.warnAboutUntrackedRead_(),jt(),this.value_=this.computeValue_(!1),Ct());else if(yp(this),eu(this)){var r=X.trackingContext;this.keepAlive_&&!r&&(X.trackingContext=this),this.trackAndCompute()&&m_(this),X.trackingContext=r}var n=this.value_;if(Uo(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_===ke.NOT_TRACKING_,i=this.computeValue_(!0),o=n||Uo(r)||Uo(i)||!this.equals_(r,i);return o&&(this.value_=i,ot()&&Bn({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:r,newValue:i})),o},t.computeValue_=function(r){this.isComputing=!0;var n=es(!1),i;if(r)i=cp(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 ua(o)}return ts(n),this.isComputing=!1,i},t.suspend_=function(){this.keepAlive_||(tu(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 Dt(function(){var s=i.get();if(!o||n){var u=An();r({observableKind:"computed",debugObjectName:i.name_,type:Wt,object:i,newValue:s,oldValue:a}),mr(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 Xd(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},si(e,[{key:"isComputing",get:function(){return bt(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=vt(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return bt(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=vt(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return bt(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=vt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return bt(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=vt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return bt(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=vt(this.flags_,e.diffValueMask_,r===1)}}])}();Rt.isComputingMask_=1;Rt.isRunningSetterMask_=2;Rt.isBeingObservedMask_=4;Rt.isPendingUnobservationMask_=8;Rt.diffValueMask_=16;var ho=Hr("ComputedValue",Rt),ke;(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_"})(ke||(ke={}));var Pt;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(Pt||(Pt={}));var ua=function(e){this.cause=void 0,this.cause=e};function Uo(e){return e instanceof ua}function eu(e){switch(e.dependenciesState_){case ke.UP_TO_DATE_:return!1;case ke.NOT_TRACKING_:case ke.STALE_:return!0;case ke.POSSIBLY_STALE_:{for(var t=fl(!0),r=An(),n=e.observing_,i=n.length,o=0;o<i;o++){var a=n[o];if(ho(a)){if(X.disableErrorBoundaries)a.get();else try{a.get()}catch{return mr(r),Ui(t),!0}if(e.dependenciesState_===ke.STALE_)return mr(r),Ui(t),!0}}return fp(e),mr(r),Ui(t),!1}}}function u_(){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 l_(e){!X.allowStateReads&&X.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function cp(e,t,r){var n=fl(!0);fp(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 ua(a)}return X.inBatch--,X.trackingDerivation=i,f_(e),c_(e),Ui(n),o}function c_(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 f_(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=ke.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&&pp(u,e),u.diffValue=0}for(;i--;){var l=r[i];l.diffValue===1&&(l.diffValue=0,g_(l,e))}n!==ke.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function tu(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)pp(t[r],e);e.dependenciesState_=ke.NOT_TRACKING_}function Le(e){var t=An();try{return e()}finally{mr(t)}}function An(){var e=X.trackingDerivation;return X.trackingDerivation=null,e}function mr(e){X.trackingDerivation=e}function fl(e){var t=X.allowStateReads;return X.allowStateReads=e,t}function Ui(e){X.allowStateReads=e}function fp(e){if(e.dependenciesState_!==ke.UP_TO_DATE_){e.dependenciesState_=ke.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=ke.UP_TO_DATE_}}var Po=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},Ro=!0,dp=!1,X=function(){var e=Ha();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Ro=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Po().version&&(Ro=!1),Ro?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Po):(setTimeout(function(){dp||de(35)},1),new Po)}();function d_(){if((X.pendingReactions.length||X.inBatch||X.isRunningReactions)&&de(36),dp=!0,Ro){var e=Ha();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),X=new Po}}function p_(){return X}function h_(e){return e.observers_&&e.observers_.size>0}function y_(e){return e.observers_}function g_(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function pp(e,t){e.observers_.delete(t),e.observers_.size===0&&hp(e)}function hp(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,X.pendingUnobservations.push(e))}function jt(){X.inBatch++}function Ct(){if(--X.inBatch===0){vp();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 Rt&&r.suspend_())}X.pendingUnobservations=[]}}function yp(e){l_(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&&hp(e),!1)}function gp(e){e.lowestObserverState_!==ke.STALE_&&(e.lowestObserverState_=ke.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ke.UP_TO_DATE_&&(t.isTracing_!==Pt.NONE&&mp(t,e),t.onBecomeStale_()),t.dependenciesState_=ke.STALE_}))}function m_(e){e.lowestObserverState_!==ke.STALE_&&(e.lowestObserverState_=ke.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ke.POSSIBLY_STALE_?(t.dependenciesState_=ke.STALE_,t.isTracing_!==Pt.NONE&&mp(t,e)):t.dependenciesState_===ke.UP_TO_DATE_&&(e.lowestObserverState_=ke.UP_TO_DATE_)}))}function b_(e){e.lowestObserverState_===ke.UP_TO_DATE_&&(e.lowestObserverState_=ke.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ke.UP_TO_DATE_&&(t.dependenciesState_=ke.POSSIBLY_STALE_,t.onBecomeStale_())}))}function mp(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===Pt.BREAK){var r=[];bp(rs(e),r,1),new Function(`debugger;
|
|
11
11
|
/*
|
|
12
12
|
Tracing '`+e.name_+`'
|
|
13
13
|
|
|
@@ -22,45 +22,45 @@ The dependencies for this derivation are:
|
|
|
22
22
|
`+r.join(`
|
|
23
23
|
`)+`
|
|
24
24
|
*/
|
|
25
|
-
`)()}}function bp(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 bp(n,t,r+1)})}var ar=function(){function e(r,n,i,o){r===void 0&&(r="Reaction@"+Vt()),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=ke.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),vp())},t.runReaction_=function(){if(!this.isDisposed){Nt(),this.isScheduled=!1;var r=X.trackingContext;if(X.trackingContext=this,tu(this)){this.isTrackPending=!0;try{this.onInvalidate_(),this.isTrackPending&&ot()&&Ln({name:this.name_,type:"scheduled-reaction"})}catch(n){this.reportExceptionInDerivation_(n)}}X.trackingContext=r,jt()}},t.track=function(r){if(!this.isDisposed){Nt();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=cp(this,r,void 0);X.trackingContext=o,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&ru(this),Uo(a)&&this.reportExceptionInDerivation_(a.cause),n&&wt({time:Date.now()-i}),jt()}},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()&&Ln({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||(Nt(),ru(this),jt()))},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),Ip(this,r)},ai(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 Oc=100,nu=function(e){return e()};function vp(){X.inBatch>0||X.isRunningReactions||nu(v_)}function v_(){X.isRunningReactions=!0;for(var e=X.pendingReactions,t=0;e.length>0;){++t===Oc&&(console.error("Reaction doesn't converge to a stable state after "+Oc+" 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 la=Hr("Reaction",ar);function w_(e){var t=nu;nu=function(r){return e(function(){return t(r)})}}function ot(){return!!X.spyListeners.length}function Ln(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=vr({},e,{spyReportStart:!0});Ln(t)}var __={type:"report-end",spyReportEnd:!0};function wt(e){Ln(e?vr({},e,{type:"report-end",spyReportEnd:!0}):__)}function T_(e){return X.spyListeners.push(e),ll(function(){X.spyListeners=X.spyListeners.filter(function(t){return t!==e})})}var pl="action",E_="action.bound",wp="autoAction",O_="autoAction.bound",_p="<unnamed action>",iu=po(pl),x_=po(E_,{bound:!0}),ou=po(wp,{autoAction:!0}),A_=po(O_,{autoAction:!0,bound:!0});function Tp(e){var t=function(r,n){if(Fe(r))return sn(r.name||_p,r,e);if(Fe(n))return sn(r,n,e);if(fo(n))return(e?ou:iu).decorate_20223_(r,n);if(an(n))return co(r,n,e?ou:iu);if(an(r))return ir(po(e?wp:pl,{name:r,autoAction:e}));de("Invalid arguments for `action`")};return t}var Ct=Tp(!1);Object.assign(Ct,iu);var Vi=Tp(!0);Object.assign(Vi,ou);Ct.bound=ir(x_);Vi.bound=ir(A_);function Fi(e){return lp(e.name||_p,!1,e,this,void 0)}function un(e){return Fe(e)&&e.isMobxAction===!0}function Dt(e,t){var r,n,i,o;t===void 0&&(t=ul),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@"+Vt(),s=!t.scheduler&&!t.delay,u;if(s)u=new ar(a,function(){this.track(d)},t.onError,t.requiresObservable);else{var l=Ep(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 S_=function(e){return e()};function Ep(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:S_}function I_(e,t,r){var n,i,o;r===void 0&&(r=ul),(!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@"+Vt(),s=Ct(a,r.onError?k_(r.onError,t):t),u=!r.scheduler&&!r.delay,l=Ep(r),f=!0,d=!1,k,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,D=k;T.track(function(){var $=o_(!1,function(){return e(T)});W=f||!E(k,$),k=$}),(f&&r.fireImmediately||!f&&W)&&s(k,D,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 k_(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var $_="onBO",N_="onBUO";function rs(e,t,r){return Op($_,e,t,r)}function ui(e,t,r){return Op(N_,e,t,r)}function Op(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 j_="never",xo="always",C_="observed";function U_(e){e.isolateGlobalState===!0&&d_();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(X.useProxies=t===xo?!0:t===j_?!1:typeof Proxy<"u"),t==="ifavailable"&&(X.verifyProxies=!0),r!==void 0){var n=r===xo?xo:r===C_;X.enforceActions=n,X.allowStateChanges=!(n===!0||n===xo)}["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&&w_(e.reactionScheduler)}function P_(e,t,r,n){arguments.length>4&&de("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&de("'extendObservable' expects an object as first argument"),cr(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=l1(t);return Sn(function(){var o=fi(e,n)[we];Qa(i).forEach(function(a){o.extend_(a,i[a],r&&a in r?r[a]:!0)})}),e}function ns(e,t){return xp(Xt(e,t))}function xp(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=R_(e.observing_).map(xp)),t}function ca(e,t){return Ap(Xt(e,t))}function Ap(e){var t={name:e.name_};return h_(e)&&(t.observers=Array.from(y_(e)).map(Ap)),t}function R_(e){return Array.from(new Set(e))}var D_=0;function Sp(){this.message="FLOW_CANCELLED"}Sp.prototype=Object.create(Error.prototype);var Is=rp("flow"),M_=rp("flow.bound",{bound:!0}),Bn=Object.assign(function(e,t){if(fo(t))return Is.decorate_20223_(e,t);if(an(t))return co(e,t,Is);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=++D_,u=Ct(n+" - runid: "+s+" - init",r).apply(o,a),l,f=void 0,d=new Promise(function(k,E){var T=0;l=E;function B($){f=void 0;var F;try{F=Ct(n+" - runid: "+s+" - yield "+T++,u.next).call(u,$)}catch(K){return E(K)}D(F)}function W($){f=void 0;var F;try{F=Ct(n+" - runid: "+s+" - yield "+T++,u.throw).call(u,$)}catch(K){return E(K)}D(F)}function D($){if(Fe($?.then)){$.then(D,E);return}return $.done?k($.value):(f=Promise.resolve($.value),f.then(B,W))}B(void 0)});return d.cancel=Ct(n+" - runid: "+s+" - cancel",function(){try{f&&xc(f);var k=u.return(void 0),E=Promise.resolve(k.value);E.then(Rn,Rn),xc(E),l(new Sp)}catch(T){l(T)}}),d};return i.isMobXFlow=!0,i},Is);Bn.bound=ir(M_);function xc(e){Fe(e.cancel)&&e.cancel()}function zi(e){return e?.isMobXFlow===!0}function L_(e,t){return e?t!==void 0?cr(e)||ci(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]||cl(e)||la(e)||ho(e):!1}function Vn(e){return arguments.length!==1&&de("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),L_(e)}function B_(e){if(ln(e))return e[we].ownKeys_();de(38)}function Ao(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(s_(e)||ho(e))return Un(e.get(),t);if(t.has(e))return t.get(e);if(ci(e)){var r=Ao(t,e,new Array(e.length));return e.forEach(function(a,s){r[s]=Un(a,t)}),r}if(Gt(e)){var n=Ao(t,e,new Set);return e.forEach(function(a){n.add(Un(a,t))}),n}if(cr(e)){var i=Ao(t,e,new Map);return e.forEach(function(a,s){i.set(s,Un(a,t))}),i}else{var o=Ao(t,e,{});return B_(e).forEach(function(a){lo.propertyIsEnumerable.call(e,a)&&(o[a]=Un(e[a],t))}),o}}function br(e,t){return t&&de("toJS no longer supports options"),Un(e,new Map)}function Ip(){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=V_(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 V_(e){switch(e.length){case 0:return X.trackingDerivation;case 1:return Xt(e[0]);case 2:return Xt(e[0],e[1])}}function gr(e,t){t===void 0&&(t=void 0),Nt();try{return e.apply(t)}finally{jt()}}function Zr(e){return e[we]}var F_={has:function(e,t){return X.trackingDerivation&&Ti("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)||Ti("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 Ti("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 Ti("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&&Ti("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),Zr(e).ownKeys_()},preventExtensions:function(e){de(13)}};function z_(e,t){var r,n;return Wd(),e=fi(e,t),(n=(r=e[we]).proxy_)!=null?n:r.proxy_=new Proxy(e,F_)}function kt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function yo(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),ll(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function $t(e,t){var r=An();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{mr(r)}}function Jt(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function go(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),ll(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Qt(e,t){var r=An(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,o=n.length;i<o;i++)n[i](t);mr(r)}}function li(e,t,r){return Sn(function(){var n,i=fi(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=h1(e)),Qa(t).forEach(function(o){return i.make_(o,t[o])})}),e}var Ac="splice",Wt="update",q_=1e4,K_={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(fa,t)?fa[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)}},hl=function(){function e(r,n,i,o){r===void 0&&(r="ObservableArray@"+Vt()),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 yo(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}),go(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&&Up(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=oa),kt(this)){var s=$t(this,{object:this.proxy_,type:Ac,index:r,removedCount:n,added:i});if(!s)return oa;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<q_){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:Ac,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(kt(this)){var a=$t(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 G_(e,t,r,n){return r===void 0&&(r="ObservableArray@"+Vt()),n===void 0&&(n=!1),Wd(),Sn(function(){var i=new hl(r,t,n,!1);Qd(i.values_,we,i);var o=new Proxy(i.values_,K_);return i.proxy_=o,e&&e.length&&i.spliceWithArray_(0,0,e),o})}var fa={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}};Re("at",Tt);Re("concat",Tt);Re("flat",Tt);Re("includes",Tt);Re("indexOf",Tt);Re("join",Tt);Re("lastIndexOf",Tt);Re("slice",Tt);Re("toString",Tt);Re("toLocaleString",Tt);Re("toSorted",Tt);Re("toSpliced",Tt);Re("with",Tt);Re("every",er);Re("filter",er);Re("find",er);Re("findIndex",er);Re("findLast",er);Re("findLastIndex",er);Re("flatMap",er);Re("forEach",er);Re("map",er);Re("some",er);Re("toReversed",er);Re("reduce",kp);Re("reduceRight",kp);function Re(e,t){typeof Array.prototype[e]=="function"&&(fa[e]=t(e))}function Tt(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 kp(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 H_=Hr("ObservableArrayAdministration",hl);function ci(e){return Wa(e)&&H_(e[we])}var W_={},Mr="add",da="delete",$p=function(){function e(r,n,i){var o=this;n===void 0&&(n=si),i===void 0&&(i="ObservableMap@"+Vt()),this.enhancer_=void 0,this.name_=void 0,this[we]=W_,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),Sn(function(){o.keysAtom_=ep(o.name_+".keys()"),o.data_=new Map,o.hasMap_=new Map,r&&o.merge(r)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var n=this;if(!X.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var o=i=new Br(this.has_(r),Xa,this.name_+"."+Ys(r)+"?",!1);this.hasMap_.set(r,o),ui(o,function(){return n.hasMap_.delete(r)})}return i.get()},t.set=function(r,n){var i=this.has_(r);if(kt(this)){var o=$t(this,{type:i?Wt:Mr,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_),kt(this)){var i=$t(this,{type:da,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:da,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return o&&vt(s),gr(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_),gr(function(){var u,l=new Br(n,i.enhancer_,i.name_+"."+Ys(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:Mr,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 Sc({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 Sc({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=Dn(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 cr(r)&&(r=new Map(r)),gr(function(){Yt(r)?u1(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)}):oi(r)?(s1(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;gr(function(){Le(function(){for(var n=Dn(r.keys()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.replace=function(r){var n=this;return gr(function(){for(var i=J_(r),o=new Map,a=!1,s=Dn(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 k=Dn(i.entries()),E;!(E=k()).done;){var T=E.value,B=T[0],W=T[1],D=n.data_.has(B);if(n.set(B,W),n.data_.has(B)){var $=n.data_.get(B);o.set(B,$),D||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var F=n.data_.keys(),K=o.keys(),M=F.next(),Q=K.next();!M.done;){if(M.value!==Q.value){n.keysAtom_.reportChanged();break}M=F.next(),Q=K.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."),go(this,r)},t.intercept_=function(r){return yo(this,r)},ai(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),cr=Hr("ObservableMap",$p);function Sc(e){return e[Symbol.toStringTag]="MapIterator",bl(e)}function J_(e){if(oi(e)||cr(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 Q_={},Np=function(){function e(r,n,i){var o=this;n===void 0&&(n=si),i===void 0&&(i="ObservableSet@"+Vt()),this.name_=void 0,this[we]=Q_,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)},Sn(function(){o.atom_=ep(o.name_),r&&o.replace(r)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;gr(function(){Le(function(){for(var n=Dn(r.data_.values()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.forEach=function(r,n){for(var i=Dn(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_),kt(this)){var i=$t(this,{type:Mr,object:this,newValue:r});if(!i)return this;r=i.newValue}if(!this.has(r)){gr(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:Mr,object:this,newValue:r}:null;o&&vt(s),a&&Qt(this,s),o&&wt()}return this},t.delete=function(r){var n=this;if(kt(this)){var i=$t(this,{type:da,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:da,object:this,oldValue:r}:null;return o&&vt(s),gr(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 Ic({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 Ic({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(yr(r)&&!Gt(r))return r.intersection(this);var n=new Set(this);return n.intersection(r)},t.union=function(r){if(yr(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(yr(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(yr(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)),gr(function(){Array.isArray(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):yr(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."),go(this,r)},t.intercept_=function(r){return yo(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},ai(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),Gt=Hr("ObservableSet",Np);function Ic(e){return e[Symbol.toStringTag]="SetIterator",bl(e)}var kc=Object.create(null),$c="remove",au=function(){function e(r,n,i,o){n===void 0&&(n=new Map),o===void 0&&(o=L1),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_),Pp(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 Rt)return i.set(n),!0;if(kt(this)){var o=$t(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_,Xa,this.name_+"."+Ys(r)+"?",!1),this.pendingKeys_.set(r,n)),n.get()},t.make_=function(r,n){if(n===!0&&(n=this.defaultAnnotation_),n!==!1){if(Cc(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!==lo;){var a=ia(o,r);if(a){var s=n.make_(this,r,a,o);if(s===0)return;if(s===1)break}o=Object.getPrototypeOf(o)}jc(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);Cc(this,i,r);var a=i.extend_(this,r,n,o);return a&&jc(this,i,r),a},t.defineProperty_=function(r,n,i){i===void 0&&(i=!1),rr(this.keysAtom_);try{Nt();var o=this.delete_(r);if(!o)return o;if(kt(this)){var a=$t(this,{object:this.proxy_||this.target_,name:r,type:Mr,newValue:n.value});if(!a)return null;var s=a.newValue;n.value!==s&&(n=vr({},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{jt()}return!0},t.defineObservableProperty_=function(r,n,i,o){o===void 0&&(o=!1),rr(this.keysAtom_);try{Nt();var a=this.delete_(r);if(!a)return a;if(kt(this)){var s=$t(this,{object:this.proxy_||this.target_,name:r,type:Mr,newValue:n});if(!s)return null;n=s.newValue}var u=Nc(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{jt()}return!0},t.defineComputedProperty_=function(r,n,i){i===void 0&&(i=!1),rr(this.keysAtom_);try{Nt();var o=this.delete_(r);if(!o)return o;if(kt(this)){var a=$t(this,{object:this.proxy_||this.target_,name:r,type:Mr,newValue:void 0});if(!a)return null}n.name||(n.name=this.name_+"."+r.toString()),n.context=this.proxy_||this.target_;var s=Nc(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 Rt(n)),this.notifyPropertyAddition_(r,void 0)}finally{jt()}return!0},t.delete_=function(r,n){if(n===void 0&&(n=!1),rr(this.keysAtom_),!Ut(this.target_,r))return!0;if(kt(this)){var i=$t(this,{object:this.proxy_||this.target_,name:r,type:$c});if(!i)return null}try{var o;Nt();var a=Jt(this),s=ot(),u=this.values_.get(r),l=void 0;if(!u&&(a||s)){var f;l=(f=ia(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_),gp(u)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(o=o.get(r))==null||o.set(r in this.target_),a||s){var d={type:$c,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:l,name:r};s&&vt(d),a&&Qt(this,d),s&&wt()}}finally{jt()}return!0},t.observe_=function(r,n){return n===!0&&de("`observe` doesn't support the fire immediately property for observable objects."),go(this,r)},t.intercept_=function(r){return yo(this,r)},t.notifyPropertyAddition_=function(r,n){var i,o=Jt(this),a=ot();if(o||a){var s=o||a?{type:Mr,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(),Qa(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function fi(e,t){var r;if(t&&ln(e)&&de("Options can't be provided for already observable objects."),Ut(e,we))return gl(e)instanceof au||de("Cannot convert '"+pa(e)+`' into observable object:
|
|
25
|
+
`)()}}function bp(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 bp(n,t,r+1)})}var ar=function(){function e(r,n,i,o){r===void 0&&(r="Reaction@"+Vt()),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=ke.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),vp())},t.runReaction_=function(){if(!this.isDisposed){jt(),this.isScheduled=!1;var r=X.trackingContext;if(X.trackingContext=this,eu(this)){this.isTrackPending=!0;try{this.onInvalidate_(),this.isTrackPending&&ot()&&Bn({name:this.name_,type:"scheduled-reaction"})}catch(n){this.reportExceptionInDerivation_(n)}}X.trackingContext=r,Ct()}},t.track=function(r){if(!this.isDisposed){jt();var n=ot(),i;n&&(i=Date.now(),wt({name:this.name_,type:"reaction"})),this.isRunning=!0;var o=X.trackingContext;X.trackingContext=this;var a=cp(this,r,void 0);X.trackingContext=o,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&tu(this),Uo(a)&&this.reportExceptionInDerivation_(a.cause),n&&_t({time:Date.now()-i}),Ct()}},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()&&Bn({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(),tu(this),Ct()))},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),Ip(this,r)},si(e,[{key:"isDisposed",get:function(){return bt(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=vt(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return bt(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=vt(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return bt(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=vt(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return bt(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=vt(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return bt(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=vt(this.flags_,e.diffValueMask_,r===1)}}])}();ar.isDisposedMask_=1;ar.isScheduledMask_=2;ar.isTrackPendingMask_=4;ar.isRunningMask_=8;ar.diffValueMask_=16;var xc=100,ru=function(e){return e()};function vp(){X.inBatch>0||X.isRunningReactions||ru(v_)}function v_(){X.isRunningReactions=!0;for(var e=X.pendingReactions,t=0;e.length>0;){++t===xc&&(console.error("Reaction doesn't converge to a stable state after "+xc+" 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 la=Hr("Reaction",ar);function w_(e){var t=ru;ru=function(r){return e(function(){return t(r)})}}function ot(){return!!X.spyListeners.length}function Bn(e){if(X.spyListeners.length)for(var t=X.spyListeners,r=0,n=t.length;r<n;r++)t[r](e)}function wt(e){var t=vr({},e,{spyReportStart:!0});Bn(t)}var __={type:"report-end",spyReportEnd:!0};function _t(e){Bn(e?vr({},e,{type:"report-end",spyReportEnd:!0}):__)}function T_(e){return X.spyListeners.push(e),ul(function(){X.spyListeners=X.spyListeners.filter(function(t){return t!==e})})}var dl="action",E_="action.bound",wp="autoAction",x_="autoAction.bound",_p="<unnamed action>",nu=po(dl),O_=po(E_,{bound:!0}),iu=po(wp,{autoAction:!0}),A_=po(x_,{autoAction:!0,bound:!0});function Tp(e){var t=function(r,n){if(ze(r))return sn(r.name||_p,r,e);if(ze(n))return sn(r,n,e);if(fo(n))return(e?iu:nu).decorate_20223_(r,n);if(an(n))return co(r,n,e?iu:nu);if(an(r))return ir(po(e?wp:dl,{name:r,autoAction:e}));de("Invalid arguments for `action`")};return t}var mt=Tp(!1);Object.assign(mt,nu);var Vi=Tp(!0);Object.assign(Vi,iu);mt.bound=ir(O_);Vi.bound=ir(A_);function Fi(e){return lp(e.name||_p,!1,e,this,void 0)}function un(e){return ze(e)&&e.isMobxAction===!0}function Dt(e,t){var r,n,i,o;t===void 0&&(t=sl),ze(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@"+Vt(),s=!t.scheduler&&!t.delay,u;if(s)u=new ar(a,function(){this.track(d)},t.onError,t.requiresObservable);else{var l=Ep(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 S_=function(e){return e()};function Ep(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:S_}function I_(e,t,r){var n,i,o;r===void 0&&(r=sl),(!ze(e)||!ze(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@"+Vt(),s=mt(a,r.onError?k_(r.onError,t):t),u=!r.scheduler&&!r.delay,l=Ep(r),f=!0,d=!1,k,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,D=k;T.track(function(){var $=o_(!1,function(){return e(T)});W=f||!E(k,$),k=$}),(f&&r.fireImmediately||!f&&W)&&s(k,D,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 k_(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var $_="onBO",N_="onBUO";function pl(e,t,r){return xp($_,e,t,r)}function Sn(e,t,r){return xp(N_,e,t,r)}function xp(e,t,r,n){var i=typeof n=="function"?Xt(t,r):Xt(t),o=ze(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 j_="never",Oo="always",C_="observed";function U_(e){e.isolateGlobalState===!0&&d_();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(X.useProxies=t===Oo?!0:t===j_?!1:typeof Proxy<"u"),t==="ifavailable"&&(X.verifyProxies=!0),r!==void 0){var n=r===Oo?Oo:r===C_;X.enforceActions=n,X.allowStateChanges=!(n===!0||n===Oo)}["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&&w_(e.reactionScheduler)}function P_(e,t,r,n){arguments.length>4&&de("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&de("'extendObservable' expects an object as first argument"),cr(e)&&de("'extendObservable' should not be used on maps, use map.merge instead"),Yt(t)||de("'extendObservable' only accepts plain objects as second argument"),(Fn(t)||Fn(r))&&de("Extending an object with another observable (object) is not supported");var i=l1(t);return In(function(){var o=fi(e,n)[we];Qa(i).forEach(function(a){o.extend_(a,i[a],r&&a in r?r[a]:!0)})}),e}function rs(e,t){return Op(Xt(e,t))}function Op(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=R_(e.observing_).map(Op)),t}function ca(e,t){return Ap(Xt(e,t))}function Ap(e){var t={name:e.name_};return h_(e)&&(t.observers=Array.from(y_(e)).map(Ap)),t}function R_(e){return Array.from(new Set(e))}var D_=0;function Sp(){this.message="FLOW_CANCELLED"}Sp.prototype=Object.create(Error.prototype);var Ss=rp("flow"),M_=rp("flow.bound",{bound:!0}),Vn=Object.assign(function(e,t){if(fo(t))return Ss.decorate_20223_(e,t);if(an(t))return co(e,t,Ss);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=++D_,u=mt(n+" - runid: "+s+" - init",r).apply(o,a),l,f=void 0,d=new Promise(function(k,E){var T=0;l=E;function B($){f=void 0;var F;try{F=mt(n+" - runid: "+s+" - yield "+T++,u.next).call(u,$)}catch(K){return E(K)}D(F)}function W($){f=void 0;var F;try{F=mt(n+" - runid: "+s+" - yield "+T++,u.throw).call(u,$)}catch(K){return E(K)}D(F)}function D($){if(ze($?.then)){$.then(D,E);return}return $.done?k($.value):(f=Promise.resolve($.value),f.then(B,W))}B(void 0)});return d.cancel=mt(n+" - runid: "+s+" - cancel",function(){try{f&&Oc(f);var k=u.return(void 0),E=Promise.resolve(k.value);E.then(Dn,Dn),Oc(E),l(new Sp)}catch(T){l(T)}}),d};return i.isMobXFlow=!0,i},Ss);Vn.bound=ir(M_);function Oc(e){ze(e.cancel)&&e.cancel()}function zi(e){return e?.isMobXFlow===!0}function L_(e,t){return e?t!==void 0?cr(e)||ci(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]||ll(e)||la(e)||ho(e):!1}function Fn(e){return arguments.length!==1&&de("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),L_(e)}function B_(e){if(ln(e))return e[we].ownKeys_();de(38)}function Ao(e,t,r){return e.set(t,r),r}function Pn(e,t){if(e==null||typeof e!="object"||e instanceof Date||!Fn(e))return e;if(s_(e)||ho(e))return Pn(e.get(),t);if(t.has(e))return t.get(e);if(ci(e)){var r=Ao(t,e,new Array(e.length));return e.forEach(function(a,s){r[s]=Pn(a,t)}),r}if(Gt(e)){var n=Ao(t,e,new Set);return e.forEach(function(a){n.add(Pn(a,t))}),n}if(cr(e)){var i=Ao(t,e,new Map);return e.forEach(function(a,s){i.set(s,Pn(a,t))}),i}else{var o=Ao(t,e,{});return B_(e).forEach(function(a){lo.propertyIsEnumerable.call(e,a)&&(o[a]=Pn(e[a],t))}),o}}function br(e,t){return t&&de("toJS no longer supports options"),Pn(e,new Map)}function Ip(){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=V_(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 V_(e){switch(e.length){case 0:return X.trackingDerivation;case 1:return Xt(e[0]);case 2:return Xt(e[0],e[1])}}function gr(e,t){t===void 0&&(t=void 0),jt();try{return e.apply(t)}finally{Ct()}}function Zr(e){return e[we]}var F_={has:function(e,t){return X.trackingDerivation&&Ti("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)||Ti("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 Ti("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 Ti("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&&Ti("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),Zr(e).ownKeys_()},preventExtensions:function(e){de(13)}};function z_(e,t){var r,n;return Wd(),e=fi(e,t),(n=(r=e[we]).proxy_)!=null?n:r.proxy_=new Proxy(e,F_)}function $t(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function yo(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),ul(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Nt(e,t){var r=An();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{mr(r)}}function Jt(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function go(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),ul(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Qt(e,t){var r=An(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,o=n.length;i<o;i++)n[i](t);mr(r)}}function li(e,t,r){return In(function(){var n,i=fi(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=h1(e)),Qa(t).forEach(function(o){return i.make_(o,t[o])})}),e}var Ac="splice",Wt="update",q_=1e4,K_={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(fa,t)?fa[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)}},hl=function(){function e(r,n,i,o){r===void 0&&(r="ObservableArray@"+Vt()),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 yo(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}),go(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&&Up(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=oa),$t(this)){var s=Nt(this,{object:this.proxy_,type:Ac,index:r,removedCount:n,added:i});if(!s)return oa;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<q_){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&&wt(s),this.atom_.reportChanged(),a&&Qt(this,s),o&&_t()},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:Ac,index:r,removed:i,added:n,removedCount:i.length,addedCount:n.length}:null;o&&wt(s),this.atom_.reportChanged(),a&&Qt(this,s),o&&_t()},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=Nt(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 G_(e,t,r,n){return r===void 0&&(r="ObservableArray@"+Vt()),n===void 0&&(n=!1),Wd(),In(function(){var i=new hl(r,t,n,!1);Qd(i.values_,we,i);var o=new Proxy(i.values_,K_);return i.proxy_=o,e&&e.length&&i.spliceWithArray_(0,0,e),o})}var fa={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}};Re("at",Et);Re("concat",Et);Re("flat",Et);Re("includes",Et);Re("indexOf",Et);Re("join",Et);Re("lastIndexOf",Et);Re("slice",Et);Re("toString",Et);Re("toLocaleString",Et);Re("toSorted",Et);Re("toSpliced",Et);Re("with",Et);Re("every",er);Re("filter",er);Re("find",er);Re("findIndex",er);Re("findLast",er);Re("findLastIndex",er);Re("flatMap",er);Re("forEach",er);Re("map",er);Re("some",er);Re("toReversed",er);Re("reduce",kp);Re("reduceRight",kp);function Re(e,t){typeof Array.prototype[e]=="function"&&(fa[e]=t(e))}function Et(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 kp(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 H_=Hr("ObservableArrayAdministration",hl);function ci(e){return Wa(e)&&H_(e[we])}var W_={},Mr="add",da="delete",$p=function(){function e(r,n,i){var o=this;n===void 0&&(n=ui),i===void 0&&(i="ObservableMap@"+Vt()),this.enhancer_=void 0,this.name_=void 0,this[we]=W_,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,ze(Map)||de(18),In(function(){o.keysAtom_=ep(o.name_+".keys()"),o.data_=new Map,o.hasMap_=new Map,r&&o.merge(r)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var n=this;if(!X.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var o=i=new Br(this.has_(r),Xa,this.name_+"."+Qs(r)+"?",!1);this.hasMap_.set(r,o),Sn(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=Nt(this,{type:i?Wt:Mr,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=Nt(this,{type:da,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:da,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return o&&wt(s),gr(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&&_t(),!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&&wt(s),i.setNewValue_(n),a&&Qt(this,s),o&&_t()}},t.addValue_=function(r,n){var i=this;rr(this.keysAtom_),gr(function(){var u,l=new Br(n,i.enhancer_,i.name_+"."+Qs(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:Mr,object:this,name:r,newValue:n}:null;o&&wt(s),a&&Qt(this,s),o&&_t()},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 Sc({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 Sc({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=Mn(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 cr(r)&&(r=new Map(r)),gr(function(){Yt(r)?u1(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)}):ai(r)?(s1(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;gr(function(){Le(function(){for(var n=Mn(r.keys()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.replace=function(r){var n=this;return gr(function(){for(var i=J_(r),o=new Map,a=!1,s=Mn(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 k=Mn(i.entries()),E;!(E=k()).done;){var T=E.value,B=T[0],W=T[1],D=n.data_.has(B);if(n.set(B,W),n.data_.has(B)){var $=n.data_.get(B);o.set(B,$),D||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var F=n.data_.keys(),K=o.keys(),M=F.next(),Q=K.next();!M.done;){if(M.value!==Q.value){n.keysAtom_.reportChanged();break}M=F.next(),Q=K.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."),go(this,r)},t.intercept_=function(r){return yo(this,r)},si(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),cr=Hr("ObservableMap",$p);function Sc(e){return e[Symbol.toStringTag]="MapIterator",bl(e)}function J_(e){if(ai(e)||cr(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 Q_={},Np=function(){function e(r,n,i){var o=this;n===void 0&&(n=ui),i===void 0&&(i="ObservableSet@"+Vt()),this.name_=void 0,this[we]=Q_,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,ze(Set)||de(22),this.enhancer_=function(a,s){return n(a,s,i)},In(function(){o.atom_=ep(o.name_),r&&o.replace(r)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;gr(function(){Le(function(){for(var n=Mn(r.data_.values()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.forEach=function(r,n){for(var i=Mn(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=Nt(this,{type:Mr,object:this,newValue:r});if(!i)return this;r=i.newValue}if(!this.has(r)){gr(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:Mr,object:this,newValue:r}:null;o&&wt(s),a&&Qt(this,s),o&&_t()}return this},t.delete=function(r){var n=this;if($t(this)){var i=Nt(this,{type:da,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:da,object:this,oldValue:r}:null;return o&&wt(s),gr(function(){n.atom_.reportChanged(),n.data_.delete(r)}),a&&Qt(this,s),o&&_t(),!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 Ic({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 Ic({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(yr(r)&&!Gt(r))return r.intersection(this);var n=new Set(this);return n.intersection(r)},t.union=function(r){if(yr(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(yr(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(yr(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)),gr(function(){Array.isArray(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):yr(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."),go(this,r)},t.intercept_=function(r){return yo(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},si(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),Gt=Hr("ObservableSet",Np);function Ic(e){return e[Symbol.toStringTag]="SetIterator",bl(e)}var kc=Object.create(null),$c="remove",ou=function(){function e(r,n,i,o){n===void 0&&(n=new Map),o===void 0&&(o=L1),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_),Pp(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 Rt)return i.set(n),!0;if($t(this)){var o=Nt(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&&wt(u),i.setNewValue_(n),a&&Qt(this,u),s&&_t()}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_,Xa,this.name_+"."+Qs(r)+"?",!1),this.pendingKeys_.set(r,n)),n.get()},t.make_=function(r,n){if(n===!0&&(n=this.defaultAnnotation_),n!==!1){if(Cc(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!==lo;){var a=ia(o,r);if(a){var s=n.make_(this,r,a,o);if(s===0)return;if(s===1)break}o=Object.getPrototypeOf(o)}jc(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);Cc(this,i,r);var a=i.extend_(this,r,n,o);return a&&jc(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=Nt(this,{object:this.proxy_||this.target_,name:r,type:Mr,newValue:n.value});if(!a)return null;var s=a.newValue;n.value!==s&&(n=vr({},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{Ct()}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=Nt(this,{object:this.proxy_||this.target_,name:r,type:Mr,newValue:n});if(!s)return null;n=s.newValue}var u=Nc(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{Ct()}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=Nt(this,{object:this.proxy_||this.target_,name:r,type:Mr,newValue:void 0});if(!a)return null}n.name||(n.name=this.name_+"."+r.toString()),n.context=this.proxy_||this.target_;var s=Nc(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 Rt(n)),this.notifyPropertyAddition_(r,void 0)}finally{Ct()}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=Nt(this,{object:this.proxy_||this.target_,name:r,type:$c});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=ia(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_),gp(u)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(o=o.get(r))==null||o.set(r in this.target_),a||s){var d={type:$c,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:l,name:r};s&&wt(d),a&&Qt(this,d),s&&_t()}}finally{Ct()}return!0},t.observe_=function(r,n){return n===!0&&de("`observe` doesn't support the fire immediately property for observable objects."),go(this,r)},t.intercept_=function(r){return yo(this,r)},t.notifyPropertyAddition_=function(r,n){var i,o=Jt(this),a=ot();if(o||a){var s=o||a?{type:Mr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:n}:null;a&&wt(s),o&&Qt(this,s),a&&_t()}(i=this.pendingKeys_)==null||(i=i.get(r))==null||i.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Qa(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function fi(e,t){var r;if(t&&ln(e)&&de("Options can't be provided for already observable objects."),Ut(e,we))return gl(e)instanceof ou||de("Cannot convert '"+pa(e)+`' into observable object:
|
|
26
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)+"@"+Vt(),i=new
|
|
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)+"@"+Vt(),i=new ou(e,new Map,String(n),Q1(t));return Ja(e,we,i),e}var Y_=Hr("ObservableObjectAdministration",ou);function Nc(e){return kc[e]||(kc[e]={get:function(){return this[we].getObservablePropValue_(e)},set:function(t){return this[we].setObservablePropValue_(e,t)}})}function ln(e){return Wa(e)?Y_(e[we]):!1}function jc(e,t,r){var n;e.appliedAnnotations_[r]=t,(n=e.target_[gt])==null||delete n[r]}function Cc(e,t,r){if(Pp(t)||de("Cannot annotate '"+e.name_+"."+r.toString()+"': Invalid annotation."),!aa(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
28
|
The field is already annotated with '`+i+"'.")+`
|
|
29
29
|
Re-annotating fields is not allowed.
|
|
30
|
-
Use 'override' annotation for methods overridden by subclass.`)}}var X_=Cp(0),Z_=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),
|
|
30
|
+
Use 'override' annotation for methods overridden by subclass.`)}}var X_=Cp(0),Z_=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Is=0,jp=function(){};function eT(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}eT(jp,Array.prototype);var yl=function(e){function t(n,i,o,a){var s;return o===void 0&&(o="ObservableArray@"+Vt()),a===void 0&&(a=!1),s=e.call(this)||this,In(function(){var u=new hl(o,i,a,!0);u.proxy_=s,Qd(s,we,u),n&&n.length&&s.spliceWithArray(0,0,n),Z_&&Object.defineProperty(s,"0",X_)}),s}Zd(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 ci(a)?a.slice():a}))},r[Symbol.iterator]=function(){var n=this,i=0;return bl({next:function(){return i<n.length?{value:n[i++],done:!1}:{done:!0,value:void 0}}})},si(t,[{key:"length",get:function(){return this[we].getArrayLength_()},set:function(n){this[we].setArrayLength_(n)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(jp);Object.entries(fa).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&Ja(yl.prototype,t,r)});function Cp(e){return{enumerable:!1,configurable:!0,get:function(){return this[we].get_(e)},set:function(t){this[we].set_(e,t)}}}function tT(e){nr(yl.prototype,""+e,Cp(e))}function Up(e){if(e>Is){for(var t=Is;t<e+100;t++)tT(t);Is=e}}Up(1e3);function rT(e,t,r){return new yl(e,t,r)}function Xt(e,t){if(typeof e=="object"&&e!==null){if(ci(e))return t!==void 0&&de(23),e[we].atom_;if(Gt(e))return e.atom_;if(cr(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||de(25,t,pa(e)),r}if(ln(e)){if(!t)return de(26);var n=e[we].values_.get(t);return n||de(27,t,pa(e)),n}if(ll(e)||ho(e)||la(e))return e}else if(ze(e)&&la(e[we]))return e[we];de(28)}function gl(e,t){if(e||de(29),t!==void 0)return gl(Xt(e,t));if(ll(e)||ho(e)||la(e)||cr(e)||Gt(e))return e;if(e[we])return e[we];de(24,e)}function pa(e,t){var r;if(t!==void 0)r=Xt(e,t);else{if(un(e))return e.name;ln(e)||cr(e)||Gt(e)?r=gl(e):r=Xt(e)}return r.name_}function In(e){var t=An(),r=es(!0);jt();try{return e()}finally{Ct(),ts(r),mr(t)}}var Uc=lo.toString;function ml(e,t,r){return r===void 0&&(r=-1),au(e,t,r)}function au(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=Uc.call(e);if(a!==Uc.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=Pc(e),t=Pc(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&&!(ze(u)&&u instanceof u&&ze(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(!au(e[f],t[f],r-1,n,i))return!1}else{var d=Object.keys(e),k=d.length;if(Object.keys(t).length!==k)return!1;for(var E=0;E<k;E++){var T=d[E];if(!(Ut(t,T)&&au(e[T],t[T],r-1,n,i)))return!1}}return n.pop(),i.pop(),!0}function Pc(e){return ci(e)?e.slice():ai(e)||cr(e)||yr(e)||Gt(e)?Array.from(e.entries()):e}var Rc,nT=((Rc=Ha().Iterator)==null?void 0:Rc.prototype)||{};function bl(e){return e[Symbol.iterator]=iT,Object.assign(Object.create(nT),e)}function iT(){return this}function Pp(e){return e instanceof Object&&typeof e.annotationType_=="string"&&ze(e.make_)&&ze(e.extend_)}["Symbol","Map","Set"].forEach(function(e){var t=Ha();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:T_,extras:{getDebugName:pa},$mobx:we});var oT=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}}),aT=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]},k={key:f,value:u[f]};return s(d,k)}}}(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,k=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<k.length;l++){var E=k[l],T=s(u[E]);T&&(f&&(f+=","),f+=JSON.stringify(E)+":"+T)}return a.splice(d,1),"{"+f+"}"}}(r)}}}),sT=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=D();n.configure=D,n.stringify=n,n.default=n,e.stringify=n,e.configure=D,t.exports=n;var i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function o($){return $.length<5e3&&!i.test($)?`"${$}"`:JSON.stringify($)}function a($,F){if($.length>200||F)return $.sort(F);for(let K=1;K<$.length;K++){let M=$[K],Q=K;for(;Q!==0&&$[Q-1]>M;)$[Q]=$[Q-1],Q--;$[Q]=M}return $}var s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function u($){return s.call($)!==void 0&&$.length!==0}function l($,F,K){$.length<K&&(K=$.length);let M=F===","?"":" ",Q=`"0":${M}${$[0]}`;for(let q=1;q<K;q++)Q+=`${F}"${q}":${M}${$[q]}`;return Q}function f($){if(r.call($,"circularValue")){let F=$.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($){let F;if(r.call($,"deterministic")&&(F=$.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 K;if(r.call($,F)&&(K=$[F],typeof K!="boolean"))throw new TypeError(`The "${F}" argument must be of type boolean`);return K===void 0?!0:K}function E($,F){let K;if(r.call($,F)){if(K=$[F],typeof K!="number")throw new TypeError(`The "${F}" argument must be of type number`);if(!Number.isInteger(K))throw new TypeError(`The "${F}" argument must be an integer`);if(K<1)throw new RangeError(`The "${F}" argument must be >= 1`)}return K===void 0?1/0:K}function T($){return $===1?"1 item":`${$} items`}function B($){let F=new Set;for(let K of $)(typeof K=="string"||typeof K=="number")&&F.add(String(K));return F}function W($){if(r.call($,"strict")){let F=$.strict;if(typeof F!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(F)return K=>{let M=`Object can not safely be stringified. Received type ${typeof K}`;throw typeof K!="function"&&(M+=` (${K.toString()})`),new Error(M)}}}function D($){$={...$};let F=W($);F&&($.bigint===void 0&&($.bigint=!1),"circularValue"in $||($.circularValue=Error));let K=f($),M=k($,"bigint"),Q=d($),q=typeof Q=="function"?Q:void 0,te=E($,"maximumDepth"),N=E($,"maximumBreadth");function L(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 K;let A="",R=",",j=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
31
|
${p}`,R=`,
|
|
32
|
-
${p}`);let
|
|
33
|
-
${j}`),J.pop(),`[${A}]`}let U=Object.keys(w),g=U.length;if(g===0)return"{}";if(te<J.length+1)return'"[Object]"';let
|
|
34
|
-
${p}`,
|
|
32
|
+
${p}`);let x=Math.min(w.length,N),v=0;for(;v<x-1;v++){let P=L(String(v),w,J,Z,ye,p);A+=P!==void 0?P:"null",A+=R}let b=L(String(v),w,J,Z,ye,p);if(A+=b!==void 0?b:"null",w.length-1>N){let P=w.length-N-1;A+=`${R}"... ${T(P)} not stringified"`}return ye!==""&&(A+=`
|
|
33
|
+
${j}`),J.pop(),`[${A}]`}let U=Object.keys(w),g=U.length;if(g===0)return"{}";if(te<J.length+1)return'"[Object]"';let O="",_="";ye!==""&&(p+=ye,R=`,
|
|
34
|
+
${p}`,O=" ");let c=Math.min(g,N);Q&&!u(w)&&(U=a(U,q)),J.push(w);for(let x=0;x<c;x++){let v=U[x],b=L(v,w,J,Z,ye,p);b!==void 0&&(A+=`${_}${o(v)}:${O}${b}`,_=R)}if(g>N){let x=g-N;A+=`${_}"...":${O}"${T(x)} not stringified"`,_=R}return ye!==""&&_.length>1&&(A=`
|
|
35
35
|
${p}${A}
|
|
36
36
|
${j}`),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(M)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 K;let w=p,A="",R=",";if(Array.isArray(V)){if(V.length===0)return"[]";if(te<J.length+1)return'"[Array]"';J.push(V),ye!==""&&(p+=ye,A+=`
|
|
37
37
|
${p}`,R=`,
|
|
38
|
-
${p}`);let g=Math.min(V.length,N),
|
|
38
|
+
${p}`);let g=Math.min(V.length,N),O=0;for(;O<g-1;O++){let c=z(String(O),V[O],J,Z,ye,p);A+=c!==void 0?c:"null",A+=R}let _=z(String(O),V[O],J,Z,ye,p);if(A+=_!==void 0?_:"null",V.length-1>N){let c=V.length-N-1;A+=`${R}"... ${T(c)} not stringified"`}return ye!==""&&(A+=`
|
|
39
39
|
${w}`),J.pop(),`[${A}]`}J.push(V);let j="";ye!==""&&(p+=ye,R=`,
|
|
40
|
-
${p}`,j=" ");let U="";for(let g of Z){let
|
|
40
|
+
${p}`,j=" ");let U="";for(let g of Z){let O=z(g,V[g],J,Z,ye,p);O!==void 0&&(A+=`${U}${o(g)}:${j}${O}`,U=R)}return ye!==""&&U.length>1&&(A=`
|
|
41
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(M)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 K;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
|
|
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(M)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 K;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 O=`
|
|
43
43
|
${ye}`,_=`,
|
|
44
|
-
${ye}`,c=Math.min(V.length,N),
|
|
45
|
-
${p}`,J.pop(),`[${
|
|
46
|
-
${ye}`,j="",U="",g=Math.min(A,N);u(V)&&(j+=l(V,R,N),w=w.slice(V.length),g-=V.length,U=R),Q&&(w=a(w,q)),J.push(V);for(let
|
|
44
|
+
${ye}`,c=Math.min(V.length,N),x=0;for(;x<c-1;x++){let b=re(String(x),V[x],J,Z,ye);O+=b!==void 0?b:"null",O+=_}let v=re(String(x),V[x],J,Z,ye);if(O+=v!==void 0?v:"null",V.length-1>N){let b=V.length-N-1;O+=`${_}"... ${T(b)} not stringified"`}return O+=`
|
|
45
|
+
${p}`,J.pop(),`[${O}]`}let w=Object.keys(V),A=w.length;if(A===0)return"{}";if(te<J.length+1)return'"[Object]"';ye+=Z;let R=`,
|
|
46
|
+
${ye}`,j="",U="",g=Math.min(A,N);u(V)&&(j+=l(V,R,N),w=w.slice(V.length),g-=V.length,U=R),Q&&(w=a(w,q)),J.push(V);for(let O=0;O<g;O++){let _=w[O],c=re(_,V[_],J,Z,ye);c!==void 0&&(j+=`${U}${o(_)}: ${c}`,U=R)}if(A>N){let O=A-N;j+=`${U}"...": "${T(O)} not stringified"`,U=R}return U!==""&&(j=`
|
|
47
47
|
${ye}${j}
|
|
48
|
-
${p}`),J.pop(),`{${j}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(M)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 K;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 j=Math.min(V.length,N),U=0;for(;U<j-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>N){let x=V.length-N-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="",R=Math.min(w,N);ye&&u(V)&&(Z+=l(V,",",N),p=p.slice(V.length),R-=V.length,A=","),Q&&(p=a(p,q)),J.push(V);for(let j=0;j<R;j++){let U=p[j],g=se(U,V[U],J);g!==void 0&&(Z+=`${A}${o(U)}:${g}`,A=",")}if(w>N){let j=w-N;Z+=`${A}"...":"${T(j)} 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(M)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 L("",{"":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}}}),di=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(M){return l(M)&&Symbol.asyncIterator in M}e.IsAsyncIterator=t;function r(M){return l(M)&&Symbol.iterator in M}e.IsIterator=r;function n(M){return ArrayBuffer.isView(M)}e.IsTypedArray=n;function i(M){return M instanceof Promise}e.IsPromise=i;function o(M){return M instanceof Uint8Array}e.IsUint8Array=o;function a(M){return M instanceof Date&&Number.isFinite(M.getTime())}e.IsDate=a;function s(M,Q){return Q in M}e.HasPropertyKey=s;function u(M){return l(M)&&$(M.constructor)&&M.constructor.name==="Object"}e.IsPlainObject=u;function l(M){return M!==null&&typeof M=="object"}e.IsObject=l;function f(M){return Array.isArray(M)&&!ArrayBuffer.isView(M)}e.IsArray=f;function d(M){return M===void 0}e.IsUndefined=d;function k(M){return M===null}e.IsNull=k;function E(M){return typeof M=="boolean"}e.IsBoolean=E;function T(M){return typeof M=="number"}e.IsNumber=T;function B(M){return T(M)&&Number.isInteger(M)}e.IsInteger=B;function W(M){return typeof M=="bigint"}e.IsBigInt=W;function D(M){return typeof M=="string"}e.IsString=D;function $(M){return typeof M=="function"}e.IsFunction=$;function F(M){return typeof M=="symbol"}e.IsSymbol=F;function K(M){return W(M)||E(M)||k(M)||T(M)||D(M)||F(M)||d(M)}e.IsValueType=K}}),Rp=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=di(),r=os(),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 k(E,T){if(n.FormatRegistry.Has(E))throw new o(E);return n.FormatRegistry.Set(E,T),E}f.Format=k})(a||(e.TypeSystem=a={}));var s;(function(f){let d=l;function k(){d=l}f.Reset=k;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,D){return f.ExactOptionalPropertyTypes?D in W:W[D]!==void 0}f.IsExactOptionalProperty=d;function k(W){let D=(0,t.IsObject)(W);return f.AllowArrayObject?D:D&&!(0,t.IsArray)(W)}f.IsObjectLike=k;function E(W){return k(W)&&!(W instanceof Date)&&!(W instanceof Uint8Array)}f.IsRecordLike=E;function T(W){let D=(0,t.IsNumber)(W);return f.AllowNaN?D:D&&Number.isFinite(W)}f.IsNumberLike=T;function B(W){let D=(0,t.IsUndefined)(W);return f.AllowNullVoid?D||W===null:D}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}}),is=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}}),vl=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=di(),r=class extends Error{constructor(L){super("Unable to hash value"),this.value=L}};e.ValueHashError=r;var n;(function(L){L[L.Undefined=0]="Undefined",L[L.Null=1]="Null",L[L.Boolean=2]="Boolean",L[L.Number=3]="Number",L[L.String=4]="String",L[L.Object=5]="Object",L[L.Array=6]="Array",L[L.Date=7]="Date",L[L.Uint8Array=8]="Uint8Array",L[L.Symbol=9]="Symbol",L[L.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((L,z)=>BigInt(z)),u=new Float64Array(1),l=new DataView(u.buffer),f=new Uint8Array(u.buffer);function*d(L){let z=L===0?1:Math.ceil(Math.floor(Math.log2(L)+1)/8);for(let re=0;re<z;re++)yield L>>8*(z-1-re)&255}function k(L){te(n.Array);for(let z of L)q(z)}function E(L){te(n.Boolean),te(L?1:0)}function T(L){te(n.BigInt),l.setBigInt64(0,L);for(let z of f)te(z)}function B(L){te(n.Date),q(L.getTime())}function W(L){te(n.Null)}function D(L){te(n.Number),l.setFloat64(0,L);for(let z of f)te(z)}function $(L){te(n.Object);for(let z of globalThis.Object.keys(L).sort())q(z),q(L[z])}function F(L){te(n.String);for(let z=0;z<L.length;z++)for(let re of d(L.charCodeAt(z)))te(re)}function K(L){te(n.Symbol),q(L.description)}function M(L){te(n.Uint8Array);for(let z=0;z<L.length;z++)te(L[z])}function Q(L){return te(n.Undefined)}function q(L){if((0,t.IsArray)(L))return k(L);if((0,t.IsBoolean)(L))return E(L);if((0,t.IsBigInt)(L))return T(L);if((0,t.IsDate)(L))return B(L);if((0,t.IsNull)(L))return W(L);if((0,t.IsNumber)(L))return D(L);if((0,t.IsPlainObject)(L))return $(L);if((0,t.IsString)(L))return F(L);if((0,t.IsSymbol)(L))return K(L);if((0,t.IsUint8Array)(L))return M(L);if((0,t.IsUndefined)(L))return Q(L);throw new r(L)}function te(L){i=i^s[L],i=i*o%a}function N(L){return i=BigInt("14695981039346656037"),q(L),i}e.Hash=N}}),os=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=di(),r=Rp(),n=is(),i=vl(),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*k(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*D(c,O,v,b){yield*x(c.returns,O,v,b.prototype)}function*$(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*K(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*M(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*q(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*N(c,O,v,b){x(c.not,O,v,b).next().done===!0&&(yield d(a.Not,c,v,b))}function*L(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*R(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*j(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*k(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*D(H,P,v,b);case"Date":return yield*$(H,P,v,b);case"Function":return yield*F(H,P,v,b);case"Integer":return yield*K(H,P,v,b);case"Intersect":return yield*M(H,P,v,b);case"Iterator":return yield*Q(H,P,v,b);case"Literal":return yield*q(H,P,v,b);case"Never":return yield*te(H,P,v,b);case"Not":return yield*N(H,P,v,b);case"Null":return yield*L(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*R(H,P,v,b);case"Unknown":return yield*j(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=_}}),uT=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(os(),e)}}),Dp=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=os();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(Rp(),e)}}),lT=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=di(),r=Dp(),n=is(),i=vl(),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=>j(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)=>j(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 k(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 j(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 D(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 $(g,x,_){let c=g.allOf.every(O=>j(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)||j(g.unevaluatedProperties,x,_[b]));return c&&v}else return c}function F(g,x,_){return(0,t.IsIterator)(_)}function K(g,x,_){return _===g.const}function M(g,x,_){return!1}function Q(g,x,_){return!j(g.not,x,_)}function q(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 N(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(!j(v,x,_[O])||(o.ExtendsUndefined.Check(v)||s(v))&&!(O in _))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(_,O)&&!j(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)||j(g.additionalProperties,x,_[O])):!0}function L(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)?j(O,x,oe):!0),P=typeof g.additionalProperties=="object"?Object.entries(_).every(([ie,oe])=>v.test(ie)?!0:j(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 j((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 j((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(!j(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=>j(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 R(g,x,_){return o.TypeRegistry.Has(g[o.Kind])?o.TypeRegistry.Get(g[o.Kind])(g,_):!1}function j(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 k(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 D(O,c,_);case"Intersect":return $(O,c,_);case"Iterator":return F(O,c,_);case"Literal":return K(O,c,_);case"Never":return M(O,c,_);case"Not":return Q(O,c,_);case"Null":return q(O,c,_);case"Number":return te(O,c,_);case"Object":return N(O,c,_);case"Promise":return L(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 R(O,c,_)}}function U(...g){return g.length===3?j(g[0],g[1],g[2]):j(g[0],[],g[1])}e.Check=U}}),cT=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=di(),r=is(),n=lT(),i=Gr(),o=class extends i.TypeBoxError{constructor(k,E,T){super("Unable to decode due to invalid value"),this.schema=k,this.value=E,this.error=T}};e.TransformDecodeCheckError=o;var a=class extends i.TypeBoxError{constructor(k,E,T){super("Unable to encode due to invalid value"),this.schema=k,this.value=E,this.error=T}};e.TransformEncodeCheckError=a;var s=class extends i.TypeBoxError{constructor(k,E,T){super(`${T instanceof Error?T.message:"Unknown error"}`),this.schema=k,this.value=E}};e.TransformDecodeError=s;var u=class extends i.TypeBoxError{constructor(k,E,T){super(`${T instanceof Error?T.message:"Unknown error"}`),this.schema=k,this.value=E}};e.TransformEncodeError=u;var l;(function(k){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 D(ee,ce){return i.TypeGuard.TTransform(ee)||i.TypeGuard.TTransform(ee.unevaluatedProperties)||ee.allOf.some(V=>z(V,ce))}function $(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 K(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 M(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 q(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 N(ee,ce){return i.TypeGuard.TTransform(ee)||!(0,t.IsUndefined)(ee.items)&&ee.items.some(V=>z(V,ce))}function L(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 D(J,V);case"Iterator":return $(J,V);case"Not":return F(J,V);case"Object":return K(J,V);case"Promise":return M(J,V);case"Record":return Q(J,V);case"Ref":return q(J,V);case"This":return te(J,V);case"Tuple":return N(J,V);case"Union":return L(J,V);default:return i.TypeGuard.TTransform(ee)}}let re=new Set;function se(ee,ce){return re.clear(),z(ee,ce)}k.Has=se})(l||(e.HasTransform=l={}));var f;(function(k){function E(N,L){try{return i.TypeGuard.TTransform(N)?N[i.Transform].Decode(L):L}catch(z){throw new s(N,L,z)}}function T(N,L,z){return(0,t.IsArray)(z)?E(N,z.map(re=>q(N.items,L,re))):E(N,z)}function B(N,L,z){if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return E(N,z);let re=i.KeyResolver.ResolveKeys(N,{includePatterns:!1}),se=re.reduce((J,Z)=>Z in J?{...J,[Z]:q(i.IndexedAccessor.Resolve(N,[Z]),L,J[Z])}:J,z);if(!i.TypeGuard.TTransform(N.unevaluatedProperties))return E(N,se);let ee=Object.getOwnPropertyNames(se),ce=N.unevaluatedProperties,V=ee.reduce((J,Z)=>re.includes(Z)?J:{...J,[Z]:E(ce,J[Z])},se);return E(N,V)}function W(N,L,z){return E(N,q(N.not,L,z))}function D(N,L,z){if(!(0,t.IsPlainObject)(z))return E(N,z);let re=i.KeyResolver.ResolveKeys(N,{includePatterns:!1}),se=re.reduce((J,Z)=>Z in J?{...J,[Z]:q(N.properties[Z],L,J[Z])}:J,z);if(!i.TypeGuard.TSchema(N.additionalProperties))return E(N,se);let ee=Object.getOwnPropertyNames(se),ce=N.additionalProperties,V=ee.reduce((J,Z)=>re.includes(Z)?J:{...J,[Z]:E(ce,J[Z])},se);return E(N,V)}function $(N,L,z){if(!(0,t.IsPlainObject)(z))return E(N,z);let re=Object.getOwnPropertyNames(N.patternProperties)[0],se=new RegExp(re),ee=Object.getOwnPropertyNames(z).reduce((Z,ye)=>se.test(ye)?{...Z,[ye]:q(N.patternProperties[re],L,Z[ye])}:Z,z);if(!i.TypeGuard.TSchema(N.additionalProperties))return E(N,ee);let ce=Object.getOwnPropertyNames(ee),V=N.additionalProperties,J=ce.reduce((Z,ye)=>se.test(ye)?Z:{...Z,[ye]:E(V,Z[ye])},ee);return E(N,J)}function F(N,L,z){let re=(0,r.Deref)(N,L);return E(N,q(re,L,z))}function K(N,L,z){let re=(0,r.Deref)(N,L);return E(N,q(re,L,z))}function M(N,L,z){return(0,t.IsArray)(z)&&(0,t.IsArray)(N.items)?E(N,N.items.map((re,se)=>q(re,L,z[se]))):E(N,z)}function Q(N,L,z){let re=E(N,z);for(let se of N.anyOf)if((0,n.Check)(se,L,re))return q(se,L,re);return re}function q(N,L,z){let re=typeof N.$id=="string"?[...L,N]:L,se=N;switch(N[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 D(se,re,z);case"Record":return $(se,re,z);case"Ref":return F(se,re,z);case"Symbol":return E(se,z);case"This":return K(se,re,z);case"Tuple":return M(se,re,z);case"Union":return Q(se,re,z);default:return E(se,z)}}function te(N,L,z){return q(N,L,z)}k.Decode=te})(f||(e.DecodeTransform=f={}));var d;(function(k){function E(N,L){try{return i.TypeGuard.TTransform(N)?N[i.Transform].Encode(L):L}catch(z){throw new u(N,L,z)}}function T(N,L,z){let re=E(N,z);return(0,t.IsArray)(re)?re.map(se=>q(N.items,L,se)):re}function B(N,L,z){let re=E(N,z);if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return re;let se=i.KeyResolver.ResolveKeys(N,{includePatterns:!1}),ee=se.reduce((J,Z)=>Z in re?{...J,[Z]:q(i.IndexedAccessor.Resolve(N,[Z]),L,J[Z])}:J,re);if(!i.TypeGuard.TTransform(N.unevaluatedProperties))return E(N,ee);let ce=Object.getOwnPropertyNames(ee),V=N.unevaluatedProperties;return ce.reduce((J,Z)=>se.includes(Z)?J:{...J,[Z]:E(V,J[Z])},ee)}function W(N,L,z){return E(N.not,E(N,z))}function D(N,L,z){let re=E(N,z);if(!(0,t.IsPlainObject)(z))return re;let se=i.KeyResolver.ResolveKeys(N,{includePatterns:!1}),ee=se.reduce((J,Z)=>Z in J?{...J,[Z]:q(N.properties[Z],L,J[Z])}:J,re);if(!i.TypeGuard.TSchema(N.additionalProperties))return ee;let ce=Object.getOwnPropertyNames(ee),V=N.additionalProperties;return ce.reduce((J,Z)=>se.includes(Z)?J:{...J,[Z]:E(V,J[Z])},ee)}function $(N,L,z){let re=E(N,z);if(!(0,t.IsPlainObject)(z))return re;let se=Object.getOwnPropertyNames(N.patternProperties)[0],ee=new RegExp(se),ce=Object.getOwnPropertyNames(z).reduce((Z,ye)=>ee.test(ye)?{...Z,[ye]:q(N.patternProperties[se],L,Z[ye])}:Z,re);if(!i.TypeGuard.TSchema(N.additionalProperties))return E(N,ce);let V=Object.getOwnPropertyNames(ce),J=N.additionalProperties;return V.reduce((Z,ye)=>ee.test(ye)?Z:{...Z,[ye]:E(J,Z[ye])},ce)}function F(N,L,z){let re=(0,r.Deref)(N,L),se=q(re,L,z);return E(N,se)}function K(N,L,z){let re=(0,r.Deref)(N,L),se=q(re,L,z);return E(N,se)}function M(N,L,z){let re=E(N,z);return(0,t.IsArray)(N.items)?N.items.map((se,ee)=>q(se,L,re[ee])):[]}function Q(N,L,z){for(let re of N.anyOf){if(!(0,n.Check)(re,L,z))continue;let se=q(re,L,z);return E(N,se)}for(let re of N.anyOf){let se=q(re,L,z);if((0,n.Check)(N,L,se))return E(N,se)}return E(N,z)}function q(N,L,z){let re=typeof N.$id=="string"?[...L,N]:L,se=N;switch(N[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 D(se,re,z);case"Record":return $(se,re,z);case"Ref":return F(se,re,z);case"This":return K(se,re,z);case"Tuple":return M(se,re,z);case"Union":return Q(se,re,z);default:return E(se,z)}}function te(N,L,z){return q(N,L,z)}k.Encode=te})(d||(e.EncodeTransform=d={}))}}),fT=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=cT(),r=di(),n=os(),i=Dp(),o=is(),a=vl(),s=Gr(),u=class{constructor(D,$,F,K){this.schema=D,this.references=$,this.checkFunc=F,this.code=K,this.hasTransform=t.HasTransform.Has(D,$)}Code(){return this.code}Errors(D){return(0,n.Errors)(this.schema,this.references,D)}Check(D){return this.checkFunc(D)}Decode(D){if(!this.checkFunc(D))throw new t.TransformDecodeCheckError(this.schema,D,this.Errors(D).First());return this.hasTransform?t.DecodeTransform.Decode(this.schema,this.references,D):D}Encode(D){let $=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,D):D;if(!this.checkFunc($))throw new t.TransformEncodeCheckError(this.schema,D,this.Errors(D).First());return $}};e.TypeCheck=u;var l;(function(D){function $(Q){return Q===36}D.DollarSign=$;function F(Q){return Q===95}D.IsUnderscore=F;function K(Q){return Q>=65&&Q<=90||Q>=97&&Q<=122}D.IsAlpha=K;function M(Q){return Q>=48&&Q<=57}D.IsNumeric=M})(l||(l={}));var f;(function(D){function $(Q){return Q.length===0?!1:l.IsNumeric(Q.charCodeAt(0))}function F(Q){if($(Q))return!1;for(let q=0;q<Q.length;q++){let te=Q.charCodeAt(q);if(!(l.IsAlpha(te)||l.IsNumeric(te)||l.DollarSign(te)||l.IsUnderscore(te)))return!1}return!0}function K(Q){return Q.replace(/'/g,"\\'")}function M(Q,q){return F(q)?`${Q}.${q}`:`${Q}['${K(q)}']`}D.Encode=M})(f||(f={}));var d;(function(D){function $(F){let K=[];for(let M=0;M<F.length;M++){let Q=F.charCodeAt(M);l.IsNumeric(Q)||l.IsAlpha(Q)?K.push(F.charAt(M)):K.push(`_${Q}_`)}return K.join("").replace(/__/g,"_")}D.Encode=$})(d||(d={}));var k;(function(D){function $(F){return F.replace(/'/g,"\\'")}D.Escape=$})(k||(k={}));var E=class extends s.TypeBoxError{constructor(D){super("Unknown type"),this.schema=D}};e.TypeCompilerUnknownTypeError=E;var T=class extends s.TypeBoxError{constructor(D){super("Preflight validation check failed to guard for the given schema"),this.schema=D}};e.TypeCompilerTypeGuardError=T;var B;(function(D){function $(q,te,N){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${te}' in ${q} ? ${N} : true)`:`(${f.Encode(q,te)} !== undefined ? ${N} : true)`}D.IsExactOptionalProperty=$;function F(q){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${q} === 'object' && ${q} !== null)`:`(typeof ${q} === 'object' && ${q} !== null && !Array.isArray(${q}))`}D.IsObjectLike=F;function K(q){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${q} === 'object' && ${q} !== null && !(${q} instanceof Date) && !(${q} instanceof Uint8Array))`:`(typeof ${q} === 'object' && ${q} !== null && !Array.isArray(${q}) && !(${q} instanceof Date) && !(${q} instanceof Uint8Array))`}D.IsRecordLike=K;function M(q){return i.TypeSystemPolicy.AllowNaN?`typeof ${q} === 'number'`:`(typeof ${q} === 'number' && Number.isFinite(${q}))`}D.IsNumberLike=M;function Q(q){return i.TypeSystemPolicy.AllowNullVoid?`(${q} === undefined || ${q} === null)`:`${q} === undefined`}D.IsVoidLike=Q})(B||(e.Policy=B={}));var W;(function(D){function $(S){return S[s.Kind]==="Any"||S[s.Kind]==="Unknown"}function*F(S,pe,C){yield"true"}function*K(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(),qe=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}) => ${qe} ? acc + 1 : acc, 0)`,Ir=["(count > 0)",...ft,...at].join(" && ");yield`((${_e}) => { ${pt}; return ${Ir}})(${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*M(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*q(S,pe,C){yield`(typeof ${C} === 'boolean')`}function*te(S,pe,C){yield*H(S.returns,pe,`${C}.prototype`)}function*N(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*L(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} === '${k.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)||$(Ce))&&(yield`('${ae}' in ${C})`);else{let qe=oe(Ce,pe,he);yield B.IsExactOptionalProperty(C,ae,qe)}}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"),qe=s.TypeGuard.TSchema(S.additionalProperties)?oe(S.additionalProperties,pe,C):S.additionalProperties===!1?"false":"true",ft=`(${he}.test(key) ? ${Ce} : ${qe})`;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*R(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*j(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 qe=De(Ce,S,pe,"value",!1);return ie.functions.set(Ce,qe),yield`${Ce}(${C})`}}switch(he[s.Kind]){case"Any":return yield*F(he,ae,C);case"Array":return yield*K(he,ae,C);case"AsyncIterator":return yield*M(he,ae,C);case"BigInt":return yield*Q(he,ae,C);case"Boolean":return yield*q(he,ae,C);case"Constructor":return yield*te(he,ae,C);case"Date":return yield*N(he,ae,C);case"Function":return yield*L(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*R(he,ae,C);case"Symbol":return yield*j(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 De(S,pe,C,_e,ae=!0){let[he,Ce]=[`
|
|
49
|
-
`,pt=>"".padStart(pt," ")],qe
|
|
50
|
-
}`}function
|
|
48
|
+
${p}`),J.pop(),`{${j}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(M)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 K;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 j=Math.min(V.length,N),U=0;for(;U<j-1;U++){let O=se(String(U),V[U],J);Z+=O!==void 0?O:"null",Z+=","}let g=se(String(U),V[U],J);if(Z+=g!==void 0?g:"null",V.length-1>N){let O=V.length-N-1;Z+=`,"... ${T(O)} 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="",R=Math.min(w,N);ye&&u(V)&&(Z+=l(V,",",N),p=p.slice(V.length),R-=V.length,A=","),Q&&(p=a(p,q)),J.push(V);for(let j=0;j<R;j++){let U=p[j],g=se(U,V[U],J);g!==void 0&&(Z+=`${A}${o(U)}:${g}`,A=",")}if(w>N){let j=w-N;Z+=`${A}"...":"${T(j)} 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(M)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 L("",{"":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}}}),di=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(M){return l(M)&&Symbol.asyncIterator in M}e.IsAsyncIterator=t;function r(M){return l(M)&&Symbol.iterator in M}e.IsIterator=r;function n(M){return ArrayBuffer.isView(M)}e.IsTypedArray=n;function i(M){return M instanceof Promise}e.IsPromise=i;function o(M){return M instanceof Uint8Array}e.IsUint8Array=o;function a(M){return M instanceof Date&&Number.isFinite(M.getTime())}e.IsDate=a;function s(M,Q){return Q in M}e.HasPropertyKey=s;function u(M){return l(M)&&$(M.constructor)&&M.constructor.name==="Object"}e.IsPlainObject=u;function l(M){return M!==null&&typeof M=="object"}e.IsObject=l;function f(M){return Array.isArray(M)&&!ArrayBuffer.isView(M)}e.IsArray=f;function d(M){return M===void 0}e.IsUndefined=d;function k(M){return M===null}e.IsNull=k;function E(M){return typeof M=="boolean"}e.IsBoolean=E;function T(M){return typeof M=="number"}e.IsNumber=T;function B(M){return T(M)&&Number.isInteger(M)}e.IsInteger=B;function W(M){return typeof M=="bigint"}e.IsBigInt=W;function D(M){return typeof M=="string"}e.IsString=D;function $(M){return typeof M=="function"}e.IsFunction=$;function F(M){return typeof M=="symbol"}e.IsSymbol=F;function K(M){return W(M)||E(M)||k(M)||T(M)||D(M)||F(M)||d(M)}e.IsValueType=K}}),Rp=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=di(),r=is(),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 k(E,T){if(n.FormatRegistry.Has(E))throw new o(E);return n.FormatRegistry.Set(E,T),E}f.Format=k})(a||(e.TypeSystem=a={}));var s;(function(f){let d=l;function k(){d=l}f.Reset=k;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,D){return f.ExactOptionalPropertyTypes?D in W:W[D]!==void 0}f.IsExactOptionalProperty=d;function k(W){let D=(0,t.IsObject)(W);return f.AllowArrayObject?D:D&&!(0,t.IsArray)(W)}f.IsObjectLike=k;function E(W){return k(W)&&!(W instanceof Date)&&!(W instanceof Uint8Array)}f.IsRecordLike=E;function T(W){let D=(0,t.IsNumber)(W);return f.AllowNaN?D:D&&Number.isFinite(W)}f.IsNumberLike=T;function B(W){let D=(0,t.IsUndefined)(W);return f.AllowNullVoid?D||W===null:D}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}}),ns=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}}),vl=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=di(),r=class extends Error{constructor(L){super("Unable to hash value"),this.value=L}};e.ValueHashError=r;var n;(function(L){L[L.Undefined=0]="Undefined",L[L.Null=1]="Null",L[L.Boolean=2]="Boolean",L[L.Number=3]="Number",L[L.String=4]="String",L[L.Object=5]="Object",L[L.Array=6]="Array",L[L.Date=7]="Date",L[L.Uint8Array=8]="Uint8Array",L[L.Symbol=9]="Symbol",L[L.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((L,z)=>BigInt(z)),u=new Float64Array(1),l=new DataView(u.buffer),f=new Uint8Array(u.buffer);function*d(L){let z=L===0?1:Math.ceil(Math.floor(Math.log2(L)+1)/8);for(let re=0;re<z;re++)yield L>>8*(z-1-re)&255}function k(L){te(n.Array);for(let z of L)q(z)}function E(L){te(n.Boolean),te(L?1:0)}function T(L){te(n.BigInt),l.setBigInt64(0,L);for(let z of f)te(z)}function B(L){te(n.Date),q(L.getTime())}function W(L){te(n.Null)}function D(L){te(n.Number),l.setFloat64(0,L);for(let z of f)te(z)}function $(L){te(n.Object);for(let z of globalThis.Object.keys(L).sort())q(z),q(L[z])}function F(L){te(n.String);for(let z=0;z<L.length;z++)for(let re of d(L.charCodeAt(z)))te(re)}function K(L){te(n.Symbol),q(L.description)}function M(L){te(n.Uint8Array);for(let z=0;z<L.length;z++)te(L[z])}function Q(L){return te(n.Undefined)}function q(L){if((0,t.IsArray)(L))return k(L);if((0,t.IsBoolean)(L))return E(L);if((0,t.IsBigInt)(L))return T(L);if((0,t.IsDate)(L))return B(L);if((0,t.IsNull)(L))return W(L);if((0,t.IsNumber)(L))return D(L);if((0,t.IsPlainObject)(L))return $(L);if((0,t.IsString)(L))return F(L);if((0,t.IsSymbol)(L))return K(L);if((0,t.IsUint8Array)(L))return M(L);if((0,t.IsUndefined)(L))return Q(L);throw new r(L)}function te(L){i=i^s[L],i=i*o%a}function N(L){return i=BigInt("14695981039346656037"),q(L),i}e.Hash=N}}),is=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=di(),r=Rp(),n=ns(),i=vl(),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,x,v,b){return{type:c,schema:x,path:v,value:b,message:r.TypeSystemErrorFunction.Get()(x,c)}}function*k(c,x,v,b){}function*E(c,x,v,b){if(!(0,t.IsArray)(b))return yield d(a.Array,c,v,b);l(c.minItems)&&!(b.length>=c.minItems)&&(yield d(a.ArrayMinItems,c,v,b)),l(c.maxItems)&&!(b.length<=c.maxItems)&&(yield d(a.ArrayMaxItems,c,v,b));for(let ie=0;ie<b.length;ie++)yield*O(c.items,x,`${v}/${ie}`,b[ie]);if(c.uniqueItems===!0&&!function(){let ie=new Set;for(let oe of b){let 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)=>O(P,x,`${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,x,v,b){(0,t.IsAsyncIterator)(b)||(yield d(a.AsyncIterator,c,v,b))}function*B(c,x,v,b){if(!(0,t.IsBigInt)(b))return yield d(a.BigInt,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.BigIntExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.BigIntExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.BigIntMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.BigIntMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==BigInt(0)&&(yield d(a.BigIntMultipleOf,c,v,b))}function*W(c,x,v,b){(0,t.IsBoolean)(b)||(yield d(a.Boolean,c,v,b))}function*D(c,x,v,b){yield*O(c.returns,x,v,b.prototype)}function*$(c,x,v,b){if(!(0,t.IsDate)(b))return yield d(a.Date,c,v,b);l(c.exclusiveMaximumTimestamp)&&!(b.getTime()<c.exclusiveMaximumTimestamp)&&(yield d(a.DateExclusiveMaximumTimestamp,c,v,b)),l(c.exclusiveMinimumTimestamp)&&!(b.getTime()>c.exclusiveMinimumTimestamp)&&(yield d(a.DateExclusiveMinimumTimestamp,c,v,b)),l(c.maximumTimestamp)&&!(b.getTime()<=c.maximumTimestamp)&&(yield d(a.DateMaximumTimestamp,c,v,b)),l(c.minimumTimestamp)&&!(b.getTime()>=c.minimumTimestamp)&&(yield d(a.DateMinimumTimestamp,c,v,b)),l(c.multipleOfTimestamp)&&b.getTime()%c.multipleOfTimestamp!==0&&(yield d(a.DateMultipleOfTimestamp,c,v,b))}function*F(c,x,v,b){(0,t.IsFunction)(b)||(yield d(a.Function,c,v,b))}function*K(c,x,v,b){if(!(0,t.IsInteger)(b))return yield d(a.Integer,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.IntegerExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.IntegerExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.IntegerMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.IntegerMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==0&&(yield d(a.IntegerMultipleOf,c,v,b))}function*M(c,x,v,b){for(let P of c.allOf){let H=O(P,x,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=O(c.unevaluatedProperties,x,`${v}/${H}`,b[H]).next();ie.done||(yield ie.value)}}}function*Q(c,x,v,b){(0,t.IsIterator)(b)||(yield d(a.Iterator,c,v,b))}function*q(c,x,v,b){b!==c.const&&(yield d(a.Literal,c,v,b))}function*te(c,x,v,b){yield d(a.Never,c,v,b)}function*N(c,x,v,b){O(c.not,x,v,b).next().done===!0&&(yield d(a.Not,c,v,b))}function*L(c,x,v,b){(0,t.IsNull)(b)||(yield d(a.Null,c,v,b))}function*z(c,x,v,b){if(!r.TypeSystemPolicy.IsNumberLike(b))return yield d(a.Number,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.NumberExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.NumberExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.NumberMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.NumberMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==0&&(yield d(a.NumberMultipleOf,c,v,b))}function*re(c,x,v,b){if(!r.TypeSystemPolicy.IsObjectLike(b))return yield d(a.Object,c,v,b);l(c.minProperties)&&!(Object.getOwnPropertyNames(b).length>=c.minProperties)&&(yield d(a.ObjectMinProperties,c,v,b)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=c.maxProperties)&&(yield d(a.ObjectMaxProperties,c,v,b));let 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*O(c.additionalProperties,x,`${v}/${u(oe)}`,b[oe]));for(let oe of H){let ve=c.properties[oe];c.required&&c.required.includes(oe)?(yield*O(ve,x,`${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*O(ve,x,`${v}/${u(oe)}`,b[oe]))}}function*se(c,x,v,b){(0,t.IsPromise)(b)||(yield d(a.Promise,c,v,b))}function*ee(c,x,v,b){if(!r.TypeSystemPolicy.IsRecordLike(b))return yield d(a.Object,c,v,b);l(c.minProperties)&&!(Object.getOwnPropertyNames(b).length>=c.minProperties)&&(yield d(a.ObjectMinProperties,c,v,b)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=c.maxProperties)&&(yield d(a.ObjectMaxProperties,c,v,b));let[P,H]=Object.entries(c.patternProperties)[0],ie=new RegExp(P);for(let[oe,ve]of Object.entries(b))ie.test(oe)&&(yield*O(H,x,`${v}/${u(oe)}`,ve));if(typeof c.additionalProperties=="object")for(let[oe,ve]of Object.entries(b))ie.test(oe)||(yield*O(c.additionalProperties,x,`${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,x,v,b){yield*O((0,n.Deref)(c,x),x,v,b)}function*V(c,x,v,b){if(!(0,t.IsString)(b))return yield d(a.String,c,v,b);l(c.minLength)&&!(b.length>=c.minLength)&&(yield d(a.StringMinLength,c,v,b)),l(c.maxLength)&&!(b.length<=c.maxLength)&&(yield d(a.StringMaxLength,c,v,b)),(0,t.IsString)(c.pattern)&&(new RegExp(c.pattern).test(b)||(yield d(a.StringPattern,c,v,b))),(0,t.IsString)(c.format)&&(o.FormatRegistry.Has(c.format)?o.FormatRegistry.Get(c.format)(b)||(yield d(a.StringFormat,c,v,b)):yield d(a.StringFormatUnknown,c,v,b))}function*J(c,x,v,b){(0,t.IsSymbol)(b)||(yield d(a.Symbol,c,v,b))}function*Z(c,x,v,b){if(!(0,t.IsString)(b))return yield d(a.String,c,v,b);new RegExp(c.pattern).test(b)||(yield d(a.StringPattern,c,v,b))}function*ye(c,x,v,b){yield*O((0,n.Deref)(c,x),x,v,b)}function*p(c,x,v,b){if(!(0,t.IsArray)(b))return yield d(a.Tuple,c,v,b);if(c.items===void 0&&b.length!==0)return yield d(a.TupleLength,c,v,b);if(b.length!==c.maxItems)return yield d(a.TupleLength,c,v,b);if(c.items)for(let P=0;P<c.items.length;P++)yield*O(c.items[P],x,`${v}/${P}`,b[P])}function*w(c,x,v,b){(0,t.IsUndefined)(b)||(yield d(a.Undefined,c,v,b))}function*A(c,x,v,b){let P=0;for(let H of c.anyOf){let ie=[...O(H,x,v,b)];if(ie.length===0)return;P+=ie.length}P>0&&(yield d(a.Union,c,v,b))}function*R(c,x,v,b){if(!(0,t.IsUint8Array)(b))return yield d(a.Uint8Array,c,v,b);l(c.maxByteLength)&&!(b.length<=c.maxByteLength)&&(yield d(a.Uint8ArrayMaxByteLength,c,v,b)),l(c.minByteLength)&&!(b.length>=c.minByteLength)&&(yield d(a.Uint8ArrayMinByteLength,c,v,b))}function*j(c,x,v,b){}function*U(c,x,v,b){r.TypeSystemPolicy.IsVoidLike(b)||(yield d(a.Void,c,v,b))}function*g(c,x,v,b){o.TypeRegistry.Get(c[o.Kind])(c,b)||(yield d(a.Kind,c,v,b))}function*O(c,x,v,b){let P=l(c.$id)?[...x,c]:x,H=c;switch(H[o.Kind]){case"Any":return yield*k(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*D(H,P,v,b);case"Date":return yield*$(H,P,v,b);case"Function":return yield*F(H,P,v,b);case"Integer":return yield*K(H,P,v,b);case"Intersect":return yield*M(H,P,v,b);case"Iterator":return yield*Q(H,P,v,b);case"Literal":return yield*q(H,P,v,b);case"Never":return yield*te(H,P,v,b);case"Not":return yield*N(H,P,v,b);case"Null":return yield*L(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*R(H,P,v,b);case"Unknown":return yield*j(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 x=c.length===3?O(c[0],c[1],"",c[2]):O(c[0],[],"",c[1]);return new f(x)}e.Errors=_}}),uT=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(is(),e)}}),Dp=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=is();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(Rp(),e)}}),lT=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=di(),r=Dp(),n=ns(),i=vl(),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,O,_){return!0}function f(g,O,_){if(!(0,t.IsArray)(_)||u(g.minItems)&&!(_.length>=g.minItems)||u(g.maxItems)&&!(_.length<=g.maxItems)||!_.every(v=>j(g.items,O,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(),x=_.reduce((v,b)=>j(c,O,b)?v+1:v,0);return!(x===0||(0,t.IsNumber)(g.minContains)&&x<g.minContains||(0,t.IsNumber)(g.maxContains)&&x>g.maxContains)}function d(g,O,_){return(0,t.IsAsyncIterator)(_)}function k(g,O,_){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,O,_){return(0,t.IsBoolean)(_)}function T(g,O,_){return j(g.returns,O,_.prototype)}function B(g,O,_){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,O,_){return(0,t.IsFunction)(_)}function D(g,O,_){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 $(g,O,_){let c=g.allOf.every(x=>j(x,O,_));if(g.unevaluatedProperties===!1){let x=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(_).every(b=>x.test(b));return c&&v}else if(o.TypeGuard.TSchema(g.unevaluatedProperties)){let x=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(_).every(b=>x.test(b)||j(g.unevaluatedProperties,O,_[b]));return c&&v}else return c}function F(g,O,_){return(0,t.IsIterator)(_)}function K(g,O,_){return _===g.const}function M(g,O,_){return!1}function Q(g,O,_){return!j(g.not,O,_)}function q(g,O,_){return(0,t.IsNull)(_)}function te(g,O,_){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 N(g,O,_){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 x of c){let v=g.properties[x];if(g.required&&g.required.includes(x)){if(!j(v,O,_[x])||(o.ExtendsUndefined.Check(v)||s(v))&&!(x in _))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(_,x)&&!j(v,O,_[x]))return!1}if(g.additionalProperties===!1){let x=Object.getOwnPropertyNames(_);return g.required&&g.required.length===c.length&&x.length===c.length?!0:x.every(v=>c.includes(v))}else return typeof g.additionalProperties=="object"?Object.getOwnPropertyNames(_).every(x=>c.includes(x)||j(g.additionalProperties,O,_[x])):!0}function L(g,O,_){return(0,t.IsPromise)(_)}function z(g,O,_){if(!r.TypeSystemPolicy.IsRecordLike(_)||u(g.minProperties)&&!(Object.getOwnPropertyNames(_).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(_).length<=g.maxProperties))return!1;let[c,x]=Object.entries(g.patternProperties)[0],v=new RegExp(c),b=Object.entries(_).every(([ie,oe])=>v.test(ie)?j(x,O,oe):!0),P=typeof g.additionalProperties=="object"?Object.entries(_).every(([ie,oe])=>v.test(ie)?!0:j(g.additionalProperties,O,oe)):!0,H=g.additionalProperties===!1?Object.getOwnPropertyNames(_).every(ie=>v.test(ie)):!0;return b&&P&&H}function re(g,O,_){return j((0,n.Deref)(g,O),O,_)}function se(g,O,_){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,O,_){return(0,t.IsSymbol)(_)}function ce(g,O,_){return(0,t.IsString)(_)&&new RegExp(g.pattern).test(_)}function V(g,O,_){return j((0,n.Deref)(g,O),O,_)}function J(g,O,_){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(!j(g.items[c],O,_[c]))return!1;return!0}function Z(g,O,_){return(0,t.IsUndefined)(_)}function ye(g,O,_){return g.anyOf.some(c=>j(c,O,_))}function p(g,O,_){return!(!(0,t.IsUint8Array)(_)||u(g.maxByteLength)&&!(_.length<=g.maxByteLength)||u(g.minByteLength)&&!(_.length>=g.minByteLength))}function w(g,O,_){return!0}function A(g,O,_){return r.TypeSystemPolicy.IsVoidLike(_)}function R(g,O,_){return o.TypeRegistry.Has(g[o.Kind])?o.TypeRegistry.Get(g[o.Kind])(g,_):!1}function j(g,O,_){let c=u(g.$id)?[...O,g]:O,x=g;switch(x[o.Kind]){case"Any":return l(x,c,_);case"Array":return f(x,c,_);case"AsyncIterator":return d(x,c,_);case"BigInt":return k(x,c,_);case"Boolean":return E(x,c,_);case"Constructor":return T(x,c,_);case"Date":return B(x,c,_);case"Function":return W(x,c,_);case"Integer":return D(x,c,_);case"Intersect":return $(x,c,_);case"Iterator":return F(x,c,_);case"Literal":return K(x,c,_);case"Never":return M(x,c,_);case"Not":return Q(x,c,_);case"Null":return q(x,c,_);case"Number":return te(x,c,_);case"Object":return N(x,c,_);case"Promise":return L(x,c,_);case"Record":return z(x,c,_);case"Ref":return re(x,c,_);case"String":return se(x,c,_);case"Symbol":return ee(x,c,_);case"TemplateLiteral":return ce(x,c,_);case"This":return V(x,c,_);case"Tuple":return J(x,c,_);case"Undefined":return Z(x,c,_);case"Union":return ye(x,c,_);case"Uint8Array":return p(x,c,_);case"Unknown":return w(x,c,_);case"Void":return A(x,c,_);default:if(!o.TypeRegistry.Has(x[o.Kind]))throw new a(x);return R(x,c,_)}}function U(...g){return g.length===3?j(g[0],g[1],g[2]):j(g[0],[],g[1])}e.Check=U}}),cT=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=di(),r=ns(),n=lT(),i=Gr(),o=class extends i.TypeBoxError{constructor(k,E,T){super("Unable to decode due to invalid value"),this.schema=k,this.value=E,this.error=T}};e.TransformDecodeCheckError=o;var a=class extends i.TypeBoxError{constructor(k,E,T){super("Unable to encode due to invalid value"),this.schema=k,this.value=E,this.error=T}};e.TransformEncodeCheckError=a;var s=class extends i.TypeBoxError{constructor(k,E,T){super(`${T instanceof Error?T.message:"Unknown error"}`),this.schema=k,this.value=E}};e.TransformDecodeError=s;var u=class extends i.TypeBoxError{constructor(k,E,T){super(`${T instanceof Error?T.message:"Unknown error"}`),this.schema=k,this.value=E}};e.TransformEncodeError=u;var l;(function(k){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 D(ee,ce){return i.TypeGuard.TTransform(ee)||i.TypeGuard.TTransform(ee.unevaluatedProperties)||ee.allOf.some(V=>z(V,ce))}function $(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 K(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 M(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 q(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 N(ee,ce){return i.TypeGuard.TTransform(ee)||!(0,t.IsUndefined)(ee.items)&&ee.items.some(V=>z(V,ce))}function L(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 D(J,V);case"Iterator":return $(J,V);case"Not":return F(J,V);case"Object":return K(J,V);case"Promise":return M(J,V);case"Record":return Q(J,V);case"Ref":return q(J,V);case"This":return te(J,V);case"Tuple":return N(J,V);case"Union":return L(J,V);default:return i.TypeGuard.TTransform(ee)}}let re=new Set;function se(ee,ce){return re.clear(),z(ee,ce)}k.Has=se})(l||(e.HasTransform=l={}));var f;(function(k){function E(N,L){try{return i.TypeGuard.TTransform(N)?N[i.Transform].Decode(L):L}catch(z){throw new s(N,L,z)}}function T(N,L,z){return(0,t.IsArray)(z)?E(N,z.map(re=>q(N.items,L,re))):E(N,z)}function B(N,L,z){if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return E(N,z);let re=i.KeyResolver.ResolveKeys(N,{includePatterns:!1}),se=re.reduce((J,Z)=>Z in J?{...J,[Z]:q(i.IndexedAccessor.Resolve(N,[Z]),L,J[Z])}:J,z);if(!i.TypeGuard.TTransform(N.unevaluatedProperties))return E(N,se);let ee=Object.getOwnPropertyNames(se),ce=N.unevaluatedProperties,V=ee.reduce((J,Z)=>re.includes(Z)?J:{...J,[Z]:E(ce,J[Z])},se);return E(N,V)}function W(N,L,z){return E(N,q(N.not,L,z))}function D(N,L,z){if(!(0,t.IsPlainObject)(z))return E(N,z);let re=i.KeyResolver.ResolveKeys(N,{includePatterns:!1}),se=re.reduce((J,Z)=>Z in J?{...J,[Z]:q(N.properties[Z],L,J[Z])}:J,z);if(!i.TypeGuard.TSchema(N.additionalProperties))return E(N,se);let ee=Object.getOwnPropertyNames(se),ce=N.additionalProperties,V=ee.reduce((J,Z)=>re.includes(Z)?J:{...J,[Z]:E(ce,J[Z])},se);return E(N,V)}function $(N,L,z){if(!(0,t.IsPlainObject)(z))return E(N,z);let re=Object.getOwnPropertyNames(N.patternProperties)[0],se=new RegExp(re),ee=Object.getOwnPropertyNames(z).reduce((Z,ye)=>se.test(ye)?{...Z,[ye]:q(N.patternProperties[re],L,Z[ye])}:Z,z);if(!i.TypeGuard.TSchema(N.additionalProperties))return E(N,ee);let ce=Object.getOwnPropertyNames(ee),V=N.additionalProperties,J=ce.reduce((Z,ye)=>se.test(ye)?Z:{...Z,[ye]:E(V,Z[ye])},ee);return E(N,J)}function F(N,L,z){let re=(0,r.Deref)(N,L);return E(N,q(re,L,z))}function K(N,L,z){let re=(0,r.Deref)(N,L);return E(N,q(re,L,z))}function M(N,L,z){return(0,t.IsArray)(z)&&(0,t.IsArray)(N.items)?E(N,N.items.map((re,se)=>q(re,L,z[se]))):E(N,z)}function Q(N,L,z){let re=E(N,z);for(let se of N.anyOf)if((0,n.Check)(se,L,re))return q(se,L,re);return re}function q(N,L,z){let re=typeof N.$id=="string"?[...L,N]:L,se=N;switch(N[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 D(se,re,z);case"Record":return $(se,re,z);case"Ref":return F(se,re,z);case"Symbol":return E(se,z);case"This":return K(se,re,z);case"Tuple":return M(se,re,z);case"Union":return Q(se,re,z);default:return E(se,z)}}function te(N,L,z){return q(N,L,z)}k.Decode=te})(f||(e.DecodeTransform=f={}));var d;(function(k){function E(N,L){try{return i.TypeGuard.TTransform(N)?N[i.Transform].Encode(L):L}catch(z){throw new u(N,L,z)}}function T(N,L,z){let re=E(N,z);return(0,t.IsArray)(re)?re.map(se=>q(N.items,L,se)):re}function B(N,L,z){let re=E(N,z);if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return re;let se=i.KeyResolver.ResolveKeys(N,{includePatterns:!1}),ee=se.reduce((J,Z)=>Z in re?{...J,[Z]:q(i.IndexedAccessor.Resolve(N,[Z]),L,J[Z])}:J,re);if(!i.TypeGuard.TTransform(N.unevaluatedProperties))return E(N,ee);let ce=Object.getOwnPropertyNames(ee),V=N.unevaluatedProperties;return ce.reduce((J,Z)=>se.includes(Z)?J:{...J,[Z]:E(V,J[Z])},ee)}function W(N,L,z){return E(N.not,E(N,z))}function D(N,L,z){let re=E(N,z);if(!(0,t.IsPlainObject)(z))return re;let se=i.KeyResolver.ResolveKeys(N,{includePatterns:!1}),ee=se.reduce((J,Z)=>Z in J?{...J,[Z]:q(N.properties[Z],L,J[Z])}:J,re);if(!i.TypeGuard.TSchema(N.additionalProperties))return ee;let ce=Object.getOwnPropertyNames(ee),V=N.additionalProperties;return ce.reduce((J,Z)=>se.includes(Z)?J:{...J,[Z]:E(V,J[Z])},ee)}function $(N,L,z){let re=E(N,z);if(!(0,t.IsPlainObject)(z))return re;let se=Object.getOwnPropertyNames(N.patternProperties)[0],ee=new RegExp(se),ce=Object.getOwnPropertyNames(z).reduce((Z,ye)=>ee.test(ye)?{...Z,[ye]:q(N.patternProperties[se],L,Z[ye])}:Z,re);if(!i.TypeGuard.TSchema(N.additionalProperties))return E(N,ce);let V=Object.getOwnPropertyNames(ce),J=N.additionalProperties;return V.reduce((Z,ye)=>ee.test(ye)?Z:{...Z,[ye]:E(J,Z[ye])},ce)}function F(N,L,z){let re=(0,r.Deref)(N,L),se=q(re,L,z);return E(N,se)}function K(N,L,z){let re=(0,r.Deref)(N,L),se=q(re,L,z);return E(N,se)}function M(N,L,z){let re=E(N,z);return(0,t.IsArray)(N.items)?N.items.map((se,ee)=>q(se,L,re[ee])):[]}function Q(N,L,z){for(let re of N.anyOf){if(!(0,n.Check)(re,L,z))continue;let se=q(re,L,z);return E(N,se)}for(let re of N.anyOf){let se=q(re,L,z);if((0,n.Check)(N,L,se))return E(N,se)}return E(N,z)}function q(N,L,z){let re=typeof N.$id=="string"?[...L,N]:L,se=N;switch(N[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 D(se,re,z);case"Record":return $(se,re,z);case"Ref":return F(se,re,z);case"This":return K(se,re,z);case"Tuple":return M(se,re,z);case"Union":return Q(se,re,z);default:return E(se,z)}}function te(N,L,z){return q(N,L,z)}k.Encode=te})(d||(e.EncodeTransform=d={}))}}),fT=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=cT(),r=di(),n=is(),i=Dp(),o=ns(),a=vl(),s=Gr(),u=class{constructor(D,$,F,K){this.schema=D,this.references=$,this.checkFunc=F,this.code=K,this.hasTransform=t.HasTransform.Has(D,$)}Code(){return this.code}Errors(D){return(0,n.Errors)(this.schema,this.references,D)}Check(D){return this.checkFunc(D)}Decode(D){if(!this.checkFunc(D))throw new t.TransformDecodeCheckError(this.schema,D,this.Errors(D).First());return this.hasTransform?t.DecodeTransform.Decode(this.schema,this.references,D):D}Encode(D){let $=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,D):D;if(!this.checkFunc($))throw new t.TransformEncodeCheckError(this.schema,D,this.Errors(D).First());return $}};e.TypeCheck=u;var l;(function(D){function $(Q){return Q===36}D.DollarSign=$;function F(Q){return Q===95}D.IsUnderscore=F;function K(Q){return Q>=65&&Q<=90||Q>=97&&Q<=122}D.IsAlpha=K;function M(Q){return Q>=48&&Q<=57}D.IsNumeric=M})(l||(l={}));var f;(function(D){function $(Q){return Q.length===0?!1:l.IsNumeric(Q.charCodeAt(0))}function F(Q){if($(Q))return!1;for(let q=0;q<Q.length;q++){let te=Q.charCodeAt(q);if(!(l.IsAlpha(te)||l.IsNumeric(te)||l.DollarSign(te)||l.IsUnderscore(te)))return!1}return!0}function K(Q){return Q.replace(/'/g,"\\'")}function M(Q,q){return F(q)?`${Q}.${q}`:`${Q}['${K(q)}']`}D.Encode=M})(f||(f={}));var d;(function(D){function $(F){let K=[];for(let M=0;M<F.length;M++){let Q=F.charCodeAt(M);l.IsNumeric(Q)||l.IsAlpha(Q)?K.push(F.charAt(M)):K.push(`_${Q}_`)}return K.join("").replace(/__/g,"_")}D.Encode=$})(d||(d={}));var k;(function(D){function $(F){return F.replace(/'/g,"\\'")}D.Escape=$})(k||(k={}));var E=class extends s.TypeBoxError{constructor(D){super("Unknown type"),this.schema=D}};e.TypeCompilerUnknownTypeError=E;var T=class extends s.TypeBoxError{constructor(D){super("Preflight validation check failed to guard for the given schema"),this.schema=D}};e.TypeCompilerTypeGuardError=T;var B;(function(D){function $(q,te,N){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${te}' in ${q} ? ${N} : true)`:`(${f.Encode(q,te)} !== undefined ? ${N} : true)`}D.IsExactOptionalProperty=$;function F(q){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${q} === 'object' && ${q} !== null)`:`(typeof ${q} === 'object' && ${q} !== null && !Array.isArray(${q}))`}D.IsObjectLike=F;function K(q){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${q} === 'object' && ${q} !== null && !(${q} instanceof Date) && !(${q} instanceof Uint8Array))`:`(typeof ${q} === 'object' && ${q} !== null && !Array.isArray(${q}) && !(${q} instanceof Date) && !(${q} instanceof Uint8Array))`}D.IsRecordLike=K;function M(q){return i.TypeSystemPolicy.AllowNaN?`typeof ${q} === 'number'`:`(typeof ${q} === 'number' && Number.isFinite(${q}))`}D.IsNumberLike=M;function Q(q){return i.TypeSystemPolicy.AllowNullVoid?`(${q} === undefined || ${q} === null)`:`${q} === undefined`}D.IsVoidLike=Q})(B||(e.Policy=B={}));var W;(function(D){function $(S){return S[s.Kind]==="Any"||S[s.Kind]==="Unknown"}function*F(S,pe,C){yield"true"}function*K(S,pe,C){yield`Array.isArray(${C})`;let[_e,ae]=[qe("value","any"),qe("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)`,Ir=["(count > 0)",...ft,...at].join(" && ");yield`((${_e}) => { ${pt}; return ${Ir}})(${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*M(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*q(S,pe,C){yield`(typeof ${C} === 'boolean')`}function*te(S,pe,C){yield*H(S.returns,pe,`${C}.prototype`)}function*N(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*L(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=xe(`${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=xe(`${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} === '${k.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)||$(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=xe(`${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*R(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`${xe(`${new RegExp(S.pattern)};`)}.test(${C})`),S.format!==void 0&&(yield`format('${S.format}', ${C})`)}function*j(S,pe,C){yield`(typeof ${C} === 'symbol')`}function*U(S,pe,C){yield`(typeof ${C} === 'string')`,yield`${xe(`${new RegExp(S.pattern)};`)}.test(${C})`}function*g(S,pe,C){yield`${ve(S.$ref)}(${C})`}function*O(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*x(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=De(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*K(he,ae,C);case"AsyncIterator":return yield*M(he,ae,C);case"BigInt":return yield*Q(he,ae,C);case"Boolean":return yield*q(he,ae,C);case"Constructor":return yield*te(he,ae,C);case"Date":return yield*N(he,ae,C);case"Function":return yield*L(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*R(he,ae,C);case"Symbol":return yield*j(he,ae,C);case"TemplateLiteral":return yield*U(he,ae,C);case"This":return yield*g(he,ae,C);case"Tuple":return yield*O(he,ae,C);case"Undefined":return yield*_(he,ae,C);case"Union":return yield*c(he,ae,C);case"Uint8Array":return yield*x(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 xe(S){let pe=`local_${ie.variables.size}`;return ie.variables.set(pe,`const ${pe} = ${S}`),pe}function De(S,pe,C,_e,ae=!0){let[he,Ce]=[`
|
|
49
|
+
`,pt=>"".padStart(pt," ")],Ke=qe("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 qe(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=De("check",S,pe,"value"),ae=qe("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
51
|
return ${ve(S.$id)}(value)
|
|
52
|
-
}`:`return ${_e}`;return[...
|
|
53
|
-
`)}function Sr(...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)}D.Code=Sr;function Qr(S,pe=[]){let C=Sr(S,pe,{language:"javascript"}),_e=globalThis.Function("kind","format","hash",C),ae=new Map(ie.instances);function he(at,pt,Ir){if(!s.TypeRegistry.Has(at)||!ae.has(pt))return!1;let
|
|
54
|
-
`)){let i=n.match(/^\s+at\s+(.*)/);if(i){if(r)return i[1].trim().replace(__dirname,"");r=!0}}}};ha.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(
|
|
52
|
+
}`:`return ${_e}`;return[...Ke,...Ce,ft].join(`
|
|
53
|
+
`)}function Sr(...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)}D.Code=Sr;function Qr(S,pe=[]){let C=Sr(S,pe,{language:"javascript"}),_e=globalThis.Function("kind","format","hash",C),ae=new Map(ie.instances);function he(at,pt,Ir){if(!s.TypeRegistry.Has(at)||!ae.has(pt))return!1;let Nn=s.TypeRegistry.Get(at),jn=ae.get(pt);return Nn(jn,Ir)}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)}D.Compile=Qr})(W||(e.TypeCompiler=W={}))}}),dT=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=uT();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return n.ValueErrorIterator}}),r(fT(),e)}}),ha=xr(oT(),1),pT=xr(aT(),1),Mp=!1,Lp=!1;ha.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(Mp=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(Lp=process?.env?.LOGGER_PERF_PREFIX==="true"));var hT={prefix:void 0,time:Mp,delta:Lp,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},ks=[],Bp=class{sinceFirst=0;sinceLast=0;time=!1;delta=!1;constructor(e,t,r,n){Object.assign(this,{sinceFirst:e,sinceLast:t,time:r,delta:n})}toString(){let e=this.sinceFirst*.001,t=e.toFixed(e<5?2:1),r=this.sinceLast<1e3?`${this.sinceLast.toFixed(0)}`.padStart(5," "):`${`${(this.sinceLast*.001).toFixed(this.sinceLast<1e4?1:0)}`.padStart(4," ")}s`;return`[${[this.time?t:null,this.delta?r:null].filter(n=>n!=null).join(",")}]`}},Vp=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},ki=!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({},hT,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(...k){let E=k[k.length-1];return E===i?E():(o(...k.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,pT.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(ha.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=ha.isBrowser&&navigator.userAgent.includes("Chrome")?["",ht.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(ki?n.push(new Vp("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 Bp(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}}}};ha.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(ks&&ks.length){for(let t of ks)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof Bp))return null;ki||(ki=!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 Vp?(ki||(ki=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var yT=typeof global=="object"&&global&&global.Object===Object&&global,Fp=yT,gT=typeof self=="object"&&self&&self.Object===Object&&self,mT=Fp||gT||Function("return this")(),xt=mT,bT=xt.Symbol,sr=bT,zp=Object.prototype,vT=zp.hasOwnProperty,wT=zp.toString,Ei=sr?sr.toStringTag:void 0;function _T(e){var t=vT.call(e,Ei),r=e[Ei];try{e[Ei]=void 0;var n=!0}catch{}var i=wT.call(e);return n&&(t?e[Ei]=r:delete e[Ei]),i}var TT=_T,ET=Object.prototype,xT=ET.toString;function OT(e){return xT.call(e)}var AT=OT,ST="[object Null]",IT="[object Undefined]",Dc=sr?sr.toStringTag:void 0;function kT(e){return e==null?e===void 0?IT:ST:Dc&&Dc in Object(e)?TT(e):AT(e)}var pi=kT;function $T(e){return e!=null&&typeof e=="object"}var qr=$T,NT="[object Symbol]";function jT(e){return typeof e=="symbol"||qr(e)&&pi(e)==NT}var zn=jT;function CT(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 qp=CT,UT=Array.isArray,Zt=UT,PT=1/0,Mc=sr?sr.prototype:void 0,Lc=Mc?Mc.toString:void 0;function Kp(e){if(typeof e=="string")return e;if(Zt(e))return qp(e,Kp)+"";if(zn(e))return Lc?Lc.call(e):"";var t=e+"";return t=="0"&&1/e==-PT?"-0":t}var RT=Kp,DT=/\s/;function MT(e){for(var t=e.length;t--&&DT.test(e.charAt(t)););return t}var LT=MT,BT=/^\s+/;function VT(e){return e&&e.slice(0,LT(e)+1).replace(BT,"")}var FT=VT;function zT(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var wr=zT,Bc=NaN,qT=/^[-+]0x[0-9a-f]+$/i,KT=/^0b[01]+$/i,GT=/^0o[0-7]+$/i,HT=parseInt;function WT(e){if(typeof e=="number")return e;if(zn(e))return Bc;if(wr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=wr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=FT(e);var r=KT.test(e);return r||GT.test(e)?HT(e.slice(2),r?2:8):qT.test(e)?Bc:+e}var JT=WT,Vc=1/0,QT=17976931348623157e292;function YT(e){if(!e)return e===0?e:0;if(e=JT(e),e===Vc||e===-Vc){var t=e<0?-1:1;return t*QT}return e===e?e:0}var XT=YT;function ZT(e){var t=XT(e),r=t%1;return t===t?r?t-r:t:0}var Fc=ZT;function e2(e){return e}var os=e2,t2="[object AsyncFunction]",r2="[object Function]",n2="[object GeneratorFunction]",i2="[object Proxy]";function o2(e){if(!wr(e))return!1;var t=pi(e);return t==r2||t==n2||t==t2||t==i2}var Gp=o2,a2=xt["__core-js_shared__"],$s=a2,zc=function(){var e=/[^.]+$/.exec($s&&$s.keys&&$s.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function s2(e){return!!zc&&zc in e}var u2=s2,l2=Function.prototype,c2=l2.toString;function f2(e){if(e!=null){try{return c2.call(e)}catch{}try{return e+""}catch{}}return""}var kn=f2,d2=/[\\^$.*+?()[\]{}|]/g,p2=/^\[object .+?Constructor\]$/,h2=Function.prototype,y2=Object.prototype,g2=h2.toString,m2=y2.hasOwnProperty,b2=RegExp("^"+g2.call(m2).replace(d2,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function v2(e){if(!wr(e)||u2(e))return!1;var t=Gp(e)?b2:p2;return t.test(kn(e))}var w2=v2;function _2(e,t){return e?.[t]}var T2=_2;function E2(e,t){var r=T2(e,t);return w2(r)?r:void 0}var $n=E2,x2=$n(xt,"WeakMap"),qi=x2,O2=qi&&new qi,ya=O2,A2=ya?function(e,t){return ya.set(e,t),e}:os,Hp=A2,qc=Object.create,S2=function(){function e(){}return function(t){if(!wr(t))return{};if(qc)return qc(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),wl=S2;function I2(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=wl(e.prototype),n=e.apply(r,t);return wr(n)?n:r}}var Ki=I2,k2=1;function $2(e,t,r){var n=t&k2,i=Ki(e);function o(){var a=this&&this!==xt&&this instanceof o?i:e;return a.apply(n?r:this,arguments)}return o}var N2=$2;function j2(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 _l=j2,C2=Math.max;function U2(e,t,r,n){for(var i=-1,o=e.length,a=r.length,s=-1,u=t.length,l=C2(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 Wp=U2,P2=Math.max;function R2(e,t,r,n){for(var i=-1,o=e.length,a=-1,s=r.length,u=-1,l=t.length,f=P2(o-s,0),d=Array(f+l),k=!n;++i<f;)d[i]=e[i];for(var E=i;++u<l;)d[E+u]=t[u];for(;++a<s;)(k||i<o)&&(d[E+r[a]]=e[i++]);return d}var Jp=R2;function D2(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var M2=D2;function L2(){}var Tl=L2,B2=4294967295;function ga(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=B2,this.__views__=[]}ga.prototype=wl(Tl.prototype);ga.prototype.constructor=ga;var El=ga;function V2(){}var Qp=V2,F2=ya?function(e){return ya.get(e)}:Qp,Yp=F2,z2={},Kc=z2,q2=Object.prototype,K2=q2.hasOwnProperty;function G2(e){for(var t=e.name+"",r=Kc[t],n=K2.call(Kc,t)?r.length:0;n--;){var i=r[n],o=i.func;if(o==null||o==e)return i.name}return t}var H2=G2;function ma(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}ma.prototype=wl(Tl.prototype);ma.prototype.constructor=ma;var su=ma;function W2(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var Xp=W2;function J2(e){if(e instanceof El)return e.clone();var t=new su(e.__wrapped__,e.__chain__);return t.__actions__=Xp(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Q2=J2,Y2=Object.prototype,X2=Y2.hasOwnProperty;function ba(e){if(qr(e)&&!Zt(e)&&!(e instanceof El)){if(e instanceof su)return e;if(X2.call(e,"__wrapped__"))return Q2(e)}return new su(e)}ba.prototype=Tl.prototype;ba.prototype.constructor=ba;var Z2=ba;function eE(e){var t=H2(e),r=Z2[t];if(typeof r!="function"||!(t in El.prototype))return!1;if(e===r)return!0;var n=Yp(r);return!!n&&e===n[0]}var tE=eE,rE=800,nE=16,iE=Date.now;function oE(e){var t=0,r=0;return function(){var n=iE(),i=nE-(n-r);if(r=n,i>0){if(++t>=rE)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Zp=oE,aE=Zp(Hp),eh=aE,sE=/\{\n\/\* \[wrapped with (.+)\] \*/,uE=/,? & /;function lE(e){var t=e.match(sE);return t?t[1].split(uE):[]}var cE=lE,fE=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function dE(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(fE,`{
|
|
55
55
|
/* [wrapped with `+t+`] */
|
|
56
|
-
`)}var pE=dE;function hE(e){return function(){return e}}var yE=hE,gE=function(){try{var e=kn(Object,"defineProperty");return e({},"",{}),e}catch{}}(),va=gE,mE=va?function(e,t){return va(e,"toString",{configurable:!0,enumerable:!1,value:yE(t),writable:!0})}:as,bE=mE,vE=Zp(bE),Ol=vE;function wE(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var _E=wE;function TE(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 EE=TE;function OE(e){return e!==e}var xE=OE;function AE(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}var SE=AE;function IE(e,t,r){return t===t?SE(e,t,r):EE(e,xE,r)}var kE=IE;function $E(e,t){var r=e==null?0:e.length;return!!r&&kE(e,t,0)>-1}var th=$E,NE=1,jE=2,CE=8,UE=16,PE=32,RE=64,DE=128,ME=256,LE=512,BE=[["ary",DE],["bind",NE],["bindKey",jE],["curry",CE],["curryRight",UE],["flip",LE],["partial",PE],["partialRight",RE],["rearg",ME]];function VE(e,t){return _E(BE,function(r){var n="_."+r[0];t&r[1]&&!th(e,n)&&e.push(n)}),e.sort()}var FE=VE;function zE(e,t,r){var n=t+"";return Ol(e,pE(n,FE(cE(n),r)))}var rh=zE,qE=1,KE=2,GE=4,HE=8,Gc=32,Hc=64;function WE(e,t,r,n,i,o,a,s,u,l){var f=t&HE,d=f?a:void 0,k=f?void 0:a,E=f?o:void 0,T=f?void 0:o;t|=f?Gc:Hc,t&=~(f?Hc:Gc),t&GE||(t&=~(qE|KE));var B=[e,t,i,E,d,T,k,s,u,l],W=r.apply(void 0,B);return tE(e)&&eh(W,B),W.placeholder=n,rh(W,e,t)}var nh=WE;function JE(e){var t=e;return t.placeholder}var xl=JE,QE=9007199254740991,YE=/^(?:0|[1-9]\d*)$/;function XE(e,t){var r=typeof e;return t=t??QE,!!t&&(r=="number"||r!="symbol"&&YE.test(e))&&e>-1&&e%1==0&&e<t}var ss=XE,ZE=Math.min;function eO(e,t){for(var r=e.length,n=ZE(t.length,r),i=Xp(e);n--;){var o=t[n];e[n]=ss(o,r)?i[o]:void 0}return e}var tO=eO,Wc="__lodash_placeholder__";function rO(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r];(a===t||a===Wc)&&(e[r]=Wc,o[i++]=r)}return o}var Gi=rO,nO=1,iO=2,oO=8,aO=16,sO=128,uO=512;function ih(e,t,r,n,i,o,a,s,u,l){var f=t&sO,d=t&nO,k=t&iO,E=t&(oO|aO),T=t&uO,B=k?void 0:Ki(e);function W(){for(var D=arguments.length,$=Array(D),F=D;F--;)$[F]=arguments[F];if(E)var K=xl(W),M=M2($,K);if(n&&($=Wp($,n,i,E)),o&&($=Jp($,o,a,E)),D-=M,E&&D<l){var Q=Gi($,K);return nh(e,t,ih,W.placeholder,r,$,Q,s,u,l-D)}var q=d?r:this,te=k?q[e]:e;return D=$.length,s?$=tO($,s):T&&D>1&&$.reverse(),f&&u<D&&($.length=u),this&&this!==Et&&this instanceof W&&(te=B||Ki(te)),te.apply(q,$)}return W}var oh=ih;function lO(e,t,r){var n=Ki(e);function i(){for(var o=arguments.length,a=Array(o),s=o,u=xl(i);s--;)a[s]=arguments[s];var l=o<3&&a[0]!==u&&a[o-1]!==u?[]:Gi(a,u);if(o-=l.length,o<r)return nh(e,t,oh,i.placeholder,void 0,a,l,void 0,void 0,r-o);var f=this&&this!==Et&&this instanceof i?n:e;return _l(f,this,a)}return i}var cO=lO,fO=1;function dO(e,t,r,n){var i=t&fO,o=Ki(e);function a(){for(var s=-1,u=arguments.length,l=-1,f=n.length,d=Array(f+u),k=this&&this!==Et&&this instanceof a?o:e;++l<f;)d[l]=n[l];for(;u--;)d[l++]=arguments[++s];return _l(k,i?r:this,d)}return a}var pO=dO,Jc="__lodash_placeholder__",js=1,hO=2,yO=4,Qc=8,Oi=128,Yc=256,gO=Math.min;function mO(e,t){var r=e[1],n=t[1],i=r|n,o=i<(js|hO|Oi),a=n==Oi&&r==Qc||n==Oi&&r==Yc&&e[7].length<=t[8]||n==(Oi|Yc)&&t[7].length<=t[8]&&r==Qc;if(!(o||a))return e;n&js&&(e[2]=t[2],i|=r&js?0:yO);var s=t[3];if(s){var u=e[3];e[3]=u?Wp(u,s,t[4]):s,e[4]=u?Gi(e[3],Jc):t[4]}return s=t[5],s&&(u=e[5],e[5]=u?Jp(u,s,t[6]):s,e[6]=u?Gi(e[5],Jc):t[6]),s=t[7],s&&(e[7]=s),n&Oi&&(e[8]=e[8]==null?t[8]:gO(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}var bO=mO,vO="Expected a function",Xc=1,wO=2,Cs=8,Us=16,Ps=32,Zc=64,ef=Math.max;function _O(e,t,r,n,i,o,a,s){var u=t&wO;if(!u&&typeof e!="function")throw new TypeError(vO);var l=n?n.length:0;if(l||(t&=~(Ps|Zc),n=i=void 0),a=a===void 0?a:ef(Fc(a),0),s=s===void 0?s:Fc(s),l-=i?i.length:0,t&Zc){var f=n,d=i;n=i=void 0}var k=u?void 0:Yp(e),E=[e,t,r,n,i,f,d,o,a,s];if(k&&bO(E,k),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:ef(E[9]-l,0),!s&&t&(Cs|Us)&&(t&=~(Cs|Us)),!t||t==Xc)var T=N2(e,t,r);else t==Cs||t==Us?T=cO(e,t,s):(t==Ps||t==(Xc|Ps))&&!i.length?T=pO(e,t,r,n):T=oh.apply(void 0,E);var B=k?Hp:eh;return rh(B(T,E),e,t)}var TO=_O;function EO(e,t,r){t=="__proto__"&&va?va(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var OO=EO;function xO(e,t){return e===t||e!==e&&t!==t}var Al=xO,AO=Object.prototype,SO=AO.hasOwnProperty;function IO(e,t,r){var n=e[t];(!(SO.call(e,t)&&Al(n,r))||r===void 0&&!(t in e))&&OO(e,t,r)}var kO=IO,tf=Math.max;function $O(e,t,r){return t=tf(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=tf(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),_l(e,this,s)}}var ah=$O;function NO(e,t){return Ol(ah(e,t,as),e+"")}var sh=NO,jO=9007199254740991;function CO(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=jO}var Sl=CO;function UO(e){return e!=null&&Sl(e.length)&&!Gp(e)}var uh=UO,PO=Object.prototype;function RO(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||PO;return e===r}var DO=RO;function MO(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var LO=MO,BO="[object Arguments]";function VO(e){return qr(e)&&pi(e)==BO}var rf=VO,lh=Object.prototype,FO=lh.hasOwnProperty,zO=lh.propertyIsEnumerable,qO=rf(function(){return arguments}())?rf:function(e){return qr(e)&&FO.call(e,"callee")&&!zO.call(e,"callee")},Il=qO;function KO(){return!1}var GO=KO,ch=typeof exports=="object"&&exports&&!exports.nodeType&&exports,nf=ch&&typeof module=="object"&&module&&!module.nodeType&&module,HO=nf&&nf.exports===ch,of=HO?Et.Buffer:void 0,WO=of?of.isBuffer:void 0,JO=WO||GO,lu=JO,QO="[object Arguments]",YO="[object Array]",XO="[object Boolean]",ZO="[object Date]",ex="[object Error]",tx="[object Function]",rx="[object Map]",nx="[object Number]",ix="[object Object]",ox="[object RegExp]",ax="[object Set]",sx="[object String]",ux="[object WeakMap]",lx="[object ArrayBuffer]",cx="[object DataView]",fx="[object Float32Array]",dx="[object Float64Array]",px="[object Int8Array]",hx="[object Int16Array]",yx="[object Int32Array]",gx="[object Uint8Array]",mx="[object Uint8ClampedArray]",bx="[object Uint16Array]",vx="[object Uint32Array]",Me={};Me[fx]=Me[dx]=Me[px]=Me[hx]=Me[yx]=Me[gx]=Me[mx]=Me[bx]=Me[vx]=!0;Me[QO]=Me[YO]=Me[lx]=Me[XO]=Me[cx]=Me[ZO]=Me[ex]=Me[tx]=Me[rx]=Me[nx]=Me[ix]=Me[ox]=Me[ax]=Me[sx]=Me[ux]=!1;function wx(e){return qr(e)&&Sl(e.length)&&!!Me[pi(e)]}var _x=wx;function Tx(e){return function(t){return e(t)}}var fh=Tx,dh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pi=dh&&typeof module=="object"&&module&&!module.nodeType&&module,Ex=Pi&&Pi.exports===dh,Rs=Ex&&Fp.process,Ox=function(){try{var e=Pi&&Pi.require&&Pi.require("util").types;return e||Rs&&Rs.binding&&Rs.binding("util")}catch{}}(),af=Ox,sf=af&&af.isTypedArray,xx=sf?fh(sf):_x,ph=xx,Ax=Object.prototype,Sx=Ax.hasOwnProperty;function Ix(e,t){var r=Zt(e),n=!r&&Il(e),i=!r&&!n&&lu(e),o=!r&&!n&&!i&&ph(e),a=r||n||i||o,s=a?LO(e.length,String):[],u=s.length;for(var l in e)(t||Sx.call(e,l))&&!(a&&(l=="length"||i&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||ss(l,u)))&&s.push(l);return s}var kx=Ix;function $x(e,t){return function(r){return e(t(r))}}var Nx=$x,jx=Nx(Object.keys,Object),Cx=jx,Ux=Object.prototype,Px=Ux.hasOwnProperty;function Rx(e){if(!DO(e))return Cx(e);var t=[];for(var r in Object(e))Px.call(e,r)&&r!="constructor"&&t.push(r);return t}var Dx=Rx;function Mx(e){return uh(e)?kx(e):Dx(e)}var hh=Mx,Lx=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Bx=/^\w*$/;function Vx(e,t){if(Zt(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Fn(e)?!0:Bx.test(e)||!Lx.test(e)||t!=null&&e in Object(t)}var kl=Vx,Fx=kn(Object,"create"),Hi=Fx;function zx(){this.__data__=Hi?Hi(null):{},this.size=0}var qx=zx;function Kx(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Gx=Kx,Hx="__lodash_hash_undefined__",Wx=Object.prototype,Jx=Wx.hasOwnProperty;function Qx(e){var t=this.__data__;if(Hi){var r=t[e];return r===Hx?void 0:r}return Jx.call(t,e)?t[e]:void 0}var Yx=Qx,Xx=Object.prototype,Zx=Xx.hasOwnProperty;function eA(e){var t=this.__data__;return Hi?t[e]!==void 0:Zx.call(t,e)}var tA=eA,rA="__lodash_hash_undefined__";function nA(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Hi&&t===void 0?rA:t,this}var iA=nA;function hi(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])}}hi.prototype.clear=qx;hi.prototype.delete=Gx;hi.prototype.get=Yx;hi.prototype.has=tA;hi.prototype.set=iA;var uf=hi;function oA(){this.__data__=[],this.size=0}var aA=oA;function sA(e,t){for(var r=e.length;r--;)if(Al(e[r][0],t))return r;return-1}var us=sA,uA=Array.prototype,lA=uA.splice;function cA(e){var t=this.__data__,r=us(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():lA.call(t,r,1),--this.size,!0}var fA=cA;function dA(e){var t=this.__data__,r=us(t,e);return r<0?void 0:t[r][1]}var pA=dA;function hA(e){return us(this.__data__,e)>-1}var yA=hA;function gA(e,t){var r=this.__data__,n=us(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var mA=gA;function yi(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])}}yi.prototype.clear=aA;yi.prototype.delete=fA;yi.prototype.get=pA;yi.prototype.has=yA;yi.prototype.set=mA;var ls=yi,bA=kn(Et,"Map"),Wi=bA;function vA(){this.size=0,this.__data__={hash:new uf,map:new(Wi||ls),string:new uf}}var wA=vA;function _A(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var TA=_A;function EA(e,t){var r=e.__data__;return TA(t)?r[typeof t=="string"?"string":"hash"]:r.map}var cs=EA;function OA(e){var t=cs(this,e).delete(e);return this.size-=t?1:0,t}var xA=OA;function AA(e){return cs(this,e).get(e)}var SA=AA;function IA(e){return cs(this,e).has(e)}var kA=IA;function $A(e,t){var r=cs(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var NA=$A;function gi(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])}}gi.prototype.clear=wA;gi.prototype.delete=xA;gi.prototype.get=SA;gi.prototype.has=kA;gi.prototype.set=NA;var fs=gi,jA="Expected a function";function $l(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(jA);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($l.Cache||fs),r}$l.Cache=fs;var CA=$l,UA=500;function PA(e){var t=CA(e,function(n){return r.size===UA&&r.clear(),n}),r=t.cache;return t}var RA=PA,DA=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,MA=/\\(\\)?/g,LA=RA(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(DA,function(r,n,i,o){t.push(i?o.replace(MA,"$1"):n||r)}),t}),BA=LA;function VA(e){return e==null?"":RT(e)}var FA=VA;function zA(e,t){return Zt(e)?e:kl(e,t)?[e]:BA(FA(e))}var ds=zA,qA=1/0;function KA(e){if(typeof e=="string"||Fn(e))return e;var t=e+"";return t=="0"&&1/e==-qA?"-0":t}var mo=KA;function GA(e,t){t=ds(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[mo(t[r++])];return r&&r==n?e:void 0}var Nl=GA;function HA(e,t,r){var n=e==null?void 0:Nl(e,t);return n===void 0?r:n}var WA=HA;function JA(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var yh=JA,lf=sr?sr.isConcatSpreadable:void 0;function QA(e){return Zt(e)||Il(e)||!!(lf&&e&&e[lf])}var YA=QA;function gh(e,t,r,n,i){var o=-1,a=e.length;for(r||(r=YA),i||(i=[]);++o<a;){var s=e[o];t>0&&r(s)?t>1?gh(s,t-1,r,n,i):yh(i,s):n||(i[i.length]=s)}return i}var XA=gh;function ZA(e){var t=e==null?0:e.length;return t?XA(e,1):[]}var eS=ZA;function tS(e){return Ol(ah(e,void 0,eS),e+"")}var rS=tS;function nS(){this.__data__=new ls,this.size=0}var iS=nS;function oS(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var aS=oS;function sS(e){return this.__data__.get(e)}var uS=sS;function lS(e){return this.__data__.has(e)}var cS=lS,fS=200;function dS(e,t){var r=this.__data__;if(r instanceof ls){var n=r.__data__;if(!Wi||n.length<fS-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new fs(n)}return r.set(e,t),this.size=r.size,this}var pS=dS;function mi(e){var t=this.__data__=new ls(e);this.size=t.size}mi.prototype.clear=iS;mi.prototype.delete=aS;mi.prototype.get=uS;mi.prototype.has=cS;mi.prototype.set=pS;var Do=mi;function hS(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 yS=hS;function gS(){return[]}var mS=gS,bS=Object.prototype,vS=bS.propertyIsEnumerable,cf=Object.getOwnPropertySymbols,wS=cf?function(e){return e==null?[]:(e=Object(e),yS(cf(e),function(t){return vS.call(e,t)}))}:mS,_S=wS;function TS(e,t,r){var n=t(e);return Zt(e)?n:yh(n,r(e))}var ES=TS;function OS(e){return ES(e,hh,_S)}var ff=OS,xS=kn(Et,"DataView"),cu=xS,AS=kn(Et,"Promise"),fu=AS,SS=kn(Et,"Set"),Mn=SS,df="[object Map]",IS="[object Object]",pf="[object Promise]",hf="[object Set]",yf="[object WeakMap]",gf="[object DataView]",kS=In(cu),$S=In(Wi),NS=In(fu),jS=In(Mn),CS=In(qi),rn=pi;(cu&&rn(new cu(new ArrayBuffer(1)))!=gf||Wi&&rn(new Wi)!=df||fu&&rn(fu.resolve())!=pf||Mn&&rn(new Mn)!=hf||qi&&rn(new qi)!=yf)&&(rn=function(e){var t=pi(e),r=t==IS?e.constructor:void 0,n=r?In(r):"";if(n)switch(n){case kS:return gf;case $S:return df;case NS:return pf;case jS:return hf;case CS:return yf}return t});var mf=rn,US=Et.Uint8Array,bf=US,PS="__lodash_hash_undefined__";function RS(e){return this.__data__.set(e,PS),this}var DS=RS;function MS(e){return this.__data__.has(e)}var LS=MS;function wa(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new fs;++t<r;)this.add(e[t])}wa.prototype.add=wa.prototype.push=DS;wa.prototype.has=LS;var mh=wa;function BS(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 VS=BS;function FS(e,t){return e.has(t)}var bh=FS,zS=1,qS=2;function KS(e,t,r,n,i,o){var a=r&zS,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,k=!0,E=r&qS?new mh: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;k=!1;break}if(E){if(!VS(t,function(D,$){if(!bh(E,$)&&(T===D||i(T,D,r,n,o)))return E.push($)})){k=!1;break}}else if(!(T===B||i(T,B,r,n,o))){k=!1;break}}return o.delete(e),o.delete(t),k}var vh=KS;function GS(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var HS=GS;function WS(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var wh=WS,JS=1,QS=2,YS="[object Boolean]",XS="[object Date]",ZS="[object Error]",eI="[object Map]",tI="[object Number]",rI="[object RegExp]",nI="[object Set]",iI="[object String]",oI="[object Symbol]",aI="[object ArrayBuffer]",sI="[object DataView]",vf=sr?sr.prototype:void 0,Ds=vf?vf.valueOf:void 0;function uI(e,t,r,n,i,o,a){switch(r){case sI:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case aI:return!(e.byteLength!=t.byteLength||!o(new bf(e),new bf(t)));case YS:case XS:case tI:return Al(+e,+t);case ZS:return e.name==t.name&&e.message==t.message;case rI:case iI:return e==t+"";case eI:var s=HS;case nI:var u=n&JS;if(s||(s=wh),e.size!=t.size&&!u)return!1;var l=a.get(e);if(l)return l==t;n|=QS,a.set(e,t);var f=vh(s(e),s(t),n,i,o,a);return a.delete(e),f;case oI:if(Ds)return Ds.call(e)==Ds.call(t)}return!1}var lI=uI,cI=1,fI=Object.prototype,dI=fI.hasOwnProperty;function pI(e,t,r,n,i,o){var a=r&cI,s=ff(e),u=s.length,l=ff(t),f=l.length;if(u!=f&&!a)return!1;for(var d=u;d--;){var k=s[d];if(!(a?k in t:dI.call(t,k)))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;){k=s[d];var D=e[k],$=t[k];if(n)var F=a?n($,D,k,t,e,o):n(D,$,k,e,t,o);if(!(F===void 0?D===$||i(D,$,r,n,o):F)){B=!1;break}W||(W=k=="constructor")}if(B&&!W){var K=e.constructor,M=t.constructor;K!=M&&"constructor"in e&&"constructor"in t&&!(typeof K=="function"&&K instanceof K&&typeof M=="function"&&M instanceof M)&&(B=!1)}return o.delete(e),o.delete(t),B}var hI=pI,yI=1,wf="[object Arguments]",_f="[object Array]",So="[object Object]",gI=Object.prototype,Tf=gI.hasOwnProperty;function mI(e,t,r,n,i,o){var a=Zt(e),s=Zt(t),u=a?_f:mf(e),l=s?_f:mf(t);u=u==wf?So:u,l=l==wf?So:l;var f=u==So,d=l==So,k=u==l;if(k&&lu(e)){if(!lu(t))return!1;a=!0,f=!1}if(k&&!f)return o||(o=new Do),a||ph(e)?vh(e,t,r,n,i,o):lI(e,t,u,r,n,i,o);if(!(r&yI)){var E=f&&Tf.call(e,"__wrapped__"),T=d&&Tf.call(t,"__wrapped__");if(E||T){var B=E?e.value():e,W=T?t.value():t;return o||(o=new Do),i(B,W,r,n,o)}}return k?(o||(o=new Do),hI(e,t,r,n,i,o)):!1}var bI=mI;function _h(e,t,r,n,i){return e===t?!0:e==null||t==null||!qr(e)&&!qr(t)?e!==e&&t!==t:bI(e,t,r,n,_h,i)}var Th=_h,vI=1,wI=2;function _I(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 Do;if(n)var k=n(l,f,u,e,t,d);if(!(k===void 0?Th(f,l,vI|wI,n,d):k))return!1}}return!0}var TI=_I;function EI(e){return e===e&&!wr(e)}var Eh=EI;function OI(e){for(var t=hh(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Eh(i)]}return t}var xI=OI;function AI(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var Oh=AI;function SI(e){var t=xI(e);return t.length==1&&t[0][2]?Oh(t[0][0],t[0][1]):function(r){return r===e||TI(r,e,t)}}var II=SI;function kI(e,t){return e!=null&&t in Object(e)}var $I=kI;function NI(e,t,r){t=ds(t,e);for(var n=-1,i=t.length,o=!1;++n<i;){var a=mo(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&&Sl(i)&&ss(a,i)&&(Zt(e)||Il(e)))}var jI=NI;function CI(e,t){return e!=null&&jI(e,t,$I)}var xh=CI,UI=1,PI=2;function RI(e,t){return kl(e)&&Eh(t)?Oh(mo(e),t):function(r){var n=WA(r,e);return n===void 0&&n===t?xh(r,e):Th(t,n,UI|PI)}}var DI=RI;function MI(e){return function(t){return t?.[e]}}var LI=MI;function BI(e){return function(t){return Nl(t,e)}}var VI=BI;function FI(e){return kl(e)?LI(mo(e)):VI(e)}var zI=FI;function qI(e){return typeof e=="function"?e:e==null?as:typeof e=="object"?Zt(e)?DI(e[0],e[1]):II(e):zI(e)}var KI=qI;function GI(e){return qr(e)&&uh(e)}var HI=GI;function WI(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 JI=WI,QI=200;function YI(e,t,r,n){var i=-1,o=th,a=!0,s=e.length,u=[],l=t.length;if(!s)return u;r&&(t=qp(t,fh(r))),n?(o=JI,a=!1):t.length>=QI&&(o=bh,a=!1,t=new mh(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 k=l;k--;)if(t[k]===d)continue e;u.push(f)}else o(t,d,n)||u.push(f)}return u}var XI=YI;function ZI(e,t,r,n){if(!wr(e))return e;t=ds(t,e);for(var i=-1,o=t.length,a=o-1,s=e;s!=null&&++i<o;){var u=mo(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=wr(f)?f:ss(t[i+1])?[]:{})}kO(s,u,l),s=s[u]}return e}var ek=ZI;function tk(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var a=t[n],s=Nl(e,a);r(s,a)&&ek(o,ds(a,e),s)}return o}var rk=tk,nk=32,jl=sh(function(e,t){var r=Gi(t,xl(jl));return TO(e,nk,void 0,t,r)});jl.placeholder={};var ik=jl;function ok(e,t){return rk(e,t,function(r,n){return xh(e,n)})}var ak=ok,sk=rS(function(e,t){return e==null?{}:ak(e,t)}),Ef=sk,uk=4294967295,lk=uk-1,ck=Math.floor,fk=Math.min;function dk(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=ck((i+o)/2),d=r(e[f]),k=d!==void 0,E=d===null,T=d===d,B=Fn(d);if(a)var W=n||T;else l?W=T&&(n||k):s?W=T&&k&&(n||!E):u?W=T&&k&&!E&&(n||!B):E||B?W=!1:W=n?d<=t:d<t;W?i=f+1:o=f}return fk(o,lk)}var pk=dk;function hk(e,t,r){return pk(e,t,KI(r,2))}var yk=hk,gk=1/0,fC=Mn&&1/wh(new Mn([,-0]))[1]==gk?function(e){return new Mn(e)}:Qp,mk=sh(function(e,t){return HI(e)?XI(e,t):[]}),Of=mk,Ah=Or(sT(),1),dC=Ah.default.configure,Ji=Ah.default,Ms=100,{WARN:bk,LOG:pC,DEBUG:Xe,VERBOSE:Ee,ERROR:hC}=Ae.setup(Ae.INFO),_a=Be.set();U_({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})=>Le(()=>(n=n||r,`${!Array.isArray(t)&&t?.name?t.name+" | ":""}${e??"caller?"}${n?`{${typeof n=="string"?n:Ji(n)}}`:""}`));function vk(e,t){return Le(()=>Je.structural(e.get(),t.get()))}function bo(e,t){return Je.shallow(e.applogs,t.applogs)}function Cl(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(!bo(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 wk=0;function Ht(e,{name:t,equals:r}={}){let n=`observableArrayMap@${++wk}{${t}}`;Ee.isEnabled&&Ee(`[${n}] create`,{fnname:e.name,fn:e,name:t,equals:r});let i,o=Sh(e,s=>{i?Le(()=>(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:ca(i)}),Fi(()=>_a.add(a))}return Ee.isEnabled&&rs(i,()=>{Ee(`[${n}] observed`,ca(i),{rootsAtom:a,observableArr:i})}),ui(i,()=>{Ee.isEnabled&&Ee(`[${n}] dispose`),a&&Fi(()=>_a.delete(a)),o()}),i}var _k=0;function Tk(e,{name:t}={}){let r=`observableSetMap@${++_k}{${t}}`;Ee.isEnabled&&Ee(`[${r}] create`,{fnname:e.name,fn:e,name:t});let n,i=Sh(e,a=>{if(!n)n=Be.set(a,{deep:!1,name:t});else{let{deleted:s,added:u}=Le(()=>{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:ca(n)}),Fi(()=>_a.add(o))}return Ee.isEnabled&&rs(n,()=>{Ee(`[${r}] observed`,ca(n),{rootsAtom:o,observableSet:n})}),ui(n,()=>{Ee.isEnabled&&Ee(`[${r}] dispose`),o&&Fi(()=>_a.delete(o)),i()}),n}function Sh(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=Ms&&performance.now();Xe.isEnabled&&Xe(`[${n}] runAndTrack:`,{name:r??e.name,fn:e}),i=e(),Xe.isEnabled&&Xe(`[${n}] runAndTrack =>`,i),Fi(()=>{t?.(i)}),Ms&&performance.now()-s>Ms&&bk(`[${n}] took ${performance.now()-s}ms`)})}return a(),Xe.isEnabled&&Xe(`[${n}] deps of reaction`,{reaction:o,result:i,deps:ns(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=Le(()=>{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(Ok(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(Of(E,E[B]),Of(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&&!u_())return!n&&p_().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,k=He(()=>(Ee.isEnabled&&Ee(`[${f}] update->rerun`,Le(()=>({args:s})),t),Ee.isEnabled&&Ip(),d=t.apply(this,s)),{...o,name:f});if(Ee.isEnabled&&Ee(`[${f}] deps`,ns(k),{untrackedArgs:l}),a.set(l,k),!o.keepAlive){let E=ui(k,()=>{Ee.isEnabled&&Ee(`[${f}] dispose`,k),E(),a.delete(l),o.onCleanup&&o.onCleanup(d,...s),d=void 0})}return k.get()}}function Ek(e){let t=0,r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("?r+=o+`
|
|
56
|
+
`)}var pE=dE;function hE(e){return function(){return e}}var yE=hE,gE=function(){try{var e=$n(Object,"defineProperty");return e({},"",{}),e}catch{}}(),va=gE,mE=va?function(e,t){return va(e,"toString",{configurable:!0,enumerable:!1,value:yE(t),writable:!0})}:os,bE=mE,vE=Zp(bE),xl=vE;function wE(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var _E=wE;function TE(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 EE=TE;function xE(e){return e!==e}var OE=xE;function AE(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}var SE=AE;function IE(e,t,r){return t===t?SE(e,t,r):EE(e,OE,r)}var kE=IE;function $E(e,t){var r=e==null?0:e.length;return!!r&&kE(e,t,0)>-1}var th=$E,NE=1,jE=2,CE=8,UE=16,PE=32,RE=64,DE=128,ME=256,LE=512,BE=[["ary",DE],["bind",NE],["bindKey",jE],["curry",CE],["curryRight",UE],["flip",LE],["partial",PE],["partialRight",RE],["rearg",ME]];function VE(e,t){return _E(BE,function(r){var n="_."+r[0];t&r[1]&&!th(e,n)&&e.push(n)}),e.sort()}var FE=VE;function zE(e,t,r){var n=t+"";return xl(e,pE(n,FE(cE(n),r)))}var rh=zE,qE=1,KE=2,GE=4,HE=8,Gc=32,Hc=64;function WE(e,t,r,n,i,o,a,s,u,l){var f=t&HE,d=f?a:void 0,k=f?void 0:a,E=f?o:void 0,T=f?void 0:o;t|=f?Gc:Hc,t&=~(f?Hc:Gc),t&GE||(t&=~(qE|KE));var B=[e,t,i,E,d,T,k,s,u,l],W=r.apply(void 0,B);return tE(e)&&eh(W,B),W.placeholder=n,rh(W,e,t)}var nh=WE;function JE(e){var t=e;return t.placeholder}var Ol=JE,QE=9007199254740991,YE=/^(?:0|[1-9]\d*)$/;function XE(e,t){var r=typeof e;return t=t??QE,!!t&&(r=="number"||r!="symbol"&&YE.test(e))&&e>-1&&e%1==0&&e<t}var as=XE,ZE=Math.min;function ex(e,t){for(var r=e.length,n=ZE(t.length,r),i=Xp(e);n--;){var o=t[n];e[n]=as(o,r)?i[o]:void 0}return e}var tx=ex,Wc="__lodash_placeholder__";function rx(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r];(a===t||a===Wc)&&(e[r]=Wc,o[i++]=r)}return o}var Gi=rx,nx=1,ix=2,ox=8,ax=16,sx=128,ux=512;function ih(e,t,r,n,i,o,a,s,u,l){var f=t&sx,d=t&nx,k=t&ix,E=t&(ox|ax),T=t&ux,B=k?void 0:Ki(e);function W(){for(var D=arguments.length,$=Array(D),F=D;F--;)$[F]=arguments[F];if(E)var K=Ol(W),M=M2($,K);if(n&&($=Wp($,n,i,E)),o&&($=Jp($,o,a,E)),D-=M,E&&D<l){var Q=Gi($,K);return nh(e,t,ih,W.placeholder,r,$,Q,s,u,l-D)}var q=d?r:this,te=k?q[e]:e;return D=$.length,s?$=tx($,s):T&&D>1&&$.reverse(),f&&u<D&&($.length=u),this&&this!==xt&&this instanceof W&&(te=B||Ki(te)),te.apply(q,$)}return W}var oh=ih;function lx(e,t,r){var n=Ki(e);function i(){for(var o=arguments.length,a=Array(o),s=o,u=Ol(i);s--;)a[s]=arguments[s];var l=o<3&&a[0]!==u&&a[o-1]!==u?[]:Gi(a,u);if(o-=l.length,o<r)return nh(e,t,oh,i.placeholder,void 0,a,l,void 0,void 0,r-o);var f=this&&this!==xt&&this instanceof i?n:e;return _l(f,this,a)}return i}var cx=lx,fx=1;function dx(e,t,r,n){var i=t&fx,o=Ki(e);function a(){for(var s=-1,u=arguments.length,l=-1,f=n.length,d=Array(f+u),k=this&&this!==xt&&this instanceof a?o:e;++l<f;)d[l]=n[l];for(;u--;)d[l++]=arguments[++s];return _l(k,i?r:this,d)}return a}var px=dx,Jc="__lodash_placeholder__",Ns=1,hx=2,yx=4,Qc=8,xi=128,Yc=256,gx=Math.min;function mx(e,t){var r=e[1],n=t[1],i=r|n,o=i<(Ns|hx|xi),a=n==xi&&r==Qc||n==xi&&r==Yc&&e[7].length<=t[8]||n==(xi|Yc)&&t[7].length<=t[8]&&r==Qc;if(!(o||a))return e;n&Ns&&(e[2]=t[2],i|=r&Ns?0:yx);var s=t[3];if(s){var u=e[3];e[3]=u?Wp(u,s,t[4]):s,e[4]=u?Gi(e[3],Jc):t[4]}return s=t[5],s&&(u=e[5],e[5]=u?Jp(u,s,t[6]):s,e[6]=u?Gi(e[5],Jc):t[6]),s=t[7],s&&(e[7]=s),n&xi&&(e[8]=e[8]==null?t[8]:gx(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}var bx=mx,vx="Expected a function",Xc=1,wx=2,js=8,Cs=16,Us=32,Zc=64,ef=Math.max;function _x(e,t,r,n,i,o,a,s){var u=t&wx;if(!u&&typeof e!="function")throw new TypeError(vx);var l=n?n.length:0;if(l||(t&=~(Us|Zc),n=i=void 0),a=a===void 0?a:ef(Fc(a),0),s=s===void 0?s:Fc(s),l-=i?i.length:0,t&Zc){var f=n,d=i;n=i=void 0}var k=u?void 0:Yp(e),E=[e,t,r,n,i,f,d,o,a,s];if(k&&bx(E,k),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:ef(E[9]-l,0),!s&&t&(js|Cs)&&(t&=~(js|Cs)),!t||t==Xc)var T=N2(e,t,r);else t==js||t==Cs?T=cx(e,t,s):(t==Us||t==(Xc|Us))&&!i.length?T=px(e,t,r,n):T=oh.apply(void 0,E);var B=k?Hp:eh;return rh(B(T,E),e,t)}var Tx=_x;function Ex(e,t,r){t=="__proto__"&&va?va(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var xx=Ex;function Ox(e,t){return e===t||e!==e&&t!==t}var Al=Ox,Ax=Object.prototype,Sx=Ax.hasOwnProperty;function Ix(e,t,r){var n=e[t];(!(Sx.call(e,t)&&Al(n,r))||r===void 0&&!(t in e))&&xx(e,t,r)}var kx=Ix,tf=Math.max;function $x(e,t,r){return t=tf(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=tf(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),_l(e,this,s)}}var ah=$x;function Nx(e,t){return xl(ah(e,t,os),e+"")}var sh=Nx,jx=9007199254740991;function Cx(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=jx}var Sl=Cx;function Ux(e){return e!=null&&Sl(e.length)&&!Gp(e)}var uh=Ux,Px=Object.prototype;function Rx(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Px;return e===r}var Dx=Rx;function Mx(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var Lx=Mx,Bx="[object Arguments]";function Vx(e){return qr(e)&&pi(e)==Bx}var rf=Vx,lh=Object.prototype,Fx=lh.hasOwnProperty,zx=lh.propertyIsEnumerable,qx=rf(function(){return arguments}())?rf:function(e){return qr(e)&&Fx.call(e,"callee")&&!zx.call(e,"callee")},Il=qx;function Kx(){return!1}var Gx=Kx,ch=typeof exports=="object"&&exports&&!exports.nodeType&&exports,nf=ch&&typeof module=="object"&&module&&!module.nodeType&&module,Hx=nf&&nf.exports===ch,of=Hx?xt.Buffer:void 0,Wx=of?of.isBuffer:void 0,Jx=Wx||Gx,uu=Jx,Qx="[object Arguments]",Yx="[object Array]",Xx="[object Boolean]",Zx="[object Date]",eO="[object Error]",tO="[object Function]",rO="[object Map]",nO="[object Number]",iO="[object Object]",oO="[object RegExp]",aO="[object Set]",sO="[object String]",uO="[object WeakMap]",lO="[object ArrayBuffer]",cO="[object DataView]",fO="[object Float32Array]",dO="[object Float64Array]",pO="[object Int8Array]",hO="[object Int16Array]",yO="[object Int32Array]",gO="[object Uint8Array]",mO="[object Uint8ClampedArray]",bO="[object Uint16Array]",vO="[object Uint32Array]",Me={};Me[fO]=Me[dO]=Me[pO]=Me[hO]=Me[yO]=Me[gO]=Me[mO]=Me[bO]=Me[vO]=!0;Me[Qx]=Me[Yx]=Me[lO]=Me[Xx]=Me[cO]=Me[Zx]=Me[eO]=Me[tO]=Me[rO]=Me[nO]=Me[iO]=Me[oO]=Me[aO]=Me[sO]=Me[uO]=!1;function wO(e){return qr(e)&&Sl(e.length)&&!!Me[pi(e)]}var _O=wO;function TO(e){return function(t){return e(t)}}var fh=TO,dh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pi=dh&&typeof module=="object"&&module&&!module.nodeType&&module,EO=Pi&&Pi.exports===dh,Ps=EO&&Fp.process,xO=function(){try{var e=Pi&&Pi.require&&Pi.require("util").types;return e||Ps&&Ps.binding&&Ps.binding("util")}catch{}}(),af=xO,sf=af&&af.isTypedArray,OO=sf?fh(sf):_O,ph=OO,AO=Object.prototype,SO=AO.hasOwnProperty;function IO(e,t){var r=Zt(e),n=!r&&Il(e),i=!r&&!n&&uu(e),o=!r&&!n&&!i&&ph(e),a=r||n||i||o,s=a?Lx(e.length,String):[],u=s.length;for(var l in e)(t||SO.call(e,l))&&!(a&&(l=="length"||i&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||as(l,u)))&&s.push(l);return s}var kO=IO;function $O(e,t){return function(r){return e(t(r))}}var NO=$O,jO=NO(Object.keys,Object),CO=jO,UO=Object.prototype,PO=UO.hasOwnProperty;function RO(e){if(!Dx(e))return CO(e);var t=[];for(var r in Object(e))PO.call(e,r)&&r!="constructor"&&t.push(r);return t}var DO=RO;function MO(e){return uh(e)?kO(e):DO(e)}var hh=MO,LO=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,BO=/^\w*$/;function VO(e,t){if(Zt(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||zn(e)?!0:BO.test(e)||!LO.test(e)||t!=null&&e in Object(t)}var kl=VO,FO=$n(Object,"create"),Hi=FO;function zO(){this.__data__=Hi?Hi(null):{},this.size=0}var qO=zO;function KO(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var GO=KO,HO="__lodash_hash_undefined__",WO=Object.prototype,JO=WO.hasOwnProperty;function QO(e){var t=this.__data__;if(Hi){var r=t[e];return r===HO?void 0:r}return JO.call(t,e)?t[e]:void 0}var YO=QO,XO=Object.prototype,ZO=XO.hasOwnProperty;function eA(e){var t=this.__data__;return Hi?t[e]!==void 0:ZO.call(t,e)}var tA=eA,rA="__lodash_hash_undefined__";function nA(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Hi&&t===void 0?rA:t,this}var iA=nA;function hi(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])}}hi.prototype.clear=qO;hi.prototype.delete=GO;hi.prototype.get=YO;hi.prototype.has=tA;hi.prototype.set=iA;var uf=hi;function oA(){this.__data__=[],this.size=0}var aA=oA;function sA(e,t){for(var r=e.length;r--;)if(Al(e[r][0],t))return r;return-1}var ss=sA,uA=Array.prototype,lA=uA.splice;function cA(e){var t=this.__data__,r=ss(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():lA.call(t,r,1),--this.size,!0}var fA=cA;function dA(e){var t=this.__data__,r=ss(t,e);return r<0?void 0:t[r][1]}var pA=dA;function hA(e){return ss(this.__data__,e)>-1}var yA=hA;function gA(e,t){var r=this.__data__,n=ss(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var mA=gA;function yi(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])}}yi.prototype.clear=aA;yi.prototype.delete=fA;yi.prototype.get=pA;yi.prototype.has=yA;yi.prototype.set=mA;var us=yi,bA=$n(xt,"Map"),Wi=bA;function vA(){this.size=0,this.__data__={hash:new uf,map:new(Wi||us),string:new uf}}var wA=vA;function _A(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var TA=_A;function EA(e,t){var r=e.__data__;return TA(t)?r[typeof t=="string"?"string":"hash"]:r.map}var ls=EA;function xA(e){var t=ls(this,e).delete(e);return this.size-=t?1:0,t}var OA=xA;function AA(e){return ls(this,e).get(e)}var SA=AA;function IA(e){return ls(this,e).has(e)}var kA=IA;function $A(e,t){var r=ls(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var NA=$A;function gi(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])}}gi.prototype.clear=wA;gi.prototype.delete=OA;gi.prototype.get=SA;gi.prototype.has=kA;gi.prototype.set=NA;var cs=gi,jA="Expected a function";function $l(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(jA);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($l.Cache||cs),r}$l.Cache=cs;var CA=$l,UA=500;function PA(e){var t=CA(e,function(n){return r.size===UA&&r.clear(),n}),r=t.cache;return t}var RA=PA,DA=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,MA=/\\(\\)?/g,LA=RA(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(DA,function(r,n,i,o){t.push(i?o.replace(MA,"$1"):n||r)}),t}),BA=LA;function VA(e){return e==null?"":RT(e)}var FA=VA;function zA(e,t){return Zt(e)?e:kl(e,t)?[e]:BA(FA(e))}var fs=zA,qA=1/0;function KA(e){if(typeof e=="string"||zn(e))return e;var t=e+"";return t=="0"&&1/e==-qA?"-0":t}var mo=KA;function GA(e,t){t=fs(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[mo(t[r++])];return r&&r==n?e:void 0}var Nl=GA;function HA(e,t,r){var n=e==null?void 0:Nl(e,t);return n===void 0?r:n}var WA=HA;function JA(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var yh=JA,lf=sr?sr.isConcatSpreadable:void 0;function QA(e){return Zt(e)||Il(e)||!!(lf&&e&&e[lf])}var YA=QA;function gh(e,t,r,n,i){var o=-1,a=e.length;for(r||(r=YA),i||(i=[]);++o<a;){var s=e[o];t>0&&r(s)?t>1?gh(s,t-1,r,n,i):yh(i,s):n||(i[i.length]=s)}return i}var XA=gh;function ZA(e){var t=e==null?0:e.length;return t?XA(e,1):[]}var eS=ZA;function tS(e){return xl(ah(e,void 0,eS),e+"")}var rS=tS;function nS(){this.__data__=new us,this.size=0}var iS=nS;function oS(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var aS=oS;function sS(e){return this.__data__.get(e)}var uS=sS;function lS(e){return this.__data__.has(e)}var cS=lS,fS=200;function dS(e,t){var r=this.__data__;if(r instanceof us){var n=r.__data__;if(!Wi||n.length<fS-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new cs(n)}return r.set(e,t),this.size=r.size,this}var pS=dS;function mi(e){var t=this.__data__=new us(e);this.size=t.size}mi.prototype.clear=iS;mi.prototype.delete=aS;mi.prototype.get=uS;mi.prototype.has=cS;mi.prototype.set=pS;var Do=mi;function hS(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 yS=hS;function gS(){return[]}var mS=gS,bS=Object.prototype,vS=bS.propertyIsEnumerable,cf=Object.getOwnPropertySymbols,wS=cf?function(e){return e==null?[]:(e=Object(e),yS(cf(e),function(t){return vS.call(e,t)}))}:mS,_S=wS;function TS(e,t,r){var n=t(e);return Zt(e)?n:yh(n,r(e))}var ES=TS;function xS(e){return ES(e,hh,_S)}var ff=xS,OS=$n(xt,"DataView"),lu=OS,AS=$n(xt,"Promise"),cu=AS,SS=$n(xt,"Set"),Ln=SS,df="[object Map]",IS="[object Object]",pf="[object Promise]",hf="[object Set]",yf="[object WeakMap]",gf="[object DataView]",kS=kn(lu),$S=kn(Wi),NS=kn(cu),jS=kn(Ln),CS=kn(qi),rn=pi;(lu&&rn(new lu(new ArrayBuffer(1)))!=gf||Wi&&rn(new Wi)!=df||cu&&rn(cu.resolve())!=pf||Ln&&rn(new Ln)!=hf||qi&&rn(new qi)!=yf)&&(rn=function(e){var t=pi(e),r=t==IS?e.constructor:void 0,n=r?kn(r):"";if(n)switch(n){case kS:return gf;case $S:return df;case NS:return pf;case jS:return hf;case CS:return yf}return t});var mf=rn,US=xt.Uint8Array,bf=US,PS="__lodash_hash_undefined__";function RS(e){return this.__data__.set(e,PS),this}var DS=RS;function MS(e){return this.__data__.has(e)}var LS=MS;function wa(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new cs;++t<r;)this.add(e[t])}wa.prototype.add=wa.prototype.push=DS;wa.prototype.has=LS;var mh=wa;function BS(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 VS=BS;function FS(e,t){return e.has(t)}var bh=FS,zS=1,qS=2;function KS(e,t,r,n,i,o){var a=r&zS,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,k=!0,E=r&qS?new mh: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;k=!1;break}if(E){if(!VS(t,function(D,$){if(!bh(E,$)&&(T===D||i(T,D,r,n,o)))return E.push($)})){k=!1;break}}else if(!(T===B||i(T,B,r,n,o))){k=!1;break}}return o.delete(e),o.delete(t),k}var vh=KS;function GS(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var HS=GS;function WS(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var wh=WS,JS=1,QS=2,YS="[object Boolean]",XS="[object Date]",ZS="[object Error]",eI="[object Map]",tI="[object Number]",rI="[object RegExp]",nI="[object Set]",iI="[object String]",oI="[object Symbol]",aI="[object ArrayBuffer]",sI="[object DataView]",vf=sr?sr.prototype:void 0,Rs=vf?vf.valueOf:void 0;function uI(e,t,r,n,i,o,a){switch(r){case sI:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case aI:return!(e.byteLength!=t.byteLength||!o(new bf(e),new bf(t)));case YS:case XS:case tI:return Al(+e,+t);case ZS:return e.name==t.name&&e.message==t.message;case rI:case iI:return e==t+"";case eI:var s=HS;case nI:var u=n&JS;if(s||(s=wh),e.size!=t.size&&!u)return!1;var l=a.get(e);if(l)return l==t;n|=QS,a.set(e,t);var f=vh(s(e),s(t),n,i,o,a);return a.delete(e),f;case oI:if(Rs)return Rs.call(e)==Rs.call(t)}return!1}var lI=uI,cI=1,fI=Object.prototype,dI=fI.hasOwnProperty;function pI(e,t,r,n,i,o){var a=r&cI,s=ff(e),u=s.length,l=ff(t),f=l.length;if(u!=f&&!a)return!1;for(var d=u;d--;){var k=s[d];if(!(a?k in t:dI.call(t,k)))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;){k=s[d];var D=e[k],$=t[k];if(n)var F=a?n($,D,k,t,e,o):n(D,$,k,e,t,o);if(!(F===void 0?D===$||i(D,$,r,n,o):F)){B=!1;break}W||(W=k=="constructor")}if(B&&!W){var K=e.constructor,M=t.constructor;K!=M&&"constructor"in e&&"constructor"in t&&!(typeof K=="function"&&K instanceof K&&typeof M=="function"&&M instanceof M)&&(B=!1)}return o.delete(e),o.delete(t),B}var hI=pI,yI=1,wf="[object Arguments]",_f="[object Array]",So="[object Object]",gI=Object.prototype,Tf=gI.hasOwnProperty;function mI(e,t,r,n,i,o){var a=Zt(e),s=Zt(t),u=a?_f:mf(e),l=s?_f:mf(t);u=u==wf?So:u,l=l==wf?So:l;var f=u==So,d=l==So,k=u==l;if(k&&uu(e)){if(!uu(t))return!1;a=!0,f=!1}if(k&&!f)return o||(o=new Do),a||ph(e)?vh(e,t,r,n,i,o):lI(e,t,u,r,n,i,o);if(!(r&yI)){var E=f&&Tf.call(e,"__wrapped__"),T=d&&Tf.call(t,"__wrapped__");if(E||T){var B=E?e.value():e,W=T?t.value():t;return o||(o=new Do),i(B,W,r,n,o)}}return k?(o||(o=new Do),hI(e,t,r,n,i,o)):!1}var bI=mI;function _h(e,t,r,n,i){return e===t?!0:e==null||t==null||!qr(e)&&!qr(t)?e!==e&&t!==t:bI(e,t,r,n,_h,i)}var Th=_h,vI=1,wI=2;function _I(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 Do;if(n)var k=n(l,f,u,e,t,d);if(!(k===void 0?Th(f,l,vI|wI,n,d):k))return!1}}return!0}var TI=_I;function EI(e){return e===e&&!wr(e)}var Eh=EI;function xI(e){for(var t=hh(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Eh(i)]}return t}var OI=xI;function AI(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var xh=AI;function SI(e){var t=OI(e);return t.length==1&&t[0][2]?xh(t[0][0],t[0][1]):function(r){return r===e||TI(r,e,t)}}var II=SI;function kI(e,t){return e!=null&&t in Object(e)}var $I=kI;function NI(e,t,r){t=fs(t,e);for(var n=-1,i=t.length,o=!1;++n<i;){var a=mo(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&&Sl(i)&&as(a,i)&&(Zt(e)||Il(e)))}var jI=NI;function CI(e,t){return e!=null&&jI(e,t,$I)}var Oh=CI,UI=1,PI=2;function RI(e,t){return kl(e)&&Eh(t)?xh(mo(e),t):function(r){var n=WA(r,e);return n===void 0&&n===t?Oh(r,e):Th(t,n,UI|PI)}}var DI=RI;function MI(e){return function(t){return t?.[e]}}var LI=MI;function BI(e){return function(t){return Nl(t,e)}}var VI=BI;function FI(e){return kl(e)?LI(mo(e)):VI(e)}var zI=FI;function qI(e){return typeof e=="function"?e:e==null?os:typeof e=="object"?Zt(e)?DI(e[0],e[1]):II(e):zI(e)}var KI=qI;function GI(e){return qr(e)&&uh(e)}var HI=GI;function WI(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 JI=WI,QI=200;function YI(e,t,r,n){var i=-1,o=th,a=!0,s=e.length,u=[],l=t.length;if(!s)return u;r&&(t=qp(t,fh(r))),n?(o=JI,a=!1):t.length>=QI&&(o=bh,a=!1,t=new mh(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 k=l;k--;)if(t[k]===d)continue e;u.push(f)}else o(t,d,n)||u.push(f)}return u}var XI=YI;function ZI(e,t,r,n){if(!wr(e))return e;t=fs(t,e);for(var i=-1,o=t.length,a=o-1,s=e;s!=null&&++i<o;){var u=mo(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=wr(f)?f:as(t[i+1])?[]:{})}kx(s,u,l),s=s[u]}return e}var ek=ZI;function tk(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var a=t[n],s=Nl(e,a);r(s,a)&&ek(o,fs(a,e),s)}return o}var rk=tk,nk=32,jl=sh(function(e,t){var r=Gi(t,Ol(jl));return Tx(e,nk,void 0,t,r)});jl.placeholder={};var ik=jl;function ok(e,t){return rk(e,t,function(r,n){return Oh(e,n)})}var ak=ok,sk=rS(function(e,t){return e==null?{}:ak(e,t)}),Ef=sk,uk=4294967295,lk=uk-1,ck=Math.floor,fk=Math.min;function dk(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=zn(t),l=t===void 0;i<o;){var f=ck((i+o)/2),d=r(e[f]),k=d!==void 0,E=d===null,T=d===d,B=zn(d);if(a)var W=n||T;else l?W=T&&(n||k):s?W=T&&k&&(n||!E):u?W=T&&k&&!E&&(n||!B):E||B?W=!1:W=n?d<=t:d<t;W?i=f+1:o=f}return fk(o,lk)}var pk=dk;function hk(e,t,r){return pk(e,t,KI(r,2))}var yk=hk,gk=1/0,fC=Ln&&1/wh(new Ln([,-0]))[1]==gk?function(e){return new Ln(e)}:Qp,mk=sh(function(e,t){return HI(e)?XI(e,t):[]}),xf=mk,Ah=xr(sT(),1),dC=Ah.default.configure,Ji=Ah.default,Ds=100,{WARN:bk,LOG:pC,DEBUG:Xe,VERBOSE:Ee,ERROR:hC}=Ae.setup(Ae.INFO),_a=Be.set();U_({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})=>Le(()=>(n=n||r,`${!Array.isArray(t)&&t?.name?t.name+" | ":""}${e??"caller?"}${n?`{${typeof n=="string"?n:Ji(n)}}`:""}`));function vk(e,t){return Le(()=>Je.structural(e.get(),t.get()))}function bo(e,t){return Je.shallow(e.applogs,t.applogs)}function Cl(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(!bo(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 wk=0;function Ht(e,{name:t,equals:r}={}){let n=`observableArrayMap@${++wk}{${t}}`;Ee.isEnabled&&Ee(`[${n}] create`,{fnname:e.name,fn:e,name:t,equals:r});let i,o=Sh(e,s=>{i?Le(()=>(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:ca(i)}),Fi(()=>_a.add(a))}return Ee.isEnabled&&pl(i,()=>{Ee(`[${n}] observed`,ca(i),{rootsAtom:a,observableArr:i})}),Sn(i,()=>{Ee.isEnabled&&Ee(`[${n}] dispose`),a&&Fi(()=>_a.delete(a)),o()}),i}var _k=0;function Tk(e,{name:t}={}){let r=`observableSetMap@${++_k}{${t}}`;Ee.isEnabled&&Ee(`[${r}] create`,{fnname:e.name,fn:e,name:t});let n,i=Sh(e,a=>{if(!n)n=Be.set(a,{deep:!1,name:t});else{let{deleted:s,added:u}=Le(()=>{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:ca(n)}),Fi(()=>_a.add(o))}return Ee.isEnabled&&pl(n,()=>{Ee(`[${r}] observed`,ca(n),{rootsAtom:o,observableSet:n})}),Sn(n,()=>{Ee.isEnabled&&Ee(`[${r}] dispose`),o&&Fi(()=>_a.delete(o)),i()}),n}function Sh(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=Ds&&performance.now();Xe.isEnabled&&Xe(`[${n}] runAndTrack:`,{name:r??e.name,fn:e}),i=e(),Xe.isEnabled&&Xe(`[${n}] runAndTrack =>`,i),Fi(()=>{t?.(i)}),Ds&&performance.now()-s>Ds&&bk(`[${n}] took ${performance.now()-s}ms`)})}return a(),Xe.isEnabled&&Xe(`[${n}] deps of reaction`,{reaction:o,result:i,deps:rs(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=Le(()=>{let E=s;for(let T=0;T<s.length;T++)s[T]instanceof qn&&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(xk(E,l)){u=T;break}else if(Ee.isEnabled)for(let B=0;B<E.length;B++)E[B]instanceof qn&&E[B].name===s[B].name&&Je.structural(xf(E,E[B]),xf(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&&!u_())return!n&&p_().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,k=Fe(()=>(Ee.isEnabled&&Ee(`[${f}] update->rerun`,Le(()=>({args:s})),t),Ee.isEnabled&&Ip(),d=t.apply(this,s)),{...o,name:f});if(Ee.isEnabled&&Ee(`[${f}] deps`,rs(k),{untrackedArgs:l}),a.set(l,k),!o.keepAlive){let E=Sn(k,()=>{Ee.isEnabled&&Ee(`[${f}] dispose`,k),E(),a.delete(l),o.onCleanup&&o.onCleanup(d,...s),d=void 0})}return k.get()}}function Ek(e){let t=0,r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("?r+=o+`
|
|
57
57
|
`+" ".repeat(++t):o===")"?r+=`
|
|
58
58
|
`+" ".repeat(--t)+o:o===","&&n===0?r+=o+`
|
|
59
59
|
`+" ".repeat(t):o==="{"&&n===0?(n++,r+=o+`
|
|
60
60
|
`+" ".repeat(t+1)):o==="}"&&n===1?(n--,r+=`
|
|
61
|
-
`+" ".repeat(t)+o):o==="{"&&n>0?(n++,r+=o):(o==="}"&&n>1&&n--,r+=o)}return r}function Ok(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:xf,LOG:yC,DEBUG:xk,VERBOSE:gC,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,Le(()=>this.parents?.length===0)&&xf("[Thread] empty parents array",e),i.skipObservable||li(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):xf("unsubscribe called for non-existent",e)}notifySubscribers(e){xk(`[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 Le(()=>this.size)}get nameAndSizeUntracked(){return Le(()=>`${this.name} (${this.size})`)}get prettyName(){return Ek(this.name)}get hasParents(){return!!this.parents?.length}},Ak=class Ih extends zn{static fromArray(t,r){return new Ih(r||"static",null,[],t)}constructor(t,r,n,i){super(t,r,n,i,{skipObservable:!0})}get readOnly(){return!0}},Sk={};ei(Sk,{code:()=>$h,decode:()=>Pl,encode:()=>Ul,format:()=>Af,name:()=>Bk,parse:()=>Fk,stringify:()=>Af});var Ik=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=xd(JSON.stringify(t.value));e.push(r.length>32?Ba(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 kk(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 $k={addBreakTokens:!0,mapSorter:kk};function Nk(e,t){return t=Object.assign({},$k,t),Bd(e,new Ik,t)}var kh=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,Av(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 jk(e,t){return t=Object.assign({tokenizer:new kh(e,t)},t),N0(e,t)}function Ck(e){return e instanceof ArrayBuffer?new Uint8Array(e,0,e.byteLength):e}function Uk(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Ka.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=sl.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 Pk(e){return Ta(new Uint8Array(e))}function Rk(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Dk(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 Mk={typeEncoders:{Object:Uk,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:Pk,undefined:Rk,number:Dk}},Lk=class extends kh{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=sl.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]=Ka.parse;var Bk="dag-json",$h=297,Ul=e=>Nk(e,Mk),Pl=e=>{let t=Ck(e),r=Object.assign(du,{tokenizer:new Lk(t,du)});return jk(t,r)},Af=e=>Vk.decode(Ul(e)),Vk=new TextDecoder,Fk=e=>Pl(zk.encode(e)),zk=new TextEncoder,Mo=xr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),mC=xr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),bC=xr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),vC=xr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),wC=xr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),_C=xr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),TC=xr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),EC=xr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),OC=xr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Pr=Ga({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),xC=Ga({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Nh={};ei(Nh,{Digest:()=>ps,create:()=>Rl,decode:()=>Ch,equals:()=>Uh,hasCode:()=>u$});var qk=jh,Sf=128,Kk=127,Gk=~Kk,Hk=Math.pow(2,31);function jh(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Hk;)t[r++]=e&255|Sf,e/=128;for(;e&Gk;)t[r++]=e&255|Sf,e>>>=7;return t[r]=e|0,jh.bytes=r-n+1,t}var Wk=pu,Jk=128,If=127;function pu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw pu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&If)<<i:(a&If)*Math.pow(2,i),i+=7}while(a>=Jk);return pu.bytes=o-n,r}var Qk=Math.pow(2,7),Yk=Math.pow(2,14),Xk=Math.pow(2,21),Zk=Math.pow(2,28),e$=Math.pow(2,35),t$=Math.pow(2,42),r$=Math.pow(2,49),n$=Math.pow(2,56),i$=Math.pow(2,63),o$=function(e){return e<Qk?1:e<Yk?2:e<Xk?3:e<Zk?4:e<e$?5:e<t$?6:e<r$?7:e<n$?8:e<i$?9:10},a$={encode:qk,decode:Wk,encodingLength:o$},s$=a$,Ea=s$;function hu(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 Rl(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 ps(e,r,t,o)}function Ch(e){let t=al(e),[r,n]=hu(t),[i,o]=hu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new ps(r,i,a,t)}function Uh(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Bw(e.bytes,r.bytes)}}var ps=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function u$(e,t){return e.code===t}function kf(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return c$(r,yu(e),t??Pr.encoder);default:return f$(r,yu(e),t??Mo.encoder)}}var $f=new WeakMap;function yu(e){let t=$f.get(e);if(t==null){let r=new Map;return $f.set(e,r),r}return t}var or=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!==xi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==d$)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=Rl(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&&Uh(t.multihash,n.multihash)}toString(t){return kf(this,t)}toJSON(){return{"/":kf(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??Nf(n,i,o.bytes))}else if(r[p$]===!0){let{version:n,multihash:i,code:o}=r,a=Ch(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!==xi)throw new Error(`Version 0 CID must use dag-pb (code: ${xi}) block encoding`);return new lt(t,r,n,n.bytes)}case 1:{let i=Nf(t,r,n.bytes);return new lt(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return lt.create(0,xi,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=al(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 ps(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,k]=hu(t.subarray(r));return r+=k,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]=l$(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 yu(o).set(n,t),o}};function l$(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 Mo.prefix:{let r=t??Mo;return[Mo.prefix,r.decode(e)]}case Co.prefix:{let r=t??Co;return[Co.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 c$(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 f$(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,d$=18;function Nf(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 p$=Symbol.for("@ipld/js-cid/CID"),h$=20;function Ph({name:e,code:t,encode:r,minDigestLength:n,maxDigestLength:i}){return new y$(e,t,r,n,i)}var y$=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,r,n,i){this.name=e,this.code=t,this.encode=r,this.minDigestLength=n??h$,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?jf(r,this.code,t?.truncate):r.then(n=>jf(n,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};function jf(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 Rl(t,e)}var et=Or(Gr(),1),Rh=Or(dT(),1),Cf=e=>et.Type.Union([e,et.Type.Null()]),Dh=/^(k51qz|baguq)[0-9a-z]{56,57}$/,g$=/^[0-9A-Fa-f]{7,8}$/g;et.FormatRegistry.Set("EntityID",e=>!!e.match(g$)||!!e.match(Dh));var m$=et.Type.String(),gu=e=>e?.enc instanceof Uint8Array;et.FormatRegistry.Set("CID",e=>!!e.match(Dh));var Mh=et.Type.String({format:"CID"}),b$=/^http([s]?):\/\/.*\..*/;et.FormatRegistry.Set("URL",e=>!!e.match(b$));var AC=et.Type.String({format:"URL"}),Lh=et.Type.Object({en:m$,at:et.Type.String(),vl:Cf(et.Type.Union([et.Type.String(),et.Type.Boolean(),et.Type.Number()])),ts:et.Type.String(),ag:et.Type.String(),pv:Cf(Mh)}),Uf=Rh.TypeCompiler.Compile(Lh),SC=Uf.Check.bind(Uf),v$=et.Type.Composite([et.Type.Object({cid:Mh}),Lh]),mu=Rh.TypeCompiler.Compile(v$),w$=e=>Array.from(mu.Errors(e)),Bh=mu.Check.bind(mu);function Vh(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var _$=Ph({name:"sha2-256",code:18,encode:Vh("SHA-256")}),IC=Ph({name:"sha2-512",code:19,encode:Vh("SHA-512")}),{WARN:Pf,LOG:kC,DEBUG:T$,VERBOSE:Aa,ERROR:Fh}=Ae.setup(Ae.INFO),E$=114;function O$(e,t=["cid"]){if(!e)throw Fh("falsy log",e);let r=e.cid;if(gu(e))return r||(r=Dl(zh(e).bytes).toString()),Pf("preparing an encrypted applog - really?"),{log:e,cid:r};let n={};for(let[i,o]of Object.entries(e))o===void 0&&(Pf(`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 x$(e){return Dl(A$(e).bytes)}function A$(e){return zh(O$(e)?.log)}function Dl(e){let t=Lw(e),r=Nh.create(_$.code,t),n=or.create(1,$h,r);return Aa("[getCidSync]",{bytes:e,hash:t,digest:r,cid:n}),n}function zh(e){T$("[encodeBlock]",e);try{let t=Ul(e);return{bytes:t,cid:Dl(t)}}catch(t){throw Fh("[encodeBlock] failed to encode:",e,t)}}function S$(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,Co)}catch(n){Aa("[retrieveThread] couldn't parse pubID with base36"),r.push(n)}return{cid:t,errors:t?null:r,isIpns:t&&Ml(t)}}function Ml(e){return e.code===E$}function bu(e){return typeof e=="string"?or.parse(e):typeof e.toV1!="function"?or.decode(e.bytes):e}function qh(e,t){if(!e||!t)throw new Error(`[areCidsEqual] invalid params: ${e}, ${t}`);if(e===t)return!0;let r=bu(e),n=bu(t);return r.toV1().toString()===n.toV1().toString()}function Rf(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 I$(e,t){let r=Rf(e),n=Rf(t);return+r<+n}var{WARN:k$,LOG:$C,DEBUG:NC,VERBOSE:Sa,ERROR:Ia}=Ae.setup(Ae.INFO),$$=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),Kh=(e,t,r)=>Je.structural(Ef(t,e),Ef(r,e)),N$=(e,t,r="asc")=>$$(e.ts,t.ts,r),jC=ik(Kh,["en","at"]);function Qi(e,t="asc"){return e.sort((r,n)=>N$(r,n,t))}var j$=(e,t)=>I$(new Date(e.ts),new Date(t.ts)),C$=()=>{k$("[removeDuplicateAppLogs] mode not set; pass 'safety' or 'cleanup' for optimal behavior")},Df=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())},U$=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},Gh=(e,t)=>t?t==="safety"?U$(e):Df(e):(C$(),Df(e));function P$(e){return typeof e=="string"&&e.startsWith("?")}function R$(e){return e.slice(1)}function Hh(e,t){let r={},n={};for(let[i,o]of Object.entries(e))if(P$(o)){let a=R$(o),s=t[a];s?n[i]=s:r[i]=a}else n[i]=o;return[n,r]}function D$(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 Wh=function(e){for(var t=0,r=0,n=e.length;r<n;r++)t+=e[r];return t},Mf=function(e){return Wh(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:Wh,mean:Mf,average:Mf,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 Jh(){return new Date().toISOString()}var{WARN:M$,LOG:CC,DEBUG:Ge,VERBOSE:UC,ERROR:ka}=Ae.setup(Ae.INFO);function L$(e,t){Ge(`[ensureTsPvAndFinalizeApplogs] ENTER - ${e.length} applogs, thread size=${t.size}`);let r=Jh(),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=B$(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 B$(e,{ts:t,threadForPv:r}={}){Ge(`[finalizeApplogForInsert] ENTER - en=${e.en}, at=${e.at}`),Ge("[finalizeApplogForInsert] About to call withTs");let n=z$(e,t??Jh());Ge(`[finalizeApplogForInsert] About to call withPvFrom (thread size=${r?.size??"null"})`);let i=q$(n,r);Ge("[finalizeApplogForInsert] About to call encodeApplogAndGetCid");let o=x$(i).toString();Ge(`[finalizeApplogForInsert] CID created: ${o}`),e.cid&&e.cid!==o&&M$("[finalizeApplogForInsert] overwriting wrong CID",{log:e,cid:o,logWithPv:i});let a={...i,cid:o};if(Ge("[finalizeApplogForInsert] About to validate applog"),!Bh(a))throw ka(`Bogus Applog ${JSON.stringify(a)}`,w$(a));return Ge(`[finalizeApplogForInsert] EXIT - CID=${o}`),Object.freeze(a)}function V$(e){return!!e.ts}function F$(e){return!!e.pv}function z$(e,t){return V$(e)?e:{...e,ts:t}}function q$(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"),Kh(["en","at","vl","ts","ag"],e,i))throw ka("[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(!F$(e))throw ka("[withPvFrom] no thread and no pv:",e);return Ge("[withPvFrom] EXIT - no thread, returning log with existing pv"),e}}function vu(e){let t=()=>(Le(()=>e.length<2&&Ge(`joinThreads with count=${e.length}`)),Qi(Gh(e.flatMap(i=>{let o=i.applogs;if(!o)throw ka("falsy applogs of thread",i),new Error("falsy applogs of thread");return o}),"cleanup"))),r=Le(()=>t()),n=Ct(function(i,o){return Kr(i)?{init:Le(()=>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 hs(Le(()=>`join(~ ${e.map(i=>i.name).join(", ")})`),e,["?"],r,n)}var{WARN:Lf,LOG:PC,DEBUG:Bf,VERBOSE:tn,ERROR:Io}=Ae.setup(Ae.INFO),hs=class wu 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,li(this,{onParentUpdate:Ct}),o&&this.subscribeToParents()}static mapWrites(t,r,n){return new wu(`${r}<${t.nameAndSizeUntracked}>`,t,t.filters,t._applogs,null,n)}static asReadOnly(t){return t.readOnly?t:new wu(`readOnly(${t.name})`,t,t.filters,t._applogs,null,null,!0)}_parentSubscriptions=null;insert(t){if(this.readOnly)throw Io("[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 Io("[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=Dt(()=>{this.parents.length||Lf("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 Io("triggerRemap on a thread that is not actually mapping?!",this.nameAndSizeUntracked);Bf(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.length!==1&&Lf(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap with parentCount=${this.parents.length} - not meant for this`),this.parents.forEach(t=>{this.onParentUpdate(t,{init:Le(()=>br(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(yk(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))Bf("Ignoring remove event for non-existent because it was part of parent event's removed",i,r);else throw Io(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,i,{thread:this,event:r,mapResult:n})}}tn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,ns(this._applogs)),this.notifySubscribers(n)}get readOnly(){return this._readOnly??!1}},{WARN:RC,LOG:DC,DEBUG:MC,VERBOSE:Ls,ERROR:K$}=Ae.setup(Ae.INFO),qn=tt("rollingFilter",function(e,t,r={}){let n=H$(t),i=Vf(n),o=Be.array(Le(function(){return i(e.applogs)}),{deep:!1,name:`${e.name} | ${r.name||`rollingFilter.array{${Ji(n)}}`}`}),a=f=>{let d;return Kr(f)?d={init:i(f.init)}:d={added:i(f.added),removed:f.removed},Ls(`rollingFilter{${e.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,n,f,"=>",d),d},s=new hs(`${e.name} | ${r.name||`rollingFilter{${Ji(n)}}`}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],o,a),u=I_(()=>br(t),f=>{Ls(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,n,"=>",f),n=f,i=Vf(n),s.triggerRemap()}),l=ui(o,()=>{Ls(`rollingFilter<${Le(()=>e.name)}>${r.name?` '${r.name}'`:""} unobserve`,n),u(),l()});return s},{equals:bo,argsDebugName:(e,t,r)=>We({caller:"rollingFilter",thread:e,pattern:t,args:r})}),G$=tt("rollingMapper",function(e,t,r={}){let n=Le(()=>t.call(null,{init:e.applogs},e));if(!Kr(n))throw K$("Initial run must return init event");let i=n.init;return new hs(`${e.name} | ${r.name||"rollingMapper"}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],i,t)},{equals:bo,argsDebugName:(e,t,r)=>We({caller:"rollingMapper",thread:e,args:r})}),LC=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}`:""}}`}),H$=function(e){let t=Le(function(){return Object.fromEntries(Object.entries(br(e)).map(([r,n])=>[br(r),br(n)]))});if(!Object.entries(t).length)throw new Error("Pattern is empty");return t};function Vf(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(!D$(n,i,o))return!1}return!0})}}var BC=hs.asReadOnly,{WARN:W$,LOG:J$,DEBUG:Ke,VERBOSE:Qh,ERROR:Lo}=Ae.setup(Ae.INFO),Q$=class extends zn{constructor(e,t=[],r){super(e,null,r,t),li(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){Ke(`[WriteableThread.insert] ENTER - ${e.length} applogs for thread "${this.name}"`),Ke("[WriteableThread.insert] About to call ensureTsPvAndFinalizeApplogs");let t=L$(e,this);Ke(`[WriteableThread.insert] ensureTsPvAndFinalizeApplogs completed, mapped=${t.length} applogs`),Ke("[WriteableThread.insert] About to call insertRaw");let r=this.insertRaw(t);return Ke("[WriteableThread.insert] insertRaw completed"),r}insertMissing(e,t=!1){let r=e.filter(n=>!this.hasApplog(n,t));return r.length===0?(Qh("[insertMissing] no missing applogs"),[]):this.insertRaw(r)??[]}insertRaw(e){Ke(`[WriteableThread.insertRaw] ENTER - ${e.length} applogs for thread "${this.name}"`),Ke("[WriteableThread.insertRaw] About to deduplicate");let t=Gh(e,"safety");if(t.length!==e.length)throw Lo(`[insertRaw] duplicate applogs passed: ${e.length-t.length}`,{appLogsToInsert:e,deduplicated:t});Ke("[WriteableThread.insertRaw] Deduplication done"),Ke("[WriteableThread.insertRaw] About to validate");let r=e.filter(o=>!Bh(o));if(r.length)throw Lo(`[insertRaw] bogus applogs passed: ${r.length}`,{bogus:r});Ke("[WriteableThread.insertRaw] Validation done"),Ke("[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(Ke("[WriteableThread.insertRaw] Existing check done"),!e.length){W$("[insertRaw] skipping empty insert empty logs array");return}(!this.hasParents&&!(this instanceof vo)?J$:Ke)("Inserting:",e.length===1?e[0]:e,{ds:this}),Ke("[WriteableThread.insertRaw] About to sort applogs"),Qi(e);let i=this._applogs.length&&j$(e[0],this._applogs[this._applogs.length-1]);return Ke("[WriteableThread.insertRaw] About to push to _applogs array"),this._applogs.push(...e),i&&(Ke("[WriteableThread.insertRaw] About to sort _applogs (sortNeeded=true)"),Qi(this._applogs)),Ke("[WriteableThread.insertRaw] About to notify subscribers"),this.notifySubscribers({added:e,removed:null}),Ke("[WriteableThread.insertRaw] Subscribers notified"),Ke("[WriteableThread.insertRaw] About to call persist (void - not awaited)"),this.persist(e),Ke(`[WriteableThread.insertRaw] EXIT - returning ${e.length} applogs`),e}get readOnly(){return!1}},vo=class Bo extends Q${constructor(t,r,n,i){super(t,r,n),this._readOnly=i,li(this,{_applogs:Be.shallow})}static empty(t){return Bo.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new Bo(r??"in-memory",t,[],n)}static fromReadOnlyArray(t,r){return new Bo(r??"in-memory",t,[],!0)}get readOnly(){return this._readOnly}async persist(t){if(Qh("[InMem.persist] no persist for",t),this.readOnly)throw Lo("[persist] called for readOnly thread")}},{WARN:VC,LOG:FC,DEBUG:zC,VERBOSE:qC,ERROR:KC}=Ae.setup(Ae.INFO),{WARN:GC,LOG:HC,DEBUG:WC,VERBOSE:JC,ERROR:QC}=Ae.setup(Ae.INFO),Y$=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=r,li(this,{threadOfTrail:He})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?vu([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},Yh=class{constructor(e){this.nodes=e,li(this,{threadOfAllTrails:He,size:He,isEmpty:He})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return Le(()=>this.records.length)}get records(){return Ht(()=>this.nodes.map(({variables:e})=>e),{name:"QueryResult.records"})}get leafNodeThread(){return vu(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 vu(Ht(()=>this.nodes.map(e=>e.threadOfTrail),{name:"QueryResult.threadOfAllTrails"}))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},{WARN:YC,LOG:ys,DEBUG:_r,VERBOSE:Se,ERROR:cn}=Ae.setup(Ae.INFO,{prefix:"[q]"}),Bs=null,XC=tt("lastWriteWins",function(e,{inverseToOnlyReturnFirstLogs:t,tolerateAlreadyFiltered:r}={}){if(Se(`lastWriteWins${t?".inversed":""} < ${e.nameAndSizeUntracked} > initializing`),e.filters.includes("lastWriteWins")){if(r)return _r("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),e;throw cn("thread already filtered lastWriteWins:",e.filters,{name:e.name})}let n,i=G$(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 k=t?0:u.length-1;t?k<u.length:k>=0;t?k++:k--){let E=u[k],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:k,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 Qi(l),Se.isDisabled||Se(`lastWriteWins${t?".inversed":""}<${e.nameAndSizeUntracked}> mapped event`,s?{...Object.fromEntries(Object.entries(o).map(([k,E])=>[k,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||Dt(()=>{Se(`lastWriteWins<${e.nameAndSizeUntracked}> filtered down to`,i.applogs.length)}),i},{equals:bo,argsDebugName:e=>We({caller:"lastWriteWins",thread:e})}),ZC=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=qn(e,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});Se.isEnabled&&Se(`withoutDeleted<${e.nameAndSizeUntracked}> deletionLogs:`,Le(function(){return[...t.applogs]}));let r=We({caller:"allDeletedEntities",thread:e}),n=Tk(function(){return t.map(i=>i.en)},{name:r});return Se.isEnabled&&Dt(()=>{Se(`withoutDeleted<${e.nameAndSizeUntracked}> deleted:`,[...n])}),qn(e,{"!en":n},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:bo}),Xh=tt("query",function e(t,r,n={},i={}){oN();let o=Zh(t);_r(`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=X$(o,s,u,i);return Se.isDisabled||Dt(()=>Se("query result:",br(l))),l},{equals:Cl,argsDebugName:(e,t,r)=>We({caller:"query",thread:e,args:r?{pattern:t,startVars:r}:t})}),X$=tt("queryStep",function(e,t,r,n={}){if(_r(`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]=Hh(r,a?.variables??{});Se("[queryStep.doQuery] patternWithoutVars: ",s);let l=qn(e,s),f=gs(u),d=Ht(function(){let k=l.map(E=>({log:E,vars:f(E)}));return Se.isEnabled&&Se("[queryStep.doQuery] step node:",a?.variables," =>",k,"from:",Le(()=>l.applogs)),k.map(({log:E,vars:T})=>{let B=Object.assign({},a?.variables,T);return new Y$(Ak.fromArray([E],We({caller:"QueryNode",thread:l,pattern:`${Ji(B)}@${Ji(s)}`})),B,a)})},{name:We({caller:"doQuery.mapNodes",thread:l,pattern:r})});return Se.isEnabled&&Dt(()=>Se("[queryStep.doQuery] resultNodes:",[...d])),n.debug&&ys("[queryStep] step result:",Le(()=>d.map(({variables:k,logsOfThisNode:E})=>({variables:k,thread:E})))),d}let o=Ht(function(){return _r(`[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&&Dt(()=>Se("[queryStep] observableResultNodes:",[...o])),new Yh(o)},{equals:Cl,argsDebugName:(e,t,r)=>We({caller:"queryStep",thread:e,pattern:r})}),e5=tt("queryNot",function(e,t,r,n={}){let i=t.nodes;_r(`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]=Hh(a,s??{});Se("[queryNot] patternWithoutVars: ",u);let f=qn(e,u);return Se("[queryNot] step node:",s," =>",f.size,"applogs"),Se.isDisabled||Se("[queryNot] step node:",s," => empty?",Le(()=>f.applogs)),n.debug&&ys("[queryNot] node result:",s,"=>",f.applogs),f.isEmpty})}return new Yh(i)},{equals:Cl,argsDebugName:(e,t,r)=>We({caller:"queryNot",thread:e,pattern:r})}),t5=tt("filterAndMap",function(e,t,r){_r(`filterAndMap<${e.nameAndSizeUntracked}>`,t);let n=qn(e,t);Se.isEnabled&&(Se("[filterAndMap] filtered:",n.untrackedSize),Dt(()=>Se("[filterAndMap] filtered:",n.applogs)));let i=We({thread:e,pattern:t,caller:"filterAndMap"}),o=Ht(()=>tN(n,r),{name:i});return Se.isDisabled||Dt(()=>Se("[filterAndMap] mapped:",o)),o},{equals:Je.structural,argsDebugName:(e,t)=>We({caller:"filterAndMap",thread:e,pattern:t})}),r5=tt("queryAndMap",function(e,t,r,n={}){let i=Zh(e);_r(`queryAndMap<${i.nameAndSizeUntracked}>`,{patternOrPatterns:t,variables:n,map:r});let o=We({thread:i,caller:"queryAndMap"}),a=Xh(i,t);Se("[queryAndMap] filtered count:",a.untrackedSize);let s=Ht(()=>rN(a,r),{name:o});return Se.isDisabled||Dt(()=>Se("[queryAndMap] result:",br(s))),s},{equals:Je.structural,argsDebugName:(e,t)=>We({caller:"queryAndMap",thread:e,pattern:t})}),n5=tt("queryEntity",function(e,t,r,n){_r(`queryEntity<${e.nameAndSizeUntracked}>`,r,t);let i=qn(e,{en:r,at:nN(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:vk,argsDebugName:(e,t,r)=>We({caller:"queryEntity",thread:e,args:{name:t,entityID:r}})}),i5=tt("agentsOfThread",function(e){_r(`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)}ys(`agentsOfThread<${e.nameAndSizeUntracked}> processed event`,{event:i,mapped:t})});r({init:e.applogs});let n=e.subscribe(r);return rs(t,n),t}),Z$=tt("entityOverlap",function(e,t){return ys(`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))})}),o5=tt("entityOverlapCount",function(e,t){return He(()=>Z$(e,t).get().length)}),eN=tt("querySingle",function(e,t,r={}){let n=Xh(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})}),a5=tt("querySingleAndMap",function(e,t,r,n={}){let i=eN(e,t,n);return He(()=>{let o=i.get();if(o)return typeof r=="string"?o[r]:gs(r)(o)})},{equals:Je.structural,argsDebugName:(e,t)=>We({caller:"querySingleAndMap",thread:e,pattern:t})}),tN=function(e,t){return typeof t=="function"?e.map(t):typeof t=="string"?e.map(r=>r[t]):e.map(gs(t))},rN=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=>gs(t)(e))};function gs(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function nN(e,t){return t.map(r=>iN(e,r))}function iN(e,t){return`${e}/${t}`}function Zh(e,t){return Array.isArray(e)?vo.fromArray(e,t||`threadFromArray[${e.length}]`,!0):e}function oN(){if(Bs!=null&&performance.now()>=Bs)throw new aN(Bs)}var aN=class extends Error{constructor(e){super(e)}},sN=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}}}),uN=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,k=o.length;do{if(f>=k||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}}}),lN=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:sN(),decode:uN(),encodingLength:lN()}}}),ey=42;function cN(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Ka.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new ne(I.tag,ey),new ne(I.bytes,r)]}function fN(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function dN(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 pN(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 Ff={float64:!0,typeEncoders:{Map:pN,Object:cN,undefined:fN,number:dN}},s5={...Ff,typeEncoders:{...Ff.typeEncoders}};function hN(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Ka.decode(e.subarray(1))}var _u={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};_u.tags[ey]=hN;var u5={..._u,tags:_u.tags.slice()},l5=Or(Ll(),1),Lr={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)":Lr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Lr.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:Lr.Int,CarV1HeaderOrV2Pragma:e=>{if(Lr.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}},Ni={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Lr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Lr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Ni["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Ni["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Lr.Int,CarV1HeaderOrV2Pragma:e=>{if(Lr.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=Ni["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=Ni.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}},c5={toTyped:$i.CarV1HeaderOrV2Pragma,toRepresentation:Ni.CarV1HeaderOrV2Pragma},f5=Dd(),d5=Or(Ll(),1),p5=[new ne(I.map,2),new ne(I.string,"version"),new ne(I.uint,1),new ne(I.string,"roots")],h5=new ne(I.tag,42),y5=Or(Ll(),1),{WARN:ty,LOG:g5,DEBUG:Vs,VERBOSE:Bl,ERROR:Cn}=Ae.setup(Ae.INFO);async function yN(e){let t=await mN(e);return await gN(t)}async function gN({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(Bl("[decodePubFromBlocks] root:",f,d,{blockStore:t}),!d)throw Cn("[decodePubFromBlocks] root not found in blockStore",{blockStore:t,currentCID:f});let k;if(d?.info){u||(u=d.applogs);let B=await Pn(t,d.applogs);k=await wN(B,t),o||(o=await Pn(t,d.info),Vs("new format - infoLogs",o.logs.map(W=>({[W.toString()]:W}))))}else k=d.applogs;let E=async B=>{let W=B,D=await Pn(t,W);if(!D)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 D.pv instanceof or&&(D.pv=D.pv.toV1().toString()),{...D,cid:W.toV1().toString()}},T=await Promise.all(k.map(E));if(i=i.concat(T),!d.prev)break;if(n&&qh(d.prev,n)){Vs("[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,k=await Pn(t,d);if(!k)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 k.pv instanceof or&&(k.pv=k.pv.toV1().toString()),{...k,cid:d.toV1().toString()}}))}:null,applogsCID:u,applogs:i};return Vs("[decodePubFromBlocks] result:",l,{rootCID:e.toString(),blockStore:t,applogs:i}),l}async function mN(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);Bl({cidFromCarblocks:n,cid:o}),r.set(o.toV1().toString(),i)}return t.length!==1&&ty("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 ty("returning null"),null}catch(n){if(n.message==="Not Found")return null;throw n}return Pl(r)}function bN(e){return async function*(){for(;;){let{done:t,value:r}=await e.read();if(Bl("[car] chunk",{done:t,value:r}),t)break;yield r}}()}var{WARN:m5,LOG:b5,DEBUG:v5,VERBOSE:w5,ERROR:vN}=Ae.setup(Ae.INFO);async function wN(e,t){return _N(e)?(await Promise.all(e.chunks.map(async r=>{let n=await Pn(t,r);if(!n.logs)throw vN("Weird chunk",n);return n.logs}))).flat():e.logs}function _N(e){return e.chunks}var $a=Yi(ky(),1),TN=Yi($y(),1),ry=!1,ny=!1;$a.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(ry=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(ny=process?.env?.LOGGER_PERF_PREFIX==="true"));var EN={prefix:void 0,time:ry,delta:ny,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},Fs=[],iy=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(",")}]`}},oy=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},ji=!1,Kn=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({},EN,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(...k){let E=k[k.length-1];return E===i?E():(o(...k.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,TN.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($a.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=$a.isBrowser&&navigator.userAgent.includes("Chrome")?["",yt.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(ji?n.push(new oy("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 iy(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}}}};$a.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(Fs&&Fs.length){for(let t of Fs)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof iy))return null;ji||(ji=!0);let t=Kn.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof oy?(ji||(ji=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var _5=new Uint8Array(0);function ON(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 Vl(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 xN(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,D=0,$=T.length;D!==$&&T[D]===0;)D++,B++;for(var F=($-D)*f+1>>>0,K=new Uint8Array(F);D!==$;){for(var M=T[D],Q=0,q=F-1;(M!==0||Q<W)&&q!==-1;q--,Q++)M+=256*K[q]>>>0,K[q]=M%s>>>0,M=M/s>>>0;if(M!==0)throw new Error("Non-zero carry");W=Q,D++}for(var te=F-W;te!==F&&K[te]===0;)te++;for(var N=u.repeat(B);te<F;++te)N+=e.charAt(K[te]);return N}function k(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,D=0;T[B]===u;)W++,B++;for(var $=(T.length-B)*l+1>>>0,F=new Uint8Array($);T[B];){var K=r[T.charCodeAt(B)];if(K===255)return;for(var M=0,Q=$-1;(K!==0||M<D)&&Q!==-1;Q--,M++)K+=s*F[Q]>>>0,F[Q]=K%256>>>0,K=K/256>>>0;if(K!==0)throw new Error("Non-zero carry");D=M,B++}if(T[B]!==" "){for(var q=$-D;q!==$&&F[q]===0;)q++;for(var te=new Uint8Array(W+($-q)),N=W;q!==$;)te[N++]=F[q++];return te}}}function E(T){var B=k(T);if(B)return B;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:k,decode:E}}var AN=xN,SN=AN,IN=SN,kN=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")}},$N=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 ay(this,e)}},NN=class{decoders;constructor(e){this.decoders=e}or(e){return ay(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function ay(e,t){return new NN({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var jN=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 kN(e,t,r),this.decoder=new $N(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function sy({name:e,prefix:t,encode:r,decode:n}){return new jN(e,t,r,n)}function uy({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=IN(r,e);return sy({prefix:t,name:e,encode:n,decode:o=>Vl(i(o))})}function CN(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 UN(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 Ar({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return sy({prefix:t,name:e,encode(i){return UN(i,n,r)},decode(i){return CN(i,n,r,e)}})}var Vo=Ar({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),T5=Ar({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),E5=Ar({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),O5=Ar({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),x5=Ar({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),A5=Ar({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),S5=Ar({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),I5=Ar({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),k5=Ar({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Rr=uy({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),$5=uy({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),PN=ly,zf=128,RN=127,DN=~RN,MN=Math.pow(2,31);function ly(e,t,r){t=t||[],r=r||0;for(var n=r;e>=MN;)t[r++]=e&255|zf,e/=128;for(;e&DN;)t[r++]=e&255|zf,e>>>=7;return t[r]=e|0,ly.bytes=r-n+1,t}var LN=Tu,BN=128,qf=127;function Tu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Tu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&qf)<<i:(a&qf)*Math.pow(2,i),i+=7}while(a>=BN);return Tu.bytes=o-n,r}var VN=Math.pow(2,7),FN=Math.pow(2,14),zN=Math.pow(2,21),qN=Math.pow(2,28),KN=Math.pow(2,35),GN=Math.pow(2,42),HN=Math.pow(2,49),WN=Math.pow(2,56),JN=Math.pow(2,63),QN=function(e){return e<VN?1:e<FN?2:e<zN?3:e<qN?4:e<KN?5:e<GN?6:e<HN?7:e<WN?8:e<JN?9:10},YN={encode:PN,decode:LN,encodingLength:QN},XN=YN,Na=XN;function Eu(e,t=0){return[Na.decode(e,t),Na.decode.bytes]}function ja(e,t,r=0){return Na.encode(e,t,r),t}function Ca(e){return Na.encodingLength(e)}function ZN(e,t){let r=t.byteLength,n=Ca(e),i=n+Ca(r),o=new Uint8Array(i+r);return ja(e,o,0),ja(r,o,n),o.set(t,i),new Fl(e,r,t,o)}function ej(e){let t=Vl(e),[r,n]=Eu(t),[i,o]=Eu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Fl(r,i,a,t)}function tj(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&ON(e.bytes,r.bytes)}}var Fl=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Kf(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return nj(r,Ou(e),t??Rr.encoder);default:return ij(r,Ou(e),t??Vo.encoder)}}var Gf=new WeakMap;function Ou(e){let t=Gf.get(e);if(t==null){let r=new Map;return Gf.set(e,r),r}return t}var N5=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!==Ai)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==oj)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=ZN(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&&tj(t.multihash,n.multihash)}toString(t){return Kf(this,t)}toJSON(){return{"/":Kf(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??Hf(n,i,o.bytes))}else if(r[aj]===!0){let{version:n,multihash:i,code:o}=r,a=ej(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!==Ai)throw new Error(`Version 0 CID must use dag-pb (code: ${Ai}) block encoding`);return new ct(t,r,n,n.bytes)}case 1:{let i=Hf(t,r,n.bytes);return new ct(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return ct.create(0,Ai,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=Vl(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 Fl(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,k]=Eu(t.subarray(r));return r+=k,d},i=n(),o=Ai;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]=rj(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 Ou(o).set(n,t),o}};function rj(e,t){switch(e[0]){case"Q":{let r=t??Rr;return[Rr.prefix,r.decode(`${Rr.prefix}${e}`)]}case Rr.prefix:{let r=t??Rr;return[Rr.prefix,r.decode(e)]}case Vo.prefix:{let r=t??Vo;return[Vo.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 nj(e,t,r){let{prefix:n}=r;if(n!==Rr.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 ij(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 Ai=112,oj=18;function Hf(e,t,r){let n=Ca(e),i=n+Ca(t),o=new Uint8Array(i+r.byteLength);return ja(e,o,0),ja(t,o,n),o.set(r,i),o}var aj=Symbol.for("@ipld/js-cid/CID"),{WARN:sj,LOG:j5,DEBUG:Ri,VERBOSE:C5,ERROR:ms}=Kn.setup(Kn.INFO),zl=["https://trustless-gateway.link/","https://ipfs.4everland.io/"].map(e=>({url:e}));async function ql(e,{readOnly:t=!0,pinnedCID:r,gateways:n=zl}={}){let{cid:i,errors:o,isIpns:a}=S$(e);if(!i)throw ms("Failed to parse pubID",e,o);Ri("[retrieveThread] parsedPubID",{cid:i.toString(),errors:o,isIpns:a});let s=await cy(i),{applogs:u,info:l}=await yN(s),f=u.filter(gu);f.length&&sj(`Found ${f.length} encrypted logs - skipping`);let d=u.filter(E=>!gu(E));Qi(d);let k=vo.fromArray(d,`preview${e&&e!==i.toString()?"-"+e:""}@${i.toString()}`,t);return{cid:i,info:l,thread:k,encryptedCount:f.length}}async function cy(e,t=zl){return e=bu(e),Ri("Retrieving:",e,e.toString(),"from",t),await Kl(t,async(r,n)=>{var i=fy(r,e);n>1&&(i+=`&cache-bust=${performance.now()}`);let o=await fetch(i),a=await uj(o,i);Ri("[retrieveCar] GW result",{result:a,gateway:r});let s=await Ed.fromIterable(a);Ri("[retrieveCar] GW decodeResult",{car:s,gateway:r});let u=(await s.getRoots())[0];if(!Ml(e)&&!qh(e,u))throw ms("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=Ml(t),o=`${n}${i?"ipns/":"ipfs/"}${t.toString()}?format=car&dag-scope=${r}`;return Ri({isIpns:i,url:o}),o}async function uj(e,t){if(!e?.ok||!e?.body)throw ms("[retrieveCar] unexpected response",e?.statusText,{url:t});return bN(e.body.getReader())}async function Kl(e,t,r=1){try{return await Promise.any(Xo(e).map(async n=>{try{return await t(n,r)}catch(i){throw ms("still trying",i),i instanceof Error?i:new Error(`[retrieveCar] error: ${i}`)}}))}catch(n){if(r<3)return await Kl(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:l8,LOG:c8,DEBUG:f8,VERBOSE:d8,ERROR:p8}=Ae.setup(Ae.INFO),{WARN:h8,LOG:y8,DEBUG:g8,VERBOSE:m8,ERROR:b8}=Ae.setup(Ae.INFO),{WARN:lj,LOG:v8,DEBUG:cj,VERBOSE:
|
|
61
|
+
`+" ".repeat(t)+o):o==="{"&&n>0?(n++,r+=o):(o==="}"&&n>1&&n--,r+=o)}return r}function xk(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]instanceof qn){if(t[r]!==e[r])return!1}else if(!Je.structural(e[r],t[r]))return!1;return!0}var{WARN:Of,LOG:yC,DEBUG:Ok,VERBOSE:gC,ERROR:en}=Ae.setup(Ae.INFO,{prefix:"[thread]"});function Kr(e){return e.init!==void 0}var qn=class{constructor(e,t,r,n=[],i={}){this.name=e,this._applogs=n,this.parents=t===null?null:Xo(t),this.filters=r,Le(()=>this.parents?.length===0)&&Of("[Thread] empty parents array",e),i.skipObservable||li(this,{applogsCids:Fe,applogsCidSet:Fe,applogsByCid:Fe,insert:mt,size:Fe,isEmpty:Fe,firstLog:Fe,latestLog:Fe},{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):Of("unsubscribe called for non-existent",e)}notifySubscribers(e){Ok(`[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)}get applogsCidSet(){return new Set(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.applogsCidSet.has(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 Le(()=>this.size)}get nameAndSizeUntracked(){return Le(()=>`${this.name} (${this.size})`)}get prettyName(){return Ek(this.name)}get hasParents(){return!!this.parents?.length}},Ak=class Ih extends qn{static fromArray(t,r){return new Ih(r||"static",null,[],t)}constructor(t,r,n,i){super(t,r,n,i,{skipObservable:!0})}get readOnly(){return!0}},Sk={};ti(Sk,{code:()=>$h,decode:()=>Pl,encode:()=>Ul,format:()=>Af,name:()=>Bk,parse:()=>Fk,stringify:()=>Af});var Ik=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=Od(JSON.stringify(t.value));e.push(r.length>32?Ba(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 kk(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 $k={addBreakTokens:!0,mapSorter:kk};function Nk(e,t){return t=Object.assign({},$k,t),Bd(e,new Ik,t)}var kh=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,Av(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 jk(e,t){return t=Object.assign({tokenizer:new kh(e,t)},t),N0(e,t)}function Ck(e){return e instanceof ArrayBuffer?new Uint8Array(e,0,e.byteLength):e}function Uk(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Ka.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=al.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 Pk(e){return Ta(new Uint8Array(e))}function Rk(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Dk(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 Mk={typeEncoders:{Object:Uk,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:Pk,undefined:Rk,number:Dk}},Lk=class extends kh{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=al.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}},fu={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};fu.tags[42]=Ka.parse;var Bk="dag-json",$h=297,Ul=e=>Nk(e,Mk),Pl=e=>{let t=Ck(e),r=Object.assign(fu,{tokenizer:new Lk(t,fu)});return jk(t,r)},Af=e=>Vk.decode(Ul(e)),Vk=new TextDecoder,Fk=e=>Pl(zk.encode(e)),zk=new TextEncoder,Mo=Or({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),mC=Or({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),bC=Or({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),vC=Or({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),wC=Or({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),_C=Or({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),TC=Or({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),EC=Or({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),xC=Or({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Pr=Ga({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),OC=Ga({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Nh={};ti(Nh,{Digest:()=>ds,create:()=>Rl,decode:()=>Ch,equals:()=>Uh,hasCode:()=>u$});var qk=jh,Sf=128,Kk=127,Gk=~Kk,Hk=Math.pow(2,31);function jh(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Hk;)t[r++]=e&255|Sf,e/=128;for(;e&Gk;)t[r++]=e&255|Sf,e>>>=7;return t[r]=e|0,jh.bytes=r-n+1,t}var Wk=du,Jk=128,If=127;function du(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw du.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&If)<<i:(a&If)*Math.pow(2,i),i+=7}while(a>=Jk);return du.bytes=o-n,r}var Qk=Math.pow(2,7),Yk=Math.pow(2,14),Xk=Math.pow(2,21),Zk=Math.pow(2,28),e$=Math.pow(2,35),t$=Math.pow(2,42),r$=Math.pow(2,49),n$=Math.pow(2,56),i$=Math.pow(2,63),o$=function(e){return e<Qk?1:e<Yk?2:e<Xk?3:e<Zk?4:e<e$?5:e<t$?6:e<r$?7:e<n$?8:e<i$?9:10},a$={encode:qk,decode:Wk,encodingLength:o$},s$=a$,Ea=s$;function pu(e,t=0){return[Ea.decode(e,t),Ea.decode.bytes]}function xa(e,t,r=0){return Ea.encode(e,t,r),t}function Oa(e){return Ea.encodingLength(e)}function Rl(e,t){let r=t.byteLength,n=Oa(e),i=n+Oa(r),o=new Uint8Array(i+r);return xa(e,o,0),xa(r,o,n),o.set(t,i),new ds(e,r,t,o)}function Ch(e){let t=ol(e),[r,n]=pu(t),[i,o]=pu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new ds(r,i,a,t)}function Uh(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Bw(e.bytes,r.bytes)}}var ds=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function u$(e,t){return e.code===t}function kf(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return c$(r,hu(e),t??Pr.encoder);default:return f$(r,hu(e),t??Mo.encoder)}}var $f=new WeakMap;function hu(e){let t=$f.get(e);if(t==null){let r=new Map;return $f.set(e,r),r}return t}var or=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!==d$)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=Rl(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&&Uh(t.multihash,n.multihash)}toString(t){return kf(this,t)}toJSON(){return{"/":kf(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??Nf(n,i,o.bytes))}else if(r[p$]===!0){let{version:n,multihash:i,code:o}=r,a=Ch(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=Nf(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=ol(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),a=new ds(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,k]=pu(t.subarray(r));return r+=k,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]=l$(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 hu(o).set(n,t),o}};function l$(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 Mo.prefix:{let r=t??Mo;return[Mo.prefix,r.decode(e)]}case Co.prefix:{let r=t??Co;return[Co.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 c$(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 f$(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,d$=18;function Nf(e,t,r){let n=Oa(e),i=n+Oa(t),o=new Uint8Array(i+r.byteLength);return xa(e,o,0),xa(t,o,n),o.set(r,i),o}var p$=Symbol.for("@ipld/js-cid/CID"),h$=20;function Ph({name:e,code:t,encode:r,minDigestLength:n,maxDigestLength:i}){return new y$(e,t,r,n,i)}var y$=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,r,n,i){this.name=e,this.code=t,this.encode=r,this.minDigestLength=n??h$,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?jf(r,this.code,t?.truncate):r.then(n=>jf(n,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};function jf(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 Rl(t,e)}var et=xr(Gr(),1),Rh=xr(dT(),1),Cf=e=>et.Type.Union([e,et.Type.Null()]),Dh=/^(k51qz|baguq)[0-9a-z]{56,57}$/,g$=/^[0-9A-Fa-f]{7,8}$/g;et.FormatRegistry.Set("EntityID",e=>!!e.match(g$)||!!e.match(Dh));var m$=et.Type.String(),yu=e=>e?.enc instanceof Uint8Array;et.FormatRegistry.Set("CID",e=>!!e.match(Dh));var Mh=et.Type.String({format:"CID"}),b$=/^http([s]?):\/\/.*\..*/;et.FormatRegistry.Set("URL",e=>!!e.match(b$));var AC=et.Type.String({format:"URL"}),Lh=et.Type.Object({en:m$,at:et.Type.String(),vl:Cf(et.Type.Union([et.Type.String(),et.Type.Boolean(),et.Type.Number()])),ts:et.Type.String(),ag:et.Type.String(),pv:Cf(Mh)}),Uf=Rh.TypeCompiler.Compile(Lh),SC=Uf.Check.bind(Uf),v$=et.Type.Composite([et.Type.Object({cid:Mh}),Lh]),gu=Rh.TypeCompiler.Compile(v$),w$=e=>Array.from(gu.Errors(e)),Bh=gu.Check.bind(gu);function Vh(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var _$=Ph({name:"sha2-256",code:18,encode:Vh("SHA-256")}),IC=Ph({name:"sha2-512",code:19,encode:Vh("SHA-512")}),{WARN:Pf,LOG:kC,DEBUG:T$,VERBOSE:Aa,ERROR:Fh}=Ae.setup(Ae.INFO),E$=114;function x$(e,t=["cid"]){if(!e)throw Fh("falsy log",e);let r=e.cid;if(yu(e))return r||(r=Dl(zh(e).bytes).toString()),Pf("preparing an encrypted applog - really?"),{log:e,cid:r};let n={};for(let[i,o]of Object.entries(e))o===void 0&&(Pf(`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 O$(e){return Dl(A$(e).bytes)}function A$(e){return zh(x$(e)?.log)}function Dl(e){let t=Lw(e),r=Nh.create(_$.code,t),n=or.create(1,$h,r);return Aa("[getCidSync]",{bytes:e,hash:t,digest:r,cid:n}),n}function zh(e){T$("[encodeBlock]",e);try{let t=Ul(e);return{bytes:t,cid:Dl(t)}}catch(t){throw Fh("[encodeBlock] failed to encode:",e,t)}}function S$(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,Co)}catch(n){Aa("[retrieveThread] couldn't parse pubID with base36"),r.push(n)}return{cid:t,errors:t?null:r,isIpns:t&&Ml(t)}}function Ml(e){return e.code===E$}function mu(e){return typeof e=="string"?or.parse(e):typeof e.toV1!="function"?or.decode(e.bytes):e}function qh(e,t){if(!e||!t)throw new Error(`[areCidsEqual] invalid params: ${e}, ${t}`);if(e===t)return!0;let r=mu(e),n=mu(t);return r.toV1().toString()===n.toV1().toString()}function Rf(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 I$(e,t){let r=Rf(e),n=Rf(t);return+r<+n}var{WARN:k$,LOG:$C,DEBUG:NC,VERBOSE:Sa,ERROR:Ia}=Ae.setup(Ae.INFO),$$=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),Kh=(e,t,r)=>Je.structural(Ef(t,e),Ef(r,e)),N$=(e,t,r="asc")=>$$(e.ts,t.ts,r),jC=ik(Kh,["en","at"]);function Qi(e,t="asc"){return e.sort((r,n)=>N$(r,n,t))}var j$=(e,t)=>I$(new Date(e.ts),new Date(t.ts)),C$=()=>{k$("[removeDuplicateAppLogs] mode not set; pass 'safety' or 'cleanup' for optimal behavior")},Df=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())},U$=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},Gh=(e,t)=>t?t==="safety"?U$(e):Df(e):(C$(),Df(e));function P$(e){return typeof e=="string"&&e.startsWith("?")}function R$(e){return e.slice(1)}function Hh(e,t){let r={},n={};for(let[i,o]of Object.entries(e))if(P$(o)){let a=R$(o),s=t[a];s?n[i]=s:r[i]=a}else n[i]=o;return[n,r]}function D$(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 Wh=function(e){for(var t=0,r=0,n=e.length;r<n;r++)t+=e[r];return t},Mf=function(e){return Wh(e)/e.length},kt={max:function(e){return Math.max.apply(null,e)},min:function(e){return Math.min.apply(null,e)},range:function(e){return kt.max(e)-kt.min(e)},midrange:function(e){return kt.range(e)/2},sum:Wh,mean:Mf,average:Mf,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=kt.mean(e);return kt.mean(e.map(function(r){return Math.pow(r-t,2)}))},standardDeviation:function(e){return Math.sqrt(kt.variance(e))},meanAbsoluteDeviation:function(e){var t=kt.mean(e);return kt.mean(e.map(function(r){return Math.abs(r-t)}))},zScores:function(e){var t=kt.mean(e),r=kt.standardDeviation(e);return e.map(function(n){return(n-t)/r})}};kt.average=kt.mean;function Jh(){return new Date().toISOString()}var{WARN:M$,LOG:CC,DEBUG:He,VERBOSE:UC,ERROR:ka}=Ae.setup(Ae.INFO);function L$(e,t){He(`[ensureTsPvAndFinalizeApplogs] ENTER - ${e.length} applogs, thread size=${t.size}`);let r=Jh(),n=t;He("[ensureTsPvAndFinalizeApplogs] About to map over applogs");let i=e.map((o,a)=>{He(`[ensureTsPvAndFinalizeApplogs] Processing applog ${a+1}/${e.length}`);let s=B$(o,{ts:r,threadForPv:n});return He(`[ensureTsPvAndFinalizeApplogs] Finalized applog ${a+1}/${e.length}`),s});return He(`[ensureTsPvAndFinalizeApplogs] EXIT - mapped ${i.length} applogs`),i}function B$(e,{ts:t,threadForPv:r}={}){He(`[finalizeApplogForInsert] ENTER - en=${e.en}, at=${e.at}`),He("[finalizeApplogForInsert] About to call withTs");let n=z$(e,t??Jh());He(`[finalizeApplogForInsert] About to call withPvFrom (thread size=${r?.size??"null"})`);let i=q$(n,r);He("[finalizeApplogForInsert] About to call encodeApplogAndGetCid");let o=O$(i).toString();He(`[finalizeApplogForInsert] CID created: ${o}`),e.cid&&e.cid!==o&&M$("[finalizeApplogForInsert] overwriting wrong CID",{log:e,cid:o,logWithPv:i});let a={...i,cid:o};if(He("[finalizeApplogForInsert] About to validate applog"),!Bh(a))throw ka(`Bogus Applog ${JSON.stringify(a)}`,w$(a));return He(`[finalizeApplogForInsert] EXIT - CID=${o}`),Object.freeze(a)}function V$(e){return!!e.ts}function F$(e){return!!e.pv}function z$(e,t){return V$(e)?e:{...e,ts:t}}function q$(e,t){if(He(`[withPvFrom] ENTER - en=${e.en}, at=${e.at}, hasPv=${e.pv!==void 0}`),e.pv!==void 0)return He("[withPvFrom] EXIT early - pv already set"),e;if(t){let{en:r,at:n}=e;He(`[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(He(`[withPvFrom] findLast completed, found=${!!i}`),He("[withPvFrom] About to check equality"),Kh(["en","at","vl","ts","ag"],e,i))throw ka("[withPvFrom] Same as previous:",{log:e,pv:i,thread:t});let o=(e.pv!==void 0?e.pv:i?.cid)??null;return He(`[withPvFrom] EXIT - prevLogCid=${o}`),{...e,pv:o}}else{if(!F$(e))throw ka("[withPvFrom] no thread and no pv:",e);return He("[withPvFrom] EXIT - no thread, returning log with existing pv"),e}}function bu(e){let t=()=>(Le(()=>e.length<2&&He(`joinThreads with count=${e.length}`)),Qi(Gh(e.flatMap(i=>{let o=i.applogs;if(!o)throw ka("falsy applogs of thread",i),new Error("falsy applogs of thread");return o}),"cleanup"))),r=Le(()=>t()),n=mt(function(i,o){return Kr(i)?{init:Le(()=>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 ps(Le(()=>`join(~ ${e.map(i=>i.name).join(", ")})`),e,["?"],r,n)}var{WARN:Lf,LOG:PC,DEBUG:Bf,VERBOSE:tn,ERROR:Io}=Ae.setup(Ae.INFO),ps=class vu extends qn{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,li(this,{onParentUpdate:mt}),o&&this.subscribeToParents()}static mapWrites(t,r,n){return new vu(`${r}<${t.nameAndSizeUntracked}>`,t,t.filters,t._applogs,null,n)}static asReadOnly(t){return t.readOnly?t:new vu(`readOnly(${t.name})`,t,t.filters,t._applogs,null,null,!0)}_parentSubscriptions=null;insert(t){if(this.readOnly)throw Io("[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 Io("[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=Dt(()=>{this.parents.length||Lf("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 Io("triggerRemap on a thread that is not actually mapping?!",this.nameAndSizeUntracked);Bf(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.length!==1&&Lf(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap with parentCount=${this.parents.length} - not meant for this`),this.parents.forEach(t=>{this.onParentUpdate(t,{init:Le(()=>br(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(yk(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))Bf("Ignoring remove event for non-existent because it was part of parent event's removed",i,r);else throw Io(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,i,{thread:this,event:r,mapResult:n})}}tn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,rs(this._applogs)),this.notifySubscribers(n)}get readOnly(){return this._readOnly??!1}},{WARN:RC,LOG:DC,DEBUG:MC,VERBOSE:Ms,ERROR:K$}=Ae.setup(Ae.INFO),Kn=tt("rollingFilter",function(e,t,r={}){let n=H$(t),i=Vf(n),o=Be.array(Le(function(){return i(e.applogs)}),{deep:!1,name:`${e.name} | ${r.name||`rollingFilter.array{${Ji(n)}}`}`}),a=f=>{let d;return Kr(f)?d={init:i(f.init)}:d={added:i(f.added),removed:f.removed},Ms(`rollingFilter{${e.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,n,f,"=>",d),d},s=new ps(`${e.name} | ${r.name||`rollingFilter{${Ji(n)}}`}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],o,a),u=I_(()=>br(t),f=>{Ms(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,n,"=>",f),n=f,i=Vf(n),s.triggerRemap()}),l=Sn(o,()=>{Ms(`rollingFilter<${Le(()=>e.name)}>${r.name?` '${r.name}'`:""} unobserve`,n),u(),l()});return s},{equals:bo,argsDebugName:(e,t,r)=>We({caller:"rollingFilter",thread:e,pattern:t,args:r})}),G$=tt("rollingMapper",function(e,t,r={}){let n=Le(()=>t.call(null,{init:e.applogs},e));if(!Kr(n))throw K$("Initial run must return init event");let i=n.init;return new ps(`${e.name} | ${r.name||"rollingMapper"}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],i,t)},{equals:bo,argsDebugName:(e,t,r)=>We({caller:"rollingMapper",thread:e,args:r})}),LC=tt("rollingAcc",function(e,t,r,n={}){let i=mt(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}`:""}}`}),H$=function(e){let t=Le(function(){return Object.fromEntries(Object.entries(br(e)).map(([r,n])=>[br(r),br(n)]))});if(!Object.entries(t).length)throw new Error("Pattern is empty");return t};function Vf(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(!D$(n,i,o))return!1}return!0})}}var BC=ps.asReadOnly,{WARN:W$,LOG:J$,DEBUG:Ge,VERBOSE:Qh,ERROR:Lo}=Ae.setup(Ae.INFO),Q$=class extends qn{constructor(e,t=[],r){super(e,null,r,t),li(this,{insertRaw:mt,purge:mt})}purge(e){let t=this.applogs.length;return this._applogs=this.applogs.filter(r=>!e.includes(r.cid)),t-this.applogs.length}insert(e){Ge(`[WriteableThread.insert] ENTER - ${e.length} applogs for thread "${this.name}"`),Ge("[WriteableThread.insert] About to call ensureTsPvAndFinalizeApplogs");let t=L$(e,this);Ge(`[WriteableThread.insert] ensureTsPvAndFinalizeApplogs completed, mapped=${t.length} applogs`),Ge("[WriteableThread.insert] About to call insertRaw");let r=this.insertRaw(t);return Ge("[WriteableThread.insert] insertRaw completed"),r}insertMissing(e,t=!1){let r=e.filter(n=>!this.hasApplog(n,t));return r.length===0?(Qh("[insertMissing] no missing applogs"),[]):this.insertRaw(r)??[]}insertRaw(e){Ge(`[WriteableThread.insertRaw] ENTER - ${e.length} applogs for thread "${this.name}"`),Ge("[WriteableThread.insertRaw] About to deduplicate");let t=Gh(e,"safety");if(t.length!==e.length)throw Lo(`[insertRaw] duplicate applogs passed: ${e.length-t.length}`,{appLogsToInsert:e,deduplicated:t});Ge("[WriteableThread.insertRaw] Deduplication done"),Ge("[WriteableThread.insertRaw] About to validate");let r=e.filter(a=>!Bh(a));if(r.length)throw Lo(`[insertRaw] bogus applogs passed: ${r.length}`,{bogus:r});Ge("[WriteableThread.insertRaw] Validation done"),Ge("[WriteableThread.insertRaw] About to check for existing");let n=e.filter(a=>this.hasApplog(a,!1));if(n.length)throw Lo(`[insertRaw] already existing applogs passed: ${n.length}`,{existing:n});if(Ge("[WriteableThread.insertRaw] Existing check done"),!e.length){W$("[insertRaw] skipping empty insert empty logs array");return}(!this.hasParents&&!(this instanceof vo)?J$:Ge)("Inserting:",e.length===1?e[0]:e,{ds:this}),Ge("[WriteableThread.insertRaw] About to sort applogs"),Qi(e);let i=this._applogs.length&&j$(e[0],this._applogs[this._applogs.length-1]);Ge("[WriteableThread.insertRaw] About to push to _applogs array");let o=5e4;for(let a=0;a<e.length;a+=o)this._applogs.push(...e.slice(a,a+o));return i&&(Ge("[WriteableThread.insertRaw] About to sort _applogs (sortNeeded=true)"),Qi(this._applogs)),Ge("[WriteableThread.insertRaw] About to notify subscribers"),this.notifySubscribers({added:e,removed:null}),Ge("[WriteableThread.insertRaw] Subscribers notified"),Ge("[WriteableThread.insertRaw] About to call persist (void - not awaited)"),this.persist(e),Ge(`[WriteableThread.insertRaw] EXIT - returning ${e.length} applogs`),e}get readOnly(){return!1}},vo=class Bo extends Q${constructor(t,r,n,i){super(t,r,n),this._readOnly=i,li(this,{_applogs:Be.shallow})}static empty(t){return Bo.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new Bo(r??"in-memory",t,[],n)}static fromReadOnlyArray(t,r){return new Bo(r??"in-memory",t,[],!0)}get readOnly(){return this._readOnly}async persist(t){if(Qh("[InMem.persist] no persist for",t),this.readOnly)throw Lo("[persist] called for readOnly thread")}},{WARN:VC,LOG:FC,DEBUG:zC,VERBOSE:qC,ERROR:KC}=Ae.setup(Ae.INFO),{WARN:GC,LOG:HC,DEBUG:WC,VERBOSE:JC,ERROR:QC}=Ae.setup(Ae.INFO),Y$=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=r,li(this,{threadOfTrail:Fe})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?bu([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},Yh=class{constructor(e){this.nodes=e,li(this,{threadOfAllTrails:Fe,size:Fe,isEmpty:Fe})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return Le(()=>this.records.length)}get records(){return Ht(()=>this.nodes.map(({variables:e})=>e),{name:"QueryResult.records"})}get leafNodeThread(){return bu(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 bu(Ht(()=>this.nodes.map(e=>e.threadOfTrail),{name:"QueryResult.threadOfAllTrails"}))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},{WARN:YC,LOG:hs,DEBUG:_r,VERBOSE:Se,ERROR:cn}=Ae.setup(Ae.INFO,{prefix:"[q]"}),Ls=null,XC=tt("lastWriteWins",function(e,{inverseToOnlyReturnFirstLogs:t,tolerateAlreadyFiltered:r}={}){if(Se(`lastWriteWins${t?".inversed":""} < ${e.nameAndSizeUntracked} > initializing`),e.filters.includes("lastWriteWins")){if(r)return _r("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),e;throw cn("thread already filtered lastWriteWins:",e.filters,{name:e.name})}let n,i=G$(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 k=t?0:u.length-1;t?k<u.length:k>=0;t?k++:k--){let E=u[k],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:k,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 Qi(l),Se.isDisabled||Se(`lastWriteWins${t?".inversed":""}<${e.nameAndSizeUntracked}> mapped event`,s?{...Object.fromEntries(Object.entries(o).map(([k,E])=>[k,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||Dt(()=>{Se(`lastWriteWins<${e.nameAndSizeUntracked}> filtered down to`,i.applogs.length)}),i},{equals:bo,argsDebugName:e=>We({caller:"lastWriteWins",thread:e})}),ZC=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:`,Le(function(){return[...t.applogs]}));let r=We({caller:"allDeletedEntities",thread:e}),n=Tk(function(){return t.map(i=>i.en)},{name:r});return Se.isEnabled&&Dt(()=>{Se(`withoutDeleted<${e.nameAndSizeUntracked}> deleted:`,[...n])}),Kn(e,{"!en":n},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:bo}),Xh=tt("query",function e(t,r,n={},i={}){oN();let o=Zh(t);_r(`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=X$(o,s,u,i);return Se.isDisabled||Dt(()=>Se("query result:",br(l))),l},{equals:Cl,argsDebugName:(e,t,r)=>We({caller:"query",thread:e,args:r?{pattern:t,startVars:r}:t})}),X$=tt("queryStep",function(e,t,r,n={}){if(_r(`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]=Hh(r,a?.variables??{});Se("[queryStep.doQuery] patternWithoutVars: ",s);let l=Kn(e,s),f=ys(u),d=Ht(function(){let k=l.map(E=>({log:E,vars:f(E)}));return Se.isEnabled&&Se("[queryStep.doQuery] step node:",a?.variables," =>",k,"from:",Le(()=>l.applogs)),k.map(({log:E,vars:T})=>{let B=Object.assign({},a?.variables,T);return new Y$(Ak.fromArray([E],We({caller:"QueryNode",thread:l,pattern:`${Ji(B)}@${Ji(s)}`})),B,a)})},{name:We({caller:"doQuery.mapNodes",thread:l,pattern:r})});return Se.isEnabled&&Dt(()=>Se("[queryStep.doQuery] resultNodes:",[...d])),n.debug&&hs("[queryStep] step result:",Le(()=>d.map(({variables:k,logsOfThisNode:E})=>({variables:k,thread:E})))),d}let o=Ht(function(){return _r(`[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&&Dt(()=>Se("[queryStep] observableResultNodes:",[...o])),new Yh(o)},{equals:Cl,argsDebugName:(e,t,r)=>We({caller:"queryStep",thread:e,pattern:r})}),e5=tt("queryNot",function(e,t,r,n={}){let i=t.nodes;_r(`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]=Hh(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?",Le(()=>f.applogs)),n.debug&&hs("[queryNot] node result:",s,"=>",f.applogs),f.isEmpty})}return new Yh(i)},{equals:Cl,argsDebugName:(e,t,r)=>We({caller:"queryNot",thread:e,pattern:r})}),t5=tt("filterAndMap",function(e,t,r){_r(`filterAndMap<${e.nameAndSizeUntracked}>`,t);let n=Kn(e,t);Se.isEnabled&&(Se("[filterAndMap] filtered:",n.untrackedSize),Dt(()=>Se("[filterAndMap] filtered:",n.applogs)));let i=We({thread:e,pattern:t,caller:"filterAndMap"}),o=Ht(()=>tN(n,r),{name:i});return Se.isDisabled||Dt(()=>Se("[filterAndMap] mapped:",o)),o},{equals:Je.structural,argsDebugName:(e,t)=>We({caller:"filterAndMap",thread:e,pattern:t})}),r5=tt("queryAndMap",function(e,t,r,n={}){let i=Zh(e);_r(`queryAndMap<${i.nameAndSizeUntracked}>`,{patternOrPatterns:t,variables:n,map:r});let o=We({thread:i,caller:"queryAndMap"}),a=Xh(i,t);Se("[queryAndMap] filtered count:",a.untrackedSize);let s=Ht(()=>rN(a,r),{name:o});return Se.isDisabled||Dt(()=>Se("[queryAndMap] result:",br(s))),s},{equals:Je.structural,argsDebugName:(e,t)=>We({caller:"queryAndMap",thread:e,pattern:t})}),n5=tt("queryEntity",function(e,t,r,n){_r(`queryEntity<${e.nameAndSizeUntracked}>`,r,t);let i=Kn(e,{en:r,at:nN(t,n)});return Se("queryEntity applogs:",i.applogs),Fe(()=>i.isEmpty?null:Object.fromEntries(i.map(({at:o,vl:a})=>[o.slice(t.length+1),a])))},{equals:vk,argsDebugName:(e,t,r)=>We({caller:"queryEntity",thread:e,args:{name:t,entityID:r}})}),i5=tt("agentsOfThread",function(e){_r(`agentsOfThread<${e.nameAndSizeUntracked}>`);let t=Be.map(),r=mt(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)}hs(`agentsOfThread<${e.nameAndSizeUntracked}> processed event`,{event:i,mapped:t})});r({init:e.applogs});let n=e.subscribe(r);return Sn(t,n),t}),Z$=tt("entityOverlap",function(e,t){return hs(`entityOverlap<${e.nameAndSizeUntracked}, ${t.nameAndSizeUntracked}>`),Fe(()=>{let r=new Set(e.map(i=>i.en)),n=new Set(t.map(i=>i.en));return[...r].filter(i=>n.has(i))})}),o5=tt("entityOverlapCount",function(e,t){return Fe(()=>Z$(e,t).get().length)}),eN=tt("querySingle",function(e,t,r={}){let n=Xh(e,t,r);return Fe(()=>{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})}),a5=tt("querySingleAndMap",function(e,t,r,n={}){let i=eN(e,t,n);return Fe(()=>{let o=i.get();if(o)return typeof r=="string"?o[r]:ys(r)(o)})},{equals:Je.structural,argsDebugName:(e,t)=>We({caller:"querySingleAndMap",thread:e,pattern:t})}),tN=function(e,t){return typeof t=="function"?e.map(t):typeof t=="string"?e.map(r=>r[t]):e.map(ys(t))},rN=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=>ys(t)(e))};function ys(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function nN(e,t){return t.map(r=>iN(e,r))}function iN(e,t){return`${e}/${t}`}function Zh(e,t){return Array.isArray(e)?vo.fromArray(e,t||`threadFromArray[${e.length}]`,!0):e}function oN(){if(Ls!=null&&performance.now()>=Ls)throw new aN(Ls)}var aN=class extends Error{constructor(e){super(e)}},sN=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}}}),uN=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,k=o.length;do{if(f>=k||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}}}),lN=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:sN(),decode:uN(),encodingLength:lN()}}}),ey=42;function cN(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Ka.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new ne(I.tag,ey),new ne(I.bytes,r)]}function fN(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function dN(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 pN(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 Ff={float64:!0,typeEncoders:{Map:pN,Object:cN,undefined:fN,number:dN}},s5={...Ff,typeEncoders:{...Ff.typeEncoders}};function hN(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Ka.decode(e.subarray(1))}var wu={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};wu.tags[ey]=hN;var u5={...wu,tags:wu.tags.slice()},l5=xr(Ll(),1),Lr={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)":Lr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Lr.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:Lr.Int,CarV1HeaderOrV2Pragma:e=>{if(Lr.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}},Ni={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Lr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Lr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Ni["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Ni["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Lr.Int,CarV1HeaderOrV2Pragma:e=>{if(Lr.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=Ni["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=Ni.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}},c5={toTyped:$i.CarV1HeaderOrV2Pragma,toRepresentation:Ni.CarV1HeaderOrV2Pragma},f5=Dd(),d5=xr(Ll(),1),p5=[new ne(I.map,2),new ne(I.string,"version"),new ne(I.uint,1),new ne(I.string,"roots")],h5=new ne(I.tag,42),y5=xr(Ll(),1),{WARN:ty,LOG:g5,DEBUG:Bs,VERBOSE:Bl,ERROR:Un}=Ae.setup(Ae.INFO);async function yN(e){let t=await mN(e);return await gN(t)}async function gN({rootCID:e,blockStore:t},r=[],n){if(!e||!t)throw Un("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 Un("[decodePubFromBlocks] pub chain has a loop",{currentCID:f,visited:[...s]});s.add(f);let d=await Rn(t,a);if(Bl("[decodePubFromBlocks] root:",f,d,{blockStore:t}),!d)throw Un("[decodePubFromBlocks] root not found in blockStore",{blockStore:t,currentCID:f});let k;if(d?.info){u||(u=d.applogs);let B=await Rn(t,d.applogs);k=await wN(B,t),o||(o=await Rn(t,d.info),Bs("new format - infoLogs",o.logs.map(W=>({[W.toString()]:W}))))}else k=d.applogs;let E=async B=>{let W=B,D=await Rn(t,W);if(!D)throw Un("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 D.pv instanceof or&&(D.pv=D.pv.toV1().toString()),{...D,cid:W.toV1().toString()}},T=await Promise.all(k.map(E));if(i=i.concat(T),!d.prev)break;if(n&&qh(d.prev,n)){Bs("[decodePubFromBlocks] stopping at stopAtCID:",n.toString());break}if(!await t.get(d.prev))throw Un("[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,k=await Rn(t,d);if(!k)throw Un("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 k.pv instanceof or&&(k.pv=k.pv.toV1().toString()),{...k,cid:d.toV1().toString()}}))}:null,applogsCID:u,applogs:i};return Bs("[decodePubFromBlocks] result:",l,{rootCID:e.toString(),blockStore:t,applogs:i}),l}async function mN(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);Bl({cidFromCarblocks:n,cid:o}),r.set(o.toV1().toString(),i)}return t.length!==1&&ty("Unexpected roots count:",t),{rootCID:or.parse(t[0]),blockStore:{get:n=>r.get(n.toV1().toString())}}}async function Rn(e,t){try{var r=await e.get(t);if(!r)return ty("returning null"),null}catch(n){if(n.message==="Not Found")return null;throw n}return Pl(r)}function bN(e){return async function*(){for(;;){let{done:t,value:r}=await e.read();if(Bl("[car] chunk",{done:t,value:r}),t)break;yield r}}()}var{WARN:m5,LOG:b5,DEBUG:v5,VERBOSE:w5,ERROR:vN}=Ae.setup(Ae.INFO);async function wN(e,t){return _N(e)?(await Promise.all(e.chunks.map(async r=>{let n=await Rn(t,r);if(!n.logs)throw vN("Weird chunk",n);return n.logs}))).flat():e.logs}function _N(e){return e.chunks}var $a=Yi(ky(),1),TN=Yi($y(),1),ry=!1,ny=!1;$a.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(ry=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(ny=process?.env?.LOGGER_PERF_PREFIX==="true"));var EN={prefix:void 0,time:ry,delta:ny,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},Vs=[],iy=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(",")}]`}},oy=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},ji=!1,Gn=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({},EN,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(...k){let E=k[k.length-1];return E===i?E():(o(...k.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,TN.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($a.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=$a.isBrowser&&navigator.userAgent.includes("Chrome")?["",yt.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(ji?n.push(new oy("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 iy(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}}}};$a.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(Vs&&Vs.length){for(let t of Vs)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof iy))return null;ji||(ji=!0);let t=Gn.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof oy?(ji||(ji=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var _5=new Uint8Array(0);function xN(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 Vl(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 ON(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,D=0,$=T.length;D!==$&&T[D]===0;)D++,B++;for(var F=($-D)*f+1>>>0,K=new Uint8Array(F);D!==$;){for(var M=T[D],Q=0,q=F-1;(M!==0||Q<W)&&q!==-1;q--,Q++)M+=256*K[q]>>>0,K[q]=M%s>>>0,M=M/s>>>0;if(M!==0)throw new Error("Non-zero carry");W=Q,D++}for(var te=F-W;te!==F&&K[te]===0;)te++;for(var N=u.repeat(B);te<F;++te)N+=e.charAt(K[te]);return N}function k(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,D=0;T[B]===u;)W++,B++;for(var $=(T.length-B)*l+1>>>0,F=new Uint8Array($);T[B];){var K=r[T.charCodeAt(B)];if(K===255)return;for(var M=0,Q=$-1;(K!==0||M<D)&&Q!==-1;Q--,M++)K+=s*F[Q]>>>0,F[Q]=K%256>>>0,K=K/256>>>0;if(K!==0)throw new Error("Non-zero carry");D=M,B++}if(T[B]!==" "){for(var q=$-D;q!==$&&F[q]===0;)q++;for(var te=new Uint8Array(W+($-q)),N=W;q!==$;)te[N++]=F[q++];return te}}}function E(T){var B=k(T);if(B)return B;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:k,decode:E}}var AN=ON,SN=AN,IN=SN,kN=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")}},$N=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 ay(this,e)}},NN=class{decoders;constructor(e){this.decoders=e}or(e){return ay(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function ay(e,t){return new NN({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var jN=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 kN(e,t,r),this.decoder=new $N(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function sy({name:e,prefix:t,encode:r,decode:n}){return new jN(e,t,r,n)}function uy({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=IN(r,e);return sy({prefix:t,name:e,encode:n,decode:o=>Vl(i(o))})}function CN(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 UN(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 Ar({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return sy({prefix:t,name:e,encode(i){return UN(i,n,r)},decode(i){return CN(i,n,r,e)}})}var Vo=Ar({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),T5=Ar({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),E5=Ar({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),x5=Ar({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),O5=Ar({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),A5=Ar({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),S5=Ar({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),I5=Ar({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),k5=Ar({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Rr=uy({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),$5=uy({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),PN=ly,zf=128,RN=127,DN=~RN,MN=Math.pow(2,31);function ly(e,t,r){t=t||[],r=r||0;for(var n=r;e>=MN;)t[r++]=e&255|zf,e/=128;for(;e&DN;)t[r++]=e&255|zf,e>>>=7;return t[r]=e|0,ly.bytes=r-n+1,t}var LN=_u,BN=128,qf=127;function _u(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw _u.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&qf)<<i:(a&qf)*Math.pow(2,i),i+=7}while(a>=BN);return _u.bytes=o-n,r}var VN=Math.pow(2,7),FN=Math.pow(2,14),zN=Math.pow(2,21),qN=Math.pow(2,28),KN=Math.pow(2,35),GN=Math.pow(2,42),HN=Math.pow(2,49),WN=Math.pow(2,56),JN=Math.pow(2,63),QN=function(e){return e<VN?1:e<FN?2:e<zN?3:e<qN?4:e<KN?5:e<GN?6:e<HN?7:e<WN?8:e<JN?9:10},YN={encode:PN,decode:LN,encodingLength:QN},XN=YN,Na=XN;function Tu(e,t=0){return[Na.decode(e,t),Na.decode.bytes]}function ja(e,t,r=0){return Na.encode(e,t,r),t}function Ca(e){return Na.encodingLength(e)}function ZN(e,t){let r=t.byteLength,n=Ca(e),i=n+Ca(r),o=new Uint8Array(i+r);return ja(e,o,0),ja(r,o,n),o.set(t,i),new Fl(e,r,t,o)}function ej(e){let t=Vl(e),[r,n]=Tu(t),[i,o]=Tu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Fl(r,i,a,t)}function tj(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&xN(e.bytes,r.bytes)}}var Fl=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Kf(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return nj(r,Eu(e),t??Rr.encoder);default:return ij(r,Eu(e),t??Vo.encoder)}}var Gf=new WeakMap;function Eu(e){let t=Gf.get(e);if(t==null){let r=new Map;return Gf.set(e,r),r}return t}var N5=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!==Ai)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==oj)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=ZN(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&&tj(t.multihash,n.multihash)}toString(t){return Kf(this,t)}toJSON(){return{"/":Kf(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??Hf(n,i,o.bytes))}else if(r[aj]===!0){let{version:n,multihash:i,code:o}=r,a=ej(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!==Ai)throw new Error(`Version 0 CID must use dag-pb (code: ${Ai}) block encoding`);return new ct(t,r,n,n.bytes)}case 1:{let i=Hf(t,r,n.bytes);return new ct(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return ct.create(0,Ai,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=Vl(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 Fl(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,k]=Tu(t.subarray(r));return r+=k,d},i=n(),o=Ai;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]=rj(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 Eu(o).set(n,t),o}};function rj(e,t){switch(e[0]){case"Q":{let r=t??Rr;return[Rr.prefix,r.decode(`${Rr.prefix}${e}`)]}case Rr.prefix:{let r=t??Rr;return[Rr.prefix,r.decode(e)]}case Vo.prefix:{let r=t??Vo;return[Vo.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 nj(e,t,r){let{prefix:n}=r;if(n!==Rr.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 ij(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 Ai=112,oj=18;function Hf(e,t,r){let n=Ca(e),i=n+Ca(t),o=new Uint8Array(i+r.byteLength);return ja(e,o,0),ja(t,o,n),o.set(r,i),o}var aj=Symbol.for("@ipld/js-cid/CID"),{WARN:sj,LOG:j5,DEBUG:Ri,VERBOSE:C5,ERROR:gs}=Gn.setup(Gn.INFO),zl=["https://trustless-gateway.link/","https://ipfs.4everland.io/"].map(e=>({url:e}));async function ql(e,{readOnly:t=!0,pinnedCID:r,gateways:n=zl}={}){let{cid:i,errors:o,isIpns:a}=S$(e);if(!i)throw gs("Failed to parse pubID",e,o);Ri("[retrieveThread] parsedPubID",{cid:i.toString(),errors:o,isIpns:a});let s=await cy(i),{applogs:u,info:l}=await yN(s),f=u.filter(yu);f.length&&sj(`Found ${f.length} encrypted logs - skipping`);let d=u.filter(E=>!yu(E));Qi(d);let k=vo.fromArray(d,`preview${e&&e!==i.toString()?"-"+e:""}@${i.toString()}`,t);return{cid:i,info:l,thread:k,encryptedCount:f.length}}async function cy(e,t=zl){return e=mu(e),Ri("Retrieving:",e,e.toString(),"from",t),await Kl(t,async(r,n)=>{var i=fy(r,e);n>1&&(i+=`&cache-bust=${performance.now()}`);let o=await fetch(i),a=await uj(o,i);Ri("[retrieveCar] GW result",{result:a,gateway:r});let s=await Ed.fromIterable(a);Ri("[retrieveCar] GW decodeResult",{car:s,gateway:r});let u=(await s.getRoots())[0];if(!Ml(e)&&!qh(e,u))throw gs("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=Ml(t),o=`${n}${i?"ipns/":"ipfs/"}${t.toString()}?format=car&dag-scope=${r}`;return Ri({isIpns:i,url:o}),o}async function uj(e,t){if(!e?.ok||!e?.body)throw gs("[retrieveCar] unexpected response",e?.statusText,{url:t});return bN(e.body.getReader())}async function Kl(e,t,r=1){try{return await Promise.any(Xo(e).map(async n=>{try{return await t(n,r)}catch(i){throw gs("still trying",i),i instanceof Error?i:new Error(`[retrieveCar] error: ${i}`)}}))}catch(n){if(r<3)return await Kl(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:l8,LOG:c8,DEBUG:f8,VERBOSE:d8,ERROR:p8}=Ae.setup(Ae.INFO),{WARN:h8,LOG:y8,DEBUG:g8,VERBOSE:m8,ERROR:b8}=Ae.setup(Ae.INFO),{WARN:lj,LOG:v8,DEBUG:cj,VERBOSE:ms,ERROR:w8}=Ae.setup(Ae.INFO),_8=tt("queryDivergencesByPrev",function(e){cj(`queryDivergencesByPrev<${e.nameAndSizeUntracked}>`),e.filters.includes("lastWriteWins")&&lj("queryDivergencesByPrev on thread lastWriteWins",e);let t=Ht(()=>{let r=new Map,n=new Set;ms("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())),ms("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 vo(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 ms.isDisabled||Dt(()=>ms("[queryDivergencesByPrev] result:",br(t))),t},{equals:Je.structural}),{WARN:T8,LOG:E8,DEBUG:x8,VERBOSE:O8,ERROR:A8}=Gn.setup(Gn.INFO);var{WARN:$8,LOG:N8,DEBUG:j8,VERBOSE:C8,ERROR:U8}=Ts.setup(Ts.INFO),fj="https://nftstorage.link";async function P8(e,{readOnly:t=!0,pinnedCID:r}={}){return ql(e,{readOnly:t,pinnedCID:r,gateways:[{url:fj}]})}export{fj as a,P8 as b};
|
|
64
64
|
/*! Bundled license information:
|
|
65
65
|
|
|
66
66
|
@noble/hashes/utils.js:
|
|
@@ -79,4 +79,4 @@ lodash-es/lodash.js:
|
|
|
79
79
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
80
80
|
*)
|
|
81
81
|
*/
|
|
82
|
-
//# sourceMappingURL=chunk-
|
|
82
|
+
//# sourceMappingURL=chunk-T37KBFFF.min.js.map
|