@wovin/connect-nftstorage 0.0.5 → 0.0.7
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-NM3L4FRZ.min.js +51 -0
- package/dist/{chunk-ERMY3HEM.min.js.map → chunk-NM3L4FRZ.min.js.map} +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/retrieve.d.ts +3 -3
- package/dist/retrieve.d.ts.map +1 -1
- package/dist/retrieve.min.js +1 -1
- package/package.json +58 -46
- package/dist/chunk-ERMY3HEM.min.js +0 -51
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import{b as bi,d as Do,e as Lo,f as wi,g as gt}from"./chunk-SOBCOB7T.min.js";var Mu=bi((sE,Ru)=>{"use strict";Ru.exports=Yo;var Cu=128,Ip=127,Sp=~Ip,$p=Math.pow(2,31);function Yo(e,t,r){if(Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw Yo.bytes=0,new RangeError("Could not encode varint");t=t||[],r=r||0;for(var n=r;e>=$p;)t[r++]=e&255|Cu,e/=128;for(;e&Sp;)t[r++]=e&255|Cu,e>>>=7;return t[r]=e|0,Yo.bytes=r-n+1,t}});var Vu=bi((uE,Lu)=>{"use strict";Lu.exports=Xo;var kp=128,Du=127;function Xo(e,n){var r=0,n=n||0,i=0,a=n,o,u=e.length;do{if(a>=u||i>49)throw Xo.bytes=0,new RangeError("Could not decode varint");o=e[a++],r+=i<28?(o&Du)<<i:(o&Du)*Math.pow(2,i),i+=7}while(o>=kp);return Xo.bytes=a-n,r}});var zu=bi((cE,Fu)=>{"use strict";var Up=Math.pow(2,7),Np=Math.pow(2,14),jp=Math.pow(2,21),Pp=Math.pow(2,28),Bp=Math.pow(2,35),Cp=Math.pow(2,42),Rp=Math.pow(2,49),Mp=Math.pow(2,56),Dp=Math.pow(2,63);Fu.exports=function(e){return e<Up?1:e<Np?2:e<jp?3:e<Pp?4:e<Bp?5:e<Cp?6:e<Rp?7:e<Mp?8:e<Dp?9:10}});var ji=bi((lE,qu)=>{"use strict";qu.exports={encode:Mu(),decode:Vu(),encodingLength:zu()}});var Yd=["string","number","bigint","symbol"],Xd=["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 Ns(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(Yd.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(Zd(e))return"Buffer";let r=Qd(e);return r||"Object"}function Zd(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function Qd(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Xd.includes(t))return t}var L=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}};L.uint=new L(0,"uint",!0);L.negint=new L(1,"negint",!0);L.bytes=new L(2,"bytes",!0);L.string=new L(3,"string",!0);L.array=new L(4,"array",!1);L.map=new L(5,"map",!1);L.tag=new L(6,"tag",!1);L.float=new L(7,"float",!0);L.false=new L(7,"false",!0);L.true=new L(7,"true",!0);L.null=new L(7,"null",!0);L.undefined=new L(7,"undefined",!0);L.break=new L(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 Gr=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",ep=new TextDecoder,tp=new TextEncoder;function _i(e){return Gr&&globalThis.Buffer.isBuffer(e)}function Cs(e){return e instanceof Uint8Array?_i(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Rs=Gr?(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?ep.decode(e.subarray(t,r)):Ps(e,t,r),Ms=Gr?e=>e.length>64?globalThis.Buffer.from(e):js(e):e=>e.length>64?tp.encode(e):js(e);var Hr=Gr?(e,t,r)=>_i(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Ds=Gr?(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},Ls=Gr?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Vs(e,t){if(_i(e)&&_i(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,y;switch(o){case 1:i<128&&(a=i);break;case 2:u=e[t+1],(u&192)===128&&(y=(i&31)<<6|u&63,y>127&&(a=y));break;case 3:u=e[t+1],l=e[t+2],(u&192)===128&&(l&192)===128&&(y=(i&15)<<12|(u&63)<<6|l&63,y>2047&&(y<55296||y>57343)&&(a=y));break;case 4:u=e[t+1],l=e[t+2],c=e[t+3],(u&192)===128&&(l&192)===128&&(c&192)===128&&(y=(i&15)<<18|(u&63)<<12|(l&63)<<6|c&63,y>65535&&y<1114112&&(a=y))}}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 rp(n)}var Bs=4096;function rp(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 np=256,xi=class{constructor(t=np){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=Ds(this.chunks,this.cursor);return t&&this.reset(),r}};var ve="CBOR decode error:",Vo="CBOR encode error:",An=[];An[23]=1;An[24]=2;An[25]=3;An[26]=5;An[27]=9;function Ct(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){Ct(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){Ct(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){Ct(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){Ct(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(L.uint,tt(e,t+1,n),2)}function zs(e,t,r,n){return new ce(L.uint,rt(e,t+1,n),3)}function qs(e,t,r,n){return new ce(L.uint,nt(e,t+1,n),5)}function Ks(e,t,r,n){return new ce(L.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 Gs(e,t,r,n){return new ce(L.negint,-1-tt(e,t+1,n),2)}function Hs(e,t,r,n){return new ce(L.negint,-1-rt(e,t+1,n),3)}function Ws(e,t,r,n){return new ce(L.negint,-1-nt(e,t+1,n),5)}var Fo=BigInt(-1),Js=BigInt(1);function Ys(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(L.negint,a,9)}if(n.allowBigInt!==!0)throw new Error(`${ve} integers outside of the safe integer range are not supported`);return new ce(L.negint,Fo-BigInt(i),9)}function Ti(e,t){let r=t.value,n=typeof r=="bigint"?r*Fo-Js:r*-1-1;Fe(e,t.type.majorEncoded,n)}Ti.encodedSize=function(t){let r=t.value,n=typeof r=="bigint"?r*Fo-Js:r*-1-1;return n<Ve[0]?1:n<Ve[1]?2:n<Ve[2]?3:n<Ve[3]?5:9};Ti.compareTokens=function(t,r){return t.value<r.value?1:t.value>r.value?-1:0};function In(e,t,r,n){Ct(e,t,r+n);let i=Hr(e,t+r,t+r+n);return new ce(L.bytes,i,r+n)}function Xs(e,t,r,n){return In(e,t,1,r)}function Zs(e,t,r,n){return In(e,t,2,tt(e,t+1,n))}function Qs(e,t,r,n){return In(e,t,3,rt(e,t+1,n))}function eu(e,t,r,n){return In(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 In(e,t,9,i)}function Ei(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===L.string?Ms(e.value):e.value),e.encodedBytes}function Wr(e,t){let r=Ei(t);Fe(e,t.type.majorEncoded,r.length),e.push(r)}Wr.encodedSize=function(t){let r=Ei(t);return Fe.encodedSize(r.length)+r.length};Wr.compareTokens=function(t,r){return op(Ei(t),Ei(r))};function op(e,t){return e.length<t.length?-1:e.length>t.length?1:Vs(e,t)}function Sn(e,t,r,n,i){let a=r+n;Ct(e,t,a);let o=new ce(L.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 Sn(e,t,1,r,n)}function nu(e,t,r,n){return Sn(e,t,2,tt(e,t+1,n),n)}function iu(e,t,r,n){return Sn(e,t,3,rt(e,t+1,n),n)}function ou(e,t,r,n){return Sn(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 Sn(e,t,9,i,n)}var su=Wr;function Jr(e,t,r,n){return new ce(L.array,n,r)}function uu(e,t,r,n){return Jr(e,t,1,r)}function cu(e,t,r,n){return Jr(e,t,2,tt(e,t+1,n))}function lu(e,t,r,n){return Jr(e,t,3,rt(e,t+1,n))}function fu(e,t,r,n){return Jr(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 Jr(e,t,9,i)}function pu(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 Oi(e,t){Fe(e,L.array.majorEncoded,t.value)}Oi.compareTokens=ct.compareTokens;Oi.encodedSize=function(t){return Fe.encodedSize(t.value)};function Yr(e,t,r,n){return new ce(L.map,n,r)}function hu(e,t,r,n){return Yr(e,t,1,r)}function yu(e,t,r,n){return Yr(e,t,2,tt(e,t+1,n))}function mu(e,t,r,n){return Yr(e,t,3,rt(e,t+1,n))}function gu(e,t,r,n){return Yr(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 Yr(e,t,9,i)}function bu(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return Yr(e,t,1,1/0)}function Ai(e,t){Fe(e,L.map.majorEncoded,t.value)}Ai.compareTokens=ct.compareTokens;Ai.encodedSize=function(t){return Fe.encodedSize(t.value)};function wu(e,t,r,n){return new ce(L.tag,r,1)}function _u(e,t,r,n){return new ce(L.tag,tt(e,t+1,n),2)}function xu(e,t,r,n){return new ce(L.tag,rt(e,t+1,n),3)}function Tu(e,t,r,n){return new ce(L.tag,nt(e,t+1,n),5)}function Eu(e,t,r,n){return new ce(L.tag,it(e,t+1,n),9)}function Ii(e,t){Fe(e,L.tag.majorEncoded,t.value)}Ii.compareTokens=ct.compareTokens;Ii.encodedSize=function(t){return Fe.encodedSize(t.value)};var fp=20,dp=21,pp=22,hp=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(L.null,null,1):new ce(L.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(L.break,void 0,1)}function zo(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(L.float,e,t)}function Iu(e,t,r,n){return zo(qo(e,t+1),3,n)}function Su(e,t,r,n){return zo(Ko(e,t+1),5,n)}function $u(e,t,r,n){return zo(ju(e,t+1),9,n)}function Si(e,t,r){let n=t.value;if(n===!1)e.push([L.float.majorEncoded|fp]);else if(n===!0)e.push([L.float.majorEncoded|dp]);else if(n===null)e.push([L.float.majorEncoded|pp]);else if(n===void 0)e.push([L.float.majorEncoded|hp]);else{let i,a=!1;(!r||r.float64!==!0)&&(Uu(n),i=qo(vt,1),n===i||Number.isNaN(n)?(vt[0]=249,e.push(vt.slice(0,3)),a=!0):(Nu(n),i=Ko(vt,1),n===i&&(vt[0]=250,e.push(vt.slice(0,5)),a=!0))),a||(yp(n),i=ju(vt,1),vt[0]=251,e.push(vt.slice(0,9)))}}Si.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=qo(vt,1);if(n===i||Number.isNaN(n))return 3;if(Nu(n),i=Ko(vt,1),n===i)return 5}return 9};var ku=new ArrayBuffer(9),lt=new DataView(ku,1),vt=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 qo(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 Nu(e){lt.setFloat32(0,e,!1)}function Ko(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 yp(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)}Si.compareTokens=ct.compareTokens;function Te(e,t,r){throw new Error(`${ve} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function $i(e){return()=>{throw new Error(`${ve} ${e}`)}}var ie=[];for(let e=0;e<=23;e++)ie[e]=Te;ie[24]=Fs;ie[25]=zs;ie[26]=qs;ie[27]=Ks;ie[28]=Te;ie[29]=Te;ie[30]=Te;ie[31]=Te;for(let e=32;e<=55;e++)ie[e]=Te;ie[56]=Gs;ie[57]=Hs;ie[58]=Ws;ie[59]=Ys;ie[60]=Te;ie[61]=Te;ie[62]=Te;ie[63]=Te;for(let e=64;e<=87;e++)ie[e]=Xs;ie[88]=Zs;ie[89]=Qs;ie[90]=eu;ie[91]=tu;ie[92]=Te;ie[93]=Te;ie[94]=Te;ie[95]=$i("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]=Te;ie[125]=Te;ie[126]=Te;ie[127]=$i("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]=Te;ie[157]=Te;ie[158]=Te;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]=Te;ie[189]=Te;ie[190]=Te;ie[191]=bu;for(let e=192;e<=215;e++)ie[e]=wu;ie[216]=_u;ie[217]=xu;ie[218]=Tu;ie[219]=Eu;ie[220]=Te;ie[221]=Te;ie[222]=Te;ie[223]=Te;for(let e=224;e<=243;e++)ie[e]=$i("simple values are not supported");ie[244]=Te;ie[245]=Te;ie[246]=Te;ie[247]=Ou;ie[248]=$i("simple values are not supported");ie[249]=Iu;ie[250]=Su;ie[251]=$u;ie[252]=Te;ie[253]=Te;ie[254]=Te;ie[255]=Au;var bt=[];for(let e=0;e<24;e++)bt[e]=new ce(L.uint,e,1);for(let e=-1;e>=-24;e--)bt[31-e]=new ce(L.negint,e,1);bt[64]=new ce(L.bytes,new Uint8Array(0),1);bt[96]=new ce(L.string,"",1);bt[128]=new ce(L.array,0,1);bt[160]=new ce(L.map,0,1);bt[244]=new ce(L.false,!1,1);bt[245]=new ce(L.true,!0,1);bt[246]=new ce(L.null,null,1);function Go(){let e=[];return e[L.uint.major]=ct,e[L.negint.major]=Ti,e[L.bytes.major]=Wr,e[L.string.major]=su,e[L.array.major]=Oi,e[L.map.major]=Ai,e[L.tag.major]=Ii,e[L.float.major]=Si,e}var YT=Go(),XT=new xi,Ui=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(`${Vo} object contains circular references`);return new e(r,t)}},Gt={null:new ce(L.null,null),undefined:new ce(L.undefined,void 0),true:new ce(L.true,!0),false:new ce(L.false,!1),emptyArray:new ce(L.array,0),emptyMap:new ce(L.map,0)},Ht={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ce(L.float,e):e>=0?new ce(L.uint,e):new ce(L.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ce(L.uint,e):new ce(L.negint,e)},Uint8Array(e,t,r,n){return new ce(L.bytes,e)},string(e,t,r,n){return new ce(L.string,e)},boolean(e,t,r,n){return e?Gt.true:Gt.false},null(e,t,r,n){return Gt.null},undefined(e,t,r,n){return Gt.undefined},ArrayBuffer(e,t,r,n){return new ce(L.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ce(L.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Gt.emptyArray,new ce(L.break)]:Gt.emptyArray;n=Ui.createCheck(n,e);let i=[],a=0;for(let o of e)i[a++]=ki(o,r,n);return r.addBreakTokens?[new ce(L.array,e.length),i,new ce(L.break)]:[new ce(L.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?[Gt.emptyMap,new ce(L.break)]:Gt.emptyMap;n=Ui.createCheck(n,e);let u=[],l=0;for(let c of a)u[l++]=[ki(c,r,n),ki(i?e.get(c):e[c],r,n)];return vp(u,r),r.addBreakTokens?[new ce(L.map,o),u,new ce(L.break)]:[new ce(L.map,o),u]}};Ht.Map=Ht.Object;Ht.Buffer=Ht.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Ht[`${e}Array`]=Ht.DataView;function ki(e,t={},r){let n=Ns(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Ht[n];if(typeof i=="function"){let o=i(e,n,t,r);if(o!=null)return o}let a=Ht[n];if(!a)throw new Error(`${Vo} unsupported type: ${n}`);return a(e,n,t,r)}function vp(e,t){t.mapSorter&&e.sort(t.mapSorter)}var bp={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Ho=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=bt[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}},$n=Symbol.for("DONE"),Ni=Symbol.for("BREAK");function wp(e,t,r){let n=[];for(let i=0;i<e.value;i++){let a=kn(t,r);if(a===Ni){if(e.value===1/0)break;throw new Error(`${ve} got unexpected break to lengthed array`)}if(a===$n)throw new Error(`${ve} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=a}return n}function _p(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=kn(t,r);if(u===Ni){if(e.value===1/0)break;throw new Error(`${ve} got unexpected break to lengthed map`)}if(u===$n)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=kn(t,r);if(l===$n)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 kn(e,t){if(e.done())return $n;let r=e.next();if(r.type===L.break)return Ni;if(r.type.terminal)return r.value;if(r.type===L.array)return wp(r,e,t);if(r.type===L.map)return _p(r,e,t);if(r.type===L.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=kn(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({},bp,t);let r=t.tokenizer||new Ho(e,t),n=kn(r,t);if(n===$n)throw new Error(`${ve} did not find any content to decode`);if(n===Ni)throw new Error(`${ve} got unexpected break`);return[n,e.subarray(r.pos())]}function Wo(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 Ep=42;function Op(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return gt.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[Ep]=Op;var Jo=e=>Wo(e,Bu);var Wt=Do(ji(),1),Un={SHA2_256:18,LENGTH:32,DAG_PB:112},Zo=40;function Xr(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=Wt.default.decode(e);return t.seek(Wt.default.decode.bytes),r}function Qo(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 ea(e){Wt.default.decode(e);let t=Wt.default.decode.bytes,r=Wt.default.decode(e.subarray(Wt.default.decode.bytes)),n=Wt.default.decode.bytes;return t+n+r}var Jt={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},Nn={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Jt.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Jt.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:Jt.Int,CarV1HeaderOrV2Pragma:e=>{if(Jt.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)"](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=Nn.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}},jn={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Jt.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Jt.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=jn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let a=e[i];if(a=jn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](a),a===void 0)return;n.push(a)}return n}}return e}},Int:Jt.Int,CarV1HeaderOrV2Pragma:e=>{if(Jt.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=jn["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=jn.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}},ta={toTyped:Nn.CarV1HeaderOrV2Pragma,toRepresentation:jn.CarV1HeaderOrV2Pragma};var _E=Go();var zp=Do(ji(),1);var AE=[new ce(L.map,2),new ce(L.string,"version"),new ce(L.uint,1),new ce(L.string,"roots")],IE=new ce(L.tag,42);async function ra(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=Jo(n);if(ta.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=Qo(await e.exactly(Zo,!0));e.seek(a.dataOffset-e.pos);let o=await ra(e,1);return Object.assign(o,a)}async function Kp(e){let t=await e.exactly(2,!1);if(t[0]===Un.SHA2_256&&t[1]===Un.LENGTH){let o=await e.exactly(34,!0),u=wi(o);return gt.create(0,Un.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(ea(await e.upTo(8)),!0),a=wi(i);return gt.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 Kp(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function Gp(e){let{cid:t,blockLength:r}=await Ku(e);return{bytes:await e.exactly(r,!0),cid:t}}async function Hp(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 Yt(e){let t=(async()=>{let r=await ra(e);if(r.version===2){let n=e.pos-r.dataOffset;e=Jp(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await Gp(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await Hp(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 Wp(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,y)=>c+y.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 Xt(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return Wp(r)}function Jp(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 Pn=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 Gu(br(t))}static async fromIterable(t){if(!t||typeof t[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Gu(Xt(t))}};async function Gu(e){let t=Yt(e),{version:r,roots:n}=await t.header();return new Pn(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(Xt(t))}};async function Hu(e){let t=Yt(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new wr(r,n)}var Pi=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}},na=class e extends Pi{[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)}},ia=class e extends Pi{[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 Yu(br(e))}async function Ju(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Yu(Xt(e))}async function Yu(e){let t=Yt(e),{version:r,roots:n}=await t.header();return{version:r,roots:n,iterator:t.blocks()}}var Yp=Do(ji(),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 Xp=Object.create,da=Object.defineProperty,Zp=Object.getOwnPropertyDescriptor,Qp=Object.getOwnPropertyNames,eh=Object.getPrototypeOf,th=Object.prototype.hasOwnProperty,Le=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),cc=(e,t)=>{for(var r in t)da(e,r,{get:t[r],enumerable:!0})},rh=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Qp(t))!th.call(e,i)&&i!==r&&da(e,i,{get:()=>t[i],enumerable:!(n=Zp(t,i))||n.enumerable});return e},nr=(e,t,r)=>(r=e!=null?Xp(eh(e)):{},rh(t||!e||!e.__esModule?da(r,"default",{value:e,enumerable:!0}):r,e)),nh={};cc(nh,{code:()=>$c,decode:()=>Wi,encode:()=>Ia,format:()=>sc,name:()=>um,parse:()=>lm,stringify:()=>sc});var ih=["string","number","bigint","symbol"],oh=["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 ah(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return ih.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":sh(e)?"Buffer":uh(e)||"Object"}function sh(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function uh(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(oh.includes(t))return t}var j=class{constructor(e,t,r){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=r}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}};j.uint=new j(0,"uint",!0);j.negint=new j(1,"negint",!0);j.bytes=new j(2,"bytes",!0);j.string=new j(3,"string",!0);j.array=new j(4,"array",!1);j.map=new j(5,"map",!1);j.tag=new j(6,"tag",!1);j.float=new j(7,"float",!0);j.false=new j(7,"false",!0);j.true=new j(7,"true",!0);j.null=new j(7,"null",!0);j.undefined=new j(7,"undefined",!0);j.break=new j(7,"break",!0);var X=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",ch=new TextDecoder,lh=new TextEncoder;function Ri(e){return Zr&&globalThis.Buffer.isBuffer(e)}function pa(e){return e instanceof Uint8Array?Ri(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var fh=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?ch.decode(e.subarray(t,r)):Qu(e,t,r),lc=Zr?e=>e.length>64?globalThis.Buffer.from(e):Zu(e):e=>e.length>64?lh.encode(e):Zu(e);var ha=Zr?(e,t,r)=>Ri(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),dh=Zr?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),pa(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},ph=Zr?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function hh(e,t){if(Ri(e)&&Ri(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 Zu(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,y;switch(o){case 1:i<128&&(a=i);break;case 2:u=e[t+1],(u&192)===128&&(y=(i&31)<<6|u&63,y>127&&(a=y));break;case 3:u=e[t+1],l=e[t+2],(u&192)===128&&(l&192)===128&&(y=(i&15)<<12|(u&63)<<6|l&63,y>2047&&(y<55296||y>57343)&&(a=y));break;case 4:u=e[t+1],l=e[t+2],c=e[t+3],(u&192)===128&&(l&192)===128&&(c&192)===128&&(y=(i&15)<<18|(u&63)<<12|(l&63)<<6|c&63,y>65535&&y<1114112&&(a=y))}}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 yh=256,dc=class{constructor(e=yh){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=ph(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=ha(r,0,this.cursor)}else t=dh(this.chunks,this.cursor);return e&&this.reset(),t}},he="CBOR decode error:",_r="CBOR encode error:",Ln=[];Ln[23]=1;Ln[24]=2;Ln[25]=3;Ln[26]=5;Ln[27]=9;function Qr(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 xr(e,t,r){Qr(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 Tr(e,t,r){Qr(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 Er(e,t,r){Qr(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 Or(e,t,r){Qr(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 mh(e,t,r,n){return new X(j.uint,xr(e,t+1,n),2)}function gh(e,t,r,n){return new X(j.uint,Tr(e,t+1,n),3)}function vh(e,t,r,n){return new X(j.uint,Er(e,t+1,n),5)}function bh(e,t,r,n){return new X(j.uint,Or(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 wh(e,t,r,n){return new X(j.negint,-1-xr(e,t+1,n),2)}function _h(e,t,r,n){return new X(j.negint,-1-Tr(e,t+1,n),3)}function xh(e,t,r,n){return new X(j.negint,-1-Er(e,t+1,n),5)}var ya=BigInt(-1),pc=BigInt(1);function Th(e,t,r,n){let i=Or(e,t+1,n);if(typeof i!="bigint"){let a=-1-i;if(a>=Number.MIN_SAFE_INTEGER)return new X(j.negint,a,9)}if(n.allowBigInt!==!0)throw new Error(`${he} integers outside of the safe integer range are not supported`);return new X(j.negint,ya-BigInt(i),9)}function ma(e,t){let r=t.value,n=typeof r=="bigint"?r*ya-pc:r*-1-1;dt(e,t.type.majorEncoded,n)}ma.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*ya-pc:t*-1-1;return r<ze[0]?1:r<ze[1]?2:r<ze[2]?3:r<ze[3]?5:9};ma.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Vn(e,t,r,n){Qr(e,t,r+n);let i=ha(e,t+r,t+r+n);return new X(j.bytes,i,r+n)}function Eh(e,t,r,n){return Vn(e,t,1,r)}function Oh(e,t,r,n){return Vn(e,t,2,xr(e,t+1,n))}function Ah(e,t,r,n){return Vn(e,t,3,Tr(e,t+1,n))}function Ih(e,t,r,n){return Vn(e,t,5,Er(e,t+1,n))}function Sh(e,t,r,n){let i=Or(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer bytes lengths not supported`);return Vn(e,t,9,i)}function Mi(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===j.string?lc(e.value):e.value),e.encodedBytes}function qi(e,t){let r=Mi(t);dt(e,t.type.majorEncoded,r.length),e.push(r)}qi.encodedSize=function(e){let t=Mi(e);return dt.encodedSize(t.length)+t.length};qi.compareTokens=function(e,t){return $h(Mi(e),Mi(t))};function $h(e,t){return e.length<t.length?-1:e.length>t.length?1:hh(e,t)}function Fn(e,t,r,n,i){let a=r+n;Qr(e,t,a);let o=new X(j.string,fh(e,t+r,t+a),a);return i.retainStringBytes===!0&&(o.byteValue=ha(e,t+r,t+a)),o}function kh(e,t,r,n){return Fn(e,t,1,r,n)}function Uh(e,t,r,n){return Fn(e,t,2,xr(e,t+1,n),n)}function Nh(e,t,r,n){return Fn(e,t,3,Tr(e,t+1,n),n)}function jh(e,t,r,n){return Fn(e,t,5,Er(e,t+1,n),n)}function Ph(e,t,r,n){let i=Or(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer string lengths not supported`);return Fn(e,t,9,i,n)}var Bh=qi;function en(e,t,r,n){return new X(j.array,n,r)}function Ch(e,t,r,n){return en(e,t,1,r)}function Rh(e,t,r,n){return en(e,t,2,xr(e,t+1,n))}function Mh(e,t,r,n){return en(e,t,3,Tr(e,t+1,n))}function Dh(e,t,r,n){return en(e,t,5,Er(e,t+1,n))}function Lh(e,t,r,n){let i=Or(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer array lengths not supported`);return en(e,t,9,i)}function Vh(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${he} indefinite length items not allowed`);return en(e,t,1,1/0)}function ga(e,t){dt(e,j.array.majorEncoded,t.value)}ga.compareTokens=Ar.compareTokens;ga.encodedSize=function(e){return dt.encodedSize(e.value)};function tn(e,t,r,n){return new X(j.map,n,r)}function Fh(e,t,r,n){return tn(e,t,1,r)}function zh(e,t,r,n){return tn(e,t,2,xr(e,t+1,n))}function qh(e,t,r,n){return tn(e,t,3,Tr(e,t+1,n))}function Kh(e,t,r,n){return tn(e,t,5,Er(e,t+1,n))}function Gh(e,t,r,n){let i=Or(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer map lengths not supported`);return tn(e,t,9,i)}function Hh(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 va(e,t){dt(e,j.map.majorEncoded,t.value)}va.compareTokens=Ar.compareTokens;va.encodedSize=function(e){return dt.encodedSize(e.value)};function Wh(e,t,r,n){return new X(j.tag,r,1)}function Jh(e,t,r,n){return new X(j.tag,xr(e,t+1,n),2)}function Yh(e,t,r,n){return new X(j.tag,Tr(e,t+1,n),3)}function Xh(e,t,r,n){return new X(j.tag,Er(e,t+1,n),5)}function Zh(e,t,r,n){return new X(j.tag,Or(e,t+1,n),9)}function ba(e,t){dt(e,j.tag.majorEncoded,t.value)}ba.compareTokens=Ar.compareTokens;ba.encodedSize=function(e){return dt.encodedSize(e.value)};var Qh=20,ey=21,ty=22,ry=23;function ny(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${he} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new X(j.null,null,1):new X(j.undefined,void 0,1)}function iy(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${he} indefinite length items not allowed`);return new X(j.break,void 0,1)}function wa(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 X(j.float,e,t)}function oy(e,t,r,n){return wa(xa(e,t+1),3,n)}function ay(e,t,r,n){return wa(Ta(e,t+1),5,n)}function sy(e,t,r,n){return wa(gc(e,t+1),9,n)}function _a(e,t,r){let n=t.value;if(n===!1)e.push([j.float.majorEncoded|Qh]);else if(n===!0)e.push([j.float.majorEncoded|ey]);else if(n===null)e.push([j.float.majorEncoded|ty]);else if(n===void 0)e.push([j.float.majorEncoded|ry]);else{let i,a=!1;(!r||r.float64!==!0)&&(yc(n),i=xa(_t,1),n===i||Number.isNaN(n)?(_t[0]=249,e.push(_t.slice(0,3)),a=!0):(mc(n),i=Ta(_t,1),n===i&&(_t[0]=250,e.push(_t.slice(0,5)),a=!0))),a||(uy(n),i=gc(_t,1),_t[0]=251,e.push(_t.slice(0,9)))}}_a.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=xa(_t,1);if(r===n||Number.isNaN(r))return 3;if(mc(r),n=Ta(_t,1),r===n)return 5}return 9};var hc=new ArrayBuffer(9),ft=new DataView(hc,1),_t=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 xa(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 Ta(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 uy(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)}_a.compareTokens=Ar.compareTokens;function Ee(e,t,r){throw new Error(`${he} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Ki(e){return()=>{throw new Error(`${he} ${e}`)}}var oe=[];for(let e=0;e<=23;e++)oe[e]=Ee;oe[24]=mh;oe[25]=gh;oe[26]=vh;oe[27]=bh;oe[28]=Ee;oe[29]=Ee;oe[30]=Ee;oe[31]=Ee;for(let e=32;e<=55;e++)oe[e]=Ee;oe[56]=wh;oe[57]=_h;oe[58]=xh;oe[59]=Th;oe[60]=Ee;oe[61]=Ee;oe[62]=Ee;oe[63]=Ee;for(let e=64;e<=87;e++)oe[e]=Eh;oe[88]=Oh;oe[89]=Ah;oe[90]=Ih;oe[91]=Sh;oe[92]=Ee;oe[93]=Ee;oe[94]=Ee;oe[95]=Ki("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)oe[e]=kh;oe[120]=Uh;oe[121]=Nh;oe[122]=jh;oe[123]=Ph;oe[124]=Ee;oe[125]=Ee;oe[126]=Ee;oe[127]=Ki("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)oe[e]=Ch;oe[152]=Rh;oe[153]=Mh;oe[154]=Dh;oe[155]=Lh;oe[156]=Ee;oe[157]=Ee;oe[158]=Ee;oe[159]=Vh;for(let e=160;e<=183;e++)oe[e]=Fh;oe[184]=zh;oe[185]=qh;oe[186]=Kh;oe[187]=Gh;oe[188]=Ee;oe[189]=Ee;oe[190]=Ee;oe[191]=Hh;for(let e=192;e<=215;e++)oe[e]=Wh;oe[216]=Jh;oe[217]=Yh;oe[218]=Xh;oe[219]=Zh;oe[220]=Ee;oe[221]=Ee;oe[222]=Ee;oe[223]=Ee;for(let e=224;e<=243;e++)oe[e]=Ki("simple values are not supported");oe[244]=Ee;oe[245]=Ee;oe[246]=Ee;oe[247]=ny;oe[248]=Ki("simple values are not supported");oe[249]=oy;oe[250]=ay;oe[251]=sy;oe[252]=Ee;oe[253]=Ee;oe[254]=Ee;oe[255]=iy;var $t=[];for(let e=0;e<24;e++)$t[e]=new X(j.uint,e,1);for(let e=-1;e>=-24;e--)$t[31-e]=new X(j.negint,e,1);$t[64]=new X(j.bytes,new Uint8Array(0),1);$t[96]=new X(j.string,"",1);$t[128]=new X(j.array,0,1);$t[160]=new X(j.map,0,1);$t[244]=new X(j.false,!1,1);$t[245]=new X(j.true,!0,1);$t[246]=new X(j.null,null,1);function Ea(){let e=[];return e[j.uint.major]=Ar,e[j.negint.major]=ma,e[j.bytes.major]=qi,e[j.string.major]=Bh,e[j.array.major]=ga,e[j.map.major]=va,e[j.tag.major]=ba,e[j.float.major]=_a,e}var lO=Ea(),oa=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)}},Zt={null:new X(j.null,null),undefined:new X(j.undefined,void 0),true:new X(j.true,!0),false:new X(j.false,!1),emptyArray:new X(j.array,0),emptyMap:new X(j.map,0)},rr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new X(j.float,e):e>=0?new X(j.uint,e):new X(j.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new X(j.uint,e):new X(j.negint,e)},Uint8Array(e,t,r,n){return new X(j.bytes,e)},string(e,t,r,n){return new X(j.string,e)},boolean(e,t,r,n){return e?Zt.true:Zt.false},null(e,t,r,n){return Zt.null},undefined(e,t,r,n){return Zt.undefined},ArrayBuffer(e,t,r,n){return new X(j.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new X(j.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Zt.emptyArray,new X(j.break)]:Zt.emptyArray;n=tc.createCheck(n,e);let i=[],a=0;for(let o of e)i[a++]=Bi(o,r,n);return r.addBreakTokens?[new X(j.array,e.length),i,new X(j.break)]:[new X(j.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?[Zt.emptyMap,new X(j.break)]:Zt.emptyMap;n=tc.createCheck(n,e);let u=[],l=0;for(let c of a)u[l++]=[Bi(c,r,n),Bi(i?e.get(c):e[c],r,n)];return cy(u,r),r.addBreakTokens?[new X(j.map,o),u,new X(j.break)]:[new X(j.map,o),u]}};rr.Map=rr.Object;rr.Buffer=rr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))rr[`${e}Array`]=rr.DataView;function Bi(e,t={},r){let n=ah(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||rr[n];if(typeof i=="function"){let o=i(e,n,t,r);if(o!=null)return o}let a=rr[n];if(!a)throw new Error(`${_r} unsupported type: ${n}`);return a(e,n,t,r)}function cy(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 ly(e,t,r){let n=Bi(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 pa(u.chunks[0])}}return oa.reset(),bc(oa,n,t,r),oa.toBytes(!0)}var fy={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},dy=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=$t[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}},Rn=Symbol.for("DONE"),Gi=Symbol.for("BREAK");function py(e,t,r){let n=[];for(let i=0;i<e.value;i++){let a=Mn(t,r);if(a===Gi){if(e.value===1/0)break;throw new Error(`${he} got unexpected break to lengthed array`)}if(a===Rn)throw new Error(`${he} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=a}return n}function hy(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=Mn(t,r);if(u===Gi){if(e.value===1/0)break;throw new Error(`${he} got unexpected break to lengthed map`)}if(u===Rn)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=Mn(t,r);if(l===Rn)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 Mn(e,t){if(e.done())return Rn;let r=e.next();if(r.type===j.break)return Gi;if(r.type.terminal)return r.value;if(r.type===j.array)return py(r,e,t);if(r.type===j.map)return hy(r,e,t);if(r.type===j.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Mn(e,t);return t.tags[r.value](n)}throw new Error(`${he} tag not supported (${r.value})`)}throw new Error("unsupported")}function yy(e,t){if(!(e instanceof Uint8Array))throw new Error(`${he} data to decode must be a Uint8Array`);t=Object.assign({},fy,t);let r=t.tokenizer||new dy(e,t),n=Mn(r,t);if(n===Rn)throw new Error(`${he} did not find any content to decode`);if(n===Gi)throw new Error(`${he} got unexpected break`);return[n,e.subarray(r.pos())]}function Oa(e,t){let[r,n]=yy(e,t);if(n.length>0)throw new Error(`${he} too many terminals, data makes no sense`);return r}var my=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(t.type===j.array&&(t.elements++,t.elements!==1&&e.push([44])),t.type===j.map&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[j.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)}[j.negint.major](e,t){this[j.uint.major](e,t)}[j.bytes.major](e,t){throw new Error(`${_r} unsupported type: Uint8Array`)}[j.string.major](e,t){this.prefix(e);let r=lc(JSON.stringify(t.value));e.push(r.length>32?pa(r):r)}[j.array.major](e,t){this.prefix(e),this.inRecursive.push({type:j.array,elements:0}),e.push([91])}[j.map.major](e,t){this.prefix(e),this.inRecursive.push({type:j.map,elements:0}),e.push([123])}[j.tag.major](e,t){}[j.float.major](e,t){if(t.type.name==="break"){let a=this.inRecursive.pop();if(a){if(a.type===j.array)e.push([93]);else if(a.type===j.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 gy(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!==j.string||n.type!==j.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 vy={addBreakTokens:!0,mapSorter:gy};function by(e,t){return t=Object.assign({},vy,t),ly(e,new my,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 X(j.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 X(j.float,a,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(a)?new X(a>=0?j.uint:j.negint,a,this._pos-e):new X(a>=0?j.uint:j.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 X(j.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,y;switch(o){case 1:i<128&&(a=i);break;case 2:u=this.data[this._pos+1],(u&192)===128&&(y=(i&31)<<6|u&63,y>127&&(a=y));break;case 3:u=this.data[this._pos+1],l=this.data[this._pos+2],(u&192)===128&&(l&192)===128&&(y=(i&15)<<12|(u&63)<<6|l&63,y>2047&&(y<55296||y>57343)&&(a=y));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&&(y=(i&15)<<18|(u&63)<<12|(l&63)<<6|c&63,y>65535&&y<1114112&&(a=y))}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 X(j.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 X(j.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new X(j.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new X(j.null,null,4);case 102:return this.expect([102,97,108,115,101]),new X(j.false,!1,5);case 116:return this.expect([116,114,117,101]),new X(j.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 X(j.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 X(j.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 X(j.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 X(j.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 wy(e,t){return t=Object.assign({tokenizer:new wc(e,t)},t),Oa(e,t)}var fO=new Uint8Array(0),_y=(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},Aa=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};function xy(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var 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),y=Math.log(256)/Math.log(u);function g(F){if(F instanceof Uint8Array||(ArrayBuffer.isView(F)?F=new Uint8Array(F.buffer,F.byteOffset,F.byteLength):Array.isArray(F)&&(F=Uint8Array.from(F))),!(F instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(F.length===0)return"";for(var Q=0,ae=0,B=0,V=F.length;B!==V&&F[B]===0;)B++,Q++;for(var H=(V-B)*y+1>>>0,se=new Uint8Array(H);B!==V;){for(var z=F[B],ue=0,q=H-1;(z!==0||ue<ae)&&q!==-1;q--,ue++)z+=256*se[q]>>>0,se[q]=z%u>>>0,z=z/u>>>0;if(z!==0)throw new Error("Non-zero carry");ae=ue,B++}for(var pe=H-ae;pe!==H&&se[pe]===0;)pe++;for(var R=l.repeat(Q);pe<H;++pe)R+=e.charAt(se[pe]);return R}function M(F){if(typeof F!="string")throw new TypeError("Expected String");if(F.length===0)return new Uint8Array;var Q=0;if(F[Q]!==" "){for(var ae=0,B=0;F[Q]===l;)ae++,Q++;for(var V=(F.length-Q)*c+1>>>0,H=new Uint8Array(V);F[Q];){var se=r[F.charCodeAt(Q)];if(se===255)return;for(var z=0,ue=V-1;(se!==0||z<B)&&ue!==-1;ue--,z++)se+=u*H[ue]>>>0,H[ue]=se%256>>>0,se=se/256>>>0;if(se!==0)throw new Error("Non-zero carry");B=z,Q++}if(F[Q]!==" "){for(var q=V-B;q!==V&&H[q]===0;)q++;for(var pe=new Uint8Array(ae+(V-q)),R=ae;q!==V;)pe[R++]=H[q++];return pe}}}function k(F){var Q=M(F);if(Q)return Q;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:M,decode:k}}var Ty=xy,Ey=Ty,Oy=Ey,Ay=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")}},Iy=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)}},Sy=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 Sy({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}}),$y=class{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new Ay(e,t,r),this.decoder=new Iy(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},xc=({name:e,prefix:t,encode:r,decode:n})=>new $y(e,t,r,n),Tc=({prefix:e,name:t,alphabet:r})=>{let{encode:n,decode:i}=Oy(r,t);return xc({prefix:e,name:t,encode:n,decode:a=>Aa(i(a))})},ky=(e,t,r,n)=>{let i={};for(let y=0;y<t.length;++y)i[t[y]]=y;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 y=0;y<a;++y){let g=i[e[y]];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},Uy=(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})=>xc({prefix:t,name:e,encode(i){return Uy(i,n,r)},decode(i){return ky(i,n,r,e)}}),Ci=ot({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),dO=ot({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),pO=ot({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),hO=ot({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),yO=ot({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),mO=ot({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),gO=ot({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),vO=ot({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),bO=ot({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),tr=Tc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),wO=Tc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Ec={};cc(Ec,{Digest:()=>Hi,create:()=>Fi,decode:()=>zn,equals:()=>Ac});var Ny=Oc,rc=128,jy=127,Py=~jy,By=Math.pow(2,31);function Oc(e,t,r){t=t||[],r=r||0;for(var n=r;e>=By;)t[r++]=e&255|rc,e/=128;for(;e&Py;)t[r++]=e&255|rc,e>>>=7;return t[r]=e|0,Oc.bytes=r-n+1,t}var Cy=ua,Ry=128,nc=127;function ua(e,n){var r=0,n=n||0,i=0,a=n,o,u=e.length;do{if(a>=u)throw ua.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>=Ry);return ua.bytes=a-n,r}var My=Math.pow(2,7),Dy=Math.pow(2,14),Ly=Math.pow(2,21),Vy=Math.pow(2,28),Fy=Math.pow(2,35),zy=Math.pow(2,42),qy=Math.pow(2,49),Ky=Math.pow(2,56),Gy=Math.pow(2,63),Hy=function(e){return e<My?1:e<Dy?2:e<Ly?3:e<Vy?4:e<Fy?5:e<zy?6:e<qy?7:e<Ky?8:e<Gy?9:10},Wy={encode:Ny,decode:Cy,encodingLength:Hy},Jy=Wy,Di=Jy,ca=(e,t=0)=>[Di.decode(e,t),Di.decode.bytes],Li=(e,t,r=0)=>(Di.encode(e,t,r),t),Vi=e=>Di.encodingLength(e),Fi=(e,t)=>{let r=t.byteLength,n=Vi(e),i=n+Vi(r),a=new Uint8Array(i+r);return Li(e,a,0),Li(r,a,n),a.set(t,i),new Hi(e,r,t,a)},zn=e=>{let t=Aa(e),[r,n]=ca(t),[i,a]=ca(t.subarray(n)),o=t.subarray(n+a);if(o.byteLength!==i)throw new Error("Incorrect length");return new Hi(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&&_y(e.bytes,r.bytes)}},Hi=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 Xy(r,la(e),t||tr.encoder);default:return Zy(r,la(e),t||Ci.encoder)}},oc=new WeakMap,la=e=>{let t=oc.get(e);if(t==null){let r=new Map;return oc.set(e,r),r}return t},Rt=class Ke{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!==Bn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Qy)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Ke.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=Fi(t,r);return Ke.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 Ke.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 Ke)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:a,bytes:o}=r;return new Ke(n,i,a,o||ac(n,i,a.bytes))}else if(r[em]===!0){let{version:n,multihash:i,code:a}=r,o=zn(i);return Ke.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!==Bn)throw new Error(`Version 0 CID must use dag-pb (code: ${Bn}) block encoding`);return new Ke(t,r,n,n.bytes)}case 1:{let i=ac(t,r,n.bytes);return new Ke(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return Ke.create(0,Bn,t)}static createV1(t,r){return Ke.create(1,t,r)}static decode(t){let[r,n]=Ke.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=Ke.inspectBytes(t),n=r.size-r.multihashSize,i=Aa(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 Hi(r.multihashCode,r.digestSize,a,i);return[r.version===0?Ke.createV0(o):Ke.createV1(r.codec,o),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[g,M]=ca(t.subarray(r));return r+=M,g},i=n(),a=Bn;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,y=c-o;return{version:i,codec:a,multihashCode:u,digestSize:l,multihashSize:y,size:c}}static parse(t,r){let[n,i]=Yy(t,r),a=Ke.decode(i);if(a.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return la(a).set(n,t),a}},Yy=(e,t)=>{switch(e[0]){case"Q":{let r=t||tr;return[tr.prefix,r.decode(`${tr.prefix}${e}`)]}case tr.prefix:{let r=t||tr;return[tr.prefix,r.decode(e)]}case Ci.prefix:{let r=t||Ci;return[Ci.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)]}}},Xy=(e,t,r)=>{let{prefix:n}=r;if(n!==tr.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},Zy=(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},Bn=112,Qy=18,ac=(e,t,r)=>{let n=Vi(e),i=n+Vi(t),a=new Uint8Array(i+r.byteLength);return Li(e,a,0),Li(t,a,n),a.set(r,i),a},em=Symbol.for("@ipld/js-cid/CID"),Ic=({name:e,code:t,encode:r})=>new tm(e,t,r),tm=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?Fi(this.code,t):t.then(r=>Fi(this.code,r))}else throw Error("Unknown type, must be binary type")}},Sc=ot({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),_O=ot({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),xO=ot({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),TO=ot({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function rm(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Rt.asCID(e);if(!t)return null;let r=t.toString();return[new X(j.map,1/0,1),new X(j.string,"/",1),new X(j.string,r,r.length),new X(j.break,void 0,1)]}function zi(e){let t=Sc.encode(e).slice(1);return[new X(j.map,1/0,1),new X(j.string,"/",1),new X(j.map,1/0,1),new X(j.string,"bytes",5),new X(j.string,t,t.length),new X(j.break,void 0,1),new X(j.break,void 0,1)]}function wt(e){return zi(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function nm(e){return zi(new Uint8Array(e))}function im(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function om(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 am={typeEncoders:{Object:rm,Buffer:zi,Uint8Array:zi,Int8Array:wt,Uint16Array:wt,Int16Array:wt,Uint32Array:wt,Int32Array:wt,Float32Array:wt,Float64Array:wt,Uint8ClampedArray:wt,BigInt64Array:wt,BigUint64Array:wt,DataView:wt,ArrayBuffer:nm,undefined:im,number:om}},sm=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===j.map){let t=this._next();if(t.type===j.string&&t.value==="/"){let r=this._next();if(r.type===j.string){if(this._next().type!==j.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new X(j.tag,42,0)}if(r.type===j.map){let n=this._next();if(n.type===j.string&&n.value==="bytes"){let i=this._next();if(i.type===j.string){for(let o=0;o<2;o++)if(this._next().type!==j.break)throw new Error("Invalid encoded Bytes form");let a=Sc.decode(`m${i.value}`);return new X(j.bytes,a,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(n)}this.tokenBuffer.push(r)}this.tokenBuffer.push(t)}return e}},fa={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};fa.tags[42]=Rt.parse;var um="dag-json",$c=297,Ia=e=>by(e,am),Wi=e=>{let t=Object.assign(fa,{tokenizer:new sm(e,fa)});return wy(e,t)},sc=e=>cm.decode(Ia(e)),cm=new TextDecoder,lm=e=>Wi(fm.encode(e)),fm=new TextEncoder;function dm(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 pm(e,t){dm(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var hm=e=>e instanceof Uint8Array,aa=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),St=(e,t)=>e<<32-t|e>>>t,ym=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!ym)throw new Error("Non little-endian hardware is not supported");function mm(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=mm(e)),!hm(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}var gm=class{clone(){return this._cloneInto()}},EO={}.toString;function vm(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 bm(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 wm=class extends gm{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=aa(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=aa(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),pm(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 y=a;y<n;y++)t[y]=0;bm(r,n-8,BigInt(this.length*8),i),this.process(r,0);let o=aa(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 y=0;y<l;y++)o.setUint32(4*y,c[y],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}},_m=(e,t,r)=>e&t^~e&r,xm=(e,t,r)=>e&t^e&r^t&r,Tm=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]),er=new Uint32Array(64),Em=class extends wm{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 y=0;y<16;y++,t+=4)er[y]=e.getUint32(t,!1);for(let y=16;y<64;y++){let g=er[y-15],M=er[y-2],k=St(g,7)^St(g,18)^g>>>3,F=St(M,17)^St(M,19)^M>>>10;er[y]=F+er[y-7]+k+er[y-16]|0}let{A:r,B:n,C:i,D:a,E:o,F:u,G:l,H:c}=this;for(let y=0;y<64;y++){let g=St(o,6)^St(o,11)^St(o,25),M=c+g+_m(o,u,l)+Tm[y]+er[y]|0,k=(St(r,2)^St(r,13)^St(r,22))+xm(r,n,i)|0;c=l,l=u,u=o,o=a+M|0,a=i,i=n,n=r,r=M+k|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(){er.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Om=vm(()=>new Em),Am=Object.create,Sa=Object.defineProperty,Im=Object.getOwnPropertyDescriptor,Uc=Object.getOwnPropertyNames,Sm=Object.getPrototypeOf,$m=Object.prototype.hasOwnProperty,km=(e,t,r)=>t in e?Sa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Nc=(e,t)=>function(){return t||(0,e[Uc(e)[0]])((t={exports:{}}).exports,t),t.exports},Um=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Uc(t))!$m.call(e,i)&&i!==r&&Sa(e,i,{get:()=>t[i],enumerable:!(n=Im(t,i))||n.enumerable});return e},jc=(e,t,r)=>(r=e!=null?Am(Sm(e)):{},Um(t||!e||!e.__esModule?Sa(r,"default",{value:e,enumerable:!0}):r,e)),ir=(e,t,r)=>(km(e,typeof t!="symbol"?t+"":t,r),r),Nm=Nc({"../../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}}),jm=Nc({"../../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,y){var g={key:c,value:l[c]},M={key:y,value:l[y]};return u(g,M)}}}(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,y;if(Array.isArray(l)){for(y="[",c=0;c<l.length;c++)c&&(y+=","),y+=u(l[c])||"null";return y+"]"}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,M=Object.keys(l).sort(a&&a(l));for(y="",c=0;c<M.length;c++){var k=M[c],F=u(l[k]);F&&(y&&(y+=","),y+=JSON.stringify(k)+":"+F)}return o.splice(g,1),"{"+y+"}"}}(r)}}}),Dn=jc(Nm(),1),Pm=jc(jm(),1),Pc=!1,Bc=!1;Dn.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(Pc=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(Bc=process?.env?.LOGGER_PERF_PREFIX==="true"));var Bm=Object.freeze({prefix:void 0,time:Pc,delta:Bc,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0}),sa=[],Cc=class{sinceFirst=0;sinceLast=0;time=!1;delta=!1;constructor(e,t,r,n){Object.assign(this,{sinceFirst:e,sinceLast:t,time:r,delta:n})}toString(){let e=this.sinceFirst*.001,t=e.toFixed(e<5?2:1),r=this.sinceLast<1e3?`${this.sinceLast.toFixed(0)}`.padStart(5," "):`${`${(this.sinceLast*.001).toFixed(this.sinceLast<1e4?1:0)}`.padStart(4," ")}s`;return`[${[this.time?t:null,this.delta?r:null].join(",")}]`}},Rc=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Cn=!1,Xe=class{static setup(e=Xe.INFO,t={}){t=Object.assign({},Bm,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 M=g[g.length-1];return M===n?M():(i(...g.slice(0,-1)),(async()=>{try{let k=M();return k instanceof Promise?await k:k}finally{console.groupEnd()}})())}let y=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:c,force:l});return u?y:Object.assign(n.bind({}),{isEnabled:u,isDisabled:!u,group:c,force:y})},o=a(e>=Xe.ERROR,this.wrapLog(console.error,t));return{ERROR:(...u)=>(o(...u),new Error((0,Pm.default)(u))),WARN:a(e>=Xe.WARN,this.wrapLog(console.warn,t)),LOG:a(e>=Xe.INFO,this.wrapLog(console.log,t)),DEBUG:a(e>=Xe.DEBUG,this.wrapLog(console.log,{...t,dim:t.dimDebugOnServer})),VERBOSE:a(e>=Xe.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")?["",Xe.timeStr(!!t.time,!!t.delta)]:[];r.push(...n)}return t.prefix&&(Cn?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();Xe.firstLog||(Xe.firstLog=n,Xe.lastLog=n);let i=new Cc(n-Xe.firstLog,n-Xe.lastLog,e,t);return Xe.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}}}},Ae=Xe;ir(Ae,"ERROR",2);ir(Ae,"WARN",4);ir(Ae,"INFO",6);ir(Ae,"LOG",6);ir(Ae,"DEBUG",8);ir(Ae,"VERBOSE",10);ir(Ae,"firstLog",0);ir(Ae,"lastLog",0);Dn.isBrowser?(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(sa&&sa.length){for(let t of sa)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof Cc))return null;Cn||(Cn=!0);let t=Ae.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof Rc?(Cn||(Cn=!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)),Cm=Ic({name:"sha2-256",code:18,encode:Mc("SHA-256")}),OO=Ic({name:"sha2-512",code:19,encode:Mc("SHA-512")}),{WARN:Rm,LOG:AO,DEBUG:Mm,VERBOSE:Dc,ERROR:IO}=Ae.setup(Ae.INFO);function Lc(e,t=["cid"]){let r={};for(let[n,i]of Object.entries(e))i===void 0&&(Rm(`log.${n} is undefined, which is not allowed - encoding as null`,e),i=null),t.includes(n)?Dc("excluding app log",{key:n,val:i}):r[n]=i&&n==="pv"?Rt.parse(i):i;return r}function $a(e){return ka(Vc(e).bytes)}function Vc(e){return Fc(Lc(e))}function ka(e){let t=Om(e),r=Ec.create(Cm.code,t),n=Rt.create(1,$c,r);return Dc("[getCidSync]",{bytes:e,hash:t,digest:r,cid:n}),n}function Fc(e){Mm("[encodeBlock]",e);let t=Ia(e);return{bytes:t,cid:ka(t)}}var Dm=Le((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 H=B[V],se=V;for(;se!==0&&B[se-1]>H;)B[se]=B[se-1],se--;B[se]=H}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,H){B.length<H&&(H=B.length);let se=V===","?"":" ",z=`"0":${se}${B[0]}`;for(let ue=1;ue<H;ue++)z+=`${V}"${ue}":${se}${B[ue]}`;return z}function y(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 H;if(r.call(B,V)&&(H=B[V],typeof H!="boolean"))throw new TypeError(`The "${V}" argument must be of type boolean`);return H===void 0?!0:H}function M(B,V){let H;if(r.call(B,V)){if(H=B[V],typeof H!="number")throw new TypeError(`The "${V}" argument must be of type number`);if(!Number.isInteger(H))throw new TypeError(`The "${V}" argument must be an integer`);if(H<1)throw new RangeError(`The "${V}" argument must be >= 1`)}return H===void 0?1/0:H}function k(B){return B===1?"1 item":`${B} items`}function F(B){let V=new Set;for(let H of B)(typeof H=="string"||typeof H=="number")&&V.add(String(H));return V}function Q(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 H=>{let se=`Object can not safely be stringified. Received type ${typeof H}`;throw typeof H!="function"&&(se+=` (${H.toString()})`),new Error(se)}}}function ae(B){B={...B};let V=Q(B);V&&(B.bigint===void 0&&(B.bigint=!1),"circularValue"in B||(B.circularValue=Error));let H=y(B),se=g(B,"bigint"),z=g(B,"deterministic"),ue=M(B,"maximumDepth"),q=M(B,"maximumBreadth");function pe(Y,E,K,te,G,W){let fe=E[Y];switch(typeof fe=="object"&&fe!==null&&typeof fe.toJSON=="function"&&(fe=fe.toJSON(Y)),fe=te.call(E,Y,fe),typeof fe){case"string":return a(fe);case"object":{if(fe===null)return"null";if(K.indexOf(fe)!==-1)return H;let f="",_=",",O=W;if(Array.isArray(fe)){if(fe.length===0)return"[]";if(ue<K.length+1)return'"[Array]"';K.push(fe),G!==""&&(W+=G,f+=`
|
|
3
|
+
${W}`,_=`,
|
|
4
|
+
${W}`);let w=Math.min(fe.length,q),s=0;for(;s<w-1;s++){let b=pe(String(s),fe,K,te,G,W);f+=b!==void 0?b:"null",f+=_}let x=pe(String(s),fe,K,te,G,W);if(f+=x!==void 0?x:"null",fe.length-1>q){let b=fe.length-q-1;f+=`${_}"... ${k(b)} not stringified"`}return G!==""&&(f+=`
|
|
5
|
+
${O}`),K.pop(),`[${f}]`}let U=Object.keys(fe),S=U.length;if(S===0)return"{}";if(ue<K.length+1)return'"[Object]"';let $="",h="";G!==""&&(W+=G,_=`,
|
|
6
|
+
${W}`,$=" ");let A=Math.min(S,q);z&&!l(fe)&&(U=o(U)),K.push(fe);for(let w=0;w<A;w++){let s=U[w],x=pe(s,fe,K,te,G,W);x!==void 0&&(f+=`${h}${a(s)}:${$}${x}`,h=_)}if(S>q){let w=S-q;f+=`${h}"...":${$}"${k(w)} not stringified"`,h=_}return G!==""&&h.length>1&&(f=`
|
|
7
|
+
${W}${f}
|
|
8
|
+
${O}`),K.pop(),`{${f}}`}case"number":return isFinite(fe)?String(fe):V?V(fe):"null";case"boolean":return fe===!0?"true":"false";case"undefined":return;case"bigint":if(se)return String(fe);default:return V?V(fe):void 0}}function R(Y,E,K,te,G,W){switch(typeof E=="object"&&E!==null&&typeof E.toJSON=="function"&&(E=E.toJSON(Y)),typeof E){case"string":return a(E);case"object":{if(E===null)return"null";if(K.indexOf(E)!==-1)return H;let fe=W,f="",_=",";if(Array.isArray(E)){if(E.length===0)return"[]";if(ue<K.length+1)return'"[Array]"';K.push(E),G!==""&&(W+=G,f+=`
|
|
9
|
+
${W}`,_=`,
|
|
10
|
+
${W}`);let S=Math.min(E.length,q),$=0;for(;$<S-1;$++){let A=R(String($),E[$],K,te,G,W);f+=A!==void 0?A:"null",f+=_}let h=R(String($),E[$],K,te,G,W);if(f+=h!==void 0?h:"null",E.length-1>q){let A=E.length-q-1;f+=`${_}"... ${k(A)} not stringified"`}return G!==""&&(f+=`
|
|
11
|
+
${fe}`),K.pop(),`[${f}]`}K.push(E);let O="";G!==""&&(W+=G,_=`,
|
|
12
|
+
${W}`,O=" ");let U="";for(let S of te){let $=R(S,E[S],K,te,G,W);$!==void 0&&(f+=`${U}${a(S)}:${O}${$}`,U=_)}return G!==""&&U.length>1&&(f=`
|
|
13
|
+
${W}${f}
|
|
14
|
+
${fe}`),K.pop(),`{${f}}`}case"number":return isFinite(E)?String(E):V?V(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(se)return String(E);default:return V?V(E):void 0}}function P(Y,E,K,te,G){switch(typeof E){case"string":return a(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(Y),typeof E!="object")return P(Y,E,K,te,G);if(E===null)return"null"}if(K.indexOf(E)!==-1)return H;let W=G;if(Array.isArray(E)){if(E.length===0)return"[]";if(ue<K.length+1)return'"[Array]"';K.push(E),G+=te;let $=`
|
|
15
|
+
${G}`,h=`,
|
|
16
|
+
${G}`,A=Math.min(E.length,q),w=0;for(;w<A-1;w++){let x=P(String(w),E[w],K,te,G);$+=x!==void 0?x:"null",$+=h}let s=P(String(w),E[w],K,te,G);if($+=s!==void 0?s:"null",E.length-1>q){let x=E.length-q-1;$+=`${h}"... ${k(x)} not stringified"`}return $+=`
|
|
17
|
+
${W}`,K.pop(),`[${$}]`}let fe=Object.keys(E),f=fe.length;if(f===0)return"{}";if(ue<K.length+1)return'"[Object]"';G+=te;let _=`,
|
|
18
|
+
${G}`,O="",U="",S=Math.min(f,q);l(E)&&(O+=c(E,_,q),fe=fe.slice(E.length),S-=E.length,U=_),z&&(fe=o(fe)),K.push(E);for(let $=0;$<S;$++){let h=fe[$],A=P(h,E[h],K,te,G);A!==void 0&&(O+=`${U}${a(h)}: ${A}`,U=_)}if(f>q){let $=f-q;O+=`${U}"...": "${k($)} not stringified"`,U=_}return U!==""&&(O=`
|
|
19
|
+
${G}${O}
|
|
20
|
+
${W}`),K.pop(),`{${O}}`}case"number":return isFinite(E)?String(E):V?V(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(se)return String(E);default:return V?V(E):void 0}}function C(Y,E,K){switch(typeof E){case"string":return a(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(Y),typeof E!="object")return C(Y,E,K);if(E===null)return"null"}if(K.indexOf(E)!==-1)return H;let te="";if(Array.isArray(E)){if(E.length===0)return"[]";if(ue<K.length+1)return'"[Array]"';K.push(E);let _=Math.min(E.length,q),O=0;for(;O<_-1;O++){let S=C(String(O),E[O],K);te+=S!==void 0?S:"null",te+=","}let U=C(String(O),E[O],K);if(te+=U!==void 0?U:"null",E.length-1>q){let S=E.length-q-1;te+=`,"... ${k(S)} not stringified"`}return K.pop(),`[${te}]`}let G=Object.keys(E),W=G.length;if(W===0)return"{}";if(ue<K.length+1)return'"[Object]"';let fe="",f=Math.min(W,q);l(E)&&(te+=c(E,",",q),G=G.slice(E.length),f-=E.length,fe=","),z&&(G=o(G)),K.push(E);for(let _=0;_<f;_++){let O=G[_],U=C(O,E[O],K);U!==void 0&&(te+=`${fe}${a(O)}:${U}`,fe=",")}if(W>q){let _=W-q;te+=`${fe}"...":"${k(_)} not stringified"`}return K.pop(),`{${te}}`}case"number":return isFinite(E)?String(E):V?V(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(se)return String(E);default:return V?V(E):void 0}}function Z(Y,E,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)),E!=null){if(typeof E=="function")return pe("",{"":Y},[],E,te,"");if(Array.isArray(E))return R("",Y,[],F(E),te,"")}if(te.length!==0)return P("",Y,[],te,"")}return C("",Y,[])}return Z}}),Cr=Le(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 O(){return new Map(_)}f.Entries=O;function U(){return _.clear()}f.Clear=U;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 O(){return new Map(_)}f.Entries=O;function U(){return _.clear()}f.Clear=U;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 O(b){return typeof b=="bigint"}f.IsBigInt=O;function U(b){return typeof b=="boolean"}f.IsBoolean=U;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 x(b){return b===void 0}f.IsUndefined=x})(i||(e.ValueGuard=i={}));var a=class extends r{};e.TypeGuardUnknownTypeError=a;var o;(function(f){function _(m){try{return new RegExp(m),!0}catch{return!1}}function O(m){if(!i.IsString(m))return!1;for(let $e=0;$e<m.length;$e++){let ut=m.charCodeAt($e);if(ut>=7&&ut<=13||ut===27||ut===127)return!1}return!0}function U(m){return h(m)||De(m)}function S(m){return i.IsUndefined(m)||i.IsBigInt(m)}function $(m){return i.IsUndefined(m)||i.IsNumber(m)}function h(m){return i.IsUndefined(m)||i.IsBoolean(m)}function A(m){return i.IsUndefined(m)||i.IsString(m)}function w(m){return i.IsUndefined(m)||i.IsString(m)&&O(m)&&_(m)}function s(m){return i.IsUndefined(m)||i.IsString(m)&&O(m)}function x(m){return i.IsUndefined(m)||De(m)}function b(m){return be(m,"Any")&&A(m.$id)}f.TAny=b;function v(m){return be(m,"Array")&&m.type==="array"&&A(m.$id)&&De(m.items)&&$(m.minItems)&&$(m.maxItems)&&h(m.uniqueItems)&&x(m.contains)&&$(m.minContains)&&$(m.maxContains)}f.TArray=v;function N(m){return be(m,"AsyncIterator")&&m.type==="AsyncIterator"&&A(m.$id)&&De(m.items)}f.TAsyncIterator=N;function D(m){return be(m,"BigInt")&&m.type==="bigint"&&A(m.$id)&&S(m.exclusiveMaximum)&&S(m.exclusiveMinimum)&&S(m.maximum)&&S(m.minimum)&&S(m.multipleOf)}f.TBigInt=D;function J(m){return be(m,"Boolean")&&m.type==="boolean"&&A(m.$id)}f.TBoolean=J;function ee(m){return be(m,"Constructor")&&m.type==="Constructor"&&A(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every($e=>De($e))&&De(m.returns)}f.TConstructor=ee;function ye(m){return be(m,"Date")&&m.type==="Date"&&A(m.$id)&&$(m.exclusiveMaximumTimestamp)&&$(m.exclusiveMinimumTimestamp)&&$(m.maximumTimestamp)&&$(m.minimumTimestamp)&&$(m.multipleOfTimestamp)}f.TDate=ye;function we(m){return be(m,"Function")&&m.type==="Function"&&A(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every($e=>De($e))&&De(m.returns)}f.TFunction=we;function Ne(m){return be(m,"Integer")&&m.type==="integer"&&A(m.$id)&&$(m.exclusiveMaximum)&&$(m.exclusiveMinimum)&&$(m.maximum)&&$(m.minimum)&&$(m.multipleOf)}f.TInteger=Ne;function Be(m){return be(m,"Intersect")&&!(i.IsString(m.type)&&m.type!=="object")&&i.IsArray(m.allOf)&&m.allOf.every($e=>De($e)&&!En($e))&&A(m.type)&&(h(m.unevaluatedProperties)||x(m.unevaluatedProperties))&&A(m.$id)}f.TIntersect=Be;function hr(m){return be(m,"Iterator")&&m.type==="Iterator"&&A(m.$id)&&De(m.items)}f.TIterator=hr;function be(m,$e){return qt(m)&&m[e.Kind]===$e}f.TKindOf=be;function qt(m){return i.IsObject(m)&&e.Kind in m&&i.IsString(m[e.Kind])}f.TKind=qt;function yr(m){return I(m)&&i.IsString(m.const)}f.TLiteralString=yr;function T(m){return I(m)&&i.IsNumber(m.const)}f.TLiteralNumber=T;function le(m){return I(m)&&i.IsBoolean(m.const)}f.TLiteralBoolean=le;function I(m){return be(m,"Literal")&&A(m.$id)&&(i.IsBoolean(m.const)||i.IsNumber(m.const)||i.IsString(m.const))}f.TLiteral=I;function ge(m){return be(m,"Never")&&i.IsObject(m.not)&&Object.getOwnPropertyNames(m.not).length===0}f.TNever=ge;function ne(m){return be(m,"Not")&&De(m.not)}f.TNot=ne;function de(m){return be(m,"Null")&&m.type==="null"&&A(m.$id)}f.TNull=de;function Ie(m){return be(m,"Number")&&m.type==="number"&&A(m.$id)&&$(m.exclusiveMaximum)&&$(m.exclusiveMinimum)&&$(m.maximum)&&$(m.minimum)&&$(m.multipleOf)}f.TNumber=Ie;function Ce(m){return be(m,"Object")&&m.type==="object"&&A(m.$id)&&i.IsObject(m.properties)&&U(m.additionalProperties)&&$(m.minProperties)&&$(m.maxProperties)&&Object.entries(m.properties).every(([$e,ut])=>O($e)&&De(ut))}f.TObject=Ce;function We(m){return be(m,"Promise")&&m.type==="Promise"&&A(m.$id)&&De(m.item)}f.TPromise=We;function qe(m){return be(m,"Record")&&m.type==="object"&&A(m.$id)&&U(m.additionalProperties)&&i.IsObject(m.patternProperties)&&($e=>{let ut=Object.getOwnPropertyNames($e.patternProperties);return ut.length===1&&_(ut[0])&&i.IsObject($e.patternProperties)&&De($e.patternProperties[ut[0]])})(m)}f.TRecord=qe;function Ye(m){return i.IsObject(m)&&e.Hint in m&&m[e.Hint]==="Recursive"}f.TRecursive=Ye;function Kt(m){return be(m,"Ref")&&A(m.$id)&&i.IsString(m.$ref)}f.TRef=Kt;function zr(m){return be(m,"String")&&m.type==="string"&&A(m.$id)&&$(m.minLength)&&$(m.maxLength)&&w(m.pattern)&&s(m.format)}f.TString=zr;function qr(m){return be(m,"Symbol")&&m.type==="symbol"&&A(m.$id)}f.TSymbol=qr;function mr(m){return be(m,"TemplateLiteral")&&m.type==="string"&&i.IsString(m.pattern)&&m.pattern[0]==="^"&&m.pattern[m.pattern.length-1]==="$"}f.TTemplateLiteral=mr;function mi(m){return be(m,"This")&&A(m.$id)&&i.IsString(m.$ref)}f.TThis=mi;function En(m){return i.IsObject(m)&&e.Transform in m}f.TTransform=En;function Me(m){return be(m,"Tuple")&&m.type==="array"&&A(m.$id)&&i.IsNumber(m.minItems)&&i.IsNumber(m.maxItems)&&m.minItems===m.maxItems&&(i.IsUndefined(m.items)&&i.IsUndefined(m.additionalItems)&&m.minItems===0||i.IsArray(m.items)&&m.items.every($e=>De($e)))}f.TTuple=Me;function gi(m){return be(m,"Undefined")&&m.type==="undefined"&&A(m.$id)}f.TUndefined=gi;function Bo(m){return gr(m)&&m.anyOf.every($e=>yr($e)||T($e))}f.TUnionLiteral=Bo;function gr(m){return be(m,"Union")&&A(m.$id)&&i.IsObject(m)&&i.IsArray(m.anyOf)&&m.anyOf.every($e=>De($e))}f.TUnion=gr;function Kr(m){return be(m,"Uint8Array")&&m.type==="Uint8Array"&&A(m.$id)&&$(m.minByteLength)&&$(m.maxByteLength)}f.TUint8Array=Kr;function Je(m){return be(m,"Unknown")&&A(m.$id)}f.TUnknown=Je;function vi(m){return be(m,"Unsafe")}f.TUnsafe=vi;function On(m){return be(m,"Void")&&m.type==="void"&&A(m.$id)}f.TVoid=On;function Co(m){return i.IsObject(m)&&m[e.Readonly]==="Readonly"}f.TReadonly=Co;function Ro(m){return i.IsObject(m)&&m[e.Optional]==="Optional"}f.TOptional=Ro;function De(m){return i.IsObject(m)&&(b(m)||v(m)||J(m)||D(m)||N(m)||ee(m)||ye(m)||we(m)||Ne(m)||Be(m)||hr(m)||I(m)||ge(m)||ne(m)||de(m)||Ie(m)||Ce(m)||We(m)||qe(m)||Kt(m)||zr(m)||qr(m)||mr(m)||mi(m)||Me(m)||gi(m)||gr(m)||Kr(m)||Je(m)||vi(m)||On(m)||qt(m)&&t.Has(m[e.Kind]))}f.TSchema=De})(o||(e.TypeGuard=o={}));var u;(function(f){function _(O){return O[e.Kind]==="Intersect"?O.allOf.every(U=>_(U)):O[e.Kind]==="Union"?O.anyOf.some(U=>_(U)):O[e.Kind]==="Undefined"?!0:O[e.Kind]==="Not"?!_(O.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 y;(function(f){function _(p){return p===c.False?p:c.True}function O(p){throw new l(p)}function U(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)?Mo(p,d):o.TUnknown(d)?Us(p,d):o.TAny(d)?$(p,d):O("StructuralRight")}function $(p,d){return c.True}function h(p,d){return o.TIntersect(d)?we(p,d):o.TUnion(d)&&d.anyOf.some(xe=>o.TAny(xe)||o.TUnknown(xe))?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:U(d)?S(p,d):o.TArray(d)?_(ke(p.items,d.items)):c.False}function s(p,d){return U(d)?S(p,d):o.TAsyncIterator(d)?_(ke(p.items,d.items)):c.False}function x(p,d){return U(d)?S(p,d):o.TObject(d)?Me(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 U(d)?S(p,d):o.TObject(d)?Me(p,d):o.TRecord(d)?Je(p,d):o.TBoolean(d)?c.True:c.False}function N(p,d){return U(d)?S(p,d):o.TObject(d)?Me(p,d):o.TConstructor(d)?p.parameters.length>d.parameters.length?c.False:p.parameters.every((xe,Bt)=>_(ke(d.parameters[Bt],xe))===c.True)?_(ke(p.returns,d.returns)):c.False:c.False}function D(p,d){return U(d)?S(p,d):o.TObject(d)?Me(p,d):o.TRecord(d)?Je(p,d):o.TDate(d)?c.True:c.False}function J(p,d){return U(d)?S(p,d):o.TObject(d)?Me(p,d):o.TFunction(d)?p.parameters.length>d.parameters.length?c.False:p.parameters.every((xe,Bt)=>_(ke(d.parameters[Bt],xe))===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:U(d)?S(p,d):o.TObject(d)?Me(p,d):o.TRecord(d)?Je(p,d):c.False}function we(p,d){return d.allOf.every(xe=>ke(p,xe)===c.True)?c.True:c.False}function Ne(p,d){return p.allOf.some(xe=>ke(xe,d)===c.True)?c.True:c.False}function Be(p,d){return U(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:U(d)?S(p,d):o.TObject(d)?Me(p,d):o.TRecord(d)?Je(p,d):o.TString(d)?On(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 qt(p,d){return c.True}function yr(p){let[d,xe]=[p,0];for(;o.TNot(d);)d=d.not,xe+=1;return xe%2===0?d:e.Type.Unknown()}function T(p,d){return o.TNot(p)?ke(yr(p),d):o.TNot(d)?ke(p,yr(d)):O("Invalid fallthrough for Not")}function le(p,d){return U(d)?S(p,d):o.TObject(d)?Me(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 U(d)?S(p,d):o.TObject(d)?Me(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 qe(p){return ne(p,0)}function Ye(p){return ne(p,0)}function Kt(p){return mr(p)}function zr(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 qr(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 mi(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 Me(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)&&qe(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)&&Kt(d)||o.TDate(p)&&Ye(d)||o.TConstructor(p)&&qr(d)||o.TFunction(p)&&zr(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 gi(p,d){return U(d)?S(p,d):o.TRecord(d)?Je(p,d):o.TObject(d)?(()=>{for(let xe of Object.getOwnPropertyNames(d.properties)){if(!(xe in p.properties)&&!o.TOptional(d.properties[xe]))return c.False;if(o.TOptional(d.properties[xe]))return c.True;if(En(p.properties[xe],d.properties[xe])===c.False)return c.False}return c.True})():c.False}function Bo(p,d){return U(d)?S(p,d):o.TObject(d)&&mi(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():O("Unknown record key pattern")}function Kr(p){return e.PatternNumberExact in p.patternProperties?p.patternProperties[e.PatternNumberExact]:e.PatternStringExact in p.patternProperties?p.patternProperties[e.PatternStringExact]:O("Unable to get record value schema")}function Je(p,d){let[xe,Bt]=[gr(d),Kr(d)];return o.TLiteralString(p)&&o.TNumber(xe)&&_(ke(p,Bt))===c.True?c.True:o.TUint8Array(p)&&o.TNumber(xe)||o.TString(p)&&o.TNumber(xe)||o.TArray(p)&&o.TNumber(xe)?ke(p,Bt):o.TObject(p)?(()=>{for(let Jd of Object.getOwnPropertyNames(p.properties))if(En(Bt,p.properties[Jd])===c.False)return c.False;return c.True})():c.False}function vi(p,d){return U(d)?S(p,d):o.TObject(d)?Me(p,d):o.TRecord(d)?ke(Kr(p),Kr(d)):c.False}function On(p,d){return o.TLiteral(p)&&i.IsString(p.const)||o.TString(p)?c.True:c.False}function Co(p,d){return U(d)?S(p,d):o.TObject(d)?Me(p,d):o.TRecord(d)?Je(p,d):o.TString(d)?c.True:c.False}function Ro(p,d){return U(d)?S(p,d):o.TObject(d)?Me(p,d):o.TRecord(d)?Je(p,d):o.TSymbol(d)?c.True:c.False}function De(p,d){return o.TTemplateLiteral(p)?ke(z.Resolve(p),d):o.TTemplateLiteral(d)?ke(p,z.Resolve(d)):O("Invalid fallthrough for TemplateLiteral")}function m(p,d){return o.TArray(d)&&p.items!==void 0&&p.items.every(xe=>ke(xe,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 U(d)?S(p,d):o.TObject(d)&&mr(d)||o.TArray(d)&&m(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((xe,Bt)=>ke(xe,d.items[Bt])===c.True)?c.True:c.False:c.False}function Fd(p,d){return U(d)?S(p,d):o.TObject(d)?Me(p,d):o.TRecord(d)?Je(p,d):o.TUint8Array(d)?c.True:c.False}function zd(p,d){return U(d)?S(p,d):o.TObject(d)?Me(p,d):o.TRecord(d)?Je(p,d):o.TVoid(d)?Gd(p,d):o.TUndefined(d)?c.True:c.False}function Mo(p,d){return d.anyOf.some(xe=>ke(p,xe)===c.True)?c.True:c.False}function qd(p,d){return p.anyOf.every(xe=>ke(xe,d)===c.True)?c.True:c.False}function Us(p,d){return c.True}function Kd(p,d){return o.TNever(d)?be(p,d):o.TIntersect(d)?we(p,d):o.TUnion(d)?Mo(p,d):o.TAny(d)?$(p,d):o.TString(d)?On(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)?Me(p,d):o.TUnknown(d)?c.True:c.False}function Gd(p,d){return o.TUndefined(p)||o.TUndefined(p)?c.True:c.False}function Hd(p,d){return o.TIntersect(d)?we(p,d):o.TUnion(d)?Mo(p,d):o.TUnknown(d)?Us(p,d):o.TAny(d)?$(p,d):o.TObject(d)?Me(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)?T(p,d):o.TAny(p)?h(p,d):o.TArray(p)?w(p,d):o.TBigInt(p)?x(p,d):o.TBoolean(p)?v(p,d):o.TAsyncIterator(p)?s(p,d):o.TConstructor(p)?N(p,d):o.TDate(p)?D(p,d):o.TFunction(p)?J(p,d):o.TInteger(p)?ye(p,d):o.TIntersect(p)?Ne(p,d):o.TIterator(p)?Be(p,d):o.TLiteral(p)?hr(p,d):o.TNever(p)?qt(p,d):o.TNull(p)?le(p,d):o.TNumber(p)?ge(p,d):o.TObject(p)?gi(p,d):o.TRecord(p)?vi(p,d):o.TString(p)?Co(p,d):o.TSymbol(p)?Ro(p,d):o.TTuple(p)?ut(p,d):o.TPromise(p)?Bo(p,d):o.TUint8Array(p)?Fd(p,d):o.TUndefined(p)?zd(p,d):o.TUnion(p)?qd(p,d):o.TUnknown(p)?Kd(p,d):o.TVoid(p)?Hd(p,d):O(`Unknown left type operand '${p[e.Kind]}'`)}function Wd(p,d){return ke(p,d)}f.Extends=Wd})(y||(e.TypeExtends=y={}));var g;(function(f){function _(w){return w.map(s=>$(s))}function O(w){return new Date(w.getTime())}function U(w){return new Uint8Array(w)}function S(w){let s=Object.getOwnPropertyNames(w).reduce((b,v)=>({...b,[v]:$(w[v])}),{}),x=Object.getOwnPropertySymbols(w).reduce((b,v)=>({...b,[v]:$(w[v])}),{});return{...s,...x}}function $(w){return i.IsArray(w)?_(w):i.IsDate(w)?O(w):i.IsUint8Array(w)?U(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 M;(function(f){function _(N){return N.map(D=>{let{[e.Optional]:J,...ee}=g.Type(D);return ee})}function O(N){return N.every(D=>o.TOptional(D))}function U(N){return N.some(D=>o.TOptional(D))}function S(N){return O(N.allOf)?e.Type.Optional(e.Type.Intersect(_(N.allOf))):N}function $(N){return U(N.anyOf)?e.Type.Optional(e.Type.Union(_(N.anyOf))):N}function h(N){return N[e.Kind]==="Intersect"?S(N):N[e.Kind]==="Union"?$(N):N}function A(N,D){let J=N.allOf.reduce((ee,ye)=>{let we=b(ye,D);return we[e.Kind]==="Never"?ee:[...ee,we]},[]);return h(e.Type.Intersect(J))}function w(N,D){let J=N.anyOf.map(ee=>b(ee,D));return h(e.Type.Union(J))}function s(N,D){let J=N.properties[D];return i.IsUndefined(J)?e.Type.Never():e.Type.Union([J])}function x(N,D){let J=N.items;if(i.IsUndefined(J))return e.Type.Never();let ee=J[D];return i.IsUndefined(ee)?e.Type.Never():ee}function b(N,D){return N[e.Kind]==="Intersect"?A(N,D):N[e.Kind]==="Union"?w(N,D):N[e.Kind]==="Object"?s(N,D):N[e.Kind]==="Tuple"?x(N,D):e.Type.Never()}function v(N,D,J={}){let ee=D.map(ye=>b(N,ye.toString()));return h(e.Type.Union(ee,J))}f.Resolve=v})(M||(e.IndexedAccessor=M={}));var k;(function(f){function _(x){let[b,v]=[x.slice(0,1),x.slice(1)];return`${b.toLowerCase()}${v}`}function O(x){let[b,v]=[x.slice(0,1),x.slice(1)];return`${b.toUpperCase()}${v}`}function U(x){return x.toUpperCase()}function S(x){return x.toLowerCase()}function $(x,b){let v=q.ParseExact(x.pattern);if(!R.Check(v))return{...x,pattern:h(x.pattern,b)};let N=[...C.Generate(v)].map(ee=>e.Type.Literal(ee)),D=A(N,b),J=e.Type.Union(D);return e.Type.TemplateLiteral([J])}function h(x,b){return typeof x=="string"?b==="Uncapitalize"?_(x):b==="Capitalize"?O(x):b==="Uppercase"?U(x):b==="Lowercase"?S(x):x:x.toString()}function A(x,b){if(x.length===0)return[];let[v,...N]=x;return[s(v,b),...A(N,b)]}function w(x,b){return o.TTemplateLiteral(x)?$(x,b):o.TUnion(x)?e.Type.Union(A(x.anyOf,b)):o.TLiteral(x)?e.Type.Literal(h(x.const,b)):x}function s(x,b){return w(x,b)}f.Map=s})(k||(e.Intrinsic=k={}));var F;(function(f){function _(h,A){return e.Type.Intersect(h.allOf.map(w=>S(w,A)),{...h})}function O(h,A){return e.Type.Union(h.anyOf.map(w=>S(w,A)),{...h})}function U(h,A){return A(h)}function S(h,A){return h[e.Kind]==="Intersect"?_(h,A):h[e.Kind]==="Union"?O(h,A):h[e.Kind]==="Object"?U(h,A):h}function $(h,A,w){return{...S(g.Type(h),A),...w}}f.Map=$})(F||(e.ObjectMap=F={}));var Q;(function(f){function _(s){return s[0]==="^"&&s[s.length-1]==="$"?s.slice(1,s.length-1):s}function O(s,x){return s.allOf.reduce((b,v)=>[...b,...h(v,x)],[])}function U(s,x){let b=s.anyOf.map(v=>h(v,x));return[...b.reduce((v,N)=>N.map(D=>b.every(J=>J.includes(D))?v.add(D):v)[0],new Set)]}function S(s,x){return Object.getOwnPropertyNames(s.properties)}function $(s,x){return x.includePatterns?Object.getOwnPropertyNames(s.patternProperties):[]}function h(s,x){return o.TIntersect(s)?O(s,x):o.TUnion(s)?U(s,x):o.TObject(s)?S(s,x):o.TRecord(s)?$(s,x):[]}function A(s,x){return[...new Set(h(s,x))]}f.ResolveKeys=A;function w(s){return`^(${A(s,{includePatterns:!0}).map(x=>`(${_(x)})`).join("|")})$`}f.ResolvePattern=w})(Q||(e.KeyResolver=Q={}));var ae=class extends r{};e.KeyArrayResolverError=ae;var B;(function(f){function _(O){return Array.isArray(O)?O:o.TUnionLiteral(O)?O.anyOf.map(U=>U.const.toString()):o.TLiteral(O)?[O.const]:o.TTemplateLiteral(O)?(()=>{let U=q.ParseExact(O.pattern);if(!R.Check(U))throw new ae("Cannot resolve keys from infinite template expression");return[...C.Generate(U)]})():[]}f.Resolve=_})(B||(e.KeyArrayResolver=B={}));var V;(function(f){function*_(U){for(let S of U.anyOf)S[e.Kind]==="Union"?yield*_(S):yield S}function O(U){return e.Type.Union([..._(U)],{...U})}f.Resolve=O})(V||(e.UnionResolver=V={}));var H=class extends r{};e.TemplateLiteralPatternError=H;var se;(function(f){function _($){throw new H($)}function O($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function U($,h){return o.TTemplateLiteral($)?$.pattern.slice(1,$.pattern.length-1):o.TUnion($)?`(${$.anyOf.map(A=>U(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}${O($.const.toString())}`:o.TBoolean($)?`${h}${e.PatternBoolean}`:_(`Unexpected Kind '${$[e.Kind]}'`)}function S($){return`^${$.map(h=>U(h,"")).join("")}$`}f.Create=S})(se||(e.TemplateLiteralPattern=se={}));var z;(function(f){function _(O){let U=q.ParseExact(O.pattern);if(!R.Check(U))return e.Type.String();let S=[...C.Generate(U)].map($=>e.Type.Literal($));return e.Type.Union(S)}f.Resolve=_})(z||(e.TemplateLiteralResolver=z={}));var ue=class extends r{};e.TemplateLiteralParserError=ue;var q;(function(f){function _(N,D,J){return N[D]===J&&N.charCodeAt(D-1)!==92}function O(N,D){return _(N,D,"(")}function U(N,D){return _(N,D,")")}function S(N,D){return _(N,D,"|")}function $(N){if(!(O(N,0)&&U(N,N.length-1)))return!1;let D=0;for(let J=0;J<N.length;J++)if(O(N,J)&&(D+=1),U(N,J)&&(D-=1),D===0&&J!==N.length-1)return!1;return!0}function h(N){return N.slice(1,N.length-1)}function A(N){let D=0;for(let J=0;J<N.length;J++)if(O(N,J)&&(D+=1),U(N,J)&&(D-=1),S(N,J)&&D===0)return!0;return!1}function w(N){for(let D=0;D<N.length;D++)if(O(N,D))return!0;return!1}function s(N){let[D,J]=[0,0],ee=[];for(let we=0;we<N.length;we++)if(O(N,we)&&(D+=1),U(N,we)&&(D-=1),S(N,we)&&D===0){let Ne=N.slice(J,we);Ne.length>0&&ee.push(b(Ne)),J=we+1}let ye=N.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 x(N){function D(ye,we){if(!O(ye,we))throw new ue("TemplateLiteralParser: Index must point to open parens");let Ne=0;for(let Be=we;Be<ye.length;Be++)if(O(ye,Be)&&(Ne+=1),U(ye,Be)&&(Ne-=1),Ne===0)return[we,Be];throw new ue("TemplateLiteralParser: Unclosed group parens in expression")}function J(ye,we){for(let Ne=we;Ne<ye.length;Ne++)if(O(ye,Ne))return[we,Ne];return[we,ye.length]}let ee=[];for(let ye=0;ye<N.length;ye++)if(O(N,ye)){let[we,Ne]=D(N,ye),Be=N.slice(we,Ne+1);ee.push(b(Be)),ye=Ne}else{let[we,Ne]=J(N,ye),Be=N.slice(we,Ne);Be.length>0&&ee.push(b(Be)),ye=Ne-1}return ee.length===0?{type:"const",const:""}:ee.length===1?ee[0]:{type:"and",expr:ee}}function b(N){return $(N)?b(h(N)):A(N)?s(N):w(N)?x(N):{type:"const",const:N}}f.Parse=b;function v(N){return b(N.slice(1,N.length-1))}f.ParseExact=v})(q||(e.TemplateLiteralParser=q={}));var pe=class extends r{};e.TemplateLiteralFiniteError=pe;var R;(function(f){function _(h){throw new pe(h)}function O(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 U(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 U(h)?!0:O(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=$})(R||(e.TemplateLiteralFinite=R={}));var P=class extends r{};e.TemplateLiteralGeneratorError=P;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*O(h){return yield*_(h.expr.map(A=>[...$(A)]))}function*U(h){for(let A of h.expr)yield*$(A)}function*S(h){return yield h.const}function*$(h){return h.type==="and"?yield*O(h):h.type==="or"?yield*U(h):h.type==="const"?yield*S(h):(()=>{throw new P("Unknown expression")})()}f.Generate=$})(C||(e.TemplateLiteralGenerator=C={}));var Z;(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*O($){if($[1]!=="{"){let h=e.Type.Literal("$"),A=U($.slice(1));return yield*[h,...A]}for(let h=2;h<$.length;h++)if($[h]==="}"){let A=_($.slice(2,h)),w=U($.slice(h+1));return yield*[...A,...w]}yield e.Type.Literal($)}function*U($){for(let h=0;h<$.length;h++)if($[h]==="$"){let A=e.Type.Literal($.slice(0,h)),w=O($.slice(h));return yield*[A,...w]}yield e.Type.Literal($)}function S($){return[...U($)]}f.Parse=S})(Z||(e.TemplateLiteralDslParser=Z={}));var Y=class{constructor(f){this.schema=f}Decode(f){return new E(this.schema,f)}};e.TransformDecodeBuilder=Y;var E=class{constructor(f,_){this.schema=f,this.decode=_}Encode(f){let _=g.Type(this.schema);return o.TTransform(_)?(()=>{let O={Encode:U=>_[e.Transform].Encode(f(U)),Decode:U=>this.decode(_[e.Transform].Decode(U))};return{..._,[e.Transform]:O}})():(()=>{let O={Decode:this.decode,Encode:f};return{..._,[e.Transform]:O}})()}};e.TransformEncodeBuilder=E;var K=0,te=class extends r{};e.TypeBuilderError=te;var G=class{Create(f){return f}Throw(f){throw new te(f)}Discard(f,_){return _.reduce((O,U)=>{let{[U]:S,...$}=O;return $},f)}Strict(f){return JSON.parse(JSON.stringify(f))}};e.TypeBuilder=G;var W=class extends G{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{...k.Map(g.Type(f),"Capitalize"),..._}}Composite(f,_){let O=e.Type.Intersect(f,{}),U=Q.ResolveKeys(O,{includePatterns:!1}).reduce((S,$)=>({...S,[$]:e.Type.Index(O,[$])}),{});return e.Type.Object(U,_)}Enum(f,_={}){if(i.IsUndefined(f))return this.Throw("Enum undefined or empty");let O=Object.getOwnPropertyNames(f).filter(S=>isNaN(S)).map(S=>f[S]),U=[...new Set(O)].map(S=>e.Type.Literal(S));return this.Union(U,{..._,[e.Hint]:"Enum"})}Extends(f,_,O,U,S={}){switch(y.Extends(f,_)){case c.Union:return this.Union([g.Type(O,S),g.Type(U,S)]);case c.True:return g.Type(O,S);case c.False:return g.Type(U,S)}}Exclude(f,_,O={}){return o.TTemplateLiteral(f)?this.Exclude(z.Resolve(f),_,O):o.TTemplateLiteral(_)?this.Exclude(f,z.Resolve(_),O):o.TUnion(f)?(()=>{let U=f.anyOf.filter(S=>y.Extends(S,_)===c.False);return U.length===1?g.Type(U[0],O):this.Union(U,O)})():y.Extends(f,_)!==c.False?this.Never(O):g.Type(f,O)}Extract(f,_,O={}){return o.TTemplateLiteral(f)?this.Extract(z.Resolve(f),_,O):o.TTemplateLiteral(_)?this.Extract(f,z.Resolve(_),O):o.TUnion(f)?(()=>{let U=f.anyOf.filter(S=>y.Extends(S,_)!==c.False);return U.length===1?g.Type(U[0],O):this.Union(U,O)})():y.Extends(f,_)!==c.False?g.Type(f,O):this.Never(O)}Index(f,_,O={}){return o.TArray(f)&&o.TNumber(_)?g.Type(f.items,O):o.TTuple(f)&&o.TNumber(_)?(()=>{let U=(i.IsUndefined(f.items)?[]:f.items).map(S=>g.Type(S));return this.Union(U,O)})():(()=>{let U=B.Resolve(_),S=g.Type(f);return M.Resolve(S,U,O)})()}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 O=f.every($=>o.TObject($)),U=g.Rest(f),S=o.TSchema(_.unevaluatedProperties)?{unevaluatedProperties:g.Type(_.unevaluatedProperties)}:{};return _.unevaluatedProperties===!1||o.TSchema(_.unevaluatedProperties)||O?this.Create({..._,...S,[e.Kind]:"Intersect",type:"object",allOf:U}):this.Create({..._,...S,[e.Kind]:"Intersect",allOf:U})}KeyOf(f,_={}){return o.TRecord(f)?(()=>{let O=Object.getOwnPropertyNames(f.patternProperties)[0];return O===e.PatternNumberExact?this.Number(_):O===e.PatternStringExact?this.String(_):this.Throw("Unable to resolve key type from Record key pattern")})():o.TTuple(f)?(()=>{let O=(i.IsUndefined(f.items)?[]:f.items).map((U,S)=>e.Type.Literal(S.toString()));return this.Union(O,_)})():o.TArray(f)?this.Number(_):(()=>{let O=Q.ResolveKeys(f,{includePatterns:!1});if(O.length===0)return this.Never(_);let U=O.map(S=>this.Literal(S));return this.Union(U,_)})()}Literal(f,_={}){return this.Create({..._,[e.Kind]:"Literal",const:f,type:typeof f})}Lowercase(f,_={}){return{...k.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 O=Object.getOwnPropertyNames(f),U=O.filter(A=>o.TOptional(f[A])),S=O.filter(A=>!U.includes(A)),$=o.TSchema(_.additionalProperties)?{additionalProperties:g.Type(_.additionalProperties)}:{},h=O.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,_,O={}){let U=B.Resolve(_);return F.Map(this.Discard(g.Type(f),["$id",e.Transform]),S=>{i.IsArray(S.required)&&(S.required=S.required.filter($=>!U.includes($)),S.required.length===0&&delete S.required);for(let $ of Object.getOwnPropertyNames(S.properties))U.includes($)&&delete S.properties[$];return this.Create(S)},O)}Partial(f,_={}){return F.Map(this.Discard(g.Type(f),["$id",e.Transform]),O=>{let U=Object.getOwnPropertyNames(O.properties).reduce((S,$)=>({...S,[$]:this.Optional(O.properties[$])}),{});return this.Object(U,this.Discard(O,["required"]))},_)}Pick(f,_,O={}){let U=B.Resolve(_);return F.Map(this.Discard(g.Type(f),["$id",e.Transform]),S=>{i.IsArray(S.required)&&(S.required=S.required.filter($=>U.includes($)),S.required.length===0&&delete S.required);for(let $ of Object.getOwnPropertyNames(S.properties))U.includes($)||delete S.properties[$];return this.Create(S)},O)}Record(f,_,O={}){return o.TTemplateLiteral(f)?(()=>{let U=q.ParseExact(f.pattern);return R.Check(U)?this.Object([...C.Generate(U)].reduce((S,$)=>({...S,[$]:g.Type(_)}),{}),O):this.Create({...O,[e.Kind]:"Record",type:"object",patternProperties:{[f.pattern]:g.Type(_)}})})():o.TUnion(f)?(()=>{let U=V.Resolve(f);if(o.TUnionLiteral(U)){let S=U.anyOf.reduce(($,h)=>({...$,[h.const]:g.Type(_)}),{});return this.Object(S,{...O,[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(_)},O):this.Throw("Record key of type literal is not of type string or number"):o.TInteger(f)||o.TNumber(f)?this.Create({...O,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:g.Type(_)}}):o.TString(f)?(()=>{let U=i.IsUndefined(f.pattern)?e.PatternStringExact:f.pattern;return this.Create({...O,[e.Kind]:"Record",type:"object",patternProperties:{[U]:g.Type(_)}})})():this.Never()}Recursive(f,_={}){i.IsUndefined(_.$id)&&(_.$id=`T${K++}`);let O=f({[e.Kind]:"This",$ref:`${_.$id}`});return O.$id=_.$id,this.Create({..._,[e.Hint]:"Recursive",...O})}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 F.Map(this.Discard(g.Type(f),["$id",e.Transform]),O=>{let U=Object.getOwnPropertyNames(O.properties).reduce((S,$)=>({...S,[$]:this.Discard(O.properties[$],[e.Optional])}),{});return this.Object(U,O)},_)}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 O=i.IsString(f)?se.Create(Z.Parse(f)):se.Create(f);return this.Create({..._,[e.Kind]:"TemplateLiteral",type:"string",pattern:O})}Transform(f){return new Y(f)}Tuple(f,_={}){let[O,U,S]=[!1,f.length,f.length],$=g.Rest(f),h=f.length>0?{..._,[e.Kind]:"Tuple",type:"array",items:$,additionalItems:O,minItems:U,maxItems:S}:{..._,[e.Kind]:"Tuple",type:"array",minItems:U,maxItems:S};return this.Create(h)}Uncapitalize(f,_={}){return{...k.Map(g.Type(f),"Uncapitalize"),..._}}Union(f,_={}){return o.TTemplateLiteral(f)?z.Resolve(f):(()=>{let O=f;if(O.length===0)return this.Never(_);if(O.length===1)return this.Create(g.Type(O[0],_));let U=g.Rest(O);return this.Create({..._,[e.Kind]:"Union",anyOf:U})})()}Unknown(f={}){return this.Create({...f,[e.Kind]:"Unknown"})}Unsafe(f={}){return this.Create({...f,[e.Kind]:f[e.Kind]||"Unsafe"})}Uppercase(f,_={}){return{...k.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 O=U=>U.length>0?(()=>{let[S,...$]=U;return[this.Awaited(S),...O($)]})():U;return o.TIntersect(f)?e.Type.Intersect(O(f.allOf)):o.TUnion(f)?e.Type.Union(O(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,_,O){let[U,S]=[g.Rest(f),g.Type(_)];return this.Create({...O,[e.Kind]:"Constructor",type:"Constructor",parameters:U,returns:S})}Date(f={}){return this.Create({...f,[e.Kind]:"Date",type:"Date"})}Function(f,_,O){let[U,S]=[g.Rest(f),g.Type(_)];return this.Create({...O,[e.Kind]:"Function",type:"Function",parameters:U,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 O=i.IsString(f)?f:f.source;return this.Create({..._,[e.Kind]:"String",type:"string",pattern:O})}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}),dn=Le(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(z){return c(z)&&Symbol.asyncIterator in z}e.IsAsyncIterator=t;function r(z){return c(z)&&Symbol.iterator in z}e.IsIterator=r;function n(z){return ArrayBuffer.isView(z)}e.IsTypedArray=n;function i(z){return z instanceof Promise}e.IsPromise=i;function a(z){return z instanceof Uint8Array}e.IsUint8Array=a;function o(z){return z instanceof Date&&Number.isFinite(z.getTime())}e.IsDate=o;function u(z,ue){return ue in z}e.HasPropertyKey=u;function l(z){return c(z)&&V(z.constructor)&&z.constructor.name==="Object"}e.IsPlainObject=l;function c(z){return z!==null&&typeof z=="object"}e.IsObject=c;function y(z){return Array.isArray(z)&&!ArrayBuffer.isView(z)}e.IsArray=y;function g(z){return z===void 0}e.IsUndefined=g;function M(z){return z===null}e.IsNull=M;function k(z){return typeof z=="boolean"}e.IsBoolean=k;function F(z){return typeof z=="number"}e.IsNumber=F;function Q(z){return F(z)&&Number.isInteger(z)}e.IsInteger=Q;function ae(z){return typeof z=="bigint"}e.IsBigInt=ae;function B(z){return typeof z=="string"}e.IsString=B;function V(z){return typeof z=="function"}e.IsFunction=V;function H(z){return typeof z=="symbol"}e.IsSymbol=H;function se(z){return ae(z)||k(z)||M(z)||F(z)||B(z)||H(z)||g(z)}e.IsValueType=se}),Pl=Le(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=dn(),r=go(),n=Cr(),i=class extends n.TypeBoxError{constructor(y){super(`Duplicate type kind '${y}' detected`)}};e.TypeSystemDuplicateTypeKind=i;var a=class extends n.TypeBoxError{constructor(y){super(`Duplicate string format '${y}' detected`)}};e.TypeSystemDuplicateFormat=a;var o;(function(y){function g(k,F){if(n.TypeRegistry.Has(k))throw new i(k);return n.TypeRegistry.Set(k,F),(Q={})=>n.Type.Unsafe({...Q,[n.Kind]:k})}y.Type=g;function M(k,F){if(n.FormatRegistry.Has(k))throw new a(k);return n.FormatRegistry.Set(k,F),k}y.Format=M})(o||(e.TypeSystem=o={}));var u;(function(y){let g=c;function M(){g=c}y.Reset=M;function k(Q){g=Q}y.Set=k;function F(){return g}y.Get=F})(u||(e.TypeSystemErrorFunction=u={}));var l;(function(y){y.ExactOptionalPropertyTypes=!1,y.AllowArrayObject=!1,y.AllowNaN=!1,y.AllowNullVoid=!1;function g(ae,B){return y.ExactOptionalPropertyTypes?B in ae:ae[B]!==void 0}y.IsExactOptionalProperty=g;function M(ae){let B=(0,t.IsObject)(ae);return y.AllowArrayObject?B:B&&!(0,t.IsArray)(ae)}y.IsObjectLike=M;function k(ae){return M(ae)&&!(ae instanceof Date)&&!(ae instanceof Uint8Array)}y.IsRecordLike=k;function F(ae){let B=(0,t.IsNumber)(ae);return y.AllowNaN?B:B&&Number.isFinite(ae)}y.IsNumberLike=F;function Q(ae){let B=(0,t.IsUndefined)(ae);return y.AllowNullVoid?B||ae===null:B}y.IsVoidLike=Q})(l||(e.TypeSystemPolicy=l={}));function c(y,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 ${y.maxContains} matching values`;case r.ValueErrorType.ArrayMinContains:return`Expected array to contain at least ${y.minContains} matching values`;case r.ValueErrorType.ArrayMaxItems:return`Expected array length to be less or equal to ${y.maxItems}`;case r.ValueErrorType.ArrayMinItems:return`Expected array length to be greater or equal to ${y.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 ${y.exclusiveMaximum}`;case r.ValueErrorType.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${y.exclusiveMinimum}`;case r.ValueErrorType.BigIntMaximum:return`Expected bigint to be less or equal to ${y.maximum}`;case r.ValueErrorType.BigIntMinimum:return`Expected bigint to be greater or equal to ${y.minimum}`;case r.ValueErrorType.BigIntMultipleOf:return`Expected bigint to be a multiple of ${y.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 ${y.exclusiveMinimumTimestamp}`;case r.ValueErrorType.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${y.exclusiveMaximumTimestamp}`;case r.ValueErrorType.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${y.minimumTimestamp}`;case r.ValueErrorType.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${y.maximumTimestamp}`;case r.ValueErrorType.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${y.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 ${y.exclusiveMaximum}`;case r.ValueErrorType.IntegerExclusiveMinimum:return`Expected integer to be greater than ${y.exclusiveMinimum}`;case r.ValueErrorType.IntegerMaximum:return`Expected integer to be less or equal to ${y.maximum}`;case r.ValueErrorType.IntegerMinimum:return`Expected integer to be greater or equal to ${y.minimum}`;case r.ValueErrorType.IntegerMultipleOf:return`Expected integer to be a multiple of ${y.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 y.const=="string"?`'${y.const}'`:y.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 ${y.exclusiveMaximum}`;case r.ValueErrorType.NumberExclusiveMinimum:return`Expected number to be greater than ${y.exclusiveMinimum}`;case r.ValueErrorType.NumberMaximum:return`Expected number to be less or equal to ${y.maximum}`;case r.ValueErrorType.NumberMinimum:return`Expected number to be greater or equal to ${y.minimum}`;case r.ValueErrorType.NumberMultipleOf:return`Expected number to be a multiple of ${y.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 ${y.maxProperties} properties`;case r.ValueErrorType.ObjectMinProperties:return`Expected object to have at least ${y.minProperties} properties`;case r.ValueErrorType.ObjectRequiredProperty:return"Required property";case r.ValueErrorType.Promise:return"Expected Promise";case r.ValueErrorType.StringFormatUnknown:return`Unknown format '${y.format}'`;case r.ValueErrorType.StringFormat:return`Expected string to match '${y.format}' format`;case r.ValueErrorType.StringMaxLength:return`Expected string length less or equal to ${y.maxLength}`;case r.ValueErrorType.StringMinLength:return`Expected string length greater or equal to ${y.minLength}`;case r.ValueErrorType.StringPattern:return`Expected string to match '${y.pattern}'`;case r.ValueErrorType.String:return"Expected string";case r.ValueErrorType.Symbol:return"Expected symbol";case r.ValueErrorType.TupleLength:return`Expected tuple to have ${y.maxItems||0} elements`;case r.ValueErrorType.Tuple:return"Expected tuple";case r.ValueErrorType.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${y.maxByteLength}`;case r.ValueErrorType.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${y.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 '${y[n.Kind]}'`;default:return"Unknown error type"}}e.DefaultErrorFunction=c}),mo=Le(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Deref=e.TypeDereferenceError=void 0;var t=Cr(),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}),ns=Le(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.ByteMarker=e.ValueHashError=void 0;var t=dn(),r=class extends Error{constructor(P){super("Unable to hash value"),this.value=P}};e.ValueHashError=r;var n;(function(P){P[P.Undefined=0]="Undefined",P[P.Null=1]="Null",P[P.Boolean=2]="Boolean",P[P.Number=3]="Number",P[P.String=4]="String",P[P.Object=5]="Object",P[P.Array=6]="Array",P[P.Date=7]="Date",P[P.Uint8Array=8]="Uint8Array",P[P.Symbol=9]="Symbol",P[P.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((P,C)=>BigInt(C)),l=new Float64Array(1),c=new DataView(l.buffer),y=new Uint8Array(l.buffer);function*g(P){let C=P===0?1:Math.ceil(Math.floor(Math.log2(P)+1)/8);for(let Z=0;Z<C;Z++)yield P>>8*(C-1-Z)&255}function M(P){pe(n.Array);for(let C of P)q(C)}function k(P){pe(n.Boolean),pe(P?1:0)}function F(P){pe(n.BigInt),c.setBigInt64(0,P);for(let C of y)pe(C)}function Q(P){pe(n.Date),q(P.getTime())}function ae(P){pe(n.Null)}function B(P){pe(n.Number),c.setFloat64(0,P);for(let C of y)pe(C)}function V(P){pe(n.Object);for(let C of globalThis.Object.keys(P).sort())q(C),q(P[C])}function H(P){pe(n.String);for(let C=0;C<P.length;C++)for(let Z of g(P.charCodeAt(C)))pe(Z)}function se(P){pe(n.Symbol),q(P.description)}function z(P){pe(n.Uint8Array);for(let C=0;C<P.length;C++)pe(P[C])}function ue(P){return pe(n.Undefined)}function q(P){if((0,t.IsArray)(P))return M(P);if((0,t.IsBoolean)(P))return k(P);if((0,t.IsBigInt)(P))return F(P);if((0,t.IsDate)(P))return Q(P);if((0,t.IsNull)(P))return ae(P);if((0,t.IsNumber)(P))return B(P);if((0,t.IsPlainObject)(P))return V(P);if((0,t.IsString)(P))return H(P);if((0,t.IsSymbol)(P))return se(P);if((0,t.IsUint8Array)(P))return z(P);if((0,t.IsUndefined)(P))return ue(P);throw new r(P)}function pe(P){i=i^u[P],i=i*a%o}function R(P){return i=BigInt("14695981039346656037"),q(P),i}e.Hash=R}),go=Le(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Errors=e.ValueErrorIterator=e.EscapeKey=e.ValueErrorsUnknownTypeError=e.ValueErrorType=void 0;var t=dn(),r=Pl(),n=mo(),i=ns(),a=Cr(),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 y=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=y;function g(s,x,b,v){return{type:s,schema:x,path:b,value:v,message:r.TypeSystemErrorFunction.Get()(x,s)}}function*M(s,x,b,v){}function*k(s,x,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,x,`${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 N=c(s.contains)?s.contains:a.Type.Never(),D=v.reduce((J,ee,ye)=>A(N,x,`${b}${ye}`,ee).next().done===!0?J+1:J,0);D===0&&(yield g(o.ArrayContains,s,b,v)),(0,t.IsNumber)(s.minContains)&&D<s.minContains&&(yield g(o.ArrayMinContains,s,b,v)),(0,t.IsNumber)(s.maxContains)&&D>s.maxContains&&(yield g(o.ArrayMaxContains,s,b,v))}function*F(s,x,b,v){(0,t.IsAsyncIterator)(v)||(yield g(o.AsyncIterator,s,b,v))}function*Q(s,x,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,x,b,v){(0,t.IsBoolean)(v)||(yield g(o.Boolean,s,b,v))}function*B(s,x,b,v){yield*A(s.returns,x,b,v.prototype)}function*V(s,x,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*H(s,x,b,v){(0,t.IsFunction)(v)||(yield g(o.Function,s,b,v))}function*se(s,x,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*z(s,x,b,v){for(let N of s.allOf){let D=A(N,x,b,v).next();D.done||(yield g(o.Intersect,s,b,v),yield D.value)}if(s.unevaluatedProperties===!1){let N=new RegExp(a.KeyResolver.ResolvePattern(s));for(let D of Object.getOwnPropertyNames(v))N.test(D)||(yield g(o.IntersectUnevaluatedProperties,s,`${b}/${D}`,v))}if(typeof s.unevaluatedProperties=="object"){let N=new RegExp(a.KeyResolver.ResolvePattern(s));for(let D of Object.getOwnPropertyNames(v))if(!N.test(D)){let J=A(s.unevaluatedProperties,x,`${b}/${D}`,v[D]).next();J.done||(yield J.value)}}}function*ue(s,x,b,v){(0,t.IsIterator)(v)||(yield g(o.Iterator,s,b,v))}function*q(s,x,b,v){v!==s.const&&(yield g(o.Literal,s,b,v))}function*pe(s,x,b,v){yield g(o.Never,s,b,v)}function*R(s,x,b,v){A(s.not,x,b,v).next().done===!0&&(yield g(o.Not,s,b,v))}function*P(s,x,b,v){(0,t.IsNull)(v)||(yield g(o.Null,s,b,v))}function*C(s,x,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*Z(s,x,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 N=Array.isArray(s.required)?s.required:[],D=Object.getOwnPropertyNames(s.properties),J=Object.getOwnPropertyNames(v);for(let ee of N)J.includes(ee)||(yield g(o.ObjectRequiredProperty,s.properties[ee],`${b}/${l(ee)}`,void 0));if(s.additionalProperties===!1)for(let ee of J)D.includes(ee)||(yield g(o.ObjectAdditionalProperties,s,`${b}/${l(ee)}`,v[ee]));if(typeof s.additionalProperties=="object")for(let ee of J)D.includes(ee)||(yield*A(s.additionalProperties,x,`${b}/${l(ee)}`,v[ee]));for(let ee of D){let ye=s.properties[ee];s.required&&s.required.includes(ee)?(yield*A(ye,x,`${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,x,`${b}/${l(ee)}`,v[ee]))}}function*Y(s,x,b,v){(0,t.IsPromise)(v)||(yield g(o.Promise,s,b,v))}function*E(s,x,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[N,D]=Object.entries(s.patternProperties)[0],J=new RegExp(N);for(let[ee,ye]of Object.entries(v))J.test(ee)&&(yield*A(D,x,`${b}/${l(ee)}`,ye));if(typeof s.additionalProperties=="object")for(let[ee,ye]of Object.entries(v))J.test(ee)||(yield*A(s.additionalProperties,x,`${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,x,b,v){yield*A((0,n.Deref)(s,x),x,b,v)}function*te(s,x,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*G(s,x,b,v){(0,t.IsSymbol)(v)||(yield g(o.Symbol,s,b,v))}function*W(s,x,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,x,b,v){yield*A((0,n.Deref)(s,x),x,b,v)}function*f(s,x,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 N=0;N<s.items.length;N++)yield*A(s.items[N],x,`${b}/${N}`,v[N])}function*_(s,x,b,v){(0,t.IsUndefined)(v)||(yield g(o.Undefined,s,b,v))}function*O(s,x,b,v){let N=0;for(let D of s.anyOf){let J=[...A(D,x,b,v)];if(J.length===0)return;N+=J.length}N>0&&(yield g(o.Union,s,b,v))}function*U(s,x,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,x,b,v){}function*$(s,x,b,v){r.TypeSystemPolicy.IsVoidLike(v)||(yield g(o.Void,s,b,v))}function*h(s,x,b,v){a.TypeRegistry.Get(s[a.Kind])(s,v)||(yield g(o.Kind,s,b,v))}function*A(s,x,b,v){let N=c(s.$id)?[...x,s]:x,D=s;switch(D[a.Kind]){case"Any":return yield*M(D,N,b,v);case"Array":return yield*k(D,N,b,v);case"AsyncIterator":return yield*F(D,N,b,v);case"BigInt":return yield*Q(D,N,b,v);case"Boolean":return yield*ae(D,N,b,v);case"Constructor":return yield*B(D,N,b,v);case"Date":return yield*V(D,N,b,v);case"Function":return yield*H(D,N,b,v);case"Integer":return yield*se(D,N,b,v);case"Intersect":return yield*z(D,N,b,v);case"Iterator":return yield*ue(D,N,b,v);case"Literal":return yield*q(D,N,b,v);case"Never":return yield*pe(D,N,b,v);case"Not":return yield*R(D,N,b,v);case"Null":return yield*P(D,N,b,v);case"Number":return yield*C(D,N,b,v);case"Object":return yield*Z(D,N,b,v);case"Promise":return yield*Y(D,N,b,v);case"Record":return yield*E(D,N,b,v);case"Ref":return yield*K(D,N,b,v);case"String":return yield*te(D,N,b,v);case"Symbol":return yield*G(D,N,b,v);case"TemplateLiteral":return yield*W(D,N,b,v);case"This":return yield*fe(D,N,b,v);case"Tuple":return yield*f(D,N,b,v);case"Undefined":return yield*_(D,N,b,v);case"Union":return yield*O(D,N,b,v);case"Uint8Array":return yield*U(D,N,b,v);case"Unknown":return yield*S(D,N,b,v);case"Void":return yield*$(D,N,b,v);default:if(!a.TypeRegistry.Has(D[a.Kind]))throw new u(s);return yield*h(D,N,b,v)}}function w(...s){let x=s.length===3?A(s[0],s[1],"",s[2]):A(s[0],[],"",s[1]);return new y(x)}e.Errors=w}),Lm=Le(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(go(),e)}),Bl=Le(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=go();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(Pl(),e)}),Vm=Le(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Check=e.ValueCheckUnknownTypeError=void 0;var t=dn(),r=Bl(),n=mo(),i=ns(),a=Cr(),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 y(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 N=(0,i.Hash)(v);if(b.has(N))return!1;b.add(N)}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(),x=w.reduce((b,v)=>S(s,A,v)?b+1:b,0);return!(x===0||(0,t.IsNumber)(h.minContains)&&x<h.minContains||(0,t.IsNumber)(h.maxContains)&&x>h.maxContains)}function g(h,A,w){return(0,t.IsAsyncIterator)(w)}function M(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 k(h,A,w){return(0,t.IsBoolean)(w)}function F(h,A,w){return S(h.returns,A,w.prototype)}function Q(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(x=>S(x,A,w));if(h.unevaluatedProperties===!1){let x=new RegExp(a.KeyResolver.ResolvePattern(h)),b=Object.getOwnPropertyNames(w).every(v=>x.test(v));return s&&b}else if(a.TypeGuard.TSchema(h.unevaluatedProperties)){let x=new RegExp(a.KeyResolver.ResolvePattern(h)),b=Object.getOwnPropertyNames(w).every(v=>x.test(v)||S(h.unevaluatedProperties,A,w[v]));return s&&b}else return s}function H(h,A,w){return(0,t.IsIterator)(w)}function se(h,A,w){return w===h.const}function z(h,A,w){return!1}function ue(h,A,w){return!S(h.not,A,w)}function q(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 R(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 x of s){let b=h.properties[x];if(h.required&&h.required.includes(x)){if(!S(b,A,w[x])||(a.ExtendsUndefined.Check(b)||u(b))&&!(x in w))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(w,x)&&!S(b,A,w[x]))return!1}if(h.additionalProperties===!1){let x=Object.getOwnPropertyNames(w);return h.required&&h.required.length===s.length&&x.length===s.length?!0:x.every(b=>s.includes(b))}else return typeof h.additionalProperties=="object"?Object.getOwnPropertyNames(w).every(x=>s.includes(x)||S(h.additionalProperties,A,w[x])):!0}function P(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,x]=Object.entries(h.patternProperties)[0],b=new RegExp(s),v=Object.entries(w).every(([J,ee])=>b.test(J)?S(x,A,ee):!0),N=typeof h.additionalProperties=="object"?Object.entries(w).every(([J,ee])=>b.test(J)?!0:S(h.additionalProperties,A,ee)):!0,D=h.additionalProperties===!1?Object.getOwnPropertyNames(w).every(J=>b.test(J)):!0;return v&&N&&D}function Z(h,A,w){return S((0,n.Deref)(h,A),A,w)}function Y(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 E(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 G(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 O(h,A,w){return r.TypeSystemPolicy.IsVoidLike(w)}function U(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,x=h;switch(x[a.Kind]){case"Any":return c(x,s,w);case"Array":return y(x,s,w);case"AsyncIterator":return g(x,s,w);case"BigInt":return M(x,s,w);case"Boolean":return k(x,s,w);case"Constructor":return F(x,s,w);case"Date":return Q(x,s,w);case"Function":return ae(x,s,w);case"Integer":return B(x,s,w);case"Intersect":return V(x,s,w);case"Iterator":return H(x,s,w);case"Literal":return se(x,s,w);case"Never":return z(x,s,w);case"Not":return ue(x,s,w);case"Null":return q(x,s,w);case"Number":return pe(x,s,w);case"Object":return R(x,s,w);case"Promise":return P(x,s,w);case"Record":return C(x,s,w);case"Ref":return Z(x,s,w);case"String":return Y(x,s,w);case"Symbol":return E(x,s,w);case"TemplateLiteral":return K(x,s,w);case"This":return te(x,s,w);case"Tuple":return G(x,s,w);case"Undefined":return W(x,s,w);case"Union":return fe(x,s,w);case"Uint8Array":return f(x,s,w);case"Unknown":return _(x,s,w);case"Void":return O(x,s,w);default:if(!a.TypeRegistry.Has(x[a.Kind]))throw new o(x);return U(x,s,w)}}function $(...h){return h.length===3?S(h[0],h[1],h[2]):S(h[0],[],h[1])}e.Check=$}),Fm=Le(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=dn(),r=mo(),n=Vm(),i=Cr(),a=class extends i.TypeBoxError{constructor(M,k,F){super("Unable to decode due to invalid value"),this.schema=M,this.value=k,this.error=F}};e.TransformDecodeCheckError=a;var o=class extends i.TypeBoxError{constructor(M,k,F){super("Unable to encode due to invalid value"),this.schema=M,this.value=k,this.error=F}};e.TransformEncodeCheckError=o;var u=class extends i.TypeBoxError{constructor(M,k,F){super(`${F instanceof Error?F.message:"Unknown error"}`),this.schema=M,this.value=k}};e.TransformDecodeError=u;var l=class extends i.TypeBoxError{constructor(M,k,F){super(`${F instanceof Error?F.message:"Unknown error"}`),this.schema=M,this.value=k}};e.TransformEncodeError=l;var c;(function(M){function k(E,K){return i.TypeGuard.TTransform(E)||C(E.items,K)}function F(E,K){return i.TypeGuard.TTransform(E)||C(E.items,K)}function Q(E,K){return i.TypeGuard.TTransform(E)||C(E.returns,K)||E.parameters.some(te=>C(te,K))}function ae(E,K){return i.TypeGuard.TTransform(E)||C(E.returns,K)||E.parameters.some(te=>C(te,K))}function B(E,K){return i.TypeGuard.TTransform(E)||i.TypeGuard.TTransform(E.unevaluatedProperties)||E.allOf.some(te=>C(te,K))}function V(E,K){return i.TypeGuard.TTransform(E)||C(E.items,K)}function H(E,K){return i.TypeGuard.TTransform(E)||C(E.not,K)}function se(E,K){return i.TypeGuard.TTransform(E)||Object.values(E.properties).some(te=>C(te,K))||i.TypeGuard.TSchema(E.additionalProperties)&&C(E.additionalProperties,K)}function z(E,K){return i.TypeGuard.TTransform(E)||C(E.item,K)}function ue(E,K){let te=Object.getOwnPropertyNames(E.patternProperties)[0],G=E.patternProperties[te];return i.TypeGuard.TTransform(E)||C(G,K)||i.TypeGuard.TSchema(E.additionalProperties)&&i.TypeGuard.TTransform(E.additionalProperties)}function q(E,K){return i.TypeGuard.TTransform(E)?!0:C((0,r.Deref)(E,K),K)}function pe(E,K){return i.TypeGuard.TTransform(E)?!0:C((0,r.Deref)(E,K),K)}function R(E,K){return i.TypeGuard.TTransform(E)||!(0,t.IsUndefined)(E.items)&&E.items.some(te=>C(te,K))}function P(E,K){return i.TypeGuard.TTransform(E)||E.anyOf.some(te=>C(te,K))}function C(E,K){let te=(0,t.IsString)(E.$id)?[...K,E]:K,G=E;if(E.$id&&Z.has(E.$id))return!1;switch(E.$id&&Z.add(E.$id),E[i.Kind]){case"Array":return k(G,te);case"AsyncIterator":return F(G,te);case"Constructor":return Q(G,te);case"Function":return ae(G,te);case"Intersect":return B(G,te);case"Iterator":return V(G,te);case"Not":return H(G,te);case"Object":return se(G,te);case"Promise":return z(G,te);case"Record":return ue(G,te);case"Ref":return q(G,te);case"This":return pe(G,te);case"Tuple":return R(G,te);case"Union":return P(G,te);default:return i.TypeGuard.TTransform(E)}}let Z=new Set;function Y(E,K){return Z.clear(),C(E,K)}M.Has=Y})(c||(e.HasTransform=c={}));var y;(function(M){function k(R,P){try{return i.TypeGuard.TTransform(R)?R[i.Transform].Decode(P):P}catch(C){throw new u(R,P,C)}}function F(R,P,C){return(0,t.IsArray)(C)?k(R,C.map(Z=>q(R.items,P,Z))):k(R,C)}function Q(R,P,C){if(!(0,t.IsPlainObject)(C)||(0,t.IsValueType)(C))return k(R,C);let Z=i.KeyResolver.ResolveKeys(R,{includePatterns:!1}),Y=Z.reduce((G,W)=>W in G?{...G,[W]:q(i.IndexedAccessor.Resolve(R,[W]),P,G[W])}:G,C);if(!i.TypeGuard.TTransform(R.unevaluatedProperties))return k(R,Y);let E=Object.getOwnPropertyNames(Y),K=R.unevaluatedProperties,te=E.reduce((G,W)=>Z.includes(W)?G:{...G,[W]:k(K,G[W])},Y);return k(R,te)}function ae(R,P,C){return k(R,q(R.not,P,C))}function B(R,P,C){if(!(0,t.IsPlainObject)(C))return k(R,C);let Z=i.KeyResolver.ResolveKeys(R,{includePatterns:!1}),Y=Z.reduce((G,W)=>W in G?{...G,[W]:q(R.properties[W],P,G[W])}:G,C);if(!i.TypeGuard.TSchema(R.additionalProperties))return k(R,Y);let E=Object.getOwnPropertyNames(Y),K=R.additionalProperties,te=E.reduce((G,W)=>Z.includes(W)?G:{...G,[W]:k(K,G[W])},Y);return k(R,te)}function V(R,P,C){if(!(0,t.IsPlainObject)(C))return k(R,C);let Z=Object.getOwnPropertyNames(R.patternProperties)[0],Y=new RegExp(Z),E=Object.getOwnPropertyNames(C).reduce((W,fe)=>Y.test(fe)?{...W,[fe]:q(R.patternProperties[Z],P,W[fe])}:W,C);if(!i.TypeGuard.TSchema(R.additionalProperties))return k(R,E);let K=Object.getOwnPropertyNames(E),te=R.additionalProperties,G=K.reduce((W,fe)=>Y.test(fe)?W:{...W,[fe]:k(te,W[fe])},E);return k(R,G)}function H(R,P,C){let Z=(0,r.Deref)(R,P);return k(R,q(Z,P,C))}function se(R,P,C){let Z=(0,r.Deref)(R,P);return k(R,q(Z,P,C))}function z(R,P,C){return(0,t.IsArray)(C)&&(0,t.IsArray)(R.items)?k(R,R.items.map((Z,Y)=>q(Z,P,C[Y]))):k(R,C)}function ue(R,P,C){let Z=k(R,C);for(let Y of R.anyOf)if((0,n.Check)(Y,P,Z))return q(Y,P,Z);return Z}function q(R,P,C){let Z=typeof R.$id=="string"?[...P,R]:P,Y=R;switch(R[i.Kind]){case"Array":return F(Y,Z,C);case"Intersect":return Q(Y,Z,C);case"Not":return ae(Y,Z,C);case"Object":return B(Y,Z,C);case"Record":return V(Y,Z,C);case"Ref":return H(Y,Z,C);case"Symbol":return k(Y,C);case"This":return se(Y,Z,C);case"Tuple":return z(Y,Z,C);case"Union":return ue(Y,Z,C);default:return k(Y,C)}}function pe(R,P,C){return q(R,P,C)}M.Decode=pe})(y||(e.DecodeTransform=y={}));var g;(function(M){function k(R,P){try{return i.TypeGuard.TTransform(R)?R[i.Transform].Encode(P):P}catch(C){throw new l(R,P,C)}}function F(R,P,C){let Z=k(R,C);return(0,t.IsArray)(Z)?Z.map(Y=>q(R.items,P,Y)):Z}function Q(R,P,C){let Z=k(R,C);if(!(0,t.IsPlainObject)(C)||(0,t.IsValueType)(C))return Z;let Y=i.KeyResolver.ResolveKeys(R,{includePatterns:!1}),E=Y.reduce((G,W)=>W in Z?{...G,[W]:q(i.IndexedAccessor.Resolve(R,[W]),P,G[W])}:G,Z);if(!i.TypeGuard.TTransform(R.unevaluatedProperties))return k(R,E);let K=Object.getOwnPropertyNames(E),te=R.unevaluatedProperties;return K.reduce((G,W)=>Y.includes(W)?G:{...G,[W]:k(te,G[W])},E)}function ae(R,P,C){return k(R.not,k(R,C))}function B(R,P,C){let Z=k(R,C);if(!(0,t.IsPlainObject)(C))return Z;let Y=i.KeyResolver.ResolveKeys(R,{includePatterns:!1}),E=Y.reduce((G,W)=>W in G?{...G,[W]:q(R.properties[W],P,G[W])}:G,Z);if(!i.TypeGuard.TSchema(R.additionalProperties))return E;let K=Object.getOwnPropertyNames(E),te=R.additionalProperties;return K.reduce((G,W)=>Y.includes(W)?G:{...G,[W]:k(te,G[W])},E)}function V(R,P,C){let Z=k(R,C);if(!(0,t.IsPlainObject)(C))return Z;let Y=Object.getOwnPropertyNames(R.patternProperties)[0],E=new RegExp(Y),K=Object.getOwnPropertyNames(C).reduce((W,fe)=>E.test(fe)?{...W,[fe]:q(R.patternProperties[Y],P,W[fe])}:W,Z);if(!i.TypeGuard.TSchema(R.additionalProperties))return k(R,K);let te=Object.getOwnPropertyNames(K),G=R.additionalProperties;return te.reduce((W,fe)=>E.test(fe)?W:{...W,[fe]:k(G,W[fe])},K)}function H(R,P,C){let Z=(0,r.Deref)(R,P),Y=q(Z,P,C);return k(R,Y)}function se(R,P,C){let Z=(0,r.Deref)(R,P),Y=q(Z,P,C);return k(R,Y)}function z(R,P,C){let Z=k(R,C);return(0,t.IsArray)(R.items)?R.items.map((Y,E)=>q(Y,P,Z[E])):[]}function ue(R,P,C){for(let Z of R.anyOf){if(!(0,n.Check)(Z,P,C))continue;let Y=q(Z,P,C);return k(R,Y)}for(let Z of R.anyOf){let Y=q(Z,P,C);if((0,n.Check)(R,P,Y))return k(R,Y)}return k(R,C)}function q(R,P,C){let Z=typeof R.$id=="string"?[...P,R]:P,Y=R;switch(R[i.Kind]){case"Array":return F(Y,Z,C);case"Intersect":return Q(Y,Z,C);case"Not":return ae(Y,Z,C);case"Object":return B(Y,Z,C);case"Record":return V(Y,Z,C);case"Ref":return H(Y,Z,C);case"This":return se(Y,Z,C);case"Tuple":return z(Y,Z,C);case"Union":return ue(Y,Z,C);default:return k(Y,C)}}function pe(R,P,C){return q(R,P,C)}M.Encode=pe})(g||(e.EncodeTransform=g={}))}),zm=Le(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeCompiler=e.Policy=e.TypeCompilerTypeGuardError=e.TypeCompilerUnknownTypeError=e.TypeCheck=void 0;var t=Fm(),r=dn(),n=go(),i=Bl(),a=mo(),o=ns(),u=Cr(),l=class{constructor(B,V,H,se){this.schema=B,this.references=V,this.checkFunc=H,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 H(ue){return ue===95}B.IsUnderscore=H;function se(ue){return ue>=65&&ue<=90||ue>=97&&ue<=122}B.IsAlpha=se;function z(ue){return ue>=48&&ue<=57}B.IsNumeric=z})(c||(c={}));var y;(function(B){function V(ue){return ue.length===0?!1:c.IsNumeric(ue.charCodeAt(0))}function H(ue){if(V(ue))return!1;for(let q=0;q<ue.length;q++){let pe=ue.charCodeAt(q);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 z(ue,q){return H(q)?`${ue}.${q}`:`${ue}['${se(q)}']`}B.Encode=z})(y||(y={}));var g;(function(B){function V(H){let se=[];for(let z=0;z<H.length;z++){let ue=H.charCodeAt(z);c.IsNumeric(ue)||c.IsAlpha(ue)?se.push(H.charAt(z)):se.push(`_${ue}_`)}return se.join("").replace(/__/g,"_")}B.Encode=V})(g||(g={}));var M;(function(B){function V(H){return H.replace(/'/g,"\\'")}B.Escape=V})(M||(M={}));var k=class extends u.TypeBoxError{constructor(B){super("Unknown type"),this.schema=B}};e.TypeCompilerUnknownTypeError=k;var F=class extends u.TypeBoxError{constructor(B){super("Preflight validation check failed to guard for the given schema"),this.schema=B}};e.TypeCompilerTypeGuardError=F;var Q;(function(B){function V(q,pe,R){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${pe}' in ${q} ? ${R} : true)`:`(${y.Encode(q,pe)} !== undefined ? ${R} : true)`}B.IsExactOptionalProperty=V;function H(q){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${q} === 'object' && ${q} !== null)`:`(typeof ${q} === 'object' && ${q} !== null && !Array.isArray(${q}))`}B.IsObjectLike=H;function se(q){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${q} === 'object' && ${q} !== null && !(${q} instanceof Date) && !(${q} instanceof Uint8Array))`:`(typeof ${q} === 'object' && ${q} !== null && !Array.isArray(${q}) && !(${q} instanceof Date) && !(${q} instanceof Uint8Array))`}B.IsRecordLike=se;function z(q){return i.TypeSystemPolicy.AllowNaN?`typeof ${q} === 'number'`:`(typeof ${q} === 'number' && Number.isFinite(${q}))`}B.IsNumberLike=z;function ue(q){return i.TypeSystemPolicy.AllowNullVoid?`(${q} === undefined || ${q} === null)`:`${q} === undefined`}B.IsVoidLike=ue})(Q||(e.Policy=Q={}));var ae;(function(B){function V(T){return T[u.Kind]==="Any"||T[u.Kind]==="Unknown"}function*H(T,le,I){yield"true"}function*se(T,le,I){yield`Array.isArray(${I})`;let[ge,ne]=[Be("value","any"),Be("acc","number")];(0,r.IsNumber)(T.maxItems)&&(yield`${I}.length <= ${T.maxItems}`),(0,r.IsNumber)(T.minItems)&&(yield`${I}.length >= ${T.minItems}`);let de=ee(T.items,le,"value");if(yield`${I}.every((${ge}) => ${de})`,u.TypeGuard.TSchema(T.contains)||(0,r.IsNumber)(T.minContains)||(0,r.IsNumber)(T.maxContains)){let Ie=u.TypeGuard.TSchema(T.contains)?T.contains:u.Type.Never(),Ce=ee(Ie,le,"value"),We=(0,r.IsNumber)(T.minContains)?[`(count >= ${T.minContains})`]:[],qe=(0,r.IsNumber)(T.maxContains)?[`(count <= ${T.maxContains})`]:[],Ye=`const count = value.reduce((${ne}, ${ge}) => ${Ce} ? acc + 1 : acc, 0)`,Kt=["(count > 0)",...We,...qe].join(" && ");yield`((${ge}) => { ${Ye}; return ${Kt}})(${I})`}T.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*z(T,le,I){yield`(typeof value === 'object' && Symbol.asyncIterator in ${I})`}function*ue(T,le,I){yield`(typeof ${I} === 'bigint')`,(0,r.IsBigInt)(T.exclusiveMaximum)&&(yield`${I} < BigInt(${T.exclusiveMaximum})`),(0,r.IsBigInt)(T.exclusiveMinimum)&&(yield`${I} > BigInt(${T.exclusiveMinimum})`),(0,r.IsBigInt)(T.maximum)&&(yield`${I} <= BigInt(${T.maximum})`),(0,r.IsBigInt)(T.minimum)&&(yield`${I} >= BigInt(${T.minimum})`),(0,r.IsBigInt)(T.multipleOf)&&(yield`(${I} % BigInt(${T.multipleOf})) === 0`)}function*q(T,le,I){yield`(typeof ${I} === 'boolean')`}function*pe(T,le,I){yield*D(T.returns,le,`${I}.prototype`)}function*R(T,le,I){yield`(${I} instanceof Date) && Number.isFinite(${I}.getTime())`,(0,r.IsNumber)(T.exclusiveMaximumTimestamp)&&(yield`${I}.getTime() < ${T.exclusiveMaximumTimestamp}`),(0,r.IsNumber)(T.exclusiveMinimumTimestamp)&&(yield`${I}.getTime() > ${T.exclusiveMinimumTimestamp}`),(0,r.IsNumber)(T.maximumTimestamp)&&(yield`${I}.getTime() <= ${T.maximumTimestamp}`),(0,r.IsNumber)(T.minimumTimestamp)&&(yield`${I}.getTime() >= ${T.minimumTimestamp}`),(0,r.IsNumber)(T.multipleOfTimestamp)&&(yield`(${I}.getTime() % ${T.multipleOfTimestamp}) === 0`)}function*P(T,le,I){yield`(typeof ${I} === 'function')`}function*C(T,le,I){yield`(typeof ${I} === 'number' && Number.isInteger(${I}))`,(0,r.IsNumber)(T.exclusiveMaximum)&&(yield`${I} < ${T.exclusiveMaximum}`),(0,r.IsNumber)(T.exclusiveMinimum)&&(yield`${I} > ${T.exclusiveMinimum}`),(0,r.IsNumber)(T.maximum)&&(yield`${I} <= ${T.maximum}`),(0,r.IsNumber)(T.minimum)&&(yield`${I} >= ${T.minimum}`),(0,r.IsNumber)(T.multipleOf)&&(yield`(${I} % ${T.multipleOf}) === 0`)}function*Z(T,le,I){let ge=T.allOf.map(ne=>ee(ne,le,I)).join(" && ");if(T.unevaluatedProperties===!1){let ne=we(`${new RegExp(u.KeyResolver.ResolvePattern(T))};`),de=`Object.getOwnPropertyNames(${I}).every(key => ${ne}.test(key))`;yield`(${ge} && ${de})`}else if(u.TypeGuard.TSchema(T.unevaluatedProperties)){let ne=we(`${new RegExp(u.KeyResolver.ResolvePattern(T))};`),de=`Object.getOwnPropertyNames(${I}).every(key => ${ne}.test(key) || ${ee(T.unevaluatedProperties,le,`${I}[key]`)})`;yield`(${ge} && ${de})`}else yield`(${ge})`}function*Y(T,le,I){yield`(typeof value === 'object' && Symbol.iterator in ${I})`}function*E(T,le,I){typeof T.const=="number"||typeof T.const=="boolean"?yield`(${I} === ${T.const})`:yield`(${I} === '${M.Escape(T.const)}')`}function*K(T,le,I){yield"false"}function*te(T,le,I){yield`(!${ee(T.not,le,I)})`}function*G(T,le,I){yield`(${I} === null)`}function*W(T,le,I){yield Q.IsNumberLike(I),(0,r.IsNumber)(T.exclusiveMaximum)&&(yield`${I} < ${T.exclusiveMaximum}`),(0,r.IsNumber)(T.exclusiveMinimum)&&(yield`${I} > ${T.exclusiveMinimum}`),(0,r.IsNumber)(T.maximum)&&(yield`${I} <= ${T.maximum}`),(0,r.IsNumber)(T.minimum)&&(yield`${I} >= ${T.minimum}`),(0,r.IsNumber)(T.multipleOf)&&(yield`(${I} % ${T.multipleOf}) === 0`)}function*fe(T,le,I){yield Q.IsObjectLike(I),(0,r.IsNumber)(T.minProperties)&&(yield`Object.getOwnPropertyNames(${I}).length >= ${T.minProperties}`),(0,r.IsNumber)(T.maxProperties)&&(yield`Object.getOwnPropertyNames(${I}).length <= ${T.maxProperties}`);let ge=Object.getOwnPropertyNames(T.properties);for(let ne of ge){let de=y.Encode(I,ne),Ie=T.properties[ne];if(T.required&&T.required.includes(ne))yield*D(Ie,le,de),(u.ExtendsUndefined.Check(Ie)||V(Ie))&&(yield`('${ne}' in ${I})`);else{let Ce=ee(Ie,le,de);yield Q.IsExactOptionalProperty(I,ne,Ce)}}if(T.additionalProperties===!1)if(T.required&&T.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 T.additionalProperties=="object"){let ne=ee(T.additionalProperties,le,`${I}[key]`),de=`[${ge.map(Ie=>`'${Ie}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${I}).every(key => ${de}.includes(key) || ${ne}))`}}function*f(T,le,I){yield`(typeof value === 'object' && typeof ${I}.then === 'function')`}function*_(T,le,I){yield Q.IsRecordLike(I),(0,r.IsNumber)(T.minProperties)&&(yield`Object.getOwnPropertyNames(${I}).length >= ${T.minProperties}`),(0,r.IsNumber)(T.maxProperties)&&(yield`Object.getOwnPropertyNames(${I}).length <= ${T.maxProperties}`);let[ge,ne]=Object.entries(T.patternProperties)[0],de=we(`${new RegExp(ge)}`),Ie=ee(ne,le,"value"),Ce=u.TypeGuard.TSchema(T.additionalProperties)?ee(T.additionalProperties,le,I):T.additionalProperties===!1?"false":"true",We=`(${de}.test(key) ? ${Ie} : ${Ce})`;yield`(Object.entries(${I}).every(([key, value]) => ${We}))`}function*O(T,le,I){let ge=(0,a.Deref)(T,le);if(J.functions.has(T.$ref))return yield`${ye(T.$ref)}(${I})`;yield*D(ge,le,I)}function*U(T,le,I){yield`(typeof ${I} === 'string')`,(0,r.IsNumber)(T.maxLength)&&(yield`${I}.length <= ${T.maxLength}`),(0,r.IsNumber)(T.minLength)&&(yield`${I}.length >= ${T.minLength}`),T.pattern!==void 0&&(yield`${we(`${new RegExp(T.pattern)};`)}.test(${I})`),T.format!==void 0&&(yield`format('${T.format}', ${I})`)}function*S(T,le,I){yield`(typeof ${I} === 'symbol')`}function*$(T,le,I){yield`(typeof ${I} === 'string')`,yield`${we(`${new RegExp(T.pattern)};`)}.test(${I})`}function*h(T,le,I){yield`${ye(T.$ref)}(${I})`}function*A(T,le,I){if(yield`Array.isArray(${I})`,T.items===void 0)return yield`${I}.length === 0`;yield`(${I}.length === ${T.maxItems})`;for(let ge=0;ge<T.items.length;ge++)yield`${ee(T.items[ge],le,`${I}[${ge}]`)}`}function*w(T,le,I){yield`${I} === undefined`}function*s(T,le,I){yield`(${T.anyOf.map(ge=>ee(ge,le,I)).join(" || ")})`}function*x(T,le,I){yield`${I} instanceof Uint8Array`,(0,r.IsNumber)(T.maxByteLength)&&(yield`(${I}.length <= ${T.maxByteLength})`),(0,r.IsNumber)(T.minByteLength)&&(yield`(${I}.length >= ${T.minByteLength})`)}function*b(T,le,I){yield"true"}function*v(T,le,I){yield Q.IsVoidLike(I)}function*N(T,le,I){let ge=J.instances.size;J.instances.set(ge,T),yield`kind('${T[u.Kind]}', ${ge}, ${I})`}function*D(T,le,I,ge=!0){let ne=(0,r.IsString)(T.$id)?[...le,T]:le,de=T;if(ge&&(0,r.IsString)(T.$id)){let Ie=ye(T.$id);if(J.functions.has(Ie))return yield`${Ie}(${I})`;{let Ce=Ne(Ie,T,le,"value",!1);return J.functions.set(Ie,Ce),yield`${Ie}(${I})`}}switch(de[u.Kind]){case"Any":return yield*H(de,ne,I);case"Array":return yield*se(de,ne,I);case"AsyncIterator":return yield*z(de,ne,I);case"BigInt":return yield*ue(de,ne,I);case"Boolean":return yield*q(de,ne,I);case"Constructor":return yield*pe(de,ne,I);case"Date":return yield*R(de,ne,I);case"Function":return yield*P(de,ne,I);case"Integer":return yield*C(de,ne,I);case"Intersect":return yield*Z(de,ne,I);case"Iterator":return yield*Y(de,ne,I);case"Literal":return yield*E(de,ne,I);case"Never":return yield*K(de,ne,I);case"Not":return yield*te(de,ne,I);case"Null":return yield*G(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*O(de,ne,I);case"String":return yield*U(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*x(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 k(T);return yield*N(de,ne,I)}}let J={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function ee(T,le,I,ge=!0){return`(${[...D(T,le,I,ge)].join(" && ")})`}function ye(T){return`check_${g.Encode(T)}`}function we(T){let le=`local_${J.variables.size}`;return J.variables.set(le,`const ${le} = ${T}`),le}function Ne(T,le,I,ge,ne=!0){let[de,Ie]=[`
|
|
21
|
+
`,Ye=>"".padStart(Ye," ")],Ce=Be("value","any"),We=hr("boolean"),qe=[...D(le,I,ge,ne)].map(Ye=>`${Ie(4)}${Ye}`).join(` &&${de}`);return`function ${T}(${Ce})${We} {${de}${Ie(2)}return (${de}${qe}${de}${Ie(2)})
|
|
22
|
+
}`}function Be(T,le){let I=J.language==="typescript"?`: ${le}`:"";return`${T}${I}`}function hr(T){return J.language==="typescript"?`: ${T}`:""}function be(T,le,I){let ge=Ne("check",T,le,"value"),ne=Be("value","any"),de=hr("boolean"),Ie=[...J.functions.values()],Ce=[...J.variables.values()],We=(0,r.IsString)(T.$id)?`return function check(${ne})${de} {
|
|
23
|
+
return ${ye(T.$id)}(value)
|
|
24
|
+
}`:`return ${ge}`;return[...Ce,...Ie,We].join(`
|
|
25
|
+
`)}function qt(...T){let le={language:"javascript"},[I,ge,ne]=T.length===2&&(0,r.IsArray)(T[1])?[T[0],T[1],le]:T.length===2&&!(0,r.IsArray)(T[1])?[T[0],[],T[1]]:T.length===3?[T[0],T[1],T[2]]:T.length===1?[T[0],[],le]:[null,[],le];if(J.language=ne.language,J.variables.clear(),J.functions.clear(),J.instances.clear(),!u.TypeGuard.TSchema(I))throw new F(I);for(let de of ge)if(!u.TypeGuard.TSchema(de))throw new F(de);return be(I,ge,ne)}B.Code=qt;function yr(T,le=[]){let I=qt(T,le,{language:"javascript"}),ge=globalThis.Function("kind","format","hash",I),ne=new Map(J.instances);function de(qe,Ye,Kt){if(!u.TypeRegistry.Has(qe)||!ne.has(Ye))return!1;let zr=u.TypeRegistry.Get(qe),qr=ne.get(Ye);return zr(qr,Kt)}function Ie(qe,Ye){return u.FormatRegistry.Has(qe)?u.FormatRegistry.Get(qe)(Ye):!1}function Ce(qe){return(0,o.Hash)(qe)}let We=ge(de,Ie,Ce);return new l(T,le,We,I)}B.Compile=yr})(ae||(e.TypeCompiler=ae={}))}),qm=Le(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=Lm();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return n.ValueErrorIterator}}),r(zm(),e)});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 Km={};function is(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:Km}var Cl=Object.assign,io=Object.getOwnPropertyDescriptor,Nt=Object.defineProperty,ri=Object.prototype,Da=[];Object.freeze(Da);var os={};Object.freeze(os);var Gm=typeof Proxy<"u",Hm=Object.toString();function Rl(){Gm||_e("Proxy not available")}function Ml(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var on=function(){};function At(e){return typeof e=="function"}function $r(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function vo(e){return e!==null&&typeof e=="object"}function ur(e){if(!vo(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()===Hm}function Dl(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function bo(e,t,r){Nt(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function Ll(e,t,r){Nt(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function fr(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(n){return vo(n)&&n[r]===!0}}function pn(e){return e instanceof Map}function ni(e){return e instanceof Set}var Vl=typeof Object.getOwnPropertySymbols<"u";function Wm(e){var t=Object.keys(e);if(!Vl)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return ri.propertyIsEnumerable.call(e,n)})):t}var wo=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Vl?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Fl(e){return e===null?null:typeof e=="object"?""+e:e}function Dt(e,t){return ri.hasOwnProperty.call(e,t)}var Jm=Object.getOwnPropertyDescriptors||function(e){var t={};return wo(e).forEach(function(r){t[r]=io(e,r)}),t};function zc(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,Zm(n.key),n)}}function as(e,t,r){return t&&zc(e.prototype,t),r&&zc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function kr(){return kr=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},kr.apply(this,arguments)}function zl(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,La(e,t)}function La(e,t){return La=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},La(e,t)}function Ua(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ym(e,t){if(e){if(typeof e=="string")return qc(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 qc(e,t)}}function qc(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 an(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=Ym(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.
|
|
26
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xm(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 Zm(e){var t=Xm(e,"string");return typeof t=="symbol"?t:String(t)}var kt=Symbol("mobx-stored-annotations");function jt(e){function t(r,n){if(ii(n))return e.decorate_20223_(r,n);hn(r,n,e)}return Object.assign(t,e)}function hn(e,t,r){if(Dt(e,kt)||bo(e,kt,kr({},e[kt])),0)var n;Qm(e,r,t),ug(r)||(e[kt][t]=r)}function Qm(e,t,r){if(0)var n,i,a}function eg(e){return Dt(e,kt)||bo(e,kt,kr({},e[kt])),e[kt]}function ii(e){return typeof e=="object"&&typeof e.kind=="string"}var me=Symbol("mobx administration"),oi=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_=Oe.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 uf(this)},t.reportChanged=function(){yt(),cf(this),mt()},t.toString=function(){return this.name_},e}(),ss=fr("Atom",oi);function ql(e,t,r){t===void 0&&(t=on),r===void 0&&(r=on);var n=new oi(e);return t!==on&&gf(n,t),r!==on&&ci(n,r),n}function tg(e,t){return e===t}function rg(e,t){return ps(e,t)}function ng(e,t){return ps(e,t,1)}function ig(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Qe={identity:tg,structural:rg,default:ig,shallow:ng};function yn(e,t,r){return ls(e)?e:Array.isArray(e)?Pe.array(e,{name:r}):ur(e)?Pe.object(e,void 0,{name:r}):pn(e)?Pe.map(e,{name:r}):ni(e)?Pe.set(e,{name:r}):typeof e=="function"&&!ui(e)&&!Yn(e)?Dl(e)?cn(e):Jn(r,e):e}function og(e,t,r){if(e==null||ln(e)||di(e)||dr(e)||Mr(e))return e;if(Array.isArray(e))return Pe.array(e,{name:r,deep:!1});if(ur(e))return Pe.object(e,void 0,{name:r,deep:!1});if(pn(e))return Pe.map(e,{name:r,deep:!1});if(ni(e))return Pe.set(e,{name:r,deep:!1})}function _o(e){return e}function ag(e,t){return ps(e,t)?t:e}var sg="override";function ug(e){return e.annotationType_===sg}function ai(e,t){return{annotationType_:e,options_:t,make_:cg,extend_:lg,decorate_20223_:fg}}function cg(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(ui(r.value))return 1;var a=Kl(e,this,t,r,!1);return Nt(n,t,a),2}function lg(e,t,r,n){var i=Kl(e,this,t,r);return e.defineProperty_(t,i,n)}function fg(e,t){var r=t.kind,n=t.name,i=t.addInitializer,a=this,o=function(l){var c,y,g,M;return Ur((c=(y=a.options_)==null?void 0:y.name)!=null?c:n.toString(),l,(g=(M=a.options_)==null?void 0:M.autoAction)!=null?g:!1)};if(r=="field"){i(function(){hn(this,n,a)});return}if(r=="method"){var u;return ui(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+"):"+(`
|
|
27
|
+
'`+a.annotationType_+"' can only be used on properties with a function value."))}function dg(e,t,r,n){var i=t.annotationType_,a=n.value}function Kl(e,t,r,n,i){var a,o,u,l,c,y,g;i===void 0&&(i=re.safeDescriptors),dg(e,t,r,n);var M=n.value;if((a=t.options_)!=null&&a.bound){var k;M=M.bind((k=e.proxy_)!=null?k:e.target_)}return{value:Ur((o=(u=t.options_)==null?void 0:u.name)!=null?o:r.toString(),M,(l=(c=t.options_)==null?void 0:c.autoAction)!=null?l:!1,(y=t.options_)!=null&&y.bound?(g=e.proxy_)!=null?g:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function Gl(e,t){return{annotationType_:e,options_:t,make_:pg,extend_:hg,decorate_20223_:yg}}function pg(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&&(!Dt(e.target_,t)||!Yn(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(Yn(r.value))return 1;var a=Hl(e,this,t,r,!1,!1);return Nt(n,t,a),2}function hg(e,t,r,n){var i,a=Hl(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,a,n)}function yg(e,t){var r,n=t.name,i=t.addInitializer;return Yn(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 mg(e,t,r,n){var i=t.annotationType_,a=n.value}function Hl(e,t,r,n,i,a){a===void 0&&(a=re.safeDescriptors),mg(e,t,r,n);var o=n.value;if(Yn(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 us(e,t){return{annotationType_:e,options_:t,make_:gg,extend_:vg,decorate_20223_:bg}}function gg(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function vg(e,t,r,n){return wg(e,this,t,r),e.defineComputedProperty_(t,kr({},this.options_,{get:r.get,set:r.set}),n)}function bg(e,t){var r=this,n=t.name,i=t.addInitializer;return i(function(){var a=gn(this)[me],o=kr({},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 wg(e,t,r,n){var i=t.annotationType_,a=n.get}function xo(e,t){return{annotationType_:e,options_:t,make_:_g,extend_:xg,decorate_20223_:Tg}}function _g(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function xg(e,t,r,n){var i,a;return Eg(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(a=this.options_)==null?void 0:a.enhancer)!=null?i:yn,n)}function Tg(e,t){var r=this,n=t.kind,i=t.name,a=new WeakSet;function o(u,l){var c,y,g=gn(u)[me],M=new sr(l,(c=(y=r.options_)==null?void 0:y.enhancer)!=null?c:yn,"ObservableObject."+i.toString(),!1);g.values_.set(i,M),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 Eg(e,t,r,n){var i=t.annotationType_}var Og="true",Ag=Wl();function Wl(e){return{annotationType_:Og,options_:e,make_:Ig,extend_:Sg,decorate_20223_:$g}}function Ig(e,t,r,n){var i,a;if(r.get)return He.make_(e,t,r,n);if(r.set){var o=Ur(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:re.safeDescriptors?e.isPlainObject_:!0,set:o})===null?0:2:(Nt(n,t,{configurable:!0,set:o}),2)}if(n!==e.target_&&typeof r.value=="function"){var u;if(Dl(r.value)){var l,c=(l=this.options_)!=null&&l.autoBind?cn.bound:cn;return c.make_(e,t,r,n)}var y=(u=this.options_)!=null&&u.autoBind?Jn.bound:Jn;return y.make_(e,t,r,n)}var g=((i=this.options_)==null?void 0:i.deep)===!1?Pe.ref:Pe;if(typeof r.value=="function"&&(a=this.options_)!=null&&a.autoBind){var M;r.value=r.value.bind((M=e.proxy_)!=null?M:e.target_)}return g.make_(e,t,r,n)}function Sg(e,t,r,n){var i,a;if(r.get)return He.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:re.safeDescriptors?e.isPlainObject_:!0,set:Ur(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?Pe.ref:Pe;return u.extend_(e,t,r,n)}function $g(e,t){_e("'"+this.annotationType_+"' cannot be used as a decorator")}var kg="observable",Ug="observable.ref",Ng="observable.shallow",jg="observable.struct",Jl={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Jl);function Ji(e){return e||Jl}var Va=xo(kg),Pg=xo(Ug,{enhancer:_o}),Bg=xo(Ng,{enhancer:og}),Cg=xo(jg,{enhancer:ag}),Yl=jt(Va);function Yi(e){return e.deep===!0?yn:e.deep===!1?_o:Mg(e.defaultDecorator)}function Rg(e){var t;return e?(t=e.defaultDecorator)!=null?t:Wl(e):void 0}function Mg(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:yn}function Xl(e,t,r){if(ii(t))return Va.decorate_20223_(e,t);if($r(t)){hn(e,t,Va);return}return ls(e)?e:ur(e)?Pe.object(e,t,r):Array.isArray(e)?Pe.array(e,t):pn(e)?Pe.map(e,t):ni(e)?Pe.set(e,t):typeof e=="object"&&e!==null?e:Pe.box(e,t)}Cl(Xl,Yl);var Dg={box:function(e,t){var r=Ji(t);return new sr(e,Yi(r),r.name,!0,r.equals)},array:function(e,t){var r=Ji(t);return(re.useProxies===!1||r.proxy===!1?Lv:kv)(e,Yi(r),r.name)},map:function(e,t){var r=Ji(t);return new Af(e,Yi(r),r.name)},set:function(e,t){var r=Ji(t);return new $f(e,Yi(r),r.name)},object:function(e,t,r){return Dr(function(){return bv(re.useProxies===!1||r?.proxy===!1?gn({},r):Iv({},r),e,t)})},ref:jt(Pg),shallow:jt(Bg),deep:Yl,struct:jt(Cg)},Pe=Cl(Xl,Dg),Zl="computed",Lg="computed.struct",Fa=us(Zl),Vg=us(Lg,{equals:Qe.structural}),He=function(e,t){if(ii(t))return Fa.decorate_20223_(e,t);if($r(t))return hn(e,t,Fa);if(ur(e))return jt(us(Zl,e));var r=ur(t)?t:{};return r.get=e,r.name||(r.name=e.name||""),new un(r)};Object.assign(He,Fa);He.struct=jt(Vg);var Kc,Gc,oo=0,Fg=1,zg=(Kc=(Gc=io(function(){},"name"))==null?void 0:Gc.configurable)!=null?Kc:!1,Hc={value:"action",configurable:!0,writable:!1,enumerable:!1};function Ur(e,t,r,n){r===void 0&&(r=!1);function i(){return Ql(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},zg&&(Hc.value=e,Nt(i,"name",Hc)),i}function Ql(e,t,r,n,i){var a=qg(e,t,n,i);try{return r.apply(n,i)}catch(o){throw a.error_=o,o}finally{Kg(a)}}function qg(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&&(Rr(),c=To(!0));var y=cs(!0),g={runAsAction_:l,prevDerivation_:u,prevAllowStateChanges_:c,prevAllowStateReads_:y,notifySpy_:i,startTime_:a,actionId_:Fg++,parentActionId_:oo};return oo=g.actionId_,g}function Kg(e){oo!==e.actionId_&&_e(30),oo=e.parentActionId_,e.error_!==void 0&&(re.suppressReactionErrors=!0),Eo(e.prevAllowStateChanges_),Gn(e.prevAllowStateReads_),mt(),e.runAsAction_&&Lt(e.prevDerivation_),re.suppressReactionErrors=!1}function Gg(e,t){var r=To(e);try{return t()}finally{Eo(r)}}function To(e){var t=re.allowStateChanges;return re.allowStateChanges=e,t}function Eo(e){re.allowStateChanges=e}var ef;ef=Symbol.toPrimitive;var sr=function(e){zl(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=Qe.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(Ut(this),pt(this)){var i=ht(this,{object:this,type:Pt,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(),Et(this)&&Ot(this,{type:Pt,object:this,newValue:n,oldValue:i})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(n){return li(this,n)},r.observe_=function(n,i){return i&&n({observableKind:"value",debugObjectName:this.name_,object:this,type:Pt,newValue:this.value_,oldValue:void 0}),fi(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 Fl(this.get())},r[ef]=function(){return this.valueOf()},t}(oi),Hg=fr("ObservableValue",sr),tf;tf=Symbol.toPrimitive;var un=function(){function e(r){this.dependenciesState_=Oe.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_=Oe.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new so(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_=ao.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_=Ur("ComputedValue-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?Qe.structural:Qe.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){rv(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_)za(this)&&(this.warnAboutUntrackedRead_(),yt(),this.value_=this.computeValue_(!1),mt());else if(uf(this),za(this)){var r=re.trackingContext;this.keepAlive_&&!r&&(re.trackingContext=this),this.trackAndCompute()&&tv(this),re.trackingContext=r}var n=this.value_;if(eo(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_===Oe.NOT_TRACKING_,i=this.computeValue_(!0),a=n||eo(r)||eo(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=rf(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 so(a)}return Eo(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 Nr(function(){var u=i.get();if(!a||n){var l=Rr();r({observableKind:"computed",debugObjectName:i.name_,type:Pt,object:i,newValue:u,oldValue:o}),Lt(l)}a=!1,o=u})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return Fl(this.get())},t[tf]=function(){return this.valueOf()},e}(),si=fr("ComputedValue",un),Oe;(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_"})(Oe||(Oe={}));var ao;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(ao||(ao={}));var so=function(e){this.cause=void 0,this.cause=e};function eo(e){return e instanceof so}function za(e){switch(e.dependenciesState_){case Oe.UP_TO_DATE_:return!1;case Oe.NOT_TRACKING_:case Oe.STALE_:return!0;case Oe.POSSIBLY_STALE_:{for(var t=cs(!0),r=Rr(),n=e.observing_,i=n.length,a=0;a<i;a++){var o=n[a];if(si(o)){if(re.disableErrorBoundaries)o.get();else try{o.get()}catch{return Lt(r),Gn(t),!0}if(e.dependenciesState_===Oe.STALE_)return Lt(r),Gn(t),!0}}return nf(e),Lt(r),Gn(t),!1}}}function Wg(){return re.trackingDerivation!==null}function Ut(e){return;var t}function rf(e,t,r){var n=cs(!0);nf(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 so(o)}return re.inBatch--,re.trackingDerivation=i,Jg(e),Gn(n),a}function Jg(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=Oe.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&&af(l,e),l.diffValue_=0}for(;i--;){var c=r[i];c.diffValue_===1&&(c.diffValue_=0,ev(c,e))}n!==Oe.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function qa(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)af(t[r],e);e.dependenciesState_=Oe.NOT_TRACKING_}function Re(e){var t=Rr();try{return e()}finally{Lt(t)}}function Rr(){var e=re.trackingDerivation;return re.trackingDerivation=null,e}function Lt(e){re.trackingDerivation=e}function cs(e){var t=re.allowStateReads;return re.allowStateReads=e,t}function Gn(e){re.allowStateReads=e}function nf(e){if(e.dependenciesState_!==Oe.UP_TO_DATE_){e.dependenciesState_=Oe.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Oe.UP_TO_DATE_}}var to=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},ro=!0,of=!1,re=function(){var e=is();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ro=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new to().version&&(ro=!1),ro?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new to):(setTimeout(function(){of||_e(35)},1),new to)}();function Yg(){if((re.pendingReactions.length||re.inBatch||re.isRunningReactions)&&_e(36),of=!0,ro){var e=is();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),re=new to}}function Xg(){return re}function Zg(e){return e.observers_&&e.observers_.size>0}function Qg(e){return e.observers_}function ev(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function af(e,t){e.observers_.delete(t),e.observers_.size===0&&sf(e)}function sf(e){e.isPendingUnobservation_===!1&&(e.isPendingUnobservation_=!0,re.pendingUnobservations.push(e))}function yt(){re.inBatch++}function mt(){if(--re.inBatch===0){lf();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 uf(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&&sf(e),!1)}function cf(e){e.lowestObserverState_!==Oe.STALE_&&(e.lowestObserverState_=Oe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Oe.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=Oe.STALE_}))}function tv(e){e.lowestObserverState_!==Oe.STALE_&&(e.lowestObserverState_=Oe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Oe.POSSIBLY_STALE_?t.dependenciesState_=Oe.STALE_:t.dependenciesState_===Oe.UP_TO_DATE_&&(e.lowestObserverState_=Oe.UP_TO_DATE_)}))}function rv(e){e.lowestObserverState_===Oe.UP_TO_DATE_&&(e.lowestObserverState_=Oe.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Oe.UP_TO_DATE_&&(t.dependenciesState_=Oe.POSSIBLY_STALE_,t.onBecomeStale_())}))}var Wn=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_=Oe.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_=ao.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),lf())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){yt(),this.isScheduled_=!1;var r=re.trackingContext;if(re.trackingContext=this,za(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=rf(this,r,void 0);re.trackingContext=a,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&qa(this),eo(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),xf(this,r)},e}(),nv=100,Ka=function(e){return e()};function lf(){re.inBatch>0||re.isRunningReactions||Ka(iv)}function iv(){re.isRunningReactions=!0;for(var e=re.pendingReactions,t=0;e.length>0;){++t===nv&&(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 uo=fr("Reaction",Wn);function ov(e){var t=Ka;Ka=function(r){return e(function(){return t(r)})}}function Sr(){return!1}function ff(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var df="action",av="action.bound",pf="autoAction",sv="autoAction.bound",hf="<unnamed action>",Ga=ai(df),uv=ai(av,{bound:!0}),Ha=ai(pf,{autoAction:!0}),cv=ai(sv,{autoAction:!0,bound:!0});function yf(e){var t=function(r,n){if(At(r))return Ur(r.name||hf,r,e);if(At(n))return Ur(r,n,e);if(ii(n))return(e?Ha:Ga).decorate_20223_(r,n);if($r(n))return hn(r,n,e?Ha:Ga);if($r(r))return jt(ai(e?pf:df,{name:r,autoAction:e}))};return t}var Tt=yf(!1);Object.assign(Tt,Ga);var Jn=yf(!0);Object.assign(Jn,Ha);Tt.bound=jt(uv);Jn.bound=jt(cv);function lv(e){return Ql(e.name||hf,!1,e,this,void 0)}function ui(e){return At(e)&&e.isMobxAction===!0}function Nr(e,t){var r,n,i,a,o;t===void 0&&(t=os);var u=(r=(n=t)==null?void 0:n.name)!=null?r:"Autorun",l=!t.scheduler&&!t.delay,c;if(l)c=new Wn(u,function(){this.track(M)},t.onError,t.requiresObservable);else{var y=mf(t),g=!1;c=new Wn(u,function(){g||(g=!0,y(function(){g=!1,c.isDisposed_||c.track(M)}))},t.onError,t.requiresObservable)}function M(){e(c)}return(i=t)!=null&&(a=i.signal)!=null&&a.aborted||c.schedule_(),c.getDisposer_((o=t)==null?void 0:o.signal)}var fv=function(e){return e()};function mf(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:fv}function dv(e,t,r){var n,i,a,o;r===void 0&&(r=os);var u=(n=r.name)!=null?n:"Reaction",l=Tt(u,r.onError?pv(r.onError,t):t),c=!r.scheduler&&!r.delay,y=mf(r),g=!0,M=!1,k,F,Q=r.compareStructural?Qe.structural:r.equals||Qe.default,ae=new Wn(u,function(){g||c?B():M||(M=!0,y(B))},r.onError,r.requiresObservable);function B(){if(M=!1,!ae.isDisposed_){var V=!1;ae.track(function(){var H=Gg(!1,function(){return e(ae)});V=g||!Q(k,H),F=k,k=H}),(g&&r.fireImmediately||!g&&V)&&l(k,F,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 pv(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var hv="onBO",yv="onBUO";function gf(e,t,r){return vf(hv,e,t,r)}function ci(e,t,r){return vf(yv,e,t,r)}function vf(e,t,r,n){var i=typeof n=="function"?cr(t,r):cr(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 mv="never",Xi="always",gv="observed";function vv(e){e.isolateGlobalState===!0&&Yg();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(re.useProxies=t===Xi?!0:t===mv?!1:typeof Proxy<"u"),t==="ifavailable"&&(re.verifyProxies=!0),r!==void 0){var n=r===Xi?Xi:r===gv;re.enforceActions=n,re.allowStateChanges=!(n===!0||n===Xi)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(re[i]=!!e[i])}),re.allowStateReads=!re.observableRequiresReaction,e.reactionScheduler&&ov(e.reactionScheduler)}function bv(e,t,r,n){var i=Jm(t);return Dr(function(){var a=gn(e,n)[me];wo(i).forEach(function(o){a.extend_(o,i[o],r&&o in r?r[o]:!0)})}),e}function Oo(e,t){return bf(cr(e,t))}function bf(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=_v(e.observing_).map(bf)),t}function wv(e,t){return wf(cr(e,t))}function wf(e){var t={name:e.name_};return Zg(e)&&(t.observers=Array.from(Qg(e)).map(wf)),t}function _v(e){return Array.from(new Set(e))}var xv=0;function _f(){this.message="FLOW_CANCELLED"}_f.prototype=Object.create(Error.prototype);var Na=Gl("flow"),Tv=Gl("flow.bound",{bound:!0}),cn=Object.assign(function(e,t){if(ii(t))return Na.decorate_20223_(e,t);if($r(t))return hn(e,t,Na);var r=e,n=r.name||"<unnamed flow>",i=function(){var a=this,o=arguments,u=++xv,l=Tt(n+" - runid: "+u+" - init",r).apply(a,o),c,y=void 0,g=new Promise(function(M,k){var F=0;c=k;function Q(V){y=void 0;var H;try{H=Tt(n+" - runid: "+u+" - yield "+F++,l.next).call(l,V)}catch(se){return k(se)}B(H)}function ae(V){y=void 0;var H;try{H=Tt(n+" - runid: "+u+" - yield "+F++,l.throw).call(l,V)}catch(se){return k(se)}B(H)}function B(V){if(At(V?.then)){V.then(B,k);return}return V.done?M(V.value):(y=Promise.resolve(V.value),y.then(Q,ae))}Q(void 0)});return g.cancel=Tt(n+" - runid: "+u+" - cancel",function(){try{y&&Wc(y);var M=l.return(void 0),k=Promise.resolve(M.value);k.then(on,on),Wc(k),c(new _f)}catch(F){c(F)}}),g};return i.isMobXFlow=!0,i},Na);cn.bound=jt(Tv);function Wc(e){At(e.cancel)&&e.cancel()}function Yn(e){return e?.isMobXFlow===!0}function Ev(e,t){return e?t!==void 0?ln(e)?e[me].values_.has(t):!1:ln(e)||!!e[me]||ss(e)||uo(e)||si(e):!1}function ls(e){return Ev(e)}function Ov(e){if(ln(e))return e[me].ownKeys_();_e(38)}function Zi(e,t,r){return e.set(t,r),r}function nn(e,t){if(e==null||typeof e!="object"||e instanceof Date||!ls(e))return e;if(Hg(e)||si(e))return nn(e.get(),t);if(t.has(e))return t.get(e);if(di(e)){var r=Zi(t,e,new Array(e.length));return e.forEach(function(o,u){r[u]=nn(o,t)}),r}if(Mr(e)){var n=Zi(t,e,new Set);return e.forEach(function(o){n.add(nn(o,t))}),n}if(dr(e)){var i=Zi(t,e,new Map);return e.forEach(function(o,u){i.set(u,nn(o,t))}),i}else{var a=Zi(t,e,{});return Ov(e).forEach(function(o){ri.propertyIsEnumerable.call(e,o)&&(a[o]=nn(e[o],t))}),a}}function sn(e,t){return nn(e,new Map)}function xf(){return;for(var e,t,r,n;n<t;n++)r[n]=arguments[n];var i}function Mt(e,t){t===void 0&&(t=void 0),yt();try{return e.apply(t)}finally{mt()}}function rn(e){return e[me]}var Av={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,r){var n;return $r(t)?(n=rn(e).set_(t,r,!0))!=null?n:!0:!1},deleteProperty:function(e,t){var r;return $r(t)?(r=rn(e).delete_(t,!0))!=null?r:!0:!1},defineProperty:function(e,t,r){var n;return(n=rn(e).defineProperty_(t,r))!=null?n:!0},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(e){_e(13)}};function Iv(e,t){var r,n;return Rl(),e=gn(e,t),(n=(r=e[me]).proxy_)!=null?n:r.proxy_=new Proxy(e,Av)}function pt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function li(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),Ml(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function ht(e,t){var r=Rr();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{Lt(r)}}function Et(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function fi(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),Ml(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Ot(e,t){var r=Rr(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,a=n.length;i<a;i++)n[i](t);Lt(r)}}function mn(e,t,r){return Dr(function(){var n,i=gn(e,r)[me];(n=t)!=null||(t=eg(e)),wo(t).forEach(function(a){return i.make_(a,t[a])})}),e}var Jc="splice",Pt="update",Sv=1e4,$v={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)):Dt(co,t)?co[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)}},fs=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 oi(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 li(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}),fi(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&&jf(r+n+1)},t.spliceWithArray_=function(r,n,i){var a=this;Ut(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=Da),pt(this)){var u=ht(this,{object:this.proxy_,type:Jc,index:r,removedCount:n,added:i});if(!u)return Da;n=u.removedCount,i=u.added}if(i=i.length===0?i:i.map(function(y){return a.enhancer_(y,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<Sv){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=Et(this),u=o||a?{observableKind:"array",object:this.proxy_,type:Pt,debugObjectName:this.atom_.name_,index:r,newValue:n,oldValue:i}:null;this.atom_.reportChanged(),o&&Ot(this,u)},t.notifyArraySplice_=function(r,n,i){var a=!this.owned_&&Sr(),o=Et(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&&Ot(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){Ut(this.atom_);var a=i[r];if(pt(this)){var o=ht(this,{type:Pt,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 kv(e,t,r,n){return r===void 0&&(r="ObservableArray"),n===void 0&&(n=!1),Rl(),Dr(function(){var i=new fs(r,t,n,!1);Ll(i.values_,me,i);var a=new Proxy(i.values_,$v);return i.proxy_=a,e&&e.length&&i.spliceWithArray_(0,0,e),a})}var co={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",Tf);Ue("reduceRight",Tf);function Ue(e,t){typeof Array.prototype[e]=="function"&&(co[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 Tf(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 Uv=fr("ObservableArrayAdministration",fs);function di(e){return vo(e)&&Uv(e[me])}var Ef,Of,Nv={},ar="add",lo="delete";Ef=Symbol.iterator;Of=Symbol.toStringTag;var Af=function(){function e(r,n,i){var a=this;n===void 0&&(n=yn),i===void 0&&(i="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[me]=Nv,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),Dr(function(){a.keysAtom_=ql("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 sr(this.has_(r),_o,"ObservableMap.key?",!1);this.hasMap_.set(r,a),ci(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?Pt:ar,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(Ut(this.keysAtom_),pt(this)){var i=ht(this,{type:lo,object:this,name:r});if(!i)return!1}if(this.has_(r)){var a=Sr(),o=Et(this),u=o||a?{observableKind:"map",debugObjectName:this.name_,type:lo,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return Mt(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&&Ot(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=Et(this),u=o||a?{observableKind:"map",debugObjectName:this.name_,type:Pt,object:this,oldValue:i.value_,name:r,newValue:n}:null;i.setNewValue_(n),o&&Ot(this,u)}},t.addValue_=function(r,n){var i=this;Ut(this.keysAtom_),Mt(function(){var l,c=new sr(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=Et(this),u=o||a?{observableKind:"map",debugObjectName:this.name_,type:ar,object:this,name:r,newValue:n}:null;o&&Ot(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 Xn({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 Xn({next:function(){var i=n.next(),a=i.done,o=i.value;return{done:a,value:a?void 0:[o,r.get(o)]}}})},t[Ef]=function(){return this.entries()},t.forEach=function(r,n){for(var i=an(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 dr(r)&&(r=new Map(r)),Mt(function(){ur(r)?Wm(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)}):pn(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;Mt(function(){Re(function(){for(var n=an(r.keys()),i;!(i=n()).done;){var a=i.value;r.delete(a)}})})},t.replace=function(r){var n=this;return Mt(function(){for(var i=jv(r),a=new Map,o=!1,u=an(n.data_.keys()),l;!(l=u()).done;){var c=l.value;if(!i.has(c)){var y=n.delete(c);if(y)o=!0;else{var g=n.data_.get(c);a.set(c,g)}}}for(var M=an(i.entries()),k;!(k=M()).done;){var F=k.value,Q=F[0],ae=F[1],B=n.data_.has(Q);if(n.set(Q,ae),n.data_.has(Q)){var V=n.data_.get(Q);a.set(Q,V),B||(o=!0)}}if(!o)if(n.data_.size!==a.size)n.keysAtom_.reportChanged();else for(var H=n.data_.keys(),se=a.keys(),z=H.next(),ue=se.next();!z.done;){if(z.value!==ue.value){n.keysAtom_.reportChanged();break}z=H.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 fi(this,r)},t.intercept_=function(r){return li(this,r)},as(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Of,get:function(){return"Map"}}]),e}(),dr=fr("ObservableMap",Af);function jv(e){if(pn(e)||dr(e))return e;if(Array.isArray(e))return new Map(e);if(ur(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return _e(21,e)}var If,Sf,Pv={};If=Symbol.iterator;Sf=Symbol.toStringTag;var $f=function(){function e(r,n,i){var a=this;n===void 0&&(n=yn),i===void 0&&(i="ObservableSet"),this.name_=void 0,this[me]=Pv,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)},Dr(function(){a.atom_=ql(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;Mt(function(){Re(function(){for(var n=an(r.data_.values()),i;!(i=n()).done;){var a=i.value;r.delete(a)}})})},t.forEach=function(r,n){for(var i=an(this),a;!(a=i()).done;){var o=a.value;r.call(n,o,o,this)}},t.add=function(r){var n=this;if(Ut(this.atom_),pt(this)){var i=ht(this,{type:ar,object:this,newValue:r});if(!i)return this}if(!this.has(r)){Mt(function(){n.data_.add(n.enhancer_(r,void 0)),n.atom_.reportChanged()});var a=!1,o=Et(this),u=o||a?{observableKind:"set",debugObjectName:this.name_,type:ar,object:this,newValue:r}:null;o&&Ot(this,u)}return this},t.delete=function(r){var n=this;if(pt(this)){var i=ht(this,{type:lo,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var a=!1,o=Et(this),u=o||a?{observableKind:"set",debugObjectName:this.name_,type:lo,object:this,oldValue:r}:null;return Mt(function(){n.atom_.reportChanged(),n.data_.delete(r)}),o&&Ot(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 Xn({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 Xn({next:function(){return n<i.length?{value:r.dehanceValue_(i[n++]),done:!1}:{done:!0}}})},t.replace=function(r){var n=this;return Mr(r)&&(r=new Set(r)),Mt(function(){Array.isArray(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):ni(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 fi(this,r)},t.intercept_=function(r){return li(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[If]=function(){return this.values()},as(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Sf,get:function(){return"Set"}}]),e}(),Mr=fr("ObservableSet",$f),Yc=Object.create(null),Xc="remove",kf=function(){function e(r,n,i,a){n===void 0&&(n=new Map),a===void 0&&(a=Ag),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 oi("ObservableObject.keys"),this.isPlainObject_=ur(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:Pt,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=Et(this),u=!1,l=o||u?{type:Pt,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:i.value_,name:r,newValue:n}:null;i.setNewValue_(n),o&&Ot(this,l)}return!0},t.get_=function(r){return re.trackingDerivation&&!Dt(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,n,i){return i===void 0&&(i=!1),Dt(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 sr(r in this.target_,_o,"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_[kt])!=null&&i[r])return;_e(1,n.annotationType_,this.name_+"."+r.toString())}for(var a=this.target_;a&&a!==ri;){var o=io(a,r);if(o){var u=n.make_(this,r,o,a);if(u===0)return;if(u===1)break}a=Object.getPrototypeOf(a)}Qc(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&&Qc(this,i,r),o},t.defineProperty_=function(r,n,i){i===void 0&&(i=!1),Ut(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:ar,newValue:n.value});if(!o)return null;var u=o.newValue;n.value!==u&&(n=kr({},n,{value:u}))}if(i){if(!Reflect.defineProperty(this.target_,r,n))return!1}else Nt(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),Ut(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:ar,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 Nt(this.target_,r,c);var y=new sr(n,i,"ObservableObject.key",!1);this.values_.set(r,y),this.notifyPropertyAddition_(r,y.value_)}finally{mt()}return!0},t.defineComputedProperty_=function(r,n,i){i===void 0&&(i=!1),Ut(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:ar,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 Nt(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),Ut(this.keysAtom_),!Dt(this.target_,r))return!0;if(pt(this)){var i=ht(this,{object:this.proxy_||this.target_,name:r,type:Xc});if(!i)return null}try{var a,o;yt();var u=Et(this),l=!1,c=this.values_.get(r),y=void 0;if(!c&&(u||l)){var g;y=(g=io(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 sr&&(y=c.value_),cf(c)),this.keysAtom_.reportChanged(),(a=this.pendingKeys_)==null||(o=a.get(r))==null||o.set(r in this.target_),u||l){var M={type:Xc,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:y,name:r};u&&Ot(this,M)}}finally{mt()}return!0},t.observe_=function(r,n){return fi(this,r)},t.intercept_=function(r){return li(this,r)},t.notifyPropertyAddition_=function(r,n){var i,a,o=Et(this),u=!1;if(o||u){var l=o||u?{type:ar,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:n}:null;o&&Ot(this,l)}(i=this.pendingKeys_)==null||(a=i.get(r))==null||a.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),wo(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function gn(e,t){var r;if(Dt(e,me))return e;var n=(r=t?.name)!=null?r:"ObservableObject",i=new kf(e,new Map,String(n),Rg(t));return bo(e,me,i),e}var Bv=fr("ObservableObjectAdministration",kf);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 vo(e)?Bv(e[me]):!1}function Qc(e,t,r){var n;(n=e.target_[kt])==null||delete n[r]}function el(e,t,r){if(0)var n,i,a}var Cv=Nf(0),Rv=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),ja=0,Uf=function(){};function Mv(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}Mv(Uf,Array.prototype);var ds=function(e,t,r){zl(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,Dr(function(){var y=new fs(u,o,l,!0);y.proxy_=Ua(c),Ll(Ua(c),me,y),a&&a.length&&c.spliceWithArray(0,0,a),Rv&&Object.defineProperty(Ua(c),"0",Cv)}),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 di(l)?l.slice():l}))},i[r]=function(){var a=this,o=0;return Xn({next:function(){return o<a.length?{value:a[o++],done:!1}:{done:!0,value:void 0}}})},as(n,[{key:"length",get:function(){return this[me].getArrayLength_()},set:function(a){this[me].setArrayLength_(a)}},{key:t,get:function(){return"Array"}}]),n}(Uf,Symbol.toStringTag,Symbol.iterator);Object.entries(co).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&bo(ds.prototype,t,r)});function Nf(e){return{enumerable:!1,configurable:!0,get:function(){return this[me].get_(e)},set:function(t){this[me].set_(e,t)}}}function Dv(e){Nt(ds.prototype,""+e,Nf(e))}function jf(e){if(e>ja){for(var t=ja;t<e+100;t++)Dv(t);ja=e}}jf(1e3);function Lv(e,t,r){return new ds(e,t,r)}function cr(e,t){if(typeof e=="object"&&e!==null){if(di(e))return t!==void 0&&_e(23),e[me].atom_;if(Mr(e))return e.atom_;if(dr(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||_e(25,t,fo(e)),r}if(ln(e)){if(!t)return _e(26);var n=e[me].values_.get(t);return n||_e(27,t,fo(e)),n}if(ss(e)||si(e)||uo(e))return e}else if(At(e)&&uo(e[me]))return e[me];_e(28)}function Pf(e,t){if(e||_e(29),t!==void 0)return Pf(cr(e,t));if(ss(e)||si(e)||uo(e)||dr(e)||Mr(e))return e;if(e[me])return e[me];_e(24,e)}function fo(e,t){var r;if(t!==void 0)r=cr(e,t);else{if(ui(e))return e.name;ln(e)||dr(e)||Mr(e)?r=Pf(e):r=cr(e)}return r.name_}function Dr(e){var t=Rr(),r=To(!0);yt();try{return e()}finally{mt(),Eo(r),Lt(t)}}var tl=ri.toString;function ps(e,t,r){return r===void 0&&(r=-1),Wa(e,t,r)}function Wa(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 y=n.length;y--;)if(n[y]===e)return i[y]===t;if(n.push(e),i.push(t),u){if(y=e.length,y!==t.length)return!1;for(;y--;)if(!Wa(e[y],t[y],r-1,n,i))return!1}else{var g=Object.keys(e),M;if(y=g.length,Object.keys(t).length!==y)return!1;for(;y--;)if(M=g[y],!(Dt(t,M)&&Wa(e[M],t[M],r-1,n,i)))return!1}return n.pop(),i.pop(),!0}function rl(e){return di(e)?e.slice():pn(e)||dr(e)||ni(e)||Mr(e)?Array.from(e.entries()):e}function Xn(e){return e[Symbol.iterator]=Vv,e}function Vv(){return this}["Symbol","Map","Set"].forEach(function(e){var t=is();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:ff,extras:{getDebugName:fo},$mobx:me});function Ja(e){"@babel/helpers - typeof";return Ja=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},Ja(e)}function Bf(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function nl(e){Bf(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||Ja(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 Fv(e,t){Bf(2,arguments);var r=nl(e),n=nl(t);return r.getTime()<n.getTime()}var Cf=nr(Dm(),1),JO=Cf.default.configure,jr=Cf.default,{WARN:YO,LOG:XO,DEBUG:ZO,VERBOSE:il,ERROR:zv}=Ae.setup(Ae.INFO),Rf=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),Mf=(e,t,r="asc")=>Rf(e.ts,t.ts,r);function Pr(e,t="asc"){return e.sort((r,n)=>Mf(r,n,t))}var Df=(e,t)=>Fv(new Date(e.ts),new Date(t.ts));var Lf=(e,t)=>Qe.structural(e,t),hs=e=>{let t=new Map;for(let r of e){if(!r)throw zv("falsy entry in applogs",e),new Error("falsy entry in applogs");t.set(jr(r),r)}return Array.from(t.values())};function Vf(e){return typeof e=="string"&&e.startsWith("?")}function Ff(e){return e.slice(1)}function ys(e,t){let r={};return[Object.entries(e).reduce((n,[i,a])=>{if(Vf(a)){let o=Ff(a),u=t[o];u?n[i]=u:r[i]=o}else n[i]=a;return n},{}),r]}function zf(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 qf=function(e){for(var t=0,r=0,n=e.length;r<n;r++)t+=e[r];return t},ol=function(e){return qf(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:qf,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 Kf(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 Gf(){return new Date().toISOString()}var Pa=100,{WARN:qv,LOG:QO,DEBUG:or,VERBOSE:xt,ERROR:eA}=Ae.setup(Ae.INFO);vv({enforceActions:"always"});if(!new class{xyz}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");var Hf=()=>window.disableSpy=ff(e=>{xt("[mobx]",e)});typeof window=="object"&&(window.getDependencyTree=Oo,window.getObserverTree=wv,window.getAtom=cr,window.getDebugName=fo,window.enableSpy=Hf);xt.isEnabled&&Hf();var Ze=({caller:e,thread:t,pattern:r,args:n})=>(n=n||r,`${t?.name?t.name+" | ":""}${e??"caller?"}${n?`{${typeof n=="string"?n:jr(n)}}`:""}`);function Kv(e,t){return Re(()=>Qe.structural(e.get(),t.get()))}function pi(e,t){return Qe.shallow(e.applogs,t.applogs)}function ms(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(xt("queryNodesComparer",r,n,i),!Qe.structural(n.variables,i.variables)||!pi(n.logsOfThisNode,i.logsOfThisNode))return!1}return!0}var Gv=0;function Ao(e,{name:t,equals:r}={}){let n=`observableArrayMap@${++Gv}{${t}}`;xt(`[${n}] create`,{fnname:e.name,fn:e,name:t,equals:r});let i,a=Hv(e,u=>i=Pe.array(u,{deep:!1,name:t}),u=>{Re(()=>(r??Qe.structural)(i,u))?or(`[${n}] update skipped`,{updatedItems:u,observableArr:i}):(i.replace(u),or(`[${n}] updated`,{updatedItems:u,observableArr:i}))},{name:n}),o=ci(i,()=>{xt(`[${n}] dispose`),a(),o()});return i}function Hv(e,t,r,{name:n}={}){or("[autorunButAlsoImmediately] create",{fnname:e.name,fn:e,name:n});let i=`${n}.autorunImm`,a,o=new Wn(i,(...l)=>{or(`[${i}] reaction.invalidate`,l),u(),lv(()=>{r(a)})});function u(){o.track(()=>{let l=Pa&&performance.now();or(`[${i}] runAndTrack:`,{name:n??e.name,fn:e}),a=e(),or(`[${i}] runAndTrack =>`,a),Pa&&performance.now()-l>Pa&&qv(`[${i}] took ${performance.now()-l}ms`)})}return u(),t(a),or.isEnabled&&or(`[${i}] deps of reaction`,{reaction:o,result:a,deps:Oo(o)}),()=>{o.dispose()}}function et(e,t,r=!1){if(ui(t))throw new Error("computedFnDeepCompare shouldn't be used on actions");let n=!1,i=0,a=typeof r=="boolean"?{keepAlive:r}:r,o=new Map;return function(...u){let l,c=Re(()=>u),y=`computedFnDeepCompare(${e||t.name}#${++i})${a.argsDebugName?`{${a.argsDebugName(...u)}}`:""}`;for(let[k,F]of o.entries())if(Qe.structural(k,c)){l=F;break}if(l){let k=l.get();return xt(`[${y}] cache hit`,{untrackedArgs:c,cachedResult:k}),k}if(!a.keepAlive&&!Wg())return!n&&Xg().computedRequiresReaction&&(console.warn("invoking a computedFn from outside an reactive context won't be memoized, unless keepAlive is set"),n=!0),t.apply(this,u);xt(`[${y}] new computation`,{untrackedArgs:c});let g,M=He(()=>(xt(`[${y}] update->rerun`,Re(()=>({args:u})),t),xt.isDisabled||xf(),g=t.apply(this,u)),{...a,name:y});if(xt(`[${y}] deps`,Oo(M),{untrackedArgs:c}),o.set(c,M),!a.keepAlive){let k=ci(M,()=>{xt(`[${y}] dispose`,M),o.delete(c),a.onCleanup&&a.onCleanup(g,...u),g=void 0,k()})}return M.get()}}function Wv(e){let t=0,r="",n=0;for(let i=0;i<e.length;i++){let a=e[i];a==="("?r+=a+`
|
|
28
|
+
`+" ".repeat(++t):a===")"?r+=`
|
|
29
|
+
`+" ".repeat(--t)+a:a===","&&n===0?r+=a+`
|
|
30
|
+
`+" ".repeat(t):a==="{"&&n===0?(n++,r+=a+`
|
|
31
|
+
`+" ".repeat(t+1)):a==="}"&&n===1?(n--,r+=`
|
|
32
|
+
`+" ".repeat(t)+a):a==="{"&&n>0?(n++,r+=a):(a==="}"&&n>1&&n--,r+=a)}return r}var{WARN:Jv,LOG:tA,DEBUG:Yv,VERBOSE:rA,ERROR:al}=Ae.setup(Ae.INFO,{prefix:"[thread]"});function Vt(e){return e.init!==void 0}var gs=class{constructor(e,t,r=[],n){if(this._applogs=r,this.name=n,this.parents=e&&!Array.isArray(e)?[e]:e,this.filters=t,this.parents?.length===0)throw new Error("Unhandled: empty parents");mn(this,{size:He,isEmpty:He,firstLog:He,latestLog:He},{name:`Thread{${n}}`})}filters;parents;_subscribers=[];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):Jv("unsubscribe called for non-existent",e)}notifySubscribers(e){Yv(`[thread: ${this.name}] notifying`,this._subscribers.length,"subscribers of",{...e,subs:this._subscribers});for(let t of this._subscribers)t(e)}get applogs(){return this._applogs}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(!Kf(r,Object.keys(n)))throw al("[hasApplog] field set mismatch:",{applog:e,log:n});return Lf(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 Re(()=>this.size)}get nameAndSizeUntracked(){return Re(()=>`${this.name} (${this.size})`)}get prettyName(){return Wv(this.name)}};var Xv=typeof global=="object"&&global&&global.Object===Object&&global,Wf=Xv,Zv=typeof self=="object"&&self&&self.Object===Object&&self,Qv=Wf||Zv||Function("return this")(),zt=Qv,eb=zt.Symbol,lr=eb,Jf=Object.prototype,tb=Jf.hasOwnProperty,rb=Jf.toString,qn=lr?lr.toStringTag:void 0;function nb(e){var t=tb.call(e,qn),r=e[qn];try{e[qn]=void 0;var n=!0}catch{}var i=rb.call(e);return n&&(t?e[qn]=r:delete e[qn]),i}var ib=nb,ob=Object.prototype,ab=ob.toString;function sb(e){return ab.call(e)}var ub=sb,cb="[object Null]",lb="[object Undefined]",sl=lr?lr.toStringTag:void 0;function fb(e){return e==null?e===void 0?lb:cb:sl&&sl in Object(e)?ib(e):ub(e)}var vn=fb;function db(e){return e!=null&&typeof e=="object"}var fn=db,pb="[object Symbol]";function hb(e){return typeof e=="symbol"||fn(e)&&vn(e)==pb}var Zn=hb;function yb(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 mb=yb,gb=Array.isArray,Ft=gb,vb=1/0,ul=lr?lr.prototype:void 0,cl=ul?ul.toString:void 0;function Yf(e){if(typeof e=="string")return e;if(Ft(e))return mb(e,Yf)+"";if(Zn(e))return cl?cl.call(e):"";var t=e+"";return t=="0"&&1/e==-vb?"-0":t}var bb=Yf;function wb(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var vs=wb;function _b(e){return e}var xb=_b,Tb="[object AsyncFunction]",Eb="[object Function]",Ob="[object GeneratorFunction]",Ab="[object Proxy]";function Ib(e){if(!vs(e))return!1;var t=vn(e);return t==Eb||t==Ob||t==Tb||t==Ab}var Xf=Ib,Sb=zt["__core-js_shared__"],Ba=Sb,ll=function(){var e=/[^.]+$/.exec(Ba&&Ba.keys&&Ba.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function $b(e){return!!ll&&ll in e}var kb=$b,Ub=Function.prototype,Nb=Ub.toString;function jb(e){if(e!=null){try{return Nb.call(e)}catch{}try{return e+""}catch{}}return""}var Lr=jb,Pb=/[\\^$.*+?()[\]{}|]/g,Bb=/^\[object .+?Constructor\]$/,Cb=Function.prototype,Rb=Object.prototype,Mb=Cb.toString,Db=Rb.hasOwnProperty,Lb=RegExp("^"+Mb.call(Db).replace(Pb,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Vb(e){if(!vs(e)||kb(e))return!1;var t=Xf(e)?Lb:Bb;return t.test(Lr(e))}var Fb=Vb;function zb(e,t){return e?.[t]}var qb=zb;function Kb(e,t){var r=qb(e,t);return Fb(r)?r:void 0}var bn=Kb,Gb=bn(zt,"WeakMap"),Ya=Gb,Hb=9007199254740991,Wb=/^(?:0|[1-9]\d*)$/;function Jb(e,t){var r=typeof e;return t=t??Hb,!!t&&(r=="number"||r!="symbol"&&Wb.test(e))&&e>-1&&e%1==0&&e<t}var Zf=Jb;function Yb(e,t){return e===t||e!==e&&t!==t}var Qf=Yb,Xb=9007199254740991;function Zb(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Xb}var bs=Zb;function Qb(e){return e!=null&&bs(e.length)&&!Xf(e)}var e0=Qb,t0=Object.prototype;function r0(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||t0;return e===r}var n0=r0;function i0(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var o0=i0,a0="[object Arguments]";function s0(e){return fn(e)&&vn(e)==a0}var fl=s0,ed=Object.prototype,u0=ed.hasOwnProperty,c0=ed.propertyIsEnumerable,l0=fl(function(){return arguments}())?fl:function(e){return fn(e)&&u0.call(e,"callee")&&!c0.call(e,"callee")},td=l0;function f0(){return!1}var d0=f0,rd=typeof exports=="object"&&exports&&!exports.nodeType&&exports,dl=rd&&typeof module=="object"&&module&&!module.nodeType&&module,p0=dl&&dl.exports===rd,pl=p0?zt.Buffer:void 0,h0=pl?pl.isBuffer:void 0,y0=h0||d0,Xa=y0,m0="[object Arguments]",g0="[object Array]",v0="[object Boolean]",b0="[object Date]",w0="[object Error]",_0="[object Function]",x0="[object Map]",T0="[object Number]",E0="[object Object]",O0="[object RegExp]",A0="[object Set]",I0="[object String]",S0="[object WeakMap]",$0="[object ArrayBuffer]",k0="[object DataView]",U0="[object Float32Array]",N0="[object Float64Array]",j0="[object Int8Array]",P0="[object Int16Array]",B0="[object Int32Array]",C0="[object Uint8Array]",R0="[object Uint8ClampedArray]",M0="[object Uint16Array]",D0="[object Uint32Array]",je={};je[U0]=je[N0]=je[j0]=je[P0]=je[B0]=je[C0]=je[R0]=je[M0]=je[D0]=!0;je[m0]=je[g0]=je[$0]=je[v0]=je[k0]=je[b0]=je[w0]=je[_0]=je[x0]=je[T0]=je[E0]=je[O0]=je[A0]=je[I0]=je[S0]=!1;function L0(e){return fn(e)&&bs(e.length)&&!!je[vn(e)]}var V0=L0;function F0(e){return function(t){return e(t)}}var z0=F0,nd=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Hn=nd&&typeof module=="object"&&module&&!module.nodeType&&module,q0=Hn&&Hn.exports===nd,Ca=q0&&Wf.process,K0=function(){try{var e=Hn&&Hn.require&&Hn.require("util").types;return e||Ca&&Ca.binding&&Ca.binding("util")}catch{}}(),hl=K0,yl=hl&&hl.isTypedArray,G0=yl?z0(yl):V0,id=G0,H0=Object.prototype,W0=H0.hasOwnProperty;function J0(e,t){var r=Ft(e),n=!r&&td(e),i=!r&&!n&&Xa(e),a=!r&&!n&&!i&&id(e),o=r||n||i||a,u=o?o0(e.length,String):[],l=u.length;for(var c in e)(t||W0.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 Y0=J0;function X0(e,t){return function(r){return e(t(r))}}var Z0=X0,Q0=Z0(Object.keys,Object),ew=Q0,tw=Object.prototype,rw=tw.hasOwnProperty;function nw(e){if(!n0(e))return ew(e);var t=[];for(var r in Object(e))rw.call(e,r)&&r!="constructor"&&t.push(r);return t}var iw=nw;function ow(e){return e0(e)?Y0(e):iw(e)}var od=ow,aw=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,sw=/^\w*$/;function uw(e,t){if(Ft(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Zn(e)?!0:sw.test(e)||!aw.test(e)||t!=null&&e in Object(t)}var ws=uw,cw=bn(Object,"create"),Qn=cw;function lw(){this.__data__=Qn?Qn(null):{},this.size=0}var fw=lw;function dw(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var pw=dw,hw="__lodash_hash_undefined__",yw=Object.prototype,mw=yw.hasOwnProperty;function gw(e){var t=this.__data__;if(Qn){var r=t[e];return r===hw?void 0:r}return mw.call(t,e)?t[e]:void 0}var vw=gw,bw=Object.prototype,ww=bw.hasOwnProperty;function _w(e){var t=this.__data__;return Qn?t[e]!==void 0:ww.call(t,e)}var xw=_w,Tw="__lodash_hash_undefined__";function Ew(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Qn&&t===void 0?Tw:t,this}var Ow=Ew;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=fw;wn.prototype.delete=pw;wn.prototype.get=vw;wn.prototype.has=xw;wn.prototype.set=Ow;var ml=wn;function Aw(){this.__data__=[],this.size=0}var Iw=Aw;function Sw(e,t){for(var r=e.length;r--;)if(Qf(e[r][0],t))return r;return-1}var Io=Sw,$w=Array.prototype,kw=$w.splice;function Uw(e){var t=this.__data__,r=Io(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():kw.call(t,r,1),--this.size,!0}var Nw=Uw;function jw(e){var t=this.__data__,r=Io(t,e);return r<0?void 0:t[r][1]}var Pw=jw;function Bw(e){return Io(this.__data__,e)>-1}var Cw=Bw;function Rw(e,t){var r=this.__data__,n=Io(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var Mw=Rw;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=Iw;_n.prototype.delete=Nw;_n.prototype.get=Pw;_n.prototype.has=Cw;_n.prototype.set=Mw;var So=_n,Dw=bn(zt,"Map"),ei=Dw;function Lw(){this.size=0,this.__data__={hash:new ml,map:new(ei||So),string:new ml}}var Vw=Lw;function Fw(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var zw=Fw;function qw(e,t){var r=e.__data__;return zw(t)?r[typeof t=="string"?"string":"hash"]:r.map}var $o=qw;function Kw(e){var t=$o(this,e).delete(e);return this.size-=t?1:0,t}var Gw=Kw;function Hw(e){return $o(this,e).get(e)}var Ww=Hw;function Jw(e){return $o(this,e).has(e)}var Yw=Jw;function Xw(e,t){var r=$o(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var Zw=Xw;function xn(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])}}xn.prototype.clear=Vw;xn.prototype.delete=Gw;xn.prototype.get=Ww;xn.prototype.has=Yw;xn.prototype.set=Zw;var ko=xn,Qw="Expected a function";function _s(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Qw);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||ko),r}_s.Cache=ko;var e1=_s,t1=500;function r1(e){var t=e1(e,function(n){return r.size===t1&&r.clear(),n}),r=t.cache;return t}var n1=r1,i1=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,o1=/\\(\\)?/g,a1=n1(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(i1,function(r,n,i,a){t.push(i?a.replace(o1,"$1"):n||r)}),t}),s1=a1;function u1(e){return e==null?"":bb(e)}var c1=u1;function l1(e,t){return Ft(e)?e:ws(e,t)?[e]:s1(c1(e))}var ad=l1,f1=1/0;function d1(e){if(typeof e=="string"||Zn(e))return e;var t=e+"";return t=="0"&&1/e==-f1?"-0":t}var Uo=d1;function p1(e,t){t=ad(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Uo(t[r++])];return r&&r==n?e:void 0}var sd=p1;function h1(e,t,r){var n=e==null?void 0:sd(e,t);return n===void 0?r:n}var y1=h1;function m1(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var g1=m1;function v1(){this.__data__=new So,this.size=0}var b1=v1;function w1(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var _1=w1;function x1(e){return this.__data__.get(e)}var T1=x1;function E1(e){return this.__data__.has(e)}var O1=E1,A1=200;function I1(e,t){var r=this.__data__;if(r instanceof So){var n=r.__data__;if(!ei||n.length<A1-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new ko(n)}return r.set(e,t),this.size=r.size,this}var S1=I1;function Tn(e){var t=this.__data__=new So(e);this.size=t.size}Tn.prototype.clear=b1;Tn.prototype.delete=_1;Tn.prototype.get=T1;Tn.prototype.has=O1;Tn.prototype.set=S1;var no=Tn;function $1(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 k1=$1;function U1(){return[]}var N1=U1,j1=Object.prototype,P1=j1.propertyIsEnumerable,gl=Object.getOwnPropertySymbols,B1=gl?function(e){return e==null?[]:(e=Object(e),k1(gl(e),function(t){return P1.call(e,t)}))}:N1,C1=B1;function R1(e,t,r){var n=t(e);return Ft(e)?n:g1(n,r(e))}var M1=R1;function D1(e){return M1(e,od,C1)}var vl=D1,L1=bn(zt,"DataView"),Za=L1,V1=bn(zt,"Promise"),Qa=V1,F1=bn(zt,"Set"),es=F1,bl="[object Map]",z1="[object Object]",wl="[object Promise]",_l="[object Set]",xl="[object WeakMap]",Tl="[object DataView]",q1=Lr(Za),K1=Lr(ei),G1=Lr(Qa),H1=Lr(es),W1=Lr(Ya),Ir=vn;(Za&&Ir(new Za(new ArrayBuffer(1)))!=Tl||ei&&Ir(new ei)!=bl||Qa&&Ir(Qa.resolve())!=wl||es&&Ir(new es)!=_l||Ya&&Ir(new Ya)!=xl)&&(Ir=function(e){var t=vn(e),r=t==z1?e.constructor:void 0,n=r?Lr(r):"";if(n)switch(n){case q1:return Tl;case K1:return bl;case G1:return wl;case H1:return _l;case W1:return xl}return t});var El=Ir,J1=zt.Uint8Array,Ol=J1,Y1="__lodash_hash_undefined__";function X1(e){return this.__data__.set(e,Y1),this}var Z1=X1;function Q1(e){return this.__data__.has(e)}var e_=Q1;function po(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new ko;++t<r;)this.add(e[t])}po.prototype.add=po.prototype.push=Z1;po.prototype.has=e_;var t_=po;function r_(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 n_=r_;function i_(e,t){return e.has(t)}var o_=i_,a_=1,s_=2;function u_(e,t,r,n,i,a){var o=r&a_,u=e.length,l=t.length;if(u!=l&&!(o&&l>u))return!1;var c=a.get(e),y=a.get(t);if(c&&y)return c==t&&y==e;var g=-1,M=!0,k=r&s_?new t_:void 0;for(a.set(e,t),a.set(t,e);++g<u;){var F=e[g],Q=t[g];if(n)var ae=o?n(Q,F,g,t,e,a):n(F,Q,g,e,t,a);if(ae!==void 0){if(ae)continue;M=!1;break}if(k){if(!n_(t,function(B,V){if(!o_(k,V)&&(F===B||i(F,B,r,n,a)))return k.push(V)})){M=!1;break}}else if(!(F===Q||i(F,Q,r,n,a))){M=!1;break}}return a.delete(e),a.delete(t),M}var ud=u_;function c_(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var l_=c_;function f_(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var d_=f_,p_=1,h_=2,y_="[object Boolean]",m_="[object Date]",g_="[object Error]",v_="[object Map]",b_="[object Number]",w_="[object RegExp]",__="[object Set]",x_="[object String]",T_="[object Symbol]",E_="[object ArrayBuffer]",O_="[object DataView]",Al=lr?lr.prototype:void 0,Ra=Al?Al.valueOf:void 0;function A_(e,t,r,n,i,a,o){switch(r){case O_:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case E_:return!(e.byteLength!=t.byteLength||!a(new Ol(e),new Ol(t)));case y_:case m_:case b_:return Qf(+e,+t);case g_:return e.name==t.name&&e.message==t.message;case w_:case x_:return e==t+"";case v_:var u=l_;case __:var l=n&p_;if(u||(u=d_),e.size!=t.size&&!l)return!1;var c=o.get(e);if(c)return c==t;n|=h_,o.set(e,t);var y=ud(u(e),u(t),n,i,a,o);return o.delete(e),y;case T_:if(Ra)return Ra.call(e)==Ra.call(t)}return!1}var I_=A_,S_=1,$_=Object.prototype,k_=$_.hasOwnProperty;function U_(e,t,r,n,i,a){var o=r&S_,u=vl(e),l=u.length,c=vl(t),y=c.length;if(l!=y&&!o)return!1;for(var g=l;g--;){var M=u[g];if(!(o?M in t:k_.call(t,M)))return!1}var k=a.get(e),F=a.get(t);if(k&&F)return k==t&&F==e;var Q=!0;a.set(e,t),a.set(t,e);for(var ae=o;++g<l;){M=u[g];var B=e[M],V=t[M];if(n)var H=o?n(V,B,M,t,e,a):n(B,V,M,e,t,a);if(!(H===void 0?B===V||i(B,V,r,n,a):H)){Q=!1;break}ae||(ae=M=="constructor")}if(Q&&!ae){var se=e.constructor,z=t.constructor;se!=z&&"constructor"in e&&"constructor"in t&&!(typeof se=="function"&&se instanceof se&&typeof z=="function"&&z instanceof z)&&(Q=!1)}return a.delete(e),a.delete(t),Q}var N_=U_,j_=1,Il="[object Arguments]",Sl="[object Array]",Qi="[object Object]",P_=Object.prototype,$l=P_.hasOwnProperty;function B_(e,t,r,n,i,a){var o=Ft(e),u=Ft(t),l=o?Sl:El(e),c=u?Sl:El(t);l=l==Il?Qi:l,c=c==Il?Qi:c;var y=l==Qi,g=c==Qi,M=l==c;if(M&&Xa(e)){if(!Xa(t))return!1;o=!0,y=!1}if(M&&!y)return a||(a=new no),o||id(e)?ud(e,t,r,n,i,a):I_(e,t,l,r,n,i,a);if(!(r&j_)){var k=y&&$l.call(e,"__wrapped__"),F=g&&$l.call(t,"__wrapped__");if(k||F){var Q=k?e.value():e,ae=F?t.value():t;return a||(a=new no),i(Q,ae,r,n,a)}}return M?(a||(a=new no),N_(e,t,r,n,i,a)):!1}var C_=B_;function cd(e,t,r,n,i){return e===t?!0:e==null||t==null||!fn(e)&&!fn(t)?e!==e&&t!==t:C_(e,t,r,n,cd,i)}var ld=cd,R_=1,M_=2;function D_(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],y=u[1];if(o&&u[2]){if(c===void 0&&!(l in e))return!1}else{var g=new no;if(n)var M=n(c,y,l,e,t,g);if(!(M===void 0?ld(y,c,R_|M_,n,g):M))return!1}}return!0}var L_=D_;function V_(e){return e===e&&!vs(e)}var fd=V_;function F_(e){for(var t=od(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,fd(i)]}return t}var z_=F_;function q_(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var dd=q_;function K_(e){var t=z_(e);return t.length==1&&t[0][2]?dd(t[0][0],t[0][1]):function(r){return r===e||L_(r,e,t)}}var G_=K_;function H_(e,t){return e!=null&&t in Object(e)}var W_=H_;function J_(e,t,r){t=ad(t,e);for(var n=-1,i=t.length,a=!1;++n<i;){var o=Uo(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)&&(Ft(e)||td(e)))}var Y_=J_;function X_(e,t){return e!=null&&Y_(e,t,W_)}var Z_=X_,Q_=1,ex=2;function tx(e,t){return ws(e)&&fd(t)?dd(Uo(e),t):function(r){var n=y1(r,e);return n===void 0&&n===t?Z_(r,e):ld(t,n,Q_|ex)}}var rx=tx;function nx(e){return function(t){return t?.[e]}}var ix=nx;function ox(e){return function(t){return sd(t,e)}}var ax=ox;function sx(e){return ws(e)?ix(Uo(e)):ax(e)}var ux=sx;function cx(e){return typeof e=="function"?e:e==null?xb:typeof e=="object"?Ft(e)?rx(e[0],e[1]):G_(e):ux(e)}var lx=cx,fx=4294967295,dx=fx-1,px=Math.floor,hx=Math.min;function yx(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=Zn(t),c=t===void 0;i<a;){var y=px((i+a)/2),g=r(e[y]),M=g!==void 0,k=g===null,F=g===g,Q=Zn(g);if(o)var ae=n||F;else c?ae=F&&(n||M):u?ae=F&&M&&(n||!k):l?ae=F&&M&&!k&&(n||!Q):k||Q?ae=!1:ae=n?g<=t:g<t;ae?i=y+1:a=y}return hx(a,dx)}var mx=yx;function gx(e,t,r){return mx(e,t,lx(r,2))}var vx=gx,{WARN:bx,LOG:nA,DEBUG:wx,VERBOSE:Kn,ERROR:kl}=Ae.setup(Ae.INFO),No=class extends gs{constructor(e,t,r,n,i){super(e,t,Pe.array([...r],{deep:!1,name:`${i}.array`}),i),this._initialLogs=r,this._eventMapper=n,this.name=i,mn(this,{onParentUpdate:Tt}),this.subscribeToParent()}_parentSubscriptions=new Map;get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}subscribeToParent(){if(this.parents.length||bx("MappedThread has no parents",this),this._parentSubscriptions.size)throw kl("parents subs must not be called twice",this);Kn(`[MappedThread: ${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(){Kn(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.forEach(e=>{this.onParentUpdate(e,{init:Re(()=>sn(e.applogs))})})}onParentUpdate(e,t){Kn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate`,t);let r=this._eventMapper(t,e);if(Kn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => mapped`,r),Vt(r))this._applogs.replace([...r.init]);else{for(let n of r.added)this._applogs.splice(vx(this._applogs,n,"ts"),0,n);if(r.removed){for(let n of r.removed)if(!this._applogs.remove(n))if(!Vt(t)&&t.removed?.includes(n))wx("Ignoring remove event for non-existent because it was part of parent event's removed",n,t);else throw kl(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,n,{thread:this,event:t,mapResult:r})}}Kn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,Oo(this._applogs)),this.notifySubscribers(r)}},{WARN:iA,LOG:oA,DEBUG:aA,VERBOSE:Ma,ERROR:_x}=Ae.setup(Ae.INFO),Br=et("rollingFilter",function(e,t,r={}){let n=hd(t),i=ts(n),a=Pe.array(Re(()=>i(e.applogs)),{deep:!1,name:`${e.name} | ${r.name||`rollingFilter.array{${jr(n)}}`}`}),o=y=>{let g;return Vt(y)?g={init:i(y.init)}:g={added:i(y.added),removed:y.removed},Ma(`rollingFilter{${e.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,n,y,"=>",g),g},u=new No(e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],a,o,`${e.name} | ${r.name||`rollingFilter{${jr(n)}}`}`),l=dv(()=>JSON.parse(JSON.stringify(t)),y=>{Ma(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,n,"=>",y),n=y,i=ts(n),u.triggerRemap()}),c=ci(a,()=>{Ma(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} unobserve`,n),l(),c()});return u},{equals:pi,argsDebugName:(e,t,r)=>Ze({caller:"rollingFilter",thread:e,pattern:t,args:r})}),pd=et("rollingMapper",function(e,t,r={}){let n=Re(()=>t.call(null,{init:e.applogs},e));if(!Vt(n))throw _x("Initial run must return init event");let i=n.init;return new No(e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],i,t,`${e.name} | ${r.name||"rollingMapper"}`)},{equals:pi,argsDebugName:(e,t,r)=>Ze({caller:"rollingMapper",thread:e,args:r})}),xx=et("rollingAcc",function(e,t,r,n={}){return r=Tt(r),r({init:e.applogs},t),e.subscribe(i=>{r(i,t)}),t},{argsDebugName:(e,t,r,n)=>`rollingAcc{${e.nameAndSizeUntracked}${n?.name?` | ${n?.name}`:""}}`}),hd=function(e){let t=Re(()=>Object.fromEntries(Object.entries(sn(e)).map(([r,n])=>[sn(r),sn(n)])));if(!Object.entries(t).length)throw new Error("Pattern is empty");return t};function ts(e){return t=>t.filter(r=>{for(let[n,i]of Object.entries(e)){let a=r[n.startsWith("!")?n.slice(1):n];if(!zf(n,i,a))return!1}return!0})}var{WARN:sA,LOG:ti,DEBUG:Vr,VERBOSE:Se,ERROR:ho}=Ae.setup(Ae.INFO,{prefix:"[q]"}),Tx=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=r,mn(this,{threadOfTrail:He})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?xs([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},yd=class{constructor(e){this.nodes=e,mn(this,{threadOfAllTrails:He,size:He,isEmpty:He})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return Re(()=>this.records.length)}get records(){return this.nodes.map(({variables:e})=>e)}get leafNodeLogs(){return this.nodes.map(({logsOfThisNode:e})=>e.applogs)}get threadOfAllTrails(){return xs(this.nodes.map(e=>e.threadOfTrail))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},Ex=et("lastWriteWins",function(e,{inverseToOnlyReturnFirstLogs:t,tolerateAlreadyFiltered:r}={}){if(Se(`lastWriteWins${t?".inversed":""} < ${e.nameAndSizeUntracked} > initializing`),e.filters.includes("lastWriteWins")){if(r)return Vr("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),e;throw ho("thread already filtered lastWriteWins:",e.filters,{name:e.name})}let n,i=pd(e,function(a,o){let u=Vt(a),l,c=[],y=u?null:[];u?(n=new Map,l=a.init):l=a.added;let g;for(let M=t?0:l.length-1;t?M<l.length:M>=0;t?M++:M--){let k=l[M],F=jr([k.en,k.at]);if(g&&(t?g>k.ts:g<k.ts))throw ho("lastWriteWins.mapper logs not sorted:",g,t?">":"<",k.ts,{log:k,i:M,newLogs:l,inverseToOnlyReturnFirstLogs:t});g=k.ts;let Q=n.get(F);(!Q||(t?Q.ts>k.ts:Q.ts<k.ts))&&(Q&&!u&&y.push(Q),c.push(k),n.set(F,k))}return Pr(c),Se.isDisabled||Se(`lastWriteWins${t?".inversed":""}<${e.nameAndSizeUntracked}> mapped event`,u?{...Object.fromEntries(Object.entries(a).map(([M,k])=>[M,k?.length])),toAdd:c.length,toRemove:y}:{...a,toAdd:c,toRemove:y}),u?{init:c}:{added:c,removed:y}},{name:`lastWriteWins${t?".inversed":""}`,extraFilterName:"lastWriteWins"});return Se.isDisabled||Nr(()=>{Se(`lastWriteWins<${e.nameAndSizeUntracked}> filtered down to`,i.applogs.length)}),i},{equals:pi,argsDebugName:e=>Ze({caller:"lastWriteWins",thread:e})}),uA=et("withoutDeleted",function(e){if(Se(`withoutDeleted<${e.nameAndSizeUntracked}>`),e.filters.includes("withoutDeleted"))throw ho("thread already filtered withoutDeleted:",e.filters,{name:e.name});let t=Br(e,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});Se(`withoutDeleted<${e.nameAndSizeUntracked}> deletionLogs:`,Re(()=>[...t.applogs]));let r=Ze({caller:"allDeletedEntities",thread:e}),n=Ao(()=>t.map(i=>i.en),{name:r});return Se.isDisabled||Nr(()=>{Se(`withoutDeleted<${e.nameAndSizeUntracked}> deleted:`,[...n])}),Br(e,{"!en":n},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:pi}),Ox=et("query",function e(t,r,n={},i={}){Vr(`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=Ax(t,o,u,i);return Se.isDisabled||Nr(()=>Se("query result:",sn(l))),l},{equals:ms,argsDebugName:(e,t,r)=>Ze({caller:"query",thread:e,args:r?{pattern:t,startVars:r}:t})}),Ax=et("queryStep",function(e,t,r,n={}){if(Vr(`queryStep<${e.nameAndSizeUntracked}> with`,t?.untrackedSize??"all","nodes, pattern:",r),!Object.entries(r).length)throw new Error("Pattern is empty");let i=Ao(()=>{function a(o){let[u,l]=ys(r,o?.variables??{});Se("[queryStep] patternWithoutVars: ",u);let c=Br(e,u),y=md(l),g=c.map(k=>({log:k,vars:y(k)}));Se.isDisabled||Se("[queryStep] step node:",o?.variables," =>",g,"from:",Re(()=>c.applogs));let M=g.map(({log:k,vars:F})=>{let Q=Object.assign({},o?.variables,F);return new Tx(new jo([k],e.filters,Ze({caller:"QueryNode",thread:c,pattern:`${jr(Q)}@${jr(u)}`}),!0,c),Q,o)});return n.debug&&ti("[queryStep] step result:",Re(()=>M.map(({variables:k,logsOfThisNode:F})=>({variables:k,thread:F.applogs})))),M}return t?t.nodes.flatMap(a):a(null)},{name:Ze({caller:"queryStep",thread:e,pattern:r})});return Se("queryStep result:",i),new yd(i)},{equals:ms,argsDebugName:(e,t,r)=>Ze({caller:"queryStep",thread:e,pattern:r})}),cA=et("queryNot",function(e,t,r,n={}){let i=t.nodes;Vr(`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]=ys(o,u??{});Se("[queryNot] patternWithoutVars: ",l);let y=Br(e,l);return Se("[queryNot] step node:",u," =>",y.size,"applogs"),Se.isDisabled||Se("[queryNot] step node:",u," => empty?",Re(()=>y.applogs)),n.debug&&ti("[queryNot] node result:",u,"=>",y.applogs),y.isEmpty})}return new yd(i)},{equals:ms,argsDebugName:(e,t,r)=>Ze({caller:"queryNot",thread:e,pattern:r})}),Ix=et("filterAndMap",function(e,t,r){Vr(`filterAndMap<${e.nameAndSizeUntracked}>`,t);let n=Br(e,t);Se("[filterAndMap] filtered:",n.untrackedSize),Se.isDisabled||Nr(()=>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(md(r))},a=Ze({thread:e,pattern:t,caller:"filterAndMap"}),o=Ao(i,{name:a});return Se.isDisabled||Nr(()=>Se("[filterAndMap] mapped:",o)),o},{equals:Qe.structural,argsDebugName:(e,t)=>Ze({caller:"filterAndMap",thread:e,pattern:t})}),lA=et("queryAndMap",function(e,t,r,n={}){Vr(`queryAndMap<${e.nameAndSizeUntracked}>`,{patternOrPatterns:t,variables:n,map:r});let i=Ze({thread:e,caller:"queryAndMap"}),a=Ox(e,t);Se("[queryAndMap] filtered count:",a.untrackedSize);let o=Ao(()=>{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||Nr(()=>Se("[queryAndMap] result:",sn(o))),o},{equals:Qe.structural,argsDebugName:(e,t)=>Ze({caller:"queryAndMap",thread:e,pattern:t})}),fA=et("queryEntity",function(e,t,r,n){Vr(`queryEntity<${e.nameAndSizeUntracked}>`,r,t);let i=Br(e,{en:r,at:$x(t,n)});return Se("queryEntity applogs:",i.applogs),He(()=>i.isEmpty?null:Object.fromEntries(i.map(({at:a,vl:o})=>[a.slice(t.length+1),o])))},{equals:Kv,argsDebugName:(e,t,r)=>Ze({caller:"queryEntity",thread:e,args:{name:t,entityID:r}})}),dA=et("agentsOfThread",function(e){ti(`agentsOfThread<${e.nameAndSizeUntracked}>`);let t=Pe.map();function r(n){for(let i of Vt(n)?n.init:n.added){let a=t.get(i.ag)??0;t.set(i.ag,a+1)}for(let i of!Vt(n)&&n.removed||[]){let a=t.get(i.ag);if(!a||a<1)throw ho("[agentsOfThread] number is now negative",{log:i,event:n,mapped:t,prev:a});t.set(i.ag,a-1)}ti(`agentsOfThread<${e.nameAndSizeUntracked}> processed event`,{event:n,mapped:t})}return Re(()=>r({init:e.applogs})),e.subscribe(r),gf(t,()=>e.unsubscribe(r)),t}),Sx=et("entityOverlap",function(e,t){return ti(`entityOverlap<${e.nameAndSizeUntracked}, ${t.nameAndSizeUntracked}>`),He(()=>{let r=new Set(e.map(i=>i.en)),n=new Set(t.map(i=>i.en));return[...r].filter(i=>n.has(i))})}),pA=et("entityOverlapCount",function(e,t){return He(()=>Sx(e,t).get().length)});function md(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function $x(e,t){return t.map(r=>kx(e,r))}function kx(e,t){return`${e}/${t}`}var{WARN:Ul,LOG:hA,DEBUG:yA,VERBOSE:mA,ERROR:Nl}=Ae.setup(Ae.INFO);function gd(e){return!!e.ts}function vd(e,t){return gd(e)?e:{...e,ts:t}}function bd(e,t){let{en:r,at:n}=e,i=Ix(Ex(t),{en:r,at:n},"cid");i.length>1&&Ul("[withPv] unexpected result count:",i.length);let a=i.length?i[0]:null,o=a===e.pv;return e.pv&&!o&&Ul("[withPv] different than pre-set pv:",{queriedPv:a,logPv:e.pv}),a=e.pv??a,{...e,pv:a??null}}function xs(e){if(e.length===0)throw Nl("joinThreads called with empty array");if(e.length===1)return e[0];let t=()=>Pr(hs(e.flatMap(i=>{let a=i.applogs;if(!a)throw Nl("falsy applogs of thread",i),new Error("falsy applogs of thread");return a}))),r=Re(()=>t()),n=Tt(function(i,a){return Vt(i)?{init:Re(()=>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 No(e,["?"],r,n,`join(${e.map(i=>i.name).join(", ")})`)}var Ge=nr(Cr(),1),Ux=nr(qm(),1),wd=e=>Ge.Type.Union([e,Ge.Type.Null()]);var _d=/^(k51qz|baguq)[0-9a-z]{56,57}$/,Nx=/^[0-9A-Fa-f]{7,8}$/g;Ge.FormatRegistry.Set("EntityID",e=>!!e.match(Nx)||!!e.match(_d));var xd=Ge.Type.String();Ge.FormatRegistry.Set("CID",e=>!!e.match(_d));var jx=Ge.Type.String({format:"EntityID"}),Px=/^http([s]?):\/\/.*\..*/;Ge.FormatRegistry.Set("URL",e=>!!e.match(Px));var Bx=Ge.Type.String({format:"URL"}),Td=Ge.Type.Object({en:xd,at:Ge.Type.String(),vl:wd(Ge.Type.Union([Ge.Type.String(),Ge.Type.Boolean(),Ge.Type.Number()])),ts:Ge.Type.String(),ag:Ge.Type.String()}),yo=Ux.TypeCompiler.Compile(Td),Ed=e=>Array.from(yo.Errors(e)),Od=yo.Check.bind(yo),{WARN:jl,LOG:Cx,DEBUG:gA,VERBOSE:Rx,ERROR:Ad}=Ae.setup(Ae.INFO),Id=class extends gs{constructor(e,t,r=[],n){super(e,t,r,n),mn(this,{insert:Tt})}insert(e){let t=Gf(),r=e.map(a=>{let o=vd(a,t);if(!Od(o))throw Ad(`Bogus Applog ${JSON.stringify(o)}`,Ed(o));let u=bd(o,this),l=$a(u).toString(),c={...u,cid:l};return Object.freeze(c)}),n=hs(r);if(e.length!==n.length?jl("request to insert duplicate log, inserting mappedLogs:",{appLogsToInsert:e,mappedLogs:n}):e.length?Cx("Inserting:",n.length===1?n[0]:n,{ds:this}):jl("request to insert empty logs array"),!n.length)return[];Pr(n);let i=this._applogs.length&&Df(n[0],this._applogs[this._applogs.length-1]);return this._applogs.push(...n),i&&Pr(this._applogs),this.notifySubscribers({added:n,removed:null}),this.persist(n),n}get readOnly(){return!1}},jo=class rs extends Id{constructor(t,r,n,i,a=null){super(a,r,t,n),this._readOnly=i,mn(this,{_applogs:Pe.shallow})}static empty(t){return rs.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new rs(t,[],r??"in-memory",n)}get readOnly(){return this._readOnly}persist(t){if(Rx("[InMem.persist] no persist for",t),this.readOnly)throw Ad("[persist] called for readOnly thread")}};var Mx=Le((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 y=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-y+1,l}}),Dx=Le((e,t)=>{"use strict";t.exports=i;var r=128,n=127;function i(a,l){var u=0,l=l||0,c=0,y=l,g,M=a.length;do{if(y>=M||c>49)throw i.bytes=0,new RangeError("Could not decode varint");g=a[y++],u+=c<28?(g&n)<<c:(g&n)*Math.pow(2,c),c+=7}while(g>=r);return i.bytes=y-l,u}}),Lx=Le((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),y=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<y?9:10}}),Is=Le((e,t)=>{"use strict";t.exports={encode:Mx(),decode:Dx(),encodingLength:Lx()}}),Vx=42;function Fx(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Rt.decode(e.subarray(1))}var kd={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};kd.tags[Vx]=Fx;var zx=e=>Oa(e,kd),Fr=nr(Is(),1),Ts={SHA2_256:18,LENGTH:32,DAG_PB:112},qx=40;function Po(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=Fr.default.decode(e);return t.seek(Fr.default.decode.bytes),r}function Kx(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 Gx(e){Fr.default.decode(e);let t=Fr.default.decode.bytes,r=Fr.default.decode(e.subarray(Fr.default.decode.bytes)),n=Fr.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},hi={"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=hi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let a=e[i];if(a=hi["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=hi["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=hi.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}},yi={"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=yi["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=yi["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=yi["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=yi.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}},Hx={toTyped:hi.CarV1HeaderOrV2Pragma,toRepresentation:yi.CarV1HeaderOrV2Pragma},yI=Ea(),mI=nr(Is(),1),gI=[new X(j.map,2),new X(j.string,"version"),new X(j.uint,1),new X(j.string,"roots")],vI=new X(j.tag,42);async function Ud(e,t){let r=Po(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=zx(n);if(Hx.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=Kx(await e.exactly(qx,!0));e.seek(a.dataOffset-e.pos);let o=await Ud(e,1);return Object.assign(o,a)}async function Wx(e){let t=await e.exactly(2,!1);if(t[0]===Ts.SHA2_256&&t[1]===Ts.LENGTH){let o=await e.exactly(34,!0),u=zn(o);return Rt.create(0,Ts.DAG_PB,u)}let r=Po(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=Po(await e.upTo(8),e),i=await e.exactly(Gx(await e.upTo(8)),!0),a=zn(i);return Rt.create(r,n,a)}async function Nd(e){let t=e.pos,r=Po(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await Wx(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function Jx(e){let{cid:t,blockLength:r}=await Nd(e);return{bytes:await e.exactly(r,!0),cid:t}}async function Yx(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await Nd(e),a={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(a.blockLength),a}function jd(e){let t=(async()=>{let r=await Ud(e);if(r.version===2){let n=e.pos-r.dataOffset;e=Zx(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await Jx(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await Yx(e)}}}function Pd(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 Xx(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,y)=>c+y.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 Bd(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return Xx(r)}function Zx(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 Qx=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 Sd(Pd(e))}static async fromIterable(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Sd(Bd(e))}};async function Sd(e){let t=jd(e),{version:r,roots:n}=await t.header();return new Qx(r,n,t.blocksIndex())}var Cd=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}},bI=class Os extends Cd{[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 Rd(t);return new Os(r,n,i)}static async fromIterable(t){let{version:r,roots:n,iterator:i}=await Md(t);return new Os(r,n,i)}},wI=class As extends Cd{[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 Rd(t);return new As(r,n,i)}static async fromIterable(t){let{version:r,roots:n,iterator:i}=await Md(t);return new As(r,n,i)}};async function Rd(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Dd(Pd(e))}async function Md(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Dd(Bd(e))}async function Dd(e){let t=jd(e),{version:r,roots:n}=await t.header();return{version:r,roots:n,iterator:t.blocks()}}var _I=nr(Is(),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:eT,LOG:TI,DEBUG:Es,VERBOSE:EI,ERROR:$d}=Ae.setup(Ae.INFO);async function Ss(e){let{roots:t,blocks:r}=await Ld(e);if(!t||!r)throw $d("decodeCar is funky",{roots:t,blocks:r});t.length!==1&&eT("Unexpected roots count:",t);let n=r.get(t[0]),i;Es("root:",n,{blocks:r}),n.info?(i=r.get(n.applogs.toString()).logs,Es("new format - infoLogs",r.get(n.info.toString()))):i=n.applogs;let a;return a=i.map(o=>{let u=o.toV1?o.toV1().toString():o["/"],l=r.get(u);if(!l)throw $d("Could not find applog CID in Car file:",u,{root:n,blocks:r});return l.pv instanceof Rt&&(l.pv=l.pv.toV1().toString()),{...l,cid:u}}),Es("Decoded car logs:",n,{roots:t,blocks:r,applogs:a}),{applogs:a}}async function Ld(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(),Wi(i));return{roots:t,blocks:r}}var{WARN:$s,LOG:ZI,DEBUG:Vd,VERBOSE:QI,ERROR:ks}=Lo.setup(Lo.DEBUG),tT=["https://ipfs.4everland.io/ipfs/CID/?format=car&dag-scope=all","https://cloudflare-ipfs.com/ipfs/CID/?format=car&dag-scope=all"];async function eS(e,{readOnly:t=!0,pinnedCID:r}={}){let n;if(r)n=gt.parse(r);else try{n=await rT(e),Vd("Resolved pub to CID",n.toString())}catch(c){throw ks(`Failed to resolve IPNS ${e}:`,c)}let i=await nT(n),{applogs:a}=await Ss(i),o=a.filter(c=>c instanceof Uint8Array);o.length&&$s(`Found ${o.length} encrypted logs - skipping`);let u=a.filter(c=>!(c instanceof Uint8Array));Pr(u);let l=new jo(u,[],`preview-${e}`,t);return{cid:n,thread:l}}async function rT(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),gt.parse(r.value.replace("/ipfs/",""))}async function nT(e){Vd("Retrieving:",e);let t;for(let r of tT){let n=r.replaceAll("CID",e.toString()),i=await fetch(n);(!i?.ok||!i?.body)&&(t=ks(`[retrieveCar] unexpected response ${i?.statusText}`,{url:n}),$s("Gateway failed:",n,t)),t=iT(i.body.getReader())}if(t instanceof Error)throw t;return(await oT(t)).car}function iT(e){return async function*(){for(;;){let{done:t,value:r}=await e.read();if(t)break;yield r}}()}async function oT(e){let t=Yt(Xt(e)),r=await t.header(),n=[],i=!1;try{for await(let a of t.blocks())n.push(a);i=!0}catch(a){if(ks("Failed to read car:",a,{blocks:n,header:r}),n.length===0)throw a;$s(`Returning half-baked car with ${n.length} blocks`)}return{complete:i,car:new wr(r,n)}}export{eS as a,rT as b,nT as c};
|
|
33
|
+
/*! Bundled license information:
|
|
34
|
+
|
|
35
|
+
@noble/hashes/esm/utils.js:
|
|
36
|
+
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
37
|
+
*/
|
|
38
|
+
/*! Bundled license information:
|
|
39
|
+
|
|
40
|
+
lodash-es/lodash.js:
|
|
41
|
+
(**
|
|
42
|
+
* @license
|
|
43
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
44
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
45
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
46
|
+
* Released under MIT license <https://lodash.com/license>
|
|
47
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
48
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
49
|
+
*)
|
|
50
|
+
*/
|
|
51
|
+
//# sourceMappingURL=chunk-NM3L4FRZ.min.js.map
|