@wovin/connect-nftstorage 0.0.1-RC27 → 0.0.2
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.
- package/dist/{chunk-FO5ATFMT.min.js → chunk-NGDKLL6Y.min.js} +8 -8
- package/dist/{chunk-FO5ATFMT.min.js.map → chunk-NGDKLL6Y.min.js.map} +1 -1
- package/dist/chunk-Q7RF3VV2.min.js +16 -0
- package/dist/chunk-Q7RF3VV2.min.js.map +1 -0
- package/dist/chunk-ZATDQB6W.min.js +3 -0
- package/dist/chunk-ZATDQB6W.min.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/retrieve.min.js +1 -1
- package/dist/store.d.ts +1 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.min.js +1 -1
- package/package.json +9 -4
- package/dist/chunk-2UPIASCI.min.js +0 -3
- package/dist/chunk-2UPIASCI.min.js.map +0 -1
- package/dist/chunk-67IW34JW.min.js +0 -2
- package/dist/chunk-67IW34JW.min.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{b as Ti,d as zo,n as xi,o as bt,p as Go}from"./chunk-2UPIASCI.min.js";var Ru=Ti((rO,Cu)=>{"use strict";Cu.exports=ea;var Bu=128,xp=127,Op=~xp,Ep=Math.pow(2,31);function ea(e,t,r){if(Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw ea.bytes=0,new RangeError("Could not encode varint");t=t||[],r=r||0;for(var n=r;e>=Ep;)t[r++]=e&255|Bu,e/=128;for(;e&Op;)t[r++]=e&255|Bu,e>>>=7;return t[r]=e|0,ea.bytes=r-n+1,t}});var Du=Ti((nO,Lu)=>{"use strict";Lu.exports=ta;var Ap=128,Mu=127;function ta(e,n){var r=0,n=n||0,i=0,a=n,o,u=e.length;do{if(a>=u||i>49)throw ta.bytes=0,new RangeError("Could not decode varint");o=e[a++],r+=i<28?(o&Mu)<<i:(o&Mu)*Math.pow(2,i),i+=7}while(o>=Ap);return ta.bytes=a-n,r}});var Fu=Ti((iO,Vu)=>{"use strict";var Ip=Math.pow(2,7),Sp=Math.pow(2,14),$p=Math.pow(2,21),kp=Math.pow(2,28),Up=Math.pow(2,35),jp=Math.pow(2,42),Pp=Math.pow(2,49),Np=Math.pow(2,56),Bp=Math.pow(2,63);Vu.exports=function(e){return e<Ip?1:e<Sp?2:e<$p?3:e<kp?4:e<Up?5:e<jp?6:e<Pp?7:e<Np?8:e<Bp?9:10}});var Ci=Ti((oO,zu)=>{"use strict";zu.exports={encode:Ru(),decode:Du(),encodingLength:Fu()}});var Hd=["string","number","bigint","symbol"],qd=["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 Us(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(Hd.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(Wd(e))return"Buffer";let r=Jd(e);return r||"Object"}function Wd(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function Jd(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(qd.includes(t))return t}var D=class{constructor(t,r,n){this.major=t,this.majorEncoded=t<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(t){return this.major<t.major?-1:this.major>t.major?1:0}};D.uint=new D(0,"uint",!0);D.negint=new D(1,"negint",!0);D.bytes=new D(2,"bytes",!0);D.string=new D(3,"string",!0);D.array=new D(4,"array",!1);D.map=new D(5,"map",!1);D.tag=new D(6,"tag",!1);D.float=new D(7,"float",!0);D.false=new D(7,"false",!0);D.true=new D(7,"true",!0);D.null=new D(7,"null",!0);D.undefined=new D(7,"undefined",!0);D.break=new D(7,"break",!0);var ce=class{constructor(t,r,n){this.type=t,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};var Kr=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Xd=new TextDecoder,Yd=new TextEncoder;function Oi(e){return Kr&&globalThis.Buffer.isBuffer(e)}function Bs(e){return e instanceof Uint8Array?Oi(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Cs=Kr?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Ps(e,t,r):(e,t,r)=>r-t>64?Xd.decode(e.subarray(t,r)):Ps(e,t,r),Rs=Kr?e=>e.length>64?globalThis.Buffer.from(e):js(e):e=>e.length>64?Yd.encode(e):js(e);var Hr=Kr?(e,t,r)=>Oi(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Ms=Kr?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Bs(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},Ls=Kr?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Ds(e,t){if(Oi(e)&&Oi(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 js(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 Ps(e,t,r){let n=[];for(;t<r;){let i=e[t],a=null,o=i>239?4:i>223?3:i>191?2:1;if(t+o<=r){let u,l,c,m;switch(o){case 1:i<128&&(a=i);break;case 2:u=e[t+1],(u&192)===128&&(m=(i&31)<<6|u&63,m>127&&(a=m));break;case 3:u=e[t+1],l=e[t+2],(u&192)===128&&(l&192)===128&&(m=(i&15)<<12|(u&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:u=e[t+1],l=e[t+2],c=e[t+3],(u&192)===128&&(l&192)===128&&(c&192)===128&&(m=(i&15)<<18|(u&63)<<12|(l&63)<<6|c&63,m>65535&&m<1114112&&(a=m))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),t+=o}return Qd(n)}var Ns=4096;function Qd(e){let t=e.length;if(t<=Ns)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Ns));return r}var Zd=256,Ei=class{constructor(t=Zd){this.chunkSize=t,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(t){let r=this.chunks[this.chunks.length-1];if(this.cursor+t.length<=this.maxCursor+1){let i=r.length-(this.maxCursor-this.cursor)-1;r.set(t,i)}else{if(r){let i=r.length-(this.maxCursor-this.cursor)-1;i<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,i),this.maxCursor=this.cursor-1)}t.length<64&&t.length<this.chunkSize?(r=Ls(this.chunkSize),this.chunks.push(r),this.maxCursor+=r.length,this._initReuseChunk===null&&(this._initReuseChunk=r),r.set(t,0)):(this.chunks.push(t),this.maxCursor+=t.length)}this.cursor+=t.length}toBytes(t=!1){let r;if(this.chunks.length===1){let n=this.chunks[0];t&&this.cursor>n.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=Hr(n,0,this.cursor)}else r=Ms(this.chunks,this.cursor);return t&&this.reset(),r}};var ve="CBOR decode error:",Ko="CBOR encode error:",In=[];In[23]=1;In[24]=2;In[25]=3;In[26]=5;In[27]=9;function Mt(e,t,r){if(e.length-t<r)throw new Error(`${ve} not enough data for type`)}var Ve=[24,256,65536,4294967296,BigInt("18446744073709551616")];function tt(e,t,r){Mt(e,t,1);let n=e[t];if(r.strict===!0&&n<Ve[0])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);return n}function rt(e,t,r){Mt(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<Ve[1])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);return n}function nt(e,t,r){Mt(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<Ve[2])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);return n}function it(e,t,r){Mt(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],a=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&a<Ve[3])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);if(a<=Number.MAX_SAFE_INTEGER)return Number(a);if(r.allowBigInt===!0)return a;throw new Error(`${ve} integers outside of the safe integer range are not supported`)}function Vs(e,t,r,n){return new ce(D.uint,tt(e,t+1,n),2)}function Fs(e,t,r,n){return new ce(D.uint,rt(e,t+1,n),3)}function zs(e,t,r,n){return new ce(D.uint,nt(e,t+1,n),5)}function Gs(e,t,r,n){return new ce(D.uint,it(e,t+1,n),9)}function ct(e,t){return Fe(e,0,t.value)}function Fe(e,t,r){if(r<Ve[0]){let n=Number(r);e.push([t|n])}else if(r<Ve[1]){let n=Number(r);e.push([t|24,n])}else if(r<Ve[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<Ve[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<Ve[4]){let i=[t|27,0,0,0,0,0,0,0],a=Number(n&BigInt(4294967295)),o=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=a&255,a=a>>8,i[7]=a&255,a=a>>8,i[6]=a&255,a=a>>8,i[5]=a&255,i[4]=o&255,o=o>>8,i[3]=o&255,o=o>>8,i[2]=o&255,o=o>>8,i[1]=o&255,e.push(i)}else throw new Error(`${ve} encountered BigInt larger than allowable range`)}}ct.encodedSize=function(t){return Fe.encodedSize(t.value)};Fe.encodedSize=function(t){return t<Ve[0]?1:t<Ve[1]?2:t<Ve[2]?3:t<Ve[3]?5:9};ct.compareTokens=function(t,r){return t.value<r.value?-1:t.value>r.value?1:0};function Ks(e,t,r,n){return new ce(D.negint,-1-tt(e,t+1,n),2)}function Hs(e,t,r,n){return new ce(D.negint,-1-rt(e,t+1,n),3)}function qs(e,t,r,n){return new ce(D.negint,-1-nt(e,t+1,n),5)}var Ho=BigInt(-1),Ws=BigInt(1);function Js(e,t,r,n){let i=it(e,t+1,n);if(typeof i!="bigint"){let a=-1-i;if(a>=Number.MIN_SAFE_INTEGER)return new ce(D.negint,a,9)}if(n.allowBigInt!==!0)throw new Error(`${ve} integers outside of the safe integer range are not supported`);return new ce(D.negint,Ho-BigInt(i),9)}function Ai(e,t){let r=t.value,n=typeof r=="bigint"?r*Ho-Ws:r*-1-1;Fe(e,t.type.majorEncoded,n)}Ai.encodedSize=function(t){let r=t.value,n=typeof r=="bigint"?r*Ho-Ws:r*-1-1;return n<Ve[0]?1:n<Ve[1]?2:n<Ve[2]?3:n<Ve[3]?5:9};Ai.compareTokens=function(t,r){return t.value<r.value?1:t.value>r.value?-1:0};function Sn(e,t,r,n){Mt(e,t,r+n);let i=Hr(e,t+r,t+r+n);return new ce(D.bytes,i,r+n)}function Xs(e,t,r,n){return Sn(e,t,1,r)}function Ys(e,t,r,n){return Sn(e,t,2,tt(e,t+1,n))}function Qs(e,t,r,n){return Sn(e,t,3,rt(e,t+1,n))}function Zs(e,t,r,n){return Sn(e,t,5,nt(e,t+1,n))}function eu(e,t,r,n){let i=it(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer bytes lengths not supported`);return Sn(e,t,9,i)}function Ii(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===D.string?Rs(e.value):e.value),e.encodedBytes}function qr(e,t){let r=Ii(t);Fe(e,t.type.majorEncoded,r.length),e.push(r)}qr.encodedSize=function(t){let r=Ii(t);return Fe.encodedSize(r.length)+r.length};qr.compareTokens=function(t,r){return tp(Ii(t),Ii(r))};function tp(e,t){return e.length<t.length?-1:e.length>t.length?1:Ds(e,t)}function $n(e,t,r,n,i){let a=r+n;Mt(e,t,a);let o=new ce(D.string,Cs(e,t+r,t+a),a);return i.retainStringBytes===!0&&(o.byteValue=Hr(e,t+r,t+a)),o}function tu(e,t,r,n){return $n(e,t,1,r,n)}function ru(e,t,r,n){return $n(e,t,2,tt(e,t+1,n),n)}function nu(e,t,r,n){return $n(e,t,3,rt(e,t+1,n),n)}function iu(e,t,r,n){return $n(e,t,5,nt(e,t+1,n),n)}function ou(e,t,r,n){let i=it(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer string lengths not supported`);return $n(e,t,9,i,n)}var au=qr;function Wr(e,t,r,n){return new ce(D.array,n,r)}function su(e,t,r,n){return Wr(e,t,1,r)}function uu(e,t,r,n){return Wr(e,t,2,tt(e,t+1,n))}function cu(e,t,r,n){return Wr(e,t,3,rt(e,t+1,n))}function lu(e,t,r,n){return Wr(e,t,5,nt(e,t+1,n))}function fu(e,t,r,n){let i=it(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer array lengths not supported`);return Wr(e,t,9,i)}function du(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return Wr(e,t,1,1/0)}function Si(e,t){Fe(e,D.array.majorEncoded,t.value)}Si.compareTokens=ct.compareTokens;Si.encodedSize=function(t){return Fe.encodedSize(t.value)};function Jr(e,t,r,n){return new ce(D.map,n,r)}function pu(e,t,r,n){return Jr(e,t,1,r)}function hu(e,t,r,n){return Jr(e,t,2,tt(e,t+1,n))}function yu(e,t,r,n){return Jr(e,t,3,rt(e,t+1,n))}function mu(e,t,r,n){return Jr(e,t,5,nt(e,t+1,n))}function gu(e,t,r,n){let i=it(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer map lengths not supported`);return Jr(e,t,9,i)}function vu(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return Jr(e,t,1,1/0)}function $i(e,t){Fe(e,D.map.majorEncoded,t.value)}$i.compareTokens=ct.compareTokens;$i.encodedSize=function(t){return Fe.encodedSize(t.value)};function bu(e,t,r,n){return new ce(D.tag,r,1)}function wu(e,t,r,n){return new ce(D.tag,tt(e,t+1,n),2)}function _u(e,t,r,n){return new ce(D.tag,rt(e,t+1,n),3)}function Tu(e,t,r,n){return new ce(D.tag,nt(e,t+1,n),5)}function xu(e,t,r,n){return new ce(D.tag,it(e,t+1,n),9)}function ki(e,t){Fe(e,D.tag.majorEncoded,t.value)}ki.compareTokens=ct.compareTokens;ki.encodedSize=function(t){return Fe.encodedSize(t.value)};var sp=20,up=21,cp=22,lp=23;function Ou(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${ve} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ce(D.null,null,1):new ce(D.undefined,void 0,1)}function Eu(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return new ce(D.break,void 0,1)}function qo(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${ve} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${ve} Infinity values are not supported`)}return new ce(D.float,e,t)}function Au(e,t,r,n){return qo(Wo(e,t+1),3,n)}function Iu(e,t,r,n){return qo(Jo(e,t+1),5,n)}function Su(e,t,r,n){return qo(ju(e,t+1),9,n)}function Ui(e,t,r){let n=t.value;if(n===!1)e.push([D.float.majorEncoded|sp]);else if(n===!0)e.push([D.float.majorEncoded|up]);else if(n===null)e.push([D.float.majorEncoded|cp]);else if(n===void 0)e.push([D.float.majorEncoded|lp]);else{let i,a=!1;(!r||r.float64!==!0)&&(ku(n),i=Wo(wt,1),n===i||Number.isNaN(n)?(wt[0]=249,e.push(wt.slice(0,3)),a=!0):(Uu(n),i=Jo(wt,1),n===i&&(wt[0]=250,e.push(wt.slice(0,5)),a=!0))),a||(fp(n),i=ju(wt,1),wt[0]=251,e.push(wt.slice(0,9)))}}Ui.encodedSize=function(t,r){let n=t.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){ku(n);let i=Wo(wt,1);if(n===i||Number.isNaN(n))return 3;if(Uu(n),i=Jo(wt,1),n===i)return 5}return 9};var $u=new ArrayBuffer(9),lt=new DataView($u,1),wt=new Uint8Array($u,0);function ku(e){if(e===1/0)lt.setUint16(0,31744,!1);else if(e===-1/0)lt.setUint16(0,64512,!1);else if(Number.isNaN(e))lt.setUint16(0,32256,!1);else{lt.setFloat32(0,e);let t=lt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)lt.setUint16(0,31744,!1);else if(r===0)lt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?lt.setUint16(0,0):i<-14?lt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):lt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Wo(e,t){if(e.length-t<2)throw new Error(`${ve} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,a;return n===0?a=i*2**-24:n!==31?a=(i+1024)*2**(n-25):a=i===0?1/0:NaN,r&32768?-a:a}function Uu(e){lt.setFloat32(0,e,!1)}function Jo(e,t){if(e.length-t<4)throw new Error(`${ve} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function fp(e){lt.setFloat64(0,e,!1)}function ju(e,t){if(e.length-t<8)throw new Error(`${ve} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Ui.compareTokens=ct.compareTokens;function xe(e,t,r){throw new Error(`${ve} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function ji(e){return()=>{throw new Error(`${ve} ${e}`)}}var ie=[];for(let e=0;e<=23;e++)ie[e]=xe;ie[24]=Vs;ie[25]=Fs;ie[26]=zs;ie[27]=Gs;ie[28]=xe;ie[29]=xe;ie[30]=xe;ie[31]=xe;for(let e=32;e<=55;e++)ie[e]=xe;ie[56]=Ks;ie[57]=Hs;ie[58]=qs;ie[59]=Js;ie[60]=xe;ie[61]=xe;ie[62]=xe;ie[63]=xe;for(let e=64;e<=87;e++)ie[e]=Xs;ie[88]=Ys;ie[89]=Qs;ie[90]=Zs;ie[91]=eu;ie[92]=xe;ie[93]=xe;ie[94]=xe;ie[95]=ji("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ie[e]=tu;ie[120]=ru;ie[121]=nu;ie[122]=iu;ie[123]=ou;ie[124]=xe;ie[125]=xe;ie[126]=xe;ie[127]=ji("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ie[e]=su;ie[152]=uu;ie[153]=cu;ie[154]=lu;ie[155]=fu;ie[156]=xe;ie[157]=xe;ie[158]=xe;ie[159]=du;for(let e=160;e<=183;e++)ie[e]=pu;ie[184]=hu;ie[185]=yu;ie[186]=mu;ie[187]=gu;ie[188]=xe;ie[189]=xe;ie[190]=xe;ie[191]=vu;for(let e=192;e<=215;e++)ie[e]=bu;ie[216]=wu;ie[217]=_u;ie[218]=Tu;ie[219]=xu;ie[220]=xe;ie[221]=xe;ie[222]=xe;ie[223]=xe;for(let e=224;e<=243;e++)ie[e]=ji("simple values are not supported");ie[244]=xe;ie[245]=xe;ie[246]=xe;ie[247]=Ou;ie[248]=ji("simple values are not supported");ie[249]=Au;ie[250]=Iu;ie[251]=Su;ie[252]=xe;ie[253]=xe;ie[254]=xe;ie[255]=Eu;var _t=[];for(let e=0;e<24;e++)_t[e]=new ce(D.uint,e,1);for(let e=-1;e>=-24;e--)_t[31-e]=new ce(D.negint,e,1);_t[64]=new ce(D.bytes,new Uint8Array(0),1);_t[96]=new ce(D.string,"",1);_t[128]=new ce(D.array,0,1);_t[160]=new ce(D.map,0,1);_t[244]=new ce(D.false,!1,1);_t[245]=new ce(D.true,!0,1);_t[246]=new ce(D.null,null,1);function Xo(){let e=[];return e[D.uint.major]=ct,e[D.negint.major]=Ai,e[D.bytes.major]=qr,e[D.string.major]=au,e[D.array.major]=Si,e[D.map.major]=$i,e[D.tag.major]=ki,e[D.float.major]=Ui,e}var Kx=Xo(),Hx=new Ei,Ni=class e{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(`${Ko} object contains circular references`);return new e(r,t)}},qt={null:new ce(D.null,null),undefined:new ce(D.undefined,void 0),true:new ce(D.true,!0),false:new ce(D.false,!1),emptyArray:new ce(D.array,0),emptyMap:new ce(D.map,0)},Wt={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ce(D.float,e):e>=0?new ce(D.uint,e):new ce(D.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ce(D.uint,e):new ce(D.negint,e)},Uint8Array(e,t,r,n){return new ce(D.bytes,e)},string(e,t,r,n){return new ce(D.string,e)},boolean(e,t,r,n){return e?qt.true:qt.false},null(e,t,r,n){return qt.null},undefined(e,t,r,n){return qt.undefined},ArrayBuffer(e,t,r,n){return new ce(D.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ce(D.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[qt.emptyArray,new ce(D.break)]:qt.emptyArray;n=Ni.createCheck(n,e);let i=[],a=0;for(let o of e)i[a++]=Pi(o,r,n);return r.addBreakTokens?[new ce(D.array,e.length),i,new ce(D.break)]:[new ce(D.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",a=i?e.keys():Object.keys(e),o=i?e.size:a.length;if(!o)return r.addBreakTokens===!0?[qt.emptyMap,new ce(D.break)]:qt.emptyMap;n=Ni.createCheck(n,e);let u=[],l=0;for(let c of a)u[l++]=[Pi(c,r,n),Pi(i?e.get(c):e[c],r,n)];return hp(u,r),r.addBreakTokens?[new ce(D.map,o),u,new ce(D.break)]:[new ce(D.map,o),u]}};Wt.Map=Wt.Object;Wt.Buffer=Wt.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Wt[`${e}Array`]=Wt.DataView;function Pi(e,t={},r){let n=Us(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Wt[n];if(typeof i=="function"){let o=i(e,n,t,r);if(o!=null)return o}let a=Wt[n];if(!a)throw new Error(`${Ko} unsupported type: ${n}`);return a(e,n,t,r)}function hp(e,t){t.mapSorter&&e.sort(t.mapSorter)}var yp={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Yo=class{constructor(t,r={}){this._pos=0,this.data=t,this.options=r}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let t=this.data[this._pos],r=_t[t];if(r===void 0){let n=ie[t];if(!n)throw new Error(`${ve} no decoder for major type ${t>>>5} (byte 0x${t.toString(16).padStart(2,"0")})`);let i=t&31;r=n(this.data,this._pos,i,this.options)}return this._pos+=r.encodedLength,r}},kn=Symbol.for("DONE"),Bi=Symbol.for("BREAK");function mp(e,t,r){let n=[];for(let i=0;i<e.value;i++){let a=Un(t,r);if(a===Bi){if(e.value===1/0)break;throw new Error(`${ve} got unexpected break to lengthed array`)}if(a===kn)throw new Error(`${ve} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=a}return n}function gp(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},a=n?new Map:void 0;for(let o=0;o<e.value;o++){let u=Un(t,r);if(u===Bi){if(e.value===1/0)break;throw new Error(`${ve} got unexpected break to lengthed map`)}if(u===kn)throw new Error(`${ve} found map but not enough entries (got ${o} [no key], expected ${e.value})`);if(n!==!0&&typeof u!="string")throw new Error(`${ve} non-string keys not supported (got ${typeof u})`);if(r.rejectDuplicateMapKeys===!0&&(n&&a.has(u)||!n&&u in i))throw new Error(`${ve} found repeat map key "${u}"`);let l=Un(t,r);if(l===kn)throw new Error(`${ve} found map but not enough entries (got ${o} [no value], expected ${e.value})`);n?a.set(u,l):i[u]=l}return n?a:i}function Un(e,t){if(e.done())return kn;let r=e.next();if(r.type===D.break)return Bi;if(r.type.terminal)return r.value;if(r.type===D.array)return mp(r,e,t);if(r.type===D.map)return gp(r,e,t);if(r.type===D.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Un(e,t);return t.tags[r.value](n)}throw new Error(`${ve} tag not supported (${r.value})`)}throw new Error("unsupported")}function Pu(e,t){if(!(e instanceof Uint8Array))throw new Error(`${ve} data to decode must be a Uint8Array`);t=Object.assign({},yp,t);let r=t.tokenizer||new Yo(e,t),n=Un(r,t);if(n===kn)throw new Error(`${ve} did not find any content to decode`);if(n===Bi)throw new Error(`${ve} got unexpected break`);return[n,e.subarray(r.pos())]}function Qo(e,t){let[r,n]=Pu(e,t);if(n.length>0)throw new Error(`${ve} too many terminals, data makes no sense`);return r}var wp=42;function _p(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return bt.decode(e.subarray(1))}var Nu={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Nu.tags[wp]=_p;var Zo=e=>Qo(e,Nu);var Jt=zo(Ci(),1),jn={SHA2_256:18,LENGTH:32,DAG_PB:112},ra=40;function Xr(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=Jt.default.decode(e);return t.seek(Jt.default.decode.bytes),r}function na(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 ia(e){Jt.default.decode(e);let t=Jt.default.decode.bytes,r=Jt.default.decode(e.subarray(Jt.default.decode.bytes)),n=Jt.default.decode.bytes;return t+n+r}var Xt={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},Pn={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Xt.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Xt.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Pn["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 a=e[i];if(a=Pn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](a),a===void 0)return;n.push(a)}return n}}return e}},Int:Xt.Int,CarV1HeaderOrV2Pragma:e=>{if(Xt.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[a,o]=t[i];switch(a){case"roots":{let u=Pn["CarV1HeaderOrV2Pragma > roots (anon)"](e[a]);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.roots=u}}break;case"version":{n--;let u=Pn.Int(e[a]);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.version=u}}break;default:return}}if(!(n>0))return r}},Nn={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Xt.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Xt.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Nn["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 a=e[i];if(a=Nn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](a),a===void 0)return;n.push(a)}return n}}return e}},Int:Xt.Int,CarV1HeaderOrV2Pragma:e=>{if(Xt.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[a,o]=t[i];switch(a){case"roots":{let u=Nn["CarV1HeaderOrV2Pragma > roots (anon)"](o);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.roots=u}}break;case"version":{n--;let u=Nn.Int(o);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.version=u}}break;default:return}}if(!(n>0))return r}},oa={toTyped:Pn.CarV1HeaderOrV2Pragma,toRepresentation:Nn.CarV1HeaderOrV2Pragma};var mO=Xo();var Lp=zo(Ci(),1);var _O=[new ce(D.map,2),new ce(D.string,"version"),new ce(D.uint,1),new ce(D.string,"roots")],TO=new ce(D.tag,42);async function aa(e,t){let r=Xr(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=Zo(n);if(oa.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 a=na(await e.exactly(ra,!0));e.seek(a.dataOffset-e.pos);let o=await aa(e,1);return Object.assign(o,a)}async function Vp(e){let t=await e.exactly(2,!1);if(t[0]===jn.SHA2_256&&t[1]===jn.LENGTH){let o=await e.exactly(34,!0),u=xi(o);return bt.create(0,jn.DAG_PB,u)}let r=Xr(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=Xr(await e.upTo(8),e),i=await e.exactly(ia(await e.upTo(8)),!0),a=xi(i);return bt.create(r,n,a)}async function Gu(e){let t=e.pos,r=Xr(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await Vp(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function Fp(e){let{cid:t,blockLength:r}=await Gu(e);return{bytes:await e.exactly(r,!0),cid:t}}async function zp(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await Gu(e),a={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(a.blockLength),a}function Yr(e){let t=(async()=>{let r=await aa(e);if(r.version===2){let n=e.pos-r.dataOffset;e=Kp(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await Fp(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await zp(e)}}}function br(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 Gp(e){let t=0,r=0,n=0,i=new Uint8Array(0),a=async o=>{r=i.length-n;let u=[i.subarray(n)];for(;r<o;){let c=await e();if(c==null)break;r<0?c.length>r&&u.push(c.subarray(-r)):u.push(c),r+=c.length}i=new Uint8Array(u.reduce((c,m)=>c+m.length,0));let l=0;for(let c of u)i.set(c,l),l+=c.length;n=0};return{async upTo(o){return i.length-n<o&&await a(o),i.subarray(n,n+Math.min(i.length-n,o))},async exactly(o,u=!1){if(i.length-n<o&&await a(o),i.length-n<o)throw new Error("Unexpected end of data");let l=i.subarray(n,n+o);return u&&(t+=o,n+=o),l},seek(o){t+=o,n+=o},get pos(){return t}}}function Qr(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return Gp(r)}function Kp(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 a=await e.exactly(n,i);if(a.length+r>t)throw new Error("Unexpected end of data");return i&&(r+=n),a},seek(n){r+=n,e.seek(n)},get pos(){return e.pos}}}var Bn=class{constructor(t,r,n){this._version=t,this._roots=r,this._iterator=n}get version(){return this._version}async getRoots(){return this._roots}[Symbol.asyncIterator](){return this._iterator}static async fromBytes(t){if(!(t instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Ku(br(t))}static async fromIterable(t){if(!t||typeof t[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Ku(Qr(t))}};async function Ku(e){let t=Yr(e),{version:r,roots:n}=await t.header();return new Bn(r,n,t.blocksIndex())}var wr=class{constructor(t,r){this._header=t,this._blocks=r,this._keys=r.map(n=>n.cid.toString())}get version(){return this._header.version}async getRoots(){return this._header.roots}async has(t){return this._keys.indexOf(t.toString())>-1}async get(t){let r=this._keys.indexOf(t.toString());return r>-1?this._blocks[r]:void 0}async*blocks(){for(let t of this._blocks)yield t}async*cids(){for(let t of this._blocks)yield t.cid}static async fromBytes(t){if(!(t instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Hu(br(t))}static async fromIterable(t){if(!t||typeof t[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Hu(Qr(t))}};async function Hu(e){let t=Yr(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new wr(r,n)}var Ri=class{constructor(t,r,n){this._version=t,this._roots=r,this._iterable=n,this._decoded=!1}get version(){return this._version}async getRoots(){return this._roots}},sa=class e extends Ri{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");return this._decoded=!0,this._iterable[Symbol.asyncIterator]()}static async fromBytes(t){let{version:r,roots:n,iterator:i}=await qu(t);return new e(r,n,i)}static async fromIterable(t){let{version:r,roots:n,iterator:i}=await Wu(t);return new e(r,n,i)}},ua=class e extends Ri{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");this._decoded=!0;let t=this._iterable[Symbol.asyncIterator]();return{async next(){let r=await t.next();return r.done?r:{done:!1,value:r.value.cid}}}}static async fromBytes(t){let{version:r,roots:n,iterator:i}=await qu(t);return new e(r,n,i)}static async fromIterable(t){let{version:r,roots:n,iterator:i}=await Wu(t);return new e(r,n,i)}};async function qu(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Ju(br(e))}async function Wu(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Ju(Qr(e))}async function Ju(e){let t=Yr(e),{version:r,roots:n}=await t.header();return{version:r,roots:n,iterator:t.blocks()}}var Hp=zo(Ci(),1);var Xu=class{constructor(t){this._iterator=t}[Symbol.asyncIterator](){if(this._iterating)throw new Error("Multiple iterator not supported");return this._iterating=!0,this._iterator}};var qp=Object.create,qi=Object.defineProperty,Wp=Object.getOwnPropertyDescriptor,Jp=Object.getOwnPropertyNames,Xp=Object.getPrototypeOf,Yp=Object.prototype.hasOwnProperty,Qp=(e,t,r)=>t in e?qi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Re=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),uc=(e,t)=>{for(var r in t)qi(e,r,{get:t[r],enumerable:!0})},Zp=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Jp(t))!Yp.call(e,i)&&i!==r&&qi(e,i,{get:()=>t[i],enumerable:!(n=Wp(t,i))||n.enumerable});return e},Lt=(e,t,r)=>(r=e!=null?qp(Xp(e)):{},Zp(t||!e||!e.__esModule?qi(r,"default",{value:e,enumerable:!0}):r,e)),$t=(e,t,r)=>(Qp(e,typeof t!="symbol"?t+"":t,r),r),eh={};uc(eh,{code:()=>Sc,decode:()=>Qi,encode:()=>ka,format:()=>ac,name:()=>om,parse:()=>sm,stringify:()=>ac});var th=["string","number","bigint","symbol"],rh=["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 nh(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return th.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":ih(e)?"Buffer":oh(e)||"Object"}function ih(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function oh(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(rh.includes(t))return t}var P=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}};P.uint=new P(0,"uint",!0);P.negint=new P(1,"negint",!0);P.bytes=new P(2,"bytes",!0);P.string=new P(3,"string",!0);P.array=new P(4,"array",!1);P.map=new P(5,"map",!1);P.tag=new P(6,"tag",!1);P.float=new P(7,"float",!0);P.false=new P(7,"false",!0);P.true=new P(7,"true",!0);P.null=new P(7,"null",!0);P.undefined=new P(7,"undefined",!0);P.break=new P(7,"break",!0);var Y=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}`}},Zr=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",ah=new TextDecoder,sh=new TextEncoder;function Di(e){return Zr&&globalThis.Buffer.isBuffer(e)}function ma(e){return e instanceof Uint8Array?Di(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var uh=Zr?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Qu(e,t,r):(e,t,r)=>r-t>64?ah.decode(e.subarray(t,r)):Qu(e,t,r),cc=Zr?e=>e.length>64?globalThis.Buffer.from(e):Yu(e):e=>e.length>64?sh.encode(e):Yu(e);var ga=Zr?(e,t,r)=>Di(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),ch=Zr?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),ma(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},lh=Zr?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function fh(e,t){if(Di(e)&&Di(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 Yu(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 Qu(e,t,r){let n=[];for(;t<r;){let i=e[t],a=null,o=i>239?4:i>223?3:i>191?2:1;if(t+o<=r){let u,l,c,m;switch(o){case 1:i<128&&(a=i);break;case 2:u=e[t+1],(u&192)===128&&(m=(i&31)<<6|u&63,m>127&&(a=m));break;case 3:u=e[t+1],l=e[t+2],(u&192)===128&&(l&192)===128&&(m=(i&15)<<12|(u&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:u=e[t+1],l=e[t+2],c=e[t+3],(u&192)===128&&(l&192)===128&&(c&192)===128&&(m=(i&15)<<18|(u&63)<<12|(l&63)<<6|c&63,m>65535&&m<1114112&&(a=m))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),t+=o}return lc(n)}var Zu=4096;function lc(e){let t=e.length;if(t<=Zu)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Zu));return r}var dh=256,fc=class{constructor(e=dh){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=lh(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=ga(r,0,this.cursor)}else t=ch(this.chunks,this.cursor);return e&&this.reset(),t}},he="CBOR decode error:",_r="CBOR encode error:",Vn=[];Vn[23]=1;Vn[24]=2;Vn[25]=3;Vn[26]=5;Vn[27]=9;function en(e,t,r){if(e.length-t<r)throw new Error(`${he} not enough data for type`)}var ze=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Tr(e,t,r){en(e,t,1);let n=e[t];if(r.strict===!0&&n<ze[0])throw new Error(`${he} integer encoded in more bytes than necessary (strict decode)`);return n}function xr(e,t,r){en(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<ze[1])throw new Error(`${he} integer encoded in more bytes than necessary (strict decode)`);return n}function Or(e,t,r){en(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<ze[2])throw new Error(`${he} integer encoded in more bytes than necessary (strict decode)`);return n}function Er(e,t,r){en(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],a=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&a<ze[3])throw new Error(`${he} integer encoded in more bytes than necessary (strict decode)`);if(a<=Number.MAX_SAFE_INTEGER)return Number(a);if(r.allowBigInt===!0)return a;throw new Error(`${he} integers outside of the safe integer range are not supported`)}function ph(e,t,r,n){return new Y(P.uint,Tr(e,t+1,n),2)}function hh(e,t,r,n){return new Y(P.uint,xr(e,t+1,n),3)}function yh(e,t,r,n){return new Y(P.uint,Or(e,t+1,n),5)}function mh(e,t,r,n){return new Y(P.uint,Er(e,t+1,n),9)}function Ar(e,t){return dt(e,0,t.value)}function dt(e,t,r){if(r<ze[0]){let n=Number(r);e.push([t|n])}else if(r<ze[1]){let n=Number(r);e.push([t|24,n])}else if(r<ze[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<ze[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<ze[4]){let i=[t|27,0,0,0,0,0,0,0],a=Number(n&BigInt(4294967295)),o=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=a&255,a=a>>8,i[7]=a&255,a=a>>8,i[6]=a&255,a=a>>8,i[5]=a&255,i[4]=o&255,o=o>>8,i[3]=o&255,o=o>>8,i[2]=o&255,o=o>>8,i[1]=o&255,e.push(i)}else throw new Error(`${he} encountered BigInt larger than allowable range`)}}Ar.encodedSize=function(e){return dt.encodedSize(e.value)};dt.encodedSize=function(e){return e<ze[0]?1:e<ze[1]?2:e<ze[2]?3:e<ze[3]?5:9};Ar.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function gh(e,t,r,n){return new Y(P.negint,-1-Tr(e,t+1,n),2)}function vh(e,t,r,n){return new Y(P.negint,-1-xr(e,t+1,n),3)}function bh(e,t,r,n){return new Y(P.negint,-1-Or(e,t+1,n),5)}var va=BigInt(-1),dc=BigInt(1);function wh(e,t,r,n){let i=Er(e,t+1,n);if(typeof i!="bigint"){let a=-1-i;if(a>=Number.MIN_SAFE_INTEGER)return new Y(P.negint,a,9)}if(n.allowBigInt!==!0)throw new Error(`${he} integers outside of the safe integer range are not supported`);return new Y(P.negint,va-BigInt(i),9)}function ba(e,t){let r=t.value,n=typeof r=="bigint"?r*va-dc:r*-1-1;dt(e,t.type.majorEncoded,n)}ba.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*va-dc:t*-1-1;return r<ze[0]?1:r<ze[1]?2:r<ze[2]?3:r<ze[3]?5:9};ba.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Fn(e,t,r,n){en(e,t,r+n);let i=ga(e,t+r,t+r+n);return new Y(P.bytes,i,r+n)}function _h(e,t,r,n){return Fn(e,t,1,r)}function Th(e,t,r,n){return Fn(e,t,2,Tr(e,t+1,n))}function xh(e,t,r,n){return Fn(e,t,3,xr(e,t+1,n))}function Oh(e,t,r,n){return Fn(e,t,5,Or(e,t+1,n))}function Eh(e,t,r,n){let i=Er(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer bytes lengths not supported`);return Fn(e,t,9,i)}function Vi(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===P.string?cc(e.value):e.value),e.encodedBytes}function Wi(e,t){let r=Vi(t);dt(e,t.type.majorEncoded,r.length),e.push(r)}Wi.encodedSize=function(e){let t=Vi(e);return dt.encodedSize(t.length)+t.length};Wi.compareTokens=function(e,t){return Ah(Vi(e),Vi(t))};function Ah(e,t){return e.length<t.length?-1:e.length>t.length?1:fh(e,t)}function zn(e,t,r,n,i){let a=r+n;en(e,t,a);let o=new Y(P.string,uh(e,t+r,t+a),a);return i.retainStringBytes===!0&&(o.byteValue=ga(e,t+r,t+a)),o}function Ih(e,t,r,n){return zn(e,t,1,r,n)}function Sh(e,t,r,n){return zn(e,t,2,Tr(e,t+1,n),n)}function $h(e,t,r,n){return zn(e,t,3,xr(e,t+1,n),n)}function kh(e,t,r,n){return zn(e,t,5,Or(e,t+1,n),n)}function Uh(e,t,r,n){let i=Er(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer string lengths not supported`);return zn(e,t,9,i,n)}var jh=Wi;function tn(e,t,r,n){return new Y(P.array,n,r)}function Ph(e,t,r,n){return tn(e,t,1,r)}function Nh(e,t,r,n){return tn(e,t,2,Tr(e,t+1,n))}function Bh(e,t,r,n){return tn(e,t,3,xr(e,t+1,n))}function Ch(e,t,r,n){return tn(e,t,5,Or(e,t+1,n))}function Rh(e,t,r,n){let i=Er(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer array lengths not supported`);return tn(e,t,9,i)}function Mh(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${he} indefinite length items not allowed`);return tn(e,t,1,1/0)}function wa(e,t){dt(e,P.array.majorEncoded,t.value)}wa.compareTokens=Ar.compareTokens;wa.encodedSize=function(e){return dt.encodedSize(e.value)};function rn(e,t,r,n){return new Y(P.map,n,r)}function Lh(e,t,r,n){return rn(e,t,1,r)}function Dh(e,t,r,n){return rn(e,t,2,Tr(e,t+1,n))}function Vh(e,t,r,n){return rn(e,t,3,xr(e,t+1,n))}function Fh(e,t,r,n){return rn(e,t,5,Or(e,t+1,n))}function zh(e,t,r,n){let i=Er(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer map lengths not supported`);return rn(e,t,9,i)}function Gh(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${he} indefinite length items not allowed`);return rn(e,t,1,1/0)}function _a(e,t){dt(e,P.map.majorEncoded,t.value)}_a.compareTokens=Ar.compareTokens;_a.encodedSize=function(e){return dt.encodedSize(e.value)};function Kh(e,t,r,n){return new Y(P.tag,r,1)}function Hh(e,t,r,n){return new Y(P.tag,Tr(e,t+1,n),2)}function qh(e,t,r,n){return new Y(P.tag,xr(e,t+1,n),3)}function Wh(e,t,r,n){return new Y(P.tag,Or(e,t+1,n),5)}function Jh(e,t,r,n){return new Y(P.tag,Er(e,t+1,n),9)}function Ta(e,t){dt(e,P.tag.majorEncoded,t.value)}Ta.compareTokens=Ar.compareTokens;Ta.encodedSize=function(e){return dt.encodedSize(e.value)};var Xh=20,Yh=21,Qh=22,Zh=23;function ey(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${he} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new Y(P.null,null,1):new Y(P.undefined,void 0,1)}function ty(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${he} indefinite length items not allowed`);return new Y(P.break,void 0,1)}function xa(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${he} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${he} Infinity values are not supported`)}return new Y(P.float,e,t)}function ry(e,t,r,n){return xa(Ea(e,t+1),3,n)}function ny(e,t,r,n){return xa(Aa(e,t+1),5,n)}function iy(e,t,r,n){return xa(mc(e,t+1),9,n)}function Oa(e,t,r){let n=t.value;if(n===!1)e.push([P.float.majorEncoded|Xh]);else if(n===!0)e.push([P.float.majorEncoded|Yh]);else if(n===null)e.push([P.float.majorEncoded|Qh]);else if(n===void 0)e.push([P.float.majorEncoded|Zh]);else{let i,a=!1;(!r||r.float64!==!0)&&(hc(n),i=Ea(xt,1),n===i||Number.isNaN(n)?(xt[0]=249,e.push(xt.slice(0,3)),a=!0):(yc(n),i=Aa(xt,1),n===i&&(xt[0]=250,e.push(xt.slice(0,5)),a=!0))),a||(oy(n),i=mc(xt,1),xt[0]=251,e.push(xt.slice(0,9)))}}Oa.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){hc(r);let n=Ea(xt,1);if(r===n||Number.isNaN(r))return 3;if(yc(r),n=Aa(xt,1),r===n)return 5}return 9};var pc=new ArrayBuffer(9),ft=new DataView(pc,1),xt=new Uint8Array(pc,0);function hc(e){if(e===1/0)ft.setUint16(0,31744,!1);else if(e===-1/0)ft.setUint16(0,64512,!1);else if(Number.isNaN(e))ft.setUint16(0,32256,!1);else{ft.setFloat32(0,e);let t=ft.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)ft.setUint16(0,31744,!1);else if(r===0)ft.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?ft.setUint16(0,0):i<-14?ft.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):ft.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Ea(e,t){if(e.length-t<2)throw new Error(`${he} 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,a;return n===0?a=i*2**-24:n!==31?a=(i+1024)*2**(n-25):a=i===0?1/0:NaN,r&32768?-a:a}function yc(e){ft.setFloat32(0,e,!1)}function Aa(e,t){if(e.length-t<4)throw new Error(`${he} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function oy(e){ft.setFloat64(0,e,!1)}function mc(e,t){if(e.length-t<8)throw new Error(`${he} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Oa.compareTokens=Ar.compareTokens;function Ee(e,t,r){throw new Error(`${he} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Ji(e){return()=>{throw new Error(`${he} ${e}`)}}var oe=[];for(let e=0;e<=23;e++)oe[e]=Ee;oe[24]=ph;oe[25]=hh;oe[26]=yh;oe[27]=mh;oe[28]=Ee;oe[29]=Ee;oe[30]=Ee;oe[31]=Ee;for(let e=32;e<=55;e++)oe[e]=Ee;oe[56]=gh;oe[57]=vh;oe[58]=bh;oe[59]=wh;oe[60]=Ee;oe[61]=Ee;oe[62]=Ee;oe[63]=Ee;for(let e=64;e<=87;e++)oe[e]=_h;oe[88]=Th;oe[89]=xh;oe[90]=Oh;oe[91]=Eh;oe[92]=Ee;oe[93]=Ee;oe[94]=Ee;oe[95]=Ji("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)oe[e]=Ih;oe[120]=Sh;oe[121]=$h;oe[122]=kh;oe[123]=Uh;oe[124]=Ee;oe[125]=Ee;oe[126]=Ee;oe[127]=Ji("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)oe[e]=Ph;oe[152]=Nh;oe[153]=Bh;oe[154]=Ch;oe[155]=Rh;oe[156]=Ee;oe[157]=Ee;oe[158]=Ee;oe[159]=Mh;for(let e=160;e<=183;e++)oe[e]=Lh;oe[184]=Dh;oe[185]=Vh;oe[186]=Fh;oe[187]=zh;oe[188]=Ee;oe[189]=Ee;oe[190]=Ee;oe[191]=Gh;for(let e=192;e<=215;e++)oe[e]=Kh;oe[216]=Hh;oe[217]=qh;oe[218]=Wh;oe[219]=Jh;oe[220]=Ee;oe[221]=Ee;oe[222]=Ee;oe[223]=Ee;for(let e=224;e<=243;e++)oe[e]=Ji("simple values are not supported");oe[244]=Ee;oe[245]=Ee;oe[246]=Ee;oe[247]=ey;oe[248]=Ji("simple values are not supported");oe[249]=ry;oe[250]=ny;oe[251]=iy;oe[252]=Ee;oe[253]=Ee;oe[254]=Ee;oe[255]=ty;var kt=[];for(let e=0;e<24;e++)kt[e]=new Y(P.uint,e,1);for(let e=-1;e>=-24;e--)kt[31-e]=new Y(P.negint,e,1);kt[64]=new Y(P.bytes,new Uint8Array(0),1);kt[96]=new Y(P.string,"",1);kt[128]=new Y(P.array,0,1);kt[160]=new Y(P.map,0,1);kt[244]=new Y(P.false,!1,1);kt[245]=new Y(P.true,!0,1);kt[246]=new Y(P.null,null,1);function Ia(){let e=[];return e[P.uint.major]=Ar,e[P.negint.major]=ba,e[P.bytes.major]=Wi,e[P.string.major]=jh,e[P.array.major]=wa,e[P.map.major]=_a,e[P.tag.major]=Ta,e[P.float.major]=Oa,e}var oE=Ia(),ca=new fc,ec=class gc{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(`${_r} object contains circular references`);return new gc(r,t)}},Yt={null:new Y(P.null,null),undefined:new Y(P.undefined,void 0),true:new Y(P.true,!0),false:new Y(P.false,!1),emptyArray:new Y(P.array,0),emptyMap:new Y(P.map,0)},tr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new Y(P.float,e):e>=0?new Y(P.uint,e):new Y(P.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new Y(P.uint,e):new Y(P.negint,e)},Uint8Array(e,t,r,n){return new Y(P.bytes,e)},string(e,t,r,n){return new Y(P.string,e)},boolean(e,t,r,n){return e?Yt.true:Yt.false},null(e,t,r,n){return Yt.null},undefined(e,t,r,n){return Yt.undefined},ArrayBuffer(e,t,r,n){return new Y(P.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new Y(P.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Yt.emptyArray,new Y(P.break)]:Yt.emptyArray;n=ec.createCheck(n,e);let i=[],a=0;for(let o of e)i[a++]=Mi(o,r,n);return r.addBreakTokens?[new Y(P.array,e.length),i,new Y(P.break)]:[new Y(P.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",a=i?e.keys():Object.keys(e),o=i?e.size:a.length;if(!o)return r.addBreakTokens===!0?[Yt.emptyMap,new Y(P.break)]:Yt.emptyMap;n=ec.createCheck(n,e);let u=[],l=0;for(let c of a)u[l++]=[Mi(c,r,n),Mi(i?e.get(c):e[c],r,n)];return ay(u,r),r.addBreakTokens?[new Y(P.map,o),u,new Y(P.break)]:[new Y(P.map,o),u]}};tr.Map=tr.Object;tr.Buffer=tr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))tr[`${e}Array`]=tr.DataView;function Mi(e,t={},r){let n=nh(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||tr[n];if(typeof i=="function"){let o=i(e,n,t,r);if(o!=null)return o}let a=tr[n];if(!a)throw new Error(`${_r} unsupported type: ${n}`);return a(e,n,t,r)}function ay(e,t){t.mapSorter&&e.sort(t.mapSorter)}function vc(e,t,r,n){if(Array.isArray(t))for(let i of t)vc(e,i,r,n);else r[t.type.major](e,t,n)}function sy(e,t,r){let n=Mi(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let i=r.quickEncodeToken(n);if(i)return i;let a=t[n.type.major];if(a.encodedSize){let o=a.encodedSize(n,r),u=new fc(o);if(a(u,n,r),u.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return ma(u.chunks[0])}}return ca.reset(),vc(ca,n,t,r),ca.toBytes(!0)}var uy={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},cy=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=kt[e];if(t===void 0){let r=oe[e];if(!r)throw new Error(`${he} 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}},Mn=Symbol.for("DONE"),Xi=Symbol.for("BREAK");function ly(e,t,r){let n=[];for(let i=0;i<e.value;i++){let a=Ln(t,r);if(a===Xi){if(e.value===1/0)break;throw new Error(`${he} got unexpected break to lengthed array`)}if(a===Mn)throw new Error(`${he} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=a}return n}function fy(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},a=n?new Map:void 0;for(let o=0;o<e.value;o++){let u=Ln(t,r);if(u===Xi){if(e.value===1/0)break;throw new Error(`${he} got unexpected break to lengthed map`)}if(u===Mn)throw new Error(`${he} found map but not enough entries (got ${o} [no key], expected ${e.value})`);if(n!==!0&&typeof u!="string")throw new Error(`${he} non-string keys not supported (got ${typeof u})`);if(r.rejectDuplicateMapKeys===!0&&(n&&a.has(u)||!n&&u in i))throw new Error(`${he} found repeat map key "${u}"`);let l=Ln(t,r);if(l===Mn)throw new Error(`${he} found map but not enough entries (got ${o} [no value], expected ${e.value})`);n?a.set(u,l):i[u]=l}return n?a:i}function Ln(e,t){if(e.done())return Mn;let r=e.next();if(r.type===P.break)return Xi;if(r.type.terminal)return r.value;if(r.type===P.array)return ly(r,e,t);if(r.type===P.map)return fy(r,e,t);if(r.type===P.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Ln(e,t);return t.tags[r.value](n)}throw new Error(`${he} tag not supported (${r.value})`)}throw new Error("unsupported")}function dy(e,t){if(!(e instanceof Uint8Array))throw new Error(`${he} data to decode must be a Uint8Array`);t=Object.assign({},uy,t);let r=t.tokenizer||new cy(e,t),n=Ln(r,t);if(n===Mn)throw new Error(`${he} did not find any content to decode`);if(n===Xi)throw new Error(`${he} got unexpected break`);return[n,e.subarray(r.pos())]}function Sa(e,t){let[r,n]=dy(e,t);if(n.length>0)throw new Error(`${he} too many terminals, data makes no sense`);return r}var py=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(t.type===P.array&&(t.elements++,t.elements!==1&&e.push([44])),t.type===P.map&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[P.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)}[P.negint.major](e,t){this[P.uint.major](e,t)}[P.bytes.major](e,t){throw new Error(`${_r} unsupported type: Uint8Array`)}[P.string.major](e,t){this.prefix(e);let r=cc(JSON.stringify(t.value));e.push(r.length>32?ma(r):r)}[P.array.major](e,t){this.prefix(e),this.inRecursive.push({type:P.array,elements:0}),e.push([91])}[P.map.major](e,t){this.prefix(e),this.inRecursive.push({type:P.map,elements:0}),e.push([123])}[P.tag.major](e,t){}[P.float.major](e,t){if(t.type.name==="break"){let a=this.inRecursive.pop();if(a){if(a.type===P.array)e.push([93]);else if(a.type===P.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(`${_r} 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 a=0;a<r.length;a++)n[a]=r.charCodeAt(a),!i&&(n[a]===46||n[a]===101||n[a]===69)&&(i=!0);i||(n.push(46),n.push(48)),e.push(n)}};function hy(e,t){if(Array.isArray(e[0])||Array.isArray(t[0]))throw new Error(`${_r} complex map keys are not supported`);let r=e[0],n=t[0];if(r.type!==P.string||n.type!==P.string)throw new Error(`${_r} non-string map keys are not supported`);if(r<n)return-1;if(r>n)return 1;throw new Error(`${_r} unexpected duplicate map keys, this is not supported`)}var yy={addBreakTokens:!0,mapSorter:hy};function my(e,t){return t=Object.assign({},yy,t),sy(e,new py,t)}var bc=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(`${he} 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(`${he} unexpected token at position ${this._pos}, expected to find '${String.fromCharCode(...e)}'`)}parseNumber(){let e=this._pos,t=!1,r=!1,n=o=>{for(;!this.done();){let u=this.ch();if(o.includes(u))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 Y(P.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(`${he} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(r)throw new Error(`${he} 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)),a=parseFloat(i);return r?new Y(P.float,a,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(a)?new Y(a>=0?P.uint:P.negint,a,this._pos-e):new Y(a>=0?P.uint:P.negint,BigInt(i),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${he} unexpected character at position ${this._pos}; this shouldn't happen`);this._pos++;for(let i=this._pos,a=0;i<this.data.length&&a<65536;i++,a++){let o=this.data[i];if(o===92||o<32||o>=128)break;if(o===34){let u=String.fromCharCode.apply(null,this.data.subarray(this._pos,i));return this._pos=i+1,new Y(P.string,u,a)}}let e=this._pos,t=[],r=()=>{if(this._pos+4>=this.data.length)throw new Error(`${he} unexpected end of unicode escape sequence at position ${this._pos}`);let i=0;for(let a=0;a<4;a++){let o=this.ch();if(o>=48&&o<=57)o-=48;else if(o>=97&&o<=102)o=o-97+10;else if(o>=65&&o<=70)o=o-65+10;else throw new Error(`${he} unexpected unicode escape character at position ${this._pos}`);i=i*16+o,this._pos++}return i},n=()=>{let i=this.ch(),a=null,o=i>239?4:i>223?3:i>191?2:1;if(this._pos+o>this.data.length)throw new Error(`${he} unexpected unicode sequence at position ${this._pos}`);let u,l,c,m;switch(o){case 1:i<128&&(a=i);break;case 2:u=this.data[this._pos+1],(u&192)===128&&(m=(i&31)<<6|u&63,m>127&&(a=m));break;case 3:u=this.data[this._pos+1],l=this.data[this._pos+2],(u&192)===128&&(l&192)===128&&(m=(i&15)<<12|(u&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:u=this.data[this._pos+1],l=this.data[this._pos+2],c=this.data[this._pos+3],(u&192)===128&&(l&192)===128&&(c&192)===128&&(m=(i&15)<<18|(u&63)<<12|(l&63)<<6|c&63,m>65535&&m<1114112&&(a=m))}a===null?(a=65533,o=1):a>65535&&(a-=65536,t.push(a>>>10&1023|55296),a=56320|a&1023),t.push(a),this._pos+=o};for(;!this.done();){let i=this.ch(),a;switch(i){case 92:if(this._pos++,this.done())throw new Error(`${he} unexpected string termination at position ${this._pos}`);switch(a=this.ch(),this._pos++,a){case 34:case 39:case 92:case 47:t.push(a);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(`${he} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new Y(P.string,lc(t),this._pos-e);default:if(i<32)throw new Error(`${he} invalid control character at position ${this._pos}`);i<128?(t.push(i),this._pos++):n()}}throw new Error(`${he} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new Y(P.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new Y(P.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new Y(P.null,null,4);case 102:return this.expect([102,97,108,115,101]),new Y(P.false,!1,5);case 116:return this.expect([116,114,117,101]),new Y(P.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(`${he} 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 Y(P.break,void 0,1);if(this.ch()!==44)throw new Error(`${he} 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 Y(P.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 Y(P.break,void 0,1);if(this.ch()!==44)throw new Error(`${he} 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 Y(P.break,void 0,1);let e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${he} 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(`${he} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}};function gy(e,t){return t=Object.assign({tokenizer:new bc(e,t)},t),Sa(e,t)}var aE=new Uint8Array(0),vy=(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},$a=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 by(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 a=e.charAt(i),o=a.charCodeAt(0);if(r[o]!==255)throw new TypeError(a+" is ambiguous");r[o]=i}var u=e.length,l=e.charAt(0),c=Math.log(u)/Math.log(256),m=Math.log(256)/Math.log(u);function g(G){if(G instanceof Uint8Array||(ArrayBuffer.isView(G)?G=new Uint8Array(G.buffer,G.byteOffset,G.byteLength):Array.isArray(G)&&(G=Uint8Array.from(G))),!(G instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(G.length===0)return"";for(var Z=0,ae=0,B=0,V=G.length;B!==V&&G[B]===0;)B++,Z++;for(var q=(V-B)*m+1>>>0,se=new Uint8Array(q);B!==V;){for(var F=G[B],ue=0,z=q-1;(F!==0||ue<ae)&&z!==-1;z--,ue++)F+=256*se[z]>>>0,se[z]=F%u>>>0,F=F/u>>>0;if(F!==0)throw new Error("Non-zero carry");ae=ue,B++}for(var pe=q-ae;pe!==q&&se[pe]===0;)pe++;for(var M=l.repeat(Z);pe<q;++pe)M+=e.charAt(se[pe]);return M}function R(G){if(typeof G!="string")throw new TypeError("Expected String");if(G.length===0)return new Uint8Array;var Z=0;if(G[Z]!==" "){for(var ae=0,B=0;G[Z]===l;)ae++,Z++;for(var V=(G.length-Z)*c+1>>>0,q=new Uint8Array(V);G[Z];){var se=r[G.charCodeAt(Z)];if(se===255)return;for(var F=0,ue=V-1;(se!==0||F<B)&&ue!==-1;ue--,F++)se+=u*q[ue]>>>0,q[ue]=se%256>>>0,se=se/256>>>0;if(se!==0)throw new Error("Non-zero carry");B=F,Z++}if(G[Z]!==" "){for(var z=V-B;z!==V&&q[z]===0;)z++;for(var pe=new Uint8Array(ae+(V-z)),M=ae;z!==V;)pe[M++]=q[z++];return pe}}}function j(G){var Z=R(G);if(Z)return Z;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:R,decode:j}}var wy=by,_y=wy,Ty=_y,xy=class{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")}},Oy=class{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 wc(this,e)}},Ey=class{constructor(e){this.decoders=e}or(e){return wc(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},wc=(e,t)=>new Ey({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}}),Ay=class{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new xy(e,t,r),this.decoder=new Oy(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},_c=({name:e,prefix:t,encode:r,decode:n})=>new Ay(e,t,r,n),Tc=({prefix:e,name:t,alphabet:r})=>{let{encode:n,decode:i}=Ty(r,t);return _c({prefix:e,name:t,encode:n,decode:a=>$a(i(a))})},Iy=(e,t,r,n)=>{let i={};for(let m=0;m<t.length;++m)i[t[m]]=m;let a=e.length;for(;e[a-1]==="=";)--a;let o=new Uint8Array(a*r/8|0),u=0,l=0,c=0;for(let m=0;m<a;++m){let g=i[e[m]];if(g===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<r|g,u+=r,u>=8&&(u-=8,o[c++]=255&l>>u)}if(u>=r||255&l<<8-u)throw new SyntaxError("Unexpected end of data");return o},Sy=(e,t,r)=>{let n=t[t.length-1]==="=",i=(1<<r)-1,a="",o=0,u=0;for(let l=0;l<e.length;++l)for(u=u<<8|e[l],o+=8;o>r;)o-=r,a+=t[i&u>>o];if(o&&(a+=t[i&u<<r-o]),n)for(;a.length*r&7;)a+="=";return a},ot=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>_c({prefix:t,name:e,encode(i){return Sy(i,n,r)},decode(i){return Iy(i,n,r,e)}}),Li=ot({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),sE=ot({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),uE=ot({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),cE=ot({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),lE=ot({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),fE=ot({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),dE=ot({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),pE=ot({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),hE=ot({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),er=Tc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),yE=Tc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),xc={};uc(xc,{Digest:()=>Yi,create:()=>Ki,decode:()=>Gn,equals:()=>Ec});var $y=Oc,tc=128,ky=127,Uy=~ky,jy=Math.pow(2,31);function Oc(e,t,r){t=t||[],r=r||0;for(var n=r;e>=jy;)t[r++]=e&255|tc,e/=128;for(;e&Uy;)t[r++]=e&255|tc,e>>>=7;return t[r]=e|0,Oc.bytes=r-n+1,t}var Py=da,Ny=128,rc=127;function da(e,n){var r=0,n=n||0,i=0,a=n,o,u=e.length;do{if(a>=u)throw da.bytes=0,new RangeError("Could not decode varint");o=e[a++],r+=i<28?(o&rc)<<i:(o&rc)*Math.pow(2,i),i+=7}while(o>=Ny);return da.bytes=a-n,r}var By=Math.pow(2,7),Cy=Math.pow(2,14),Ry=Math.pow(2,21),My=Math.pow(2,28),Ly=Math.pow(2,35),Dy=Math.pow(2,42),Vy=Math.pow(2,49),Fy=Math.pow(2,56),zy=Math.pow(2,63),Gy=function(e){return e<By?1:e<Cy?2:e<Ry?3:e<My?4:e<Ly?5:e<Dy?6:e<Vy?7:e<Fy?8:e<zy?9:10},Ky={encode:$y,decode:Py,encodingLength:Gy},Hy=Ky,Fi=Hy,pa=(e,t=0)=>[Fi.decode(e,t),Fi.decode.bytes],zi=(e,t,r=0)=>(Fi.encode(e,t,r),t),Gi=e=>Fi.encodingLength(e),Ki=(e,t)=>{let r=t.byteLength,n=Gi(e),i=n+Gi(r),a=new Uint8Array(i+r);return zi(e,a,0),zi(r,a,n),a.set(t,i),new Yi(e,r,t,a)},Gn=e=>{let t=$a(e),[r,n]=pa(t),[i,a]=pa(t.subarray(n)),o=t.subarray(n+a);if(o.byteLength!==i)throw new Error("Incorrect length");return new Yi(r,i,o,t)},Ec=(e,t)=>{if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&vy(e.bytes,r.bytes)}},Yi=class{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}},nc=(e,t)=>{let{bytes:r,version:n}=e;switch(n){case 0:return Wy(r,ha(e),t||er.encoder);default:return Jy(r,ha(e),t||Li.encoder)}},ic=new WeakMap,ha=e=>{let t=ic.get(e);if(t==null){let r=new Map;return ic.set(e,r),r}return t},rr=class He{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!==Cn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Xy)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return He.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=Ki(t,r);return He.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 He.equals(this,t)}static equals(t,r){let n=r;return n&&t.code===n.code&&t.version===n.version&&Ec(t.multihash,n.multihash)}toString(t){return nc(this,t)}toJSON(){return{"/":nc(this)}}link(){return this}get[Symbol.toStringTag](){return"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 He)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:a,bytes:o}=r;return new He(n,i,a,o||oc(n,i,a.bytes))}else if(r[Yy]===!0){let{version:n,multihash:i,code:a}=r,o=Gn(i);return He.create(n,a,o)}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!==Cn)throw new Error(`Version 0 CID must use dag-pb (code: ${Cn}) block encoding`);return new He(t,r,n,n.bytes)}case 1:{let i=oc(t,r,n.bytes);return new He(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return He.create(0,Cn,t)}static createV1(t,r){return He.create(1,t,r)}static decode(t){let[r,n]=He.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=He.inspectBytes(t),n=r.size-r.multihashSize,i=$a(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let a=i.subarray(r.multihashSize-r.digestSize),o=new Yi(r.multihashCode,r.digestSize,a,i);return[r.version===0?He.createV0(o):He.createV1(r.codec,o),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[g,R]=pa(t.subarray(r));return r+=R,g},i=n(),a=Cn;if(i===18?(i=0,r=0):a=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,u=n(),l=n(),c=r+l,m=c-o;return{version:i,codec:a,multihashCode:u,digestSize:l,multihashSize:m,size:c}}static parse(t,r){let[n,i]=qy(t,r),a=He.decode(i);if(a.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ha(a).set(n,t),a}},qy=(e,t)=>{switch(e[0]){case"Q":{let r=t||er;return[er.prefix,r.decode(`${er.prefix}${e}`)]}case er.prefix:{let r=t||er;return[er.prefix,r.decode(e)]}case Li.prefix:{let r=t||Li;return[Li.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)]}}},Wy=(e,t,r)=>{let{prefix:n}=r;if(n!==er.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let a=r.encode(e).slice(1);return t.set(n,a),a}else return i},Jy=(e,t,r)=>{let{prefix:n}=r,i=t.get(n);if(i==null){let a=r.encode(e);return t.set(n,a),a}else return i},Cn=112,Xy=18,oc=(e,t,r)=>{let n=Gi(e),i=n+Gi(t),a=new Uint8Array(i+r.byteLength);return zi(e,a,0),zi(t,a,n),a.set(r,i),a},Yy=Symbol.for("@ipld/js-cid/CID"),Ac=({name:e,code:t,encode:r})=>new Qy(e,t,r),Qy=class{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?Ki(this.code,t):t.then(r=>Ki(this.code,r))}else throw Error("Unknown type, must be binary type")}},Ic=ot({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),mE=ot({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),gE=ot({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),vE=ot({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function Zy(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=rr.asCID(e);if(!t)return null;let r=t.toString();return[new Y(P.map,1/0,1),new Y(P.string,"/",1),new Y(P.string,r,r.length),new Y(P.break,void 0,1)]}function Hi(e){let t=Ic.encode(e).slice(1);return[new Y(P.map,1/0,1),new Y(P.string,"/",1),new Y(P.map,1/0,1),new Y(P.string,"bytes",5),new Y(P.string,t,t.length),new Y(P.break,void 0,1),new Y(P.break,void 0,1)]}function Tt(e){return Hi(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function em(e){return Hi(new Uint8Array(e))}function tm(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function rm(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 nm={typeEncoders:{Object:Zy,Buffer:Hi,Uint8Array:Hi,Int8Array:Tt,Uint16Array:Tt,Int16Array:Tt,Uint32Array:Tt,Int32Array:Tt,Float32Array:Tt,Float64Array:Tt,Uint8ClampedArray:Tt,BigInt64Array:Tt,BigUint64Array:Tt,DataView:Tt,ArrayBuffer:em,undefined:tm,number:rm}},im=class extends bc{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===P.map){let t=this._next();if(t.type===P.string&&t.value==="/"){let r=this._next();if(r.type===P.string){if(this._next().type!==P.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new Y(P.tag,42,0)}if(r.type===P.map){let n=this._next();if(n.type===P.string&&n.value==="bytes"){let i=this._next();if(i.type===P.string){for(let o=0;o<2;o++)if(this._next().type!==P.break)throw new Error("Invalid encoded Bytes form");let a=Ic.decode(`m${i.value}`);return new Y(P.bytes,a,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(n)}this.tokenBuffer.push(r)}this.tokenBuffer.push(t)}return e}},ya={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};ya.tags[42]=rr.parse;var om="dag-json",Sc=297,ka=e=>my(e,nm),Qi=e=>{let t=Object.assign(ya,{tokenizer:new im(e,ya)});return gy(e,t)},ac=e=>am.decode(ka(e)),am=new TextDecoder,sm=e=>Qi(um.encode(e)),um=new TextEncoder;function cm(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function sc(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 lm(e,t){cm(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var fm=e=>e instanceof Uint8Array,la=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),St=(e,t)=>e<<32-t|e>>>t,dm=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!dm)throw new Error("Non little-endian hardware is not supported");function pm(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function $c(e){if(typeof e=="string"&&(e=pm(e)),!fm(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}var hm=class{clone(){return this._cloneInto()}},bE={}.toString;function ym(e){let t=n=>e().update($c(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function mm(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let i=BigInt(32),a=BigInt(4294967295),o=Number(r>>i&a),u=Number(r&a),l=n?4:0,c=n?0:4;e.setUint32(t+l,o,n),e.setUint32(t+c,u,n)}var gm=class extends hm{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=la(this.buffer)}update(e){sc(this);let{view:t,buffer:r,blockLen:n}=this;e=$c(e);let i=e.length;for(let a=0;a<i;){let o=Math.min(n-this.pos,i-a);if(o===n){let u=la(e);for(;n<=i-a;a+=n)this.process(u,a);continue}r.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){sc(this),lm(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>n-a&&(this.process(r,0),a=0);for(let m=a;m<n;m++)t[m]=0;mm(r,n-8,BigInt(this.length*8),i),this.process(r,0);let o=la(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let l=u/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<l;m++)o.setUint32(4*m,c[m],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:a,pos:o}=this;return e.length=n,e.pos=o,e.finished=i,e.destroyed=a,n%t&&e.buffer.set(r),e}},vm=(e,t,r)=>e&t^~e&r,bm=(e,t,r)=>e&t^e&r^t&r,wm=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Qt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Zt=new Uint32Array(64),_m=class extends gm{constructor(){super(64,32,8,!1),this.A=Qt[0]|0,this.B=Qt[1]|0,this.C=Qt[2]|0,this.D=Qt[3]|0,this.E=Qt[4]|0,this.F=Qt[5]|0,this.G=Qt[6]|0,this.H=Qt[7]|0}get(){let{A:e,B:t,C:r,D:n,E:i,F:a,G:o,H:u}=this;return[e,t,r,n,i,a,o,u]}set(e,t,r,n,i,a,o,u){this.A=e|0,this.B=t|0,this.C=r|0,this.D=n|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=u|0}process(e,t){for(let m=0;m<16;m++,t+=4)Zt[m]=e.getUint32(t,!1);for(let m=16;m<64;m++){let g=Zt[m-15],R=Zt[m-2],j=St(g,7)^St(g,18)^g>>>3,G=St(R,17)^St(R,19)^R>>>10;Zt[m]=G+Zt[m-7]+j+Zt[m-16]|0}let{A:r,B:n,C:i,D:a,E:o,F:u,G:l,H:c}=this;for(let m=0;m<64;m++){let g=St(o,6)^St(o,11)^St(o,25),R=c+g+vm(o,u,l)+wm[m]+Zt[m]|0,j=(St(r,2)^St(r,13)^St(r,22))+bm(r,n,i)|0;c=l,l=u,u=o,o=a+R|0,a=i,i=n,n=r,r=R+j|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,u=u+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(r,n,i,a,o,u,l,c)}roundClean(){Zt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Tm=ym(()=>new _m),xm=Object.create,Ua=Object.defineProperty,Om=Object.getOwnPropertyDescriptor,kc=Object.getOwnPropertyNames,Em=Object.getPrototypeOf,Am=Object.prototype.hasOwnProperty,Im=(e,t,r)=>t in e?Ua(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Uc=(e,t)=>function(){return t||(0,e[kc(e)[0]])((t={exports:{}}).exports,t),t.exports},Sm=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of kc(t))!Am.call(e,i)&&i!==r&&Ua(e,i,{get:()=>t[i],enumerable:!(n=Om(t,i))||n.enumerable});return e},jc=(e,t,r)=>(r=e!=null?xm(Em(e)):{},Sm(t||!e||!e.__esModule?Ua(r,"default",{value:e,enumerable:!0}):r,e)),nr=(e,t,r)=>(Im(e,typeof t!="symbol"?t+"":t,r),r),$m=Uc({"../../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(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},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",a=typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),o=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u";e.isBrowser=r,e.isWebWorker=i,e.isNode=n,e.isJsDom=a,e.isDeno=o}}),km=Uc({"../../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,a=n.cmp&&function(u){return function(l){return function(c,m){var g={key:c,value:l[c]},R={key:m,value:l[m]};return u(g,R)}}}(n.cmp),o=[];return function u(l){if(l&&l.toJSON&&typeof l.toJSON=="function"&&(l=l.toJSON()),l!==void 0){if(typeof l=="number")return isFinite(l)?""+l:"null";if(typeof l!="object")return JSON.stringify(l);var c,m;if(Array.isArray(l)){for(m="[",c=0;c<l.length;c++)c&&(m+=","),m+=u(l[c])||"null";return m+"]"}if(l===null)return"null";if(o.indexOf(l)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var g=o.push(l)-1,R=Object.keys(l).sort(a&&a(l));for(m="",c=0;c<R.length;c++){var j=R[c],G=u(l[j]);G&&(m&&(m+=","),m+=JSON.stringify(j)+":"+G)}return o.splice(g,1),"{"+m+"}"}}(r)}}}),Dn=jc($m(),1),Um=jc(km(),1),Pc=!1,Nc=!1;Dn.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(Pc=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(Nc=process?.env?.LOGGER_PERF_PREFIX==="true"));var jm=Object.freeze({prefix:void 0,time:Pc,delta:Nc,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0}),fa=[],Bc=class{constructor(e,t,r,n){$t(this,"sinceFirst",0),$t(this,"sinceLast",0),$t(this,"time",!1),$t(this,"delta",!1),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].join(",")}]`}},Cc=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Rn=!1,Ze=class{static setup(e=Ze.INFO,t={}){t=Object.assign({},jm,t),e>10&&console.debug("setup logger",{config:t});let r=this.wrapLog(console.debug,{...t,dim:t.dimDebugOnServer}),n=(...u)=>{window?.FORCE_DISABLE_LOGLEVEL&&r(...u)};n.isDisabled=!0,n.isEnabled=!1;let i=this.wrapLog(console.groupCollapsed,t),a=(u,l)=>{function c(...g){let R=g[g.length-1];return R===n?R():(i(...g.slice(0,-1)),(async()=>{try{let j=R();return j instanceof Promise?await j:j}finally{console.groupEnd()}})())}let m=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:c,force:l});return u?m:Object.assign(n.bind({}),{isEnabled:u,isDisabled:!u,group:c,force:m})},o=a(e>=Ze.ERROR,this.wrapLog(console.error,t));return{ERROR:(...u)=>(o(...u),new Error((0,Um.default)(u))),WARN:a(e>=Ze.WARN,this.wrapLog(console.warn,t)),LOG:a(e>=Ze.INFO,this.wrapLog(console.log,t)),DEBUG:a(e>=Ze.DEBUG,this.wrapLog(console.log,{...t,dim:t.dimDebugOnServer})),VERBOSE:a(e>=Ze.VERBOSE,this.wrapLog(console.debug,{...t,dim:t.dimDebugOnServer}))}}static wrapLog(e,t){if(Dn.isNode)return e.bind(console);{let r=[];if(t.time||t.delta){let n=Dn.isBrowser&&navigator.userAgent.includes("Chrome")?["",Ze.timeStr(!!t.time,!!t.delta)]:[];r.push(...n)}return t.prefix&&(Rn?r.push(new Cc("dim",t.prefix)):r.push(t.prefix)),e.bind(console,...r)}}static timeStr(e,t,r=0){if(!performance.now)return;let n=performance.now();Ze.firstLog||(Ze.firstLog=n,Ze.lastLog=n);let i=new Bc(n-Ze.firstLog,n-Ze.lastLog,e,t);return Ze.lastLog=n,r?i.toString():i}static getOriginFromStack(e){let t=!1;for(let r of e.split(`
|
|
2
|
-
`)){let n=r.match(/^\s+at\s+(.*)/);if(n){if(t)return n[1].trim().replace(__dirname,"");t=!0}}}},Oe=Ze;nr(Oe,"ERROR",2);nr(Oe,"WARN",4);nr(Oe,"INFO",6);nr(Oe,"LOG",6);nr(Oe,"DEBUG",8);nr(Oe,"VERBOSE",10);nr(Oe,"firstLog",0);nr(Oe,"lastLog",0);Dn.isBrowser?(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(fa&&fa.length){for(let t of fa)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof
|
|
1
|
+
import{b as Ti,d as zo,e as Go,f as xi,g as bt}from"./chunk-ZATDQB6W.min.js";var Mu=Ti((nO,Ru)=>{"use strict";Ru.exports=ea;var Cu=128,Op=127,Ep=~Op,Ap=Math.pow(2,31);function ea(e,t,r){if(Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw ea.bytes=0,new RangeError("Could not encode varint");t=t||[],r=r||0;for(var n=r;e>=Ap;)t[r++]=e&255|Cu,e/=128;for(;e&Ep;)t[r++]=e&255|Cu,e>>>=7;return t[r]=e|0,ea.bytes=r-n+1,t}});var Vu=Ti((iO,Du)=>{"use strict";Du.exports=ta;var Ip=128,Lu=127;function ta(e,n){var r=0,n=n||0,i=0,a=n,o,u=e.length;do{if(a>=u||i>49)throw ta.bytes=0,new RangeError("Could not decode varint");o=e[a++],r+=i<28?(o&Lu)<<i:(o&Lu)*Math.pow(2,i),i+=7}while(o>=Ip);return ta.bytes=a-n,r}});var zu=Ti((oO,Fu)=>{"use strict";var Sp=Math.pow(2,7),$p=Math.pow(2,14),kp=Math.pow(2,21),Up=Math.pow(2,28),jp=Math.pow(2,35),Pp=Math.pow(2,42),Np=Math.pow(2,49),Bp=Math.pow(2,56),Cp=Math.pow(2,63);Fu.exports=function(e){return e<Sp?1:e<$p?2:e<kp?3:e<Up?4:e<jp?5:e<Pp?6:e<Np?7:e<Bp?8:e<Cp?9:10}});var Ci=Ti((aO,Gu)=>{"use strict";Gu.exports={encode:Mu(),decode:Vu(),encodingLength:zu()}});var qd=["string","number","bigint","symbol"],Wd=["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 js(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(qd.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(Jd(e))return"Buffer";let r=Xd(e);return r||"Object"}function Jd(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function Xd(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Wd.includes(t))return t}var D=class{constructor(t,r,n){this.major=t,this.majorEncoded=t<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(t){return this.major<t.major?-1:this.major>t.major?1:0}};D.uint=new D(0,"uint",!0);D.negint=new D(1,"negint",!0);D.bytes=new D(2,"bytes",!0);D.string=new D(3,"string",!0);D.array=new D(4,"array",!1);D.map=new D(5,"map",!1);D.tag=new D(6,"tag",!1);D.float=new D(7,"float",!0);D.false=new D(7,"false",!0);D.true=new D(7,"true",!0);D.null=new D(7,"null",!0);D.undefined=new D(7,"undefined",!0);D.break=new D(7,"break",!0);var ce=class{constructor(t,r,n){this.type=t,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};var Kr=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Yd=new TextDecoder,Qd=new TextEncoder;function Oi(e){return Kr&&globalThis.Buffer.isBuffer(e)}function Cs(e){return e instanceof Uint8Array?Oi(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Rs=Kr?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Ns(e,t,r):(e,t,r)=>r-t>64?Yd.decode(e.subarray(t,r)):Ns(e,t,r),Ms=Kr?e=>e.length>64?globalThis.Buffer.from(e):Ps(e):e=>e.length>64?Qd.encode(e):Ps(e);var Hr=Kr?(e,t,r)=>Oi(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Ls=Kr?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Cs(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},Ds=Kr?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Vs(e,t){if(Oi(e)&&Oi(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 Ps(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 Ns(e,t,r){let n=[];for(;t<r;){let i=e[t],a=null,o=i>239?4:i>223?3:i>191?2:1;if(t+o<=r){let u,l,c,m;switch(o){case 1:i<128&&(a=i);break;case 2:u=e[t+1],(u&192)===128&&(m=(i&31)<<6|u&63,m>127&&(a=m));break;case 3:u=e[t+1],l=e[t+2],(u&192)===128&&(l&192)===128&&(m=(i&15)<<12|(u&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:u=e[t+1],l=e[t+2],c=e[t+3],(u&192)===128&&(l&192)===128&&(c&192)===128&&(m=(i&15)<<18|(u&63)<<12|(l&63)<<6|c&63,m>65535&&m<1114112&&(a=m))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),t+=o}return Zd(n)}var Bs=4096;function Zd(e){let t=e.length;if(t<=Bs)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Bs));return r}var ep=256,Ei=class{constructor(t=ep){this.chunkSize=t,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(t){let r=this.chunks[this.chunks.length-1];if(this.cursor+t.length<=this.maxCursor+1){let i=r.length-(this.maxCursor-this.cursor)-1;r.set(t,i)}else{if(r){let i=r.length-(this.maxCursor-this.cursor)-1;i<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,i),this.maxCursor=this.cursor-1)}t.length<64&&t.length<this.chunkSize?(r=Ds(this.chunkSize),this.chunks.push(r),this.maxCursor+=r.length,this._initReuseChunk===null&&(this._initReuseChunk=r),r.set(t,0)):(this.chunks.push(t),this.maxCursor+=t.length)}this.cursor+=t.length}toBytes(t=!1){let r;if(this.chunks.length===1){let n=this.chunks[0];t&&this.cursor>n.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=Hr(n,0,this.cursor)}else r=Ls(this.chunks,this.cursor);return t&&this.reset(),r}};var ve="CBOR decode error:",Ko="CBOR encode error:",In=[];In[23]=1;In[24]=2;In[25]=3;In[26]=5;In[27]=9;function Mt(e,t,r){if(e.length-t<r)throw new Error(`${ve} not enough data for type`)}var Ve=[24,256,65536,4294967296,BigInt("18446744073709551616")];function tt(e,t,r){Mt(e,t,1);let n=e[t];if(r.strict===!0&&n<Ve[0])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);return n}function rt(e,t,r){Mt(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<Ve[1])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);return n}function nt(e,t,r){Mt(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<Ve[2])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);return n}function it(e,t,r){Mt(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],a=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&a<Ve[3])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);if(a<=Number.MAX_SAFE_INTEGER)return Number(a);if(r.allowBigInt===!0)return a;throw new Error(`${ve} integers outside of the safe integer range are not supported`)}function Fs(e,t,r,n){return new ce(D.uint,tt(e,t+1,n),2)}function zs(e,t,r,n){return new ce(D.uint,rt(e,t+1,n),3)}function Gs(e,t,r,n){return new ce(D.uint,nt(e,t+1,n),5)}function Ks(e,t,r,n){return new ce(D.uint,it(e,t+1,n),9)}function ct(e,t){return Fe(e,0,t.value)}function Fe(e,t,r){if(r<Ve[0]){let n=Number(r);e.push([t|n])}else if(r<Ve[1]){let n=Number(r);e.push([t|24,n])}else if(r<Ve[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<Ve[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<Ve[4]){let i=[t|27,0,0,0,0,0,0,0],a=Number(n&BigInt(4294967295)),o=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=a&255,a=a>>8,i[7]=a&255,a=a>>8,i[6]=a&255,a=a>>8,i[5]=a&255,i[4]=o&255,o=o>>8,i[3]=o&255,o=o>>8,i[2]=o&255,o=o>>8,i[1]=o&255,e.push(i)}else throw new Error(`${ve} encountered BigInt larger than allowable range`)}}ct.encodedSize=function(t){return Fe.encodedSize(t.value)};Fe.encodedSize=function(t){return t<Ve[0]?1:t<Ve[1]?2:t<Ve[2]?3:t<Ve[3]?5:9};ct.compareTokens=function(t,r){return t.value<r.value?-1:t.value>r.value?1:0};function Hs(e,t,r,n){return new ce(D.negint,-1-tt(e,t+1,n),2)}function qs(e,t,r,n){return new ce(D.negint,-1-rt(e,t+1,n),3)}function Ws(e,t,r,n){return new ce(D.negint,-1-nt(e,t+1,n),5)}var Ho=BigInt(-1),Js=BigInt(1);function Xs(e,t,r,n){let i=it(e,t+1,n);if(typeof i!="bigint"){let a=-1-i;if(a>=Number.MIN_SAFE_INTEGER)return new ce(D.negint,a,9)}if(n.allowBigInt!==!0)throw new Error(`${ve} integers outside of the safe integer range are not supported`);return new ce(D.negint,Ho-BigInt(i),9)}function Ai(e,t){let r=t.value,n=typeof r=="bigint"?r*Ho-Js:r*-1-1;Fe(e,t.type.majorEncoded,n)}Ai.encodedSize=function(t){let r=t.value,n=typeof r=="bigint"?r*Ho-Js:r*-1-1;return n<Ve[0]?1:n<Ve[1]?2:n<Ve[2]?3:n<Ve[3]?5:9};Ai.compareTokens=function(t,r){return t.value<r.value?1:t.value>r.value?-1:0};function Sn(e,t,r,n){Mt(e,t,r+n);let i=Hr(e,t+r,t+r+n);return new ce(D.bytes,i,r+n)}function Ys(e,t,r,n){return Sn(e,t,1,r)}function Qs(e,t,r,n){return Sn(e,t,2,tt(e,t+1,n))}function Zs(e,t,r,n){return Sn(e,t,3,rt(e,t+1,n))}function eu(e,t,r,n){return Sn(e,t,5,nt(e,t+1,n))}function tu(e,t,r,n){let i=it(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer bytes lengths not supported`);return Sn(e,t,9,i)}function Ii(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===D.string?Ms(e.value):e.value),e.encodedBytes}function qr(e,t){let r=Ii(t);Fe(e,t.type.majorEncoded,r.length),e.push(r)}qr.encodedSize=function(t){let r=Ii(t);return Fe.encodedSize(r.length)+r.length};qr.compareTokens=function(t,r){return rp(Ii(t),Ii(r))};function rp(e,t){return e.length<t.length?-1:e.length>t.length?1:Vs(e,t)}function $n(e,t,r,n,i){let a=r+n;Mt(e,t,a);let o=new ce(D.string,Rs(e,t+r,t+a),a);return i.retainStringBytes===!0&&(o.byteValue=Hr(e,t+r,t+a)),o}function ru(e,t,r,n){return $n(e,t,1,r,n)}function nu(e,t,r,n){return $n(e,t,2,tt(e,t+1,n),n)}function iu(e,t,r,n){return $n(e,t,3,rt(e,t+1,n),n)}function ou(e,t,r,n){return $n(e,t,5,nt(e,t+1,n),n)}function au(e,t,r,n){let i=it(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer string lengths not supported`);return $n(e,t,9,i,n)}var su=qr;function Wr(e,t,r,n){return new ce(D.array,n,r)}function uu(e,t,r,n){return Wr(e,t,1,r)}function cu(e,t,r,n){return Wr(e,t,2,tt(e,t+1,n))}function lu(e,t,r,n){return Wr(e,t,3,rt(e,t+1,n))}function fu(e,t,r,n){return Wr(e,t,5,nt(e,t+1,n))}function du(e,t,r,n){let i=it(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer array lengths not supported`);return Wr(e,t,9,i)}function pu(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return Wr(e,t,1,1/0)}function Si(e,t){Fe(e,D.array.majorEncoded,t.value)}Si.compareTokens=ct.compareTokens;Si.encodedSize=function(t){return Fe.encodedSize(t.value)};function Jr(e,t,r,n){return new ce(D.map,n,r)}function hu(e,t,r,n){return Jr(e,t,1,r)}function yu(e,t,r,n){return Jr(e,t,2,tt(e,t+1,n))}function mu(e,t,r,n){return Jr(e,t,3,rt(e,t+1,n))}function gu(e,t,r,n){return Jr(e,t,5,nt(e,t+1,n))}function vu(e,t,r,n){let i=it(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer map lengths not supported`);return Jr(e,t,9,i)}function bu(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return Jr(e,t,1,1/0)}function $i(e,t){Fe(e,D.map.majorEncoded,t.value)}$i.compareTokens=ct.compareTokens;$i.encodedSize=function(t){return Fe.encodedSize(t.value)};function wu(e,t,r,n){return new ce(D.tag,r,1)}function _u(e,t,r,n){return new ce(D.tag,tt(e,t+1,n),2)}function Tu(e,t,r,n){return new ce(D.tag,rt(e,t+1,n),3)}function xu(e,t,r,n){return new ce(D.tag,nt(e,t+1,n),5)}function Ou(e,t,r,n){return new ce(D.tag,it(e,t+1,n),9)}function ki(e,t){Fe(e,D.tag.majorEncoded,t.value)}ki.compareTokens=ct.compareTokens;ki.encodedSize=function(t){return Fe.encodedSize(t.value)};var up=20,cp=21,lp=22,fp=23;function Eu(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${ve} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ce(D.null,null,1):new ce(D.undefined,void 0,1)}function Au(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return new ce(D.break,void 0,1)}function qo(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${ve} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${ve} Infinity values are not supported`)}return new ce(D.float,e,t)}function Iu(e,t,r,n){return qo(Wo(e,t+1),3,n)}function Su(e,t,r,n){return qo(Jo(e,t+1),5,n)}function $u(e,t,r,n){return qo(Pu(e,t+1),9,n)}function Ui(e,t,r){let n=t.value;if(n===!1)e.push([D.float.majorEncoded|up]);else if(n===!0)e.push([D.float.majorEncoded|cp]);else if(n===null)e.push([D.float.majorEncoded|lp]);else if(n===void 0)e.push([D.float.majorEncoded|fp]);else{let i,a=!1;(!r||r.float64!==!0)&&(Uu(n),i=Wo(wt,1),n===i||Number.isNaN(n)?(wt[0]=249,e.push(wt.slice(0,3)),a=!0):(ju(n),i=Jo(wt,1),n===i&&(wt[0]=250,e.push(wt.slice(0,5)),a=!0))),a||(dp(n),i=Pu(wt,1),wt[0]=251,e.push(wt.slice(0,9)))}}Ui.encodedSize=function(t,r){let n=t.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){Uu(n);let i=Wo(wt,1);if(n===i||Number.isNaN(n))return 3;if(ju(n),i=Jo(wt,1),n===i)return 5}return 9};var ku=new ArrayBuffer(9),lt=new DataView(ku,1),wt=new Uint8Array(ku,0);function Uu(e){if(e===1/0)lt.setUint16(0,31744,!1);else if(e===-1/0)lt.setUint16(0,64512,!1);else if(Number.isNaN(e))lt.setUint16(0,32256,!1);else{lt.setFloat32(0,e);let t=lt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)lt.setUint16(0,31744,!1);else if(r===0)lt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?lt.setUint16(0,0):i<-14?lt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):lt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Wo(e,t){if(e.length-t<2)throw new Error(`${ve} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,a;return n===0?a=i*2**-24:n!==31?a=(i+1024)*2**(n-25):a=i===0?1/0:NaN,r&32768?-a:a}function ju(e){lt.setFloat32(0,e,!1)}function Jo(e,t){if(e.length-t<4)throw new Error(`${ve} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function dp(e){lt.setFloat64(0,e,!1)}function Pu(e,t){if(e.length-t<8)throw new Error(`${ve} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Ui.compareTokens=ct.compareTokens;function xe(e,t,r){throw new Error(`${ve} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function ji(e){return()=>{throw new Error(`${ve} ${e}`)}}var ie=[];for(let e=0;e<=23;e++)ie[e]=xe;ie[24]=Fs;ie[25]=zs;ie[26]=Gs;ie[27]=Ks;ie[28]=xe;ie[29]=xe;ie[30]=xe;ie[31]=xe;for(let e=32;e<=55;e++)ie[e]=xe;ie[56]=Hs;ie[57]=qs;ie[58]=Ws;ie[59]=Xs;ie[60]=xe;ie[61]=xe;ie[62]=xe;ie[63]=xe;for(let e=64;e<=87;e++)ie[e]=Ys;ie[88]=Qs;ie[89]=Zs;ie[90]=eu;ie[91]=tu;ie[92]=xe;ie[93]=xe;ie[94]=xe;ie[95]=ji("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ie[e]=ru;ie[120]=nu;ie[121]=iu;ie[122]=ou;ie[123]=au;ie[124]=xe;ie[125]=xe;ie[126]=xe;ie[127]=ji("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ie[e]=uu;ie[152]=cu;ie[153]=lu;ie[154]=fu;ie[155]=du;ie[156]=xe;ie[157]=xe;ie[158]=xe;ie[159]=pu;for(let e=160;e<=183;e++)ie[e]=hu;ie[184]=yu;ie[185]=mu;ie[186]=gu;ie[187]=vu;ie[188]=xe;ie[189]=xe;ie[190]=xe;ie[191]=bu;for(let e=192;e<=215;e++)ie[e]=wu;ie[216]=_u;ie[217]=Tu;ie[218]=xu;ie[219]=Ou;ie[220]=xe;ie[221]=xe;ie[222]=xe;ie[223]=xe;for(let e=224;e<=243;e++)ie[e]=ji("simple values are not supported");ie[244]=xe;ie[245]=xe;ie[246]=xe;ie[247]=Eu;ie[248]=ji("simple values are not supported");ie[249]=Iu;ie[250]=Su;ie[251]=$u;ie[252]=xe;ie[253]=xe;ie[254]=xe;ie[255]=Au;var _t=[];for(let e=0;e<24;e++)_t[e]=new ce(D.uint,e,1);for(let e=-1;e>=-24;e--)_t[31-e]=new ce(D.negint,e,1);_t[64]=new ce(D.bytes,new Uint8Array(0),1);_t[96]=new ce(D.string,"",1);_t[128]=new ce(D.array,0,1);_t[160]=new ce(D.map,0,1);_t[244]=new ce(D.false,!1,1);_t[245]=new ce(D.true,!0,1);_t[246]=new ce(D.null,null,1);function Xo(){let e=[];return e[D.uint.major]=ct,e[D.negint.major]=Ai,e[D.bytes.major]=qr,e[D.string.major]=su,e[D.array.major]=Si,e[D.map.major]=$i,e[D.tag.major]=ki,e[D.float.major]=Ui,e}var Hx=Xo(),qx=new Ei,Ni=class e{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(`${Ko} object contains circular references`);return new e(r,t)}},qt={null:new ce(D.null,null),undefined:new ce(D.undefined,void 0),true:new ce(D.true,!0),false:new ce(D.false,!1),emptyArray:new ce(D.array,0),emptyMap:new ce(D.map,0)},Wt={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ce(D.float,e):e>=0?new ce(D.uint,e):new ce(D.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ce(D.uint,e):new ce(D.negint,e)},Uint8Array(e,t,r,n){return new ce(D.bytes,e)},string(e,t,r,n){return new ce(D.string,e)},boolean(e,t,r,n){return e?qt.true:qt.false},null(e,t,r,n){return qt.null},undefined(e,t,r,n){return qt.undefined},ArrayBuffer(e,t,r,n){return new ce(D.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ce(D.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[qt.emptyArray,new ce(D.break)]:qt.emptyArray;n=Ni.createCheck(n,e);let i=[],a=0;for(let o of e)i[a++]=Pi(o,r,n);return r.addBreakTokens?[new ce(D.array,e.length),i,new ce(D.break)]:[new ce(D.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",a=i?e.keys():Object.keys(e),o=i?e.size:a.length;if(!o)return r.addBreakTokens===!0?[qt.emptyMap,new ce(D.break)]:qt.emptyMap;n=Ni.createCheck(n,e);let u=[],l=0;for(let c of a)u[l++]=[Pi(c,r,n),Pi(i?e.get(c):e[c],r,n)];return yp(u,r),r.addBreakTokens?[new ce(D.map,o),u,new ce(D.break)]:[new ce(D.map,o),u]}};Wt.Map=Wt.Object;Wt.Buffer=Wt.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Wt[`${e}Array`]=Wt.DataView;function Pi(e,t={},r){let n=js(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Wt[n];if(typeof i=="function"){let o=i(e,n,t,r);if(o!=null)return o}let a=Wt[n];if(!a)throw new Error(`${Ko} unsupported type: ${n}`);return a(e,n,t,r)}function yp(e,t){t.mapSorter&&e.sort(t.mapSorter)}var mp={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Yo=class{constructor(t,r={}){this._pos=0,this.data=t,this.options=r}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let t=this.data[this._pos],r=_t[t];if(r===void 0){let n=ie[t];if(!n)throw new Error(`${ve} no decoder for major type ${t>>>5} (byte 0x${t.toString(16).padStart(2,"0")})`);let i=t&31;r=n(this.data,this._pos,i,this.options)}return this._pos+=r.encodedLength,r}},kn=Symbol.for("DONE"),Bi=Symbol.for("BREAK");function gp(e,t,r){let n=[];for(let i=0;i<e.value;i++){let a=Un(t,r);if(a===Bi){if(e.value===1/0)break;throw new Error(`${ve} got unexpected break to lengthed array`)}if(a===kn)throw new Error(`${ve} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=a}return n}function vp(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},a=n?new Map:void 0;for(let o=0;o<e.value;o++){let u=Un(t,r);if(u===Bi){if(e.value===1/0)break;throw new Error(`${ve} got unexpected break to lengthed map`)}if(u===kn)throw new Error(`${ve} found map but not enough entries (got ${o} [no key], expected ${e.value})`);if(n!==!0&&typeof u!="string")throw new Error(`${ve} non-string keys not supported (got ${typeof u})`);if(r.rejectDuplicateMapKeys===!0&&(n&&a.has(u)||!n&&u in i))throw new Error(`${ve} found repeat map key "${u}"`);let l=Un(t,r);if(l===kn)throw new Error(`${ve} found map but not enough entries (got ${o} [no value], expected ${e.value})`);n?a.set(u,l):i[u]=l}return n?a:i}function Un(e,t){if(e.done())return kn;let r=e.next();if(r.type===D.break)return Bi;if(r.type.terminal)return r.value;if(r.type===D.array)return gp(r,e,t);if(r.type===D.map)return vp(r,e,t);if(r.type===D.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Un(e,t);return t.tags[r.value](n)}throw new Error(`${ve} tag not supported (${r.value})`)}throw new Error("unsupported")}function Nu(e,t){if(!(e instanceof Uint8Array))throw new Error(`${ve} data to decode must be a Uint8Array`);t=Object.assign({},mp,t);let r=t.tokenizer||new Yo(e,t),n=Un(r,t);if(n===kn)throw new Error(`${ve} did not find any content to decode`);if(n===Bi)throw new Error(`${ve} got unexpected break`);return[n,e.subarray(r.pos())]}function Qo(e,t){let[r,n]=Nu(e,t);if(n.length>0)throw new Error(`${ve} too many terminals, data makes no sense`);return r}var _p=42;function Tp(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return bt.decode(e.subarray(1))}var Bu={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Bu.tags[_p]=Tp;var Zo=e=>Qo(e,Bu);var Jt=zo(Ci(),1),jn={SHA2_256:18,LENGTH:32,DAG_PB:112},ra=40;function Xr(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=Jt.default.decode(e);return t.seek(Jt.default.decode.bytes),r}function na(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 ia(e){Jt.default.decode(e);let t=Jt.default.decode.bytes,r=Jt.default.decode(e.subarray(Jt.default.decode.bytes)),n=Jt.default.decode.bytes;return t+n+r}var Xt={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},Pn={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Xt.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Xt.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Pn["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 a=e[i];if(a=Pn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](a),a===void 0)return;n.push(a)}return n}}return e}},Int:Xt.Int,CarV1HeaderOrV2Pragma:e=>{if(Xt.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[a,o]=t[i];switch(a){case"roots":{let u=Pn["CarV1HeaderOrV2Pragma > roots (anon)"](e[a]);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.roots=u}}break;case"version":{n--;let u=Pn.Int(e[a]);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.version=u}}break;default:return}}if(!(n>0))return r}},Nn={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Xt.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Xt.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Nn["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 a=e[i];if(a=Nn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](a),a===void 0)return;n.push(a)}return n}}return e}},Int:Xt.Int,CarV1HeaderOrV2Pragma:e=>{if(Xt.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[a,o]=t[i];switch(a){case"roots":{let u=Nn["CarV1HeaderOrV2Pragma > roots (anon)"](o);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.roots=u}}break;case"version":{n--;let u=Nn.Int(o);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.version=u}}break;default:return}}if(!(n>0))return r}},oa={toTyped:Pn.CarV1HeaderOrV2Pragma,toRepresentation:Nn.CarV1HeaderOrV2Pragma};var gO=Xo();var Dp=zo(Ci(),1);var TO=[new ce(D.map,2),new ce(D.string,"version"),new ce(D.uint,1),new ce(D.string,"roots")],xO=new ce(D.tag,42);async function aa(e,t){let r=Xr(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=Zo(n);if(oa.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 a=na(await e.exactly(ra,!0));e.seek(a.dataOffset-e.pos);let o=await aa(e,1);return Object.assign(o,a)}async function Fp(e){let t=await e.exactly(2,!1);if(t[0]===jn.SHA2_256&&t[1]===jn.LENGTH){let o=await e.exactly(34,!0),u=xi(o);return bt.create(0,jn.DAG_PB,u)}let r=Xr(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=Xr(await e.upTo(8),e),i=await e.exactly(ia(await e.upTo(8)),!0),a=xi(i);return bt.create(r,n,a)}async function Ku(e){let t=e.pos,r=Xr(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await Fp(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function zp(e){let{cid:t,blockLength:r}=await Ku(e);return{bytes:await e.exactly(r,!0),cid:t}}async function Gp(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await Ku(e),a={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(a.blockLength),a}function Yr(e){let t=(async()=>{let r=await aa(e);if(r.version===2){let n=e.pos-r.dataOffset;e=Hp(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await zp(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await Gp(e)}}}function br(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 Kp(e){let t=0,r=0,n=0,i=new Uint8Array(0),a=async o=>{r=i.length-n;let u=[i.subarray(n)];for(;r<o;){let c=await e();if(c==null)break;r<0?c.length>r&&u.push(c.subarray(-r)):u.push(c),r+=c.length}i=new Uint8Array(u.reduce((c,m)=>c+m.length,0));let l=0;for(let c of u)i.set(c,l),l+=c.length;n=0};return{async upTo(o){return i.length-n<o&&await a(o),i.subarray(n,n+Math.min(i.length-n,o))},async exactly(o,u=!1){if(i.length-n<o&&await a(o),i.length-n<o)throw new Error("Unexpected end of data");let l=i.subarray(n,n+o);return u&&(t+=o,n+=o),l},seek(o){t+=o,n+=o},get pos(){return t}}}function Qr(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return Kp(r)}function Hp(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 a=await e.exactly(n,i);if(a.length+r>t)throw new Error("Unexpected end of data");return i&&(r+=n),a},seek(n){r+=n,e.seek(n)},get pos(){return e.pos}}}var Bn=class{constructor(t,r,n){this._version=t,this._roots=r,this._iterator=n}get version(){return this._version}async getRoots(){return this._roots}[Symbol.asyncIterator](){return this._iterator}static async fromBytes(t){if(!(t instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Hu(br(t))}static async fromIterable(t){if(!t||typeof t[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Hu(Qr(t))}};async function Hu(e){let t=Yr(e),{version:r,roots:n}=await t.header();return new Bn(r,n,t.blocksIndex())}var wr=class{constructor(t,r){this._header=t,this._blocks=r,this._keys=r.map(n=>n.cid.toString())}get version(){return this._header.version}async getRoots(){return this._header.roots}async has(t){return this._keys.indexOf(t.toString())>-1}async get(t){let r=this._keys.indexOf(t.toString());return r>-1?this._blocks[r]:void 0}async*blocks(){for(let t of this._blocks)yield t}async*cids(){for(let t of this._blocks)yield t.cid}static async fromBytes(t){if(!(t instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return qu(br(t))}static async fromIterable(t){if(!t||typeof t[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return qu(Qr(t))}};async function qu(e){let t=Yr(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new wr(r,n)}var Ri=class{constructor(t,r,n){this._version=t,this._roots=r,this._iterable=n,this._decoded=!1}get version(){return this._version}async getRoots(){return this._roots}},sa=class e extends Ri{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");return this._decoded=!0,this._iterable[Symbol.asyncIterator]()}static async fromBytes(t){let{version:r,roots:n,iterator:i}=await Wu(t);return new e(r,n,i)}static async fromIterable(t){let{version:r,roots:n,iterator:i}=await Ju(t);return new e(r,n,i)}},ua=class e extends Ri{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");this._decoded=!0;let t=this._iterable[Symbol.asyncIterator]();return{async next(){let r=await t.next();return r.done?r:{done:!1,value:r.value.cid}}}}static async fromBytes(t){let{version:r,roots:n,iterator:i}=await Wu(t);return new e(r,n,i)}static async fromIterable(t){let{version:r,roots:n,iterator:i}=await Ju(t);return new e(r,n,i)}};async function Wu(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Xu(br(e))}async function Ju(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Xu(Qr(e))}async function Xu(e){let t=Yr(e),{version:r,roots:n}=await t.header();return{version:r,roots:n,iterator:t.blocks()}}var qp=zo(Ci(),1);var Yu=class{constructor(t){this._iterator=t}[Symbol.asyncIterator](){if(this._iterating)throw new Error("Multiple iterator not supported");return this._iterating=!0,this._iterator}};var Wp=Object.create,qi=Object.defineProperty,Jp=Object.getOwnPropertyDescriptor,Xp=Object.getOwnPropertyNames,Yp=Object.getPrototypeOf,Qp=Object.prototype.hasOwnProperty,Zp=(e,t,r)=>t in e?qi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Re=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),cc=(e,t)=>{for(var r in t)qi(e,r,{get:t[r],enumerable:!0})},eh=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Xp(t))!Qp.call(e,i)&&i!==r&&qi(e,i,{get:()=>t[i],enumerable:!(n=Jp(t,i))||n.enumerable});return e},Lt=(e,t,r)=>(r=e!=null?Wp(Yp(e)):{},eh(t||!e||!e.__esModule?qi(r,"default",{value:e,enumerable:!0}):r,e)),$t=(e,t,r)=>(Zp(e,typeof t!="symbol"?t+"":t,r),r),th={};cc(th,{code:()=>$c,decode:()=>Qi,encode:()=>ka,format:()=>sc,name:()=>am,parse:()=>um,stringify:()=>sc});var rh=["string","number","bigint","symbol"],nh=["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 ih(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return rh.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":oh(e)?"Buffer":ah(e)||"Object"}function oh(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function ah(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(nh.includes(t))return t}var P=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}};P.uint=new P(0,"uint",!0);P.negint=new P(1,"negint",!0);P.bytes=new P(2,"bytes",!0);P.string=new P(3,"string",!0);P.array=new P(4,"array",!1);P.map=new P(5,"map",!1);P.tag=new P(6,"tag",!1);P.float=new P(7,"float",!0);P.false=new P(7,"false",!0);P.true=new P(7,"true",!0);P.null=new P(7,"null",!0);P.undefined=new P(7,"undefined",!0);P.break=new P(7,"break",!0);var Y=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}`}},Zr=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",sh=new TextDecoder,uh=new TextEncoder;function Di(e){return Zr&&globalThis.Buffer.isBuffer(e)}function ma(e){return e instanceof Uint8Array?Di(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var ch=Zr?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Zu(e,t,r):(e,t,r)=>r-t>64?sh.decode(e.subarray(t,r)):Zu(e,t,r),lc=Zr?e=>e.length>64?globalThis.Buffer.from(e):Qu(e):e=>e.length>64?uh.encode(e):Qu(e);var ga=Zr?(e,t,r)=>Di(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),lh=Zr?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),ma(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},fh=Zr?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function dh(e,t){if(Di(e)&&Di(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 Qu(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 Zu(e,t,r){let n=[];for(;t<r;){let i=e[t],a=null,o=i>239?4:i>223?3:i>191?2:1;if(t+o<=r){let u,l,c,m;switch(o){case 1:i<128&&(a=i);break;case 2:u=e[t+1],(u&192)===128&&(m=(i&31)<<6|u&63,m>127&&(a=m));break;case 3:u=e[t+1],l=e[t+2],(u&192)===128&&(l&192)===128&&(m=(i&15)<<12|(u&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:u=e[t+1],l=e[t+2],c=e[t+3],(u&192)===128&&(l&192)===128&&(c&192)===128&&(m=(i&15)<<18|(u&63)<<12|(l&63)<<6|c&63,m>65535&&m<1114112&&(a=m))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),t+=o}return fc(n)}var ec=4096;function fc(e){let t=e.length;if(t<=ec)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=ec));return r}var ph=256,dc=class{constructor(e=ph){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=fh(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=ga(r,0,this.cursor)}else t=lh(this.chunks,this.cursor);return e&&this.reset(),t}},he="CBOR decode error:",_r="CBOR encode error:",Vn=[];Vn[23]=1;Vn[24]=2;Vn[25]=3;Vn[26]=5;Vn[27]=9;function en(e,t,r){if(e.length-t<r)throw new Error(`${he} not enough data for type`)}var ze=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Tr(e,t,r){en(e,t,1);let n=e[t];if(r.strict===!0&&n<ze[0])throw new Error(`${he} integer encoded in more bytes than necessary (strict decode)`);return n}function xr(e,t,r){en(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<ze[1])throw new Error(`${he} integer encoded in more bytes than necessary (strict decode)`);return n}function Or(e,t,r){en(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<ze[2])throw new Error(`${he} integer encoded in more bytes than necessary (strict decode)`);return n}function Er(e,t,r){en(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],a=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&a<ze[3])throw new Error(`${he} integer encoded in more bytes than necessary (strict decode)`);if(a<=Number.MAX_SAFE_INTEGER)return Number(a);if(r.allowBigInt===!0)return a;throw new Error(`${he} integers outside of the safe integer range are not supported`)}function hh(e,t,r,n){return new Y(P.uint,Tr(e,t+1,n),2)}function yh(e,t,r,n){return new Y(P.uint,xr(e,t+1,n),3)}function mh(e,t,r,n){return new Y(P.uint,Or(e,t+1,n),5)}function gh(e,t,r,n){return new Y(P.uint,Er(e,t+1,n),9)}function Ar(e,t){return dt(e,0,t.value)}function dt(e,t,r){if(r<ze[0]){let n=Number(r);e.push([t|n])}else if(r<ze[1]){let n=Number(r);e.push([t|24,n])}else if(r<ze[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<ze[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<ze[4]){let i=[t|27,0,0,0,0,0,0,0],a=Number(n&BigInt(4294967295)),o=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=a&255,a=a>>8,i[7]=a&255,a=a>>8,i[6]=a&255,a=a>>8,i[5]=a&255,i[4]=o&255,o=o>>8,i[3]=o&255,o=o>>8,i[2]=o&255,o=o>>8,i[1]=o&255,e.push(i)}else throw new Error(`${he} encountered BigInt larger than allowable range`)}}Ar.encodedSize=function(e){return dt.encodedSize(e.value)};dt.encodedSize=function(e){return e<ze[0]?1:e<ze[1]?2:e<ze[2]?3:e<ze[3]?5:9};Ar.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function vh(e,t,r,n){return new Y(P.negint,-1-Tr(e,t+1,n),2)}function bh(e,t,r,n){return new Y(P.negint,-1-xr(e,t+1,n),3)}function wh(e,t,r,n){return new Y(P.negint,-1-Or(e,t+1,n),5)}var va=BigInt(-1),pc=BigInt(1);function _h(e,t,r,n){let i=Er(e,t+1,n);if(typeof i!="bigint"){let a=-1-i;if(a>=Number.MIN_SAFE_INTEGER)return new Y(P.negint,a,9)}if(n.allowBigInt!==!0)throw new Error(`${he} integers outside of the safe integer range are not supported`);return new Y(P.negint,va-BigInt(i),9)}function ba(e,t){let r=t.value,n=typeof r=="bigint"?r*va-pc:r*-1-1;dt(e,t.type.majorEncoded,n)}ba.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*va-pc:t*-1-1;return r<ze[0]?1:r<ze[1]?2:r<ze[2]?3:r<ze[3]?5:9};ba.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Fn(e,t,r,n){en(e,t,r+n);let i=ga(e,t+r,t+r+n);return new Y(P.bytes,i,r+n)}function Th(e,t,r,n){return Fn(e,t,1,r)}function xh(e,t,r,n){return Fn(e,t,2,Tr(e,t+1,n))}function Oh(e,t,r,n){return Fn(e,t,3,xr(e,t+1,n))}function Eh(e,t,r,n){return Fn(e,t,5,Or(e,t+1,n))}function Ah(e,t,r,n){let i=Er(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer bytes lengths not supported`);return Fn(e,t,9,i)}function Vi(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===P.string?lc(e.value):e.value),e.encodedBytes}function Wi(e,t){let r=Vi(t);dt(e,t.type.majorEncoded,r.length),e.push(r)}Wi.encodedSize=function(e){let t=Vi(e);return dt.encodedSize(t.length)+t.length};Wi.compareTokens=function(e,t){return Ih(Vi(e),Vi(t))};function Ih(e,t){return e.length<t.length?-1:e.length>t.length?1:dh(e,t)}function zn(e,t,r,n,i){let a=r+n;en(e,t,a);let o=new Y(P.string,ch(e,t+r,t+a),a);return i.retainStringBytes===!0&&(o.byteValue=ga(e,t+r,t+a)),o}function Sh(e,t,r,n){return zn(e,t,1,r,n)}function $h(e,t,r,n){return zn(e,t,2,Tr(e,t+1,n),n)}function kh(e,t,r,n){return zn(e,t,3,xr(e,t+1,n),n)}function Uh(e,t,r,n){return zn(e,t,5,Or(e,t+1,n),n)}function jh(e,t,r,n){let i=Er(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer string lengths not supported`);return zn(e,t,9,i,n)}var Ph=Wi;function tn(e,t,r,n){return new Y(P.array,n,r)}function Nh(e,t,r,n){return tn(e,t,1,r)}function Bh(e,t,r,n){return tn(e,t,2,Tr(e,t+1,n))}function Ch(e,t,r,n){return tn(e,t,3,xr(e,t+1,n))}function Rh(e,t,r,n){return tn(e,t,5,Or(e,t+1,n))}function Mh(e,t,r,n){let i=Er(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer array lengths not supported`);return tn(e,t,9,i)}function Lh(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${he} indefinite length items not allowed`);return tn(e,t,1,1/0)}function wa(e,t){dt(e,P.array.majorEncoded,t.value)}wa.compareTokens=Ar.compareTokens;wa.encodedSize=function(e){return dt.encodedSize(e.value)};function rn(e,t,r,n){return new Y(P.map,n,r)}function Dh(e,t,r,n){return rn(e,t,1,r)}function Vh(e,t,r,n){return rn(e,t,2,Tr(e,t+1,n))}function Fh(e,t,r,n){return rn(e,t,3,xr(e,t+1,n))}function zh(e,t,r,n){return rn(e,t,5,Or(e,t+1,n))}function Gh(e,t,r,n){let i=Er(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer map lengths not supported`);return rn(e,t,9,i)}function Kh(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${he} indefinite length items not allowed`);return rn(e,t,1,1/0)}function _a(e,t){dt(e,P.map.majorEncoded,t.value)}_a.compareTokens=Ar.compareTokens;_a.encodedSize=function(e){return dt.encodedSize(e.value)};function Hh(e,t,r,n){return new Y(P.tag,r,1)}function qh(e,t,r,n){return new Y(P.tag,Tr(e,t+1,n),2)}function Wh(e,t,r,n){return new Y(P.tag,xr(e,t+1,n),3)}function Jh(e,t,r,n){return new Y(P.tag,Or(e,t+1,n),5)}function Xh(e,t,r,n){return new Y(P.tag,Er(e,t+1,n),9)}function Ta(e,t){dt(e,P.tag.majorEncoded,t.value)}Ta.compareTokens=Ar.compareTokens;Ta.encodedSize=function(e){return dt.encodedSize(e.value)};var Yh=20,Qh=21,Zh=22,ey=23;function ty(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${he} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new Y(P.null,null,1):new Y(P.undefined,void 0,1)}function ry(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${he} indefinite length items not allowed`);return new Y(P.break,void 0,1)}function xa(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${he} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${he} Infinity values are not supported`)}return new Y(P.float,e,t)}function ny(e,t,r,n){return xa(Ea(e,t+1),3,n)}function iy(e,t,r,n){return xa(Aa(e,t+1),5,n)}function oy(e,t,r,n){return xa(gc(e,t+1),9,n)}function Oa(e,t,r){let n=t.value;if(n===!1)e.push([P.float.majorEncoded|Yh]);else if(n===!0)e.push([P.float.majorEncoded|Qh]);else if(n===null)e.push([P.float.majorEncoded|Zh]);else if(n===void 0)e.push([P.float.majorEncoded|ey]);else{let i,a=!1;(!r||r.float64!==!0)&&(yc(n),i=Ea(xt,1),n===i||Number.isNaN(n)?(xt[0]=249,e.push(xt.slice(0,3)),a=!0):(mc(n),i=Aa(xt,1),n===i&&(xt[0]=250,e.push(xt.slice(0,5)),a=!0))),a||(ay(n),i=gc(xt,1),xt[0]=251,e.push(xt.slice(0,9)))}}Oa.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){yc(r);let n=Ea(xt,1);if(r===n||Number.isNaN(r))return 3;if(mc(r),n=Aa(xt,1),r===n)return 5}return 9};var hc=new ArrayBuffer(9),ft=new DataView(hc,1),xt=new Uint8Array(hc,0);function yc(e){if(e===1/0)ft.setUint16(0,31744,!1);else if(e===-1/0)ft.setUint16(0,64512,!1);else if(Number.isNaN(e))ft.setUint16(0,32256,!1);else{ft.setFloat32(0,e);let t=ft.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)ft.setUint16(0,31744,!1);else if(r===0)ft.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?ft.setUint16(0,0):i<-14?ft.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):ft.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Ea(e,t){if(e.length-t<2)throw new Error(`${he} 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,a;return n===0?a=i*2**-24:n!==31?a=(i+1024)*2**(n-25):a=i===0?1/0:NaN,r&32768?-a:a}function mc(e){ft.setFloat32(0,e,!1)}function Aa(e,t){if(e.length-t<4)throw new Error(`${he} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function ay(e){ft.setFloat64(0,e,!1)}function gc(e,t){if(e.length-t<8)throw new Error(`${he} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Oa.compareTokens=Ar.compareTokens;function Ee(e,t,r){throw new Error(`${he} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Ji(e){return()=>{throw new Error(`${he} ${e}`)}}var oe=[];for(let e=0;e<=23;e++)oe[e]=Ee;oe[24]=hh;oe[25]=yh;oe[26]=mh;oe[27]=gh;oe[28]=Ee;oe[29]=Ee;oe[30]=Ee;oe[31]=Ee;for(let e=32;e<=55;e++)oe[e]=Ee;oe[56]=vh;oe[57]=bh;oe[58]=wh;oe[59]=_h;oe[60]=Ee;oe[61]=Ee;oe[62]=Ee;oe[63]=Ee;for(let e=64;e<=87;e++)oe[e]=Th;oe[88]=xh;oe[89]=Oh;oe[90]=Eh;oe[91]=Ah;oe[92]=Ee;oe[93]=Ee;oe[94]=Ee;oe[95]=Ji("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)oe[e]=Sh;oe[120]=$h;oe[121]=kh;oe[122]=Uh;oe[123]=jh;oe[124]=Ee;oe[125]=Ee;oe[126]=Ee;oe[127]=Ji("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)oe[e]=Nh;oe[152]=Bh;oe[153]=Ch;oe[154]=Rh;oe[155]=Mh;oe[156]=Ee;oe[157]=Ee;oe[158]=Ee;oe[159]=Lh;for(let e=160;e<=183;e++)oe[e]=Dh;oe[184]=Vh;oe[185]=Fh;oe[186]=zh;oe[187]=Gh;oe[188]=Ee;oe[189]=Ee;oe[190]=Ee;oe[191]=Kh;for(let e=192;e<=215;e++)oe[e]=Hh;oe[216]=qh;oe[217]=Wh;oe[218]=Jh;oe[219]=Xh;oe[220]=Ee;oe[221]=Ee;oe[222]=Ee;oe[223]=Ee;for(let e=224;e<=243;e++)oe[e]=Ji("simple values are not supported");oe[244]=Ee;oe[245]=Ee;oe[246]=Ee;oe[247]=ty;oe[248]=Ji("simple values are not supported");oe[249]=ny;oe[250]=iy;oe[251]=oy;oe[252]=Ee;oe[253]=Ee;oe[254]=Ee;oe[255]=ry;var kt=[];for(let e=0;e<24;e++)kt[e]=new Y(P.uint,e,1);for(let e=-1;e>=-24;e--)kt[31-e]=new Y(P.negint,e,1);kt[64]=new Y(P.bytes,new Uint8Array(0),1);kt[96]=new Y(P.string,"",1);kt[128]=new Y(P.array,0,1);kt[160]=new Y(P.map,0,1);kt[244]=new Y(P.false,!1,1);kt[245]=new Y(P.true,!0,1);kt[246]=new Y(P.null,null,1);function Ia(){let e=[];return e[P.uint.major]=Ar,e[P.negint.major]=ba,e[P.bytes.major]=Wi,e[P.string.major]=Ph,e[P.array.major]=wa,e[P.map.major]=_a,e[P.tag.major]=Ta,e[P.float.major]=Oa,e}var aE=Ia(),ca=new dc,tc=class vc{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(`${_r} object contains circular references`);return new vc(r,t)}},Yt={null:new Y(P.null,null),undefined:new Y(P.undefined,void 0),true:new Y(P.true,!0),false:new Y(P.false,!1),emptyArray:new Y(P.array,0),emptyMap:new Y(P.map,0)},tr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new Y(P.float,e):e>=0?new Y(P.uint,e):new Y(P.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new Y(P.uint,e):new Y(P.negint,e)},Uint8Array(e,t,r,n){return new Y(P.bytes,e)},string(e,t,r,n){return new Y(P.string,e)},boolean(e,t,r,n){return e?Yt.true:Yt.false},null(e,t,r,n){return Yt.null},undefined(e,t,r,n){return Yt.undefined},ArrayBuffer(e,t,r,n){return new Y(P.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new Y(P.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Yt.emptyArray,new Y(P.break)]:Yt.emptyArray;n=tc.createCheck(n,e);let i=[],a=0;for(let o of e)i[a++]=Mi(o,r,n);return r.addBreakTokens?[new Y(P.array,e.length),i,new Y(P.break)]:[new Y(P.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",a=i?e.keys():Object.keys(e),o=i?e.size:a.length;if(!o)return r.addBreakTokens===!0?[Yt.emptyMap,new Y(P.break)]:Yt.emptyMap;n=tc.createCheck(n,e);let u=[],l=0;for(let c of a)u[l++]=[Mi(c,r,n),Mi(i?e.get(c):e[c],r,n)];return sy(u,r),r.addBreakTokens?[new Y(P.map,o),u,new Y(P.break)]:[new Y(P.map,o),u]}};tr.Map=tr.Object;tr.Buffer=tr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))tr[`${e}Array`]=tr.DataView;function Mi(e,t={},r){let n=ih(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||tr[n];if(typeof i=="function"){let o=i(e,n,t,r);if(o!=null)return o}let a=tr[n];if(!a)throw new Error(`${_r} unsupported type: ${n}`);return a(e,n,t,r)}function sy(e,t){t.mapSorter&&e.sort(t.mapSorter)}function bc(e,t,r,n){if(Array.isArray(t))for(let i of t)bc(e,i,r,n);else r[t.type.major](e,t,n)}function uy(e,t,r){let n=Mi(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let i=r.quickEncodeToken(n);if(i)return i;let a=t[n.type.major];if(a.encodedSize){let o=a.encodedSize(n,r),u=new dc(o);if(a(u,n,r),u.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return ma(u.chunks[0])}}return ca.reset(),bc(ca,n,t,r),ca.toBytes(!0)}var cy={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},ly=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=kt[e];if(t===void 0){let r=oe[e];if(!r)throw new Error(`${he} 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}},Mn=Symbol.for("DONE"),Xi=Symbol.for("BREAK");function fy(e,t,r){let n=[];for(let i=0;i<e.value;i++){let a=Ln(t,r);if(a===Xi){if(e.value===1/0)break;throw new Error(`${he} got unexpected break to lengthed array`)}if(a===Mn)throw new Error(`${he} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=a}return n}function dy(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},a=n?new Map:void 0;for(let o=0;o<e.value;o++){let u=Ln(t,r);if(u===Xi){if(e.value===1/0)break;throw new Error(`${he} got unexpected break to lengthed map`)}if(u===Mn)throw new Error(`${he} found map but not enough entries (got ${o} [no key], expected ${e.value})`);if(n!==!0&&typeof u!="string")throw new Error(`${he} non-string keys not supported (got ${typeof u})`);if(r.rejectDuplicateMapKeys===!0&&(n&&a.has(u)||!n&&u in i))throw new Error(`${he} found repeat map key "${u}"`);let l=Ln(t,r);if(l===Mn)throw new Error(`${he} found map but not enough entries (got ${o} [no value], expected ${e.value})`);n?a.set(u,l):i[u]=l}return n?a:i}function Ln(e,t){if(e.done())return Mn;let r=e.next();if(r.type===P.break)return Xi;if(r.type.terminal)return r.value;if(r.type===P.array)return fy(r,e,t);if(r.type===P.map)return dy(r,e,t);if(r.type===P.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Ln(e,t);return t.tags[r.value](n)}throw new Error(`${he} tag not supported (${r.value})`)}throw new Error("unsupported")}function py(e,t){if(!(e instanceof Uint8Array))throw new Error(`${he} data to decode must be a Uint8Array`);t=Object.assign({},cy,t);let r=t.tokenizer||new ly(e,t),n=Ln(r,t);if(n===Mn)throw new Error(`${he} did not find any content to decode`);if(n===Xi)throw new Error(`${he} got unexpected break`);return[n,e.subarray(r.pos())]}function Sa(e,t){let[r,n]=py(e,t);if(n.length>0)throw new Error(`${he} too many terminals, data makes no sense`);return r}var hy=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(t.type===P.array&&(t.elements++,t.elements!==1&&e.push([44])),t.type===P.map&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[P.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)}[P.negint.major](e,t){this[P.uint.major](e,t)}[P.bytes.major](e,t){throw new Error(`${_r} unsupported type: Uint8Array`)}[P.string.major](e,t){this.prefix(e);let r=lc(JSON.stringify(t.value));e.push(r.length>32?ma(r):r)}[P.array.major](e,t){this.prefix(e),this.inRecursive.push({type:P.array,elements:0}),e.push([91])}[P.map.major](e,t){this.prefix(e),this.inRecursive.push({type:P.map,elements:0}),e.push([123])}[P.tag.major](e,t){}[P.float.major](e,t){if(t.type.name==="break"){let a=this.inRecursive.pop();if(a){if(a.type===P.array)e.push([93]);else if(a.type===P.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(`${_r} 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 a=0;a<r.length;a++)n[a]=r.charCodeAt(a),!i&&(n[a]===46||n[a]===101||n[a]===69)&&(i=!0);i||(n.push(46),n.push(48)),e.push(n)}};function yy(e,t){if(Array.isArray(e[0])||Array.isArray(t[0]))throw new Error(`${_r} complex map keys are not supported`);let r=e[0],n=t[0];if(r.type!==P.string||n.type!==P.string)throw new Error(`${_r} non-string map keys are not supported`);if(r<n)return-1;if(r>n)return 1;throw new Error(`${_r} unexpected duplicate map keys, this is not supported`)}var my={addBreakTokens:!0,mapSorter:yy};function gy(e,t){return t=Object.assign({},my,t),uy(e,new hy,t)}var wc=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(`${he} 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(`${he} unexpected token at position ${this._pos}, expected to find '${String.fromCharCode(...e)}'`)}parseNumber(){let e=this._pos,t=!1,r=!1,n=o=>{for(;!this.done();){let u=this.ch();if(o.includes(u))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 Y(P.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(`${he} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(r)throw new Error(`${he} 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)),a=parseFloat(i);return r?new Y(P.float,a,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(a)?new Y(a>=0?P.uint:P.negint,a,this._pos-e):new Y(a>=0?P.uint:P.negint,BigInt(i),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${he} unexpected character at position ${this._pos}; this shouldn't happen`);this._pos++;for(let i=this._pos,a=0;i<this.data.length&&a<65536;i++,a++){let o=this.data[i];if(o===92||o<32||o>=128)break;if(o===34){let u=String.fromCharCode.apply(null,this.data.subarray(this._pos,i));return this._pos=i+1,new Y(P.string,u,a)}}let e=this._pos,t=[],r=()=>{if(this._pos+4>=this.data.length)throw new Error(`${he} unexpected end of unicode escape sequence at position ${this._pos}`);let i=0;for(let a=0;a<4;a++){let o=this.ch();if(o>=48&&o<=57)o-=48;else if(o>=97&&o<=102)o=o-97+10;else if(o>=65&&o<=70)o=o-65+10;else throw new Error(`${he} unexpected unicode escape character at position ${this._pos}`);i=i*16+o,this._pos++}return i},n=()=>{let i=this.ch(),a=null,o=i>239?4:i>223?3:i>191?2:1;if(this._pos+o>this.data.length)throw new Error(`${he} unexpected unicode sequence at position ${this._pos}`);let u,l,c,m;switch(o){case 1:i<128&&(a=i);break;case 2:u=this.data[this._pos+1],(u&192)===128&&(m=(i&31)<<6|u&63,m>127&&(a=m));break;case 3:u=this.data[this._pos+1],l=this.data[this._pos+2],(u&192)===128&&(l&192)===128&&(m=(i&15)<<12|(u&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:u=this.data[this._pos+1],l=this.data[this._pos+2],c=this.data[this._pos+3],(u&192)===128&&(l&192)===128&&(c&192)===128&&(m=(i&15)<<18|(u&63)<<12|(l&63)<<6|c&63,m>65535&&m<1114112&&(a=m))}a===null?(a=65533,o=1):a>65535&&(a-=65536,t.push(a>>>10&1023|55296),a=56320|a&1023),t.push(a),this._pos+=o};for(;!this.done();){let i=this.ch(),a;switch(i){case 92:if(this._pos++,this.done())throw new Error(`${he} unexpected string termination at position ${this._pos}`);switch(a=this.ch(),this._pos++,a){case 34:case 39:case 92:case 47:t.push(a);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(`${he} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new Y(P.string,fc(t),this._pos-e);default:if(i<32)throw new Error(`${he} invalid control character at position ${this._pos}`);i<128?(t.push(i),this._pos++):n()}}throw new Error(`${he} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new Y(P.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new Y(P.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new Y(P.null,null,4);case 102:return this.expect([102,97,108,115,101]),new Y(P.false,!1,5);case 116:return this.expect([116,114,117,101]),new Y(P.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(`${he} 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 Y(P.break,void 0,1);if(this.ch()!==44)throw new Error(`${he} 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 Y(P.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 Y(P.break,void 0,1);if(this.ch()!==44)throw new Error(`${he} 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 Y(P.break,void 0,1);let e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${he} 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(`${he} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}};function vy(e,t){return t=Object.assign({tokenizer:new wc(e,t)},t),Sa(e,t)}var sE=new Uint8Array(0),by=(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},$a=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 wy(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 a=e.charAt(i),o=a.charCodeAt(0);if(r[o]!==255)throw new TypeError(a+" is ambiguous");r[o]=i}var u=e.length,l=e.charAt(0),c=Math.log(u)/Math.log(256),m=Math.log(256)/Math.log(u);function g(G){if(G instanceof Uint8Array||(ArrayBuffer.isView(G)?G=new Uint8Array(G.buffer,G.byteOffset,G.byteLength):Array.isArray(G)&&(G=Uint8Array.from(G))),!(G instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(G.length===0)return"";for(var Z=0,ae=0,B=0,V=G.length;B!==V&&G[B]===0;)B++,Z++;for(var q=(V-B)*m+1>>>0,se=new Uint8Array(q);B!==V;){for(var F=G[B],ue=0,z=q-1;(F!==0||ue<ae)&&z!==-1;z--,ue++)F+=256*se[z]>>>0,se[z]=F%u>>>0,F=F/u>>>0;if(F!==0)throw new Error("Non-zero carry");ae=ue,B++}for(var pe=q-ae;pe!==q&&se[pe]===0;)pe++;for(var M=l.repeat(Z);pe<q;++pe)M+=e.charAt(se[pe]);return M}function R(G){if(typeof G!="string")throw new TypeError("Expected String");if(G.length===0)return new Uint8Array;var Z=0;if(G[Z]!==" "){for(var ae=0,B=0;G[Z]===l;)ae++,Z++;for(var V=(G.length-Z)*c+1>>>0,q=new Uint8Array(V);G[Z];){var se=r[G.charCodeAt(Z)];if(se===255)return;for(var F=0,ue=V-1;(se!==0||F<B)&&ue!==-1;ue--,F++)se+=u*q[ue]>>>0,q[ue]=se%256>>>0,se=se/256>>>0;if(se!==0)throw new Error("Non-zero carry");B=F,Z++}if(G[Z]!==" "){for(var z=V-B;z!==V&&q[z]===0;)z++;for(var pe=new Uint8Array(ae+(V-z)),M=ae;z!==V;)pe[M++]=q[z++];return pe}}}function j(G){var Z=R(G);if(Z)return Z;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:R,decode:j}}var _y=wy,Ty=_y,xy=Ty,Oy=class{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")}},Ey=class{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 _c(this,e)}},Ay=class{constructor(e){this.decoders=e}or(e){return _c(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},_c=(e,t)=>new Ay({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}}),Iy=class{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new Oy(e,t,r),this.decoder=new Ey(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Tc=({name:e,prefix:t,encode:r,decode:n})=>new Iy(e,t,r,n),xc=({prefix:e,name:t,alphabet:r})=>{let{encode:n,decode:i}=xy(r,t);return Tc({prefix:e,name:t,encode:n,decode:a=>$a(i(a))})},Sy=(e,t,r,n)=>{let i={};for(let m=0;m<t.length;++m)i[t[m]]=m;let a=e.length;for(;e[a-1]==="=";)--a;let o=new Uint8Array(a*r/8|0),u=0,l=0,c=0;for(let m=0;m<a;++m){let g=i[e[m]];if(g===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<r|g,u+=r,u>=8&&(u-=8,o[c++]=255&l>>u)}if(u>=r||255&l<<8-u)throw new SyntaxError("Unexpected end of data");return o},$y=(e,t,r)=>{let n=t[t.length-1]==="=",i=(1<<r)-1,a="",o=0,u=0;for(let l=0;l<e.length;++l)for(u=u<<8|e[l],o+=8;o>r;)o-=r,a+=t[i&u>>o];if(o&&(a+=t[i&u<<r-o]),n)for(;a.length*r&7;)a+="=";return a},ot=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>Tc({prefix:t,name:e,encode(i){return $y(i,n,r)},decode(i){return Sy(i,n,r,e)}}),Li=ot({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),uE=ot({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),cE=ot({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),lE=ot({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),fE=ot({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),dE=ot({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),pE=ot({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),hE=ot({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),yE=ot({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),er=xc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mE=xc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Oc={};cc(Oc,{Digest:()=>Yi,create:()=>Ki,decode:()=>Gn,equals:()=>Ac});var ky=Ec,rc=128,Uy=127,jy=~Uy,Py=Math.pow(2,31);function Ec(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Py;)t[r++]=e&255|rc,e/=128;for(;e&jy;)t[r++]=e&255|rc,e>>>=7;return t[r]=e|0,Ec.bytes=r-n+1,t}var Ny=da,By=128,nc=127;function da(e,n){var r=0,n=n||0,i=0,a=n,o,u=e.length;do{if(a>=u)throw da.bytes=0,new RangeError("Could not decode varint");o=e[a++],r+=i<28?(o&nc)<<i:(o&nc)*Math.pow(2,i),i+=7}while(o>=By);return da.bytes=a-n,r}var Cy=Math.pow(2,7),Ry=Math.pow(2,14),My=Math.pow(2,21),Ly=Math.pow(2,28),Dy=Math.pow(2,35),Vy=Math.pow(2,42),Fy=Math.pow(2,49),zy=Math.pow(2,56),Gy=Math.pow(2,63),Ky=function(e){return e<Cy?1:e<Ry?2:e<My?3:e<Ly?4:e<Dy?5:e<Vy?6:e<Fy?7:e<zy?8:e<Gy?9:10},Hy={encode:ky,decode:Ny,encodingLength:Ky},qy=Hy,Fi=qy,pa=(e,t=0)=>[Fi.decode(e,t),Fi.decode.bytes],zi=(e,t,r=0)=>(Fi.encode(e,t,r),t),Gi=e=>Fi.encodingLength(e),Ki=(e,t)=>{let r=t.byteLength,n=Gi(e),i=n+Gi(r),a=new Uint8Array(i+r);return zi(e,a,0),zi(r,a,n),a.set(t,i),new Yi(e,r,t,a)},Gn=e=>{let t=$a(e),[r,n]=pa(t),[i,a]=pa(t.subarray(n)),o=t.subarray(n+a);if(o.byteLength!==i)throw new Error("Incorrect length");return new Yi(r,i,o,t)},Ac=(e,t)=>{if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&by(e.bytes,r.bytes)}},Yi=class{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}},ic=(e,t)=>{let{bytes:r,version:n}=e;switch(n){case 0:return Jy(r,ha(e),t||er.encoder);default:return Xy(r,ha(e),t||Li.encoder)}},oc=new WeakMap,ha=e=>{let t=oc.get(e);if(t==null){let r=new Map;return oc.set(e,r),r}return t},rr=class He{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!==Cn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Yy)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return He.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=Ki(t,r);return He.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 He.equals(this,t)}static equals(t,r){let n=r;return n&&t.code===n.code&&t.version===n.version&&Ac(t.multihash,n.multihash)}toString(t){return ic(this,t)}toJSON(){return{"/":ic(this)}}link(){return this}get[Symbol.toStringTag](){return"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 He)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:a,bytes:o}=r;return new He(n,i,a,o||ac(n,i,a.bytes))}else if(r[Qy]===!0){let{version:n,multihash:i,code:a}=r,o=Gn(i);return He.create(n,a,o)}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!==Cn)throw new Error(`Version 0 CID must use dag-pb (code: ${Cn}) block encoding`);return new He(t,r,n,n.bytes)}case 1:{let i=ac(t,r,n.bytes);return new He(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return He.create(0,Cn,t)}static createV1(t,r){return He.create(1,t,r)}static decode(t){let[r,n]=He.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=He.inspectBytes(t),n=r.size-r.multihashSize,i=$a(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let a=i.subarray(r.multihashSize-r.digestSize),o=new Yi(r.multihashCode,r.digestSize,a,i);return[r.version===0?He.createV0(o):He.createV1(r.codec,o),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[g,R]=pa(t.subarray(r));return r+=R,g},i=n(),a=Cn;if(i===18?(i=0,r=0):a=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,u=n(),l=n(),c=r+l,m=c-o;return{version:i,codec:a,multihashCode:u,digestSize:l,multihashSize:m,size:c}}static parse(t,r){let[n,i]=Wy(t,r),a=He.decode(i);if(a.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ha(a).set(n,t),a}},Wy=(e,t)=>{switch(e[0]){case"Q":{let r=t||er;return[er.prefix,r.decode(`${er.prefix}${e}`)]}case er.prefix:{let r=t||er;return[er.prefix,r.decode(e)]}case Li.prefix:{let r=t||Li;return[Li.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)]}}},Jy=(e,t,r)=>{let{prefix:n}=r;if(n!==er.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let a=r.encode(e).slice(1);return t.set(n,a),a}else return i},Xy=(e,t,r)=>{let{prefix:n}=r,i=t.get(n);if(i==null){let a=r.encode(e);return t.set(n,a),a}else return i},Cn=112,Yy=18,ac=(e,t,r)=>{let n=Gi(e),i=n+Gi(t),a=new Uint8Array(i+r.byteLength);return zi(e,a,0),zi(t,a,n),a.set(r,i),a},Qy=Symbol.for("@ipld/js-cid/CID"),Ic=({name:e,code:t,encode:r})=>new Zy(e,t,r),Zy=class{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?Ki(this.code,t):t.then(r=>Ki(this.code,r))}else throw Error("Unknown type, must be binary type")}},Sc=ot({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),gE=ot({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),vE=ot({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),bE=ot({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function em(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=rr.asCID(e);if(!t)return null;let r=t.toString();return[new Y(P.map,1/0,1),new Y(P.string,"/",1),new Y(P.string,r,r.length),new Y(P.break,void 0,1)]}function Hi(e){let t=Sc.encode(e).slice(1);return[new Y(P.map,1/0,1),new Y(P.string,"/",1),new Y(P.map,1/0,1),new Y(P.string,"bytes",5),new Y(P.string,t,t.length),new Y(P.break,void 0,1),new Y(P.break,void 0,1)]}function Tt(e){return Hi(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function tm(e){return Hi(new Uint8Array(e))}function rm(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function nm(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 im={typeEncoders:{Object:em,Buffer:Hi,Uint8Array:Hi,Int8Array:Tt,Uint16Array:Tt,Int16Array:Tt,Uint32Array:Tt,Int32Array:Tt,Float32Array:Tt,Float64Array:Tt,Uint8ClampedArray:Tt,BigInt64Array:Tt,BigUint64Array:Tt,DataView:Tt,ArrayBuffer:tm,undefined:rm,number:nm}},om=class extends wc{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===P.map){let t=this._next();if(t.type===P.string&&t.value==="/"){let r=this._next();if(r.type===P.string){if(this._next().type!==P.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new Y(P.tag,42,0)}if(r.type===P.map){let n=this._next();if(n.type===P.string&&n.value==="bytes"){let i=this._next();if(i.type===P.string){for(let o=0;o<2;o++)if(this._next().type!==P.break)throw new Error("Invalid encoded Bytes form");let a=Sc.decode(`m${i.value}`);return new Y(P.bytes,a,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(n)}this.tokenBuffer.push(r)}this.tokenBuffer.push(t)}return e}},ya={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};ya.tags[42]=rr.parse;var am="dag-json",$c=297,ka=e=>gy(e,im),Qi=e=>{let t=Object.assign(ya,{tokenizer:new om(e,ya)});return vy(e,t)},sc=e=>sm.decode(ka(e)),sm=new TextDecoder,um=e=>Qi(cm.encode(e)),cm=new TextEncoder;function lm(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function uc(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 fm(e,t){lm(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var dm=e=>e instanceof Uint8Array,la=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),St=(e,t)=>e<<32-t|e>>>t,pm=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!pm)throw new Error("Non little-endian hardware is not supported");function hm(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function kc(e){if(typeof e=="string"&&(e=hm(e)),!dm(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}var ym=class{clone(){return this._cloneInto()}},wE={}.toString;function mm(e){let t=n=>e().update(kc(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function gm(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let i=BigInt(32),a=BigInt(4294967295),o=Number(r>>i&a),u=Number(r&a),l=n?4:0,c=n?0:4;e.setUint32(t+l,o,n),e.setUint32(t+c,u,n)}var vm=class extends ym{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=la(this.buffer)}update(e){uc(this);let{view:t,buffer:r,blockLen:n}=this;e=kc(e);let i=e.length;for(let a=0;a<i;){let o=Math.min(n-this.pos,i-a);if(o===n){let u=la(e);for(;n<=i-a;a+=n)this.process(u,a);continue}r.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){uc(this),fm(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>n-a&&(this.process(r,0),a=0);for(let m=a;m<n;m++)t[m]=0;gm(r,n-8,BigInt(this.length*8),i),this.process(r,0);let o=la(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let l=u/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<l;m++)o.setUint32(4*m,c[m],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:a,pos:o}=this;return e.length=n,e.pos=o,e.finished=i,e.destroyed=a,n%t&&e.buffer.set(r),e}},bm=(e,t,r)=>e&t^~e&r,wm=(e,t,r)=>e&t^e&r^t&r,_m=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Qt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Zt=new Uint32Array(64),Tm=class extends vm{constructor(){super(64,32,8,!1),this.A=Qt[0]|0,this.B=Qt[1]|0,this.C=Qt[2]|0,this.D=Qt[3]|0,this.E=Qt[4]|0,this.F=Qt[5]|0,this.G=Qt[6]|0,this.H=Qt[7]|0}get(){let{A:e,B:t,C:r,D:n,E:i,F:a,G:o,H:u}=this;return[e,t,r,n,i,a,o,u]}set(e,t,r,n,i,a,o,u){this.A=e|0,this.B=t|0,this.C=r|0,this.D=n|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=u|0}process(e,t){for(let m=0;m<16;m++,t+=4)Zt[m]=e.getUint32(t,!1);for(let m=16;m<64;m++){let g=Zt[m-15],R=Zt[m-2],j=St(g,7)^St(g,18)^g>>>3,G=St(R,17)^St(R,19)^R>>>10;Zt[m]=G+Zt[m-7]+j+Zt[m-16]|0}let{A:r,B:n,C:i,D:a,E:o,F:u,G:l,H:c}=this;for(let m=0;m<64;m++){let g=St(o,6)^St(o,11)^St(o,25),R=c+g+bm(o,u,l)+_m[m]+Zt[m]|0,j=(St(r,2)^St(r,13)^St(r,22))+wm(r,n,i)|0;c=l,l=u,u=o,o=a+R|0,a=i,i=n,n=r,r=R+j|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,u=u+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(r,n,i,a,o,u,l,c)}roundClean(){Zt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},xm=mm(()=>new Tm),Om=Object.create,Ua=Object.defineProperty,Em=Object.getOwnPropertyDescriptor,Uc=Object.getOwnPropertyNames,Am=Object.getPrototypeOf,Im=Object.prototype.hasOwnProperty,Sm=(e,t,r)=>t in e?Ua(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,jc=(e,t)=>function(){return t||(0,e[Uc(e)[0]])((t={exports:{}}).exports,t),t.exports},$m=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Uc(t))!Im.call(e,i)&&i!==r&&Ua(e,i,{get:()=>t[i],enumerable:!(n=Em(t,i))||n.enumerable});return e},Pc=(e,t,r)=>(r=e!=null?Om(Am(e)):{},$m(t||!e||!e.__esModule?Ua(r,"default",{value:e,enumerable:!0}):r,e)),nr=(e,t,r)=>(Sm(e,typeof t!="symbol"?t+"":t,r),r),km=jc({"../../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(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},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",a=typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),o=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u";e.isBrowser=r,e.isWebWorker=i,e.isNode=n,e.isJsDom=a,e.isDeno=o}}),Um=jc({"../../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,a=n.cmp&&function(u){return function(l){return function(c,m){var g={key:c,value:l[c]},R={key:m,value:l[m]};return u(g,R)}}}(n.cmp),o=[];return function u(l){if(l&&l.toJSON&&typeof l.toJSON=="function"&&(l=l.toJSON()),l!==void 0){if(typeof l=="number")return isFinite(l)?""+l:"null";if(typeof l!="object")return JSON.stringify(l);var c,m;if(Array.isArray(l)){for(m="[",c=0;c<l.length;c++)c&&(m+=","),m+=u(l[c])||"null";return m+"]"}if(l===null)return"null";if(o.indexOf(l)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var g=o.push(l)-1,R=Object.keys(l).sort(a&&a(l));for(m="",c=0;c<R.length;c++){var j=R[c],G=u(l[j]);G&&(m&&(m+=","),m+=JSON.stringify(j)+":"+G)}return o.splice(g,1),"{"+m+"}"}}(r)}}}),Dn=Pc(km(),1),jm=Pc(Um(),1),Nc=!1,Bc=!1;Dn.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(Nc=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(Bc=process?.env?.LOGGER_PERF_PREFIX==="true"));var Pm=Object.freeze({prefix:void 0,time:Nc,delta:Bc,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0}),fa=[],Cc=class{constructor(e,t,r,n){$t(this,"sinceFirst",0),$t(this,"sinceLast",0),$t(this,"time",!1),$t(this,"delta",!1),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].join(",")}]`}},Rc=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Rn=!1,Ze=class{static setup(e=Ze.INFO,t={}){t=Object.assign({},Pm,t),e>10&&console.debug("setup logger",{config:t});let r=this.wrapLog(console.debug,{...t,dim:t.dimDebugOnServer}),n=(...u)=>{window?.FORCE_DISABLE_LOGLEVEL&&r(...u)};n.isDisabled=!0,n.isEnabled=!1;let i=this.wrapLog(console.groupCollapsed,t),a=(u,l)=>{function c(...g){let R=g[g.length-1];return R===n?R():(i(...g.slice(0,-1)),(async()=>{try{let j=R();return j instanceof Promise?await j:j}finally{console.groupEnd()}})())}let m=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:c,force:l});return u?m:Object.assign(n.bind({}),{isEnabled:u,isDisabled:!u,group:c,force:m})},o=a(e>=Ze.ERROR,this.wrapLog(console.error,t));return{ERROR:(...u)=>(o(...u),new Error((0,jm.default)(u))),WARN:a(e>=Ze.WARN,this.wrapLog(console.warn,t)),LOG:a(e>=Ze.INFO,this.wrapLog(console.log,t)),DEBUG:a(e>=Ze.DEBUG,this.wrapLog(console.log,{...t,dim:t.dimDebugOnServer})),VERBOSE:a(e>=Ze.VERBOSE,this.wrapLog(console.debug,{...t,dim:t.dimDebugOnServer}))}}static wrapLog(e,t){if(Dn.isNode)return e.bind(console);{let r=[];if(t.time||t.delta){let n=Dn.isBrowser&&navigator.userAgent.includes("Chrome")?["",Ze.timeStr(!!t.time,!!t.delta)]:[];r.push(...n)}return t.prefix&&(Rn?r.push(new Rc("dim",t.prefix)):r.push(t.prefix)),e.bind(console,...r)}}static timeStr(e,t,r=0){if(!performance.now)return;let n=performance.now();Ze.firstLog||(Ze.firstLog=n,Ze.lastLog=n);let i=new Cc(n-Ze.firstLog,n-Ze.lastLog,e,t);return Ze.lastLog=n,r?i.toString():i}static getOriginFromStack(e){let t=!1;for(let r of e.split(`
|
|
2
|
+
`)){let n=r.match(/^\s+at\s+(.*)/);if(n){if(t)return n[1].trim().replace(__dirname,"");t=!0}}}},Oe=Ze;nr(Oe,"ERROR",2);nr(Oe,"WARN",4);nr(Oe,"INFO",6);nr(Oe,"LOG",6);nr(Oe,"DEBUG",8);nr(Oe,"VERBOSE",10);nr(Oe,"firstLog",0);nr(Oe,"lastLog",0);Dn.isBrowser?(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(fa&&fa.length){for(let t of fa)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof Cc))return null;Rn||(Rn=!0);let t=Oe.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof Rc?(Rn||(Rn=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1})):Dn.isNode;var Mc=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Nm=Ic({name:"sha2-256",code:18,encode:Mc("SHA-256")}),_E=Ic({name:"sha2-512",code:19,encode:Mc("SHA-512")}),{WARN:Bm,LOG:TE,DEBUG:Cm,VERBOSE:Lc,ERROR:xE}=Oe.setup(Oe.INFO);function Dc(e,t=["cid"]){let r={};for(let[n,i]of Object.entries(e))i===void 0&&(Bm(`log.${n} is undefined, which is not allowed - encoding as null`,e),i=null),t.includes(n)?Lc("excluding app log",{key:n,val:i}):r[n]=i&&n==="pv"?rr.parse(i):i;return r}function ja(e){return Pa(Vc(e).bytes)}function Vc(e){return Fc(Dc(e))}function Pa(e){let t=xm(e),r=Oc.create(Nm.code,t),n=rr.create(1,$c,r);return Lc("[getCidSync]",{bytes:e,hash:t,digest:r,cid:n}),n}function Fc(e){Cm("[encodeBlock]",e);let t=ka(e);return{bytes:t,cid:Pa(t)}}var Rm=Re((e,t)=>{"use strict";var{hasOwnProperty:r}=Object.prototype,n=ae();n.configure=ae,n.stringify=n,n.default=n,e.stringify=n,e.configure=ae,t.exports=n;var i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function a(B){return B.length<5e3&&!i.test(B)?`"${B}"`:JSON.stringify(B)}function o(B){if(B.length>200)return B.sort();for(let V=1;V<B.length;V++){let q=B[V],se=V;for(;se!==0&&B[se-1]>q;)B[se]=B[se-1],se--;B[se]=q}return B}var u=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(B){return u.call(B)!==void 0&&B.length!==0}function c(B,V,q){B.length<q&&(q=B.length);let se=V===","?"":" ",F=`"0":${se}${B[0]}`;for(let ue=1;ue<q;ue++)F+=`${V}"${ue}":${se}${B[ue]}`;return F}function m(B){if(r.call(B,"circularValue")){let V=B.circularValue;if(typeof V=="string")return`"${V}"`;if(V==null)return V;if(V===Error||V===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 g(B,V){let q;if(r.call(B,V)&&(q=B[V],typeof q!="boolean"))throw new TypeError(`The "${V}" argument must be of type boolean`);return q===void 0?!0:q}function R(B,V){let q;if(r.call(B,V)){if(q=B[V],typeof q!="number")throw new TypeError(`The "${V}" argument must be of type number`);if(!Number.isInteger(q))throw new TypeError(`The "${V}" argument must be an integer`);if(q<1)throw new RangeError(`The "${V}" argument must be >= 1`)}return q===void 0?1/0:q}function j(B){return B===1?"1 item":`${B} items`}function G(B){let V=new Set;for(let q of B)(typeof q=="string"||typeof q=="number")&&V.add(String(q));return V}function Z(B){if(r.call(B,"strict")){let V=B.strict;if(typeof V!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(V)return q=>{let se=`Object can not safely be stringified. Received type ${typeof q}`;throw typeof q!="function"&&(se+=` (${q.toString()})`),new Error(se)}}}function ae(B){B={...B};let V=Z(B);V&&(B.bigint===void 0&&(B.bigint=!1),"circularValue"in B||(B.circularValue=Error));let q=m(B),se=g(B,"bigint"),F=g(B,"deterministic"),ue=R(B,"maximumDepth"),z=R(B,"maximumBreadth");function pe(X,O,K,te,H,W){let fe=O[X];switch(typeof fe=="object"&&fe!==null&&typeof fe.toJSON=="function"&&(fe=fe.toJSON(X)),fe=te.call(O,X,fe),typeof fe){case"string":return a(fe);case"object":{if(fe===null)return"null";if(K.indexOf(fe)!==-1)return q;let f="",_=",",E=W;if(Array.isArray(fe)){if(fe.length===0)return"[]";if(ue<K.length+1)return'"[Array]"';K.push(fe),H!==""&&(W+=H,f+=`
|
|
3
3
|
${W}`,_=`,
|
|
4
4
|
${W}`);let w=Math.min(fe.length,z),s=0;for(;s<w-1;s++){let b=pe(String(s),fe,K,te,H,W);f+=b!==void 0?b:"null",f+=_}let T=pe(String(s),fe,K,te,H,W);if(f+=T!==void 0?T:"null",fe.length-1>z){let b=fe.length-z-1;f+=`${_}"... ${j(b)} not stringified"`}return H!==""&&(f+=`
|
|
5
5
|
${E}`),K.pop(),`[${f}]`}let k=Object.keys(fe),S=k.length;if(S===0)return"{}";if(ue<K.length+1)return'"[Object]"';let $="",h="";H!==""&&(W+=H,_=`,
|
|
@@ -17,19 +17,19 @@ ${H}`,A=Math.min(O.length,z),w=0;for(;w<A-1;w++){let T=N(String(w),O[w],K,te,H);
|
|
|
17
17
|
${W}`,K.pop(),`[${$}]`}let fe=Object.keys(O),f=fe.length;if(f===0)return"{}";if(ue<K.length+1)return'"[Object]"';H+=te;let _=`,
|
|
18
18
|
${H}`,E="",k="",S=Math.min(f,z);l(O)&&(E+=c(O,_,z),fe=fe.slice(O.length),S-=O.length,k=_),F&&(fe=o(fe)),K.push(O);for(let $=0;$<S;$++){let h=fe[$],A=N(h,O[h],K,te,H);A!==void 0&&(E+=`${k}${a(h)}: ${A}`,k=_)}if(f>z){let $=f-z;E+=`${k}"...": "${j($)} not stringified"`,k=_}return k!==""&&(E=`
|
|
19
19
|
${H}${E}
|
|
20
|
-
${W}`),K.pop(),`{${E}}`}case"number":return isFinite(O)?String(O):V?V(O):"null";case"boolean":return O===!0?"true":"false";case"undefined":return;case"bigint":if(se)return String(O);default:return V?V(O):void 0}}function C(X,O,K){switch(typeof O){case"string":return a(O);case"object":{if(O===null)return"null";if(typeof O.toJSON=="function"){if(O=O.toJSON(X),typeof O!="object")return C(X,O,K);if(O===null)return"null"}if(K.indexOf(O)!==-1)return q;let te="";if(Array.isArray(O)){if(O.length===0)return"[]";if(ue<K.length+1)return'"[Array]"';K.push(O);let _=Math.min(O.length,z),E=0;for(;E<_-1;E++){let S=C(String(E),O[E],K);te+=S!==void 0?S:"null",te+=","}let k=C(String(E),O[E],K);if(te+=k!==void 0?k:"null",O.length-1>z){let S=O.length-z-1;te+=`,"... ${j(S)} not stringified"`}return K.pop(),`[${te}]`}let H=Object.keys(O),W=H.length;if(W===0)return"{}";if(ue<K.length+1)return'"[Object]"';let fe="",f=Math.min(W,z);l(O)&&(te+=c(O,",",z),H=H.slice(O.length),f-=O.length,fe=","),F&&(H=o(H)),K.push(O);for(let _=0;_<f;_++){let E=H[_],k=C(E,O[E],K);k!==void 0&&(te+=`${fe}${a(E)}:${k}`,fe=",")}if(W>z){let _=W-z;te+=`${fe}"...":"${j(_)} not stringified"`}return K.pop(),`{${te}}`}case"number":return isFinite(O)?String(O):V?V(O):"null";case"boolean":return O===!0?"true":"false";case"undefined":return;case"bigint":if(se)return String(O);default:return V?V(O):void 0}}function Q(X,O,K){if(arguments.length>1){let te="";if(typeof K=="number"?te=" ".repeat(Math.min(K,10)):typeof K=="string"&&(te=K.slice(0,10)),O!=null){if(typeof O=="function")return pe("",{"":X},[],O,te,"");if(Array.isArray(O))return M("",X,[],G(O),te,"")}if(te.length!==0)return N("",X,[],te,"")}return C("",X,[])}return Q}});function Va(e){"@babel/helpers - typeof";return Va=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Va(e)}function
|
|
21
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
22
|
-
'`+a.annotationType_+"' can only be used on properties with a function value."))}function og(e,t,r,n){var i=t.annotationType_,a=n.value}function Dl(e,t,r,n,i){var a,o,u,l,c,m,g;i===void 0&&(i=re.safeDescriptors),og(e,t,r,n);var R=n.value;if((a=t.options_)!=null&&a.bound){var j;R=R.bind((j=e.proxy_)!=null?j:e.target_)}return{value:jr((o=(u=t.options_)==null?void 0:u.name)!=null?o:r.toString(),R,(l=(c=t.options_)==null?void 0:c.autoAction)!=null?l:!1,(m=t.options_)!=null&&m.bound?(g=e.proxy_)!=null?g:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function Vl(e,t){return{annotationType_:e,options_:t,make_:ag,extend_:sg,decorate_20223_:ug}}function ag(e,t,r,n){var i;if(n===e.target_)return this.extend_(e,t,r,!1)===null?0:2;if((i=this.options_)!=null&&i.bound&&(!Vt(e.target_,t)||!Qn(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(Qn(r.value))return 1;var a=Fl(e,this,t,r,!1,!1);return Pt(n,t,a),2}function sg(e,t,r,n){var i,a=Fl(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,a,n)}function ug(e,t){var r,n=t.name,i=t.addInitializer;return Qn(e)||(e=cn(e)),(r=this.options_)!=null&&r.bound&&i(function(){var a=this,o=a[n].bind(a);o.isMobXFlow=!0,a[n]=o}),e}function cg(e,t,r,n){var i=t.annotationType_,a=n.value}function Fl(e,t,r,n,i,a){a===void 0&&(a=re.safeDescriptors),cg(e,t,r,n);var o=n.value;if(Qn(o)||(o=cn(o)),i){var u;o=o.bind((u=e.proxy_)!=null?u:e.target_),o.isMobXFlow=!0}return{value:o,configurable:a?e.isPlainObject_:!0,enumerable:!1,writable:!a}}function cs(e,t){return{annotationType_:e,options_:t,make_:lg,extend_:fg,decorate_20223_:dg}}function lg(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function fg(e,t,r,n){return pg(e,this,t,r),e.defineComputedProperty_(t,Ur({},this.options_,{get:r.get,set:r.set}),n)}function dg(e,t){var r=this,n=t.name,i=t.addInitializer;return i(function(){var a=yn(this)[me],o=Ur({},r.options_,{get:e,context:this});o.name||(o.name="ObservableObject."+n.toString()),a.values_.set(n,new un(o))}),function(){return this[me].getObservablePropValue_(n)}}function pg(e,t,r,n){var i=t.annotationType_,a=n.get}function _o(e,t){return{annotationType_:e,options_:t,make_:hg,extend_:yg,decorate_20223_:mg}}function hg(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function yg(e,t,r,n){var i,a;return gg(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(a=this.options_)==null?void 0:a.enhancer)!=null?i:hn,n)}function mg(e,t){var r=this,n=t.kind,i=t.name,a=new WeakSet;function o(u,l){var c,m,g=yn(u)[me],R=new or(l,(c=(m=r.options_)==null?void 0:m.enhancer)!=null?c:hn,"ObservableObject."+i.toString(),!1);g.values_.set(i,R),a.add(u)}if(n=="accessor")return{get:function(){return a.has(this)||o(this,e.get.call(this)),this[me].getObservablePropValue_(i)},set:function(u){return a.has(this)||o(this,u),this[me].setObservablePropValue_(i,u)},init:function(u){return a.has(this)||o(this,u),u}}}function gg(e,t,r,n){var i=t.annotationType_}var vg="true",bg=zl();function zl(e){return{annotationType_:vg,options_:e,make_:wg,extend_:_g,decorate_20223_:Tg}}function wg(e,t,r,n){var i,a;if(r.get)return Ge.make_(e,t,r,n);if(r.set){var o=jr(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:re.safeDescriptors?e.isPlainObject_:!0,set:o})===null?0:2:(Pt(n,t,{configurable:!0,set:o}),2)}if(n!==e.target_&&typeof r.value=="function"){var u;if(Nl(r.value)){var l,c=(l=this.options_)!=null&&l.autoBind?cn.bound:cn;return c.make_(e,t,r,n)}var m=(u=this.options_)!=null&&u.autoBind?Xn.bound:Xn;return m.make_(e,t,r,n)}var g=((i=this.options_)==null?void 0:i.deep)===!1?Ne.ref:Ne;if(typeof r.value=="function"&&(a=this.options_)!=null&&a.autoBind){var R;r.value=r.value.bind((R=e.proxy_)!=null?R:e.target_)}return g.make_(e,t,r,n)}function _g(e,t,r,n){var i,a;if(r.get)return Ge.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:re.safeDescriptors?e.isPlainObject_:!0,set:jr(t.toString(),r.set)},n);if(typeof r.value=="function"&&(i=this.options_)!=null&&i.autoBind){var o;r.value=r.value.bind((o=e.proxy_)!=null?o:e.target_)}var u=((a=this.options_)==null?void 0:a.deep)===!1?Ne.ref:Ne;return u.extend_(e,t,r,n)}function Tg(e,t){_e("'"+this.annotationType_+"' cannot be used as a decorator")}var xg="observable",Og="observable.ref",Eg="observable.shallow",Ag="observable.struct",Gl={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Gl);function Zi(e){return e||Gl}var Ga=_o(xg),Ig=_o(Og,{enhancer:wo}),Sg=_o(Eg,{enhancer:Qm}),$g=_o(Ag,{enhancer:Zm}),Kl=Nt(Ga);function eo(e){return e.deep===!0?hn:e.deep===!1?wo:Ug(e.defaultDecorator)}function kg(e){var t;return e?(t=e.defaultDecorator)!=null?t:zl(e):void 0}function Ug(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:hn}function Hl(e,t,r){if(oi(t))return Ga.decorate_20223_(e,t);if(kr(t)){pn(e,t,Ga);return}return ds(e)?e:ar(e)?Ne.object(e,t,r):Array.isArray(e)?Ne.array(e,t):dn(e)?Ne.map(e,t):ii(e)?Ne.set(e,t):typeof e=="object"&&e!==null?e:Ne.box(e,t)}Ul(Hl,Kl);var jg={box:function(e,t){var r=Zi(t);return new or(e,eo(r),r.name,!0,r.equals)},array:function(e,t){var r=Zi(t);return(re.useProxies===!1||r.proxy===!1?Pv:xv)(e,eo(r),r.name)},map:function(e,t){var r=Zi(t);return new wf(e,eo(r),r.name)},set:function(e,t){var r=Zi(t);return new xf(e,eo(r),r.name)},object:function(e,t,r){return Rr(function(){return dv(re.useProxies===!1||r?.proxy===!1?yn({},r):wv({},r),e,t)})},ref:Nt(Ig),shallow:Nt(Sg),deep:Kl,struct:Nt($g)},Ne=Ul(Hl,jg),ql="computed",Pg="computed.struct",Ka=cs(ql),Ng=cs(Pg,{equals:Xe.structural}),Ge=function(e,t){if(oi(t))return Ka.decorate_20223_(e,t);if(kr(t))return pn(e,t,Ka);if(ar(e))return Nt(cs(ql,e));var r=ar(t)?t:{};return r.get=e,r.name||(r.name=e.name||""),new un(r)};Object.assign(Ge,Ka);Ge.struct=Nt(Ng);var Kc,Hc,co=0,Bg=1,Cg=(Kc=(Hc=uo(function(){},"name"))==null?void 0:Hc.configurable)!=null?Kc:!1,qc={value:"action",configurable:!0,writable:!1,enumerable:!1};function jr(e,t,r,n){r===void 0&&(r=!1);function i(){return Wl(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},Cg&&(qc.value=e,Pt(i,"name",qc)),i}function Wl(e,t,r,n,i){var a=Rg(e,t,n,i);try{return r.apply(n,i)}catch(o){throw a.error_=o,o}finally{Mg(a)}}function Rg(e,t,r,n){var i=!1,a=0;if(0)var o;var u=re.trackingDerivation,l=!t||!u;yt();var c=re.allowStateChanges;l&&(Nr(),c=To(!0));var m=ls(!0),g={runAsAction_:l,prevDerivation_:u,prevAllowStateChanges_:c,prevAllowStateReads_:m,notifySpy_:i,startTime_:a,actionId_:Bg++,parentActionId_:co};return co=g.actionId_,g}function Mg(e){co!==e.actionId_&&_e(30),co=e.parentActionId_,e.error_!==void 0&&(re.suppressReactionErrors=!0),xo(e.prevAllowStateChanges_),qn(e.prevAllowStateReads_),mt(),e.runAsAction_&&Ft(e.prevDerivation_),re.suppressReactionErrors=!1}function Lg(e,t){var r=To(e);try{return t()}finally{xo(r)}}function To(e){var t=re.allowStateChanges;return re.allowStateChanges=e,t}function xo(e){re.allowStateChanges=e}var Jl;Jl=Symbol.toPrimitive;var or=function(e){Ml(t,e);function t(n,i,a,o,u){var l;return a===void 0&&(a="ObservableValue"),o===void 0&&(o=!0),u===void 0&&(u=Xe.default),l=e.call(this,a)||this,l.enhancer=void 0,l.name_=void 0,l.equals=void 0,l.hasUnreportedChange_=!1,l.interceptors_=void 0,l.changeListeners_=void 0,l.value_=void 0,l.dehancer=void 0,l.enhancer=i,l.name_=a,l.equals=u,l.value_=i(n,void 0,a),l}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!==re.UNCHANGED){var a=Sr();this.setNewValue_(n)}},r.prepareNewValue_=function(n){if(jt(this),pt(this)){var i=ht(this,{object:this,type:Bt,newValue:n});if(!i)return re.UNCHANGED;n=i.newValue}return n=this.enhancer(n,this.value_,this.name_),this.equals(this.value_,n)?re.UNCHANGED:n},r.setNewValue_=function(n){var i=this.value_;this.value_=n,this.reportChanged(),Ot(this)&&Et(this,{type:Bt,object:this,newValue:n,oldValue:i})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(n){return fi(this,n)},r.observe_=function(n,i){return i&&n({observableKind:"value",debugObjectName:this.name_,object:this,type:Bt,newValue:this.value_,oldValue:void 0}),di(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 Rl(this.get())},r[Jl]=function(){return this.valueOf()},t}(ai),Dg=ur("ObservableValue",or),Xl;Xl=Symbol.toPrimitive;var un=function(){function e(r){this.dependenciesState_=Ae.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.isBeingObserved_=!1,this.isPendingUnobservation_=!1,this.observers_=new Set,this.diffValue_=0,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ae.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new fo(null),this.name_=void 0,this.triggeredBy_=void 0,this.isComputing_=!1,this.isRunningSetter_=!1,this.derivation=void 0,this.setter_=void 0,this.isTracing_=lo.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||_e(31),this.derivation=r.get,this.name_=r.name||"ComputedValue",r.set&&(this.setter_=jr("ComputedValue-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?Xe.structural:Xe.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){Jg(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_&&_e(32,this.name_,this.derivation),re.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)Ha(this)&&(this.warnAboutUntrackedRead_(),yt(),this.value_=this.computeValue_(!1),mt());else if(rf(this),Ha(this)){var r=re.trackingContext;this.keepAlive_&&!r&&(re.trackingContext=this),this.trackAndCompute()&&Wg(this),re.trackingContext=r}var n=this.value_;if(io(n))throw n.cause;return n},t.set=function(r){if(this.setter_){this.isRunningSetter_&&_e(33,this.name_),this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter_=!1}}else _e(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,n=this.dependenciesState_===Ae.NOT_TRACKING_,i=this.computeValue_(!0),a=n||io(r)||io(i)||!this.equals_(r,i);return a&&(this.value_=i),a},t.computeValue_=function(r){this.isComputing_=!0;var n=To(!1),i;if(r)i=Yl(this,this.derivation,this.scope_);else if(re.disableErrorBoundaries===!0)i=this.derivation.call(this.scope_);else try{i=this.derivation.call(this.scope_)}catch(a){i=new fo(a)}return xo(n),this.isComputing_=!1,i},t.suspend_=function(){this.keepAlive_||(qa(this),this.value_=void 0)},t.observe_=function(r,n){var i=this,a=!0,o=void 0;return cr(function(){var u=i.get();if(!a||n){var l=Nr();r({observableKind:"computed",debugObjectName:i.name_,type:Bt,object:i,newValue:u,oldValue:o}),Ft(l)}a=!1,o=u})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return Rl(this.get())},t[Xl]=function(){return this.valueOf()},e}(),ui=ur("ComputedValue",un),Ae;(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_"})(Ae||(Ae={}));var lo;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(lo||(lo={}));var fo=function(e){this.cause=void 0,this.cause=e};function io(e){return e instanceof fo}function Ha(e){switch(e.dependenciesState_){case Ae.UP_TO_DATE_:return!1;case Ae.NOT_TRACKING_:case Ae.STALE_:return!0;case Ae.POSSIBLY_STALE_:{for(var t=ls(!0),r=Nr(),n=e.observing_,i=n.length,a=0;a<i;a++){var o=n[a];if(ui(o)){if(re.disableErrorBoundaries)o.get();else try{o.get()}catch{return Ft(r),qn(t),!0}if(e.dependenciesState_===Ae.STALE_)return Ft(r),qn(t),!0}}return Ql(e),Ft(r),qn(t),!1}}}function Vg(){return re.trackingDerivation!==null}function jt(e){return;var t}function Yl(e,t,r){var n=ls(!0);Ql(e),e.newObserving_=new Array(e.observing_.length+100),e.unboundDepsCount_=0,e.runId_=++re.runId;var i=re.trackingDerivation;re.trackingDerivation=e,re.inBatch++;var a;if(re.disableErrorBoundaries===!0)a=t.call(r);else try{a=t.call(r)}catch(o){a=new fo(o)}return re.inBatch--,re.trackingDerivation=i,Fg(e),qn(n),a}function Fg(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=Ae.UP_TO_DATE_,i=0,a=e.unboundDepsCount_,o=0;o<a;o++){var u=r[o];u.diffValue_===0&&(u.diffValue_=1,i!==o&&(r[i]=u),i++),u.dependenciesState_>n&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var l=t[a];l.diffValue_===0&&ef(l,e),l.diffValue_=0}for(;i--;){var c=r[i];c.diffValue_===1&&(c.diffValue_=0,qg(c,e))}n!==Ae.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function qa(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)ef(t[r],e);e.dependenciesState_=Ae.NOT_TRACKING_}function Me(e){var t=Nr();try{return e()}finally{Ft(t)}}function Nr(){var e=re.trackingDerivation;return re.trackingDerivation=null,e}function Ft(e){re.trackingDerivation=e}function ls(e){var t=re.allowStateReads;return re.allowStateReads=e,t}function qn(e){re.allowStateReads=e}function Ql(e){if(e.dependenciesState_!==Ae.UP_TO_DATE_){e.dependenciesState_=Ae.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ae.UP_TO_DATE_}}var oo=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},ao=!0,Zl=!1,re=function(){var e=os();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ao=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new oo().version&&(ao=!1),ao?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new oo):(setTimeout(function(){Zl||_e(35)},1),new oo)}();function zg(){if((re.pendingReactions.length||re.inBatch||re.isRunningReactions)&&_e(36),Zl=!0,ao){var e=os();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),re=new oo}}function Gg(){return re}function Kg(e){return e.observers_&&e.observers_.size>0}function Hg(e){return e.observers_}function qg(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function ef(e,t){e.observers_.delete(t),e.observers_.size===0&&tf(e)}function tf(e){e.isPendingUnobservation_===!1&&(e.isPendingUnobservation_=!0,re.pendingUnobservations.push(e))}function yt(){re.inBatch++}function mt(){if(--re.inBatch===0){of();for(var e=re.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 un&&r.suspend_())}re.pendingUnobservations=[]}}function rf(e){var t=re.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved_&&re.trackingContext&&(e.isBeingObserved_=!0,e.onBO())),e.isBeingObserved_):(e.observers_.size===0&&re.inBatch>0&&tf(e),!1)}function nf(e){e.lowestObserverState_!==Ae.STALE_&&(e.lowestObserverState_=Ae.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ae.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=Ae.STALE_}))}function Wg(e){e.lowestObserverState_!==Ae.STALE_&&(e.lowestObserverState_=Ae.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ae.POSSIBLY_STALE_?t.dependenciesState_=Ae.STALE_:t.dependenciesState_===Ae.UP_TO_DATE_&&(e.lowestObserverState_=Ae.UP_TO_DATE_)}))}function Jg(e){e.lowestObserverState_===Ae.UP_TO_DATE_&&(e.lowestObserverState_=Ae.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ae.UP_TO_DATE_&&(t.dependenciesState_=Ae.POSSIBLY_STALE_,t.onBecomeStale_())}))}var Jn=function(){function e(r,n,i,a){r===void 0&&(r="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ae.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=lo.NONE,this.name_=r,this.onInvalidate_=n,this.errorHandler_=i,this.requiresObservable_=a}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,re.pendingReactions.push(this),of())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){yt(),this.isScheduled_=!1;var r=re.trackingContext;if(re.trackingContext=this,Ha(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(n){this.reportExceptionInDerivation_(n)}}re.trackingContext=r,mt()}},t.track=function(r){if(!this.isDisposed_){yt();var n=Sr(),i;this.isRunning_=!0;var a=re.trackingContext;re.trackingContext=this;var o=Yl(this,r,void 0);re.trackingContext=a,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&qa(this),io(o)&&this.reportExceptionInDerivation_(o.cause),mt()}},t.reportExceptionInDerivation_=function(r){var n=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(re.disableErrorBoundaries)throw r;var i="[mobx] uncaught error in '"+this+"'";re.suppressReactionErrors||console.error(i,r),re.globalReactionErrorHandlers.forEach(function(a){return a(r,n)})},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(yt(),qa(this),mt()))},t.getDisposer_=function(r){var n=this,i=function a(){n.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",a)};return r==null||r.addEventListener==null||r.addEventListener("abort",i),i[me]=this,i},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){r===void 0&&(r=!1),mf(this,r)},e}(),Xg=100,Wa=function(e){return e()};function of(){re.inBatch>0||re.isRunningReactions||Wa(Yg)}function Yg(){re.isRunningReactions=!0;for(var e=re.pendingReactions,t=0;e.length>0;){++t===Xg&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n<i;n++)r[n].runReaction_()}re.isRunningReactions=!1}var po=ur("Reaction",Jn);function Qg(e){var t=Wa;Wa=function(r){return e(function(){return t(r)})}}function Sr(){return!1}function af(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var sf="action",Zg="action.bound",uf="autoAction",ev="autoAction.bound",cf="<unnamed action>",Ja=si(sf),tv=si(Zg,{bound:!0}),Xa=si(uf,{autoAction:!0}),rv=si(ev,{autoAction:!0,bound:!0});function lf(e){var t=function(r,n){if(At(r))return jr(r.name||cf,r,e);if(At(n))return jr(r,n,e);if(oi(n))return(e?Xa:Ja).decorate_20223_(r,n);if(kr(n))return pn(r,n,e?Xa:Ja);if(kr(r))return Nt(si(e?uf:sf,{name:r,autoAction:e}))};return t}var gt=lf(!1);Object.assign(gt,Ja);var Xn=lf(!0);Object.assign(Xn,Xa);gt.bound=Nt(tv);Xn.bound=Nt(rv);function nv(e){return Wl(e.name||cf,!1,e,this,void 0)}function ci(e){return At(e)&&e.isMobxAction===!0}function cr(e,t){var r,n,i,a,o;t===void 0&&(t=as);var u=(r=(n=t)==null?void 0:n.name)!=null?r:"Autorun",l=!t.scheduler&&!t.delay,c;if(l)c=new Jn(u,function(){this.track(R)},t.onError,t.requiresObservable);else{var m=ff(t),g=!1;c=new Jn(u,function(){g||(g=!0,m(function(){g=!1,c.isDisposed_||c.track(R)}))},t.onError,t.requiresObservable)}function R(){e(c)}return(i=t)!=null&&(a=i.signal)!=null&&a.aborted||c.schedule_(),c.getDisposer_((o=t)==null?void 0:o.signal)}var iv=function(e){return e()};function ff(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:iv}function ov(e,t,r){var n,i,a,o;r===void 0&&(r=as);var u=(n=r.name)!=null?n:"Reaction",l=gt(u,r.onError?av(r.onError,t):t),c=!r.scheduler&&!r.delay,m=ff(r),g=!0,R=!1,j,G,Z=r.compareStructural?Xe.structural:r.equals||Xe.default,ae=new Jn(u,function(){g||c?B():R||(R=!0,m(B))},r.onError,r.requiresObservable);function B(){if(R=!1,!ae.isDisposed_){var V=!1;ae.track(function(){var q=Lg(!1,function(){return e(ae)});V=g||!Z(j,q),G=j,j=q}),(g&&r.fireImmediately||!g&&V)&&l(j,G,ae),g=!1}}return(i=r)!=null&&(a=i.signal)!=null&&a.aborted||ae.schedule_(),ae.getDisposer_((o=r)==null?void 0:o.signal)}function av(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var sv="onBO",uv="onBUO";function fs(e,t,r){return df(sv,e,t,r)}function li(e,t,r){return df(uv,e,t,r)}function df(e,t,r,n){var i=typeof n=="function"?Pr(t,r):Pr(t),a=At(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var u=i[o];u&&(u.delete(a),u.size===0&&delete i[o])}}var cv="never",to="always",lv="observed";function fv(e){e.isolateGlobalState===!0&&zg();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(re.useProxies=t===to?!0:t===cv?!1:typeof Proxy<"u"),t==="ifavailable"&&(re.verifyProxies=!0),r!==void 0){var n=r===to?to:r===lv;re.enforceActions=n,re.allowStateChanges=!(n===!0||n===to)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(re[i]=!!e[i])}),re.allowStateReads=!re.observableRequiresReaction,e.reactionScheduler&&Qg(e.reactionScheduler)}function dv(e,t,r,n){var i=Fm(t);return Rr(function(){var a=yn(e,n)[me];bo(i).forEach(function(o){a.extend_(o,i[o],r&&o in r?r[o]:!0)})}),e}function Yn(e,t){return pf(Pr(e,t))}function pf(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=hv(e.observing_).map(pf)),t}function pv(e,t){return hf(Pr(e,t))}function hf(e){var t={name:e.name_};return Kg(e)&&(t.observers=Array.from(Hg(e)).map(hf)),t}function hv(e){return Array.from(new Set(e))}var yv=0;function yf(){this.message="FLOW_CANCELLED"}yf.prototype=Object.create(Error.prototype);var Ba=Vl("flow"),mv=Vl("flow.bound",{bound:!0}),cn=Object.assign(function(e,t){if(oi(t))return Ba.decorate_20223_(e,t);if(kr(t))return pn(e,t,Ba);var r=e,n=r.name||"<unnamed flow>",i=function(){var a=this,o=arguments,u=++yv,l=gt(n+" - runid: "+u+" - init",r).apply(a,o),c,m=void 0,g=new Promise(function(R,j){var G=0;c=j;function Z(V){m=void 0;var q;try{q=gt(n+" - runid: "+u+" - yield "+G++,l.next).call(l,V)}catch(se){return j(se)}B(q)}function ae(V){m=void 0;var q;try{q=gt(n+" - runid: "+u+" - yield "+G++,l.throw).call(l,V)}catch(se){return j(se)}B(q)}function B(V){if(At(V?.then)){V.then(B,j);return}return V.done?R(V.value):(m=Promise.resolve(V.value),m.then(Z,ae))}Z(void 0)});return g.cancel=gt(n+" - runid: "+u+" - cancel",function(){try{m&&Wc(m);var R=l.return(void 0),j=Promise.resolve(R.value);j.then(an,an),Wc(j),c(new yf)}catch(G){c(G)}}),g};return i.isMobXFlow=!0,i},Ba);cn.bound=Nt(mv);function Wc(e){At(e.cancel)&&e.cancel()}function Qn(e){return e?.isMobXFlow===!0}function gv(e,t){return e?t!==void 0?ln(e)?e[me].values_.has(t):!1:ln(e)||!!e[me]||us(e)||po(e)||ui(e):!1}function ds(e){return gv(e)}function vv(e){if(ln(e))return e[me].ownKeys_();_e(38)}function ro(e,t,r){return e.set(t,r),r}function on(e,t){if(e==null||typeof e!="object"||e instanceof Date||!ds(e))return e;if(Dg(e)||ui(e))return on(e.get(),t);if(t.has(e))return t.get(e);if(pi(e)){var r=ro(t,e,new Array(e.length));return e.forEach(function(o,u){r[u]=on(o,t)}),r}if(Cr(e)){var n=ro(t,e,new Set);return e.forEach(function(o){n.add(on(o,t))}),n}if(lr(e)){var i=ro(t,e,new Map);return e.forEach(function(o,u){i.set(u,on(o,t))}),i}else{var a=ro(t,e,{});return vv(e).forEach(function(o){ni.propertyIsEnumerable.call(e,o)&&(a[o]=on(e[o],t))}),a}}function $r(e,t){return on(e,new Map)}function mf(){return;for(var e,t,r,n;n<t;n++)r[n]=arguments[n];var i}function Dt(e,t){t===void 0&&(t=void 0),yt();try{return e.apply(t)}finally{mt()}}function nn(e){return e[me]}var bv={has:function(e,t){return nn(e).has_(t)},get:function(e,t){return nn(e).get_(t)},set:function(e,t,r){var n;return kr(t)?(n=nn(e).set_(t,r,!0))!=null?n:!0:!1},deleteProperty:function(e,t){var r;return kr(t)?(r=nn(e).delete_(t,!0))!=null?r:!0:!1},defineProperty:function(e,t,r){var n;return(n=nn(e).defineProperty_(t,r))!=null?n:!0},ownKeys:function(e){return nn(e).ownKeys_()},preventExtensions:function(e){_e(13)}};function wv(e,t){var r,n;return jl(),e=yn(e,t),(n=(r=e[me]).proxy_)!=null?n:r.proxy_=new Proxy(e,bv)}function pt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function fi(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),Pl(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function ht(e,t){var r=Nr();try{for(var n=[].concat(e.interceptors_||[]),i=0,a=n.length;i<a&&(t=n[i](t),t&&!t.type&&_e(14),!!t);i++);return t}finally{Ft(r)}}function Ot(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function di(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),Pl(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Et(e,t){var r=Nr(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,a=n.length;i<a;i++)n[i](t);Ft(r)}}function Br(e,t,r){return Rr(function(){var n,i=yn(e,r)[me];(n=t)!=null||(t=qm(e)),bo(t).forEach(function(a){return i.make_(a,t[a])})}),e}var Jc="splice",Bt="update",_v=1e4,Tv={get:function(e,t){var r=e[me];return t===me?r:t==="length"?r.getArrayLength_():typeof t=="string"&&!isNaN(t)?r.get_(parseInt(t)):Vt(ho,t)?ho[t]:e[t]},set:function(e,t,r){var n=e[me];return t==="length"&&n.setArrayLength_(r),typeof t=="symbol"||isNaN(t)?e[t]=r:n.set_(parseInt(t),r),!0},preventExtensions:function(){_e(15)}},ps=function(){function e(r,n,i,a){r===void 0&&(r="ObservableArray"),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_=a,this.atom_=new ai(r),this.enhancer_=function(o,u){return n(o,u,"ObservableArray[..]")}}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 fi(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}),di(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&_e("Out of range: "+r);var n=this.values_.length;if(r!==n)if(r>n){for(var i=new Array(r-n),a=0;a<r-n;a++)i[a]=void 0;this.spliceWithArray_(n,0,i)}else this.spliceWithArray_(r,n-r)},t.updateArrayLength_=function(r,n){r!==this.lastKnownLength_&&_e(16),this.lastKnownLength_+=n,this.legacyMode_&&n>0&&If(r+n+1)},t.spliceWithArray_=function(r,n,i){var a=this;jt(this.atom_);var o=this.values_.length;if(r===void 0?r=0:r>o?r=o:r<0&&(r=Math.max(0,o+r)),arguments.length===1?n=o-r:n==null?n=0:n=Math.max(0,Math.min(n,o-r)),i===void 0&&(i=Fa),pt(this)){var u=ht(this,{object:this.proxy_,type:Jc,index:r,removedCount:n,added:i});if(!u)return Fa;n=u.removedCount,i=u.added}if(i=i.length===0?i:i.map(function(m){return a.enhancer_(m,void 0)}),this.legacyMode_){var l=i.length-n;this.updateArrayLength_(o,l)}var c=this.spliceItemsIntoValues_(r,n,i);return(n!==0||i.length!==0)&&this.notifyArraySplice_(r,i,c),this.dehanceValues_(c)},t.spliceItemsIntoValues_=function(r,n,i){if(i.length<_v){var a;return(a=this.values_).splice.apply(a,[r,n].concat(i))}else{var o=this.values_.slice(r,r+n),u=this.values_.slice(r+n);this.values_.length+=i.length-n;for(var l=0;l<i.length;l++)this.values_[r+l]=i[l];for(var c=0;c<u.length;c++)this.values_[r+i.length+c]=u[c];return o}},t.notifyArrayChildUpdate_=function(r,n,i){var a=!this.owned_&&Sr(),o=Ot(this),u=o||a?{observableKind:"array",object:this.proxy_,type:Bt,debugObjectName:this.atom_.name_,index:r,newValue:n,oldValue:i}:null;this.atom_.reportChanged(),o&&Et(this,u)},t.notifyArraySplice_=function(r,n,i){var a=!this.owned_&&Sr(),o=Ot(this),u=o||a?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Jc,index:r,removed:i,added:n,removedCount:i.length,addedCount:n.length}:null;this.atom_.reportChanged(),o&&Et(this,u)},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx] Out of bounds read: "+r);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&&_e(17,r,i.length),r<i.length){jt(this.atom_);var a=i[r];if(pt(this)){var o=ht(this,{type:Bt,object:this.proxy_,index:r,newValue:n});if(!o)return;n=o.newValue}n=this.enhancer_(n,a);var u=n!==a;u&&(i[r]=n,this.notifyArrayChildUpdate_(r,n,a))}else{for(var l=new Array(r+1-i.length),c=0;c<l.length-1;c++)l[c]=void 0;l[l.length-1]=n,this.spliceWithArray_(i.length,0,l)}},e}();function xv(e,t,r,n){return r===void 0&&(r="ObservableArray"),n===void 0&&(n=!1),jl(),Rr(function(){var i=new ps(r,t,n,!1);Bl(i.values_,me,i);var a=new Proxy(i.values_,Tv);return i.proxy_=a,e&&e.length&&i.spliceWithArray_(0,0,e),a})}var ho={clear:function(){return this.splice(0)},replace:function(e){var t=this[me];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 a=this[me];switch(arguments.length){case 0:return[];case 1:return a.spliceWithArray_(e);case 2:return a.spliceWithArray_(e,t)}return a.spliceWithArray_(e,t,n)},spliceWithArray:function(e,t,r){return this[me].spliceWithArray_(e,t,r)},push:function(){for(var e=this[me],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[me].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[me],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 re.trackingDerivation&&_e(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){re.trackingDerivation&&_e(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[me],r=t.dehanceValues_(t.values_).indexOf(e);return r>-1?(this.splice(r,1),!0):!1}};Ue("at",st);Ue("concat",st);Ue("flat",st);Ue("includes",st);Ue("indexOf",st);Ue("join",st);Ue("lastIndexOf",st);Ue("slice",st);Ue("toString",st);Ue("toLocaleString",st);Ue("toSorted",st);Ue("toSpliced",st);Ue("with",st);Ue("every",It);Ue("filter",It);Ue("find",It);Ue("findIndex",It);Ue("findLast",It);Ue("findLastIndex",It);Ue("flatMap",It);Ue("forEach",It);Ue("map",It);Ue("some",It);Ue("toReversed",It);Ue("reduce",gf);Ue("reduceRight",gf);function Ue(e,t){typeof Array.prototype[e]=="function"&&(ho[e]=t(e))}function st(e){return function(){var t=this[me];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function It(e){return function(t,r){var n=this,i=this[me];i.atom_.reportObserved();var a=i.dehanceValues_(i.values_);return a[e](function(o,u){return t.call(r,o,u,n)})}}function gf(e){return function(){var t=this,r=this[me];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(a,o,u){return i(a,o,u,t)},n[e].apply(n,arguments)}}var Ov=ur("ObservableArrayAdministration",ps);function pi(e){return go(e)&&Ov(e[me])}var vf,bf,Ev={},ir="add",yo="delete";vf=Symbol.iterator;bf=Symbol.toStringTag;var wf=function(){function e(r,n,i){var a=this;n===void 0&&(n=hn),i===void 0&&(i="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[me]=Ev,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,At(Map)||_e(18),Rr(function(){a.keysAtom_=Ll("ObservableMap.keys()"),a.data_=new Map,a.hasMap_=new Map,r&&a.merge(r)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var n=this;if(!re.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var a=i=new or(this.has_(r),wo,"ObservableMap.key?",!1);this.hasMap_.set(r,a),li(a,function(){return n.hasMap_.delete(r)})}return i.get()},t.set=function(r,n){var i=this.has_(r);if(pt(this)){var a=ht(this,{type:i?Bt:ir,object:this,newValue:n,name:r});if(!a)return this;n=a.newValue}return i?this.updateValue_(r,n):this.addValue_(r,n),this},t.delete=function(r){var n=this;if(jt(this.keysAtom_),pt(this)){var i=ht(this,{type:yo,object:this,name:r});if(!i)return!1}if(this.has_(r)){var a=Sr(),o=Ot(this),u=o||a?{observableKind:"map",debugObjectName:this.name_,type:yo,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return Dt(function(){var l;n.keysAtom_.reportChanged(),(l=n.hasMap_.get(r))==null||l.setNewValue_(!1);var c=n.data_.get(r);c.setNewValue_(void 0),n.data_.delete(r)}),o&&Et(this,u),!0}return!1},t.updateValue_=function(r,n){var i=this.data_.get(r);if(n=i.prepareNewValue_(n),n!==re.UNCHANGED){var a=Sr(),o=Ot(this),u=o||a?{observableKind:"map",debugObjectName:this.name_,type:Bt,object:this,oldValue:i.value_,name:r,newValue:n}:null;i.setNewValue_(n),o&&Et(this,u)}},t.addValue_=function(r,n){var i=this;jt(this.keysAtom_),Dt(function(){var l,c=new or(n,i.enhancer_,"ObservableMap.key",!1);i.data_.set(r,c),n=c.value_,(l=i.hasMap_.get(r))==null||l.setNewValue_(!0),i.keysAtom_.reportChanged()});var a=Sr(),o=Ot(this),u=o||a?{observableKind:"map",debugObjectName:this.name_,type:ir,object:this,name:r,newValue:n}:null;o&&Et(this,u)},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 Zn({next:function(){var i=n.next(),a=i.done,o=i.value;return{done:a,value:a?void 0:r.get(o)}}})},t.entries=function(){var r=this,n=this.keys();return Zn({next:function(){var i=n.next(),a=i.done,o=i.value;return{done:a,value:a?void 0:[o,r.get(o)]}}})},t[vf]=function(){return this.entries()},t.forEach=function(r,n){for(var i=sn(this),a;!(a=i()).done;){var o=a.value,u=o[0],l=o[1];r.call(n,l,u,this)}},t.merge=function(r){var n=this;return lr(r)&&(r=new Map(r)),Dt(function(){ar(r)?Vm(r).forEach(function(i){return n.set(i,r[i])}):Array.isArray(r)?r.forEach(function(i){var a=i[0],o=i[1];return n.set(a,o)}):dn(r)?(r.constructor!==Map&&_e(19,r),r.forEach(function(i,a){return n.set(a,i)})):r!=null&&_e(20,r)}),this},t.clear=function(){var r=this;Dt(function(){Me(function(){for(var n=sn(r.keys()),i;!(i=n()).done;){var a=i.value;r.delete(a)}})})},t.replace=function(r){var n=this;return Dt(function(){for(var i=Av(r),a=new Map,o=!1,u=sn(n.data_.keys()),l;!(l=u()).done;){var c=l.value;if(!i.has(c)){var m=n.delete(c);if(m)o=!0;else{var g=n.data_.get(c);a.set(c,g)}}}for(var R=sn(i.entries()),j;!(j=R()).done;){var G=j.value,Z=G[0],ae=G[1],B=n.data_.has(Z);if(n.set(Z,ae),n.data_.has(Z)){var V=n.data_.get(Z);a.set(Z,V),B||(o=!0)}}if(!o)if(n.data_.size!==a.size)n.keysAtom_.reportChanged();else for(var q=n.data_.keys(),se=a.keys(),F=q.next(),ue=se.next();!F.done;){if(F.value!==ue.value){n.keysAtom_.reportChanged();break}F=q.next(),ue=se.next()}n.data_=a}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,n){return di(this,r)},t.intercept_=function(r){return fi(this,r)},ss(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:bf,get:function(){return"Map"}}]),e}(),lr=ur("ObservableMap",wf);function Av(e){if(dn(e)||lr(e))return e;if(Array.isArray(e))return new Map(e);if(ar(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return _e(21,e)}var _f,Tf,Iv={};_f=Symbol.iterator;Tf=Symbol.toStringTag;var xf=function(){function e(r,n,i){var a=this;n===void 0&&(n=hn),i===void 0&&(i="ObservableSet"),this.name_=void 0,this[me]=Iv,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,At(Set)||_e(22),this.enhancer_=function(o,u){return n(o,u,i)},Rr(function(){a.atom_=Ll(a.name_),r&&a.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;Dt(function(){Me(function(){for(var n=sn(r.data_.values()),i;!(i=n()).done;){var a=i.value;r.delete(a)}})})},t.forEach=function(r,n){for(var i=sn(this),a;!(a=i()).done;){var o=a.value;r.call(n,o,o,this)}},t.add=function(r){var n=this;if(jt(this.atom_),pt(this)){var i=ht(this,{type:ir,object:this,newValue:r});if(!i)return this}if(!this.has(r)){Dt(function(){n.data_.add(n.enhancer_(r,void 0)),n.atom_.reportChanged()});var a=!1,o=Ot(this),u=o||a?{observableKind:"set",debugObjectName:this.name_,type:ir,object:this,newValue:r}:null;o&&Et(this,u)}return this},t.delete=function(r){var n=this;if(pt(this)){var i=ht(this,{type:yo,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var a=!1,o=Ot(this),u=o||a?{observableKind:"set",debugObjectName:this.name_,type:yo,object:this,oldValue:r}:null;return Dt(function(){n.atom_.reportChanged(),n.data_.delete(r)}),o&&Et(this,u),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=0,n=Array.from(this.keys()),i=Array.from(this.values());return Zn({next:function(){var a=r;return r+=1,a<i.length?{value:[n[a],i[a]],done:!1}:{done:!0}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,n=0,i=Array.from(this.data_.values());return Zn({next:function(){return n<i.length?{value:r.dehanceValue_(i[n++]),done:!1}:{done:!0}}})},t.replace=function(r){var n=this;return Cr(r)&&(r=new Set(r)),Dt(function(){Array.isArray(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):ii(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):r!=null&&_e("Cannot initialize set from "+r)}),this},t.observe_=function(r,n){return di(this,r)},t.intercept_=function(r){return fi(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[_f]=function(){return this.values()},ss(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Tf,get:function(){return"Set"}}]),e}(),Cr=ur("ObservableSet",xf),Xc=Object.create(null),Yc="remove",Of=function(){function e(r,n,i,a){n===void 0&&(n=new Map),a===void 0&&(a=bg),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_=a,this.keysAtom_=new ai("ObservableObject.keys"),this.isPlainObject_=ar(this.target_)}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 un)return i.set(n),!0;if(pt(this)){var a=ht(this,{type:Bt,object:this.proxy_||this.target_,name:r,newValue:n});if(!a)return null;n=a.newValue}if(n=i.prepareNewValue_(n),n!==re.UNCHANGED){var o=Ot(this),u=!1,l=o||u?{type:Bt,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:i.value_,name:r,newValue:n}:null;i.setNewValue_(n),o&&Et(this,l)}return!0},t.get_=function(r){return re.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(!re.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var n=this.pendingKeys_.get(r);return n||(n=new or(r in this.target_,wo,"ObservableObject.key?",!1),this.pendingKeys_.set(r,n)),n.get()},t.make_=function(r,n){if(n===!0&&(n=this.defaultAnnotation_),n!==!1){if(el(this,n,r),!(r in this.target_)){var i;if((i=this.target_[Ut])!=null&&i[r])return;_e(1,n.annotationType_,this.name_+"."+r.toString())}for(var a=this.target_;a&&a!==ni;){var o=uo(a,r);if(o){var u=n.make_(this,r,o,a);if(u===0)return;if(u===1)break}a=Object.getPrototypeOf(a)}Zc(this,n,r)}},t.extend_=function(r,n,i,a){if(a===void 0&&(a=!1),i===!0&&(i=this.defaultAnnotation_),i===!1)return this.defineProperty_(r,n,a);el(this,i,r);var o=i.extend_(this,r,n,a);return o&&Zc(this,i,r),o},t.defineProperty_=function(r,n,i){i===void 0&&(i=!1),jt(this.keysAtom_);try{yt();var a=this.delete_(r);if(!a)return a;if(pt(this)){var o=ht(this,{object:this.proxy_||this.target_,name:r,type:ir,newValue:n.value});if(!o)return null;var u=o.newValue;n.value!==u&&(n=Ur({},n,{value:u}))}if(i){if(!Reflect.defineProperty(this.target_,r,n))return!1}else Pt(this.target_,r,n);this.notifyPropertyAddition_(r,n.value)}finally{mt()}return!0},t.defineObservableProperty_=function(r,n,i,a){a===void 0&&(a=!1),jt(this.keysAtom_);try{yt();var o=this.delete_(r);if(!o)return o;if(pt(this)){var u=ht(this,{object:this.proxy_||this.target_,name:r,type:ir,newValue:n});if(!u)return null;n=u.newValue}var l=Qc(r),c={configurable:re.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:l.get,set:l.set};if(a){if(!Reflect.defineProperty(this.target_,r,c))return!1}else Pt(this.target_,r,c);var m=new or(n,i,"ObservableObject.key",!1);this.values_.set(r,m),this.notifyPropertyAddition_(r,m.value_)}finally{mt()}return!0},t.defineComputedProperty_=function(r,n,i){i===void 0&&(i=!1),jt(this.keysAtom_);try{yt();var a=this.delete_(r);if(!a)return a;if(pt(this)){var o=ht(this,{object:this.proxy_||this.target_,name:r,type:ir,newValue:void 0});if(!o)return null}n.name||(n.name="ObservableObject.key"),n.context=this.proxy_||this.target_;var u=Qc(r),l={configurable:re.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:u.get,set:u.set};if(i){if(!Reflect.defineProperty(this.target_,r,l))return!1}else Pt(this.target_,r,l);this.values_.set(r,new un(n)),this.notifyPropertyAddition_(r,void 0)}finally{mt()}return!0},t.delete_=function(r,n){if(n===void 0&&(n=!1),jt(this.keysAtom_),!Vt(this.target_,r))return!0;if(pt(this)){var i=ht(this,{object:this.proxy_||this.target_,name:r,type:Yc});if(!i)return null}try{var a,o;yt();var u=Ot(this),l=!1,c=this.values_.get(r),m=void 0;if(!c&&(u||l)){var g;m=(g=uo(this.target_,r))==null?void 0:g.value}if(n){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(c&&(this.values_.delete(r),c instanceof or&&(m=c.value_),nf(c)),this.keysAtom_.reportChanged(),(a=this.pendingKeys_)==null||(o=a.get(r))==null||o.set(r in this.target_),u||l){var R={type:Yc,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:m,name:r};u&&Et(this,R)}}finally{mt()}return!0},t.observe_=function(r,n){return di(this,r)},t.intercept_=function(r){return fi(this,r)},t.notifyPropertyAddition_=function(r,n){var i,a,o=Ot(this),u=!1;if(o||u){var l=o||u?{type:ir,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:n}:null;o&&Et(this,l)}(i=this.pendingKeys_)==null||(a=i.get(r))==null||a.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),bo(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function yn(e,t){var r;if(Vt(e,me))return e;var n=(r=t?.name)!=null?r:"ObservableObject",i=new Of(e,new Map,String(n),kg(t));return vo(e,me,i),e}var Sv=ur("ObservableObjectAdministration",Of);function Qc(e){return Xc[e]||(Xc[e]={get:function(){return this[me].getObservablePropValue_(e)},set:function(t){return this[me].setObservablePropValue_(e,t)}})}function ln(e){return go(e)?Sv(e[me]):!1}function Zc(e,t,r){var n;(n=e.target_[Ut])==null||delete n[r]}function el(e,t,r){if(0)var n,i,a}var $v=Af(0),kv=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Ca=0,Ef=function(){};function Uv(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}Uv(Ef,Array.prototype);var hs=function(e,t,r){Ml(n,e);function n(a,o,u,l){var c;return u===void 0&&(u="ObservableArray"),l===void 0&&(l=!1),c=e.call(this)||this,Rr(function(){var m=new ps(u,o,l,!0);m.proxy_=Na(c),Bl(Na(c),me,m),a&&a.length&&c.spliceWithArray(0,0,a),kv&&Object.defineProperty(Na(c),"0",$v)}),c}var i=n.prototype;return i.concat=function(){this[me].atom_.reportObserved();for(var a=arguments.length,o=new Array(a),u=0;u<a;u++)o[u]=arguments[u];return Array.prototype.concat.apply(this.slice(),o.map(function(l){return pi(l)?l.slice():l}))},i[r]=function(){var a=this,o=0;return Zn({next:function(){return o<a.length?{value:a[o++],done:!1}:{done:!0,value:void 0}}})},ss(n,[{key:"length",get:function(){return this[me].getArrayLength_()},set:function(a){this[me].setArrayLength_(a)}},{key:t,get:function(){return"Array"}}]),n}(Ef,Symbol.toStringTag,Symbol.iterator);Object.entries(ho).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&vo(hs.prototype,t,r)});function Af(e){return{enumerable:!1,configurable:!0,get:function(){return this[me].get_(e)},set:function(t){this[me].set_(e,t)}}}function jv(e){Pt(hs.prototype,""+e,Af(e))}function If(e){if(e>Ca){for(var t=Ca;t<e+100;t++)jv(t);Ca=e}}If(1e3);function Pv(e,t,r){return new hs(e,t,r)}function Pr(e,t){if(typeof e=="object"&&e!==null){if(pi(e))return t!==void 0&&_e(23),e[me].atom_;if(Cr(e))return e.atom_;if(lr(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||_e(25,t,Ya(e)),r}if(ln(e)){if(!t)return _e(26);var n=e[me].values_.get(t);return n||_e(27,t,Ya(e)),n}if(us(e)||ui(e)||po(e))return e}else if(At(e)&&po(e[me]))return e[me];_e(28)}function Sf(e,t){if(e||_e(29),t!==void 0)return Sf(Pr(e,t));if(us(e)||ui(e)||po(e)||lr(e)||Cr(e))return e;if(e[me])return e[me];_e(24,e)}function Ya(e,t){var r;if(t!==void 0)r=Pr(e,t);else{if(ci(e))return e.name;ln(e)||lr(e)||Cr(e)?r=Sf(e):r=Pr(e)}return r.name_}function Rr(e){var t=Nr(),r=To(!0);yt();try{return e()}finally{mt(),xo(r),Ft(t)}}var tl=ni.toString;function ys(e,t,r){return r===void 0&&(r=-1),Qa(e,t,r)}function Qa(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 a=typeof e;if(a!=="function"&&a!=="object"&&typeof t!="object")return!1;var o=tl.call(e);if(o!==tl.call(t))return!1;switch(o){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=rl(e),t=rl(t);var u=o==="[object Array]";if(!u){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,c=t.constructor;if(l!==c&&!(At(l)&&l instanceof l&&At(c)&&c instanceof c)&&"constructor"in e&&"constructor"in t)return!1}if(r===0)return!1;r<0&&(r=-1),n=n||[],i=i||[];for(var m=n.length;m--;)if(n[m]===e)return i[m]===t;if(n.push(e),i.push(t),u){if(m=e.length,m!==t.length)return!1;for(;m--;)if(!Qa(e[m],t[m],r-1,n,i))return!1}else{var g=Object.keys(e),R;if(m=g.length,Object.keys(t).length!==m)return!1;for(;m--;)if(R=g[m],!(Vt(t,R)&&Qa(e[R],t[R],r-1,n,i)))return!1}return n.pop(),i.pop(),!0}function rl(e){return pi(e)?e.slice():dn(e)||lr(e)||ii(e)||Cr(e)?Array.from(e.entries()):e}function Zn(e){return e[Symbol.iterator]=Nv,e}function Nv(){return this}["Symbol","Map","Set"].forEach(function(e){var t=os();typeof t[e]>"u"&&_e("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:af,extras:{getDebugName:Ya},$mobx:me});var $f=Lt(Cm(),1),GE=$f.default.configure,vt=$f.default,{WARN:KE,LOG:HE,DEBUG:qE,VERBOSE:nl,ERROR:Bv}=Oe.setup(Oe.DEBUG),kf=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),Uf=(e,t,r="asc")=>kf(e.ts,t.ts,r);function fr(e,t="asc"){return e.sort((r,n)=>Uf(r,n,t))}var ms=(e,t)=>Rm(new Date(e.ts),new Date(t.ts));var jf=(e,t)=>Xe.structural(e,t),Oo=e=>{let t=new Map;for(let r of e){if(!r)throw Bv("falsy entry in applogs",e),new Error("falsy entry in applogs");t.set(vt(r),r)}return Array.from(t.values())};function Pf(e){return typeof e=="string"&&e.startsWith("?")}function Nf(e){return e.slice(1)}function Eo(e,t){let r={};return[Object.entries(e).reduce((n,[i,a])=>{if(Pf(a)){let o=Nf(a),u=t[o];u?n[i]=u:r[i]=o}else n[i]=a;return n},{}),r]}function Bf(e,t,r){nl("[matchPartStatic]",e,t,t===r?"===":"!==",r);let n=typeof t=="function"?t(r):Array.isArray(t)&&!Array.isArray(r)?t.includes(r):t===r;return nl("[matchPartStatic] =>",e.startsWith("!")?"!":"",n),e.startsWith("!")?!n:n}var Cf=function(e){for(var t=0,r=0,n=e.length;r<n;r++)t+=e[r];return t},il=function(e){return Cf(e)/e.length},at={max:function(e){return Math.max.apply(null,e)},min:function(e){return Math.min.apply(null,e)},range:function(e){return at.max(e)-at.min(e)},midrange:function(e){return at.range(e)/2},sum:Cf,mean:il,average:il,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=at.mean(e);return at.mean(e.map(function(r){return Math.pow(r-t,2)}))},standardDeviation:function(e){return Math.sqrt(at.variance(e))},meanAbsoluteDeviation:function(e){var t=at.mean(e);return at.mean(e.map(function(r){return Math.abs(r-t)}))},zScores:function(e){var t=at.mean(e),r=at.standardDeviation(e);return e.map(function(n){return(n-t)/r})}};at.average=at.mean;function Rf(e,t){if(e.length!==t.length)return!1;let r=[...e].sort(),n=[...t].sort();for(let i=0;i<r.length;i++)if(r[i]!==n[i])return!1;return!0}function gs(){return new Date().toISOString()}var{WARN:WE,LOG:JE,DEBUG:Cv,VERBOSE:et,ERROR:XE}=Oe.setup(Oe.INFO);fv({enforceActions:"always"});if(!new class{constructor(){$t(this,"xyz")}}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");typeof window=="object"&&(window.getDependencyTree=Yn,window.getObserverTree=pv);et.isDisabled||af(e=>{et("[mobx]",e)});var mn=({caller:e,stream:t,pattern:r})=>`${t?.name?t.name+" | ":""}${e??"caller?"}${r?`{${typeof r=="string"?r:vt(r)}}`:""}`;function Mf(e,t){return Me(()=>Xe.structural(e.get(),t.get()))}function gn(e,t){return Xe.shallow(e.applogs,t.applogs)}function Ao(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(et("queryNodesComparer",r,n,i),!Xe.structural(n.variables,i.variables)||!gn(n.logsOfThisNode,i.logsOfThisNode))return!1}return!0}var Rv=0;function hi(e,{name:t,equals:r}={}){et("[observableArrayMap] create",{fnname:e.name,fn:e,name:t,equals:r});let n=`observableArrayMap@${++Rv}{${t}}`,i,a;function o(){u.track(()=>{Cv(`[${n}] runAndTrack:`,{name:t??e.name,fn:e}),a=e(),et(`[${n}] runAndTrack =>`,a)})}let u=new Jn(n,(...c)=>{et(`[${n}] reaction.invalidate`,c),o(),nv(()=>{(r??Xe.structural)(i,a)||i.replace(a)})});o(),i=Ne.array(a,{deep:!1,name:t}),et(`[${n}] deps of reaction`,Yn(u),"array:",Yn(i),{reaction:u,observableArr:i});let l=li(i,()=>{et("[observableArrayMap] dispose"),u.dispose(),l()});return i}function Ye(e,t=!1){if(ci(e))throw new Error("computedFnDeepCompare shouldn't be used on actions");let r=!1,n=0,i=typeof t=="boolean"?{keepAlive:t}:t,a=new Map;return function(...o){let u,l=Me(()=>o),c=`computedFnDeepCompare(${i.name||e.name}#${++n})${i.argsDebugName?`{${i.argsDebugName(...o)}}`:""}`;for(let[R,j]of a.entries())if(Xe.structural(R,l)){u=j;break}if(u){let R=u.get();return et(`[${c}] cache hit`,{untrackedArgs:l,cachedResult:R}),R}if(!i.keepAlive&&!Vg())return!r&&Gg().computedRequiresReaction&&(console.warn("invoking a computedFn from outside an reactive context won't be memoized, unless keepAlive is set"),r=!0),e.apply(this,o);et(`[${c}] new computation`,{untrackedArgs:l});let m,g=Ge(()=>(et(`[${c}] update->rerun`,Me(()=>({args:o})),e),et.isDisabled||mf(),m=e.apply(this,o)),{...i,name:c});if(et(`[${c}] deps`,Yn(g),{untrackedArgs:l}),a.set(l,g),!i.keepAlive){let R=li(g,()=>{et(`[${c}] dispose`,g),a.delete(l),i.onCleanup&&i.onCleanup(m,...o),m=void 0,R()})}return g.get()}}function Mv(e){let t=0,r="",n=0;for(let i=0;i<e.length;i++){let a=e[i];a==="("?r+=a+`
|
|
20
|
+
${W}`),K.pop(),`{${E}}`}case"number":return isFinite(O)?String(O):V?V(O):"null";case"boolean":return O===!0?"true":"false";case"undefined":return;case"bigint":if(se)return String(O);default:return V?V(O):void 0}}function C(X,O,K){switch(typeof O){case"string":return a(O);case"object":{if(O===null)return"null";if(typeof O.toJSON=="function"){if(O=O.toJSON(X),typeof O!="object")return C(X,O,K);if(O===null)return"null"}if(K.indexOf(O)!==-1)return q;let te="";if(Array.isArray(O)){if(O.length===0)return"[]";if(ue<K.length+1)return'"[Array]"';K.push(O);let _=Math.min(O.length,z),E=0;for(;E<_-1;E++){let S=C(String(E),O[E],K);te+=S!==void 0?S:"null",te+=","}let k=C(String(E),O[E],K);if(te+=k!==void 0?k:"null",O.length-1>z){let S=O.length-z-1;te+=`,"... ${j(S)} not stringified"`}return K.pop(),`[${te}]`}let H=Object.keys(O),W=H.length;if(W===0)return"{}";if(ue<K.length+1)return'"[Object]"';let fe="",f=Math.min(W,z);l(O)&&(te+=c(O,",",z),H=H.slice(O.length),f-=O.length,fe=","),F&&(H=o(H)),K.push(O);for(let _=0;_<f;_++){let E=H[_],k=C(E,O[E],K);k!==void 0&&(te+=`${fe}${a(E)}:${k}`,fe=",")}if(W>z){let _=W-z;te+=`${fe}"...":"${j(_)} not stringified"`}return K.pop(),`{${te}}`}case"number":return isFinite(O)?String(O):V?V(O):"null";case"boolean":return O===!0?"true":"false";case"undefined":return;case"bigint":if(se)return String(O);default:return V?V(O):void 0}}function Q(X,O,K){if(arguments.length>1){let te="";if(typeof K=="number"?te=" ".repeat(Math.min(K,10)):typeof K=="string"&&(te=K.slice(0,10)),O!=null){if(typeof O=="function")return pe("",{"":X},[],O,te,"");if(Array.isArray(O))return M("",X,[],G(O),te,"")}if(te.length!==0)return N("",X,[],te,"")}return C("",X,[])}return Q}});function Va(e){"@babel/helpers - typeof";return Va=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Va(e)}function Ul(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function zc(e){Ul(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||Va(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function Mm(e,t){Ul(2,arguments);var r=zc(e),n=zc(t);return r.getTime()<n.getTime()}function _e(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(0)var i;throw new Error(typeof e=="number"?"[MobX] minified error nr: "+e+(r.length?" "+r.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var Lm={};function os(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:Lm}var jl=Object.assign,uo=Object.getOwnPropertyDescriptor,Pt=Object.defineProperty,ni=Object.prototype,Fa=[];Object.freeze(Fa);var as={};Object.freeze(as);var Dm=typeof Proxy<"u",Vm=Object.toString();function Pl(){Dm||_e("Proxy not available")}function Nl(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var an=function(){};function At(e){return typeof e=="function"}function kr(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function go(e){return e!==null&&typeof e=="object"}function ar(e){if(!go(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()===Vm}function Bl(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function vo(e,t,r){Pt(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function Cl(e,t,r){Pt(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function ur(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(n){return go(n)&&n[r]===!0}}function dn(e){return e instanceof Map}function ii(e){return e instanceof Set}var Rl=typeof Object.getOwnPropertySymbols<"u";function Fm(e){var t=Object.keys(e);if(!Rl)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return ni.propertyIsEnumerable.call(e,n)})):t}var bo=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Rl?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Ml(e){return e===null?null:typeof e=="object"?""+e:e}function Vt(e,t){return ni.hasOwnProperty.call(e,t)}var zm=Object.getOwnPropertyDescriptors||function(e){var t={};return bo(e).forEach(function(r){t[r]=uo(e,r)}),t};function Gc(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,Hm(n.key),n)}}function ss(e,t,r){return t&&Gc(e.prototype,t),r&&Gc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ur(){return Ur=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ur.apply(this,arguments)}function Ll(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,za(e,t)}function za(e,t){return za=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},za(e,t)}function Na(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Gm(e,t){if(e){if(typeof e=="string")return Kc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Kc(e,t)}}function Kc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function sn(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=Gm(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.
|
|
21
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Km(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hm(e){var t=Km(e,"string");return typeof t=="symbol"?t:String(t)}var Ut=Symbol("mobx-stored-annotations");function Nt(e){function t(r,n){if(oi(n))return e.decorate_20223_(r,n);pn(r,n,e)}return Object.assign(t,e)}function pn(e,t,r){if(Vt(e,Ut)||vo(e,Ut,Ur({},e[Ut])),0)var n;qm(e,r,t),rg(r)||(e[Ut][t]=r)}function qm(e,t,r){if(0)var n,i,a}function Wm(e){return Vt(e,Ut)||vo(e,Ut,Ur({},e[Ut])),e[Ut]}function oi(e){return typeof e=="object"&&typeof e.kind=="string"}var me=Symbol("mobx administration"),ai=function(){function e(r){r===void 0&&(r="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ae.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 nf(this)},t.reportChanged=function(){yt(),of(this),mt()},t.toString=function(){return this.name_},e}(),us=ur("Atom",ai);function Dl(e,t,r){t===void 0&&(t=an),r===void 0&&(r=an);var n=new ai(e);return t!==an&&fs(n,t),r!==an&&li(n,r),n}function Jm(e,t){return e===t}function Xm(e,t){return ys(e,t)}function Ym(e,t){return ys(e,t,1)}function Qm(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Xe={identity:Jm,structural:Xm,default:Qm,shallow:Ym};function hn(e,t,r){return ds(e)?e:Array.isArray(e)?Ne.array(e,{name:r}):ar(e)?Ne.object(e,void 0,{name:r}):dn(e)?Ne.map(e,{name:r}):ii(e)?Ne.set(e,{name:r}):typeof e=="function"&&!ci(e)&&!Qn(e)?Bl(e)?cn(e):Xn(r,e):e}function Zm(e,t,r){if(e==null||ln(e)||pi(e)||lr(e)||Cr(e))return e;if(Array.isArray(e))return Ne.array(e,{name:r,deep:!1});if(ar(e))return Ne.object(e,void 0,{name:r,deep:!1});if(dn(e))return Ne.map(e,{name:r,deep:!1});if(ii(e))return Ne.set(e,{name:r,deep:!1})}function wo(e){return e}function eg(e,t){return ys(e,t)?t:e}var tg="override";function rg(e){return e.annotationType_===tg}function si(e,t){return{annotationType_:e,options_:t,make_:ng,extend_:ig,decorate_20223_:og}}function ng(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(ci(r.value))return 1;var a=Vl(e,this,t,r,!1);return Pt(n,t,a),2}function ig(e,t,r,n){var i=Vl(e,this,t,r);return e.defineProperty_(t,i,n)}function og(e,t){var r=t.kind,n=t.name,i=t.addInitializer,a=this,o=function(l){var c,m,g,R;return jr((c=(m=a.options_)==null?void 0:m.name)!=null?c:n.toString(),l,(g=(R=a.options_)==null?void 0:R.autoAction)!=null?g:!1)};if(r=="field"){i(function(){pn(this,n,a)});return}if(r=="method"){var u;return ci(e)||(e=o(e)),(u=this.options_)!=null&&u.bound&&i(function(){var l=this,c=l[n].bind(l);c.isMobxAction=!0,l[n]=c}),e}_e("Cannot apply '"+a.annotationType_+"' to '"+String(n)+"' (kind: "+r+"):"+(`
|
|
22
|
+
'`+a.annotationType_+"' can only be used on properties with a function value."))}function ag(e,t,r,n){var i=t.annotationType_,a=n.value}function Vl(e,t,r,n,i){var a,o,u,l,c,m,g;i===void 0&&(i=re.safeDescriptors),ag(e,t,r,n);var R=n.value;if((a=t.options_)!=null&&a.bound){var j;R=R.bind((j=e.proxy_)!=null?j:e.target_)}return{value:jr((o=(u=t.options_)==null?void 0:u.name)!=null?o:r.toString(),R,(l=(c=t.options_)==null?void 0:c.autoAction)!=null?l:!1,(m=t.options_)!=null&&m.bound?(g=e.proxy_)!=null?g:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function Fl(e,t){return{annotationType_:e,options_:t,make_:sg,extend_:ug,decorate_20223_:cg}}function sg(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)||!Qn(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(Qn(r.value))return 1;var a=zl(e,this,t,r,!1,!1);return Pt(n,t,a),2}function ug(e,t,r,n){var i,a=zl(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,a,n)}function cg(e,t){var r,n=t.name,i=t.addInitializer;return Qn(e)||(e=cn(e)),(r=this.options_)!=null&&r.bound&&i(function(){var a=this,o=a[n].bind(a);o.isMobXFlow=!0,a[n]=o}),e}function lg(e,t,r,n){var i=t.annotationType_,a=n.value}function zl(e,t,r,n,i,a){a===void 0&&(a=re.safeDescriptors),lg(e,t,r,n);var o=n.value;if(Qn(o)||(o=cn(o)),i){var u;o=o.bind((u=e.proxy_)!=null?u:e.target_),o.isMobXFlow=!0}return{value:o,configurable:a?e.isPlainObject_:!0,enumerable:!1,writable:!a}}function cs(e,t){return{annotationType_:e,options_:t,make_:fg,extend_:dg,decorate_20223_:pg}}function fg(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function dg(e,t,r,n){return hg(e,this,t,r),e.defineComputedProperty_(t,Ur({},this.options_,{get:r.get,set:r.set}),n)}function pg(e,t){var r=this,n=t.name,i=t.addInitializer;return i(function(){var a=yn(this)[me],o=Ur({},r.options_,{get:e,context:this});o.name||(o.name="ObservableObject."+n.toString()),a.values_.set(n,new un(o))}),function(){return this[me].getObservablePropValue_(n)}}function hg(e,t,r,n){var i=t.annotationType_,a=n.get}function _o(e,t){return{annotationType_:e,options_:t,make_:yg,extend_:mg,decorate_20223_:gg}}function yg(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function mg(e,t,r,n){var i,a;return vg(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(a=this.options_)==null?void 0:a.enhancer)!=null?i:hn,n)}function gg(e,t){var r=this,n=t.kind,i=t.name,a=new WeakSet;function o(u,l){var c,m,g=yn(u)[me],R=new or(l,(c=(m=r.options_)==null?void 0:m.enhancer)!=null?c:hn,"ObservableObject."+i.toString(),!1);g.values_.set(i,R),a.add(u)}if(n=="accessor")return{get:function(){return a.has(this)||o(this,e.get.call(this)),this[me].getObservablePropValue_(i)},set:function(u){return a.has(this)||o(this,u),this[me].setObservablePropValue_(i,u)},init:function(u){return a.has(this)||o(this,u),u}}}function vg(e,t,r,n){var i=t.annotationType_}var bg="true",wg=Gl();function Gl(e){return{annotationType_:bg,options_:e,make_:_g,extend_:Tg,decorate_20223_:xg}}function _g(e,t,r,n){var i,a;if(r.get)return Ge.make_(e,t,r,n);if(r.set){var o=jr(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:re.safeDescriptors?e.isPlainObject_:!0,set:o})===null?0:2:(Pt(n,t,{configurable:!0,set:o}),2)}if(n!==e.target_&&typeof r.value=="function"){var u;if(Bl(r.value)){var l,c=(l=this.options_)!=null&&l.autoBind?cn.bound:cn;return c.make_(e,t,r,n)}var m=(u=this.options_)!=null&&u.autoBind?Xn.bound:Xn;return m.make_(e,t,r,n)}var g=((i=this.options_)==null?void 0:i.deep)===!1?Ne.ref:Ne;if(typeof r.value=="function"&&(a=this.options_)!=null&&a.autoBind){var R;r.value=r.value.bind((R=e.proxy_)!=null?R:e.target_)}return g.make_(e,t,r,n)}function Tg(e,t,r,n){var i,a;if(r.get)return Ge.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:re.safeDescriptors?e.isPlainObject_:!0,set:jr(t.toString(),r.set)},n);if(typeof r.value=="function"&&(i=this.options_)!=null&&i.autoBind){var o;r.value=r.value.bind((o=e.proxy_)!=null?o:e.target_)}var u=((a=this.options_)==null?void 0:a.deep)===!1?Ne.ref:Ne;return u.extend_(e,t,r,n)}function xg(e,t){_e("'"+this.annotationType_+"' cannot be used as a decorator")}var Og="observable",Eg="observable.ref",Ag="observable.shallow",Ig="observable.struct",Kl={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Kl);function Zi(e){return e||Kl}var Ga=_o(Og),Sg=_o(Eg,{enhancer:wo}),$g=_o(Ag,{enhancer:Zm}),kg=_o(Ig,{enhancer:eg}),Hl=Nt(Ga);function eo(e){return e.deep===!0?hn:e.deep===!1?wo:jg(e.defaultDecorator)}function Ug(e){var t;return e?(t=e.defaultDecorator)!=null?t:Gl(e):void 0}function jg(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:hn}function ql(e,t,r){if(oi(t))return Ga.decorate_20223_(e,t);if(kr(t)){pn(e,t,Ga);return}return ds(e)?e:ar(e)?Ne.object(e,t,r):Array.isArray(e)?Ne.array(e,t):dn(e)?Ne.map(e,t):ii(e)?Ne.set(e,t):typeof e=="object"&&e!==null?e:Ne.box(e,t)}jl(ql,Hl);var Pg={box:function(e,t){var r=Zi(t);return new or(e,eo(r),r.name,!0,r.equals)},array:function(e,t){var r=Zi(t);return(re.useProxies===!1||r.proxy===!1?Nv:Ov)(e,eo(r),r.name)},map:function(e,t){var r=Zi(t);return new _f(e,eo(r),r.name)},set:function(e,t){var r=Zi(t);return new Of(e,eo(r),r.name)},object:function(e,t,r){return Rr(function(){return pv(re.useProxies===!1||r?.proxy===!1?yn({},r):_v({},r),e,t)})},ref:Nt(Sg),shallow:Nt($g),deep:Hl,struct:Nt(kg)},Ne=jl(ql,Pg),Wl="computed",Ng="computed.struct",Ka=cs(Wl),Bg=cs(Ng,{equals:Xe.structural}),Ge=function(e,t){if(oi(t))return Ka.decorate_20223_(e,t);if(kr(t))return pn(e,t,Ka);if(ar(e))return Nt(cs(Wl,e));var r=ar(t)?t:{};return r.get=e,r.name||(r.name=e.name||""),new un(r)};Object.assign(Ge,Ka);Ge.struct=Nt(Bg);var Hc,qc,co=0,Cg=1,Rg=(Hc=(qc=uo(function(){},"name"))==null?void 0:qc.configurable)!=null?Hc:!1,Wc={value:"action",configurable:!0,writable:!1,enumerable:!1};function jr(e,t,r,n){r===void 0&&(r=!1);function i(){return Jl(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},Rg&&(Wc.value=e,Pt(i,"name",Wc)),i}function Jl(e,t,r,n,i){var a=Mg(e,t,n,i);try{return r.apply(n,i)}catch(o){throw a.error_=o,o}finally{Lg(a)}}function Mg(e,t,r,n){var i=!1,a=0;if(0)var o;var u=re.trackingDerivation,l=!t||!u;yt();var c=re.allowStateChanges;l&&(Nr(),c=To(!0));var m=ls(!0),g={runAsAction_:l,prevDerivation_:u,prevAllowStateChanges_:c,prevAllowStateReads_:m,notifySpy_:i,startTime_:a,actionId_:Cg++,parentActionId_:co};return co=g.actionId_,g}function Lg(e){co!==e.actionId_&&_e(30),co=e.parentActionId_,e.error_!==void 0&&(re.suppressReactionErrors=!0),xo(e.prevAllowStateChanges_),qn(e.prevAllowStateReads_),mt(),e.runAsAction_&&Ft(e.prevDerivation_),re.suppressReactionErrors=!1}function Dg(e,t){var r=To(e);try{return t()}finally{xo(r)}}function To(e){var t=re.allowStateChanges;return re.allowStateChanges=e,t}function xo(e){re.allowStateChanges=e}var Xl;Xl=Symbol.toPrimitive;var or=function(e){Ll(t,e);function t(n,i,a,o,u){var l;return a===void 0&&(a="ObservableValue"),o===void 0&&(o=!0),u===void 0&&(u=Xe.default),l=e.call(this,a)||this,l.enhancer=void 0,l.name_=void 0,l.equals=void 0,l.hasUnreportedChange_=!1,l.interceptors_=void 0,l.changeListeners_=void 0,l.value_=void 0,l.dehancer=void 0,l.enhancer=i,l.name_=a,l.equals=u,l.value_=i(n,void 0,a),l}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!==re.UNCHANGED){var a=Sr();this.setNewValue_(n)}},r.prepareNewValue_=function(n){if(jt(this),pt(this)){var i=ht(this,{object:this,type:Bt,newValue:n});if(!i)return re.UNCHANGED;n=i.newValue}return n=this.enhancer(n,this.value_,this.name_),this.equals(this.value_,n)?re.UNCHANGED:n},r.setNewValue_=function(n){var i=this.value_;this.value_=n,this.reportChanged(),Ot(this)&&Et(this,{type:Bt,object:this,newValue:n,oldValue:i})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(n){return fi(this,n)},r.observe_=function(n,i){return i&&n({observableKind:"value",debugObjectName:this.name_,object:this,type:Bt,newValue:this.value_,oldValue:void 0}),di(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 Ml(this.get())},r[Xl]=function(){return this.valueOf()},t}(ai),Vg=ur("ObservableValue",or),Yl;Yl=Symbol.toPrimitive;var un=function(){function e(r){this.dependenciesState_=Ae.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.isBeingObserved_=!1,this.isPendingUnobservation_=!1,this.observers_=new Set,this.diffValue_=0,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ae.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new fo(null),this.name_=void 0,this.triggeredBy_=void 0,this.isComputing_=!1,this.isRunningSetter_=!1,this.derivation=void 0,this.setter_=void 0,this.isTracing_=lo.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||_e(31),this.derivation=r.get,this.name_=r.name||"ComputedValue",r.set&&(this.setter_=jr("ComputedValue-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?Xe.structural:Xe.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){Xg(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_&&_e(32,this.name_,this.derivation),re.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)Ha(this)&&(this.warnAboutUntrackedRead_(),yt(),this.value_=this.computeValue_(!1),mt());else if(nf(this),Ha(this)){var r=re.trackingContext;this.keepAlive_&&!r&&(re.trackingContext=this),this.trackAndCompute()&&Jg(this),re.trackingContext=r}var n=this.value_;if(io(n))throw n.cause;return n},t.set=function(r){if(this.setter_){this.isRunningSetter_&&_e(33,this.name_),this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter_=!1}}else _e(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,n=this.dependenciesState_===Ae.NOT_TRACKING_,i=this.computeValue_(!0),a=n||io(r)||io(i)||!this.equals_(r,i);return a&&(this.value_=i),a},t.computeValue_=function(r){this.isComputing_=!0;var n=To(!1),i;if(r)i=Ql(this,this.derivation,this.scope_);else if(re.disableErrorBoundaries===!0)i=this.derivation.call(this.scope_);else try{i=this.derivation.call(this.scope_)}catch(a){i=new fo(a)}return xo(n),this.isComputing_=!1,i},t.suspend_=function(){this.keepAlive_||(qa(this),this.value_=void 0)},t.observe_=function(r,n){var i=this,a=!0,o=void 0;return cr(function(){var u=i.get();if(!a||n){var l=Nr();r({observableKind:"computed",debugObjectName:i.name_,type:Bt,object:i,newValue:u,oldValue:o}),Ft(l)}a=!1,o=u})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return Ml(this.get())},t[Yl]=function(){return this.valueOf()},e}(),ui=ur("ComputedValue",un),Ae;(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_"})(Ae||(Ae={}));var lo;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(lo||(lo={}));var fo=function(e){this.cause=void 0,this.cause=e};function io(e){return e instanceof fo}function Ha(e){switch(e.dependenciesState_){case Ae.UP_TO_DATE_:return!1;case Ae.NOT_TRACKING_:case Ae.STALE_:return!0;case Ae.POSSIBLY_STALE_:{for(var t=ls(!0),r=Nr(),n=e.observing_,i=n.length,a=0;a<i;a++){var o=n[a];if(ui(o)){if(re.disableErrorBoundaries)o.get();else try{o.get()}catch{return Ft(r),qn(t),!0}if(e.dependenciesState_===Ae.STALE_)return Ft(r),qn(t),!0}}return Zl(e),Ft(r),qn(t),!1}}}function Fg(){return re.trackingDerivation!==null}function jt(e){return;var t}function Ql(e,t,r){var n=ls(!0);Zl(e),e.newObserving_=new Array(e.observing_.length+100),e.unboundDepsCount_=0,e.runId_=++re.runId;var i=re.trackingDerivation;re.trackingDerivation=e,re.inBatch++;var a;if(re.disableErrorBoundaries===!0)a=t.call(r);else try{a=t.call(r)}catch(o){a=new fo(o)}return re.inBatch--,re.trackingDerivation=i,zg(e),qn(n),a}function zg(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=Ae.UP_TO_DATE_,i=0,a=e.unboundDepsCount_,o=0;o<a;o++){var u=r[o];u.diffValue_===0&&(u.diffValue_=1,i!==o&&(r[i]=u),i++),u.dependenciesState_>n&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var l=t[a];l.diffValue_===0&&tf(l,e),l.diffValue_=0}for(;i--;){var c=r[i];c.diffValue_===1&&(c.diffValue_=0,Wg(c,e))}n!==Ae.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function qa(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)tf(t[r],e);e.dependenciesState_=Ae.NOT_TRACKING_}function Me(e){var t=Nr();try{return e()}finally{Ft(t)}}function Nr(){var e=re.trackingDerivation;return re.trackingDerivation=null,e}function Ft(e){re.trackingDerivation=e}function ls(e){var t=re.allowStateReads;return re.allowStateReads=e,t}function qn(e){re.allowStateReads=e}function Zl(e){if(e.dependenciesState_!==Ae.UP_TO_DATE_){e.dependenciesState_=Ae.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ae.UP_TO_DATE_}}var oo=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},ao=!0,ef=!1,re=function(){var e=os();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ao=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new oo().version&&(ao=!1),ao?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new oo):(setTimeout(function(){ef||_e(35)},1),new oo)}();function Gg(){if((re.pendingReactions.length||re.inBatch||re.isRunningReactions)&&_e(36),ef=!0,ao){var e=os();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),re=new oo}}function Kg(){return re}function Hg(e){return e.observers_&&e.observers_.size>0}function qg(e){return e.observers_}function Wg(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function tf(e,t){e.observers_.delete(t),e.observers_.size===0&&rf(e)}function rf(e){e.isPendingUnobservation_===!1&&(e.isPendingUnobservation_=!0,re.pendingUnobservations.push(e))}function yt(){re.inBatch++}function mt(){if(--re.inBatch===0){af();for(var e=re.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 un&&r.suspend_())}re.pendingUnobservations=[]}}function nf(e){var t=re.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved_&&re.trackingContext&&(e.isBeingObserved_=!0,e.onBO())),e.isBeingObserved_):(e.observers_.size===0&&re.inBatch>0&&rf(e),!1)}function of(e){e.lowestObserverState_!==Ae.STALE_&&(e.lowestObserverState_=Ae.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ae.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=Ae.STALE_}))}function Jg(e){e.lowestObserverState_!==Ae.STALE_&&(e.lowestObserverState_=Ae.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ae.POSSIBLY_STALE_?t.dependenciesState_=Ae.STALE_:t.dependenciesState_===Ae.UP_TO_DATE_&&(e.lowestObserverState_=Ae.UP_TO_DATE_)}))}function Xg(e){e.lowestObserverState_===Ae.UP_TO_DATE_&&(e.lowestObserverState_=Ae.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ae.UP_TO_DATE_&&(t.dependenciesState_=Ae.POSSIBLY_STALE_,t.onBecomeStale_())}))}var Jn=function(){function e(r,n,i,a){r===void 0&&(r="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ae.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=lo.NONE,this.name_=r,this.onInvalidate_=n,this.errorHandler_=i,this.requiresObservable_=a}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,re.pendingReactions.push(this),af())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){yt(),this.isScheduled_=!1;var r=re.trackingContext;if(re.trackingContext=this,Ha(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(n){this.reportExceptionInDerivation_(n)}}re.trackingContext=r,mt()}},t.track=function(r){if(!this.isDisposed_){yt();var n=Sr(),i;this.isRunning_=!0;var a=re.trackingContext;re.trackingContext=this;var o=Ql(this,r,void 0);re.trackingContext=a,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&qa(this),io(o)&&this.reportExceptionInDerivation_(o.cause),mt()}},t.reportExceptionInDerivation_=function(r){var n=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(re.disableErrorBoundaries)throw r;var i="[mobx] uncaught error in '"+this+"'";re.suppressReactionErrors||console.error(i,r),re.globalReactionErrorHandlers.forEach(function(a){return a(r,n)})},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(yt(),qa(this),mt()))},t.getDisposer_=function(r){var n=this,i=function a(){n.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",a)};return r==null||r.addEventListener==null||r.addEventListener("abort",i),i[me]=this,i},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){r===void 0&&(r=!1),gf(this,r)},e}(),Yg=100,Wa=function(e){return e()};function af(){re.inBatch>0||re.isRunningReactions||Wa(Qg)}function Qg(){re.isRunningReactions=!0;for(var e=re.pendingReactions,t=0;e.length>0;){++t===Yg&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n<i;n++)r[n].runReaction_()}re.isRunningReactions=!1}var po=ur("Reaction",Jn);function Zg(e){var t=Wa;Wa=function(r){return e(function(){return t(r)})}}function Sr(){return!1}function sf(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var uf="action",ev="action.bound",cf="autoAction",tv="autoAction.bound",lf="<unnamed action>",Ja=si(uf),rv=si(ev,{bound:!0}),Xa=si(cf,{autoAction:!0}),nv=si(tv,{autoAction:!0,bound:!0});function ff(e){var t=function(r,n){if(At(r))return jr(r.name||lf,r,e);if(At(n))return jr(r,n,e);if(oi(n))return(e?Xa:Ja).decorate_20223_(r,n);if(kr(n))return pn(r,n,e?Xa:Ja);if(kr(r))return Nt(si(e?cf:uf,{name:r,autoAction:e}))};return t}var gt=ff(!1);Object.assign(gt,Ja);var Xn=ff(!0);Object.assign(Xn,Xa);gt.bound=Nt(rv);Xn.bound=Nt(nv);function iv(e){return Jl(e.name||lf,!1,e,this,void 0)}function ci(e){return At(e)&&e.isMobxAction===!0}function cr(e,t){var r,n,i,a,o;t===void 0&&(t=as);var u=(r=(n=t)==null?void 0:n.name)!=null?r:"Autorun",l=!t.scheduler&&!t.delay,c;if(l)c=new Jn(u,function(){this.track(R)},t.onError,t.requiresObservable);else{var m=df(t),g=!1;c=new Jn(u,function(){g||(g=!0,m(function(){g=!1,c.isDisposed_||c.track(R)}))},t.onError,t.requiresObservable)}function R(){e(c)}return(i=t)!=null&&(a=i.signal)!=null&&a.aborted||c.schedule_(),c.getDisposer_((o=t)==null?void 0:o.signal)}var ov=function(e){return e()};function df(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:ov}function av(e,t,r){var n,i,a,o;r===void 0&&(r=as);var u=(n=r.name)!=null?n:"Reaction",l=gt(u,r.onError?sv(r.onError,t):t),c=!r.scheduler&&!r.delay,m=df(r),g=!0,R=!1,j,G,Z=r.compareStructural?Xe.structural:r.equals||Xe.default,ae=new Jn(u,function(){g||c?B():R||(R=!0,m(B))},r.onError,r.requiresObservable);function B(){if(R=!1,!ae.isDisposed_){var V=!1;ae.track(function(){var q=Dg(!1,function(){return e(ae)});V=g||!Z(j,q),G=j,j=q}),(g&&r.fireImmediately||!g&&V)&&l(j,G,ae),g=!1}}return(i=r)!=null&&(a=i.signal)!=null&&a.aborted||ae.schedule_(),ae.getDisposer_((o=r)==null?void 0:o.signal)}function sv(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var uv="onBO",cv="onBUO";function fs(e,t,r){return pf(uv,e,t,r)}function li(e,t,r){return pf(cv,e,t,r)}function pf(e,t,r,n){var i=typeof n=="function"?Pr(t,r):Pr(t),a=At(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var u=i[o];u&&(u.delete(a),u.size===0&&delete i[o])}}var lv="never",to="always",fv="observed";function dv(e){e.isolateGlobalState===!0&&Gg();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(re.useProxies=t===to?!0:t===lv?!1:typeof Proxy<"u"),t==="ifavailable"&&(re.verifyProxies=!0),r!==void 0){var n=r===to?to:r===fv;re.enforceActions=n,re.allowStateChanges=!(n===!0||n===to)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(re[i]=!!e[i])}),re.allowStateReads=!re.observableRequiresReaction,e.reactionScheduler&&Zg(e.reactionScheduler)}function pv(e,t,r,n){var i=zm(t);return Rr(function(){var a=yn(e,n)[me];bo(i).forEach(function(o){a.extend_(o,i[o],r&&o in r?r[o]:!0)})}),e}function Yn(e,t){return hf(Pr(e,t))}function hf(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=yv(e.observing_).map(hf)),t}function hv(e,t){return yf(Pr(e,t))}function yf(e){var t={name:e.name_};return Hg(e)&&(t.observers=Array.from(qg(e)).map(yf)),t}function yv(e){return Array.from(new Set(e))}var mv=0;function mf(){this.message="FLOW_CANCELLED"}mf.prototype=Object.create(Error.prototype);var Ba=Fl("flow"),gv=Fl("flow.bound",{bound:!0}),cn=Object.assign(function(e,t){if(oi(t))return Ba.decorate_20223_(e,t);if(kr(t))return pn(e,t,Ba);var r=e,n=r.name||"<unnamed flow>",i=function(){var a=this,o=arguments,u=++mv,l=gt(n+" - runid: "+u+" - init",r).apply(a,o),c,m=void 0,g=new Promise(function(R,j){var G=0;c=j;function Z(V){m=void 0;var q;try{q=gt(n+" - runid: "+u+" - yield "+G++,l.next).call(l,V)}catch(se){return j(se)}B(q)}function ae(V){m=void 0;var q;try{q=gt(n+" - runid: "+u+" - yield "+G++,l.throw).call(l,V)}catch(se){return j(se)}B(q)}function B(V){if(At(V?.then)){V.then(B,j);return}return V.done?R(V.value):(m=Promise.resolve(V.value),m.then(Z,ae))}Z(void 0)});return g.cancel=gt(n+" - runid: "+u+" - cancel",function(){try{m&&Jc(m);var R=l.return(void 0),j=Promise.resolve(R.value);j.then(an,an),Jc(j),c(new mf)}catch(G){c(G)}}),g};return i.isMobXFlow=!0,i},Ba);cn.bound=Nt(gv);function Jc(e){At(e.cancel)&&e.cancel()}function Qn(e){return e?.isMobXFlow===!0}function vv(e,t){return e?t!==void 0?ln(e)?e[me].values_.has(t):!1:ln(e)||!!e[me]||us(e)||po(e)||ui(e):!1}function ds(e){return vv(e)}function bv(e){if(ln(e))return e[me].ownKeys_();_e(38)}function ro(e,t,r){return e.set(t,r),r}function on(e,t){if(e==null||typeof e!="object"||e instanceof Date||!ds(e))return e;if(Vg(e)||ui(e))return on(e.get(),t);if(t.has(e))return t.get(e);if(pi(e)){var r=ro(t,e,new Array(e.length));return e.forEach(function(o,u){r[u]=on(o,t)}),r}if(Cr(e)){var n=ro(t,e,new Set);return e.forEach(function(o){n.add(on(o,t))}),n}if(lr(e)){var i=ro(t,e,new Map);return e.forEach(function(o,u){i.set(u,on(o,t))}),i}else{var a=ro(t,e,{});return bv(e).forEach(function(o){ni.propertyIsEnumerable.call(e,o)&&(a[o]=on(e[o],t))}),a}}function $r(e,t){return on(e,new Map)}function gf(){return;for(var e,t,r,n;n<t;n++)r[n]=arguments[n];var i}function Dt(e,t){t===void 0&&(t=void 0),yt();try{return e.apply(t)}finally{mt()}}function nn(e){return e[me]}var wv={has:function(e,t){return nn(e).has_(t)},get:function(e,t){return nn(e).get_(t)},set:function(e,t,r){var n;return kr(t)?(n=nn(e).set_(t,r,!0))!=null?n:!0:!1},deleteProperty:function(e,t){var r;return kr(t)?(r=nn(e).delete_(t,!0))!=null?r:!0:!1},defineProperty:function(e,t,r){var n;return(n=nn(e).defineProperty_(t,r))!=null?n:!0},ownKeys:function(e){return nn(e).ownKeys_()},preventExtensions:function(e){_e(13)}};function _v(e,t){var r,n;return Pl(),e=yn(e,t),(n=(r=e[me]).proxy_)!=null?n:r.proxy_=new Proxy(e,wv)}function pt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function fi(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),Nl(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function ht(e,t){var r=Nr();try{for(var n=[].concat(e.interceptors_||[]),i=0,a=n.length;i<a&&(t=n[i](t),t&&!t.type&&_e(14),!!t);i++);return t}finally{Ft(r)}}function Ot(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function di(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),Nl(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Et(e,t){var r=Nr(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,a=n.length;i<a;i++)n[i](t);Ft(r)}}function Br(e,t,r){return Rr(function(){var n,i=yn(e,r)[me];(n=t)!=null||(t=Wm(e)),bo(t).forEach(function(a){return i.make_(a,t[a])})}),e}var Xc="splice",Bt="update",Tv=1e4,xv={get:function(e,t){var r=e[me];return t===me?r:t==="length"?r.getArrayLength_():typeof t=="string"&&!isNaN(t)?r.get_(parseInt(t)):Vt(ho,t)?ho[t]:e[t]},set:function(e,t,r){var n=e[me];return t==="length"&&n.setArrayLength_(r),typeof t=="symbol"||isNaN(t)?e[t]=r:n.set_(parseInt(t),r),!0},preventExtensions:function(){_e(15)}},ps=function(){function e(r,n,i,a){r===void 0&&(r="ObservableArray"),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_=a,this.atom_=new ai(r),this.enhancer_=function(o,u){return n(o,u,"ObservableArray[..]")}}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 fi(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}),di(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&_e("Out of range: "+r);var n=this.values_.length;if(r!==n)if(r>n){for(var i=new Array(r-n),a=0;a<r-n;a++)i[a]=void 0;this.spliceWithArray_(n,0,i)}else this.spliceWithArray_(r,n-r)},t.updateArrayLength_=function(r,n){r!==this.lastKnownLength_&&_e(16),this.lastKnownLength_+=n,this.legacyMode_&&n>0&&Sf(r+n+1)},t.spliceWithArray_=function(r,n,i){var a=this;jt(this.atom_);var o=this.values_.length;if(r===void 0?r=0:r>o?r=o:r<0&&(r=Math.max(0,o+r)),arguments.length===1?n=o-r:n==null?n=0:n=Math.max(0,Math.min(n,o-r)),i===void 0&&(i=Fa),pt(this)){var u=ht(this,{object:this.proxy_,type:Xc,index:r,removedCount:n,added:i});if(!u)return Fa;n=u.removedCount,i=u.added}if(i=i.length===0?i:i.map(function(m){return a.enhancer_(m,void 0)}),this.legacyMode_){var l=i.length-n;this.updateArrayLength_(o,l)}var c=this.spliceItemsIntoValues_(r,n,i);return(n!==0||i.length!==0)&&this.notifyArraySplice_(r,i,c),this.dehanceValues_(c)},t.spliceItemsIntoValues_=function(r,n,i){if(i.length<Tv){var a;return(a=this.values_).splice.apply(a,[r,n].concat(i))}else{var o=this.values_.slice(r,r+n),u=this.values_.slice(r+n);this.values_.length+=i.length-n;for(var l=0;l<i.length;l++)this.values_[r+l]=i[l];for(var c=0;c<u.length;c++)this.values_[r+i.length+c]=u[c];return o}},t.notifyArrayChildUpdate_=function(r,n,i){var a=!this.owned_&&Sr(),o=Ot(this),u=o||a?{observableKind:"array",object:this.proxy_,type:Bt,debugObjectName:this.atom_.name_,index:r,newValue:n,oldValue:i}:null;this.atom_.reportChanged(),o&&Et(this,u)},t.notifyArraySplice_=function(r,n,i){var a=!this.owned_&&Sr(),o=Ot(this),u=o||a?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Xc,index:r,removed:i,added:n,removedCount:i.length,addedCount:n.length}:null;this.atom_.reportChanged(),o&&Et(this,u)},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx] Out of bounds read: "+r);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&&_e(17,r,i.length),r<i.length){jt(this.atom_);var a=i[r];if(pt(this)){var o=ht(this,{type:Bt,object:this.proxy_,index:r,newValue:n});if(!o)return;n=o.newValue}n=this.enhancer_(n,a);var u=n!==a;u&&(i[r]=n,this.notifyArrayChildUpdate_(r,n,a))}else{for(var l=new Array(r+1-i.length),c=0;c<l.length-1;c++)l[c]=void 0;l[l.length-1]=n,this.spliceWithArray_(i.length,0,l)}},e}();function Ov(e,t,r,n){return r===void 0&&(r="ObservableArray"),n===void 0&&(n=!1),Pl(),Rr(function(){var i=new ps(r,t,n,!1);Cl(i.values_,me,i);var a=new Proxy(i.values_,xv);return i.proxy_=a,e&&e.length&&i.spliceWithArray_(0,0,e),a})}var ho={clear:function(){return this.splice(0)},replace:function(e){var t=this[me];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 a=this[me];switch(arguments.length){case 0:return[];case 1:return a.spliceWithArray_(e);case 2:return a.spliceWithArray_(e,t)}return a.spliceWithArray_(e,t,n)},spliceWithArray:function(e,t,r){return this[me].spliceWithArray_(e,t,r)},push:function(){for(var e=this[me],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[me].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[me],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 re.trackingDerivation&&_e(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){re.trackingDerivation&&_e(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[me],r=t.dehanceValues_(t.values_).indexOf(e);return r>-1?(this.splice(r,1),!0):!1}};Ue("at",st);Ue("concat",st);Ue("flat",st);Ue("includes",st);Ue("indexOf",st);Ue("join",st);Ue("lastIndexOf",st);Ue("slice",st);Ue("toString",st);Ue("toLocaleString",st);Ue("toSorted",st);Ue("toSpliced",st);Ue("with",st);Ue("every",It);Ue("filter",It);Ue("find",It);Ue("findIndex",It);Ue("findLast",It);Ue("findLastIndex",It);Ue("flatMap",It);Ue("forEach",It);Ue("map",It);Ue("some",It);Ue("toReversed",It);Ue("reduce",vf);Ue("reduceRight",vf);function Ue(e,t){typeof Array.prototype[e]=="function"&&(ho[e]=t(e))}function st(e){return function(){var t=this[me];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function It(e){return function(t,r){var n=this,i=this[me];i.atom_.reportObserved();var a=i.dehanceValues_(i.values_);return a[e](function(o,u){return t.call(r,o,u,n)})}}function vf(e){return function(){var t=this,r=this[me];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(a,o,u){return i(a,o,u,t)},n[e].apply(n,arguments)}}var Ev=ur("ObservableArrayAdministration",ps);function pi(e){return go(e)&&Ev(e[me])}var bf,wf,Av={},ir="add",yo="delete";bf=Symbol.iterator;wf=Symbol.toStringTag;var _f=function(){function e(r,n,i){var a=this;n===void 0&&(n=hn),i===void 0&&(i="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[me]=Av,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,At(Map)||_e(18),Rr(function(){a.keysAtom_=Dl("ObservableMap.keys()"),a.data_=new Map,a.hasMap_=new Map,r&&a.merge(r)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var n=this;if(!re.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var a=i=new or(this.has_(r),wo,"ObservableMap.key?",!1);this.hasMap_.set(r,a),li(a,function(){return n.hasMap_.delete(r)})}return i.get()},t.set=function(r,n){var i=this.has_(r);if(pt(this)){var a=ht(this,{type:i?Bt:ir,object:this,newValue:n,name:r});if(!a)return this;n=a.newValue}return i?this.updateValue_(r,n):this.addValue_(r,n),this},t.delete=function(r){var n=this;if(jt(this.keysAtom_),pt(this)){var i=ht(this,{type:yo,object:this,name:r});if(!i)return!1}if(this.has_(r)){var a=Sr(),o=Ot(this),u=o||a?{observableKind:"map",debugObjectName:this.name_,type:yo,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return Dt(function(){var l;n.keysAtom_.reportChanged(),(l=n.hasMap_.get(r))==null||l.setNewValue_(!1);var c=n.data_.get(r);c.setNewValue_(void 0),n.data_.delete(r)}),o&&Et(this,u),!0}return!1},t.updateValue_=function(r,n){var i=this.data_.get(r);if(n=i.prepareNewValue_(n),n!==re.UNCHANGED){var a=Sr(),o=Ot(this),u=o||a?{observableKind:"map",debugObjectName:this.name_,type:Bt,object:this,oldValue:i.value_,name:r,newValue:n}:null;i.setNewValue_(n),o&&Et(this,u)}},t.addValue_=function(r,n){var i=this;jt(this.keysAtom_),Dt(function(){var l,c=new or(n,i.enhancer_,"ObservableMap.key",!1);i.data_.set(r,c),n=c.value_,(l=i.hasMap_.get(r))==null||l.setNewValue_(!0),i.keysAtom_.reportChanged()});var a=Sr(),o=Ot(this),u=o||a?{observableKind:"map",debugObjectName:this.name_,type:ir,object:this,name:r,newValue:n}:null;o&&Et(this,u)},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 Zn({next:function(){var i=n.next(),a=i.done,o=i.value;return{done:a,value:a?void 0:r.get(o)}}})},t.entries=function(){var r=this,n=this.keys();return Zn({next:function(){var i=n.next(),a=i.done,o=i.value;return{done:a,value:a?void 0:[o,r.get(o)]}}})},t[bf]=function(){return this.entries()},t.forEach=function(r,n){for(var i=sn(this),a;!(a=i()).done;){var o=a.value,u=o[0],l=o[1];r.call(n,l,u,this)}},t.merge=function(r){var n=this;return lr(r)&&(r=new Map(r)),Dt(function(){ar(r)?Fm(r).forEach(function(i){return n.set(i,r[i])}):Array.isArray(r)?r.forEach(function(i){var a=i[0],o=i[1];return n.set(a,o)}):dn(r)?(r.constructor!==Map&&_e(19,r),r.forEach(function(i,a){return n.set(a,i)})):r!=null&&_e(20,r)}),this},t.clear=function(){var r=this;Dt(function(){Me(function(){for(var n=sn(r.keys()),i;!(i=n()).done;){var a=i.value;r.delete(a)}})})},t.replace=function(r){var n=this;return Dt(function(){for(var i=Iv(r),a=new Map,o=!1,u=sn(n.data_.keys()),l;!(l=u()).done;){var c=l.value;if(!i.has(c)){var m=n.delete(c);if(m)o=!0;else{var g=n.data_.get(c);a.set(c,g)}}}for(var R=sn(i.entries()),j;!(j=R()).done;){var G=j.value,Z=G[0],ae=G[1],B=n.data_.has(Z);if(n.set(Z,ae),n.data_.has(Z)){var V=n.data_.get(Z);a.set(Z,V),B||(o=!0)}}if(!o)if(n.data_.size!==a.size)n.keysAtom_.reportChanged();else for(var q=n.data_.keys(),se=a.keys(),F=q.next(),ue=se.next();!F.done;){if(F.value!==ue.value){n.keysAtom_.reportChanged();break}F=q.next(),ue=se.next()}n.data_=a}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,n){return di(this,r)},t.intercept_=function(r){return fi(this,r)},ss(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:wf,get:function(){return"Map"}}]),e}(),lr=ur("ObservableMap",_f);function Iv(e){if(dn(e)||lr(e))return e;if(Array.isArray(e))return new Map(e);if(ar(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return _e(21,e)}var Tf,xf,Sv={};Tf=Symbol.iterator;xf=Symbol.toStringTag;var Of=function(){function e(r,n,i){var a=this;n===void 0&&(n=hn),i===void 0&&(i="ObservableSet"),this.name_=void 0,this[me]=Sv,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,At(Set)||_e(22),this.enhancer_=function(o,u){return n(o,u,i)},Rr(function(){a.atom_=Dl(a.name_),r&&a.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;Dt(function(){Me(function(){for(var n=sn(r.data_.values()),i;!(i=n()).done;){var a=i.value;r.delete(a)}})})},t.forEach=function(r,n){for(var i=sn(this),a;!(a=i()).done;){var o=a.value;r.call(n,o,o,this)}},t.add=function(r){var n=this;if(jt(this.atom_),pt(this)){var i=ht(this,{type:ir,object:this,newValue:r});if(!i)return this}if(!this.has(r)){Dt(function(){n.data_.add(n.enhancer_(r,void 0)),n.atom_.reportChanged()});var a=!1,o=Ot(this),u=o||a?{observableKind:"set",debugObjectName:this.name_,type:ir,object:this,newValue:r}:null;o&&Et(this,u)}return this},t.delete=function(r){var n=this;if(pt(this)){var i=ht(this,{type:yo,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var a=!1,o=Ot(this),u=o||a?{observableKind:"set",debugObjectName:this.name_,type:yo,object:this,oldValue:r}:null;return Dt(function(){n.atom_.reportChanged(),n.data_.delete(r)}),o&&Et(this,u),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=0,n=Array.from(this.keys()),i=Array.from(this.values());return Zn({next:function(){var a=r;return r+=1,a<i.length?{value:[n[a],i[a]],done:!1}:{done:!0}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,n=0,i=Array.from(this.data_.values());return Zn({next:function(){return n<i.length?{value:r.dehanceValue_(i[n++]),done:!1}:{done:!0}}})},t.replace=function(r){var n=this;return Cr(r)&&(r=new Set(r)),Dt(function(){Array.isArray(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):ii(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):r!=null&&_e("Cannot initialize set from "+r)}),this},t.observe_=function(r,n){return di(this,r)},t.intercept_=function(r){return fi(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Tf]=function(){return this.values()},ss(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:xf,get:function(){return"Set"}}]),e}(),Cr=ur("ObservableSet",Of),Yc=Object.create(null),Qc="remove",Ef=function(){function e(r,n,i,a){n===void 0&&(n=new Map),a===void 0&&(a=wg),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_=a,this.keysAtom_=new ai("ObservableObject.keys"),this.isPlainObject_=ar(this.target_)}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 un)return i.set(n),!0;if(pt(this)){var a=ht(this,{type:Bt,object:this.proxy_||this.target_,name:r,newValue:n});if(!a)return null;n=a.newValue}if(n=i.prepareNewValue_(n),n!==re.UNCHANGED){var o=Ot(this),u=!1,l=o||u?{type:Bt,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:i.value_,name:r,newValue:n}:null;i.setNewValue_(n),o&&Et(this,l)}return!0},t.get_=function(r){return re.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(!re.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var n=this.pendingKeys_.get(r);return n||(n=new or(r in this.target_,wo,"ObservableObject.key?",!1),this.pendingKeys_.set(r,n)),n.get()},t.make_=function(r,n){if(n===!0&&(n=this.defaultAnnotation_),n!==!1){if(tl(this,n,r),!(r in this.target_)){var i;if((i=this.target_[Ut])!=null&&i[r])return;_e(1,n.annotationType_,this.name_+"."+r.toString())}for(var a=this.target_;a&&a!==ni;){var o=uo(a,r);if(o){var u=n.make_(this,r,o,a);if(u===0)return;if(u===1)break}a=Object.getPrototypeOf(a)}el(this,n,r)}},t.extend_=function(r,n,i,a){if(a===void 0&&(a=!1),i===!0&&(i=this.defaultAnnotation_),i===!1)return this.defineProperty_(r,n,a);tl(this,i,r);var o=i.extend_(this,r,n,a);return o&&el(this,i,r),o},t.defineProperty_=function(r,n,i){i===void 0&&(i=!1),jt(this.keysAtom_);try{yt();var a=this.delete_(r);if(!a)return a;if(pt(this)){var o=ht(this,{object:this.proxy_||this.target_,name:r,type:ir,newValue:n.value});if(!o)return null;var u=o.newValue;n.value!==u&&(n=Ur({},n,{value:u}))}if(i){if(!Reflect.defineProperty(this.target_,r,n))return!1}else Pt(this.target_,r,n);this.notifyPropertyAddition_(r,n.value)}finally{mt()}return!0},t.defineObservableProperty_=function(r,n,i,a){a===void 0&&(a=!1),jt(this.keysAtom_);try{yt();var o=this.delete_(r);if(!o)return o;if(pt(this)){var u=ht(this,{object:this.proxy_||this.target_,name:r,type:ir,newValue:n});if(!u)return null;n=u.newValue}var l=Zc(r),c={configurable:re.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:l.get,set:l.set};if(a){if(!Reflect.defineProperty(this.target_,r,c))return!1}else Pt(this.target_,r,c);var m=new or(n,i,"ObservableObject.key",!1);this.values_.set(r,m),this.notifyPropertyAddition_(r,m.value_)}finally{mt()}return!0},t.defineComputedProperty_=function(r,n,i){i===void 0&&(i=!1),jt(this.keysAtom_);try{yt();var a=this.delete_(r);if(!a)return a;if(pt(this)){var o=ht(this,{object:this.proxy_||this.target_,name:r,type:ir,newValue:void 0});if(!o)return null}n.name||(n.name="ObservableObject.key"),n.context=this.proxy_||this.target_;var u=Zc(r),l={configurable:re.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:u.get,set:u.set};if(i){if(!Reflect.defineProperty(this.target_,r,l))return!1}else Pt(this.target_,r,l);this.values_.set(r,new un(n)),this.notifyPropertyAddition_(r,void 0)}finally{mt()}return!0},t.delete_=function(r,n){if(n===void 0&&(n=!1),jt(this.keysAtom_),!Vt(this.target_,r))return!0;if(pt(this)){var i=ht(this,{object:this.proxy_||this.target_,name:r,type:Qc});if(!i)return null}try{var a,o;yt();var u=Ot(this),l=!1,c=this.values_.get(r),m=void 0;if(!c&&(u||l)){var g;m=(g=uo(this.target_,r))==null?void 0:g.value}if(n){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(c&&(this.values_.delete(r),c instanceof or&&(m=c.value_),of(c)),this.keysAtom_.reportChanged(),(a=this.pendingKeys_)==null||(o=a.get(r))==null||o.set(r in this.target_),u||l){var R={type:Qc,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:m,name:r};u&&Et(this,R)}}finally{mt()}return!0},t.observe_=function(r,n){return di(this,r)},t.intercept_=function(r){return fi(this,r)},t.notifyPropertyAddition_=function(r,n){var i,a,o=Ot(this),u=!1;if(o||u){var l=o||u?{type:ir,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:n}:null;o&&Et(this,l)}(i=this.pendingKeys_)==null||(a=i.get(r))==null||a.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),bo(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function yn(e,t){var r;if(Vt(e,me))return e;var n=(r=t?.name)!=null?r:"ObservableObject",i=new Ef(e,new Map,String(n),Ug(t));return vo(e,me,i),e}var $v=ur("ObservableObjectAdministration",Ef);function Zc(e){return Yc[e]||(Yc[e]={get:function(){return this[me].getObservablePropValue_(e)},set:function(t){return this[me].setObservablePropValue_(e,t)}})}function ln(e){return go(e)?$v(e[me]):!1}function el(e,t,r){var n;(n=e.target_[Ut])==null||delete n[r]}function tl(e,t,r){if(0)var n,i,a}var kv=If(0),Uv=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Ca=0,Af=function(){};function jv(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}jv(Af,Array.prototype);var hs=function(e,t,r){Ll(n,e);function n(a,o,u,l){var c;return u===void 0&&(u="ObservableArray"),l===void 0&&(l=!1),c=e.call(this)||this,Rr(function(){var m=new ps(u,o,l,!0);m.proxy_=Na(c),Cl(Na(c),me,m),a&&a.length&&c.spliceWithArray(0,0,a),Uv&&Object.defineProperty(Na(c),"0",kv)}),c}var i=n.prototype;return i.concat=function(){this[me].atom_.reportObserved();for(var a=arguments.length,o=new Array(a),u=0;u<a;u++)o[u]=arguments[u];return Array.prototype.concat.apply(this.slice(),o.map(function(l){return pi(l)?l.slice():l}))},i[r]=function(){var a=this,o=0;return Zn({next:function(){return o<a.length?{value:a[o++],done:!1}:{done:!0,value:void 0}}})},ss(n,[{key:"length",get:function(){return this[me].getArrayLength_()},set:function(a){this[me].setArrayLength_(a)}},{key:t,get:function(){return"Array"}}]),n}(Af,Symbol.toStringTag,Symbol.iterator);Object.entries(ho).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&vo(hs.prototype,t,r)});function If(e){return{enumerable:!1,configurable:!0,get:function(){return this[me].get_(e)},set:function(t){this[me].set_(e,t)}}}function Pv(e){Pt(hs.prototype,""+e,If(e))}function Sf(e){if(e>Ca){for(var t=Ca;t<e+100;t++)Pv(t);Ca=e}}Sf(1e3);function Nv(e,t,r){return new hs(e,t,r)}function Pr(e,t){if(typeof e=="object"&&e!==null){if(pi(e))return t!==void 0&&_e(23),e[me].atom_;if(Cr(e))return e.atom_;if(lr(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||_e(25,t,Ya(e)),r}if(ln(e)){if(!t)return _e(26);var n=e[me].values_.get(t);return n||_e(27,t,Ya(e)),n}if(us(e)||ui(e)||po(e))return e}else if(At(e)&&po(e[me]))return e[me];_e(28)}function $f(e,t){if(e||_e(29),t!==void 0)return $f(Pr(e,t));if(us(e)||ui(e)||po(e)||lr(e)||Cr(e))return e;if(e[me])return e[me];_e(24,e)}function Ya(e,t){var r;if(t!==void 0)r=Pr(e,t);else{if(ci(e))return e.name;ln(e)||lr(e)||Cr(e)?r=$f(e):r=Pr(e)}return r.name_}function Rr(e){var t=Nr(),r=To(!0);yt();try{return e()}finally{mt(),xo(r),Ft(t)}}var rl=ni.toString;function ys(e,t,r){return r===void 0&&(r=-1),Qa(e,t,r)}function Qa(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 a=typeof e;if(a!=="function"&&a!=="object"&&typeof t!="object")return!1;var o=rl.call(e);if(o!==rl.call(t))return!1;switch(o){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=nl(e),t=nl(t);var u=o==="[object Array]";if(!u){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,c=t.constructor;if(l!==c&&!(At(l)&&l instanceof l&&At(c)&&c instanceof c)&&"constructor"in e&&"constructor"in t)return!1}if(r===0)return!1;r<0&&(r=-1),n=n||[],i=i||[];for(var m=n.length;m--;)if(n[m]===e)return i[m]===t;if(n.push(e),i.push(t),u){if(m=e.length,m!==t.length)return!1;for(;m--;)if(!Qa(e[m],t[m],r-1,n,i))return!1}else{var g=Object.keys(e),R;if(m=g.length,Object.keys(t).length!==m)return!1;for(;m--;)if(R=g[m],!(Vt(t,R)&&Qa(e[R],t[R],r-1,n,i)))return!1}return n.pop(),i.pop(),!0}function nl(e){return pi(e)?e.slice():dn(e)||lr(e)||ii(e)||Cr(e)?Array.from(e.entries()):e}function Zn(e){return e[Symbol.iterator]=Bv,e}function Bv(){return this}["Symbol","Map","Set"].forEach(function(e){var t=os();typeof t[e]>"u"&&_e("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:sf,extras:{getDebugName:Ya},$mobx:me});var kf=Lt(Rm(),1),KE=kf.default.configure,vt=kf.default,{WARN:HE,LOG:qE,DEBUG:WE,VERBOSE:il,ERROR:Cv}=Oe.setup(Oe.DEBUG),Uf=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),jf=(e,t,r="asc")=>Uf(e.ts,t.ts,r);function fr(e,t="asc"){return e.sort((r,n)=>jf(r,n,t))}var ms=(e,t)=>Mm(new Date(e.ts),new Date(t.ts));var Pf=(e,t)=>Xe.structural(e,t),Oo=e=>{let t=new Map;for(let r of e){if(!r)throw Cv("falsy entry in applogs",e),new Error("falsy entry in applogs");t.set(vt(r),r)}return Array.from(t.values())};function Nf(e){return typeof e=="string"&&e.startsWith("?")}function Bf(e){return e.slice(1)}function Eo(e,t){let r={};return[Object.entries(e).reduce((n,[i,a])=>{if(Nf(a)){let o=Bf(a),u=t[o];u?n[i]=u:r[i]=o}else n[i]=a;return n},{}),r]}function Cf(e,t,r){il("[matchPartStatic]",e,t,t===r?"===":"!==",r);let n=typeof t=="function"?t(r):Array.isArray(t)&&!Array.isArray(r)?t.includes(r):t===r;return il("[matchPartStatic] =>",e.startsWith("!")?"!":"",n),e.startsWith("!")?!n:n}var Rf=function(e){for(var t=0,r=0,n=e.length;r<n;r++)t+=e[r];return t},ol=function(e){return Rf(e)/e.length},at={max:function(e){return Math.max.apply(null,e)},min:function(e){return Math.min.apply(null,e)},range:function(e){return at.max(e)-at.min(e)},midrange:function(e){return at.range(e)/2},sum:Rf,mean:ol,average:ol,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=at.mean(e);return at.mean(e.map(function(r){return Math.pow(r-t,2)}))},standardDeviation:function(e){return Math.sqrt(at.variance(e))},meanAbsoluteDeviation:function(e){var t=at.mean(e);return at.mean(e.map(function(r){return Math.abs(r-t)}))},zScores:function(e){var t=at.mean(e),r=at.standardDeviation(e);return e.map(function(n){return(n-t)/r})}};at.average=at.mean;function Mf(e,t){if(e.length!==t.length)return!1;let r=[...e].sort(),n=[...t].sort();for(let i=0;i<r.length;i++)if(r[i]!==n[i])return!1;return!0}function gs(){return new Date().toISOString()}var{WARN:JE,LOG:XE,DEBUG:Rv,VERBOSE:et,ERROR:YE}=Oe.setup(Oe.INFO);dv({enforceActions:"always"});if(!new class{constructor(){$t(this,"xyz")}}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");typeof window=="object"&&(window.getDependencyTree=Yn,window.getObserverTree=hv);et.isDisabled||sf(e=>{et("[mobx]",e)});var mn=({caller:e,stream:t,pattern:r})=>`${t?.name?t.name+" | ":""}${e??"caller?"}${r?`{${typeof r=="string"?r:vt(r)}}`:""}`;function Lf(e,t){return Me(()=>Xe.structural(e.get(),t.get()))}function gn(e,t){return Xe.shallow(e.applogs,t.applogs)}function Ao(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(et("queryNodesComparer",r,n,i),!Xe.structural(n.variables,i.variables)||!gn(n.logsOfThisNode,i.logsOfThisNode))return!1}return!0}var Mv=0;function hi(e,{name:t,equals:r}={}){et("[observableArrayMap] create",{fnname:e.name,fn:e,name:t,equals:r});let n=`observableArrayMap@${++Mv}{${t}}`,i,a;function o(){u.track(()=>{Rv(`[${n}] runAndTrack:`,{name:t??e.name,fn:e}),a=e(),et(`[${n}] runAndTrack =>`,a)})}let u=new Jn(n,(...c)=>{et(`[${n}] reaction.invalidate`,c),o(),iv(()=>{(r??Xe.structural)(i,a)||i.replace(a)})});o(),i=Ne.array(a,{deep:!1,name:t}),et(`[${n}] deps of reaction`,Yn(u),"array:",Yn(i),{reaction:u,observableArr:i});let l=li(i,()=>{et("[observableArrayMap] dispose"),u.dispose(),l()});return i}function Ye(e,t=!1){if(ci(e))throw new Error("computedFnDeepCompare shouldn't be used on actions");let r=!1,n=0,i=typeof t=="boolean"?{keepAlive:t}:t,a=new Map;return function(...o){let u,l=Me(()=>o),c=`computedFnDeepCompare(${i.name||e.name}#${++n})${i.argsDebugName?`{${i.argsDebugName(...o)}}`:""}`;for(let[R,j]of a.entries())if(Xe.structural(R,l)){u=j;break}if(u){let R=u.get();return et(`[${c}] cache hit`,{untrackedArgs:l,cachedResult:R}),R}if(!i.keepAlive&&!Fg())return!r&&Kg().computedRequiresReaction&&(console.warn("invoking a computedFn from outside an reactive context won't be memoized, unless keepAlive is set"),r=!0),e.apply(this,o);et(`[${c}] new computation`,{untrackedArgs:l});let m,g=Ge(()=>(et(`[${c}] update->rerun`,Me(()=>({args:o})),e),et.isDisabled||gf(),m=e.apply(this,o)),{...i,name:c});if(et(`[${c}] deps`,Yn(g),{untrackedArgs:l}),a.set(l,g),!i.keepAlive){let R=li(g,()=>{et(`[${c}] dispose`,g),a.delete(l),i.onCleanup&&i.onCleanup(m,...o),m=void 0,R()})}return g.get()}}function Lv(e){let t=0,r="",n=0;for(let i=0;i<e.length;i++){let a=e[i];a==="("?r+=a+`
|
|
23
23
|
`+" ".repeat(++t):a===")"?r+=`
|
|
24
24
|
`+" ".repeat(--t)+a:a===","&&n===0?r+=a+`
|
|
25
25
|
`+" ".repeat(t):a==="{"&&n===0?(n++,r+=a+`
|
|
26
26
|
`+" ".repeat(t+1)):a==="}"&&n===1?(n--,r+=`
|
|
27
|
-
`+" ".repeat(t)+a):a==="{"&&n>0?(n++,r+=a):(a==="}"&&n>1&&n--,r+=a)}return r}var{WARN:Lv,LOG:YE,DEBUG:Dv,VERBOSE:QE,ERROR:ol}=Oe.setup(Oe.INFO,{prefix:"[stream]"});function Ct(e){return e.init!==void 0}var Io=class{constructor(e,t,r=[],n){if(this._applogs=r,this.name=n,$t(this,"filters"),$t(this,"parents"),$t(this,"_subscribers",[]),this.parents=e&&!Array.isArray(e)?[e]:e,this.filters=t,this.parents?.length===0)throw new Error("Unhandled: empty parents");Br(this,{size:Ge,isEmpty:Ge,firstLog:Ge,latestLog:Ge},{name:`Stream{${n}}`})}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):Lv("unsubscribe called for non-existent",e)}notifySubscribers(e){Dv(`[stream: ${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}map(e){return this.applogs.map||ol("applogs arr?!",this.applogs),this.applogs.map(e)}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);{let r=Object.keys(e);return!!this.applogs.find(n=>{if(!Rf(r,Object.keys(n)))throw ol("[hasApplog] field set mismatch:",{applog:e,log:n});return jf(n,e)})}}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 untrackedSize(){return Me(()=>this.size)}get nameAndSizeUntracked(){return Me(()=>`${this.name} (${this.size})`)}get prettyName(){return Mv(this.name)}},Vv=typeof global=="object"&&global&&global.Object===Object&&global,Lf=Vv,Fv=typeof self=="object"&&self&&self.Object===Object&&self,zv=Lf||Fv||Function("return this")(),Gt=zv,Gv=Gt.Symbol,sr=Gv,Df=Object.prototype,Kv=Df.hasOwnProperty,Hv=Df.toString,Kn=sr?sr.toStringTag:void 0;function qv(e){var t=Kv.call(e,Kn),r=e[Kn];try{e[Kn]=void 0;var n=!0}catch{}var i=Hv.call(e);return n&&(t?e[Kn]=r:delete e[Kn]),i}var Wv=qv,Jv=Object.prototype,Xv=Jv.toString;function Yv(e){return Xv.call(e)}var Qv=Yv,Zv="[object Null]",eb="[object Undefined]",al=sr?sr.toStringTag:void 0;function tb(e){return e==null?e===void 0?eb:Zv:al&&al in Object(e)?Wv(e):Qv(e)}var vn=tb;function rb(e){return e!=null&&typeof e=="object"}var fn=rb,nb="[object Symbol]";function ib(e){return typeof e=="symbol"||fn(e)&&vn(e)==nb}var ei=ib;function ob(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 ab=ob,sb=Array.isArray,zt=sb,ub=1/0,sl=sr?sr.prototype:void 0,ul=sl?sl.toString:void 0;function Vf(e){if(typeof e=="string")return e;if(zt(e))return ab(e,Vf)+"";if(ei(e))return ul?ul.call(e):"";var t=e+"";return t=="0"&&1/e==-ub?"-0":t}var cb=Vf;function lb(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var vs=lb;function fb(e){return e}var db=fb,pb="[object AsyncFunction]",hb="[object Function]",yb="[object GeneratorFunction]",mb="[object Proxy]";function gb(e){if(!vs(e))return!1;var t=vn(e);return t==hb||t==yb||t==pb||t==mb}var Ff=gb,vb=Gt["__core-js_shared__"],Ra=vb,cl=function(){var e=/[^.]+$/.exec(Ra&&Ra.keys&&Ra.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function bb(e){return!!cl&&cl in e}var wb=bb,_b=Function.prototype,Tb=_b.toString;function xb(e){if(e!=null){try{return Tb.call(e)}catch{}try{return e+""}catch{}}return""}var Mr=xb,Ob=/[\\^$.*+?()[\]{}|]/g,Eb=/^\[object .+?Constructor\]$/,Ab=Function.prototype,Ib=Object.prototype,Sb=Ab.toString,$b=Ib.hasOwnProperty,kb=RegExp("^"+Sb.call($b).replace(Ob,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ub(e){if(!vs(e)||wb(e))return!1;var t=Ff(e)?kb:Eb;return t.test(Mr(e))}var jb=Ub;function Pb(e,t){return e?.[t]}var Nb=Pb;function Bb(e,t){var r=Nb(e,t);return jb(r)?r:void 0}var bn=Bb,Cb=bn(Gt,"WeakMap"),Za=Cb,Rb=9007199254740991,Mb=/^(?:0|[1-9]\d*)$/;function Lb(e,t){var r=typeof e;return t=t??Rb,!!t&&(r=="number"||r!="symbol"&&Mb.test(e))&&e>-1&&e%1==0&&e<t}var zf=Lb;function Db(e,t){return e===t||e!==e&&t!==t}var Gf=Db,Vb=9007199254740991;function Fb(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Vb}var bs=Fb;function zb(e){return e!=null&&bs(e.length)&&!Ff(e)}var Gb=zb,Kb=Object.prototype;function Hb(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Kb;return e===r}var qb=Hb;function Wb(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var Jb=Wb,Xb="[object Arguments]";function Yb(e){return fn(e)&&vn(e)==Xb}var ll=Yb,Kf=Object.prototype,Qb=Kf.hasOwnProperty,Zb=Kf.propertyIsEnumerable,e0=ll(function(){return arguments}())?ll:function(e){return fn(e)&&Qb.call(e,"callee")&&!Zb.call(e,"callee")},Hf=e0;function t0(){return!1}var r0=t0,qf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fl=qf&&typeof module=="object"&&module&&!module.nodeType&&module,n0=fl&&fl.exports===qf,dl=n0?Gt.Buffer:void 0,i0=dl?dl.isBuffer:void 0,o0=i0||r0,es=o0,a0="[object Arguments]",s0="[object Array]",u0="[object Boolean]",c0="[object Date]",l0="[object Error]",f0="[object Function]",d0="[object Map]",p0="[object Number]",h0="[object Object]",y0="[object RegExp]",m0="[object Set]",g0="[object String]",v0="[object WeakMap]",b0="[object ArrayBuffer]",w0="[object DataView]",_0="[object Float32Array]",T0="[object Float64Array]",x0="[object Int8Array]",O0="[object Int16Array]",E0="[object Int32Array]",A0="[object Uint8Array]",I0="[object Uint8ClampedArray]",S0="[object Uint16Array]",$0="[object Uint32Array]",Pe={};Pe[_0]=Pe[T0]=Pe[x0]=Pe[O0]=Pe[E0]=Pe[A0]=Pe[I0]=Pe[S0]=Pe[$0]=!0;Pe[a0]=Pe[s0]=Pe[b0]=Pe[u0]=Pe[w0]=Pe[c0]=Pe[l0]=Pe[f0]=Pe[d0]=Pe[p0]=Pe[h0]=Pe[y0]=Pe[m0]=Pe[g0]=Pe[v0]=!1;function k0(e){return fn(e)&&bs(e.length)&&!!Pe[vn(e)]}var U0=k0;function j0(e){return function(t){return e(t)}}var P0=j0,Wf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Wn=Wf&&typeof module=="object"&&module&&!module.nodeType&&module,N0=Wn&&Wn.exports===Wf,Ma=N0&&Lf.process,B0=function(){try{var e=Wn&&Wn.require&&Wn.require("util").types;return e||Ma&&Ma.binding&&Ma.binding("util")}catch{}}(),pl=B0,hl=pl&&pl.isTypedArray,C0=hl?P0(hl):U0,Jf=C0,R0=Object.prototype,M0=R0.hasOwnProperty;function L0(e,t){var r=zt(e),n=!r&&Hf(e),i=!r&&!n&&es(e),a=!r&&!n&&!i&&Jf(e),o=r||n||i||a,u=o?Jb(e.length,String):[],l=u.length;for(var c in e)(t||M0.call(e,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||a&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||zf(c,l)))&&u.push(c);return u}var D0=L0;function V0(e,t){return function(r){return e(t(r))}}var F0=V0,z0=F0(Object.keys,Object),G0=z0,K0=Object.prototype,H0=K0.hasOwnProperty;function q0(e){if(!qb(e))return G0(e);var t=[];for(var r in Object(e))H0.call(e,r)&&r!="constructor"&&t.push(r);return t}var W0=q0;function J0(e){return Gb(e)?D0(e):W0(e)}var Xf=J0,X0=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Y0=/^\w*$/;function Q0(e,t){if(zt(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||ei(e)?!0:Y0.test(e)||!X0.test(e)||t!=null&&e in Object(t)}var ws=Q0,Z0=bn(Object,"create"),ti=Z0;function ew(){this.__data__=ti?ti(null):{},this.size=0}var tw=ew;function rw(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var nw=rw,iw="__lodash_hash_undefined__",ow=Object.prototype,aw=ow.hasOwnProperty;function sw(e){var t=this.__data__;if(ti){var r=t[e];return r===iw?void 0:r}return aw.call(t,e)?t[e]:void 0}var uw=sw,cw=Object.prototype,lw=cw.hasOwnProperty;function fw(e){var t=this.__data__;return ti?t[e]!==void 0:lw.call(t,e)}var dw=fw,pw="__lodash_hash_undefined__";function hw(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ti&&t===void 0?pw:t,this}var yw=hw;function wn(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])}}wn.prototype.clear=tw;wn.prototype.delete=nw;wn.prototype.get=uw;wn.prototype.has=dw;wn.prototype.set=yw;var yl=wn;function mw(){this.__data__=[],this.size=0}var gw=mw;function vw(e,t){for(var r=e.length;r--;)if(Gf(e[r][0],t))return r;return-1}var So=vw,bw=Array.prototype,ww=bw.splice;function _w(e){var t=this.__data__,r=So(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():ww.call(t,r,1),--this.size,!0}var Tw=_w;function xw(e){var t=this.__data__,r=So(t,e);return r<0?void 0:t[r][1]}var Ow=xw;function Ew(e){return So(this.__data__,e)>-1}var Aw=Ew;function Iw(e,t){var r=this.__data__,n=So(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var Sw=Iw;function _n(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])}}_n.prototype.clear=gw;_n.prototype.delete=Tw;_n.prototype.get=Ow;_n.prototype.has=Aw;_n.prototype.set=Sw;var $o=_n,$w=bn(Gt,"Map"),ri=$w;function kw(){this.size=0,this.__data__={hash:new yl,map:new(ri||$o),string:new yl}}var Uw=kw;function jw(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Pw=jw;function Nw(e,t){var r=e.__data__;return Pw(t)?r[typeof t=="string"?"string":"hash"]:r.map}var ko=Nw;function Bw(e){var t=ko(this,e).delete(e);return this.size-=t?1:0,t}var Cw=Bw;function Rw(e){return ko(this,e).get(e)}var Mw=Rw;function Lw(e){return ko(this,e).has(e)}var Dw=Lw;function Vw(e,t){var r=ko(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var Fw=Vw;function Tn(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])}}Tn.prototype.clear=Uw;Tn.prototype.delete=Cw;Tn.prototype.get=Mw;Tn.prototype.has=Dw;Tn.prototype.set=Fw;var Uo=Tn,zw="Expected a function";function _s(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(zw);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(_s.Cache||Uo),r}_s.Cache=Uo;var Gw=_s,Kw=500;function Hw(e){var t=Gw(e,function(n){return r.size===Kw&&r.clear(),n}),r=t.cache;return t}var qw=Hw,Ww=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Jw=/\\(\\)?/g,Xw=qw(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Ww,function(r,n,i,a){t.push(i?a.replace(Jw,"$1"):n||r)}),t}),Yw=Xw;function Qw(e){return e==null?"":cb(e)}var Zw=Qw;function e1(e,t){return zt(e)?e:ws(e,t)?[e]:Yw(Zw(e))}var Yf=e1,t1=1/0;function r1(e){if(typeof e=="string"||ei(e))return e;var t=e+"";return t=="0"&&1/e==-t1?"-0":t}var jo=r1;function n1(e,t){t=Yf(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[jo(t[r++])];return r&&r==n?e:void 0}var Qf=n1;function i1(e,t,r){var n=e==null?void 0:Qf(e,t);return n===void 0?r:n}var o1=i1;function a1(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var s1=a1;function u1(){this.__data__=new $o,this.size=0}var c1=u1;function l1(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var f1=l1;function d1(e){return this.__data__.get(e)}var p1=d1;function h1(e){return this.__data__.has(e)}var y1=h1,m1=200;function g1(e,t){var r=this.__data__;if(r instanceof $o){var n=r.__data__;if(!ri||n.length<m1-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Uo(n)}return r.set(e,t),this.size=r.size,this}var v1=g1;function xn(e){var t=this.__data__=new $o(e);this.size=t.size}xn.prototype.clear=c1;xn.prototype.delete=f1;xn.prototype.get=p1;xn.prototype.has=y1;xn.prototype.set=v1;var so=xn;function b1(e,t){for(var r=-1,n=e==null?0:e.length,i=0,a=[];++r<n;){var o=e[r];t(o,r,e)&&(a[i++]=o)}return a}var w1=b1;function _1(){return[]}var T1=_1,x1=Object.prototype,O1=x1.propertyIsEnumerable,ml=Object.getOwnPropertySymbols,E1=ml?function(e){return e==null?[]:(e=Object(e),w1(ml(e),function(t){return O1.call(e,t)}))}:T1,A1=E1;function I1(e,t,r){var n=t(e);return zt(e)?n:s1(n,r(e))}var S1=I1;function $1(e){return S1(e,Xf,A1)}var gl=$1,k1=bn(Gt,"DataView"),ts=k1,U1=bn(Gt,"Promise"),rs=U1,j1=bn(Gt,"Set"),ns=j1,vl="[object Map]",P1="[object Object]",bl="[object Promise]",wl="[object Set]",_l="[object WeakMap]",Tl="[object DataView]",N1=Mr(ts),B1=Mr(ri),C1=Mr(rs),R1=Mr(ns),M1=Mr(Za),Ir=vn;(ts&&Ir(new ts(new ArrayBuffer(1)))!=Tl||ri&&Ir(new ri)!=vl||rs&&Ir(rs.resolve())!=bl||ns&&Ir(new ns)!=wl||Za&&Ir(new Za)!=_l)&&(Ir=function(e){var t=vn(e),r=t==P1?e.constructor:void 0,n=r?Mr(r):"";if(n)switch(n){case N1:return Tl;case B1:return vl;case C1:return bl;case R1:return wl;case M1:return _l}return t});var xl=Ir,L1=Gt.Uint8Array,Ol=L1,D1="__lodash_hash_undefined__";function V1(e){return this.__data__.set(e,D1),this}var F1=V1;function z1(e){return this.__data__.has(e)}var G1=z1;function mo(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Uo;++t<r;)this.add(e[t])}mo.prototype.add=mo.prototype.push=F1;mo.prototype.has=G1;var K1=mo;function H1(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 q1=H1;function W1(e,t){return e.has(t)}var J1=W1,X1=1,Y1=2;function Q1(e,t,r,n,i,a){var o=r&X1,u=e.length,l=t.length;if(u!=l&&!(o&&l>u))return!1;var c=a.get(e),m=a.get(t);if(c&&m)return c==t&&m==e;var g=-1,R=!0,j=r&Y1?new K1:void 0;for(a.set(e,t),a.set(t,e);++g<u;){var G=e[g],Z=t[g];if(n)var ae=o?n(Z,G,g,t,e,a):n(G,Z,g,e,t,a);if(ae!==void 0){if(ae)continue;R=!1;break}if(j){if(!q1(t,function(B,V){if(!J1(j,V)&&(G===B||i(G,B,r,n,a)))return j.push(V)})){R=!1;break}}else if(!(G===Z||i(G,Z,r,n,a))){R=!1;break}}return a.delete(e),a.delete(t),R}var Zf=Q1;function Z1(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var e_=Z1;function t_(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var r_=t_,n_=1,i_=2,o_="[object Boolean]",a_="[object Date]",s_="[object Error]",u_="[object Map]",c_="[object Number]",l_="[object RegExp]",f_="[object Set]",d_="[object String]",p_="[object Symbol]",h_="[object ArrayBuffer]",y_="[object DataView]",El=sr?sr.prototype:void 0,La=El?El.valueOf:void 0;function m_(e,t,r,n,i,a,o){switch(r){case y_:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case h_:return!(e.byteLength!=t.byteLength||!a(new Ol(e),new Ol(t)));case o_:case a_:case c_:return Gf(+e,+t);case s_:return e.name==t.name&&e.message==t.message;case l_:case d_:return e==t+"";case u_:var u=e_;case f_:var l=n&n_;if(u||(u=r_),e.size!=t.size&&!l)return!1;var c=o.get(e);if(c)return c==t;n|=i_,o.set(e,t);var m=Zf(u(e),u(t),n,i,a,o);return o.delete(e),m;case p_:if(La)return La.call(e)==La.call(t)}return!1}var g_=m_,v_=1,b_=Object.prototype,w_=b_.hasOwnProperty;function __(e,t,r,n,i,a){var o=r&v_,u=gl(e),l=u.length,c=gl(t),m=c.length;if(l!=m&&!o)return!1;for(var g=l;g--;){var R=u[g];if(!(o?R in t:w_.call(t,R)))return!1}var j=a.get(e),G=a.get(t);if(j&&G)return j==t&&G==e;var Z=!0;a.set(e,t),a.set(t,e);for(var ae=o;++g<l;){R=u[g];var B=e[R],V=t[R];if(n)var q=o?n(V,B,R,t,e,a):n(B,V,R,e,t,a);if(!(q===void 0?B===V||i(B,V,r,n,a):q)){Z=!1;break}ae||(ae=R=="constructor")}if(Z&&!ae){var se=e.constructor,F=t.constructor;se!=F&&"constructor"in e&&"constructor"in t&&!(typeof se=="function"&&se instanceof se&&typeof F=="function"&&F instanceof F)&&(Z=!1)}return a.delete(e),a.delete(t),Z}var T_=__,x_=1,Al="[object Arguments]",Il="[object Array]",no="[object Object]",O_=Object.prototype,Sl=O_.hasOwnProperty;function E_(e,t,r,n,i,a){var o=zt(e),u=zt(t),l=o?Il:xl(e),c=u?Il:xl(t);l=l==Al?no:l,c=c==Al?no:c;var m=l==no,g=c==no,R=l==c;if(R&&es(e)){if(!es(t))return!1;o=!0,m=!1}if(R&&!m)return a||(a=new so),o||Jf(e)?Zf(e,t,r,n,i,a):g_(e,t,l,r,n,i,a);if(!(r&x_)){var j=m&&Sl.call(e,"__wrapped__"),G=g&&Sl.call(t,"__wrapped__");if(j||G){var Z=j?e.value():e,ae=G?t.value():t;return a||(a=new so),i(Z,ae,r,n,a)}}return R?(a||(a=new so),T_(e,t,r,n,i,a)):!1}var A_=E_;function ed(e,t,r,n,i){return e===t?!0:e==null||t==null||!fn(e)&&!fn(t)?e!==e&&t!==t:A_(e,t,r,n,ed,i)}var td=ed,I_=1,S_=2;function $_(e,t,r,n){var i=r.length,a=i,o=!n;if(e==null)return!a;for(e=Object(e);i--;){var u=r[i];if(o&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++i<a;){u=r[i];var l=u[0],c=e[l],m=u[1];if(o&&u[2]){if(c===void 0&&!(l in e))return!1}else{var g=new so;if(n)var R=n(c,m,l,e,t,g);if(!(R===void 0?td(m,c,I_|S_,n,g):R))return!1}}return!0}var k_=$_;function U_(e){return e===e&&!vs(e)}var rd=U_;function j_(e){for(var t=Xf(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,rd(i)]}return t}var P_=j_;function N_(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var nd=N_;function B_(e){var t=P_(e);return t.length==1&&t[0][2]?nd(t[0][0],t[0][1]):function(r){return r===e||k_(r,e,t)}}var C_=B_;function R_(e,t){return e!=null&&t in Object(e)}var M_=R_;function L_(e,t,r){t=Yf(t,e);for(var n=-1,i=t.length,a=!1;++n<i;){var o=jo(t[n]);if(!(a=e!=null&&r(e,o)))break;e=e[o]}return a||++n!=i?a:(i=e==null?0:e.length,!!i&&bs(i)&&zf(o,i)&&(zt(e)||Hf(e)))}var D_=L_;function V_(e,t){return e!=null&&D_(e,t,M_)}var F_=V_,z_=1,G_=2;function K_(e,t){return ws(e)&&rd(t)?nd(jo(e),t):function(r){var n=o1(r,e);return n===void 0&&n===t?F_(r,e):td(t,n,z_|G_)}}var H_=K_;function q_(e){return function(t){return t?.[e]}}var W_=q_;function J_(e){return function(t){return Qf(t,e)}}var X_=J_;function Y_(e){return ws(e)?W_(jo(e)):X_(e)}var Q_=Y_;function Z_(e){return typeof e=="function"?e:e==null?db:typeof e=="object"?zt(e)?H_(e[0],e[1]):C_(e):Q_(e)}var eT=Z_,tT=4294967295,rT=tT-1,nT=Math.floor,iT=Math.min;function oT(e,t,r,n){var i=0,a=e==null?0:e.length;if(a===0)return 0;t=r(t);for(var o=t!==t,u=t===null,l=ei(t),c=t===void 0;i<a;){var m=nT((i+a)/2),g=r(e[m]),R=g!==void 0,j=g===null,G=g===g,Z=ei(g);if(o)var ae=n||G;else c?ae=G&&(n||R):u?ae=G&&R&&(n||!j):l?ae=G&&R&&!j&&(n||!Z):j||Z?ae=!1:ae=n?g<=t:g<t;ae?i=m+1:a=m}return iT(a,rT)}var aT=oT;function sT(e,t,r){return aT(e,t,eT(r,2))}var uT=sT,{WARN:cT,LOG:ZE,DEBUG:lT,VERBOSE:Hn,ERROR:$l}=Oe.setup(Oe.INFO),yi=class extends Io{constructor(e,t,r,n,i){super(e,t,Ne.array([...r],{deep:!1,name:`${i}.array`}),i),this._initialLogs=r,this._eventMapper=n,this.name=i,$t(this,"_parentSubscriptions",new Map),Br(this,{onParentUpdate:gt}),this.subscribeToParent()}get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}subscribeToParent(){if(this.parents.length||cT("MappedStream has no parents",this),this._parentSubscriptions.size)throw $l("parents subs must not be called twice",this);Hn(`[MappedStream: ${this.name}] subscribing to parents:`,this.parents.map(e=>e.name)),this.parents.forEach(e=>{let t=this.onParentUpdate.bind(this,e);e.subscribe(t),this._parentSubscriptions.set(e,t)})}triggerRemap(){Hn(`MappedStream{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.forEach(e=>{this.onParentUpdate(e,{init:Me(()=>$r(e.applogs))})})}onParentUpdate(e,t){Hn(`MappedStream{${this.nameAndSizeUntracked}} parentUpdate`,t);let r=this._eventMapper(t,e);if(Hn(`MappedStream{${this.nameAndSizeUntracked}} parentUpdate => mapped`,r),Ct(r))this._applogs.replace([...r.init]);else{for(let n of r.added)this._applogs.splice(uT(this._applogs,n,"ts"),0,n);if(r.removed){for(let n of r.removed)if(!this._applogs.remove(n))if(!Ct(t)&&t.removed?.includes(n))lT("Ignoring remove event for non-existent because it was part of parent event's removed",n,t);else throw $l(`MappedStream{${this.name}} toRemove contained log that doesn't exist`,n,{stream:this,event:t,mapResult:r})}}Hn(`MappedStream{${this.nameAndSizeUntracked}} parentUpdate => deps?`,Yn(this._applogs)),this.notifySubscribers(r)}},{WARN:eA,LOG:tA,DEBUG:rA,VERBOSE:Da,ERROR:fT}=Oe.setup(Oe.INFO),dr=Ye(function(e,t,r={}){let n=id(t),i=is(n),a=Ne.array(Me(()=>i(e.applogs)),{deep:!1,name:`${e.name} | ${r.name||`rollingFilter.array{${vt(n)}}`}`}),o=m=>{let g;return Ct(m)?g={init:i(m.init)}:g={added:i(m.added),removed:m.removed},Da(`rollingFilter{${e.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,n,m,"=>",g),g},u=new yi(e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],a,o,`${e.name} | ${r.name||`rollingFilter{${vt(n)}}`}`),l=ov(()=>JSON.parse(JSON.stringify(t)),m=>{Da(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,n,"=>",m),n=m,i=is(n),u.triggerRemap()}),c=li(a,()=>{Da(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} unobserve`,n),l(),c()});return u},{equals:gn,argsDebugName:(e,t,r)=>`${vt(t)}, ${vt(r)}`}),Ts=Ye(function(e,t,r={}){let n=Me(()=>t.call(null,{init:e.applogs},e));if(!Ct(n))throw fT("Initial run must return init event");let i=n.init;return new yi(e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],i,t,`${e.name} | ${r.name||"rollingMapper"}`)},{equals:gn,argsDebugName:(e,t,r)=>`${vt(t)}, ${vt(r)}`}),dT=Ye(function(e,t,r){return r=gt(r),r({init:e.applogs},t),e.subscribe(n=>{r(n,t)}),t},{argsDebugName:e=>`rollingAcc{${e.nameAndSizeUntracked}}`}),id=function(e){let t=Me(()=>Object.fromEntries(Object.entries($r(e)).map(([r,n])=>[$r(r),$r(n)])));if(!Object.entries(t).length)throw new Error("Pattern is empty");return t};function is(e){return t=>t.filter(r=>{for(let[n,i]of Object.entries(e)){let a=r[n.startsWith("!")?n.slice(1):n];if(!Bf(n,i,a))return!1}return!0})}var Lr=Re(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(f){let _=new Map;function E(){return new Map(_)}f.Entries=E;function k(){return _.clear()}f.Clear=k;function S(w){return _.delete(w)}f.Delete=S;function $(w){return _.has(w)}f.Has=$;function h(w,s){_.set(w,s)}f.Set=h;function A(w){return _.get(w)}f.Get=A})(t||(e.TypeRegistry=t={}));var r=class extends Error{constructor(f){super(f)}};e.TypeBoxError=r;var n;(function(f){let _=new Map;function E(){return new Map(_)}f.Entries=E;function k(){return _.clear()}f.Clear=k;function S(w){return _.delete(w)}f.Delete=S;function $(w){return _.has(w)}f.Has=$;function h(w,s){_.set(w,s)}f.Set=h;function A(w){return _.get(w)}f.Get=A})(n||(e.FormatRegistry=n={}));var i;(function(f){function _(b){return Array.isArray(b)}f.IsArray=_;function E(b){return typeof b=="bigint"}f.IsBigInt=E;function k(b){return typeof b=="boolean"}f.IsBoolean=k;function S(b){return b instanceof globalThis.Date}f.IsDate=S;function $(b){return b===null}f.IsNull=$;function h(b){return typeof b=="number"}f.IsNumber=h;function A(b){return typeof b=="object"&&b!==null}f.IsObject=A;function w(b){return typeof b=="string"}f.IsString=w;function s(b){return b instanceof globalThis.Uint8Array}f.IsUint8Array=s;function T(b){return b===void 0}f.IsUndefined=T})(i||(e.ValueGuard=i={}));var a=class extends r{};e.TypeGuardUnknownTypeError=a;var o;(function(f){function _(y){try{return new RegExp(y),!0}catch{return!1}}function E(y){if(!i.IsString(y))return!1;for(let $e=0;$e<y.length;$e++){let ut=y.charCodeAt($e);if(ut>=7&&ut<=13||ut===27||ut===127)return!1}return!0}function k(y){return h(y)||De(y)}function S(y){return i.IsUndefined(y)||i.IsBigInt(y)}function $(y){return i.IsUndefined(y)||i.IsNumber(y)}function h(y){return i.IsUndefined(y)||i.IsBoolean(y)}function A(y){return i.IsUndefined(y)||i.IsString(y)}function w(y){return i.IsUndefined(y)||i.IsString(y)&&E(y)&&_(y)}function s(y){return i.IsUndefined(y)||i.IsString(y)&&E(y)}function T(y){return i.IsUndefined(y)||De(y)}function b(y){return be(y,"Any")&&A(y.$id)}f.TAny=b;function v(y){return be(y,"Array")&&y.type==="array"&&A(y.$id)&&De(y.items)&&$(y.minItems)&&$(y.maxItems)&&h(y.uniqueItems)&&T(y.contains)&&$(y.minContains)&&$(y.maxContains)}f.TArray=v;function U(y){return be(y,"AsyncIterator")&&y.type==="AsyncIterator"&&A(y.$id)&&De(y.items)}f.TAsyncIterator=U;function L(y){return be(y,"BigInt")&&y.type==="bigint"&&A(y.$id)&&S(y.exclusiveMaximum)&&S(y.exclusiveMinimum)&&S(y.maximum)&&S(y.minimum)&&S(y.multipleOf)}f.TBigInt=L;function J(y){return be(y,"Boolean")&&y.type==="boolean"&&A(y.$id)}f.TBoolean=J;function ee(y){return be(y,"Constructor")&&y.type==="Constructor"&&A(y.$id)&&i.IsArray(y.parameters)&&y.parameters.every($e=>De($e))&&De(y.returns)}f.TConstructor=ee;function ye(y){return be(y,"Date")&&y.type==="Date"&&A(y.$id)&&$(y.exclusiveMaximumTimestamp)&&$(y.exclusiveMinimumTimestamp)&&$(y.maximumTimestamp)&&$(y.minimumTimestamp)&&$(y.multipleOfTimestamp)}f.TDate=ye;function we(y){return be(y,"Function")&&y.type==="Function"&&A(y.$id)&&i.IsArray(y.parameters)&&y.parameters.every($e=>De($e))&&De(y.returns)}f.TFunction=we;function je(y){return be(y,"Integer")&&y.type==="integer"&&A(y.$id)&&$(y.exclusiveMaximum)&&$(y.exclusiveMinimum)&&$(y.maximum)&&$(y.minimum)&&$(y.multipleOf)}f.TInteger=je;function Be(y){return be(y,"Intersect")&&!(i.IsString(y.type)&&y.type!=="object")&&i.IsArray(y.allOf)&&y.allOf.every($e=>De($e)&&!En($e))&&A(y.type)&&(h(y.unevaluatedProperties)||T(y.unevaluatedProperties))&&A(y.$id)}f.TIntersect=Be;function hr(y){return be(y,"Iterator")&&y.type==="Iterator"&&A(y.$id)&&De(y.items)}f.TIterator=hr;function be(y,$e){return Kt(y)&&y[e.Kind]===$e}f.TKindOf=be;function Kt(y){return i.IsObject(y)&&e.Kind in y&&i.IsString(y[e.Kind])}f.TKind=Kt;function yr(y){return I(y)&&i.IsString(y.const)}f.TLiteralString=yr;function x(y){return I(y)&&i.IsNumber(y.const)}f.TLiteralNumber=x;function le(y){return I(y)&&i.IsBoolean(y.const)}f.TLiteralBoolean=le;function I(y){return be(y,"Literal")&&A(y.$id)&&(i.IsBoolean(y.const)||i.IsNumber(y.const)||i.IsString(y.const))}f.TLiteral=I;function ge(y){return be(y,"Never")&&i.IsObject(y.not)&&Object.getOwnPropertyNames(y.not).length===0}f.TNever=ge;function ne(y){return be(y,"Not")&&De(y.not)}f.TNot=ne;function de(y){return be(y,"Null")&&y.type==="null"&&A(y.$id)}f.TNull=de;function Ie(y){return be(y,"Number")&&y.type==="number"&&A(y.$id)&&$(y.exclusiveMaximum)&&$(y.exclusiveMinimum)&&$(y.maximum)&&$(y.minimum)&&$(y.multipleOf)}f.TNumber=Ie;function Ce(y){return be(y,"Object")&&y.type==="object"&&A(y.$id)&&i.IsObject(y.properties)&&k(y.additionalProperties)&&$(y.minProperties)&&$(y.maxProperties)&&Object.entries(y.properties).every(([$e,ut])=>E($e)&&De(ut))}f.TObject=Ce;function We(y){return be(y,"Promise")&&y.type==="Promise"&&A(y.$id)&&De(y.item)}f.TPromise=We;function Ke(y){return be(y,"Record")&&y.type==="object"&&A(y.$id)&&k(y.additionalProperties)&&i.IsObject(y.patternProperties)&&($e=>{let ut=Object.getOwnPropertyNames($e.patternProperties);return ut.length===1&&_(ut[0])&&i.IsObject($e.patternProperties)&&De($e.patternProperties[ut[0]])})(y)}f.TRecord=Ke;function Qe(y){return i.IsObject(y)&&e.Hint in y&&y[e.Hint]==="Recursive"}f.TRecursive=Qe;function Ht(y){return be(y,"Ref")&&A(y.$id)&&i.IsString(y.$ref)}f.TRef=Ht;function Fr(y){return be(y,"String")&&y.type==="string"&&A(y.$id)&&$(y.minLength)&&$(y.maxLength)&&w(y.pattern)&&s(y.format)}f.TString=Fr;function zr(y){return be(y,"Symbol")&&y.type==="symbol"&&A(y.$id)}f.TSymbol=zr;function mr(y){return be(y,"TemplateLiteral")&&y.type==="string"&&i.IsString(y.pattern)&&y.pattern[0]==="^"&&y.pattern[y.pattern.length-1]==="$"}f.TTemplateLiteral=mr;function bi(y){return be(y,"This")&&A(y.$id)&&i.IsString(y.$ref)}f.TThis=bi;function En(y){return i.IsObject(y)&&e.Transform in y}f.TTransform=En;function Le(y){return be(y,"Tuple")&&y.type==="array"&&A(y.$id)&&i.IsNumber(y.minItems)&&i.IsNumber(y.maxItems)&&y.minItems===y.maxItems&&(i.IsUndefined(y.items)&&i.IsUndefined(y.additionalItems)&&y.minItems===0||i.IsArray(y.items)&&y.items.every($e=>De($e)))}f.TTuple=Le;function wi(y){return be(y,"Undefined")&&y.type==="undefined"&&A(y.$id)}f.TUndefined=wi;function Lo(y){return gr(y)&&y.anyOf.every($e=>yr($e)||x($e))}f.TUnionLiteral=Lo;function gr(y){return be(y,"Union")&&A(y.$id)&&i.IsObject(y)&&i.IsArray(y.anyOf)&&y.anyOf.every($e=>De($e))}f.TUnion=gr;function Gr(y){return be(y,"Uint8Array")&&y.type==="Uint8Array"&&A(y.$id)&&$(y.minByteLength)&&$(y.maxByteLength)}f.TUint8Array=Gr;function Je(y){return be(y,"Unknown")&&A(y.$id)}f.TUnknown=Je;function _i(y){return be(y,"Unsafe")}f.TUnsafe=_i;function An(y){return be(y,"Void")&&y.type==="void"&&A(y.$id)}f.TVoid=An;function Do(y){return i.IsObject(y)&&y[e.Readonly]==="Readonly"}f.TReadonly=Do;function Vo(y){return i.IsObject(y)&&y[e.Optional]==="Optional"}f.TOptional=Vo;function De(y){return i.IsObject(y)&&(b(y)||v(y)||J(y)||L(y)||U(y)||ee(y)||ye(y)||we(y)||je(y)||Be(y)||hr(y)||I(y)||ge(y)||ne(y)||de(y)||Ie(y)||Ce(y)||We(y)||Ke(y)||Ht(y)||Fr(y)||zr(y)||mr(y)||bi(y)||Le(y)||wi(y)||gr(y)||Gr(y)||Je(y)||_i(y)||An(y)||Kt(y)&&t.Has(y[e.Kind]))}f.TSchema=De})(o||(e.TypeGuard=o={}));var u;(function(f){function _(E){return E[e.Kind]==="Intersect"?E.allOf.every(k=>_(k)):E[e.Kind]==="Union"?E.anyOf.some(k=>_(k)):E[e.Kind]==="Undefined"?!0:E[e.Kind]==="Not"?!_(E.not):!1}f.Check=_})(u||(e.ExtendsUndefined=u={}));var l=class extends r{};e.TypeExtendsError=l;var c;(function(f){f[f.Union=0]="Union",f[f.True=1]="True",f[f.False=2]="False"})(c||(e.TypeExtendsResult=c={}));var m;(function(f){function _(p){return p===c.False?p:c.True}function E(p){throw new l(p)}function k(p){return o.TNever(p)||o.TIntersect(p)||o.TUnion(p)||o.TUnknown(p)||o.TAny(p)}function S(p,d){return o.TNever(d)?be(p,d):o.TIntersect(d)?we(p,d):o.TUnion(d)?Fo(p,d):o.TUnknown(d)?ks(p,d):o.TAny(d)?$(p,d):E("StructuralRight")}function $(p,d){return c.True}function h(p,d){return o.TIntersect(d)?we(p,d):o.TUnion(d)&&d.anyOf.some(Te=>o.TAny(Te)||o.TUnknown(Te))?c.True:o.TUnion(d)?c.Union:o.TUnknown(d)||o.TAny(d)?c.True:c.Union}function A(p,d){return o.TUnknown(p)?c.False:o.TAny(p)?c.Union:o.TNever(p)?c.True:c.False}function w(p,d){return o.TObject(d)&&mr(d)?c.True:k(d)?S(p,d):o.TArray(d)?_(ke(p.items,d.items)):c.False}function s(p,d){return k(d)?S(p,d):o.TAsyncIterator(d)?_(ke(p.items,d.items)):c.False}function T(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TBigInt(d)?c.True:c.False}function b(p,d){return o.TLiteral(p)&&i.IsBoolean(p.const)||o.TBoolean(p)?c.True:c.False}function v(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TBoolean(d)?c.True:c.False}function U(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TConstructor(d)?p.parameters.length>d.parameters.length?c.False:p.parameters.every((Te,Rt)=>_(ke(d.parameters[Rt],Te))===c.True)?_(ke(p.returns,d.returns)):c.False:c.False}function L(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TDate(d)?c.True:c.False}function J(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TFunction(d)?p.parameters.length>d.parameters.length?c.False:p.parameters.every((Te,Rt)=>_(ke(d.parameters[Rt],Te))===c.True)?_(ke(p.returns,d.returns)):c.False:c.False}function ee(p,d){return o.TLiteral(p)&&i.IsNumber(p.const)||o.TNumber(p)||o.TInteger(p)?c.True:c.False}function ye(p,d){return o.TInteger(d)||o.TNumber(d)?c.True:k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):c.False}function we(p,d){return d.allOf.every(Te=>ke(p,Te)===c.True)?c.True:c.False}function je(p,d){return p.allOf.some(Te=>ke(Te,d)===c.True)?c.True:c.False}function Be(p,d){return k(d)?S(p,d):o.TIterator(d)?_(ke(p.items,d.items)):c.False}function hr(p,d){return o.TLiteral(d)&&d.const===p.const?c.True:k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TString(d)?An(p,d):o.TNumber(d)?I(p,d):o.TInteger(d)?ee(p,d):o.TBoolean(d)?b(p,d):c.False}function be(p,d){return c.False}function Kt(p,d){return c.True}function yr(p){let[d,Te]=[p,0];for(;o.TNot(d);)d=d.not,Te+=1;return Te%2===0?d:e.Type.Unknown()}function x(p,d){return o.TNot(p)?ke(yr(p),d):o.TNot(d)?ke(p,yr(d)):E("Invalid fallthrough for Not")}function le(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TNull(d)?c.True:c.False}function I(p,d){return o.TLiteralNumber(p)||o.TNumber(p)||o.TInteger(p)?c.True:c.False}function ge(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TInteger(d)||o.TNumber(d)?c.True:c.False}function ne(p,d){return Object.getOwnPropertyNames(p.properties).length===d}function de(p){return mr(p)}function Ie(p){return ne(p,0)||ne(p,1)&&"description"in p.properties&&o.TUnion(p.properties.description)&&p.properties.description.anyOf.length===2&&(o.TString(p.properties.description.anyOf[0])&&o.TUndefined(p.properties.description.anyOf[1])||o.TString(p.properties.description.anyOf[1])&&o.TUndefined(p.properties.description.anyOf[0]))}function Ce(p){return ne(p,0)}function We(p){return ne(p,0)}function Ke(p){return ne(p,0)}function Qe(p){return ne(p,0)}function Ht(p){return mr(p)}function Fr(p){let d=e.Type.Number();return ne(p,0)||ne(p,1)&&"length"in p.properties&&_(ke(p.properties.length,d))===c.True}function zr(p){return ne(p,0)}function mr(p){let d=e.Type.Number();return ne(p,0)||ne(p,1)&&"length"in p.properties&&_(ke(p.properties.length,d))===c.True}function bi(p){let d=e.Type.Function([e.Type.Any()],e.Type.Any());return ne(p,0)||ne(p,1)&&"then"in p.properties&&_(ke(p.properties.then,d))===c.True}function En(p,d){return ke(p,d)===c.False||o.TOptional(p)&&!o.TOptional(d)?c.False:c.True}function Le(p,d){return o.TUnknown(p)?c.False:o.TAny(p)?c.Union:o.TNever(p)||o.TLiteralString(p)&&de(d)||o.TLiteralNumber(p)&&Ce(d)||o.TLiteralBoolean(p)&&We(d)||o.TSymbol(p)&&Ie(d)||o.TBigInt(p)&&Ke(d)||o.TString(p)&&de(d)||o.TSymbol(p)&&Ie(d)||o.TNumber(p)&&Ce(d)||o.TInteger(p)&&Ce(d)||o.TBoolean(p)&&We(d)||o.TUint8Array(p)&&Ht(d)||o.TDate(p)&&Qe(d)||o.TConstructor(p)&&zr(d)||o.TFunction(p)&&Fr(d)?c.True:o.TRecord(p)&&o.TString(gr(p))?d[e.Hint]==="Record"?c.True:c.False:o.TRecord(p)&&o.TNumber(gr(p))&&ne(d,0)?c.True:c.False}function wi(p,d){return k(d)?S(p,d):o.TRecord(d)?Je(p,d):o.TObject(d)?(()=>{for(let Te of Object.getOwnPropertyNames(d.properties)){if(!(Te in p.properties)&&!o.TOptional(d.properties[Te]))return c.False;if(o.TOptional(d.properties[Te]))return c.True;if(En(p.properties[Te],d.properties[Te])===c.False)return c.False}return c.True})():c.False}function Lo(p,d){return k(d)?S(p,d):o.TObject(d)&&bi(d)?c.True:o.TPromise(d)?_(ke(p.item,d.item)):c.False}function gr(p){return e.PatternNumberExact in p.patternProperties?e.Type.Number():e.PatternStringExact in p.patternProperties?e.Type.String():E("Unknown record key pattern")}function Gr(p){return e.PatternNumberExact in p.patternProperties?p.patternProperties[e.PatternNumberExact]:e.PatternStringExact in p.patternProperties?p.patternProperties[e.PatternStringExact]:E("Unable to get record value schema")}function Je(p,d){let[Te,Rt]=[gr(d),Gr(d)];return o.TLiteralString(p)&&o.TNumber(Te)&&_(ke(p,Rt))===c.True?c.True:o.TUint8Array(p)&&o.TNumber(Te)||o.TString(p)&&o.TNumber(Te)||o.TArray(p)&&o.TNumber(Te)?ke(p,Rt):o.TObject(p)?(()=>{for(let Kd of Object.getOwnPropertyNames(p.properties))if(En(Rt,p.properties[Kd])===c.False)return c.False;return c.True})():c.False}function _i(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?ke(Gr(p),Gr(d)):c.False}function An(p,d){return o.TLiteral(p)&&i.IsString(p.const)||o.TString(p)?c.True:c.False}function Do(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TString(d)?c.True:c.False}function Vo(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TSymbol(d)?c.True:c.False}function De(p,d){return o.TTemplateLiteral(p)?ke(F.Resolve(p),d):o.TTemplateLiteral(d)?ke(p,F.Resolve(d)):E("Invalid fallthrough for TemplateLiteral")}function y(p,d){return o.TArray(d)&&p.items!==void 0&&p.items.every(Te=>ke(Te,d.items)===c.True)}function $e(p,d){return o.TNever(p)?c.True:o.TUnknown(p)?c.False:o.TAny(p)?c.Union:c.False}function ut(p,d){return k(d)?S(p,d):o.TObject(d)&&mr(d)||o.TArray(d)&&y(p,d)?c.True:o.TTuple(d)?i.IsUndefined(p.items)&&!i.IsUndefined(d.items)||!i.IsUndefined(p.items)&&i.IsUndefined(d.items)?c.False:i.IsUndefined(p.items)&&!i.IsUndefined(d.items)||p.items.every((Te,Rt)=>ke(Te,d.items[Rt])===c.True)?c.True:c.False:c.False}function Md(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TUint8Array(d)?c.True:c.False}function Ld(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TVoid(d)?Fd(p,d):o.TUndefined(d)?c.True:c.False}function Fo(p,d){return d.anyOf.some(Te=>ke(p,Te)===c.True)?c.True:c.False}function Dd(p,d){return p.anyOf.every(Te=>ke(Te,d)===c.True)?c.True:c.False}function ks(p,d){return c.True}function Vd(p,d){return o.TNever(d)?be(p,d):o.TIntersect(d)?we(p,d):o.TUnion(d)?Fo(p,d):o.TAny(d)?$(p,d):o.TString(d)?An(p,d):o.TNumber(d)?I(p,d):o.TInteger(d)?ee(p,d):o.TBoolean(d)?b(p,d):o.TArray(d)?A(p,d):o.TTuple(d)?$e(p,d):o.TObject(d)?Le(p,d):o.TUnknown(d)?c.True:c.False}function Fd(p,d){return o.TUndefined(p)||o.TUndefined(p)?c.True:c.False}function zd(p,d){return o.TIntersect(d)?we(p,d):o.TUnion(d)?Fo(p,d):o.TUnknown(d)?ks(p,d):o.TAny(d)?$(p,d):o.TObject(d)?Le(p,d):o.TVoid(d)?c.True:c.False}function ke(p,d){return o.TTemplateLiteral(p)||o.TTemplateLiteral(d)?De(p,d):o.TNot(p)||o.TNot(d)?x(p,d):o.TAny(p)?h(p,d):o.TArray(p)?w(p,d):o.TBigInt(p)?T(p,d):o.TBoolean(p)?v(p,d):o.TAsyncIterator(p)?s(p,d):o.TConstructor(p)?U(p,d):o.TDate(p)?L(p,d):o.TFunction(p)?J(p,d):o.TInteger(p)?ye(p,d):o.TIntersect(p)?je(p,d):o.TIterator(p)?Be(p,d):o.TLiteral(p)?hr(p,d):o.TNever(p)?Kt(p,d):o.TNull(p)?le(p,d):o.TNumber(p)?ge(p,d):o.TObject(p)?wi(p,d):o.TRecord(p)?_i(p,d):o.TString(p)?Do(p,d):o.TSymbol(p)?Vo(p,d):o.TTuple(p)?ut(p,d):o.TPromise(p)?Lo(p,d):o.TUint8Array(p)?Md(p,d):o.TUndefined(p)?Ld(p,d):o.TUnion(p)?Dd(p,d):o.TUnknown(p)?Vd(p,d):o.TVoid(p)?zd(p,d):E(`Unknown left type operand '${p[e.Kind]}'`)}function Gd(p,d){return ke(p,d)}f.Extends=Gd})(m||(e.TypeExtends=m={}));var g;(function(f){function _(w){return w.map(s=>$(s))}function E(w){return new Date(w.getTime())}function k(w){return new Uint8Array(w)}function S(w){let s=Object.getOwnPropertyNames(w).reduce((b,v)=>({...b,[v]:$(w[v])}),{}),T=Object.getOwnPropertySymbols(w).reduce((b,v)=>({...b,[v]:$(w[v])}),{});return{...s,...T}}function $(w){return i.IsArray(w)?_(w):i.IsDate(w)?E(w):i.IsUint8Array(w)?k(w):i.IsObject(w)?S(w):w}function h(w){return w.map(s=>A(s))}f.Rest=h;function A(w,s={}){return{...$(w),...s}}f.Type=A})(g||(e.TypeClone=g={}));var R;(function(f){function _(U){return U.map(L=>{let{[e.Optional]:J,...ee}=g.Type(L);return ee})}function E(U){return U.every(L=>o.TOptional(L))}function k(U){return U.some(L=>o.TOptional(L))}function S(U){return E(U.allOf)?e.Type.Optional(e.Type.Intersect(_(U.allOf))):U}function $(U){return k(U.anyOf)?e.Type.Optional(e.Type.Union(_(U.anyOf))):U}function h(U){return U[e.Kind]==="Intersect"?S(U):U[e.Kind]==="Union"?$(U):U}function A(U,L){let J=U.allOf.reduce((ee,ye)=>{let we=b(ye,L);return we[e.Kind]==="Never"?ee:[...ee,we]},[]);return h(e.Type.Intersect(J))}function w(U,L){let J=U.anyOf.map(ee=>b(ee,L));return h(e.Type.Union(J))}function s(U,L){let J=U.properties[L];return i.IsUndefined(J)?e.Type.Never():e.Type.Union([J])}function T(U,L){let J=U.items;if(i.IsUndefined(J))return e.Type.Never();let ee=J[L];return i.IsUndefined(ee)?e.Type.Never():ee}function b(U,L){return U[e.Kind]==="Intersect"?A(U,L):U[e.Kind]==="Union"?w(U,L):U[e.Kind]==="Object"?s(U,L):U[e.Kind]==="Tuple"?T(U,L):e.Type.Never()}function v(U,L,J={}){let ee=L.map(ye=>b(U,ye.toString()));return h(e.Type.Union(ee,J))}f.Resolve=v})(R||(e.IndexedAccessor=R={}));var j;(function(f){function _(T){let[b,v]=[T.slice(0,1),T.slice(1)];return`${b.toLowerCase()}${v}`}function E(T){let[b,v]=[T.slice(0,1),T.slice(1)];return`${b.toUpperCase()}${v}`}function k(T){return T.toUpperCase()}function S(T){return T.toLowerCase()}function $(T,b){let v=z.ParseExact(T.pattern);if(!M.Check(v))return{...T,pattern:h(T.pattern,b)};let U=[...C.Generate(v)].map(ee=>e.Type.Literal(ee)),L=A(U,b),J=e.Type.Union(L);return e.Type.TemplateLiteral([J])}function h(T,b){return typeof T=="string"?b==="Uncapitalize"?_(T):b==="Capitalize"?E(T):b==="Uppercase"?k(T):b==="Lowercase"?S(T):T:T.toString()}function A(T,b){if(T.length===0)return[];let[v,...U]=T;return[s(v,b),...A(U,b)]}function w(T,b){return o.TTemplateLiteral(T)?$(T,b):o.TUnion(T)?e.Type.Union(A(T.anyOf,b)):o.TLiteral(T)?e.Type.Literal(h(T.const,b)):T}function s(T,b){return w(T,b)}f.Map=s})(j||(e.Intrinsic=j={}));var G;(function(f){function _(h,A){return e.Type.Intersect(h.allOf.map(w=>S(w,A)),{...h})}function E(h,A){return e.Type.Union(h.anyOf.map(w=>S(w,A)),{...h})}function k(h,A){return A(h)}function S(h,A){return h[e.Kind]==="Intersect"?_(h,A):h[e.Kind]==="Union"?E(h,A):h[e.Kind]==="Object"?k(h,A):h}function $(h,A,w){return{...S(g.Type(h),A),...w}}f.Map=$})(G||(e.ObjectMap=G={}));var Z;(function(f){function _(s){return s[0]==="^"&&s[s.length-1]==="$"?s.slice(1,s.length-1):s}function E(s,T){return s.allOf.reduce((b,v)=>[...b,...h(v,T)],[])}function k(s,T){let b=s.anyOf.map(v=>h(v,T));return[...b.reduce((v,U)=>U.map(L=>b.every(J=>J.includes(L))?v.add(L):v)[0],new Set)]}function S(s,T){return Object.getOwnPropertyNames(s.properties)}function $(s,T){return T.includePatterns?Object.getOwnPropertyNames(s.patternProperties):[]}function h(s,T){return o.TIntersect(s)?E(s,T):o.TUnion(s)?k(s,T):o.TObject(s)?S(s,T):o.TRecord(s)?$(s,T):[]}function A(s,T){return[...new Set(h(s,T))]}f.ResolveKeys=A;function w(s){return`^(${A(s,{includePatterns:!0}).map(T=>`(${_(T)})`).join("|")})$`}f.ResolvePattern=w})(Z||(e.KeyResolver=Z={}));var ae=class extends r{};e.KeyArrayResolverError=ae;var B;(function(f){function _(E){return Array.isArray(E)?E:o.TUnionLiteral(E)?E.anyOf.map(k=>k.const.toString()):o.TLiteral(E)?[E.const]:o.TTemplateLiteral(E)?(()=>{let k=z.ParseExact(E.pattern);if(!M.Check(k))throw new ae("Cannot resolve keys from infinite template expression");return[...C.Generate(k)]})():[]}f.Resolve=_})(B||(e.KeyArrayResolver=B={}));var V;(function(f){function*_(k){for(let S of k.anyOf)S[e.Kind]==="Union"?yield*_(S):yield S}function E(k){return e.Type.Union([..._(k)],{...k})}f.Resolve=E})(V||(e.UnionResolver=V={}));var q=class extends r{};e.TemplateLiteralPatternError=q;var se;(function(f){function _($){throw new q($)}function E($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function k($,h){return o.TTemplateLiteral($)?$.pattern.slice(1,$.pattern.length-1):o.TUnion($)?`(${$.anyOf.map(A=>k(A,h)).join("|")})`:o.TNumber($)?`${h}${e.PatternNumber}`:o.TInteger($)?`${h}${e.PatternNumber}`:o.TBigInt($)?`${h}${e.PatternNumber}`:o.TString($)?`${h}${e.PatternString}`:o.TLiteral($)?`${h}${E($.const.toString())}`:o.TBoolean($)?`${h}${e.PatternBoolean}`:_(`Unexpected Kind '${$[e.Kind]}'`)}function S($){return`^${$.map(h=>k(h,"")).join("")}$`}f.Create=S})(se||(e.TemplateLiteralPattern=se={}));var F;(function(f){function _(E){let k=z.ParseExact(E.pattern);if(!M.Check(k))return e.Type.String();let S=[...C.Generate(k)].map($=>e.Type.Literal($));return e.Type.Union(S)}f.Resolve=_})(F||(e.TemplateLiteralResolver=F={}));var ue=class extends r{};e.TemplateLiteralParserError=ue;var z;(function(f){function _(U,L,J){return U[L]===J&&U.charCodeAt(L-1)!==92}function E(U,L){return _(U,L,"(")}function k(U,L){return _(U,L,")")}function S(U,L){return _(U,L,"|")}function $(U){if(!(E(U,0)&&k(U,U.length-1)))return!1;let L=0;for(let J=0;J<U.length;J++)if(E(U,J)&&(L+=1),k(U,J)&&(L-=1),L===0&&J!==U.length-1)return!1;return!0}function h(U){return U.slice(1,U.length-1)}function A(U){let L=0;for(let J=0;J<U.length;J++)if(E(U,J)&&(L+=1),k(U,J)&&(L-=1),S(U,J)&&L===0)return!0;return!1}function w(U){for(let L=0;L<U.length;L++)if(E(U,L))return!0;return!1}function s(U){let[L,J]=[0,0],ee=[];for(let we=0;we<U.length;we++)if(E(U,we)&&(L+=1),k(U,we)&&(L-=1),S(U,we)&&L===0){let je=U.slice(J,we);je.length>0&&ee.push(b(je)),J=we+1}let ye=U.slice(J);return ye.length>0&&ee.push(b(ye)),ee.length===0?{type:"const",const:""}:ee.length===1?ee[0]:{type:"or",expr:ee}}function T(U){function L(ye,we){if(!E(ye,we))throw new ue("TemplateLiteralParser: Index must point to open parens");let je=0;for(let Be=we;Be<ye.length;Be++)if(E(ye,Be)&&(je+=1),k(ye,Be)&&(je-=1),je===0)return[we,Be];throw new ue("TemplateLiteralParser: Unclosed group parens in expression")}function J(ye,we){for(let je=we;je<ye.length;je++)if(E(ye,je))return[we,je];return[we,ye.length]}let ee=[];for(let ye=0;ye<U.length;ye++)if(E(U,ye)){let[we,je]=L(U,ye),Be=U.slice(we,je+1);ee.push(b(Be)),ye=je}else{let[we,je]=J(U,ye),Be=U.slice(we,je);Be.length>0&&ee.push(b(Be)),ye=je-1}return ee.length===0?{type:"const",const:""}:ee.length===1?ee[0]:{type:"and",expr:ee}}function b(U){return $(U)?b(h(U)):A(U)?s(U):w(U)?T(U):{type:"const",const:U}}f.Parse=b;function v(U){return b(U.slice(1,U.length-1))}f.ParseExact=v})(z||(e.TemplateLiteralParser=z={}));var pe=class extends r{};e.TemplateLiteralFiniteError=pe;var M;(function(f){function _(h){throw new pe(h)}function E(h){return h.type==="or"&&h.expr.length===2&&h.expr[0].type==="const"&&h.expr[0].const==="0"&&h.expr[1].type==="const"&&h.expr[1].const==="[1-9][0-9]*"}function k(h){return h.type==="or"&&h.expr.length===2&&h.expr[0].type==="const"&&h.expr[0].const==="true"&&h.expr[1].type==="const"&&h.expr[1].const==="false"}function S(h){return h.type==="const"&&h.const===".*"}function $(h){return k(h)?!0:E(h)||S(h)?!1:h.type==="and"?h.expr.every(A=>$(A)):h.type==="or"?h.expr.every(A=>$(A)):h.type==="const"?!0:_("Unknown expression type")}f.Check=$})(M||(e.TemplateLiteralFinite=M={}));var N=class extends r{};e.TemplateLiteralGeneratorError=N;var C;(function(f){function*_(h){if(h.length===1)return yield*h[0];for(let A of h[0])for(let w of _(h.slice(1)))yield`${A}${w}`}function*E(h){return yield*_(h.expr.map(A=>[...$(A)]))}function*k(h){for(let A of h.expr)yield*$(A)}function*S(h){return yield h.const}function*$(h){return h.type==="and"?yield*E(h):h.type==="or"?yield*k(h):h.type==="const"?yield*S(h):(()=>{throw new N("Unknown expression")})()}f.Generate=$})(C||(e.TemplateLiteralGenerator=C={}));var Q;(function(f){function*_($){let h=$.trim().replace(/"|'/g,"");return h==="boolean"?yield e.Type.Boolean():h==="number"?yield e.Type.Number():h==="bigint"?yield e.Type.BigInt():h==="string"?yield e.Type.String():yield(()=>{let A=h.split("|").map(w=>e.Type.Literal(w.trim()));return A.length===0?e.Type.Never():A.length===1?A[0]:e.Type.Union(A)})()}function*E($){if($[1]!=="{"){let h=e.Type.Literal("$"),A=k($.slice(1));return yield*[h,...A]}for(let h=2;h<$.length;h++)if($[h]==="}"){let A=_($.slice(2,h)),w=k($.slice(h+1));return yield*[...A,...w]}yield e.Type.Literal($)}function*k($){for(let h=0;h<$.length;h++)if($[h]==="$"){let A=e.Type.Literal($.slice(0,h)),w=E($.slice(h));return yield*[A,...w]}yield e.Type.Literal($)}function S($){return[...k($)]}f.Parse=S})(Q||(e.TemplateLiteralDslParser=Q={}));var X=class{constructor(f){this.schema=f}Decode(f){return new O(this.schema,f)}};e.TransformDecodeBuilder=X;var O=class{constructor(f,_){this.schema=f,this.decode=_}Encode(f){let _=g.Type(this.schema);return o.TTransform(_)?(()=>{let E={Encode:k=>_[e.Transform].Encode(f(k)),Decode:k=>this.decode(_[e.Transform].Decode(k))};return{..._,[e.Transform]:E}})():(()=>{let E={Decode:this.decode,Encode:f};return{..._,[e.Transform]:E}})()}};e.TransformEncodeBuilder=O;var K=0,te=class extends r{};e.TypeBuilderError=te;var H=class{Create(f){return f}Throw(f){throw new te(f)}Discard(f,_){return _.reduce((E,k)=>{let{[k]:S,...$}=E;return $},f)}Strict(f){return JSON.parse(JSON.stringify(f))}};e.TypeBuilder=H;var W=class extends H{ReadonlyOptional(f){return this.Readonly(this.Optional(f))}Readonly(f){return{...g.Type(f),[e.Readonly]:"Readonly"}}Optional(f){return{...g.Type(f),[e.Optional]:"Optional"}}Any(f={}){return this.Create({...f,[e.Kind]:"Any"})}Array(f,_={}){return this.Create({..._,[e.Kind]:"Array",type:"array",items:g.Type(f)})}Boolean(f={}){return this.Create({...f,[e.Kind]:"Boolean",type:"boolean"})}Capitalize(f,_={}){return{...j.Map(g.Type(f),"Capitalize"),..._}}Composite(f,_){let E=e.Type.Intersect(f,{}),k=Z.ResolveKeys(E,{includePatterns:!1}).reduce((S,$)=>({...S,[$]:e.Type.Index(E,[$])}),{});return e.Type.Object(k,_)}Enum(f,_={}){if(i.IsUndefined(f))return this.Throw("Enum undefined or empty");let E=Object.getOwnPropertyNames(f).filter(S=>isNaN(S)).map(S=>f[S]),k=[...new Set(E)].map(S=>e.Type.Literal(S));return this.Union(k,{..._,[e.Hint]:"Enum"})}Extends(f,_,E,k,S={}){switch(m.Extends(f,_)){case c.Union:return this.Union([g.Type(E,S),g.Type(k,S)]);case c.True:return g.Type(E,S);case c.False:return g.Type(k,S)}}Exclude(f,_,E={}){return o.TTemplateLiteral(f)?this.Exclude(F.Resolve(f),_,E):o.TTemplateLiteral(_)?this.Exclude(f,F.Resolve(_),E):o.TUnion(f)?(()=>{let k=f.anyOf.filter(S=>m.Extends(S,_)===c.False);return k.length===1?g.Type(k[0],E):this.Union(k,E)})():m.Extends(f,_)!==c.False?this.Never(E):g.Type(f,E)}Extract(f,_,E={}){return o.TTemplateLiteral(f)?this.Extract(F.Resolve(f),_,E):o.TTemplateLiteral(_)?this.Extract(f,F.Resolve(_),E):o.TUnion(f)?(()=>{let k=f.anyOf.filter(S=>m.Extends(S,_)!==c.False);return k.length===1?g.Type(k[0],E):this.Union(k,E)})():m.Extends(f,_)!==c.False?g.Type(f,E):this.Never(E)}Index(f,_,E={}){return o.TArray(f)&&o.TNumber(_)?g.Type(f.items,E):o.TTuple(f)&&o.TNumber(_)?(()=>{let k=(i.IsUndefined(f.items)?[]:f.items).map(S=>g.Type(S));return this.Union(k,E)})():(()=>{let k=B.Resolve(_),S=g.Type(f);return R.Resolve(S,k,E)})()}Integer(f={}){return this.Create({...f,[e.Kind]:"Integer",type:"integer"})}Intersect(f,_={}){if(f.length===0)return e.Type.Never();if(f.length===1)return g.Type(f[0],_);f.some($=>o.TTransform($))&&this.Throw("Cannot intersect transform types");let E=f.every($=>o.TObject($)),k=g.Rest(f),S=o.TSchema(_.unevaluatedProperties)?{unevaluatedProperties:g.Type(_.unevaluatedProperties)}:{};return _.unevaluatedProperties===!1||o.TSchema(_.unevaluatedProperties)||E?this.Create({..._,...S,[e.Kind]:"Intersect",type:"object",allOf:k}):this.Create({..._,...S,[e.Kind]:"Intersect",allOf:k})}KeyOf(f,_={}){return o.TRecord(f)?(()=>{let E=Object.getOwnPropertyNames(f.patternProperties)[0];return E===e.PatternNumberExact?this.Number(_):E===e.PatternStringExact?this.String(_):this.Throw("Unable to resolve key type from Record key pattern")})():o.TTuple(f)?(()=>{let E=(i.IsUndefined(f.items)?[]:f.items).map((k,S)=>e.Type.Literal(S.toString()));return this.Union(E,_)})():o.TArray(f)?this.Number(_):(()=>{let E=Z.ResolveKeys(f,{includePatterns:!1});if(E.length===0)return this.Never(_);let k=E.map(S=>this.Literal(S));return this.Union(k,_)})()}Literal(f,_={}){return this.Create({..._,[e.Kind]:"Literal",const:f,type:typeof f})}Lowercase(f,_={}){return{...j.Map(g.Type(f),"Lowercase"),..._}}Never(f={}){return this.Create({...f,[e.Kind]:"Never",not:{}})}Not(f,_){return this.Create({..._,[e.Kind]:"Not",not:g.Type(f)})}Null(f={}){return this.Create({...f,[e.Kind]:"Null",type:"null"})}Number(f={}){return this.Create({...f,[e.Kind]:"Number",type:"number"})}Object(f,_={}){let E=Object.getOwnPropertyNames(f),k=E.filter(A=>o.TOptional(f[A])),S=E.filter(A=>!k.includes(A)),$=o.TSchema(_.additionalProperties)?{additionalProperties:g.Type(_.additionalProperties)}:{},h=E.reduce((A,w)=>({...A,[w]:g.Type(f[w])}),{});return S.length>0?this.Create({..._,...$,[e.Kind]:"Object",type:"object",properties:h,required:S}):this.Create({..._,...$,[e.Kind]:"Object",type:"object",properties:h})}Omit(f,_,E={}){let k=B.Resolve(_);return G.Map(this.Discard(g.Type(f),["$id",e.Transform]),S=>{i.IsArray(S.required)&&(S.required=S.required.filter($=>!k.includes($)),S.required.length===0&&delete S.required);for(let $ of Object.getOwnPropertyNames(S.properties))k.includes($)&&delete S.properties[$];return this.Create(S)},E)}Partial(f,_={}){return G.Map(this.Discard(g.Type(f),["$id",e.Transform]),E=>{let k=Object.getOwnPropertyNames(E.properties).reduce((S,$)=>({...S,[$]:this.Optional(E.properties[$])}),{});return this.Object(k,this.Discard(E,["required"]))},_)}Pick(f,_,E={}){let k=B.Resolve(_);return G.Map(this.Discard(g.Type(f),["$id",e.Transform]),S=>{i.IsArray(S.required)&&(S.required=S.required.filter($=>k.includes($)),S.required.length===0&&delete S.required);for(let $ of Object.getOwnPropertyNames(S.properties))k.includes($)||delete S.properties[$];return this.Create(S)},E)}Record(f,_,E={}){return o.TTemplateLiteral(f)?(()=>{let k=z.ParseExact(f.pattern);return M.Check(k)?this.Object([...C.Generate(k)].reduce((S,$)=>({...S,[$]:g.Type(_)}),{}),E):this.Create({...E,[e.Kind]:"Record",type:"object",patternProperties:{[f.pattern]:g.Type(_)}})})():o.TUnion(f)?(()=>{let k=V.Resolve(f);if(o.TUnionLiteral(k)){let S=k.anyOf.reduce(($,h)=>({...$,[h.const]:g.Type(_)}),{});return this.Object(S,{...E,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():o.TLiteral(f)?i.IsString(f.const)||i.IsNumber(f.const)?this.Object({[f.const]:g.Type(_)},E):this.Throw("Record key of type literal is not of type string or number"):o.TInteger(f)||o.TNumber(f)?this.Create({...E,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:g.Type(_)}}):o.TString(f)?(()=>{let k=i.IsUndefined(f.pattern)?e.PatternStringExact:f.pattern;return this.Create({...E,[e.Kind]:"Record",type:"object",patternProperties:{[k]:g.Type(_)}})})():this.Never()}Recursive(f,_={}){i.IsUndefined(_.$id)&&(_.$id=`T${K++}`);let E=f({[e.Kind]:"This",$ref:`${_.$id}`});return E.$id=_.$id,this.Create({..._,[e.Hint]:"Recursive",...E})}Ref(f,_={}){return i.IsString(f)?this.Create({..._,[e.Kind]:"Ref",$ref:f}):(i.IsUndefined(f.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({..._,[e.Kind]:"Ref",$ref:f.$id}))}Required(f,_={}){return G.Map(this.Discard(g.Type(f),["$id",e.Transform]),E=>{let k=Object.getOwnPropertyNames(E.properties).reduce((S,$)=>({...S,[$]:this.Discard(E.properties[$],[e.Optional])}),{});return this.Object(k,E)},_)}Rest(f){return o.TTuple(f)&&!i.IsUndefined(f.items)?g.Rest(f.items):o.TIntersect(f)?g.Rest(f.allOf):o.TUnion(f)?g.Rest(f.anyOf):[]}String(f={}){return this.Create({...f,[e.Kind]:"String",type:"string"})}TemplateLiteral(f,_={}){let E=i.IsString(f)?se.Create(Q.Parse(f)):se.Create(f);return this.Create({..._,[e.Kind]:"TemplateLiteral",type:"string",pattern:E})}Transform(f){return new X(f)}Tuple(f,_={}){let[E,k,S]=[!1,f.length,f.length],$=g.Rest(f),h=f.length>0?{..._,[e.Kind]:"Tuple",type:"array",items:$,additionalItems:E,minItems:k,maxItems:S}:{..._,[e.Kind]:"Tuple",type:"array",minItems:k,maxItems:S};return this.Create(h)}Uncapitalize(f,_={}){return{...j.Map(g.Type(f),"Uncapitalize"),..._}}Union(f,_={}){return o.TTemplateLiteral(f)?F.Resolve(f):(()=>{let E=f;if(E.length===0)return this.Never(_);if(E.length===1)return this.Create(g.Type(E[0],_));let k=g.Rest(E);return this.Create({..._,[e.Kind]:"Union",anyOf:k})})()}Unknown(f={}){return this.Create({...f,[e.Kind]:"Unknown"})}Unsafe(f={}){return this.Create({...f,[e.Kind]:f[e.Kind]||"Unsafe"})}Uppercase(f,_={}){return{...j.Map(g.Type(f),"Uppercase"),..._}}};e.JsonTypeBuilder=W;var fe=class extends W{AsyncIterator(f,_={}){return this.Create({..._,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:g.Type(f)})}Awaited(f,_={}){let E=k=>k.length>0?(()=>{let[S,...$]=k;return[this.Awaited(S),...E($)]})():k;return o.TIntersect(f)?e.Type.Intersect(E(f.allOf)):o.TUnion(f)?e.Type.Union(E(f.anyOf)):o.TPromise(f)?this.Awaited(f.item):g.Type(f,_)}BigInt(f={}){return this.Create({...f,[e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(f,_={}){return this.Tuple([...f.parameters],{..._})}Constructor(f,_,E){let[k,S]=[g.Rest(f),g.Type(_)];return this.Create({...E,[e.Kind]:"Constructor",type:"Constructor",parameters:k,returns:S})}Date(f={}){return this.Create({...f,[e.Kind]:"Date",type:"Date"})}Function(f,_,E){let[k,S]=[g.Rest(f),g.Type(_)];return this.Create({...E,[e.Kind]:"Function",type:"Function",parameters:k,returns:S})}InstanceType(f,_={}){return g.Type(f.returns,_)}Iterator(f,_={}){return this.Create({..._,[e.Kind]:"Iterator",type:"Iterator",items:g.Type(f)})}Parameters(f,_={}){return this.Tuple(f.parameters,{..._})}Promise(f,_={}){return this.Create({..._,[e.Kind]:"Promise",type:"Promise",item:g.Type(f)})}RegExp(f,_={}){let E=i.IsString(f)?f:f.source;return this.Create({..._,[e.Kind]:"String",type:"string",pattern:E})}RegEx(f,_={}){return this.RegExp(f,_)}ReturnType(f,_={}){return g.Type(f.returns,_)}Symbol(f){return this.Create({...f,[e.Kind]:"Symbol",type:"symbol"})}Undefined(f={}){return this.Create({...f,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(f={}){return this.Create({...f,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(f={}){return this.Create({...f,[e.Kind]:"Void",type:"void"})}};e.JavaScriptTypeBuilder=fe,e.JsonType=new W,e.Type=new fe}),On=Re(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(F){return c(F)&&Symbol.asyncIterator in F}e.IsAsyncIterator=t;function r(F){return c(F)&&Symbol.iterator in F}e.IsIterator=r;function n(F){return ArrayBuffer.isView(F)}e.IsTypedArray=n;function i(F){return F instanceof Promise}e.IsPromise=i;function a(F){return F instanceof Uint8Array}e.IsUint8Array=a;function o(F){return F instanceof Date&&Number.isFinite(F.getTime())}e.IsDate=o;function u(F,ue){return ue in F}e.HasPropertyKey=u;function l(F){return c(F)&&V(F.constructor)&&F.constructor.name==="Object"}e.IsPlainObject=l;function c(F){return F!==null&&typeof F=="object"}e.IsObject=c;function m(F){return Array.isArray(F)&&!ArrayBuffer.isView(F)}e.IsArray=m;function g(F){return F===void 0}e.IsUndefined=g;function R(F){return F===null}e.IsNull=R;function j(F){return typeof F=="boolean"}e.IsBoolean=j;function G(F){return typeof F=="number"}e.IsNumber=G;function Z(F){return G(F)&&Number.isInteger(F)}e.IsInteger=Z;function ae(F){return typeof F=="bigint"}e.IsBigInt=ae;function B(F){return typeof F=="string"}e.IsString=B;function V(F){return typeof F=="function"}e.IsFunction=V;function q(F){return typeof F=="symbol"}e.IsSymbol=q;function se(F){return ae(F)||j(F)||R(F)||G(F)||B(F)||q(F)||g(F)}e.IsValueType=se}),ud=Re(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=On(),r=Co(),n=Lr(),i=class extends n.TypeBoxError{constructor(m){super(`Duplicate type kind '${m}' detected`)}};e.TypeSystemDuplicateTypeKind=i;var a=class extends n.TypeBoxError{constructor(m){super(`Duplicate string format '${m}' detected`)}};e.TypeSystemDuplicateFormat=a;var o;(function(m){function g(j,G){if(n.TypeRegistry.Has(j))throw new i(j);return n.TypeRegistry.Set(j,G),(Z={})=>n.Type.Unsafe({...Z,[n.Kind]:j})}m.Type=g;function R(j,G){if(n.FormatRegistry.Has(j))throw new a(j);return n.FormatRegistry.Set(j,G),j}m.Format=R})(o||(e.TypeSystem=o={}));var u;(function(m){let g=c;function R(){g=c}m.Reset=R;function j(Z){g=Z}m.Set=j;function G(){return g}m.Get=G})(u||(e.TypeSystemErrorFunction=u={}));var l;(function(m){m.ExactOptionalPropertyTypes=!1,m.AllowArrayObject=!1,m.AllowNaN=!1,m.AllowNullVoid=!1;function g(ae,B){return m.ExactOptionalPropertyTypes?B in ae:ae[B]!==void 0}m.IsExactOptionalProperty=g;function R(ae){let B=(0,t.IsObject)(ae);return m.AllowArrayObject?B:B&&!(0,t.IsArray)(ae)}m.IsObjectLike=R;function j(ae){return R(ae)&&!(ae instanceof Date)&&!(ae instanceof Uint8Array)}m.IsRecordLike=j;function G(ae){let B=(0,t.IsNumber)(ae);return m.AllowNaN?B:B&&Number.isFinite(ae)}m.IsNumberLike=G;function Z(ae){let B=(0,t.IsUndefined)(ae);return m.AllowNullVoid?B||ae===null:B}m.IsVoidLike=Z})(l||(e.TypeSystemPolicy=l={}));function c(m,g){switch(g){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 ${m.maxContains} matching values`;case r.ValueErrorType.ArrayMinContains:return`Expected array to contain at least ${m.minContains} matching values`;case r.ValueErrorType.ArrayMaxItems:return`Expected array length to be less or equal to ${m.maxItems}`;case r.ValueErrorType.ArrayMinItems:return`Expected array length to be greater or equal to ${m.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 ${m.exclusiveMaximum}`;case r.ValueErrorType.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${m.exclusiveMinimum}`;case r.ValueErrorType.BigIntMaximum:return`Expected bigint to be less or equal to ${m.maximum}`;case r.ValueErrorType.BigIntMinimum:return`Expected bigint to be greater or equal to ${m.minimum}`;case r.ValueErrorType.BigIntMultipleOf:return`Expected bigint to be a multiple of ${m.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 ${m.exclusiveMinimumTimestamp}`;case r.ValueErrorType.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${m.exclusiveMaximumTimestamp}`;case r.ValueErrorType.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${m.minimumTimestamp}`;case r.ValueErrorType.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${m.maximumTimestamp}`;case r.ValueErrorType.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${m.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 ${m.exclusiveMaximum}`;case r.ValueErrorType.IntegerExclusiveMinimum:return`Expected integer to be greater than ${m.exclusiveMinimum}`;case r.ValueErrorType.IntegerMaximum:return`Expected integer to be less or equal to ${m.maximum}`;case r.ValueErrorType.IntegerMinimum:return`Expected integer to be greater or equal to ${m.minimum}`;case r.ValueErrorType.IntegerMultipleOf:return`Expected integer to be a multiple of ${m.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 m.const=="string"?`'${m.const}'`:m.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 ${m.exclusiveMaximum}`;case r.ValueErrorType.NumberExclusiveMinimum:return`Expected number to be greater than ${m.exclusiveMinimum}`;case r.ValueErrorType.NumberMaximum:return`Expected number to be less or equal to ${m.maximum}`;case r.ValueErrorType.NumberMinimum:return`Expected number to be greater or equal to ${m.minimum}`;case r.ValueErrorType.NumberMultipleOf:return`Expected number to be a multiple of ${m.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 ${m.maxProperties} properties`;case r.ValueErrorType.ObjectMinProperties:return`Expected object to have at least ${m.minProperties} properties`;case r.ValueErrorType.ObjectRequiredProperty:return"Required property";case r.ValueErrorType.Promise:return"Expected Promise";case r.ValueErrorType.StringFormatUnknown:return`Unknown format '${m.format}'`;case r.ValueErrorType.StringFormat:return`Expected string to match '${m.format}' format`;case r.ValueErrorType.StringMaxLength:return`Expected string length less or equal to ${m.maxLength}`;case r.ValueErrorType.StringMinLength:return`Expected string length greater or equal to ${m.minLength}`;case r.ValueErrorType.StringPattern:return`Expected string to match '${m.pattern}'`;case r.ValueErrorType.String:return"Expected string";case r.ValueErrorType.Symbol:return"Expected symbol";case r.ValueErrorType.TupleLength:return`Expected tuple to have ${m.maxItems||0} elements`;case r.ValueErrorType.Tuple:return"Expected tuple";case r.ValueErrorType.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${m.maxByteLength}`;case r.ValueErrorType.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${m.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 '${m[n.Kind]}'`;default:return"Unknown error type"}}e.DefaultErrorFunction=c}),Bo=Re(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Deref=e.TypeDereferenceError=void 0;var t=Lr(),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,a){let o=a.findIndex(u=>u.$id===i.$ref);if(o===-1)throw new r(i);return a[o]}e.Deref=n}),xs=Re(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.ByteMarker=e.ValueHashError=void 0;var t=On(),r=class extends Error{constructor(N){super("Unable to hash value"),this.value=N}};e.ValueHashError=r;var n;(function(N){N[N.Undefined=0]="Undefined",N[N.Null=1]="Null",N[N.Boolean=2]="Boolean",N[N.Number=3]="Number",N[N.String=4]="String",N[N.Object=5]="Object",N[N.Array=6]="Array",N[N.Date=7]="Date",N[N.Uint8Array=8]="Uint8Array",N[N.Symbol=9]="Symbol",N[N.BigInt=10]="BigInt"})(n||(e.ByteMarker=n={}));var i=BigInt("14695981039346656037"),[a,o]=[BigInt("1099511628211"),BigInt("2")**BigInt("64")],u=Array.from({length:256}).map((N,C)=>BigInt(C)),l=new Float64Array(1),c=new DataView(l.buffer),m=new Uint8Array(l.buffer);function*g(N){let C=N===0?1:Math.ceil(Math.floor(Math.log2(N)+1)/8);for(let Q=0;Q<C;Q++)yield N>>8*(C-1-Q)&255}function R(N){pe(n.Array);for(let C of N)z(C)}function j(N){pe(n.Boolean),pe(N?1:0)}function G(N){pe(n.BigInt),c.setBigInt64(0,N);for(let C of m)pe(C)}function Z(N){pe(n.Date),z(N.getTime())}function ae(N){pe(n.Null)}function B(N){pe(n.Number),c.setFloat64(0,N);for(let C of m)pe(C)}function V(N){pe(n.Object);for(let C of globalThis.Object.keys(N).sort())z(C),z(N[C])}function q(N){pe(n.String);for(let C=0;C<N.length;C++)for(let Q of g(N.charCodeAt(C)))pe(Q)}function se(N){pe(n.Symbol),z(N.description)}function F(N){pe(n.Uint8Array);for(let C=0;C<N.length;C++)pe(N[C])}function ue(N){return pe(n.Undefined)}function z(N){if((0,t.IsArray)(N))return R(N);if((0,t.IsBoolean)(N))return j(N);if((0,t.IsBigInt)(N))return G(N);if((0,t.IsDate)(N))return Z(N);if((0,t.IsNull)(N))return ae(N);if((0,t.IsNumber)(N))return B(N);if((0,t.IsPlainObject)(N))return V(N);if((0,t.IsString)(N))return q(N);if((0,t.IsSymbol)(N))return se(N);if((0,t.IsUint8Array)(N))return F(N);if((0,t.IsUndefined)(N))return ue(N);throw new r(N)}function pe(N){i=i^u[N],i=i*a%o}function M(N){return i=BigInt("14695981039346656037"),z(N),i}e.Hash=M}),Co=Re(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Errors=e.ValueErrorIterator=e.EscapeKey=e.ValueErrorsUnknownTypeError=e.ValueErrorType=void 0;var t=On(),r=ud(),n=Bo(),i=xs(),a=Lr(),o;(function(s){s[s.ArrayContains=0]="ArrayContains",s[s.ArrayMaxContains=1]="ArrayMaxContains",s[s.ArrayMaxItems=2]="ArrayMaxItems",s[s.ArrayMinContains=3]="ArrayMinContains",s[s.ArrayMinItems=4]="ArrayMinItems",s[s.ArrayUniqueItems=5]="ArrayUniqueItems",s[s.Array=6]="Array",s[s.AsyncIterator=7]="AsyncIterator",s[s.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",s[s.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",s[s.BigIntMaximum=10]="BigIntMaximum",s[s.BigIntMinimum=11]="BigIntMinimum",s[s.BigIntMultipleOf=12]="BigIntMultipleOf",s[s.BigInt=13]="BigInt",s[s.Boolean=14]="Boolean",s[s.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",s[s.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",s[s.DateMaximumTimestamp=17]="DateMaximumTimestamp",s[s.DateMinimumTimestamp=18]="DateMinimumTimestamp",s[s.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",s[s.Date=20]="Date",s[s.Function=21]="Function",s[s.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",s[s.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",s[s.IntegerMaximum=24]="IntegerMaximum",s[s.IntegerMinimum=25]="IntegerMinimum",s[s.IntegerMultipleOf=26]="IntegerMultipleOf",s[s.Integer=27]="Integer",s[s.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",s[s.Intersect=29]="Intersect",s[s.Iterator=30]="Iterator",s[s.Kind=31]="Kind",s[s.Literal=32]="Literal",s[s.Never=33]="Never",s[s.Not=34]="Not",s[s.Null=35]="Null",s[s.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",s[s.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",s[s.NumberMaximum=38]="NumberMaximum",s[s.NumberMinimum=39]="NumberMinimum",s[s.NumberMultipleOf=40]="NumberMultipleOf",s[s.Number=41]="Number",s[s.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",s[s.ObjectMaxProperties=43]="ObjectMaxProperties",s[s.ObjectMinProperties=44]="ObjectMinProperties",s[s.ObjectRequiredProperty=45]="ObjectRequiredProperty",s[s.Object=46]="Object",s[s.Promise=47]="Promise",s[s.StringFormatUnknown=48]="StringFormatUnknown",s[s.StringFormat=49]="StringFormat",s[s.StringMaxLength=50]="StringMaxLength",s[s.StringMinLength=51]="StringMinLength",s[s.StringPattern=52]="StringPattern",s[s.String=53]="String",s[s.Symbol=54]="Symbol",s[s.TupleLength=55]="TupleLength",s[s.Tuple=56]="Tuple",s[s.Uint8ArrayMaxByteLength=57]="Uint8ArrayMaxByteLength",s[s.Uint8ArrayMinByteLength=58]="Uint8ArrayMinByteLength",s[s.Uint8Array=59]="Uint8Array",s[s.Undefined=60]="Undefined",s[s.Union=61]="Union",s[s.Void=62]="Void"})(o||(e.ValueErrorType=o={}));var u=class extends a.TypeBoxError{constructor(s){super("Unknown type"),this.schema=s}};e.ValueErrorsUnknownTypeError=u;function l(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}e.EscapeKey=l;function c(s){return s!==void 0}var m=class{constructor(s){this.iterator=s}[Symbol.iterator](){return this.iterator}First(){let s=this.iterator.next();return s.done?void 0:s.value}};e.ValueErrorIterator=m;function g(s,T,b,v){return{type:s,schema:T,path:b,value:v,message:r.TypeSystemErrorFunction.Get()(T,s)}}function*R(s,T,b,v){}function*j(s,T,b,v){if(!(0,t.IsArray)(v))return yield g(o.Array,s,b,v);c(s.minItems)&&!(v.length>=s.minItems)&&(yield g(o.ArrayMinItems,s,b,v)),c(s.maxItems)&&!(v.length<=s.maxItems)&&(yield g(o.ArrayMaxItems,s,b,v));for(let J=0;J<v.length;J++)yield*A(s.items,T,`${b}/${J}`,v[J]);if(s.uniqueItems===!0&&!function(){let J=new Set;for(let ee of v){let ye=(0,i.Hash)(ee);if(J.has(ye))return!1;J.add(ye)}return!0}()&&(yield g(o.ArrayUniqueItems,s,b,v)),!(c(s.contains)||c(s.minContains)||c(s.maxContains)))return;let U=c(s.contains)?s.contains:a.Type.Never(),L=v.reduce((J,ee,ye)=>A(U,T,`${b}${ye}`,ee).next().done===!0?J+1:J,0);L===0&&(yield g(o.ArrayContains,s,b,v)),(0,t.IsNumber)(s.minContains)&&L<s.minContains&&(yield g(o.ArrayMinContains,s,b,v)),(0,t.IsNumber)(s.maxContains)&&L>s.maxContains&&(yield g(o.ArrayMaxContains,s,b,v))}function*G(s,T,b,v){(0,t.IsAsyncIterator)(v)||(yield g(o.AsyncIterator,s,b,v))}function*Z(s,T,b,v){if(!(0,t.IsBigInt)(v))return yield g(o.BigInt,s,b,v);c(s.exclusiveMaximum)&&!(v<s.exclusiveMaximum)&&(yield g(o.BigIntExclusiveMaximum,s,b,v)),c(s.exclusiveMinimum)&&!(v>s.exclusiveMinimum)&&(yield g(o.BigIntExclusiveMinimum,s,b,v)),c(s.maximum)&&!(v<=s.maximum)&&(yield g(o.BigIntMaximum,s,b,v)),c(s.minimum)&&!(v>=s.minimum)&&(yield g(o.BigIntMinimum,s,b,v)),c(s.multipleOf)&&v%s.multipleOf!==BigInt(0)&&(yield g(o.BigIntMultipleOf,s,b,v))}function*ae(s,T,b,v){(0,t.IsBoolean)(v)||(yield g(o.Boolean,s,b,v))}function*B(s,T,b,v){yield*A(s.returns,T,b,v.prototype)}function*V(s,T,b,v){if(!(0,t.IsDate)(v))return yield g(o.Date,s,b,v);c(s.exclusiveMaximumTimestamp)&&!(v.getTime()<s.exclusiveMaximumTimestamp)&&(yield g(o.DateExclusiveMaximumTimestamp,s,b,v)),c(s.exclusiveMinimumTimestamp)&&!(v.getTime()>s.exclusiveMinimumTimestamp)&&(yield g(o.DateExclusiveMinimumTimestamp,s,b,v)),c(s.maximumTimestamp)&&!(v.getTime()<=s.maximumTimestamp)&&(yield g(o.DateMaximumTimestamp,s,b,v)),c(s.minimumTimestamp)&&!(v.getTime()>=s.minimumTimestamp)&&(yield g(o.DateMinimumTimestamp,s,b,v)),c(s.multipleOfTimestamp)&&v.getTime()%s.multipleOfTimestamp!==0&&(yield g(o.DateMultipleOfTimestamp,s,b,v))}function*q(s,T,b,v){(0,t.IsFunction)(v)||(yield g(o.Function,s,b,v))}function*se(s,T,b,v){if(!(0,t.IsInteger)(v))return yield g(o.Integer,s,b,v);c(s.exclusiveMaximum)&&!(v<s.exclusiveMaximum)&&(yield g(o.IntegerExclusiveMaximum,s,b,v)),c(s.exclusiveMinimum)&&!(v>s.exclusiveMinimum)&&(yield g(o.IntegerExclusiveMinimum,s,b,v)),c(s.maximum)&&!(v<=s.maximum)&&(yield g(o.IntegerMaximum,s,b,v)),c(s.minimum)&&!(v>=s.minimum)&&(yield g(o.IntegerMinimum,s,b,v)),c(s.multipleOf)&&v%s.multipleOf!==0&&(yield g(o.IntegerMultipleOf,s,b,v))}function*F(s,T,b,v){for(let U of s.allOf){let L=A(U,T,b,v).next();L.done||(yield g(o.Intersect,s,b,v),yield L.value)}if(s.unevaluatedProperties===!1){let U=new RegExp(a.KeyResolver.ResolvePattern(s));for(let L of Object.getOwnPropertyNames(v))U.test(L)||(yield g(o.IntersectUnevaluatedProperties,s,`${b}/${L}`,v))}if(typeof s.unevaluatedProperties=="object"){let U=new RegExp(a.KeyResolver.ResolvePattern(s));for(let L of Object.getOwnPropertyNames(v))if(!U.test(L)){let J=A(s.unevaluatedProperties,T,`${b}/${L}`,v[L]).next();J.done||(yield J.value)}}}function*ue(s,T,b,v){(0,t.IsIterator)(v)||(yield g(o.Iterator,s,b,v))}function*z(s,T,b,v){v!==s.const&&(yield g(o.Literal,s,b,v))}function*pe(s,T,b,v){yield g(o.Never,s,b,v)}function*M(s,T,b,v){A(s.not,T,b,v).next().done===!0&&(yield g(o.Not,s,b,v))}function*N(s,T,b,v){(0,t.IsNull)(v)||(yield g(o.Null,s,b,v))}function*C(s,T,b,v){if(!r.TypeSystemPolicy.IsNumberLike(v))return yield g(o.Number,s,b,v);c(s.exclusiveMaximum)&&!(v<s.exclusiveMaximum)&&(yield g(o.NumberExclusiveMaximum,s,b,v)),c(s.exclusiveMinimum)&&!(v>s.exclusiveMinimum)&&(yield g(o.NumberExclusiveMinimum,s,b,v)),c(s.maximum)&&!(v<=s.maximum)&&(yield g(o.NumberMaximum,s,b,v)),c(s.minimum)&&!(v>=s.minimum)&&(yield g(o.NumberMinimum,s,b,v)),c(s.multipleOf)&&v%s.multipleOf!==0&&(yield g(o.NumberMultipleOf,s,b,v))}function*Q(s,T,b,v){if(!r.TypeSystemPolicy.IsObjectLike(v))return yield g(o.Object,s,b,v);c(s.minProperties)&&!(Object.getOwnPropertyNames(v).length>=s.minProperties)&&(yield g(o.ObjectMinProperties,s,b,v)),c(s.maxProperties)&&!(Object.getOwnPropertyNames(v).length<=s.maxProperties)&&(yield g(o.ObjectMaxProperties,s,b,v));let U=Array.isArray(s.required)?s.required:[],L=Object.getOwnPropertyNames(s.properties),J=Object.getOwnPropertyNames(v);for(let ee of U)J.includes(ee)||(yield g(o.ObjectRequiredProperty,s.properties[ee],`${b}/${l(ee)}`,void 0));if(s.additionalProperties===!1)for(let ee of J)L.includes(ee)||(yield g(o.ObjectAdditionalProperties,s,`${b}/${l(ee)}`,v[ee]));if(typeof s.additionalProperties=="object")for(let ee of J)L.includes(ee)||(yield*A(s.additionalProperties,T,`${b}/${l(ee)}`,v[ee]));for(let ee of L){let ye=s.properties[ee];s.required&&s.required.includes(ee)?(yield*A(ye,T,`${b}/${l(ee)}`,v[ee]),a.ExtendsUndefined.Check(s)&&!(ee in v)&&(yield g(o.ObjectRequiredProperty,ye,`${b}/${l(ee)}`,void 0))):r.TypeSystemPolicy.IsExactOptionalProperty(v,ee)&&(yield*A(ye,T,`${b}/${l(ee)}`,v[ee]))}}function*X(s,T,b,v){(0,t.IsPromise)(v)||(yield g(o.Promise,s,b,v))}function*O(s,T,b,v){if(!r.TypeSystemPolicy.IsRecordLike(v))return yield g(o.Object,s,b,v);c(s.minProperties)&&!(Object.getOwnPropertyNames(v).length>=s.minProperties)&&(yield g(o.ObjectMinProperties,s,b,v)),c(s.maxProperties)&&!(Object.getOwnPropertyNames(v).length<=s.maxProperties)&&(yield g(o.ObjectMaxProperties,s,b,v));let[U,L]=Object.entries(s.patternProperties)[0],J=new RegExp(U);for(let[ee,ye]of Object.entries(v))J.test(ee)&&(yield*A(L,T,`${b}/${l(ee)}`,ye));if(typeof s.additionalProperties=="object")for(let[ee,ye]of Object.entries(v))J.test(ee)||(yield*A(s.additionalProperties,T,`${b}/${l(ee)}`,ye));if(s.additionalProperties===!1){for(let[ee,ye]of Object.entries(v))if(!J.test(ee))return yield g(o.ObjectAdditionalProperties,s,`${b}/${l(ee)}`,ye)}}function*K(s,T,b,v){yield*A((0,n.Deref)(s,T),T,b,v)}function*te(s,T,b,v){if(!(0,t.IsString)(v))return yield g(o.String,s,b,v);c(s.minLength)&&!(v.length>=s.minLength)&&(yield g(o.StringMinLength,s,b,v)),c(s.maxLength)&&!(v.length<=s.maxLength)&&(yield g(o.StringMaxLength,s,b,v)),(0,t.IsString)(s.pattern)&&(new RegExp(s.pattern).test(v)||(yield g(o.StringPattern,s,b,v))),(0,t.IsString)(s.format)&&(a.FormatRegistry.Has(s.format)?a.FormatRegistry.Get(s.format)(v)||(yield g(o.StringFormat,s,b,v)):yield g(o.StringFormatUnknown,s,b,v))}function*H(s,T,b,v){(0,t.IsSymbol)(v)||(yield g(o.Symbol,s,b,v))}function*W(s,T,b,v){if(!(0,t.IsString)(v))return yield g(o.String,s,b,v);new RegExp(s.pattern).test(v)||(yield g(o.StringPattern,s,b,v))}function*fe(s,T,b,v){yield*A((0,n.Deref)(s,T),T,b,v)}function*f(s,T,b,v){if(!(0,t.IsArray)(v))return yield g(o.Tuple,s,b,v);if(s.items===void 0&&v.length!==0)return yield g(o.TupleLength,s,b,v);if(v.length!==s.maxItems)return yield g(o.TupleLength,s,b,v);if(s.items)for(let U=0;U<s.items.length;U++)yield*A(s.items[U],T,`${b}/${U}`,v[U])}function*_(s,T,b,v){(0,t.IsUndefined)(v)||(yield g(o.Undefined,s,b,v))}function*E(s,T,b,v){let U=0;for(let L of s.anyOf){let J=[...A(L,T,b,v)];if(J.length===0)return;U+=J.length}U>0&&(yield g(o.Union,s,b,v))}function*k(s,T,b,v){if(!(0,t.IsUint8Array)(v))return yield g(o.Uint8Array,s,b,v);c(s.maxByteLength)&&!(v.length<=s.maxByteLength)&&(yield g(o.Uint8ArrayMaxByteLength,s,b,v)),c(s.minByteLength)&&!(v.length>=s.minByteLength)&&(yield g(o.Uint8ArrayMinByteLength,s,b,v))}function*S(s,T,b,v){}function*$(s,T,b,v){r.TypeSystemPolicy.IsVoidLike(v)||(yield g(o.Void,s,b,v))}function*h(s,T,b,v){a.TypeRegistry.Get(s[a.Kind])(s,v)||(yield g(o.Kind,s,b,v))}function*A(s,T,b,v){let U=c(s.$id)?[...T,s]:T,L=s;switch(L[a.Kind]){case"Any":return yield*R(L,U,b,v);case"Array":return yield*j(L,U,b,v);case"AsyncIterator":return yield*G(L,U,b,v);case"BigInt":return yield*Z(L,U,b,v);case"Boolean":return yield*ae(L,U,b,v);case"Constructor":return yield*B(L,U,b,v);case"Date":return yield*V(L,U,b,v);case"Function":return yield*q(L,U,b,v);case"Integer":return yield*se(L,U,b,v);case"Intersect":return yield*F(L,U,b,v);case"Iterator":return yield*ue(L,U,b,v);case"Literal":return yield*z(L,U,b,v);case"Never":return yield*pe(L,U,b,v);case"Not":return yield*M(L,U,b,v);case"Null":return yield*N(L,U,b,v);case"Number":return yield*C(L,U,b,v);case"Object":return yield*Q(L,U,b,v);case"Promise":return yield*X(L,U,b,v);case"Record":return yield*O(L,U,b,v);case"Ref":return yield*K(L,U,b,v);case"String":return yield*te(L,U,b,v);case"Symbol":return yield*H(L,U,b,v);case"TemplateLiteral":return yield*W(L,U,b,v);case"This":return yield*fe(L,U,b,v);case"Tuple":return yield*f(L,U,b,v);case"Undefined":return yield*_(L,U,b,v);case"Union":return yield*E(L,U,b,v);case"Uint8Array":return yield*k(L,U,b,v);case"Unknown":return yield*S(L,U,b,v);case"Void":return yield*$(L,U,b,v);default:if(!a.TypeRegistry.Has(L[a.Kind]))throw new u(s);return yield*h(L,U,b,v)}}function w(...s){let T=s.length===3?A(s[0],s[1],"",s[2]):A(s[0],[],"",s[1]);return new m(T)}e.Errors=w}),pT=Re(e=>{"use strict";var t=e&&e.__createBinding||(Object.create?function(n,i,a,o){o===void 0&&(o=a);var u=Object.getOwnPropertyDescriptor(i,a);(!u||("get"in u?!i.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(n,o,u)}:function(n,i,a,o){o===void 0&&(o=a),n[o]=i[a]}),r=e&&e.__exportStar||function(n,i){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(i,a)&&t(i,n,a)};Object.defineProperty(e,"__esModule",{value:!0}),r(Co(),e)}),cd=Re(e=>{"use strict";var t=e&&e.__createBinding||(Object.create?function(i,a,o,u){u===void 0&&(u=o);var l=Object.getOwnPropertyDescriptor(a,o);(!l||("get"in l?!a.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(i,u,l)}:function(i,a,o,u){u===void 0&&(u=o),i[u]=a[o]}),r=e&&e.__exportStar||function(i,a){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&t(a,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorType=void 0;var n=Co();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(ud(),e)}),hT=Re(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Check=e.ValueCheckUnknownTypeError=void 0;var t=On(),r=cd(),n=Bo(),i=xs(),a=Lr(),o=class extends a.TypeBoxError{constructor(h){super("Unknown type"),this.schema=h}};e.ValueCheckUnknownTypeError=o;function u(h){return h[a.Kind]==="Any"||h[a.Kind]==="Unknown"}function l(h){return h!==void 0}function c(h,A,w){return!0}function m(h,A,w){if(!(0,t.IsArray)(w)||l(h.minItems)&&!(w.length>=h.minItems)||l(h.maxItems)&&!(w.length<=h.maxItems)||!w.every(b=>S(h.items,A,b))||h.uniqueItems===!0&&!function(){let b=new Set;for(let v of w){let U=(0,i.Hash)(v);if(b.has(U))return!1;b.add(U)}return!0}())return!1;if(!(l(h.contains)||(0,t.IsNumber)(h.minContains)||(0,t.IsNumber)(h.maxContains)))return!0;let s=l(h.contains)?h.contains:a.Type.Never(),T=w.reduce((b,v)=>S(s,A,v)?b+1:b,0);return!(T===0||(0,t.IsNumber)(h.minContains)&&T<h.minContains||(0,t.IsNumber)(h.maxContains)&&T>h.maxContains)}function g(h,A,w){return(0,t.IsAsyncIterator)(w)}function R(h,A,w){return!(!(0,t.IsBigInt)(w)||l(h.exclusiveMaximum)&&!(w<h.exclusiveMaximum)||l(h.exclusiveMinimum)&&!(w>h.exclusiveMinimum)||l(h.maximum)&&!(w<=h.maximum)||l(h.minimum)&&!(w>=h.minimum)||l(h.multipleOf)&&w%h.multipleOf!==BigInt(0))}function j(h,A,w){return(0,t.IsBoolean)(w)}function G(h,A,w){return S(h.returns,A,w.prototype)}function Z(h,A,w){return!(!(0,t.IsDate)(w)||l(h.exclusiveMaximumTimestamp)&&!(w.getTime()<h.exclusiveMaximumTimestamp)||l(h.exclusiveMinimumTimestamp)&&!(w.getTime()>h.exclusiveMinimumTimestamp)||l(h.maximumTimestamp)&&!(w.getTime()<=h.maximumTimestamp)||l(h.minimumTimestamp)&&!(w.getTime()>=h.minimumTimestamp)||l(h.multipleOfTimestamp)&&w.getTime()%h.multipleOfTimestamp!==0)}function ae(h,A,w){return(0,t.IsFunction)(w)}function B(h,A,w){return!(!(0,t.IsInteger)(w)||l(h.exclusiveMaximum)&&!(w<h.exclusiveMaximum)||l(h.exclusiveMinimum)&&!(w>h.exclusiveMinimum)||l(h.maximum)&&!(w<=h.maximum)||l(h.minimum)&&!(w>=h.minimum)||l(h.multipleOf)&&w%h.multipleOf!==0)}function V(h,A,w){let s=h.allOf.every(T=>S(T,A,w));if(h.unevaluatedProperties===!1){let T=new RegExp(a.KeyResolver.ResolvePattern(h)),b=Object.getOwnPropertyNames(w).every(v=>T.test(v));return s&&b}else if(a.TypeGuard.TSchema(h.unevaluatedProperties)){let T=new RegExp(a.KeyResolver.ResolvePattern(h)),b=Object.getOwnPropertyNames(w).every(v=>T.test(v)||S(h.unevaluatedProperties,A,w[v]));return s&&b}else return s}function q(h,A,w){return(0,t.IsIterator)(w)}function se(h,A,w){return w===h.const}function F(h,A,w){return!1}function ue(h,A,w){return!S(h.not,A,w)}function z(h,A,w){return(0,t.IsNull)(w)}function pe(h,A,w){return!(!r.TypeSystemPolicy.IsNumberLike(w)||l(h.exclusiveMaximum)&&!(w<h.exclusiveMaximum)||l(h.exclusiveMinimum)&&!(w>h.exclusiveMinimum)||l(h.minimum)&&!(w>=h.minimum)||l(h.maximum)&&!(w<=h.maximum)||l(h.multipleOf)&&w%h.multipleOf!==0)}function M(h,A,w){if(!r.TypeSystemPolicy.IsObjectLike(w)||l(h.minProperties)&&!(Object.getOwnPropertyNames(w).length>=h.minProperties)||l(h.maxProperties)&&!(Object.getOwnPropertyNames(w).length<=h.maxProperties))return!1;let s=Object.getOwnPropertyNames(h.properties);for(let T of s){let b=h.properties[T];if(h.required&&h.required.includes(T)){if(!S(b,A,w[T])||(a.ExtendsUndefined.Check(b)||u(b))&&!(T in w))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(w,T)&&!S(b,A,w[T]))return!1}if(h.additionalProperties===!1){let T=Object.getOwnPropertyNames(w);return h.required&&h.required.length===s.length&&T.length===s.length?!0:T.every(b=>s.includes(b))}else return typeof h.additionalProperties=="object"?Object.getOwnPropertyNames(w).every(T=>s.includes(T)||S(h.additionalProperties,A,w[T])):!0}function N(h,A,w){return(0,t.IsPromise)(w)}function C(h,A,w){if(!r.TypeSystemPolicy.IsRecordLike(w)||l(h.minProperties)&&!(Object.getOwnPropertyNames(w).length>=h.minProperties)||l(h.maxProperties)&&!(Object.getOwnPropertyNames(w).length<=h.maxProperties))return!1;let[s,T]=Object.entries(h.patternProperties)[0],b=new RegExp(s),v=Object.entries(w).every(([J,ee])=>b.test(J)?S(T,A,ee):!0),U=typeof h.additionalProperties=="object"?Object.entries(w).every(([J,ee])=>b.test(J)?!0:S(h.additionalProperties,A,ee)):!0,L=h.additionalProperties===!1?Object.getOwnPropertyNames(w).every(J=>b.test(J)):!0;return v&&U&&L}function Q(h,A,w){return S((0,n.Deref)(h,A),A,w)}function X(h,A,w){return!(0,t.IsString)(w)||l(h.minLength)&&!(w.length>=h.minLength)||l(h.maxLength)&&!(w.length<=h.maxLength)||l(h.pattern)&&!new RegExp(h.pattern).test(w)?!1:l(h.format)?a.FormatRegistry.Has(h.format)?a.FormatRegistry.Get(h.format)(w):!1:!0}function O(h,A,w){return(0,t.IsSymbol)(w)}function K(h,A,w){return(0,t.IsString)(w)&&new RegExp(h.pattern).test(w)}function te(h,A,w){return S((0,n.Deref)(h,A),A,w)}function H(h,A,w){if(!(0,t.IsArray)(w)||h.items===void 0&&w.length!==0||w.length!==h.maxItems)return!1;if(!h.items)return!0;for(let s=0;s<h.items.length;s++)if(!S(h.items[s],A,w[s]))return!1;return!0}function W(h,A,w){return(0,t.IsUndefined)(w)}function fe(h,A,w){return h.anyOf.some(s=>S(s,A,w))}function f(h,A,w){return!(!(0,t.IsUint8Array)(w)||l(h.maxByteLength)&&!(w.length<=h.maxByteLength)||l(h.minByteLength)&&!(w.length>=h.minByteLength))}function _(h,A,w){return!0}function E(h,A,w){return r.TypeSystemPolicy.IsVoidLike(w)}function k(h,A,w){return a.TypeRegistry.Has(h[a.Kind])?a.TypeRegistry.Get(h[a.Kind])(h,w):!1}function S(h,A,w){let s=l(h.$id)?[...A,h]:A,T=h;switch(T[a.Kind]){case"Any":return c(T,s,w);case"Array":return m(T,s,w);case"AsyncIterator":return g(T,s,w);case"BigInt":return R(T,s,w);case"Boolean":return j(T,s,w);case"Constructor":return G(T,s,w);case"Date":return Z(T,s,w);case"Function":return ae(T,s,w);case"Integer":return B(T,s,w);case"Intersect":return V(T,s,w);case"Iterator":return q(T,s,w);case"Literal":return se(T,s,w);case"Never":return F(T,s,w);case"Not":return ue(T,s,w);case"Null":return z(T,s,w);case"Number":return pe(T,s,w);case"Object":return M(T,s,w);case"Promise":return N(T,s,w);case"Record":return C(T,s,w);case"Ref":return Q(T,s,w);case"String":return X(T,s,w);case"Symbol":return O(T,s,w);case"TemplateLiteral":return K(T,s,w);case"This":return te(T,s,w);case"Tuple":return H(T,s,w);case"Undefined":return W(T,s,w);case"Union":return fe(T,s,w);case"Uint8Array":return f(T,s,w);case"Unknown":return _(T,s,w);case"Void":return E(T,s,w);default:if(!a.TypeRegistry.Has(T[a.Kind]))throw new o(T);return k(T,s,w)}}function $(...h){return h.length===3?S(h[0],h[1],h[2]):S(h[0],[],h[1])}e.Check=$}),yT=Re(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=On(),r=Bo(),n=hT(),i=Lr(),a=class extends i.TypeBoxError{constructor(R,j,G){super("Unable to decode due to invalid value"),this.schema=R,this.value=j,this.error=G}};e.TransformDecodeCheckError=a;var o=class extends i.TypeBoxError{constructor(R,j,G){super("Unable to encode due to invalid value"),this.schema=R,this.value=j,this.error=G}};e.TransformEncodeCheckError=o;var u=class extends i.TypeBoxError{constructor(R,j,G){super(`${G instanceof Error?G.message:"Unknown error"}`),this.schema=R,this.value=j}};e.TransformDecodeError=u;var l=class extends i.TypeBoxError{constructor(R,j,G){super(`${G instanceof Error?G.message:"Unknown error"}`),this.schema=R,this.value=j}};e.TransformEncodeError=l;var c;(function(R){function j(O,K){return i.TypeGuard.TTransform(O)||C(O.items,K)}function G(O,K){return i.TypeGuard.TTransform(O)||C(O.items,K)}function Z(O,K){return i.TypeGuard.TTransform(O)||C(O.returns,K)||O.parameters.some(te=>C(te,K))}function ae(O,K){return i.TypeGuard.TTransform(O)||C(O.returns,K)||O.parameters.some(te=>C(te,K))}function B(O,K){return i.TypeGuard.TTransform(O)||i.TypeGuard.TTransform(O.unevaluatedProperties)||O.allOf.some(te=>C(te,K))}function V(O,K){return i.TypeGuard.TTransform(O)||C(O.items,K)}function q(O,K){return i.TypeGuard.TTransform(O)||C(O.not,K)}function se(O,K){return i.TypeGuard.TTransform(O)||Object.values(O.properties).some(te=>C(te,K))||i.TypeGuard.TSchema(O.additionalProperties)&&C(O.additionalProperties,K)}function F(O,K){return i.TypeGuard.TTransform(O)||C(O.item,K)}function ue(O,K){let te=Object.getOwnPropertyNames(O.patternProperties)[0],H=O.patternProperties[te];return i.TypeGuard.TTransform(O)||C(H,K)||i.TypeGuard.TSchema(O.additionalProperties)&&i.TypeGuard.TTransform(O.additionalProperties)}function z(O,K){return i.TypeGuard.TTransform(O)?!0:C((0,r.Deref)(O,K),K)}function pe(O,K){return i.TypeGuard.TTransform(O)?!0:C((0,r.Deref)(O,K),K)}function M(O,K){return i.TypeGuard.TTransform(O)||!(0,t.IsUndefined)(O.items)&&O.items.some(te=>C(te,K))}function N(O,K){return i.TypeGuard.TTransform(O)||O.anyOf.some(te=>C(te,K))}function C(O,K){let te=(0,t.IsString)(O.$id)?[...K,O]:K,H=O;if(O.$id&&Q.has(O.$id))return!1;switch(O.$id&&Q.add(O.$id),O[i.Kind]){case"Array":return j(H,te);case"AsyncIterator":return G(H,te);case"Constructor":return Z(H,te);case"Function":return ae(H,te);case"Intersect":return B(H,te);case"Iterator":return V(H,te);case"Not":return q(H,te);case"Object":return se(H,te);case"Promise":return F(H,te);case"Record":return ue(H,te);case"Ref":return z(H,te);case"This":return pe(H,te);case"Tuple":return M(H,te);case"Union":return N(H,te);default:return i.TypeGuard.TTransform(O)}}let Q=new Set;function X(O,K){return Q.clear(),C(O,K)}R.Has=X})(c||(e.HasTransform=c={}));var m;(function(R){function j(M,N){try{return i.TypeGuard.TTransform(M)?M[i.Transform].Decode(N):N}catch(C){throw new u(M,N,C)}}function G(M,N,C){return(0,t.IsArray)(C)?j(M,C.map(Q=>z(M.items,N,Q))):j(M,C)}function Z(M,N,C){if(!(0,t.IsPlainObject)(C)||(0,t.IsValueType)(C))return j(M,C);let Q=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),X=Q.reduce((H,W)=>W in H?{...H,[W]:z(i.IndexedAccessor.Resolve(M,[W]),N,H[W])}:H,C);if(!i.TypeGuard.TTransform(M.unevaluatedProperties))return j(M,X);let O=Object.getOwnPropertyNames(X),K=M.unevaluatedProperties,te=O.reduce((H,W)=>Q.includes(W)?H:{...H,[W]:j(K,H[W])},X);return j(M,te)}function ae(M,N,C){return j(M,z(M.not,N,C))}function B(M,N,C){if(!(0,t.IsPlainObject)(C))return j(M,C);let Q=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),X=Q.reduce((H,W)=>W in H?{...H,[W]:z(M.properties[W],N,H[W])}:H,C);if(!i.TypeGuard.TSchema(M.additionalProperties))return j(M,X);let O=Object.getOwnPropertyNames(X),K=M.additionalProperties,te=O.reduce((H,W)=>Q.includes(W)?H:{...H,[W]:j(K,H[W])},X);return j(M,te)}function V(M,N,C){if(!(0,t.IsPlainObject)(C))return j(M,C);let Q=Object.getOwnPropertyNames(M.patternProperties)[0],X=new RegExp(Q),O=Object.getOwnPropertyNames(C).reduce((W,fe)=>X.test(fe)?{...W,[fe]:z(M.patternProperties[Q],N,W[fe])}:W,C);if(!i.TypeGuard.TSchema(M.additionalProperties))return j(M,O);let K=Object.getOwnPropertyNames(O),te=M.additionalProperties,H=K.reduce((W,fe)=>X.test(fe)?W:{...W,[fe]:j(te,W[fe])},O);return j(M,H)}function q(M,N,C){let Q=(0,r.Deref)(M,N);return j(M,z(Q,N,C))}function se(M,N,C){let Q=(0,r.Deref)(M,N);return j(M,z(Q,N,C))}function F(M,N,C){return(0,t.IsArray)(C)&&(0,t.IsArray)(M.items)?j(M,M.items.map((Q,X)=>z(Q,N,C[X]))):j(M,C)}function ue(M,N,C){let Q=j(M,C);for(let X of M.anyOf)if((0,n.Check)(X,N,Q))return z(X,N,Q);return Q}function z(M,N,C){let Q=typeof M.$id=="string"?[...N,M]:N,X=M;switch(M[i.Kind]){case"Array":return G(X,Q,C);case"Intersect":return Z(X,Q,C);case"Not":return ae(X,Q,C);case"Object":return B(X,Q,C);case"Record":return V(X,Q,C);case"Ref":return q(X,Q,C);case"Symbol":return j(X,C);case"This":return se(X,Q,C);case"Tuple":return F(X,Q,C);case"Union":return ue(X,Q,C);default:return j(X,C)}}function pe(M,N,C){return z(M,N,C)}R.Decode=pe})(m||(e.DecodeTransform=m={}));var g;(function(R){function j(M,N){try{return i.TypeGuard.TTransform(M)?M[i.Transform].Encode(N):N}catch(C){throw new l(M,N,C)}}function G(M,N,C){let Q=j(M,C);return(0,t.IsArray)(Q)?Q.map(X=>z(M.items,N,X)):Q}function Z(M,N,C){let Q=j(M,C);if(!(0,t.IsPlainObject)(C)||(0,t.IsValueType)(C))return Q;let X=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),O=X.reduce((H,W)=>W in Q?{...H,[W]:z(i.IndexedAccessor.Resolve(M,[W]),N,H[W])}:H,Q);if(!i.TypeGuard.TTransform(M.unevaluatedProperties))return j(M,O);let K=Object.getOwnPropertyNames(O),te=M.unevaluatedProperties;return K.reduce((H,W)=>X.includes(W)?H:{...H,[W]:j(te,H[W])},O)}function ae(M,N,C){return j(M.not,j(M,C))}function B(M,N,C){let Q=j(M,C);if(!(0,t.IsPlainObject)(C))return Q;let X=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),O=X.reduce((H,W)=>W in H?{...H,[W]:z(M.properties[W],N,H[W])}:H,Q);if(!i.TypeGuard.TSchema(M.additionalProperties))return O;let K=Object.getOwnPropertyNames(O),te=M.additionalProperties;return K.reduce((H,W)=>X.includes(W)?H:{...H,[W]:j(te,H[W])},O)}function V(M,N,C){let Q=j(M,C);if(!(0,t.IsPlainObject)(C))return Q;let X=Object.getOwnPropertyNames(M.patternProperties)[0],O=new RegExp(X),K=Object.getOwnPropertyNames(C).reduce((W,fe)=>O.test(fe)?{...W,[fe]:z(M.patternProperties[X],N,W[fe])}:W,Q);if(!i.TypeGuard.TSchema(M.additionalProperties))return j(M,K);let te=Object.getOwnPropertyNames(K),H=M.additionalProperties;return te.reduce((W,fe)=>O.test(fe)?W:{...W,[fe]:j(H,W[fe])},K)}function q(M,N,C){let Q=(0,r.Deref)(M,N),X=z(Q,N,C);return j(M,X)}function se(M,N,C){let Q=(0,r.Deref)(M,N),X=z(Q,N,C);return j(M,X)}function F(M,N,C){let Q=j(M,C);return(0,t.IsArray)(M.items)?M.items.map((X,O)=>z(X,N,Q[O])):[]}function ue(M,N,C){for(let Q of M.anyOf){if(!(0,n.Check)(Q,N,C))continue;let X=z(Q,N,C);return j(M,X)}for(let Q of M.anyOf){let X=z(Q,N,C);if((0,n.Check)(M,N,X))return j(M,X)}return j(M,C)}function z(M,N,C){let Q=typeof M.$id=="string"?[...N,M]:N,X=M;switch(M[i.Kind]){case"Array":return G(X,Q,C);case"Intersect":return Z(X,Q,C);case"Not":return ae(X,Q,C);case"Object":return B(X,Q,C);case"Record":return V(X,Q,C);case"Ref":return q(X,Q,C);case"This":return se(X,Q,C);case"Tuple":return F(X,Q,C);case"Union":return ue(X,Q,C);default:return j(X,C)}}function pe(M,N,C){return z(M,N,C)}R.Encode=pe})(g||(e.EncodeTransform=g={}))}),mT=Re(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeCompiler=e.Policy=e.TypeCompilerTypeGuardError=e.TypeCompilerUnknownTypeError=e.TypeCheck=void 0;var t=yT(),r=On(),n=Co(),i=cd(),a=Bo(),o=xs(),u=Lr(),l=class{constructor(B,V,q,se){this.schema=B,this.references=V,this.checkFunc=q,this.code=se,this.hasTransform=t.HasTransform.Has(B,V)}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 V=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,B):B;if(!this.checkFunc(V))throw new t.TransformEncodeCheckError(this.schema,B,this.Errors(B).First());return V}};e.TypeCheck=l;var c;(function(B){function V(ue){return ue===36}B.DollarSign=V;function q(ue){return ue===95}B.IsUnderscore=q;function se(ue){return ue>=65&&ue<=90||ue>=97&&ue<=122}B.IsAlpha=se;function F(ue){return ue>=48&&ue<=57}B.IsNumeric=F})(c||(c={}));var m;(function(B){function V(ue){return ue.length===0?!1:c.IsNumeric(ue.charCodeAt(0))}function q(ue){if(V(ue))return!1;for(let z=0;z<ue.length;z++){let pe=ue.charCodeAt(z);if(!(c.IsAlpha(pe)||c.IsNumeric(pe)||c.DollarSign(pe)||c.IsUnderscore(pe)))return!1}return!0}function se(ue){return ue.replace(/'/g,"\\'")}function F(ue,z){return q(z)?`${ue}.${z}`:`${ue}['${se(z)}']`}B.Encode=F})(m||(m={}));var g;(function(B){function V(q){let se=[];for(let F=0;F<q.length;F++){let ue=q.charCodeAt(F);c.IsNumeric(ue)||c.IsAlpha(ue)?se.push(q.charAt(F)):se.push(`_${ue}_`)}return se.join("").replace(/__/g,"_")}B.Encode=V})(g||(g={}));var R;(function(B){function V(q){return q.replace(/'/g,"\\'")}B.Escape=V})(R||(R={}));var j=class extends u.TypeBoxError{constructor(B){super("Unknown type"),this.schema=B}};e.TypeCompilerUnknownTypeError=j;var G=class extends u.TypeBoxError{constructor(B){super("Preflight validation check failed to guard for the given schema"),this.schema=B}};e.TypeCompilerTypeGuardError=G;var Z;(function(B){function V(z,pe,M){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${pe}' in ${z} ? ${M} : true)`:`(${m.Encode(z,pe)} !== undefined ? ${M} : true)`}B.IsExactOptionalProperty=V;function q(z){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${z} === 'object' && ${z} !== null)`:`(typeof ${z} === 'object' && ${z} !== null && !Array.isArray(${z}))`}B.IsObjectLike=q;function se(z){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${z} === 'object' && ${z} !== null && !(${z} instanceof Date) && !(${z} instanceof Uint8Array))`:`(typeof ${z} === 'object' && ${z} !== null && !Array.isArray(${z}) && !(${z} instanceof Date) && !(${z} instanceof Uint8Array))`}B.IsRecordLike=se;function F(z){return i.TypeSystemPolicy.AllowNaN?`typeof ${z} === 'number'`:`(typeof ${z} === 'number' && Number.isFinite(${z}))`}B.IsNumberLike=F;function ue(z){return i.TypeSystemPolicy.AllowNullVoid?`(${z} === undefined || ${z} === null)`:`${z} === undefined`}B.IsVoidLike=ue})(Z||(e.Policy=Z={}));var ae;(function(B){function V(x){return x[u.Kind]==="Any"||x[u.Kind]==="Unknown"}function*q(x,le,I){yield"true"}function*se(x,le,I){yield`Array.isArray(${I})`;let[ge,ne]=[Be("value","any"),Be("acc","number")];(0,r.IsNumber)(x.maxItems)&&(yield`${I}.length <= ${x.maxItems}`),(0,r.IsNumber)(x.minItems)&&(yield`${I}.length >= ${x.minItems}`);let de=ee(x.items,le,"value");if(yield`${I}.every((${ge}) => ${de})`,u.TypeGuard.TSchema(x.contains)||(0,r.IsNumber)(x.minContains)||(0,r.IsNumber)(x.maxContains)){let Ie=u.TypeGuard.TSchema(x.contains)?x.contains:u.Type.Never(),Ce=ee(Ie,le,"value"),We=(0,r.IsNumber)(x.minContains)?[`(count >= ${x.minContains})`]:[],Ke=(0,r.IsNumber)(x.maxContains)?[`(count <= ${x.maxContains})`]:[],Qe=`const count = value.reduce((${ne}, ${ge}) => ${Ce} ? acc + 1 : acc, 0)`,Ht=["(count > 0)",...We,...Ke].join(" && ");yield`((${ge}) => { ${Qe}; return ${Ht}})(${I})`}x.uniqueItems===!0&&(yield`((${ge}) => { 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 } )(${I})`)}function*F(x,le,I){yield`(typeof value === 'object' && Symbol.asyncIterator in ${I})`}function*ue(x,le,I){yield`(typeof ${I} === 'bigint')`,(0,r.IsBigInt)(x.exclusiveMaximum)&&(yield`${I} < BigInt(${x.exclusiveMaximum})`),(0,r.IsBigInt)(x.exclusiveMinimum)&&(yield`${I} > BigInt(${x.exclusiveMinimum})`),(0,r.IsBigInt)(x.maximum)&&(yield`${I} <= BigInt(${x.maximum})`),(0,r.IsBigInt)(x.minimum)&&(yield`${I} >= BigInt(${x.minimum})`),(0,r.IsBigInt)(x.multipleOf)&&(yield`(${I} % BigInt(${x.multipleOf})) === 0`)}function*z(x,le,I){yield`(typeof ${I} === 'boolean')`}function*pe(x,le,I){yield*L(x.returns,le,`${I}.prototype`)}function*M(x,le,I){yield`(${I} instanceof Date) && Number.isFinite(${I}.getTime())`,(0,r.IsNumber)(x.exclusiveMaximumTimestamp)&&(yield`${I}.getTime() < ${x.exclusiveMaximumTimestamp}`),(0,r.IsNumber)(x.exclusiveMinimumTimestamp)&&(yield`${I}.getTime() > ${x.exclusiveMinimumTimestamp}`),(0,r.IsNumber)(x.maximumTimestamp)&&(yield`${I}.getTime() <= ${x.maximumTimestamp}`),(0,r.IsNumber)(x.minimumTimestamp)&&(yield`${I}.getTime() >= ${x.minimumTimestamp}`),(0,r.IsNumber)(x.multipleOfTimestamp)&&(yield`(${I}.getTime() % ${x.multipleOfTimestamp}) === 0`)}function*N(x,le,I){yield`(typeof ${I} === 'function')`}function*C(x,le,I){yield`(typeof ${I} === 'number' && Number.isInteger(${I}))`,(0,r.IsNumber)(x.exclusiveMaximum)&&(yield`${I} < ${x.exclusiveMaximum}`),(0,r.IsNumber)(x.exclusiveMinimum)&&(yield`${I} > ${x.exclusiveMinimum}`),(0,r.IsNumber)(x.maximum)&&(yield`${I} <= ${x.maximum}`),(0,r.IsNumber)(x.minimum)&&(yield`${I} >= ${x.minimum}`),(0,r.IsNumber)(x.multipleOf)&&(yield`(${I} % ${x.multipleOf}) === 0`)}function*Q(x,le,I){let ge=x.allOf.map(ne=>ee(ne,le,I)).join(" && ");if(x.unevaluatedProperties===!1){let ne=we(`${new RegExp(u.KeyResolver.ResolvePattern(x))};`),de=`Object.getOwnPropertyNames(${I}).every(key => ${ne}.test(key))`;yield`(${ge} && ${de})`}else if(u.TypeGuard.TSchema(x.unevaluatedProperties)){let ne=we(`${new RegExp(u.KeyResolver.ResolvePattern(x))};`),de=`Object.getOwnPropertyNames(${I}).every(key => ${ne}.test(key) || ${ee(x.unevaluatedProperties,le,`${I}[key]`)})`;yield`(${ge} && ${de})`}else yield`(${ge})`}function*X(x,le,I){yield`(typeof value === 'object' && Symbol.iterator in ${I})`}function*O(x,le,I){typeof x.const=="number"||typeof x.const=="boolean"?yield`(${I} === ${x.const})`:yield`(${I} === '${R.Escape(x.const)}')`}function*K(x,le,I){yield"false"}function*te(x,le,I){yield`(!${ee(x.not,le,I)})`}function*H(x,le,I){yield`(${I} === null)`}function*W(x,le,I){yield Z.IsNumberLike(I),(0,r.IsNumber)(x.exclusiveMaximum)&&(yield`${I} < ${x.exclusiveMaximum}`),(0,r.IsNumber)(x.exclusiveMinimum)&&(yield`${I} > ${x.exclusiveMinimum}`),(0,r.IsNumber)(x.maximum)&&(yield`${I} <= ${x.maximum}`),(0,r.IsNumber)(x.minimum)&&(yield`${I} >= ${x.minimum}`),(0,r.IsNumber)(x.multipleOf)&&(yield`(${I} % ${x.multipleOf}) === 0`)}function*fe(x,le,I){yield Z.IsObjectLike(I),(0,r.IsNumber)(x.minProperties)&&(yield`Object.getOwnPropertyNames(${I}).length >= ${x.minProperties}`),(0,r.IsNumber)(x.maxProperties)&&(yield`Object.getOwnPropertyNames(${I}).length <= ${x.maxProperties}`);let ge=Object.getOwnPropertyNames(x.properties);for(let ne of ge){let de=m.Encode(I,ne),Ie=x.properties[ne];if(x.required&&x.required.includes(ne))yield*L(Ie,le,de),(u.ExtendsUndefined.Check(Ie)||V(Ie))&&(yield`('${ne}' in ${I})`);else{let Ce=ee(Ie,le,de);yield Z.IsExactOptionalProperty(I,ne,Ce)}}if(x.additionalProperties===!1)if(x.required&&x.required.length===ge.length)yield`Object.getOwnPropertyNames(${I}).length === ${ge.length}`;else{let ne=`[${ge.map(de=>`'${de}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${I}).every(key => ${ne}.includes(key))`}if(typeof x.additionalProperties=="object"){let ne=ee(x.additionalProperties,le,`${I}[key]`),de=`[${ge.map(Ie=>`'${Ie}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${I}).every(key => ${de}.includes(key) || ${ne}))`}}function*f(x,le,I){yield`(typeof value === 'object' && typeof ${I}.then === 'function')`}function*_(x,le,I){yield Z.IsRecordLike(I),(0,r.IsNumber)(x.minProperties)&&(yield`Object.getOwnPropertyNames(${I}).length >= ${x.minProperties}`),(0,r.IsNumber)(x.maxProperties)&&(yield`Object.getOwnPropertyNames(${I}).length <= ${x.maxProperties}`);let[ge,ne]=Object.entries(x.patternProperties)[0],de=we(`${new RegExp(ge)}`),Ie=ee(ne,le,"value"),Ce=u.TypeGuard.TSchema(x.additionalProperties)?ee(x.additionalProperties,le,I):x.additionalProperties===!1?"false":"true",We=`(${de}.test(key) ? ${Ie} : ${Ce})`;yield`(Object.entries(${I}).every(([key, value]) => ${We}))`}function*E(x,le,I){let ge=(0,a.Deref)(x,le);if(J.functions.has(x.$ref))return yield`${ye(x.$ref)}(${I})`;yield*L(ge,le,I)}function*k(x,le,I){yield`(typeof ${I} === 'string')`,(0,r.IsNumber)(x.maxLength)&&(yield`${I}.length <= ${x.maxLength}`),(0,r.IsNumber)(x.minLength)&&(yield`${I}.length >= ${x.minLength}`),x.pattern!==void 0&&(yield`${we(`${new RegExp(x.pattern)};`)}.test(${I})`),x.format!==void 0&&(yield`format('${x.format}', ${I})`)}function*S(x,le,I){yield`(typeof ${I} === 'symbol')`}function*$(x,le,I){yield`(typeof ${I} === 'string')`,yield`${we(`${new RegExp(x.pattern)};`)}.test(${I})`}function*h(x,le,I){yield`${ye(x.$ref)}(${I})`}function*A(x,le,I){if(yield`Array.isArray(${I})`,x.items===void 0)return yield`${I}.length === 0`;yield`(${I}.length === ${x.maxItems})`;for(let ge=0;ge<x.items.length;ge++)yield`${ee(x.items[ge],le,`${I}[${ge}]`)}`}function*w(x,le,I){yield`${I} === undefined`}function*s(x,le,I){yield`(${x.anyOf.map(ge=>ee(ge,le,I)).join(" || ")})`}function*T(x,le,I){yield`${I} instanceof Uint8Array`,(0,r.IsNumber)(x.maxByteLength)&&(yield`(${I}.length <= ${x.maxByteLength})`),(0,r.IsNumber)(x.minByteLength)&&(yield`(${I}.length >= ${x.minByteLength})`)}function*b(x,le,I){yield"true"}function*v(x,le,I){yield Z.IsVoidLike(I)}function*U(x,le,I){let ge=J.instances.size;J.instances.set(ge,x),yield`kind('${x[u.Kind]}', ${ge}, ${I})`}function*L(x,le,I,ge=!0){let ne=(0,r.IsString)(x.$id)?[...le,x]:le,de=x;if(ge&&(0,r.IsString)(x.$id)){let Ie=ye(x.$id);if(J.functions.has(Ie))return yield`${Ie}(${I})`;{let Ce=je(Ie,x,le,"value",!1);return J.functions.set(Ie,Ce),yield`${Ie}(${I})`}}switch(de[u.Kind]){case"Any":return yield*q(de,ne,I);case"Array":return yield*se(de,ne,I);case"AsyncIterator":return yield*F(de,ne,I);case"BigInt":return yield*ue(de,ne,I);case"Boolean":return yield*z(de,ne,I);case"Constructor":return yield*pe(de,ne,I);case"Date":return yield*M(de,ne,I);case"Function":return yield*N(de,ne,I);case"Integer":return yield*C(de,ne,I);case"Intersect":return yield*Q(de,ne,I);case"Iterator":return yield*X(de,ne,I);case"Literal":return yield*O(de,ne,I);case"Never":return yield*K(de,ne,I);case"Not":return yield*te(de,ne,I);case"Null":return yield*H(de,ne,I);case"Number":return yield*W(de,ne,I);case"Object":return yield*fe(de,ne,I);case"Promise":return yield*f(de,ne,I);case"Record":return yield*_(de,ne,I);case"Ref":return yield*E(de,ne,I);case"String":return yield*k(de,ne,I);case"Symbol":return yield*S(de,ne,I);case"TemplateLiteral":return yield*$(de,ne,I);case"This":return yield*h(de,ne,I);case"Tuple":return yield*A(de,ne,I);case"Undefined":return yield*w(de,ne,I);case"Union":return yield*s(de,ne,I);case"Uint8Array":return yield*T(de,ne,I);case"Unknown":return yield*b(de,ne,I);case"Void":return yield*v(de,ne,I);default:if(!u.TypeRegistry.Has(de[u.Kind]))throw new j(x);return yield*U(de,ne,I)}}let J={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function ee(x,le,I,ge=!0){return`(${[...L(x,le,I,ge)].join(" && ")})`}function ye(x){return`check_${g.Encode(x)}`}function we(x){let le=`local_${J.variables.size}`;return J.variables.set(le,`const ${le} = ${x}`),le}function je(x,le,I,ge,ne=!0){let[de,Ie]=[`
|
|
27
|
+
`+" ".repeat(t)+a):a==="{"&&n>0?(n++,r+=a):(a==="}"&&n>1&&n--,r+=a)}return r}var{WARN:Dv,LOG:QE,DEBUG:Vv,VERBOSE:ZE,ERROR:al}=Oe.setup(Oe.INFO,{prefix:"[stream]"});function Ct(e){return e.init!==void 0}var Io=class{constructor(e,t,r=[],n){if(this._applogs=r,this.name=n,$t(this,"filters"),$t(this,"parents"),$t(this,"_subscribers",[]),this.parents=e&&!Array.isArray(e)?[e]:e,this.filters=t,this.parents?.length===0)throw new Error("Unhandled: empty parents");Br(this,{size:Ge,isEmpty:Ge,firstLog:Ge,latestLog:Ge},{name:`Stream{${n}}`})}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):Dv("unsubscribe called for non-existent",e)}notifySubscribers(e){Vv(`[stream: ${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}map(e){return this.applogs.map||al("applogs arr?!",this.applogs),this.applogs.map(e)}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);{let r=Object.keys(e);return!!this.applogs.find(n=>{if(!Mf(r,Object.keys(n)))throw al("[hasApplog] field set mismatch:",{applog:e,log:n});return Pf(n,e)})}}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 untrackedSize(){return Me(()=>this.size)}get nameAndSizeUntracked(){return Me(()=>`${this.name} (${this.size})`)}get prettyName(){return Lv(this.name)}},Fv=typeof global=="object"&&global&&global.Object===Object&&global,Df=Fv,zv=typeof self=="object"&&self&&self.Object===Object&&self,Gv=Df||zv||Function("return this")(),Gt=Gv,Kv=Gt.Symbol,sr=Kv,Vf=Object.prototype,Hv=Vf.hasOwnProperty,qv=Vf.toString,Kn=sr?sr.toStringTag:void 0;function Wv(e){var t=Hv.call(e,Kn),r=e[Kn];try{e[Kn]=void 0;var n=!0}catch{}var i=qv.call(e);return n&&(t?e[Kn]=r:delete e[Kn]),i}var Jv=Wv,Xv=Object.prototype,Yv=Xv.toString;function Qv(e){return Yv.call(e)}var Zv=Qv,eb="[object Null]",tb="[object Undefined]",sl=sr?sr.toStringTag:void 0;function rb(e){return e==null?e===void 0?tb:eb:sl&&sl in Object(e)?Jv(e):Zv(e)}var vn=rb;function nb(e){return e!=null&&typeof e=="object"}var fn=nb,ib="[object Symbol]";function ob(e){return typeof e=="symbol"||fn(e)&&vn(e)==ib}var ei=ob;function ab(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 sb=ab,ub=Array.isArray,zt=ub,cb=1/0,ul=sr?sr.prototype:void 0,cl=ul?ul.toString:void 0;function Ff(e){if(typeof e=="string")return e;if(zt(e))return sb(e,Ff)+"";if(ei(e))return cl?cl.call(e):"";var t=e+"";return t=="0"&&1/e==-cb?"-0":t}var lb=Ff;function fb(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var vs=fb;function db(e){return e}var pb=db,hb="[object AsyncFunction]",yb="[object Function]",mb="[object GeneratorFunction]",gb="[object Proxy]";function vb(e){if(!vs(e))return!1;var t=vn(e);return t==yb||t==mb||t==hb||t==gb}var zf=vb,bb=Gt["__core-js_shared__"],Ra=bb,ll=function(){var e=/[^.]+$/.exec(Ra&&Ra.keys&&Ra.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function wb(e){return!!ll&&ll in e}var _b=wb,Tb=Function.prototype,xb=Tb.toString;function Ob(e){if(e!=null){try{return xb.call(e)}catch{}try{return e+""}catch{}}return""}var Mr=Ob,Eb=/[\\^$.*+?()[\]{}|]/g,Ab=/^\[object .+?Constructor\]$/,Ib=Function.prototype,Sb=Object.prototype,$b=Ib.toString,kb=Sb.hasOwnProperty,Ub=RegExp("^"+$b.call(kb).replace(Eb,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function jb(e){if(!vs(e)||_b(e))return!1;var t=zf(e)?Ub:Ab;return t.test(Mr(e))}var Pb=jb;function Nb(e,t){return e?.[t]}var Bb=Nb;function Cb(e,t){var r=Bb(e,t);return Pb(r)?r:void 0}var bn=Cb,Rb=bn(Gt,"WeakMap"),Za=Rb,Mb=9007199254740991,Lb=/^(?:0|[1-9]\d*)$/;function Db(e,t){var r=typeof e;return t=t??Mb,!!t&&(r=="number"||r!="symbol"&&Lb.test(e))&&e>-1&&e%1==0&&e<t}var Gf=Db;function Vb(e,t){return e===t||e!==e&&t!==t}var Kf=Vb,Fb=9007199254740991;function zb(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Fb}var bs=zb;function Gb(e){return e!=null&&bs(e.length)&&!zf(e)}var Kb=Gb,Hb=Object.prototype;function qb(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Hb;return e===r}var Wb=qb;function Jb(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var Xb=Jb,Yb="[object Arguments]";function Qb(e){return fn(e)&&vn(e)==Yb}var fl=Qb,Hf=Object.prototype,Zb=Hf.hasOwnProperty,e0=Hf.propertyIsEnumerable,t0=fl(function(){return arguments}())?fl:function(e){return fn(e)&&Zb.call(e,"callee")&&!e0.call(e,"callee")},qf=t0;function r0(){return!1}var n0=r0,Wf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,dl=Wf&&typeof module=="object"&&module&&!module.nodeType&&module,i0=dl&&dl.exports===Wf,pl=i0?Gt.Buffer:void 0,o0=pl?pl.isBuffer:void 0,a0=o0||n0,es=a0,s0="[object Arguments]",u0="[object Array]",c0="[object Boolean]",l0="[object Date]",f0="[object Error]",d0="[object Function]",p0="[object Map]",h0="[object Number]",y0="[object Object]",m0="[object RegExp]",g0="[object Set]",v0="[object String]",b0="[object WeakMap]",w0="[object ArrayBuffer]",_0="[object DataView]",T0="[object Float32Array]",x0="[object Float64Array]",O0="[object Int8Array]",E0="[object Int16Array]",A0="[object Int32Array]",I0="[object Uint8Array]",S0="[object Uint8ClampedArray]",$0="[object Uint16Array]",k0="[object Uint32Array]",Pe={};Pe[T0]=Pe[x0]=Pe[O0]=Pe[E0]=Pe[A0]=Pe[I0]=Pe[S0]=Pe[$0]=Pe[k0]=!0;Pe[s0]=Pe[u0]=Pe[w0]=Pe[c0]=Pe[_0]=Pe[l0]=Pe[f0]=Pe[d0]=Pe[p0]=Pe[h0]=Pe[y0]=Pe[m0]=Pe[g0]=Pe[v0]=Pe[b0]=!1;function U0(e){return fn(e)&&bs(e.length)&&!!Pe[vn(e)]}var j0=U0;function P0(e){return function(t){return e(t)}}var N0=P0,Jf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Wn=Jf&&typeof module=="object"&&module&&!module.nodeType&&module,B0=Wn&&Wn.exports===Jf,Ma=B0&&Df.process,C0=function(){try{var e=Wn&&Wn.require&&Wn.require("util").types;return e||Ma&&Ma.binding&&Ma.binding("util")}catch{}}(),hl=C0,yl=hl&&hl.isTypedArray,R0=yl?N0(yl):j0,Xf=R0,M0=Object.prototype,L0=M0.hasOwnProperty;function D0(e,t){var r=zt(e),n=!r&&qf(e),i=!r&&!n&&es(e),a=!r&&!n&&!i&&Xf(e),o=r||n||i||a,u=o?Xb(e.length,String):[],l=u.length;for(var c in e)(t||L0.call(e,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||a&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Gf(c,l)))&&u.push(c);return u}var V0=D0;function F0(e,t){return function(r){return e(t(r))}}var z0=F0,G0=z0(Object.keys,Object),K0=G0,H0=Object.prototype,q0=H0.hasOwnProperty;function W0(e){if(!Wb(e))return K0(e);var t=[];for(var r in Object(e))q0.call(e,r)&&r!="constructor"&&t.push(r);return t}var J0=W0;function X0(e){return Kb(e)?V0(e):J0(e)}var Yf=X0,Y0=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q0=/^\w*$/;function Z0(e,t){if(zt(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||ei(e)?!0:Q0.test(e)||!Y0.test(e)||t!=null&&e in Object(t)}var ws=Z0,ew=bn(Object,"create"),ti=ew;function tw(){this.__data__=ti?ti(null):{},this.size=0}var rw=tw;function nw(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var iw=nw,ow="__lodash_hash_undefined__",aw=Object.prototype,sw=aw.hasOwnProperty;function uw(e){var t=this.__data__;if(ti){var r=t[e];return r===ow?void 0:r}return sw.call(t,e)?t[e]:void 0}var cw=uw,lw=Object.prototype,fw=lw.hasOwnProperty;function dw(e){var t=this.__data__;return ti?t[e]!==void 0:fw.call(t,e)}var pw=dw,hw="__lodash_hash_undefined__";function yw(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ti&&t===void 0?hw:t,this}var mw=yw;function wn(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])}}wn.prototype.clear=rw;wn.prototype.delete=iw;wn.prototype.get=cw;wn.prototype.has=pw;wn.prototype.set=mw;var ml=wn;function gw(){this.__data__=[],this.size=0}var vw=gw;function bw(e,t){for(var r=e.length;r--;)if(Kf(e[r][0],t))return r;return-1}var So=bw,ww=Array.prototype,_w=ww.splice;function Tw(e){var t=this.__data__,r=So(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():_w.call(t,r,1),--this.size,!0}var xw=Tw;function Ow(e){var t=this.__data__,r=So(t,e);return r<0?void 0:t[r][1]}var Ew=Ow;function Aw(e){return So(this.__data__,e)>-1}var Iw=Aw;function Sw(e,t){var r=this.__data__,n=So(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var $w=Sw;function _n(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])}}_n.prototype.clear=vw;_n.prototype.delete=xw;_n.prototype.get=Ew;_n.prototype.has=Iw;_n.prototype.set=$w;var $o=_n,kw=bn(Gt,"Map"),ri=kw;function Uw(){this.size=0,this.__data__={hash:new ml,map:new(ri||$o),string:new ml}}var jw=Uw;function Pw(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Nw=Pw;function Bw(e,t){var r=e.__data__;return Nw(t)?r[typeof t=="string"?"string":"hash"]:r.map}var ko=Bw;function Cw(e){var t=ko(this,e).delete(e);return this.size-=t?1:0,t}var Rw=Cw;function Mw(e){return ko(this,e).get(e)}var Lw=Mw;function Dw(e){return ko(this,e).has(e)}var Vw=Dw;function Fw(e,t){var r=ko(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var zw=Fw;function Tn(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])}}Tn.prototype.clear=jw;Tn.prototype.delete=Rw;Tn.prototype.get=Lw;Tn.prototype.has=Vw;Tn.prototype.set=zw;var Uo=Tn,Gw="Expected a function";function _s(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Gw);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(_s.Cache||Uo),r}_s.Cache=Uo;var Kw=_s,Hw=500;function qw(e){var t=Kw(e,function(n){return r.size===Hw&&r.clear(),n}),r=t.cache;return t}var Ww=qw,Jw=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Xw=/\\(\\)?/g,Yw=Ww(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Jw,function(r,n,i,a){t.push(i?a.replace(Xw,"$1"):n||r)}),t}),Qw=Yw;function Zw(e){return e==null?"":lb(e)}var e1=Zw;function t1(e,t){return zt(e)?e:ws(e,t)?[e]:Qw(e1(e))}var Qf=t1,r1=1/0;function n1(e){if(typeof e=="string"||ei(e))return e;var t=e+"";return t=="0"&&1/e==-r1?"-0":t}var jo=n1;function i1(e,t){t=Qf(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[jo(t[r++])];return r&&r==n?e:void 0}var Zf=i1;function o1(e,t,r){var n=e==null?void 0:Zf(e,t);return n===void 0?r:n}var a1=o1;function s1(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var u1=s1;function c1(){this.__data__=new $o,this.size=0}var l1=c1;function f1(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var d1=f1;function p1(e){return this.__data__.get(e)}var h1=p1;function y1(e){return this.__data__.has(e)}var m1=y1,g1=200;function v1(e,t){var r=this.__data__;if(r instanceof $o){var n=r.__data__;if(!ri||n.length<g1-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Uo(n)}return r.set(e,t),this.size=r.size,this}var b1=v1;function xn(e){var t=this.__data__=new $o(e);this.size=t.size}xn.prototype.clear=l1;xn.prototype.delete=d1;xn.prototype.get=h1;xn.prototype.has=m1;xn.prototype.set=b1;var so=xn;function w1(e,t){for(var r=-1,n=e==null?0:e.length,i=0,a=[];++r<n;){var o=e[r];t(o,r,e)&&(a[i++]=o)}return a}var _1=w1;function T1(){return[]}var x1=T1,O1=Object.prototype,E1=O1.propertyIsEnumerable,gl=Object.getOwnPropertySymbols,A1=gl?function(e){return e==null?[]:(e=Object(e),_1(gl(e),function(t){return E1.call(e,t)}))}:x1,I1=A1;function S1(e,t,r){var n=t(e);return zt(e)?n:u1(n,r(e))}var $1=S1;function k1(e){return $1(e,Yf,I1)}var vl=k1,U1=bn(Gt,"DataView"),ts=U1,j1=bn(Gt,"Promise"),rs=j1,P1=bn(Gt,"Set"),ns=P1,bl="[object Map]",N1="[object Object]",wl="[object Promise]",_l="[object Set]",Tl="[object WeakMap]",xl="[object DataView]",B1=Mr(ts),C1=Mr(ri),R1=Mr(rs),M1=Mr(ns),L1=Mr(Za),Ir=vn;(ts&&Ir(new ts(new ArrayBuffer(1)))!=xl||ri&&Ir(new ri)!=bl||rs&&Ir(rs.resolve())!=wl||ns&&Ir(new ns)!=_l||Za&&Ir(new Za)!=Tl)&&(Ir=function(e){var t=vn(e),r=t==N1?e.constructor:void 0,n=r?Mr(r):"";if(n)switch(n){case B1:return xl;case C1:return bl;case R1:return wl;case M1:return _l;case L1:return Tl}return t});var Ol=Ir,D1=Gt.Uint8Array,El=D1,V1="__lodash_hash_undefined__";function F1(e){return this.__data__.set(e,V1),this}var z1=F1;function G1(e){return this.__data__.has(e)}var K1=G1;function mo(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Uo;++t<r;)this.add(e[t])}mo.prototype.add=mo.prototype.push=z1;mo.prototype.has=K1;var H1=mo;function q1(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 W1=q1;function J1(e,t){return e.has(t)}var X1=J1,Y1=1,Q1=2;function Z1(e,t,r,n,i,a){var o=r&Y1,u=e.length,l=t.length;if(u!=l&&!(o&&l>u))return!1;var c=a.get(e),m=a.get(t);if(c&&m)return c==t&&m==e;var g=-1,R=!0,j=r&Q1?new H1:void 0;for(a.set(e,t),a.set(t,e);++g<u;){var G=e[g],Z=t[g];if(n)var ae=o?n(Z,G,g,t,e,a):n(G,Z,g,e,t,a);if(ae!==void 0){if(ae)continue;R=!1;break}if(j){if(!W1(t,function(B,V){if(!X1(j,V)&&(G===B||i(G,B,r,n,a)))return j.push(V)})){R=!1;break}}else if(!(G===Z||i(G,Z,r,n,a))){R=!1;break}}return a.delete(e),a.delete(t),R}var ed=Z1;function e_(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var t_=e_;function r_(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var n_=r_,i_=1,o_=2,a_="[object Boolean]",s_="[object Date]",u_="[object Error]",c_="[object Map]",l_="[object Number]",f_="[object RegExp]",d_="[object Set]",p_="[object String]",h_="[object Symbol]",y_="[object ArrayBuffer]",m_="[object DataView]",Al=sr?sr.prototype:void 0,La=Al?Al.valueOf:void 0;function g_(e,t,r,n,i,a,o){switch(r){case m_:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y_:return!(e.byteLength!=t.byteLength||!a(new El(e),new El(t)));case a_:case s_:case l_:return Kf(+e,+t);case u_:return e.name==t.name&&e.message==t.message;case f_:case p_:return e==t+"";case c_:var u=t_;case d_:var l=n&i_;if(u||(u=n_),e.size!=t.size&&!l)return!1;var c=o.get(e);if(c)return c==t;n|=o_,o.set(e,t);var m=ed(u(e),u(t),n,i,a,o);return o.delete(e),m;case h_:if(La)return La.call(e)==La.call(t)}return!1}var v_=g_,b_=1,w_=Object.prototype,__=w_.hasOwnProperty;function T_(e,t,r,n,i,a){var o=r&b_,u=vl(e),l=u.length,c=vl(t),m=c.length;if(l!=m&&!o)return!1;for(var g=l;g--;){var R=u[g];if(!(o?R in t:__.call(t,R)))return!1}var j=a.get(e),G=a.get(t);if(j&&G)return j==t&&G==e;var Z=!0;a.set(e,t),a.set(t,e);for(var ae=o;++g<l;){R=u[g];var B=e[R],V=t[R];if(n)var q=o?n(V,B,R,t,e,a):n(B,V,R,e,t,a);if(!(q===void 0?B===V||i(B,V,r,n,a):q)){Z=!1;break}ae||(ae=R=="constructor")}if(Z&&!ae){var se=e.constructor,F=t.constructor;se!=F&&"constructor"in e&&"constructor"in t&&!(typeof se=="function"&&se instanceof se&&typeof F=="function"&&F instanceof F)&&(Z=!1)}return a.delete(e),a.delete(t),Z}var x_=T_,O_=1,Il="[object Arguments]",Sl="[object Array]",no="[object Object]",E_=Object.prototype,$l=E_.hasOwnProperty;function A_(e,t,r,n,i,a){var o=zt(e),u=zt(t),l=o?Sl:Ol(e),c=u?Sl:Ol(t);l=l==Il?no:l,c=c==Il?no:c;var m=l==no,g=c==no,R=l==c;if(R&&es(e)){if(!es(t))return!1;o=!0,m=!1}if(R&&!m)return a||(a=new so),o||Xf(e)?ed(e,t,r,n,i,a):v_(e,t,l,r,n,i,a);if(!(r&O_)){var j=m&&$l.call(e,"__wrapped__"),G=g&&$l.call(t,"__wrapped__");if(j||G){var Z=j?e.value():e,ae=G?t.value():t;return a||(a=new so),i(Z,ae,r,n,a)}}return R?(a||(a=new so),x_(e,t,r,n,i,a)):!1}var I_=A_;function td(e,t,r,n,i){return e===t?!0:e==null||t==null||!fn(e)&&!fn(t)?e!==e&&t!==t:I_(e,t,r,n,td,i)}var rd=td,S_=1,$_=2;function k_(e,t,r,n){var i=r.length,a=i,o=!n;if(e==null)return!a;for(e=Object(e);i--;){var u=r[i];if(o&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++i<a;){u=r[i];var l=u[0],c=e[l],m=u[1];if(o&&u[2]){if(c===void 0&&!(l in e))return!1}else{var g=new so;if(n)var R=n(c,m,l,e,t,g);if(!(R===void 0?rd(m,c,S_|$_,n,g):R))return!1}}return!0}var U_=k_;function j_(e){return e===e&&!vs(e)}var nd=j_;function P_(e){for(var t=Yf(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,nd(i)]}return t}var N_=P_;function B_(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var id=B_;function C_(e){var t=N_(e);return t.length==1&&t[0][2]?id(t[0][0],t[0][1]):function(r){return r===e||U_(r,e,t)}}var R_=C_;function M_(e,t){return e!=null&&t in Object(e)}var L_=M_;function D_(e,t,r){t=Qf(t,e);for(var n=-1,i=t.length,a=!1;++n<i;){var o=jo(t[n]);if(!(a=e!=null&&r(e,o)))break;e=e[o]}return a||++n!=i?a:(i=e==null?0:e.length,!!i&&bs(i)&&Gf(o,i)&&(zt(e)||qf(e)))}var V_=D_;function F_(e,t){return e!=null&&V_(e,t,L_)}var z_=F_,G_=1,K_=2;function H_(e,t){return ws(e)&&nd(t)?id(jo(e),t):function(r){var n=a1(r,e);return n===void 0&&n===t?z_(r,e):rd(t,n,G_|K_)}}var q_=H_;function W_(e){return function(t){return t?.[e]}}var J_=W_;function X_(e){return function(t){return Zf(t,e)}}var Y_=X_;function Q_(e){return ws(e)?J_(jo(e)):Y_(e)}var Z_=Q_;function eT(e){return typeof e=="function"?e:e==null?pb:typeof e=="object"?zt(e)?q_(e[0],e[1]):R_(e):Z_(e)}var tT=eT,rT=4294967295,nT=rT-1,iT=Math.floor,oT=Math.min;function aT(e,t,r,n){var i=0,a=e==null?0:e.length;if(a===0)return 0;t=r(t);for(var o=t!==t,u=t===null,l=ei(t),c=t===void 0;i<a;){var m=iT((i+a)/2),g=r(e[m]),R=g!==void 0,j=g===null,G=g===g,Z=ei(g);if(o)var ae=n||G;else c?ae=G&&(n||R):u?ae=G&&R&&(n||!j):l?ae=G&&R&&!j&&(n||!Z):j||Z?ae=!1:ae=n?g<=t:g<t;ae?i=m+1:a=m}return oT(a,nT)}var sT=aT;function uT(e,t,r){return sT(e,t,tT(r,2))}var cT=uT,{WARN:lT,LOG:eA,DEBUG:fT,VERBOSE:Hn,ERROR:kl}=Oe.setup(Oe.INFO),yi=class extends Io{constructor(e,t,r,n,i){super(e,t,Ne.array([...r],{deep:!1,name:`${i}.array`}),i),this._initialLogs=r,this._eventMapper=n,this.name=i,$t(this,"_parentSubscriptions",new Map),Br(this,{onParentUpdate:gt}),this.subscribeToParent()}get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}subscribeToParent(){if(this.parents.length||lT("MappedStream has no parents",this),this._parentSubscriptions.size)throw kl("parents subs must not be called twice",this);Hn(`[MappedStream: ${this.name}] subscribing to parents:`,this.parents.map(e=>e.name)),this.parents.forEach(e=>{let t=this.onParentUpdate.bind(this,e);e.subscribe(t),this._parentSubscriptions.set(e,t)})}triggerRemap(){Hn(`MappedStream{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.forEach(e=>{this.onParentUpdate(e,{init:Me(()=>$r(e.applogs))})})}onParentUpdate(e,t){Hn(`MappedStream{${this.nameAndSizeUntracked}} parentUpdate`,t);let r=this._eventMapper(t,e);if(Hn(`MappedStream{${this.nameAndSizeUntracked}} parentUpdate => mapped`,r),Ct(r))this._applogs.replace([...r.init]);else{for(let n of r.added)this._applogs.splice(cT(this._applogs,n,"ts"),0,n);if(r.removed){for(let n of r.removed)if(!this._applogs.remove(n))if(!Ct(t)&&t.removed?.includes(n))fT("Ignoring remove event for non-existent because it was part of parent event's removed",n,t);else throw kl(`MappedStream{${this.name}} toRemove contained log that doesn't exist`,n,{stream:this,event:t,mapResult:r})}}Hn(`MappedStream{${this.nameAndSizeUntracked}} parentUpdate => deps?`,Yn(this._applogs)),this.notifySubscribers(r)}},{WARN:tA,LOG:rA,DEBUG:nA,VERBOSE:Da,ERROR:dT}=Oe.setup(Oe.INFO),dr=Ye(function(e,t,r={}){let n=od(t),i=is(n),a=Ne.array(Me(()=>i(e.applogs)),{deep:!1,name:`${e.name} | ${r.name||`rollingFilter.array{${vt(n)}}`}`}),o=m=>{let g;return Ct(m)?g={init:i(m.init)}:g={added:i(m.added),removed:m.removed},Da(`rollingFilter{${e.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,n,m,"=>",g),g},u=new yi(e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],a,o,`${e.name} | ${r.name||`rollingFilter{${vt(n)}}`}`),l=av(()=>JSON.parse(JSON.stringify(t)),m=>{Da(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,n,"=>",m),n=m,i=is(n),u.triggerRemap()}),c=li(a,()=>{Da(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} unobserve`,n),l(),c()});return u},{equals:gn,argsDebugName:(e,t,r)=>`${vt(t)}, ${vt(r)}`}),Ts=Ye(function(e,t,r={}){let n=Me(()=>t.call(null,{init:e.applogs},e));if(!Ct(n))throw dT("Initial run must return init event");let i=n.init;return new yi(e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],i,t,`${e.name} | ${r.name||"rollingMapper"}`)},{equals:gn,argsDebugName:(e,t,r)=>`${vt(t)}, ${vt(r)}`}),pT=Ye(function(e,t,r){return r=gt(r),r({init:e.applogs},t),e.subscribe(n=>{r(n,t)}),t},{argsDebugName:e=>`rollingAcc{${e.nameAndSizeUntracked}}`}),od=function(e){let t=Me(()=>Object.fromEntries(Object.entries($r(e)).map(([r,n])=>[$r(r),$r(n)])));if(!Object.entries(t).length)throw new Error("Pattern is empty");return t};function is(e){return t=>t.filter(r=>{for(let[n,i]of Object.entries(e)){let a=r[n.startsWith("!")?n.slice(1):n];if(!Cf(n,i,a))return!1}return!0})}var Lr=Re(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(f){let _=new Map;function E(){return new Map(_)}f.Entries=E;function k(){return _.clear()}f.Clear=k;function S(w){return _.delete(w)}f.Delete=S;function $(w){return _.has(w)}f.Has=$;function h(w,s){_.set(w,s)}f.Set=h;function A(w){return _.get(w)}f.Get=A})(t||(e.TypeRegistry=t={}));var r=class extends Error{constructor(f){super(f)}};e.TypeBoxError=r;var n;(function(f){let _=new Map;function E(){return new Map(_)}f.Entries=E;function k(){return _.clear()}f.Clear=k;function S(w){return _.delete(w)}f.Delete=S;function $(w){return _.has(w)}f.Has=$;function h(w,s){_.set(w,s)}f.Set=h;function A(w){return _.get(w)}f.Get=A})(n||(e.FormatRegistry=n={}));var i;(function(f){function _(b){return Array.isArray(b)}f.IsArray=_;function E(b){return typeof b=="bigint"}f.IsBigInt=E;function k(b){return typeof b=="boolean"}f.IsBoolean=k;function S(b){return b instanceof globalThis.Date}f.IsDate=S;function $(b){return b===null}f.IsNull=$;function h(b){return typeof b=="number"}f.IsNumber=h;function A(b){return typeof b=="object"&&b!==null}f.IsObject=A;function w(b){return typeof b=="string"}f.IsString=w;function s(b){return b instanceof globalThis.Uint8Array}f.IsUint8Array=s;function T(b){return b===void 0}f.IsUndefined=T})(i||(e.ValueGuard=i={}));var a=class extends r{};e.TypeGuardUnknownTypeError=a;var o;(function(f){function _(y){try{return new RegExp(y),!0}catch{return!1}}function E(y){if(!i.IsString(y))return!1;for(let $e=0;$e<y.length;$e++){let ut=y.charCodeAt($e);if(ut>=7&&ut<=13||ut===27||ut===127)return!1}return!0}function k(y){return h(y)||De(y)}function S(y){return i.IsUndefined(y)||i.IsBigInt(y)}function $(y){return i.IsUndefined(y)||i.IsNumber(y)}function h(y){return i.IsUndefined(y)||i.IsBoolean(y)}function A(y){return i.IsUndefined(y)||i.IsString(y)}function w(y){return i.IsUndefined(y)||i.IsString(y)&&E(y)&&_(y)}function s(y){return i.IsUndefined(y)||i.IsString(y)&&E(y)}function T(y){return i.IsUndefined(y)||De(y)}function b(y){return be(y,"Any")&&A(y.$id)}f.TAny=b;function v(y){return be(y,"Array")&&y.type==="array"&&A(y.$id)&&De(y.items)&&$(y.minItems)&&$(y.maxItems)&&h(y.uniqueItems)&&T(y.contains)&&$(y.minContains)&&$(y.maxContains)}f.TArray=v;function U(y){return be(y,"AsyncIterator")&&y.type==="AsyncIterator"&&A(y.$id)&&De(y.items)}f.TAsyncIterator=U;function L(y){return be(y,"BigInt")&&y.type==="bigint"&&A(y.$id)&&S(y.exclusiveMaximum)&&S(y.exclusiveMinimum)&&S(y.maximum)&&S(y.minimum)&&S(y.multipleOf)}f.TBigInt=L;function J(y){return be(y,"Boolean")&&y.type==="boolean"&&A(y.$id)}f.TBoolean=J;function ee(y){return be(y,"Constructor")&&y.type==="Constructor"&&A(y.$id)&&i.IsArray(y.parameters)&&y.parameters.every($e=>De($e))&&De(y.returns)}f.TConstructor=ee;function ye(y){return be(y,"Date")&&y.type==="Date"&&A(y.$id)&&$(y.exclusiveMaximumTimestamp)&&$(y.exclusiveMinimumTimestamp)&&$(y.maximumTimestamp)&&$(y.minimumTimestamp)&&$(y.multipleOfTimestamp)}f.TDate=ye;function we(y){return be(y,"Function")&&y.type==="Function"&&A(y.$id)&&i.IsArray(y.parameters)&&y.parameters.every($e=>De($e))&&De(y.returns)}f.TFunction=we;function je(y){return be(y,"Integer")&&y.type==="integer"&&A(y.$id)&&$(y.exclusiveMaximum)&&$(y.exclusiveMinimum)&&$(y.maximum)&&$(y.minimum)&&$(y.multipleOf)}f.TInteger=je;function Be(y){return be(y,"Intersect")&&!(i.IsString(y.type)&&y.type!=="object")&&i.IsArray(y.allOf)&&y.allOf.every($e=>De($e)&&!En($e))&&A(y.type)&&(h(y.unevaluatedProperties)||T(y.unevaluatedProperties))&&A(y.$id)}f.TIntersect=Be;function hr(y){return be(y,"Iterator")&&y.type==="Iterator"&&A(y.$id)&&De(y.items)}f.TIterator=hr;function be(y,$e){return Kt(y)&&y[e.Kind]===$e}f.TKindOf=be;function Kt(y){return i.IsObject(y)&&e.Kind in y&&i.IsString(y[e.Kind])}f.TKind=Kt;function yr(y){return I(y)&&i.IsString(y.const)}f.TLiteralString=yr;function x(y){return I(y)&&i.IsNumber(y.const)}f.TLiteralNumber=x;function le(y){return I(y)&&i.IsBoolean(y.const)}f.TLiteralBoolean=le;function I(y){return be(y,"Literal")&&A(y.$id)&&(i.IsBoolean(y.const)||i.IsNumber(y.const)||i.IsString(y.const))}f.TLiteral=I;function ge(y){return be(y,"Never")&&i.IsObject(y.not)&&Object.getOwnPropertyNames(y.not).length===0}f.TNever=ge;function ne(y){return be(y,"Not")&&De(y.not)}f.TNot=ne;function de(y){return be(y,"Null")&&y.type==="null"&&A(y.$id)}f.TNull=de;function Ie(y){return be(y,"Number")&&y.type==="number"&&A(y.$id)&&$(y.exclusiveMaximum)&&$(y.exclusiveMinimum)&&$(y.maximum)&&$(y.minimum)&&$(y.multipleOf)}f.TNumber=Ie;function Ce(y){return be(y,"Object")&&y.type==="object"&&A(y.$id)&&i.IsObject(y.properties)&&k(y.additionalProperties)&&$(y.minProperties)&&$(y.maxProperties)&&Object.entries(y.properties).every(([$e,ut])=>E($e)&&De(ut))}f.TObject=Ce;function We(y){return be(y,"Promise")&&y.type==="Promise"&&A(y.$id)&&De(y.item)}f.TPromise=We;function Ke(y){return be(y,"Record")&&y.type==="object"&&A(y.$id)&&k(y.additionalProperties)&&i.IsObject(y.patternProperties)&&($e=>{let ut=Object.getOwnPropertyNames($e.patternProperties);return ut.length===1&&_(ut[0])&&i.IsObject($e.patternProperties)&&De($e.patternProperties[ut[0]])})(y)}f.TRecord=Ke;function Qe(y){return i.IsObject(y)&&e.Hint in y&&y[e.Hint]==="Recursive"}f.TRecursive=Qe;function Ht(y){return be(y,"Ref")&&A(y.$id)&&i.IsString(y.$ref)}f.TRef=Ht;function Fr(y){return be(y,"String")&&y.type==="string"&&A(y.$id)&&$(y.minLength)&&$(y.maxLength)&&w(y.pattern)&&s(y.format)}f.TString=Fr;function zr(y){return be(y,"Symbol")&&y.type==="symbol"&&A(y.$id)}f.TSymbol=zr;function mr(y){return be(y,"TemplateLiteral")&&y.type==="string"&&i.IsString(y.pattern)&&y.pattern[0]==="^"&&y.pattern[y.pattern.length-1]==="$"}f.TTemplateLiteral=mr;function bi(y){return be(y,"This")&&A(y.$id)&&i.IsString(y.$ref)}f.TThis=bi;function En(y){return i.IsObject(y)&&e.Transform in y}f.TTransform=En;function Le(y){return be(y,"Tuple")&&y.type==="array"&&A(y.$id)&&i.IsNumber(y.minItems)&&i.IsNumber(y.maxItems)&&y.minItems===y.maxItems&&(i.IsUndefined(y.items)&&i.IsUndefined(y.additionalItems)&&y.minItems===0||i.IsArray(y.items)&&y.items.every($e=>De($e)))}f.TTuple=Le;function wi(y){return be(y,"Undefined")&&y.type==="undefined"&&A(y.$id)}f.TUndefined=wi;function Lo(y){return gr(y)&&y.anyOf.every($e=>yr($e)||x($e))}f.TUnionLiteral=Lo;function gr(y){return be(y,"Union")&&A(y.$id)&&i.IsObject(y)&&i.IsArray(y.anyOf)&&y.anyOf.every($e=>De($e))}f.TUnion=gr;function Gr(y){return be(y,"Uint8Array")&&y.type==="Uint8Array"&&A(y.$id)&&$(y.minByteLength)&&$(y.maxByteLength)}f.TUint8Array=Gr;function Je(y){return be(y,"Unknown")&&A(y.$id)}f.TUnknown=Je;function _i(y){return be(y,"Unsafe")}f.TUnsafe=_i;function An(y){return be(y,"Void")&&y.type==="void"&&A(y.$id)}f.TVoid=An;function Do(y){return i.IsObject(y)&&y[e.Readonly]==="Readonly"}f.TReadonly=Do;function Vo(y){return i.IsObject(y)&&y[e.Optional]==="Optional"}f.TOptional=Vo;function De(y){return i.IsObject(y)&&(b(y)||v(y)||J(y)||L(y)||U(y)||ee(y)||ye(y)||we(y)||je(y)||Be(y)||hr(y)||I(y)||ge(y)||ne(y)||de(y)||Ie(y)||Ce(y)||We(y)||Ke(y)||Ht(y)||Fr(y)||zr(y)||mr(y)||bi(y)||Le(y)||wi(y)||gr(y)||Gr(y)||Je(y)||_i(y)||An(y)||Kt(y)&&t.Has(y[e.Kind]))}f.TSchema=De})(o||(e.TypeGuard=o={}));var u;(function(f){function _(E){return E[e.Kind]==="Intersect"?E.allOf.every(k=>_(k)):E[e.Kind]==="Union"?E.anyOf.some(k=>_(k)):E[e.Kind]==="Undefined"?!0:E[e.Kind]==="Not"?!_(E.not):!1}f.Check=_})(u||(e.ExtendsUndefined=u={}));var l=class extends r{};e.TypeExtendsError=l;var c;(function(f){f[f.Union=0]="Union",f[f.True=1]="True",f[f.False=2]="False"})(c||(e.TypeExtendsResult=c={}));var m;(function(f){function _(p){return p===c.False?p:c.True}function E(p){throw new l(p)}function k(p){return o.TNever(p)||o.TIntersect(p)||o.TUnion(p)||o.TUnknown(p)||o.TAny(p)}function S(p,d){return o.TNever(d)?be(p,d):o.TIntersect(d)?we(p,d):o.TUnion(d)?Fo(p,d):o.TUnknown(d)?Us(p,d):o.TAny(d)?$(p,d):E("StructuralRight")}function $(p,d){return c.True}function h(p,d){return o.TIntersect(d)?we(p,d):o.TUnion(d)&&d.anyOf.some(Te=>o.TAny(Te)||o.TUnknown(Te))?c.True:o.TUnion(d)?c.Union:o.TUnknown(d)||o.TAny(d)?c.True:c.Union}function A(p,d){return o.TUnknown(p)?c.False:o.TAny(p)?c.Union:o.TNever(p)?c.True:c.False}function w(p,d){return o.TObject(d)&&mr(d)?c.True:k(d)?S(p,d):o.TArray(d)?_(ke(p.items,d.items)):c.False}function s(p,d){return k(d)?S(p,d):o.TAsyncIterator(d)?_(ke(p.items,d.items)):c.False}function T(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TBigInt(d)?c.True:c.False}function b(p,d){return o.TLiteral(p)&&i.IsBoolean(p.const)||o.TBoolean(p)?c.True:c.False}function v(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TBoolean(d)?c.True:c.False}function U(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TConstructor(d)?p.parameters.length>d.parameters.length?c.False:p.parameters.every((Te,Rt)=>_(ke(d.parameters[Rt],Te))===c.True)?_(ke(p.returns,d.returns)):c.False:c.False}function L(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TDate(d)?c.True:c.False}function J(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TFunction(d)?p.parameters.length>d.parameters.length?c.False:p.parameters.every((Te,Rt)=>_(ke(d.parameters[Rt],Te))===c.True)?_(ke(p.returns,d.returns)):c.False:c.False}function ee(p,d){return o.TLiteral(p)&&i.IsNumber(p.const)||o.TNumber(p)||o.TInteger(p)?c.True:c.False}function ye(p,d){return o.TInteger(d)||o.TNumber(d)?c.True:k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):c.False}function we(p,d){return d.allOf.every(Te=>ke(p,Te)===c.True)?c.True:c.False}function je(p,d){return p.allOf.some(Te=>ke(Te,d)===c.True)?c.True:c.False}function Be(p,d){return k(d)?S(p,d):o.TIterator(d)?_(ke(p.items,d.items)):c.False}function hr(p,d){return o.TLiteral(d)&&d.const===p.const?c.True:k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TString(d)?An(p,d):o.TNumber(d)?I(p,d):o.TInteger(d)?ee(p,d):o.TBoolean(d)?b(p,d):c.False}function be(p,d){return c.False}function Kt(p,d){return c.True}function yr(p){let[d,Te]=[p,0];for(;o.TNot(d);)d=d.not,Te+=1;return Te%2===0?d:e.Type.Unknown()}function x(p,d){return o.TNot(p)?ke(yr(p),d):o.TNot(d)?ke(p,yr(d)):E("Invalid fallthrough for Not")}function le(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TNull(d)?c.True:c.False}function I(p,d){return o.TLiteralNumber(p)||o.TNumber(p)||o.TInteger(p)?c.True:c.False}function ge(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TInteger(d)||o.TNumber(d)?c.True:c.False}function ne(p,d){return Object.getOwnPropertyNames(p.properties).length===d}function de(p){return mr(p)}function Ie(p){return ne(p,0)||ne(p,1)&&"description"in p.properties&&o.TUnion(p.properties.description)&&p.properties.description.anyOf.length===2&&(o.TString(p.properties.description.anyOf[0])&&o.TUndefined(p.properties.description.anyOf[1])||o.TString(p.properties.description.anyOf[1])&&o.TUndefined(p.properties.description.anyOf[0]))}function Ce(p){return ne(p,0)}function We(p){return ne(p,0)}function Ke(p){return ne(p,0)}function Qe(p){return ne(p,0)}function Ht(p){return mr(p)}function Fr(p){let d=e.Type.Number();return ne(p,0)||ne(p,1)&&"length"in p.properties&&_(ke(p.properties.length,d))===c.True}function zr(p){return ne(p,0)}function mr(p){let d=e.Type.Number();return ne(p,0)||ne(p,1)&&"length"in p.properties&&_(ke(p.properties.length,d))===c.True}function bi(p){let d=e.Type.Function([e.Type.Any()],e.Type.Any());return ne(p,0)||ne(p,1)&&"then"in p.properties&&_(ke(p.properties.then,d))===c.True}function En(p,d){return ke(p,d)===c.False||o.TOptional(p)&&!o.TOptional(d)?c.False:c.True}function Le(p,d){return o.TUnknown(p)?c.False:o.TAny(p)?c.Union:o.TNever(p)||o.TLiteralString(p)&&de(d)||o.TLiteralNumber(p)&&Ce(d)||o.TLiteralBoolean(p)&&We(d)||o.TSymbol(p)&&Ie(d)||o.TBigInt(p)&&Ke(d)||o.TString(p)&&de(d)||o.TSymbol(p)&&Ie(d)||o.TNumber(p)&&Ce(d)||o.TInteger(p)&&Ce(d)||o.TBoolean(p)&&We(d)||o.TUint8Array(p)&&Ht(d)||o.TDate(p)&&Qe(d)||o.TConstructor(p)&&zr(d)||o.TFunction(p)&&Fr(d)?c.True:o.TRecord(p)&&o.TString(gr(p))?d[e.Hint]==="Record"?c.True:c.False:o.TRecord(p)&&o.TNumber(gr(p))&&ne(d,0)?c.True:c.False}function wi(p,d){return k(d)?S(p,d):o.TRecord(d)?Je(p,d):o.TObject(d)?(()=>{for(let Te of Object.getOwnPropertyNames(d.properties)){if(!(Te in p.properties)&&!o.TOptional(d.properties[Te]))return c.False;if(o.TOptional(d.properties[Te]))return c.True;if(En(p.properties[Te],d.properties[Te])===c.False)return c.False}return c.True})():c.False}function Lo(p,d){return k(d)?S(p,d):o.TObject(d)&&bi(d)?c.True:o.TPromise(d)?_(ke(p.item,d.item)):c.False}function gr(p){return e.PatternNumberExact in p.patternProperties?e.Type.Number():e.PatternStringExact in p.patternProperties?e.Type.String():E("Unknown record key pattern")}function Gr(p){return e.PatternNumberExact in p.patternProperties?p.patternProperties[e.PatternNumberExact]:e.PatternStringExact in p.patternProperties?p.patternProperties[e.PatternStringExact]:E("Unable to get record value schema")}function Je(p,d){let[Te,Rt]=[gr(d),Gr(d)];return o.TLiteralString(p)&&o.TNumber(Te)&&_(ke(p,Rt))===c.True?c.True:o.TUint8Array(p)&&o.TNumber(Te)||o.TString(p)&&o.TNumber(Te)||o.TArray(p)&&o.TNumber(Te)?ke(p,Rt):o.TObject(p)?(()=>{for(let Hd of Object.getOwnPropertyNames(p.properties))if(En(Rt,p.properties[Hd])===c.False)return c.False;return c.True})():c.False}function _i(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?ke(Gr(p),Gr(d)):c.False}function An(p,d){return o.TLiteral(p)&&i.IsString(p.const)||o.TString(p)?c.True:c.False}function Do(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TString(d)?c.True:c.False}function Vo(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TSymbol(d)?c.True:c.False}function De(p,d){return o.TTemplateLiteral(p)?ke(F.Resolve(p),d):o.TTemplateLiteral(d)?ke(p,F.Resolve(d)):E("Invalid fallthrough for TemplateLiteral")}function y(p,d){return o.TArray(d)&&p.items!==void 0&&p.items.every(Te=>ke(Te,d.items)===c.True)}function $e(p,d){return o.TNever(p)?c.True:o.TUnknown(p)?c.False:o.TAny(p)?c.Union:c.False}function ut(p,d){return k(d)?S(p,d):o.TObject(d)&&mr(d)||o.TArray(d)&&y(p,d)?c.True:o.TTuple(d)?i.IsUndefined(p.items)&&!i.IsUndefined(d.items)||!i.IsUndefined(p.items)&&i.IsUndefined(d.items)?c.False:i.IsUndefined(p.items)&&!i.IsUndefined(d.items)||p.items.every((Te,Rt)=>ke(Te,d.items[Rt])===c.True)?c.True:c.False:c.False}function Ld(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TUint8Array(d)?c.True:c.False}function Dd(p,d){return k(d)?S(p,d):o.TObject(d)?Le(p,d):o.TRecord(d)?Je(p,d):o.TVoid(d)?zd(p,d):o.TUndefined(d)?c.True:c.False}function Fo(p,d){return d.anyOf.some(Te=>ke(p,Te)===c.True)?c.True:c.False}function Vd(p,d){return p.anyOf.every(Te=>ke(Te,d)===c.True)?c.True:c.False}function Us(p,d){return c.True}function Fd(p,d){return o.TNever(d)?be(p,d):o.TIntersect(d)?we(p,d):o.TUnion(d)?Fo(p,d):o.TAny(d)?$(p,d):o.TString(d)?An(p,d):o.TNumber(d)?I(p,d):o.TInteger(d)?ee(p,d):o.TBoolean(d)?b(p,d):o.TArray(d)?A(p,d):o.TTuple(d)?$e(p,d):o.TObject(d)?Le(p,d):o.TUnknown(d)?c.True:c.False}function zd(p,d){return o.TUndefined(p)||o.TUndefined(p)?c.True:c.False}function Gd(p,d){return o.TIntersect(d)?we(p,d):o.TUnion(d)?Fo(p,d):o.TUnknown(d)?Us(p,d):o.TAny(d)?$(p,d):o.TObject(d)?Le(p,d):o.TVoid(d)?c.True:c.False}function ke(p,d){return o.TTemplateLiteral(p)||o.TTemplateLiteral(d)?De(p,d):o.TNot(p)||o.TNot(d)?x(p,d):o.TAny(p)?h(p,d):o.TArray(p)?w(p,d):o.TBigInt(p)?T(p,d):o.TBoolean(p)?v(p,d):o.TAsyncIterator(p)?s(p,d):o.TConstructor(p)?U(p,d):o.TDate(p)?L(p,d):o.TFunction(p)?J(p,d):o.TInteger(p)?ye(p,d):o.TIntersect(p)?je(p,d):o.TIterator(p)?Be(p,d):o.TLiteral(p)?hr(p,d):o.TNever(p)?Kt(p,d):o.TNull(p)?le(p,d):o.TNumber(p)?ge(p,d):o.TObject(p)?wi(p,d):o.TRecord(p)?_i(p,d):o.TString(p)?Do(p,d):o.TSymbol(p)?Vo(p,d):o.TTuple(p)?ut(p,d):o.TPromise(p)?Lo(p,d):o.TUint8Array(p)?Ld(p,d):o.TUndefined(p)?Dd(p,d):o.TUnion(p)?Vd(p,d):o.TUnknown(p)?Fd(p,d):o.TVoid(p)?Gd(p,d):E(`Unknown left type operand '${p[e.Kind]}'`)}function Kd(p,d){return ke(p,d)}f.Extends=Kd})(m||(e.TypeExtends=m={}));var g;(function(f){function _(w){return w.map(s=>$(s))}function E(w){return new Date(w.getTime())}function k(w){return new Uint8Array(w)}function S(w){let s=Object.getOwnPropertyNames(w).reduce((b,v)=>({...b,[v]:$(w[v])}),{}),T=Object.getOwnPropertySymbols(w).reduce((b,v)=>({...b,[v]:$(w[v])}),{});return{...s,...T}}function $(w){return i.IsArray(w)?_(w):i.IsDate(w)?E(w):i.IsUint8Array(w)?k(w):i.IsObject(w)?S(w):w}function h(w){return w.map(s=>A(s))}f.Rest=h;function A(w,s={}){return{...$(w),...s}}f.Type=A})(g||(e.TypeClone=g={}));var R;(function(f){function _(U){return U.map(L=>{let{[e.Optional]:J,...ee}=g.Type(L);return ee})}function E(U){return U.every(L=>o.TOptional(L))}function k(U){return U.some(L=>o.TOptional(L))}function S(U){return E(U.allOf)?e.Type.Optional(e.Type.Intersect(_(U.allOf))):U}function $(U){return k(U.anyOf)?e.Type.Optional(e.Type.Union(_(U.anyOf))):U}function h(U){return U[e.Kind]==="Intersect"?S(U):U[e.Kind]==="Union"?$(U):U}function A(U,L){let J=U.allOf.reduce((ee,ye)=>{let we=b(ye,L);return we[e.Kind]==="Never"?ee:[...ee,we]},[]);return h(e.Type.Intersect(J))}function w(U,L){let J=U.anyOf.map(ee=>b(ee,L));return h(e.Type.Union(J))}function s(U,L){let J=U.properties[L];return i.IsUndefined(J)?e.Type.Never():e.Type.Union([J])}function T(U,L){let J=U.items;if(i.IsUndefined(J))return e.Type.Never();let ee=J[L];return i.IsUndefined(ee)?e.Type.Never():ee}function b(U,L){return U[e.Kind]==="Intersect"?A(U,L):U[e.Kind]==="Union"?w(U,L):U[e.Kind]==="Object"?s(U,L):U[e.Kind]==="Tuple"?T(U,L):e.Type.Never()}function v(U,L,J={}){let ee=L.map(ye=>b(U,ye.toString()));return h(e.Type.Union(ee,J))}f.Resolve=v})(R||(e.IndexedAccessor=R={}));var j;(function(f){function _(T){let[b,v]=[T.slice(0,1),T.slice(1)];return`${b.toLowerCase()}${v}`}function E(T){let[b,v]=[T.slice(0,1),T.slice(1)];return`${b.toUpperCase()}${v}`}function k(T){return T.toUpperCase()}function S(T){return T.toLowerCase()}function $(T,b){let v=z.ParseExact(T.pattern);if(!M.Check(v))return{...T,pattern:h(T.pattern,b)};let U=[...C.Generate(v)].map(ee=>e.Type.Literal(ee)),L=A(U,b),J=e.Type.Union(L);return e.Type.TemplateLiteral([J])}function h(T,b){return typeof T=="string"?b==="Uncapitalize"?_(T):b==="Capitalize"?E(T):b==="Uppercase"?k(T):b==="Lowercase"?S(T):T:T.toString()}function A(T,b){if(T.length===0)return[];let[v,...U]=T;return[s(v,b),...A(U,b)]}function w(T,b){return o.TTemplateLiteral(T)?$(T,b):o.TUnion(T)?e.Type.Union(A(T.anyOf,b)):o.TLiteral(T)?e.Type.Literal(h(T.const,b)):T}function s(T,b){return w(T,b)}f.Map=s})(j||(e.Intrinsic=j={}));var G;(function(f){function _(h,A){return e.Type.Intersect(h.allOf.map(w=>S(w,A)),{...h})}function E(h,A){return e.Type.Union(h.anyOf.map(w=>S(w,A)),{...h})}function k(h,A){return A(h)}function S(h,A){return h[e.Kind]==="Intersect"?_(h,A):h[e.Kind]==="Union"?E(h,A):h[e.Kind]==="Object"?k(h,A):h}function $(h,A,w){return{...S(g.Type(h),A),...w}}f.Map=$})(G||(e.ObjectMap=G={}));var Z;(function(f){function _(s){return s[0]==="^"&&s[s.length-1]==="$"?s.slice(1,s.length-1):s}function E(s,T){return s.allOf.reduce((b,v)=>[...b,...h(v,T)],[])}function k(s,T){let b=s.anyOf.map(v=>h(v,T));return[...b.reduce((v,U)=>U.map(L=>b.every(J=>J.includes(L))?v.add(L):v)[0],new Set)]}function S(s,T){return Object.getOwnPropertyNames(s.properties)}function $(s,T){return T.includePatterns?Object.getOwnPropertyNames(s.patternProperties):[]}function h(s,T){return o.TIntersect(s)?E(s,T):o.TUnion(s)?k(s,T):o.TObject(s)?S(s,T):o.TRecord(s)?$(s,T):[]}function A(s,T){return[...new Set(h(s,T))]}f.ResolveKeys=A;function w(s){return`^(${A(s,{includePatterns:!0}).map(T=>`(${_(T)})`).join("|")})$`}f.ResolvePattern=w})(Z||(e.KeyResolver=Z={}));var ae=class extends r{};e.KeyArrayResolverError=ae;var B;(function(f){function _(E){return Array.isArray(E)?E:o.TUnionLiteral(E)?E.anyOf.map(k=>k.const.toString()):o.TLiteral(E)?[E.const]:o.TTemplateLiteral(E)?(()=>{let k=z.ParseExact(E.pattern);if(!M.Check(k))throw new ae("Cannot resolve keys from infinite template expression");return[...C.Generate(k)]})():[]}f.Resolve=_})(B||(e.KeyArrayResolver=B={}));var V;(function(f){function*_(k){for(let S of k.anyOf)S[e.Kind]==="Union"?yield*_(S):yield S}function E(k){return e.Type.Union([..._(k)],{...k})}f.Resolve=E})(V||(e.UnionResolver=V={}));var q=class extends r{};e.TemplateLiteralPatternError=q;var se;(function(f){function _($){throw new q($)}function E($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function k($,h){return o.TTemplateLiteral($)?$.pattern.slice(1,$.pattern.length-1):o.TUnion($)?`(${$.anyOf.map(A=>k(A,h)).join("|")})`:o.TNumber($)?`${h}${e.PatternNumber}`:o.TInteger($)?`${h}${e.PatternNumber}`:o.TBigInt($)?`${h}${e.PatternNumber}`:o.TString($)?`${h}${e.PatternString}`:o.TLiteral($)?`${h}${E($.const.toString())}`:o.TBoolean($)?`${h}${e.PatternBoolean}`:_(`Unexpected Kind '${$[e.Kind]}'`)}function S($){return`^${$.map(h=>k(h,"")).join("")}$`}f.Create=S})(se||(e.TemplateLiteralPattern=se={}));var F;(function(f){function _(E){let k=z.ParseExact(E.pattern);if(!M.Check(k))return e.Type.String();let S=[...C.Generate(k)].map($=>e.Type.Literal($));return e.Type.Union(S)}f.Resolve=_})(F||(e.TemplateLiteralResolver=F={}));var ue=class extends r{};e.TemplateLiteralParserError=ue;var z;(function(f){function _(U,L,J){return U[L]===J&&U.charCodeAt(L-1)!==92}function E(U,L){return _(U,L,"(")}function k(U,L){return _(U,L,")")}function S(U,L){return _(U,L,"|")}function $(U){if(!(E(U,0)&&k(U,U.length-1)))return!1;let L=0;for(let J=0;J<U.length;J++)if(E(U,J)&&(L+=1),k(U,J)&&(L-=1),L===0&&J!==U.length-1)return!1;return!0}function h(U){return U.slice(1,U.length-1)}function A(U){let L=0;for(let J=0;J<U.length;J++)if(E(U,J)&&(L+=1),k(U,J)&&(L-=1),S(U,J)&&L===0)return!0;return!1}function w(U){for(let L=0;L<U.length;L++)if(E(U,L))return!0;return!1}function s(U){let[L,J]=[0,0],ee=[];for(let we=0;we<U.length;we++)if(E(U,we)&&(L+=1),k(U,we)&&(L-=1),S(U,we)&&L===0){let je=U.slice(J,we);je.length>0&&ee.push(b(je)),J=we+1}let ye=U.slice(J);return ye.length>0&&ee.push(b(ye)),ee.length===0?{type:"const",const:""}:ee.length===1?ee[0]:{type:"or",expr:ee}}function T(U){function L(ye,we){if(!E(ye,we))throw new ue("TemplateLiteralParser: Index must point to open parens");let je=0;for(let Be=we;Be<ye.length;Be++)if(E(ye,Be)&&(je+=1),k(ye,Be)&&(je-=1),je===0)return[we,Be];throw new ue("TemplateLiteralParser: Unclosed group parens in expression")}function J(ye,we){for(let je=we;je<ye.length;je++)if(E(ye,je))return[we,je];return[we,ye.length]}let ee=[];for(let ye=0;ye<U.length;ye++)if(E(U,ye)){let[we,je]=L(U,ye),Be=U.slice(we,je+1);ee.push(b(Be)),ye=je}else{let[we,je]=J(U,ye),Be=U.slice(we,je);Be.length>0&&ee.push(b(Be)),ye=je-1}return ee.length===0?{type:"const",const:""}:ee.length===1?ee[0]:{type:"and",expr:ee}}function b(U){return $(U)?b(h(U)):A(U)?s(U):w(U)?T(U):{type:"const",const:U}}f.Parse=b;function v(U){return b(U.slice(1,U.length-1))}f.ParseExact=v})(z||(e.TemplateLiteralParser=z={}));var pe=class extends r{};e.TemplateLiteralFiniteError=pe;var M;(function(f){function _(h){throw new pe(h)}function E(h){return h.type==="or"&&h.expr.length===2&&h.expr[0].type==="const"&&h.expr[0].const==="0"&&h.expr[1].type==="const"&&h.expr[1].const==="[1-9][0-9]*"}function k(h){return h.type==="or"&&h.expr.length===2&&h.expr[0].type==="const"&&h.expr[0].const==="true"&&h.expr[1].type==="const"&&h.expr[1].const==="false"}function S(h){return h.type==="const"&&h.const===".*"}function $(h){return k(h)?!0:E(h)||S(h)?!1:h.type==="and"?h.expr.every(A=>$(A)):h.type==="or"?h.expr.every(A=>$(A)):h.type==="const"?!0:_("Unknown expression type")}f.Check=$})(M||(e.TemplateLiteralFinite=M={}));var N=class extends r{};e.TemplateLiteralGeneratorError=N;var C;(function(f){function*_(h){if(h.length===1)return yield*h[0];for(let A of h[0])for(let w of _(h.slice(1)))yield`${A}${w}`}function*E(h){return yield*_(h.expr.map(A=>[...$(A)]))}function*k(h){for(let A of h.expr)yield*$(A)}function*S(h){return yield h.const}function*$(h){return h.type==="and"?yield*E(h):h.type==="or"?yield*k(h):h.type==="const"?yield*S(h):(()=>{throw new N("Unknown expression")})()}f.Generate=$})(C||(e.TemplateLiteralGenerator=C={}));var Q;(function(f){function*_($){let h=$.trim().replace(/"|'/g,"");return h==="boolean"?yield e.Type.Boolean():h==="number"?yield e.Type.Number():h==="bigint"?yield e.Type.BigInt():h==="string"?yield e.Type.String():yield(()=>{let A=h.split("|").map(w=>e.Type.Literal(w.trim()));return A.length===0?e.Type.Never():A.length===1?A[0]:e.Type.Union(A)})()}function*E($){if($[1]!=="{"){let h=e.Type.Literal("$"),A=k($.slice(1));return yield*[h,...A]}for(let h=2;h<$.length;h++)if($[h]==="}"){let A=_($.slice(2,h)),w=k($.slice(h+1));return yield*[...A,...w]}yield e.Type.Literal($)}function*k($){for(let h=0;h<$.length;h++)if($[h]==="$"){let A=e.Type.Literal($.slice(0,h)),w=E($.slice(h));return yield*[A,...w]}yield e.Type.Literal($)}function S($){return[...k($)]}f.Parse=S})(Q||(e.TemplateLiteralDslParser=Q={}));var X=class{constructor(f){this.schema=f}Decode(f){return new O(this.schema,f)}};e.TransformDecodeBuilder=X;var O=class{constructor(f,_){this.schema=f,this.decode=_}Encode(f){let _=g.Type(this.schema);return o.TTransform(_)?(()=>{let E={Encode:k=>_[e.Transform].Encode(f(k)),Decode:k=>this.decode(_[e.Transform].Decode(k))};return{..._,[e.Transform]:E}})():(()=>{let E={Decode:this.decode,Encode:f};return{..._,[e.Transform]:E}})()}};e.TransformEncodeBuilder=O;var K=0,te=class extends r{};e.TypeBuilderError=te;var H=class{Create(f){return f}Throw(f){throw new te(f)}Discard(f,_){return _.reduce((E,k)=>{let{[k]:S,...$}=E;return $},f)}Strict(f){return JSON.parse(JSON.stringify(f))}};e.TypeBuilder=H;var W=class extends H{ReadonlyOptional(f){return this.Readonly(this.Optional(f))}Readonly(f){return{...g.Type(f),[e.Readonly]:"Readonly"}}Optional(f){return{...g.Type(f),[e.Optional]:"Optional"}}Any(f={}){return this.Create({...f,[e.Kind]:"Any"})}Array(f,_={}){return this.Create({..._,[e.Kind]:"Array",type:"array",items:g.Type(f)})}Boolean(f={}){return this.Create({...f,[e.Kind]:"Boolean",type:"boolean"})}Capitalize(f,_={}){return{...j.Map(g.Type(f),"Capitalize"),..._}}Composite(f,_){let E=e.Type.Intersect(f,{}),k=Z.ResolveKeys(E,{includePatterns:!1}).reduce((S,$)=>({...S,[$]:e.Type.Index(E,[$])}),{});return e.Type.Object(k,_)}Enum(f,_={}){if(i.IsUndefined(f))return this.Throw("Enum undefined or empty");let E=Object.getOwnPropertyNames(f).filter(S=>isNaN(S)).map(S=>f[S]),k=[...new Set(E)].map(S=>e.Type.Literal(S));return this.Union(k,{..._,[e.Hint]:"Enum"})}Extends(f,_,E,k,S={}){switch(m.Extends(f,_)){case c.Union:return this.Union([g.Type(E,S),g.Type(k,S)]);case c.True:return g.Type(E,S);case c.False:return g.Type(k,S)}}Exclude(f,_,E={}){return o.TTemplateLiteral(f)?this.Exclude(F.Resolve(f),_,E):o.TTemplateLiteral(_)?this.Exclude(f,F.Resolve(_),E):o.TUnion(f)?(()=>{let k=f.anyOf.filter(S=>m.Extends(S,_)===c.False);return k.length===1?g.Type(k[0],E):this.Union(k,E)})():m.Extends(f,_)!==c.False?this.Never(E):g.Type(f,E)}Extract(f,_,E={}){return o.TTemplateLiteral(f)?this.Extract(F.Resolve(f),_,E):o.TTemplateLiteral(_)?this.Extract(f,F.Resolve(_),E):o.TUnion(f)?(()=>{let k=f.anyOf.filter(S=>m.Extends(S,_)!==c.False);return k.length===1?g.Type(k[0],E):this.Union(k,E)})():m.Extends(f,_)!==c.False?g.Type(f,E):this.Never(E)}Index(f,_,E={}){return o.TArray(f)&&o.TNumber(_)?g.Type(f.items,E):o.TTuple(f)&&o.TNumber(_)?(()=>{let k=(i.IsUndefined(f.items)?[]:f.items).map(S=>g.Type(S));return this.Union(k,E)})():(()=>{let k=B.Resolve(_),S=g.Type(f);return R.Resolve(S,k,E)})()}Integer(f={}){return this.Create({...f,[e.Kind]:"Integer",type:"integer"})}Intersect(f,_={}){if(f.length===0)return e.Type.Never();if(f.length===1)return g.Type(f[0],_);f.some($=>o.TTransform($))&&this.Throw("Cannot intersect transform types");let E=f.every($=>o.TObject($)),k=g.Rest(f),S=o.TSchema(_.unevaluatedProperties)?{unevaluatedProperties:g.Type(_.unevaluatedProperties)}:{};return _.unevaluatedProperties===!1||o.TSchema(_.unevaluatedProperties)||E?this.Create({..._,...S,[e.Kind]:"Intersect",type:"object",allOf:k}):this.Create({..._,...S,[e.Kind]:"Intersect",allOf:k})}KeyOf(f,_={}){return o.TRecord(f)?(()=>{let E=Object.getOwnPropertyNames(f.patternProperties)[0];return E===e.PatternNumberExact?this.Number(_):E===e.PatternStringExact?this.String(_):this.Throw("Unable to resolve key type from Record key pattern")})():o.TTuple(f)?(()=>{let E=(i.IsUndefined(f.items)?[]:f.items).map((k,S)=>e.Type.Literal(S.toString()));return this.Union(E,_)})():o.TArray(f)?this.Number(_):(()=>{let E=Z.ResolveKeys(f,{includePatterns:!1});if(E.length===0)return this.Never(_);let k=E.map(S=>this.Literal(S));return this.Union(k,_)})()}Literal(f,_={}){return this.Create({..._,[e.Kind]:"Literal",const:f,type:typeof f})}Lowercase(f,_={}){return{...j.Map(g.Type(f),"Lowercase"),..._}}Never(f={}){return this.Create({...f,[e.Kind]:"Never",not:{}})}Not(f,_){return this.Create({..._,[e.Kind]:"Not",not:g.Type(f)})}Null(f={}){return this.Create({...f,[e.Kind]:"Null",type:"null"})}Number(f={}){return this.Create({...f,[e.Kind]:"Number",type:"number"})}Object(f,_={}){let E=Object.getOwnPropertyNames(f),k=E.filter(A=>o.TOptional(f[A])),S=E.filter(A=>!k.includes(A)),$=o.TSchema(_.additionalProperties)?{additionalProperties:g.Type(_.additionalProperties)}:{},h=E.reduce((A,w)=>({...A,[w]:g.Type(f[w])}),{});return S.length>0?this.Create({..._,...$,[e.Kind]:"Object",type:"object",properties:h,required:S}):this.Create({..._,...$,[e.Kind]:"Object",type:"object",properties:h})}Omit(f,_,E={}){let k=B.Resolve(_);return G.Map(this.Discard(g.Type(f),["$id",e.Transform]),S=>{i.IsArray(S.required)&&(S.required=S.required.filter($=>!k.includes($)),S.required.length===0&&delete S.required);for(let $ of Object.getOwnPropertyNames(S.properties))k.includes($)&&delete S.properties[$];return this.Create(S)},E)}Partial(f,_={}){return G.Map(this.Discard(g.Type(f),["$id",e.Transform]),E=>{let k=Object.getOwnPropertyNames(E.properties).reduce((S,$)=>({...S,[$]:this.Optional(E.properties[$])}),{});return this.Object(k,this.Discard(E,["required"]))},_)}Pick(f,_,E={}){let k=B.Resolve(_);return G.Map(this.Discard(g.Type(f),["$id",e.Transform]),S=>{i.IsArray(S.required)&&(S.required=S.required.filter($=>k.includes($)),S.required.length===0&&delete S.required);for(let $ of Object.getOwnPropertyNames(S.properties))k.includes($)||delete S.properties[$];return this.Create(S)},E)}Record(f,_,E={}){return o.TTemplateLiteral(f)?(()=>{let k=z.ParseExact(f.pattern);return M.Check(k)?this.Object([...C.Generate(k)].reduce((S,$)=>({...S,[$]:g.Type(_)}),{}),E):this.Create({...E,[e.Kind]:"Record",type:"object",patternProperties:{[f.pattern]:g.Type(_)}})})():o.TUnion(f)?(()=>{let k=V.Resolve(f);if(o.TUnionLiteral(k)){let S=k.anyOf.reduce(($,h)=>({...$,[h.const]:g.Type(_)}),{});return this.Object(S,{...E,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():o.TLiteral(f)?i.IsString(f.const)||i.IsNumber(f.const)?this.Object({[f.const]:g.Type(_)},E):this.Throw("Record key of type literal is not of type string or number"):o.TInteger(f)||o.TNumber(f)?this.Create({...E,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:g.Type(_)}}):o.TString(f)?(()=>{let k=i.IsUndefined(f.pattern)?e.PatternStringExact:f.pattern;return this.Create({...E,[e.Kind]:"Record",type:"object",patternProperties:{[k]:g.Type(_)}})})():this.Never()}Recursive(f,_={}){i.IsUndefined(_.$id)&&(_.$id=`T${K++}`);let E=f({[e.Kind]:"This",$ref:`${_.$id}`});return E.$id=_.$id,this.Create({..._,[e.Hint]:"Recursive",...E})}Ref(f,_={}){return i.IsString(f)?this.Create({..._,[e.Kind]:"Ref",$ref:f}):(i.IsUndefined(f.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({..._,[e.Kind]:"Ref",$ref:f.$id}))}Required(f,_={}){return G.Map(this.Discard(g.Type(f),["$id",e.Transform]),E=>{let k=Object.getOwnPropertyNames(E.properties).reduce((S,$)=>({...S,[$]:this.Discard(E.properties[$],[e.Optional])}),{});return this.Object(k,E)},_)}Rest(f){return o.TTuple(f)&&!i.IsUndefined(f.items)?g.Rest(f.items):o.TIntersect(f)?g.Rest(f.allOf):o.TUnion(f)?g.Rest(f.anyOf):[]}String(f={}){return this.Create({...f,[e.Kind]:"String",type:"string"})}TemplateLiteral(f,_={}){let E=i.IsString(f)?se.Create(Q.Parse(f)):se.Create(f);return this.Create({..._,[e.Kind]:"TemplateLiteral",type:"string",pattern:E})}Transform(f){return new X(f)}Tuple(f,_={}){let[E,k,S]=[!1,f.length,f.length],$=g.Rest(f),h=f.length>0?{..._,[e.Kind]:"Tuple",type:"array",items:$,additionalItems:E,minItems:k,maxItems:S}:{..._,[e.Kind]:"Tuple",type:"array",minItems:k,maxItems:S};return this.Create(h)}Uncapitalize(f,_={}){return{...j.Map(g.Type(f),"Uncapitalize"),..._}}Union(f,_={}){return o.TTemplateLiteral(f)?F.Resolve(f):(()=>{let E=f;if(E.length===0)return this.Never(_);if(E.length===1)return this.Create(g.Type(E[0],_));let k=g.Rest(E);return this.Create({..._,[e.Kind]:"Union",anyOf:k})})()}Unknown(f={}){return this.Create({...f,[e.Kind]:"Unknown"})}Unsafe(f={}){return this.Create({...f,[e.Kind]:f[e.Kind]||"Unsafe"})}Uppercase(f,_={}){return{...j.Map(g.Type(f),"Uppercase"),..._}}};e.JsonTypeBuilder=W;var fe=class extends W{AsyncIterator(f,_={}){return this.Create({..._,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:g.Type(f)})}Awaited(f,_={}){let E=k=>k.length>0?(()=>{let[S,...$]=k;return[this.Awaited(S),...E($)]})():k;return o.TIntersect(f)?e.Type.Intersect(E(f.allOf)):o.TUnion(f)?e.Type.Union(E(f.anyOf)):o.TPromise(f)?this.Awaited(f.item):g.Type(f,_)}BigInt(f={}){return this.Create({...f,[e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(f,_={}){return this.Tuple([...f.parameters],{..._})}Constructor(f,_,E){let[k,S]=[g.Rest(f),g.Type(_)];return this.Create({...E,[e.Kind]:"Constructor",type:"Constructor",parameters:k,returns:S})}Date(f={}){return this.Create({...f,[e.Kind]:"Date",type:"Date"})}Function(f,_,E){let[k,S]=[g.Rest(f),g.Type(_)];return this.Create({...E,[e.Kind]:"Function",type:"Function",parameters:k,returns:S})}InstanceType(f,_={}){return g.Type(f.returns,_)}Iterator(f,_={}){return this.Create({..._,[e.Kind]:"Iterator",type:"Iterator",items:g.Type(f)})}Parameters(f,_={}){return this.Tuple(f.parameters,{..._})}Promise(f,_={}){return this.Create({..._,[e.Kind]:"Promise",type:"Promise",item:g.Type(f)})}RegExp(f,_={}){let E=i.IsString(f)?f:f.source;return this.Create({..._,[e.Kind]:"String",type:"string",pattern:E})}RegEx(f,_={}){return this.RegExp(f,_)}ReturnType(f,_={}){return g.Type(f.returns,_)}Symbol(f){return this.Create({...f,[e.Kind]:"Symbol",type:"symbol"})}Undefined(f={}){return this.Create({...f,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(f={}){return this.Create({...f,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(f={}){return this.Create({...f,[e.Kind]:"Void",type:"void"})}};e.JavaScriptTypeBuilder=fe,e.JsonType=new W,e.Type=new fe}),On=Re(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(F){return c(F)&&Symbol.asyncIterator in F}e.IsAsyncIterator=t;function r(F){return c(F)&&Symbol.iterator in F}e.IsIterator=r;function n(F){return ArrayBuffer.isView(F)}e.IsTypedArray=n;function i(F){return F instanceof Promise}e.IsPromise=i;function a(F){return F instanceof Uint8Array}e.IsUint8Array=a;function o(F){return F instanceof Date&&Number.isFinite(F.getTime())}e.IsDate=o;function u(F,ue){return ue in F}e.HasPropertyKey=u;function l(F){return c(F)&&V(F.constructor)&&F.constructor.name==="Object"}e.IsPlainObject=l;function c(F){return F!==null&&typeof F=="object"}e.IsObject=c;function m(F){return Array.isArray(F)&&!ArrayBuffer.isView(F)}e.IsArray=m;function g(F){return F===void 0}e.IsUndefined=g;function R(F){return F===null}e.IsNull=R;function j(F){return typeof F=="boolean"}e.IsBoolean=j;function G(F){return typeof F=="number"}e.IsNumber=G;function Z(F){return G(F)&&Number.isInteger(F)}e.IsInteger=Z;function ae(F){return typeof F=="bigint"}e.IsBigInt=ae;function B(F){return typeof F=="string"}e.IsString=B;function V(F){return typeof F=="function"}e.IsFunction=V;function q(F){return typeof F=="symbol"}e.IsSymbol=q;function se(F){return ae(F)||j(F)||R(F)||G(F)||B(F)||q(F)||g(F)}e.IsValueType=se}),cd=Re(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=On(),r=Co(),n=Lr(),i=class extends n.TypeBoxError{constructor(m){super(`Duplicate type kind '${m}' detected`)}};e.TypeSystemDuplicateTypeKind=i;var a=class extends n.TypeBoxError{constructor(m){super(`Duplicate string format '${m}' detected`)}};e.TypeSystemDuplicateFormat=a;var o;(function(m){function g(j,G){if(n.TypeRegistry.Has(j))throw new i(j);return n.TypeRegistry.Set(j,G),(Z={})=>n.Type.Unsafe({...Z,[n.Kind]:j})}m.Type=g;function R(j,G){if(n.FormatRegistry.Has(j))throw new a(j);return n.FormatRegistry.Set(j,G),j}m.Format=R})(o||(e.TypeSystem=o={}));var u;(function(m){let g=c;function R(){g=c}m.Reset=R;function j(Z){g=Z}m.Set=j;function G(){return g}m.Get=G})(u||(e.TypeSystemErrorFunction=u={}));var l;(function(m){m.ExactOptionalPropertyTypes=!1,m.AllowArrayObject=!1,m.AllowNaN=!1,m.AllowNullVoid=!1;function g(ae,B){return m.ExactOptionalPropertyTypes?B in ae:ae[B]!==void 0}m.IsExactOptionalProperty=g;function R(ae){let B=(0,t.IsObject)(ae);return m.AllowArrayObject?B:B&&!(0,t.IsArray)(ae)}m.IsObjectLike=R;function j(ae){return R(ae)&&!(ae instanceof Date)&&!(ae instanceof Uint8Array)}m.IsRecordLike=j;function G(ae){let B=(0,t.IsNumber)(ae);return m.AllowNaN?B:B&&Number.isFinite(ae)}m.IsNumberLike=G;function Z(ae){let B=(0,t.IsUndefined)(ae);return m.AllowNullVoid?B||ae===null:B}m.IsVoidLike=Z})(l||(e.TypeSystemPolicy=l={}));function c(m,g){switch(g){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 ${m.maxContains} matching values`;case r.ValueErrorType.ArrayMinContains:return`Expected array to contain at least ${m.minContains} matching values`;case r.ValueErrorType.ArrayMaxItems:return`Expected array length to be less or equal to ${m.maxItems}`;case r.ValueErrorType.ArrayMinItems:return`Expected array length to be greater or equal to ${m.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 ${m.exclusiveMaximum}`;case r.ValueErrorType.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${m.exclusiveMinimum}`;case r.ValueErrorType.BigIntMaximum:return`Expected bigint to be less or equal to ${m.maximum}`;case r.ValueErrorType.BigIntMinimum:return`Expected bigint to be greater or equal to ${m.minimum}`;case r.ValueErrorType.BigIntMultipleOf:return`Expected bigint to be a multiple of ${m.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 ${m.exclusiveMinimumTimestamp}`;case r.ValueErrorType.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${m.exclusiveMaximumTimestamp}`;case r.ValueErrorType.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${m.minimumTimestamp}`;case r.ValueErrorType.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${m.maximumTimestamp}`;case r.ValueErrorType.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${m.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 ${m.exclusiveMaximum}`;case r.ValueErrorType.IntegerExclusiveMinimum:return`Expected integer to be greater than ${m.exclusiveMinimum}`;case r.ValueErrorType.IntegerMaximum:return`Expected integer to be less or equal to ${m.maximum}`;case r.ValueErrorType.IntegerMinimum:return`Expected integer to be greater or equal to ${m.minimum}`;case r.ValueErrorType.IntegerMultipleOf:return`Expected integer to be a multiple of ${m.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 m.const=="string"?`'${m.const}'`:m.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 ${m.exclusiveMaximum}`;case r.ValueErrorType.NumberExclusiveMinimum:return`Expected number to be greater than ${m.exclusiveMinimum}`;case r.ValueErrorType.NumberMaximum:return`Expected number to be less or equal to ${m.maximum}`;case r.ValueErrorType.NumberMinimum:return`Expected number to be greater or equal to ${m.minimum}`;case r.ValueErrorType.NumberMultipleOf:return`Expected number to be a multiple of ${m.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 ${m.maxProperties} properties`;case r.ValueErrorType.ObjectMinProperties:return`Expected object to have at least ${m.minProperties} properties`;case r.ValueErrorType.ObjectRequiredProperty:return"Required property";case r.ValueErrorType.Promise:return"Expected Promise";case r.ValueErrorType.StringFormatUnknown:return`Unknown format '${m.format}'`;case r.ValueErrorType.StringFormat:return`Expected string to match '${m.format}' format`;case r.ValueErrorType.StringMaxLength:return`Expected string length less or equal to ${m.maxLength}`;case r.ValueErrorType.StringMinLength:return`Expected string length greater or equal to ${m.minLength}`;case r.ValueErrorType.StringPattern:return`Expected string to match '${m.pattern}'`;case r.ValueErrorType.String:return"Expected string";case r.ValueErrorType.Symbol:return"Expected symbol";case r.ValueErrorType.TupleLength:return`Expected tuple to have ${m.maxItems||0} elements`;case r.ValueErrorType.Tuple:return"Expected tuple";case r.ValueErrorType.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${m.maxByteLength}`;case r.ValueErrorType.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${m.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 '${m[n.Kind]}'`;default:return"Unknown error type"}}e.DefaultErrorFunction=c}),Bo=Re(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Deref=e.TypeDereferenceError=void 0;var t=Lr(),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,a){let o=a.findIndex(u=>u.$id===i.$ref);if(o===-1)throw new r(i);return a[o]}e.Deref=n}),Os=Re(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.ByteMarker=e.ValueHashError=void 0;var t=On(),r=class extends Error{constructor(N){super("Unable to hash value"),this.value=N}};e.ValueHashError=r;var n;(function(N){N[N.Undefined=0]="Undefined",N[N.Null=1]="Null",N[N.Boolean=2]="Boolean",N[N.Number=3]="Number",N[N.String=4]="String",N[N.Object=5]="Object",N[N.Array=6]="Array",N[N.Date=7]="Date",N[N.Uint8Array=8]="Uint8Array",N[N.Symbol=9]="Symbol",N[N.BigInt=10]="BigInt"})(n||(e.ByteMarker=n={}));var i=BigInt("14695981039346656037"),[a,o]=[BigInt("1099511628211"),BigInt("2")**BigInt("64")],u=Array.from({length:256}).map((N,C)=>BigInt(C)),l=new Float64Array(1),c=new DataView(l.buffer),m=new Uint8Array(l.buffer);function*g(N){let C=N===0?1:Math.ceil(Math.floor(Math.log2(N)+1)/8);for(let Q=0;Q<C;Q++)yield N>>8*(C-1-Q)&255}function R(N){pe(n.Array);for(let C of N)z(C)}function j(N){pe(n.Boolean),pe(N?1:0)}function G(N){pe(n.BigInt),c.setBigInt64(0,N);for(let C of m)pe(C)}function Z(N){pe(n.Date),z(N.getTime())}function ae(N){pe(n.Null)}function B(N){pe(n.Number),c.setFloat64(0,N);for(let C of m)pe(C)}function V(N){pe(n.Object);for(let C of globalThis.Object.keys(N).sort())z(C),z(N[C])}function q(N){pe(n.String);for(let C=0;C<N.length;C++)for(let Q of g(N.charCodeAt(C)))pe(Q)}function se(N){pe(n.Symbol),z(N.description)}function F(N){pe(n.Uint8Array);for(let C=0;C<N.length;C++)pe(N[C])}function ue(N){return pe(n.Undefined)}function z(N){if((0,t.IsArray)(N))return R(N);if((0,t.IsBoolean)(N))return j(N);if((0,t.IsBigInt)(N))return G(N);if((0,t.IsDate)(N))return Z(N);if((0,t.IsNull)(N))return ae(N);if((0,t.IsNumber)(N))return B(N);if((0,t.IsPlainObject)(N))return V(N);if((0,t.IsString)(N))return q(N);if((0,t.IsSymbol)(N))return se(N);if((0,t.IsUint8Array)(N))return F(N);if((0,t.IsUndefined)(N))return ue(N);throw new r(N)}function pe(N){i=i^u[N],i=i*a%o}function M(N){return i=BigInt("14695981039346656037"),z(N),i}e.Hash=M}),Co=Re(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Errors=e.ValueErrorIterator=e.EscapeKey=e.ValueErrorsUnknownTypeError=e.ValueErrorType=void 0;var t=On(),r=cd(),n=Bo(),i=Os(),a=Lr(),o;(function(s){s[s.ArrayContains=0]="ArrayContains",s[s.ArrayMaxContains=1]="ArrayMaxContains",s[s.ArrayMaxItems=2]="ArrayMaxItems",s[s.ArrayMinContains=3]="ArrayMinContains",s[s.ArrayMinItems=4]="ArrayMinItems",s[s.ArrayUniqueItems=5]="ArrayUniqueItems",s[s.Array=6]="Array",s[s.AsyncIterator=7]="AsyncIterator",s[s.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",s[s.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",s[s.BigIntMaximum=10]="BigIntMaximum",s[s.BigIntMinimum=11]="BigIntMinimum",s[s.BigIntMultipleOf=12]="BigIntMultipleOf",s[s.BigInt=13]="BigInt",s[s.Boolean=14]="Boolean",s[s.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",s[s.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",s[s.DateMaximumTimestamp=17]="DateMaximumTimestamp",s[s.DateMinimumTimestamp=18]="DateMinimumTimestamp",s[s.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",s[s.Date=20]="Date",s[s.Function=21]="Function",s[s.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",s[s.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",s[s.IntegerMaximum=24]="IntegerMaximum",s[s.IntegerMinimum=25]="IntegerMinimum",s[s.IntegerMultipleOf=26]="IntegerMultipleOf",s[s.Integer=27]="Integer",s[s.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",s[s.Intersect=29]="Intersect",s[s.Iterator=30]="Iterator",s[s.Kind=31]="Kind",s[s.Literal=32]="Literal",s[s.Never=33]="Never",s[s.Not=34]="Not",s[s.Null=35]="Null",s[s.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",s[s.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",s[s.NumberMaximum=38]="NumberMaximum",s[s.NumberMinimum=39]="NumberMinimum",s[s.NumberMultipleOf=40]="NumberMultipleOf",s[s.Number=41]="Number",s[s.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",s[s.ObjectMaxProperties=43]="ObjectMaxProperties",s[s.ObjectMinProperties=44]="ObjectMinProperties",s[s.ObjectRequiredProperty=45]="ObjectRequiredProperty",s[s.Object=46]="Object",s[s.Promise=47]="Promise",s[s.StringFormatUnknown=48]="StringFormatUnknown",s[s.StringFormat=49]="StringFormat",s[s.StringMaxLength=50]="StringMaxLength",s[s.StringMinLength=51]="StringMinLength",s[s.StringPattern=52]="StringPattern",s[s.String=53]="String",s[s.Symbol=54]="Symbol",s[s.TupleLength=55]="TupleLength",s[s.Tuple=56]="Tuple",s[s.Uint8ArrayMaxByteLength=57]="Uint8ArrayMaxByteLength",s[s.Uint8ArrayMinByteLength=58]="Uint8ArrayMinByteLength",s[s.Uint8Array=59]="Uint8Array",s[s.Undefined=60]="Undefined",s[s.Union=61]="Union",s[s.Void=62]="Void"})(o||(e.ValueErrorType=o={}));var u=class extends a.TypeBoxError{constructor(s){super("Unknown type"),this.schema=s}};e.ValueErrorsUnknownTypeError=u;function l(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}e.EscapeKey=l;function c(s){return s!==void 0}var m=class{constructor(s){this.iterator=s}[Symbol.iterator](){return this.iterator}First(){let s=this.iterator.next();return s.done?void 0:s.value}};e.ValueErrorIterator=m;function g(s,T,b,v){return{type:s,schema:T,path:b,value:v,message:r.TypeSystemErrorFunction.Get()(T,s)}}function*R(s,T,b,v){}function*j(s,T,b,v){if(!(0,t.IsArray)(v))return yield g(o.Array,s,b,v);c(s.minItems)&&!(v.length>=s.minItems)&&(yield g(o.ArrayMinItems,s,b,v)),c(s.maxItems)&&!(v.length<=s.maxItems)&&(yield g(o.ArrayMaxItems,s,b,v));for(let J=0;J<v.length;J++)yield*A(s.items,T,`${b}/${J}`,v[J]);if(s.uniqueItems===!0&&!function(){let J=new Set;for(let ee of v){let ye=(0,i.Hash)(ee);if(J.has(ye))return!1;J.add(ye)}return!0}()&&(yield g(o.ArrayUniqueItems,s,b,v)),!(c(s.contains)||c(s.minContains)||c(s.maxContains)))return;let U=c(s.contains)?s.contains:a.Type.Never(),L=v.reduce((J,ee,ye)=>A(U,T,`${b}${ye}`,ee).next().done===!0?J+1:J,0);L===0&&(yield g(o.ArrayContains,s,b,v)),(0,t.IsNumber)(s.minContains)&&L<s.minContains&&(yield g(o.ArrayMinContains,s,b,v)),(0,t.IsNumber)(s.maxContains)&&L>s.maxContains&&(yield g(o.ArrayMaxContains,s,b,v))}function*G(s,T,b,v){(0,t.IsAsyncIterator)(v)||(yield g(o.AsyncIterator,s,b,v))}function*Z(s,T,b,v){if(!(0,t.IsBigInt)(v))return yield g(o.BigInt,s,b,v);c(s.exclusiveMaximum)&&!(v<s.exclusiveMaximum)&&(yield g(o.BigIntExclusiveMaximum,s,b,v)),c(s.exclusiveMinimum)&&!(v>s.exclusiveMinimum)&&(yield g(o.BigIntExclusiveMinimum,s,b,v)),c(s.maximum)&&!(v<=s.maximum)&&(yield g(o.BigIntMaximum,s,b,v)),c(s.minimum)&&!(v>=s.minimum)&&(yield g(o.BigIntMinimum,s,b,v)),c(s.multipleOf)&&v%s.multipleOf!==BigInt(0)&&(yield g(o.BigIntMultipleOf,s,b,v))}function*ae(s,T,b,v){(0,t.IsBoolean)(v)||(yield g(o.Boolean,s,b,v))}function*B(s,T,b,v){yield*A(s.returns,T,b,v.prototype)}function*V(s,T,b,v){if(!(0,t.IsDate)(v))return yield g(o.Date,s,b,v);c(s.exclusiveMaximumTimestamp)&&!(v.getTime()<s.exclusiveMaximumTimestamp)&&(yield g(o.DateExclusiveMaximumTimestamp,s,b,v)),c(s.exclusiveMinimumTimestamp)&&!(v.getTime()>s.exclusiveMinimumTimestamp)&&(yield g(o.DateExclusiveMinimumTimestamp,s,b,v)),c(s.maximumTimestamp)&&!(v.getTime()<=s.maximumTimestamp)&&(yield g(o.DateMaximumTimestamp,s,b,v)),c(s.minimumTimestamp)&&!(v.getTime()>=s.minimumTimestamp)&&(yield g(o.DateMinimumTimestamp,s,b,v)),c(s.multipleOfTimestamp)&&v.getTime()%s.multipleOfTimestamp!==0&&(yield g(o.DateMultipleOfTimestamp,s,b,v))}function*q(s,T,b,v){(0,t.IsFunction)(v)||(yield g(o.Function,s,b,v))}function*se(s,T,b,v){if(!(0,t.IsInteger)(v))return yield g(o.Integer,s,b,v);c(s.exclusiveMaximum)&&!(v<s.exclusiveMaximum)&&(yield g(o.IntegerExclusiveMaximum,s,b,v)),c(s.exclusiveMinimum)&&!(v>s.exclusiveMinimum)&&(yield g(o.IntegerExclusiveMinimum,s,b,v)),c(s.maximum)&&!(v<=s.maximum)&&(yield g(o.IntegerMaximum,s,b,v)),c(s.minimum)&&!(v>=s.minimum)&&(yield g(o.IntegerMinimum,s,b,v)),c(s.multipleOf)&&v%s.multipleOf!==0&&(yield g(o.IntegerMultipleOf,s,b,v))}function*F(s,T,b,v){for(let U of s.allOf){let L=A(U,T,b,v).next();L.done||(yield g(o.Intersect,s,b,v),yield L.value)}if(s.unevaluatedProperties===!1){let U=new RegExp(a.KeyResolver.ResolvePattern(s));for(let L of Object.getOwnPropertyNames(v))U.test(L)||(yield g(o.IntersectUnevaluatedProperties,s,`${b}/${L}`,v))}if(typeof s.unevaluatedProperties=="object"){let U=new RegExp(a.KeyResolver.ResolvePattern(s));for(let L of Object.getOwnPropertyNames(v))if(!U.test(L)){let J=A(s.unevaluatedProperties,T,`${b}/${L}`,v[L]).next();J.done||(yield J.value)}}}function*ue(s,T,b,v){(0,t.IsIterator)(v)||(yield g(o.Iterator,s,b,v))}function*z(s,T,b,v){v!==s.const&&(yield g(o.Literal,s,b,v))}function*pe(s,T,b,v){yield g(o.Never,s,b,v)}function*M(s,T,b,v){A(s.not,T,b,v).next().done===!0&&(yield g(o.Not,s,b,v))}function*N(s,T,b,v){(0,t.IsNull)(v)||(yield g(o.Null,s,b,v))}function*C(s,T,b,v){if(!r.TypeSystemPolicy.IsNumberLike(v))return yield g(o.Number,s,b,v);c(s.exclusiveMaximum)&&!(v<s.exclusiveMaximum)&&(yield g(o.NumberExclusiveMaximum,s,b,v)),c(s.exclusiveMinimum)&&!(v>s.exclusiveMinimum)&&(yield g(o.NumberExclusiveMinimum,s,b,v)),c(s.maximum)&&!(v<=s.maximum)&&(yield g(o.NumberMaximum,s,b,v)),c(s.minimum)&&!(v>=s.minimum)&&(yield g(o.NumberMinimum,s,b,v)),c(s.multipleOf)&&v%s.multipleOf!==0&&(yield g(o.NumberMultipleOf,s,b,v))}function*Q(s,T,b,v){if(!r.TypeSystemPolicy.IsObjectLike(v))return yield g(o.Object,s,b,v);c(s.minProperties)&&!(Object.getOwnPropertyNames(v).length>=s.minProperties)&&(yield g(o.ObjectMinProperties,s,b,v)),c(s.maxProperties)&&!(Object.getOwnPropertyNames(v).length<=s.maxProperties)&&(yield g(o.ObjectMaxProperties,s,b,v));let U=Array.isArray(s.required)?s.required:[],L=Object.getOwnPropertyNames(s.properties),J=Object.getOwnPropertyNames(v);for(let ee of U)J.includes(ee)||(yield g(o.ObjectRequiredProperty,s.properties[ee],`${b}/${l(ee)}`,void 0));if(s.additionalProperties===!1)for(let ee of J)L.includes(ee)||(yield g(o.ObjectAdditionalProperties,s,`${b}/${l(ee)}`,v[ee]));if(typeof s.additionalProperties=="object")for(let ee of J)L.includes(ee)||(yield*A(s.additionalProperties,T,`${b}/${l(ee)}`,v[ee]));for(let ee of L){let ye=s.properties[ee];s.required&&s.required.includes(ee)?(yield*A(ye,T,`${b}/${l(ee)}`,v[ee]),a.ExtendsUndefined.Check(s)&&!(ee in v)&&(yield g(o.ObjectRequiredProperty,ye,`${b}/${l(ee)}`,void 0))):r.TypeSystemPolicy.IsExactOptionalProperty(v,ee)&&(yield*A(ye,T,`${b}/${l(ee)}`,v[ee]))}}function*X(s,T,b,v){(0,t.IsPromise)(v)||(yield g(o.Promise,s,b,v))}function*O(s,T,b,v){if(!r.TypeSystemPolicy.IsRecordLike(v))return yield g(o.Object,s,b,v);c(s.minProperties)&&!(Object.getOwnPropertyNames(v).length>=s.minProperties)&&(yield g(o.ObjectMinProperties,s,b,v)),c(s.maxProperties)&&!(Object.getOwnPropertyNames(v).length<=s.maxProperties)&&(yield g(o.ObjectMaxProperties,s,b,v));let[U,L]=Object.entries(s.patternProperties)[0],J=new RegExp(U);for(let[ee,ye]of Object.entries(v))J.test(ee)&&(yield*A(L,T,`${b}/${l(ee)}`,ye));if(typeof s.additionalProperties=="object")for(let[ee,ye]of Object.entries(v))J.test(ee)||(yield*A(s.additionalProperties,T,`${b}/${l(ee)}`,ye));if(s.additionalProperties===!1){for(let[ee,ye]of Object.entries(v))if(!J.test(ee))return yield g(o.ObjectAdditionalProperties,s,`${b}/${l(ee)}`,ye)}}function*K(s,T,b,v){yield*A((0,n.Deref)(s,T),T,b,v)}function*te(s,T,b,v){if(!(0,t.IsString)(v))return yield g(o.String,s,b,v);c(s.minLength)&&!(v.length>=s.minLength)&&(yield g(o.StringMinLength,s,b,v)),c(s.maxLength)&&!(v.length<=s.maxLength)&&(yield g(o.StringMaxLength,s,b,v)),(0,t.IsString)(s.pattern)&&(new RegExp(s.pattern).test(v)||(yield g(o.StringPattern,s,b,v))),(0,t.IsString)(s.format)&&(a.FormatRegistry.Has(s.format)?a.FormatRegistry.Get(s.format)(v)||(yield g(o.StringFormat,s,b,v)):yield g(o.StringFormatUnknown,s,b,v))}function*H(s,T,b,v){(0,t.IsSymbol)(v)||(yield g(o.Symbol,s,b,v))}function*W(s,T,b,v){if(!(0,t.IsString)(v))return yield g(o.String,s,b,v);new RegExp(s.pattern).test(v)||(yield g(o.StringPattern,s,b,v))}function*fe(s,T,b,v){yield*A((0,n.Deref)(s,T),T,b,v)}function*f(s,T,b,v){if(!(0,t.IsArray)(v))return yield g(o.Tuple,s,b,v);if(s.items===void 0&&v.length!==0)return yield g(o.TupleLength,s,b,v);if(v.length!==s.maxItems)return yield g(o.TupleLength,s,b,v);if(s.items)for(let U=0;U<s.items.length;U++)yield*A(s.items[U],T,`${b}/${U}`,v[U])}function*_(s,T,b,v){(0,t.IsUndefined)(v)||(yield g(o.Undefined,s,b,v))}function*E(s,T,b,v){let U=0;for(let L of s.anyOf){let J=[...A(L,T,b,v)];if(J.length===0)return;U+=J.length}U>0&&(yield g(o.Union,s,b,v))}function*k(s,T,b,v){if(!(0,t.IsUint8Array)(v))return yield g(o.Uint8Array,s,b,v);c(s.maxByteLength)&&!(v.length<=s.maxByteLength)&&(yield g(o.Uint8ArrayMaxByteLength,s,b,v)),c(s.minByteLength)&&!(v.length>=s.minByteLength)&&(yield g(o.Uint8ArrayMinByteLength,s,b,v))}function*S(s,T,b,v){}function*$(s,T,b,v){r.TypeSystemPolicy.IsVoidLike(v)||(yield g(o.Void,s,b,v))}function*h(s,T,b,v){a.TypeRegistry.Get(s[a.Kind])(s,v)||(yield g(o.Kind,s,b,v))}function*A(s,T,b,v){let U=c(s.$id)?[...T,s]:T,L=s;switch(L[a.Kind]){case"Any":return yield*R(L,U,b,v);case"Array":return yield*j(L,U,b,v);case"AsyncIterator":return yield*G(L,U,b,v);case"BigInt":return yield*Z(L,U,b,v);case"Boolean":return yield*ae(L,U,b,v);case"Constructor":return yield*B(L,U,b,v);case"Date":return yield*V(L,U,b,v);case"Function":return yield*q(L,U,b,v);case"Integer":return yield*se(L,U,b,v);case"Intersect":return yield*F(L,U,b,v);case"Iterator":return yield*ue(L,U,b,v);case"Literal":return yield*z(L,U,b,v);case"Never":return yield*pe(L,U,b,v);case"Not":return yield*M(L,U,b,v);case"Null":return yield*N(L,U,b,v);case"Number":return yield*C(L,U,b,v);case"Object":return yield*Q(L,U,b,v);case"Promise":return yield*X(L,U,b,v);case"Record":return yield*O(L,U,b,v);case"Ref":return yield*K(L,U,b,v);case"String":return yield*te(L,U,b,v);case"Symbol":return yield*H(L,U,b,v);case"TemplateLiteral":return yield*W(L,U,b,v);case"This":return yield*fe(L,U,b,v);case"Tuple":return yield*f(L,U,b,v);case"Undefined":return yield*_(L,U,b,v);case"Union":return yield*E(L,U,b,v);case"Uint8Array":return yield*k(L,U,b,v);case"Unknown":return yield*S(L,U,b,v);case"Void":return yield*$(L,U,b,v);default:if(!a.TypeRegistry.Has(L[a.Kind]))throw new u(s);return yield*h(L,U,b,v)}}function w(...s){let T=s.length===3?A(s[0],s[1],"",s[2]):A(s[0],[],"",s[1]);return new m(T)}e.Errors=w}),hT=Re(e=>{"use strict";var t=e&&e.__createBinding||(Object.create?function(n,i,a,o){o===void 0&&(o=a);var u=Object.getOwnPropertyDescriptor(i,a);(!u||("get"in u?!i.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(n,o,u)}:function(n,i,a,o){o===void 0&&(o=a),n[o]=i[a]}),r=e&&e.__exportStar||function(n,i){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(i,a)&&t(i,n,a)};Object.defineProperty(e,"__esModule",{value:!0}),r(Co(),e)}),ld=Re(e=>{"use strict";var t=e&&e.__createBinding||(Object.create?function(i,a,o,u){u===void 0&&(u=o);var l=Object.getOwnPropertyDescriptor(a,o);(!l||("get"in l?!a.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(i,u,l)}:function(i,a,o,u){u===void 0&&(u=o),i[u]=a[o]}),r=e&&e.__exportStar||function(i,a){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&t(a,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorType=void 0;var n=Co();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(cd(),e)}),yT=Re(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Check=e.ValueCheckUnknownTypeError=void 0;var t=On(),r=ld(),n=Bo(),i=Os(),a=Lr(),o=class extends a.TypeBoxError{constructor(h){super("Unknown type"),this.schema=h}};e.ValueCheckUnknownTypeError=o;function u(h){return h[a.Kind]==="Any"||h[a.Kind]==="Unknown"}function l(h){return h!==void 0}function c(h,A,w){return!0}function m(h,A,w){if(!(0,t.IsArray)(w)||l(h.minItems)&&!(w.length>=h.minItems)||l(h.maxItems)&&!(w.length<=h.maxItems)||!w.every(b=>S(h.items,A,b))||h.uniqueItems===!0&&!function(){let b=new Set;for(let v of w){let U=(0,i.Hash)(v);if(b.has(U))return!1;b.add(U)}return!0}())return!1;if(!(l(h.contains)||(0,t.IsNumber)(h.minContains)||(0,t.IsNumber)(h.maxContains)))return!0;let s=l(h.contains)?h.contains:a.Type.Never(),T=w.reduce((b,v)=>S(s,A,v)?b+1:b,0);return!(T===0||(0,t.IsNumber)(h.minContains)&&T<h.minContains||(0,t.IsNumber)(h.maxContains)&&T>h.maxContains)}function g(h,A,w){return(0,t.IsAsyncIterator)(w)}function R(h,A,w){return!(!(0,t.IsBigInt)(w)||l(h.exclusiveMaximum)&&!(w<h.exclusiveMaximum)||l(h.exclusiveMinimum)&&!(w>h.exclusiveMinimum)||l(h.maximum)&&!(w<=h.maximum)||l(h.minimum)&&!(w>=h.minimum)||l(h.multipleOf)&&w%h.multipleOf!==BigInt(0))}function j(h,A,w){return(0,t.IsBoolean)(w)}function G(h,A,w){return S(h.returns,A,w.prototype)}function Z(h,A,w){return!(!(0,t.IsDate)(w)||l(h.exclusiveMaximumTimestamp)&&!(w.getTime()<h.exclusiveMaximumTimestamp)||l(h.exclusiveMinimumTimestamp)&&!(w.getTime()>h.exclusiveMinimumTimestamp)||l(h.maximumTimestamp)&&!(w.getTime()<=h.maximumTimestamp)||l(h.minimumTimestamp)&&!(w.getTime()>=h.minimumTimestamp)||l(h.multipleOfTimestamp)&&w.getTime()%h.multipleOfTimestamp!==0)}function ae(h,A,w){return(0,t.IsFunction)(w)}function B(h,A,w){return!(!(0,t.IsInteger)(w)||l(h.exclusiveMaximum)&&!(w<h.exclusiveMaximum)||l(h.exclusiveMinimum)&&!(w>h.exclusiveMinimum)||l(h.maximum)&&!(w<=h.maximum)||l(h.minimum)&&!(w>=h.minimum)||l(h.multipleOf)&&w%h.multipleOf!==0)}function V(h,A,w){let s=h.allOf.every(T=>S(T,A,w));if(h.unevaluatedProperties===!1){let T=new RegExp(a.KeyResolver.ResolvePattern(h)),b=Object.getOwnPropertyNames(w).every(v=>T.test(v));return s&&b}else if(a.TypeGuard.TSchema(h.unevaluatedProperties)){let T=new RegExp(a.KeyResolver.ResolvePattern(h)),b=Object.getOwnPropertyNames(w).every(v=>T.test(v)||S(h.unevaluatedProperties,A,w[v]));return s&&b}else return s}function q(h,A,w){return(0,t.IsIterator)(w)}function se(h,A,w){return w===h.const}function F(h,A,w){return!1}function ue(h,A,w){return!S(h.not,A,w)}function z(h,A,w){return(0,t.IsNull)(w)}function pe(h,A,w){return!(!r.TypeSystemPolicy.IsNumberLike(w)||l(h.exclusiveMaximum)&&!(w<h.exclusiveMaximum)||l(h.exclusiveMinimum)&&!(w>h.exclusiveMinimum)||l(h.minimum)&&!(w>=h.minimum)||l(h.maximum)&&!(w<=h.maximum)||l(h.multipleOf)&&w%h.multipleOf!==0)}function M(h,A,w){if(!r.TypeSystemPolicy.IsObjectLike(w)||l(h.minProperties)&&!(Object.getOwnPropertyNames(w).length>=h.minProperties)||l(h.maxProperties)&&!(Object.getOwnPropertyNames(w).length<=h.maxProperties))return!1;let s=Object.getOwnPropertyNames(h.properties);for(let T of s){let b=h.properties[T];if(h.required&&h.required.includes(T)){if(!S(b,A,w[T])||(a.ExtendsUndefined.Check(b)||u(b))&&!(T in w))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(w,T)&&!S(b,A,w[T]))return!1}if(h.additionalProperties===!1){let T=Object.getOwnPropertyNames(w);return h.required&&h.required.length===s.length&&T.length===s.length?!0:T.every(b=>s.includes(b))}else return typeof h.additionalProperties=="object"?Object.getOwnPropertyNames(w).every(T=>s.includes(T)||S(h.additionalProperties,A,w[T])):!0}function N(h,A,w){return(0,t.IsPromise)(w)}function C(h,A,w){if(!r.TypeSystemPolicy.IsRecordLike(w)||l(h.minProperties)&&!(Object.getOwnPropertyNames(w).length>=h.minProperties)||l(h.maxProperties)&&!(Object.getOwnPropertyNames(w).length<=h.maxProperties))return!1;let[s,T]=Object.entries(h.patternProperties)[0],b=new RegExp(s),v=Object.entries(w).every(([J,ee])=>b.test(J)?S(T,A,ee):!0),U=typeof h.additionalProperties=="object"?Object.entries(w).every(([J,ee])=>b.test(J)?!0:S(h.additionalProperties,A,ee)):!0,L=h.additionalProperties===!1?Object.getOwnPropertyNames(w).every(J=>b.test(J)):!0;return v&&U&&L}function Q(h,A,w){return S((0,n.Deref)(h,A),A,w)}function X(h,A,w){return!(0,t.IsString)(w)||l(h.minLength)&&!(w.length>=h.minLength)||l(h.maxLength)&&!(w.length<=h.maxLength)||l(h.pattern)&&!new RegExp(h.pattern).test(w)?!1:l(h.format)?a.FormatRegistry.Has(h.format)?a.FormatRegistry.Get(h.format)(w):!1:!0}function O(h,A,w){return(0,t.IsSymbol)(w)}function K(h,A,w){return(0,t.IsString)(w)&&new RegExp(h.pattern).test(w)}function te(h,A,w){return S((0,n.Deref)(h,A),A,w)}function H(h,A,w){if(!(0,t.IsArray)(w)||h.items===void 0&&w.length!==0||w.length!==h.maxItems)return!1;if(!h.items)return!0;for(let s=0;s<h.items.length;s++)if(!S(h.items[s],A,w[s]))return!1;return!0}function W(h,A,w){return(0,t.IsUndefined)(w)}function fe(h,A,w){return h.anyOf.some(s=>S(s,A,w))}function f(h,A,w){return!(!(0,t.IsUint8Array)(w)||l(h.maxByteLength)&&!(w.length<=h.maxByteLength)||l(h.minByteLength)&&!(w.length>=h.minByteLength))}function _(h,A,w){return!0}function E(h,A,w){return r.TypeSystemPolicy.IsVoidLike(w)}function k(h,A,w){return a.TypeRegistry.Has(h[a.Kind])?a.TypeRegistry.Get(h[a.Kind])(h,w):!1}function S(h,A,w){let s=l(h.$id)?[...A,h]:A,T=h;switch(T[a.Kind]){case"Any":return c(T,s,w);case"Array":return m(T,s,w);case"AsyncIterator":return g(T,s,w);case"BigInt":return R(T,s,w);case"Boolean":return j(T,s,w);case"Constructor":return G(T,s,w);case"Date":return Z(T,s,w);case"Function":return ae(T,s,w);case"Integer":return B(T,s,w);case"Intersect":return V(T,s,w);case"Iterator":return q(T,s,w);case"Literal":return se(T,s,w);case"Never":return F(T,s,w);case"Not":return ue(T,s,w);case"Null":return z(T,s,w);case"Number":return pe(T,s,w);case"Object":return M(T,s,w);case"Promise":return N(T,s,w);case"Record":return C(T,s,w);case"Ref":return Q(T,s,w);case"String":return X(T,s,w);case"Symbol":return O(T,s,w);case"TemplateLiteral":return K(T,s,w);case"This":return te(T,s,w);case"Tuple":return H(T,s,w);case"Undefined":return W(T,s,w);case"Union":return fe(T,s,w);case"Uint8Array":return f(T,s,w);case"Unknown":return _(T,s,w);case"Void":return E(T,s,w);default:if(!a.TypeRegistry.Has(T[a.Kind]))throw new o(T);return k(T,s,w)}}function $(...h){return h.length===3?S(h[0],h[1],h[2]):S(h[0],[],h[1])}e.Check=$}),mT=Re(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=On(),r=Bo(),n=yT(),i=Lr(),a=class extends i.TypeBoxError{constructor(R,j,G){super("Unable to decode due to invalid value"),this.schema=R,this.value=j,this.error=G}};e.TransformDecodeCheckError=a;var o=class extends i.TypeBoxError{constructor(R,j,G){super("Unable to encode due to invalid value"),this.schema=R,this.value=j,this.error=G}};e.TransformEncodeCheckError=o;var u=class extends i.TypeBoxError{constructor(R,j,G){super(`${G instanceof Error?G.message:"Unknown error"}`),this.schema=R,this.value=j}};e.TransformDecodeError=u;var l=class extends i.TypeBoxError{constructor(R,j,G){super(`${G instanceof Error?G.message:"Unknown error"}`),this.schema=R,this.value=j}};e.TransformEncodeError=l;var c;(function(R){function j(O,K){return i.TypeGuard.TTransform(O)||C(O.items,K)}function G(O,K){return i.TypeGuard.TTransform(O)||C(O.items,K)}function Z(O,K){return i.TypeGuard.TTransform(O)||C(O.returns,K)||O.parameters.some(te=>C(te,K))}function ae(O,K){return i.TypeGuard.TTransform(O)||C(O.returns,K)||O.parameters.some(te=>C(te,K))}function B(O,K){return i.TypeGuard.TTransform(O)||i.TypeGuard.TTransform(O.unevaluatedProperties)||O.allOf.some(te=>C(te,K))}function V(O,K){return i.TypeGuard.TTransform(O)||C(O.items,K)}function q(O,K){return i.TypeGuard.TTransform(O)||C(O.not,K)}function se(O,K){return i.TypeGuard.TTransform(O)||Object.values(O.properties).some(te=>C(te,K))||i.TypeGuard.TSchema(O.additionalProperties)&&C(O.additionalProperties,K)}function F(O,K){return i.TypeGuard.TTransform(O)||C(O.item,K)}function ue(O,K){let te=Object.getOwnPropertyNames(O.patternProperties)[0],H=O.patternProperties[te];return i.TypeGuard.TTransform(O)||C(H,K)||i.TypeGuard.TSchema(O.additionalProperties)&&i.TypeGuard.TTransform(O.additionalProperties)}function z(O,K){return i.TypeGuard.TTransform(O)?!0:C((0,r.Deref)(O,K),K)}function pe(O,K){return i.TypeGuard.TTransform(O)?!0:C((0,r.Deref)(O,K),K)}function M(O,K){return i.TypeGuard.TTransform(O)||!(0,t.IsUndefined)(O.items)&&O.items.some(te=>C(te,K))}function N(O,K){return i.TypeGuard.TTransform(O)||O.anyOf.some(te=>C(te,K))}function C(O,K){let te=(0,t.IsString)(O.$id)?[...K,O]:K,H=O;if(O.$id&&Q.has(O.$id))return!1;switch(O.$id&&Q.add(O.$id),O[i.Kind]){case"Array":return j(H,te);case"AsyncIterator":return G(H,te);case"Constructor":return Z(H,te);case"Function":return ae(H,te);case"Intersect":return B(H,te);case"Iterator":return V(H,te);case"Not":return q(H,te);case"Object":return se(H,te);case"Promise":return F(H,te);case"Record":return ue(H,te);case"Ref":return z(H,te);case"This":return pe(H,te);case"Tuple":return M(H,te);case"Union":return N(H,te);default:return i.TypeGuard.TTransform(O)}}let Q=new Set;function X(O,K){return Q.clear(),C(O,K)}R.Has=X})(c||(e.HasTransform=c={}));var m;(function(R){function j(M,N){try{return i.TypeGuard.TTransform(M)?M[i.Transform].Decode(N):N}catch(C){throw new u(M,N,C)}}function G(M,N,C){return(0,t.IsArray)(C)?j(M,C.map(Q=>z(M.items,N,Q))):j(M,C)}function Z(M,N,C){if(!(0,t.IsPlainObject)(C)||(0,t.IsValueType)(C))return j(M,C);let Q=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),X=Q.reduce((H,W)=>W in H?{...H,[W]:z(i.IndexedAccessor.Resolve(M,[W]),N,H[W])}:H,C);if(!i.TypeGuard.TTransform(M.unevaluatedProperties))return j(M,X);let O=Object.getOwnPropertyNames(X),K=M.unevaluatedProperties,te=O.reduce((H,W)=>Q.includes(W)?H:{...H,[W]:j(K,H[W])},X);return j(M,te)}function ae(M,N,C){return j(M,z(M.not,N,C))}function B(M,N,C){if(!(0,t.IsPlainObject)(C))return j(M,C);let Q=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),X=Q.reduce((H,W)=>W in H?{...H,[W]:z(M.properties[W],N,H[W])}:H,C);if(!i.TypeGuard.TSchema(M.additionalProperties))return j(M,X);let O=Object.getOwnPropertyNames(X),K=M.additionalProperties,te=O.reduce((H,W)=>Q.includes(W)?H:{...H,[W]:j(K,H[W])},X);return j(M,te)}function V(M,N,C){if(!(0,t.IsPlainObject)(C))return j(M,C);let Q=Object.getOwnPropertyNames(M.patternProperties)[0],X=new RegExp(Q),O=Object.getOwnPropertyNames(C).reduce((W,fe)=>X.test(fe)?{...W,[fe]:z(M.patternProperties[Q],N,W[fe])}:W,C);if(!i.TypeGuard.TSchema(M.additionalProperties))return j(M,O);let K=Object.getOwnPropertyNames(O),te=M.additionalProperties,H=K.reduce((W,fe)=>X.test(fe)?W:{...W,[fe]:j(te,W[fe])},O);return j(M,H)}function q(M,N,C){let Q=(0,r.Deref)(M,N);return j(M,z(Q,N,C))}function se(M,N,C){let Q=(0,r.Deref)(M,N);return j(M,z(Q,N,C))}function F(M,N,C){return(0,t.IsArray)(C)&&(0,t.IsArray)(M.items)?j(M,M.items.map((Q,X)=>z(Q,N,C[X]))):j(M,C)}function ue(M,N,C){let Q=j(M,C);for(let X of M.anyOf)if((0,n.Check)(X,N,Q))return z(X,N,Q);return Q}function z(M,N,C){let Q=typeof M.$id=="string"?[...N,M]:N,X=M;switch(M[i.Kind]){case"Array":return G(X,Q,C);case"Intersect":return Z(X,Q,C);case"Not":return ae(X,Q,C);case"Object":return B(X,Q,C);case"Record":return V(X,Q,C);case"Ref":return q(X,Q,C);case"Symbol":return j(X,C);case"This":return se(X,Q,C);case"Tuple":return F(X,Q,C);case"Union":return ue(X,Q,C);default:return j(X,C)}}function pe(M,N,C){return z(M,N,C)}R.Decode=pe})(m||(e.DecodeTransform=m={}));var g;(function(R){function j(M,N){try{return i.TypeGuard.TTransform(M)?M[i.Transform].Encode(N):N}catch(C){throw new l(M,N,C)}}function G(M,N,C){let Q=j(M,C);return(0,t.IsArray)(Q)?Q.map(X=>z(M.items,N,X)):Q}function Z(M,N,C){let Q=j(M,C);if(!(0,t.IsPlainObject)(C)||(0,t.IsValueType)(C))return Q;let X=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),O=X.reduce((H,W)=>W in Q?{...H,[W]:z(i.IndexedAccessor.Resolve(M,[W]),N,H[W])}:H,Q);if(!i.TypeGuard.TTransform(M.unevaluatedProperties))return j(M,O);let K=Object.getOwnPropertyNames(O),te=M.unevaluatedProperties;return K.reduce((H,W)=>X.includes(W)?H:{...H,[W]:j(te,H[W])},O)}function ae(M,N,C){return j(M.not,j(M,C))}function B(M,N,C){let Q=j(M,C);if(!(0,t.IsPlainObject)(C))return Q;let X=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),O=X.reduce((H,W)=>W in H?{...H,[W]:z(M.properties[W],N,H[W])}:H,Q);if(!i.TypeGuard.TSchema(M.additionalProperties))return O;let K=Object.getOwnPropertyNames(O),te=M.additionalProperties;return K.reduce((H,W)=>X.includes(W)?H:{...H,[W]:j(te,H[W])},O)}function V(M,N,C){let Q=j(M,C);if(!(0,t.IsPlainObject)(C))return Q;let X=Object.getOwnPropertyNames(M.patternProperties)[0],O=new RegExp(X),K=Object.getOwnPropertyNames(C).reduce((W,fe)=>O.test(fe)?{...W,[fe]:z(M.patternProperties[X],N,W[fe])}:W,Q);if(!i.TypeGuard.TSchema(M.additionalProperties))return j(M,K);let te=Object.getOwnPropertyNames(K),H=M.additionalProperties;return te.reduce((W,fe)=>O.test(fe)?W:{...W,[fe]:j(H,W[fe])},K)}function q(M,N,C){let Q=(0,r.Deref)(M,N),X=z(Q,N,C);return j(M,X)}function se(M,N,C){let Q=(0,r.Deref)(M,N),X=z(Q,N,C);return j(M,X)}function F(M,N,C){let Q=j(M,C);return(0,t.IsArray)(M.items)?M.items.map((X,O)=>z(X,N,Q[O])):[]}function ue(M,N,C){for(let Q of M.anyOf){if(!(0,n.Check)(Q,N,C))continue;let X=z(Q,N,C);return j(M,X)}for(let Q of M.anyOf){let X=z(Q,N,C);if((0,n.Check)(M,N,X))return j(M,X)}return j(M,C)}function z(M,N,C){let Q=typeof M.$id=="string"?[...N,M]:N,X=M;switch(M[i.Kind]){case"Array":return G(X,Q,C);case"Intersect":return Z(X,Q,C);case"Not":return ae(X,Q,C);case"Object":return B(X,Q,C);case"Record":return V(X,Q,C);case"Ref":return q(X,Q,C);case"This":return se(X,Q,C);case"Tuple":return F(X,Q,C);case"Union":return ue(X,Q,C);default:return j(X,C)}}function pe(M,N,C){return z(M,N,C)}R.Encode=pe})(g||(e.EncodeTransform=g={}))}),gT=Re(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeCompiler=e.Policy=e.TypeCompilerTypeGuardError=e.TypeCompilerUnknownTypeError=e.TypeCheck=void 0;var t=mT(),r=On(),n=Co(),i=ld(),a=Bo(),o=Os(),u=Lr(),l=class{constructor(B,V,q,se){this.schema=B,this.references=V,this.checkFunc=q,this.code=se,this.hasTransform=t.HasTransform.Has(B,V)}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 V=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,B):B;if(!this.checkFunc(V))throw new t.TransformEncodeCheckError(this.schema,B,this.Errors(B).First());return V}};e.TypeCheck=l;var c;(function(B){function V(ue){return ue===36}B.DollarSign=V;function q(ue){return ue===95}B.IsUnderscore=q;function se(ue){return ue>=65&&ue<=90||ue>=97&&ue<=122}B.IsAlpha=se;function F(ue){return ue>=48&&ue<=57}B.IsNumeric=F})(c||(c={}));var m;(function(B){function V(ue){return ue.length===0?!1:c.IsNumeric(ue.charCodeAt(0))}function q(ue){if(V(ue))return!1;for(let z=0;z<ue.length;z++){let pe=ue.charCodeAt(z);if(!(c.IsAlpha(pe)||c.IsNumeric(pe)||c.DollarSign(pe)||c.IsUnderscore(pe)))return!1}return!0}function se(ue){return ue.replace(/'/g,"\\'")}function F(ue,z){return q(z)?`${ue}.${z}`:`${ue}['${se(z)}']`}B.Encode=F})(m||(m={}));var g;(function(B){function V(q){let se=[];for(let F=0;F<q.length;F++){let ue=q.charCodeAt(F);c.IsNumeric(ue)||c.IsAlpha(ue)?se.push(q.charAt(F)):se.push(`_${ue}_`)}return se.join("").replace(/__/g,"_")}B.Encode=V})(g||(g={}));var R;(function(B){function V(q){return q.replace(/'/g,"\\'")}B.Escape=V})(R||(R={}));var j=class extends u.TypeBoxError{constructor(B){super("Unknown type"),this.schema=B}};e.TypeCompilerUnknownTypeError=j;var G=class extends u.TypeBoxError{constructor(B){super("Preflight validation check failed to guard for the given schema"),this.schema=B}};e.TypeCompilerTypeGuardError=G;var Z;(function(B){function V(z,pe,M){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${pe}' in ${z} ? ${M} : true)`:`(${m.Encode(z,pe)} !== undefined ? ${M} : true)`}B.IsExactOptionalProperty=V;function q(z){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${z} === 'object' && ${z} !== null)`:`(typeof ${z} === 'object' && ${z} !== null && !Array.isArray(${z}))`}B.IsObjectLike=q;function se(z){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${z} === 'object' && ${z} !== null && !(${z} instanceof Date) && !(${z} instanceof Uint8Array))`:`(typeof ${z} === 'object' && ${z} !== null && !Array.isArray(${z}) && !(${z} instanceof Date) && !(${z} instanceof Uint8Array))`}B.IsRecordLike=se;function F(z){return i.TypeSystemPolicy.AllowNaN?`typeof ${z} === 'number'`:`(typeof ${z} === 'number' && Number.isFinite(${z}))`}B.IsNumberLike=F;function ue(z){return i.TypeSystemPolicy.AllowNullVoid?`(${z} === undefined || ${z} === null)`:`${z} === undefined`}B.IsVoidLike=ue})(Z||(e.Policy=Z={}));var ae;(function(B){function V(x){return x[u.Kind]==="Any"||x[u.Kind]==="Unknown"}function*q(x,le,I){yield"true"}function*se(x,le,I){yield`Array.isArray(${I})`;let[ge,ne]=[Be("value","any"),Be("acc","number")];(0,r.IsNumber)(x.maxItems)&&(yield`${I}.length <= ${x.maxItems}`),(0,r.IsNumber)(x.minItems)&&(yield`${I}.length >= ${x.minItems}`);let de=ee(x.items,le,"value");if(yield`${I}.every((${ge}) => ${de})`,u.TypeGuard.TSchema(x.contains)||(0,r.IsNumber)(x.minContains)||(0,r.IsNumber)(x.maxContains)){let Ie=u.TypeGuard.TSchema(x.contains)?x.contains:u.Type.Never(),Ce=ee(Ie,le,"value"),We=(0,r.IsNumber)(x.minContains)?[`(count >= ${x.minContains})`]:[],Ke=(0,r.IsNumber)(x.maxContains)?[`(count <= ${x.maxContains})`]:[],Qe=`const count = value.reduce((${ne}, ${ge}) => ${Ce} ? acc + 1 : acc, 0)`,Ht=["(count > 0)",...We,...Ke].join(" && ");yield`((${ge}) => { ${Qe}; return ${Ht}})(${I})`}x.uniqueItems===!0&&(yield`((${ge}) => { 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 } )(${I})`)}function*F(x,le,I){yield`(typeof value === 'object' && Symbol.asyncIterator in ${I})`}function*ue(x,le,I){yield`(typeof ${I} === 'bigint')`,(0,r.IsBigInt)(x.exclusiveMaximum)&&(yield`${I} < BigInt(${x.exclusiveMaximum})`),(0,r.IsBigInt)(x.exclusiveMinimum)&&(yield`${I} > BigInt(${x.exclusiveMinimum})`),(0,r.IsBigInt)(x.maximum)&&(yield`${I} <= BigInt(${x.maximum})`),(0,r.IsBigInt)(x.minimum)&&(yield`${I} >= BigInt(${x.minimum})`),(0,r.IsBigInt)(x.multipleOf)&&(yield`(${I} % BigInt(${x.multipleOf})) === 0`)}function*z(x,le,I){yield`(typeof ${I} === 'boolean')`}function*pe(x,le,I){yield*L(x.returns,le,`${I}.prototype`)}function*M(x,le,I){yield`(${I} instanceof Date) && Number.isFinite(${I}.getTime())`,(0,r.IsNumber)(x.exclusiveMaximumTimestamp)&&(yield`${I}.getTime() < ${x.exclusiveMaximumTimestamp}`),(0,r.IsNumber)(x.exclusiveMinimumTimestamp)&&(yield`${I}.getTime() > ${x.exclusiveMinimumTimestamp}`),(0,r.IsNumber)(x.maximumTimestamp)&&(yield`${I}.getTime() <= ${x.maximumTimestamp}`),(0,r.IsNumber)(x.minimumTimestamp)&&(yield`${I}.getTime() >= ${x.minimumTimestamp}`),(0,r.IsNumber)(x.multipleOfTimestamp)&&(yield`(${I}.getTime() % ${x.multipleOfTimestamp}) === 0`)}function*N(x,le,I){yield`(typeof ${I} === 'function')`}function*C(x,le,I){yield`(typeof ${I} === 'number' && Number.isInteger(${I}))`,(0,r.IsNumber)(x.exclusiveMaximum)&&(yield`${I} < ${x.exclusiveMaximum}`),(0,r.IsNumber)(x.exclusiveMinimum)&&(yield`${I} > ${x.exclusiveMinimum}`),(0,r.IsNumber)(x.maximum)&&(yield`${I} <= ${x.maximum}`),(0,r.IsNumber)(x.minimum)&&(yield`${I} >= ${x.minimum}`),(0,r.IsNumber)(x.multipleOf)&&(yield`(${I} % ${x.multipleOf}) === 0`)}function*Q(x,le,I){let ge=x.allOf.map(ne=>ee(ne,le,I)).join(" && ");if(x.unevaluatedProperties===!1){let ne=we(`${new RegExp(u.KeyResolver.ResolvePattern(x))};`),de=`Object.getOwnPropertyNames(${I}).every(key => ${ne}.test(key))`;yield`(${ge} && ${de})`}else if(u.TypeGuard.TSchema(x.unevaluatedProperties)){let ne=we(`${new RegExp(u.KeyResolver.ResolvePattern(x))};`),de=`Object.getOwnPropertyNames(${I}).every(key => ${ne}.test(key) || ${ee(x.unevaluatedProperties,le,`${I}[key]`)})`;yield`(${ge} && ${de})`}else yield`(${ge})`}function*X(x,le,I){yield`(typeof value === 'object' && Symbol.iterator in ${I})`}function*O(x,le,I){typeof x.const=="number"||typeof x.const=="boolean"?yield`(${I} === ${x.const})`:yield`(${I} === '${R.Escape(x.const)}')`}function*K(x,le,I){yield"false"}function*te(x,le,I){yield`(!${ee(x.not,le,I)})`}function*H(x,le,I){yield`(${I} === null)`}function*W(x,le,I){yield Z.IsNumberLike(I),(0,r.IsNumber)(x.exclusiveMaximum)&&(yield`${I} < ${x.exclusiveMaximum}`),(0,r.IsNumber)(x.exclusiveMinimum)&&(yield`${I} > ${x.exclusiveMinimum}`),(0,r.IsNumber)(x.maximum)&&(yield`${I} <= ${x.maximum}`),(0,r.IsNumber)(x.minimum)&&(yield`${I} >= ${x.minimum}`),(0,r.IsNumber)(x.multipleOf)&&(yield`(${I} % ${x.multipleOf}) === 0`)}function*fe(x,le,I){yield Z.IsObjectLike(I),(0,r.IsNumber)(x.minProperties)&&(yield`Object.getOwnPropertyNames(${I}).length >= ${x.minProperties}`),(0,r.IsNumber)(x.maxProperties)&&(yield`Object.getOwnPropertyNames(${I}).length <= ${x.maxProperties}`);let ge=Object.getOwnPropertyNames(x.properties);for(let ne of ge){let de=m.Encode(I,ne),Ie=x.properties[ne];if(x.required&&x.required.includes(ne))yield*L(Ie,le,de),(u.ExtendsUndefined.Check(Ie)||V(Ie))&&(yield`('${ne}' in ${I})`);else{let Ce=ee(Ie,le,de);yield Z.IsExactOptionalProperty(I,ne,Ce)}}if(x.additionalProperties===!1)if(x.required&&x.required.length===ge.length)yield`Object.getOwnPropertyNames(${I}).length === ${ge.length}`;else{let ne=`[${ge.map(de=>`'${de}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${I}).every(key => ${ne}.includes(key))`}if(typeof x.additionalProperties=="object"){let ne=ee(x.additionalProperties,le,`${I}[key]`),de=`[${ge.map(Ie=>`'${Ie}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${I}).every(key => ${de}.includes(key) || ${ne}))`}}function*f(x,le,I){yield`(typeof value === 'object' && typeof ${I}.then === 'function')`}function*_(x,le,I){yield Z.IsRecordLike(I),(0,r.IsNumber)(x.minProperties)&&(yield`Object.getOwnPropertyNames(${I}).length >= ${x.minProperties}`),(0,r.IsNumber)(x.maxProperties)&&(yield`Object.getOwnPropertyNames(${I}).length <= ${x.maxProperties}`);let[ge,ne]=Object.entries(x.patternProperties)[0],de=we(`${new RegExp(ge)}`),Ie=ee(ne,le,"value"),Ce=u.TypeGuard.TSchema(x.additionalProperties)?ee(x.additionalProperties,le,I):x.additionalProperties===!1?"false":"true",We=`(${de}.test(key) ? ${Ie} : ${Ce})`;yield`(Object.entries(${I}).every(([key, value]) => ${We}))`}function*E(x,le,I){let ge=(0,a.Deref)(x,le);if(J.functions.has(x.$ref))return yield`${ye(x.$ref)}(${I})`;yield*L(ge,le,I)}function*k(x,le,I){yield`(typeof ${I} === 'string')`,(0,r.IsNumber)(x.maxLength)&&(yield`${I}.length <= ${x.maxLength}`),(0,r.IsNumber)(x.minLength)&&(yield`${I}.length >= ${x.minLength}`),x.pattern!==void 0&&(yield`${we(`${new RegExp(x.pattern)};`)}.test(${I})`),x.format!==void 0&&(yield`format('${x.format}', ${I})`)}function*S(x,le,I){yield`(typeof ${I} === 'symbol')`}function*$(x,le,I){yield`(typeof ${I} === 'string')`,yield`${we(`${new RegExp(x.pattern)};`)}.test(${I})`}function*h(x,le,I){yield`${ye(x.$ref)}(${I})`}function*A(x,le,I){if(yield`Array.isArray(${I})`,x.items===void 0)return yield`${I}.length === 0`;yield`(${I}.length === ${x.maxItems})`;for(let ge=0;ge<x.items.length;ge++)yield`${ee(x.items[ge],le,`${I}[${ge}]`)}`}function*w(x,le,I){yield`${I} === undefined`}function*s(x,le,I){yield`(${x.anyOf.map(ge=>ee(ge,le,I)).join(" || ")})`}function*T(x,le,I){yield`${I} instanceof Uint8Array`,(0,r.IsNumber)(x.maxByteLength)&&(yield`(${I}.length <= ${x.maxByteLength})`),(0,r.IsNumber)(x.minByteLength)&&(yield`(${I}.length >= ${x.minByteLength})`)}function*b(x,le,I){yield"true"}function*v(x,le,I){yield Z.IsVoidLike(I)}function*U(x,le,I){let ge=J.instances.size;J.instances.set(ge,x),yield`kind('${x[u.Kind]}', ${ge}, ${I})`}function*L(x,le,I,ge=!0){let ne=(0,r.IsString)(x.$id)?[...le,x]:le,de=x;if(ge&&(0,r.IsString)(x.$id)){let Ie=ye(x.$id);if(J.functions.has(Ie))return yield`${Ie}(${I})`;{let Ce=je(Ie,x,le,"value",!1);return J.functions.set(Ie,Ce),yield`${Ie}(${I})`}}switch(de[u.Kind]){case"Any":return yield*q(de,ne,I);case"Array":return yield*se(de,ne,I);case"AsyncIterator":return yield*F(de,ne,I);case"BigInt":return yield*ue(de,ne,I);case"Boolean":return yield*z(de,ne,I);case"Constructor":return yield*pe(de,ne,I);case"Date":return yield*M(de,ne,I);case"Function":return yield*N(de,ne,I);case"Integer":return yield*C(de,ne,I);case"Intersect":return yield*Q(de,ne,I);case"Iterator":return yield*X(de,ne,I);case"Literal":return yield*O(de,ne,I);case"Never":return yield*K(de,ne,I);case"Not":return yield*te(de,ne,I);case"Null":return yield*H(de,ne,I);case"Number":return yield*W(de,ne,I);case"Object":return yield*fe(de,ne,I);case"Promise":return yield*f(de,ne,I);case"Record":return yield*_(de,ne,I);case"Ref":return yield*E(de,ne,I);case"String":return yield*k(de,ne,I);case"Symbol":return yield*S(de,ne,I);case"TemplateLiteral":return yield*$(de,ne,I);case"This":return yield*h(de,ne,I);case"Tuple":return yield*A(de,ne,I);case"Undefined":return yield*w(de,ne,I);case"Union":return yield*s(de,ne,I);case"Uint8Array":return yield*T(de,ne,I);case"Unknown":return yield*b(de,ne,I);case"Void":return yield*v(de,ne,I);default:if(!u.TypeRegistry.Has(de[u.Kind]))throw new j(x);return yield*U(de,ne,I)}}let J={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function ee(x,le,I,ge=!0){return`(${[...L(x,le,I,ge)].join(" && ")})`}function ye(x){return`check_${g.Encode(x)}`}function we(x){let le=`local_${J.variables.size}`;return J.variables.set(le,`const ${le} = ${x}`),le}function je(x,le,I,ge,ne=!0){let[de,Ie]=[`
|
|
28
28
|
`,Qe=>"".padStart(Qe," ")],Ce=Be("value","any"),We=hr("boolean"),Ke=[...L(le,I,ge,ne)].map(Qe=>`${Ie(4)}${Qe}`).join(` &&${de}`);return`function ${x}(${Ce})${We} {${de}${Ie(2)}return (${de}${Ke}${de}${Ie(2)})
|
|
29
29
|
}`}function Be(x,le){let I=J.language==="typescript"?`: ${le}`:"";return`${x}${I}`}function hr(x){return J.language==="typescript"?`: ${x}`:""}function be(x,le,I){let ge=je("check",x,le,"value"),ne=Be("value","any"),de=hr("boolean"),Ie=[...J.functions.values()],Ce=[...J.variables.values()],We=(0,r.IsString)(x.$id)?`return function check(${ne})${de} {
|
|
30
30
|
return ${ye(x.$id)}(value)
|
|
31
31
|
}`:`return ${ge}`;return[...Ce,...Ie,We].join(`
|
|
32
|
-
`)}function Kt(...x){let le={language:"javascript"},[I,ge,ne]=x.length===2&&(0,r.IsArray)(x[1])?[x[0],x[1],le]:x.length===2&&!(0,r.IsArray)(x[1])?[x[0],[],x[1]]:x.length===3?[x[0],x[1],x[2]]:x.length===1?[x[0],[],le]:[null,[],le];if(J.language=ne.language,J.variables.clear(),J.functions.clear(),J.instances.clear(),!u.TypeGuard.TSchema(I))throw new G(I);for(let de of ge)if(!u.TypeGuard.TSchema(de))throw new G(de);return be(I,ge,ne)}B.Code=Kt;function yr(x,le=[]){let I=Kt(x,le,{language:"javascript"}),ge=globalThis.Function("kind","format","hash",I),ne=new Map(J.instances);function de(Ke,Qe,Ht){if(!u.TypeRegistry.Has(Ke)||!ne.has(Qe))return!1;let Fr=u.TypeRegistry.Get(Ke),zr=ne.get(Qe);return Fr(zr,Ht)}function Ie(Ke,Qe){return u.FormatRegistry.Has(Ke)?u.FormatRegistry.Get(Ke)(Qe):!1}function Ce(Ke){return(0,o.Hash)(Ke)}let We=ge(de,Ie,Ce);return new l(x,le,We,I)}B.Compile=yr})(ae||(e.TypeCompiler=ae={}))}),gT=Re(e=>{"use strict";var t=e&&e.__createBinding||(Object.create?function(i,a,o,u){u===void 0&&(u=o);var l=Object.getOwnPropertyDescriptor(a,o);(!l||("get"in l?!a.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(i,u,l)}:function(i,a,o,u){u===void 0&&(u=o),i[u]=a[o]}),r=e&&e.__exportStar||function(i,a){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&t(a,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorIterator=e.ValueErrorType=void 0;var n=pT();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return n.ValueErrorIterator}}),r(mT(),e)}),{WARN:cA,LOG:mi,DEBUG:Dr,VERBOSE:Se,ERROR:Po}=Oe.setup(Oe.INFO,{prefix:"[q]"}),vT=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prev=r,Br(this,{allApplogs:Ge})}get record(){return this.variables}get allApplogs(){return this.prev?Os([this.logsOfThisNode,this.prev.allApplogs]):this.logsOfThisNode}},ld=class{constructor(e){this.nodes=e,Br(this,{allApplogs:Ge,size:Ge,isEmpty:Ge})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return Me(()=>this.records.length)}get records(){return this.nodes.map(({variables:e})=>e)}get applogSets(){return this.nodes.map(({logsOfThisNode:e})=>e.applogs)}get applogStreams(){return this.nodes.map(({logsOfThisNode:e})=>e)}get allApplogs(){return Os(this.nodes.map(e=>e.allApplogs))}},bT=Ye(function(e,{inverseToOnlyReturnFirstLogs:t,tolerateAlreadyFiltered:r}={}){if(Se(`withoutHistory${t?".inversed":""} < ${e.nameAndSizeUntracked} > initializing`),e.filters.includes("withoutHistory")){if(r)return Dr("[withoutHistory] already filtered, but tolerateAlreadyFiltered=true, so returning"),e;throw Po("stream already filtered withoutHistory:",e.filters,{name:e.name})}let n,i=Ts(e,function(a,o){let u=Ct(a),l,c=[],m=u?null:[];u?(n=new Map,l=a.init):l=a.added;let g;for(let R=t?0:l.length-1;t?R<l.length:R>=0;t?R++:R--){let j=l[R],G=vt([j.en,j.at]);if(g&&(t?g>j.ts:g<j.ts))throw Po("withoutHistory.mapper logs not sorted:",g,t?">":"<",j.ts,{log:j,i:R,newLogs:l,inverseToOnlyReturnFirstLogs:t});g=j.ts;let Z=n.get(G);(!Z||(t?Z.ts>j.ts:Z.ts<j.ts))&&(Z&&!u&&m.push(Z),c.push(j),n.set(G,j))}return fr(c),Se.isDisabled||Se(`withoutHistory${t?".inversed":""}<${e.nameAndSizeUntracked}> mapped event`,u?{...Object.fromEntries(Object.entries(a).map(([R,j])=>[R,j?.length])),toAdd:c.length,toRemove:m}:{...a,toAdd:c,toRemove:m}),u?{init:c}:{added:c,removed:m}},{name:`withoutHistory${t?".inversed":""}`,extraFilterName:"withoutHistory"});return Se.isDisabled||cr(()=>{Se(`withoutHistory<${e.nameAndSizeUntracked}> filtered down to`,i.applogs.length)}),i},{equals:gn}),lA=Ye(function(e){if(Se(`withoutDeleted<${e.nameAndSizeUntracked}>`),e.filters.includes("withoutDeleted"))throw Po("stream already filtered withoutDeleted:",e.filters,{name:e.name});let t=dr(e,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});Se(`withoutDeleted<${e.nameAndSizeUntracked}> deletionLogs:`,Me(()=>[...t.applogs]));let r=mn({caller:"allDeletedEntities",stream:e}),n=hi(()=>t.map(i=>i.en),{name:r});return Se.isDisabled||cr(()=>{Se(`withoutDeleted<${e.nameAndSizeUntracked}> deleted:`,[...n])}),dr(e,{"!en":n},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:gn}),wT=Ye(function e(t,r,n={},i={}){Dr(`query<${t.nameAndSizeUntracked}>:`,r);let a=Array.isArray(r)?r:[r],o;if(a.length===1)o=null;else{let c=a.slice(0,-1);o=e(t,c,n,i)}let u=a[a.length-1],l=_T(t,o,u,i);return Se.isDisabled||cr(()=>Se("query result:",$r(l))),l},{equals:Ao}),_T=Ye(function(e,t,r,n={}){if(Dr(`queryStep<${e.nameAndSizeUntracked}> with`,t?.untrackedSize??"all","nodes, pattern:",r),!Object.entries(r).length)throw new Error("Pattern is empty");let i=hi(()=>{function a(o){let[u,l]=Eo(r,o?.variables??{});Se("[queryStep] patternWithoutVars: ",u);let c=dr(e,u),m=fd(l),g=c.map(j=>({log:j,vars:m(j)}));Se.isDisabled||Se("[queryStep] step node:",o?.variables," =>",g,"from:",Me(()=>c.applogs));let R=g.map(({log:j,vars:G})=>{let Z=Object.assign({},o?.variables,G);return new vT(new Ro([j],e.filters,mn({caller:"QueryNode",stream:c,pattern:`${vt(Z)}@${vt(u)}`}),!0,c),Z,o)});return n.debug&&mi("[queryStep] step result:",Me(()=>R.map(({variables:j,logsOfThisNode:G})=>({variables:j,stream:G.applogs})))),R}return t?t.nodes.flatMap(a):a(null)},{name:mn({caller:"queryStep",stream:e,pattern:r})});return Se("queryStep result:",i),new ld(i)},{equals:Ao}),fA=Ye(function(e,t,r,n={}){let i=t.nodes;Dr(`queryNot<${e.nameAndSizeUntracked}> from: ${i.length} nodes`);let a=Array.isArray(r)?r:[r];for(let o of a){if(!Object.entries(r).length)throw new Error("Pattern is empty");i=i.filter(({variables:u})=>{let[l,c]=Eo(o,u??{});Se("[queryNot] patternWithoutVars: ",l);let m=dr(e,l);return Se("[queryNot] step node:",u," =>",m.size,"applogs"),Se.isDisabled||Se("[queryNot] step node:",u," => empty?",Me(()=>m.applogs)),n.debug&&mi("[queryNot] node result:",u,"=>",m.applogs),m.isEmpty})}return new ld(i)},{equals:Ao}),TT=Ye(function(e,t,r){Dr(`filterAndMap<${e.nameAndSizeUntracked}>`,t);let n=dr(e,t);Se("[filterAndMap] filtered:",n.untrackedSize),Se.isDisabled||cr(()=>Se("[filterAndMap] filtered:",n.applogs));let i=function(){return typeof r=="function"?n.map(r):typeof r=="string"?n.map(u=>u[r]):n.map(fd(r))},a=mn({stream:e,pattern:t,caller:"filterAndMap"}),o=hi(i,{name:a});return Se.isDisabled||cr(()=>Se("[filterAndMap] mapped:",o)),o},{equals:Xe.structural}),dA=Ye(function(e,t,r,n={}){Dr(`queryAndMap<${e.nameAndSizeUntracked}>`,{patternOrPatterns:t,variables:n,map:r});let i=mn({stream:e,caller:"queryAndMap"}),a=wT(e,t);Se("[queryAndMap] filtered count:",a.untrackedSize);let o=hi(()=>{if(typeof r=="function")return a.records.map(r);if(typeof r=="string")return a.records.map(u=>u[r]);throw new Error("what's this map param about?")},{name:i});return Se.isDisabled||cr(()=>Se("[queryAndMap] result:",$r(o))),o},{equals:Xe.structural}),pA=Ye(function(e,t,r,n){Dr(`queryEntity<${e.nameAndSizeUntracked}>`,r,t);let i=dr(e,{en:r,at:OT(t,n)});return Se("queryEntity applogs:",i.applogs),Ge(()=>i.isEmpty?null:Object.fromEntries(i.map(({at:a,vl:o})=>[a.slice(t.length+1),o])))},{equals:Mf}),hA=Ye(function(e){mi(`agentsOfStream<${e.nameAndSizeUntracked}>`);let t=Ne.map();function r(n){for(let i of Ct(n)?n.init:n.added){let a=t.get(i.ag)??0;t.set(i.ag,a+1)}for(let i of!Ct(n)&&n.removed||[]){let a=t.get(i.ag);if(!a||a<1)throw Po("[agentsOfStream] number is now negative",{log:i,event:n,mapped:t,prev:a});t.set(i.ag,a-1)}mi(`agentsOfStream<${e.nameAndSizeUntracked}> processed event`,{event:n,mapped:t})}return Me(()=>r({init:e.applogs})),e.subscribe(r),fs(t,()=>e.unsubscribe(r)),t}),xT=Ye(function(e,t){return mi(`entityOverlap<${e.nameAndSizeUntracked}, ${t.nameAndSizeUntracked}>`),Ge(()=>{let r=new Set(e.map(i=>i.en)),n=new Set(t.map(i=>i.en));return[...r].filter(i=>n.has(i))})}),yA=Ye(function(e,t){return Ge(()=>xT(e,t).get().length)});function fd(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function OT(e,t){return t.map(r=>ET(e,r))}function ET(e,t){return`${e}/${t}`}var{WARN:od,LOG:mA,DEBUG:gA,VERBOSE:vA,ERROR:ad}=Oe.setup(Oe.INFO);function dd(e){return!!e.ts}function pd(e,t){return dd(e)?e:{...e,ts:t}}function hd(e,t){let{en:r,at:n}=e,i=TT(bT(t),{en:r,at:n},"cid");i.length>1&&od("[withPv] unexpected result count:",i.length);let a=i.length?i[0]:null,o=a===e.pv;return e.pv&&!o&&od("[withPv] different than pre-set pv:",{queriedPv:a,logPv:e.pv}),a=e.pv??a,{...e,pv:a??null}}function Os(e){if(e.length===0)throw ad("joinStreams called with empty array");if(e.length===1)return e[0];let t=()=>fr(Oo(e.flatMap(i=>{let a=i.applogs;if(!a)throw ad("falsy applogs of stream",i),new Error("falsy applogs of stream");return a}))),r=Me(()=>t()),n=gt(function(i,a){return Ct(i)?{init:Me(()=>t())}:{added:i.added.filter(o=>!this.hasApplog(o,!0)),removed:i.added.filter(o=>!this.parents.some(u=>u===a?!1:u.hasApplog(o,!0)))}});return new yi(e,["?"],r,n,`join(${e.map(i=>i.name).join(", ")})`)}var qe=Lt(Lr(),1),AT=Lt(gT(),1),yd=e=>qe.Type.Union([e,qe.Type.Null()]);var md=/^(k51qz|baguq)[0-9a-z]{56,57}$/,IT=/^[0-9A-Fa-f]{7,8}$/g;qe.FormatRegistry.Set("EntityID",e=>!!e.match(IT)||!!e.match(md));var gd=qe.Type.String();qe.FormatRegistry.Set("CID",e=>!!e.match(md));var ST=qe.Type.String({format:"EntityID"}),$T=/^http([s]?):\/\/.*\..*/;qe.FormatRegistry.Set("URL",e=>!!e.match($T));var kT=qe.Type.String({format:"URL"}),vd=qe.Type.Object({en:gd,at:qe.Type.String(),vl:yd(qe.Type.Union([qe.Type.String(),qe.Type.Boolean(),qe.Type.Number()])),ts:qe.Type.String(),ag:qe.Type.String()}),No=AT.TypeCompiler.Compile(vd),bd=e=>Array.from(No.Errors(e)),wd=No.Check.bind(No),{WARN:sd,LOG:UT,DEBUG:bA,VERBOSE:jT,ERROR:_d}=Oe.setup(Oe.INFO),Td=class extends Io{constructor(e,t,r=[],n){super(e,t,r,n),Br(this,{insert:gt})}insert(e){let t=gs(),r=e.map(a=>{let o=pd(a,t);if(!wd(o))throw _d(`Bogus Applog ${JSON.stringify(o)}`,bd(o));let u=hd(o,this),l=ja(u).toString(),c={...u,cid:l};return Object.freeze(c)}),n=Oo(r);if(e.length!==n.length?sd("request to insert duplicate log, inserting mappedLogs:",{appLogsToInsert:e,mappedLogs:n}):e.length?UT("Inserting:",n.length===1?n[0]:n,{ds:this}):sd("request to insert empty logs array"),!n.length)return[];fr(n);let i=this._applogs.length&&ms(n[0],this._applogs[this._applogs.length-1]);return this._applogs.push(...n),i&&fr(this._applogs),this.notifySubscribers({added:n,removed:null}),this.persist(n),n}get readOnly(){return!1}},Ro=class extends Td{constructor(e,t,r,n,i=null){super(i,t,e,r),this._readOnly=n,Br(this,{_applogs:Ne.shallow})}get readOnly(){return this._readOnly}persist(e){if(jT("[InMem.persist] no persist for",e),this.readOnly)throw _d("[persist] called for readOnly stream")}};var PT=Re((e,t)=>{"use strict";t.exports=o;var r=128,n=127,i=~n,a=Math.pow(2,31);function o(u,l,c){if(Number.MAX_SAFE_INTEGER&&u>Number.MAX_SAFE_INTEGER)throw o.bytes=0,new RangeError("Could not encode varint");l=l||[],c=c||0;for(var m=c;u>=a;)l[c++]=u&255|r,u/=128;for(;u&i;)l[c++]=u&255|r,u>>>=7;return l[c]=u|0,o.bytes=c-m+1,l}}),NT=Re((e,t)=>{"use strict";t.exports=i;var r=128,n=127;function i(a,l){var u=0,l=l||0,c=0,m=l,g,R=a.length;do{if(m>=R||c>49)throw i.bytes=0,new RangeError("Could not decode varint");g=a[m++],u+=c<28?(g&n)<<c:(g&n)*Math.pow(2,c),c+=7}while(g>=r);return i.bytes=m-l,u}}),BT=Re((e,t)=>{"use strict";var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),a=Math.pow(2,28),o=Math.pow(2,35),u=Math.pow(2,42),l=Math.pow(2,49),c=Math.pow(2,56),m=Math.pow(2,63);t.exports=function(g){return g<r?1:g<n?2:g<i?3:g<a?4:g<o?5:g<u?6:g<l?7:g<c?8:g<m?9:10}}),Ss=Re((e,t)=>{"use strict";t.exports={encode:PT(),decode:NT(),encodingLength:BT()}}),CT=42;function RT(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return rr.decode(e.subarray(1))}var Ad={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Ad.tags[CT]=RT;var MT=e=>Sa(e,Ad),Vr=Lt(Ss(),1),Es={SHA2_256:18,LENGTH:32,DAG_PB:112},LT=40;function Mo(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=Vr.default.decode(e);return t.seek(Vr.default.decode.bytes),r}function DT(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 VT(e){Vr.default.decode(e);let t=Vr.default.decode.bytes,r=Vr.default.decode(e.subarray(Vr.default.decode.bytes)),n=Vr.default.decode.bytes;return t+n+r}var pr={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},gi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":pr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(pr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=gi["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 a=e[i];if(a=gi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](a),a===void 0)return;n.push(a)}return n}}return e}},Int:pr.Int,CarV1HeaderOrV2Pragma:e=>{if(pr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[a,o]=t[i];switch(a){case"roots":{let u=gi["CarV1HeaderOrV2Pragma > roots (anon)"](e[a]);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.roots=u}}break;case"version":{n--;let u=gi.Int(e[a]);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.version=u}}break;default:return}}if(!(n>0))return r}},vi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":pr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(pr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=vi["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 a=e[i];if(a=vi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](a),a===void 0)return;n.push(a)}return n}}return e}},Int:pr.Int,CarV1HeaderOrV2Pragma:e=>{if(pr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[a,o]=t[i];switch(a){case"roots":{let u=vi["CarV1HeaderOrV2Pragma > roots (anon)"](o);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.roots=u}}break;case"version":{n--;let u=vi.Int(o);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.version=u}}break;default:return}}if(!(n>0))return r}},FT={toTyped:gi.CarV1HeaderOrV2Pragma,toRepresentation:vi.CarV1HeaderOrV2Pragma},mI=Ia(),gI=Lt(Ss(),1),vI=[new Y(P.map,2),new Y(P.string,"version"),new Y(P.uint,1),new Y(P.string,"roots")],bI=new Y(P.tag,42);async function Id(e,t){let r=Mo(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=MT(n);if(FT.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 a=DT(await e.exactly(LT,!0));e.seek(a.dataOffset-e.pos);let o=await Id(e,1);return Object.assign(o,a)}async function zT(e){let t=await e.exactly(2,!1);if(t[0]===Es.SHA2_256&&t[1]===Es.LENGTH){let o=await e.exactly(34,!0),u=Gn(o);return rr.create(0,Es.DAG_PB,u)}let r=Mo(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=Mo(await e.upTo(8),e),i=await e.exactly(VT(await e.upTo(8)),!0),a=Gn(i);return rr.create(r,n,a)}async function Sd(e){let t=e.pos,r=Mo(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await zT(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function GT(e){let{cid:t,blockLength:r}=await Sd(e);return{bytes:await e.exactly(r,!0),cid:t}}async function KT(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await Sd(e),a={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(a.blockLength),a}function $d(e){let t=(async()=>{let r=await Id(e);if(r.version===2){let n=e.pos-r.dataOffset;e=qT(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await GT(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await KT(e)}}}function kd(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 HT(e){let t=0,r=0,n=0,i=new Uint8Array(0),a=async o=>{r=i.length-n;let u=[i.subarray(n)];for(;r<o;){let c=await e();if(c==null)break;r<0?c.length>r&&u.push(c.subarray(-r)):u.push(c),r+=c.length}i=new Uint8Array(u.reduce((c,m)=>c+m.length,0));let l=0;for(let c of u)i.set(c,l),l+=c.length;n=0};return{async upTo(o){return i.length-n<o&&await a(o),i.subarray(n,n+Math.min(i.length-n,o))},async exactly(o,u=!1){if(i.length-n<o&&await a(o),i.length-n<o)throw new Error("Unexpected end of data");let l=i.subarray(n,n+o);return u&&(t+=o,n+=o),l},seek(o){t+=o,n+=o},get pos(){return t}}}function Ud(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return HT(r)}function qT(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 a=await e.exactly(n,i);if(a.length+r>t)throw new Error("Unexpected end of data");return i&&(r+=n),a},seek(n){r+=n,e.seek(n)},get pos(){return e.pos}}}var WT=class{constructor(e,t,r){this._version=e,this._roots=t,this._iterator=r}get version(){return this._version}async getRoots(){return this._roots}[Symbol.asyncIterator](){return this._iterator}static async fromBytes(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return xd(kd(e))}static async fromIterable(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return xd(Ud(e))}};async function xd(e){let t=$d(e),{version:r,roots:n}=await t.header();return new WT(r,n,t.blocksIndex())}var jd=class{constructor(e,t,r){this._version=e,this._roots=t,this._iterable=r,this._decoded=!1}get version(){return this._version}async getRoots(){return this._roots}},wI=class As extends jd{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");return this._decoded=!0,this._iterable[Symbol.asyncIterator]()}static async fromBytes(t){let{version:r,roots:n,iterator:i}=await Pd(t);return new As(r,n,i)}static async fromIterable(t){let{version:r,roots:n,iterator:i}=await Nd(t);return new As(r,n,i)}},_I=class Is extends jd{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");this._decoded=!0;let t=this._iterable[Symbol.asyncIterator]();return{async next(){let r=await t.next();return r.done?r:{done:!1,value:r.value.cid}}}}static async fromBytes(t){let{version:r,roots:n,iterator:i}=await Pd(t);return new Is(r,n,i)}static async fromIterable(t){let{version:r,roots:n,iterator:i}=await Nd(t);return new Is(r,n,i)}};async function Pd(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Bd(kd(e))}async function Nd(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Bd(Ud(e))}async function Bd(e){let t=$d(e),{version:r,roots:n}=await t.header();return{version:r,roots:n,iterator:t.blocks()}}var TI=Lt(Ss(),1);var xI=class{constructor(e){this._iterator=e}[Symbol.asyncIterator](){if(this._iterating)throw new Error("Multiple iterator not supported");return this._iterating=!0,this._iterator}};var{WARN:JT,LOG:OI,DEBUG:Od,VERBOSE:EI,ERROR:Ed}=Oe.setup(Oe.INFO);async function $s(e){let{roots:t,blocks:r}=await Cd(e);if(!t||!r)throw Ed("decodeCar is funky",{roots:t,blocks:r});t.length!==1&&JT("Unexpected roots count:",t);let n=r.get(t[0]);Od("root:",n,{blocks:r});let i=n.applogs.map(a=>{let o=a.toV1?a.toV1().toString():a["/"],u=r.get(o);if(!u)throw Ed("Could not find applog CID in Car file:",o,{root:n,blocks:r});return{...u,cid:o}});return Od("Decoded car logs:",n,{roots:t,blocks:r,applogs:i}),{applogs:i}}async function Cd(e){let t=(await e.getRoots()).map(n=>n.toV1().toString()),r=new Map;for await(let{cid:n,bytes:i}of e.blocks())r.set(n.toV1().toString(),Qi(i));return{roots:t,blocks:r}}var{WARN:XT,LOG:QI,DEBUG:Rd,VERBOSE:ZI,ERROR:YT}=Go.setup(Go.DEBUG);async function eS(e,{readOnly:t=!0,pinnedCID:r}={}){let n;if(r)n=bt.parse(r);else try{n=await QT(e),Rd("Resolved pub to CID",n.toString())}catch(c){throw YT(`Failed to resolve IPNS ${e}:`,c)}let i=await ZT(n),{applogs:a}=await $s(i),o=a.filter(c=>c instanceof Uint8Array);o.length&&XT(`Found ${o.length} encrypted logs - skipping`);let u=a.filter(c=>!(c instanceof Uint8Array));fr(u);let l=new Ro(u,[],`preview-${e}`,t);return{cid:n,dataStream:l}}async function QT(e){let r=await(await fetch(`https://name.web3.storage/name/${e}`)).json();return r.value.startsWith("/ipfs/")||console.warn("IPNS value is not ipfs:",r),bt.parse(r.value.replace("/ipfs/",""))}async function ZT(e){Rd("Retrieving:",e);let t=await fetch(`https://cloudflare-ipfs.com/ipfs/${e}?format=car&dag-scope=all`);if(!t?.ok||!t?.body)throw new Error(`unexpected response ${t?.statusText}`);let r=ex(t.body.getReader());return await wr.fromIterable(r)}function ex(e){return async function*(){for(;;){let{done:t,value:r}=await e.read();if(t)break;yield r}}()}export{eS as a,QT as b,ZT as c};
|
|
32
|
+
`)}function Kt(...x){let le={language:"javascript"},[I,ge,ne]=x.length===2&&(0,r.IsArray)(x[1])?[x[0],x[1],le]:x.length===2&&!(0,r.IsArray)(x[1])?[x[0],[],x[1]]:x.length===3?[x[0],x[1],x[2]]:x.length===1?[x[0],[],le]:[null,[],le];if(J.language=ne.language,J.variables.clear(),J.functions.clear(),J.instances.clear(),!u.TypeGuard.TSchema(I))throw new G(I);for(let de of ge)if(!u.TypeGuard.TSchema(de))throw new G(de);return be(I,ge,ne)}B.Code=Kt;function yr(x,le=[]){let I=Kt(x,le,{language:"javascript"}),ge=globalThis.Function("kind","format","hash",I),ne=new Map(J.instances);function de(Ke,Qe,Ht){if(!u.TypeRegistry.Has(Ke)||!ne.has(Qe))return!1;let Fr=u.TypeRegistry.Get(Ke),zr=ne.get(Qe);return Fr(zr,Ht)}function Ie(Ke,Qe){return u.FormatRegistry.Has(Ke)?u.FormatRegistry.Get(Ke)(Qe):!1}function Ce(Ke){return(0,o.Hash)(Ke)}let We=ge(de,Ie,Ce);return new l(x,le,We,I)}B.Compile=yr})(ae||(e.TypeCompiler=ae={}))}),vT=Re(e=>{"use strict";var t=e&&e.__createBinding||(Object.create?function(i,a,o,u){u===void 0&&(u=o);var l=Object.getOwnPropertyDescriptor(a,o);(!l||("get"in l?!a.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(i,u,l)}:function(i,a,o,u){u===void 0&&(u=o),i[u]=a[o]}),r=e&&e.__exportStar||function(i,a){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&t(a,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorIterator=e.ValueErrorType=void 0;var n=hT();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return n.ValueErrorIterator}}),r(gT(),e)}),{WARN:lA,LOG:mi,DEBUG:Dr,VERBOSE:Se,ERROR:Po}=Oe.setup(Oe.INFO,{prefix:"[q]"}),bT=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prev=r,Br(this,{allApplogs:Ge})}get record(){return this.variables}get allApplogs(){return this.prev?Es([this.logsOfThisNode,this.prev.allApplogs]):this.logsOfThisNode}},fd=class{constructor(e){this.nodes=e,Br(this,{allApplogs:Ge,size:Ge,isEmpty:Ge})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return Me(()=>this.records.length)}get records(){return this.nodes.map(({variables:e})=>e)}get applogSets(){return this.nodes.map(({logsOfThisNode:e})=>e.applogs)}get applogStreams(){return this.nodes.map(({logsOfThisNode:e})=>e)}get allApplogs(){return Es(this.nodes.map(e=>e.allApplogs))}},wT=Ye(function(e,{inverseToOnlyReturnFirstLogs:t,tolerateAlreadyFiltered:r}={}){if(Se(`withoutHistory${t?".inversed":""} < ${e.nameAndSizeUntracked} > initializing`),e.filters.includes("withoutHistory")){if(r)return Dr("[withoutHistory] already filtered, but tolerateAlreadyFiltered=true, so returning"),e;throw Po("stream already filtered withoutHistory:",e.filters,{name:e.name})}let n,i=Ts(e,function(a,o){let u=Ct(a),l,c=[],m=u?null:[];u?(n=new Map,l=a.init):l=a.added;let g;for(let R=t?0:l.length-1;t?R<l.length:R>=0;t?R++:R--){let j=l[R],G=vt([j.en,j.at]);if(g&&(t?g>j.ts:g<j.ts))throw Po("withoutHistory.mapper logs not sorted:",g,t?">":"<",j.ts,{log:j,i:R,newLogs:l,inverseToOnlyReturnFirstLogs:t});g=j.ts;let Z=n.get(G);(!Z||(t?Z.ts>j.ts:Z.ts<j.ts))&&(Z&&!u&&m.push(Z),c.push(j),n.set(G,j))}return fr(c),Se.isDisabled||Se(`withoutHistory${t?".inversed":""}<${e.nameAndSizeUntracked}> mapped event`,u?{...Object.fromEntries(Object.entries(a).map(([R,j])=>[R,j?.length])),toAdd:c.length,toRemove:m}:{...a,toAdd:c,toRemove:m}),u?{init:c}:{added:c,removed:m}},{name:`withoutHistory${t?".inversed":""}`,extraFilterName:"withoutHistory"});return Se.isDisabled||cr(()=>{Se(`withoutHistory<${e.nameAndSizeUntracked}> filtered down to`,i.applogs.length)}),i},{equals:gn}),fA=Ye(function(e){if(Se(`withoutDeleted<${e.nameAndSizeUntracked}>`),e.filters.includes("withoutDeleted"))throw Po("stream already filtered withoutDeleted:",e.filters,{name:e.name});let t=dr(e,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});Se(`withoutDeleted<${e.nameAndSizeUntracked}> deletionLogs:`,Me(()=>[...t.applogs]));let r=mn({caller:"allDeletedEntities",stream:e}),n=hi(()=>t.map(i=>i.en),{name:r});return Se.isDisabled||cr(()=>{Se(`withoutDeleted<${e.nameAndSizeUntracked}> deleted:`,[...n])}),dr(e,{"!en":n},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:gn}),_T=Ye(function e(t,r,n={},i={}){Dr(`query<${t.nameAndSizeUntracked}>:`,r);let a=Array.isArray(r)?r:[r],o;if(a.length===1)o=null;else{let c=a.slice(0,-1);o=e(t,c,n,i)}let u=a[a.length-1],l=TT(t,o,u,i);return Se.isDisabled||cr(()=>Se("query result:",$r(l))),l},{equals:Ao}),TT=Ye(function(e,t,r,n={}){if(Dr(`queryStep<${e.nameAndSizeUntracked}> with`,t?.untrackedSize??"all","nodes, pattern:",r),!Object.entries(r).length)throw new Error("Pattern is empty");let i=hi(()=>{function a(o){let[u,l]=Eo(r,o?.variables??{});Se("[queryStep] patternWithoutVars: ",u);let c=dr(e,u),m=dd(l),g=c.map(j=>({log:j,vars:m(j)}));Se.isDisabled||Se("[queryStep] step node:",o?.variables," =>",g,"from:",Me(()=>c.applogs));let R=g.map(({log:j,vars:G})=>{let Z=Object.assign({},o?.variables,G);return new bT(new Ro([j],e.filters,mn({caller:"QueryNode",stream:c,pattern:`${vt(Z)}@${vt(u)}`}),!0,c),Z,o)});return n.debug&&mi("[queryStep] step result:",Me(()=>R.map(({variables:j,logsOfThisNode:G})=>({variables:j,stream:G.applogs})))),R}return t?t.nodes.flatMap(a):a(null)},{name:mn({caller:"queryStep",stream:e,pattern:r})});return Se("queryStep result:",i),new fd(i)},{equals:Ao}),dA=Ye(function(e,t,r,n={}){let i=t.nodes;Dr(`queryNot<${e.nameAndSizeUntracked}> from: ${i.length} nodes`);let a=Array.isArray(r)?r:[r];for(let o of a){if(!Object.entries(r).length)throw new Error("Pattern is empty");i=i.filter(({variables:u})=>{let[l,c]=Eo(o,u??{});Se("[queryNot] patternWithoutVars: ",l);let m=dr(e,l);return Se("[queryNot] step node:",u," =>",m.size,"applogs"),Se.isDisabled||Se("[queryNot] step node:",u," => empty?",Me(()=>m.applogs)),n.debug&&mi("[queryNot] node result:",u,"=>",m.applogs),m.isEmpty})}return new fd(i)},{equals:Ao}),xT=Ye(function(e,t,r){Dr(`filterAndMap<${e.nameAndSizeUntracked}>`,t);let n=dr(e,t);Se("[filterAndMap] filtered:",n.untrackedSize),Se.isDisabled||cr(()=>Se("[filterAndMap] filtered:",n.applogs));let i=function(){return typeof r=="function"?n.map(r):typeof r=="string"?n.map(u=>u[r]):n.map(dd(r))},a=mn({stream:e,pattern:t,caller:"filterAndMap"}),o=hi(i,{name:a});return Se.isDisabled||cr(()=>Se("[filterAndMap] mapped:",o)),o},{equals:Xe.structural}),pA=Ye(function(e,t,r,n={}){Dr(`queryAndMap<${e.nameAndSizeUntracked}>`,{patternOrPatterns:t,variables:n,map:r});let i=mn({stream:e,caller:"queryAndMap"}),a=_T(e,t);Se("[queryAndMap] filtered count:",a.untrackedSize);let o=hi(()=>{if(typeof r=="function")return a.records.map(r);if(typeof r=="string")return a.records.map(u=>u[r]);throw new Error("what's this map param about?")},{name:i});return Se.isDisabled||cr(()=>Se("[queryAndMap] result:",$r(o))),o},{equals:Xe.structural}),hA=Ye(function(e,t,r,n){Dr(`queryEntity<${e.nameAndSizeUntracked}>`,r,t);let i=dr(e,{en:r,at:ET(t,n)});return Se("queryEntity applogs:",i.applogs),Ge(()=>i.isEmpty?null:Object.fromEntries(i.map(({at:a,vl:o})=>[a.slice(t.length+1),o])))},{equals:Lf}),yA=Ye(function(e){mi(`agentsOfStream<${e.nameAndSizeUntracked}>`);let t=Ne.map();function r(n){for(let i of Ct(n)?n.init:n.added){let a=t.get(i.ag)??0;t.set(i.ag,a+1)}for(let i of!Ct(n)&&n.removed||[]){let a=t.get(i.ag);if(!a||a<1)throw Po("[agentsOfStream] number is now negative",{log:i,event:n,mapped:t,prev:a});t.set(i.ag,a-1)}mi(`agentsOfStream<${e.nameAndSizeUntracked}> processed event`,{event:n,mapped:t})}return Me(()=>r({init:e.applogs})),e.subscribe(r),fs(t,()=>e.unsubscribe(r)),t}),OT=Ye(function(e,t){return mi(`entityOverlap<${e.nameAndSizeUntracked}, ${t.nameAndSizeUntracked}>`),Ge(()=>{let r=new Set(e.map(i=>i.en)),n=new Set(t.map(i=>i.en));return[...r].filter(i=>n.has(i))})}),mA=Ye(function(e,t){return Ge(()=>OT(e,t).get().length)});function dd(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function ET(e,t){return t.map(r=>AT(e,r))}function AT(e,t){return`${e}/${t}`}var{WARN:ad,LOG:gA,DEBUG:vA,VERBOSE:bA,ERROR:sd}=Oe.setup(Oe.INFO);function pd(e){return!!e.ts}function hd(e,t){return pd(e)?e:{...e,ts:t}}function yd(e,t){let{en:r,at:n}=e,i=xT(wT(t),{en:r,at:n},"cid");i.length>1&&ad("[withPv] unexpected result count:",i.length);let a=i.length?i[0]:null,o=a===e.pv;return e.pv&&!o&&ad("[withPv] different than pre-set pv:",{queriedPv:a,logPv:e.pv}),a=e.pv??a,{...e,pv:a??null}}function Es(e){if(e.length===0)throw sd("joinStreams called with empty array");if(e.length===1)return e[0];let t=()=>fr(Oo(e.flatMap(i=>{let a=i.applogs;if(!a)throw sd("falsy applogs of stream",i),new Error("falsy applogs of stream");return a}))),r=Me(()=>t()),n=gt(function(i,a){return Ct(i)?{init:Me(()=>t())}:{added:i.added.filter(o=>!this.hasApplog(o,!0)),removed:i.added.filter(o=>!this.parents.some(u=>u===a?!1:u.hasApplog(o,!0)))}});return new yi(e,["?"],r,n,`join(${e.map(i=>i.name).join(", ")})`)}var qe=Lt(Lr(),1),IT=Lt(vT(),1),md=e=>qe.Type.Union([e,qe.Type.Null()]);var gd=/^(k51qz|baguq)[0-9a-z]{56,57}$/,ST=/^[0-9A-Fa-f]{7,8}$/g;qe.FormatRegistry.Set("EntityID",e=>!!e.match(ST)||!!e.match(gd));var vd=qe.Type.String();qe.FormatRegistry.Set("CID",e=>!!e.match(gd));var $T=qe.Type.String({format:"EntityID"}),kT=/^http([s]?):\/\/.*\..*/;qe.FormatRegistry.Set("URL",e=>!!e.match(kT));var UT=qe.Type.String({format:"URL"}),bd=qe.Type.Object({en:vd,at:qe.Type.String(),vl:md(qe.Type.Union([qe.Type.String(),qe.Type.Boolean(),qe.Type.Number()])),ts:qe.Type.String(),ag:qe.Type.String()}),No=IT.TypeCompiler.Compile(bd),wd=e=>Array.from(No.Errors(e)),_d=No.Check.bind(No),{WARN:ud,LOG:jT,DEBUG:wA,VERBOSE:PT,ERROR:Td}=Oe.setup(Oe.INFO),xd=class extends Io{constructor(e,t,r=[],n){super(e,t,r,n),Br(this,{insert:gt})}insert(e){let t=gs(),r=e.map(a=>{let o=hd(a,t);if(!_d(o))throw Td(`Bogus Applog ${JSON.stringify(o)}`,wd(o));let u=yd(o,this),l=ja(u).toString(),c={...u,cid:l};return Object.freeze(c)}),n=Oo(r);if(e.length!==n.length?ud("request to insert duplicate log, inserting mappedLogs:",{appLogsToInsert:e,mappedLogs:n}):e.length?jT("Inserting:",n.length===1?n[0]:n,{ds:this}):ud("request to insert empty logs array"),!n.length)return[];fr(n);let i=this._applogs.length&&ms(n[0],this._applogs[this._applogs.length-1]);return this._applogs.push(...n),i&&fr(this._applogs),this.notifySubscribers({added:n,removed:null}),this.persist(n),n}get readOnly(){return!1}},Ro=class xs extends xd{constructor(t,r,n,i,a=null){super(a,r,t,n),this._readOnly=i,Br(this,{_applogs:Ne.shallow})}static empty(t){return xs.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new xs(t,[],r??"in-memory",n)}get readOnly(){return this._readOnly}persist(t){if(PT("[InMem.persist] no persist for",t),this.readOnly)throw Td("[persist] called for readOnly stream")}};var NT=Re((e,t)=>{"use strict";t.exports=o;var r=128,n=127,i=~n,a=Math.pow(2,31);function o(u,l,c){if(Number.MAX_SAFE_INTEGER&&u>Number.MAX_SAFE_INTEGER)throw o.bytes=0,new RangeError("Could not encode varint");l=l||[],c=c||0;for(var m=c;u>=a;)l[c++]=u&255|r,u/=128;for(;u&i;)l[c++]=u&255|r,u>>>=7;return l[c]=u|0,o.bytes=c-m+1,l}}),BT=Re((e,t)=>{"use strict";t.exports=i;var r=128,n=127;function i(a,l){var u=0,l=l||0,c=0,m=l,g,R=a.length;do{if(m>=R||c>49)throw i.bytes=0,new RangeError("Could not decode varint");g=a[m++],u+=c<28?(g&n)<<c:(g&n)*Math.pow(2,c),c+=7}while(g>=r);return i.bytes=m-l,u}}),CT=Re((e,t)=>{"use strict";var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),a=Math.pow(2,28),o=Math.pow(2,35),u=Math.pow(2,42),l=Math.pow(2,49),c=Math.pow(2,56),m=Math.pow(2,63);t.exports=function(g){return g<r?1:g<n?2:g<i?3:g<a?4:g<o?5:g<u?6:g<l?7:g<c?8:g<m?9:10}}),$s=Re((e,t)=>{"use strict";t.exports={encode:NT(),decode:BT(),encodingLength:CT()}}),RT=42;function MT(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return rr.decode(e.subarray(1))}var Id={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Id.tags[RT]=MT;var LT=e=>Sa(e,Id),Vr=Lt($s(),1),As={SHA2_256:18,LENGTH:32,DAG_PB:112},DT=40;function Mo(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=Vr.default.decode(e);return t.seek(Vr.default.decode.bytes),r}function VT(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 FT(e){Vr.default.decode(e);let t=Vr.default.decode.bytes,r=Vr.default.decode(e.subarray(Vr.default.decode.bytes)),n=Vr.default.decode.bytes;return t+n+r}var pr={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},gi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":pr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(pr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=gi["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 a=e[i];if(a=gi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](a),a===void 0)return;n.push(a)}return n}}return e}},Int:pr.Int,CarV1HeaderOrV2Pragma:e=>{if(pr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[a,o]=t[i];switch(a){case"roots":{let u=gi["CarV1HeaderOrV2Pragma > roots (anon)"](e[a]);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.roots=u}}break;case"version":{n--;let u=gi.Int(e[a]);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.version=u}}break;default:return}}if(!(n>0))return r}},vi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":pr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(pr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=vi["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 a=e[i];if(a=vi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](a),a===void 0)return;n.push(a)}return n}}return e}},Int:pr.Int,CarV1HeaderOrV2Pragma:e=>{if(pr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[a,o]=t[i];switch(a){case"roots":{let u=vi["CarV1HeaderOrV2Pragma > roots (anon)"](o);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.roots=u}}break;case"version":{n--;let u=vi.Int(o);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.version=u}}break;default:return}}if(!(n>0))return r}},zT={toTyped:gi.CarV1HeaderOrV2Pragma,toRepresentation:vi.CarV1HeaderOrV2Pragma},mI=Ia(),gI=Lt($s(),1),vI=[new Y(P.map,2),new Y(P.string,"version"),new Y(P.uint,1),new Y(P.string,"roots")],bI=new Y(P.tag,42);async function Sd(e,t){let r=Mo(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=LT(n);if(zT.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 a=VT(await e.exactly(DT,!0));e.seek(a.dataOffset-e.pos);let o=await Sd(e,1);return Object.assign(o,a)}async function GT(e){let t=await e.exactly(2,!1);if(t[0]===As.SHA2_256&&t[1]===As.LENGTH){let o=await e.exactly(34,!0),u=Gn(o);return rr.create(0,As.DAG_PB,u)}let r=Mo(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=Mo(await e.upTo(8),e),i=await e.exactly(FT(await e.upTo(8)),!0),a=Gn(i);return rr.create(r,n,a)}async function $d(e){let t=e.pos,r=Mo(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await GT(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function KT(e){let{cid:t,blockLength:r}=await $d(e);return{bytes:await e.exactly(r,!0),cid:t}}async function HT(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await $d(e),a={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(a.blockLength),a}function kd(e){let t=(async()=>{let r=await Sd(e);if(r.version===2){let n=e.pos-r.dataOffset;e=WT(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await KT(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await HT(e)}}}function Ud(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 qT(e){let t=0,r=0,n=0,i=new Uint8Array(0),a=async o=>{r=i.length-n;let u=[i.subarray(n)];for(;r<o;){let c=await e();if(c==null)break;r<0?c.length>r&&u.push(c.subarray(-r)):u.push(c),r+=c.length}i=new Uint8Array(u.reduce((c,m)=>c+m.length,0));let l=0;for(let c of u)i.set(c,l),l+=c.length;n=0};return{async upTo(o){return i.length-n<o&&await a(o),i.subarray(n,n+Math.min(i.length-n,o))},async exactly(o,u=!1){if(i.length-n<o&&await a(o),i.length-n<o)throw new Error("Unexpected end of data");let l=i.subarray(n,n+o);return u&&(t+=o,n+=o),l},seek(o){t+=o,n+=o},get pos(){return t}}}function jd(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return qT(r)}function WT(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 a=await e.exactly(n,i);if(a.length+r>t)throw new Error("Unexpected end of data");return i&&(r+=n),a},seek(n){r+=n,e.seek(n)},get pos(){return e.pos}}}var JT=class{constructor(e,t,r){this._version=e,this._roots=t,this._iterator=r}get version(){return this._version}async getRoots(){return this._roots}[Symbol.asyncIterator](){return this._iterator}static async fromBytes(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Od(Ud(e))}static async fromIterable(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Od(jd(e))}};async function Od(e){let t=kd(e),{version:r,roots:n}=await t.header();return new JT(r,n,t.blocksIndex())}var Pd=class{constructor(e,t,r){this._version=e,this._roots=t,this._iterable=r,this._decoded=!1}get version(){return this._version}async getRoots(){return this._roots}},wI=class Is extends Pd{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");return this._decoded=!0,this._iterable[Symbol.asyncIterator]()}static async fromBytes(t){let{version:r,roots:n,iterator:i}=await Nd(t);return new Is(r,n,i)}static async fromIterable(t){let{version:r,roots:n,iterator:i}=await Bd(t);return new Is(r,n,i)}},_I=class Ss extends Pd{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");this._decoded=!0;let t=this._iterable[Symbol.asyncIterator]();return{async next(){let r=await t.next();return r.done?r:{done:!1,value:r.value.cid}}}}static async fromBytes(t){let{version:r,roots:n,iterator:i}=await Nd(t);return new Ss(r,n,i)}static async fromIterable(t){let{version:r,roots:n,iterator:i}=await Bd(t);return new Ss(r,n,i)}};async function Nd(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Cd(Ud(e))}async function Bd(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Cd(jd(e))}async function Cd(e){let t=kd(e),{version:r,roots:n}=await t.header();return{version:r,roots:n,iterator:t.blocks()}}var TI=Lt($s(),1);var xI=class{constructor(e){this._iterator=e}[Symbol.asyncIterator](){if(this._iterating)throw new Error("Multiple iterator not supported");return this._iterating=!0,this._iterator}};var{WARN:XT,LOG:OI,DEBUG:Ed,VERBOSE:EI,ERROR:Ad}=Oe.setup(Oe.INFO);async function ks(e){let{roots:t,blocks:r}=await Rd(e);if(!t||!r)throw Ad("decodeCar is funky",{roots:t,blocks:r});t.length!==1&&XT("Unexpected roots count:",t);let n=r.get(t[0]);Ed("root:",n,{blocks:r});let i=n.applogs.map(a=>{let o=a.toV1?a.toV1().toString():a["/"],u=r.get(o);if(!u)throw Ad("Could not find applog CID in Car file:",o,{root:n,blocks:r});return{...u,cid:o}});return Ed("Decoded car logs:",n,{roots:t,blocks:r,applogs:i}),{applogs:i}}async function Rd(e){let t=(await e.getRoots()).map(n=>n.toV1().toString()),r=new Map;for await(let{cid:n,bytes:i}of e.blocks())r.set(n.toV1().toString(),Qi(i));return{roots:t,blocks:r}}var{WARN:YT,LOG:QI,DEBUG:Md,VERBOSE:ZI,ERROR:QT}=Go.setup(Go.DEBUG);async function eS(e,{readOnly:t=!0,pinnedCID:r}={}){let n;if(r)n=bt.parse(r);else try{n=await ZT(e),Md("Resolved pub to CID",n.toString())}catch(c){throw QT(`Failed to resolve IPNS ${e}:`,c)}let i=await ex(n),{applogs:a}=await ks(i),o=a.filter(c=>c instanceof Uint8Array);o.length&&YT(`Found ${o.length} encrypted logs - skipping`);let u=a.filter(c=>!(c instanceof Uint8Array));fr(u);let l=new Ro(u,[],`preview-${e}`,t);return{cid:n,dataStream:l}}async function ZT(e){let r=await(await fetch(`https://name.web3.storage/name/${e}`)).json();return r.value.startsWith("/ipfs/")||console.warn("IPNS value is not ipfs:",r),bt.parse(r.value.replace("/ipfs/",""))}async function ex(e){Md("Retrieving:",e);let t=await fetch(`https://cloudflare-ipfs.com/ipfs/${e}?format=car&dag-scope=all`);if(!t?.ok||!t?.body)throw new Error(`unexpected response ${t?.statusText}`);let r=tx(t.body.getReader());return await wr.fromIterable(r)}function tx(e){return async function*(){for(;;){let{done:t,value:r}=await e.read();if(t)break;yield r}}()}export{eS as a,ZT as b,ex as c};
|
|
33
33
|
/*! Bundled license information:
|
|
34
34
|
|
|
35
35
|
@noble/hashes/esm/utils.js:
|
|
@@ -48,4 +48,4 @@ lodash-es/lodash.js:
|
|
|
48
48
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
49
49
|
*)
|
|
50
50
|
*/
|
|
51
|
-
//# sourceMappingURL=chunk-
|
|
51
|
+
//# sourceMappingURL=chunk-NGDKLL6Y.min.js.map
|