@wovin/connect-nftstorage 0.0.26 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import{e as zs}from"./chunk-BKKH6BET.min.js";var gg=Object.create,jd=Object.defineProperty,mg=Object.getOwnPropertyDescriptor,bg=Object.getOwnPropertyNames,vg=Object.getPrototypeOf,wg=Object.prototype.hasOwnProperty,li=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Tg=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of bg(t))!wg.call(e,i)&&i!==r&&jd(e,i,{get:()=>t[i],enumerable:!(n=mg(t,i))||n.enumerable});return e},mo=(e,t,r)=>(r=e!=null?gg(vg(e)):{},Tg(t||!e||!e.__esModule?jd(r,"default",{value:e,enumerable:!0}):r,e)),_g=li((e,t)=>{"use strict";t.exports=a;var r=128,n=127,i=~n,o=Math.pow(2,31);function a(s,u,l){if(Number.MAX_SAFE_INTEGER&&s>Number.MAX_SAFE_INTEGER)throw a.bytes=0,new RangeError("Could not encode varint");u=u||[],l=l||0;for(var f=l;s>=o;)u[l++]=s&255|r,s/=128;for(;s&i;)u[l++]=s&255|r,s>>>=7;return u[l]=s|0,a.bytes=l-f+1,u}}),Eg=li((e,t)=>{"use strict";t.exports=i;var r=128,n=127;function i(o,u){var s=0,u=u||0,l=0,f=u,d,I=o.length;do{if(f>=I||l>49)throw i.bytes=0,new RangeError("Could not decode varint");d=o[f++],s+=l<28?(d&n)<<l:(d&n)*Math.pow(2,l),l+=7}while(d>=r);return i.bytes=f-u,s}}),xg=li((e,t)=>{"use strict";var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),a=Math.pow(2,35),s=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),f=Math.pow(2,63);t.exports=function(d){return d<r?1:d<n?2:d<i?3:d<o?4:d<a?5:d<s?6:d<u?7:d<l?8:d<f?9:10}}),Gu=li((e,t)=>{"use strict";t.exports={encode:_g(),decode:Eg(),encodingLength:xg()}}),Og=li(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},r=typeof window<"u"&&typeof window.document<"u",n=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,i=(typeof self>"u"?"undefined":t(self))==="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope",o=typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),a=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u";e.isBrowser=r,e.isWebWorker=i,e.isNode=n,e.isJsDom=o,e.isDeno=a}),Ag=li((e,t)=>{"use strict";t.exports=function(r,n){n||(n={}),typeof n=="function"&&(n={cmp:n});var i=typeof n.cycles=="boolean"?n.cycles:!1,o=n.cmp&&function(s){return function(u){return function(l,f){var d={key:l,value:u[l]},I={key:f,value:u[f]};return s(d,I)}}}(n.cmp),a=[];return function s(u){if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u!==void 0){if(typeof u=="number")return isFinite(u)?""+u:"null";if(typeof u!="object")return JSON.stringify(u);var l,f;if(Array.isArray(u)){for(f="[",l=0;l<u.length;l++)l&&(f+=","),f+=s(u[l])||"null";return f+"]"}if(u===null)return"null";if(a.indexOf(u)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var d=a.push(u)-1,I=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<I.length;l++){var E=I[l],_=s(u[E]);_&&(f&&(f+=","),f+=JSON.stringify(E)+":"+_)}return a.splice(d,1),"{"+f+"}"}}(r)}}),Sg=["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 Ig(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":kg(e)||"Object"}function kg(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Sg.includes(t))return t}var G=class{constructor(e,t,r){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=r}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}static equals(e,t){return e===t||e.major===t.major&&e.name===t.name}};G.uint=new G(0,"uint",!0);G.negint=new G(1,"negint",!0);G.bytes=new G(2,"bytes",!0);G.string=new G(3,"string",!0);G.array=new G(4,"array",!1);G.map=new G(5,"map",!1);G.tag=new G(6,"tag",!1);G.float=new G(7,"float",!0);G.false=new G(7,"false",!0);G.true=new G(7,"true",!0);G.null=new G(7,"null",!0);G.undefined=new G(7,"undefined",!0);G.break=new G(7,"break",!0);var we=class{constructor(e,t,r){this.type=e,this.value=t,this.encodedLength=r,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},bo=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",$g=new TextEncoder;function ca(e){return bo&&globalThis.Buffer.isBuffer(e)}function Wu(e){return e instanceof Uint8Array?ca(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var jg=24,Cg=200,Ng=bo?e=>e.length>=jg?globalThis.Buffer.from(e):Oc(e):e=>e.length>=Cg?$g.encode(e):Oc(e),Tr=e=>Uint8Array.from(e),Ug=bo?(e,t,r)=>ca(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Pg=bo?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Wu(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},Bg=bo?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Cd(e,t){if(ca(e)&&ca(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}function Oc(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 Dg=256,Nd=class{constructor(e=Dg){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=Bg(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=Ug(r,0,this.cursor)}else t=Pg(this.chunks,this.cursor);return e&&this.reset(),t}},Rg=class{constructor(e){this.dest=e,this.cursor=0,this.chunks=[e]}reset(){this.cursor=0}push(e){if(this.cursor+e.length>this.dest.length)throw new Error("write out of bounds, destination buffer is too small");this.dest.set(e,this.cursor),this.cursor+=e.length}toBytes(e=!1){let t=this.dest.subarray(0,this.cursor);return e&&this.reset(),t}},Ie="CBOR decode error:",Ud="CBOR encode error:",vo=[];vo[23]=1;vo[24]=2;vo[25]=3;vo[26]=5;vo[27]=9;function ci(e,t,r){if(e.length-t<r)throw new Error(`${Ie} not enough data for type`)}var st=[24,256,65536,4294967296,BigInt("18446744073709551616")];function En(e,t,r){ci(e,t,1);let n=e[t];if(r.strict===!0&&n<st[0])throw new Error(`${Ie} integer encoded in more bytes than necessary (strict decode)`);return n}function xn(e,t,r){ci(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<st[1])throw new Error(`${Ie} integer encoded in more bytes than necessary (strict decode)`);return n}function On(e,t,r){ci(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<st[2])throw new Error(`${Ie} integer encoded in more bytes than necessary (strict decode)`);return n}function An(e,t,r){ci(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<st[3])throw new Error(`${Ie} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${Ie} integers outside of the safe integer range are not supported`)}function Mg(e,t,r,n){return new we(G.uint,En(e,t+1,n),2)}function Lg(e,t,r,n){return new we(G.uint,xn(e,t+1,n),3)}function Vg(e,t,r,n){return new we(G.uint,On(e,t+1,n),5)}function Fg(e,t,r,n){return new we(G.uint,An(e,t+1,n),9)}function Sn(e,t){return Gt(e,0,t.value)}function Gt(e,t,r){if(r<st[0]){let n=Number(r);e.push([t|n])}else if(r<st[1]){let n=Number(r);e.push([t|24,n])}else if(r<st[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<st[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<st[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,e.push(i)}else throw new Error(`${Ie} encountered BigInt larger than allowable range`)}}Sn.encodedSize=function(e){return Gt.encodedSize(e.value)};Gt.encodedSize=function(e){return e<st[0]?1:e<st[1]?2:e<st[2]?3:e<st[3]?5:9};Sn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function zg(e,t,r,n){return new we(G.negint,-1-En(e,t+1,n),2)}function Kg(e,t,r,n){return new we(G.negint,-1-xn(e,t+1,n),3)}function qg(e,t,r,n){return new we(G.negint,-1-On(e,t+1,n),5)}var Hu=BigInt(-1),Pd=BigInt(1);function Gg(e,t,r,n){let i=An(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new we(G.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Ie} integers outside of the safe integer range are not supported`);return new we(G.negint,Hu-BigInt(i),9)}function Ju(e,t){let r=t.value,n=typeof r=="bigint"?r*Hu-Pd:r*-1-1;Gt(e,t.type.majorEncoded,n)}Ju.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*Hu-Pd:t*-1-1;return r<st[0]?1:r<st[1]?2:r<st[2]?3:r<st[3]?5:9};Ju.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function wo(e,t,r,n){ci(e,t,r+n);let i=e.slice(t+r,t+r+n);return new we(G.bytes,i,r+n)}function Wg(e,t,r,n){return wo(e,t,1,r)}function Hg(e,t,r,n){return wo(e,t,2,En(e,t+1,n))}function Jg(e,t,r,n){return wo(e,t,3,xn(e,t+1,n))}function Xg(e,t,r,n){return wo(e,t,5,On(e,t+1,n))}function Qg(e,t,r,n){let i=An(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ie} 64-bit integer bytes lengths not supported`);return wo(e,t,9,i)}function fa(e){return e.encodedBytes===void 0&&(e.encodedBytes=G.equals(e.type,G.string)?Ng(e.value):e.value),e.encodedBytes}function ts(e,t){let r=fa(t);Gt(e,t.type.majorEncoded,r.length),e.push(r)}ts.encodedSize=function(e){let t=fa(e);return Gt.encodedSize(t.length)+t.length};ts.compareTokens=function(e,t){return Zg(fa(e),fa(t))};function Zg(e,t){return e.length<t.length?-1:e.length>t.length?1:Cd(e,t)}var Ac=new TextDecoder,Yg=32;function em(e,t,r){if(r-t<Yg){let n="";for(let i=t;i<r;i++){let o=e[i];if(o&128)return Ac.decode(e.subarray(t,r));n+=String.fromCharCode(o)}return n}return Ac.decode(e.subarray(t,r))}function To(e,t,r,n,i){let o=r+n;ci(e,t,o);let a=new we(G.string,em(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=e.slice(t+r,t+o)),a}function tm(e,t,r,n){return To(e,t,1,r,n)}function rm(e,t,r,n){return To(e,t,2,En(e,t+1,n),n)}function nm(e,t,r,n){return To(e,t,3,xn(e,t+1,n),n)}function im(e,t,r,n){return To(e,t,5,On(e,t+1,n),n)}function om(e,t,r,n){let i=An(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ie} 64-bit integer string lengths not supported`);return To(e,t,9,i,n)}var am=ts;function fi(e,t,r,n){return new we(G.array,n,r)}function sm(e,t,r,n){return fi(e,t,1,r)}function um(e,t,r,n){return fi(e,t,2,En(e,t+1,n))}function lm(e,t,r,n){return fi(e,t,3,xn(e,t+1,n))}function cm(e,t,r,n){return fi(e,t,5,On(e,t+1,n))}function fm(e,t,r,n){let i=An(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ie} 64-bit integer array lengths not supported`);return fi(e,t,9,i)}function dm(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ie} indefinite length items not allowed`);return fi(e,t,1,1/0)}function Xu(e,t){Gt(e,G.array.majorEncoded,t.value)}Xu.compareTokens=Sn.compareTokens;Xu.encodedSize=function(e){return Gt.encodedSize(e.value)};function di(e,t,r,n){return new we(G.map,n,r)}function pm(e,t,r,n){return di(e,t,1,r)}function hm(e,t,r,n){return di(e,t,2,En(e,t+1,n))}function ym(e,t,r,n){return di(e,t,3,xn(e,t+1,n))}function gm(e,t,r,n){return di(e,t,5,On(e,t+1,n))}function mm(e,t,r,n){let i=An(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ie} 64-bit integer map lengths not supported`);return di(e,t,9,i)}function bm(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ie} indefinite length items not allowed`);return di(e,t,1,1/0)}function Qu(e,t){Gt(e,G.map.majorEncoded,t.value)}Qu.compareTokens=Sn.compareTokens;Qu.encodedSize=function(e){return Gt.encodedSize(e.value)};function vm(e,t,r,n){return new we(G.tag,r,1)}function wm(e,t,r,n){return new we(G.tag,En(e,t+1,n),2)}function Tm(e,t,r,n){return new we(G.tag,xn(e,t+1,n),3)}function _m(e,t,r,n){return new we(G.tag,On(e,t+1,n),5)}function Em(e,t,r,n){return new we(G.tag,An(e,t+1,n),9)}function Zu(e,t){Gt(e,G.tag.majorEncoded,t.value)}Zu.compareTokens=Sn.compareTokens;Zu.encodedSize=function(e){return Gt.encodedSize(e.value)};var Bd=20,Dd=21,Rd=22,Md=23;function xm(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Ie} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new we(G.null,null,1):new we(G.undefined,void 0,1)}function Om(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ie} indefinite length items not allowed`);return new we(G.break,void 0,1)}function Yu(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Ie} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Ie} Infinity values are not supported`)}return new we(G.float,e,t)}function Am(e,t,r,n){return Yu(tl(e,t+1),3,n)}function Sm(e,t,r,n){return Yu(rl(e,t+1),5,n)}function Im(e,t,r,n){return Yu(zd(e,t+1),9,n)}function el(e,t,r){let n=t.value;if(n===!1)e.push([G.float.majorEncoded|Bd]);else if(n===!0)e.push([G.float.majorEncoded|Dd]);else if(n===null)e.push([G.float.majorEncoded|Rd]);else if(n===void 0)e.push([G.float.majorEncoded|Md]);else{let i,o=!1;(!r||r.float64!==!0)&&(Vd(n),i=tl(Zt,1),n===i||Number.isNaN(n)?(Zt[0]=249,e.push(Zt.slice(0,3)),o=!0):(Fd(n),i=rl(Zt,1),n===i&&(Zt[0]=250,e.push(Zt.slice(0,5)),o=!0))),o||(km(n),i=zd(Zt,1),Zt[0]=251,e.push(Zt.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){Vd(r);let n=tl(Zt,1);if(r===n||Number.isNaN(r))return 3;if(Fd(r),n=rl(Zt,1),r===n)return 5}return 9};var Ld=new ArrayBuffer(9),jt=new DataView(Ld,1),Zt=new Uint8Array(Ld,0);function Vd(e){if(e===1/0)jt.setUint16(0,31744,!1);else if(e===-1/0)jt.setUint16(0,64512,!1);else if(Number.isNaN(e))jt.setUint16(0,32256,!1);else{jt.setFloat32(0,e);let t=jt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)jt.setUint16(0,31744,!1);else if(r===0)jt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?jt.setUint16(0,0):i<-14?jt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):jt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function tl(e,t){if(e.length-t<2)throw new Error(`${Ie} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function Fd(e){jt.setFloat32(0,e,!1)}function rl(e,t){if(e.length-t<4)throw new Error(`${Ie} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function km(e){jt.setFloat64(0,e,!1)}function zd(e,t){if(e.length-t<8)throw new Error(`${Ie} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}el.compareTokens=Sn.compareTokens;function Ne(e,t,r){throw new Error(`${Ie} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function rs(e){return()=>{throw new Error(`${Ie} ${e}`)}}var le=[];for(let e=0;e<=23;e++)le[e]=Ne;le[24]=Mg;le[25]=Lg;le[26]=Vg;le[27]=Fg;le[28]=Ne;le[29]=Ne;le[30]=Ne;le[31]=Ne;for(let e=32;e<=55;e++)le[e]=Ne;le[56]=zg;le[57]=Kg;le[58]=qg;le[59]=Gg;le[60]=Ne;le[61]=Ne;le[62]=Ne;le[63]=Ne;for(let e=64;e<=87;e++)le[e]=Wg;le[88]=Hg;le[89]=Jg;le[90]=Xg;le[91]=Qg;le[92]=Ne;le[93]=Ne;le[94]=Ne;le[95]=rs("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)le[e]=tm;le[120]=rm;le[121]=nm;le[122]=im;le[123]=om;le[124]=Ne;le[125]=Ne;le[126]=Ne;le[127]=rs("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)le[e]=sm;le[152]=um;le[153]=lm;le[154]=cm;le[155]=fm;le[156]=Ne;le[157]=Ne;le[158]=Ne;le[159]=dm;for(let e=160;e<=183;e++)le[e]=pm;le[184]=hm;le[185]=ym;le[186]=gm;le[187]=mm;le[188]=Ne;le[189]=Ne;le[190]=Ne;le[191]=bm;for(let e=192;e<=215;e++)le[e]=vm;le[216]=wm;le[217]=Tm;le[218]=_m;le[219]=Em;le[220]=Ne;le[221]=Ne;le[222]=Ne;le[223]=Ne;for(let e=224;e<=243;e++)le[e]=rs("simple values are not supported");le[244]=Ne;le[245]=Ne;le[246]=Ne;le[247]=xm;le[248]=rs("simple values are not supported");le[249]=Am;le[250]=Sm;le[251]=Im;le[252]=Ne;le[253]=Ne;le[254]=Ne;le[255]=Om;var mr=[];for(let e=0;e<24;e++)mr[e]=new we(G.uint,e,1);for(let e=-1;e>=-24;e--)mr[31-e]=new we(G.negint,e,1);mr[64]=new we(G.bytes,new Uint8Array(0),1);mr[96]=new we(G.string,"",1);mr[128]=new we(G.array,0,1);mr[160]=new we(G.map,0,1);mr[244]=new we(G.false,!1,1);mr[245]=new we(G.true,!0,1);mr[246]=new we(G.null,null,1);function $m(e){switch(e.type){case G.false:return Tr([244]);case G.true:return Tr([245]);case G.null:return Tr([246]);case G.bytes:return e.value.length?void 0:Tr([64]);case G.string:return e.value===""?Tr([96]):void 0;case G.array:return e.value===0?Tr([128]):void 0;case G.map:return e.value===0?Tr([160]):void 0;case G.uint:return e.value<24?Tr([Number(e.value)]):void 0;case G.negint:if(e.value>=-24)return Tr([31-Number(e.value)])}}var jm=Object.freeze({float64:!0,mapSorter:Bm,quickEncodeToken:$m});function Cm(){let e=[];return e[G.uint.major]=Sn,e[G.negint.major]=Ju,e[G.bytes.major]=ts,e[G.string.major]=am,e[G.array.major]=Xu,e[G.map.major]=Qu,e[G.tag.major]=Zu,e[G.float.major]=el,e}var Nm=Cm(),Um=new Nd,Sc=class Kd{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(`${Ud} object contains circular references`);return new Kd(r,t)}},Rr={null:new we(G.null,null),undefined:new we(G.undefined,void 0),true:new we(G.true,!0),false:new we(G.false,!1),emptyArray:new we(G.array,0),emptyMap:new we(G.map,0)},Zr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new we(G.float,e):e>=0?new we(G.uint,e):new we(G.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new we(G.uint,e):new we(G.negint,e)},Uint8Array(e,t,r,n){return new we(G.bytes,e)},string(e,t,r,n){return new we(G.string,e)},boolean(e,t,r,n){return e?Rr.true:Rr.false},null(e,t,r,n){return Rr.null},undefined(e,t,r,n){return Rr.undefined},ArrayBuffer(e,t,r,n){return new we(G.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new we(G.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Rr.emptyArray,new we(G.break)]:Rr.emptyArray;n=Sc.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=Xo(a,r,n);return r.addBreakTokens?[new we(G.array,e.length),i,new we(G.break)]:[new we(G.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length,s;if(a){s=new Array(a),n=Sc.createCheck(n,e);let u=!i&&r.ignoreUndefinedProperties,l=0;for(let f of o){let d=i?e.get(f):e[f];u&&d===void 0||(s[l++]=[Xo(f,r,n),Xo(d,r,n)])}l<a&&(s.length=l)}return s?.length?(Pm(s,r),r.addBreakTokens?[new we(G.map,s.length),s,new we(G.break)]:[new we(G.map,s.length),s]):r.addBreakTokens===!0?[Rr.emptyMap,new we(G.break)]:Rr.emptyMap}};Zr.Map=Zr.Object;Zr.Buffer=Zr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Zr[`${e}Array`]=Zr.DataView;function Xo(e,t={},r){let n=Ig(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(`${Ud} unsupported type: ${n}`);return o(e,n,t,r)}function Pm(e,t){t.mapSorter&&e.sort(t.mapSorter)}function Bm(e,t){if(e[0]instanceof we&&t[0]instanceof we){let r=e[0],n=t[0];return r._keyBytes||(r._keyBytes=Ic(r.value)),n._keyBytes||(n._keyBytes=Ic(n.value)),Cd(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function Ic(e){return Dm(e,Nm,jm)}function qd(e,t,r,n){if(Array.isArray(t))for(let i of t)qd(e,i,r,n);else r[t.type.major](e,t,n)}var eN=G.uint.majorEncoded,tN=G.negint.majorEncoded,rN=G.bytes.majorEncoded,nN=G.string.majorEncoded,iN=G.array.majorEncoded,oN=G.float.majorEncoded|Bd,aN=G.float.majorEncoded|Dd,sN=G.float.majorEncoded|Rd,uN=G.float.majorEncoded|Md,lN=BigInt(-1),cN=BigInt(1);function Dm(e,t,r,n){let i=n instanceof Uint8Array,o=i?new Rg(n):Um,a=Xo(e,r);if(!Array.isArray(a)&&r.quickEncodeToken){let s=r.quickEncodeToken(a);if(s)return i?(o.push(s),o.toBytes()):s;let u=t[a.type.major];if(u.encodedSize){let l=u.encodedSize(a,r);if(i||(o=new Nd(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():Wu(o.chunks[0])}}return o.reset(),qd(o,a,t,r),o.toBytes(!0)}var Rm={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Mm=class{constructor(e,t={}){this._pos=0,this.data=e,this.options=t}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let e=this.data[this._pos],t=mr[e];if(t===void 0){let r=le[e];if(!r)throw new Error(`${Ie} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let n=e&31;t=r(this.data,this._pos,n,this.options)}return this._pos+=t.encodedLength,t}},ro=Symbol.for("DONE"),ns=Symbol.for("BREAK");function Lm(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=no(t,r);if(o===ns){if(e.value===1/0)break;throw new Error(`${Ie} got unexpected break to lengthed array`)}if(o===ro)throw new Error(`${Ie} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function Vm(e,t,r){let n=r.useMaps===!0,i=r.rejectDuplicateMapKeys===!0,o=n?void 0:{},a=n?new Map:void 0;for(let s=0;s<e.value;s++){let u=no(t,r);if(u===ns){if(e.value===1/0)break;throw new Error(`${Ie} got unexpected break to lengthed map`)}if(u===ro)throw new Error(`${Ie} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(!n&&typeof u!="string")throw new Error(`${Ie} non-string keys not supported (got ${typeof u})`);if(i&&(n&&a.has(u)||!n&&Object.hasOwn(o,u)))throw new Error(`${Ie} found repeat map key "${u}"`);let l=no(t,r);if(l===ro)throw new Error(`${Ie} found map but not enough entries (got ${s} [no value], expected ${e.value})`);n?a.set(u,l):o[u]=l}return n?a:o}function no(e,t){if(e.done())return ro;let r=e.next();if(G.equals(r.type,G.break))return ns;if(r.type.terminal)return r.value;if(G.equals(r.type,G.array))return Lm(r,e,t);if(G.equals(r.type,G.map))return Vm(r,e,t);if(G.equals(r.type,G.tag)){if(t.tags&&typeof t.tags[r.value]=="function"){let n=no(e,t);return t.tags[r.value](n)}throw new Error(`${Ie} tag not supported (${r.value})`)}throw new Error("unsupported")}function Fm(e,t){if(!(e instanceof Uint8Array))throw new Error(`${Ie} data to decode must be a Uint8Array`);t=Object.assign({},Rm,t);let r=Wu(e),n=t.tokenizer||new Mm(r,t),i=no(n,t);if(i===ro)throw new Error(`${Ie} did not find any content to decode`);if(i===ns)throw new Error(`${Ie} got unexpected break`);return[i,e.subarray(n.pos())]}function zm(e,t){let[r,n]=Fm(e,t);if(n.length>0)throw new Error(`${Ie} too many terminals, data makes no sense`);return r}var fN=new Uint8Array(0);function Km(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 qm(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(_){if(_ instanceof Uint8Array||(ArrayBuffer.isView(_)?_=new Uint8Array(_.buffer,_.byteOffset,_.byteLength):Array.isArray(_)&&(_=Uint8Array.from(_))),!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(_.length===0)return"";for(var L=0,J=0,B=0,k=_.length;B!==k&&_[B]===0;)B++,L++;for(var F=(k-B)*f+1>>>0,q=new Uint8Array(F);B!==k;){for(var D=_[B],Q=0,K=F-1;(D!==0||Q<J)&&K!==-1;K--,Q++)D+=256*q[K]>>>0,q[K]=D%s>>>0,D=D/s>>>0;if(D!==0)throw new Error("Non-zero carry");J=Q,B++}for(var re=F-J;re!==F&&q[re]===0;)re++;for(var $=u.repeat(L);re<F;++re)$+=e.charAt(q[re]);return $}function I(_){if(typeof _!="string")throw new TypeError("Expected String");if(_.length===0)return new Uint8Array;var L=0;if(_[L]!==" "){for(var J=0,B=0;_[L]===u;)J++,L++;for(var k=(_.length-L)*l+1>>>0,F=new Uint8Array(k);_[L];){var q=r[_.charCodeAt(L)];if(q===255)return;for(var D=0,Q=k-1;(q!==0||D<B)&&Q!==-1;Q--,D++)q+=s*F[Q]>>>0,F[Q]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");B=D,L++}if(_[L]!==" "){for(var K=k-B;K!==k&&F[K]===0;)K++;for(var re=new Uint8Array(J+(k-K)),$=J;K!==k;)re[$++]=F[K++];return re}}}function E(_){var L=I(_);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:I,decode:E}}var Gm=qm,Wm=Gm,Hm=Wm,Jm=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")}},Xm=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 Gd(this,e)}},Qm=class{decoders;constructor(e){this.decoders=e}or(e){return Gd(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 Gd(e,t){return new Qm({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Zm=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 Jm(e,t,r),this.decoder=new Xm(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Wd({name:e,prefix:t,encode:r,decode:n}){return new Zm(e,t,r,n)}function is({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Hm(r,e);return Wd({prefix:t,name:e,encode:n,decode:o=>nl(i(o))})}function Ym(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 eb(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 tb(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function $r({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=tb(n);return Wd({prefix:t,name:e,encode(o){return eb(o,n,r)},decode(o){return Ym(o,i,r,e)}})}var Qo=$r({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),dN=$r({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),pN=$r({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),hN=$r({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),yN=$r({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),gN=$r({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),mN=$r({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),bN=$r({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),vN=$r({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Ks=is({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),wN=is({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Kr=is({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),TN=is({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),rb=Hd,kc=128,nb=127,ib=~nb,ob=Math.pow(2,31);function Hd(e,t,r){t=t||[],r=r||0;for(var n=r;e>=ob;)t[r++]=e&255|kc,e/=128;for(;e&ib;)t[r++]=e&255|kc,e>>>=7;return t[r]=e|0,Hd.bytes=r-n+1,t}var ab=fu,sb=128,$c=127;function fu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw fu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&$c)<<i:(a&$c)*Math.pow(2,i),i+=7}while(a>=sb);return fu.bytes=o-n,r}var ub=Math.pow(2,7),lb=Math.pow(2,14),cb=Math.pow(2,21),fb=Math.pow(2,28),db=Math.pow(2,35),pb=Math.pow(2,42),hb=Math.pow(2,49),yb=Math.pow(2,56),gb=Math.pow(2,63),mb=function(e){return e<ub?1:e<lb?2:e<cb?3:e<fb?4:e<db?5:e<pb?6:e<hb?7:e<yb?8:e<gb?9:10},bb={encode:rb,decode:ab,encodingLength:mb},vb=bb,da=vb;function du(e,t=0){return[da.decode(e,t),da.decode.bytes]}function pa(e,t,r=0){return da.encode(e,t,r),t}function ha(e){return da.encodingLength(e)}function wb(e,t){let r=t.byteLength,n=ha(e),i=n+ha(r),o=new Uint8Array(i+r);return pa(e,o,0),pa(r,o,n),o.set(t,i),new il(e,r,t,o)}function Tb(e){let t=nl(e),[r,n]=du(t),[i,o]=du(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 _b(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Km(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}};function jc(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return xb(r,pu(e),t??Kr.encoder);default:return Ob(r,pu(e),t??Qo.encoder)}}var Cc=new WeakMap;function pu(e){let t=Cc.get(e);if(t==null){let r=new Map;return Cc.set(e,r),r}return t}var Jd=class pt{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==Li)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Ab)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return pt.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=wb(t,r);return pt.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return pt.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&_b(t.multihash,n.multihash)}toString(t){return jc(this,t)}toJSON(){return{"/":jc(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof pt)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new pt(n,i,o,a??Nc(n,i,o.bytes))}else if(r[Sb]===!0){let{version:n,multihash:i,code:o}=r,a=Tb(i);return pt.create(n,o,a)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==Li)throw new Error(`Version 0 CID must use dag-pb (code: ${Li}) block encoding`);return new pt(t,r,n,n.bytes)}case 1:{let i=Nc(t,r,n.bytes);return new pt(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return pt.create(0,Li,t)}static createV1(t,r){return pt.create(1,t,r)}static decode(t){let[r,n]=pt.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=pt.inspectBytes(t),n=r.size-r.multihashSize,i=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?pt.createV0(a):pt.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,I]=du(t.subarray(r));return r+=I,d},i=n(),o=Li;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=Eb(t,r),o=pt.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return pu(o).set(n,t),o}};function Eb(e,t){switch(e[0]){case"Q":{let r=t??Kr;return[Kr.prefix,r.decode(`${Kr.prefix}${e}`)]}case Kr.prefix:{let r=t??Kr;return[Kr.prefix,r.decode(e)]}case Qo.prefix:{let r=t??Qo;return[Qo.prefix,r.decode(e)]}case Ks.prefix:{let r=t??Ks;return[Ks.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 xb(e,t,r){let{prefix:n}=r;if(n!==Kr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function Ob(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var Li=112,Ab=18;function Nc(e,t,r){let n=ha(e),i=n+ha(t),o=new Uint8Array(i+r.byteLength);return pa(e,o,0),pa(t,o,n),o.set(r,i),o}var Sb=Symbol.for("@ipld/js-cid/CID"),Xd=42;function Ib(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Jd.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new we(G.tag,Xd),new we(G.bytes,r)]}function kb(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function $b(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 Uc={float64:!0,typeEncoders:{Object:Ib,undefined:kb,number:$b}},_N={...Uc,typeEncoders:{...Uc.typeEncoders}};function jb(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Jd.decode(e.subarray(1))}var ya={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};ya.tags[Xd]=jb;var EN={...ya,tags:ya.tags.slice()},Cb=e=>zm(e,ya),xN=new Uint8Array(0);function Nb(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 Ub(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(_){if(_ instanceof Uint8Array||(ArrayBuffer.isView(_)?_=new Uint8Array(_.buffer,_.byteOffset,_.byteLength):Array.isArray(_)&&(_=Uint8Array.from(_))),!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(_.length===0)return"";for(var L=0,J=0,B=0,k=_.length;B!==k&&_[B]===0;)B++,L++;for(var F=(k-B)*f+1>>>0,q=new Uint8Array(F);B!==k;){for(var D=_[B],Q=0,K=F-1;(D!==0||Q<J)&&K!==-1;K--,Q++)D+=256*q[K]>>>0,q[K]=D%s>>>0,D=D/s>>>0;if(D!==0)throw new Error("Non-zero carry");J=Q,B++}for(var re=F-J;re!==F&&q[re]===0;)re++;for(var $=u.repeat(L);re<F;++re)$+=e.charAt(q[re]);return $}function I(_){if(typeof _!="string")throw new TypeError("Expected String");if(_.length===0)return new Uint8Array;var L=0;if(_[L]!==" "){for(var J=0,B=0;_[L]===u;)J++,L++;for(var k=(_.length-L)*l+1>>>0,F=new Uint8Array(k);_[L];){var q=r[_.charCodeAt(L)];if(q===255)return;for(var D=0,Q=k-1;(q!==0||D<B)&&Q!==-1;Q--,D++)q+=s*F[Q]>>>0,F[Q]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");B=D,L++}if(_[L]!==" "){for(var K=k-B;K!==k&&F[K]===0;)K++;for(var re=new Uint8Array(J+(k-K)),$=J;K!==k;)re[$++]=F[K++];return re}}}function E(_){var L=I(_);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:I,decode:E}}var Pb=Ub,Bb=Pb,Db=Bb,Rb=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")}},Mb=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 Qd(this,e)}},Lb=class{decoders;constructor(e){this.decoders=e}or(e){return Qd(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 Qd(e,t){return new Lb({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Vb=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 Rb(e,t,r),this.decoder=new Mb(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Zd({name:e,prefix:t,encode:r,decode:n}){return new Vb(e,t,r,n)}function Yd({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Db(r,e);return Zd({prefix:t,name:e,encode:n,decode:o=>ol(i(o))})}function Fb(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 zb(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",a=0,s=0;for(let u=0;u<e.length;++u)for(s=s<<8|e[u],a+=8;a>r;)a-=r,o+=t[i&s>>a];if(a!==0&&(o+=t[i&s<<r-a]),n)for(;o.length*r&7;)o+="=";return o}function jr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return Zd({prefix:t,name:e,encode(i){return zb(i,n,r)},decode(i){return Fb(i,n,r,e)}})}var Zo=jr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ON=jr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),AN=jr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),SN=jr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),IN=jr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),kN=jr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),$N=jr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),jN=jr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),CN=jr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),qr=Yd({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),NN=Yd({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Kb=ep,Pc=128,qb=127,Gb=~qb,Wb=Math.pow(2,31);function ep(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Wb;)t[r++]=e&255|Pc,e/=128;for(;e&Gb;)t[r++]=e&255|Pc,e>>>=7;return t[r]=e|0,ep.bytes=r-n+1,t}var Hb=hu,Jb=128,Bc=127;function hu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw hu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Bc)<<i:(a&Bc)*Math.pow(2,i),i+=7}while(a>=Jb);return hu.bytes=o-n,r}var Xb=Math.pow(2,7),Qb=Math.pow(2,14),Zb=Math.pow(2,21),Yb=Math.pow(2,28),ev=Math.pow(2,35),tv=Math.pow(2,42),rv=Math.pow(2,49),nv=Math.pow(2,56),iv=Math.pow(2,63),ov=function(e){return e<Xb?1:e<Qb?2:e<Zb?3:e<Yb?4:e<ev?5:e<tv?6:e<rv?7:e<nv?8:e<iv?9:10},av={encode:Kb,decode:Hb,encodingLength:ov},sv=av,ga=sv;function yu(e,t=0){return[ga.decode(e,t),ga.decode.bytes]}function ma(e,t,r=0){return ga.encode(e,t,r),t}function ba(e){return ga.encodingLength(e)}function uv(e,t){let r=t.byteLength,n=ba(e),i=n+ba(r),o=new Uint8Array(i+r);return ma(e,o,0),ma(r,o,n),o.set(t,i),new al(e,r,t,o)}function gu(e){let t=ol(e),[r,n]=yu(t),[i,o]=yu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new al(r,i,a,t)}function lv(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Nb(e.bytes,r.bytes)}}var al=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Dc(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return fv(r,mu(e),t??qr.encoder);default:return dv(r,mu(e),t??Zo.encoder)}}var Rc=new WeakMap;function mu(e){let t=Rc.get(e);if(t==null){let r=new Map;return Rc.set(e,r),r}return t}var Mc=class ht{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==Vi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==pv)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return ht.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=uv(t,r);return ht.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return ht.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&lv(t.multihash,n.multihash)}toString(t){return Dc(this,t)}toJSON(){return{"/":Dc(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof ht)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new ht(n,i,o,a??Lc(n,i,o.bytes))}else if(r[hv]===!0){let{version:n,multihash:i,code:o}=r,a=gu(i);return ht.create(n,o,a)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==Vi)throw new Error(`Version 0 CID must use dag-pb (code: ${Vi}) block encoding`);return new ht(t,r,n,n.bytes)}case 1:{let i=Lc(t,r,n.bytes);return new ht(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return ht.create(0,Vi,t)}static createV1(t,r){return ht.create(1,t,r)}static decode(t){let[r,n]=ht.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=ht.inspectBytes(t),n=r.size-r.multihashSize,i=ol(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),a=new al(r.multihashCode,r.digestSize,o,i);return[r.version===0?ht.createV0(a):ht.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,I]=yu(t.subarray(r));return r+=I,d},i=n(),o=Vi;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=cv(t,r),o=ht.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return mu(o).set(n,t),o}};function cv(e,t){switch(e[0]){case"Q":{let r=t??qr;return[qr.prefix,r.decode(`${qr.prefix}${e}`)]}case qr.prefix:{let r=t??qr;return[qr.prefix,r.decode(e)]}case Zo.prefix:{let r=t??Zo;return[Zo.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function fv(e,t,r){let{prefix:n}=r;if(n!==qr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function dv(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var Vi=112,pv=18;function Lc(e,t,r){let n=ba(e),i=n+ba(t),o=new Uint8Array(i+r.byteLength);return ma(e,o,0),ma(t,o,n),o.set(r,i),o}var hv=Symbol.for("@ipld/js-cid/CID"),gn=mo(Gu(),1),qs={SHA2_256:18,LENGTH:32,DAG_PB:112},yv=40;function va(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=gn.default.decode(e);return t.seek(gn.default.decode.bytes),r}function gv(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 mv(e){gn.default.decode(e);let t=gn.default.decode.bytes,r=gn.default.decode(e.subarray(gn.default.decode.bytes)),n=gn.default.decode.bytes;return t+n+r}var Hr={Null:e=>e===null?e:void 0,Int:e=>Number.isInteger(e)?e:void 0,Float:e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,String:e=>typeof e=="string"?e:void 0,Bool:e=>typeof e=="boolean"?e:void 0,Bytes:e=>e instanceof Uint8Array?e:void 0,Link:e=>e!==null&&typeof e=="object"&&e.asCID===e?e:void 0,List:e=>Array.isArray(e)?e:void 0,Map:e=>e!==null&&typeof e=="object"&&e.asCID!==e&&!Array.isArray(e)&&!(e instanceof Uint8Array)?e:void 0},Wi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Hr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Hr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Wi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Wi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Hr.Int,CarV1HeaderOrV2Pragma:e=>{if(Hr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,a]=t[i];switch(o){case"roots":{let s=Wi["CarV1HeaderOrV2Pragma > roots (anon)"](e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=Wi.Int(e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},Hi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Hr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Hr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Hi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Hi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Hr.Int,CarV1HeaderOrV2Pragma:e=>{if(Hr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,a]=t[i];switch(o){case"roots":{let s=Hi["CarV1HeaderOrV2Pragma > roots (anon)"](a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=Hi.Int(a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},bv={toTyped:Wi.CarV1HeaderOrV2Pragma,toRepresentation:Hi.CarV1HeaderOrV2Pragma},vv=["string","number","bigint","symbol"],wv=["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 Tv(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return vv.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":_v(e)?"Buffer":Ev(e)||"Object"}function _v(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function Ev(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(wv.includes(t))return t}var Z=class{constructor(e,t,r){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=r}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}};Z.uint=new Z(0,"uint",!0);Z.negint=new Z(1,"negint",!0);Z.bytes=new Z(2,"bytes",!0);Z.string=new Z(3,"string",!0);Z.array=new Z(4,"array",!1);Z.map=new Z(5,"map",!1);Z.tag=new Z(6,"tag",!1);Z.float=new Z(7,"float",!0);Z.false=new Z(7,"false",!0);Z.true=new Z(7,"true",!0);Z.null=new Z(7,"null",!0);Z.undefined=new Z(7,"undefined",!0);Z.break=new Z(7,"break",!0);var ve=class{constructor(e,t,r){this.type=e,this.value=t,this.encodedLength=r,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},pi=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",xv=new TextDecoder,Ov=new TextEncoder;function wa(e){return pi&&globalThis.Buffer.isBuffer(e)}function Av(e){return e instanceof Uint8Array?wa(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Sv=pi?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Fc(e,t,r):(e,t,r)=>r-t>64?xv.decode(e.subarray(t,r)):Fc(e,t,r),Iv=pi?e=>e.length>64?globalThis.Buffer.from(e):Vc(e):e=>e.length>64?Ov.encode(e):Vc(e),sl=pi?(e,t,r)=>wa(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),kv=pi?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Av(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},$v=pi?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function jv(e,t){if(wa(e)&&wa(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}function Vc(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 Fc(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 Cv(n)}var zc=4096;function Cv(e){let t=e.length;if(t<=zc)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=zc));return r}var Nv=256,Uv=class{constructor(e=Nv){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=$v(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=sl(r,0,this.cursor)}else t=kv(this.chunks,this.cursor);return e&&this.reset(),t}},qe="CBOR decode error:",tp="CBOR encode error:",_o=[];_o[23]=1;_o[24]=2;_o[25]=3;_o[26]=5;_o[27]=9;function hi(e,t,r){if(e.length-t<r)throw new Error(`${qe} not enough data for type`)}var ut=[24,256,65536,4294967296,BigInt("18446744073709551616")];function In(e,t,r){hi(e,t,1);let n=e[t];if(r.strict===!0&&n<ut[0])throw new Error(`${qe} integer encoded in more bytes than necessary (strict decode)`);return n}function kn(e,t,r){hi(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<ut[1])throw new Error(`${qe} integer encoded in more bytes than necessary (strict decode)`);return n}function $n(e,t,r){hi(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<ut[2])throw new Error(`${qe} integer encoded in more bytes than necessary (strict decode)`);return n}function jn(e,t,r){hi(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<ut[3])throw new Error(`${qe} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${qe} integers outside of the safe integer range are not supported`)}function Pv(e,t,r,n){return new ve(Z.uint,In(e,t+1,n),2)}function Bv(e,t,r,n){return new ve(Z.uint,kn(e,t+1,n),3)}function Dv(e,t,r,n){return new ve(Z.uint,$n(e,t+1,n),5)}function Rv(e,t,r,n){return new ve(Z.uint,jn(e,t+1,n),9)}function Cn(e,t){return Wt(e,0,t.value)}function Wt(e,t,r){if(r<ut[0]){let n=Number(r);e.push([t|n])}else if(r<ut[1]){let n=Number(r);e.push([t|24,n])}else if(r<ut[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<ut[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<ut[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,e.push(i)}else throw new Error(`${qe} encountered BigInt larger than allowable range`)}}Cn.encodedSize=function(e){return Wt.encodedSize(e.value)};Wt.encodedSize=function(e){return e<ut[0]?1:e<ut[1]?2:e<ut[2]?3:e<ut[3]?5:9};Cn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function Mv(e,t,r,n){return new ve(Z.negint,-1-In(e,t+1,n),2)}function Lv(e,t,r,n){return new ve(Z.negint,-1-kn(e,t+1,n),3)}function Vv(e,t,r,n){return new ve(Z.negint,-1-$n(e,t+1,n),5)}var ul=BigInt(-1),rp=BigInt(1);function Fv(e,t,r,n){let i=jn(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ve(Z.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${qe} integers outside of the safe integer range are not supported`);return new ve(Z.negint,ul-BigInt(i),9)}function ll(e,t){let r=t.value,n=typeof r=="bigint"?r*ul-rp:r*-1-1;Wt(e,t.type.majorEncoded,n)}ll.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*ul-rp:t*-1-1;return r<ut[0]?1:r<ut[1]?2:r<ut[2]?3:r<ut[3]?5:9};ll.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Eo(e,t,r,n){hi(e,t,r+n);let i=sl(e,t+r,t+r+n);return new ve(Z.bytes,i,r+n)}function zv(e,t,r,n){return Eo(e,t,1,r)}function Kv(e,t,r,n){return Eo(e,t,2,In(e,t+1,n))}function qv(e,t,r,n){return Eo(e,t,3,kn(e,t+1,n))}function Gv(e,t,r,n){return Eo(e,t,5,$n(e,t+1,n))}function Wv(e,t,r,n){let i=jn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${qe} 64-bit integer bytes lengths not supported`);return Eo(e,t,9,i)}function Ta(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===Z.string?Iv(e.value):e.value),e.encodedBytes}function os(e,t){let r=Ta(t);Wt(e,t.type.majorEncoded,r.length),e.push(r)}os.encodedSize=function(e){let t=Ta(e);return Wt.encodedSize(t.length)+t.length};os.compareTokens=function(e,t){return Hv(Ta(e),Ta(t))};function Hv(e,t){return e.length<t.length?-1:e.length>t.length?1:jv(e,t)}function xo(e,t,r,n,i){let o=r+n;hi(e,t,o);let a=new ve(Z.string,Sv(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=sl(e,t+r,t+o)),a}function Jv(e,t,r,n){return xo(e,t,1,r,n)}function Xv(e,t,r,n){return xo(e,t,2,In(e,t+1,n),n)}function Qv(e,t,r,n){return xo(e,t,3,kn(e,t+1,n),n)}function Zv(e,t,r,n){return xo(e,t,5,$n(e,t+1,n),n)}function Yv(e,t,r,n){let i=jn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${qe} 64-bit integer string lengths not supported`);return xo(e,t,9,i,n)}var e0=os;function yi(e,t,r,n){return new ve(Z.array,n,r)}function t0(e,t,r,n){return yi(e,t,1,r)}function r0(e,t,r,n){return yi(e,t,2,In(e,t+1,n))}function n0(e,t,r,n){return yi(e,t,3,kn(e,t+1,n))}function i0(e,t,r,n){return yi(e,t,5,$n(e,t+1,n))}function o0(e,t,r,n){let i=jn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${qe} 64-bit integer array lengths not supported`);return yi(e,t,9,i)}function a0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${qe} indefinite length items not allowed`);return yi(e,t,1,1/0)}function cl(e,t){Wt(e,Z.array.majorEncoded,t.value)}cl.compareTokens=Cn.compareTokens;cl.encodedSize=function(e){return Wt.encodedSize(e.value)};function gi(e,t,r,n){return new ve(Z.map,n,r)}function s0(e,t,r,n){return gi(e,t,1,r)}function u0(e,t,r,n){return gi(e,t,2,In(e,t+1,n))}function l0(e,t,r,n){return gi(e,t,3,kn(e,t+1,n))}function c0(e,t,r,n){return gi(e,t,5,$n(e,t+1,n))}function f0(e,t,r,n){let i=jn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${qe} 64-bit integer map lengths not supported`);return gi(e,t,9,i)}function d0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${qe} indefinite length items not allowed`);return gi(e,t,1,1/0)}function fl(e,t){Wt(e,Z.map.majorEncoded,t.value)}fl.compareTokens=Cn.compareTokens;fl.encodedSize=function(e){return Wt.encodedSize(e.value)};function p0(e,t,r,n){return new ve(Z.tag,r,1)}function h0(e,t,r,n){return new ve(Z.tag,In(e,t+1,n),2)}function y0(e,t,r,n){return new ve(Z.tag,kn(e,t+1,n),3)}function g0(e,t,r,n){return new ve(Z.tag,$n(e,t+1,n),5)}function m0(e,t,r,n){return new ve(Z.tag,jn(e,t+1,n),9)}function dl(e,t){Wt(e,Z.tag.majorEncoded,t.value)}dl.compareTokens=Cn.compareTokens;dl.encodedSize=function(e){return Wt.encodedSize(e.value)};var b0=20,v0=21,w0=22,T0=23;function _0(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${qe} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ve(Z.null,null,1):new ve(Z.undefined,void 0,1)}function E0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${qe} indefinite length items not allowed`);return new ve(Z.break,void 0,1)}function pl(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${qe} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${qe} Infinity values are not supported`)}return new ve(Z.float,e,t)}function x0(e,t,r,n){return pl(yl(e,t+1),3,n)}function O0(e,t,r,n){return pl(gl(e,t+1),5,n)}function A0(e,t,r,n){return pl(ap(e,t+1),9,n)}function hl(e,t,r){let n=t.value;if(n===!1)e.push([Z.float.majorEncoded|b0]);else if(n===!0)e.push([Z.float.majorEncoded|v0]);else if(n===null)e.push([Z.float.majorEncoded|w0]);else if(n===void 0)e.push([Z.float.majorEncoded|T0]);else{let i,o=!1;(!r||r.float64!==!0)&&(ip(n),i=yl(Yt,1),n===i||Number.isNaN(n)?(Yt[0]=249,e.push(Yt.slice(0,3)),o=!0):(op(n),i=gl(Yt,1),n===i&&(Yt[0]=250,e.push(Yt.slice(0,5)),o=!0))),o||(S0(n),i=ap(Yt,1),Yt[0]=251,e.push(Yt.slice(0,9)))}}hl.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){ip(r);let n=yl(Yt,1);if(r===n||Number.isNaN(r))return 3;if(op(r),n=gl(Yt,1),r===n)return 5}return 9};var np=new ArrayBuffer(9),Ct=new DataView(np,1),Yt=new Uint8Array(np,0);function ip(e){if(e===1/0)Ct.setUint16(0,31744,!1);else if(e===-1/0)Ct.setUint16(0,64512,!1);else if(Number.isNaN(e))Ct.setUint16(0,32256,!1);else{Ct.setFloat32(0,e);let t=Ct.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Ct.setUint16(0,31744,!1);else if(r===0)Ct.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Ct.setUint16(0,0):i<-14?Ct.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):Ct.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function yl(e,t){if(e.length-t<2)throw new Error(`${qe} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function op(e){Ct.setFloat32(0,e,!1)}function gl(e,t){if(e.length-t<4)throw new Error(`${qe} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function S0(e){Ct.setFloat64(0,e,!1)}function ap(e,t){if(e.length-t<8)throw new Error(`${qe} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}hl.compareTokens=Cn.compareTokens;function Ue(e,t,r){throw new Error(`${qe} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function as(e){return()=>{throw new Error(`${qe} ${e}`)}}var de=[];for(let e=0;e<=23;e++)de[e]=Ue;de[24]=Pv;de[25]=Bv;de[26]=Dv;de[27]=Rv;de[28]=Ue;de[29]=Ue;de[30]=Ue;de[31]=Ue;for(let e=32;e<=55;e++)de[e]=Ue;de[56]=Mv;de[57]=Lv;de[58]=Vv;de[59]=Fv;de[60]=Ue;de[61]=Ue;de[62]=Ue;de[63]=Ue;for(let e=64;e<=87;e++)de[e]=zv;de[88]=Kv;de[89]=qv;de[90]=Gv;de[91]=Wv;de[92]=Ue;de[93]=Ue;de[94]=Ue;de[95]=as("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)de[e]=Jv;de[120]=Xv;de[121]=Qv;de[122]=Zv;de[123]=Yv;de[124]=Ue;de[125]=Ue;de[126]=Ue;de[127]=as("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)de[e]=t0;de[152]=r0;de[153]=n0;de[154]=i0;de[155]=o0;de[156]=Ue;de[157]=Ue;de[158]=Ue;de[159]=a0;for(let e=160;e<=183;e++)de[e]=s0;de[184]=u0;de[185]=l0;de[186]=c0;de[187]=f0;de[188]=Ue;de[189]=Ue;de[190]=Ue;de[191]=d0;for(let e=192;e<=215;e++)de[e]=p0;de[216]=h0;de[217]=y0;de[218]=g0;de[219]=m0;de[220]=Ue;de[221]=Ue;de[222]=Ue;de[223]=Ue;for(let e=224;e<=243;e++)de[e]=as("simple values are not supported");de[244]=Ue;de[245]=Ue;de[246]=Ue;de[247]=_0;de[248]=as("simple values are not supported");de[249]=x0;de[250]=O0;de[251]=A0;de[252]=Ue;de[253]=Ue;de[254]=Ue;de[255]=E0;var Cr=[];for(let e=0;e<24;e++)Cr[e]=new ve(Z.uint,e,1);for(let e=-1;e>=-24;e--)Cr[31-e]=new ve(Z.negint,e,1);Cr[64]=new ve(Z.bytes,new Uint8Array(0),1);Cr[96]=new ve(Z.string,"",1);Cr[128]=new ve(Z.array,0,1);Cr[160]=new ve(Z.map,0,1);Cr[244]=new ve(Z.false,!1,1);Cr[245]=new ve(Z.true,!0,1);Cr[246]=new ve(Z.null,null,1);function sp(){let e=[];return e[Z.uint.major]=Cn,e[Z.negint.major]=ll,e[Z.bytes.major]=os,e[Z.string.major]=e0,e[Z.array.major]=cl,e[Z.map.major]=fl,e[Z.tag.major]=dl,e[Z.float.major]=hl,e}var UN=sp(),PN=new Uv,Kc=class up{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(`${tp} object contains circular references`);return new up(r,t)}},Mr={null:new ve(Z.null,null),undefined:new ve(Z.undefined,void 0),true:new ve(Z.true,!0),false:new ve(Z.false,!1),emptyArray:new ve(Z.array,0),emptyMap:new ve(Z.map,0)},Yr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ve(Z.float,e):e>=0?new ve(Z.uint,e):new ve(Z.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ve(Z.uint,e):new ve(Z.negint,e)},Uint8Array(e,t,r,n){return new ve(Z.bytes,e)},string(e,t,r,n){return new ve(Z.string,e)},boolean(e,t,r,n){return e?Mr.true:Mr.false},null(e,t,r,n){return Mr.null},undefined(e,t,r,n){return Mr.undefined},ArrayBuffer(e,t,r,n){return new ve(Z.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ve(Z.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Mr.emptyArray,new ve(Z.break)]:Mr.emptyArray;n=Kc.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=Gs(a,r,n);return r.addBreakTokens?[new ve(Z.array,e.length),i,new ve(Z.break)]:[new ve(Z.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length;if(!a)return r.addBreakTokens===!0?[Mr.emptyMap,new ve(Z.break)]:Mr.emptyMap;n=Kc.createCheck(n,e);let s=[],u=0;for(let l of o)s[u++]=[Gs(l,r,n),Gs(i?e.get(l):e[l],r,n)];return I0(s,r),r.addBreakTokens?[new ve(Z.map,a),s,new ve(Z.break)]:[new ve(Z.map,a),s]}};Yr.Map=Yr.Object;Yr.Buffer=Yr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Yr[`${e}Array`]=Yr.DataView;function Gs(e,t={},r){let n=Tv(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Yr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=Yr[n];if(!o)throw new Error(`${tp} unsupported type: ${n}`);return o(e,n,t,r)}function I0(e,t){t.mapSorter&&e.sort(t.mapSorter)}var BN=Symbol.for("DONE"),DN=Symbol.for("BREAK"),RN=sp(),MN=mo(Gu(),1),LN=[new ve(Z.map,2),new ve(Z.string,"version"),new ve(Z.uint,1),new ve(Z.string,"roots")],VN=new ve(Z.tag,42);async function lp(e,t){let r=va(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=Cb(n);if(bv.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=gv(await e.exactly(yv,!0));e.seek(o.dataOffset-e.pos);let a=await lp(e,1);return Object.assign(a,o)}async function k0(e){let t=await e.exactly(2,!1);if(t[0]===qs.SHA2_256&&t[1]===qs.LENGTH){let a=await e.exactly(34,!0),s=gu(a);return Mc.create(0,qs.DAG_PB,s)}let r=va(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=va(await e.upTo(8),e),i=await e.exactly(mv(await e.upTo(8)),!0),o=gu(i);return Mc.create(r,n,o)}async function cp(e){let t=e.pos,r=va(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await k0(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function $0(e){let{cid:t,blockLength:r}=await cp(e);return{bytes:await e.exactly(r,!0),cid:t}}async function j0(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await cp(e),o={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(o.blockLength),o}function C0(e){let t=(async()=>{let r=await lp(e);if(r.version===2){let n=e.pos-r.dataOffset;e=B0(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await $0(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await j0(e)}}}function N0(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 U0(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 P0(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return U0(r)}function B0(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 fp=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 qc(N0(e))}static async fromIterable(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return qc(P0(e))}};async function qc(e){let t=C0(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new fp(r,n)}var FN=mo(Gu(),1),D0={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"},R0=D0;function he(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=typeof e=="string"?e:R0[e];throw typeof i=="function"&&(i=i.apply(null,r)),new Error("[MobX] "+i)}var M0={};function ss(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:M0}var dp=Object.assign,_a=Object.getOwnPropertyDescriptor,pr=Object.defineProperty,Oo=Object.prototype,Ea=[];Object.freeze(Ea);var ml={};Object.freeze(ml);var L0=typeof Proxy<"u",V0=Object.toString();function pp(){L0||he("`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`")}function Fi(e){Y.verifyProxies&&he("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+e)}function Ht(){return++Y.mobxGuid}function bl(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Yn=function(){};function We(e){return typeof e=="function"}function bn(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function us(e){return e!==null&&typeof e=="object"}function sr(e){if(!us(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()===V0}function hp(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function ls(e,t,r){pr(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function yp(e,t,r){pr(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function on(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(n){return us(n)&&n[r]===!0}}function mi(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function F0(e){var t=Object.getPrototypeOf(e),r=Object.getPrototypeOf(t),n=Object.getPrototypeOf(r);return n===null}function Er(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var gp=typeof Object.getOwnPropertySymbols<"u";function z0(e){var t=Object.keys(e);if(!gp)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return Oo.propertyIsEnumerable.call(e,n)})):t}var cs=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:gp?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function bu(e){return typeof e=="string"?e:typeof e=="symbol"?e.toString():new String(e).toString()}function mp(e){return e===null?null:typeof e=="object"?""+e:e}function Vt(e,t){return Oo.hasOwnProperty.call(e,t)}var K0=Object.getOwnPropertyDescriptors||function(e){var t={};return cs(e).forEach(function(r){t[r]=_a(e,r)}),t};function Et(e,t){return!!(e&t)}function xt(e,t,r){return r?e|=t:e&=~t,e}function Gc(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,G0(n.key),n)}}function bi(e,t,r){return t&&Wc(e.prototype,t),r&&Wc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ei(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=W0(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sr(){return Sr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Sr.apply(null,arguments)}function bp(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,vu(e,t)}function vu(e,t){return vu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},vu(e,t)}function q0(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 G0(e){var t=q0(e,"string");return typeof t=="symbol"?t:t+""}function W0(e,t){if(e){if(typeof e=="string")return Gc(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)?Gc(e,t):void 0}}var _t=Symbol("mobx-stored-annotations");function hr(e){function t(r,n){if(So(n))return e.decorate_20223_(r,n);Ao(r,n,e)}return Object.assign(t,e)}function Ao(e,t,r){if(Vt(e,_t)||ls(e,_t,Sr({},e[_t])),xa(r)&&!Vt(e[_t],t)){var n=e.constructor.name+".prototype."+t.toString();he("'"+n+"' is decorated with 'override', but no such decorated member was found on prototype.")}H0(e,r,t),xa(r)||(e[_t][t]=r)}function H0(e,t,r){if(!xa(t)&&Vt(e[_t],r)){var n=e.constructor.name+".prototype."+r.toString(),i=e[_t][r].annotationType_,o=t.annotationType_;he("Cannot apply '@"+o+"' to '"+n+"':"+(`
|
|
3
|
+
The field is already decorated with '@`+i+"'.")+`
|
|
4
|
+
Re-decorating fields is not allowed.
|
|
5
|
+
Use '@override' decorator for methods overridden by subclass.`)}}function J0(e){return Vt(e,_t)||ls(e,_t,Sr({},e[_t])),e[_t]}function So(e){return typeof e=="object"&&typeof e.kind=="string"}function fs(e,t){t.includes(e.kind)||he("The decorator applied to '"+String(e.name)+"' cannot be used on a "+e.kind+" element")}var Ee=Symbol("mobx administration"),an=function(){function e(r){r===void 0&&(r="Atom@"+Ht()),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=je.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=r}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.reportObserved=function(){return Up(this)},t.reportChanged=function(){Rt(),Pp(this),Mt()},t.toString=function(){return this.name_},bi(e,[{key:"isBeingObserved",get:function(){return Et(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=xt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return Et(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=xt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return Et(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=xt(this.flags_,e.diffValueMask_,r===1)}}])}();an.isBeingObservedMask_=1;an.isPendingUnobservationMask_=2;an.diffValueMask_=4;var vl=on("Atom",an);function vp(e,t,r){t===void 0&&(t=Yn),r===void 0&&(r=Yn);var n=new an(e);return t!==Yn&&gs(n,t),r!==Yn&&wi(n,r),n}function X0(e,t){return e===t}function Q0(e,t){return Al(e,t)}function Z0(e,t){return Al(e,t,1)}function Y0(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var et={identity:X0,structural:Q0,default:Y0,shallow:Z0};function vi(e,t,r){return ii(e)?e:Array.isArray(e)?Ke.array(e,{name:r}):sr(e)?Ke.object(e,void 0,{name:r}):mi(e)?Ke.map(e,{name:r}):Er(e)?Ke.set(e,{name:r}):typeof e=="function"&&!wn(e)&&!ao(e)?hp(e)?ni(e):io(r,e):e}function e1(e,t,r){if(e==null||Tn(e)||_i(e)||br(e)||rr(e))return e;if(Array.isArray(e))return Ke.array(e,{name:r,deep:!1});if(sr(e))return Ke.object(e,void 0,{name:r,deep:!1});if(mi(e))return Ke.map(e,{name:r,deep:!1});if(Er(e))return Ke.set(e,{name:r,deep:!1});he("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function ds(e){return e}function t1(e,t){return ii(e)&&he("observable.struct should not be used with observable values"),Al(e,t)?t:e}var r1="override";function xa(e){return e.annotationType_===r1}function Io(e,t){return{annotationType_:e,options_:t,make_:n1,extend_:i1,decorate_20223_:o1}}function n1(e,t,r,n){var i;if((i=this.options_)!=null&&i.bound)return this.extend_(e,t,r,!1)===null?0:1;if(n===e.target_)return this.extend_(e,t,r,!1)===null?0:2;if(wn(r.value))return 1;var o=wp(e,this,t,r,!1);return pr(n,t,o),2}function i1(e,t,r,n){var i=wp(e,this,t,r);return e.defineProperty_(t,i,n)}function o1(e,t){fs(t,["method","field"]);var r=t.kind,n=t.name,i=t.addInitializer,o=this,a=function(u){var l,f,d,I;return vn((l=(f=o.options_)==null?void 0:f.name)!=null?l:n.toString(),u,(d=(I=o.options_)==null?void 0:I.autoAction)!=null?d:!1)};if(r=="field")return function(u){var l,f=u;return wn(f)||(f=a(f)),(l=o.options_)!=null&&l.bound&&(f=f.bind(this),f.isMobxAction=!0),f};if(r=="method"){var s;return wn(e)||(e=a(e)),(s=this.options_)!=null&&s.bound&&i(function(){var u=this,l=u[n].bind(u);l.isMobxAction=!0,u[n]=l}),e}he("Cannot apply '"+o.annotationType_+"' to '"+String(n)+"' (kind: "+r+"):"+(`
|
|
6
|
+
'`+o.annotationType_+"' can only be used on properties with a function value."))}function a1(e,t,r,n){var i=t.annotationType_,o=n.value;We(o)||he("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
7
|
+
'`+i+"' can only be used on properties with a function value."))}function wp(e,t,r,n,i){var o,a,s,u,l,f,d;i===void 0&&(i=Y.safeDescriptors),a1(e,t,r,n);var I=n.value;if((o=t.options_)!=null&&o.bound){var E;I=I.bind((E=e.proxy_)!=null?E:e.target_)}return{value:vn((a=(s=t.options_)==null?void 0:s.name)!=null?a:r.toString(),I,(u=(l=t.options_)==null?void 0:l.autoAction)!=null?u:!1,(f=t.options_)!=null&&f.bound?(d=e.proxy_)!=null?d:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function Tp(e,t){return{annotationType_:e,options_:t,make_:s1,extend_:u1,decorate_20223_:l1}}function s1(e,t,r,n){var i;if(n===e.target_)return this.extend_(e,t,r,!1)===null?0:2;if((i=this.options_)!=null&&i.bound&&(!Vt(e.target_,t)||!ao(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(ao(r.value))return 1;var o=_p(e,this,t,r,!1,!1);return pr(n,t,o),2}function u1(e,t,r,n){var i,o=_p(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,o,n)}function l1(e,t){var r;fs(t,["method"]);var n=t.name,i=t.addInitializer;return ao(e)||(e=ni(e)),(r=this.options_)!=null&&r.bound&&i(function(){var o=this,a=o[n].bind(o);a.isMobXFlow=!0,o[n]=a}),e}function c1(e,t,r,n){var i=t.annotationType_,o=n.value;We(o)||he("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
8
|
+
'`+i+"' can only be used on properties with a generator function value."))}function _p(e,t,r,n,i,o){o===void 0&&(o=Y.safeDescriptors),c1(e,t,r,n);var a=n.value;if(ao(a)||(a=ni(a)),i){var s;a=a.bind((s=e.proxy_)!=null?s:e.target_),a.isMobXFlow=!0}return{value:a,configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function wl(e,t){return{annotationType_:e,options_:t,make_:f1,extend_:d1,decorate_20223_:p1}}function f1(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function d1(e,t,r,n){return h1(e,this,t,r),e.defineComputedProperty_(t,Sr({},this.options_,{get:r.get,set:r.set}),n)}function p1(e,t){fs(t,["getter"]);var r=this,n=t.name,i=t.addInitializer;return i(function(){var o=Ei(this)[Ee],a=Sr({},r.options_,{get:e,context:this});a.name||(a.name=o.name_+"."+n.toString()),o.values_.set(n,new Kt(a))}),function(){return this[Ee].getObservablePropValue_(n)}}function h1(e,t,r,n){var i=t.annotationType_,o=n.get;o||he("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
9
|
+
'`+i+"' can only be used on getter(+setter) properties."))}function ps(e,t){return{annotationType_:e,options_:t,make_:y1,extend_:g1,decorate_20223_:m1}}function y1(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function g1(e,t,r,n){var i,o;return b1(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(o=this.options_)==null?void 0:o.enhancer)!=null?i:vi,n)}function m1(e,t){if(t.kind==="field")throw he("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");fs(t,["accessor"]);var r=this,n=t.kind,i=t.name,o=new WeakSet;function a(s,u){var l,f,d=Ei(s)[Ee],I=new Qr(u,(l=(f=r.options_)==null?void 0:f.enhancer)!=null?l:vi,d.name_+"."+i.toString(),!1);d.values_.set(i,I),o.add(s)}if(n=="accessor")return{get:function(){return o.has(this)||a(this,e.get.call(this)),this[Ee].getObservablePropValue_(i)},set:function(s){return o.has(this)||a(this,s),this[Ee].setObservablePropValue_(i,s)},init:function(s){return o.has(this)||a(this,s),s}}}function b1(e,t,r,n){var i=t.annotationType_;"value"in n||he("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
10
|
+
'`+i+"' cannot be used on getter/setter properties"))}var v1="true",w1=Ep();function Ep(e){return{annotationType_:v1,options_:e,make_:T1,extend_:_1,decorate_20223_:E1}}function T1(e,t,r,n){var i,o;if(r.get)return Ze.make_(e,t,r,n);if(r.set){var a=vn(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:Y.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(pr(n,t,{configurable:!0,set:a}),2)}if(n!==e.target_&&typeof r.value=="function"){var s;if(hp(r.value)){var u,l=(u=this.options_)!=null&&u.autoBind?ni.bound:ni;return l.make_(e,t,r,n)}var f=(s=this.options_)!=null&&s.autoBind?io.bound:io;return f.make_(e,t,r,n)}var d=((i=this.options_)==null?void 0:i.deep)===!1?Ke.ref:Ke;if(typeof r.value=="function"&&(o=this.options_)!=null&&o.autoBind){var I;r.value=r.value.bind((I=e.proxy_)!=null?I:e.target_)}return d.make_(e,t,r,n)}function _1(e,t,r,n){var i,o;if(r.get)return Ze.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:Y.safeDescriptors?e.isPlainObject_:!0,set:vn(t.toString(),r.set)},n);if(typeof r.value=="function"&&(i=this.options_)!=null&&i.autoBind){var a;r.value=r.value.bind((a=e.proxy_)!=null?a:e.target_)}var s=((o=this.options_)==null?void 0:o.deep)===!1?Ke.ref:Ke;return s.extend_(e,t,r,n)}function E1(e,t){he("'"+this.annotationType_+"' cannot be used as a decorator")}var x1="observable",O1="observable.ref",A1="observable.shallow",S1="observable.struct",xp={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(xp);function qo(e){return e||xp}var wu=ps(x1),I1=ps(O1,{enhancer:ds}),k1=ps(A1,{enhancer:e1}),$1=ps(S1,{enhancer:t1}),Op=hr(wu);function Go(e){return e.deep===!0?vi:e.deep===!1?ds:C1(e.defaultDecorator)}function j1(e){var t;return e?(t=e.defaultDecorator)!=null?t:Ep(e):void 0}function C1(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:vi}function Ap(e,t,r){if(So(t))return wu.decorate_20223_(e,t);if(bn(t)){Ao(e,t,wu);return}return ii(e)?e:sr(e)?Ke.object(e,t,r):Array.isArray(e)?Ke.array(e,t):mi(e)?Ke.map(e,t):Er(e)?Ke.set(e,t):typeof e=="object"&&e!==null?e:Ke.box(e,t)}dp(Ap,Op);var N1={box:function(e,t){var r=qo(t);return new Qr(e,Go(r),r.name,!0,r.equals)},array:function(e,t){var r=qo(t);return(Y.useProxies===!1||r.proxy===!1?Dw:Sw)(e,Go(r),r.name)},map:function(e,t){var r=qo(t);return new Jp(e,Go(r),r.name)},set:function(e,t){var r=qo(t);return new Xp(e,Go(r),r.name)},object:function(e,t,r){return Un(function(){return gw(Y.useProxies===!1||r?.proxy===!1?Ei({},r):xw({},r),e,t)})},ref:hr(I1),shallow:hr(k1),deep:Op,struct:hr($1)},Ke=dp(Ap,N1),Sp="computed",U1="computed.struct",Tu=wl(Sp),P1=wl(U1,{equals:et.structural}),Ze=function(e,t){if(So(t))return Tu.decorate_20223_(e,t);if(bn(t))return Ao(e,t,Tu);if(sr(e))return hr(wl(Sp,e));We(e)||he("First argument to `computed` should be an expression."),We(t)&&he("A setter as second argument is no longer supported, use `{ set: fn }` option instead");var r=sr(t)?t:{};return r.get=e,r.name||(r.name=e.name||""),new Kt(r)};Object.assign(Ze,Tu);Ze.struct=hr(P1);var Hc,Jc,Oa=0,B1=1,D1=(Hc=(Jc=_a(function(){},"name"))==null?void 0:Jc.configurable)!=null?Hc:!1,Xc={value:"action",configurable:!0,writable:!1,enumerable:!1};function vn(e,t,r,n){r===void 0&&(r=!1),We(t)||he("`action` can only be invoked on functions"),(typeof e!="string"||!e)&&he("actions should have valid names, got: '"+e+"'");function i(){return Ip(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},D1&&(Xc.value=e,pr(i,"name",Xc)),i}function Ip(e,t,r,n,i){var o=R1(e,t,n,i);try{return r.apply(n,i)}catch(a){throw o.error_=a,a}finally{M1(o)}}function R1(e,t,r,n){var i=ft()&&!!e,o=0;if(i){o=Date.now();var a=n?Array.from(n):Ea;Ot({type:_l,name:e,object:r,arguments:a})}var s=Y.trackingDerivation,u=!t||!s;Rt();var l=Y.allowStateChanges;u&&(Nn(),l=hs(!0));var f=Tl(!0),d={runAsAction_:u,prevDerivation_:s,prevAllowStateChanges_:l,prevAllowStateReads_:f,notifySpy_:i,startTime_:o,actionId_:B1++,parentActionId_:Oa};return Oa=d.actionId_,d}function M1(e){Oa!==e.actionId_&&he(30),Oa=e.parentActionId_,e.error_!==void 0&&(Y.suppressReactionErrors=!0),ys(e.prevAllowStateChanges_),Yi(e.prevAllowStateReads_),Mt(),e.runAsAction_&&Or(e.prevDerivation_),e.notifySpy_&&At({time:Date.now()-e.startTime_}),Y.suppressReactionErrors=!1}function L1(e,t){var r=hs(e);try{return t()}finally{ys(r)}}function hs(e){var t=Y.allowStateChanges;return Y.allowStateChanges=e,t}function ys(e){Y.allowStateChanges=e}var V1="create",Qr=function(e){function t(n,i,o,a,s){var u;return o===void 0&&(o="ObservableValue@"+Ht()),a===void 0&&(a=!0),s===void 0&&(s=et.default),u=e.call(this,o)||this,u.enhancer=void 0,u.name_=void 0,u.equals=void 0,u.hasUnreportedChange_=!1,u.interceptors_=void 0,u.changeListeners_=void 0,u.value_=void 0,u.dehancer=void 0,u.enhancer=i,u.name_=o,u.equals=s,u.value_=i(n,void 0,o),a&&ft()&&ri({type:V1,object:u,observableKind:"value",debugObjectName:u.name_,newValue:""+u.value_}),u}bp(t,e);var r=t.prototype;return r.dehanceValue=function(n){return this.dehancer!==void 0?this.dehancer(n):n},r.set=function(n){var i=this.value_;if(n=this.prepareNewValue_(n),n!==Y.UNCHANGED){var o=ft();o&&Ot({type:ir,object:this,observableKind:"value",debugObjectName:this.name_,newValue:n,oldValue:i}),this.setNewValue_(n),o&&At()}},r.prepareNewValue_=function(n){if(dr(this),Bt(this)){var i=Dt(this,{object:this,type:ir,newValue:n});if(!i)return Y.UNCHANGED;n=i.newValue}return n=this.enhancer(n,this.value_,this.name_),this.equals(this.value_,n)?Y.UNCHANGED:n},r.setNewValue_=function(n){var i=this.value_;this.value_=n,this.reportChanged(),or(this)&&ar(this,{type:ir,object:this,newValue:n,oldValue:i})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(n){return $o(this,n)},r.observe_=function(n,i){return i&&n({observableKind:"value",debugObjectName:this.name_,object:this,type:ir,newValue:this.value_,oldValue:void 0}),jo(this,n)},r.raw=function(){return this.value_},r.toJSON=function(){return this.get()},r.toString=function(){return this.name_+"["+this.value_+"]"},r.valueOf=function(){return mp(this.get())},r[Symbol.toPrimitive]=function(){return this.valueOf()},t}(an),F1=on("ObservableValue",Qr),Kt=function(){function e(r){this.dependenciesState_=je.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=je.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Aa(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Ft.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,r.get||he(31),this.derivation=r.get,this.name_=r.name||"ComputedValue@"+Ht(),r.set&&(this.setter_=vn(this.name_+"-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?et.structural:et.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){Y1(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.get=function(){if(this.isComputing&&he(32,this.name_,this.derivation),Y.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)_u(this)&&(this.warnAboutUntrackedRead_(),Rt(),this.value_=this.computeValue_(!1),Mt());else if(Up(this),_u(this)){var r=Y.trackingContext;this.keepAlive_&&!r&&(Y.trackingContext=this),this.trackAndCompute()&&Z1(this),Y.trackingContext=r}var n=this.value_;if(Yo(n))throw n.cause;return n},t.set=function(r){if(this.setter_){this.isRunningSetter&&he(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else he(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,n=this.dependenciesState_===je.NOT_TRACKING_,i=this.computeValue_(!0),o=n||Yo(r)||Yo(i)||!this.equals_(r,i);return o&&(this.value_=i,ft()&&ri({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:r,newValue:i})),o},t.computeValue_=function(r){this.isComputing=!0;var n=hs(!1),i;if(r)i=kp(this,this.derivation,this.scope_);else if(Y.disableErrorBoundaries===!0)i=this.derivation.call(this.scope_);else try{i=this.derivation.call(this.scope_)}catch(o){i=new Aa(o)}return ys(n),this.isComputing=!1,i},t.suspend_=function(){this.keepAlive_||(Eu(this),this.value_=void 0,this.isTracing_!==Ft.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' was suspended and it will recompute on the next access."))},t.observe_=function(r,n){var i=this,o=!0,a=void 0;return qt(function(){var s=i.get();if(!o||n){var u=Nn();r({observableKind:"computed",debugObjectName:i.name_,type:ir,object:i,newValue:s,oldValue:a}),Or(u)}o=!1,a=s})},t.warnAboutUntrackedRead_=function(){this.isTracing_!==Ft.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."),(typeof this.requiresReaction_=="boolean"?this.requiresReaction_:Y.computedRequiresReaction)&&console.warn("[mobx] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute.")},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return mp(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},bi(e,[{key:"isComputing",get:function(){return Et(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=xt(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return Et(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=xt(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return Et(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=xt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return Et(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=xt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return Et(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=xt(this.flags_,e.diffValueMask_,r===1)}}])}();Kt.isComputingMask_=1;Kt.isRunningSetterMask_=2;Kt.isBeingObservedMask_=4;Kt.isPendingUnobservationMask_=8;Kt.diffValueMask_=16;var ko=on("ComputedValue",Kt),je;(function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"})(je||(je={}));var Ft;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(Ft||(Ft={}));var Aa=function(e){this.cause=void 0,this.cause=e};function Yo(e){return e instanceof Aa}function _u(e){switch(e.dependenciesState_){case je.UP_TO_DATE_:return!1;case je.NOT_TRACKING_:case je.STALE_:return!0;case je.POSSIBLY_STALE_:{for(var t=Tl(!0),r=Nn(),n=e.observing_,i=n.length,o=0;o<i;o++){var a=n[o];if(ko(a)){if(Y.disableErrorBoundaries)a.get();else try{a.get()}catch{return Or(r),Yi(t),!0}if(e.dependenciesState_===je.STALE_)return Or(r),Yi(t),!0}}return $p(e),Or(r),Yi(t),!1}}}function z1(){return Y.trackingDerivation!==null}function dr(e){var t=e.observers_.size>0;!Y.allowStateChanges&&(t||Y.enforceActions==="always")&&console.warn("[MobX] "+(Y.enforceActions?"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: ":"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ")+e.name_)}function K1(e){!Y.allowStateReads&&Y.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function kp(e,t,r){var n=Tl(!0);$p(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++Y.runId;var i=Y.trackingDerivation;Y.trackingDerivation=e,Y.inBatch++;var o;if(Y.disableErrorBoundaries===!0)o=t.call(r);else try{o=t.call(r)}catch(a){o=new Aa(a)}return Y.inBatch--,Y.trackingDerivation=i,G1(e),q1(e),Yi(n),o}function q1(e){e.observing_.length===0&&(typeof e.requiresObservable_=="boolean"?e.requiresObservable_:Y.reactionRequiresObservable)&&console.warn("[mobx] Derivation '"+e.name_+"' is created/updated without reading any observable value.")}function G1(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=je.UP_TO_DATE_,i=0,o=e.unboundDepsCount_,a=0;a<o;a++){var s=r[a];s.diffValue===0&&(s.diffValue=1,i!==a&&(r[i]=s),i++),s.dependenciesState_>n&&(n=s.dependenciesState_)}for(r.length=i,e.newObserving_=null,o=t.length;o--;){var u=t[o];u.diffValue===0&&Cp(u,e),u.diffValue=0}for(;i--;){var l=r[i];l.diffValue===1&&(l.diffValue=0,Q1(l,e))}n!==je.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function Eu(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)Cp(t[r],e);e.dependenciesState_=je.NOT_TRACKING_}function ze(e){var t=Nn();try{return e()}finally{Or(t)}}function Nn(){var e=Y.trackingDerivation;return Y.trackingDerivation=null,e}function Or(e){Y.trackingDerivation=e}function Tl(e){var t=Y.allowStateReads;return Y.allowStateReads=e,t}function Yi(e){Y.allowStateReads=e}function $p(e){if(e.dependenciesState_!==je.UP_TO_DATE_){e.dependenciesState_=je.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=je.UP_TO_DATE_}}var ea=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},ta=!0,jp=!1,Y=function(){var e=ss();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ta=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new ea().version&&(ta=!1),ta?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new ea):(setTimeout(function(){jp||he(35)},1),new ea)}();function W1(){if((Y.pendingReactions.length||Y.inBatch||Y.isRunningReactions)&&he(36),jp=!0,ta){var e=ss();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),Y=new ea}}function H1(){return Y}function J1(e){return e.observers_&&e.observers_.size>0}function X1(e){return e.observers_}function Q1(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Cp(e,t){e.observers_.delete(t),e.observers_.size===0&&Np(e)}function Np(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,Y.pendingUnobservations.push(e))}function Rt(){Y.inBatch++}function Mt(){if(--Y.inBatch===0){Rp();for(var e=Y.pendingUnobservations,t=0;t<e.length;t++){var r=e[t];r.isPendingUnobservation=!1,r.observers_.size===0&&(r.isBeingObserved&&(r.isBeingObserved=!1,r.onBUO()),r instanceof Kt&&r.suspend_())}Y.pendingUnobservations=[]}}function Up(e){K1(e);var t=Y.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&Y.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&Y.inBatch>0&&Np(e),!1)}function Pp(e){e.lowestObserverState_!==je.STALE_&&(e.lowestObserverState_=je.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===je.UP_TO_DATE_&&(t.isTracing_!==Ft.NONE&&Bp(t,e),t.onBecomeStale_()),t.dependenciesState_=je.STALE_}))}function Z1(e){e.lowestObserverState_!==je.STALE_&&(e.lowestObserverState_=je.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===je.POSSIBLY_STALE_?(t.dependenciesState_=je.STALE_,t.isTracing_!==Ft.NONE&&Bp(t,e)):t.dependenciesState_===je.UP_TO_DATE_&&(e.lowestObserverState_=je.UP_TO_DATE_)}))}function Y1(e){e.lowestObserverState_===je.UP_TO_DATE_&&(e.lowestObserverState_=je.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===je.UP_TO_DATE_&&(t.dependenciesState_=je.POSSIBLY_STALE_,t.onBecomeStale_())}))}function Bp(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===Ft.BREAK){var r=[];Dp(ms(e),r,1),new Function(`debugger;
|
|
11
|
+
/*
|
|
12
|
+
Tracing '`+e.name_+`'
|
|
13
|
+
|
|
14
|
+
You are entering this break point because derivation '`+e.name_+"' is being traced and '"+t.name_+`' is now forcing it to update.
|
|
15
|
+
Just follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update
|
|
16
|
+
The stackframe you are looking for is at least ~6-8 stack-frames up.
|
|
17
|
+
|
|
18
|
+
`+(e instanceof Kt?e.derivation.toString().replace(/[*]\//g,"/"):"")+`
|
|
19
|
+
|
|
20
|
+
The dependencies for this derivation are:
|
|
21
|
+
|
|
22
|
+
`+r.join(`
|
|
23
|
+
`)+`
|
|
24
|
+
*/
|
|
25
|
+
`)()}}function Dp(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 Dp(n,t,r+1)})}var yr=function(){function e(r,n,i,o){r===void 0&&(r="Reaction@"+Ht()),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=je.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Ft.NONE,this.name_=r,this.onInvalidate_=n,this.errorHandler_=i,this.requiresObservable_=o}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,Y.pendingReactions.push(this),Rp())},t.runReaction_=function(){if(!this.isDisposed){Rt(),this.isScheduled=!1;var r=Y.trackingContext;if(Y.trackingContext=this,_u(this)){this.isTrackPending=!0;try{this.onInvalidate_(),this.isTrackPending&&ft()&&ri({name:this.name_,type:"scheduled-reaction"})}catch(n){this.reportExceptionInDerivation_(n)}}Y.trackingContext=r,Mt()}},t.track=function(r){if(!this.isDisposed){Rt();var n=ft(),i;n&&(i=Date.now(),Ot({name:this.name_,type:"reaction"})),this.isRunning=!0;var o=Y.trackingContext;Y.trackingContext=this;var a=kp(this,r,void 0);Y.trackingContext=o,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Eu(this),Yo(a)&&this.reportExceptionInDerivation_(a.cause),n&&At({time:Date.now()-i}),Mt()}},t.reportExceptionInDerivation_=function(r){var n=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(Y.disableErrorBoundaries)throw r;var i="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";Y.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name_+"' suppressed, fix error of causing action below)"):console.error(i,r),ft()&&ri({type:"error",name:this.name_,message:i,error:""+r}),Y.globalReactionErrorHandlers.forEach(function(o){return o(r,n)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Rt(),Eu(this),Mt()))},t.getDisposer_=function(r){var n=this,i=function o(){n.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",o)};return r==null||r.addEventListener==null||r.addEventListener("abort",i),i[Ee]=this,i},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){r===void 0&&(r=!1),Wp(this,r)},bi(e,[{key:"isDisposed",get:function(){return Et(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=xt(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return Et(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=xt(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return Et(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=xt(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return Et(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=xt(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return Et(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=xt(this.flags_,e.diffValueMask_,r===1)}}])}();yr.isDisposedMask_=1;yr.isScheduledMask_=2;yr.isTrackPendingMask_=4;yr.isRunningMask_=8;yr.diffValueMask_=16;var Qc=100,xu=function(e){return e()};function Rp(){Y.inBatch>0||Y.isRunningReactions||xu(ew)}function ew(){Y.isRunningReactions=!0;for(var e=Y.pendingReactions,t=0;e.length>0;){++t===Qc&&(console.error("Reaction doesn't converge to a stable state after "+Qc+" iterations."+(" Probably there is a cycle in the reactive function: "+e[0])),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n<i;n++)r[n].runReaction_()}Y.isRunningReactions=!1}var Sa=on("Reaction",yr);function tw(e){var t=xu;xu=function(r){return e(function(){return t(r)})}}function ft(){return!!Y.spyListeners.length}function ri(e){if(Y.spyListeners.length)for(var t=Y.spyListeners,r=0,n=t.length;r<n;r++)t[r](e)}function Ot(e){var t=Sr({},e,{spyReportStart:!0});ri(t)}var rw={type:"report-end",spyReportEnd:!0};function At(e){ri(e?Sr({},e,{type:"report-end",spyReportEnd:!0}):rw)}function nw(e){return Y.spyListeners.push(e),bl(function(){Y.spyListeners=Y.spyListeners.filter(function(t){return t!==e})})}var _l="action",iw="action.bound",Mp="autoAction",ow="autoAction.bound",Lp="<unnamed action>",Ou=Io(_l),aw=Io(iw,{bound:!0}),Au=Io(Mp,{autoAction:!0}),sw=Io(ow,{autoAction:!0,bound:!0});function Vp(e){var t=function(r,n){if(We(r))return vn(r.name||Lp,r,e);if(We(n))return vn(r,n,e);if(So(n))return(e?Au:Ou).decorate_20223_(r,n);if(bn(n))return Ao(r,n,e?Au:Ou);if(bn(r))return hr(Io(e?Mp:_l,{name:r,autoAction:e}));he("Invalid arguments for `action`")};return t}var Lt=Vp(!1);Object.assign(Lt,Ou);var io=Vp(!0);Object.assign(io,Au);Lt.bound=hr(aw);io.bound=hr(sw);function oo(e){return Ip(e.name||Lp,!1,e,this,void 0)}function wn(e){return We(e)&&e.isMobxAction===!0}function qt(e,t){var r,n,i,o;t===void 0&&(t=ml),We(e)||he("Autorun expects a function as first argument"),wn(e)&&he("Autorun does not accept actions since actions are untrackable");var a=(r=(n=t)==null?void 0:n.name)!=null?r:e.name||"Autorun@"+Ht(),s=!t.scheduler&&!t.delay,u;if(s)u=new yr(a,function(){this.track(d)},t.onError,t.requiresObservable);else{var l=Fp(t),f=!1;u=new yr(a,function(){f||(f=!0,l(function(){f=!1,u.isDisposed||u.track(d)}))},t.onError,t.requiresObservable)}function d(){e(u)}return(i=t)!=null&&(i=i.signal)!=null&&i.aborted||u.schedule_(),u.getDisposer_((o=t)==null?void 0:o.signal)}var uw=function(e){return e()};function Fp(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:uw}function lw(e,t,r){var n,i,o;r===void 0&&(r=ml),(!We(e)||!We(t))&&he("First and second argument to reaction should be functions"),sr(r)||he("Third argument of reactions should be an object");var a=(n=r.name)!=null?n:"Reaction@"+Ht(),s=Lt(a,r.onError?cw(r.onError,t):t),u=!r.scheduler&&!r.delay,l=Fp(r),f=!0,d=!1,I,E=r.compareStructural?et.structural:r.equals||et.default,_=new yr(a,function(){f||u?L():d||(d=!0,l(L))},r.onError,r.requiresObservable);function L(){if(d=!1,!_.isDisposed){var J=!1,B=I;_.track(function(){var k=L1(!1,function(){return e(_)});J=f||!E(I,k),I=k}),(f&&r.fireImmediately||!f&&J)&&s(I,B,_),f=!1}}return(i=r)!=null&&(i=i.signal)!=null&&i.aborted||_.schedule_(),_.getDisposer_((o=r)==null?void 0:o.signal)}function cw(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var fw="onBO",dw="onBUO";function gs(e,t,r){return zp(fw,e,t,r)}function wi(e,t,r){return zp(dw,e,t,r)}function zp(e,t,r,n){var i=typeof n=="function"?ur(t,r):ur(t),o=We(n)?n:r,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var s=i[a];s&&(s.delete(o),s.size===0&&delete i[a])}}var pw="never",Wo="always",hw="observed";function yw(e){e.isolateGlobalState===!0&&W1();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(Y.useProxies=t===Wo?!0:t===pw?!1:typeof Proxy<"u"),t==="ifavailable"&&(Y.verifyProxies=!0),r!==void 0){var n=r===Wo?Wo:r===hw;Y.enforceActions=n,Y.allowStateChanges=!(n===!0||n===Wo)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(Y[i]=!!e[i])}),Y.allowStateReads=!Y.observableRequiresReaction,Y.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&tw(e.reactionScheduler)}function gw(e,t,r,n){arguments.length>4&&he("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&he("'extendObservable' expects an object as first argument"),br(e)&&he("'extendObservable' should not be used on maps, use map.merge instead"),sr(t)||he("'extendObservable' only accepts plain objects as second argument"),(ii(t)||ii(r))&&he("Extending an object with another observable (object) is not supported");var i=K0(t);return Un(function(){var o=Ei(e,n)[Ee];cs(i).forEach(function(a){o.extend_(a,i[a],r&&a in r?r[a]:!0)})}),e}function ms(e,t){return Kp(ur(e,t))}function Kp(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=mw(e.observing_).map(Kp)),t}function Ia(e,t){return qp(ur(e,t))}function qp(e){var t={name:e.name_};return J1(e)&&(t.observers=Array.from(X1(e)).map(qp)),t}function mw(e){return Array.from(new Set(e))}var bw=0;function Gp(){this.message="FLOW_CANCELLED"}Gp.prototype=Object.create(Error.prototype);var Ws=Tp("flow"),vw=Tp("flow.bound",{bound:!0}),ni=Object.assign(function(e,t){if(So(t))return Ws.decorate_20223_(e,t);if(bn(t))return Ao(e,t,Ws);arguments.length!==1&&he("Flow expects single argument with generator function");var r=e,n=r.name||"<unnamed flow>",i=function(){var o=this,a=arguments,s=++bw,u=Lt(n+" - runid: "+s+" - init",r).apply(o,a),l,f=void 0,d=new Promise(function(I,E){var _=0;l=E;function L(k){f=void 0;var F;try{F=Lt(n+" - runid: "+s+" - yield "+_++,u.next).call(u,k)}catch(q){return E(q)}B(F)}function J(k){f=void 0;var F;try{F=Lt(n+" - runid: "+s+" - yield "+_++,u.throw).call(u,k)}catch(q){return E(q)}B(F)}function B(k){if(We(k?.then)){k.then(B,E);return}return k.done?I(k.value):(f=Promise.resolve(k.value),f.then(L,J))}L(void 0)});return d.cancel=Lt(n+" - runid: "+s+" - cancel",function(){try{f&&Zc(f);var I=u.return(void 0),E=Promise.resolve(I.value);E.then(Yn,Yn),Zc(E),l(new Gp)}catch(_){l(_)}}),d};return i.isMobXFlow=!0,i},Ws);ni.bound=hr(vw);function Zc(e){We(e.cancel)&&e.cancel()}function ao(e){return e?.isMobXFlow===!0}function ww(e,t){return e?t!==void 0?br(e)||_i(e)?he("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."):Tn(e)?e[Ee].values_.has(t):!1:Tn(e)||!!e[Ee]||vl(e)||Sa(e)||ko(e):!1}function ii(e){return arguments.length!==1&&he("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),ww(e)}function Tw(e){if(Tn(e))return e[Ee].ownKeys_();he(38)}function Ho(e,t,r){return e.set(t,r),r}function Qn(e,t){if(e==null||typeof e!="object"||e instanceof Date||!ii(e))return e;if(F1(e)||ko(e))return Qn(e.get(),t);if(t.has(e))return t.get(e);if(_i(e)){var r=Ho(t,e,new Array(e.length));return e.forEach(function(a,s){r[s]=Qn(a,t)}),r}if(rr(e)){var n=Ho(t,e,new Set);return e.forEach(function(a){n.add(Qn(a,t))}),n}if(br(e)){var i=Ho(t,e,new Map);return e.forEach(function(a,s){i.set(s,Qn(a,t))}),i}else{var o=Ho(t,e,{});return Tw(e).forEach(function(a){Oo.propertyIsEnumerable.call(e,a)&&(o[a]=Qn(e[a],t))}),o}}function Ar(e,t){return t&&he("toJS no longer supports options"),Qn(e,new Map)}function Wp(){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=_w(r);if(!i)return he("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");i.isTracing_===Ft.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled"),i.isTracing_=e?Ft.BREAK:Ft.LOG}function _w(e){switch(e.length){case 0:return Y.trackingDerivation;case 1:return ur(e[0]);case 2:return ur(e[0],e[1])}}function xr(e,t){t===void 0&&(t=void 0),Rt();try{return e.apply(t)}finally{Mt()}}function dn(e){return e[Ee]}var Ew={has:function(e,t){return Y.trackingDerivation&&Fi("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),dn(e).has_(t)},get:function(e,t){return dn(e).get_(t)},set:function(e,t,r){var n;return bn(t)?(dn(e).values_.has(t)||Fi("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(n=dn(e).set_(t,r,!0))!=null?n:!0):!1},deleteProperty:function(e,t){var r;return Fi("delete properties from an observable object. Use 'remove' from 'mobx' instead."),bn(t)?(r=dn(e).delete_(t,!0))!=null?r:!0:!1},defineProperty:function(e,t,r){var n;return Fi("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(n=dn(e).defineProperty_(t,r))!=null?n:!0},ownKeys:function(e){return Y.trackingDerivation&&Fi("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),dn(e).ownKeys_()},preventExtensions:function(e){he(13)}};function xw(e,t){var r,n;return pp(),e=Ei(e,t),(n=(r=e[Ee]).proxy_)!=null?n:r.proxy_=new Proxy(e,Ew)}function Bt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function $o(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),bl(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Dt(e,t){var r=Nn();try{for(var n=[].concat(e.interceptors_||[]),i=0,o=n.length;i<o&&(t=n[i](t),t&&!t.type&&he(14),!!t);i++);return t}finally{Or(r)}}function or(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function jo(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),bl(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function ar(e,t){var r=Nn(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,o=n.length;i<o;i++)n[i](t);Or(r)}}function Ti(e,t,r){return Un(function(){var n,i=Ei(e,r)[Ee];t&&e[_t]&&he("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(n=t)!=null||(t=J0(e)),cs(t).forEach(function(o){return i.make_(o,t[o])})}),e}var Yc="splice",ir="update",Ow=1e4,Aw={get:function(e,t){var r=e[Ee];return t===Ee?r:t==="length"?r.getArrayLength_():typeof t=="string"&&!isNaN(t)?r.get_(parseInt(t)):Vt(ka,t)?ka[t]:e[t]},set:function(e,t,r){var n=e[Ee];return t==="length"&&n.setArrayLength_(r),typeof t=="symbol"||isNaN(t)?e[t]=r:n.set_(parseInt(t),r),!0},preventExtensions:function(){he(15)}},El=function(){function e(r,n,i,o){r===void 0&&(r="ObservableArray@"+Ht()),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=i,this.legacyMode_=o,this.atom_=new an(r),this.enhancer_=function(a,s){return n(a,s,r+"[..]")}}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.dehanceValues_=function(r){return this.dehancer!==void 0&&r.length>0?r.map(this.dehancer):r},t.intercept_=function(r){return $o(this,r)},t.observe_=function(r,n){return n===void 0&&(n=!1),n&&r({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),jo(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&he("Out of range: "+r);var n=this.values_.length;if(r!==n)if(r>n){for(var i=new Array(r-n),o=0;o<r-n;o++)i[o]=void 0;this.spliceWithArray_(n,0,i)}else this.spliceWithArray_(r,n-r)},t.updateArrayLength_=function(r,n){r!==this.lastKnownLength_&&he(16),this.lastKnownLength_+=n,this.legacyMode_&&n>0&&Yp(r+n+1)},t.spliceWithArray_=function(r,n,i){var o=this;dr(this.atom_);var a=this.values_.length;if(r===void 0?r=0:r>a?r=a:r<0&&(r=Math.max(0,a+r)),arguments.length===1?n=a-r:n==null?n=0:n=Math.max(0,Math.min(n,a-r)),i===void 0&&(i=Ea),Bt(this)){var s=Dt(this,{object:this.proxy_,type:Yc,index:r,removedCount:n,added:i});if(!s)return Ea;n=s.removedCount,i=s.added}i=i.length===0?i:i.map(function(f){return o.enhancer_(f,void 0)}),this.legacyMode_;var u=i.length-n;this.updateArrayLength_(a,u);var l=this.spliceItemsIntoValues_(r,n,i);return(n!==0||i.length!==0)&&this.notifyArraySplice_(r,i,l),this.dehanceValues_(l)},t.spliceItemsIntoValues_=function(r,n,i){if(i.length<Ow){var o;return(o=this.values_).splice.apply(o,[r,n].concat(i))}else{var a=this.values_.slice(r,r+n),s=this.values_.slice(r+n);this.values_.length+=i.length-n;for(var u=0;u<i.length;u++)this.values_[r+u]=i[u];for(var l=0;l<s.length;l++)this.values_[r+i.length+l]=s[l];return a}},t.notifyArrayChildUpdate_=function(r,n,i){var o=!this.owned_&&ft(),a=or(this),s=a||o?{observableKind:"array",object:this.proxy_,type:ir,debugObjectName:this.atom_.name_,index:r,newValue:n,oldValue:i}:null;o&&Ot(s),this.atom_.reportChanged(),a&&ar(this,s),o&&At()},t.notifyArraySplice_=function(r,n,i){var o=!this.owned_&&ft(),a=or(this),s=a||o?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Yc,index:r,removed:i,added:n,removedCount:i.length,addedCount:n.length}:null;o&&Ot(s),this.atom_.reportChanged(),a&&ar(this,s),o&&At()},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx.array] Attempt to read an array index ("+r+") that is out of bounds ("+this.values_.length+"). Please check length first. Out of bound indices will not be tracked by MobX");return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},t.set_=function(r,n){var i=this.values_;if(this.legacyMode_&&r>i.length&&he(17,r,i.length),r<i.length){dr(this.atom_);var o=i[r];if(Bt(this)){var a=Dt(this,{type:ir,object:this.proxy_,index:r,newValue:n});if(!a)return;n=a.newValue}n=this.enhancer_(n,o);var s=n!==o;s&&(i[r]=n,this.notifyArrayChildUpdate_(r,n,o))}else{for(var u=new Array(r+1-i.length),l=0;l<u.length-1;l++)u[l]=void 0;u[u.length-1]=n,this.spliceWithArray_(i.length,0,u)}},e}();function Sw(e,t,r,n){return r===void 0&&(r="ObservableArray@"+Ht()),n===void 0&&(n=!1),pp(),Un(function(){var i=new El(r,t,n,!1);yp(i.values_,Ee,i);var o=new Proxy(i.values_,Aw);return i.proxy_=o,e&&e.length&&i.spliceWithArray_(0,0,e),o})}var ka={clear:function(){return this.splice(0)},replace:function(e){var t=this[Ee];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];var o=this[Ee];switch(arguments.length){case 0:return[];case 1:return o.spliceWithArray_(e);case 2:return o.spliceWithArray_(e,t)}return o.spliceWithArray_(e,t,n)},spliceWithArray:function(e,t,r){return this[Ee].spliceWithArray_(e,t,r)},push:function(){for(var e=this[Ee],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.spliceWithArray_(e.values_.length,0,r),e.values_.length},pop:function(){return this.splice(Math.max(this[Ee].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[Ee],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.spliceWithArray_(0,0,r),e.values_.length},reverse:function(){return Y.trackingDerivation&&he(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Y.trackingDerivation&&he(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[Ee],r=t.dehanceValues_(t.values_).indexOf(e);return r>-1?(this.splice(r,1),!0):!1}};Le("at",St);Le("concat",St);Le("flat",St);Le("includes",St);Le("indexOf",St);Le("join",St);Le("lastIndexOf",St);Le("slice",St);Le("toString",St);Le("toLocaleString",St);Le("toSorted",St);Le("toSpliced",St);Le("with",St);Le("every",cr);Le("filter",cr);Le("find",cr);Le("findIndex",cr);Le("findLast",cr);Le("findLastIndex",cr);Le("flatMap",cr);Le("forEach",cr);Le("map",cr);Le("some",cr);Le("toReversed",cr);Le("reduce",Hp);Le("reduceRight",Hp);function Le(e,t){typeof Array.prototype[e]=="function"&&(ka[e]=t(e))}function St(e){return function(){var t=this[Ee];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function cr(e){return function(t,r){var n=this,i=this[Ee];i.atom_.reportObserved();var o=i.dehanceValues_(i.values_);return o[e](function(a,s){return t.call(r,a,s,n)})}}function Hp(e){return function(){var t=this,r=this[Ee];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(o,a,s){return i(o,a,s,t)},n[e].apply(n,arguments)}}var Iw=on("ObservableArrayAdministration",El);function _i(e){return us(e)&&Iw(e[Ee])}var kw={},Jr="add",$a="delete",Jp=function(){function e(r,n,i){var o=this;n===void 0&&(n=vi),i===void 0&&(i="ObservableMap@"+Ht()),this.enhancer_=void 0,this.name_=void 0,this[Ee]=kw,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=i,We(Map)||he(18),Un(function(){o.keysAtom_=vp(o.name_+".keys()"),o.data_=new Map,o.hasMap_=new Map,r&&o.merge(r)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var n=this;if(!Y.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var o=i=new Qr(this.has_(r),ds,this.name_+"."+bu(r)+"?",!1);this.hasMap_.set(r,o),wi(o,function(){return n.hasMap_.delete(r)})}return i.get()},t.set=function(r,n){var i=this.has_(r);if(Bt(this)){var o=Dt(this,{type:i?ir:Jr,object:this,newValue:n,name:r});if(!o)return this;n=o.newValue}return i?this.updateValue_(r,n):this.addValue_(r,n),this},t.delete=function(r){var n=this;if(dr(this.keysAtom_),Bt(this)){var i=Dt(this,{type:$a,object:this,name:r});if(!i)return!1}if(this.has_(r)){var o=ft(),a=or(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:$a,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return o&&Ot(s),xr(function(){var u;n.keysAtom_.reportChanged(),(u=n.hasMap_.get(r))==null||u.setNewValue_(!1);var l=n.data_.get(r);l.setNewValue_(void 0),n.data_.delete(r)}),a&&ar(this,s),o&&At(),!0}return!1},t.updateValue_=function(r,n){var i=this.data_.get(r);if(n=i.prepareNewValue_(n),n!==Y.UNCHANGED){var o=ft(),a=or(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:ir,object:this,oldValue:i.value_,name:r,newValue:n}:null;o&&Ot(s),i.setNewValue_(n),a&&ar(this,s),o&&At()}},t.addValue_=function(r,n){var i=this;dr(this.keysAtom_),xr(function(){var u,l=new Qr(n,i.enhancer_,i.name_+"."+bu(r),!1);i.data_.set(r,l),n=l.value_,(u=i.hasMap_.get(r))==null||u.setNewValue_(!0),i.keysAtom_.reportChanged()});var o=ft(),a=or(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:Jr,object:this,name:r,newValue:n}:null;o&&Ot(s),a&&ar(this,s),o&&At()},t.get=function(r){return this.has(r)?this.dehanceValue_(this.data_.get(r).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var r=this,n=this.keys();return ef({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 ef({next:function(){var i=n.next(),o=i.done,a=i.value;return{done:o,value:o?void 0:[a,r.get(a)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(r,n){for(var i=ei(this),o;!(o=i()).done;){var a=o.value,s=a[0],u=a[1];r.call(n,u,s,this)}},t.merge=function(r){var n=this;return br(r)&&(r=new Map(r)),xr(function(){sr(r)?z0(r).forEach(function(i){return n.set(i,r[i])}):Array.isArray(r)?r.forEach(function(i){var o=i[0],a=i[1];return n.set(o,a)}):mi(r)?(F0(r)||he(19,r),r.forEach(function(i,o){return n.set(o,i)})):r!=null&&he(20,r)}),this},t.clear=function(){var r=this;xr(function(){ze(function(){for(var n=ei(r.keys()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.replace=function(r){var n=this;return xr(function(){for(var i=$w(r),o=new Map,a=!1,s=ei(n.data_.keys()),u;!(u=s()).done;){var l=u.value;if(!i.has(l)){var f=n.delete(l);if(f)a=!0;else{var d=n.data_.get(l);o.set(l,d)}}}for(var I=ei(i.entries()),E;!(E=I()).done;){var _=E.value,L=_[0],J=_[1],B=n.data_.has(L);if(n.set(L,J),n.data_.has(L)){var k=n.data_.get(L);o.set(L,k),B||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var F=n.data_.keys(),q=o.keys(),D=F.next(),Q=q.next();!D.done;){if(D.value!==Q.value){n.keysAtom_.reportChanged();break}D=F.next(),Q=q.next()}n.data_=o}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,n){return n===!0&&he("`observe` doesn't support fireImmediately=true in combination with maps."),jo(this,r)},t.intercept_=function(r){return $o(this,r)},bi(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),br=on("ObservableMap",Jp);function ef(e){return e[Symbol.toStringTag]="MapIterator",Sl(e)}function $w(e){if(mi(e)||br(e))return e;if(Array.isArray(e))return new Map(e);if(sr(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return he(21,e)}var jw={},Xp=function(){function e(r,n,i){var o=this;n===void 0&&(n=vi),i===void 0&&(i="ObservableSet@"+Ht()),this.name_=void 0,this[Ee]=jw,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=i,We(Set)||he(22),this.enhancer_=function(a,s){return n(a,s,i)},Un(function(){o.atom_=vp(o.name_),r&&o.replace(r)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;xr(function(){ze(function(){for(var n=ei(r.data_.values()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.forEach=function(r,n){for(var i=ei(this),o;!(o=i()).done;){var a=o.value;r.call(n,a,a,this)}},t.add=function(r){var n=this;if(dr(this.atom_),Bt(this)){var i=Dt(this,{type:Jr,object:this,newValue:r});if(!i)return this;r=i.newValue}if(!this.has(r)){xr(function(){n.data_.add(n.enhancer_(r,void 0)),n.atom_.reportChanged()});var o=ft(),a=or(this),s=a||o?{observableKind:"set",debugObjectName:this.name_,type:Jr,object:this,newValue:r}:null;o&&Ot(s),a&&ar(this,s),o&&At()}return this},t.delete=function(r){var n=this;if(Bt(this)){var i=Dt(this,{type:$a,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var o=ft(),a=or(this),s=a||o?{observableKind:"set",debugObjectName:this.name_,type:$a,object:this,oldValue:r}:null;return o&&Ot(s),xr(function(){n.atom_.reportChanged(),n.data_.delete(r)}),a&&ar(this,s),o&&At(),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=this.values();return tf({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 tf({next:function(){var i=n.next(),o=i.value,a=i.done;return a?{value:void 0,done:a}:{value:r.dehanceValue_(o),done:a}}})},t.intersection=function(r){if(Er(r)&&!rr(r))return r.intersection(this);var n=new Set(this);return n.intersection(r)},t.union=function(r){if(Er(r)&&!rr(r))return r.union(this);var n=new Set(this);return n.union(r)},t.difference=function(r){return new Set(this).difference(r)},t.symmetricDifference=function(r){if(Er(r)&&!rr(r))return r.symmetricDifference(this);var n=new Set(this);return n.symmetricDifference(r)},t.isSubsetOf=function(r){return new Set(this).isSubsetOf(r)},t.isSupersetOf=function(r){return new Set(this).isSupersetOf(r)},t.isDisjointFrom=function(r){if(Er(r)&&!rr(r))return r.isDisjointFrom(this);var n=new Set(this);return n.isDisjointFrom(r)},t.replace=function(r){var n=this;return rr(r)&&(r=new Set(r)),xr(function(){Array.isArray(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):Er(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):r!=null&&he("Cannot initialize set from "+r)}),this},t.observe_=function(r,n){return n===!0&&he("`observe` doesn't support fireImmediately=true in combination with sets."),jo(this,r)},t.intercept_=function(r){return $o(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},bi(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),rr=on("ObservableSet",Xp);function tf(e){return e[Symbol.toStringTag]="SetIterator",Sl(e)}var rf=Object.create(null),nf="remove",Su=function(){function e(r,n,i,o){n===void 0&&(n=new Map),o===void 0&&(o=w1),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=r,this.values_=n,this.name_=i,this.defaultAnnotation_=o,this.keysAtom_=new an(this.name_+".keys"),this.isPlainObject_=sr(this.target_),eh(this.defaultAnnotation_)||he("defaultAnnotation must be valid annotation"),this.appliedAnnotations_={}}var t=e.prototype;return t.getObservablePropValue_=function(r){return this.values_.get(r).get()},t.setObservablePropValue_=function(r,n){var i=this.values_.get(r);if(i instanceof Kt)return i.set(n),!0;if(Bt(this)){var o=Dt(this,{type:ir,object:this.proxy_||this.target_,name:r,newValue:n});if(!o)return null;n=o.newValue}if(n=i.prepareNewValue_(n),n!==Y.UNCHANGED){var a=or(this),s=ft(),u=a||s?{type:ir,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:i.value_,name:r,newValue:n}:null;s&&Ot(u),i.setNewValue_(n),a&&ar(this,u),s&&At()}return!0},t.get_=function(r){return Y.trackingDerivation&&!Vt(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,n,i){return i===void 0&&(i=!1),Vt(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,n):i?Reflect.set(this.target_,r,n):(this.target_[r]=n,!0):this.extend_(r,{value:n,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,i)},t.has_=function(r){if(!Y.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var n=this.pendingKeys_.get(r);return n||(n=new Qr(r in this.target_,ds,this.name_+"."+bu(r)+"?",!1),this.pendingKeys_.set(r,n)),n.get()},t.make_=function(r,n){if(n===!0&&(n=this.defaultAnnotation_),n!==!1){if(sf(this,n,r),!(r in this.target_)){var i;if((i=this.target_[_t])!=null&&i[r])return;he(1,n.annotationType_,this.name_+"."+r.toString())}for(var o=this.target_;o&&o!==Oo;){var a=_a(o,r);if(a){var s=n.make_(this,r,a,o);if(s===0)return;if(s===1)break}o=Object.getPrototypeOf(o)}af(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);sf(this,i,r);var a=i.extend_(this,r,n,o);return a&&af(this,i,r),a},t.defineProperty_=function(r,n,i){i===void 0&&(i=!1),dr(this.keysAtom_);try{Rt();var o=this.delete_(r);if(!o)return o;if(Bt(this)){var a=Dt(this,{object:this.proxy_||this.target_,name:r,type:Jr,newValue:n.value});if(!a)return null;var s=a.newValue;n.value!==s&&(n=Sr({},n,{value:s}))}if(i){if(!Reflect.defineProperty(this.target_,r,n))return!1}else pr(this.target_,r,n);this.notifyPropertyAddition_(r,n.value)}finally{Mt()}return!0},t.defineObservableProperty_=function(r,n,i,o){o===void 0&&(o=!1),dr(this.keysAtom_);try{Rt();var a=this.delete_(r);if(!a)return a;if(Bt(this)){var s=Dt(this,{object:this.proxy_||this.target_,name:r,type:Jr,newValue:n});if(!s)return null;n=s.newValue}var u=of(r),l={configurable:Y.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(o){if(!Reflect.defineProperty(this.target_,r,l))return!1}else pr(this.target_,r,l);var f=new Qr(n,i,this.name_+"."+r.toString(),!1);this.values_.set(r,f),this.notifyPropertyAddition_(r,f.value_)}finally{Mt()}return!0},t.defineComputedProperty_=function(r,n,i){i===void 0&&(i=!1),dr(this.keysAtom_);try{Rt();var o=this.delete_(r);if(!o)return o;if(Bt(this)){var a=Dt(this,{object:this.proxy_||this.target_,name:r,type:Jr,newValue:void 0});if(!a)return null}n.name||(n.name=this.name_+"."+r.toString()),n.context=this.proxy_||this.target_;var s=of(r),u={configurable:Y.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:s.get,set:s.set};if(i){if(!Reflect.defineProperty(this.target_,r,u))return!1}else pr(this.target_,r,u);this.values_.set(r,new Kt(n)),this.notifyPropertyAddition_(r,void 0)}finally{Mt()}return!0},t.delete_=function(r,n){if(n===void 0&&(n=!1),dr(this.keysAtom_),!Vt(this.target_,r))return!0;if(Bt(this)){var i=Dt(this,{object:this.proxy_||this.target_,name:r,type:nf});if(!i)return null}try{var o;Rt();var a=or(this),s=ft(),u=this.values_.get(r),l=void 0;if(!u&&(a||s)){var f;l=(f=_a(this.target_,r))==null?void 0:f.value}if(n){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(delete this.appliedAnnotations_[r],u&&(this.values_.delete(r),u instanceof Qr&&(l=u.value_),Pp(u)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(o=o.get(r))==null||o.set(r in this.target_),a||s){var d={type:nf,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:l,name:r};s&&Ot(d),a&&ar(this,d),s&&At()}}finally{Mt()}return!0},t.observe_=function(r,n){return n===!0&&he("`observe` doesn't support the fire immediately property for observable objects."),jo(this,r)},t.intercept_=function(r){return $o(this,r)},t.notifyPropertyAddition_=function(r,n){var i,o=or(this),a=ft();if(o||a){var s=o||a?{type:Jr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:n}:null;a&&Ot(s),o&&ar(this,s),a&&At()}(i=this.pendingKeys_)==null||(i=i.get(r))==null||i.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),cs(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Ei(e,t){var r;if(t&&Tn(e)&&he("Options can't be provided for already observable objects."),Vt(e,Ee))return Ol(e)instanceof Su||he("Cannot convert '"+ja(e)+`' into observable object:
|
|
26
|
+
The target is already observable of different type.
|
|
27
|
+
Extending builtins is not supported.`),e;Object.isExtensible(e)||he("Cannot make the designated object observable; it is not extensible");var n=(r=t?.name)!=null?r:(sr(e)?"ObservableObject":e.constructor.name)+"@"+Ht(),i=new Su(e,new Map,String(n),j1(t));return ls(e,Ee,i),e}var Cw=on("ObservableObjectAdministration",Su);function of(e){return rf[e]||(rf[e]={get:function(){return this[Ee].getObservablePropValue_(e)},set:function(t){return this[Ee].setObservablePropValue_(e,t)}})}function Tn(e){return us(e)?Cw(e[Ee]):!1}function af(e,t,r){var n;e.appliedAnnotations_[r]=t,(n=e.target_[_t])==null||delete n[r]}function sf(e,t,r){if(eh(t)||he("Cannot annotate '"+e.name_+"."+r.toString()+"': Invalid annotation."),!xa(t)&&Vt(e.appliedAnnotations_,r)){var n=e.name_+"."+r.toString(),i=e.appliedAnnotations_[r].annotationType_,o=t.annotationType_;he("Cannot apply '"+o+"' to '"+n+"':"+(`
|
|
28
|
+
The field is already annotated with '`+i+"'.")+`
|
|
29
|
+
Re-annotating fields is not allowed.
|
|
30
|
+
Use 'override' annotation for methods overridden by subclass.`)}}var Nw=Zp(0),Uw=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Hs=0,Qp=function(){};function Pw(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}Pw(Qp,Array.prototype);var xl=function(e){function t(n,i,o,a){var s;return o===void 0&&(o="ObservableArray@"+Ht()),a===void 0&&(a=!1),s=e.call(this)||this,Un(function(){var u=new El(o,i,a,!0);u.proxy_=s,yp(s,Ee,u),n&&n.length&&s.spliceWithArray(0,0,n),Uw&&Object.defineProperty(s,"0",Nw)}),s}bp(t,e);var r=t.prototype;return r.concat=function(){this[Ee].atom_.reportObserved();for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return Array.prototype.concat.apply(this.slice(),i.map(function(a){return _i(a)?a.slice():a}))},r[Symbol.iterator]=function(){var n=this,i=0;return Sl({next:function(){return i<n.length?{value:n[i++],done:!1}:{done:!0,value:void 0}}})},bi(t,[{key:"length",get:function(){return this[Ee].getArrayLength_()},set:function(n){this[Ee].setArrayLength_(n)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(Qp);Object.entries(ka).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&ls(xl.prototype,t,r)});function Zp(e){return{enumerable:!1,configurable:!0,get:function(){return this[Ee].get_(e)},set:function(t){this[Ee].set_(e,t)}}}function Bw(e){pr(xl.prototype,""+e,Zp(e))}function Yp(e){if(e>Hs){for(var t=Hs;t<e+100;t++)Bw(t);Hs=e}}Yp(1e3);function Dw(e,t,r){return new xl(e,t,r)}function ur(e,t){if(typeof e=="object"&&e!==null){if(_i(e))return t!==void 0&&he(23),e[Ee].atom_;if(rr(e))return e.atom_;if(br(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||he(25,t,ja(e)),r}if(Tn(e)){if(!t)return he(26);var n=e[Ee].values_.get(t);return n||he(27,t,ja(e)),n}if(vl(e)||ko(e)||Sa(e))return e}else if(We(e)&&Sa(e[Ee]))return e[Ee];he(28)}function Ol(e,t){if(e||he(29),t!==void 0)return Ol(ur(e,t));if(vl(e)||ko(e)||Sa(e)||br(e)||rr(e))return e;if(e[Ee])return e[Ee];he(24,e)}function ja(e,t){var r;if(t!==void 0)r=ur(e,t);else{if(wn(e))return e.name;Tn(e)||br(e)||rr(e)?r=Ol(e):r=ur(e)}return r.name_}function Un(e){var t=Nn(),r=hs(!0);Rt();try{return e()}finally{Mt(),ys(r),Or(t)}}var uf=Oo.toString;function Al(e,t,r){return r===void 0&&(r=-1),Iu(e,t,r)}function Iu(e,t,r,n,i){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var o=typeof e;if(o!=="function"&&o!=="object"&&typeof t!="object")return!1;var a=uf.call(e);if(a!==uf.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=lf(e),t=lf(t);var s=a==="[object Array]";if(!s){if(typeof e!="object"||typeof t!="object")return!1;var u=e.constructor,l=t.constructor;if(u!==l&&!(We(u)&&u instanceof u&&We(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(r===0)return!1;r<0&&(r=-1),n=n||[],i=i||[];for(var f=n.length;f--;)if(n[f]===e)return i[f]===t;if(n.push(e),i.push(t),s){if(f=e.length,f!==t.length)return!1;for(;f--;)if(!Iu(e[f],t[f],r-1,n,i))return!1}else{var d=Object.keys(e),I=d.length;if(Object.keys(t).length!==I)return!1;for(var E=0;E<I;E++){var _=d[E];if(!(Vt(t,_)&&Iu(e[_],t[_],r-1,n,i)))return!1}}return n.pop(),i.pop(),!0}function lf(e){return _i(e)?e.slice():mi(e)||br(e)||Er(e)||rr(e)?Array.from(e.entries()):e}var cf,Rw=((cf=ss().Iterator)==null?void 0:cf.prototype)||{};function Sl(e){return e[Symbol.iterator]=Mw,Object.assign(Object.create(Rw),e)}function Mw(){return this}function eh(e){return e instanceof Object&&typeof e.annotationType_=="string"&&We(e.make_)&&We(e.extend_)}["Symbol","Map","Set"].forEach(function(e){var t=ss();typeof t[e]>"u"&&he("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:nw,extras:{getDebugName:ja},$mobx:Ee});var Lw=Object.create,Il=Object.defineProperty,Vw=Object.getOwnPropertyDescriptor,th=Object.getOwnPropertyNames,Fw=Object.getPrototypeOf,zw=Object.prototype.hasOwnProperty,it=(e,t)=>function(){return t||(0,e[th(e)[0]])((t={exports:{}}).exports,t),t.exports},rh=(e,t)=>{for(var r in t)Il(e,r,{get:t[r],enumerable:!0})},Kw=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of th(t))!zw.call(e,i)&&i!==r&&Il(e,i,{get:()=>t[i],enumerable:!(n=Vw(t,i))||n.enumerable});return e},Nr=(e,t,r)=>(r=e!=null?Lw(Fw(e)):{},Kw(t||!e||!e.__esModule?Il(r,"default",{value:e,enumerable:!0}):r,e)),sn=it({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/typebox.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Type=e.JsonType=e.JavaScriptTypeBuilder=e.JsonTypeBuilder=e.TypeBuilder=e.TypeBuilderError=e.TransformEncodeBuilder=e.TransformDecodeBuilder=e.TemplateLiteralDslParser=e.TemplateLiteralGenerator=e.TemplateLiteralGeneratorError=e.TemplateLiteralFinite=e.TemplateLiteralFiniteError=e.TemplateLiteralParser=e.TemplateLiteralParserError=e.TemplateLiteralResolver=e.TemplateLiteralPattern=e.TemplateLiteralPatternError=e.UnionResolver=e.KeyArrayResolver=e.KeyArrayResolverError=e.KeyResolver=e.ObjectMap=e.Intrinsic=e.IndexedAccessor=e.TypeClone=e.TypeExtends=e.TypeExtendsResult=e.TypeExtendsError=e.ExtendsUndefined=e.TypeGuard=e.TypeGuardUnknownTypeError=e.ValueGuard=e.FormatRegistry=e.TypeBoxError=e.TypeRegistry=e.PatternStringExact=e.PatternNumberExact=e.PatternBooleanExact=e.PatternString=e.PatternNumber=e.PatternBoolean=e.Kind=e.Hint=e.Optional=e.Readonly=e.Transform=void 0,e.Transform=Symbol.for("TypeBox.Transform"),e.Readonly=Symbol.for("TypeBox.Readonly"),e.Optional=Symbol.for("TypeBox.Optional"),e.Hint=Symbol.for("TypeBox.Hint"),e.Kind=Symbol.for("TypeBox.Kind"),e.PatternBoolean="(true|false)",e.PatternNumber="(0|[1-9][0-9]*)",e.PatternString="(.*)",e.PatternBooleanExact=`^${e.PatternBoolean}$`,e.PatternNumberExact=`^${e.PatternNumber}$`,e.PatternStringExact=`^${e.PatternString}$`;var t;(function(p){let w=new Map;function A(){return new Map(w)}p.Entries=A;function P(){return w.clear()}p.Clear=P;function j(T){return w.delete(T)}p.Delete=j;function N(T){return w.has(T)}p.Has=N;function g(T,c){w.set(T,c)}p.Set=g;function O(T){return w.get(T)}p.Get=O})(t||(e.TypeRegistry=t={}));var r=class extends Error{constructor(p){super(p)}};e.TypeBoxError=r;var n;(function(p){let w=new Map;function A(){return new Map(w)}p.Entries=A;function P(){return w.clear()}p.Clear=P;function j(T){return w.delete(T)}p.Delete=j;function N(T){return w.has(T)}p.Has=N;function g(T,c){w.set(T,c)}p.Set=g;function O(T){return w.get(T)}p.Get=O})(n||(e.FormatRegistry=n={}));var i;(function(p){function w(v){return Array.isArray(v)}p.IsArray=w;function A(v){return typeof v=="bigint"}p.IsBigInt=A;function P(v){return typeof v=="boolean"}p.IsBoolean=P;function j(v){return v instanceof globalThis.Date}p.IsDate=j;function N(v){return v===null}p.IsNull=N;function g(v){return typeof v=="number"}p.IsNumber=g;function O(v){return typeof v=="object"&&v!==null}p.IsObject=O;function T(v){return typeof v=="string"}p.IsString=T;function c(v){return v instanceof globalThis.Uint8Array}p.IsUint8Array=c;function x(v){return v===void 0}p.IsUndefined=x})(i||(e.ValueGuard=i={}));var o=class extends r{};e.TypeGuardUnknownTypeError=o;var a;(function(p){function w(m){try{return new RegExp(m),!0}catch{return!1}}function A(m){if(!i.IsString(m))return!1;for(let Re=0;Re<m.length;Re++){let $t=m.charCodeAt(Re);if($t>=7&&$t<=13||$t===27||$t===127)return!1}return!0}function P(m){return g(m)||rt(m)}function j(m){return i.IsUndefined(m)||i.IsBigInt(m)}function N(m){return i.IsUndefined(m)||i.IsNumber(m)}function g(m){return i.IsUndefined(m)||i.IsBoolean(m)}function O(m){return i.IsUndefined(m)||i.IsString(m)}function T(m){return i.IsUndefined(m)||i.IsString(m)&&A(m)&&w(m)}function c(m){return i.IsUndefined(m)||i.IsString(m)&&A(m)}function x(m){return i.IsUndefined(m)||rt(m)}function v(m){return Oe(m,"Any")&&O(m.$id)}p.TAny=v;function b(m){return Oe(m,"Array")&&m.type==="array"&&O(m.$id)&&rt(m.items)&&N(m.minItems)&&N(m.maxItems)&&g(m.uniqueItems)&&x(m.contains)&&N(m.minContains)&&N(m.maxContains)}p.TArray=b;function U(m){return Oe(m,"AsyncIterator")&&m.type==="AsyncIterator"&&O(m.$id)&&rt(m.items)}p.TAsyncIterator=U;function H(m){return Oe(m,"BigInt")&&m.type==="bigint"&&O(m.$id)&&j(m.exclusiveMaximum)&&j(m.exclusiveMinimum)&&j(m.maximum)&&j(m.minimum)&&j(m.multipleOf)}p.TBigInt=H;function ie(m){return Oe(m,"Boolean")&&m.type==="boolean"&&O(m.$id)}p.TBoolean=ie;function oe(m){return Oe(m,"Constructor")&&m.type==="Constructor"&&O(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Re=>rt(Re))&&rt(m.returns)}p.TConstructor=oe;function _e(m){return Oe(m,"Date")&&m.type==="Date"&&O(m.$id)&&N(m.exclusiveMaximumTimestamp)&&N(m.exclusiveMinimumTimestamp)&&N(m.maximumTimestamp)&&N(m.minimumTimestamp)&&N(m.multipleOfTimestamp)}p.TDate=_e;function Se(m){return Oe(m,"Function")&&m.type==="Function"&&O(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Re=>rt(Re))&&rt(m.returns)}p.TFunction=Se;function Ve(m){return Oe(m,"Integer")&&m.type==="integer"&&O(m.$id)&&N(m.exclusiveMaximum)&&N(m.exclusiveMinimum)&&N(m.maximum)&&N(m.minimum)&&N(m.multipleOf)}p.TInteger=Ve;function He(m){return Oe(m,"Intersect")&&!(i.IsString(m.type)&&m.type!=="object")&&i.IsArray(m.allOf)&&m.allOf.every(Re=>rt(Re)&&!Ri(Re))&&O(m.type)&&(g(m.unevaluatedProperties)||x(m.unevaluatedProperties))&&O(m.$id)}p.TIntersect=He;function un(m){return Oe(m,"Iterator")&&m.type==="Iterator"&&O(m.$id)&&rt(m.items)}p.TIterator=un;function Oe(m,Re){return Br(m)&&m[e.Kind]===Re}p.TKindOf=Oe;function Br(m){return i.IsObject(m)&&e.Kind in m&&i.IsString(m[e.Kind])}p.TKind=Br;function ln(m){return C(m)&&i.IsString(m.const)}p.TLiteralString=ln;function S(m){return C(m)&&i.IsNumber(m.const)}p.TLiteralNumber=S;function ye(m){return C(m)&&i.IsBoolean(m.const)}p.TLiteralBoolean=ye;function C(m){return Oe(m,"Literal")&&O(m.$id)&&(i.IsBoolean(m.const)||i.IsNumber(m.const)||i.IsString(m.const))}p.TLiteral=C;function xe(m){return Oe(m,"Never")&&i.IsObject(m.not)&&Object.getOwnPropertyNames(m.not).length===0}p.TNever=xe;function se(m){return Oe(m,"Not")&&rt(m.not)}p.TNot=se;function ge(m){return Oe(m,"Null")&&m.type==="null"&&O(m.$id)}p.TNull=ge;function De(m){return Oe(m,"Number")&&m.type==="number"&&O(m.$id)&&N(m.exclusiveMaximum)&&N(m.exclusiveMinimum)&&N(m.maximum)&&N(m.minimum)&&N(m.multipleOf)}p.TNumber=De;function Je(m){return Oe(m,"Object")&&m.type==="object"&&O(m.$id)&&i.IsObject(m.properties)&&P(m.additionalProperties)&&N(m.minProperties)&&N(m.maxProperties)&&Object.entries(m.properties).every(([Re,$t])=>A(Re)&&rt($t))}p.TObject=Je;function mt(m){return Oe(m,"Promise")&&m.type==="Promise"&&O(m.$id)&&rt(m.item)}p.TPromise=mt;function dt(m){return Oe(m,"Record")&&m.type==="object"&&O(m.$id)&&P(m.additionalProperties)&&i.IsObject(m.patternProperties)&&(Re=>{let $t=Object.getOwnPropertyNames(Re.patternProperties);return $t.length===1&&w($t[0])&&i.IsObject(Re.patternProperties)&&rt(Re.patternProperties[$t[0]])})(m)}p.TRecord=dt;function vt(m){return i.IsObject(m)&&e.Hint in m&&m[e.Hint]==="Recursive"}p.TRecursive=vt;function Dr(m){return Oe(m,"Ref")&&O(m.$id)&&i.IsString(m.$ref)}p.TRef=Dr;function Wn(m){return Oe(m,"String")&&m.type==="string"&&O(m.$id)&&N(m.minLength)&&N(m.maxLength)&&T(m.pattern)&&c(m.format)}p.TString=Wn;function Hn(m){return Oe(m,"Symbol")&&m.type==="symbol"&&O(m.$id)}p.TSymbol=Hn;function cn(m){return Oe(m,"TemplateLiteral")&&m.type==="string"&&i.IsString(m.pattern)&&m.pattern[0]==="^"&&m.pattern[m.pattern.length-1]==="$"}p.TTemplateLiteral=cn;function Fo(m){return Oe(m,"This")&&O(m.$id)&&i.IsString(m.$ref)}p.TThis=Fo;function Ri(m){return i.IsObject(m)&&e.Transform in m}p.TTransform=Ri;function tt(m){return Oe(m,"Tuple")&&m.type==="array"&&O(m.$id)&&i.IsNumber(m.minItems)&&i.IsNumber(m.maxItems)&&m.minItems===m.maxItems&&(i.IsUndefined(m.items)&&i.IsUndefined(m.additionalItems)&&m.minItems===0||i.IsArray(m.items)&&m.items.every(Re=>rt(Re)))}p.TTuple=tt;function zo(m){return Oe(m,"Undefined")&&m.type==="undefined"&&O(m.$id)}p.TUndefined=zo;function Ms(m){return fn(m)&&m.anyOf.every(Re=>ln(Re)||S(Re))}p.TUnionLiteral=Ms;function fn(m){return Oe(m,"Union")&&O(m.$id)&&i.IsObject(m)&&i.IsArray(m.anyOf)&&m.anyOf.every(Re=>rt(Re))}p.TUnion=fn;function Jn(m){return Oe(m,"Uint8Array")&&m.type==="Uint8Array"&&O(m.$id)&&N(m.minByteLength)&&N(m.maxByteLength)}p.TUint8Array=Jn;function bt(m){return Oe(m,"Unknown")&&O(m.$id)}p.TUnknown=bt;function Ko(m){return Oe(m,"Unsafe")}p.TUnsafe=Ko;function Mi(m){return Oe(m,"Void")&&m.type==="void"&&O(m.$id)}p.TVoid=Mi;function Ls(m){return i.IsObject(m)&&m[e.Readonly]==="Readonly"}p.TReadonly=Ls;function Vs(m){return i.IsObject(m)&&m[e.Optional]==="Optional"}p.TOptional=Vs;function rt(m){return i.IsObject(m)&&(v(m)||b(m)||ie(m)||H(m)||U(m)||oe(m)||_e(m)||Se(m)||Ve(m)||He(m)||un(m)||C(m)||xe(m)||se(m)||ge(m)||De(m)||Je(m)||mt(m)||dt(m)||Dr(m)||Wn(m)||Hn(m)||cn(m)||Fo(m)||tt(m)||zo(m)||fn(m)||Jn(m)||bt(m)||Ko(m)||Mi(m)||Br(m)&&t.Has(m[e.Kind]))}p.TSchema=rt})(a||(e.TypeGuard=a={}));var s;(function(p){function w(A){return A[e.Kind]==="Intersect"?A.allOf.every(P=>w(P)):A[e.Kind]==="Union"?A.anyOf.some(P=>w(P)):A[e.Kind]==="Undefined"?!0:A[e.Kind]==="Not"?!w(A.not):!1}p.Check=w})(s||(e.ExtendsUndefined=s={}));var u=class extends r{};e.TypeExtendsError=u;var l;(function(p){p[p.Union=0]="Union",p[p.True=1]="True",p[p.False=2]="False"})(l||(e.TypeExtendsResult=l={}));var f;(function(p){function w(y){return y===l.False?y:l.True}function A(y){throw new u(y)}function P(y){return a.TNever(y)||a.TIntersect(y)||a.TUnion(y)||a.TUnknown(y)||a.TAny(y)}function j(y,h){return a.TNever(h)?Oe(y,h):a.TIntersect(h)?Se(y,h):a.TUnion(h)?Fs(y,h):a.TUnknown(h)?xc(y,h):a.TAny(h)?N(y,h):A("StructuralRight")}function N(y,h){return l.True}function g(y,h){return a.TIntersect(h)?Se(y,h):a.TUnion(h)&&h.anyOf.some($e=>a.TAny($e)||a.TUnknown($e))?l.True:a.TUnion(h)?l.Union:a.TUnknown(h)||a.TAny(h)?l.True:l.Union}function O(y,h){return a.TUnknown(y)?l.False:a.TAny(y)?l.Union:a.TNever(y)?l.True:l.False}function T(y,h){return a.TObject(h)&&cn(h)?l.True:P(h)?j(y,h):a.TArray(h)?w(Me(y.items,h.items)):l.False}function c(y,h){return P(h)?j(y,h):a.TAsyncIterator(h)?w(Me(y.items,h.items)):l.False}function x(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TBigInt(h)?l.True:l.False}function v(y,h){return a.TLiteral(y)&&i.IsBoolean(y.const)||a.TBoolean(y)?l.True:l.False}function b(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TBoolean(h)?l.True:l.False}function U(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TConstructor(h)?y.parameters.length>h.parameters.length?l.False:y.parameters.every(($e,wr)=>w(Me(h.parameters[wr],$e))===l.True)?w(Me(y.returns,h.returns)):l.False:l.False}function H(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TDate(h)?l.True:l.False}function ie(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TFunction(h)?y.parameters.length>h.parameters.length?l.False:y.parameters.every(($e,wr)=>w(Me(h.parameters[wr],$e))===l.True)?w(Me(y.returns,h.returns)):l.False:l.False}function oe(y,h){return a.TLiteral(y)&&i.IsNumber(y.const)||a.TNumber(y)||a.TInteger(y)?l.True:l.False}function _e(y,h){return a.TInteger(h)||a.TNumber(h)?l.True:P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):l.False}function Se(y,h){return h.allOf.every($e=>Me(y,$e)===l.True)?l.True:l.False}function Ve(y,h){return y.allOf.some($e=>Me($e,h)===l.True)?l.True:l.False}function He(y,h){return P(h)?j(y,h):a.TIterator(h)?w(Me(y.items,h.items)):l.False}function un(y,h){return a.TLiteral(h)&&h.const===y.const?l.True:P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TString(h)?Mi(y,h):a.TNumber(h)?C(y,h):a.TInteger(h)?oe(y,h):a.TBoolean(h)?v(y,h):l.False}function Oe(y,h){return l.False}function Br(y,h){return l.True}function ln(y){let[h,$e]=[y,0];for(;a.TNot(h);)h=h.not,$e+=1;return $e%2===0?h:e.Type.Unknown()}function S(y,h){return a.TNot(y)?Me(ln(y),h):a.TNot(h)?Me(y,ln(h)):A("Invalid fallthrough for Not")}function ye(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TNull(h)?l.True:l.False}function C(y,h){return a.TLiteralNumber(y)||a.TNumber(y)||a.TInteger(y)?l.True:l.False}function xe(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TInteger(h)||a.TNumber(h)?l.True:l.False}function se(y,h){return Object.getOwnPropertyNames(y.properties).length===h}function ge(y){return cn(y)}function De(y){return se(y,0)||se(y,1)&&"description"in y.properties&&a.TUnion(y.properties.description)&&y.properties.description.anyOf.length===2&&(a.TString(y.properties.description.anyOf[0])&&a.TUndefined(y.properties.description.anyOf[1])||a.TString(y.properties.description.anyOf[1])&&a.TUndefined(y.properties.description.anyOf[0]))}function Je(y){return se(y,0)}function mt(y){return se(y,0)}function dt(y){return se(y,0)}function vt(y){return se(y,0)}function Dr(y){return cn(y)}function Wn(y){let h=e.Type.Number();return se(y,0)||se(y,1)&&"length"in y.properties&&w(Me(y.properties.length,h))===l.True}function Hn(y){return se(y,0)}function cn(y){let h=e.Type.Number();return se(y,0)||se(y,1)&&"length"in y.properties&&w(Me(y.properties.length,h))===l.True}function Fo(y){let h=e.Type.Function([e.Type.Any()],e.Type.Any());return se(y,0)||se(y,1)&&"then"in y.properties&&w(Me(y.properties.then,h))===l.True}function Ri(y,h){return Me(y,h)===l.False||a.TOptional(y)&&!a.TOptional(h)?l.False:l.True}function tt(y,h){return a.TUnknown(y)?l.False:a.TAny(y)?l.Union:a.TNever(y)||a.TLiteralString(y)&&ge(h)||a.TLiteralNumber(y)&&Je(h)||a.TLiteralBoolean(y)&&mt(h)||a.TSymbol(y)&&De(h)||a.TBigInt(y)&&dt(h)||a.TString(y)&&ge(h)||a.TSymbol(y)&&De(h)||a.TNumber(y)&&Je(h)||a.TInteger(y)&&Je(h)||a.TBoolean(y)&&mt(h)||a.TUint8Array(y)&&Dr(h)||a.TDate(y)&&vt(h)||a.TConstructor(y)&&Hn(h)||a.TFunction(y)&&Wn(h)?l.True:a.TRecord(y)&&a.TString(fn(y))?h[e.Hint]==="Record"?l.True:l.False:a.TRecord(y)&&a.TNumber(fn(y))&&se(h,0)?l.True:l.False}function zo(y,h){return P(h)?j(y,h):a.TRecord(h)?bt(y,h):a.TObject(h)?(()=>{for(let $e of Object.getOwnPropertyNames(h.properties)){if(!($e in y.properties)&&!a.TOptional(h.properties[$e]))return l.False;if(a.TOptional(h.properties[$e]))return l.True;if(Ri(y.properties[$e],h.properties[$e])===l.False)return l.False}return l.True})():l.False}function Ms(y,h){return P(h)?j(y,h):a.TObject(h)&&Fo(h)?l.True:a.TPromise(h)?w(Me(y.item,h.item)):l.False}function fn(y){return e.PatternNumberExact in y.patternProperties?e.Type.Number():e.PatternStringExact in y.patternProperties?e.Type.String():A("Unknown record key pattern")}function Jn(y){return e.PatternNumberExact in y.patternProperties?y.patternProperties[e.PatternNumberExact]:e.PatternStringExact in y.patternProperties?y.patternProperties[e.PatternStringExact]:A("Unable to get record value schema")}function bt(y,h){let[$e,wr]=[fn(h),Jn(h)];return a.TLiteralString(y)&&a.TNumber($e)&&w(Me(y,wr))===l.True?l.True:a.TUint8Array(y)&&a.TNumber($e)||a.TString(y)&&a.TNumber($e)||a.TArray(y)&&a.TNumber($e)?Me(y,wr):a.TObject(y)?(()=>{for(let yg of Object.getOwnPropertyNames(y.properties))if(Ri(wr,y.properties[yg])===l.False)return l.False;return l.True})():l.False}function Ko(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?Me(Jn(y),Jn(h)):l.False}function Mi(y,h){return a.TLiteral(y)&&i.IsString(y.const)||a.TString(y)?l.True:l.False}function Ls(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TString(h)?l.True:l.False}function Vs(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TSymbol(h)?l.True:l.False}function rt(y,h){return a.TTemplateLiteral(y)?Me(D.Resolve(y),h):a.TTemplateLiteral(h)?Me(y,D.Resolve(h)):A("Invalid fallthrough for TemplateLiteral")}function m(y,h){return a.TArray(h)&&y.items!==void 0&&y.items.every($e=>Me($e,h.items)===l.True)}function Re(y,h){return a.TNever(y)?l.True:a.TUnknown(y)?l.False:a.TAny(y)?l.Union:l.False}function $t(y,h){return P(h)?j(y,h):a.TObject(h)&&cn(h)||a.TArray(h)&&m(y,h)?l.True:a.TTuple(h)?i.IsUndefined(y.items)&&!i.IsUndefined(h.items)||!i.IsUndefined(y.items)&&i.IsUndefined(h.items)?l.False:i.IsUndefined(y.items)&&!i.IsUndefined(h.items)||y.items.every(($e,wr)=>Me($e,h.items[wr])===l.True)?l.True:l.False:l.False}function ug(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TUint8Array(h)?l.True:l.False}function lg(y,h){return P(h)?j(y,h):a.TObject(h)?tt(y,h):a.TRecord(h)?bt(y,h):a.TVoid(h)?dg(y,h):a.TUndefined(h)?l.True:l.False}function Fs(y,h){return h.anyOf.some($e=>Me(y,$e)===l.True)?l.True:l.False}function cg(y,h){return y.anyOf.every($e=>Me($e,h)===l.True)?l.True:l.False}function xc(y,h){return l.True}function fg(y,h){return a.TNever(h)?Oe(y,h):a.TIntersect(h)?Se(y,h):a.TUnion(h)?Fs(y,h):a.TAny(h)?N(y,h):a.TString(h)?Mi(y,h):a.TNumber(h)?C(y,h):a.TInteger(h)?oe(y,h):a.TBoolean(h)?v(y,h):a.TArray(h)?O(y,h):a.TTuple(h)?Re(y,h):a.TObject(h)?tt(y,h):a.TUnknown(h)?l.True:l.False}function dg(y,h){return a.TUndefined(y)||a.TUndefined(y)?l.True:l.False}function pg(y,h){return a.TIntersect(h)?Se(y,h):a.TUnion(h)?Fs(y,h):a.TUnknown(h)?xc(y,h):a.TAny(h)?N(y,h):a.TObject(h)?tt(y,h):a.TVoid(h)?l.True:l.False}function Me(y,h){return a.TTemplateLiteral(y)||a.TTemplateLiteral(h)?rt(y,h):a.TNot(y)||a.TNot(h)?S(y,h):a.TAny(y)?g(y,h):a.TArray(y)?T(y,h):a.TBigInt(y)?x(y,h):a.TBoolean(y)?b(y,h):a.TAsyncIterator(y)?c(y,h):a.TConstructor(y)?U(y,h):a.TDate(y)?H(y,h):a.TFunction(y)?ie(y,h):a.TInteger(y)?_e(y,h):a.TIntersect(y)?Ve(y,h):a.TIterator(y)?He(y,h):a.TLiteral(y)?un(y,h):a.TNever(y)?Br(y,h):a.TNull(y)?ye(y,h):a.TNumber(y)?xe(y,h):a.TObject(y)?zo(y,h):a.TRecord(y)?Ko(y,h):a.TString(y)?Ls(y,h):a.TSymbol(y)?Vs(y,h):a.TTuple(y)?$t(y,h):a.TPromise(y)?Ms(y,h):a.TUint8Array(y)?ug(y,h):a.TUndefined(y)?lg(y,h):a.TUnion(y)?cg(y,h):a.TUnknown(y)?fg(y,h):a.TVoid(y)?pg(y,h):A(`Unknown left type operand '${y[e.Kind]}'`)}function hg(y,h){return Me(y,h)}p.Extends=hg})(f||(e.TypeExtends=f={}));var d;(function(p){function w(T){return T.map(c=>N(c))}function A(T){return new Date(T.getTime())}function P(T){return new Uint8Array(T)}function j(T){let c=Object.getOwnPropertyNames(T).reduce((v,b)=>({...v,[b]:N(T[b])}),{}),x=Object.getOwnPropertySymbols(T).reduce((v,b)=>({...v,[b]:N(T[b])}),{});return{...c,...x}}function N(T){return i.IsArray(T)?w(T):i.IsDate(T)?A(T):i.IsUint8Array(T)?P(T):i.IsObject(T)?j(T):T}function g(T){return T.map(c=>O(c))}p.Rest=g;function O(T,c={}){return{...N(T),...c}}p.Type=O})(d||(e.TypeClone=d={}));var I;(function(p){function w(U){return U.map(H=>{let{[e.Optional]:ie,...oe}=d.Type(H);return oe})}function A(U){return U.every(H=>a.TOptional(H))}function P(U){return U.some(H=>a.TOptional(H))}function j(U){return A(U.allOf)?e.Type.Optional(e.Type.Intersect(w(U.allOf))):U}function N(U){return P(U.anyOf)?e.Type.Optional(e.Type.Union(w(U.anyOf))):U}function g(U){return U[e.Kind]==="Intersect"?j(U):U[e.Kind]==="Union"?N(U):U}function O(U,H){let ie=U.allOf.reduce((oe,_e)=>{let Se=v(_e,H);return Se[e.Kind]==="Never"?oe:[...oe,Se]},[]);return g(e.Type.Intersect(ie))}function T(U,H){let ie=U.anyOf.map(oe=>v(oe,H));return g(e.Type.Union(ie))}function c(U,H){let ie=U.properties[H];return i.IsUndefined(ie)?e.Type.Never():e.Type.Union([ie])}function x(U,H){let ie=U.items;if(i.IsUndefined(ie))return e.Type.Never();let oe=ie[H];return i.IsUndefined(oe)?e.Type.Never():oe}function v(U,H){return U[e.Kind]==="Intersect"?O(U,H):U[e.Kind]==="Union"?T(U,H):U[e.Kind]==="Object"?c(U,H):U[e.Kind]==="Tuple"?x(U,H):e.Type.Never()}function b(U,H,ie={}){let oe=H.map(_e=>v(U,_e.toString()));return g(e.Type.Union(oe,ie))}p.Resolve=b})(I||(e.IndexedAccessor=I={}));var E;(function(p){function w(x){let[v,b]=[x.slice(0,1),x.slice(1)];return`${v.toLowerCase()}${b}`}function A(x){let[v,b]=[x.slice(0,1),x.slice(1)];return`${v.toUpperCase()}${b}`}function P(x){return x.toUpperCase()}function j(x){return x.toLowerCase()}function N(x,v){let b=K.ParseExact(x.pattern);if(!$.Check(b))return{...x,pattern:g(x.pattern,v)};let U=[...z.Generate(b)].map(oe=>e.Type.Literal(oe)),H=O(U,v),ie=e.Type.Union(H);return e.Type.TemplateLiteral([ie])}function g(x,v){return typeof x=="string"?v==="Uncapitalize"?w(x):v==="Capitalize"?A(x):v==="Uppercase"?P(x):v==="Lowercase"?j(x):x:x.toString()}function O(x,v){if(x.length===0)return[];let[b,...U]=x;return[c(b,v),...O(U,v)]}function T(x,v){return a.TTemplateLiteral(x)?N(x,v):a.TUnion(x)?e.Type.Union(O(x.anyOf,v)):a.TLiteral(x)?e.Type.Literal(g(x.const,v)):x}function c(x,v){return T(x,v)}p.Map=c})(E||(e.Intrinsic=E={}));var _;(function(p){function w(g,O){return e.Type.Intersect(g.allOf.map(T=>j(T,O)),{...g})}function A(g,O){return e.Type.Union(g.anyOf.map(T=>j(T,O)),{...g})}function P(g,O){return O(g)}function j(g,O){return g[e.Kind]==="Intersect"?w(g,O):g[e.Kind]==="Union"?A(g,O):g[e.Kind]==="Object"?P(g,O):g}function N(g,O,T){return{...j(d.Type(g),O),...T}}p.Map=N})(_||(e.ObjectMap=_={}));var L;(function(p){function w(c){return c[0]==="^"&&c[c.length-1]==="$"?c.slice(1,c.length-1):c}function A(c,x){return c.allOf.reduce((v,b)=>[...v,...g(b,x)],[])}function P(c,x){let v=c.anyOf.map(b=>g(b,x));return[...v.reduce((b,U)=>U.map(H=>v.every(ie=>ie.includes(H))?b.add(H):b)[0],new Set)]}function j(c,x){return Object.getOwnPropertyNames(c.properties)}function N(c,x){return x.includePatterns?Object.getOwnPropertyNames(c.patternProperties):[]}function g(c,x){return a.TIntersect(c)?A(c,x):a.TUnion(c)?P(c,x):a.TObject(c)?j(c,x):a.TRecord(c)?N(c,x):[]}function O(c,x){return[...new Set(g(c,x))]}p.ResolveKeys=O;function T(c){return`^(${O(c,{includePatterns:!0}).map(x=>`(${w(x)})`).join("|")})$`}p.ResolvePattern=T})(L||(e.KeyResolver=L={}));var J=class extends r{};e.KeyArrayResolverError=J;var B;(function(p){function w(A){return Array.isArray(A)?A:a.TUnionLiteral(A)?A.anyOf.map(P=>P.const.toString()):a.TLiteral(A)?[A.const]:a.TTemplateLiteral(A)?(()=>{let P=K.ParseExact(A.pattern);if(!$.Check(P))throw new J("Cannot resolve keys from infinite template expression");return[...z.Generate(P)]})():[]}p.Resolve=w})(B||(e.KeyArrayResolver=B={}));var k;(function(p){function*w(P){for(let j of P.anyOf)j[e.Kind]==="Union"?yield*w(j):yield j}function A(P){return e.Type.Union([...w(P)],{...P})}p.Resolve=A})(k||(e.UnionResolver=k={}));var F=class extends r{};e.TemplateLiteralPatternError=F;var q;(function(p){function w(N){throw new F(N)}function A(N){return N.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function P(N,g){return a.TTemplateLiteral(N)?N.pattern.slice(1,N.pattern.length-1):a.TUnion(N)?`(${N.anyOf.map(O=>P(O,g)).join("|")})`:a.TNumber(N)?`${g}${e.PatternNumber}`:a.TInteger(N)?`${g}${e.PatternNumber}`:a.TBigInt(N)?`${g}${e.PatternNumber}`:a.TString(N)?`${g}${e.PatternString}`:a.TLiteral(N)?`${g}${A(N.const.toString())}`:a.TBoolean(N)?`${g}${e.PatternBoolean}`:w(`Unexpected Kind '${N[e.Kind]}'`)}function j(N){return`^${N.map(g=>P(g,"")).join("")}$`}p.Create=j})(q||(e.TemplateLiteralPattern=q={}));var D;(function(p){function w(A){let P=K.ParseExact(A.pattern);if(!$.Check(P))return e.Type.String();let j=[...z.Generate(P)].map(N=>e.Type.Literal(N));return e.Type.Union(j)}p.Resolve=w})(D||(e.TemplateLiteralResolver=D={}));var Q=class extends r{};e.TemplateLiteralParserError=Q;var K;(function(p){function w(U,H,ie){return U[H]===ie&&U.charCodeAt(H-1)!==92}function A(U,H){return w(U,H,"(")}function P(U,H){return w(U,H,")")}function j(U,H){return w(U,H,"|")}function N(U){if(!(A(U,0)&&P(U,U.length-1)))return!1;let H=0;for(let ie=0;ie<U.length;ie++)if(A(U,ie)&&(H+=1),P(U,ie)&&(H-=1),H===0&&ie!==U.length-1)return!1;return!0}function g(U){return U.slice(1,U.length-1)}function O(U){let H=0;for(let ie=0;ie<U.length;ie++)if(A(U,ie)&&(H+=1),P(U,ie)&&(H-=1),j(U,ie)&&H===0)return!0;return!1}function T(U){for(let H=0;H<U.length;H++)if(A(U,H))return!0;return!1}function c(U){let[H,ie]=[0,0],oe=[];for(let Se=0;Se<U.length;Se++)if(A(U,Se)&&(H+=1),P(U,Se)&&(H-=1),j(U,Se)&&H===0){let Ve=U.slice(ie,Se);Ve.length>0&&oe.push(v(Ve)),ie=Se+1}let _e=U.slice(ie);return _e.length>0&&oe.push(v(_e)),oe.length===0?{type:"const",const:""}:oe.length===1?oe[0]:{type:"or",expr:oe}}function x(U){function H(_e,Se){if(!A(_e,Se))throw new Q("TemplateLiteralParser: Index must point to open parens");let Ve=0;for(let He=Se;He<_e.length;He++)if(A(_e,He)&&(Ve+=1),P(_e,He)&&(Ve-=1),Ve===0)return[Se,He];throw new Q("TemplateLiteralParser: Unclosed group parens in expression")}function ie(_e,Se){for(let Ve=Se;Ve<_e.length;Ve++)if(A(_e,Ve))return[Se,Ve];return[Se,_e.length]}let oe=[];for(let _e=0;_e<U.length;_e++)if(A(U,_e)){let[Se,Ve]=H(U,_e),He=U.slice(Se,Ve+1);oe.push(v(He)),_e=Ve}else{let[Se,Ve]=ie(U,_e),He=U.slice(Se,Ve);He.length>0&&oe.push(v(He)),_e=Ve-1}return oe.length===0?{type:"const",const:""}:oe.length===1?oe[0]:{type:"and",expr:oe}}function v(U){return N(U)?v(g(U)):O(U)?c(U):T(U)?x(U):{type:"const",const:U}}p.Parse=v;function b(U){return v(U.slice(1,U.length-1))}p.ParseExact=b})(K||(e.TemplateLiteralParser=K={}));var re=class extends r{};e.TemplateLiteralFiniteError=re;var $;(function(p){function w(g){throw new re(g)}function A(g){return g.type==="or"&&g.expr.length===2&&g.expr[0].type==="const"&&g.expr[0].const==="0"&&g.expr[1].type==="const"&&g.expr[1].const==="[1-9][0-9]*"}function P(g){return g.type==="or"&&g.expr.length===2&&g.expr[0].type==="const"&&g.expr[0].const==="true"&&g.expr[1].type==="const"&&g.expr[1].const==="false"}function j(g){return g.type==="const"&&g.const===".*"}function N(g){return P(g)?!0:A(g)||j(g)?!1:g.type==="and"?g.expr.every(O=>N(O)):g.type==="or"?g.expr.every(O=>N(O)):g.type==="const"?!0:w("Unknown expression type")}p.Check=N})($||(e.TemplateLiteralFinite=$={}));var R=class extends r{};e.TemplateLiteralGeneratorError=R;var z;(function(p){function*w(g){if(g.length===1)return yield*g[0];for(let O of g[0])for(let T of w(g.slice(1)))yield`${O}${T}`}function*A(g){return yield*w(g.expr.map(O=>[...N(O)]))}function*P(g){for(let O of g.expr)yield*N(O)}function*j(g){return yield g.const}function*N(g){return g.type==="and"?yield*A(g):g.type==="or"?yield*P(g):g.type==="const"?yield*j(g):(()=>{throw new R("Unknown expression")})()}p.Generate=N})(z||(e.TemplateLiteralGenerator=z={}));var ne;(function(p){function*w(N){let g=N.trim().replace(/"|'/g,"");return g==="boolean"?yield e.Type.Boolean():g==="number"?yield e.Type.Number():g==="bigint"?yield e.Type.BigInt():g==="string"?yield e.Type.String():yield(()=>{let O=g.split("|").map(T=>e.Type.Literal(T.trim()));return O.length===0?e.Type.Never():O.length===1?O[0]:e.Type.Union(O)})()}function*A(N){if(N[1]!=="{"){let g=e.Type.Literal("$"),O=P(N.slice(1));return yield*[g,...O]}for(let g=2;g<N.length;g++)if(N[g]==="}"){let O=w(N.slice(2,g)),T=P(N.slice(g+1));return yield*[...O,...T]}yield e.Type.Literal(N)}function*P(N){for(let g=0;g<N.length;g++)if(N[g]==="$"){let O=e.Type.Literal(N.slice(0,g)),T=A(N.slice(g));return yield*[O,...T]}yield e.Type.Literal(N)}function j(N){return[...P(N)]}p.Parse=j})(ne||(e.TemplateLiteralDslParser=ne={}));var ue=class{constructor(p){this.schema=p}Decode(p){return new te(this.schema,p)}};e.TransformDecodeBuilder=ue;var te=class{constructor(p,w){this.schema=p,this.decode=w}Encode(p){let w=d.Type(this.schema);return a.TTransform(w)?(()=>{let A={Encode:P=>w[e.Transform].Encode(p(P)),Decode:P=>this.decode(w[e.Transform].Decode(P))};return{...w,[e.Transform]:A}})():(()=>{let A={Decode:this.decode,Encode:p};return{...w,[e.Transform]:A}})()}};e.TransformEncodeBuilder=te;var fe=0,V=class extends r{};e.TypeBuilderError=V;var X=class{Create(p){return p}Throw(p){throw new V(p)}Discard(p,w){return w.reduce((A,P)=>{let{[P]:j,...N}=A;return N},p)}Strict(p){return JSON.parse(JSON.stringify(p))}};e.TypeBuilder=X;var ee=class extends X{ReadonlyOptional(p){return this.Readonly(this.Optional(p))}Readonly(p){return{...d.Type(p),[e.Readonly]:"Readonly"}}Optional(p){return{...d.Type(p),[e.Optional]:"Optional"}}Any(p={}){return this.Create({...p,[e.Kind]:"Any"})}Array(p,w={}){return this.Create({...w,[e.Kind]:"Array",type:"array",items:d.Type(p)})}Boolean(p={}){return this.Create({...p,[e.Kind]:"Boolean",type:"boolean"})}Capitalize(p,w={}){return{...E.Map(d.Type(p),"Capitalize"),...w}}Composite(p,w){let A=e.Type.Intersect(p,{}),P=L.ResolveKeys(A,{includePatterns:!1}).reduce((j,N)=>({...j,[N]:e.Type.Index(A,[N])}),{});return e.Type.Object(P,w)}Enum(p,w={}){if(i.IsUndefined(p))return this.Throw("Enum undefined or empty");let A=Object.getOwnPropertyNames(p).filter(j=>isNaN(j)).map(j=>p[j]),P=[...new Set(A)].map(j=>e.Type.Literal(j));return this.Union(P,{...w,[e.Hint]:"Enum"})}Extends(p,w,A,P,j={}){switch(f.Extends(p,w)){case l.Union:return this.Union([d.Type(A,j),d.Type(P,j)]);case l.True:return d.Type(A,j);case l.False:return d.Type(P,j)}}Exclude(p,w,A={}){return a.TTemplateLiteral(p)?this.Exclude(D.Resolve(p),w,A):a.TTemplateLiteral(w)?this.Exclude(p,D.Resolve(w),A):a.TUnion(p)?(()=>{let P=p.anyOf.filter(j=>f.Extends(j,w)===l.False);return P.length===1?d.Type(P[0],A):this.Union(P,A)})():f.Extends(p,w)!==l.False?this.Never(A):d.Type(p,A)}Extract(p,w,A={}){return a.TTemplateLiteral(p)?this.Extract(D.Resolve(p),w,A):a.TTemplateLiteral(w)?this.Extract(p,D.Resolve(w),A):a.TUnion(p)?(()=>{let P=p.anyOf.filter(j=>f.Extends(j,w)!==l.False);return P.length===1?d.Type(P[0],A):this.Union(P,A)})():f.Extends(p,w)!==l.False?d.Type(p,A):this.Never(A)}Index(p,w,A={}){return a.TArray(p)&&a.TNumber(w)?d.Type(p.items,A):a.TTuple(p)&&a.TNumber(w)?(()=>{let P=(i.IsUndefined(p.items)?[]:p.items).map(j=>d.Type(j));return this.Union(P,A)})():(()=>{let P=B.Resolve(w),j=d.Type(p);return I.Resolve(j,P,A)})()}Integer(p={}){return this.Create({...p,[e.Kind]:"Integer",type:"integer"})}Intersect(p,w={}){if(p.length===0)return e.Type.Never();if(p.length===1)return d.Type(p[0],w);p.some(N=>a.TTransform(N))&&this.Throw("Cannot intersect transform types");let A=p.every(N=>a.TObject(N)),P=d.Rest(p),j=a.TSchema(w.unevaluatedProperties)?{unevaluatedProperties:d.Type(w.unevaluatedProperties)}:{};return w.unevaluatedProperties===!1||a.TSchema(w.unevaluatedProperties)||A?this.Create({...w,...j,[e.Kind]:"Intersect",type:"object",allOf:P}):this.Create({...w,...j,[e.Kind]:"Intersect",allOf:P})}KeyOf(p,w={}){return a.TRecord(p)?(()=>{let A=Object.getOwnPropertyNames(p.patternProperties)[0];return A===e.PatternNumberExact?this.Number(w):A===e.PatternStringExact?this.String(w):this.Throw("Unable to resolve key type from Record key pattern")})():a.TTuple(p)?(()=>{let A=(i.IsUndefined(p.items)?[]:p.items).map((P,j)=>e.Type.Literal(j.toString()));return this.Union(A,w)})():a.TArray(p)?this.Number(w):(()=>{let A=L.ResolveKeys(p,{includePatterns:!1});if(A.length===0)return this.Never(w);let P=A.map(j=>this.Literal(j));return this.Union(P,w)})()}Literal(p,w={}){return this.Create({...w,[e.Kind]:"Literal",const:p,type:typeof p})}Lowercase(p,w={}){return{...E.Map(d.Type(p),"Lowercase"),...w}}Never(p={}){return this.Create({...p,[e.Kind]:"Never",not:{}})}Not(p,w){return this.Create({...w,[e.Kind]:"Not",not:d.Type(p)})}Null(p={}){return this.Create({...p,[e.Kind]:"Null",type:"null"})}Number(p={}){return this.Create({...p,[e.Kind]:"Number",type:"number"})}Object(p,w={}){let A=Object.getOwnPropertyNames(p),P=A.filter(O=>a.TOptional(p[O])),j=A.filter(O=>!P.includes(O)),N=a.TSchema(w.additionalProperties)?{additionalProperties:d.Type(w.additionalProperties)}:{},g=A.reduce((O,T)=>({...O,[T]:d.Type(p[T])}),{});return j.length>0?this.Create({...w,...N,[e.Kind]:"Object",type:"object",properties:g,required:j}):this.Create({...w,...N,[e.Kind]:"Object",type:"object",properties:g})}Omit(p,w,A={}){let P=B.Resolve(w);return _.Map(this.Discard(d.Type(p),["$id",e.Transform]),j=>{i.IsArray(j.required)&&(j.required=j.required.filter(N=>!P.includes(N)),j.required.length===0&&delete j.required);for(let N of Object.getOwnPropertyNames(j.properties))P.includes(N)&&delete j.properties[N];return this.Create(j)},A)}Partial(p,w={}){return _.Map(this.Discard(d.Type(p),["$id",e.Transform]),A=>{let P=Object.getOwnPropertyNames(A.properties).reduce((j,N)=>({...j,[N]:this.Optional(A.properties[N])}),{});return this.Object(P,this.Discard(A,["required"]))},w)}Pick(p,w,A={}){let P=B.Resolve(w);return _.Map(this.Discard(d.Type(p),["$id",e.Transform]),j=>{i.IsArray(j.required)&&(j.required=j.required.filter(N=>P.includes(N)),j.required.length===0&&delete j.required);for(let N of Object.getOwnPropertyNames(j.properties))P.includes(N)||delete j.properties[N];return this.Create(j)},A)}Record(p,w,A={}){return a.TTemplateLiteral(p)?(()=>{let P=K.ParseExact(p.pattern);return $.Check(P)?this.Object([...z.Generate(P)].reduce((j,N)=>({...j,[N]:d.Type(w)}),{}),A):this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[p.pattern]:d.Type(w)}})})():a.TUnion(p)?(()=>{let P=k.Resolve(p);if(a.TUnionLiteral(P)){let j=P.anyOf.reduce((N,g)=>({...N,[g.const]:d.Type(w)}),{});return this.Object(j,{...A,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():a.TLiteral(p)?i.IsString(p.const)||i.IsNumber(p.const)?this.Object({[p.const]:d.Type(w)},A):this.Throw("Record key of type literal is not of type string or number"):a.TInteger(p)||a.TNumber(p)?this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:d.Type(w)}}):a.TString(p)?(()=>{let P=i.IsUndefined(p.pattern)?e.PatternStringExact:p.pattern;return this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[P]:d.Type(w)}})})():this.Never()}Recursive(p,w={}){i.IsUndefined(w.$id)&&(w.$id=`T${fe++}`);let A=p({[e.Kind]:"This",$ref:`${w.$id}`});return A.$id=w.$id,this.Create({...w,[e.Hint]:"Recursive",...A})}Ref(p,w={}){return i.IsString(p)?this.Create({...w,[e.Kind]:"Ref",$ref:p}):(i.IsUndefined(p.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({...w,[e.Kind]:"Ref",$ref:p.$id}))}Required(p,w={}){return _.Map(this.Discard(d.Type(p),["$id",e.Transform]),A=>{let P=Object.getOwnPropertyNames(A.properties).reduce((j,N)=>({...j,[N]:this.Discard(A.properties[N],[e.Optional])}),{});return this.Object(P,A)},w)}Rest(p){return a.TTuple(p)&&!i.IsUndefined(p.items)?d.Rest(p.items):a.TIntersect(p)?d.Rest(p.allOf):a.TUnion(p)?d.Rest(p.anyOf):[]}String(p={}){return this.Create({...p,[e.Kind]:"String",type:"string"})}TemplateLiteral(p,w={}){let A=i.IsString(p)?q.Create(ne.Parse(p)):q.Create(p);return this.Create({...w,[e.Kind]:"TemplateLiteral",type:"string",pattern:A})}Transform(p){return new ue(p)}Tuple(p,w={}){let[A,P,j]=[!1,p.length,p.length],N=d.Rest(p),g=p.length>0?{...w,[e.Kind]:"Tuple",type:"array",items:N,additionalItems:A,minItems:P,maxItems:j}:{...w,[e.Kind]:"Tuple",type:"array",minItems:P,maxItems:j};return this.Create(g)}Uncapitalize(p,w={}){return{...E.Map(d.Type(p),"Uncapitalize"),...w}}Union(p,w={}){return a.TTemplateLiteral(p)?D.Resolve(p):(()=>{let A=p;if(A.length===0)return this.Never(w);if(A.length===1)return this.Create(d.Type(A[0],w));let P=d.Rest(A);return this.Create({...w,[e.Kind]:"Union",anyOf:P})})()}Unknown(p={}){return this.Create({...p,[e.Kind]:"Unknown"})}Unsafe(p={}){return this.Create({...p,[e.Kind]:p[e.Kind]||"Unsafe"})}Uppercase(p,w={}){return{...E.Map(d.Type(p),"Uppercase"),...w}}};e.JsonTypeBuilder=ee;var be=class extends ee{AsyncIterator(p,w={}){return this.Create({...w,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:d.Type(p)})}Awaited(p,w={}){let A=P=>P.length>0?(()=>{let[j,...N]=P;return[this.Awaited(j),...A(N)]})():P;return a.TIntersect(p)?e.Type.Intersect(A(p.allOf)):a.TUnion(p)?e.Type.Union(A(p.anyOf)):a.TPromise(p)?this.Awaited(p.item):d.Type(p,w)}BigInt(p={}){return this.Create({...p,[e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(p,w={}){return this.Tuple([...p.parameters],{...w})}Constructor(p,w,A){let[P,j]=[d.Rest(p),d.Type(w)];return this.Create({...A,[e.Kind]:"Constructor",type:"Constructor",parameters:P,returns:j})}Date(p={}){return this.Create({...p,[e.Kind]:"Date",type:"Date"})}Function(p,w,A){let[P,j]=[d.Rest(p),d.Type(w)];return this.Create({...A,[e.Kind]:"Function",type:"Function",parameters:P,returns:j})}InstanceType(p,w={}){return d.Type(p.returns,w)}Iterator(p,w={}){return this.Create({...w,[e.Kind]:"Iterator",type:"Iterator",items:d.Type(p)})}Parameters(p,w={}){return this.Tuple(p.parameters,{...w})}Promise(p,w={}){return this.Create({...w,[e.Kind]:"Promise",type:"Promise",item:d.Type(p)})}RegExp(p,w={}){let A=i.IsString(p)?p:p.source;return this.Create({...w,[e.Kind]:"String",type:"string",pattern:A})}RegEx(p,w={}){return this.RegExp(p,w)}ReturnType(p,w={}){return d.Type(p.returns,w)}Symbol(p){return this.Create({...p,[e.Kind]:"Symbol",type:"symbol"})}Undefined(p={}){return this.Create({...p,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(p={}){return this.Create({...p,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(p={}){return this.Create({...p,[e.Kind]:"Void",type:"void"})}};e.JavaScriptTypeBuilder=be,e.JsonType=new ee,e.Type=new be}}),xi=Nr(sn(),1),{String:qw,Optional:Gw,Boolean:Ww,Object:Hw,Number:Jw}=xi.Type,Xw=qw.bind(xi.Type),Qw=Jw.bind(xi.Type),zN=Hw.bind(xi.Type),KN=Gw.bind(xi.Type),Zw=Ww.bind(xi.Type),qN=Xw(),GN=Qw(),WN=Zw();function Ca(e){return Array.isArray(e)?e:[e]}var Yw=it({"../../../node_modules/.pnpm/browser-or-node@2.1.1/node_modules/browser-or-node/lib/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},r=typeof window<"u"&&typeof window.document<"u",n=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,i=(typeof self>"u"?"undefined":t(self))==="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope",o=typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),a=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u";e.isBrowser=r,e.isWebWorker=i,e.isNode=n,e.isJsDom=o,e.isDeno=a}}),e2=it({"../../../node_modules/.pnpm/fast-json-stable-stringify@2.1.0/node_modules/fast-json-stable-stringify/index.js"(e,t){"use strict";t.exports=function(r,n){n||(n={}),typeof n=="function"&&(n={cmp:n});var i=typeof n.cycles=="boolean"?n.cycles:!1,o=n.cmp&&function(s){return function(u){return function(l,f){var d={key:l,value:u[l]},I={key:f,value:u[f]};return s(d,I)}}}(n.cmp),a=[];return function s(u){if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u!==void 0){if(typeof u=="number")return isFinite(u)?""+u:"null";if(typeof u!="object")return JSON.stringify(u);var l,f;if(Array.isArray(u)){for(f="[",l=0;l<u.length;l++)l&&(f+=","),f+=s(u[l])||"null";return f+"]"}if(u===null)return"null";if(a.indexOf(u)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var d=a.push(u)-1,I=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<I.length;l++){var E=I[l],_=s(u[E]);_&&(f&&(f+=","),f+=JSON.stringify(E)+":"+_)}return a.splice(d,1),"{"+f+"}"}}(r)}}}),t2=it({"../../../node_modules/.pnpm/safe-stable-stringify@2.5.0/node_modules/safe-stable-stringify/index.js"(e,t){"use strict";var{hasOwnProperty:r}=Object.prototype,n=B();n.configure=B,n.stringify=n,n.default=n,e.stringify=n,e.configure=B,t.exports=n;var i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function o(k){return k.length<5e3&&!i.test(k)?`"${k}"`:JSON.stringify(k)}function a(k,F){if(k.length>200||F)return k.sort(F);for(let q=1;q<k.length;q++){let D=k[q],Q=q;for(;Q!==0&&k[Q-1]>D;)k[Q]=k[Q-1],Q--;k[Q]=D}return k}var s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function u(k){return s.call(k)!==void 0&&k.length!==0}function l(k,F,q){k.length<q&&(q=k.length);let D=F===","?"":" ",Q=`"0":${D}${k[0]}`;for(let K=1;K<q;K++)Q+=`${F}"${K}":${D}${k[K]}`;return Q}function f(k){if(r.call(k,"circularValue")){let F=k.circularValue;if(typeof F=="string")return`"${F}"`;if(F==null)return F;if(F===Error||F===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function d(k){let F;if(r.call(k,"deterministic")&&(F=k.deterministic,typeof F!="boolean"&&typeof F!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return F===void 0?!0:F}function I(k,F){let q;if(r.call(k,F)&&(q=k[F],typeof q!="boolean"))throw new TypeError(`The "${F}" argument must be of type boolean`);return q===void 0?!0:q}function E(k,F){let q;if(r.call(k,F)){if(q=k[F],typeof q!="number")throw new TypeError(`The "${F}" argument must be of type number`);if(!Number.isInteger(q))throw new TypeError(`The "${F}" argument must be an integer`);if(q<1)throw new RangeError(`The "${F}" argument must be >= 1`)}return q===void 0?1/0:q}function _(k){return k===1?"1 item":`${k} items`}function L(k){let F=new Set;for(let q of k)(typeof q=="string"||typeof q=="number")&&F.add(String(q));return F}function J(k){if(r.call(k,"strict")){let F=k.strict;if(typeof F!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(F)return q=>{let D=`Object can not safely be stringified. Received type ${typeof q}`;throw typeof q!="function"&&(D+=` (${q.toString()})`),new Error(D)}}}function B(k){k={...k};let F=J(k);F&&(k.bigint===void 0&&(k.bigint=!1),"circularValue"in k||(k.circularValue=Error));let q=f(k),D=I(k,"bigint"),Q=d(k),K=typeof Q=="function"?Q:void 0,re=E(k,"maximumDepth"),$=E(k,"maximumBreadth");function R(fe,V,X,ee,be,p){let w=V[fe];switch(typeof w=="object"&&w!==null&&typeof w.toJSON=="function"&&(w=w.toJSON(fe)),w=ee.call(V,fe,w),typeof w){case"string":return o(w);case"object":{if(w===null)return"null";if(X.indexOf(w)!==-1)return q;let A="",P=",",j=p;if(Array.isArray(w)){if(w.length===0)return"[]";if(re<X.length+1)return'"[Array]"';X.push(w),be!==""&&(p+=be,A+=`
|
|
31
|
+
${p}`,P=`,
|
|
32
|
+
${p}`);let x=Math.min(w.length,$),v=0;for(;v<x-1;v++){let U=R(String(v),w,X,ee,be,p);A+=U!==void 0?U:"null",A+=P}let b=R(String(v),w,X,ee,be,p);if(A+=b!==void 0?b:"null",w.length-1>$){let U=w.length-$-1;A+=`${P}"... ${_(U)} not stringified"`}return be!==""&&(A+=`
|
|
33
|
+
${j}`),X.pop(),`[${A}]`}let N=Object.keys(w),g=N.length;if(g===0)return"{}";if(re<X.length+1)return'"[Object]"';let O="",T="";be!==""&&(p+=be,P=`,
|
|
34
|
+
${p}`,O=" ");let c=Math.min(g,$);Q&&!u(w)&&(N=a(N,K)),X.push(w);for(let x=0;x<c;x++){let v=N[x],b=R(v,w,X,ee,be,p);b!==void 0&&(A+=`${T}${o(v)}:${O}${b}`,T=P)}if(g>$){let x=g-$;A+=`${T}"...":${O}"${_(x)} not stringified"`,T=P}return be!==""&&T.length>1&&(A=`
|
|
35
|
+
${p}${A}
|
|
36
|
+
${j}`),X.pop(),`{${A}}`}case"number":return isFinite(w)?String(w):F?F(w):"null";case"boolean":return w===!0?"true":"false";case"undefined":return;case"bigint":if(D)return String(w);default:return F?F(w):void 0}}function z(fe,V,X,ee,be,p){switch(typeof V=="object"&&V!==null&&typeof V.toJSON=="function"&&(V=V.toJSON(fe)),typeof V){case"string":return o(V);case"object":{if(V===null)return"null";if(X.indexOf(V)!==-1)return q;let w=p,A="",P=",";if(Array.isArray(V)){if(V.length===0)return"[]";if(re<X.length+1)return'"[Array]"';X.push(V),be!==""&&(p+=be,A+=`
|
|
37
|
+
${p}`,P=`,
|
|
38
|
+
${p}`);let g=Math.min(V.length,$),O=0;for(;O<g-1;O++){let c=z(String(O),V[O],X,ee,be,p);A+=c!==void 0?c:"null",A+=P}let T=z(String(O),V[O],X,ee,be,p);if(A+=T!==void 0?T:"null",V.length-1>$){let c=V.length-$-1;A+=`${P}"... ${_(c)} not stringified"`}return be!==""&&(A+=`
|
|
39
|
+
${w}`),X.pop(),`[${A}]`}X.push(V);let j="";be!==""&&(p+=be,P=`,
|
|
40
|
+
${p}`,j=" ");let N="";for(let g of ee){let O=z(g,V[g],X,ee,be,p);O!==void 0&&(A+=`${N}${o(g)}:${j}${O}`,N=P)}return be!==""&&N.length>1&&(A=`
|
|
41
|
+
${p}${A}
|
|
42
|
+
${w}`),X.pop(),`{${A}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(D)return String(V);default:return F?F(V):void 0}}function ne(fe,V,X,ee,be){switch(typeof V){case"string":return o(V);case"object":{if(V===null)return"null";if(typeof V.toJSON=="function"){if(V=V.toJSON(fe),typeof V!="object")return ne(fe,V,X,ee,be);if(V===null)return"null"}if(X.indexOf(V)!==-1)return q;let p=be;if(Array.isArray(V)){if(V.length===0)return"[]";if(re<X.length+1)return'"[Array]"';X.push(V),be+=ee;let O=`
|
|
43
|
+
${be}`,T=`,
|
|
44
|
+
${be}`,c=Math.min(V.length,$),x=0;for(;x<c-1;x++){let b=ne(String(x),V[x],X,ee,be);O+=b!==void 0?b:"null",O+=T}let v=ne(String(x),V[x],X,ee,be);if(O+=v!==void 0?v:"null",V.length-1>$){let b=V.length-$-1;O+=`${T}"... ${_(b)} not stringified"`}return O+=`
|
|
45
|
+
${p}`,X.pop(),`[${O}]`}let w=Object.keys(V),A=w.length;if(A===0)return"{}";if(re<X.length+1)return'"[Object]"';be+=ee;let P=`,
|
|
46
|
+
${be}`,j="",N="",g=Math.min(A,$);u(V)&&(j+=l(V,P,$),w=w.slice(V.length),g-=V.length,N=P),Q&&(w=a(w,K)),X.push(V);for(let O=0;O<g;O++){let T=w[O],c=ne(T,V[T],X,ee,be);c!==void 0&&(j+=`${N}${o(T)}: ${c}`,N=P)}if(A>$){let O=A-$;j+=`${N}"...": "${_(O)} not stringified"`,N=P}return N!==""&&(j=`
|
|
47
|
+
${be}${j}
|
|
48
|
+
${p}`),X.pop(),`{${j}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(D)return String(V);default:return F?F(V):void 0}}function ue(fe,V,X){switch(typeof V){case"string":return o(V);case"object":{if(V===null)return"null";if(typeof V.toJSON=="function"){if(V=V.toJSON(fe),typeof V!="object")return ue(fe,V,X);if(V===null)return"null"}if(X.indexOf(V)!==-1)return q;let ee="",be=V.length!==void 0;if(be&&Array.isArray(V)){if(V.length===0)return"[]";if(re<X.length+1)return'"[Array]"';X.push(V);let j=Math.min(V.length,$),N=0;for(;N<j-1;N++){let O=ue(String(N),V[N],X);ee+=O!==void 0?O:"null",ee+=","}let g=ue(String(N),V[N],X);if(ee+=g!==void 0?g:"null",V.length-1>$){let O=V.length-$-1;ee+=`,"... ${_(O)} not stringified"`}return X.pop(),`[${ee}]`}let p=Object.keys(V),w=p.length;if(w===0)return"{}";if(re<X.length+1)return'"[Object]"';let A="",P=Math.min(w,$);be&&u(V)&&(ee+=l(V,",",$),p=p.slice(V.length),P-=V.length,A=","),Q&&(p=a(p,K)),X.push(V);for(let j=0;j<P;j++){let N=p[j],g=ue(N,V[N],X);g!==void 0&&(ee+=`${A}${o(N)}:${g}`,A=",")}if(w>$){let j=w-$;ee+=`${A}"...":"${_(j)} not stringified"`}return X.pop(),`{${ee}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(D)return String(V);default:return F?F(V):void 0}}function te(fe,V,X){if(arguments.length>1){let ee="";if(typeof X=="number"?ee=" ".repeat(Math.min(X,10)):typeof X=="string"&&(ee=X.slice(0,10)),V!=null){if(typeof V=="function")return R("",{"":fe},[],V,ee,"");if(Array.isArray(V))return z("",fe,[],L(V),ee,"")}if(ee.length!==0)return ne("",fe,[],ee,"")}return ue("",fe,[])}return te}}}),Oi=it({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/guard.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IsValueType=e.IsSymbol=e.IsFunction=e.IsString=e.IsBigInt=e.IsInteger=e.IsNumber=e.IsBoolean=e.IsNull=e.IsUndefined=e.IsArray=e.IsObject=e.IsPlainObject=e.HasPropertyKey=e.IsDate=e.IsUint8Array=e.IsPromise=e.IsTypedArray=e.IsIterator=e.IsAsyncIterator=void 0;function t(D){return l(D)&&Symbol.asyncIterator in D}e.IsAsyncIterator=t;function r(D){return l(D)&&Symbol.iterator in D}e.IsIterator=r;function n(D){return ArrayBuffer.isView(D)}e.IsTypedArray=n;function i(D){return D instanceof Promise}e.IsPromise=i;function o(D){return D instanceof Uint8Array}e.IsUint8Array=o;function a(D){return D instanceof Date&&Number.isFinite(D.getTime())}e.IsDate=a;function s(D,Q){return Q in D}e.HasPropertyKey=s;function u(D){return l(D)&&k(D.constructor)&&D.constructor.name==="Object"}e.IsPlainObject=u;function l(D){return D!==null&&typeof D=="object"}e.IsObject=l;function f(D){return Array.isArray(D)&&!ArrayBuffer.isView(D)}e.IsArray=f;function d(D){return D===void 0}e.IsUndefined=d;function I(D){return D===null}e.IsNull=I;function E(D){return typeof D=="boolean"}e.IsBoolean=E;function _(D){return typeof D=="number"}e.IsNumber=_;function L(D){return _(D)&&Number.isInteger(D)}e.IsInteger=L;function J(D){return typeof D=="bigint"}e.IsBigInt=J;function B(D){return typeof D=="string"}e.IsString=B;function k(D){return typeof D=="function"}e.IsFunction=k;function F(D){return typeof D=="symbol"}e.IsSymbol=F;function q(D){return J(D)||E(D)||I(D)||_(D)||B(D)||F(D)||d(D)}e.IsValueType=q}}),nh=it({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/system/system.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultErrorFunction=e.TypeSystemPolicy=e.TypeSystemErrorFunction=e.TypeSystem=e.TypeSystemDuplicateFormat=e.TypeSystemDuplicateTypeKind=void 0;var t=Oi(),r=vs(),n=sn(),i=class extends n.TypeBoxError{constructor(f){super(`Duplicate type kind '${f}' detected`)}};e.TypeSystemDuplicateTypeKind=i;var o=class extends n.TypeBoxError{constructor(f){super(`Duplicate string format '${f}' detected`)}};e.TypeSystemDuplicateFormat=o;var a;(function(f){function d(E,_){if(n.TypeRegistry.Has(E))throw new i(E);return n.TypeRegistry.Set(E,_),(L={})=>n.Type.Unsafe({...L,[n.Kind]:E})}f.Type=d;function I(E,_){if(n.FormatRegistry.Has(E))throw new o(E);return n.FormatRegistry.Set(E,_),E}f.Format=I})(a||(e.TypeSystem=a={}));var s;(function(f){let d=l;function I(){d=l}f.Reset=I;function E(L){d=L}f.Set=E;function _(){return d}f.Get=_})(s||(e.TypeSystemErrorFunction=s={}));var u;(function(f){f.ExactOptionalPropertyTypes=!1,f.AllowArrayObject=!1,f.AllowNaN=!1,f.AllowNullVoid=!1;function d(J,B){return f.ExactOptionalPropertyTypes?B in J:J[B]!==void 0}f.IsExactOptionalProperty=d;function I(J){let B=(0,t.IsObject)(J);return f.AllowArrayObject?B:B&&!(0,t.IsArray)(J)}f.IsObjectLike=I;function E(J){return I(J)&&!(J instanceof Date)&&!(J instanceof Uint8Array)}f.IsRecordLike=E;function _(J){let B=(0,t.IsNumber)(J);return f.AllowNaN?B:B&&Number.isFinite(J)}f.IsNumberLike=_;function L(J){let B=(0,t.IsUndefined)(J);return f.AllowNullVoid?B||J===null:B}f.IsVoidLike=L})(u||(e.TypeSystemPolicy=u={}));function l(f,d){switch(d){case r.ValueErrorType.ArrayContains:return"Expected array to contain at least one matching value";case r.ValueErrorType.ArrayMaxContains:return`Expected array to contain no more than ${f.maxContains} matching values`;case r.ValueErrorType.ArrayMinContains:return`Expected array to contain at least ${f.minContains} matching values`;case r.ValueErrorType.ArrayMaxItems:return`Expected array length to be less or equal to ${f.maxItems}`;case r.ValueErrorType.ArrayMinItems:return`Expected array length to be greater or equal to ${f.minItems}`;case r.ValueErrorType.ArrayUniqueItems:return"Expected array elements to be unique";case r.ValueErrorType.Array:return"Expected array";case r.ValueErrorType.AsyncIterator:return"Expected AsyncIterator";case r.ValueErrorType.BigIntExclusiveMaximum:return`Expected bigint to be less than ${f.exclusiveMaximum}`;case r.ValueErrorType.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.BigIntMaximum:return`Expected bigint to be less or equal to ${f.maximum}`;case r.ValueErrorType.BigIntMinimum:return`Expected bigint to be greater or equal to ${f.minimum}`;case r.ValueErrorType.BigIntMultipleOf:return`Expected bigint to be a multiple of ${f.multipleOf}`;case r.ValueErrorType.BigInt:return"Expected bigint";case r.ValueErrorType.Boolean:return"Expected boolean";case r.ValueErrorType.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${f.exclusiveMinimumTimestamp}`;case r.ValueErrorType.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${f.exclusiveMaximumTimestamp}`;case r.ValueErrorType.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${f.minimumTimestamp}`;case r.ValueErrorType.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${f.maximumTimestamp}`;case r.ValueErrorType.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${f.multipleOfTimestamp}`;case r.ValueErrorType.Date:return"Expected Date";case r.ValueErrorType.Function:return"Expected function";case r.ValueErrorType.IntegerExclusiveMaximum:return`Expected integer to be less than ${f.exclusiveMaximum}`;case r.ValueErrorType.IntegerExclusiveMinimum:return`Expected integer to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.IntegerMaximum:return`Expected integer to be less or equal to ${f.maximum}`;case r.ValueErrorType.IntegerMinimum:return`Expected integer to be greater or equal to ${f.minimum}`;case r.ValueErrorType.IntegerMultipleOf:return`Expected integer to be a multiple of ${f.multipleOf}`;case r.ValueErrorType.Integer:return"Expected integer";case r.ValueErrorType.IntersectUnevaluatedProperties:return"Unexpected property";case r.ValueErrorType.Intersect:return"Expected all values to match";case r.ValueErrorType.Iterator:return"Expected Iterator";case r.ValueErrorType.Literal:return`Expected ${typeof f.const=="string"?`'${f.const}'`:f.const}`;case r.ValueErrorType.Never:return"Never";case r.ValueErrorType.Not:return"Value should not match";case r.ValueErrorType.Null:return"Expected null";case r.ValueErrorType.NumberExclusiveMaximum:return`Expected number to be less than ${f.exclusiveMaximum}`;case r.ValueErrorType.NumberExclusiveMinimum:return`Expected number to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.NumberMaximum:return`Expected number to be less or equal to ${f.maximum}`;case r.ValueErrorType.NumberMinimum:return`Expected number to be greater or equal to ${f.minimum}`;case r.ValueErrorType.NumberMultipleOf:return`Expected number to be a multiple of ${f.multipleOf}`;case r.ValueErrorType.Number:return"Expected number";case r.ValueErrorType.Object:return"Expected object";case r.ValueErrorType.ObjectAdditionalProperties:return"Unexpected property";case r.ValueErrorType.ObjectMaxProperties:return`Expected object to have no more than ${f.maxProperties} properties`;case r.ValueErrorType.ObjectMinProperties:return`Expected object to have at least ${f.minProperties} properties`;case r.ValueErrorType.ObjectRequiredProperty:return"Required property";case r.ValueErrorType.Promise:return"Expected Promise";case r.ValueErrorType.StringFormatUnknown:return`Unknown format '${f.format}'`;case r.ValueErrorType.StringFormat:return`Expected string to match '${f.format}' format`;case r.ValueErrorType.StringMaxLength:return`Expected string length less or equal to ${f.maxLength}`;case r.ValueErrorType.StringMinLength:return`Expected string length greater or equal to ${f.minLength}`;case r.ValueErrorType.StringPattern:return`Expected string to match '${f.pattern}'`;case r.ValueErrorType.String:return"Expected string";case r.ValueErrorType.Symbol:return"Expected symbol";case r.ValueErrorType.TupleLength:return`Expected tuple to have ${f.maxItems||0} elements`;case r.ValueErrorType.Tuple:return"Expected tuple";case r.ValueErrorType.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${f.maxByteLength}`;case r.ValueErrorType.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${f.minByteLength}`;case r.ValueErrorType.Uint8Array:return"Expected Uint8Array";case r.ValueErrorType.Undefined:return"Expected undefined";case r.ValueErrorType.Union:return"Expected union value";case r.ValueErrorType.Void:return"Expected void";case r.ValueErrorType.Kind:return`Expected kind '${f[n.Kind]}'`;default:return"Unknown error type"}}e.DefaultErrorFunction=l}}),bs=it({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/deref.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Deref=e.TypeDereferenceError=void 0;var t=sn(),r=class extends t.TypeBoxError{constructor(i){super(`Unable to dereference schema with $id '${i.$id}'`),this.schema=i}};e.TypeDereferenceError=r;function n(i,o){let a=o.findIndex(s=>s.$id===i.$ref);if(a===-1)throw new r(i);return o[a]}e.Deref=n}}),kl=it({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/hash.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.ByteMarker=e.ValueHashError=void 0;var t=Oi(),r=class extends Error{constructor(R){super("Unable to hash value"),this.value=R}};e.ValueHashError=r;var n;(function(R){R[R.Undefined=0]="Undefined",R[R.Null=1]="Null",R[R.Boolean=2]="Boolean",R[R.Number=3]="Number",R[R.String=4]="String",R[R.Object=5]="Object",R[R.Array=6]="Array",R[R.Date=7]="Date",R[R.Uint8Array=8]="Uint8Array",R[R.Symbol=9]="Symbol",R[R.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((R,z)=>BigInt(z)),u=new Float64Array(1),l=new DataView(u.buffer),f=new Uint8Array(u.buffer);function*d(R){let z=R===0?1:Math.ceil(Math.floor(Math.log2(R)+1)/8);for(let ne=0;ne<z;ne++)yield R>>8*(z-1-ne)&255}function I(R){re(n.Array);for(let z of R)K(z)}function E(R){re(n.Boolean),re(R?1:0)}function _(R){re(n.BigInt),l.setBigInt64(0,R);for(let z of f)re(z)}function L(R){re(n.Date),K(R.getTime())}function J(R){re(n.Null)}function B(R){re(n.Number),l.setFloat64(0,R);for(let z of f)re(z)}function k(R){re(n.Object);for(let z of globalThis.Object.keys(R).sort())K(z),K(R[z])}function F(R){re(n.String);for(let z=0;z<R.length;z++)for(let ne of d(R.charCodeAt(z)))re(ne)}function q(R){re(n.Symbol),K(R.description)}function D(R){re(n.Uint8Array);for(let z=0;z<R.length;z++)re(R[z])}function Q(R){return re(n.Undefined)}function K(R){if((0,t.IsArray)(R))return I(R);if((0,t.IsBoolean)(R))return E(R);if((0,t.IsBigInt)(R))return _(R);if((0,t.IsDate)(R))return L(R);if((0,t.IsNull)(R))return J(R);if((0,t.IsNumber)(R))return B(R);if((0,t.IsPlainObject)(R))return k(R);if((0,t.IsString)(R))return F(R);if((0,t.IsSymbol)(R))return q(R);if((0,t.IsUint8Array)(R))return D(R);if((0,t.IsUndefined)(R))return Q(R);throw new r(R)}function re(R){i=i^s[R],i=i*o%a}function $(R){return i=BigInt("14695981039346656037"),K(R),i}e.Hash=$}}),vs=it({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/errors/errors.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Errors=e.ValueErrorIterator=e.EscapeKey=e.ValueErrorsUnknownTypeError=e.ValueErrorType=void 0;var t=Oi(),r=nh(),n=bs(),i=kl(),o=sn(),a;(function(c){c[c.ArrayContains=0]="ArrayContains",c[c.ArrayMaxContains=1]="ArrayMaxContains",c[c.ArrayMaxItems=2]="ArrayMaxItems",c[c.ArrayMinContains=3]="ArrayMinContains",c[c.ArrayMinItems=4]="ArrayMinItems",c[c.ArrayUniqueItems=5]="ArrayUniqueItems",c[c.Array=6]="Array",c[c.AsyncIterator=7]="AsyncIterator",c[c.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",c[c.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",c[c.BigIntMaximum=10]="BigIntMaximum",c[c.BigIntMinimum=11]="BigIntMinimum",c[c.BigIntMultipleOf=12]="BigIntMultipleOf",c[c.BigInt=13]="BigInt",c[c.Boolean=14]="Boolean",c[c.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",c[c.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",c[c.DateMaximumTimestamp=17]="DateMaximumTimestamp",c[c.DateMinimumTimestamp=18]="DateMinimumTimestamp",c[c.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",c[c.Date=20]="Date",c[c.Function=21]="Function",c[c.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",c[c.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",c[c.IntegerMaximum=24]="IntegerMaximum",c[c.IntegerMinimum=25]="IntegerMinimum",c[c.IntegerMultipleOf=26]="IntegerMultipleOf",c[c.Integer=27]="Integer",c[c.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",c[c.Intersect=29]="Intersect",c[c.Iterator=30]="Iterator",c[c.Kind=31]="Kind",c[c.Literal=32]="Literal",c[c.Never=33]="Never",c[c.Not=34]="Not",c[c.Null=35]="Null",c[c.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",c[c.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",c[c.NumberMaximum=38]="NumberMaximum",c[c.NumberMinimum=39]="NumberMinimum",c[c.NumberMultipleOf=40]="NumberMultipleOf",c[c.Number=41]="Number",c[c.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",c[c.ObjectMaxProperties=43]="ObjectMaxProperties",c[c.ObjectMinProperties=44]="ObjectMinProperties",c[c.ObjectRequiredProperty=45]="ObjectRequiredProperty",c[c.Object=46]="Object",c[c.Promise=47]="Promise",c[c.StringFormatUnknown=48]="StringFormatUnknown",c[c.StringFormat=49]="StringFormat",c[c.StringMaxLength=50]="StringMaxLength",c[c.StringMinLength=51]="StringMinLength",c[c.StringPattern=52]="StringPattern",c[c.String=53]="String",c[c.Symbol=54]="Symbol",c[c.TupleLength=55]="TupleLength",c[c.Tuple=56]="Tuple",c[c.Uint8ArrayMaxByteLength=57]="Uint8ArrayMaxByteLength",c[c.Uint8ArrayMinByteLength=58]="Uint8ArrayMinByteLength",c[c.Uint8Array=59]="Uint8Array",c[c.Undefined=60]="Undefined",c[c.Union=61]="Union",c[c.Void=62]="Void"})(a||(e.ValueErrorType=a={}));var s=class extends o.TypeBoxError{constructor(c){super("Unknown type"),this.schema=c}};e.ValueErrorsUnknownTypeError=s;function u(c){return c.replace(/~/g,"~0").replace(/\//g,"~1")}e.EscapeKey=u;function l(c){return c!==void 0}var f=class{constructor(c){this.iterator=c}[Symbol.iterator](){return this.iterator}First(){let c=this.iterator.next();return c.done?void 0:c.value}};e.ValueErrorIterator=f;function d(c,x,v,b){return{type:c,schema:x,path:v,value:b,message:r.TypeSystemErrorFunction.Get()(x,c)}}function*I(c,x,v,b){}function*E(c,x,v,b){if(!(0,t.IsArray)(b))return yield d(a.Array,c,v,b);l(c.minItems)&&!(b.length>=c.minItems)&&(yield d(a.ArrayMinItems,c,v,b)),l(c.maxItems)&&!(b.length<=c.maxItems)&&(yield d(a.ArrayMaxItems,c,v,b));for(let ie=0;ie<b.length;ie++)yield*O(c.items,x,`${v}/${ie}`,b[ie]);if(c.uniqueItems===!0&&!function(){let ie=new Set;for(let oe of b){let _e=(0,i.Hash)(oe);if(ie.has(_e))return!1;ie.add(_e)}return!0}()&&(yield d(a.ArrayUniqueItems,c,v,b)),!(l(c.contains)||l(c.minContains)||l(c.maxContains)))return;let U=l(c.contains)?c.contains:o.Type.Never(),H=b.reduce((ie,oe,_e)=>O(U,x,`${v}${_e}`,oe).next().done===!0?ie+1:ie,0);H===0&&(yield d(a.ArrayContains,c,v,b)),(0,t.IsNumber)(c.minContains)&&H<c.minContains&&(yield d(a.ArrayMinContains,c,v,b)),(0,t.IsNumber)(c.maxContains)&&H>c.maxContains&&(yield d(a.ArrayMaxContains,c,v,b))}function*_(c,x,v,b){(0,t.IsAsyncIterator)(b)||(yield d(a.AsyncIterator,c,v,b))}function*L(c,x,v,b){if(!(0,t.IsBigInt)(b))return yield d(a.BigInt,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.BigIntExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.BigIntExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.BigIntMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.BigIntMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==BigInt(0)&&(yield d(a.BigIntMultipleOf,c,v,b))}function*J(c,x,v,b){(0,t.IsBoolean)(b)||(yield d(a.Boolean,c,v,b))}function*B(c,x,v,b){yield*O(c.returns,x,v,b.prototype)}function*k(c,x,v,b){if(!(0,t.IsDate)(b))return yield d(a.Date,c,v,b);l(c.exclusiveMaximumTimestamp)&&!(b.getTime()<c.exclusiveMaximumTimestamp)&&(yield d(a.DateExclusiveMaximumTimestamp,c,v,b)),l(c.exclusiveMinimumTimestamp)&&!(b.getTime()>c.exclusiveMinimumTimestamp)&&(yield d(a.DateExclusiveMinimumTimestamp,c,v,b)),l(c.maximumTimestamp)&&!(b.getTime()<=c.maximumTimestamp)&&(yield d(a.DateMaximumTimestamp,c,v,b)),l(c.minimumTimestamp)&&!(b.getTime()>=c.minimumTimestamp)&&(yield d(a.DateMinimumTimestamp,c,v,b)),l(c.multipleOfTimestamp)&&b.getTime()%c.multipleOfTimestamp!==0&&(yield d(a.DateMultipleOfTimestamp,c,v,b))}function*F(c,x,v,b){(0,t.IsFunction)(b)||(yield d(a.Function,c,v,b))}function*q(c,x,v,b){if(!(0,t.IsInteger)(b))return yield d(a.Integer,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.IntegerExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.IntegerExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.IntegerMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.IntegerMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==0&&(yield d(a.IntegerMultipleOf,c,v,b))}function*D(c,x,v,b){for(let U of c.allOf){let H=O(U,x,v,b).next();H.done||(yield d(a.Intersect,c,v,b),yield H.value)}if(c.unevaluatedProperties===!1){let U=new RegExp(o.KeyResolver.ResolvePattern(c));for(let H of Object.getOwnPropertyNames(b))U.test(H)||(yield d(a.IntersectUnevaluatedProperties,c,`${v}/${H}`,b))}if(typeof c.unevaluatedProperties=="object"){let U=new RegExp(o.KeyResolver.ResolvePattern(c));for(let H of Object.getOwnPropertyNames(b))if(!U.test(H)){let ie=O(c.unevaluatedProperties,x,`${v}/${H}`,b[H]).next();ie.done||(yield ie.value)}}}function*Q(c,x,v,b){(0,t.IsIterator)(b)||(yield d(a.Iterator,c,v,b))}function*K(c,x,v,b){b!==c.const&&(yield d(a.Literal,c,v,b))}function*re(c,x,v,b){yield d(a.Never,c,v,b)}function*$(c,x,v,b){O(c.not,x,v,b).next().done===!0&&(yield d(a.Not,c,v,b))}function*R(c,x,v,b){(0,t.IsNull)(b)||(yield d(a.Null,c,v,b))}function*z(c,x,v,b){if(!r.TypeSystemPolicy.IsNumberLike(b))return yield d(a.Number,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.NumberExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.NumberExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.NumberMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.NumberMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==0&&(yield d(a.NumberMultipleOf,c,v,b))}function*ne(c,x,v,b){if(!r.TypeSystemPolicy.IsObjectLike(b))return yield d(a.Object,c,v,b);l(c.minProperties)&&!(Object.getOwnPropertyNames(b).length>=c.minProperties)&&(yield d(a.ObjectMinProperties,c,v,b)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=c.maxProperties)&&(yield d(a.ObjectMaxProperties,c,v,b));let U=Array.isArray(c.required)?c.required:[],H=Object.getOwnPropertyNames(c.properties),ie=Object.getOwnPropertyNames(b);for(let oe of U)ie.includes(oe)||(yield d(a.ObjectRequiredProperty,c.properties[oe],`${v}/${u(oe)}`,void 0));if(c.additionalProperties===!1)for(let oe of ie)H.includes(oe)||(yield d(a.ObjectAdditionalProperties,c,`${v}/${u(oe)}`,b[oe]));if(typeof c.additionalProperties=="object")for(let oe of ie)H.includes(oe)||(yield*O(c.additionalProperties,x,`${v}/${u(oe)}`,b[oe]));for(let oe of H){let _e=c.properties[oe];c.required&&c.required.includes(oe)?(yield*O(_e,x,`${v}/${u(oe)}`,b[oe]),o.ExtendsUndefined.Check(c)&&!(oe in b)&&(yield d(a.ObjectRequiredProperty,_e,`${v}/${u(oe)}`,void 0))):r.TypeSystemPolicy.IsExactOptionalProperty(b,oe)&&(yield*O(_e,x,`${v}/${u(oe)}`,b[oe]))}}function*ue(c,x,v,b){(0,t.IsPromise)(b)||(yield d(a.Promise,c,v,b))}function*te(c,x,v,b){if(!r.TypeSystemPolicy.IsRecordLike(b))return yield d(a.Object,c,v,b);l(c.minProperties)&&!(Object.getOwnPropertyNames(b).length>=c.minProperties)&&(yield d(a.ObjectMinProperties,c,v,b)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=c.maxProperties)&&(yield d(a.ObjectMaxProperties,c,v,b));let[U,H]=Object.entries(c.patternProperties)[0],ie=new RegExp(U);for(let[oe,_e]of Object.entries(b))ie.test(oe)&&(yield*O(H,x,`${v}/${u(oe)}`,_e));if(typeof c.additionalProperties=="object")for(let[oe,_e]of Object.entries(b))ie.test(oe)||(yield*O(c.additionalProperties,x,`${v}/${u(oe)}`,_e));if(c.additionalProperties===!1){for(let[oe,_e]of Object.entries(b))if(!ie.test(oe))return yield d(a.ObjectAdditionalProperties,c,`${v}/${u(oe)}`,_e)}}function*fe(c,x,v,b){yield*O((0,n.Deref)(c,x),x,v,b)}function*V(c,x,v,b){if(!(0,t.IsString)(b))return yield d(a.String,c,v,b);l(c.minLength)&&!(b.length>=c.minLength)&&(yield d(a.StringMinLength,c,v,b)),l(c.maxLength)&&!(b.length<=c.maxLength)&&(yield d(a.StringMaxLength,c,v,b)),(0,t.IsString)(c.pattern)&&(new RegExp(c.pattern).test(b)||(yield d(a.StringPattern,c,v,b))),(0,t.IsString)(c.format)&&(o.FormatRegistry.Has(c.format)?o.FormatRegistry.Get(c.format)(b)||(yield d(a.StringFormat,c,v,b)):yield d(a.StringFormatUnknown,c,v,b))}function*X(c,x,v,b){(0,t.IsSymbol)(b)||(yield d(a.Symbol,c,v,b))}function*ee(c,x,v,b){if(!(0,t.IsString)(b))return yield d(a.String,c,v,b);new RegExp(c.pattern).test(b)||(yield d(a.StringPattern,c,v,b))}function*be(c,x,v,b){yield*O((0,n.Deref)(c,x),x,v,b)}function*p(c,x,v,b){if(!(0,t.IsArray)(b))return yield d(a.Tuple,c,v,b);if(c.items===void 0&&b.length!==0)return yield d(a.TupleLength,c,v,b);if(b.length!==c.maxItems)return yield d(a.TupleLength,c,v,b);if(c.items)for(let U=0;U<c.items.length;U++)yield*O(c.items[U],x,`${v}/${U}`,b[U])}function*w(c,x,v,b){(0,t.IsUndefined)(b)||(yield d(a.Undefined,c,v,b))}function*A(c,x,v,b){let U=0;for(let H of c.anyOf){let ie=[...O(H,x,v,b)];if(ie.length===0)return;U+=ie.length}U>0&&(yield d(a.Union,c,v,b))}function*P(c,x,v,b){if(!(0,t.IsUint8Array)(b))return yield d(a.Uint8Array,c,v,b);l(c.maxByteLength)&&!(b.length<=c.maxByteLength)&&(yield d(a.Uint8ArrayMaxByteLength,c,v,b)),l(c.minByteLength)&&!(b.length>=c.minByteLength)&&(yield d(a.Uint8ArrayMinByteLength,c,v,b))}function*j(c,x,v,b){}function*N(c,x,v,b){r.TypeSystemPolicy.IsVoidLike(b)||(yield d(a.Void,c,v,b))}function*g(c,x,v,b){o.TypeRegistry.Get(c[o.Kind])(c,b)||(yield d(a.Kind,c,v,b))}function*O(c,x,v,b){let U=l(c.$id)?[...x,c]:x,H=c;switch(H[o.Kind]){case"Any":return yield*I(H,U,v,b);case"Array":return yield*E(H,U,v,b);case"AsyncIterator":return yield*_(H,U,v,b);case"BigInt":return yield*L(H,U,v,b);case"Boolean":return yield*J(H,U,v,b);case"Constructor":return yield*B(H,U,v,b);case"Date":return yield*k(H,U,v,b);case"Function":return yield*F(H,U,v,b);case"Integer":return yield*q(H,U,v,b);case"Intersect":return yield*D(H,U,v,b);case"Iterator":return yield*Q(H,U,v,b);case"Literal":return yield*K(H,U,v,b);case"Never":return yield*re(H,U,v,b);case"Not":return yield*$(H,U,v,b);case"Null":return yield*R(H,U,v,b);case"Number":return yield*z(H,U,v,b);case"Object":return yield*ne(H,U,v,b);case"Promise":return yield*ue(H,U,v,b);case"Record":return yield*te(H,U,v,b);case"Ref":return yield*fe(H,U,v,b);case"String":return yield*V(H,U,v,b);case"Symbol":return yield*X(H,U,v,b);case"TemplateLiteral":return yield*ee(H,U,v,b);case"This":return yield*be(H,U,v,b);case"Tuple":return yield*p(H,U,v,b);case"Undefined":return yield*w(H,U,v,b);case"Union":return yield*A(H,U,v,b);case"Uint8Array":return yield*P(H,U,v,b);case"Unknown":return yield*j(H,U,v,b);case"Void":return yield*N(H,U,v,b);default:if(!o.TypeRegistry.Has(H[o.Kind]))throw new s(c);return yield*g(H,U,v,b)}}function T(...c){let x=c.length===3?O(c[0],c[1],"",c[2]):O(c[0],[],"",c[1]);return new f(x)}e.Errors=T}}),r2=it({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/errors/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(n,i,o,a){a===void 0&&(a=o);var s=Object.getOwnPropertyDescriptor(i,o);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(n,a,s)}:function(n,i,o,a){a===void 0&&(a=o),n[a]=i[o]}),r=e&&e.__exportStar||function(n,i){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,n,o)};Object.defineProperty(e,"__esModule",{value:!0}),r(vs(),e)}}),ih=it({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/system/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(i,o,a,s){s===void 0&&(s=a);var u=Object.getOwnPropertyDescriptor(o,a);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(i,s,u)}:function(i,o,a,s){s===void 0&&(s=a),i[s]=o[a]}),r=e&&e.__exportStar||function(i,o){for(var a in i)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorType=void 0;var n=vs();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(nh(),e)}}),n2=it({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/check.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Check=e.ValueCheckUnknownTypeError=void 0;var t=Oi(),r=ih(),n=bs(),i=kl(),o=sn(),a=class extends o.TypeBoxError{constructor(g){super("Unknown type"),this.schema=g}};e.ValueCheckUnknownTypeError=a;function s(g){return g[o.Kind]==="Any"||g[o.Kind]==="Unknown"}function u(g){return g!==void 0}function l(g,O,T){return!0}function f(g,O,T){if(!(0,t.IsArray)(T)||u(g.minItems)&&!(T.length>=g.minItems)||u(g.maxItems)&&!(T.length<=g.maxItems)||!T.every(v=>j(g.items,O,v))||g.uniqueItems===!0&&!function(){let v=new Set;for(let b of T){let U=(0,i.Hash)(b);if(v.has(U))return!1;v.add(U)}return!0}())return!1;if(!(u(g.contains)||(0,t.IsNumber)(g.minContains)||(0,t.IsNumber)(g.maxContains)))return!0;let c=u(g.contains)?g.contains:o.Type.Never(),x=T.reduce((v,b)=>j(c,O,b)?v+1:v,0);return!(x===0||(0,t.IsNumber)(g.minContains)&&x<g.minContains||(0,t.IsNumber)(g.maxContains)&&x>g.maxContains)}function d(g,O,T){return(0,t.IsAsyncIterator)(T)}function I(g,O,T){return!(!(0,t.IsBigInt)(T)||u(g.exclusiveMaximum)&&!(T<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(T>g.exclusiveMinimum)||u(g.maximum)&&!(T<=g.maximum)||u(g.minimum)&&!(T>=g.minimum)||u(g.multipleOf)&&T%g.multipleOf!==BigInt(0))}function E(g,O,T){return(0,t.IsBoolean)(T)}function _(g,O,T){return j(g.returns,O,T.prototype)}function L(g,O,T){return!(!(0,t.IsDate)(T)||u(g.exclusiveMaximumTimestamp)&&!(T.getTime()<g.exclusiveMaximumTimestamp)||u(g.exclusiveMinimumTimestamp)&&!(T.getTime()>g.exclusiveMinimumTimestamp)||u(g.maximumTimestamp)&&!(T.getTime()<=g.maximumTimestamp)||u(g.minimumTimestamp)&&!(T.getTime()>=g.minimumTimestamp)||u(g.multipleOfTimestamp)&&T.getTime()%g.multipleOfTimestamp!==0)}function J(g,O,T){return(0,t.IsFunction)(T)}function B(g,O,T){return!(!(0,t.IsInteger)(T)||u(g.exclusiveMaximum)&&!(T<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(T>g.exclusiveMinimum)||u(g.maximum)&&!(T<=g.maximum)||u(g.minimum)&&!(T>=g.minimum)||u(g.multipleOf)&&T%g.multipleOf!==0)}function k(g,O,T){let c=g.allOf.every(x=>j(x,O,T));if(g.unevaluatedProperties===!1){let x=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(T).every(b=>x.test(b));return c&&v}else if(o.TypeGuard.TSchema(g.unevaluatedProperties)){let x=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(T).every(b=>x.test(b)||j(g.unevaluatedProperties,O,T[b]));return c&&v}else return c}function F(g,O,T){return(0,t.IsIterator)(T)}function q(g,O,T){return T===g.const}function D(g,O,T){return!1}function Q(g,O,T){return!j(g.not,O,T)}function K(g,O,T){return(0,t.IsNull)(T)}function re(g,O,T){return!(!r.TypeSystemPolicy.IsNumberLike(T)||u(g.exclusiveMaximum)&&!(T<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(T>g.exclusiveMinimum)||u(g.minimum)&&!(T>=g.minimum)||u(g.maximum)&&!(T<=g.maximum)||u(g.multipleOf)&&T%g.multipleOf!==0)}function $(g,O,T){if(!r.TypeSystemPolicy.IsObjectLike(T)||u(g.minProperties)&&!(Object.getOwnPropertyNames(T).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(T).length<=g.maxProperties))return!1;let c=Object.getOwnPropertyNames(g.properties);for(let x of c){let v=g.properties[x];if(g.required&&g.required.includes(x)){if(!j(v,O,T[x])||(o.ExtendsUndefined.Check(v)||s(v))&&!(x in T))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(T,x)&&!j(v,O,T[x]))return!1}if(g.additionalProperties===!1){let x=Object.getOwnPropertyNames(T);return g.required&&g.required.length===c.length&&x.length===c.length?!0:x.every(v=>c.includes(v))}else return typeof g.additionalProperties=="object"?Object.getOwnPropertyNames(T).every(x=>c.includes(x)||j(g.additionalProperties,O,T[x])):!0}function R(g,O,T){return(0,t.IsPromise)(T)}function z(g,O,T){if(!r.TypeSystemPolicy.IsRecordLike(T)||u(g.minProperties)&&!(Object.getOwnPropertyNames(T).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(T).length<=g.maxProperties))return!1;let[c,x]=Object.entries(g.patternProperties)[0],v=new RegExp(c),b=Object.entries(T).every(([ie,oe])=>v.test(ie)?j(x,O,oe):!0),U=typeof g.additionalProperties=="object"?Object.entries(T).every(([ie,oe])=>v.test(ie)?!0:j(g.additionalProperties,O,oe)):!0,H=g.additionalProperties===!1?Object.getOwnPropertyNames(T).every(ie=>v.test(ie)):!0;return b&&U&&H}function ne(g,O,T){return j((0,n.Deref)(g,O),O,T)}function ue(g,O,T){return!(0,t.IsString)(T)||u(g.minLength)&&!(T.length>=g.minLength)||u(g.maxLength)&&!(T.length<=g.maxLength)||u(g.pattern)&&!new RegExp(g.pattern).test(T)?!1:u(g.format)?o.FormatRegistry.Has(g.format)?o.FormatRegistry.Get(g.format)(T):!1:!0}function te(g,O,T){return(0,t.IsSymbol)(T)}function fe(g,O,T){return(0,t.IsString)(T)&&new RegExp(g.pattern).test(T)}function V(g,O,T){return j((0,n.Deref)(g,O),O,T)}function X(g,O,T){if(!(0,t.IsArray)(T)||g.items===void 0&&T.length!==0||T.length!==g.maxItems)return!1;if(!g.items)return!0;for(let c=0;c<g.items.length;c++)if(!j(g.items[c],O,T[c]))return!1;return!0}function ee(g,O,T){return(0,t.IsUndefined)(T)}function be(g,O,T){return g.anyOf.some(c=>j(c,O,T))}function p(g,O,T){return!(!(0,t.IsUint8Array)(T)||u(g.maxByteLength)&&!(T.length<=g.maxByteLength)||u(g.minByteLength)&&!(T.length>=g.minByteLength))}function w(g,O,T){return!0}function A(g,O,T){return r.TypeSystemPolicy.IsVoidLike(T)}function P(g,O,T){return o.TypeRegistry.Has(g[o.Kind])?o.TypeRegistry.Get(g[o.Kind])(g,T):!1}function j(g,O,T){let c=u(g.$id)?[...O,g]:O,x=g;switch(x[o.Kind]){case"Any":return l(x,c,T);case"Array":return f(x,c,T);case"AsyncIterator":return d(x,c,T);case"BigInt":return I(x,c,T);case"Boolean":return E(x,c,T);case"Constructor":return _(x,c,T);case"Date":return L(x,c,T);case"Function":return J(x,c,T);case"Integer":return B(x,c,T);case"Intersect":return k(x,c,T);case"Iterator":return F(x,c,T);case"Literal":return q(x,c,T);case"Never":return D(x,c,T);case"Not":return Q(x,c,T);case"Null":return K(x,c,T);case"Number":return re(x,c,T);case"Object":return $(x,c,T);case"Promise":return R(x,c,T);case"Record":return z(x,c,T);case"Ref":return ne(x,c,T);case"String":return ue(x,c,T);case"Symbol":return te(x,c,T);case"TemplateLiteral":return fe(x,c,T);case"This":return V(x,c,T);case"Tuple":return X(x,c,T);case"Undefined":return ee(x,c,T);case"Union":return be(x,c,T);case"Uint8Array":return p(x,c,T);case"Unknown":return w(x,c,T);case"Void":return A(x,c,T);default:if(!o.TypeRegistry.Has(x[o.Kind]))throw new a(x);return P(x,c,T)}}function N(...g){return g.length===3?j(g[0],g[1],g[2]):j(g[0],[],g[1])}e.Check=N}}),i2=it({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/transform.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EncodeTransform=e.DecodeTransform=e.HasTransform=e.TransformEncodeError=e.TransformDecodeError=e.TransformEncodeCheckError=e.TransformDecodeCheckError=void 0;var t=Oi(),r=bs(),n=n2(),i=sn(),o=class extends i.TypeBoxError{constructor(I,E,_){super("Unable to decode due to invalid value"),this.schema=I,this.value=E,this.error=_}};e.TransformDecodeCheckError=o;var a=class extends i.TypeBoxError{constructor(I,E,_){super("Unable to encode due to invalid value"),this.schema=I,this.value=E,this.error=_}};e.TransformEncodeCheckError=a;var s=class extends i.TypeBoxError{constructor(I,E,_){super(`${_ instanceof Error?_.message:"Unknown error"}`),this.schema=I,this.value=E}};e.TransformDecodeError=s;var u=class extends i.TypeBoxError{constructor(I,E,_){super(`${_ instanceof Error?_.message:"Unknown error"}`),this.schema=I,this.value=E}};e.TransformEncodeError=u;var l;(function(I){function E(te,fe){return i.TypeGuard.TTransform(te)||z(te.items,fe)}function _(te,fe){return i.TypeGuard.TTransform(te)||z(te.items,fe)}function L(te,fe){return i.TypeGuard.TTransform(te)||z(te.returns,fe)||te.parameters.some(V=>z(V,fe))}function J(te,fe){return i.TypeGuard.TTransform(te)||z(te.returns,fe)||te.parameters.some(V=>z(V,fe))}function B(te,fe){return i.TypeGuard.TTransform(te)||i.TypeGuard.TTransform(te.unevaluatedProperties)||te.allOf.some(V=>z(V,fe))}function k(te,fe){return i.TypeGuard.TTransform(te)||z(te.items,fe)}function F(te,fe){return i.TypeGuard.TTransform(te)||z(te.not,fe)}function q(te,fe){return i.TypeGuard.TTransform(te)||Object.values(te.properties).some(V=>z(V,fe))||i.TypeGuard.TSchema(te.additionalProperties)&&z(te.additionalProperties,fe)}function D(te,fe){return i.TypeGuard.TTransform(te)||z(te.item,fe)}function Q(te,fe){let V=Object.getOwnPropertyNames(te.patternProperties)[0],X=te.patternProperties[V];return i.TypeGuard.TTransform(te)||z(X,fe)||i.TypeGuard.TSchema(te.additionalProperties)&&i.TypeGuard.TTransform(te.additionalProperties)}function K(te,fe){return i.TypeGuard.TTransform(te)?!0:z((0,r.Deref)(te,fe),fe)}function re(te,fe){return i.TypeGuard.TTransform(te)?!0:z((0,r.Deref)(te,fe),fe)}function $(te,fe){return i.TypeGuard.TTransform(te)||!(0,t.IsUndefined)(te.items)&&te.items.some(V=>z(V,fe))}function R(te,fe){return i.TypeGuard.TTransform(te)||te.anyOf.some(V=>z(V,fe))}function z(te,fe){let V=(0,t.IsString)(te.$id)?[...fe,te]:fe,X=te;if(te.$id&&ne.has(te.$id))return!1;switch(te.$id&&ne.add(te.$id),te[i.Kind]){case"Array":return E(X,V);case"AsyncIterator":return _(X,V);case"Constructor":return L(X,V);case"Function":return J(X,V);case"Intersect":return B(X,V);case"Iterator":return k(X,V);case"Not":return F(X,V);case"Object":return q(X,V);case"Promise":return D(X,V);case"Record":return Q(X,V);case"Ref":return K(X,V);case"This":return re(X,V);case"Tuple":return $(X,V);case"Union":return R(X,V);default:return i.TypeGuard.TTransform(te)}}let ne=new Set;function ue(te,fe){return ne.clear(),z(te,fe)}I.Has=ue})(l||(e.HasTransform=l={}));var f;(function(I){function E($,R){try{return i.TypeGuard.TTransform($)?$[i.Transform].Decode(R):R}catch(z){throw new s($,R,z)}}function _($,R,z){return(0,t.IsArray)(z)?E($,z.map(ne=>K($.items,R,ne))):E($,z)}function L($,R,z){if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return E($,z);let ne=i.KeyResolver.ResolveKeys($,{includePatterns:!1}),ue=ne.reduce((X,ee)=>ee in X?{...X,[ee]:K(i.IndexedAccessor.Resolve($,[ee]),R,X[ee])}:X,z);if(!i.TypeGuard.TTransform($.unevaluatedProperties))return E($,ue);let te=Object.getOwnPropertyNames(ue),fe=$.unevaluatedProperties,V=te.reduce((X,ee)=>ne.includes(ee)?X:{...X,[ee]:E(fe,X[ee])},ue);return E($,V)}function J($,R,z){return E($,K($.not,R,z))}function B($,R,z){if(!(0,t.IsPlainObject)(z))return E($,z);let ne=i.KeyResolver.ResolveKeys($,{includePatterns:!1}),ue=ne.reduce((X,ee)=>ee in X?{...X,[ee]:K($.properties[ee],R,X[ee])}:X,z);if(!i.TypeGuard.TSchema($.additionalProperties))return E($,ue);let te=Object.getOwnPropertyNames(ue),fe=$.additionalProperties,V=te.reduce((X,ee)=>ne.includes(ee)?X:{...X,[ee]:E(fe,X[ee])},ue);return E($,V)}function k($,R,z){if(!(0,t.IsPlainObject)(z))return E($,z);let ne=Object.getOwnPropertyNames($.patternProperties)[0],ue=new RegExp(ne),te=Object.getOwnPropertyNames(z).reduce((ee,be)=>ue.test(be)?{...ee,[be]:K($.patternProperties[ne],R,ee[be])}:ee,z);if(!i.TypeGuard.TSchema($.additionalProperties))return E($,te);let fe=Object.getOwnPropertyNames(te),V=$.additionalProperties,X=fe.reduce((ee,be)=>ue.test(be)?ee:{...ee,[be]:E(V,ee[be])},te);return E($,X)}function F($,R,z){let ne=(0,r.Deref)($,R);return E($,K(ne,R,z))}function q($,R,z){let ne=(0,r.Deref)($,R);return E($,K(ne,R,z))}function D($,R,z){return(0,t.IsArray)(z)&&(0,t.IsArray)($.items)?E($,$.items.map((ne,ue)=>K(ne,R,z[ue]))):E($,z)}function Q($,R,z){let ne=E($,z);for(let ue of $.anyOf)if((0,n.Check)(ue,R,ne))return K(ue,R,ne);return ne}function K($,R,z){let ne=typeof $.$id=="string"?[...R,$]:R,ue=$;switch($[i.Kind]){case"Array":return _(ue,ne,z);case"Intersect":return L(ue,ne,z);case"Not":return J(ue,ne,z);case"Object":return B(ue,ne,z);case"Record":return k(ue,ne,z);case"Ref":return F(ue,ne,z);case"Symbol":return E(ue,z);case"This":return q(ue,ne,z);case"Tuple":return D(ue,ne,z);case"Union":return Q(ue,ne,z);default:return E(ue,z)}}function re($,R,z){return K($,R,z)}I.Decode=re})(f||(e.DecodeTransform=f={}));var d;(function(I){function E($,R){try{return i.TypeGuard.TTransform($)?$[i.Transform].Encode(R):R}catch(z){throw new u($,R,z)}}function _($,R,z){let ne=E($,z);return(0,t.IsArray)(ne)?ne.map(ue=>K($.items,R,ue)):ne}function L($,R,z){let ne=E($,z);if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return ne;let ue=i.KeyResolver.ResolveKeys($,{includePatterns:!1}),te=ue.reduce((X,ee)=>ee in ne?{...X,[ee]:K(i.IndexedAccessor.Resolve($,[ee]),R,X[ee])}:X,ne);if(!i.TypeGuard.TTransform($.unevaluatedProperties))return E($,te);let fe=Object.getOwnPropertyNames(te),V=$.unevaluatedProperties;return fe.reduce((X,ee)=>ue.includes(ee)?X:{...X,[ee]:E(V,X[ee])},te)}function J($,R,z){return E($.not,E($,z))}function B($,R,z){let ne=E($,z);if(!(0,t.IsPlainObject)(z))return ne;let ue=i.KeyResolver.ResolveKeys($,{includePatterns:!1}),te=ue.reduce((X,ee)=>ee in X?{...X,[ee]:K($.properties[ee],R,X[ee])}:X,ne);if(!i.TypeGuard.TSchema($.additionalProperties))return te;let fe=Object.getOwnPropertyNames(te),V=$.additionalProperties;return fe.reduce((X,ee)=>ue.includes(ee)?X:{...X,[ee]:E(V,X[ee])},te)}function k($,R,z){let ne=E($,z);if(!(0,t.IsPlainObject)(z))return ne;let ue=Object.getOwnPropertyNames($.patternProperties)[0],te=new RegExp(ue),fe=Object.getOwnPropertyNames(z).reduce((ee,be)=>te.test(be)?{...ee,[be]:K($.patternProperties[ue],R,ee[be])}:ee,ne);if(!i.TypeGuard.TSchema($.additionalProperties))return E($,fe);let V=Object.getOwnPropertyNames(fe),X=$.additionalProperties;return V.reduce((ee,be)=>te.test(be)?ee:{...ee,[be]:E(X,ee[be])},fe)}function F($,R,z){let ne=(0,r.Deref)($,R),ue=K(ne,R,z);return E($,ue)}function q($,R,z){let ne=(0,r.Deref)($,R),ue=K(ne,R,z);return E($,ue)}function D($,R,z){let ne=E($,z);return(0,t.IsArray)($.items)?$.items.map((ue,te)=>K(ue,R,ne[te])):[]}function Q($,R,z){for(let ne of $.anyOf){if(!(0,n.Check)(ne,R,z))continue;let ue=K(ne,R,z);return E($,ue)}for(let ne of $.anyOf){let ue=K(ne,R,z);if((0,n.Check)($,R,ue))return E($,ue)}return E($,z)}function K($,R,z){let ne=typeof $.$id=="string"?[...R,$]:R,ue=$;switch($[i.Kind]){case"Array":return _(ue,ne,z);case"Intersect":return L(ue,ne,z);case"Not":return J(ue,ne,z);case"Object":return B(ue,ne,z);case"Record":return k(ue,ne,z);case"Ref":return F(ue,ne,z);case"This":return q(ue,ne,z);case"Tuple":return D(ue,ne,z);case"Union":return Q(ue,ne,z);default:return E(ue,z)}}function re($,R,z){return K($,R,z)}I.Encode=re})(d||(e.EncodeTransform=d={}))}}),o2=it({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/compiler/compiler.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeCompiler=e.Policy=e.TypeCompilerTypeGuardError=e.TypeCompilerUnknownTypeError=e.TypeCheck=void 0;var t=i2(),r=Oi(),n=vs(),i=ih(),o=bs(),a=kl(),s=sn(),u=class{constructor(B,k,F,q){this.schema=B,this.references=k,this.checkFunc=F,this.code=q,this.hasTransform=t.HasTransform.Has(B,k)}Code(){return this.code}Errors(B){return(0,n.Errors)(this.schema,this.references,B)}Check(B){return this.checkFunc(B)}Decode(B){if(!this.checkFunc(B))throw new t.TransformDecodeCheckError(this.schema,B,this.Errors(B).First());return this.hasTransform?t.DecodeTransform.Decode(this.schema,this.references,B):B}Encode(B){let k=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,B):B;if(!this.checkFunc(k))throw new t.TransformEncodeCheckError(this.schema,B,this.Errors(B).First());return k}};e.TypeCheck=u;var l;(function(B){function k(Q){return Q===36}B.DollarSign=k;function F(Q){return Q===95}B.IsUnderscore=F;function q(Q){return Q>=65&&Q<=90||Q>=97&&Q<=122}B.IsAlpha=q;function D(Q){return Q>=48&&Q<=57}B.IsNumeric=D})(l||(l={}));var f;(function(B){function k(Q){return Q.length===0?!1:l.IsNumeric(Q.charCodeAt(0))}function F(Q){if(k(Q))return!1;for(let K=0;K<Q.length;K++){let re=Q.charCodeAt(K);if(!(l.IsAlpha(re)||l.IsNumeric(re)||l.DollarSign(re)||l.IsUnderscore(re)))return!1}return!0}function q(Q){return Q.replace(/'/g,"\\'")}function D(Q,K){return F(K)?`${Q}.${K}`:`${Q}['${q(K)}']`}B.Encode=D})(f||(f={}));var d;(function(B){function k(F){let q=[];for(let D=0;D<F.length;D++){let Q=F.charCodeAt(D);l.IsNumeric(Q)||l.IsAlpha(Q)?q.push(F.charAt(D)):q.push(`_${Q}_`)}return q.join("").replace(/__/g,"_")}B.Encode=k})(d||(d={}));var I;(function(B){function k(F){return F.replace(/'/g,"\\'")}B.Escape=k})(I||(I={}));var E=class extends s.TypeBoxError{constructor(B){super("Unknown type"),this.schema=B}};e.TypeCompilerUnknownTypeError=E;var _=class extends s.TypeBoxError{constructor(B){super("Preflight validation check failed to guard for the given schema"),this.schema=B}};e.TypeCompilerTypeGuardError=_;var L;(function(B){function k(K,re,$){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${re}' in ${K} ? ${$} : true)`:`(${f.Encode(K,re)} !== undefined ? ${$} : true)`}B.IsExactOptionalProperty=k;function F(K){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${K} === 'object' && ${K} !== null)`:`(typeof ${K} === 'object' && ${K} !== null && !Array.isArray(${K}))`}B.IsObjectLike=F;function q(K){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${K} === 'object' && ${K} !== null && !(${K} instanceof Date) && !(${K} instanceof Uint8Array))`:`(typeof ${K} === 'object' && ${K} !== null && !Array.isArray(${K}) && !(${K} instanceof Date) && !(${K} instanceof Uint8Array))`}B.IsRecordLike=q;function D(K){return i.TypeSystemPolicy.AllowNaN?`typeof ${K} === 'number'`:`(typeof ${K} === 'number' && Number.isFinite(${K}))`}B.IsNumberLike=D;function Q(K){return i.TypeSystemPolicy.AllowNullVoid?`(${K} === undefined || ${K} === null)`:`${K} === undefined`}B.IsVoidLike=Q})(L||(e.Policy=L={}));var J;(function(B){function k(S){return S[s.Kind]==="Any"||S[s.Kind]==="Unknown"}function*F(S,ye,C){yield"true"}function*q(S,ye,C){yield`Array.isArray(${C})`;let[xe,se]=[He("value","any"),He("acc","number")];(0,r.IsNumber)(S.maxItems)&&(yield`${C}.length <= ${S.maxItems}`),(0,r.IsNumber)(S.minItems)&&(yield`${C}.length >= ${S.minItems}`);let ge=oe(S.items,ye,"value");if(yield`${C}.every((${xe}) => ${ge})`,s.TypeGuard.TSchema(S.contains)||(0,r.IsNumber)(S.minContains)||(0,r.IsNumber)(S.maxContains)){let De=s.TypeGuard.TSchema(S.contains)?S.contains:s.Type.Never(),Je=oe(De,ye,"value"),mt=(0,r.IsNumber)(S.minContains)?[`(count >= ${S.minContains})`]:[],dt=(0,r.IsNumber)(S.maxContains)?[`(count <= ${S.maxContains})`]:[],vt=`const count = value.reduce((${se}, ${xe}) => ${Je} ? acc + 1 : acc, 0)`,Dr=["(count > 0)",...mt,...dt].join(" && ");yield`((${xe}) => { ${vt}; return ${Dr}})(${C})`}S.uniqueItems===!0&&(yield`((${xe}) => { const set = new Set(); for(const element of value) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true } )(${C})`)}function*D(S,ye,C){yield`(typeof value === 'object' && Symbol.asyncIterator in ${C})`}function*Q(S,ye,C){yield`(typeof ${C} === 'bigint')`,(0,r.IsBigInt)(S.exclusiveMaximum)&&(yield`${C} < BigInt(${S.exclusiveMaximum})`),(0,r.IsBigInt)(S.exclusiveMinimum)&&(yield`${C} > BigInt(${S.exclusiveMinimum})`),(0,r.IsBigInt)(S.maximum)&&(yield`${C} <= BigInt(${S.maximum})`),(0,r.IsBigInt)(S.minimum)&&(yield`${C} >= BigInt(${S.minimum})`),(0,r.IsBigInt)(S.multipleOf)&&(yield`(${C} % BigInt(${S.multipleOf})) === 0`)}function*K(S,ye,C){yield`(typeof ${C} === 'boolean')`}function*re(S,ye,C){yield*H(S.returns,ye,`${C}.prototype`)}function*$(S,ye,C){yield`(${C} instanceof Date) && Number.isFinite(${C}.getTime())`,(0,r.IsNumber)(S.exclusiveMaximumTimestamp)&&(yield`${C}.getTime() < ${S.exclusiveMaximumTimestamp}`),(0,r.IsNumber)(S.exclusiveMinimumTimestamp)&&(yield`${C}.getTime() > ${S.exclusiveMinimumTimestamp}`),(0,r.IsNumber)(S.maximumTimestamp)&&(yield`${C}.getTime() <= ${S.maximumTimestamp}`),(0,r.IsNumber)(S.minimumTimestamp)&&(yield`${C}.getTime() >= ${S.minimumTimestamp}`),(0,r.IsNumber)(S.multipleOfTimestamp)&&(yield`(${C}.getTime() % ${S.multipleOfTimestamp}) === 0`)}function*R(S,ye,C){yield`(typeof ${C} === 'function')`}function*z(S,ye,C){yield`(typeof ${C} === 'number' && Number.isInteger(${C}))`,(0,r.IsNumber)(S.exclusiveMaximum)&&(yield`${C} < ${S.exclusiveMaximum}`),(0,r.IsNumber)(S.exclusiveMinimum)&&(yield`${C} > ${S.exclusiveMinimum}`),(0,r.IsNumber)(S.maximum)&&(yield`${C} <= ${S.maximum}`),(0,r.IsNumber)(S.minimum)&&(yield`${C} >= ${S.minimum}`),(0,r.IsNumber)(S.multipleOf)&&(yield`(${C} % ${S.multipleOf}) === 0`)}function*ne(S,ye,C){let xe=S.allOf.map(se=>oe(se,ye,C)).join(" && ");if(S.unevaluatedProperties===!1){let se=Se(`${new RegExp(s.KeyResolver.ResolvePattern(S))};`),ge=`Object.getOwnPropertyNames(${C}).every(key => ${se}.test(key))`;yield`(${xe} && ${ge})`}else if(s.TypeGuard.TSchema(S.unevaluatedProperties)){let se=Se(`${new RegExp(s.KeyResolver.ResolvePattern(S))};`),ge=`Object.getOwnPropertyNames(${C}).every(key => ${se}.test(key) || ${oe(S.unevaluatedProperties,ye,`${C}[key]`)})`;yield`(${xe} && ${ge})`}else yield`(${xe})`}function*ue(S,ye,C){yield`(typeof value === 'object' && Symbol.iterator in ${C})`}function*te(S,ye,C){typeof S.const=="number"||typeof S.const=="boolean"?yield`(${C} === ${S.const})`:yield`(${C} === '${I.Escape(S.const)}')`}function*fe(S,ye,C){yield"false"}function*V(S,ye,C){yield`(!${oe(S.not,ye,C)})`}function*X(S,ye,C){yield`(${C} === null)`}function*ee(S,ye,C){yield L.IsNumberLike(C),(0,r.IsNumber)(S.exclusiveMaximum)&&(yield`${C} < ${S.exclusiveMaximum}`),(0,r.IsNumber)(S.exclusiveMinimum)&&(yield`${C} > ${S.exclusiveMinimum}`),(0,r.IsNumber)(S.maximum)&&(yield`${C} <= ${S.maximum}`),(0,r.IsNumber)(S.minimum)&&(yield`${C} >= ${S.minimum}`),(0,r.IsNumber)(S.multipleOf)&&(yield`(${C} % ${S.multipleOf}) === 0`)}function*be(S,ye,C){yield L.IsObjectLike(C),(0,r.IsNumber)(S.minProperties)&&(yield`Object.getOwnPropertyNames(${C}).length >= ${S.minProperties}`),(0,r.IsNumber)(S.maxProperties)&&(yield`Object.getOwnPropertyNames(${C}).length <= ${S.maxProperties}`);let xe=Object.getOwnPropertyNames(S.properties);for(let se of xe){let ge=f.Encode(C,se),De=S.properties[se];if(S.required&&S.required.includes(se))yield*H(De,ye,ge),(s.ExtendsUndefined.Check(De)||k(De))&&(yield`('${se}' in ${C})`);else{let Je=oe(De,ye,ge);yield L.IsExactOptionalProperty(C,se,Je)}}if(S.additionalProperties===!1)if(S.required&&S.required.length===xe.length)yield`Object.getOwnPropertyNames(${C}).length === ${xe.length}`;else{let se=`[${xe.map(ge=>`'${ge}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${C}).every(key => ${se}.includes(key))`}if(typeof S.additionalProperties=="object"){let se=oe(S.additionalProperties,ye,`${C}[key]`),ge=`[${xe.map(De=>`'${De}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${C}).every(key => ${ge}.includes(key) || ${se}))`}}function*p(S,ye,C){yield`(typeof value === 'object' && typeof ${C}.then === 'function')`}function*w(S,ye,C){yield L.IsRecordLike(C),(0,r.IsNumber)(S.minProperties)&&(yield`Object.getOwnPropertyNames(${C}).length >= ${S.minProperties}`),(0,r.IsNumber)(S.maxProperties)&&(yield`Object.getOwnPropertyNames(${C}).length <= ${S.maxProperties}`);let[xe,se]=Object.entries(S.patternProperties)[0],ge=Se(`${new RegExp(xe)}`),De=oe(se,ye,"value"),Je=s.TypeGuard.TSchema(S.additionalProperties)?oe(S.additionalProperties,ye,C):S.additionalProperties===!1?"false":"true",mt=`(${ge}.test(key) ? ${De} : ${Je})`;yield`(Object.entries(${C}).every(([key, value]) => ${mt}))`}function*A(S,ye,C){let xe=(0,o.Deref)(S,ye);if(ie.functions.has(S.$ref))return yield`${_e(S.$ref)}(${C})`;yield*H(xe,ye,C)}function*P(S,ye,C){yield`(typeof ${C} === 'string')`,(0,r.IsNumber)(S.maxLength)&&(yield`${C}.length <= ${S.maxLength}`),(0,r.IsNumber)(S.minLength)&&(yield`${C}.length >= ${S.minLength}`),S.pattern!==void 0&&(yield`${Se(`${new RegExp(S.pattern)};`)}.test(${C})`),S.format!==void 0&&(yield`format('${S.format}', ${C})`)}function*j(S,ye,C){yield`(typeof ${C} === 'symbol')`}function*N(S,ye,C){yield`(typeof ${C} === 'string')`,yield`${Se(`${new RegExp(S.pattern)};`)}.test(${C})`}function*g(S,ye,C){yield`${_e(S.$ref)}(${C})`}function*O(S,ye,C){if(yield`Array.isArray(${C})`,S.items===void 0)return yield`${C}.length === 0`;yield`(${C}.length === ${S.maxItems})`;for(let xe=0;xe<S.items.length;xe++)yield`${oe(S.items[xe],ye,`${C}[${xe}]`)}`}function*T(S,ye,C){yield`${C} === undefined`}function*c(S,ye,C){yield`(${S.anyOf.map(xe=>oe(xe,ye,C)).join(" || ")})`}function*x(S,ye,C){yield`${C} instanceof Uint8Array`,(0,r.IsNumber)(S.maxByteLength)&&(yield`(${C}.length <= ${S.maxByteLength})`),(0,r.IsNumber)(S.minByteLength)&&(yield`(${C}.length >= ${S.minByteLength})`)}function*v(S,ye,C){yield"true"}function*b(S,ye,C){yield L.IsVoidLike(C)}function*U(S,ye,C){let xe=ie.instances.size;ie.instances.set(xe,S),yield`kind('${S[s.Kind]}', ${xe}, ${C})`}function*H(S,ye,C,xe=!0){let se=(0,r.IsString)(S.$id)?[...ye,S]:ye,ge=S;if(xe&&(0,r.IsString)(S.$id)){let De=_e(S.$id);if(ie.functions.has(De))return yield`${De}(${C})`;{let Je=Ve(De,S,ye,"value",!1);return ie.functions.set(De,Je),yield`${De}(${C})`}}switch(ge[s.Kind]){case"Any":return yield*F(ge,se,C);case"Array":return yield*q(ge,se,C);case"AsyncIterator":return yield*D(ge,se,C);case"BigInt":return yield*Q(ge,se,C);case"Boolean":return yield*K(ge,se,C);case"Constructor":return yield*re(ge,se,C);case"Date":return yield*$(ge,se,C);case"Function":return yield*R(ge,se,C);case"Integer":return yield*z(ge,se,C);case"Intersect":return yield*ne(ge,se,C);case"Iterator":return yield*ue(ge,se,C);case"Literal":return yield*te(ge,se,C);case"Never":return yield*fe(ge,se,C);case"Not":return yield*V(ge,se,C);case"Null":return yield*X(ge,se,C);case"Number":return yield*ee(ge,se,C);case"Object":return yield*be(ge,se,C);case"Promise":return yield*p(ge,se,C);case"Record":return yield*w(ge,se,C);case"Ref":return yield*A(ge,se,C);case"String":return yield*P(ge,se,C);case"Symbol":return yield*j(ge,se,C);case"TemplateLiteral":return yield*N(ge,se,C);case"This":return yield*g(ge,se,C);case"Tuple":return yield*O(ge,se,C);case"Undefined":return yield*T(ge,se,C);case"Union":return yield*c(ge,se,C);case"Uint8Array":return yield*x(ge,se,C);case"Unknown":return yield*v(ge,se,C);case"Void":return yield*b(ge,se,C);default:if(!s.TypeRegistry.Has(ge[s.Kind]))throw new E(S);return yield*U(ge,se,C)}}let ie={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function oe(S,ye,C,xe=!0){return`(${[...H(S,ye,C,xe)].join(" && ")})`}function _e(S){return`check_${d.Encode(S)}`}function Se(S){let ye=`local_${ie.variables.size}`;return ie.variables.set(ye,`const ${ye} = ${S}`),ye}function Ve(S,ye,C,xe,se=!0){let[ge,De]=[`
|
|
49
|
+
`,vt=>"".padStart(vt," ")],Je=He("value","any"),mt=un("boolean"),dt=[...H(ye,C,xe,se)].map(vt=>`${De(4)}${vt}`).join(` &&${ge}`);return`function ${S}(${Je})${mt} {${ge}${De(2)}return (${ge}${dt}${ge}${De(2)})
|
|
50
|
+
}`}function He(S,ye){let C=ie.language==="typescript"?`: ${ye}`:"";return`${S}${C}`}function un(S){return ie.language==="typescript"?`: ${S}`:""}function Oe(S,ye,C){let xe=Ve("check",S,ye,"value"),se=He("value","any"),ge=un("boolean"),De=[...ie.functions.values()],Je=[...ie.variables.values()],mt=(0,r.IsString)(S.$id)?`return function check(${se})${ge} {
|
|
51
|
+
return ${_e(S.$id)}(value)
|
|
52
|
+
}`:`return ${xe}`;return[...Je,...De,mt].join(`
|
|
53
|
+
`)}function Br(...S){let ye={language:"javascript"},[C,xe,se]=S.length===2&&(0,r.IsArray)(S[1])?[S[0],S[1],ye]:S.length===2&&!(0,r.IsArray)(S[1])?[S[0],[],S[1]]:S.length===3?[S[0],S[1],S[2]]:S.length===1?[S[0],[],ye]:[null,[],ye];if(ie.language=se.language,ie.variables.clear(),ie.functions.clear(),ie.instances.clear(),!s.TypeGuard.TSchema(C))throw new _(C);for(let ge of xe)if(!s.TypeGuard.TSchema(ge))throw new _(ge);return Oe(C,xe,se)}B.Code=Br;function ln(S,ye=[]){let C=Br(S,ye,{language:"javascript"}),xe=globalThis.Function("kind","format","hash",C),se=new Map(ie.instances);function ge(dt,vt,Dr){if(!s.TypeRegistry.Has(dt)||!se.has(vt))return!1;let Wn=s.TypeRegistry.Get(dt),Hn=se.get(vt);return Wn(Hn,Dr)}function De(dt,vt){return s.FormatRegistry.Has(dt)?s.FormatRegistry.Get(dt)(vt):!1}function Je(dt){return(0,a.Hash)(dt)}let mt=xe(ge,De,Je);return new u(S,ye,mt,C)}B.Compile=ln})(J||(e.TypeCompiler=J={}))}}),a2=it({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/compiler/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(i,o,a,s){s===void 0&&(s=a);var u=Object.getOwnPropertyDescriptor(o,a);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(i,s,u)}:function(i,o,a,s){s===void 0&&(s=a),i[s]=o[a]}),r=e&&e.__exportStar||function(i,o){for(var a in i)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorIterator=e.ValueErrorType=void 0;var n=r2();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return n.ValueErrorIterator}}),r(o2(),e)}}),Na=Nr(Yw(),1),s2=Nr(e2(),1),oh=!1,ah=!1;Na.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(oh=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(ah=process?.env?.LOGGER_PERF_PREFIX==="true"));var u2={prefix:void 0,time:oh,delta:ah,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},Js=[],sh=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(",")}]`}},uh=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Ji=!1,Ce=class wt{static ERROR=2;static WARN=4;static INFO=6;static LOG=6;static DEBUG=8;static VERBOSE=10;static firstLog=0;static lastLog=0;static setup(t=wt.INFO,r={}){r=Object.assign({},u2,r),t>10&&console.debug("setup logger",{config:r});let n=this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}),i=(...u)=>{typeof window<"u"&&window?.FORCE_DISABLE_LOGLEVEL&&n(...u)};i.isDisabled=!0,i.isEnabled=!1;let o=this.wrapLog(console.groupCollapsed,r),a=(u,l)=>{function f(...I){let E=I[I.length-1];return E===i?E():(o(...I.slice(0,-1)),(async()=>{try{let _=E();return _ instanceof Promise?await _:_}finally{console.groupEnd()}})())}let d=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:l});return u?d:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:d})},s=a(t>=wt.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(s(...u),new Error(u.map(l=>typeof l=="string"?l:(0,s2.default)(l)).join(" "))),WARN:a(t>=wt.WARN,this.wrapLog(console.warn,r)),LOG:a(t>=wt.INFO,this.wrapLog(console.log,r)),DEBUG:a(t>=wt.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:a(t>=wt.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(Na.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=Na.isBrowser&&navigator.userAgent.includes("Chrome")?["",wt.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(Ji?n.push(new uh("dim",r.prefix)):n.push(r.prefix)),t.bind(console,...n)}}static timeStr(t,r,n=0){if(!performance.now)return;let i=performance.now();wt.firstLog||(wt.firstLog=i,wt.lastLog=i);let o=new sh(i-wt.firstLog,i-wt.lastLog,t,r);return wt.lastLog=i,n?o.toString():o}static getOriginFromStack(t){let r=!1;for(let n of t.split(`
|
|
54
|
+
`)){let i=n.match(/^\s+at\s+(.*)/);if(i){if(r)return i[1].trim().replace(__dirname,"");r=!0}}}};Na.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(Js&&Js.length){for(let t of Js)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof sh))return null;Ji||(Ji=!0);let t=Ce.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof uh?(Ji||(Ji=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var l2=typeof global=="object"&&global&&global.Object===Object&&global,lh=l2,c2=typeof self=="object"&&self&&self.Object===Object&&self,f2=lh||c2||Function("return this")(),It=f2,d2=It.Symbol,gr=d2,ch=Object.prototype,p2=ch.hasOwnProperty,h2=ch.toString,zi=gr?gr.toStringTag:void 0;function y2(e){var t=p2.call(e,zi),r=e[zi];try{e[zi]=void 0;var n=!0}catch{}var i=h2.call(e);return n&&(t?e[zi]=r:delete e[zi]),i}var g2=y2,m2=Object.prototype,b2=m2.toString;function v2(e){return b2.call(e)}var w2=v2,T2="[object Null]",_2="[object Undefined]",ff=gr?gr.toStringTag:void 0;function E2(e){return e==null?e===void 0?_2:T2:ff&&ff in Object(e)?g2(e):w2(e)}var Ai=E2;function x2(e){return e!=null&&typeof e=="object"}var en=x2,O2="[object Symbol]";function A2(e){return typeof e=="symbol"||en(e)&&Ai(e)==O2}var oi=A2;function S2(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 fh=S2,I2=Array.isArray,lr=I2,k2=1/0,df=gr?gr.prototype:void 0,pf=df?df.toString:void 0;function dh(e){if(typeof e=="string")return e;if(lr(e))return fh(e,dh)+"";if(oi(e))return pf?pf.call(e):"";var t=e+"";return t=="0"&&1/e==-k2?"-0":t}var $2=dh,j2=/\s/;function C2(e){for(var t=e.length;t--&&j2.test(e.charAt(t)););return t}var N2=C2,U2=/^\s+/;function P2(e){return e&&e.slice(0,N2(e)+1).replace(U2,"")}var B2=P2;function D2(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ir=D2,hf=NaN,R2=/^[-+]0x[0-9a-f]+$/i,M2=/^0b[01]+$/i,L2=/^0o[0-7]+$/i,V2=parseInt;function F2(e){if(typeof e=="number")return e;if(oi(e))return hf;if(Ir(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ir(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=B2(e);var r=M2.test(e);return r||L2.test(e)?V2(e.slice(2),r?2:8):R2.test(e)?hf:+e}var z2=F2,yf=1/0,K2=17976931348623157e292;function q2(e){if(!e)return e===0?e:0;if(e=z2(e),e===yf||e===-yf){var t=e<0?-1:1;return t*K2}return e===e?e:0}var G2=q2;function W2(e){var t=G2(e),r=t%1;return t===t?r?t-r:t:0}var gf=W2;function H2(e){return e}var ws=H2,J2="[object AsyncFunction]",X2="[object Function]",Q2="[object GeneratorFunction]",Z2="[object Proxy]";function Y2(e){if(!Ir(e))return!1;var t=Ai(e);return t==X2||t==Q2||t==J2||t==Z2}var ph=Y2,eT=It["__core-js_shared__"],Xs=eT,mf=function(){var e=/[^.]+$/.exec(Xs&&Xs.keys&&Xs.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function tT(e){return!!mf&&mf in e}var rT=tT,nT=Function.prototype,iT=nT.toString;function oT(e){if(e!=null){try{return iT.call(e)}catch{}try{return e+""}catch{}}return""}var Pn=oT,aT=/[\\^$.*+?()[\]{}|]/g,sT=/^\[object .+?Constructor\]$/,uT=Function.prototype,lT=Object.prototype,cT=uT.toString,fT=lT.hasOwnProperty,dT=RegExp("^"+cT.call(fT).replace(aT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function pT(e){if(!Ir(e)||rT(e))return!1;var t=ph(e)?dT:sT;return t.test(Pn(e))}var hT=pT;function yT(e,t){return e?.[t]}var gT=yT;function mT(e,t){var r=gT(e,t);return hT(r)?r:void 0}var Bn=mT,bT=Bn(It,"WeakMap"),so=bT,vT=so&&new so,Ua=vT,wT=Ua?function(e,t){return Ua.set(e,t),e}:ws,hh=wT,bf=Object.create,TT=function(){function e(){}return function(t){if(!Ir(t))return{};if(bf)return bf(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),$l=TT;function _T(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=$l(e.prototype),n=e.apply(r,t);return Ir(n)?n:r}}var uo=_T,ET=1;function xT(e,t,r){var n=t&ET,i=uo(e);function o(){var a=this&&this!==It&&this instanceof o?i:e;return a.apply(n?r:this,arguments)}return o}var OT=xT;function AT(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 jl=AT,ST=Math.max;function IT(e,t,r,n){for(var i=-1,o=e.length,a=r.length,s=-1,u=t.length,l=ST(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 yh=IT,kT=Math.max;function $T(e,t,r,n){for(var i=-1,o=e.length,a=-1,s=r.length,u=-1,l=t.length,f=kT(o-s,0),d=Array(f+l),I=!n;++i<f;)d[i]=e[i];for(var E=i;++u<l;)d[E+u]=t[u];for(;++a<s;)(I||i<o)&&(d[E+r[a]]=e[i++]);return d}var gh=$T;function jT(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var CT=jT;function NT(){}var Cl=NT,UT=4294967295;function Pa(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=UT,this.__views__=[]}Pa.prototype=$l(Cl.prototype);Pa.prototype.constructor=Pa;var Nl=Pa;function PT(){}var mh=PT,BT=Ua?function(e){return Ua.get(e)}:mh,bh=BT,DT={},vf=DT,RT=Object.prototype,MT=RT.hasOwnProperty;function LT(e){for(var t=e.name+"",r=vf[t],n=MT.call(vf,t)?r.length:0;n--;){var i=r[n],o=i.func;if(o==null||o==e)return i.name}return t}var VT=LT;function Ba(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}Ba.prototype=$l(Cl.prototype);Ba.prototype.constructor=Ba;var ku=Ba;function FT(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var vh=FT;function zT(e){if(e instanceof Nl)return e.clone();var t=new ku(e.__wrapped__,e.__chain__);return t.__actions__=vh(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var KT=zT,qT=Object.prototype,GT=qT.hasOwnProperty;function Da(e){if(en(e)&&!lr(e)&&!(e instanceof Nl)){if(e instanceof ku)return e;if(GT.call(e,"__wrapped__"))return KT(e)}return new ku(e)}Da.prototype=Cl.prototype;Da.prototype.constructor=Da;var WT=Da;function HT(e){var t=VT(e),r=WT[t];if(typeof r!="function"||!(t in Nl.prototype))return!1;if(e===r)return!0;var n=bh(r);return!!n&&e===n[0]}var JT=HT,XT=800,QT=16,ZT=Date.now;function YT(e){var t=0,r=0;return function(){var n=ZT(),i=QT-(n-r);if(r=n,i>0){if(++t>=XT)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var wh=YT,e_=wh(hh),Th=e_,t_=/\{\n\/\* \[wrapped with (.+)\] \*/,r_=/,? & /;function n_(e){var t=e.match(t_);return t?t[1].split(r_):[]}var i_=n_,o_=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function a_(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(o_,`{
|
|
55
|
+
/* [wrapped with `+t+`] */
|
|
56
|
+
`)}var s_=a_;function u_(e){return function(){return e}}var l_=u_,c_=function(){try{var e=Bn(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Ra=c_,f_=Ra?function(e,t){return Ra(e,"toString",{configurable:!0,enumerable:!1,value:l_(t),writable:!0})}:ws,d_=f_,p_=wh(d_),Ul=p_;function h_(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var y_=h_;function g_(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 m_=g_;function b_(e){return e!==e}var v_=b_;function w_(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}var T_=w_;function __(e,t,r){return t===t?T_(e,t,r):m_(e,v_,r)}var E_=__;function x_(e,t){var r=e==null?0:e.length;return!!r&&E_(e,t,0)>-1}var _h=x_,O_=1,A_=2,S_=8,I_=16,k_=32,$_=64,j_=128,C_=256,N_=512,U_=[["ary",j_],["bind",O_],["bindKey",A_],["curry",S_],["curryRight",I_],["flip",N_],["partial",k_],["partialRight",$_],["rearg",C_]];function P_(e,t){return y_(U_,function(r){var n="_."+r[0];t&r[1]&&!_h(e,n)&&e.push(n)}),e.sort()}var B_=P_;function D_(e,t,r){var n=t+"";return Ul(e,s_(n,B_(i_(n),r)))}var Eh=D_,R_=1,M_=2,L_=4,V_=8,wf=32,Tf=64;function F_(e,t,r,n,i,o,a,s,u,l){var f=t&V_,d=f?a:void 0,I=f?void 0:a,E=f?o:void 0,_=f?void 0:o;t|=f?wf:Tf,t&=~(f?Tf:wf),t&L_||(t&=~(R_|M_));var L=[e,t,i,E,d,_,I,s,u,l],J=r.apply(void 0,L);return JT(e)&&Th(J,L),J.placeholder=n,Eh(J,e,t)}var xh=F_;function z_(e){var t=e;return t.placeholder}var Pl=z_,K_=9007199254740991,q_=/^(?:0|[1-9]\d*)$/;function G_(e,t){var r=typeof e;return t=t??K_,!!t&&(r=="number"||r!="symbol"&&q_.test(e))&&e>-1&&e%1==0&&e<t}var Ts=G_,W_=Math.min;function H_(e,t){for(var r=e.length,n=W_(t.length,r),i=vh(e);n--;){var o=t[n];e[n]=Ts(o,r)?i[o]:void 0}return e}var J_=H_,_f="__lodash_placeholder__";function X_(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r];(a===t||a===_f)&&(e[r]=_f,o[i++]=r)}return o}var lo=X_,Q_=1,Z_=2,Y_=8,eE=16,tE=128,rE=512;function Oh(e,t,r,n,i,o,a,s,u,l){var f=t&tE,d=t&Q_,I=t&Z_,E=t&(Y_|eE),_=t&rE,L=I?void 0:uo(e);function J(){for(var B=arguments.length,k=Array(B),F=B;F--;)k[F]=arguments[F];if(E)var q=Pl(J),D=CT(k,q);if(n&&(k=yh(k,n,i,E)),o&&(k=gh(k,o,a,E)),B-=D,E&&B<l){var Q=lo(k,q);return xh(e,t,Oh,J.placeholder,r,k,Q,s,u,l-B)}var K=d?r:this,re=I?K[e]:e;return B=k.length,s?k=J_(k,s):_&&B>1&&k.reverse(),f&&u<B&&(k.length=u),this&&this!==It&&this instanceof J&&(re=L||uo(re)),re.apply(K,k)}return J}var Ah=Oh;function nE(e,t,r){var n=uo(e);function i(){for(var o=arguments.length,a=Array(o),s=o,u=Pl(i);s--;)a[s]=arguments[s];var l=o<3&&a[0]!==u&&a[o-1]!==u?[]:lo(a,u);if(o-=l.length,o<r)return xh(e,t,Ah,i.placeholder,void 0,a,l,void 0,void 0,r-o);var f=this&&this!==It&&this instanceof i?n:e;return jl(f,this,a)}return i}var iE=nE,oE=1;function aE(e,t,r,n){var i=t&oE,o=uo(e);function a(){for(var s=-1,u=arguments.length,l=-1,f=n.length,d=Array(f+u),I=this&&this!==It&&this instanceof a?o:e;++l<f;)d[l]=n[l];for(;u--;)d[l++]=arguments[++s];return jl(I,i?r:this,d)}return a}var sE=aE,Ef="__lodash_placeholder__",Qs=1,uE=2,lE=4,xf=8,Ki=128,Of=256,cE=Math.min;function fE(e,t){var r=e[1],n=t[1],i=r|n,o=i<(Qs|uE|Ki),a=n==Ki&&r==xf||n==Ki&&r==Of&&e[7].length<=t[8]||n==(Ki|Of)&&t[7].length<=t[8]&&r==xf;if(!(o||a))return e;n&Qs&&(e[2]=t[2],i|=r&Qs?0:lE);var s=t[3];if(s){var u=e[3];e[3]=u?yh(u,s,t[4]):s,e[4]=u?lo(e[3],Ef):t[4]}return s=t[5],s&&(u=e[5],e[5]=u?gh(u,s,t[6]):s,e[6]=u?lo(e[5],Ef):t[6]),s=t[7],s&&(e[7]=s),n&Ki&&(e[8]=e[8]==null?t[8]:cE(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}var dE=fE,pE="Expected a function",Af=1,hE=2,Zs=8,Ys=16,eu=32,Sf=64,If=Math.max;function yE(e,t,r,n,i,o,a,s){var u=t&hE;if(!u&&typeof e!="function")throw new TypeError(pE);var l=n?n.length:0;if(l||(t&=~(eu|Sf),n=i=void 0),a=a===void 0?a:If(gf(a),0),s=s===void 0?s:gf(s),l-=i?i.length:0,t&Sf){var f=n,d=i;n=i=void 0}var I=u?void 0:bh(e),E=[e,t,r,n,i,f,d,o,a,s];if(I&&dE(E,I),e=E[0],t=E[1],r=E[2],n=E[3],i=E[4],s=E[9]=E[9]===void 0?u?0:e.length:If(E[9]-l,0),!s&&t&(Zs|Ys)&&(t&=~(Zs|Ys)),!t||t==Af)var _=OT(e,t,r);else t==Zs||t==Ys?_=iE(e,t,s):(t==eu||t==(Af|eu))&&!i.length?_=sE(e,t,r,n):_=Ah.apply(void 0,E);var L=I?hh:Th;return Eh(L(_,E),e,t)}var gE=yE;function mE(e,t,r){t=="__proto__"&&Ra?Ra(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var bE=mE;function vE(e,t){return e===t||e!==e&&t!==t}var Bl=vE,wE=Object.prototype,TE=wE.hasOwnProperty;function _E(e,t,r){var n=e[t];(!(TE.call(e,t)&&Bl(n,r))||r===void 0&&!(t in e))&&bE(e,t,r)}var EE=_E,kf=Math.max;function xE(e,t,r){return t=kf(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=kf(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),jl(e,this,s)}}var Sh=xE;function OE(e,t){return Ul(Sh(e,t,ws),e+"")}var Ih=OE,AE=9007199254740991;function SE(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=AE}var Dl=SE;function IE(e){return e!=null&&Dl(e.length)&&!ph(e)}var kh=IE,kE=Object.prototype;function $E(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||kE;return e===r}var jE=$E;function CE(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var NE=CE,UE="[object Arguments]";function PE(e){return en(e)&&Ai(e)==UE}var $f=PE,$h=Object.prototype,BE=$h.hasOwnProperty,DE=$h.propertyIsEnumerable,RE=$f(function(){return arguments}())?$f:function(e){return en(e)&&BE.call(e,"callee")&&!DE.call(e,"callee")},Rl=RE;function ME(){return!1}var LE=ME,jh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,jf=jh&&typeof module=="object"&&module&&!module.nodeType&&module,VE=jf&&jf.exports===jh,Cf=VE?It.Buffer:void 0,FE=Cf?Cf.isBuffer:void 0,zE=FE||LE,$u=zE,KE="[object Arguments]",qE="[object Array]",GE="[object Boolean]",WE="[object Date]",HE="[object Error]",JE="[object Function]",XE="[object Map]",QE="[object Number]",ZE="[object Object]",YE="[object RegExp]",ex="[object Set]",tx="[object String]",rx="[object WeakMap]",nx="[object ArrayBuffer]",ix="[object DataView]",ox="[object Float32Array]",ax="[object Float64Array]",sx="[object Int8Array]",ux="[object Int16Array]",lx="[object Int32Array]",cx="[object Uint8Array]",fx="[object Uint8ClampedArray]",dx="[object Uint16Array]",px="[object Uint32Array]",Fe={};Fe[ox]=Fe[ax]=Fe[sx]=Fe[ux]=Fe[lx]=Fe[cx]=Fe[fx]=Fe[dx]=Fe[px]=!0;Fe[KE]=Fe[qE]=Fe[nx]=Fe[GE]=Fe[ix]=Fe[WE]=Fe[HE]=Fe[JE]=Fe[XE]=Fe[QE]=Fe[ZE]=Fe[YE]=Fe[ex]=Fe[tx]=Fe[rx]=!1;function hx(e){return en(e)&&Dl(e.length)&&!!Fe[Ai(e)]}var yx=hx;function gx(e){return function(t){return e(t)}}var Ch=gx,Nh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,eo=Nh&&typeof module=="object"&&module&&!module.nodeType&&module,mx=eo&&eo.exports===Nh,tu=mx&&lh.process,bx=function(){try{var e=eo&&eo.require&&eo.require("util").types;return e||tu&&tu.binding&&tu.binding("util")}catch{}}(),Nf=bx,Uf=Nf&&Nf.isTypedArray,vx=Uf?Ch(Uf):yx,Uh=vx,wx=Object.prototype,Tx=wx.hasOwnProperty;function _x(e,t){var r=lr(e),n=!r&&Rl(e),i=!r&&!n&&$u(e),o=!r&&!n&&!i&&Uh(e),a=r||n||i||o,s=a?NE(e.length,String):[],u=s.length;for(var l in e)(t||Tx.call(e,l))&&!(a&&(l=="length"||i&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||Ts(l,u)))&&s.push(l);return s}var Ex=_x;function xx(e,t){return function(r){return e(t(r))}}var Ox=xx,Ax=Ox(Object.keys,Object),Sx=Ax,Ix=Object.prototype,kx=Ix.hasOwnProperty;function $x(e){if(!jE(e))return Sx(e);var t=[];for(var r in Object(e))kx.call(e,r)&&r!="constructor"&&t.push(r);return t}var jx=$x;function Cx(e){return kh(e)?Ex(e):jx(e)}var Ph=Cx,Nx=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ux=/^\w*$/;function Px(e,t){if(lr(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||oi(e)?!0:Ux.test(e)||!Nx.test(e)||t!=null&&e in Object(t)}var Ml=Px,Bx=Bn(Object,"create"),co=Bx;function Dx(){this.__data__=co?co(null):{},this.size=0}var Rx=Dx;function Mx(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Lx=Mx,Vx="__lodash_hash_undefined__",Fx=Object.prototype,zx=Fx.hasOwnProperty;function Kx(e){var t=this.__data__;if(co){var r=t[e];return r===Vx?void 0:r}return zx.call(t,e)?t[e]:void 0}var qx=Kx,Gx=Object.prototype,Wx=Gx.hasOwnProperty;function Hx(e){var t=this.__data__;return co?t[e]!==void 0:Wx.call(t,e)}var Jx=Hx,Xx="__lodash_hash_undefined__";function Qx(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=co&&t===void 0?Xx:t,this}var Zx=Qx;function Si(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Si.prototype.clear=Rx;Si.prototype.delete=Lx;Si.prototype.get=qx;Si.prototype.has=Jx;Si.prototype.set=Zx;var Pf=Si;function Yx(){this.__data__=[],this.size=0}var eO=Yx;function tO(e,t){for(var r=e.length;r--;)if(Bl(e[r][0],t))return r;return-1}var _s=tO,rO=Array.prototype,nO=rO.splice;function iO(e){var t=this.__data__,r=_s(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():nO.call(t,r,1),--this.size,!0}var oO=iO;function aO(e){var t=this.__data__,r=_s(t,e);return r<0?void 0:t[r][1]}var sO=aO;function uO(e){return _s(this.__data__,e)>-1}var lO=uO;function cO(e,t){var r=this.__data__,n=_s(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var fO=cO;function Ii(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ii.prototype.clear=eO;Ii.prototype.delete=oO;Ii.prototype.get=sO;Ii.prototype.has=lO;Ii.prototype.set=fO;var Es=Ii,dO=Bn(It,"Map"),fo=dO;function pO(){this.size=0,this.__data__={hash:new Pf,map:new(fo||Es),string:new Pf}}var hO=pO;function yO(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var gO=yO;function mO(e,t){var r=e.__data__;return gO(t)?r[typeof t=="string"?"string":"hash"]:r.map}var xs=mO;function bO(e){var t=xs(this,e).delete(e);return this.size-=t?1:0,t}var vO=bO;function wO(e){return xs(this,e).get(e)}var TO=wO;function _O(e){return xs(this,e).has(e)}var EO=_O;function xO(e,t){var r=xs(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var OO=xO;function ki(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ki.prototype.clear=hO;ki.prototype.delete=vO;ki.prototype.get=TO;ki.prototype.has=EO;ki.prototype.set=OO;var Os=ki,AO="Expected a function";function Ll(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(AO);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(Ll.Cache||Os),r}Ll.Cache=Os;var SO=Ll,IO=500;function kO(e){var t=SO(e,function(n){return r.size===IO&&r.clear(),n}),r=t.cache;return t}var $O=kO,jO=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,CO=/\\(\\)?/g,NO=$O(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(jO,function(r,n,i,o){t.push(i?o.replace(CO,"$1"):n||r)}),t}),UO=NO;function PO(e){return e==null?"":$2(e)}var BO=PO;function DO(e,t){return lr(e)?e:Ml(e,t)?[e]:UO(BO(e))}var As=DO,RO=1/0;function MO(e){if(typeof e=="string"||oi(e))return e;var t=e+"";return t=="0"&&1/e==-RO?"-0":t}var Co=MO;function LO(e,t){t=As(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Co(t[r++])];return r&&r==n?e:void 0}var Vl=LO;function VO(e,t,r){var n=e==null?void 0:Vl(e,t);return n===void 0?r:n}var FO=VO;function zO(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var Bh=zO,Bf=gr?gr.isConcatSpreadable:void 0;function KO(e){return lr(e)||Rl(e)||!!(Bf&&e&&e[Bf])}var qO=KO;function Dh(e,t,r,n,i){var o=-1,a=e.length;for(r||(r=qO),i||(i=[]);++o<a;){var s=e[o];t>0&&r(s)?t>1?Dh(s,t-1,r,n,i):Bh(i,s):n||(i[i.length]=s)}return i}var GO=Dh;function WO(e){var t=e==null?0:e.length;return t?GO(e,1):[]}var HO=WO;function JO(e){return Ul(Sh(e,void 0,HO),e+"")}var XO=JO;function QO(){this.__data__=new Es,this.size=0}var ZO=QO;function YO(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var eA=YO;function tA(e){return this.__data__.get(e)}var rA=tA;function nA(e){return this.__data__.has(e)}var iA=nA,oA=200;function aA(e,t){var r=this.__data__;if(r instanceof Es){var n=r.__data__;if(!fo||n.length<oA-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Os(n)}return r.set(e,t),this.size=r.size,this}var sA=aA;function $i(e){var t=this.__data__=new Es(e);this.size=t.size}$i.prototype.clear=ZO;$i.prototype.delete=eA;$i.prototype.get=rA;$i.prototype.has=iA;$i.prototype.set=sA;var ra=$i;function uA(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 lA=uA;function cA(){return[]}var fA=cA,dA=Object.prototype,pA=dA.propertyIsEnumerable,Df=Object.getOwnPropertySymbols,hA=Df?function(e){return e==null?[]:(e=Object(e),lA(Df(e),function(t){return pA.call(e,t)}))}:fA,yA=hA;function gA(e,t,r){var n=t(e);return lr(e)?n:Bh(n,r(e))}var mA=gA;function bA(e){return mA(e,Ph,yA)}var Rf=bA,vA=Bn(It,"DataView"),ju=vA,wA=Bn(It,"Promise"),Cu=wA,TA=Bn(It,"Set"),ti=TA,Mf="[object Map]",_A="[object Object]",Lf="[object Promise]",Vf="[object Set]",Ff="[object WeakMap]",zf="[object DataView]",EA=Pn(ju),xA=Pn(fo),OA=Pn(Cu),AA=Pn(ti),SA=Pn(so),yn=Ai;(ju&&yn(new ju(new ArrayBuffer(1)))!=zf||fo&&yn(new fo)!=Mf||Cu&&yn(Cu.resolve())!=Lf||ti&&yn(new ti)!=Vf||so&&yn(new so)!=Ff)&&(yn=function(e){var t=Ai(e),r=t==_A?e.constructor:void 0,n=r?Pn(r):"";if(n)switch(n){case EA:return zf;case xA:return Mf;case OA:return Lf;case AA:return Vf;case SA:return Ff}return t});var Kf=yn,IA=It.Uint8Array,qf=IA,kA="__lodash_hash_undefined__";function $A(e){return this.__data__.set(e,kA),this}var jA=$A;function CA(e){return this.__data__.has(e)}var NA=CA;function Ma(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Os;++t<r;)this.add(e[t])}Ma.prototype.add=Ma.prototype.push=jA;Ma.prototype.has=NA;var Rh=Ma;function UA(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 PA=UA;function BA(e,t){return e.has(t)}var Mh=BA,DA=1,RA=2;function MA(e,t,r,n,i,o){var a=r&DA,s=e.length,u=t.length;if(s!=u&&!(a&&u>s))return!1;var l=o.get(e),f=o.get(t);if(l&&f)return l==t&&f==e;var d=-1,I=!0,E=r&RA?new Rh:void 0;for(o.set(e,t),o.set(t,e);++d<s;){var _=e[d],L=t[d];if(n)var J=a?n(L,_,d,t,e,o):n(_,L,d,e,t,o);if(J!==void 0){if(J)continue;I=!1;break}if(E){if(!PA(t,function(B,k){if(!Mh(E,k)&&(_===B||i(_,B,r,n,o)))return E.push(k)})){I=!1;break}}else if(!(_===L||i(_,L,r,n,o))){I=!1;break}}return o.delete(e),o.delete(t),I}var Lh=MA;function LA(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var VA=LA;function FA(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var Vh=FA,zA=1,KA=2,qA="[object Boolean]",GA="[object Date]",WA="[object Error]",HA="[object Map]",JA="[object Number]",XA="[object RegExp]",QA="[object Set]",ZA="[object String]",YA="[object Symbol]",eS="[object ArrayBuffer]",tS="[object DataView]",Gf=gr?gr.prototype:void 0,ru=Gf?Gf.valueOf:void 0;function rS(e,t,r,n,i,o,a){switch(r){case tS:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case eS:return!(e.byteLength!=t.byteLength||!o(new qf(e),new qf(t)));case qA:case GA:case JA:return Bl(+e,+t);case WA:return e.name==t.name&&e.message==t.message;case XA:case ZA:return e==t+"";case HA:var s=VA;case QA:var u=n&zA;if(s||(s=Vh),e.size!=t.size&&!u)return!1;var l=a.get(e);if(l)return l==t;n|=KA,a.set(e,t);var f=Lh(s(e),s(t),n,i,o,a);return a.delete(e),f;case YA:if(ru)return ru.call(e)==ru.call(t)}return!1}var nS=rS,iS=1,oS=Object.prototype,aS=oS.hasOwnProperty;function sS(e,t,r,n,i,o){var a=r&iS,s=Rf(e),u=s.length,l=Rf(t),f=l.length;if(u!=f&&!a)return!1;for(var d=u;d--;){var I=s[d];if(!(a?I in t:aS.call(t,I)))return!1}var E=o.get(e),_=o.get(t);if(E&&_)return E==t&&_==e;var L=!0;o.set(e,t),o.set(t,e);for(var J=a;++d<u;){I=s[d];var B=e[I],k=t[I];if(n)var F=a?n(k,B,I,t,e,o):n(B,k,I,e,t,o);if(!(F===void 0?B===k||i(B,k,r,n,o):F)){L=!1;break}J||(J=I=="constructor")}if(L&&!J){var q=e.constructor,D=t.constructor;q!=D&&"constructor"in e&&"constructor"in t&&!(typeof q=="function"&&q instanceof q&&typeof D=="function"&&D instanceof D)&&(L=!1)}return o.delete(e),o.delete(t),L}var uS=sS,lS=1,Wf="[object Arguments]",Hf="[object Array]",Jo="[object Object]",cS=Object.prototype,Jf=cS.hasOwnProperty;function fS(e,t,r,n,i,o){var a=lr(e),s=lr(t),u=a?Hf:Kf(e),l=s?Hf:Kf(t);u=u==Wf?Jo:u,l=l==Wf?Jo:l;var f=u==Jo,d=l==Jo,I=u==l;if(I&&$u(e)){if(!$u(t))return!1;a=!0,f=!1}if(I&&!f)return o||(o=new ra),a||Uh(e)?Lh(e,t,r,n,i,o):nS(e,t,u,r,n,i,o);if(!(r&lS)){var E=f&&Jf.call(e,"__wrapped__"),_=d&&Jf.call(t,"__wrapped__");if(E||_){var L=E?e.value():e,J=_?t.value():t;return o||(o=new ra),i(L,J,r,n,o)}}return I?(o||(o=new ra),uS(e,t,r,n,i,o)):!1}var dS=fS;function Fh(e,t,r,n,i){return e===t?!0:e==null||t==null||!en(e)&&!en(t)?e!==e&&t!==t:dS(e,t,r,n,Fh,i)}var zh=Fh,pS=1,hS=2;function yS(e,t,r,n){var i=r.length,o=i,a=!n;if(e==null)return!o;for(e=Object(e);i--;){var s=r[i];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){s=r[i];var u=s[0],l=e[u],f=s[1];if(a&&s[2]){if(l===void 0&&!(u in e))return!1}else{var d=new ra;if(n)var I=n(l,f,u,e,t,d);if(!(I===void 0?zh(f,l,pS|hS,n,d):I))return!1}}return!0}var gS=yS;function mS(e){return e===e&&!Ir(e)}var Kh=mS;function bS(e){for(var t=Ph(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Kh(i)]}return t}var vS=bS;function wS(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var qh=wS;function TS(e){var t=vS(e);return t.length==1&&t[0][2]?qh(t[0][0],t[0][1]):function(r){return r===e||gS(r,e,t)}}var _S=TS;function ES(e,t){return e!=null&&t in Object(e)}var xS=ES;function OS(e,t,r){t=As(t,e);for(var n=-1,i=t.length,o=!1;++n<i;){var a=Co(t[n]);if(!(o=e!=null&&r(e,a)))break;e=e[a]}return o||++n!=i?o:(i=e==null?0:e.length,!!i&&Dl(i)&&Ts(a,i)&&(lr(e)||Rl(e)))}var AS=OS;function SS(e,t){return e!=null&&AS(e,t,xS)}var Gh=SS,IS=1,kS=2;function $S(e,t){return Ml(e)&&Kh(t)?qh(Co(e),t):function(r){var n=FO(r,e);return n===void 0&&n===t?Gh(r,e):zh(t,n,IS|kS)}}var jS=$S;function CS(e){return function(t){return t?.[e]}}var NS=CS;function US(e){return function(t){return Vl(t,e)}}var PS=US;function BS(e){return Ml(e)?NS(Co(e)):PS(e)}var DS=BS;function RS(e){return typeof e=="function"?e:e==null?ws:typeof e=="object"?lr(e)?jS(e[0],e[1]):_S(e):DS(e)}var MS=RS;function LS(e){return en(e)&&kh(e)}var VS=LS;function FS(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 zS=FS,KS=200;function qS(e,t,r,n){var i=-1,o=_h,a=!0,s=e.length,u=[],l=t.length;if(!s)return u;r&&(t=fh(t,Ch(r))),n?(o=zS,a=!1):t.length>=KS&&(o=Mh,a=!1,t=new Rh(t));e:for(;++i<s;){var f=e[i],d=r==null?f:r(f);if(f=n||f!==0?f:0,a&&d===d){for(var I=l;I--;)if(t[I]===d)continue e;u.push(f)}else o(t,d,n)||u.push(f)}return u}var GS=qS;function WS(e,t,r,n){if(!Ir(e))return e;t=As(t,e);for(var i=-1,o=t.length,a=o-1,s=e;s!=null&&++i<o;){var u=Co(t[i]),l=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return e;if(i!=a){var f=s[u];l=n?n(f,u,s):void 0,l===void 0&&(l=Ir(f)?f:Ts(t[i+1])?[]:{})}EE(s,u,l),s=s[u]}return e}var HS=WS;function JS(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var a=t[n],s=Vl(e,a);r(s,a)&&HS(o,As(a,e),s)}return o}var XS=JS,QS=32,Fl=Ih(function(e,t){var r=lo(t,Pl(Fl));return gE(e,QS,void 0,t,r)});Fl.placeholder={};var ZS=Fl;function YS(e,t){return XS(e,t,function(r,n){return Gh(e,n)})}var eI=YS,tI=XO(function(e,t){return e==null?{}:eI(e,t)}),Xf=tI,rI=4294967295,nI=rI-1,iI=Math.floor,oI=Math.min;function aI(e,t,r,n){var i=0,o=e==null?0:e.length;if(o===0)return 0;t=r(t);for(var a=t!==t,s=t===null,u=oi(t),l=t===void 0;i<o;){var f=iI((i+o)/2),d=r(e[f]),I=d!==void 0,E=d===null,_=d===d,L=oi(d);if(a)var J=n||_;else l?J=_&&(n||I):s?J=_&&I&&(n||!E):u?J=_&&I&&!E&&(n||!L):E||L?J=!1:J=n?d<=t:d<t;J?i=f+1:o=f}return oI(o,nI)}var sI=aI;function uI(e,t,r){return sI(e,t,MS(r,2))}var lI=uI,cI=1/0,HN=ti&&1/Vh(new ti([,-0]))[1]==cI?function(e){return new ti(e)}:mh,fI=Ih(function(e,t){return VS(e)?GS(e,t):[]}),Qf=fI,Wh=Nr(t2(),1),JN=Wh.default.configure,po=Wh.default,nu=100,{WARN:dI,LOG:XN,DEBUG:nt,VERBOSE:Ae,ERROR:QN}=Ce.setup(Ce.INFO),La=Ke.set();yw({enforceActions:"always"});if(!new class{xyz}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");var Ye=({caller:e,thread:t,pattern:r,args:n})=>ze(()=>(n=n||r,`${!Array.isArray(t)&&t?.name?t.name+" | ":""}${e??"caller?"}${n?`{${typeof n=="string"?n:po(n)}}`:""}`));function pI(e,t){return ze(()=>et.structural(e.get(),t.get()))}function No(e,t){return et.shallow(e.applogs,t.applogs)}function zl(e,t){if(e.size!==t.size)return!1;for(let r=0;r<e.size;r++){let n=e.nodes[r],i=t.nodes[r];if(Ae.isEnabled&&Ae("queryNodesComparer",r,n,i),!et.structural(n.variables,i.variables))return Ae.isEnabled&&Ae("[queryNodesComparer] changed vars:",r,n,i),!1;if(!No(n.logsOfThisNode,i.logsOfThisNode))return Ae.isEnabled&&Ae("[queryNodesComparer] changed logsOfThisNode:",r,n,i),!1}return Ae.isEnabled&&Ae("[queryNodesComparer] equal:",{a:e,b:t}),!0}var hI=0;function nr(e,{name:t,equals:r}={}){let n=`observableArrayMap@${++hI}{${t}}`;Ae.isEnabled&&Ae(`[${n}] create`,{fnname:e.name,fn:e,name:t,equals:r});let i,o=Hh(e,s=>{i?ze(()=>(r??et.structural)(i,s))?nt.isEnabled&&nt(`[${n}] update skipped`,{updatedItems:s,observableArr:i}):(i.replace(s),nt.isEnabled&&nt(`[${n}] updated`,{updatedItems:s,observableArr:i})):i=Ke.array(s,{deep:!1,name:t,equals:r})},{name:n});if(n.includes("useRoots")){var a=ur(i);nt(`[${n}] deps`,{disposeAutorun:o,rootsAtom:a,observableArr:i,observers:Ia(i)}),oo(()=>La.add(a))}return Ae.isEnabled&&gs(i,()=>{Ae(`[${n}] observed`,Ia(i),{rootsAtom:a,observableArr:i})}),wi(i,()=>{Ae.isEnabled&&Ae(`[${n}] dispose`),a&&oo(()=>La.delete(a)),o()}),i}var yI=0;function gI(e,{name:t}={}){let r=`observableSetMap@${++yI}{${t}}`;Ae.isEnabled&&Ae(`[${r}] create`,{fnname:e.name,fn:e,name:t});let n,i=Hh(e,a=>{if(!n)n=Ke.set(a,{deep:!1,name:t});else{let{deleted:s,added:u}=ze(()=>{let l=new Set(n.values()),f=new Set;for(let d of a)n.has(d)?(Ae.isEnabled&&Ae(`[${r}] unchanged`,d,{updatedItems:a,observableSet:n}),l.delete(d)):f.add(d);return nt.isEnabled&&nt(`[${r}] updated:`,{unseen:l,added:f,updatedItems:a,observableSet:n}),{added:f,deleted:l}});for(let l of s)n.delete(l);for(let l of u)n.add(l)}},{name:r});if(r.includes("useRoots")){var o=ur(n);nt.isEnabled&&nt(`[${r}] deps`,{disposeAutorun:i,rootsAtom:o,observableSet:n,observers:Ia(n)}),oo(()=>La.add(o))}return Ae.isEnabled&&gs(n,()=>{Ae(`[${r}] observed`,Ia(n),{rootsAtom:o,observableSet:n})}),wi(n,()=>{Ae.isEnabled&&Ae(`[${r}] dispose`),o&&oo(()=>La.delete(o)),i()}),n}function Hh(e,t=null,{name:r}={}){nt.isEnabled&&nt("[autorunButAlsoImmediately] create",{fnname:e.name,fn:e,name:r});let n=`${r}.autorunImm`,i,o=new yr(n,function(...s){nt.isEnabled&&nt(`[${n}] reaction.invalidate`,s),a()});function a(){o.track(function(){let s=nu&&performance.now();nt.isEnabled&&nt(`[${n}] runAndTrack:`,{name:r??e.name,fn:e}),i=e(),nt.isEnabled&&nt(`[${n}] runAndTrack =>`,i),oo(()=>{t?.(i)}),nu&&performance.now()-s>nu&&dI(`[${n}] took ${performance.now()-s}ms`)})}return a(),nt.isEnabled&&nt(`[${n}] deps of reaction`,{reaction:o,result:i,deps:ms(o)}),()=>{Ae.isEnabled&&Ae(`[${n}] dispose`),setTimeout(()=>o.dispose())}}function at(e,t,r=!1){if(wn(t))throw new Error("computedFnDeepCompare shouldn't be used on actions");let n=!1,i=0,o=typeof r=="boolean"?{keepAlive:r}:r,a=new Map;return function(...s){let u,l=ze(()=>{let E=s;for(let _=0;_<s.length;_++)s[_]instanceof ai&&s===E&&(E=s.slice());return E}),f=`computedFnDeepCompare(${e||t.name}#${++i})${o.argsDebugName?`{${o.argsDebugName(...s)}}`:""}`;for(let[E,_]of a.entries())if(bI(E,l)){u=_;break}else if(Ae.isEnabled)for(let L=0;L<E.length;L++)E[L]instanceof ai&&E[L].name===s[L].name&&et.structural(Qf(E,E[L]),Qf(l,l[L]))&&Ae.force(`[${f}] threadState mismatch => cachebust`,{diffFields:Object.keys(E[L]).filter(J=>!et.structural(E[L][J],s[L][J])),cacheArg:E[L],freshArg:s[L]});if(u){let E=u.get();return Ae.isEnabled&&Ae(`[${f}] cache hit`,{untrackedArgs:l,cachedResult:E}),E}if(!o.keepAlive&&!z1())return!n&&H1().computedRequiresReaction&&(console.warn("invoking a computedFn from outside an reactive context won't be memoized, unless keepAlive is set"),n=!0),t.apply(this,s);Ae.isEnabled&&Ae(`[${f}] new computation`,{untrackedArgs:l});let d,I=Ze(()=>(Ae.isEnabled&&Ae(`[${f}] update->rerun`,ze(()=>({args:s})),t),Ae.isEnabled&&Wp(),d=t.apply(this,s)),{...o,name:f});if(Ae.isEnabled&&Ae(`[${f}] deps`,ms(I),{untrackedArgs:l}),a.set(l,I),!o.keepAlive){let E=wi(I,()=>{Ae.isEnabled&&Ae(`[${f}] dispose`,I),E(),a.delete(l),o.onCleanup&&o.onCleanup(d,...s),d=void 0})}return I.get()}}function mI(e){let t=0,r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("?r+=o+`
|
|
57
|
+
`+" ".repeat(++t):o===")"?r+=`
|
|
58
|
+
`+" ".repeat(--t)+o:o===","&&n===0?r+=o+`
|
|
59
|
+
`+" ".repeat(t):o==="{"&&n===0?(n++,r+=o+`
|
|
60
|
+
`+" ".repeat(t+1)):o==="}"&&n===1?(n--,r+=`
|
|
61
|
+
`+" ".repeat(t)+o):o==="{"&&n>0?(n++,r+=o):(o==="}"&&n>1&&n--,r+=o)}return r}function bI(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]instanceof ai){if(t[r]!==e[r])return!1}else if(!et.structural(e[r],t[r]))return!1;return!0}var{WARN:Zf,LOG:ZN,DEBUG:vI,VERBOSE:YN,ERROR:pn}=Ce.setup(Ce.INFO,{prefix:"[thread]"});function tn(e){return e.init!==void 0}var ai=class{constructor(e,t,r,n=[],i={}){this.name=e,this._applogs=n,this.parents=t===null?null:Ca(t),this.filters=r,ze(()=>this.parents?.length===0)&&Zf("[Thread] empty parents array",e),i.skipObservable||Ti(this,{applogsCids:Ze,applogsByCid:Ze,insert:Lt,size:Ze,isEmpty:Ze,firstLog:Ze,latestLog:Ze},{name:`Thread{${e}}`})}filters;parents;_subscribers=[];get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}insert(e){if(this.readOnly)throw pn("[Thread] insert() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw pn("[Thread] insert() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw pn("[Thread] insert() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insert(e)}insertRaw(e){if(this.readOnly)throw pn("[Thread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw pn("[Thread] insertRaw() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw pn("[Thread] insertRaw() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insertRaw(e)}subscribe(e){return this._subscribers.push(e),this.unsubscribe.bind(this,e)}unsubscribe(e){let t=this._subscribers.indexOf(e);t!==-1?this._subscribers.splice(t,1):Zf("unsubscribe called for non-existent",e)}notifySubscribers(e){vI(`[thread: ${this.name}] notifying`,this._subscribers.length,"subscribers of",{...e,subs:this._subscribers});for(let t of this._subscribers)t(e)}get applogs(){return this._applogs}get applogsCids(){return this._applogs.map(e=>e.cid)}map(e){return this.applogs.map(e)}get findLast(){return this.applogs.findLast.bind(this.applogs)}get findFirst(){return this.applogs.find.bind(this.applogs)}get firstLog(){return this.applogs[0]}get latestLog(){return this.applogs[this.applogs.length-1]}hasApplog(e,t){if(t)return this.applogs.includes(e);if(!e.cid)throw pn("[hasApplogs] applog without CID:",e);return this.hasApplogCid(e.cid)}hasApplogCid(e){return this.applogsCids.includes(e.toString())}get applogsByCid(){return new Map(this.applogs.map(e=>[e.cid,e]))}getApplog(e){return this.applogsByCid.get(e.toString())}hasApplogWithDiffTs(e){return this.applogs.find(t=>t.en===e.en&&t.at===e.at&&t.vl===e.vl&&t.ag===e.ag)}get isEmpty(){return this.size===0}get size(){return this.applogs.length}get length(){return this.applogs.length}get untrackedSize(){return ze(()=>this.size)}get nameAndSizeUntracked(){return ze(()=>`${this.name} (${this.size})`)}get prettyName(){return mI(this.name)}get hasParents(){return!!this.parents?.length}},wI=class Jh extends ai{static fromArray(t,r){return new Jh(r||"static",null,[],t)}constructor(t,r,n,i){super(t,r,n,i,{skipObservable:!0})}get readOnly(){return!0}},TI={};rh(TI,{code:()=>yy,decode:()=>ic,encode:()=>nc,format:()=>ld,name:()=>C$,parse:()=>U$,stringify:()=>ld});var _I=["string","number","bigint","symbol"],EI=["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 xI(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return _I.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":OI(e)?"Buffer":AI(e)||"Object"}function OI(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function AI(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(EI.includes(t))return t}var M=class{constructor(e,t,r){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=r}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}};M.uint=new M(0,"uint",!0);M.negint=new M(1,"negint",!0);M.bytes=new M(2,"bytes",!0);M.string=new M(3,"string",!0);M.array=new M(4,"array",!1);M.map=new M(5,"map",!1);M.tag=new M(6,"tag",!1);M.float=new M(7,"float",!0);M.false=new M(7,"false",!0);M.true=new M(7,"true",!0);M.null=new M(7,"null",!0);M.undefined=new M(7,"undefined",!0);M.break=new M(7,"break",!0);var ae=class{constructor(e,t,r){this.type=e,this.value=t,this.encodedLength=r,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},ji=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",SI=new TextDecoder,II=new TextEncoder;function Va(e){return ji&&globalThis.Buffer.isBuffer(e)}function Kl(e){return e instanceof Uint8Array?Va(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var kI=ji?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):ed(e,t,r):(e,t,r)=>r-t>64?SI.decode(e.subarray(t,r)):ed(e,t,r),Xh=ji?e=>e.length>64?globalThis.Buffer.from(e):Yf(e):e=>e.length>64?II.encode(e):Yf(e),ql=ji?(e,t,r)=>Va(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),$I=ji?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Kl(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},jI=ji?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function CI(e,t){if(Va(e)&&Va(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}function Yf(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 ed(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 Qh(n)}var td=4096;function Qh(e){let t=e.length;if(t<=td)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=td));return r}var NI=256,Zh=class{constructor(e=NI){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=jI(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=ql(r,0,this.cursor)}else t=$I(this.chunks,this.cursor);return e&&this.reset(),t}},Te="CBOR decode error:",mn="CBOR encode error:",Uo=[];Uo[23]=1;Uo[24]=2;Uo[25]=3;Uo[26]=5;Uo[27]=9;function Ci(e,t,r){if(e.length-t<r)throw new Error(`${Te} not enough data for type`)}var lt=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Dn(e,t,r){Ci(e,t,1);let n=e[t];if(r.strict===!0&&n<lt[0])throw new Error(`${Te} integer encoded in more bytes than necessary (strict decode)`);return n}function Rn(e,t,r){Ci(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<lt[1])throw new Error(`${Te} integer encoded in more bytes than necessary (strict decode)`);return n}function Mn(e,t,r){Ci(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<lt[2])throw new Error(`${Te} integer encoded in more bytes than necessary (strict decode)`);return n}function Ln(e,t,r){Ci(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<lt[3])throw new Error(`${Te} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${Te} integers outside of the safe integer range are not supported`)}function UI(e,t,r,n){return new ae(M.uint,Dn(e,t+1,n),2)}function PI(e,t,r,n){return new ae(M.uint,Rn(e,t+1,n),3)}function BI(e,t,r,n){return new ae(M.uint,Mn(e,t+1,n),5)}function DI(e,t,r,n){return new ae(M.uint,Ln(e,t+1,n),9)}function Vn(e,t){return Jt(e,0,t.value)}function Jt(e,t,r){if(r<lt[0]){let n=Number(r);e.push([t|n])}else if(r<lt[1]){let n=Number(r);e.push([t|24,n])}else if(r<lt[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<lt[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<lt[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,e.push(i)}else throw new Error(`${Te} encountered BigInt larger than allowable range`)}}Vn.encodedSize=function(e){return Jt.encodedSize(e.value)};Jt.encodedSize=function(e){return e<lt[0]?1:e<lt[1]?2:e<lt[2]?3:e<lt[3]?5:9};Vn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function RI(e,t,r,n){return new ae(M.negint,-1-Dn(e,t+1,n),2)}function MI(e,t,r,n){return new ae(M.negint,-1-Rn(e,t+1,n),3)}function LI(e,t,r,n){return new ae(M.negint,-1-Mn(e,t+1,n),5)}var Gl=BigInt(-1),Yh=BigInt(1);function VI(e,t,r,n){let i=Ln(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ae(M.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Te} integers outside of the safe integer range are not supported`);return new ae(M.negint,Gl-BigInt(i),9)}function Wl(e,t){let r=t.value,n=typeof r=="bigint"?r*Gl-Yh:r*-1-1;Jt(e,t.type.majorEncoded,n)}Wl.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*Gl-Yh:t*-1-1;return r<lt[0]?1:r<lt[1]?2:r<lt[2]?3:r<lt[3]?5:9};Wl.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Po(e,t,r,n){Ci(e,t,r+n);let i=ql(e,t+r,t+r+n);return new ae(M.bytes,i,r+n)}function FI(e,t,r,n){return Po(e,t,1,r)}function zI(e,t,r,n){return Po(e,t,2,Dn(e,t+1,n))}function KI(e,t,r,n){return Po(e,t,3,Rn(e,t+1,n))}function qI(e,t,r,n){return Po(e,t,5,Mn(e,t+1,n))}function GI(e,t,r,n){let i=Ln(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Te} 64-bit integer bytes lengths not supported`);return Po(e,t,9,i)}function Fa(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===M.string?Xh(e.value):e.value),e.encodedBytes}function Ss(e,t){let r=Fa(t);Jt(e,t.type.majorEncoded,r.length),e.push(r)}Ss.encodedSize=function(e){let t=Fa(e);return Jt.encodedSize(t.length)+t.length};Ss.compareTokens=function(e,t){return WI(Fa(e),Fa(t))};function WI(e,t){return e.length<t.length?-1:e.length>t.length?1:CI(e,t)}function Bo(e,t,r,n,i){let o=r+n;Ci(e,t,o);let a=new ae(M.string,kI(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=ql(e,t+r,t+o)),a}function HI(e,t,r,n){return Bo(e,t,1,r,n)}function JI(e,t,r,n){return Bo(e,t,2,Dn(e,t+1,n),n)}function XI(e,t,r,n){return Bo(e,t,3,Rn(e,t+1,n),n)}function QI(e,t,r,n){return Bo(e,t,5,Mn(e,t+1,n),n)}function ZI(e,t,r,n){let i=Ln(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Te} 64-bit integer string lengths not supported`);return Bo(e,t,9,i,n)}var YI=Ss;function Ni(e,t,r,n){return new ae(M.array,n,r)}function ek(e,t,r,n){return Ni(e,t,1,r)}function tk(e,t,r,n){return Ni(e,t,2,Dn(e,t+1,n))}function rk(e,t,r,n){return Ni(e,t,3,Rn(e,t+1,n))}function nk(e,t,r,n){return Ni(e,t,5,Mn(e,t+1,n))}function ik(e,t,r,n){let i=Ln(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Te} 64-bit integer array lengths not supported`);return Ni(e,t,9,i)}function ok(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Te} indefinite length items not allowed`);return Ni(e,t,1,1/0)}function Hl(e,t){Jt(e,M.array.majorEncoded,t.value)}Hl.compareTokens=Vn.compareTokens;Hl.encodedSize=function(e){return Jt.encodedSize(e.value)};function Ui(e,t,r,n){return new ae(M.map,n,r)}function ak(e,t,r,n){return Ui(e,t,1,r)}function sk(e,t,r,n){return Ui(e,t,2,Dn(e,t+1,n))}function uk(e,t,r,n){return Ui(e,t,3,Rn(e,t+1,n))}function lk(e,t,r,n){return Ui(e,t,5,Mn(e,t+1,n))}function ck(e,t,r,n){let i=Ln(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Te} 64-bit integer map lengths not supported`);return Ui(e,t,9,i)}function fk(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Te} indefinite length items not allowed`);return Ui(e,t,1,1/0)}function Jl(e,t){Jt(e,M.map.majorEncoded,t.value)}Jl.compareTokens=Vn.compareTokens;Jl.encodedSize=function(e){return Jt.encodedSize(e.value)};function dk(e,t,r,n){return new ae(M.tag,r,1)}function pk(e,t,r,n){return new ae(M.tag,Dn(e,t+1,n),2)}function hk(e,t,r,n){return new ae(M.tag,Rn(e,t+1,n),3)}function yk(e,t,r,n){return new ae(M.tag,Mn(e,t+1,n),5)}function gk(e,t,r,n){return new ae(M.tag,Ln(e,t+1,n),9)}function Xl(e,t){Jt(e,M.tag.majorEncoded,t.value)}Xl.compareTokens=Vn.compareTokens;Xl.encodedSize=function(e){return Jt.encodedSize(e.value)};var mk=20,bk=21,vk=22,wk=23;function Tk(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Te} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ae(M.null,null,1):new ae(M.undefined,void 0,1)}function _k(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Te} indefinite length items not allowed`);return new ae(M.break,void 0,1)}function Ql(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Te} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Te} Infinity values are not supported`)}return new ae(M.float,e,t)}function Ek(e,t,r,n){return Ql(Yl(e,t+1),3,n)}function xk(e,t,r,n){return Ql(ec(e,t+1),5,n)}function Ok(e,t,r,n){return Ql(ny(e,t+1),9,n)}function Zl(e,t,r){let n=t.value;if(n===!1)e.push([M.float.majorEncoded|mk]);else if(n===!0)e.push([M.float.majorEncoded|bk]);else if(n===null)e.push([M.float.majorEncoded|vk]);else if(n===void 0)e.push([M.float.majorEncoded|wk]);else{let i,o=!1;(!r||r.float64!==!0)&&(ty(n),i=Yl(er,1),n===i||Number.isNaN(n)?(er[0]=249,e.push(er.slice(0,3)),o=!0):(ry(n),i=ec(er,1),n===i&&(er[0]=250,e.push(er.slice(0,5)),o=!0))),o||(Ak(n),i=ny(er,1),er[0]=251,e.push(er.slice(0,9)))}}Zl.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){ty(r);let n=Yl(er,1);if(r===n||Number.isNaN(r))return 3;if(ry(r),n=ec(er,1),r===n)return 5}return 9};var ey=new ArrayBuffer(9),Nt=new DataView(ey,1),er=new Uint8Array(ey,0);function ty(e){if(e===1/0)Nt.setUint16(0,31744,!1);else if(e===-1/0)Nt.setUint16(0,64512,!1);else if(Number.isNaN(e))Nt.setUint16(0,32256,!1);else{Nt.setFloat32(0,e);let t=Nt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Nt.setUint16(0,31744,!1);else if(r===0)Nt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Nt.setUint16(0,0):i<-14?Nt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):Nt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Yl(e,t){if(e.length-t<2)throw new Error(`${Te} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function ry(e){Nt.setFloat32(0,e,!1)}function ec(e,t){if(e.length-t<4)throw new Error(`${Te} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function Ak(e){Nt.setFloat64(0,e,!1)}function ny(e,t){if(e.length-t<8)throw new Error(`${Te} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Zl.compareTokens=Vn.compareTokens;function Pe(e,t,r){throw new Error(`${Te} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Is(e){return()=>{throw new Error(`${Te} ${e}`)}}var ce=[];for(let e=0;e<=23;e++)ce[e]=Pe;ce[24]=UI;ce[25]=PI;ce[26]=BI;ce[27]=DI;ce[28]=Pe;ce[29]=Pe;ce[30]=Pe;ce[31]=Pe;for(let e=32;e<=55;e++)ce[e]=Pe;ce[56]=RI;ce[57]=MI;ce[58]=LI;ce[59]=VI;ce[60]=Pe;ce[61]=Pe;ce[62]=Pe;ce[63]=Pe;for(let e=64;e<=87;e++)ce[e]=FI;ce[88]=zI;ce[89]=KI;ce[90]=qI;ce[91]=GI;ce[92]=Pe;ce[93]=Pe;ce[94]=Pe;ce[95]=Is("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ce[e]=HI;ce[120]=JI;ce[121]=XI;ce[122]=QI;ce[123]=ZI;ce[124]=Pe;ce[125]=Pe;ce[126]=Pe;ce[127]=Is("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ce[e]=ek;ce[152]=tk;ce[153]=rk;ce[154]=nk;ce[155]=ik;ce[156]=Pe;ce[157]=Pe;ce[158]=Pe;ce[159]=ok;for(let e=160;e<=183;e++)ce[e]=ak;ce[184]=sk;ce[185]=uk;ce[186]=lk;ce[187]=ck;ce[188]=Pe;ce[189]=Pe;ce[190]=Pe;ce[191]=fk;for(let e=192;e<=215;e++)ce[e]=dk;ce[216]=pk;ce[217]=hk;ce[218]=yk;ce[219]=gk;ce[220]=Pe;ce[221]=Pe;ce[222]=Pe;ce[223]=Pe;for(let e=224;e<=243;e++)ce[e]=Is("simple values are not supported");ce[244]=Pe;ce[245]=Pe;ce[246]=Pe;ce[247]=Tk;ce[248]=Is("simple values are not supported");ce[249]=Ek;ce[250]=xk;ce[251]=Ok;ce[252]=Pe;ce[253]=Pe;ce[254]=Pe;ce[255]=_k;var vr=[];for(let e=0;e<24;e++)vr[e]=new ae(M.uint,e,1);for(let e=-1;e>=-24;e--)vr[31-e]=new ae(M.negint,e,1);vr[64]=new ae(M.bytes,new Uint8Array(0),1);vr[96]=new ae(M.string,"",1);vr[128]=new ae(M.array,0,1);vr[160]=new ae(M.map,0,1);vr[244]=new ae(M.false,!1,1);vr[245]=new ae(M.true,!0,1);vr[246]=new ae(M.null,null,1);function Sk(){let e=[];return e[M.uint.major]=Vn,e[M.negint.major]=Wl,e[M.bytes.major]=Ss,e[M.string.major]=YI,e[M.array.major]=Hl,e[M.map.major]=Jl,e[M.tag.major]=Xl,e[M.float.major]=Zl,e}var eU=Sk(),iu=new Zh,rd=class iy{constructor(t,r){this.obj=t,this.parent=r}includes(t){let r=this;do if(r.obj===t)return!0;while(r=r.parent);return!1}static createCheck(t,r){if(t&&t.includes(r))throw new Error(`${mn} object contains circular references`);return new iy(r,t)}},Lr={null:new ae(M.null,null),undefined:new ae(M.undefined,void 0),true:new ae(M.true,!0),false:new ae(M.false,!1),emptyArray:new ae(M.array,0),emptyMap:new ae(M.map,0)},rn={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ae(M.float,e):e>=0?new ae(M.uint,e):new ae(M.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ae(M.uint,e):new ae(M.negint,e)},Uint8Array(e,t,r,n){return new ae(M.bytes,e)},string(e,t,r,n){return new ae(M.string,e)},boolean(e,t,r,n){return e?Lr.true:Lr.false},null(e,t,r,n){return Lr.null},undefined(e,t,r,n){return Lr.undefined},ArrayBuffer(e,t,r,n){return new ae(M.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ae(M.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Lr.emptyArray,new ae(M.break)]:Lr.emptyArray;n=rd.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=na(a,r,n);return r.addBreakTokens?[new ae(M.array,e.length),i,new ae(M.break)]:[new ae(M.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length;if(!a)return r.addBreakTokens===!0?[Lr.emptyMap,new ae(M.break)]:Lr.emptyMap;n=rd.createCheck(n,e);let s=[],u=0;for(let l of o)s[u++]=[na(l,r,n),na(i?e.get(l):e[l],r,n)];return Ik(s,r),r.addBreakTokens?[new ae(M.map,a),s,new ae(M.break)]:[new ae(M.map,a),s]}};rn.Map=rn.Object;rn.Buffer=rn.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))rn[`${e}Array`]=rn.DataView;function na(e,t={},r){let n=xI(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||rn[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=rn[n];if(!o)throw new Error(`${mn} unsupported type: ${n}`);return o(e,n,t,r)}function Ik(e,t){t.mapSorter&&e.sort(t.mapSorter)}function oy(e,t,r,n){if(Array.isArray(t))for(let i of t)oy(e,i,r,n);else r[t.type.major](e,t,n)}function kk(e,t,r){let n=na(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let i=r.quickEncodeToken(n);if(i)return i;let o=t[n.type.major];if(o.encodedSize){let a=o.encodedSize(n,r),s=new Zh(a);if(o(s,n,r),s.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return Kl(s.chunks[0])}}return iu.reset(),oy(iu,n,t,r),iu.toBytes(!0)}var $k={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},jk=class{constructor(e,t={}){this._pos=0,this.data=e,this.options=t}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let e=this.data[this._pos],t=vr[e];if(t===void 0){let r=ce[e];if(!r)throw new Error(`${Te} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let n=e&31;t=r(this.data,this._pos,n,this.options)}return this._pos+=t.encodedLength,t}},ho=Symbol.for("DONE"),ks=Symbol.for("BREAK");function Ck(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=yo(t,r);if(o===ks){if(e.value===1/0)break;throw new Error(`${Te} got unexpected break to lengthed array`)}if(o===ho)throw new Error(`${Te} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function Nk(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},o=n?new Map:void 0;for(let a=0;a<e.value;a++){let s=yo(t,r);if(s===ks){if(e.value===1/0)break;throw new Error(`${Te} got unexpected break to lengthed map`)}if(s===ho)throw new Error(`${Te} found map but not enough entries (got ${a} [no key], expected ${e.value})`);if(n!==!0&&typeof s!="string")throw new Error(`${Te} non-string keys not supported (got ${typeof s})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(s)||!n&&s in i))throw new Error(`${Te} found repeat map key "${s}"`);let u=yo(t,r);if(u===ho)throw new Error(`${Te} found map but not enough entries (got ${a} [no value], expected ${e.value})`);n?o.set(s,u):i[s]=u}return n?o:i}function yo(e,t){if(e.done())return ho;let r=e.next();if(r.type===M.break)return ks;if(r.type.terminal)return r.value;if(r.type===M.array)return Ck(r,e,t);if(r.type===M.map)return Nk(r,e,t);if(r.type===M.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=yo(e,t);return t.tags[r.value](n)}throw new Error(`${Te} tag not supported (${r.value})`)}throw new Error("unsupported")}function Uk(e,t){if(!(e instanceof Uint8Array))throw new Error(`${Te} data to decode must be a Uint8Array`);t=Object.assign({},$k,t);let r=t.tokenizer||new jk(e,t),n=yo(r,t);if(n===ho)throw new Error(`${Te} did not find any content to decode`);if(n===ks)throw new Error(`${Te} got unexpected break`);return[n,e.subarray(r.pos())]}function Pk(e,t){let[r,n]=Uk(e,t);if(n.length>0)throw new Error(`${Te} too many terminals, data makes no sense`);return r}var Bk=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(t.type===M.array&&(t.elements++,t.elements!==1&&e.push([44])),t.type===M.map&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[M.uint.major](e,t){this.prefix(e);let r=String(t.value),n=[];for(let i=0;i<r.length;i++)n[i]=r.charCodeAt(i);e.push(n)}[M.negint.major](e,t){this[M.uint.major](e,t)}[M.bytes.major](e,t){throw new Error(`${mn} unsupported type: Uint8Array`)}[M.string.major](e,t){this.prefix(e);let r=Xh(JSON.stringify(t.value));e.push(r.length>32?Kl(r):r)}[M.array.major](e,t){this.prefix(e),this.inRecursive.push({type:M.array,elements:0}),e.push([91])}[M.map.major](e,t){this.prefix(e),this.inRecursive.push({type:M.map,elements:0}),e.push([123])}[M.tag.major](e,t){}[M.float.major](e,t){if(t.type.name==="break"){let o=this.inRecursive.pop();if(o){if(o.type===M.array)e.push([93]);else if(o.type===M.map)e.push([125]);else throw new Error("Unexpected recursive type; this should not happen!");return}throw new Error("Unexpected break; this should not happen!")}if(t.value===void 0)throw new Error(`${mn} unsupported type: undefined`);if(this.prefix(e),t.type.name==="true"){e.push([116,114,117,101]);return}else if(t.type.name==="false"){e.push([102,97,108,115,101]);return}else if(t.type.name==="null"){e.push([110,117,108,108]);return}let r=String(t.value),n=[],i=!1;for(let o=0;o<r.length;o++)n[o]=r.charCodeAt(o),!i&&(n[o]===46||n[o]===101||n[o]===69)&&(i=!0);i||(n.push(46),n.push(48)),e.push(n)}};function Dk(e,t){if(Array.isArray(e[0])||Array.isArray(t[0]))throw new Error(`${mn} complex map keys are not supported`);let r=e[0],n=t[0];if(r.type!==M.string||n.type!==M.string)throw new Error(`${mn} non-string map keys are not supported`);if(r<n)return-1;if(r>n)return 1;throw new Error(`${mn} unexpected duplicate map keys, this is not supported`)}var Rk={addBreakTokens:!0,mapSorter:Dk};function Mk(e,t){return t=Object.assign({},Rk,t),kk(e,new Bk,t)}var ay=class{constructor(e,t={}){this._pos=0,this.data=e,this.options=t,this.modeStack=["value"],this.lastToken=""}pos(){return this._pos}done(){return this._pos>=this.data.length}ch(){return this.data[this._pos]}currentMode(){return this.modeStack[this.modeStack.length-1]}skipWhitespace(){let e=this.ch();for(;e===32||e===9||e===13||e===10;)e=this.data[++this._pos]}expect(e){if(this.data.length-this._pos<e.length)throw new Error(`${Te} unexpected end of input at position ${this._pos}`);for(let t=0;t<e.length;t++)if(this.data[this._pos++]!==e[t])throw new Error(`${Te} unexpected token at position ${this._pos}, expected to find '${String.fromCharCode(...e)}'`)}parseNumber(){let e=this._pos,t=!1,r=!1,n=a=>{for(;!this.done();){let s=this.ch();if(a.includes(s))this._pos++;else break}};if(this.ch()===45&&(t=!0,this._pos++),this.ch()===48)if(this._pos++,this.ch()===46)this._pos++,r=!0;else return new ae(M.uint,0,this._pos-e);if(n([48,49,50,51,52,53,54,55,56,57]),t&&this._pos===e+1)throw new Error(`${Te} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(r)throw new Error(`${Te} unexpected token at position ${this._pos}`);r=!0,this._pos++,n([48,49,50,51,52,53,54,55,56,57])}!this.done()&&(this.ch()===101||this.ch()===69)&&(r=!0,this._pos++,!this.done()&&(this.ch()===43||this.ch()===45)&&this._pos++,n([48,49,50,51,52,53,54,55,56,57]));let i=String.fromCharCode.apply(null,this.data.subarray(e,this._pos)),o=parseFloat(i);return r?new ae(M.float,o,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(o)?new ae(o>=0?M.uint:M.negint,o,this._pos-e):new ae(o>=0?M.uint:M.negint,BigInt(i),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${Te} unexpected character at position ${this._pos}; this shouldn't happen`);this._pos++;for(let i=this._pos,o=0;i<this.data.length&&o<65536;i++,o++){let a=this.data[i];if(a===92||a<32||a>=128)break;if(a===34){let s=String.fromCharCode.apply(null,this.data.subarray(this._pos,i));return this._pos=i+1,new ae(M.string,s,o)}}let e=this._pos,t=[],r=()=>{if(this._pos+4>=this.data.length)throw new Error(`${Te} unexpected end of unicode escape sequence at position ${this._pos}`);let i=0;for(let o=0;o<4;o++){let a=this.ch();if(a>=48&&a<=57)a-=48;else if(a>=97&&a<=102)a=a-97+10;else if(a>=65&&a<=70)a=a-65+10;else throw new Error(`${Te} unexpected unicode escape character at position ${this._pos}`);i=i*16+a,this._pos++}return i},n=()=>{let i=this.ch(),o=null,a=i>239?4:i>223?3:i>191?2:1;if(this._pos+a>this.data.length)throw new Error(`${Te} unexpected unicode sequence at position ${this._pos}`);let s,u,l,f;switch(a){case 1:i<128&&(o=i);break;case 2:s=this.data[this._pos+1],(s&192)===128&&(f=(i&31)<<6|s&63,f>127&&(o=f));break;case 3:s=this.data[this._pos+1],u=this.data[this._pos+2],(s&192)===128&&(u&192)===128&&(f=(i&15)<<12|(s&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:s=this.data[this._pos+1],u=this.data[this._pos+2],l=this.data[this._pos+3],(s&192)===128&&(u&192)===128&&(l&192)===128&&(f=(i&15)<<18|(s&63)<<12|(u&63)<<6|l&63,f>65535&&f<1114112&&(o=f))}o===null?(o=65533,a=1):o>65535&&(o-=65536,t.push(o>>>10&1023|55296),o=56320|o&1023),t.push(o),this._pos+=a};for(;!this.done();){let i=this.ch(),o;switch(i){case 92:if(this._pos++,this.done())throw new Error(`${Te} unexpected string termination at position ${this._pos}`);switch(o=this.ch(),this._pos++,o){case 34:case 39:case 92:case 47:t.push(o);break;case 98:t.push(8);break;case 116:t.push(9);break;case 110:t.push(10);break;case 102:t.push(12);break;case 114:t.push(13);break;case 117:t.push(r());break;default:throw new Error(`${Te} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new ae(M.string,Qh(t),this._pos-e);default:if(i<32)throw new Error(`${Te} invalid control character at position ${this._pos}`);i<128?(t.push(i),this._pos++):n()}}throw new Error(`${Te} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new ae(M.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new ae(M.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new ae(M.null,null,4);case 102:return this.expect([102,97,108,115,101]),new ae(M.false,!1,5);case 116:return this.expect([116,114,117,101]),new ae(M.true,!0,4);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.parseNumber();default:throw new Error(`${Te} unexpected character at position ${this._pos}`)}}next(){switch(this.skipWhitespace(),this.currentMode()){case"value":return this.modeStack.pop(),this.parseValue();case"array-value":{if(this.modeStack.pop(),this.ch()===93)return this._pos++,this.skipWhitespace(),new ae(M.break,void 0,1);if(this.ch()!==44)throw new Error(`${Te} unexpected character at position ${this._pos}, was expecting array delimiter but found '${String.fromCharCode(this.ch())}'`);return this._pos++,this.modeStack.push("array-value"),this.skipWhitespace(),this.parseValue()}case"array-start":return this.modeStack.pop(),this.ch()===93?(this._pos++,this.skipWhitespace(),new ae(M.break,void 0,1)):(this.modeStack.push("array-value"),this.skipWhitespace(),this.parseValue());case"obj-key":if(this.ch()===125)return this.modeStack.pop(),this._pos++,this.skipWhitespace(),new ae(M.break,void 0,1);if(this.ch()!==44)throw new Error(`${Te} unexpected character at position ${this._pos}, was expecting object delimiter but found '${String.fromCharCode(this.ch())}'`);this._pos++,this.skipWhitespace();case"obj-start":{if(this.modeStack.pop(),this.ch()===125)return this._pos++,this.skipWhitespace(),new ae(M.break,void 0,1);let e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${Te} unexpected character at position ${this._pos}, was expecting key/value delimiter ':' but found '${String.fromCharCode(this.ch())}'`);return this._pos++,this.modeStack.push("obj-value"),e}case"obj-value":return this.modeStack.pop(),this.modeStack.push("obj-key"),this.skipWhitespace(),this.parseValue();default:throw new Error(`${Te} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}};function Lk(e,t){return t=Object.assign({tokenizer:new ay(e,t)},t),Pk(e,t)}var tU=new Uint8Array(0);function Vk(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 tc(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 Fk(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(_){if(_ instanceof Uint8Array||(ArrayBuffer.isView(_)?_=new Uint8Array(_.buffer,_.byteOffset,_.byteLength):Array.isArray(_)&&(_=Uint8Array.from(_))),!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(_.length===0)return"";for(var L=0,J=0,B=0,k=_.length;B!==k&&_[B]===0;)B++,L++;for(var F=(k-B)*f+1>>>0,q=new Uint8Array(F);B!==k;){for(var D=_[B],Q=0,K=F-1;(D!==0||Q<J)&&K!==-1;K--,Q++)D+=256*q[K]>>>0,q[K]=D%s>>>0,D=D/s>>>0;if(D!==0)throw new Error("Non-zero carry");J=Q,B++}for(var re=F-J;re!==F&&q[re]===0;)re++;for(var $=u.repeat(L);re<F;++re)$+=e.charAt(q[re]);return $}function I(_){if(typeof _!="string")throw new TypeError("Expected String");if(_.length===0)return new Uint8Array;var L=0;if(_[L]!==" "){for(var J=0,B=0;_[L]===u;)J++,L++;for(var k=(_.length-L)*l+1>>>0,F=new Uint8Array(k);_[L];){var q=r[_.charCodeAt(L)];if(q===255)return;for(var D=0,Q=k-1;(q!==0||D<B)&&Q!==-1;Q--,D++)q+=s*F[Q]>>>0,F[Q]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");B=D,L++}if(_[L]!==" "){for(var K=k-B;K!==k&&F[K]===0;)K++;for(var re=new Uint8Array(J+(k-K)),$=J;K!==k;)re[$++]=F[K++];return re}}}function E(_){var L=I(_);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:I,decode:E}}var zk=Fk,Kk=zk,qk=Kk,Gk=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")}},Wk=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 sy(this,e)}},Hk=class{decoders;constructor(e){this.decoders=e}or(e){return sy(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 sy(e,t){return new Hk({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Jk=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 Gk(e,t,r),this.decoder=new Wk(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function uy({name:e,prefix:t,encode:r,decode:n}){return new Jk(e,t,r,n)}function $s({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=qk(r,e);return uy({prefix:t,name:e,encode:n,decode:o=>tc(i(o))})}function Xk(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 Qk(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 Zk(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function kt({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=Zk(n);return uy({prefix:t,name:e,encode(o){return Qk(o,n,r)},decode(o){return Xk(o,i,r,e)}})}var ia=kt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),rU=kt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),nU=kt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),iU=kt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),oU=kt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),aU=kt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),sU=kt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),uU=kt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),lU=kt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),oa=$s({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),cU=$s({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Gr=$s({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),fU=$s({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),ly={};rh(ly,{Digest:()=>js,create:()=>rc,decode:()=>fy,equals:()=>dy,hasCode:()=>m$});var Yk=cy,nd=128,e$=127,t$=~e$,r$=Math.pow(2,31);function cy(e,t,r){t=t||[],r=r||0;for(var n=r;e>=r$;)t[r++]=e&255|nd,e/=128;for(;e&t$;)t[r++]=e&255|nd,e>>>=7;return t[r]=e|0,cy.bytes=r-n+1,t}var n$=Nu,i$=128,id=127;function Nu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Nu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&id)<<i:(a&id)*Math.pow(2,i),i+=7}while(a>=i$);return Nu.bytes=o-n,r}var o$=Math.pow(2,7),a$=Math.pow(2,14),s$=Math.pow(2,21),u$=Math.pow(2,28),l$=Math.pow(2,35),c$=Math.pow(2,42),f$=Math.pow(2,49),d$=Math.pow(2,56),p$=Math.pow(2,63),h$=function(e){return e<o$?1:e<a$?2:e<s$?3:e<u$?4:e<l$?5:e<c$?6:e<f$?7:e<d$?8:e<p$?9:10},y$={encode:Yk,decode:n$,encodingLength:h$},g$=y$,za=g$;function Uu(e,t=0){return[za.decode(e,t),za.decode.bytes]}function Ka(e,t,r=0){return za.encode(e,t,r),t}function qa(e){return za.encodingLength(e)}function rc(e,t){let r=t.byteLength,n=qa(e),i=n+qa(r),o=new Uint8Array(i+r);return Ka(e,o,0),Ka(r,o,n),o.set(t,i),new js(e,r,t,o)}function fy(e){let t=tc(e),[r,n]=Uu(t),[i,o]=Uu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new js(r,i,a,t)}function dy(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Vk(e.bytes,r.bytes)}}var js=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function m$(e,t){return e.code===t}function od(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return v$(r,Pu(e),t??Gr.encoder);default:return w$(r,Pu(e),t??ia.encoder)}}var ad=new WeakMap;function Pu(e){let t=ad.get(e);if(t==null){let r=new Map;return ad.set(e,r),r}return t}var zt=class yt{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==qi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==T$)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return yt.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=rc(t,r);return yt.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return yt.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&dy(t.multihash,n.multihash)}toString(t){return od(this,t)}toJSON(){return{"/":od(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof yt)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new yt(n,i,o,a??sd(n,i,o.bytes))}else if(r[_$]===!0){let{version:n,multihash:i,code:o}=r,a=fy(i);return yt.create(n,o,a)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==qi)throw new Error(`Version 0 CID must use dag-pb (code: ${qi}) block encoding`);return new yt(t,r,n,n.bytes)}case 1:{let i=sd(t,r,n.bytes);return new yt(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return yt.create(0,qi,t)}static createV1(t,r){return yt.create(1,t,r)}static decode(t){let[r,n]=yt.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=yt.inspectBytes(t),n=r.size-r.multihashSize,i=tc(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 js(r.multihashCode,r.digestSize,o,i);return[r.version===0?yt.createV0(a):yt.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,I]=Uu(t.subarray(r));return r+=I,d},i=n(),o=qi;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=b$(t,r),o=yt.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Pu(o).set(n,t),o}};function b$(e,t){switch(e[0]){case"Q":{let r=t??Gr;return[Gr.prefix,r.decode(`${Gr.prefix}${e}`)]}case Gr.prefix:{let r=t??Gr;return[Gr.prefix,r.decode(e)]}case ia.prefix:{let r=t??ia;return[ia.prefix,r.decode(e)]}case oa.prefix:{let r=t??oa;return[oa.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function v$(e,t,r){let{prefix:n}=r;if(n!==Gr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function w$(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var qi=112,T$=18;function sd(e,t,r){let n=qa(e),i=n+qa(t),o=new Uint8Array(i+r.byteLength);return Ka(e,o,0),Ka(t,o,n),o.set(r,i),o}var _$=Symbol.for("@ipld/js-cid/CID"),E$=20;function py({name:e,code:t,encode:r,minDigestLength:n,maxDigestLength:i}){return new x$(e,t,r,n,i)}var x$=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,r,n,i){this.name=e,this.code=t,this.encode=r,this.minDigestLength=n??E$,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?ud(r,this.code,t?.truncate):r.then(n=>ud(n,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};function ud(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 rc(t,e)}var hy=kt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),dU=kt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),pU=kt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),hU=kt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function O$(e){return e instanceof ArrayBuffer?new Uint8Array(e,0,e.byteLength):e}function A$(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=zt.asCID(e);if(!t)return null;let r=t.toString();return[new ae(M.map,1/0,1),new ae(M.string,"/",1),new ae(M.string,r,r.length),new ae(M.break,void 0,1)]}function Ga(e){let t=hy.encode(e).slice(1);return[new ae(M.map,1/0,1),new ae(M.string,"/",1),new ae(M.map,1/0,1),new ae(M.string,"bytes",5),new ae(M.string,t,t.length),new ae(M.break,void 0,1),new ae(M.break,void 0,1)]}function Qt(e){return Ga(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function S$(e){return Ga(new Uint8Array(e))}function I$(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function k$(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 $$={typeEncoders:{Object:A$,Buffer:Ga,Uint8Array:Ga,Int8Array:Qt,Uint16Array:Qt,Int16Array:Qt,Uint32Array:Qt,Int32Array:Qt,Float32Array:Qt,Float64Array:Qt,Uint8ClampedArray:Qt,BigInt64Array:Qt,BigUint64Array:Qt,DataView:Qt,ArrayBuffer:S$,undefined:I$,number:k$}},j$=class extends ay{constructor(e,t){super(e,t),this.tokenBuffer=[]}done(){return this.tokenBuffer.length===0&&super.done()}_next(){return this.tokenBuffer.length>0?this.tokenBuffer.pop():super.next()}next(){let e=this._next();if(e.type===M.map){let t=this._next();if(t.type===M.string&&t.value==="/"){let r=this._next();if(r.type===M.string){if(this._next().type!==M.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new ae(M.tag,42,0)}if(r.type===M.map){let n=this._next();if(n.type===M.string&&n.value==="bytes"){let i=this._next();if(i.type===M.string){for(let a=0;a<2;a++)if(this._next().type!==M.break)throw new Error("Invalid encoded Bytes form");let o=hy.decode(`m${i.value}`);return new ae(M.bytes,o,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(n)}this.tokenBuffer.push(r)}this.tokenBuffer.push(t)}return e}},Bu={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Bu.tags[42]=zt.parse;var C$="dag-json",yy=297,nc=e=>Mk(e,$$),ic=e=>{let t=O$(e),r=Object.assign(Bu,{tokenizer:new j$(t,Bu)});return Lk(t,r)},ld=e=>N$.decode(nc(e)),N$=new TextDecoder,U$=e=>ic(P$.encode(e)),P$=new TextEncoder;function B$(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function gy(e,t,r=""){let n=B$(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 cd(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 D$(e,t){gy(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw new Error('"digestInto() output" expected to be of length >='+r)}function Du(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ou(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function fr(e,t){return e<<32-t|e>>>t}function R$(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 M$=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function L$(e,t,r){return e&t^~e&r}function V$(e,t,r){return e&t^e&r^t&r}var F$=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=ou(this.buffer)}update(e){cd(this),gy(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=ou(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){cd(this),D$(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:o}=this;t[o++]=128,Du(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let f=o;f<n;f++)t[f]=0;r.setBigUint64(n-8,BigInt(this.length*8),i),this.process(r,0);let a=ou(e),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let u=s/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)a.setUint32(4*f,l[f],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:a}=this;return e.destroyed=o,e.finished=i,e.length=n,e.pos=a,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}},Vr=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),z$=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Fr=new Uint32Array(64),K$=class extends F${constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:r,D:n,E:i,F:o,G:a,H:s}=this;return[e,t,r,n,i,o,a,s]}set(e,t,r,n,i,o,a,s){this.A=e|0,this.B=t|0,this.C=r|0,this.D=n|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=s|0}process(e,t){for(let f=0;f<16;f++,t+=4)Fr[f]=e.getUint32(t,!1);for(let f=16;f<64;f++){let d=Fr[f-15],I=Fr[f-2],E=fr(d,7)^fr(d,18)^d>>>3,_=fr(I,17)^fr(I,19)^I>>>10;Fr[f]=_+Fr[f-7]+E+Fr[f-16]|0}let{A:r,B:n,C:i,D:o,E:a,F:s,G:u,H:l}=this;for(let f=0;f<64;f++){let d=fr(a,6)^fr(a,11)^fr(a,25),I=l+d+L$(a,s,u)+z$[f]+Fr[f]|0,E=(fr(r,2)^fr(r,13)^fr(r,22))+V$(r,n,i)|0;l=u,u=s,s=a,a=o+I|0,o=i,i=n,n=r,r=I+E|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,n,i,o,a,s,u,l)}roundClean(){Du(Fr)}destroy(){this.set(0,0,0,0,0,0,0,0),Du(this.buffer)}},q$=class extends K${A=Vr[0]|0;B=Vr[1]|0;C=Vr[2]|0;D=Vr[3]|0;E=Vr[4]|0;F=Vr[5]|0;G=Vr[6]|0;H=Vr[7]|0;constructor(){super(32)}},G$=R$(()=>new q$,M$(1)),ot=Nr(sn(),1),my=Nr(a2(),1),fd=e=>ot.Type.Union([e,ot.Type.Null()]),by=/^(k51qz|baguq)[0-9a-z]{56,57}$/,W$=/^[0-9A-Fa-f]{7,8}$/g;ot.FormatRegistry.Set("EntityID",e=>!!e.match(W$)||!!e.match(by));var H$=ot.Type.String(),Ru=e=>e?.enc instanceof Uint8Array;ot.FormatRegistry.Set("CID",e=>!!e.match(by));var vy=ot.Type.String({format:"CID"}),J$=/^http([s]?):\/\/.*\..*/;ot.FormatRegistry.Set("URL",e=>!!e.match(J$));var yU=ot.Type.String({format:"URL"}),wy=ot.Type.Object({en:H$,at:ot.Type.String(),vl:fd(ot.Type.Union([ot.Type.String(),ot.Type.Boolean(),ot.Type.Number()])),ts:ot.Type.String(),ag:ot.Type.String(),pv:fd(vy)}),dd=my.TypeCompiler.Compile(wy),gU=dd.Check.bind(dd),X$=ot.Type.Composite([ot.Type.Object({cid:vy}),wy]),Mu=my.TypeCompiler.Compile(X$),Q$=e=>Array.from(Mu.Errors(e)),Ty=Mu.Check.bind(Mu);function _y(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var Z$=py({name:"sha2-256",code:18,encode:_y("SHA-256")}),mU=py({name:"sha2-512",code:19,encode:_y("SHA-512")}),{WARN:pd,LOG:bU,DEBUG:Y$,VERBOSE:Wa,ERROR:ej}=Ce.setup(Ce.INFO),tj=114;function rj(e,t=["cid"]){if(!e)throw ej("falsy log",e);let r=e.cid;if(Ru(e))return r||(r=oc(Ey(e).bytes).toString()),pd("preparing an encrypted applog - really?"),{log:e,cid:r};let n={};for(let[i,o]of Object.entries(e))o===void 0&&(pd(`log.${i} is undefined, which is not allowed - encoding as null`,e),o=null),t.includes(i)?Wa("excluding app log",{key:i,val:o}):n[i]=o;return{log:n,cid:r}}function nj(e){return oc(ij(e).bytes)}function ij(e){return Ey(rj(e)?.log)}function oc(e){let t=G$(e),r=ly.create(Z$.code,t),n=zt.create(1,yy,r);return Wa("[getCidSync]",{bytes:e,hash:t,digest:r,cid:n}),n}function Ey(e){Y$("[encodeBlock]",e);let t=nc(e);return{bytes:t,cid:oc(t)}}function oj(e){let t=null,r=[];try{t=zt.parse(e)}catch(n){Wa("[retrieveThread] couldn't parse pubID with default base"),r.push(n)}if(!t)try{t=zt.parse(e,oa)}catch(n){Wa("[retrieveThread] couldn't parse pubID with base36"),r.push(n)}return{cid:t,errors:t?null:r,isIpns:t&&ac(t)}}function ac(e){return e.code===tj}function Lu(e){return typeof e=="string"?zt.parse(e):typeof e.toV1!="function"?zt.decode(e.bytes):e}function xy(e,t){if(!e||!t)throw new Error(`[areCidsEqual] invalid params: ${e}, ${t}`);if(e===t)return!0;let r=Lu(e),n=Lu(t);return r.toV1().toString()===n.toV1().toString()}function hd(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 aj(e,t){let r=hd(e),n=hd(t);return+r<+n}var{WARN:vU,LOG:wU,DEBUG:TU,VERBOSE:sj,ERROR:yd}=Ce.setup(Ce.INFO),uj=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),Oy=(e,t,r)=>et.structural(Xf(t,e),Xf(r,e)),lj=(e,t,r="asc")=>uj(e.ts,t.ts,r),_U=ZS(Oy,["en","at"]);function go(e,t="asc"){return e.sort((r,n)=>lj(r,n,t))}var cj=(e,t)=>aj(new Date(e.ts),new Date(t.ts)),Ay=e=>{let t=new Map;for(let r of e){if(!r)throw yd("falsy entry in applogs",e),new Error("falsy entry in applogs");if(!r.cid)throw yd("applog with missing CID",r),new Error("applog with missing CID");let n=r.cid;t.has(n)?sj("Skipping duplicate applog:",[t.get(n),r]):t.set(n,r)}return Array.from(t.values())};function fj(e){return typeof e=="string"&&e.startsWith("?")}function dj(e){return e.slice(1)}function Sy(e,t){let r={},n={};for(let[i,o]of Object.entries(e))if(fj(o)){let a=dj(o),s=t[a];s?n[i]=s:r[i]=a}else n[i]=o;return[n,r]}function pj(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 Iy=function(e){for(var t=0,r=0,n=e.length;r<n;r++)t+=e[r];return t},gd=function(e){return Iy(e)/e.length},Ut={max:function(e){return Math.max.apply(null,e)},min:function(e){return Math.min.apply(null,e)},range:function(e){return Ut.max(e)-Ut.min(e)},midrange:function(e){return Ut.range(e)/2},sum:Iy,mean:gd,average:gd,median:function(e){e.sort(function(r,n){return r-n});var t=e.length/2;return t%1?e[t-.5]:(e[t-1]+e[t])/2},modes:function(e){if(!e.length)return[];var t={},r=0,n=[];return e.forEach(function(i){t[i]?t[i]++:t[i]=1,t[i]>r?(n=[i],r=t[i]):t[i]===r&&(n.push(i),r=t[i])}),n},variance:function(e){var t=Ut.mean(e);return Ut.mean(e.map(function(r){return Math.pow(r-t,2)}))},standardDeviation:function(e){return Math.sqrt(Ut.variance(e))},meanAbsoluteDeviation:function(e){var t=Ut.mean(e);return Ut.mean(e.map(function(r){return Math.abs(r-t)}))},zScores:function(e){var t=Ut.mean(e),r=Ut.standardDeviation(e);return e.map(function(n){return(n-t)/r})}};Ut.average=Ut.mean;function ky(){return new Date().toISOString()}var{WARN:hj,LOG:EU,DEBUG:Qe,VERBOSE:xU,ERROR:Ha}=Ce.setup(Ce.INFO);function yj(e,t){Qe(`[ensureTsPvAndFinalizeApplogs] ENTER - ${e.length} applogs, thread size=${t.size}`);let r=ky(),n=t;Qe("[ensureTsPvAndFinalizeApplogs] About to map over applogs");let i=e.map((o,a)=>{Qe(`[ensureTsPvAndFinalizeApplogs] Processing applog ${a+1}/${e.length}`);let s=gj(o,{ts:r,threadForPv:n});return Qe(`[ensureTsPvAndFinalizeApplogs] Finalized applog ${a+1}/${e.length}`),s});return Qe(`[ensureTsPvAndFinalizeApplogs] EXIT - mapped ${i.length} applogs`),i}function gj(e,{ts:t,threadForPv:r}={}){Qe(`[finalizeApplogForInsert] ENTER - en=${e.en}, at=${e.at}`),Qe("[finalizeApplogForInsert] About to call withTs");let n=vj(e,t??ky());Qe(`[finalizeApplogForInsert] About to call withPvFrom (thread size=${r?.size??"null"})`);let i=wj(n,r);Qe("[finalizeApplogForInsert] About to call encodeApplogAndGetCid");let o=nj(i).toString();Qe(`[finalizeApplogForInsert] CID created: ${o}`),e.cid&&e.cid!==o&&hj("[finalizeApplogForInsert] overwriting wrong CID",{log:e,cid:o,logWithPv:i});let a={...i,cid:o};if(Qe("[finalizeApplogForInsert] About to validate applog"),!Ty(a))throw Ha(`Bogus Applog ${JSON.stringify(a)}`,Q$(a));return Qe(`[finalizeApplogForInsert] EXIT - CID=${o}`),Object.freeze(a)}function mj(e){return!!e.ts}function bj(e){return!!e.pv}function vj(e,t){return mj(e)?e:{...e,ts:t}}function wj(e,t){if(Qe(`[withPvFrom] ENTER - en=${e.en}, at=${e.at}, hasPv=${e.pv!==void 0}`),e.pv!==void 0)return Qe("[withPvFrom] EXIT early - pv already set"),e;if(t){let{en:r,at:n}=e;Qe(`[withPvFrom] About to call thread.findLast for en=${r}, at=${n}, thread.size=${t.size}`);let i=t.findLast(a=>a.en==r&&a.at==n);if(Qe(`[withPvFrom] findLast completed, found=${!!i}`),Qe("[withPvFrom] About to check equality"),Oy(["en","at","vl","ts","ag"],e,i))throw Ha("[withPvFrom] Same as previous:",{log:e,pv:i,thread:t});let o=(e.pv!==void 0?e.pv:i?.cid)??null;return Qe(`[withPvFrom] EXIT - prevLogCid=${o}`),{...e,pv:o}}else{if(!bj(e))throw Ha("[withPvFrom] no thread and no pv:",e);return Qe("[withPvFrom] EXIT - no thread, returning log with existing pv"),e}}function Vu(e){let t=()=>(ze(()=>e.length<2&&Qe(`joinThreads with count=${e.length}`)),go(Ay(e.flatMap(i=>{let o=i.applogs;if(!o)throw Ha("falsy applogs of thread",i),new Error("falsy applogs of thread");return o})))),r=ze(()=>t()),n=Lt(function(i,o){return tn(i)?{init:ze(()=>t())}:{added:i.added.filter(a=>!this.hasApplog(a,!0)),removed:i.removed?.filter(a=>!!this.parents.some(s=>s===o?!1:s.hasApplog(a,!0)))}});return new sc(ze(()=>`join(~ ${e.map(i=>i.name).join(", ")})`),e,["?"],r,n)}var{WARN:md,LOG:OU,DEBUG:bd,VERBOSE:hn,ERROR:vd}=Ce.setup(Ce.INFO),sc=class $y extends ai{constructor(t,r,n,i,o,a=null){super(t,r,n,o?Ke.array([...i],{deep:!1,name:`${t}.array`}):i),this.name=t,this._initialLogs=i,this._eventMapper=o,this._writeMapper=a,Ti(this,{onParentUpdate:Lt}),o&&this.subscribeToParents()}static mapWrites(t,r,n){return new $y(`${r}<${t.nameAndSizeUntracked}>`,t,t.filters,t._applogs,null,n)}_parentSubscriptions=null;insert(t){let r=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!r))return this.parents.forEach(n=>n.insert(r))}insertRaw(t){let r=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!r))return this.parents.forEach(n=>n.insertRaw(r))}subscribeToParents(){this._parentSubscriptions=new Map;let t=qt(()=>{this.parents.length||md("MappedThread has no parents",this),hn(`[MappedThread: ${this.name}] subscribing to parents:`,this.parents.map(n=>n.name));let r=new Set([...this._parentSubscriptions.keys()]);for(let n of this.parents){r.delete(n)&&hn(`[MappedThread: ${this.name}] Skipping re-sub to parent`,n.nameAndSizeUntracked),hn(`[MappedThread: ${this.name}] sub to new parent`,n.nameAndSizeUntracked);let i=this.onParentUpdate.bind(this,n),o=n.subscribe(i);this._parentSubscriptions.set(n,o)}for(let n of r)hn(`[MappedThread: ${this.name}] un-subscribing from old parent`,n.nameAndSizeUntracked),this._parentSubscriptions.get(n)(),this._parentSubscriptions.delete(n)})}subscribe(t){return this._parentSubscriptions||this.subscribeToParents(),super.subscribe(t)}triggerRemap(){if(!this._eventMapper)throw vd("triggerRemap on a thread that is not actually mapping?!",this.nameAndSizeUntracked);bd(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.length!==1&&md(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap with parentCount=${this.parents.length} - not meant for this`),this.parents.forEach(t=>{this.onParentUpdate(t,{init:ze(()=>Ar(t.applogs))})})}onParentUpdate(t,r){hn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate`,r);let n=this._eventMapper?this._eventMapper(r,t):r;if(this._eventMapper)if(hn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => mapped`,n),tn(n))this._applogs.replace([...n.init]);else{for(let i of n.added)this._applogs.splice(lI(this._applogs,i,"ts"),0,i);if(n.removed){for(let i of n.removed)if(!this._applogs.remove(i))if(!tn(r)&&r.removed?.includes(i))bd("Ignoring remove event for non-existent because it was part of parent event's removed",i,r);else throw vd(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,i,{thread:this,event:r,mapResult:n})}}hn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,ms(this._applogs)),this.notifySubscribers(n)}get readOnly(){return!1}},{WARN:AU,LOG:SU,DEBUG:IU,VERBOSE:au,ERROR:Tj}=Ce.setup(Ce.INFO),si=at("rollingFilter",function(e,t,r={}){let n=Ej(t),i=wd(n),o=Ke.array(ze(function(){return i(e.applogs)}),{deep:!1,name:`${e.name} | ${r.name||`rollingFilter.array{${po(n)}}`}`}),a=f=>{let d;return tn(f)?d={init:i(f.init)}:d={added:i(f.added),removed:f.removed},au(`rollingFilter{${e.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,n,f,"=>",d),d},s=new sc(`${e.name} | ${r.name||`rollingFilter{${po(n)}}`}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],o,a),u=lw(()=>Ar(t),f=>{au(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,n,"=>",f),n=f,i=wd(n),s.triggerRemap()}),l=wi(o,()=>{au(`rollingFilter<${ze(()=>e.name)}>${r.name?` '${r.name}'`:""} unobserve`,n),u(),l()});return s},{equals:No,argsDebugName:(e,t,r)=>Ye({caller:"rollingFilter",thread:e,pattern:t,args:r})}),_j=at("rollingMapper",function(e,t,r={}){let n=ze(()=>t.call(null,{init:e.applogs},e));if(!tn(n))throw Tj("Initial run must return init event");let i=n.init;return new sc(`${e.name} | ${r.name||"rollingMapper"}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],i,t)},{equals:No,argsDebugName:(e,t,r)=>Ye({caller:"rollingMapper",thread:e,args:r})}),kU=at("rollingAcc",function(e,t,r,n={}){let i=Lt(r);return i({init:e.applogs},t),e.subscribe(o=>{i(o,t)}),t},{argsDebugName:(e,t,r,n)=>`rollingAcc{${e.nameAndSizeUntracked}${n?.name?` | ${n?.name}`:""}}`}),Ej=function(e){let t=ze(function(){return Object.fromEntries(Object.entries(Ar(e)).map(([r,n])=>[Ar(r),Ar(n)]))});if(!Object.entries(t).length)throw new Error("Pattern is empty");return t};function wd(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(!pj(n,i,o))return!1}return!0})}}var{WARN:xj,LOG:Oj,DEBUG:Xe,VERBOSE:Aj,ERROR:aa}=Ce.setup(Ce.INFO),Sj=class extends ai{constructor(e,t=[],r){super(e,null,r,t),Ti(this,{})}purge(e){let t=this.applogs.length;return this._applogs=this.applogs.filter(r=>!e.includes(r.cid)),t-this.applogs.length}insert(e){Xe(`[WriteableThread.insert] ENTER - ${e.length} applogs for thread "${this.name}"`),Xe("[WriteableThread.insert] About to call ensureTsPvAndFinalizeApplogs");let t=yj(e,this);Xe(`[WriteableThread.insert] ensureTsPvAndFinalizeApplogs completed, mapped=${t.length} applogs`),Xe("[WriteableThread.insert] About to call insertRaw");let r=this.insertRaw(t);return Xe("[WriteableThread.insert] insertRaw completed"),r}insertRaw(e){Xe(`[WriteableThread.insertRaw] ENTER - ${e.length} applogs for thread "${this.name}"`),Xe("[WriteableThread.insertRaw] About to deduplicate");let t=Ay(e);if(t.length!==e.length)throw aa(`[insertRaw] duplicate applogs passed: ${e.length-t.length}`,{appLogsToInsert:e,deduplicated:t});Xe("[WriteableThread.insertRaw] Deduplication done"),Xe("[WriteableThread.insertRaw] About to validate");let r=e.filter(o=>!Ty(o));if(r.length)throw aa(`[insertRaw] bogus applogs passed: ${r.length}`,{bogus:r});Xe("[WriteableThread.insertRaw] Validation done"),Xe("[WriteableThread.insertRaw] About to check for existing");let n=e.filter(o=>this.hasApplog(o,!1));if(n.length)throw aa(`[insertRaw] already existing applogs passed: ${n.length}`,{existing:n});if(Xe("[WriteableThread.insertRaw] Existing check done"),!e.length){xj("[insertRaw] skipping empty insert empty logs array");return}(!this.hasParents&&!(this instanceof Do)?Oj:Xe)("Inserting:",e.length===1?e[0]:e,{ds:this}),Xe("[WriteableThread.insertRaw] About to sort applogs"),go(e);let i=this._applogs.length&&cj(e[0],this._applogs[this._applogs.length-1]);return Xe("[WriteableThread.insertRaw] About to push to _applogs array"),this._applogs.push(...e),i&&(Xe("[WriteableThread.insertRaw] About to sort _applogs (sortNeeded=true)"),go(this._applogs)),Xe("[WriteableThread.insertRaw] About to notify subscribers"),this.notifySubscribers({added:e,removed:null}),Xe("[WriteableThread.insertRaw] Subscribers notified"),Xe("[WriteableThread.insertRaw] About to call persist (void - not awaited)"),this.persist(e),Xe(`[WriteableThread.insertRaw] EXIT - returning ${e.length} applogs`),e}get readOnly(){return!1}},Do=class sa extends Sj{constructor(t,r,n,i){super(t,r,n),this._readOnly=i,Ti(this,{_applogs:Ke.shallow})}static empty(t){return sa.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new sa(r??"in-memory",t,[],n)}static fromReadOnlyArray(t,r){return new sa(r??"in-memory",t,[],!0)}get readOnly(){return this._readOnly}async persist(t){if(Aj("[InMem.persist] no persist for",t),this.readOnly)throw aa("[persist] called for readOnly thread")}},{WARN:$U,LOG:jU,DEBUG:CU,VERBOSE:NU,ERROR:UU}=Ce.setup(Ce.INFO),{WARN:PU,LOG:BU,DEBUG:DU,VERBOSE:RU,ERROR:MU}=Ce.setup(Ce.INFO),Ij=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=r,Ti(this,{threadOfTrail:Ze})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?Vu([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},jy=class{constructor(e){this.nodes=e,Ti(this,{threadOfAllTrails:Ze,size:Ze,isEmpty:Ze})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return ze(()=>this.records.length)}get records(){return nr(()=>this.nodes.map(({variables:e})=>e),{name:"QueryResult.records"})}get leafNodeThread(){return Vu(nr(()=>this.nodes.map(({logsOfThisNode:e})=>e),{name:"QueryResult.leafNodeThread"}))}get leafNodeLogSet(){return nr(()=>this.nodes.map(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogSet"})}get leafNodeLogs(){return nr(()=>this.nodes.flatMap(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogs"})}get threadOfAllTrails(){return Vu(nr(()=>this.nodes.map(e=>e.threadOfTrail),{name:"QueryResult.threadOfAllTrails"}))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},{WARN:LU,LOG:Cs,DEBUG:kr,VERBOSE:ke,ERROR:_n}=Ce.setup(Ce.INFO,{prefix:"[q]"}),su=null,VU=at("lastWriteWins",function(e,{inverseToOnlyReturnFirstLogs:t,tolerateAlreadyFiltered:r}={}){if(ke(`lastWriteWins${t?".inversed":""} < ${e.nameAndSizeUntracked} > initializing`),e.filters.includes("lastWriteWins")){if(r)return kr("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),e;throw _n("thread already filtered lastWriteWins:",e.filters,{name:e.name})}let n,i=_j(e,function(o,a){let s=tn(o),u,l=[],f=s?null:[];s?(n=new Map,u=o.init):u=o.added;let d;for(let I=t?0:u.length-1;t?I<u.length:I>=0;t?I++:I--){let E=u[I],_=E.en+"|"+E.at;if(d&&(t?d>E.ts:d<E.ts))throw _n("lastWriteWins.mapper logs not sorted:",d,t?">":"<",E.ts,{log:E,i:I,newLogs:u,inverseToOnlyReturnFirstLogs:t});d=E.ts;let L=n.get(_);(!L||(t?L.ts>E.ts:L.ts<E.ts))&&(L&&!s&&f.push(L),l.push(E),n.set(_,E))}return go(l),ke.isDisabled||ke(`lastWriteWins${t?".inversed":""}<${e.nameAndSizeUntracked}> mapped event`,s?{...Object.fromEntries(Object.entries(o).map(([I,E])=>[I,E?.length])),toAdd:l.length,toRemove:f}:{...o,toAdd:l,toRemove:f}),s?{init:l}:{added:l,removed:f}},{name:`lastWriteWins${t?".inversed":""}`,extraFilterName:"lastWriteWins"});return ke.isDisabled||qt(()=>{ke(`lastWriteWins<${e.nameAndSizeUntracked}> filtered down to`,i.applogs.length)}),i},{equals:No,argsDebugName:e=>Ye({caller:"lastWriteWins",thread:e})}),FU=at("withoutDeleted",function(e){if(ke.isEnabled&&ke(`withoutDeleted<${e.nameAndSizeUntracked}>`),e.filters.includes("withoutDeleted"))throw _n("thread already filtered withoutDeleted:",e.filters,{name:e.name});let t=si(e,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});ke.isEnabled&&ke(`withoutDeleted<${e.nameAndSizeUntracked}> deletionLogs:`,ze(function(){return[...t.applogs]}));let r=Ye({caller:"allDeletedEntities",thread:e}),n=gI(function(){return t.map(i=>i.en)},{name:r});return ke.isEnabled&&qt(()=>{ke(`withoutDeleted<${e.nameAndSizeUntracked}> deleted:`,[...n])}),si(e,{"!en":n},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:No}),Cy=at("query",function e(t,r,n={},i={}){Bj();let o=Ny(t);kr(`query<${o.nameAndSizeUntracked}>:`,r);let a=Array.isArray(r)?r:[r],s;if(a.length===1)s=null;else{let f=a.slice(0,-1);s=e(o,f,n,i)}let u=a[a.length-1],l=kj(o,s,u,i);return ke.isDisabled||qt(()=>ke("query result:",Ar(l))),l},{equals:zl,argsDebugName:(e,t,r)=>Ye({caller:"query",thread:e,args:r?{pattern:t,startVars:r}:t})}),kj=at("queryStep",function(e,t,r,n={}){if(kr(`queryStep<${e.nameAndSizeUntracked}> with`,t?.untrackedSize??"all","nodes, pattern:",r),!Object.entries(r).length)throw new Error("Pattern is empty");function i(a){let[s,u]=Sy(r,a?.variables??{});ke("[queryStep.doQuery] patternWithoutVars: ",s);let l=si(e,s),f=Ns(u),d=nr(function(){let I=l.map(E=>({log:E,vars:f(E)}));return ke.isEnabled&&ke("[queryStep.doQuery] step node:",a?.variables," =>",I,"from:",ze(()=>l.applogs)),I.map(({log:E,vars:_})=>{let L=Object.assign({},a?.variables,_);return new Ij(wI.fromArray([E],Ye({caller:"QueryNode",thread:l,pattern:`${po(L)}@${po(s)}`})),L,a)})},{name:Ye({caller:"doQuery.mapNodes",thread:l,pattern:r})});return ke.isEnabled&&qt(()=>ke("[queryStep.doQuery] resultNodes:",[...d])),n.debug&&Cs("[queryStep] step result:",ze(()=>d.map(({variables:I,logsOfThisNode:E})=>({variables:I,thread:E})))),d}let o=nr(function(){return kr(`[queryStep] Running with ${t?.nodes?.length} input nodes:`),t?[...t.nodes.flatMap(i)]:[...i(null)]},{name:Ye({caller:"queryStep",thread:e,pattern:r})});return ke.isEnabled&&qt(()=>ke("[queryStep] observableResultNodes:",[...o])),new jy(o)},{equals:zl,argsDebugName:(e,t,r)=>Ye({caller:"queryStep",thread:e,pattern:r})}),zU=at("queryNot",function(e,t,r,n={}){let i=t.nodes;kr(`queryNot<${e.nameAndSizeUntracked}> from: ${i.length} nodes`);let o=Array.isArray(r)?r:[r];for(let a of o){if(!Object.entries(r).length)throw new Error("Pattern is empty");i=i.filter(function({variables:s}){let[u,l]=Sy(a,s??{});ke("[queryNot] patternWithoutVars: ",u);let f=si(e,u);return ke("[queryNot] step node:",s," =>",f.size,"applogs"),ke.isDisabled||ke("[queryNot] step node:",s," => empty?",ze(()=>f.applogs)),n.debug&&Cs("[queryNot] node result:",s,"=>",f.applogs),f.isEmpty})}return new jy(i)},{equals:zl,argsDebugName:(e,t,r)=>Ye({caller:"queryNot",thread:e,pattern:r})}),KU=at("filterAndMap",function(e,t,r){kr(`filterAndMap<${e.nameAndSizeUntracked}>`,t);let n=si(e,t);ke.isEnabled&&(ke("[filterAndMap] filtered:",n.untrackedSize),qt(()=>ke("[filterAndMap] filtered:",n.applogs)));let i=Ye({thread:e,pattern:t,caller:"filterAndMap"}),o=nr(()=>Cj(n,r),{name:i});return ke.isDisabled||qt(()=>ke("[filterAndMap] mapped:",o)),o},{equals:et.structural,argsDebugName:(e,t)=>Ye({caller:"filterAndMap",thread:e,pattern:t})}),qU=at("queryAndMap",function(e,t,r,n={}){let i=Ny(e);kr(`queryAndMap<${i.nameAndSizeUntracked}>`,{patternOrPatterns:t,variables:n,map:r});let o=Ye({thread:i,caller:"queryAndMap"}),a=Cy(i,t);ke("[queryAndMap] filtered count:",a.untrackedSize);let s=nr(()=>Nj(a,r),{name:o});return ke.isDisabled||qt(()=>ke("[queryAndMap] result:",Ar(s))),s},{equals:et.structural,argsDebugName:(e,t)=>Ye({caller:"queryAndMap",thread:e,pattern:t})}),GU=at("queryEntity",function(e,t,r,n){kr(`queryEntity<${e.nameAndSizeUntracked}>`,r,t);let i=si(e,{en:r,at:Uj(t,n)});return ke("queryEntity applogs:",i.applogs),Ze(()=>i.isEmpty?null:Object.fromEntries(i.map(({at:o,vl:a})=>[o.slice(t.length+1),a])))},{equals:pI,argsDebugName:(e,t,r)=>Ye({caller:"queryEntity",thread:e,args:{name:t,entityID:r}})}),WU=at("agentsOfThread",function(e){kr(`agentsOfThread<${e.nameAndSizeUntracked}>`);let t=Ke.map(),r=Lt(i=>{for(let o of tn(i)?i.init:i.added){let a=t.get(o.ag)??0;t.set(o.ag,a+1)}for(let o of!tn(i)&&i.removed||[]){let a=t.get(o.ag);if(!a||a<1)throw _n("[agentsOfThread] number is now negative",{log:o,event:i,mapped:t,prev:a});t.set(o.ag,a-1)}Cs(`agentsOfThread<${e.nameAndSizeUntracked}> processed event`,{event:i,mapped:t})});r({init:e.applogs});let n=e.subscribe(r);return gs(t,n),t}),$j=at("entityOverlap",function(e,t){return Cs(`entityOverlap<${e.nameAndSizeUntracked}, ${t.nameAndSizeUntracked}>`),Ze(()=>{let r=new Set(e.map(i=>i.en)),n=new Set(t.map(i=>i.en));return[...r].filter(i=>n.has(i))})}),HU=at("entityOverlapCount",function(e,t){return Ze(()=>$j(e,t).get().length)}),jj=at("querySingle",function(e,t,r={}){let n=Cy(e,t,r);return Ze(()=>{if(n.isEmpty)return null;if(n.size>1)throw _n("[querySingle] got",n.size,"results:",n);let i=n.nodes[0].logsOfThisNode;if(i.size!=1)throw _n("[querySingle] single result, but got",i.size,"logs:",i.applogs);return i.applogs[0]})},{equals:et.structural,argsDebugName:(e,t)=>Ye({caller:"querySingle",thread:e,pattern:t})}),JU=at("querySingleAndMap",function(e,t,r,n={}){let i=jj(e,t,n);return Ze(()=>{let o=i.get();if(o)return typeof r=="string"?o[r]:Ns(r)(o)})},{equals:et.structural,argsDebugName:(e,t)=>Ye({caller:"querySingleAndMap",thread:e,pattern:t})}),Cj=function(e,t){return typeof t=="function"?e.map(t):typeof t=="string"?e.map(r=>r[t]):e.map(Ns(t))},Nj=function(e,t){return typeof t=="function"?e.records.map(t):typeof t=="string"?e.nodes.map(r=>{if(!Object.hasOwn(r.record,t)){if(r.logsOfThisNode.size!==1)throw _n(`not sure what to map (it's not a var and a result node log count of ${r.logsOfThisNode.size})`);return r.logsOfThisNode.firstLog[t]}return r.record[t]}):e.nodes.map(r=>Ns(t)(e))};function Ns(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function Uj(e,t){return t.map(r=>Pj(e,r))}function Pj(e,t){return`${e}/${t}`}function Ny(e,t){return Array.isArray(e)?Do.fromArray(e,t||`threadFromArray[${e.length}]`,!0):e}function Bj(){if(su!=null&&performance.now()>=su)throw new Dj(su)}var Dj=class extends Error{constructor(e){super(e)}},Rj=it({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js"(e,t){"use strict";t.exports=a;var r=128,n=127,i=~n,o=Math.pow(2,31);function a(s,u,l){if(Number.MAX_SAFE_INTEGER&&s>Number.MAX_SAFE_INTEGER)throw a.bytes=0,new RangeError("Could not encode varint");u=u||[],l=l||0;for(var f=l;s>=o;)u[l++]=s&255|r,s/=128;for(;s&i;)u[l++]=s&255|r,s>>>=7;return u[l]=s|0,a.bytes=l-f+1,u}}}),Mj=it({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/decode.js"(e,t){"use strict";t.exports=i;var r=128,n=127;function i(o,u){var s=0,u=u||0,l=0,f=u,d,I=o.length;do{if(f>=I||l>49)throw i.bytes=0,new RangeError("Could not decode varint");d=o[f++],s+=l<28?(d&n)<<l:(d&n)*Math.pow(2,l),l+=7}while(d>=r);return i.bytes=f-u,s}}}),Lj=it({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js"(e,t){"use strict";var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),a=Math.pow(2,35),s=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),f=Math.pow(2,63);t.exports=function(d){return d<r?1:d<n?2:d<i?3:d<o?4:d<a?5:d<s?6:d<u?7:d<l?8:d<f?9:10}}}),uc=it({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js"(e,t){"use strict";t.exports={encode:Rj(),decode:Mj(),encodingLength:Lj()}}}),Vj=["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 Fj(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":zj(e)||"Object"}function zj(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Vj.includes(t))return t}var W=class{constructor(e,t,r){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=r}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}static equals(e,t){return e===t||e.major===t.major&&e.name===t.name}};W.uint=new W(0,"uint",!0);W.negint=new W(1,"negint",!0);W.bytes=new W(2,"bytes",!0);W.string=new W(3,"string",!0);W.array=new W(4,"array",!1);W.map=new W(5,"map",!1);W.tag=new W(6,"tag",!1);W.float=new W(7,"float",!0);W.false=new W(7,"false",!0);W.true=new W(7,"true",!0);W.null=new W(7,"null",!0);W.undefined=new W(7,"undefined",!0);W.break=new W(7,"break",!0);var me=class{constructor(e,t,r){this.type=e,this.value=t,this.encodedLength=r,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},Ro=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Kj=new TextEncoder;function Ja(e){return Ro&&globalThis.Buffer.isBuffer(e)}function Uy(e){return e instanceof Uint8Array?Ja(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var qj=24,Gj=200,Wj=Ro?e=>e.length>=qj?globalThis.Buffer.from(e):Td(e):e=>e.length>=Gj?Kj.encode(e):Td(e),_r=e=>Uint8Array.from(e),Hj=Ro?(e,t,r)=>Ja(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Jj=Ro?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Uy(globalThis.Buffer.concat(e,t))):(e,t)=>{let r=new Uint8Array(t),n=0;for(let i of e)n+i.length>r.length&&(i=i.subarray(0,r.length-n)),r.set(i,n),n+=i.length;return r},Xj=Ro?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Py(e,t){if(Ja(e)&&Ja(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}function Td(e){let t=[],r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=i&63|128):(i&64512)===55296&&n+1<e.length&&(e.charCodeAt(n+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++n)&1023),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=i&63|128):(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 Qj=256,By=class{constructor(e=Qj){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=Xj(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=Hj(r,0,this.cursor)}else t=Jj(this.chunks,this.cursor);return e&&this.reset(),t}},Zj=class{constructor(e){this.dest=e,this.cursor=0,this.chunks=[e]}reset(){this.cursor=0}push(e){if(this.cursor+e.length>this.dest.length)throw new Error("write out of bounds, destination buffer is too small");this.dest.set(e,this.cursor),this.cursor+=e.length}toBytes(e=!1){let t=this.dest.subarray(0,this.cursor);return e&&this.reset(),t}},Ge="CBOR decode error:",Dy="CBOR encode error:",Mo=[];Mo[23]=1;Mo[24]=2;Mo[25]=3;Mo[26]=5;Mo[27]=9;function Pi(e,t,r){if(e.length-t<r)throw new Error(`${Ge} not enough data for type`)}var ct=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Fn(e,t,r){Pi(e,t,1);let n=e[t];if(r.strict===!0&&n<ct[0])throw new Error(`${Ge} integer encoded in more bytes than necessary (strict decode)`);return n}function zn(e,t,r){Pi(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<ct[1])throw new Error(`${Ge} integer encoded in more bytes than necessary (strict decode)`);return n}function Kn(e,t,r){Pi(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<ct[2])throw new Error(`${Ge} integer encoded in more bytes than necessary (strict decode)`);return n}function qn(e,t,r){Pi(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<ct[3])throw new Error(`${Ge} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${Ge} integers outside of the safe integer range are not supported`)}function Yj(e,t,r,n){return new me(W.uint,Fn(e,t+1,n),2)}function e5(e,t,r,n){return new me(W.uint,zn(e,t+1,n),3)}function t5(e,t,r,n){return new me(W.uint,Kn(e,t+1,n),5)}function r5(e,t,r,n){return new me(W.uint,qn(e,t+1,n),9)}function Gn(e,t){return Xt(e,0,t.value)}function Xt(e,t,r){if(r<ct[0]){let n=Number(r);e.push([t|n])}else if(r<ct[1]){let n=Number(r);e.push([t|24,n])}else if(r<ct[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<ct[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<ct[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,e.push(i)}else throw new Error(`${Ge} encountered BigInt larger than allowable range`)}}Gn.encodedSize=function(e){return Xt.encodedSize(e.value)};Xt.encodedSize=function(e){return e<ct[0]?1:e<ct[1]?2:e<ct[2]?3:e<ct[3]?5:9};Gn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function n5(e,t,r,n){return new me(W.negint,-1-Fn(e,t+1,n),2)}function i5(e,t,r,n){return new me(W.negint,-1-zn(e,t+1,n),3)}function o5(e,t,r,n){return new me(W.negint,-1-Kn(e,t+1,n),5)}var lc=BigInt(-1),Ry=BigInt(1);function a5(e,t,r,n){let i=qn(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new me(W.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Ge} integers outside of the safe integer range are not supported`);return new me(W.negint,lc-BigInt(i),9)}function cc(e,t){let r=t.value,n=typeof r=="bigint"?r*lc-Ry:r*-1-1;Xt(e,t.type.majorEncoded,n)}cc.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*lc-Ry:t*-1-1;return r<ct[0]?1:r<ct[1]?2:r<ct[2]?3:r<ct[3]?5:9};cc.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Lo(e,t,r,n){Pi(e,t,r+n);let i=e.slice(t+r,t+r+n);return new me(W.bytes,i,r+n)}function s5(e,t,r,n){return Lo(e,t,1,r)}function u5(e,t,r,n){return Lo(e,t,2,Fn(e,t+1,n))}function l5(e,t,r,n){return Lo(e,t,3,zn(e,t+1,n))}function c5(e,t,r,n){return Lo(e,t,5,Kn(e,t+1,n))}function f5(e,t,r,n){let i=qn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ge} 64-bit integer bytes lengths not supported`);return Lo(e,t,9,i)}function Xa(e){return e.encodedBytes===void 0&&(e.encodedBytes=W.equals(e.type,W.string)?Wj(e.value):e.value),e.encodedBytes}function Us(e,t){let r=Xa(t);Xt(e,t.type.majorEncoded,r.length),e.push(r)}Us.encodedSize=function(e){let t=Xa(e);return Xt.encodedSize(t.length)+t.length};Us.compareTokens=function(e,t){return d5(Xa(e),Xa(t))};function d5(e,t){return e.length<t.length?-1:e.length>t.length?1:Py(e,t)}var _d=new TextDecoder,p5=32;function h5(e,t,r){if(r-t<p5){let n="";for(let i=t;i<r;i++){let o=e[i];if(o&128)return _d.decode(e.subarray(t,r));n+=String.fromCharCode(o)}return n}return _d.decode(e.subarray(t,r))}function Vo(e,t,r,n,i){let o=r+n;Pi(e,t,o);let a=new me(W.string,h5(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=e.slice(t+r,t+o)),a}function y5(e,t,r,n){return Vo(e,t,1,r,n)}function g5(e,t,r,n){return Vo(e,t,2,Fn(e,t+1,n),n)}function m5(e,t,r,n){return Vo(e,t,3,zn(e,t+1,n),n)}function b5(e,t,r,n){return Vo(e,t,5,Kn(e,t+1,n),n)}function v5(e,t,r,n){let i=qn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ge} 64-bit integer string lengths not supported`);return Vo(e,t,9,i,n)}var w5=Us;function Bi(e,t,r,n){return new me(W.array,n,r)}function T5(e,t,r,n){return Bi(e,t,1,r)}function _5(e,t,r,n){return Bi(e,t,2,Fn(e,t+1,n))}function E5(e,t,r,n){return Bi(e,t,3,zn(e,t+1,n))}function x5(e,t,r,n){return Bi(e,t,5,Kn(e,t+1,n))}function O5(e,t,r,n){let i=qn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ge} 64-bit integer array lengths not supported`);return Bi(e,t,9,i)}function A5(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ge} indefinite length items not allowed`);return Bi(e,t,1,1/0)}function fc(e,t){Xt(e,W.array.majorEncoded,t.value)}fc.compareTokens=Gn.compareTokens;fc.encodedSize=function(e){return Xt.encodedSize(e.value)};function Di(e,t,r,n){return new me(W.map,n,r)}function S5(e,t,r,n){return Di(e,t,1,r)}function I5(e,t,r,n){return Di(e,t,2,Fn(e,t+1,n))}function k5(e,t,r,n){return Di(e,t,3,zn(e,t+1,n))}function $5(e,t,r,n){return Di(e,t,5,Kn(e,t+1,n))}function j5(e,t,r,n){let i=qn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ge} 64-bit integer map lengths not supported`);return Di(e,t,9,i)}function C5(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ge} indefinite length items not allowed`);return Di(e,t,1,1/0)}function dc(e,t){Xt(e,W.map.majorEncoded,t.value)}dc.compareTokens=Gn.compareTokens;dc.encodedSize=function(e){return Xt.encodedSize(e.value)};function N5(e,t,r,n){return new me(W.tag,r,1)}function U5(e,t,r,n){return new me(W.tag,Fn(e,t+1,n),2)}function P5(e,t,r,n){return new me(W.tag,zn(e,t+1,n),3)}function B5(e,t,r,n){return new me(W.tag,Kn(e,t+1,n),5)}function D5(e,t,r,n){return new me(W.tag,qn(e,t+1,n),9)}function pc(e,t){Xt(e,W.tag.majorEncoded,t.value)}pc.compareTokens=Gn.compareTokens;pc.encodedSize=function(e){return Xt.encodedSize(e.value)};var My=20,Ly=21,Vy=22,Fy=23;function R5(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Ge} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new me(W.null,null,1):new me(W.undefined,void 0,1)}function M5(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ge} indefinite length items not allowed`);return new me(W.break,void 0,1)}function hc(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Ge} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Ge} Infinity values are not supported`)}return new me(W.float,e,t)}function L5(e,t,r,n){return hc(gc(e,t+1),3,n)}function V5(e,t,r,n){return hc(mc(e,t+1),5,n)}function F5(e,t,r,n){return hc(Gy(e,t+1),9,n)}function yc(e,t,r){let n=t.value;if(n===!1)e.push([W.float.majorEncoded|My]);else if(n===!0)e.push([W.float.majorEncoded|Ly]);else if(n===null)e.push([W.float.majorEncoded|Vy]);else if(n===void 0)e.push([W.float.majorEncoded|Fy]);else{let i,o=!1;(!r||r.float64!==!0)&&(Ky(n),i=gc(tr,1),n===i||Number.isNaN(n)?(tr[0]=249,e.push(tr.slice(0,3)),o=!0):(qy(n),i=mc(tr,1),n===i&&(tr[0]=250,e.push(tr.slice(0,5)),o=!0))),o||(z5(n),i=Gy(tr,1),tr[0]=251,e.push(tr.slice(0,9)))}}yc.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){Ky(r);let n=gc(tr,1);if(r===n||Number.isNaN(r))return 3;if(qy(r),n=mc(tr,1),r===n)return 5}return 9};var zy=new ArrayBuffer(9),Pt=new DataView(zy,1),tr=new Uint8Array(zy,0);function Ky(e){if(e===1/0)Pt.setUint16(0,31744,!1);else if(e===-1/0)Pt.setUint16(0,64512,!1);else if(Number.isNaN(e))Pt.setUint16(0,32256,!1);else{Pt.setFloat32(0,e);let t=Pt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Pt.setUint16(0,31744,!1);else if(r===0)Pt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Pt.setUint16(0,0):i<-14?Pt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):Pt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function gc(e,t){if(e.length-t<2)throw new Error(`${Ge} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function qy(e){Pt.setFloat32(0,e,!1)}function mc(e,t){if(e.length-t<4)throw new Error(`${Ge} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function z5(e){Pt.setFloat64(0,e,!1)}function Gy(e,t){if(e.length-t<8)throw new Error(`${Ge} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}yc.compareTokens=Gn.compareTokens;function Be(e,t,r){throw new Error(`${Ge} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Ps(e){return()=>{throw new Error(`${Ge} ${e}`)}}var pe=[];for(let e=0;e<=23;e++)pe[e]=Be;pe[24]=Yj;pe[25]=e5;pe[26]=t5;pe[27]=r5;pe[28]=Be;pe[29]=Be;pe[30]=Be;pe[31]=Be;for(let e=32;e<=55;e++)pe[e]=Be;pe[56]=n5;pe[57]=i5;pe[58]=o5;pe[59]=a5;pe[60]=Be;pe[61]=Be;pe[62]=Be;pe[63]=Be;for(let e=64;e<=87;e++)pe[e]=s5;pe[88]=u5;pe[89]=l5;pe[90]=c5;pe[91]=f5;pe[92]=Be;pe[93]=Be;pe[94]=Be;pe[95]=Ps("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)pe[e]=y5;pe[120]=g5;pe[121]=m5;pe[122]=b5;pe[123]=v5;pe[124]=Be;pe[125]=Be;pe[126]=Be;pe[127]=Ps("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)pe[e]=T5;pe[152]=_5;pe[153]=E5;pe[154]=x5;pe[155]=O5;pe[156]=Be;pe[157]=Be;pe[158]=Be;pe[159]=A5;for(let e=160;e<=183;e++)pe[e]=S5;pe[184]=I5;pe[185]=k5;pe[186]=$5;pe[187]=j5;pe[188]=Be;pe[189]=Be;pe[190]=Be;pe[191]=C5;for(let e=192;e<=215;e++)pe[e]=N5;pe[216]=U5;pe[217]=P5;pe[218]=B5;pe[219]=D5;pe[220]=Be;pe[221]=Be;pe[222]=Be;pe[223]=Be;for(let e=224;e<=243;e++)pe[e]=Ps("simple values are not supported");pe[244]=Be;pe[245]=Be;pe[246]=Be;pe[247]=R5;pe[248]=Ps("simple values are not supported");pe[249]=L5;pe[250]=V5;pe[251]=F5;pe[252]=Be;pe[253]=Be;pe[254]=Be;pe[255]=M5;var Ur=[];for(let e=0;e<24;e++)Ur[e]=new me(W.uint,e,1);for(let e=-1;e>=-24;e--)Ur[31-e]=new me(W.negint,e,1);Ur[64]=new me(W.bytes,new Uint8Array(0),1);Ur[96]=new me(W.string,"",1);Ur[128]=new me(W.array,0,1);Ur[160]=new me(W.map,0,1);Ur[244]=new me(W.false,!1,1);Ur[245]=new me(W.true,!0,1);Ur[246]=new me(W.null,null,1);function K5(e){switch(e.type){case W.false:return _r([244]);case W.true:return _r([245]);case W.null:return _r([246]);case W.bytes:return e.value.length?void 0:_r([64]);case W.string:return e.value===""?_r([96]):void 0;case W.array:return e.value===0?_r([128]):void 0;case W.map:return e.value===0?_r([160]):void 0;case W.uint:return e.value<24?_r([Number(e.value)]):void 0;case W.negint:if(e.value>=-24)return _r([31-Number(e.value)])}}var q5=Object.freeze({float64:!0,mapSorter:J5,quickEncodeToken:K5});function Wy(){let e=[];return e[W.uint.major]=Gn,e[W.negint.major]=cc,e[W.bytes.major]=Us,e[W.string.major]=w5,e[W.array.major]=fc,e[W.map.major]=dc,e[W.tag.major]=pc,e[W.float.major]=yc,e}var G5=Wy(),W5=new By,Ed=class Hy{constructor(t,r){this.obj=t,this.parent=r}includes(t){let r=this;do if(r.obj===t)return!0;while(r=r.parent);return!1}static createCheck(t,r){if(t&&t.includes(r))throw new Error(`${Dy} object contains circular references`);return new Hy(r,t)}},zr={null:new me(W.null,null),undefined:new me(W.undefined,void 0),true:new me(W.true,!0),false:new me(W.false,!1),emptyArray:new me(W.array,0),emptyMap:new me(W.map,0)},nn={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new me(W.float,e):e>=0?new me(W.uint,e):new me(W.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new me(W.uint,e):new me(W.negint,e)},Uint8Array(e,t,r,n){return new me(W.bytes,e)},string(e,t,r,n){return new me(W.string,e)},boolean(e,t,r,n){return e?zr.true:zr.false},null(e,t,r,n){return zr.null},undefined(e,t,r,n){return zr.undefined},ArrayBuffer(e,t,r,n){return new me(W.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new me(W.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[zr.emptyArray,new me(W.break)]:zr.emptyArray;n=Ed.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=ua(a,r,n);return r.addBreakTokens?[new me(W.array,e.length),i,new me(W.break)]:[new me(W.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length,s;if(a){s=new Array(a),n=Ed.createCheck(n,e);let u=!i&&r.ignoreUndefinedProperties,l=0;for(let f of o){let d=i?e.get(f):e[f];u&&d===void 0||(s[l++]=[ua(f,r,n),ua(d,r,n)])}l<a&&(s.length=l)}return s?.length?(H5(s,r),r.addBreakTokens?[new me(W.map,s.length),s,new me(W.break)]:[new me(W.map,s.length),s]):r.addBreakTokens===!0?[zr.emptyMap,new me(W.break)]:zr.emptyMap}};nn.Map=nn.Object;nn.Buffer=nn.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))nn[`${e}Array`]=nn.DataView;function ua(e,t={},r){let n=Fj(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||nn[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=nn[n];if(!o)throw new Error(`${Dy} unsupported type: ${n}`);return o(e,n,t,r)}function H5(e,t){t.mapSorter&&e.sort(t.mapSorter)}function J5(e,t){if(e[0]instanceof me&&t[0]instanceof me){let r=e[0],n=t[0];return r._keyBytes||(r._keyBytes=xd(r.value)),n._keyBytes||(n._keyBytes=xd(n.value)),Py(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function xd(e){return X5(e,G5,q5)}function Jy(e,t,r,n){if(Array.isArray(t))for(let i of t)Jy(e,i,r,n);else r[t.type.major](e,t,n)}var XU=W.uint.majorEncoded,QU=W.negint.majorEncoded,ZU=W.bytes.majorEncoded,YU=W.string.majorEncoded,eP=W.array.majorEncoded,tP=W.float.majorEncoded|My,rP=W.float.majorEncoded|Ly,nP=W.float.majorEncoded|Vy,iP=W.float.majorEncoded|Fy,oP=BigInt(-1),aP=BigInt(1);function X5(e,t,r,n){let i=n instanceof Uint8Array,o=i?new Zj(n):W5,a=ua(e,r);if(!Array.isArray(a)&&r.quickEncodeToken){let s=r.quickEncodeToken(a);if(s)return i?(o.push(s),o.toBytes()):s;let u=t[a.type.major];if(u.encodedSize){let l=u.encodedSize(a,r);if(i||(o=new By(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():Uy(o.chunks[0])}}return o.reset(),Jy(o,a,t,r),o.toBytes(!0)}var sP=Symbol.for("DONE"),uP=Symbol.for("BREAK"),lP=new Uint8Array(0);function Q5(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 bc(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 Z5(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(_){if(_ instanceof Uint8Array||(ArrayBuffer.isView(_)?_=new Uint8Array(_.buffer,_.byteOffset,_.byteLength):Array.isArray(_)&&(_=Uint8Array.from(_))),!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(_.length===0)return"";for(var L=0,J=0,B=0,k=_.length;B!==k&&_[B]===0;)B++,L++;for(var F=(k-B)*f+1>>>0,q=new Uint8Array(F);B!==k;){for(var D=_[B],Q=0,K=F-1;(D!==0||Q<J)&&K!==-1;K--,Q++)D+=256*q[K]>>>0,q[K]=D%s>>>0,D=D/s>>>0;if(D!==0)throw new Error("Non-zero carry");J=Q,B++}for(var re=F-J;re!==F&&q[re]===0;)re++;for(var $=u.repeat(L);re<F;++re)$+=e.charAt(q[re]);return $}function I(_){if(typeof _!="string")throw new TypeError("Expected String");if(_.length===0)return new Uint8Array;var L=0;if(_[L]!==" "){for(var J=0,B=0;_[L]===u;)J++,L++;for(var k=(_.length-L)*l+1>>>0,F=new Uint8Array(k);_[L];){var q=r[_.charCodeAt(L)];if(q===255)return;for(var D=0,Q=k-1;(q!==0||D<B)&&Q!==-1;Q--,D++)q+=s*F[Q]>>>0,F[Q]=q%256>>>0,q=q/256>>>0;if(q!==0)throw new Error("Non-zero carry");B=D,L++}if(_[L]!==" "){for(var K=k-B;K!==k&&F[K]===0;)K++;for(var re=new Uint8Array(J+(k-K)),$=J;K!==k;)re[$++]=F[K++];return re}}}function E(_){var L=I(_);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:I,decode:E}}var Y5=Z5,eC=Y5,tC=eC,rC=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")}},nC=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,r){this.name=e,this.prefix=t;let n=t.codePointAt(0);if(n===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n,this.baseDecode=r}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Xy(this,e)}},iC=class{decoders;constructor(e){this.decoders=e}or(e){return Xy(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Xy(e,t){return new iC({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var oC=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 rC(e,t,r),this.decoder=new nC(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Qy({name:e,prefix:t,encode:r,decode:n}){return new oC(e,t,r,n)}function Bs({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=tC(r,e);return Qy({prefix:t,name:e,encode:n,decode:o=>bc(i(o))})}function aC(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 sC(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 uC(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function Pr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=uC(n);return Qy({prefix:t,name:e,encode(o){return sC(o,n,r)},decode(o){return aC(o,i,r,e)}})}var la=Pr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),cP=Pr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),fP=Pr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),dP=Pr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),pP=Pr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),hP=Pr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),yP=Pr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),gP=Pr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),mP=Pr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),uu=Bs({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),bP=Bs({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Wr=Bs({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),vP=Bs({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),lC=Zy,Od=128,cC=127,fC=~cC,dC=Math.pow(2,31);function Zy(e,t,r){t=t||[],r=r||0;for(var n=r;e>=dC;)t[r++]=e&255|Od,e/=128;for(;e&fC;)t[r++]=e&255|Od,e>>>=7;return t[r]=e|0,Zy.bytes=r-n+1,t}var pC=Fu,hC=128,Ad=127;function Fu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Fu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Ad)<<i:(a&Ad)*Math.pow(2,i),i+=7}while(a>=hC);return Fu.bytes=o-n,r}var yC=Math.pow(2,7),gC=Math.pow(2,14),mC=Math.pow(2,21),bC=Math.pow(2,28),vC=Math.pow(2,35),wC=Math.pow(2,42),TC=Math.pow(2,49),_C=Math.pow(2,56),EC=Math.pow(2,63),xC=function(e){return e<yC?1:e<gC?2:e<mC?3:e<bC?4:e<vC?5:e<wC?6:e<TC?7:e<_C?8:e<EC?9:10},OC={encode:lC,decode:pC,encodingLength:xC},AC=OC,Qa=AC;function zu(e,t=0){return[Qa.decode(e,t),Qa.decode.bytes]}function Za(e,t,r=0){return Qa.encode(e,t,r),t}function Ya(e){return Qa.encodingLength(e)}function SC(e,t){let r=t.byteLength,n=Ya(e),i=n+Ya(r),o=new Uint8Array(i+r);return Za(e,o,0),Za(r,o,n),o.set(t,i),new vc(e,r,t,o)}function IC(e){let t=bc(e),[r,n]=zu(t),[i,o]=zu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new vc(r,i,a,t)}function kC(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Q5(e.bytes,r.bytes)}}var vc=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Sd(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return jC(r,Ku(e),t??Wr.encoder);default:return CC(r,Ku(e),t??la.encoder)}}var Id=new WeakMap;function Ku(e){let t=Id.get(e);if(t==null){let r=new Map;return Id.set(e,r),r}return t}var Yy=class gt{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==Gi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==NC)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return gt.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=SC(t,r);return gt.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return gt.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&kC(t.multihash,n.multihash)}toString(t){return Sd(this,t)}toJSON(){return{"/":Sd(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof gt)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new gt(n,i,o,a??kd(n,i,o.bytes))}else if(r[UC]===!0){let{version:n,multihash:i,code:o}=r,a=IC(i);return gt.create(n,o,a)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==Gi)throw new Error(`Version 0 CID must use dag-pb (code: ${Gi}) block encoding`);return new gt(t,r,n,n.bytes)}case 1:{let i=kd(t,r,n.bytes);return new gt(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return gt.create(0,Gi,t)}static createV1(t,r){return gt.create(1,t,r)}static decode(t){let[r,n]=gt.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=gt.inspectBytes(t),n=r.size-r.multihashSize,i=bc(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 vc(r.multihashCode,r.digestSize,o,i);return[r.version===0?gt.createV0(a):gt.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,I]=zu(t.subarray(r));return r+=I,d},i=n(),o=Gi;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=$C(t,r),o=gt.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ku(o).set(n,t),o}};function $C(e,t){switch(e[0]){case"Q":{let r=t??Wr;return[Wr.prefix,r.decode(`${Wr.prefix}${e}`)]}case Wr.prefix:{let r=t??Wr;return[Wr.prefix,r.decode(e)]}case la.prefix:{let r=t??la;return[la.prefix,r.decode(e)]}case uu.prefix:{let r=t??uu;return[uu.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 jC(e,t,r){let{prefix:n}=r;if(n!==Wr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function CC(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var Gi=112,NC=18;function kd(e,t,r){let n=Ya(e),i=n+Ya(t),o=new Uint8Array(i+r.byteLength);return Za(e,o,0),Za(t,o,n),o.set(r,i),o}var UC=Symbol.for("@ipld/js-cid/CID"),eg=42;function PC(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Yy.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new me(W.tag,eg),new me(W.bytes,r)]}function BC(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function DC(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 RC(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 $d={float64:!0,typeEncoders:{Map:RC,Object:PC,undefined:BC,number:DC}},wP={...$d,typeEncoders:{...$d.typeEncoders}};function MC(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Yy.decode(e.subarray(1))}var qu={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};qu.tags[eg]=MC;var TP={...qu,tags:qu.tags.slice()},_P=Nr(uc(),1),Xr={Null:e=>e===null?e:void 0,Int:e=>Number.isInteger(e)?e:void 0,Float:e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,String:e=>typeof e=="string"?e:void 0,Bool:e=>typeof e=="boolean"?e:void 0,Bytes:e=>e instanceof Uint8Array?e:void 0,Link:e=>e!==null&&typeof e=="object"&&e.asCID===e?e:void 0,List:e=>Array.isArray(e)?e:void 0,Map:e=>e!==null&&typeof e=="object"&&e.asCID!==e&&!Array.isArray(e)&&!(e instanceof Uint8Array)?e:void 0},Xi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Xr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Xr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Xi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Xi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Xr.Int,CarV1HeaderOrV2Pragma:e=>{if(Xr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,a]=t[i];switch(o){case"roots":{let s=Xi["CarV1HeaderOrV2Pragma > roots (anon)"](e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=Xi.Int(e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},Qi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Xr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Xr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Qi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Qi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Xr.Int,CarV1HeaderOrV2Pragma:e=>{if(Xr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,a]=t[i];switch(o){case"roots":{let s=Qi["CarV1HeaderOrV2Pragma > roots (anon)"](a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=Qi.Int(a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},EP={toTyped:Xi.CarV1HeaderOrV2Pragma,toRepresentation:Qi.CarV1HeaderOrV2Pragma},xP=Wy(),OP=Nr(uc(),1),AP=[new me(W.map,2),new me(W.string,"version"),new me(W.uint,1),new me(W.string,"roots")],SP=new me(W.tag,42),IP=Nr(uc(),1),{WARN:tg,LOG:kP,DEBUG:lu,VERBOSE:wc,ERROR:Xn}=Ce.setup(Ce.INFO);async function LC(e){let t=await FC(e);return await VC(t)}async function VC({rootCID:e,blockStore:t},r=[],n){if(!e||!t)throw Xn("Empty roots/blocks",{rootCID:e,blockStore:t});let i=[],o=null,a=e,s=new Set,u=null;for(;a;){let f=a.toString();if(s.has(f))throw Xn("[decodePubFromBlocks] pub chain has a loop",{currentCID:f,visited:[...s]});s.add(f);let d=await Zn(t,a);if(wc("[decodePubFromBlocks] root:",f,d,{blockStore:t}),!d)throw Xn("[decodePubFromBlocks] root not found in blockStore",{blockStore:t,currentCID:f});let I;if(d?.info){u||(u=d.applogs);let L=await Zn(t,d.applogs);I=await qC(L,t),o||(o=await Zn(t,d.info),lu("new format - infoLogs",o.logs.map(J=>({[J.toString()]:J}))))}else I=d.applogs;let E=async L=>{let J=L,B=await Zn(t,J);if(!B)throw Xn("Could not find applog CID in pub blocks:",J.toString(),{cid:J,root:d,blockStore:t}),new Error(`Could not find applog CID in pub blocks: ${J.toString()}`);return B.pv instanceof zt&&(B.pv=B.pv.toV1().toString()),{...B,cid:J.toV1().toString()}},_=await Promise.all(I.map(E));if(i=i.concat(_),!d.prev)break;if(n&&xy(d.prev,n)){lu("[decodePubFromBlocks] stopping at stopAtCID:",n.toString());break}if(!await t.get(d.prev))throw Xn("[decodePubFromBlocks] prev snapshot missing from blockStore",{currentCID:f,prev:d.prev.toString(),stopAtCID:n?.toString(),visited:[...s]});a=d.prev}let l={cid:e,info:o?{...o,logs:await Promise.all(o.logs.map(async f=>{let d=f,I=await Zn(t,d);if(!I)throw Xn("Could not find info log CID in pub blocks:",d.toString(),{cid:d,blockStore:t}),new Error(`Could not find info log CID in pub blocks: ${d.toString()}`);return I.pv instanceof zt&&(I.pv=I.pv.toV1().toString()),{...I,cid:d.toV1().toString()}}))}:null,applogsCID:u,applogs:i};return lu("[decodePubFromBlocks] result:",l,{rootCID:e.toString(),blockStore:t,applogs:i}),l}async function FC(e){let t=(await e.getRoots()).map(n=>(typeof n.toV1=="function"?n:zt.decode(n.bytes)).toV1().toString()),r=new Map;for await(let{cid:n,bytes:i}of e.blocks()){let o=typeof n.toV1=="function"?n:zt.decode(n.bytes);wc({cidFromCarblocks:n,cid:o}),r.set(o.toV1().toString(),i)}return t.length!==1&&tg("Unexpected roots count:",t),{rootCID:zt.parse(t[0]),blockStore:{get:n=>r.get(n.toV1().toString())}}}async function Zn(e,t){try{var r=await e.get(t);if(!r)return tg("returning null"),null}catch(n){if(n.message==="Not Found")return null;throw n}return ic(r)}function zC(e){return async function*(){for(;;){let{done:t,value:r}=await e.read();if(wc("[car] chunk",{done:t,value:r}),t)break;yield r}}()}var{WARN:$P,LOG:jP,DEBUG:CP,VERBOSE:NP,ERROR:KC}=Ce.setup(Ce.INFO);async function qC(e,t){return GC(e)?(await Promise.all(e.chunks.map(async r=>{let n=await Zn(t,r);if(!n.logs)throw KC("Weird chunk",n);return n.logs}))).flat():e.logs}function GC(e){return e.chunks}var es=mo(Og(),1),WC=mo(Ag(),1),rg=!1,ng=!1;es.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(rg=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(ng=process?.env?.LOGGER_PERF_PREFIX==="true"));var HC={prefix:void 0,time:rg,delta:ng,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},cu=[],ig=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(",")}]`}},og=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Zi=!1,ui=class Tt{static ERROR=2;static WARN=4;static INFO=6;static LOG=6;static DEBUG=8;static VERBOSE=10;static firstLog=0;static lastLog=0;static setup(t=Tt.INFO,r={}){r=Object.assign({},HC,r),t>10&&console.debug("setup logger",{config:r});let n=this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}),i=(...u)=>{typeof window<"u"&&window?.FORCE_DISABLE_LOGLEVEL&&n(...u)};i.isDisabled=!0,i.isEnabled=!1;let o=this.wrapLog(console.groupCollapsed,r),a=(u,l)=>{function f(...I){let E=I[I.length-1];return E===i?E():(o(...I.slice(0,-1)),(async()=>{try{let _=E();return _ instanceof Promise?await _:_}finally{console.groupEnd()}})())}let d=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:l});return u?d:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:d})},s=a(t>=Tt.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(s(...u),new Error((0,WC.default)(u))),WARN:a(t>=Tt.WARN,this.wrapLog(console.warn,r)),LOG:a(t>=Tt.INFO,this.wrapLog(console.log,r)),DEBUG:a(t>=Tt.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:a(t>=Tt.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(es.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=es.isBrowser&&navigator.userAgent.includes("Chrome")?["",Tt.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(Zi?n.push(new og("dim",r.prefix)):n.push(r.prefix)),t.bind(console,...n)}}static timeStr(t,r,n=0){if(!performance.now)return;let i=performance.now();Tt.firstLog||(Tt.firstLog=i,Tt.lastLog=i);let o=new ig(i-Tt.firstLog,i-Tt.lastLog,t,r);return Tt.lastLog=i,n?o.toString():o}static getOriginFromStack(t){let r=!1;for(let n of t.split(`
|
|
62
|
+
`)){let i=n.match(/^\s+at\s+(.*)/);if(i){if(r)return i[1].trim().replace(__dirname,"");r=!0}}}};es.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(cu&&cu.length){for(let t of cu)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof ig))return null;Zi||(Zi=!0);let t=ui.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof og?(Zi||(Zi=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var{WARN:JC,LOG:UP,DEBUG:to,VERBOSE:PP,ERROR:Ds}=ui.setup(ui.INFO),Tc=["https://trustless-gateway.link/","https://ipfs.4everland.io/"].map(e=>({url:e}));async function _c(e,{readOnly:t=!0,pinnedCID:r,gateways:n=Tc}={}){let{cid:i,errors:o,isIpns:a}=oj(e);if(!i)throw Ds("Failed to parse pubID",e,o);to("[retrieveThread] parsedPubID",{cid:i.toString(),errors:o,isIpns:a});let s=await ag(i),{applogs:u,info:l}=await LC(s),f=u.filter(Ru);f.length&&JC(`Found ${f.length} encrypted logs - skipping`);let d=u.filter(E=>!Ru(E));go(d);let I=Do.fromArray(d,`preview${e&&e!==i.toString()?"-"+e:""}@${i.toString()}`,t);return{cid:i,info:l,thread:I,encryptedCount:f.length}}async function ag(e,t=Tc){return e=Lu(e),to("Retrieving:",e,e.toString(),"from",t),await Ec(t,async(r,n)=>{var i=sg(r,e);n>1&&(i+=`&cache-bust=${performance.now()}`);let o=await fetch(i),a=await XC(o,i);to("[retrieveCar] GW result",{result:a,gateway:r});let s=await fp.fromIterable(a);to("[retrieveCar] GW decodeResult",{car:s,gateway:r});let u=(await s.getRoots())[0];if(!ac(e)&&!xy(e,u))throw Ds("Fetched CAR has different CID",u.toString(),"than the one asked for:",e.toString());return s})}function sg(e,t,r="all"){let n=new URL(e.url),i=ac(t),o=`${n}${i?"ipns/":"ipfs/"}${t.toString()}?format=car&dag-scope=${r}`;return to({isIpns:i,url:o}),o}async function XC(e,t){if(!e?.ok||!e?.body)throw Ds("[retrieveCar] unexpected response",e?.statusText,{url:t});return zC(e.body.getReader())}async function Ec(e,t,r=1){try{return await Promise.any(Ca(e).map(async n=>{try{return await t(n,r)}catch(i){throw Ds("still trying",i),i instanceof Error?i:new Error(`[retrieveCar] error: ${i}`)}}))}catch(n){if(r<3)return await Ec(e,t,r+1);throw new Error("[Gateway] no valid results after 3 attempts via: "+Ca(e).map(({url:i})=>i)+`
|
|
63
|
+
`+n.errors.map(i=>i.message))}}var{WARN:h6,LOG:y6,DEBUG:g6,VERBOSE:m6,ERROR:b6}=Ce.setup(Ce.INFO),{WARN:QC,LOG:v6,DEBUG:ZC,VERBOSE:Rs,ERROR:w6}=Ce.setup(Ce.INFO),T6=at("queryDivergencesByPrev",function(e){ZC(`queryDivergencesByPrev<${e.nameAndSizeUntracked}>`),e.filters.includes("lastWriteWins")&&QC("queryDivergencesByPrev on thread lastWriteWins",e);let t=nr(()=>{let r=new Map,n=new Set;Rs("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())),Rs("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 Do(Ye({caller:"DivergenceLeaf",thread:e,pattern:`leaf: ${i}`}),r.get(i),e.filters,!0);return{log:o.latestLog,thread:o}})},{name:Ye({caller:"queryDivergencesByPrev",thread:e})});return Rs.isDisabled||qt(()=>Rs("[queryDivergencesByPrev] result:",Ar(t))),t},{equals:et.structural}),{WARN:_6,LOG:E6,DEBUG:x6,VERBOSE:O6,ERROR:A6}=ui.setup(ui.INFO);var{WARN:$6,LOG:j6,DEBUG:C6,VERBOSE:N6,ERROR:U6}=zs.setup(zs.INFO),YC="https://nftstorage.link";async function P6(e,{readOnly:t=!0,pinnedCID:r}={}){return _c(e,{readOnly:t,pinnedCID:r,gateways:[{url:YC}]})}export{YC as a,P6 as b};
|
|
64
|
+
/*! Bundled license information:
|
|
65
|
+
|
|
66
|
+
lodash-es/lodash.js:
|
|
67
|
+
(**
|
|
68
|
+
* @license
|
|
69
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
70
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
71
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
72
|
+
* Released under MIT license <https://lodash.com/license>
|
|
73
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
74
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
75
|
+
*)
|
|
76
|
+
|
|
77
|
+
@noble/hashes/utils.js:
|
|
78
|
+
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
79
|
+
*/
|
|
80
|
+
//# sourceMappingURL=chunk-3DHV7P2U.min.js.map
|