@wovin/connect-nftstorage 0.0.9-RC3 → 0.0.10
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/LICENSE +661 -0
- package/dist/chunk-2QFX3P3I.min.js +16 -0
- package/dist/chunk-2QFX3P3I.min.js.map +1 -0
- package/dist/chunk-BKKH6BET.min.js +3 -0
- package/dist/chunk-BKKH6BET.min.js.map +1 -0
- package/dist/chunk-CMDKOQ7H.min.js +80 -0
- package/dist/chunk-CMDKOQ7H.min.js.map +1 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/retrieve.d.ts +14 -7
- package/dist/retrieve.d.ts.map +1 -1
- package/dist/retrieve.min.js +1 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.min.js +1 -1
- package/package.json +9 -8
- package/dist/chunk-DEC6G2QE.min.js +0 -78
- package/dist/chunk-DEC6G2QE.min.js.map +0 -1
- package/dist/chunk-S4T3O5K3.min.js +0 -16
- package/dist/chunk-S4T3O5K3.min.js.map +0 -1
- package/dist/chunk-SOBCOB7T.min.js +0 -3
- package/dist/chunk-SOBCOB7T.min.js.map +0 -1
- package/dist/utils.d.ts +0 -1
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.min.js +0 -1
- package/dist/utils.min.js.map +0 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import{e as ha}from"./chunk-BKKH6BET.min.js";var rd=Object.create,ec=Object.defineProperty,nd=Object.getOwnPropertyDescriptor,id=Object.getOwnPropertyNames,od=Object.getPrototypeOf,ad=Object.prototype.hasOwnProperty,cn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),sd=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of id(t))!ad.call(e,i)&&i!==r&&ec(e,i,{get:()=>t[i],enumerable:!(n=nd(t,i))||n.enumerable});return e},di=(e,t,r)=>(r=e!=null?rd(od(e)):{},sd(t||!e||!e.__esModule?ec(r,"default",{value:e,enumerable:!0}):r,e)),ud=cn((e,t)=>{"use strict";t.exports=a;var r=128,n=127,i=~n,o=Math.pow(2,31);function a(s,u,l){if(Number.MAX_SAFE_INTEGER&&s>Number.MAX_SAFE_INTEGER)throw a.bytes=0,new RangeError("Could not encode varint");u=u||[],l=l||0;for(var f=l;s>=o;)u[l++]=s&255|r,s/=128;for(;s&i;)u[l++]=s&255|r,s>>>=7;return u[l]=s|0,a.bytes=l-f+1,u}}),ld=cn((e,t)=>{"use strict";t.exports=i;var r=128,n=127;function i(o,u){var s=0,u=u||0,l=0,f=u,d,S=o.length;do{if(f>=S||l>49)throw i.bytes=0,new RangeError("Could not decode varint");d=o[f++],s+=l<28?(d&n)<<l:(d&n)*Math.pow(2,l),l+=7}while(d>=r);return i.bytes=f-u,s}}),cd=cn((e,t)=>{"use strict";var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),a=Math.pow(2,35),s=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),f=Math.pow(2,63);t.exports=function(d){return d<r?1:d<n?2:d<i?3:d<o?4:d<a?5:d<s?6:d<u?7:d<l?8:d<f?9:10}}),ss=cn((e,t)=>{"use strict";t.exports={encode:ud(),decode:ld(),encodingLength:cd()}}),fd=cn(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},r=typeof window<"u"&&typeof window.document<"u",n=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,i=(typeof self>"u"?"undefined":t(self))==="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope",o=typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),a=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u";e.isBrowser=r,e.isWebWorker=i,e.isNode=n,e.isJsDom=o,e.isDeno=a}),pd=cn((e,t)=>{"use strict";t.exports=function(r,n){n||(n={}),typeof n=="function"&&(n={cmp:n});var i=typeof n.cycles=="boolean"?n.cycles:!1,o=n.cmp&&function(s){return function(u){return function(l,f){var d={key:l,value:u[l]},S={key:f,value:u[f]};return s(d,S)}}}(n.cmp),a=[];return function s(u){if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u!==void 0){if(typeof u=="number")return isFinite(u)?""+u:"null";if(typeof u!="object")return JSON.stringify(u);var l,f;if(Array.isArray(u)){for(f="[",l=0;l<u.length;l++)l&&(f+=","),f+=s(u[l])||"null";return f+"]"}if(u===null)return"null";if(a.indexOf(u)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var d=a.push(u)-1,S=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<S.length;l++){var T=S[l],B=s(u[T]);B&&(f&&(f+=","),f+=JSON.stringify(T)+":"+B)}return a.splice(d,1),"{"+f+"}"}}(r)}}),dd=["string","number","bigint","symbol"],hd=["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 yd(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return dd.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":md(e)?"Buffer":gd(e)||"Object"}function md(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function gd(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(hd.includes(t))return t}var q=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}};q.uint=new q(0,"uint",!0);q.negint=new q(1,"negint",!0);q.bytes=new q(2,"bytes",!0);q.string=new q(3,"string",!0);q.array=new q(4,"array",!1);q.map=new q(5,"map",!1);q.tag=new q(6,"tag",!1);q.float=new q(7,"float",!0);q.false=new q(7,"false",!0);q.true=new q(7,"true",!0);q.null=new q(7,"null",!0);q.undefined=new q(7,"undefined",!0);q.break=new q(7,"break",!0);var he=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}`}},fn=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",vd=new TextDecoder,bd=new TextEncoder;function Xi(e){return fn&&globalThis.Buffer.isBuffer(e)}function wd(e){return e instanceof Uint8Array?Xi(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var _d=fn?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):wu(e,t,r):(e,t,r)=>r-t>64?vd.decode(e.subarray(t,r)):wu(e,t,r),Td=fn?e=>e.length>64?globalThis.Buffer.from(e):bu(e):e=>e.length>64?bd.encode(e):bu(e),us=fn?(e,t,r)=>Xi(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Od=fn?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),wd(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},xd=fn?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Ed(e,t){if(Xi(e)&&Xi(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 bu(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 wu(e,t,r){let n=[];for(;t<r;){let i=e[t],o=null,a=i>239?4:i>223?3:i>191?2:1;if(t+a<=r){let s,u,l,f;switch(a){case 1:i<128&&(o=i);break;case 2:s=e[t+1],(s&192)===128&&(f=(i&31)<<6|s&63,f>127&&(o=f));break;case 3:s=e[t+1],u=e[t+2],(s&192)===128&&(u&192)===128&&(f=(i&15)<<12|(s&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:s=e[t+1],u=e[t+2],l=e[t+3],(s&192)===128&&(u&192)===128&&(l&192)===128&&(f=(i&15)<<18|(s&63)<<12|(u&63)<<6|l&63,f>65535&&f<1114112&&(o=f))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),t+=a}return Id(n)}var _u=4096;function Id(e){let t=e.length;if(t<=_u)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=_u));return r}var Sd=256,Ad=class{constructor(e=Sd){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=xd(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=us(r,0,this.cursor)}else t=Od(this.chunks,this.cursor);return e&&this.reset(),t}},_e="CBOR decode error:",tc="CBOR encode error:",hi=[];hi[23]=1;hi[24]=2;hi[25]=3;hi[26]=5;hi[27]=9;function pn(e,t,r){if(e.length-t<r)throw new Error(`${_e} not enough data for type`)}var We=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Rr(e,t,r){pn(e,t,1);let n=e[t];if(r.strict===!0&&n<We[0])throw new Error(`${_e} integer encoded in more bytes than necessary (strict decode)`);return n}function Br(e,t,r){pn(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<We[1])throw new Error(`${_e} integer encoded in more bytes than necessary (strict decode)`);return n}function Dr(e,t,r){pn(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<We[2])throw new Error(`${_e} integer encoded in more bytes than necessary (strict decode)`);return n}function Cr(e,t,r){pn(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<We[3])throw new Error(`${_e} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${_e} integers outside of the safe integer range are not supported`)}function $d(e,t,r,n){return new he(q.uint,Rr(e,t+1,n),2)}function jd(e,t,r,n){return new he(q.uint,Br(e,t+1,n),3)}function Nd(e,t,r,n){return new he(q.uint,Dr(e,t+1,n),5)}function Pd(e,t,r,n){return new he(q.uint,Cr(e,t+1,n),9)}function Mr(e,t){return xt(e,0,t.value)}function xt(e,t,r){if(r<We[0]){let n=Number(r);e.push([t|n])}else if(r<We[1]){let n=Number(r);e.push([t|24,n])}else if(r<We[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<We[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<We[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,e.push(i)}else throw new Error(`${_e} encountered BigInt larger than allowable range`)}}Mr.encodedSize=function(e){return xt.encodedSize(e.value)};xt.encodedSize=function(e){return e<We[0]?1:e<We[1]?2:e<We[2]?3:e<We[3]?5:9};Mr.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function kd(e,t,r,n){return new he(q.negint,-1-Rr(e,t+1,n),2)}function Ud(e,t,r,n){return new he(q.negint,-1-Br(e,t+1,n),3)}function Rd(e,t,r,n){return new he(q.negint,-1-Dr(e,t+1,n),5)}var ls=BigInt(-1),rc=BigInt(1);function Bd(e,t,r,n){let i=Cr(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new he(q.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${_e} integers outside of the safe integer range are not supported`);return new he(q.negint,ls-BigInt(i),9)}function cs(e,t){let r=t.value,n=typeof r=="bigint"?r*ls-rc:r*-1-1;xt(e,t.type.majorEncoded,n)}cs.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*ls-rc:t*-1-1;return r<We[0]?1:r<We[1]?2:r<We[2]?3:r<We[3]?5:9};cs.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function yi(e,t,r,n){pn(e,t,r+n);let i=us(e,t+r,t+r+n);return new he(q.bytes,i,r+n)}function Dd(e,t,r,n){return yi(e,t,1,r)}function Cd(e,t,r,n){return yi(e,t,2,Rr(e,t+1,n))}function Md(e,t,r,n){return yi(e,t,3,Br(e,t+1,n))}function Ld(e,t,r,n){return yi(e,t,5,Dr(e,t+1,n))}function Vd(e,t,r,n){let i=Cr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${_e} 64-bit integer bytes lengths not supported`);return yi(e,t,9,i)}function Ji(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===q.string?Td(e.value):e.value),e.encodedBytes}function ko(e,t){let r=Ji(t);xt(e,t.type.majorEncoded,r.length),e.push(r)}ko.encodedSize=function(e){let t=Ji(e);return xt.encodedSize(t.length)+t.length};ko.compareTokens=function(e,t){return Fd(Ji(e),Ji(t))};function Fd(e,t){return e.length<t.length?-1:e.length>t.length?1:Ed(e,t)}function mi(e,t,r,n,i){let o=r+n;pn(e,t,o);let a=new he(q.string,_d(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=us(e,t+r,t+o)),a}function zd(e,t,r,n){return mi(e,t,1,r,n)}function Gd(e,t,r,n){return mi(e,t,2,Rr(e,t+1,n),n)}function qd(e,t,r,n){return mi(e,t,3,Br(e,t+1,n),n)}function Kd(e,t,r,n){return mi(e,t,5,Dr(e,t+1,n),n)}function Wd(e,t,r,n){let i=Cr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${_e} 64-bit integer string lengths not supported`);return mi(e,t,9,i,n)}var Hd=ko;function dn(e,t,r,n){return new he(q.array,n,r)}function Xd(e,t,r,n){return dn(e,t,1,r)}function Jd(e,t,r,n){return dn(e,t,2,Rr(e,t+1,n))}function Yd(e,t,r,n){return dn(e,t,3,Br(e,t+1,n))}function Zd(e,t,r,n){return dn(e,t,5,Dr(e,t+1,n))}function Qd(e,t,r,n){let i=Cr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${_e} 64-bit integer array lengths not supported`);return dn(e,t,9,i)}function eh(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${_e} indefinite length items not allowed`);return dn(e,t,1,1/0)}function fs(e,t){xt(e,q.array.majorEncoded,t.value)}fs.compareTokens=Mr.compareTokens;fs.encodedSize=function(e){return xt.encodedSize(e.value)};function hn(e,t,r,n){return new he(q.map,n,r)}function th(e,t,r,n){return hn(e,t,1,r)}function rh(e,t,r,n){return hn(e,t,2,Rr(e,t+1,n))}function nh(e,t,r,n){return hn(e,t,3,Br(e,t+1,n))}function ih(e,t,r,n){return hn(e,t,5,Dr(e,t+1,n))}function oh(e,t,r,n){let i=Cr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${_e} 64-bit integer map lengths not supported`);return hn(e,t,9,i)}function ah(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${_e} indefinite length items not allowed`);return hn(e,t,1,1/0)}function ps(e,t){xt(e,q.map.majorEncoded,t.value)}ps.compareTokens=Mr.compareTokens;ps.encodedSize=function(e){return xt.encodedSize(e.value)};function sh(e,t,r,n){return new he(q.tag,r,1)}function uh(e,t,r,n){return new he(q.tag,Rr(e,t+1,n),2)}function lh(e,t,r,n){return new he(q.tag,Br(e,t+1,n),3)}function ch(e,t,r,n){return new he(q.tag,Dr(e,t+1,n),5)}function fh(e,t,r,n){return new he(q.tag,Cr(e,t+1,n),9)}function ds(e,t){xt(e,q.tag.majorEncoded,t.value)}ds.compareTokens=Mr.compareTokens;ds.encodedSize=function(e){return xt.encodedSize(e.value)};var ph=20,dh=21,hh=22,yh=23;function mh(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${_e} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new he(q.null,null,1):new he(q.undefined,void 0,1)}function gh(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${_e} indefinite length items not allowed`);return new he(q.break,void 0,1)}function hs(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${_e} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${_e} Infinity values are not supported`)}return new he(q.float,e,t)}function vh(e,t,r,n){return hs(ms(e,t+1),3,n)}function bh(e,t,r,n){return hs(gs(e,t+1),5,n)}function wh(e,t,r,n){return hs(ac(e,t+1),9,n)}function ys(e,t,r){let n=t.value;if(n===!1)e.push([q.float.majorEncoded|ph]);else if(n===!0)e.push([q.float.majorEncoded|dh]);else if(n===null)e.push([q.float.majorEncoded|hh]);else if(n===void 0)e.push([q.float.majorEncoded|yh]);else{let i,o=!1;(!r||r.float64!==!0)&&(ic(n),i=ms(At,1),n===i||Number.isNaN(n)?(At[0]=249,e.push(At.slice(0,3)),o=!0):(oc(n),i=gs(At,1),n===i&&(At[0]=250,e.push(At.slice(0,5)),o=!0))),o||(_h(n),i=ac(At,1),At[0]=251,e.push(At.slice(0,9)))}}ys.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){ic(r);let n=ms(At,1);if(r===n||Number.isNaN(r))return 3;if(oc(r),n=gs(At,1),r===n)return 5}return 9};var nc=new ArrayBuffer(9),ht=new DataView(nc,1),At=new Uint8Array(nc,0);function ic(e){if(e===1/0)ht.setUint16(0,31744,!1);else if(e===-1/0)ht.setUint16(0,64512,!1);else if(Number.isNaN(e))ht.setUint16(0,32256,!1);else{ht.setFloat32(0,e);let t=ht.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)ht.setUint16(0,31744,!1);else if(r===0)ht.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?ht.setUint16(0,0):i<-14?ht.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):ht.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function ms(e,t){if(e.length-t<2)throw new Error(`${_e} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function oc(e){ht.setFloat32(0,e,!1)}function gs(e,t){if(e.length-t<4)throw new Error(`${_e} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function _h(e){ht.setFloat64(0,e,!1)}function ac(e,t){if(e.length-t<8)throw new Error(`${_e} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}ys.compareTokens=Mr.compareTokens;function Ie(e,t,r){throw new Error(`${_e} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Uo(e){return()=>{throw new Error(`${_e} ${e}`)}}var se=[];for(let e=0;e<=23;e++)se[e]=Ie;se[24]=$d;se[25]=jd;se[26]=Nd;se[27]=Pd;se[28]=Ie;se[29]=Ie;se[30]=Ie;se[31]=Ie;for(let e=32;e<=55;e++)se[e]=Ie;se[56]=kd;se[57]=Ud;se[58]=Rd;se[59]=Bd;se[60]=Ie;se[61]=Ie;se[62]=Ie;se[63]=Ie;for(let e=64;e<=87;e++)se[e]=Dd;se[88]=Cd;se[89]=Md;se[90]=Ld;se[91]=Vd;se[92]=Ie;se[93]=Ie;se[94]=Ie;se[95]=Uo("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)se[e]=zd;se[120]=Gd;se[121]=qd;se[122]=Kd;se[123]=Wd;se[124]=Ie;se[125]=Ie;se[126]=Ie;se[127]=Uo("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)se[e]=Xd;se[152]=Jd;se[153]=Yd;se[154]=Zd;se[155]=Qd;se[156]=Ie;se[157]=Ie;se[158]=Ie;se[159]=eh;for(let e=160;e<=183;e++)se[e]=th;se[184]=rh;se[185]=nh;se[186]=ih;se[187]=oh;se[188]=Ie;se[189]=Ie;se[190]=Ie;se[191]=ah;for(let e=192;e<=215;e++)se[e]=sh;se[216]=uh;se[217]=lh;se[218]=ch;se[219]=fh;se[220]=Ie;se[221]=Ie;se[222]=Ie;se[223]=Ie;for(let e=224;e<=243;e++)se[e]=Uo("simple values are not supported");se[244]=Ie;se[245]=Ie;se[246]=Ie;se[247]=mh;se[248]=Uo("simple values are not supported");se[249]=vh;se[250]=bh;se[251]=wh;se[252]=Ie;se[253]=Ie;se[254]=Ie;se[255]=gh;var zt=[];for(let e=0;e<24;e++)zt[e]=new he(q.uint,e,1);for(let e=-1;e>=-24;e--)zt[31-e]=new he(q.negint,e,1);zt[64]=new he(q.bytes,new Uint8Array(0),1);zt[96]=new he(q.string,"",1);zt[128]=new he(q.array,0,1);zt[160]=new he(q.map,0,1);zt[244]=new he(q.false,!1,1);zt[245]=new he(q.true,!0,1);zt[246]=new he(q.null,null,1);function sc(){let e=[];return e[q.uint.major]=Mr,e[q.negint.major]=cs,e[q.bytes.major]=ko,e[q.string.major]=Hd,e[q.array.major]=fs,e[q.map.major]=ps,e[q.tag.major]=ds,e[q.float.major]=ys,e}var WI=sc(),HI=new Ad,Tu=class uc{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(`${tc} object contains circular references`);return new uc(r,t)}},nr={null:new he(q.null,null),undefined:new he(q.undefined,void 0),true:new he(q.true,!0),false:new he(q.false,!1),emptyArray:new he(q.array,0),emptyMap:new he(q.map,0)},hr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new he(q.float,e):e>=0?new he(q.uint,e):new he(q.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new he(q.uint,e):new he(q.negint,e)},Uint8Array(e,t,r,n){return new he(q.bytes,e)},string(e,t,r,n){return new he(q.string,e)},boolean(e,t,r,n){return e?nr.true:nr.false},null(e,t,r,n){return nr.null},undefined(e,t,r,n){return nr.undefined},ArrayBuffer(e,t,r,n){return new he(q.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new he(q.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[nr.emptyArray,new he(q.break)]:nr.emptyArray;n=Tu.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=ya(a,r,n);return r.addBreakTokens?[new he(q.array,e.length),i,new he(q.break)]:[new he(q.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length;if(!a)return r.addBreakTokens===!0?[nr.emptyMap,new he(q.break)]:nr.emptyMap;n=Tu.createCheck(n,e);let s=[],u=0;for(let l of o)s[u++]=[ya(l,r,n),ya(i?e.get(l):e[l],r,n)];return Th(s,r),r.addBreakTokens?[new he(q.map,a),s,new he(q.break)]:[new he(q.map,a),s]}};hr.Map=hr.Object;hr.Buffer=hr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))hr[`${e}Array`]=hr.DataView;function ya(e,t={},r){let n=yd(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||hr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=hr[n];if(!o)throw new Error(`${tc} unsupported type: ${n}`);return o(e,n,t,r)}function Th(e,t){t.mapSorter&&e.sort(t.mapSorter)}var Oh={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},xh=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=zt[e];if(t===void 0){let r=se[e];if(!r)throw new Error(`${_e} 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}},Yn=Symbol.for("DONE"),Ro=Symbol.for("BREAK");function Eh(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=Zn(t,r);if(o===Ro){if(e.value===1/0)break;throw new Error(`${_e} got unexpected break to lengthed array`)}if(o===Yn)throw new Error(`${_e} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function Ih(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},o=n?new Map:void 0;for(let a=0;a<e.value;a++){let s=Zn(t,r);if(s===Ro){if(e.value===1/0)break;throw new Error(`${_e} got unexpected break to lengthed map`)}if(s===Yn)throw new Error(`${_e} found map but not enough entries (got ${a} [no key], expected ${e.value})`);if(n!==!0&&typeof s!="string")throw new Error(`${_e} non-string keys not supported (got ${typeof s})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(s)||!n&&s in i))throw new Error(`${_e} found repeat map key "${s}"`);let u=Zn(t,r);if(u===Yn)throw new Error(`${_e} found map but not enough entries (got ${a} [no value], expected ${e.value})`);n?o.set(s,u):i[s]=u}return n?o:i}function Zn(e,t){if(e.done())return Yn;let r=e.next();if(r.type===q.break)return Ro;if(r.type.terminal)return r.value;if(r.type===q.array)return Eh(r,e,t);if(r.type===q.map)return Ih(r,e,t);if(r.type===q.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Zn(e,t);return t.tags[r.value](n)}throw new Error(`${_e} tag not supported (${r.value})`)}throw new Error("unsupported")}function Sh(e,t){if(!(e instanceof Uint8Array))throw new Error(`${_e} data to decode must be a Uint8Array`);t=Object.assign({},Oh,t);let r=t.tokenizer||new xh(e,t),n=Zn(r,t);if(n===Yn)throw new Error(`${_e} did not find any content to decode`);if(n===Ro)throw new Error(`${_e} got unexpected break`);return[n,e.subarray(r.pos())]}function Ah(e,t){let[r,n]=Sh(e,t);if(n.length>0)throw new Error(`${_e} too many terminals, data makes no sense`);return r}var XI=new Uint8Array(0);function $h(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function vs(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 jh(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(B){if(B instanceof Uint8Array||(ArrayBuffer.isView(B)?B=new Uint8Array(B.buffer,B.byteOffset,B.byteLength):Array.isArray(B)&&(B=Uint8Array.from(B))),!(B instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(B.length===0)return"";for(var K=0,J=0,A=0,M=B.length;A!==M&&B[A]===0;)A++,K++;for(var W=(M-A)*f+1>>>0,Y=new Uint8Array(W);A!==M;){for(var F=B[A],ne=0,V=W-1;(F!==0||ne<J)&&V!==-1;V--,ne++)F+=256*Y[V]>>>0,Y[V]=F%s>>>0,F=F/s>>>0;if(F!==0)throw new Error("Non-zero carry");J=ne,A++}for(var pe=W-J;pe!==W&&Y[pe]===0;)pe++;for(var L=u.repeat(K);pe<W;++pe)L+=e.charAt(Y[pe]);return L}function S(B){if(typeof B!="string")throw new TypeError("Expected String");if(B.length===0)return new Uint8Array;var K=0;if(B[K]!==" "){for(var J=0,A=0;B[K]===u;)J++,K++;for(var M=(B.length-K)*l+1>>>0,W=new Uint8Array(M);B[K];){var Y=r[B.charCodeAt(K)];if(Y===255)return;for(var F=0,ne=M-1;(Y!==0||F<A)&&ne!==-1;ne--,F++)Y+=s*W[ne]>>>0,W[ne]=Y%256>>>0,Y=Y/256>>>0;if(Y!==0)throw new Error("Non-zero carry");A=F,K++}if(B[K]!==" "){for(var V=M-A;V!==M&&W[V]===0;)V++;for(var pe=new Uint8Array(J+(M-V)),L=J;V!==M;)pe[L++]=W[V++];return pe}}}function T(B){var K=S(B);if(K)return K;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:S,decode:T}}var Nh=jh,Ph=Nh,kh=Ph,Uh=class{name;prefix;baseEncode;constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Rh=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,r){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return lc(this,e)}},Bh=class{decoders;constructor(e){this.decoders=e}or(e){return lc(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function lc(e,t){return new Bh({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Dh=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new Uh(e,t,r),this.decoder=new Rh(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function cc({name:e,prefix:t,encode:r,decode:n}){return new Dh(e,t,r,n)}function fc({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=kh(r,e);return cc({prefix:t,name:e,encode:n,decode:o=>vs(i(o))})}function Ch(e,t,r,n){let i={};for(let f=0;f<t.length;++f)i[t[f]]=f;let o=e.length;for(;e[o-1]==="=";)--o;let a=new Uint8Array(o*r/8|0),s=0,u=0,l=0;for(let f=0;f<o;++f){let d=i[e[f]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|d,s+=r,s>=8&&(s-=8,a[l++]=255&u>>s)}if(s>=r||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a}function Mh(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",a=0,s=0;for(let u=0;u<e.length;++u)for(s=s<<8|e[u],a+=8;a>r;)a-=r,o+=t[i&s>>a];if(a!==0&&(o+=t[i&s<<r-a]),n)for(;o.length*r&7;)o+="=";return o}function Qt({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return cc({prefix:t,name:e,encode(i){return Mh(i,n,r)},decode(i){return Ch(i,n,r,e)}})}var Li=Qt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),JI=Qt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),YI=Qt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ZI=Qt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),QI=Qt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),eS=Qt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),tS=Qt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),rS=Qt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),nS=Qt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),sr=fc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),iS=fc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Lh=pc,Ou=128,Vh=127,Fh=~Vh,zh=Math.pow(2,31);function pc(e,t,r){t=t||[],r=r||0;for(var n=r;e>=zh;)t[r++]=e&255|Ou,e/=128;for(;e&Fh;)t[r++]=e&255|Ou,e>>>=7;return t[r]=e|0,pc.bytes=r-n+1,t}var Gh=Pa,qh=128,xu=127;function Pa(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Pa.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&xu)<<i:(a&xu)*Math.pow(2,i),i+=7}while(a>=qh);return Pa.bytes=o-n,r}var Kh=Math.pow(2,7),Wh=Math.pow(2,14),Hh=Math.pow(2,21),Xh=Math.pow(2,28),Jh=Math.pow(2,35),Yh=Math.pow(2,42),Zh=Math.pow(2,49),Qh=Math.pow(2,56),ey=Math.pow(2,63),ty=function(e){return e<Kh?1:e<Wh?2:e<Hh?3:e<Xh?4:e<Jh?5:e<Yh?6:e<Zh?7:e<Qh?8:e<ey?9:10},ry={encode:Lh,decode:Gh,encodingLength:ty},ny=ry,Yi=ny;function ka(e,t=0){return[Yi.decode(e,t),Yi.decode.bytes]}function Zi(e,t,r=0){return Yi.encode(e,t,r),t}function Qi(e){return Yi.encodingLength(e)}function iy(e,t){let r=t.byteLength,n=Qi(e),i=n+Qi(r),o=new Uint8Array(i+r);return Zi(e,o,0),Zi(r,o,n),o.set(t,i),new bs(e,r,t,o)}function Ua(e){let t=vs(e),[r,n]=ka(t),[i,o]=ka(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new bs(r,i,a,t)}function oy(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&$h(e.bytes,r.bytes)}}var bs=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Eu(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return sy(r,Ra(e),t??sr.encoder);default:return uy(r,Ra(e),t??Li.encoder)}}var Iu=new WeakMap;function Ra(e){let t=Iu.get(e);if(t==null){let r=new Map;return Iu.set(e,r),r}return t}var eo=class Qe{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==Bn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==ly)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Qe.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=iy(t,r);return Qe.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 Qe.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&oy(t.multihash,n.multihash)}toString(t){return Eu(this,t)}toJSON(){return{"/":Eu(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof Qe)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new Qe(n,i,o,a??Su(n,i,o.bytes))}else if(r[cy]===!0){let{version:n,multihash:i,code:o}=r,a=Ua(i);return Qe.create(n,o,a)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==Bn)throw new Error(`Version 0 CID must use dag-pb (code: ${Bn}) block encoding`);return new Qe(t,r,n,n.bytes)}case 1:{let i=Su(t,r,n.bytes);return new Qe(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return Qe.create(0,Bn,t)}static createV1(t,r){return Qe.create(1,t,r)}static decode(t){let[r,n]=Qe.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=Qe.inspectBytes(t),n=r.size-r.multihashSize,i=vs(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),a=new bs(r.multihashCode,r.digestSize,o,i);return[r.version===0?Qe.createV0(a):Qe.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,S]=ka(t.subarray(r));return r+=S,d},i=n(),o=Bn;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=ay(t,r),o=Qe.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ra(o).set(n,t),o}};function ay(e,t){switch(e[0]){case"Q":{let r=t??sr;return[sr.prefix,r.decode(`${sr.prefix}${e}`)]}case sr.prefix:{let r=t??sr;return[sr.prefix,r.decode(e)]}case Li.prefix:{let r=t??Li;return[Li.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function sy(e,t,r){let{prefix:n}=r;if(n!==sr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function uy(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var Bn=112,ly=18;function Su(e,t,r){let n=Qi(e),i=n+Qi(t),o=new Uint8Array(i+r.byteLength);return Zi(e,o,0),Zi(t,o,n),o.set(r,i),o}var cy=Symbol.for("@ipld/js-cid/CID"),dc=42;function fy(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=eo.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new he(q.tag,dc),new he(q.bytes,r)]}function py(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function dy(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 Au={float64:!0,typeEncoders:{Object:fy,undefined:py,number:dy}},oS={...Au,typeEncoders:{...Au.typeEncoders}};function hy(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return eo.decode(e.subarray(1))}var to={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};to.tags[dc]=hy;var aS={...to,tags:to.tags.slice()},yy=e=>Ah(e,to),Sr=di(ss(),1),ma={SHA2_256:18,LENGTH:32,DAG_PB:112},my=40;function ro(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=Sr.default.decode(e);return t.seek(Sr.default.decode.bytes),r}function gy(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 vy(e){Sr.default.decode(e);let t=Sr.default.decode.bytes,r=Sr.default.decode(e.subarray(Sr.default.decode.bytes)),n=Sr.default.decode.bytes;return t+n+r}var lr={Null:e=>e===null?e:void 0,Int:e=>Number.isInteger(e)?e:void 0,Float:e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,String:e=>typeof e=="string"?e:void 0,Bool:e=>typeof e=="boolean"?e:void 0,Bytes:e=>e instanceof Uint8Array?e:void 0,Link:e=>e!==null&&typeof e=="object"&&e.asCID===e?e:void 0,List:e=>Array.isArray(e)?e:void 0,Map:e=>e!==null&&typeof e=="object"&&e.asCID!==e&&!Array.isArray(e)&&!(e instanceof Uint8Array)?e:void 0},Vn={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":lr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(lr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Vn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Vn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:lr.Int,CarV1HeaderOrV2Pragma:e=>{if(lr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,a]=t[i];switch(o){case"roots":{let s=Vn["CarV1HeaderOrV2Pragma > roots (anon)"](e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=Vn.Int(e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},Fn={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":lr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(lr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Fn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Fn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:lr.Int,CarV1HeaderOrV2Pragma:e=>{if(lr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,a]=t[i];switch(o){case"roots":{let s=Fn["CarV1HeaderOrV2Pragma > roots (anon)"](a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=Fn.Int(a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},by={toTyped:Vn.CarV1HeaderOrV2Pragma,toRepresentation:Fn.CarV1HeaderOrV2Pragma},sS=sc(),uS=di(ss(),1),lS=[new he(q.map,2),new he(q.string,"version"),new he(q.uint,1),new he(q.string,"roots")],cS=new he(q.tag,42);async function hc(e,t){let r=ro(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=yy(n);if(by.toTyped(i)===void 0)throw new Error("Invalid CAR header format");if(i.version!==1&&i.version!==2||t!==void 0&&i.version!==t)throw new Error(`Invalid CAR version: ${i.version}${t!==void 0?` (expected ${t})`:""}`);if(i.version===1){if(!Array.isArray(i.roots))throw new Error("Invalid CAR header format");return i}if(i.roots!==void 0)throw new Error("Invalid CAR header format");let o=gy(await e.exactly(my,!0));e.seek(o.dataOffset-e.pos);let a=await hc(e,1);return Object.assign(a,o)}async function wy(e){let t=await e.exactly(2,!1);if(t[0]===ma.SHA2_256&&t[1]===ma.LENGTH){let a=await e.exactly(34,!0),s=Ua(a);return eo.create(0,ma.DAG_PB,s)}let r=ro(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=ro(await e.upTo(8),e),i=await e.exactly(vy(await e.upTo(8)),!0),o=Ua(i);return eo.create(r,n,o)}async function yc(e){let t=e.pos,r=ro(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await wy(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function _y(e){let{cid:t,blockLength:r}=await yc(e);return{bytes:await e.exactly(r,!0),cid:t}}async function Ty(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await yc(e),o={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(o.blockLength),o}function Oy(e){let t=(async()=>{let r=await hc(e);if(r.version===2){let n=e.pos-r.dataOffset;e=Sy(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await _y(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await Ty(e)}}}function xy(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 Ey(e){let t=0,r=0,n=0,i=new Uint8Array(0),o=async a=>{r=i.length-n;let s=[i.subarray(n)];for(;r<a;){let l=await e();if(l==null)break;r<0?l.length>r&&s.push(l.subarray(-r)):s.push(l),r+=l.length}i=new Uint8Array(s.reduce((l,f)=>l+f.length,0));let u=0;for(let l of s)i.set(l,u),u+=l.length;n=0};return{async upTo(a){return i.length-n<a&&await o(a),i.subarray(n,n+Math.min(i.length-n,a))},async exactly(a,s=!1){if(i.length-n<a&&await o(a),i.length-n<a)throw new Error("Unexpected end of data");let u=i.subarray(n,n+a);return s&&(t+=a,n+=a),u},seek(a){t+=a,n+=a},get pos(){return t}}}function Iy(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return Ey(r)}function Sy(e,t){let r=0;return{async upTo(n){let i=await e.upTo(n);return i.length+r>t&&(i=i.subarray(0,t-r)),i},async exactly(n,i=!1){let o=await e.exactly(n,i);if(o.length+r>t)throw new Error("Unexpected end of data");return i&&(r+=n),o},seek(n){r+=n,e.seek(n)},get pos(){return e.pos}}}var mc=class{constructor(e,t){this._header=e,this._blocks=t,this._keys=t.map(r=>r.cid.toString())}get version(){return this._header.version}async getRoots(){return this._header.roots}async has(e){return this._keys.indexOf(e.toString())>-1}async get(e){let t=this._keys.indexOf(e.toString());return t>-1?this._blocks[t]:void 0}async*blocks(){for(let e of this._blocks)yield e}async*cids(){for(let e of this._blocks)yield e.cid}static async fromBytes(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return $u(xy(e))}static async fromIterable(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return $u(Iy(e))}};async function $u(e){let t=Oy(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new mc(r,n)}var fS=di(ss(),1),Ay={0:"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'",1:function(e,t){return"Cannot apply '"+e+"' to '"+t.toString()+"': Field not found."},5:"'keys()' can only be used on observable objects, arrays, sets and maps",6:"'values()' can only be used on observable objects, arrays, sets and maps",7:"'entries()' can only be used on observable objects, arrays and maps",8:"'set()' can only be used on observable objects, arrays and maps",9:"'remove()' can only be used on observable objects, arrays and maps",10:"'has()' can only be used on observable objects, arrays and maps",11:"'get()' can only be used on observable objects, arrays and maps",12:"Invalid annotation",13:"Dynamic observable objects cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",14:"Intercept handlers should return nothing or a change object",15:"Observable arrays cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",16:"Modification exception: the internal structure of an observable array was changed.",17:function(e,t){return"[mobx.array] Index out of bounds, "+e+" is larger than "+t},18:"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js",19:function(e){return"Cannot initialize from classes that inherit from Map: "+e.constructor.name},20:function(e){return"Cannot initialize map from "+e},21:function(e){return"Cannot convert to map from '"+e+"'"},22:"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js",23:"It is not possible to get index atoms from arrays",24:function(e){return"Cannot obtain administration from "+e},25:function(e,t){return"the entry '"+e+"' does not exist in the observable map '"+t+"'"},26:"please specify a property",27:function(e,t){return"no observable property '"+e.toString()+"' found on the observable object '"+t+"'"},28:function(e){return"Cannot obtain atom from "+e},29:"Expecting some object",30:"invalid action stack. did you forget to finish an action?",31:"missing option for computed: get",32:function(e,t){return"Cycle detected in computation "+e+": "+t},33:function(e){return"The setter of computed value '"+e+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"},34:function(e){return"[ComputedValue '"+e+"'] It is not possible to assign a new value to a computed value."},35:"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`",36:"isolateGlobalState should be called before MobX is running any reactions",37:function(e){return"[mobx] `observableArray."+e+"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice()."+e+"()` instead"},38:"'ownKeys()' can only be used on observable objects",39:"'defineProperty()' can only be used on observable objects"},$y=Ay;function le(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=typeof e=="string"?e:$y[e];throw typeof i=="function"&&(i=i.apply(null,r)),new Error("[MobX] "+i)}var jy={};function ws(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:jy}var gc=Object.assign,no=Object.getOwnPropertyDescriptor,Lt=Object.defineProperty,gi=Object.prototype,io=[];Object.freeze(io);var _s={};Object.freeze(_s);var Ny=typeof Proxy<"u",Py=Object.toString();function vc(){Ny||le("`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`")}function Dn(e){X.verifyProxies&&le("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+e)}function Et(){return++X.mobxGuid}function Ts(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var en=function(){};function De(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 Bo(e){return e!==null&&typeof e=="object"}function kt(e){if(!Bo(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()===Py}function bc(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Do(e,t,r){Lt(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function wc(e,t,r){Lt(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function gr(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(n){return Bo(n)&&n[r]===!0}}function yn(e){return e instanceof Map}function vi(e){return e instanceof Set}var _c=typeof Object.getOwnPropertySymbols<"u";function ky(e){var t=Object.keys(e);if(!_c)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return gi.propertyIsEnumerable.call(e,n)})):t}var Co=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:_c?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Ba(e){return typeof e=="string"?e:typeof e=="symbol"?e.toString():new String(e).toString()}function Tc(e){return e===null?null:typeof e=="object"?""+e:e}function Tt(e,t){return gi.hasOwnProperty.call(e,t)}var Uy=Object.getOwnPropertyDescriptors||function(e){var t={};return Co(e).forEach(function(r){t[r]=no(e,r)}),t};function ju(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,Dy(n.key),n)}}function Os(e,t,r){return t&&ju(e.prototype,t),r&&ju(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Jt(){return Jt=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},Jt.apply(this,arguments)}function Oc(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Da(e,t)}function Da(e,t){return Da=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Da(e,t)}function Vi(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ry(e,t){if(e){if(typeof e=="string")return Nu(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 Nu(e,t)}}function Nu(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 tn(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=Ry(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function By(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 Dy(e){var t=By(e,"string");return typeof t=="symbol"?t:String(t)}var at=Symbol("mobx-stored-annotations");function Vt(e){function t(r,n){if(bi(n))return e.decorate_20223_(r,n);mn(r,n,e)}return Object.assign(t,e)}function mn(e,t,r){if(Tt(e,at)||Do(e,at,Jt({},e[at])),oo(r)&&!Tt(e[at],t)){var n=e.constructor.name+".prototype."+t.toString();le("'"+n+"' is decorated with 'override', but no such decorated member was found on prototype.")}Cy(e,r,t),oo(r)||(e[at][t]=r)}function Cy(e,t,r){if(!oo(t)&&Tt(e[at],r)){var n=e.constructor.name+".prototype."+r.toString(),i=e[at][r].annotationType_,o=t.annotationType_;le("Cannot apply '@"+o+"' to '"+n+"':"+(`
|
|
3
|
+
The field is already decorated with '@`+i+"'.")+`
|
|
4
|
+
Re-decorating fields is not allowed.
|
|
5
|
+
Use '@override' decorator for methods overridden by subclass.`)}}function My(e){return Tt(e,at)||Do(e,at,Jt({},e[at])),e[at]}function bi(e){return typeof e=="object"&&typeof e.kind=="string"}function Mo(e,t){t.includes(e.kind)||le("The decorator applied to '"+String(e.name)+"' cannot be used on a "+e.kind+" element")}var ge=Symbol("mobx administration"),wi=function(){function e(r){r===void 0&&(r="Atom@"+Et()),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ee.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 Vc(this)},t.reportChanged=function(){bt(),Fc(this),wt()},t.toString=function(){return this.name_},e}(),xs=gr("Atom",wi);function xc(e,t,r){t===void 0&&(t=en),r===void 0&&(r=en);var n=new wi(e);return t!==en&&Go(n,t),r!==en&&bn(n,r),n}function Ly(e,t){return e===t}function Vy(e,t){return Ns(e,t)}function Fy(e,t){return Ns(e,t,1)}function zy(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Je={identity:Ly,structural:Vy,default:zy,shallow:Fy};function gn(e,t,r){return an(e)?e:Array.isArray(e)?Be.array(e,{name:r}):kt(e)?Be.object(e,void 0,{name:r}):yn(e)?Be.map(e,{name:r}):vi(e)?Be.set(e,{name:r}):typeof e=="function"&&!vn(e)&&!ri(e)?bc(e)?on(e):ei(r,e):e}function Gy(e,t,r){if(e==null||Pr(e)||_n(e)||Gt(e)||Vr(e))return e;if(Array.isArray(e))return Be.array(e,{name:r,deep:!1});if(kt(e))return Be.object(e,void 0,{name:r,deep:!1});if(yn(e))return Be.map(e,{name:r,deep:!1});if(vi(e))return Be.set(e,{name:r,deep:!1});le("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function Lo(e){return e}function qy(e,t){return an(e)&&le("observable.struct should not be used with observable values"),Ns(e,t)?t:e}var Ky="override";function oo(e){return e.annotationType_===Ky}function _i(e,t){return{annotationType_:e,options_:t,make_:Wy,extend_:Hy,decorate_20223_:Xy}}function Wy(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(vn(r.value))return 1;var o=Ec(e,this,t,r,!1);return Lt(n,t,o),2}function Hy(e,t,r,n){var i=Ec(e,this,t,r);return e.defineProperty_(t,i,n)}function Xy(e,t){Mo(t,["method","field"]);var r=t.kind,n=t.name,i=t.addInitializer,o=this,a=function(u){var l,f,d,S;return jr((l=(f=o.options_)==null?void 0:f.name)!=null?l:n.toString(),u,(d=(S=o.options_)==null?void 0:S.autoAction)!=null?d:!1)};if(r=="field"){i(function(){mn(this,n,o)});return}if(r=="method"){var s;return vn(e)||(e=a(e)),(s=this.options_)!=null&&s.bound&&i(function(){var u=this,l=u[n].bind(u);l.isMobxAction=!0,u[n]=l}),e}le("Cannot apply '"+o.annotationType_+"' to '"+String(n)+"' (kind: "+r+"):"+(`
|
|
6
|
+
'`+o.annotationType_+"' can only be used on properties with a function value."))}function Jy(e,t,r,n){var i=t.annotationType_,o=n.value;De(o)||le("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
7
|
+
'`+i+"' can only be used on properties with a function value."))}function Ec(e,t,r,n,i){var o,a,s,u,l,f,d;i===void 0&&(i=X.safeDescriptors),Jy(e,t,r,n);var S=n.value;if((o=t.options_)!=null&&o.bound){var T;S=S.bind((T=e.proxy_)!=null?T:e.target_)}return{value:jr((a=(s=t.options_)==null?void 0:s.name)!=null?a:r.toString(),S,(u=(l=t.options_)==null?void 0:l.autoAction)!=null?u:!1,(f=t.options_)!=null&&f.bound?(d=e.proxy_)!=null?d:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function Ic(e,t){return{annotationType_:e,options_:t,make_:Yy,extend_:Zy,decorate_20223_:Qy}}function Yy(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&&(!Tt(e.target_,t)||!ri(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(ri(r.value))return 1;var o=Sc(e,this,t,r,!1,!1);return Lt(n,t,o),2}function Zy(e,t,r,n){var i,o=Sc(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,o,n)}function Qy(e,t){var r;Mo(t,["method"]);var n=t.name,i=t.addInitializer;return ri(e)||(e=on(e)),(r=this.options_)!=null&&r.bound&&i(function(){var o=this,a=o[n].bind(o);a.isMobXFlow=!0,o[n]=a}),e}function em(e,t,r,n){var i=t.annotationType_,o=n.value;De(o)||le("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
8
|
+
'`+i+"' can only be used on properties with a generator function value."))}function Sc(e,t,r,n,i,o){o===void 0&&(o=X.safeDescriptors),em(e,t,r,n);var a=n.value;if(ri(a)||(a=on(a)),i){var s;a=a.bind((s=e.proxy_)!=null?s:e.target_),a.isMobXFlow=!0}return{value:a,configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function Es(e,t){return{annotationType_:e,options_:t,make_:tm,extend_:rm,decorate_20223_:nm}}function tm(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function rm(e,t,r,n){return im(e,this,t,r),e.defineComputedProperty_(t,Jt({},this.options_,{get:r.get,set:r.set}),n)}function nm(e,t){Mo(t,["getter"]);var r=this,n=t.name,i=t.addInitializer;return i(function(){var o=Tn(this)[ge],a=Jt({},r.options_,{get:e,context:this});a.name||(a.name=o.name_+"."+n.toString()),o.values_.set(n,new Nr(a))}),function(){return this[ge].getObservablePropValue_(n)}}function im(e,t,r,n){var i=t.annotationType_,o=n.get;o||le("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
9
|
+
'`+i+"' can only be used on getter(+setter) properties."))}function Vo(e,t){return{annotationType_:e,options_:t,make_:om,extend_:am,decorate_20223_:sm}}function om(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function am(e,t,r,n){var i,o;return um(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(o=this.options_)==null?void 0:o.enhancer)!=null?i:gn,n)}function sm(e,t){if(t.kind==="field")throw le("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");Mo(t,["accessor"]);var r=this,n=t.kind,i=t.name,o=new WeakSet;function a(s,u){var l,f,d=Tn(s)[ge],S=new pr(u,(l=(f=r.options_)==null?void 0:f.enhancer)!=null?l:gn,d.name_+"."+i.toString(),!1);d.values_.set(i,S),o.add(s)}if(n=="accessor")return{get:function(){return o.has(this)||a(this,e.get.call(this)),this[ge].getObservablePropValue_(i)},set:function(s){return o.has(this)||a(this,s),this[ge].setObservablePropValue_(i,s)},init:function(s){return o.has(this)||a(this,s),s}}}function um(e,t,r,n){var i=t.annotationType_;"value"in n||le("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
10
|
+
'`+i+"' cannot be used on getter/setter properties"))}var lm="true",cm=Ac();function Ac(e){return{annotationType_:lm,options_:e,make_:fm,extend_:pm,decorate_20223_:dm}}function fm(e,t,r,n){var i,o;if(r.get)return Le.make_(e,t,r,n);if(r.set){var a=jr(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:X.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(Lt(n,t,{configurable:!0,set:a}),2)}if(n!==e.target_&&typeof r.value=="function"){var s;if(bc(r.value)){var u,l=(u=this.options_)!=null&&u.autoBind?on.bound:on;return l.make_(e,t,r,n)}var f=(s=this.options_)!=null&&s.autoBind?ei.bound:ei;return f.make_(e,t,r,n)}var d=((i=this.options_)==null?void 0:i.deep)===!1?Be.ref:Be;if(typeof r.value=="function"&&(o=this.options_)!=null&&o.autoBind){var S;r.value=r.value.bind((S=e.proxy_)!=null?S:e.target_)}return d.make_(e,t,r,n)}function pm(e,t,r,n){var i,o;if(r.get)return Le.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:X.safeDescriptors?e.isPlainObject_:!0,set:jr(t.toString(),r.set)},n);if(typeof r.value=="function"&&(i=this.options_)!=null&&i.autoBind){var a;r.value=r.value.bind((a=e.proxy_)!=null?a:e.target_)}var s=((o=this.options_)==null?void 0:o.deep)===!1?Be.ref:Be;return s.extend_(e,t,r,n)}function dm(e,t){le("'"+this.annotationType_+"' cannot be used as a decorator")}var hm="observable",ym="observable.ref",mm="observable.shallow",gm="observable.struct",$c={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze($c);function ki(e){return e||$c}var Ca=Vo(hm),vm=Vo(ym,{enhancer:Lo}),bm=Vo(mm,{enhancer:Gy}),wm=Vo(gm,{enhancer:qy}),jc=Vt(Ca);function Ui(e){return e.deep===!0?gn:e.deep===!1?Lo:Tm(e.defaultDecorator)}function _m(e){var t;return e?(t=e.defaultDecorator)!=null?t:Ac(e):void 0}function Tm(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:gn}function Nc(e,t,r){if(bi(t))return Ca.decorate_20223_(e,t);if($r(t)){mn(e,t,Ca);return}return an(e)?e:kt(e)?Be.object(e,t,r):Array.isArray(e)?Be.array(e,t):yn(e)?Be.map(e,t):vi(e)?Be.set(e,t):typeof e=="object"&&e!==null?e:Be.box(e,t)}gc(Nc,jc);var Om={box:function(e,t){var r=ki(t);return new pr(e,Ui(r),r.name,!0,r.equals)},array:function(e,t){var r=ki(t);return(X.useProxies===!1||r.proxy===!1?Sg:gg)(e,Ui(r),r.name)},map:function(e,t){var r=ki(t);return new of(e,Ui(r),r.name)},set:function(e,t){var r=ki(t);return new uf(e,Ui(r),r.name)},object:function(e,t,r){return Fr(function(){return ag(X.useProxies===!1||r?.proxy===!1?Tn({},r):hg({},r),e,t)})},ref:Vt(vm),shallow:Vt(bm),deep:jc,struct:Vt(wm)},Be=gc(Nc,Om),Pc="computed",xm="computed.struct",Ma=Es(Pc),Em=Es(xm,{equals:Je.structural}),Le=function(e,t){if(bi(t))return Ma.decorate_20223_(e,t);if($r(t))return mn(e,t,Ma);if(kt(e))return Vt(Es(Pc,e));De(e)||le("First argument to `computed` should be an expression."),De(t)&&le("A setter as second argument is no longer supported, use `{ set: fn }` option instead");var r=kt(t)?t:{};return r.get=e,r.name||(r.name=e.name||""),new Nr(r)};Object.assign(Le,Ma);Le.struct=Vt(Em);var Pu,ku,ao=0,Im=1,Sm=(Pu=(ku=no(function(){},"name"))==null?void 0:ku.configurable)!=null?Pu:!1,Uu={value:"action",configurable:!0,writable:!1,enumerable:!1};function jr(e,t,r,n){r===void 0&&(r=!1),De(t)||le("`action` can only be invoked on functions"),(typeof e!="string"||!e)&&le("actions should have valid names, got: '"+e+"'");function i(){return kc(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},Sm&&(Uu.value=e,Lt(i,"name",Uu)),i}function kc(e,t,r,n,i){var o=Am(e,t,n,i);try{return r.apply(n,i)}catch(a){throw o.error_=a,a}finally{$m(o)}}function Am(e,t,r,n){var i=Xe()&&!!e,o=0;if(i){o=Date.now();var a=n?Array.from(n):io;st({type:Ss,name:e,object:r,arguments:a})}var s=X.trackingDerivation,u=!t||!s;bt();var l=X.allowStateChanges;u&&(Lr(),l=Fo(!0));var f=Is(!0),d={runAsAction_:u,prevDerivation_:s,prevAllowStateChanges_:l,prevAllowStateReads_:f,notifySpy_:i,startTime_:o,actionId_:Im++,parentActionId_:ao};return ao=d.actionId_,d}function $m(e){ao!==e.actionId_&&le(30),ao=e.parentActionId_,e.error_!==void 0&&(X.suppressReactionErrors=!0),zo(e.prevAllowStateChanges_),Hn(e.prevAllowStateReads_),wt(),e.runAsAction_&&Xt(e.prevDerivation_),e.notifySpy_&&ut({time:Date.now()-e.startTime_}),X.suppressReactionErrors=!1}function jm(e,t){var r=Fo(e);try{return t()}finally{zo(r)}}function Fo(e){var t=X.allowStateChanges;return X.allowStateChanges=e,t}function zo(e){X.allowStateChanges=e}var Uc,Nm="create";Uc=Symbol.toPrimitive;var pr=function(e){Oc(t,e);function t(n,i,o,a,s){var u;return o===void 0&&(o="ObservableValue@"+Et()),a===void 0&&(a=!0),s===void 0&&(s=Je.default),u=e.call(this,o)||this,u.enhancer=void 0,u.name_=void 0,u.equals=void 0,u.hasUnreportedChange_=!1,u.interceptors_=void 0,u.changeListeners_=void 0,u.value_=void 0,u.dehancer=void 0,u.enhancer=i,u.name_=o,u.equals=s,u.value_=i(n,void 0,o),a&&Xe()&&nn({type:Nm,object:Vi(u),observableKind:"value",debugObjectName:u.name_,newValue:""+u.value_}),u}var r=t.prototype;return r.dehanceValue=function(n){return this.dehancer!==void 0?this.dehancer(n):n},r.set=function(n){var i=this.value_;if(n=this.prepareNewValue_(n),n!==X.UNCHANGED){var o=Xe();o&&st({type:jt,object:this,observableKind:"value",debugObjectName:this.name_,newValue:n,oldValue:i}),this.setNewValue_(n),o&&ut()}},r.prepareNewValue_=function(n){if(Mt(this),gt(this)){var i=vt(this,{object:this,type:jt,newValue:n});if(!i)return X.UNCHANGED;n=i.newValue}return n=this.enhancer(n,this.value_,this.name_),this.equals(this.value_,n)?X.UNCHANGED:n},r.setNewValue_=function(n){var i=this.value_;this.value_=n,this.reportChanged(),Nt(this)&&Pt(this,{type:jt,object:this,newValue:n,oldValue:i})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(n){return Oi(this,n)},r.observe_=function(n,i){return i&&n({observableKind:"value",debugObjectName:this.name_,object:this,type:jt,newValue:this.value_,oldValue:void 0}),xi(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 Tc(this.get())},r[Uc]=function(){return this.valueOf()},t}(wi),Pm=gr("ObservableValue",pr),Rc;Rc=Symbol.toPrimitive;var Nr=function(){function e(r){this.dependenciesState_=Ee.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_=Ee.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_=Ot.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||le(31),this.derivation=r.get,this.name_=r.name||"ComputedValue@"+Et(),r.set&&(this.setter_=jr(this.name_+"-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?Je.structural:Je.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){zm(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_&&le(32,this.name_,this.derivation),X.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)La(this)&&(this.warnAboutUntrackedRead_(),bt(),this.value_=this.computeValue_(!1),wt());else if(Vc(this),La(this)){var r=X.trackingContext;this.keepAlive_&&!r&&(X.trackingContext=this),this.trackAndCompute()&&Fm(this),X.trackingContext=r}var n=this.value_;if(Fi(n))throw n.cause;return n},t.set=function(r){if(this.setter_){this.isRunningSetter_&&le(33,this.name_),this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter_=!1}}else le(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,n=this.dependenciesState_===Ee.NOT_TRACKING_,i=this.computeValue_(!0),o=n||Fi(r)||Fi(i)||!this.equals_(r,i);return o&&(this.value_=i,Xe()&&nn({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:r,newValue:i})),o},t.computeValue_=function(r){this.isComputing_=!0;var n=Fo(!1),i;if(r)i=Bc(this,this.derivation,this.scope_);else if(X.disableErrorBoundaries===!0)i=this.derivation.call(this.scope_);else try{i=this.derivation.call(this.scope_)}catch(o){i=new so(o)}return zo(n),this.isComputing_=!1,i},t.suspend_=function(){this.keepAlive_||(Va(this),this.value_=void 0,this.isTracing_!==Ot.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' was suspended and it will recompute on the next access."))},t.observe_=function(r,n){var i=this,o=!0,a=void 0;return Ut(function(){var s=i.get();if(!o||n){var u=Lr();r({observableKind:"computed",debugObjectName:i.name_,type:jt,object:i,newValue:s,oldValue:a}),Xt(u)}o=!1,a=s})},t.warnAboutUntrackedRead_=function(){this.isTracing_!==Ot.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."),(typeof this.requiresReaction_=="boolean"?this.requiresReaction_:X.computedRequiresReaction)&&console.warn("[mobx] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute.")},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return Tc(this.get())},t[Rc]=function(){return this.valueOf()},e}(),Ti=gr("ComputedValue",Nr),Ee;(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_"})(Ee||(Ee={}));var Ot;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(Ot||(Ot={}));var so=function(e){this.cause=void 0,this.cause=e};function Fi(e){return e instanceof so}function La(e){switch(e.dependenciesState_){case Ee.UP_TO_DATE_:return!1;case Ee.NOT_TRACKING_:case Ee.STALE_:return!0;case Ee.POSSIBLY_STALE_:{for(var t=Is(!0),r=Lr(),n=e.observing_,i=n.length,o=0;o<i;o++){var a=n[o];if(Ti(a)){if(X.disableErrorBoundaries)a.get();else try{a.get()}catch{return Xt(r),Hn(t),!0}if(e.dependenciesState_===Ee.STALE_)return Xt(r),Hn(t),!0}}return Dc(e),Xt(r),Hn(t),!1}}}function km(){return X.trackingDerivation!==null}function Mt(e){var t=e.observers_.size>0;!X.allowStateChanges&&(t||X.enforceActions==="always")&&console.warn("[MobX] "+(X.enforceActions?"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: ":"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ")+e.name_)}function Um(e){!X.allowStateReads&&X.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function Bc(e,t,r){var n=Is(!0);Dc(e),e.newObserving_=new Array(e.observing_.length+100),e.unboundDepsCount_=0,e.runId_=++X.runId;var i=X.trackingDerivation;X.trackingDerivation=e,X.inBatch++;var o;if(X.disableErrorBoundaries===!0)o=t.call(r);else try{o=t.call(r)}catch(a){o=new so(a)}return X.inBatch--,X.trackingDerivation=i,Bm(e),Rm(e),Hn(n),o}function Rm(e){e.observing_.length===0&&(typeof e.requiresObservable_=="boolean"?e.requiresObservable_:X.reactionRequiresObservable)&&console.warn("[mobx] Derivation '"+e.name_+"' is created/updated without reading any observable value.")}function Bm(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=Ee.UP_TO_DATE_,i=0,o=e.unboundDepsCount_,a=0;a<o;a++){var s=r[a];s.diffValue_===0&&(s.diffValue_=1,i!==a&&(r[i]=s),i++),s.dependenciesState_>n&&(n=s.dependenciesState_)}for(r.length=i,e.newObserving_=null,o=t.length;o--;){var u=t[o];u.diffValue_===0&&Mc(u,e),u.diffValue_=0}for(;i--;){var l=r[i];l.diffValue_===1&&(l.diffValue_=0,Vm(l,e))}n!==Ee.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function Va(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)Mc(t[r],e);e.dependenciesState_=Ee.NOT_TRACKING_}function Re(e){var t=Lr();try{return e()}finally{Xt(t)}}function Lr(){var e=X.trackingDerivation;return X.trackingDerivation=null,e}function Xt(e){X.trackingDerivation=e}function Is(e){var t=X.allowStateReads;return X.allowStateReads=e,t}function Hn(e){X.allowStateReads=e}function Dc(e){if(e.dependenciesState_!==Ee.UP_TO_DATE_){e.dependenciesState_=Ee.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ee.UP_TO_DATE_}}var zi=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},Gi=!0,Cc=!1,X=function(){var e=ws();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Gi=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new zi().version&&(Gi=!1),Gi?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new zi):(setTimeout(function(){Cc||le(35)},1),new zi)}();function Dm(){if((X.pendingReactions.length||X.inBatch||X.isRunningReactions)&&le(36),Cc=!0,Gi){var e=ws();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),X=new zi}}function Cm(){return X}function Mm(e){return e.observers_&&e.observers_.size>0}function Lm(e){return e.observers_}function Vm(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Mc(e,t){e.observers_.delete(t),e.observers_.size===0&&Lc(e)}function Lc(e){e.isPendingUnobservation_===!1&&(e.isPendingUnobservation_=!0,X.pendingUnobservations.push(e))}function bt(){X.inBatch++}function wt(){if(--X.inBatch===0){qc();for(var e=X.pendingUnobservations,t=0;t<e.length;t++){var r=e[t];r.isPendingUnobservation_=!1,r.observers_.size===0&&(r.isBeingObserved_&&(r.isBeingObserved_=!1,r.onBUO()),r instanceof Nr&&r.suspend_())}X.pendingUnobservations=[]}}function Vc(e){Um(e);var t=X.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved_&&X.trackingContext&&(e.isBeingObserved_=!0,e.onBO())),e.isBeingObserved_):(e.observers_.size===0&&X.inBatch>0&&Lc(e),!1)}function Fc(e){e.lowestObserverState_!==Ee.STALE_&&(e.lowestObserverState_=Ee.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ee.UP_TO_DATE_&&(t.isTracing_!==Ot.NONE&&zc(t,e),t.onBecomeStale_()),t.dependenciesState_=Ee.STALE_}))}function Fm(e){e.lowestObserverState_!==Ee.STALE_&&(e.lowestObserverState_=Ee.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ee.POSSIBLY_STALE_?(t.dependenciesState_=Ee.STALE_,t.isTracing_!==Ot.NONE&&zc(t,e)):t.dependenciesState_===Ee.UP_TO_DATE_&&(e.lowestObserverState_=Ee.UP_TO_DATE_)}))}function zm(e){e.lowestObserverState_===Ee.UP_TO_DATE_&&(e.lowestObserverState_=Ee.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ee.UP_TO_DATE_&&(t.dependenciesState_=Ee.POSSIBLY_STALE_,t.onBecomeStale_())}))}function zc(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===Ot.BREAK){var r=[];Gc(qo(e),r,1),new Function(`debugger;
|
|
11
|
+
/*
|
|
12
|
+
Tracing '`+e.name_+`'
|
|
13
|
+
|
|
14
|
+
You are entering this break point because derivation '`+e.name_+"' is being traced and '"+t.name_+`' is now forcing it to update.
|
|
15
|
+
Just follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update
|
|
16
|
+
The stackframe you are looking for is at least ~6-8 stack-frames up.
|
|
17
|
+
|
|
18
|
+
`+(e instanceof Nr?e.derivation.toString().replace(/[*]\//g,"/"):"")+`
|
|
19
|
+
|
|
20
|
+
The dependencies for this derivation are:
|
|
21
|
+
|
|
22
|
+
`+r.join(`
|
|
23
|
+
`)+`
|
|
24
|
+
*/
|
|
25
|
+
`)()}}function Gc(e,t,r){if(t.length>=1e3){t.push("(and many more)");return}t.push(""+" ".repeat(r-1)+e.name),e.dependencies&&e.dependencies.forEach(function(n){return Gc(n,t,r+1)})}var Qn=function(){function e(r,n,i,o){r===void 0&&(r="Reaction@"+Et()),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ee.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_=Ot.NONE,this.name_=r,this.onInvalidate_=n,this.errorHandler_=i,this.requiresObservable_=o}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,X.pendingReactions.push(this),qc())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){bt(),this.isScheduled_=!1;var r=X.trackingContext;if(X.trackingContext=this,La(this)){this.isTrackPending_=!0;try{this.onInvalidate_(),this.isTrackPending_&&Xe()&&nn({name:this.name_,type:"scheduled-reaction"})}catch(n){this.reportExceptionInDerivation_(n)}}X.trackingContext=r,wt()}},t.track=function(r){if(!this.isDisposed_){bt();var n=Xe(),i;n&&(i=Date.now(),st({name:this.name_,type:"reaction"})),this.isRunning_=!0;var o=X.trackingContext;X.trackingContext=this;var a=Bc(this,r,void 0);X.trackingContext=o,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Va(this),Fi(a)&&this.reportExceptionInDerivation_(a.cause),n&&ut({time:Date.now()-i}),wt()}},t.reportExceptionInDerivation_=function(r){var n=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(X.disableErrorBoundaries)throw r;var i="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";X.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name_+"' suppressed, fix error of causing action below)"):console.error(i,r),Xe()&&nn({type:"error",name:this.name_,message:i,error:""+r}),X.globalReactionErrorHandlers.forEach(function(o){return o(r,n)})},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(bt(),Va(this),wt()))},t.getDisposer_=function(r){var n=this,i=function o(){n.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",o)};return r==null||r.addEventListener==null||r.addEventListener("abort",i),i[ge]=this,i},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){r===void 0&&(r=!1),ef(this,r)},e}(),Ru=100,Fa=function(e){return e()};function qc(){X.inBatch>0||X.isRunningReactions||Fa(Gm)}function Gm(){X.isRunningReactions=!0;for(var e=X.pendingReactions,t=0;e.length>0;){++t===Ru&&(console.error("Reaction doesn't converge to a stable state after "+Ru+" iterations."+(" Probably there is a cycle in the reactive function: "+e[0])),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n<i;n++)r[n].runReaction_()}X.isRunningReactions=!1}var uo=gr("Reaction",Qn);function qm(e){var t=Fa;Fa=function(r){return e(function(){return t(r)})}}function Xe(){return!!X.spyListeners.length}function nn(e){if(X.spyListeners.length)for(var t=X.spyListeners,r=0,n=t.length;r<n;r++)t[r](e)}function st(e){var t=Jt({},e,{spyReportStart:!0});nn(t)}var Km={type:"report-end",spyReportEnd:!0};function ut(e){nn(e?Jt({},e,{type:"report-end",spyReportEnd:!0}):Km)}function Wm(e){return X.spyListeners.push(e),Ts(function(){X.spyListeners=X.spyListeners.filter(function(t){return t!==e})})}var Ss="action",Hm="action.bound",Kc="autoAction",Xm="autoAction.bound",Wc="<unnamed action>",za=_i(Ss),Jm=_i(Hm,{bound:!0}),Ga=_i(Kc,{autoAction:!0}),Ym=_i(Xm,{autoAction:!0,bound:!0});function Hc(e){var t=function(r,n){if(De(r))return jr(r.name||Wc,r,e);if(De(n))return jr(r,n,e);if(bi(n))return(e?Ga:za).decorate_20223_(r,n);if($r(n))return mn(r,n,e?Ga:za);if($r(r))return Vt(_i(e?Kc:Ss,{name:r,autoAction:e}));le("Invalid arguments for `action`")};return t}var _t=Hc(!1);Object.assign(_t,za);var ei=Hc(!0);Object.assign(ei,Ga);_t.bound=Vt(Jm);ei.bound=Vt(Ym);function ti(e){return kc(e.name||Wc,!1,e,this,void 0)}function vn(e){return De(e)&&e.isMobxAction===!0}function Ut(e,t){var r,n,i,o,a;t===void 0&&(t=_s),De(e)||le("Autorun expects a function as first argument"),vn(e)&&le("Autorun does not accept actions since actions are untrackable");var s=(r=(n=t)==null?void 0:n.name)!=null?r:e.name||"Autorun@"+Et(),u=!t.scheduler&&!t.delay,l;if(u)l=new Qn(s,function(){this.track(S)},t.onError,t.requiresObservable);else{var f=Xc(t),d=!1;l=new Qn(s,function(){d||(d=!0,f(function(){d=!1,l.isDisposed_||l.track(S)}))},t.onError,t.requiresObservable)}function S(){e(l)}return(i=t)!=null&&(o=i.signal)!=null&&o.aborted||l.schedule_(),l.getDisposer_((a=t)==null?void 0:a.signal)}var Zm=function(e){return e()};function Xc(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Zm}function Qm(e,t,r){var n,i,o,a;r===void 0&&(r=_s),(!De(e)||!De(t))&&le("First and second argument to reaction should be functions"),kt(r)||le("Third argument of reactions should be an object");var s=(n=r.name)!=null?n:"Reaction@"+Et(),u=_t(s,r.onError?eg(r.onError,t):t),l=!r.scheduler&&!r.delay,f=Xc(r),d=!0,S=!1,T,B,K=r.compareStructural?Je.structural:r.equals||Je.default,J=new Qn(s,function(){d||l?A():S||(S=!0,f(A))},r.onError,r.requiresObservable);function A(){if(S=!1,!J.isDisposed_){var M=!1;J.track(function(){var W=jm(!1,function(){return e(J)});M=d||!K(T,W),B=T,T=W}),(d&&r.fireImmediately||!d&&M)&&u(T,B,J),d=!1}}return(i=r)!=null&&(o=i.signal)!=null&&o.aborted||J.schedule_(),J.getDisposer_((a=r)==null?void 0:a.signal)}function eg(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var tg="onBO",rg="onBUO";function Go(e,t,r){return Jc(tg,e,t,r)}function bn(e,t,r){return Jc(rg,e,t,r)}function Jc(e,t,r,n){var i=typeof n=="function"?Rt(t,r):Rt(t),o=De(n)?n:r,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var s=i[a];s&&(s.delete(o),s.size===0&&delete i[a])}}var ng="never",Ri="always",ig="observed";function og(e){e.isolateGlobalState===!0&&Dm();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(X.useProxies=t===Ri?!0:t===ng?!1:typeof Proxy<"u"),t==="ifavailable"&&(X.verifyProxies=!0),r!==void 0){var n=r===Ri?Ri:r===ig;X.enforceActions=n,X.allowStateChanges=!(n===!0||n===Ri)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(X[i]=!!e[i])}),X.allowStateReads=!X.observableRequiresReaction,X.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&qm(e.reactionScheduler)}function ag(e,t,r,n){arguments.length>4&&le("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&le("'extendObservable' expects an object as first argument"),Gt(e)&&le("'extendObservable' should not be used on maps, use map.merge instead"),kt(t)||le("'extendObservable' only accepts plain objects as second argument"),(an(t)||an(r))&&le("Extending an object with another observable (object) is not supported");var i=Uy(t);return Fr(function(){var o=Tn(e,n)[ge];Co(i).forEach(function(a){o.extend_(a,i[a],r&&a in r?r[a]:!0)})}),e}function qo(e,t){return Yc(Rt(e,t))}function Yc(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=sg(e.observing_).map(Yc)),t}function lo(e,t){return Zc(Rt(e,t))}function Zc(e){var t={name:e.name_};return Mm(e)&&(t.observers=Array.from(Lm(e)).map(Zc)),t}function sg(e){return Array.from(new Set(e))}var ug=0;function Qc(){this.message="FLOW_CANCELLED"}Qc.prototype=Object.create(Error.prototype);var ga=Ic("flow"),lg=Ic("flow.bound",{bound:!0}),on=Object.assign(function(e,t){if(bi(t))return ga.decorate_20223_(e,t);if($r(t))return mn(e,t,ga);arguments.length!==1&&le("Flow expects single argument with generator function");var r=e,n=r.name||"<unnamed flow>",i=function(){var o=this,a=arguments,s=++ug,u=_t(n+" - runid: "+s+" - init",r).apply(o,a),l,f=void 0,d=new Promise(function(S,T){var B=0;l=T;function K(M){f=void 0;var W;try{W=_t(n+" - runid: "+s+" - yield "+B++,u.next).call(u,M)}catch(Y){return T(Y)}A(W)}function J(M){f=void 0;var W;try{W=_t(n+" - runid: "+s+" - yield "+B++,u.throw).call(u,M)}catch(Y){return T(Y)}A(W)}function A(M){if(De(M?.then)){M.then(A,T);return}return M.done?S(M.value):(f=Promise.resolve(M.value),f.then(K,J))}K(void 0)});return d.cancel=_t(n+" - runid: "+s+" - cancel",function(){try{f&&Bu(f);var S=u.return(void 0),T=Promise.resolve(S.value);T.then(en,en),Bu(T),l(new Qc)}catch(B){l(B)}}),d};return i.isMobXFlow=!0,i},ga);on.bound=Vt(lg);function Bu(e){De(e.cancel)&&e.cancel()}function ri(e){return e?.isMobXFlow===!0}function cg(e,t){return e?t!==void 0?Gt(e)||_n(e)?le("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."):Pr(e)?e[ge].values_.has(t):!1:Pr(e)||!!e[ge]||xs(e)||uo(e)||Ti(e):!1}function an(e){return arguments.length!==1&&le("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),cg(e)}function fg(e){if(Pr(e))return e[ge].ownKeys_();le(38)}function Bi(e,t,r){return e.set(t,r),r}function Qr(e,t){if(e==null||typeof e!="object"||e instanceof Date||!an(e))return e;if(Pm(e)||Ti(e))return Qr(e.get(),t);if(t.has(e))return t.get(e);if(_n(e)){var r=Bi(t,e,new Array(e.length));return e.forEach(function(a,s){r[s]=Qr(a,t)}),r}if(Vr(e)){var n=Bi(t,e,new Set);return e.forEach(function(a){n.add(Qr(a,t))}),n}if(Gt(e)){var i=Bi(t,e,new Map);return e.forEach(function(a,s){i.set(s,Qr(a,t))}),i}else{var o=Bi(t,e,{});return fg(e).forEach(function(a){gi.propertyIsEnumerable.call(e,a)&&(o[a]=Qr(e[a],t))}),o}}function dr(e,t){return t&&le("toJS no longer supports options"),Qr(e,new Map)}function ef(){for(var e=!1,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];typeof r[r.length-1]=="boolean"&&(e=r.pop());var i=pg(r);if(!i)return le("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");i.isTracing_===Ot.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled"),i.isTracing_=e?Ot.BREAK:Ot.LOG}function pg(e){switch(e.length){case 0:return X.trackingDerivation;case 1:return Rt(e[0]);case 2:return Rt(e[0],e[1])}}function Wt(e,t){t===void 0&&(t=void 0),bt();try{return e.apply(t)}finally{wt()}}function Or(e){return e[ge]}var dg={has:function(e,t){return X.trackingDerivation&&Dn("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),Or(e).has_(t)},get:function(e,t){return Or(e).get_(t)},set:function(e,t,r){var n;return $r(t)?(Or(e).values_.has(t)||Dn("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(n=Or(e).set_(t,r,!0))!=null?n:!0):!1},deleteProperty:function(e,t){var r;return Dn("delete properties from an observable object. Use 'remove' from 'mobx' instead."),$r(t)?(r=Or(e).delete_(t,!0))!=null?r:!0:!1},defineProperty:function(e,t,r){var n;return Dn("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(n=Or(e).defineProperty_(t,r))!=null?n:!0},ownKeys:function(e){return X.trackingDerivation&&Dn("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),Or(e).ownKeys_()},preventExtensions:function(e){le(13)}};function hg(e,t){var r,n;return vc(),e=Tn(e,t),(n=(r=e[ge]).proxy_)!=null?n:r.proxy_=new Proxy(e,dg)}function gt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Oi(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),Ts(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function vt(e,t){var r=Lr();try{for(var n=[].concat(e.interceptors_||[]),i=0,o=n.length;i<o&&(t=n[i](t),t&&!t.type&&le(14),!!t);i++);return t}finally{Xt(r)}}function Nt(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function xi(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),Ts(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Pt(e,t){var r=Lr(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,o=n.length;i<o;i++)n[i](t);Xt(r)}}function wn(e,t,r){return Fr(function(){var n,i=Tn(e,r)[ge];t&&e[at]&&le("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(n=t)!=null||(t=My(e)),Co(t).forEach(function(o){return i.make_(o,t[o])})}),e}var Du="splice",jt="update",yg=1e4,mg={get:function(e,t){var r=e[ge];return t===ge?r:t==="length"?r.getArrayLength_():typeof t=="string"&&!isNaN(t)?r.get_(parseInt(t)):Tt(co,t)?co[t]:e[t]},set:function(e,t,r){var n=e[ge];return t==="length"&&n.setArrayLength_(r),typeof t=="symbol"||isNaN(t)?e[t]=r:n.set_(parseInt(t),r),!0},preventExtensions:function(){le(15)}},As=function(){function e(r,n,i,o){r===void 0&&(r="ObservableArray@"+Et()),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=i,this.legacyMode_=o,this.atom_=new wi(r),this.enhancer_=function(a,s){return n(a,s,r+"[..]")}}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.dehanceValues_=function(r){return this.dehancer!==void 0&&r.length>0?r.map(this.dehancer):r},t.intercept_=function(r){return Oi(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}),xi(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&le("Out of range: "+r);var n=this.values_.length;if(r!==n)if(r>n){for(var i=new Array(r-n),o=0;o<r-n;o++)i[o]=void 0;this.spliceWithArray_(n,0,i)}else this.spliceWithArray_(r,n-r)},t.updateArrayLength_=function(r,n){r!==this.lastKnownLength_&&le(16),this.lastKnownLength_+=n,this.legacyMode_&&n>0&&ff(r+n+1)},t.spliceWithArray_=function(r,n,i){var o=this;Mt(this.atom_);var a=this.values_.length;if(r===void 0?r=0:r>a?r=a:r<0&&(r=Math.max(0,a+r)),arguments.length===1?n=a-r:n==null?n=0:n=Math.max(0,Math.min(n,a-r)),i===void 0&&(i=io),gt(this)){var s=vt(this,{object:this.proxy_,type:Du,index:r,removedCount:n,added:i});if(!s)return io;n=s.removedCount,i=s.added}i=i.length===0?i:i.map(function(f){return o.enhancer_(f,void 0)}),this.legacyMode_;var u=i.length-n;this.updateArrayLength_(a,u);var l=this.spliceItemsIntoValues_(r,n,i);return(n!==0||i.length!==0)&&this.notifyArraySplice_(r,i,l),this.dehanceValues_(l)},t.spliceItemsIntoValues_=function(r,n,i){if(i.length<yg){var o;return(o=this.values_).splice.apply(o,[r,n].concat(i))}else{var a=this.values_.slice(r,r+n),s=this.values_.slice(r+n);this.values_.length+=i.length-n;for(var u=0;u<i.length;u++)this.values_[r+u]=i[u];for(var l=0;l<s.length;l++)this.values_[r+i.length+l]=s[l];return a}},t.notifyArrayChildUpdate_=function(r,n,i){var o=!this.owned_&&Xe(),a=Nt(this),s=a||o?{observableKind:"array",object:this.proxy_,type:jt,debugObjectName:this.atom_.name_,index:r,newValue:n,oldValue:i}:null;o&&st(s),this.atom_.reportChanged(),a&&Pt(this,s),o&&ut()},t.notifyArraySplice_=function(r,n,i){var o=!this.owned_&&Xe(),a=Nt(this),s=a||o?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Du,index:r,removed:i,added:n,removedCount:i.length,addedCount:n.length}:null;o&&st(s),this.atom_.reportChanged(),a&&Pt(this,s),o&&ut()},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx.array] Attempt to read an array index ("+r+") that is out of bounds ("+this.values_.length+"). Please check length first. Out of bound indices will not be tracked by MobX");return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},t.set_=function(r,n){var i=this.values_;if(this.legacyMode_&&r>i.length&&le(17,r,i.length),r<i.length){Mt(this.atom_);var o=i[r];if(gt(this)){var a=vt(this,{type:jt,object:this.proxy_,index:r,newValue:n});if(!a)return;n=a.newValue}n=this.enhancer_(n,o);var s=n!==o;s&&(i[r]=n,this.notifyArrayChildUpdate_(r,n,o))}else{for(var u=new Array(r+1-i.length),l=0;l<u.length-1;l++)u[l]=void 0;u[u.length-1]=n,this.spliceWithArray_(i.length,0,u)}},e}();function gg(e,t,r,n){return r===void 0&&(r="ObservableArray@"+Et()),n===void 0&&(n=!1),vc(),Fr(function(){var i=new As(r,t,n,!1);wc(i.values_,ge,i);var o=new Proxy(i.values_,mg);return i.proxy_=o,e&&e.length&&i.spliceWithArray_(0,0,e),o})}var co={clear:function(){return this.splice(0)},replace:function(e){var t=this[ge];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];var o=this[ge];switch(arguments.length){case 0:return[];case 1:return o.spliceWithArray_(e);case 2:return o.spliceWithArray_(e,t)}return o.spliceWithArray_(e,t,n)},spliceWithArray:function(e,t,r){return this[ge].spliceWithArray_(e,t,r)},push:function(){for(var e=this[ge],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[ge].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[ge],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.spliceWithArray_(0,0,r),e.values_.length},reverse:function(){return X.trackingDerivation&&le(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){X.trackingDerivation&&le(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[ge],r=t.dehanceValues_(t.values_).indexOf(e);return r>-1?(this.splice(r,1),!0):!1}};Pe("at",ct);Pe("concat",ct);Pe("flat",ct);Pe("includes",ct);Pe("indexOf",ct);Pe("join",ct);Pe("lastIndexOf",ct);Pe("slice",ct);Pe("toString",ct);Pe("toLocaleString",ct);Pe("toSorted",ct);Pe("toSpliced",ct);Pe("with",ct);Pe("every",Dt);Pe("filter",Dt);Pe("find",Dt);Pe("findIndex",Dt);Pe("findLast",Dt);Pe("findLastIndex",Dt);Pe("flatMap",Dt);Pe("forEach",Dt);Pe("map",Dt);Pe("some",Dt);Pe("toReversed",Dt);Pe("reduce",tf);Pe("reduceRight",tf);function Pe(e,t){typeof Array.prototype[e]=="function"&&(co[e]=t(e))}function ct(e){return function(){var t=this[ge];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function Dt(e){return function(t,r){var n=this,i=this[ge];i.atom_.reportObserved();var o=i.dehanceValues_(i.values_);return o[e](function(a,s){return t.call(r,a,s,n)})}}function tf(e){return function(){var t=this,r=this[ge];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(o,a,s){return i(o,a,s,t)},n[e].apply(n,arguments)}}var vg=gr("ObservableArrayAdministration",As);function _n(e){return Bo(e)&&vg(e[ge])}var rf,nf,bg={},cr="add",fo="delete";rf=Symbol.iterator;nf=Symbol.toStringTag;var of=function(){function e(r,n,i){var o=this;n===void 0&&(n=gn),i===void 0&&(i="ObservableMap@"+Et()),this.enhancer_=void 0,this.name_=void 0,this[ge]=bg,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,De(Map)||le(18),Fr(function(){o.keysAtom_=xc(o.name_+".keys()"),o.data_=new Map,o.hasMap_=new Map,r&&o.merge(r)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var n=this;if(!X.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var o=i=new pr(this.has_(r),Lo,this.name_+"."+Ba(r)+"?",!1);this.hasMap_.set(r,o),bn(o,function(){return n.hasMap_.delete(r)})}return i.get()},t.set=function(r,n){var i=this.has_(r);if(gt(this)){var o=vt(this,{type:i?jt:cr,object:this,newValue:n,name:r});if(!o)return this;n=o.newValue}return i?this.updateValue_(r,n):this.addValue_(r,n),this},t.delete=function(r){var n=this;if(Mt(this.keysAtom_),gt(this)){var i=vt(this,{type:fo,object:this,name:r});if(!i)return!1}if(this.has_(r)){var o=Xe(),a=Nt(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:fo,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return o&&st(s),Wt(function(){var u;n.keysAtom_.reportChanged(),(u=n.hasMap_.get(r))==null||u.setNewValue_(!1);var l=n.data_.get(r);l.setNewValue_(void 0),n.data_.delete(r)}),a&&Pt(this,s),o&&ut(),!0}return!1},t.updateValue_=function(r,n){var i=this.data_.get(r);if(n=i.prepareNewValue_(n),n!==X.UNCHANGED){var o=Xe(),a=Nt(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:jt,object:this,oldValue:i.value_,name:r,newValue:n}:null;o&&st(s),i.setNewValue_(n),a&&Pt(this,s),o&&ut()}},t.addValue_=function(r,n){var i=this;Mt(this.keysAtom_),Wt(function(){var u,l=new pr(n,i.enhancer_,i.name_+"."+Ba(r),!1);i.data_.set(r,l),n=l.value_,(u=i.hasMap_.get(r))==null||u.setNewValue_(!0),i.keysAtom_.reportChanged()});var o=Xe(),a=Nt(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:cr,object:this,name:r,newValue:n}:null;o&&st(s),a&&Pt(this,s),o&&ut()},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 ni({next:function(){var i=n.next(),o=i.done,a=i.value;return{done:o,value:o?void 0:r.get(a)}}})},t.entries=function(){var r=this,n=this.keys();return ni({next:function(){var i=n.next(),o=i.done,a=i.value;return{done:o,value:o?void 0:[a,r.get(a)]}}})},t[rf]=function(){return this.entries()},t.forEach=function(r,n){for(var i=tn(this),o;!(o=i()).done;){var a=o.value,s=a[0],u=a[1];r.call(n,u,s,this)}},t.merge=function(r){var n=this;return Gt(r)&&(r=new Map(r)),Wt(function(){kt(r)?ky(r).forEach(function(i){return n.set(i,r[i])}):Array.isArray(r)?r.forEach(function(i){var o=i[0],a=i[1];return n.set(o,a)}):yn(r)?(r.constructor!==Map&&le(19,r),r.forEach(function(i,o){return n.set(o,i)})):r!=null&&le(20,r)}),this},t.clear=function(){var r=this;Wt(function(){Re(function(){for(var n=tn(r.keys()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.replace=function(r){var n=this;return Wt(function(){for(var i=wg(r),o=new Map,a=!1,s=tn(n.data_.keys()),u;!(u=s()).done;){var l=u.value;if(!i.has(l)){var f=n.delete(l);if(f)a=!0;else{var d=n.data_.get(l);o.set(l,d)}}}for(var S=tn(i.entries()),T;!(T=S()).done;){var B=T.value,K=B[0],J=B[1],A=n.data_.has(K);if(n.set(K,J),n.data_.has(K)){var M=n.data_.get(K);o.set(K,M),A||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var W=n.data_.keys(),Y=o.keys(),F=W.next(),ne=Y.next();!F.done;){if(F.value!==ne.value){n.keysAtom_.reportChanged();break}F=W.next(),ne=Y.next()}n.data_=o}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,n){return n===!0&&le("`observe` doesn't support fireImmediately=true in combination with maps."),xi(this,r)},t.intercept_=function(r){return Oi(this,r)},Os(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:nf,get:function(){return"Map"}}]),e}(),Gt=gr("ObservableMap",of);function wg(e){if(yn(e)||Gt(e))return e;if(Array.isArray(e))return new Map(e);if(kt(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return le(21,e)}var af,sf,_g={};af=Symbol.iterator;sf=Symbol.toStringTag;var uf=function(){function e(r,n,i){var o=this;n===void 0&&(n=gn),i===void 0&&(i="ObservableSet@"+Et()),this.name_=void 0,this[ge]=_g,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,De(Set)||le(22),this.enhancer_=function(a,s){return n(a,s,i)},Fr(function(){o.atom_=xc(o.name_),r&&o.replace(r)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;Wt(function(){Re(function(){for(var n=tn(r.data_.values()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.forEach=function(r,n){for(var i=tn(this),o;!(o=i()).done;){var a=o.value;r.call(n,a,a,this)}},t.add=function(r){var n=this;if(Mt(this.atom_),gt(this)){var i=vt(this,{type:cr,object:this,newValue:r});if(!i)return this}if(!this.has(r)){Wt(function(){n.data_.add(n.enhancer_(r,void 0)),n.atom_.reportChanged()});var o=Xe(),a=Nt(this),s=a||o?{observableKind:"set",debugObjectName:this.name_,type:cr,object:this,newValue:r}:null;o&&st(s),a&&Pt(this,s),o&&ut()}return this},t.delete=function(r){var n=this;if(gt(this)){var i=vt(this,{type:fo,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var o=Xe(),a=Nt(this),s=a||o?{observableKind:"set",debugObjectName:this.name_,type:fo,object:this,oldValue:r}:null;return o&&st(s),Wt(function(){n.atom_.reportChanged(),n.data_.delete(r)}),a&&Pt(this,s),o&&ut(),!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 ni({next:function(){var o=r;return r+=1,o<i.length?{value:[n[o],i[o]],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 ni({next:function(){return n<i.length?{value:r.dehanceValue_(i[n++]),done:!1}:{done:!0}}})},t.replace=function(r){var n=this;return Vr(r)&&(r=new Set(r)),Wt(function(){Array.isArray(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):vi(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):r!=null&&le("Cannot initialize set from "+r)}),this},t.observe_=function(r,n){return n===!0&&le("`observe` doesn't support fireImmediately=true in combination with sets."),xi(this,r)},t.intercept_=function(r){return Oi(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[af]=function(){return this.values()},Os(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:sf,get:function(){return"Set"}}]),e}(),Vr=gr("ObservableSet",uf),Cu=Object.create(null),Mu="remove",qa=function(){function e(r,n,i,o){n===void 0&&(n=new Map),o===void 0&&(o=cm),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=r,this.values_=n,this.name_=i,this.defaultAnnotation_=o,this.keysAtom_=new wi(this.name_+".keys"),this.isPlainObject_=kt(this.target_),pf(this.defaultAnnotation_)||le("defaultAnnotation must be valid annotation"),this.appliedAnnotations_={}}var t=e.prototype;return t.getObservablePropValue_=function(r){return this.values_.get(r).get()},t.setObservablePropValue_=function(r,n){var i=this.values_.get(r);if(i instanceof Nr)return i.set(n),!0;if(gt(this)){var o=vt(this,{type:jt,object:this.proxy_||this.target_,name:r,newValue:n});if(!o)return null;n=o.newValue}if(n=i.prepareNewValue_(n),n!==X.UNCHANGED){var a=Nt(this),s=Xe(),u=a||s?{type:jt,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:i.value_,name:r,newValue:n}:null;s&&st(u),i.setNewValue_(n),a&&Pt(this,u),s&&ut()}return!0},t.get_=function(r){return X.trackingDerivation&&!Tt(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,n,i){return i===void 0&&(i=!1),Tt(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,n):i?Reflect.set(this.target_,r,n):(this.target_[r]=n,!0):this.extend_(r,{value:n,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,i)},t.has_=function(r){if(!X.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var n=this.pendingKeys_.get(r);return n||(n=new pr(r in this.target_,Lo,this.name_+"."+Ba(r)+"?",!1),this.pendingKeys_.set(r,n)),n.get()},t.make_=function(r,n){if(n===!0&&(n=this.defaultAnnotation_),n!==!1){if(Fu(this,n,r),!(r in this.target_)){var i;if((i=this.target_[at])!=null&&i[r])return;le(1,n.annotationType_,this.name_+"."+r.toString())}for(var o=this.target_;o&&o!==gi;){var a=no(o,r);if(a){var s=n.make_(this,r,a,o);if(s===0)return;if(s===1)break}o=Object.getPrototypeOf(o)}Vu(this,n,r)}},t.extend_=function(r,n,i,o){if(o===void 0&&(o=!1),i===!0&&(i=this.defaultAnnotation_),i===!1)return this.defineProperty_(r,n,o);Fu(this,i,r);var a=i.extend_(this,r,n,o);return a&&Vu(this,i,r),a},t.defineProperty_=function(r,n,i){i===void 0&&(i=!1),Mt(this.keysAtom_);try{bt();var o=this.delete_(r);if(!o)return o;if(gt(this)){var a=vt(this,{object:this.proxy_||this.target_,name:r,type:cr,newValue:n.value});if(!a)return null;var s=a.newValue;n.value!==s&&(n=Jt({},n,{value:s}))}if(i){if(!Reflect.defineProperty(this.target_,r,n))return!1}else Lt(this.target_,r,n);this.notifyPropertyAddition_(r,n.value)}finally{wt()}return!0},t.defineObservableProperty_=function(r,n,i,o){o===void 0&&(o=!1),Mt(this.keysAtom_);try{bt();var a=this.delete_(r);if(!a)return a;if(gt(this)){var s=vt(this,{object:this.proxy_||this.target_,name:r,type:cr,newValue:n});if(!s)return null;n=s.newValue}var u=Lu(r),l={configurable:X.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(o){if(!Reflect.defineProperty(this.target_,r,l))return!1}else Lt(this.target_,r,l);var f=new pr(n,i,this.name_+"."+r.toString(),!1);this.values_.set(r,f),this.notifyPropertyAddition_(r,f.value_)}finally{wt()}return!0},t.defineComputedProperty_=function(r,n,i){i===void 0&&(i=!1),Mt(this.keysAtom_);try{bt();var o=this.delete_(r);if(!o)return o;if(gt(this)){var a=vt(this,{object:this.proxy_||this.target_,name:r,type:cr,newValue:void 0});if(!a)return null}n.name||(n.name=this.name_+"."+r.toString()),n.context=this.proxy_||this.target_;var s=Lu(r),u={configurable:X.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:s.get,set:s.set};if(i){if(!Reflect.defineProperty(this.target_,r,u))return!1}else Lt(this.target_,r,u);this.values_.set(r,new Nr(n)),this.notifyPropertyAddition_(r,void 0)}finally{wt()}return!0},t.delete_=function(r,n){if(n===void 0&&(n=!1),Mt(this.keysAtom_),!Tt(this.target_,r))return!0;if(gt(this)){var i=vt(this,{object:this.proxy_||this.target_,name:r,type:Mu});if(!i)return null}try{var o,a;bt();var s=Nt(this),u=Xe(),l=this.values_.get(r),f=void 0;if(!l&&(s||u)){var d;f=(d=no(this.target_,r))==null?void 0:d.value}if(n){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(delete this.appliedAnnotations_[r],l&&(this.values_.delete(r),l instanceof pr&&(f=l.value_),Fc(l)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(a=o.get(r))==null||a.set(r in this.target_),s||u){var S={type:Mu,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:f,name:r};u&&st(S),s&&Pt(this,S),u&&ut()}}finally{wt()}return!0},t.observe_=function(r,n){return n===!0&&le("`observe` doesn't support the fire immediately property for observable objects."),xi(this,r)},t.intercept_=function(r){return Oi(this,r)},t.notifyPropertyAddition_=function(r,n){var i,o,a=Nt(this),s=Xe();if(a||s){var u=a||s?{type:cr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:n}:null;s&&st(u),a&&Pt(this,u),s&&ut()}(i=this.pendingKeys_)==null||(o=i.get(r))==null||o.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Co(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Tn(e,t){var r;if(t&&Pr(e)&&le("Options can't be provided for already observable objects."),Tt(e,ge))return js(e)instanceof qa||le("Cannot convert '"+po(e)+`' into observable object:
|
|
26
|
+
The target is already observable of different type.
|
|
27
|
+
Extending builtins is not supported.`),e;Object.isExtensible(e)||le("Cannot make the designated object observable; it is not extensible");var n=(r=t?.name)!=null?r:(kt(e)?"ObservableObject":e.constructor.name)+"@"+Et(),i=new qa(e,new Map,String(n),_m(t));return Do(e,ge,i),e}var Tg=gr("ObservableObjectAdministration",qa);function Lu(e){return Cu[e]||(Cu[e]={get:function(){return this[ge].getObservablePropValue_(e)},set:function(t){return this[ge].setObservablePropValue_(e,t)}})}function Pr(e){return Bo(e)?Tg(e[ge]):!1}function Vu(e,t,r){var n;e.appliedAnnotations_[r]=t,(n=e.target_[at])==null||delete n[r]}function Fu(e,t,r){if(pf(t)||le("Cannot annotate '"+e.name_+"."+r.toString()+"': Invalid annotation."),!oo(t)&&Tt(e.appliedAnnotations_,r)){var n=e.name_+"."+r.toString(),i=e.appliedAnnotations_[r].annotationType_,o=t.annotationType_;le("Cannot apply '"+o+"' to '"+n+"':"+(`
|
|
28
|
+
The field is already annotated with '`+i+"'.")+`
|
|
29
|
+
Re-annotating fields is not allowed.
|
|
30
|
+
Use 'override' annotation for methods overridden by subclass.`)}}var Og=cf(0),xg=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),va=0,lf=function(){};function Eg(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}Eg(lf,Array.prototype);var $s=function(e,t,r){Oc(n,e);function n(o,a,s,u){var l;return s===void 0&&(s="ObservableArray@"+Et()),u===void 0&&(u=!1),l=e.call(this)||this,Fr(function(){var f=new As(s,a,u,!0);f.proxy_=Vi(l),wc(Vi(l),ge,f),o&&o.length&&l.spliceWithArray(0,0,o),xg&&Object.defineProperty(Vi(l),"0",Og)}),l}var i=n.prototype;return i.concat=function(){this[ge].atom_.reportObserved();for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return Array.prototype.concat.apply(this.slice(),a.map(function(u){return _n(u)?u.slice():u}))},i[r]=function(){var o=this,a=0;return ni({next:function(){return a<o.length?{value:o[a++],done:!1}:{done:!0,value:void 0}}})},Os(n,[{key:"length",get:function(){return this[ge].getArrayLength_()},set:function(o){this[ge].setArrayLength_(o)}},{key:t,get:function(){return"Array"}}]),n}(lf,Symbol.toStringTag,Symbol.iterator);Object.entries(co).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&Do($s.prototype,t,r)});function cf(e){return{enumerable:!1,configurable:!0,get:function(){return this[ge].get_(e)},set:function(t){this[ge].set_(e,t)}}}function Ig(e){Lt($s.prototype,""+e,cf(e))}function ff(e){if(e>va){for(var t=va;t<e+100;t++)Ig(t);va=e}}ff(1e3);function Sg(e,t,r){return new $s(e,t,r)}function Rt(e,t){if(typeof e=="object"&&e!==null){if(_n(e))return t!==void 0&&le(23),e[ge].atom_;if(Vr(e))return e.atom_;if(Gt(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||le(25,t,po(e)),r}if(Pr(e)){if(!t)return le(26);var n=e[ge].values_.get(t);return n||le(27,t,po(e)),n}if(xs(e)||Ti(e)||uo(e))return e}else if(De(e)&&uo(e[ge]))return e[ge];le(28)}function js(e,t){if(e||le(29),t!==void 0)return js(Rt(e,t));if(xs(e)||Ti(e)||uo(e)||Gt(e)||Vr(e))return e;if(e[ge])return e[ge];le(24,e)}function po(e,t){var r;if(t!==void 0)r=Rt(e,t);else{if(vn(e))return e.name;Pr(e)||Gt(e)||Vr(e)?r=js(e):r=Rt(e)}return r.name_}function Fr(e){var t=Lr(),r=Fo(!0);bt();try{return e()}finally{wt(),zo(r),Xt(t)}}var zu=gi.toString;function Ns(e,t,r){return r===void 0&&(r=-1),Ka(e,t,r)}function Ka(e,t,r,n,i){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var o=typeof e;if(o!=="function"&&o!=="object"&&typeof t!="object")return!1;var a=zu.call(e);if(a!==zu.call(t))return!1;switch(a){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:+e==0?1/+e===1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":r>=0&&r++;break}e=Gu(e),t=Gu(t);var s=a==="[object Array]";if(!s){if(typeof e!="object"||typeof t!="object")return!1;var u=e.constructor,l=t.constructor;if(u!==l&&!(De(u)&&u instanceof u&&De(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(r===0)return!1;r<0&&(r=-1),n=n||[],i=i||[];for(var f=n.length;f--;)if(n[f]===e)return i[f]===t;if(n.push(e),i.push(t),s){if(f=e.length,f!==t.length)return!1;for(;f--;)if(!Ka(e[f],t[f],r-1,n,i))return!1}else{var d=Object.keys(e),S;if(f=d.length,Object.keys(t).length!==f)return!1;for(;f--;)if(S=d[f],!(Tt(t,S)&&Ka(e[S],t[S],r-1,n,i)))return!1}return n.pop(),i.pop(),!0}function Gu(e){return _n(e)?e.slice():yn(e)||Gt(e)||vi(e)||Vr(e)?Array.from(e.entries()):e}function ni(e){return e[Symbol.iterator]=Ag,e}function Ag(){return this}function pf(e){return e instanceof Object&&typeof e.annotationType_=="string"&&De(e.make_)&&De(e.extend_)}["Symbol","Map","Set"].forEach(function(e){var t=ws();typeof t[e]>"u"&&le("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:Wm,extras:{getDebugName:po},$mobx:ge});var $g=Object.create,Ps=Object.defineProperty,jg=Object.getOwnPropertyDescriptor,df=Object.getOwnPropertyNames,Ng=Object.getPrototypeOf,Pg=Object.prototype.hasOwnProperty,qe=(e,t)=>function(){return t||(0,e[df(e)[0]])((t={exports:{}}).exports,t),t.exports},hf=(e,t)=>{for(var r in t)Ps(e,r,{get:t[r],enumerable:!0})},kg=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of df(t))!Pg.call(e,i)&&i!==r&&Ps(e,i,{get:()=>t[i],enumerable:!(n=jg(t,i))||n.enumerable});return e},er=(e,t,r)=>(r=e!=null?$g(Ng(e)):{},kg(t||!e||!e.__esModule?Ps(r,"default",{value:e,enumerable:!0}):r,e)),vr=qe({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/typebox.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Type=e.JsonType=e.JavaScriptTypeBuilder=e.JsonTypeBuilder=e.TypeBuilder=e.TypeBuilderError=e.TransformEncodeBuilder=e.TransformDecodeBuilder=e.TemplateLiteralDslParser=e.TemplateLiteralGenerator=e.TemplateLiteralGeneratorError=e.TemplateLiteralFinite=e.TemplateLiteralFiniteError=e.TemplateLiteralParser=e.TemplateLiteralParserError=e.TemplateLiteralResolver=e.TemplateLiteralPattern=e.TemplateLiteralPatternError=e.UnionResolver=e.KeyArrayResolver=e.KeyArrayResolverError=e.KeyResolver=e.ObjectMap=e.Intrinsic=e.IndexedAccessor=e.TypeClone=e.TypeExtends=e.TypeExtendsResult=e.TypeExtendsError=e.ExtendsUndefined=e.TypeGuard=e.TypeGuardUnknownTypeError=e.ValueGuard=e.FormatRegistry=e.TypeBoxError=e.TypeRegistry=e.PatternStringExact=e.PatternNumberExact=e.PatternBooleanExact=e.PatternString=e.PatternNumber=e.PatternBoolean=e.Kind=e.Hint=e.Optional=e.Readonly=e.Transform=void 0,e.Transform=Symbol.for("TypeBox.Transform"),e.Readonly=Symbol.for("TypeBox.Readonly"),e.Optional=Symbol.for("TypeBox.Optional"),e.Hint=Symbol.for("TypeBox.Hint"),e.Kind=Symbol.for("TypeBox.Kind"),e.PatternBoolean="(true|false)",e.PatternNumber="(0|[1-9][0-9]*)",e.PatternString="(.*)",e.PatternBooleanExact=`^${e.PatternBoolean}$`,e.PatternNumberExact=`^${e.PatternNumber}$`,e.PatternStringExact=`^${e.PatternString}$`;var t;(function(p){let _=new Map;function I(){return new Map(_)}p.Entries=I;function k(){return _.clear()}p.Clear=k;function N(w){return _.delete(w)}p.Delete=N;function P(w){return _.has(w)}p.Has=P;function m(w,c){_.set(w,c)}p.Set=m;function $(w){return _.get(w)}p.Get=$})(t||(e.TypeRegistry=t={}));var r=class extends Error{constructor(p){super(p)}};e.TypeBoxError=r;var n;(function(p){let _=new Map;function I(){return new Map(_)}p.Entries=I;function k(){return _.clear()}p.Clear=k;function N(w){return _.delete(w)}p.Delete=N;function P(w){return _.has(w)}p.Has=P;function m(w,c){_.set(w,c)}p.Set=m;function $(w){return _.get(w)}p.Get=$})(n||(e.FormatRegistry=n={}));var i;(function(p){function _(b){return Array.isArray(b)}p.IsArray=_;function I(b){return typeof b=="bigint"}p.IsBigInt=I;function k(b){return typeof b=="boolean"}p.IsBoolean=k;function N(b){return b instanceof globalThis.Date}p.IsDate=N;function P(b){return b===null}p.IsNull=P;function m(b){return typeof b=="number"}p.IsNumber=m;function $(b){return typeof b=="object"&&b!==null}p.IsObject=$;function w(b){return typeof b=="string"}p.IsString=w;function c(b){return b instanceof globalThis.Uint8Array}p.IsUint8Array=c;function O(b){return b===void 0}p.IsUndefined=O})(i||(e.ValueGuard=i={}));var o=class extends r{};e.TypeGuardUnknownTypeError=o;var a;(function(p){function _(g){try{return new RegExp(g),!0}catch{return!1}}function I(g){if(!i.IsString(g))return!1;for(let je=0;je<g.length;je++){let dt=g.charCodeAt(je);if(dt>=7&&dt<=13||dt===27||dt===127)return!1}return!0}function k(g){return m(g)||Fe(g)}function N(g){return i.IsUndefined(g)||i.IsBigInt(g)}function P(g){return i.IsUndefined(g)||i.IsNumber(g)}function m(g){return i.IsUndefined(g)||i.IsBoolean(g)}function $(g){return i.IsUndefined(g)||i.IsString(g)}function w(g){return i.IsUndefined(g)||i.IsString(g)&&I(g)&&_(g)}function c(g){return i.IsUndefined(g)||i.IsString(g)&&I(g)}function O(g){return i.IsUndefined(g)||Fe(g)}function b(g){return be(g,"Any")&&$(g.$id)}p.TAny=b;function v(g){return be(g,"Array")&&g.type==="array"&&$(g.$id)&&Fe(g.items)&&P(g.minItems)&&P(g.maxItems)&&m(g.uniqueItems)&&O(g.contains)&&P(g.minContains)&&P(g.maxContains)}p.TArray=v;function U(g){return be(g,"AsyncIterator")&&g.type==="AsyncIterator"&&$(g.$id)&&Fe(g.items)}p.TAsyncIterator=U;function z(g){return be(g,"BigInt")&&g.type==="bigint"&&$(g.$id)&&N(g.exclusiveMaximum)&&N(g.exclusiveMinimum)&&N(g.maximum)&&N(g.minimum)&&N(g.multipleOf)}p.TBigInt=z;function Q(g){return be(g,"Boolean")&&g.type==="boolean"&&$(g.$id)}p.TBoolean=Q;function ie(g){return be(g,"Constructor")&&g.type==="Constructor"&&$(g.$id)&&i.IsArray(g.parameters)&&g.parameters.every(je=>Fe(je))&&Fe(g.returns)}p.TConstructor=ie;function me(g){return be(g,"Date")&&g.type==="Date"&&$(g.$id)&&P(g.exclusiveMaximumTimestamp)&&P(g.exclusiveMinimumTimestamp)&&P(g.maximumTimestamp)&&P(g.minimumTimestamp)&&P(g.multipleOfTimestamp)}p.TDate=me;function we(g){return be(g,"Function")&&g.type==="Function"&&$(g.$id)&&i.IsArray(g.parameters)&&g.parameters.every(je=>Fe(je))&&Fe(g.returns)}p.TFunction=we;function ke(g){return be(g,"Integer")&&g.type==="integer"&&$(g.$id)&&P(g.exclusiveMaximum)&&P(g.exclusiveMinimum)&&P(g.maximum)&&P(g.minimum)&&P(g.multipleOf)}p.TInteger=ke;function Ce(g){return be(g,"Intersect")&&!(i.IsString(g.type)&&g.type!=="object")&&i.IsArray(g.allOf)&&g.allOf.every(je=>Fe(je)&&!Un(je))&&$(g.type)&&(m(g.unevaluatedProperties)||O(g.unevaluatedProperties))&&$(g.$id)}p.TIntersect=Ce;function br(g){return be(g,"Iterator")&&g.type==="Iterator"&&$(g.$id)&&Fe(g.items)}p.TIterator=br;function be(g,je){return tr(g)&&g[e.Kind]===je}p.TKindOf=be;function tr(g){return i.IsObject(g)&&e.Kind in g&&i.IsString(g[e.Kind])}p.TKind=tr;function wr(g){return j(g)&&i.IsString(g.const)}p.TLiteralString=wr;function x(g){return j(g)&&i.IsNumber(g.const)}p.TLiteralNumber=x;function ce(g){return j(g)&&i.IsBoolean(g.const)}p.TLiteralBoolean=ce;function j(g){return be(g,"Literal")&&$(g.$id)&&(i.IsBoolean(g.const)||i.IsNumber(g.const)||i.IsString(g.const))}p.TLiteral=j;function ve(g){return be(g,"Never")&&i.IsObject(g.not)&&Object.getOwnPropertyNames(g.not).length===0}p.TNever=ve;function ae(g){return be(g,"Not")&&Fe(g.not)}p.TNot=ae;function de(g){return be(g,"Null")&&g.type==="null"&&$(g.$id)}p.TNull=de;function Ae(g){return be(g,"Number")&&g.type==="number"&&$(g.$id)&&P(g.exclusiveMaximum)&&P(g.exclusiveMinimum)&&P(g.maximum)&&P(g.minimum)&&P(g.multipleOf)}p.TNumber=Ae;function Me(g){return be(g,"Object")&&g.type==="object"&&$(g.$id)&&i.IsObject(g.properties)&&k(g.additionalProperties)&&P(g.minProperties)&&P(g.maxProperties)&&Object.entries(g.properties).every(([je,dt])=>I(je)&&Fe(dt))}p.TObject=Me;function tt(g){return be(g,"Promise")&&g.type==="Promise"&&$(g.$id)&&Fe(g.item)}p.TPromise=tt;function Ze(g){return be(g,"Record")&&g.type==="object"&&$(g.$id)&&k(g.additionalProperties)&&i.IsObject(g.patternProperties)&&(je=>{let dt=Object.getOwnPropertyNames(je.patternProperties);return dt.length===1&&_(dt[0])&&i.IsObject(je.patternProperties)&&Fe(je.patternProperties[dt[0]])})(g)}p.TRecord=Ze;function nt(g){return i.IsObject(g)&&e.Hint in g&&g[e.Hint]==="Recursive"}p.TRecursive=nt;function rr(g){return be(g,"Ref")&&$(g.$id)&&i.IsString(g.$ref)}p.TRef=rr;function Jr(g){return be(g,"String")&&g.type==="string"&&$(g.$id)&&P(g.minLength)&&P(g.maxLength)&&w(g.pattern)&&c(g.format)}p.TString=Jr;function Yr(g){return be(g,"Symbol")&&g.type==="symbol"&&$(g.$id)}p.TSymbol=Yr;function _r(g){return be(g,"TemplateLiteral")&&g.type==="string"&&i.IsString(g.pattern)&&g.pattern[0]==="^"&&g.pattern[g.pattern.length-1]==="$"}p.TTemplateLiteral=_r;function ji(g){return be(g,"This")&&$(g.$id)&&i.IsString(g.$ref)}p.TThis=ji;function Un(g){return i.IsObject(g)&&e.Transform in g}p.TTransform=Un;function Ve(g){return be(g,"Tuple")&&g.type==="array"&&$(g.$id)&&i.IsNumber(g.minItems)&&i.IsNumber(g.maxItems)&&g.minItems===g.maxItems&&(i.IsUndefined(g.items)&&i.IsUndefined(g.additionalItems)&&g.minItems===0||i.IsArray(g.items)&&g.items.every(je=>Fe(je)))}p.TTuple=Ve;function Ni(g){return be(g,"Undefined")&&g.type==="undefined"&&$(g.$id)}p.TUndefined=Ni;function ca(g){return Tr(g)&&g.anyOf.every(je=>wr(je)||x(je))}p.TUnionLiteral=ca;function Tr(g){return be(g,"Union")&&$(g.$id)&&i.IsObject(g)&&i.IsArray(g.anyOf)&&g.anyOf.every(je=>Fe(je))}p.TUnion=Tr;function Zr(g){return be(g,"Uint8Array")&&g.type==="Uint8Array"&&$(g.$id)&&P(g.minByteLength)&&P(g.maxByteLength)}p.TUint8Array=Zr;function rt(g){return be(g,"Unknown")&&$(g.$id)}p.TUnknown=rt;function Pi(g){return be(g,"Unsafe")}p.TUnsafe=Pi;function Rn(g){return be(g,"Void")&&g.type==="void"&&$(g.$id)}p.TVoid=Rn;function fa(g){return i.IsObject(g)&&g[e.Readonly]==="Readonly"}p.TReadonly=fa;function pa(g){return i.IsObject(g)&&g[e.Optional]==="Optional"}p.TOptional=pa;function Fe(g){return i.IsObject(g)&&(b(g)||v(g)||Q(g)||z(g)||U(g)||ie(g)||me(g)||we(g)||ke(g)||Ce(g)||br(g)||j(g)||ve(g)||ae(g)||de(g)||Ae(g)||Me(g)||tt(g)||Ze(g)||rr(g)||Jr(g)||Yr(g)||_r(g)||ji(g)||Ve(g)||Ni(g)||Tr(g)||Zr(g)||rt(g)||Pi(g)||Rn(g)||tr(g)&&t.Has(g[e.Kind]))}p.TSchema=Fe})(a||(e.TypeGuard=a={}));var s;(function(p){function _(I){return I[e.Kind]==="Intersect"?I.allOf.every(k=>_(k)):I[e.Kind]==="Union"?I.anyOf.some(k=>_(k)):I[e.Kind]==="Undefined"?!0:I[e.Kind]==="Not"?!_(I.not):!1}p.Check=_})(s||(e.ExtendsUndefined=s={}));var u=class extends r{};e.TypeExtendsError=u;var l;(function(p){p[p.Union=0]="Union",p[p.True=1]="True",p[p.False=2]="False"})(l||(e.TypeExtendsResult=l={}));var f;(function(p){function _(y){return y===l.False?y:l.True}function I(y){throw new u(y)}function k(y){return a.TNever(y)||a.TIntersect(y)||a.TUnion(y)||a.TUnknown(y)||a.TAny(y)}function N(y,h){return a.TNever(h)?be(y,h):a.TIntersect(h)?we(y,h):a.TUnion(h)?da(y,h):a.TUnknown(h)?vu(y,h):a.TAny(h)?P(y,h):I("StructuralRight")}function P(y,h){return l.True}function m(y,h){return a.TIntersect(h)?we(y,h):a.TUnion(h)&&h.anyOf.some(xe=>a.TAny(xe)||a.TUnknown(xe))?l.True:a.TUnion(h)?l.Union:a.TUnknown(h)||a.TAny(h)?l.True:l.Union}function $(y,h){return a.TUnknown(y)?l.False:a.TAny(y)?l.Union:a.TNever(y)?l.True:l.False}function w(y,h){return a.TObject(h)&&_r(h)?l.True:k(h)?N(y,h):a.TArray(h)?_(Ne(y.items,h.items)):l.False}function c(y,h){return k(h)?N(y,h):a.TAsyncIterator(h)?_(Ne(y.items,h.items)):l.False}function O(y,h){return k(h)?N(y,h):a.TObject(h)?Ve(y,h):a.TRecord(h)?rt(y,h):a.TBigInt(h)?l.True:l.False}function b(y,h){return a.TLiteral(y)&&i.IsBoolean(y.const)||a.TBoolean(y)?l.True:l.False}function v(y,h){return k(h)?N(y,h):a.TObject(h)?Ve(y,h):a.TRecord(h)?rt(y,h):a.TBoolean(h)?l.True:l.False}function U(y,h){return k(h)?N(y,h):a.TObject(h)?Ve(y,h):a.TConstructor(h)?y.parameters.length>h.parameters.length?l.False:y.parameters.every((xe,Kt)=>_(Ne(h.parameters[Kt],xe))===l.True)?_(Ne(y.returns,h.returns)):l.False:l.False}function z(y,h){return k(h)?N(y,h):a.TObject(h)?Ve(y,h):a.TRecord(h)?rt(y,h):a.TDate(h)?l.True:l.False}function Q(y,h){return k(h)?N(y,h):a.TObject(h)?Ve(y,h):a.TFunction(h)?y.parameters.length>h.parameters.length?l.False:y.parameters.every((xe,Kt)=>_(Ne(h.parameters[Kt],xe))===l.True)?_(Ne(y.returns,h.returns)):l.False:l.False}function ie(y,h){return a.TLiteral(y)&&i.IsNumber(y.const)||a.TNumber(y)||a.TInteger(y)?l.True:l.False}function me(y,h){return a.TInteger(h)||a.TNumber(h)?l.True:k(h)?N(y,h):a.TObject(h)?Ve(y,h):a.TRecord(h)?rt(y,h):l.False}function we(y,h){return h.allOf.every(xe=>Ne(y,xe)===l.True)?l.True:l.False}function ke(y,h){return y.allOf.some(xe=>Ne(xe,h)===l.True)?l.True:l.False}function Ce(y,h){return k(h)?N(y,h):a.TIterator(h)?_(Ne(y.items,h.items)):l.False}function br(y,h){return a.TLiteral(h)&&h.const===y.const?l.True:k(h)?N(y,h):a.TObject(h)?Ve(y,h):a.TRecord(h)?rt(y,h):a.TString(h)?Rn(y,h):a.TNumber(h)?j(y,h):a.TInteger(h)?ie(y,h):a.TBoolean(h)?b(y,h):l.False}function be(y,h){return l.False}function tr(y,h){return l.True}function wr(y){let[h,xe]=[y,0];for(;a.TNot(h);)h=h.not,xe+=1;return xe%2===0?h:e.Type.Unknown()}function x(y,h){return a.TNot(y)?Ne(wr(y),h):a.TNot(h)?Ne(y,wr(h)):I("Invalid fallthrough for Not")}function ce(y,h){return k(h)?N(y,h):a.TObject(h)?Ve(y,h):a.TRecord(h)?rt(y,h):a.TNull(h)?l.True:l.False}function j(y,h){return a.TLiteralNumber(y)||a.TNumber(y)||a.TInteger(y)?l.True:l.False}function ve(y,h){return k(h)?N(y,h):a.TObject(h)?Ve(y,h):a.TRecord(h)?rt(y,h):a.TInteger(h)||a.TNumber(h)?l.True:l.False}function ae(y,h){return Object.getOwnPropertyNames(y.properties).length===h}function de(y){return _r(y)}function Ae(y){return ae(y,0)||ae(y,1)&&"description"in y.properties&&a.TUnion(y.properties.description)&&y.properties.description.anyOf.length===2&&(a.TString(y.properties.description.anyOf[0])&&a.TUndefined(y.properties.description.anyOf[1])||a.TString(y.properties.description.anyOf[1])&&a.TUndefined(y.properties.description.anyOf[0]))}function Me(y){return ae(y,0)}function tt(y){return ae(y,0)}function Ze(y){return ae(y,0)}function nt(y){return ae(y,0)}function rr(y){return _r(y)}function Jr(y){let h=e.Type.Number();return ae(y,0)||ae(y,1)&&"length"in y.properties&&_(Ne(y.properties.length,h))===l.True}function Yr(y){return ae(y,0)}function _r(y){let h=e.Type.Number();return ae(y,0)||ae(y,1)&&"length"in y.properties&&_(Ne(y.properties.length,h))===l.True}function ji(y){let h=e.Type.Function([e.Type.Any()],e.Type.Any());return ae(y,0)||ae(y,1)&&"then"in y.properties&&_(Ne(y.properties.then,h))===l.True}function Un(y,h){return Ne(y,h)===l.False||a.TOptional(y)&&!a.TOptional(h)?l.False:l.True}function Ve(y,h){return a.TUnknown(y)?l.False:a.TAny(y)?l.Union:a.TNever(y)||a.TLiteralString(y)&&de(h)||a.TLiteralNumber(y)&&Me(h)||a.TLiteralBoolean(y)&&tt(h)||a.TSymbol(y)&&Ae(h)||a.TBigInt(y)&&Ze(h)||a.TString(y)&&de(h)||a.TSymbol(y)&&Ae(h)||a.TNumber(y)&&Me(h)||a.TInteger(y)&&Me(h)||a.TBoolean(y)&&tt(h)||a.TUint8Array(y)&&rr(h)||a.TDate(y)&&nt(h)||a.TConstructor(y)&&Yr(h)||a.TFunction(y)&&Jr(h)?l.True:a.TRecord(y)&&a.TString(Tr(y))?h[e.Hint]==="Record"?l.True:l.False:a.TRecord(y)&&a.TNumber(Tr(y))&&ae(h,0)?l.True:l.False}function Ni(y,h){return k(h)?N(y,h):a.TRecord(h)?rt(y,h):a.TObject(h)?(()=>{for(let xe of Object.getOwnPropertyNames(h.properties)){if(!(xe in y.properties)&&!a.TOptional(h.properties[xe]))return l.False;if(a.TOptional(h.properties[xe]))return l.True;if(Un(y.properties[xe],h.properties[xe])===l.False)return l.False}return l.True})():l.False}function ca(y,h){return k(h)?N(y,h):a.TObject(h)&&ji(h)?l.True:a.TPromise(h)?_(Ne(y.item,h.item)):l.False}function Tr(y){return e.PatternNumberExact in y.patternProperties?e.Type.Number():e.PatternStringExact in y.patternProperties?e.Type.String():I("Unknown record key pattern")}function Zr(y){return e.PatternNumberExact in y.patternProperties?y.patternProperties[e.PatternNumberExact]:e.PatternStringExact in y.patternProperties?y.patternProperties[e.PatternStringExact]:I("Unable to get record value schema")}function rt(y,h){let[xe,Kt]=[Tr(h),Zr(h)];return a.TLiteralString(y)&&a.TNumber(xe)&&_(Ne(y,Kt))===l.True?l.True:a.TUint8Array(y)&&a.TNumber(xe)||a.TString(y)&&a.TNumber(xe)||a.TArray(y)&&a.TNumber(xe)?Ne(y,Kt):a.TObject(y)?(()=>{for(let td of Object.getOwnPropertyNames(y.properties))if(Un(Kt,y.properties[td])===l.False)return l.False;return l.True})():l.False}function Pi(y,h){return k(h)?N(y,h):a.TObject(h)?Ve(y,h):a.TRecord(h)?Ne(Zr(y),Zr(h)):l.False}function Rn(y,h){return a.TLiteral(y)&&i.IsString(y.const)||a.TString(y)?l.True:l.False}function fa(y,h){return k(h)?N(y,h):a.TObject(h)?Ve(y,h):a.TRecord(h)?rt(y,h):a.TString(h)?l.True:l.False}function pa(y,h){return k(h)?N(y,h):a.TObject(h)?Ve(y,h):a.TRecord(h)?rt(y,h):a.TSymbol(h)?l.True:l.False}function Fe(y,h){return a.TTemplateLiteral(y)?Ne(F.Resolve(y),h):a.TTemplateLiteral(h)?Ne(y,F.Resolve(h)):I("Invalid fallthrough for TemplateLiteral")}function g(y,h){return a.TArray(h)&&y.items!==void 0&&y.items.every(xe=>Ne(xe,h.items)===l.True)}function je(y,h){return a.TNever(y)?l.True:a.TUnknown(y)?l.False:a.TAny(y)?l.Union:l.False}function dt(y,h){return k(h)?N(y,h):a.TObject(h)&&_r(h)||a.TArray(h)&&g(y,h)?l.True:a.TTuple(h)?i.IsUndefined(y.items)&&!i.IsUndefined(h.items)||!i.IsUndefined(y.items)&&i.IsUndefined(h.items)?l.False:i.IsUndefined(y.items)&&!i.IsUndefined(h.items)||y.items.every((xe,Kt)=>Ne(xe,h.items[Kt])===l.True)?l.True:l.False:l.False}function Hp(y,h){return k(h)?N(y,h):a.TObject(h)?Ve(y,h):a.TRecord(h)?rt(y,h):a.TUint8Array(h)?l.True:l.False}function Xp(y,h){return k(h)?N(y,h):a.TObject(h)?Ve(y,h):a.TRecord(h)?rt(y,h):a.TVoid(h)?Zp(y,h):a.TUndefined(h)?l.True:l.False}function da(y,h){return h.anyOf.some(xe=>Ne(y,xe)===l.True)?l.True:l.False}function Jp(y,h){return y.anyOf.every(xe=>Ne(xe,h)===l.True)?l.True:l.False}function vu(y,h){return l.True}function Yp(y,h){return a.TNever(h)?be(y,h):a.TIntersect(h)?we(y,h):a.TUnion(h)?da(y,h):a.TAny(h)?P(y,h):a.TString(h)?Rn(y,h):a.TNumber(h)?j(y,h):a.TInteger(h)?ie(y,h):a.TBoolean(h)?b(y,h):a.TArray(h)?$(y,h):a.TTuple(h)?je(y,h):a.TObject(h)?Ve(y,h):a.TUnknown(h)?l.True:l.False}function Zp(y,h){return a.TUndefined(y)||a.TUndefined(y)?l.True:l.False}function Qp(y,h){return a.TIntersect(h)?we(y,h):a.TUnion(h)?da(y,h):a.TUnknown(h)?vu(y,h):a.TAny(h)?P(y,h):a.TObject(h)?Ve(y,h):a.TVoid(h)?l.True:l.False}function Ne(y,h){return a.TTemplateLiteral(y)||a.TTemplateLiteral(h)?Fe(y,h):a.TNot(y)||a.TNot(h)?x(y,h):a.TAny(y)?m(y,h):a.TArray(y)?w(y,h):a.TBigInt(y)?O(y,h):a.TBoolean(y)?v(y,h):a.TAsyncIterator(y)?c(y,h):a.TConstructor(y)?U(y,h):a.TDate(y)?z(y,h):a.TFunction(y)?Q(y,h):a.TInteger(y)?me(y,h):a.TIntersect(y)?ke(y,h):a.TIterator(y)?Ce(y,h):a.TLiteral(y)?br(y,h):a.TNever(y)?tr(y,h):a.TNull(y)?ce(y,h):a.TNumber(y)?ve(y,h):a.TObject(y)?Ni(y,h):a.TRecord(y)?Pi(y,h):a.TString(y)?fa(y,h):a.TSymbol(y)?pa(y,h):a.TTuple(y)?dt(y,h):a.TPromise(y)?ca(y,h):a.TUint8Array(y)?Hp(y,h):a.TUndefined(y)?Xp(y,h):a.TUnion(y)?Jp(y,h):a.TUnknown(y)?Yp(y,h):a.TVoid(y)?Qp(y,h):I(`Unknown left type operand '${y[e.Kind]}'`)}function ed(y,h){return Ne(y,h)}p.Extends=ed})(f||(e.TypeExtends=f={}));var d;(function(p){function _(w){return w.map(c=>P(c))}function I(w){return new Date(w.getTime())}function k(w){return new Uint8Array(w)}function N(w){let c=Object.getOwnPropertyNames(w).reduce((b,v)=>({...b,[v]:P(w[v])}),{}),O=Object.getOwnPropertySymbols(w).reduce((b,v)=>({...b,[v]:P(w[v])}),{});return{...c,...O}}function P(w){return i.IsArray(w)?_(w):i.IsDate(w)?I(w):i.IsUint8Array(w)?k(w):i.IsObject(w)?N(w):w}function m(w){return w.map(c=>$(c))}p.Rest=m;function $(w,c={}){return{...P(w),...c}}p.Type=$})(d||(e.TypeClone=d={}));var S;(function(p){function _(U){return U.map(z=>{let{[e.Optional]:Q,...ie}=d.Type(z);return ie})}function I(U){return U.every(z=>a.TOptional(z))}function k(U){return U.some(z=>a.TOptional(z))}function N(U){return I(U.allOf)?e.Type.Optional(e.Type.Intersect(_(U.allOf))):U}function P(U){return k(U.anyOf)?e.Type.Optional(e.Type.Union(_(U.anyOf))):U}function m(U){return U[e.Kind]==="Intersect"?N(U):U[e.Kind]==="Union"?P(U):U}function $(U,z){let Q=U.allOf.reduce((ie,me)=>{let we=b(me,z);return we[e.Kind]==="Never"?ie:[...ie,we]},[]);return m(e.Type.Intersect(Q))}function w(U,z){let Q=U.anyOf.map(ie=>b(ie,z));return m(e.Type.Union(Q))}function c(U,z){let Q=U.properties[z];return i.IsUndefined(Q)?e.Type.Never():e.Type.Union([Q])}function O(U,z){let Q=U.items;if(i.IsUndefined(Q))return e.Type.Never();let ie=Q[z];return i.IsUndefined(ie)?e.Type.Never():ie}function b(U,z){return U[e.Kind]==="Intersect"?$(U,z):U[e.Kind]==="Union"?w(U,z):U[e.Kind]==="Object"?c(U,z):U[e.Kind]==="Tuple"?O(U,z):e.Type.Never()}function v(U,z,Q={}){let ie=z.map(me=>b(U,me.toString()));return m(e.Type.Union(ie,Q))}p.Resolve=v})(S||(e.IndexedAccessor=S={}));var T;(function(p){function _(O){let[b,v]=[O.slice(0,1),O.slice(1)];return`${b.toLowerCase()}${v}`}function I(O){let[b,v]=[O.slice(0,1),O.slice(1)];return`${b.toUpperCase()}${v}`}function k(O){return O.toUpperCase()}function N(O){return O.toLowerCase()}function P(O,b){let v=V.ParseExact(O.pattern);if(!L.Check(v))return{...O,pattern:m(O.pattern,b)};let U=[...C.Generate(v)].map(ie=>e.Type.Literal(ie)),z=$(U,b),Q=e.Type.Union(z);return e.Type.TemplateLiteral([Q])}function m(O,b){return typeof O=="string"?b==="Uncapitalize"?_(O):b==="Capitalize"?I(O):b==="Uppercase"?k(O):b==="Lowercase"?N(O):O:O.toString()}function $(O,b){if(O.length===0)return[];let[v,...U]=O;return[c(v,b),...$(U,b)]}function w(O,b){return a.TTemplateLiteral(O)?P(O,b):a.TUnion(O)?e.Type.Union($(O.anyOf,b)):a.TLiteral(O)?e.Type.Literal(m(O.const,b)):O}function c(O,b){return w(O,b)}p.Map=c})(T||(e.Intrinsic=T={}));var B;(function(p){function _(m,$){return e.Type.Intersect(m.allOf.map(w=>N(w,$)),{...m})}function I(m,$){return e.Type.Union(m.anyOf.map(w=>N(w,$)),{...m})}function k(m,$){return $(m)}function N(m,$){return m[e.Kind]==="Intersect"?_(m,$):m[e.Kind]==="Union"?I(m,$):m[e.Kind]==="Object"?k(m,$):m}function P(m,$,w){return{...N(d.Type(m),$),...w}}p.Map=P})(B||(e.ObjectMap=B={}));var K;(function(p){function _(c){return c[0]==="^"&&c[c.length-1]==="$"?c.slice(1,c.length-1):c}function I(c,O){return c.allOf.reduce((b,v)=>[...b,...m(v,O)],[])}function k(c,O){let b=c.anyOf.map(v=>m(v,O));return[...b.reduce((v,U)=>U.map(z=>b.every(Q=>Q.includes(z))?v.add(z):v)[0],new Set)]}function N(c,O){return Object.getOwnPropertyNames(c.properties)}function P(c,O){return O.includePatterns?Object.getOwnPropertyNames(c.patternProperties):[]}function m(c,O){return a.TIntersect(c)?I(c,O):a.TUnion(c)?k(c,O):a.TObject(c)?N(c,O):a.TRecord(c)?P(c,O):[]}function $(c,O){return[...new Set(m(c,O))]}p.ResolveKeys=$;function w(c){return`^(${$(c,{includePatterns:!0}).map(O=>`(${_(O)})`).join("|")})$`}p.ResolvePattern=w})(K||(e.KeyResolver=K={}));var J=class extends r{};e.KeyArrayResolverError=J;var A;(function(p){function _(I){return Array.isArray(I)?I:a.TUnionLiteral(I)?I.anyOf.map(k=>k.const.toString()):a.TLiteral(I)?[I.const]:a.TTemplateLiteral(I)?(()=>{let k=V.ParseExact(I.pattern);if(!L.Check(k))throw new J("Cannot resolve keys from infinite template expression");return[...C.Generate(k)]})():[]}p.Resolve=_})(A||(e.KeyArrayResolver=A={}));var M;(function(p){function*_(k){for(let N of k.anyOf)N[e.Kind]==="Union"?yield*_(N):yield N}function I(k){return e.Type.Union([..._(k)],{...k})}p.Resolve=I})(M||(e.UnionResolver=M={}));var W=class extends r{};e.TemplateLiteralPatternError=W;var Y;(function(p){function _(P){throw new W(P)}function I(P){return P.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function k(P,m){return a.TTemplateLiteral(P)?P.pattern.slice(1,P.pattern.length-1):a.TUnion(P)?`(${P.anyOf.map($=>k($,m)).join("|")})`:a.TNumber(P)?`${m}${e.PatternNumber}`:a.TInteger(P)?`${m}${e.PatternNumber}`:a.TBigInt(P)?`${m}${e.PatternNumber}`:a.TString(P)?`${m}${e.PatternString}`:a.TLiteral(P)?`${m}${I(P.const.toString())}`:a.TBoolean(P)?`${m}${e.PatternBoolean}`:_(`Unexpected Kind '${P[e.Kind]}'`)}function N(P){return`^${P.map(m=>k(m,"")).join("")}$`}p.Create=N})(Y||(e.TemplateLiteralPattern=Y={}));var F;(function(p){function _(I){let k=V.ParseExact(I.pattern);if(!L.Check(k))return e.Type.String();let N=[...C.Generate(k)].map(P=>e.Type.Literal(P));return e.Type.Union(N)}p.Resolve=_})(F||(e.TemplateLiteralResolver=F={}));var ne=class extends r{};e.TemplateLiteralParserError=ne;var V;(function(p){function _(U,z,Q){return U[z]===Q&&U.charCodeAt(z-1)!==92}function I(U,z){return _(U,z,"(")}function k(U,z){return _(U,z,")")}function N(U,z){return _(U,z,"|")}function P(U){if(!(I(U,0)&&k(U,U.length-1)))return!1;let z=0;for(let Q=0;Q<U.length;Q++)if(I(U,Q)&&(z+=1),k(U,Q)&&(z-=1),z===0&&Q!==U.length-1)return!1;return!0}function m(U){return U.slice(1,U.length-1)}function $(U){let z=0;for(let Q=0;Q<U.length;Q++)if(I(U,Q)&&(z+=1),k(U,Q)&&(z-=1),N(U,Q)&&z===0)return!0;return!1}function w(U){for(let z=0;z<U.length;z++)if(I(U,z))return!0;return!1}function c(U){let[z,Q]=[0,0],ie=[];for(let we=0;we<U.length;we++)if(I(U,we)&&(z+=1),k(U,we)&&(z-=1),N(U,we)&&z===0){let ke=U.slice(Q,we);ke.length>0&&ie.push(b(ke)),Q=we+1}let me=U.slice(Q);return me.length>0&&ie.push(b(me)),ie.length===0?{type:"const",const:""}:ie.length===1?ie[0]:{type:"or",expr:ie}}function O(U){function z(me,we){if(!I(me,we))throw new ne("TemplateLiteralParser: Index must point to open parens");let ke=0;for(let Ce=we;Ce<me.length;Ce++)if(I(me,Ce)&&(ke+=1),k(me,Ce)&&(ke-=1),ke===0)return[we,Ce];throw new ne("TemplateLiteralParser: Unclosed group parens in expression")}function Q(me,we){for(let ke=we;ke<me.length;ke++)if(I(me,ke))return[we,ke];return[we,me.length]}let ie=[];for(let me=0;me<U.length;me++)if(I(U,me)){let[we,ke]=z(U,me),Ce=U.slice(we,ke+1);ie.push(b(Ce)),me=ke}else{let[we,ke]=Q(U,me),Ce=U.slice(we,ke);Ce.length>0&&ie.push(b(Ce)),me=ke-1}return ie.length===0?{type:"const",const:""}:ie.length===1?ie[0]:{type:"and",expr:ie}}function b(U){return P(U)?b(m(U)):$(U)?c(U):w(U)?O(U):{type:"const",const:U}}p.Parse=b;function v(U){return b(U.slice(1,U.length-1))}p.ParseExact=v})(V||(e.TemplateLiteralParser=V={}));var pe=class extends r{};e.TemplateLiteralFiniteError=pe;var L;(function(p){function _(m){throw new pe(m)}function I(m){return m.type==="or"&&m.expr.length===2&&m.expr[0].type==="const"&&m.expr[0].const==="0"&&m.expr[1].type==="const"&&m.expr[1].const==="[1-9][0-9]*"}function k(m){return m.type==="or"&&m.expr.length===2&&m.expr[0].type==="const"&&m.expr[0].const==="true"&&m.expr[1].type==="const"&&m.expr[1].const==="false"}function N(m){return m.type==="const"&&m.const===".*"}function P(m){return k(m)?!0:I(m)||N(m)?!1:m.type==="and"?m.expr.every($=>P($)):m.type==="or"?m.expr.every($=>P($)):m.type==="const"?!0:_("Unknown expression type")}p.Check=P})(L||(e.TemplateLiteralFinite=L={}));var D=class extends r{};e.TemplateLiteralGeneratorError=D;var C;(function(p){function*_(m){if(m.length===1)return yield*m[0];for(let $ of m[0])for(let w of _(m.slice(1)))yield`${$}${w}`}function*I(m){return yield*_(m.expr.map($=>[...P($)]))}function*k(m){for(let $ of m.expr)yield*P($)}function*N(m){return yield m.const}function*P(m){return m.type==="and"?yield*I(m):m.type==="or"?yield*k(m):m.type==="const"?yield*N(m):(()=>{throw new D("Unknown expression")})()}p.Generate=P})(C||(e.TemplateLiteralGenerator=C={}));var re;(function(p){function*_(P){let m=P.trim().replace(/"|'/g,"");return m==="boolean"?yield e.Type.Boolean():m==="number"?yield e.Type.Number():m==="bigint"?yield e.Type.BigInt():m==="string"?yield e.Type.String():yield(()=>{let $=m.split("|").map(w=>e.Type.Literal(w.trim()));return $.length===0?e.Type.Never():$.length===1?$[0]:e.Type.Union($)})()}function*I(P){if(P[1]!=="{"){let m=e.Type.Literal("$"),$=k(P.slice(1));return yield*[m,...$]}for(let m=2;m<P.length;m++)if(P[m]==="}"){let $=_(P.slice(2,m)),w=k(P.slice(m+1));return yield*[...$,...w]}yield e.Type.Literal(P)}function*k(P){for(let m=0;m<P.length;m++)if(P[m]==="$"){let $=e.Type.Literal(P.slice(0,m)),w=I(P.slice(m));return yield*[$,...w]}yield e.Type.Literal(P)}function N(P){return[...k(P)]}p.Parse=N})(re||(e.TemplateLiteralDslParser=re={}));var te=class{constructor(p){this.schema=p}Decode(p){return new E(this.schema,p)}};e.TransformDecodeBuilder=te;var E=class{constructor(p,_){this.schema=p,this.decode=_}Encode(p){let _=d.Type(this.schema);return a.TTransform(_)?(()=>{let I={Encode:k=>_[e.Transform].Encode(p(k)),Decode:k=>this.decode(_[e.Transform].Decode(k))};return{..._,[e.Transform]:I}})():(()=>{let I={Decode:this.decode,Encode:p};return{..._,[e.Transform]:I}})()}};e.TransformEncodeBuilder=E;var G=0,oe=class extends r{};e.TypeBuilderError=oe;var H=class{Create(p){return p}Throw(p){throw new oe(p)}Discard(p,_){return _.reduce((I,k)=>{let{[k]:N,...P}=I;return P},p)}Strict(p){return JSON.parse(JSON.stringify(p))}};e.TypeBuilder=H;var Z=class extends H{ReadonlyOptional(p){return this.Readonly(this.Optional(p))}Readonly(p){return{...d.Type(p),[e.Readonly]:"Readonly"}}Optional(p){return{...d.Type(p),[e.Optional]:"Optional"}}Any(p={}){return this.Create({...p,[e.Kind]:"Any"})}Array(p,_={}){return this.Create({..._,[e.Kind]:"Array",type:"array",items:d.Type(p)})}Boolean(p={}){return this.Create({...p,[e.Kind]:"Boolean",type:"boolean"})}Capitalize(p,_={}){return{...T.Map(d.Type(p),"Capitalize"),..._}}Composite(p,_){let I=e.Type.Intersect(p,{}),k=K.ResolveKeys(I,{includePatterns:!1}).reduce((N,P)=>({...N,[P]:e.Type.Index(I,[P])}),{});return e.Type.Object(k,_)}Enum(p,_={}){if(i.IsUndefined(p))return this.Throw("Enum undefined or empty");let I=Object.getOwnPropertyNames(p).filter(N=>isNaN(N)).map(N=>p[N]),k=[...new Set(I)].map(N=>e.Type.Literal(N));return this.Union(k,{..._,[e.Hint]:"Enum"})}Extends(p,_,I,k,N={}){switch(f.Extends(p,_)){case l.Union:return this.Union([d.Type(I,N),d.Type(k,N)]);case l.True:return d.Type(I,N);case l.False:return d.Type(k,N)}}Exclude(p,_,I={}){return a.TTemplateLiteral(p)?this.Exclude(F.Resolve(p),_,I):a.TTemplateLiteral(_)?this.Exclude(p,F.Resolve(_),I):a.TUnion(p)?(()=>{let k=p.anyOf.filter(N=>f.Extends(N,_)===l.False);return k.length===1?d.Type(k[0],I):this.Union(k,I)})():f.Extends(p,_)!==l.False?this.Never(I):d.Type(p,I)}Extract(p,_,I={}){return a.TTemplateLiteral(p)?this.Extract(F.Resolve(p),_,I):a.TTemplateLiteral(_)?this.Extract(p,F.Resolve(_),I):a.TUnion(p)?(()=>{let k=p.anyOf.filter(N=>f.Extends(N,_)!==l.False);return k.length===1?d.Type(k[0],I):this.Union(k,I)})():f.Extends(p,_)!==l.False?d.Type(p,I):this.Never(I)}Index(p,_,I={}){return a.TArray(p)&&a.TNumber(_)?d.Type(p.items,I):a.TTuple(p)&&a.TNumber(_)?(()=>{let k=(i.IsUndefined(p.items)?[]:p.items).map(N=>d.Type(N));return this.Union(k,I)})():(()=>{let k=A.Resolve(_),N=d.Type(p);return S.Resolve(N,k,I)})()}Integer(p={}){return this.Create({...p,[e.Kind]:"Integer",type:"integer"})}Intersect(p,_={}){if(p.length===0)return e.Type.Never();if(p.length===1)return d.Type(p[0],_);p.some(P=>a.TTransform(P))&&this.Throw("Cannot intersect transform types");let I=p.every(P=>a.TObject(P)),k=d.Rest(p),N=a.TSchema(_.unevaluatedProperties)?{unevaluatedProperties:d.Type(_.unevaluatedProperties)}:{};return _.unevaluatedProperties===!1||a.TSchema(_.unevaluatedProperties)||I?this.Create({..._,...N,[e.Kind]:"Intersect",type:"object",allOf:k}):this.Create({..._,...N,[e.Kind]:"Intersect",allOf:k})}KeyOf(p,_={}){return a.TRecord(p)?(()=>{let I=Object.getOwnPropertyNames(p.patternProperties)[0];return I===e.PatternNumberExact?this.Number(_):I===e.PatternStringExact?this.String(_):this.Throw("Unable to resolve key type from Record key pattern")})():a.TTuple(p)?(()=>{let I=(i.IsUndefined(p.items)?[]:p.items).map((k,N)=>e.Type.Literal(N.toString()));return this.Union(I,_)})():a.TArray(p)?this.Number(_):(()=>{let I=K.ResolveKeys(p,{includePatterns:!1});if(I.length===0)return this.Never(_);let k=I.map(N=>this.Literal(N));return this.Union(k,_)})()}Literal(p,_={}){return this.Create({..._,[e.Kind]:"Literal",const:p,type:typeof p})}Lowercase(p,_={}){return{...T.Map(d.Type(p),"Lowercase"),..._}}Never(p={}){return this.Create({...p,[e.Kind]:"Never",not:{}})}Not(p,_){return this.Create({..._,[e.Kind]:"Not",not:d.Type(p)})}Null(p={}){return this.Create({...p,[e.Kind]:"Null",type:"null"})}Number(p={}){return this.Create({...p,[e.Kind]:"Number",type:"number"})}Object(p,_={}){let I=Object.getOwnPropertyNames(p),k=I.filter($=>a.TOptional(p[$])),N=I.filter($=>!k.includes($)),P=a.TSchema(_.additionalProperties)?{additionalProperties:d.Type(_.additionalProperties)}:{},m=I.reduce(($,w)=>({...$,[w]:d.Type(p[w])}),{});return N.length>0?this.Create({..._,...P,[e.Kind]:"Object",type:"object",properties:m,required:N}):this.Create({..._,...P,[e.Kind]:"Object",type:"object",properties:m})}Omit(p,_,I={}){let k=A.Resolve(_);return B.Map(this.Discard(d.Type(p),["$id",e.Transform]),N=>{i.IsArray(N.required)&&(N.required=N.required.filter(P=>!k.includes(P)),N.required.length===0&&delete N.required);for(let P of Object.getOwnPropertyNames(N.properties))k.includes(P)&&delete N.properties[P];return this.Create(N)},I)}Partial(p,_={}){return B.Map(this.Discard(d.Type(p),["$id",e.Transform]),I=>{let k=Object.getOwnPropertyNames(I.properties).reduce((N,P)=>({...N,[P]:this.Optional(I.properties[P])}),{});return this.Object(k,this.Discard(I,["required"]))},_)}Pick(p,_,I={}){let k=A.Resolve(_);return B.Map(this.Discard(d.Type(p),["$id",e.Transform]),N=>{i.IsArray(N.required)&&(N.required=N.required.filter(P=>k.includes(P)),N.required.length===0&&delete N.required);for(let P of Object.getOwnPropertyNames(N.properties))k.includes(P)||delete N.properties[P];return this.Create(N)},I)}Record(p,_,I={}){return a.TTemplateLiteral(p)?(()=>{let k=V.ParseExact(p.pattern);return L.Check(k)?this.Object([...C.Generate(k)].reduce((N,P)=>({...N,[P]:d.Type(_)}),{}),I):this.Create({...I,[e.Kind]:"Record",type:"object",patternProperties:{[p.pattern]:d.Type(_)}})})():a.TUnion(p)?(()=>{let k=M.Resolve(p);if(a.TUnionLiteral(k)){let N=k.anyOf.reduce((P,m)=>({...P,[m.const]:d.Type(_)}),{});return this.Object(N,{...I,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():a.TLiteral(p)?i.IsString(p.const)||i.IsNumber(p.const)?this.Object({[p.const]:d.Type(_)},I):this.Throw("Record key of type literal is not of type string or number"):a.TInteger(p)||a.TNumber(p)?this.Create({...I,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:d.Type(_)}}):a.TString(p)?(()=>{let k=i.IsUndefined(p.pattern)?e.PatternStringExact:p.pattern;return this.Create({...I,[e.Kind]:"Record",type:"object",patternProperties:{[k]:d.Type(_)}})})():this.Never()}Recursive(p,_={}){i.IsUndefined(_.$id)&&(_.$id=`T${G++}`);let I=p({[e.Kind]:"This",$ref:`${_.$id}`});return I.$id=_.$id,this.Create({..._,[e.Hint]:"Recursive",...I})}Ref(p,_={}){return i.IsString(p)?this.Create({..._,[e.Kind]:"Ref",$ref:p}):(i.IsUndefined(p.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({..._,[e.Kind]:"Ref",$ref:p.$id}))}Required(p,_={}){return B.Map(this.Discard(d.Type(p),["$id",e.Transform]),I=>{let k=Object.getOwnPropertyNames(I.properties).reduce((N,P)=>({...N,[P]:this.Discard(I.properties[P],[e.Optional])}),{});return this.Object(k,I)},_)}Rest(p){return a.TTuple(p)&&!i.IsUndefined(p.items)?d.Rest(p.items):a.TIntersect(p)?d.Rest(p.allOf):a.TUnion(p)?d.Rest(p.anyOf):[]}String(p={}){return this.Create({...p,[e.Kind]:"String",type:"string"})}TemplateLiteral(p,_={}){let I=i.IsString(p)?Y.Create(re.Parse(p)):Y.Create(p);return this.Create({..._,[e.Kind]:"TemplateLiteral",type:"string",pattern:I})}Transform(p){return new te(p)}Tuple(p,_={}){let[I,k,N]=[!1,p.length,p.length],P=d.Rest(p),m=p.length>0?{..._,[e.Kind]:"Tuple",type:"array",items:P,additionalItems:I,minItems:k,maxItems:N}:{..._,[e.Kind]:"Tuple",type:"array",minItems:k,maxItems:N};return this.Create(m)}Uncapitalize(p,_={}){return{...T.Map(d.Type(p),"Uncapitalize"),..._}}Union(p,_={}){return a.TTemplateLiteral(p)?F.Resolve(p):(()=>{let I=p;if(I.length===0)return this.Never(_);if(I.length===1)return this.Create(d.Type(I[0],_));let k=d.Rest(I);return this.Create({..._,[e.Kind]:"Union",anyOf:k})})()}Unknown(p={}){return this.Create({...p,[e.Kind]:"Unknown"})}Unsafe(p={}){return this.Create({...p,[e.Kind]:p[e.Kind]||"Unsafe"})}Uppercase(p,_={}){return{...T.Map(d.Type(p),"Uppercase"),..._}}};e.JsonTypeBuilder=Z;var fe=class extends Z{AsyncIterator(p,_={}){return this.Create({..._,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:d.Type(p)})}Awaited(p,_={}){let I=k=>k.length>0?(()=>{let[N,...P]=k;return[this.Awaited(N),...I(P)]})():k;return a.TIntersect(p)?e.Type.Intersect(I(p.allOf)):a.TUnion(p)?e.Type.Union(I(p.anyOf)):a.TPromise(p)?this.Awaited(p.item):d.Type(p,_)}BigInt(p={}){return this.Create({...p,[e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(p,_={}){return this.Tuple([...p.parameters],{..._})}Constructor(p,_,I){let[k,N]=[d.Rest(p),d.Type(_)];return this.Create({...I,[e.Kind]:"Constructor",type:"Constructor",parameters:k,returns:N})}Date(p={}){return this.Create({...p,[e.Kind]:"Date",type:"Date"})}Function(p,_,I){let[k,N]=[d.Rest(p),d.Type(_)];return this.Create({...I,[e.Kind]:"Function",type:"Function",parameters:k,returns:N})}InstanceType(p,_={}){return d.Type(p.returns,_)}Iterator(p,_={}){return this.Create({..._,[e.Kind]:"Iterator",type:"Iterator",items:d.Type(p)})}Parameters(p,_={}){return this.Tuple(p.parameters,{..._})}Promise(p,_={}){return this.Create({..._,[e.Kind]:"Promise",type:"Promise",item:d.Type(p)})}RegExp(p,_={}){let I=i.IsString(p)?p:p.source;return this.Create({..._,[e.Kind]:"String",type:"string",pattern:I})}RegEx(p,_={}){return this.RegExp(p,_)}ReturnType(p,_={}){return d.Type(p.returns,_)}Symbol(p){return this.Create({...p,[e.Kind]:"Symbol",type:"symbol"})}Undefined(p={}){return this.Create({...p,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(p={}){return this.Create({...p,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(p={}){return this.Create({...p,[e.Kind]:"Void",type:"void"})}};e.JavaScriptTypeBuilder=fe,e.JsonType=new Z,e.Type=new fe}}),On=er(vr(),1),{String:Ug,Optional:Rg,Boolean:Bg,Object:Dg,Number:Cg}=On.Type,Mg=Ug.bind(On.Type),Lg=Cg.bind(On.Type),pS=Dg.bind(On.Type),dS=Rg.bind(On.Type),Vg=Bg.bind(On.Type),hS=Mg(),yS=Lg(),mS=Vg();function ho(e){return Array.isArray(e)?e:[e]}var Fg=qe({"../../../node_modules/.pnpm/browser-or-node@2.1.1/node_modules/browser-or-node/lib/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},r=typeof window<"u"&&typeof window.document<"u",n=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,i=(typeof self>"u"?"undefined":t(self))==="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope",o=typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),a=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u";e.isBrowser=r,e.isWebWorker=i,e.isNode=n,e.isJsDom=o,e.isDeno=a}}),zg=qe({"../../../node_modules/.pnpm/fast-json-stable-stringify@2.1.0/node_modules/fast-json-stable-stringify/index.js"(e,t){"use strict";t.exports=function(r,n){n||(n={}),typeof n=="function"&&(n={cmp:n});var i=typeof n.cycles=="boolean"?n.cycles:!1,o=n.cmp&&function(s){return function(u){return function(l,f){var d={key:l,value:u[l]},S={key:f,value:u[f]};return s(d,S)}}}(n.cmp),a=[];return function s(u){if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u!==void 0){if(typeof u=="number")return isFinite(u)?""+u:"null";if(typeof u!="object")return JSON.stringify(u);var l,f;if(Array.isArray(u)){for(f="[",l=0;l<u.length;l++)l&&(f+=","),f+=s(u[l])||"null";return f+"]"}if(u===null)return"null";if(a.indexOf(u)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var d=a.push(u)-1,S=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<S.length;l++){var T=S[l],B=s(u[T]);B&&(f&&(f+=","),f+=JSON.stringify(T)+":"+B)}return a.splice(d,1),"{"+f+"}"}}(r)}}}),Gg=qe({"../../../node_modules/.pnpm/safe-stable-stringify@2.4.3/node_modules/safe-stable-stringify/index.js"(e,t){"use strict";var{hasOwnProperty:r}=Object.prototype,n=J();n.configure=J,n.stringify=n,n.default=n,e.stringify=n,e.configure=J,t.exports=n;var i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function o(A){return A.length<5e3&&!i.test(A)?`"${A}"`:JSON.stringify(A)}function a(A){if(A.length>200)return A.sort();for(let M=1;M<A.length;M++){let W=A[M],Y=M;for(;Y!==0&&A[Y-1]>W;)A[Y]=A[Y-1],Y--;A[Y]=W}return A}var s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function u(A){return s.call(A)!==void 0&&A.length!==0}function l(A,M,W){A.length<W&&(W=A.length);let Y=M===","?"":" ",F=`"0":${Y}${A[0]}`;for(let ne=1;ne<W;ne++)F+=`${M}"${ne}":${Y}${A[ne]}`;return F}function f(A){if(r.call(A,"circularValue")){let M=A.circularValue;if(typeof M=="string")return`"${M}"`;if(M==null)return M;if(M===Error||M===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function d(A,M){let W;if(r.call(A,M)&&(W=A[M],typeof W!="boolean"))throw new TypeError(`The "${M}" argument must be of type boolean`);return W===void 0?!0:W}function S(A,M){let W;if(r.call(A,M)){if(W=A[M],typeof W!="number")throw new TypeError(`The "${M}" argument must be of type number`);if(!Number.isInteger(W))throw new TypeError(`The "${M}" argument must be an integer`);if(W<1)throw new RangeError(`The "${M}" argument must be >= 1`)}return W===void 0?1/0:W}function T(A){return A===1?"1 item":`${A} items`}function B(A){let M=new Set;for(let W of A)(typeof W=="string"||typeof W=="number")&&M.add(String(W));return M}function K(A){if(r.call(A,"strict")){let M=A.strict;if(typeof M!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(M)return W=>{let Y=`Object can not safely be stringified. Received type ${typeof W}`;throw typeof W!="function"&&(Y+=` (${W.toString()})`),new Error(Y)}}}function J(A){A={...A};let M=K(A);M&&(A.bigint===void 0&&(A.bigint=!1),"circularValue"in A||(A.circularValue=Error));let W=f(A),Y=d(A,"bigint"),F=d(A,"deterministic"),ne=S(A,"maximumDepth"),V=S(A,"maximumBreadth");function pe(te,E,G,oe,H,Z){let fe=E[te];switch(typeof fe=="object"&&fe!==null&&typeof fe.toJSON=="function"&&(fe=fe.toJSON(te)),fe=oe.call(E,te,fe),typeof fe){case"string":return o(fe);case"object":{if(fe===null)return"null";if(G.indexOf(fe)!==-1)return W;let p="",_=",",I=Z;if(Array.isArray(fe)){if(fe.length===0)return"[]";if(ne<G.length+1)return'"[Array]"';G.push(fe),H!==""&&(Z+=H,p+=`
|
|
31
|
+
${Z}`,_=`,
|
|
32
|
+
${Z}`);let w=Math.min(fe.length,V),c=0;for(;c<w-1;c++){let b=pe(String(c),fe,G,oe,H,Z);p+=b!==void 0?b:"null",p+=_}let O=pe(String(c),fe,G,oe,H,Z);if(p+=O!==void 0?O:"null",fe.length-1>V){let b=fe.length-V-1;p+=`${_}"... ${T(b)} not stringified"`}return H!==""&&(p+=`
|
|
33
|
+
${I}`),G.pop(),`[${p}]`}let k=Object.keys(fe),N=k.length;if(N===0)return"{}";if(ne<G.length+1)return'"[Object]"';let P="",m="";H!==""&&(Z+=H,_=`,
|
|
34
|
+
${Z}`,P=" ");let $=Math.min(N,V);F&&!u(fe)&&(k=a(k)),G.push(fe);for(let w=0;w<$;w++){let c=k[w],O=pe(c,fe,G,oe,H,Z);O!==void 0&&(p+=`${m}${o(c)}:${P}${O}`,m=_)}if(N>V){let w=N-V;p+=`${m}"...":${P}"${T(w)} not stringified"`,m=_}return H!==""&&m.length>1&&(p=`
|
|
35
|
+
${Z}${p}
|
|
36
|
+
${I}`),G.pop(),`{${p}}`}case"number":return isFinite(fe)?String(fe):M?M(fe):"null";case"boolean":return fe===!0?"true":"false";case"undefined":return;case"bigint":if(Y)return String(fe);default:return M?M(fe):void 0}}function L(te,E,G,oe,H,Z){switch(typeof E=="object"&&E!==null&&typeof E.toJSON=="function"&&(E=E.toJSON(te)),typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(G.indexOf(E)!==-1)return W;let fe=Z,p="",_=",";if(Array.isArray(E)){if(E.length===0)return"[]";if(ne<G.length+1)return'"[Array]"';G.push(E),H!==""&&(Z+=H,p+=`
|
|
37
|
+
${Z}`,_=`,
|
|
38
|
+
${Z}`);let N=Math.min(E.length,V),P=0;for(;P<N-1;P++){let $=L(String(P),E[P],G,oe,H,Z);p+=$!==void 0?$:"null",p+=_}let m=L(String(P),E[P],G,oe,H,Z);if(p+=m!==void 0?m:"null",E.length-1>V){let $=E.length-V-1;p+=`${_}"... ${T($)} not stringified"`}return H!==""&&(p+=`
|
|
39
|
+
${fe}`),G.pop(),`[${p}]`}G.push(E);let I="";H!==""&&(Z+=H,_=`,
|
|
40
|
+
${Z}`,I=" ");let k="";for(let N of oe){let P=L(N,E[N],G,oe,H,Z);P!==void 0&&(p+=`${k}${o(N)}:${I}${P}`,k=_)}return H!==""&&k.length>1&&(p=`
|
|
41
|
+
${Z}${p}
|
|
42
|
+
${fe}`),G.pop(),`{${p}}`}case"number":return isFinite(E)?String(E):M?M(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(Y)return String(E);default:return M?M(E):void 0}}function D(te,E,G,oe,H){switch(typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(te),typeof E!="object")return D(te,E,G,oe,H);if(E===null)return"null"}if(G.indexOf(E)!==-1)return W;let Z=H;if(Array.isArray(E)){if(E.length===0)return"[]";if(ne<G.length+1)return'"[Array]"';G.push(E),H+=oe;let P=`
|
|
43
|
+
${H}`,m=`,
|
|
44
|
+
${H}`,$=Math.min(E.length,V),w=0;for(;w<$-1;w++){let O=D(String(w),E[w],G,oe,H);P+=O!==void 0?O:"null",P+=m}let c=D(String(w),E[w],G,oe,H);if(P+=c!==void 0?c:"null",E.length-1>V){let O=E.length-V-1;P+=`${m}"... ${T(O)} not stringified"`}return P+=`
|
|
45
|
+
${Z}`,G.pop(),`[${P}]`}let fe=Object.keys(E),p=fe.length;if(p===0)return"{}";if(ne<G.length+1)return'"[Object]"';H+=oe;let _=`,
|
|
46
|
+
${H}`,I="",k="",N=Math.min(p,V);u(E)&&(I+=l(E,_,V),fe=fe.slice(E.length),N-=E.length,k=_),F&&(fe=a(fe)),G.push(E);for(let P=0;P<N;P++){let m=fe[P],$=D(m,E[m],G,oe,H);$!==void 0&&(I+=`${k}${o(m)}: ${$}`,k=_)}if(p>V){let P=p-V;I+=`${k}"...": "${T(P)} not stringified"`,k=_}return k!==""&&(I=`
|
|
47
|
+
${H}${I}
|
|
48
|
+
${Z}`),G.pop(),`{${I}}`}case"number":return isFinite(E)?String(E):M?M(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(Y)return String(E);default:return M?M(E):void 0}}function C(te,E,G){switch(typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(te),typeof E!="object")return C(te,E,G);if(E===null)return"null"}if(G.indexOf(E)!==-1)return W;let oe="";if(Array.isArray(E)){if(E.length===0)return"[]";if(ne<G.length+1)return'"[Array]"';G.push(E);let _=Math.min(E.length,V),I=0;for(;I<_-1;I++){let N=C(String(I),E[I],G);oe+=N!==void 0?N:"null",oe+=","}let k=C(String(I),E[I],G);if(oe+=k!==void 0?k:"null",E.length-1>V){let N=E.length-V-1;oe+=`,"... ${T(N)} not stringified"`}return G.pop(),`[${oe}]`}let H=Object.keys(E),Z=H.length;if(Z===0)return"{}";if(ne<G.length+1)return'"[Object]"';let fe="",p=Math.min(Z,V);u(E)&&(oe+=l(E,",",V),H=H.slice(E.length),p-=E.length,fe=","),F&&(H=a(H)),G.push(E);for(let _=0;_<p;_++){let I=H[_],k=C(I,E[I],G);k!==void 0&&(oe+=`${fe}${o(I)}:${k}`,fe=",")}if(Z>V){let _=Z-V;oe+=`${fe}"...":"${T(_)} not stringified"`}return G.pop(),`{${oe}}`}case"number":return isFinite(E)?String(E):M?M(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(Y)return String(E);default:return M?M(E):void 0}}function re(te,E,G){if(arguments.length>1){let oe="";if(typeof G=="number"?oe=" ".repeat(Math.min(G,10)):typeof G=="string"&&(oe=G.slice(0,10)),E!=null){if(typeof E=="function")return pe("",{"":te},[],E,oe,"");if(Array.isArray(E))return L("",te,[],B(E),oe,"")}if(oe.length!==0)return D("",te,[],oe,"")}return C("",te,[])}return re}}}),xn=qe({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/guard.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IsValueType=e.IsSymbol=e.IsFunction=e.IsString=e.IsBigInt=e.IsInteger=e.IsNumber=e.IsBoolean=e.IsNull=e.IsUndefined=e.IsArray=e.IsObject=e.IsPlainObject=e.HasPropertyKey=e.IsDate=e.IsUint8Array=e.IsPromise=e.IsTypedArray=e.IsIterator=e.IsAsyncIterator=void 0;function t(F){return l(F)&&Symbol.asyncIterator in F}e.IsAsyncIterator=t;function r(F){return l(F)&&Symbol.iterator in F}e.IsIterator=r;function n(F){return ArrayBuffer.isView(F)}e.IsTypedArray=n;function i(F){return F instanceof Promise}e.IsPromise=i;function o(F){return F instanceof Uint8Array}e.IsUint8Array=o;function a(F){return F instanceof Date&&Number.isFinite(F.getTime())}e.IsDate=a;function s(F,ne){return ne in F}e.HasPropertyKey=s;function u(F){return l(F)&&M(F.constructor)&&F.constructor.name==="Object"}e.IsPlainObject=u;function l(F){return F!==null&&typeof F=="object"}e.IsObject=l;function f(F){return Array.isArray(F)&&!ArrayBuffer.isView(F)}e.IsArray=f;function d(F){return F===void 0}e.IsUndefined=d;function S(F){return F===null}e.IsNull=S;function T(F){return typeof F=="boolean"}e.IsBoolean=T;function B(F){return typeof F=="number"}e.IsNumber=B;function K(F){return B(F)&&Number.isInteger(F)}e.IsInteger=K;function J(F){return typeof F=="bigint"}e.IsBigInt=J;function A(F){return typeof F=="string"}e.IsString=A;function M(F){return typeof F=="function"}e.IsFunction=M;function W(F){return typeof F=="symbol"}e.IsSymbol=W;function Y(F){return J(F)||T(F)||S(F)||B(F)||A(F)||W(F)||d(F)}e.IsValueType=Y}}),yf=qe({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/system/system.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultErrorFunction=e.TypeSystemPolicy=e.TypeSystemErrorFunction=e.TypeSystem=e.TypeSystemDuplicateFormat=e.TypeSystemDuplicateTypeKind=void 0;var t=xn(),r=Wo(),n=vr(),i=class extends n.TypeBoxError{constructor(f){super(`Duplicate type kind '${f}' detected`)}};e.TypeSystemDuplicateTypeKind=i;var o=class extends n.TypeBoxError{constructor(f){super(`Duplicate string format '${f}' detected`)}};e.TypeSystemDuplicateFormat=o;var a;(function(f){function d(T,B){if(n.TypeRegistry.Has(T))throw new i(T);return n.TypeRegistry.Set(T,B),(K={})=>n.Type.Unsafe({...K,[n.Kind]:T})}f.Type=d;function S(T,B){if(n.FormatRegistry.Has(T))throw new o(T);return n.FormatRegistry.Set(T,B),T}f.Format=S})(a||(e.TypeSystem=a={}));var s;(function(f){let d=l;function S(){d=l}f.Reset=S;function T(K){d=K}f.Set=T;function B(){return d}f.Get=B})(s||(e.TypeSystemErrorFunction=s={}));var u;(function(f){f.ExactOptionalPropertyTypes=!1,f.AllowArrayObject=!1,f.AllowNaN=!1,f.AllowNullVoid=!1;function d(J,A){return f.ExactOptionalPropertyTypes?A in J:J[A]!==void 0}f.IsExactOptionalProperty=d;function S(J){let A=(0,t.IsObject)(J);return f.AllowArrayObject?A:A&&!(0,t.IsArray)(J)}f.IsObjectLike=S;function T(J){return S(J)&&!(J instanceof Date)&&!(J instanceof Uint8Array)}f.IsRecordLike=T;function B(J){let A=(0,t.IsNumber)(J);return f.AllowNaN?A:A&&Number.isFinite(J)}f.IsNumberLike=B;function K(J){let A=(0,t.IsUndefined)(J);return f.AllowNullVoid?A||J===null:A}f.IsVoidLike=K})(u||(e.TypeSystemPolicy=u={}));function l(f,d){switch(d){case r.ValueErrorType.ArrayContains:return"Expected array to contain at least one matching value";case r.ValueErrorType.ArrayMaxContains:return`Expected array to contain no more than ${f.maxContains} matching values`;case r.ValueErrorType.ArrayMinContains:return`Expected array to contain at least ${f.minContains} matching values`;case r.ValueErrorType.ArrayMaxItems:return`Expected array length to be less or equal to ${f.maxItems}`;case r.ValueErrorType.ArrayMinItems:return`Expected array length to be greater or equal to ${f.minItems}`;case r.ValueErrorType.ArrayUniqueItems:return"Expected array elements to be unique";case r.ValueErrorType.Array:return"Expected array";case r.ValueErrorType.AsyncIterator:return"Expected AsyncIterator";case r.ValueErrorType.BigIntExclusiveMaximum:return`Expected bigint to be less than ${f.exclusiveMaximum}`;case r.ValueErrorType.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.BigIntMaximum:return`Expected bigint to be less or equal to ${f.maximum}`;case r.ValueErrorType.BigIntMinimum:return`Expected bigint to be greater or equal to ${f.minimum}`;case r.ValueErrorType.BigIntMultipleOf:return`Expected bigint to be a multiple of ${f.multipleOf}`;case r.ValueErrorType.BigInt:return"Expected bigint";case r.ValueErrorType.Boolean:return"Expected boolean";case r.ValueErrorType.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${f.exclusiveMinimumTimestamp}`;case r.ValueErrorType.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${f.exclusiveMaximumTimestamp}`;case r.ValueErrorType.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${f.minimumTimestamp}`;case r.ValueErrorType.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${f.maximumTimestamp}`;case r.ValueErrorType.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${f.multipleOfTimestamp}`;case r.ValueErrorType.Date:return"Expected Date";case r.ValueErrorType.Function:return"Expected function";case r.ValueErrorType.IntegerExclusiveMaximum:return`Expected integer to be less than ${f.exclusiveMaximum}`;case r.ValueErrorType.IntegerExclusiveMinimum:return`Expected integer to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.IntegerMaximum:return`Expected integer to be less or equal to ${f.maximum}`;case r.ValueErrorType.IntegerMinimum:return`Expected integer to be greater or equal to ${f.minimum}`;case r.ValueErrorType.IntegerMultipleOf:return`Expected integer to be a multiple of ${f.multipleOf}`;case r.ValueErrorType.Integer:return"Expected integer";case r.ValueErrorType.IntersectUnevaluatedProperties:return"Unexpected property";case r.ValueErrorType.Intersect:return"Expected all values to match";case r.ValueErrorType.Iterator:return"Expected Iterator";case r.ValueErrorType.Literal:return`Expected ${typeof f.const=="string"?`'${f.const}'`:f.const}`;case r.ValueErrorType.Never:return"Never";case r.ValueErrorType.Not:return"Value should not match";case r.ValueErrorType.Null:return"Expected null";case r.ValueErrorType.NumberExclusiveMaximum:return`Expected number to be less than ${f.exclusiveMaximum}`;case r.ValueErrorType.NumberExclusiveMinimum:return`Expected number to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.NumberMaximum:return`Expected number to be less or equal to ${f.maximum}`;case r.ValueErrorType.NumberMinimum:return`Expected number to be greater or equal to ${f.minimum}`;case r.ValueErrorType.NumberMultipleOf:return`Expected number to be a multiple of ${f.multipleOf}`;case r.ValueErrorType.Number:return"Expected number";case r.ValueErrorType.Object:return"Expected object";case r.ValueErrorType.ObjectAdditionalProperties:return"Unexpected property";case r.ValueErrorType.ObjectMaxProperties:return`Expected object to have no more than ${f.maxProperties} properties`;case r.ValueErrorType.ObjectMinProperties:return`Expected object to have at least ${f.minProperties} properties`;case r.ValueErrorType.ObjectRequiredProperty:return"Required property";case r.ValueErrorType.Promise:return"Expected Promise";case r.ValueErrorType.StringFormatUnknown:return`Unknown format '${f.format}'`;case r.ValueErrorType.StringFormat:return`Expected string to match '${f.format}' format`;case r.ValueErrorType.StringMaxLength:return`Expected string length less or equal to ${f.maxLength}`;case r.ValueErrorType.StringMinLength:return`Expected string length greater or equal to ${f.minLength}`;case r.ValueErrorType.StringPattern:return`Expected string to match '${f.pattern}'`;case r.ValueErrorType.String:return"Expected string";case r.ValueErrorType.Symbol:return"Expected symbol";case r.ValueErrorType.TupleLength:return`Expected tuple to have ${f.maxItems||0} elements`;case r.ValueErrorType.Tuple:return"Expected tuple";case r.ValueErrorType.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${f.maxByteLength}`;case r.ValueErrorType.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${f.minByteLength}`;case r.ValueErrorType.Uint8Array:return"Expected Uint8Array";case r.ValueErrorType.Undefined:return"Expected undefined";case r.ValueErrorType.Union:return"Expected union value";case r.ValueErrorType.Void:return"Expected void";case r.ValueErrorType.Kind:return`Expected kind '${f[n.Kind]}'`;default:return"Unknown error type"}}e.DefaultErrorFunction=l}}),Ko=qe({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/deref.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Deref=e.TypeDereferenceError=void 0;var t=vr(),r=class extends t.TypeBoxError{constructor(i){super(`Unable to dereference schema with $id '${i.$id}'`),this.schema=i}};e.TypeDereferenceError=r;function n(i,o){let a=o.findIndex(s=>s.$id===i.$ref);if(a===-1)throw new r(i);return o[a]}e.Deref=n}}),ks=qe({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/hash.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.ByteMarker=e.ValueHashError=void 0;var t=xn(),r=class extends Error{constructor(D){super("Unable to hash value"),this.value=D}};e.ValueHashError=r;var n;(function(D){D[D.Undefined=0]="Undefined",D[D.Null=1]="Null",D[D.Boolean=2]="Boolean",D[D.Number=3]="Number",D[D.String=4]="String",D[D.Object=5]="Object",D[D.Array=6]="Array",D[D.Date=7]="Date",D[D.Uint8Array=8]="Uint8Array",D[D.Symbol=9]="Symbol",D[D.BigInt=10]="BigInt"})(n||(e.ByteMarker=n={}));var i=BigInt("14695981039346656037"),[o,a]=[BigInt("1099511628211"),BigInt("2")**BigInt("64")],s=Array.from({length:256}).map((D,C)=>BigInt(C)),u=new Float64Array(1),l=new DataView(u.buffer),f=new Uint8Array(u.buffer);function*d(D){let C=D===0?1:Math.ceil(Math.floor(Math.log2(D)+1)/8);for(let re=0;re<C;re++)yield D>>8*(C-1-re)&255}function S(D){pe(n.Array);for(let C of D)V(C)}function T(D){pe(n.Boolean),pe(D?1:0)}function B(D){pe(n.BigInt),l.setBigInt64(0,D);for(let C of f)pe(C)}function K(D){pe(n.Date),V(D.getTime())}function J(D){pe(n.Null)}function A(D){pe(n.Number),l.setFloat64(0,D);for(let C of f)pe(C)}function M(D){pe(n.Object);for(let C of globalThis.Object.keys(D).sort())V(C),V(D[C])}function W(D){pe(n.String);for(let C=0;C<D.length;C++)for(let re of d(D.charCodeAt(C)))pe(re)}function Y(D){pe(n.Symbol),V(D.description)}function F(D){pe(n.Uint8Array);for(let C=0;C<D.length;C++)pe(D[C])}function ne(D){return pe(n.Undefined)}function V(D){if((0,t.IsArray)(D))return S(D);if((0,t.IsBoolean)(D))return T(D);if((0,t.IsBigInt)(D))return B(D);if((0,t.IsDate)(D))return K(D);if((0,t.IsNull)(D))return J(D);if((0,t.IsNumber)(D))return A(D);if((0,t.IsPlainObject)(D))return M(D);if((0,t.IsString)(D))return W(D);if((0,t.IsSymbol)(D))return Y(D);if((0,t.IsUint8Array)(D))return F(D);if((0,t.IsUndefined)(D))return ne(D);throw new r(D)}function pe(D){i=i^s[D],i=i*o%a}function L(D){return i=BigInt("14695981039346656037"),V(D),i}e.Hash=L}}),Wo=qe({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/errors/errors.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Errors=e.ValueErrorIterator=e.EscapeKey=e.ValueErrorsUnknownTypeError=e.ValueErrorType=void 0;var t=xn(),r=yf(),n=Ko(),i=ks(),o=vr(),a;(function(c){c[c.ArrayContains=0]="ArrayContains",c[c.ArrayMaxContains=1]="ArrayMaxContains",c[c.ArrayMaxItems=2]="ArrayMaxItems",c[c.ArrayMinContains=3]="ArrayMinContains",c[c.ArrayMinItems=4]="ArrayMinItems",c[c.ArrayUniqueItems=5]="ArrayUniqueItems",c[c.Array=6]="Array",c[c.AsyncIterator=7]="AsyncIterator",c[c.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",c[c.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",c[c.BigIntMaximum=10]="BigIntMaximum",c[c.BigIntMinimum=11]="BigIntMinimum",c[c.BigIntMultipleOf=12]="BigIntMultipleOf",c[c.BigInt=13]="BigInt",c[c.Boolean=14]="Boolean",c[c.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",c[c.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",c[c.DateMaximumTimestamp=17]="DateMaximumTimestamp",c[c.DateMinimumTimestamp=18]="DateMinimumTimestamp",c[c.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",c[c.Date=20]="Date",c[c.Function=21]="Function",c[c.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",c[c.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",c[c.IntegerMaximum=24]="IntegerMaximum",c[c.IntegerMinimum=25]="IntegerMinimum",c[c.IntegerMultipleOf=26]="IntegerMultipleOf",c[c.Integer=27]="Integer",c[c.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",c[c.Intersect=29]="Intersect",c[c.Iterator=30]="Iterator",c[c.Kind=31]="Kind",c[c.Literal=32]="Literal",c[c.Never=33]="Never",c[c.Not=34]="Not",c[c.Null=35]="Null",c[c.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",c[c.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",c[c.NumberMaximum=38]="NumberMaximum",c[c.NumberMinimum=39]="NumberMinimum",c[c.NumberMultipleOf=40]="NumberMultipleOf",c[c.Number=41]="Number",c[c.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",c[c.ObjectMaxProperties=43]="ObjectMaxProperties",c[c.ObjectMinProperties=44]="ObjectMinProperties",c[c.ObjectRequiredProperty=45]="ObjectRequiredProperty",c[c.Object=46]="Object",c[c.Promise=47]="Promise",c[c.StringFormatUnknown=48]="StringFormatUnknown",c[c.StringFormat=49]="StringFormat",c[c.StringMaxLength=50]="StringMaxLength",c[c.StringMinLength=51]="StringMinLength",c[c.StringPattern=52]="StringPattern",c[c.String=53]="String",c[c.Symbol=54]="Symbol",c[c.TupleLength=55]="TupleLength",c[c.Tuple=56]="Tuple",c[c.Uint8ArrayMaxByteLength=57]="Uint8ArrayMaxByteLength",c[c.Uint8ArrayMinByteLength=58]="Uint8ArrayMinByteLength",c[c.Uint8Array=59]="Uint8Array",c[c.Undefined=60]="Undefined",c[c.Union=61]="Union",c[c.Void=62]="Void"})(a||(e.ValueErrorType=a={}));var s=class extends o.TypeBoxError{constructor(c){super("Unknown type"),this.schema=c}};e.ValueErrorsUnknownTypeError=s;function u(c){return c.replace(/~/g,"~0").replace(/\//g,"~1")}e.EscapeKey=u;function l(c){return c!==void 0}var f=class{constructor(c){this.iterator=c}[Symbol.iterator](){return this.iterator}First(){let c=this.iterator.next();return c.done?void 0:c.value}};e.ValueErrorIterator=f;function d(c,O,b,v){return{type:c,schema:O,path:b,value:v,message:r.TypeSystemErrorFunction.Get()(O,c)}}function*S(c,O,b,v){}function*T(c,O,b,v){if(!(0,t.IsArray)(v))return yield d(a.Array,c,b,v);l(c.minItems)&&!(v.length>=c.minItems)&&(yield d(a.ArrayMinItems,c,b,v)),l(c.maxItems)&&!(v.length<=c.maxItems)&&(yield d(a.ArrayMaxItems,c,b,v));for(let Q=0;Q<v.length;Q++)yield*$(c.items,O,`${b}/${Q}`,v[Q]);if(c.uniqueItems===!0&&!function(){let Q=new Set;for(let ie of v){let me=(0,i.Hash)(ie);if(Q.has(me))return!1;Q.add(me)}return!0}()&&(yield d(a.ArrayUniqueItems,c,b,v)),!(l(c.contains)||l(c.minContains)||l(c.maxContains)))return;let U=l(c.contains)?c.contains:o.Type.Never(),z=v.reduce((Q,ie,me)=>$(U,O,`${b}${me}`,ie).next().done===!0?Q+1:Q,0);z===0&&(yield d(a.ArrayContains,c,b,v)),(0,t.IsNumber)(c.minContains)&&z<c.minContains&&(yield d(a.ArrayMinContains,c,b,v)),(0,t.IsNumber)(c.maxContains)&&z>c.maxContains&&(yield d(a.ArrayMaxContains,c,b,v))}function*B(c,O,b,v){(0,t.IsAsyncIterator)(v)||(yield d(a.AsyncIterator,c,b,v))}function*K(c,O,b,v){if(!(0,t.IsBigInt)(v))return yield d(a.BigInt,c,b,v);l(c.exclusiveMaximum)&&!(v<c.exclusiveMaximum)&&(yield d(a.BigIntExclusiveMaximum,c,b,v)),l(c.exclusiveMinimum)&&!(v>c.exclusiveMinimum)&&(yield d(a.BigIntExclusiveMinimum,c,b,v)),l(c.maximum)&&!(v<=c.maximum)&&(yield d(a.BigIntMaximum,c,b,v)),l(c.minimum)&&!(v>=c.minimum)&&(yield d(a.BigIntMinimum,c,b,v)),l(c.multipleOf)&&v%c.multipleOf!==BigInt(0)&&(yield d(a.BigIntMultipleOf,c,b,v))}function*J(c,O,b,v){(0,t.IsBoolean)(v)||(yield d(a.Boolean,c,b,v))}function*A(c,O,b,v){yield*$(c.returns,O,b,v.prototype)}function*M(c,O,b,v){if(!(0,t.IsDate)(v))return yield d(a.Date,c,b,v);l(c.exclusiveMaximumTimestamp)&&!(v.getTime()<c.exclusiveMaximumTimestamp)&&(yield d(a.DateExclusiveMaximumTimestamp,c,b,v)),l(c.exclusiveMinimumTimestamp)&&!(v.getTime()>c.exclusiveMinimumTimestamp)&&(yield d(a.DateExclusiveMinimumTimestamp,c,b,v)),l(c.maximumTimestamp)&&!(v.getTime()<=c.maximumTimestamp)&&(yield d(a.DateMaximumTimestamp,c,b,v)),l(c.minimumTimestamp)&&!(v.getTime()>=c.minimumTimestamp)&&(yield d(a.DateMinimumTimestamp,c,b,v)),l(c.multipleOfTimestamp)&&v.getTime()%c.multipleOfTimestamp!==0&&(yield d(a.DateMultipleOfTimestamp,c,b,v))}function*W(c,O,b,v){(0,t.IsFunction)(v)||(yield d(a.Function,c,b,v))}function*Y(c,O,b,v){if(!(0,t.IsInteger)(v))return yield d(a.Integer,c,b,v);l(c.exclusiveMaximum)&&!(v<c.exclusiveMaximum)&&(yield d(a.IntegerExclusiveMaximum,c,b,v)),l(c.exclusiveMinimum)&&!(v>c.exclusiveMinimum)&&(yield d(a.IntegerExclusiveMinimum,c,b,v)),l(c.maximum)&&!(v<=c.maximum)&&(yield d(a.IntegerMaximum,c,b,v)),l(c.minimum)&&!(v>=c.minimum)&&(yield d(a.IntegerMinimum,c,b,v)),l(c.multipleOf)&&v%c.multipleOf!==0&&(yield d(a.IntegerMultipleOf,c,b,v))}function*F(c,O,b,v){for(let U of c.allOf){let z=$(U,O,b,v).next();z.done||(yield d(a.Intersect,c,b,v),yield z.value)}if(c.unevaluatedProperties===!1){let U=new RegExp(o.KeyResolver.ResolvePattern(c));for(let z of Object.getOwnPropertyNames(v))U.test(z)||(yield d(a.IntersectUnevaluatedProperties,c,`${b}/${z}`,v))}if(typeof c.unevaluatedProperties=="object"){let U=new RegExp(o.KeyResolver.ResolvePattern(c));for(let z of Object.getOwnPropertyNames(v))if(!U.test(z)){let Q=$(c.unevaluatedProperties,O,`${b}/${z}`,v[z]).next();Q.done||(yield Q.value)}}}function*ne(c,O,b,v){(0,t.IsIterator)(v)||(yield d(a.Iterator,c,b,v))}function*V(c,O,b,v){v!==c.const&&(yield d(a.Literal,c,b,v))}function*pe(c,O,b,v){yield d(a.Never,c,b,v)}function*L(c,O,b,v){$(c.not,O,b,v).next().done===!0&&(yield d(a.Not,c,b,v))}function*D(c,O,b,v){(0,t.IsNull)(v)||(yield d(a.Null,c,b,v))}function*C(c,O,b,v){if(!r.TypeSystemPolicy.IsNumberLike(v))return yield d(a.Number,c,b,v);l(c.exclusiveMaximum)&&!(v<c.exclusiveMaximum)&&(yield d(a.NumberExclusiveMaximum,c,b,v)),l(c.exclusiveMinimum)&&!(v>c.exclusiveMinimum)&&(yield d(a.NumberExclusiveMinimum,c,b,v)),l(c.maximum)&&!(v<=c.maximum)&&(yield d(a.NumberMaximum,c,b,v)),l(c.minimum)&&!(v>=c.minimum)&&(yield d(a.NumberMinimum,c,b,v)),l(c.multipleOf)&&v%c.multipleOf!==0&&(yield d(a.NumberMultipleOf,c,b,v))}function*re(c,O,b,v){if(!r.TypeSystemPolicy.IsObjectLike(v))return yield d(a.Object,c,b,v);l(c.minProperties)&&!(Object.getOwnPropertyNames(v).length>=c.minProperties)&&(yield d(a.ObjectMinProperties,c,b,v)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(v).length<=c.maxProperties)&&(yield d(a.ObjectMaxProperties,c,b,v));let U=Array.isArray(c.required)?c.required:[],z=Object.getOwnPropertyNames(c.properties),Q=Object.getOwnPropertyNames(v);for(let ie of U)Q.includes(ie)||(yield d(a.ObjectRequiredProperty,c.properties[ie],`${b}/${u(ie)}`,void 0));if(c.additionalProperties===!1)for(let ie of Q)z.includes(ie)||(yield d(a.ObjectAdditionalProperties,c,`${b}/${u(ie)}`,v[ie]));if(typeof c.additionalProperties=="object")for(let ie of Q)z.includes(ie)||(yield*$(c.additionalProperties,O,`${b}/${u(ie)}`,v[ie]));for(let ie of z){let me=c.properties[ie];c.required&&c.required.includes(ie)?(yield*$(me,O,`${b}/${u(ie)}`,v[ie]),o.ExtendsUndefined.Check(c)&&!(ie in v)&&(yield d(a.ObjectRequiredProperty,me,`${b}/${u(ie)}`,void 0))):r.TypeSystemPolicy.IsExactOptionalProperty(v,ie)&&(yield*$(me,O,`${b}/${u(ie)}`,v[ie]))}}function*te(c,O,b,v){(0,t.IsPromise)(v)||(yield d(a.Promise,c,b,v))}function*E(c,O,b,v){if(!r.TypeSystemPolicy.IsRecordLike(v))return yield d(a.Object,c,b,v);l(c.minProperties)&&!(Object.getOwnPropertyNames(v).length>=c.minProperties)&&(yield d(a.ObjectMinProperties,c,b,v)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(v).length<=c.maxProperties)&&(yield d(a.ObjectMaxProperties,c,b,v));let[U,z]=Object.entries(c.patternProperties)[0],Q=new RegExp(U);for(let[ie,me]of Object.entries(v))Q.test(ie)&&(yield*$(z,O,`${b}/${u(ie)}`,me));if(typeof c.additionalProperties=="object")for(let[ie,me]of Object.entries(v))Q.test(ie)||(yield*$(c.additionalProperties,O,`${b}/${u(ie)}`,me));if(c.additionalProperties===!1){for(let[ie,me]of Object.entries(v))if(!Q.test(ie))return yield d(a.ObjectAdditionalProperties,c,`${b}/${u(ie)}`,me)}}function*G(c,O,b,v){yield*$((0,n.Deref)(c,O),O,b,v)}function*oe(c,O,b,v){if(!(0,t.IsString)(v))return yield d(a.String,c,b,v);l(c.minLength)&&!(v.length>=c.minLength)&&(yield d(a.StringMinLength,c,b,v)),l(c.maxLength)&&!(v.length<=c.maxLength)&&(yield d(a.StringMaxLength,c,b,v)),(0,t.IsString)(c.pattern)&&(new RegExp(c.pattern).test(v)||(yield d(a.StringPattern,c,b,v))),(0,t.IsString)(c.format)&&(o.FormatRegistry.Has(c.format)?o.FormatRegistry.Get(c.format)(v)||(yield d(a.StringFormat,c,b,v)):yield d(a.StringFormatUnknown,c,b,v))}function*H(c,O,b,v){(0,t.IsSymbol)(v)||(yield d(a.Symbol,c,b,v))}function*Z(c,O,b,v){if(!(0,t.IsString)(v))return yield d(a.String,c,b,v);new RegExp(c.pattern).test(v)||(yield d(a.StringPattern,c,b,v))}function*fe(c,O,b,v){yield*$((0,n.Deref)(c,O),O,b,v)}function*p(c,O,b,v){if(!(0,t.IsArray)(v))return yield d(a.Tuple,c,b,v);if(c.items===void 0&&v.length!==0)return yield d(a.TupleLength,c,b,v);if(v.length!==c.maxItems)return yield d(a.TupleLength,c,b,v);if(c.items)for(let U=0;U<c.items.length;U++)yield*$(c.items[U],O,`${b}/${U}`,v[U])}function*_(c,O,b,v){(0,t.IsUndefined)(v)||(yield d(a.Undefined,c,b,v))}function*I(c,O,b,v){let U=0;for(let z of c.anyOf){let Q=[...$(z,O,b,v)];if(Q.length===0)return;U+=Q.length}U>0&&(yield d(a.Union,c,b,v))}function*k(c,O,b,v){if(!(0,t.IsUint8Array)(v))return yield d(a.Uint8Array,c,b,v);l(c.maxByteLength)&&!(v.length<=c.maxByteLength)&&(yield d(a.Uint8ArrayMaxByteLength,c,b,v)),l(c.minByteLength)&&!(v.length>=c.minByteLength)&&(yield d(a.Uint8ArrayMinByteLength,c,b,v))}function*N(c,O,b,v){}function*P(c,O,b,v){r.TypeSystemPolicy.IsVoidLike(v)||(yield d(a.Void,c,b,v))}function*m(c,O,b,v){o.TypeRegistry.Get(c[o.Kind])(c,v)||(yield d(a.Kind,c,b,v))}function*$(c,O,b,v){let U=l(c.$id)?[...O,c]:O,z=c;switch(z[o.Kind]){case"Any":return yield*S(z,U,b,v);case"Array":return yield*T(z,U,b,v);case"AsyncIterator":return yield*B(z,U,b,v);case"BigInt":return yield*K(z,U,b,v);case"Boolean":return yield*J(z,U,b,v);case"Constructor":return yield*A(z,U,b,v);case"Date":return yield*M(z,U,b,v);case"Function":return yield*W(z,U,b,v);case"Integer":return yield*Y(z,U,b,v);case"Intersect":return yield*F(z,U,b,v);case"Iterator":return yield*ne(z,U,b,v);case"Literal":return yield*V(z,U,b,v);case"Never":return yield*pe(z,U,b,v);case"Not":return yield*L(z,U,b,v);case"Null":return yield*D(z,U,b,v);case"Number":return yield*C(z,U,b,v);case"Object":return yield*re(z,U,b,v);case"Promise":return yield*te(z,U,b,v);case"Record":return yield*E(z,U,b,v);case"Ref":return yield*G(z,U,b,v);case"String":return yield*oe(z,U,b,v);case"Symbol":return yield*H(z,U,b,v);case"TemplateLiteral":return yield*Z(z,U,b,v);case"This":return yield*fe(z,U,b,v);case"Tuple":return yield*p(z,U,b,v);case"Undefined":return yield*_(z,U,b,v);case"Union":return yield*I(z,U,b,v);case"Uint8Array":return yield*k(z,U,b,v);case"Unknown":return yield*N(z,U,b,v);case"Void":return yield*P(z,U,b,v);default:if(!o.TypeRegistry.Has(z[o.Kind]))throw new s(c);return yield*m(z,U,b,v)}}function w(...c){let O=c.length===3?$(c[0],c[1],"",c[2]):$(c[0],[],"",c[1]);return new f(O)}e.Errors=w}}),qg=qe({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/errors/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(n,i,o,a){a===void 0&&(a=o);var s=Object.getOwnPropertyDescriptor(i,o);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(n,a,s)}:function(n,i,o,a){a===void 0&&(a=o),n[a]=i[o]}),r=e&&e.__exportStar||function(n,i){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,n,o)};Object.defineProperty(e,"__esModule",{value:!0}),r(Wo(),e)}}),mf=qe({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/system/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(i,o,a,s){s===void 0&&(s=a);var u=Object.getOwnPropertyDescriptor(o,a);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(i,s,u)}:function(i,o,a,s){s===void 0&&(s=a),i[s]=o[a]}),r=e&&e.__exportStar||function(i,o){for(var a in i)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorType=void 0;var n=Wo();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(yf(),e)}}),Kg=qe({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/check.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Check=e.ValueCheckUnknownTypeError=void 0;var t=xn(),r=mf(),n=Ko(),i=ks(),o=vr(),a=class extends o.TypeBoxError{constructor(m){super("Unknown type"),this.schema=m}};e.ValueCheckUnknownTypeError=a;function s(m){return m[o.Kind]==="Any"||m[o.Kind]==="Unknown"}function u(m){return m!==void 0}function l(m,$,w){return!0}function f(m,$,w){if(!(0,t.IsArray)(w)||u(m.minItems)&&!(w.length>=m.minItems)||u(m.maxItems)&&!(w.length<=m.maxItems)||!w.every(b=>N(m.items,$,b))||m.uniqueItems===!0&&!function(){let b=new Set;for(let v of w){let U=(0,i.Hash)(v);if(b.has(U))return!1;b.add(U)}return!0}())return!1;if(!(u(m.contains)||(0,t.IsNumber)(m.minContains)||(0,t.IsNumber)(m.maxContains)))return!0;let c=u(m.contains)?m.contains:o.Type.Never(),O=w.reduce((b,v)=>N(c,$,v)?b+1:b,0);return!(O===0||(0,t.IsNumber)(m.minContains)&&O<m.minContains||(0,t.IsNumber)(m.maxContains)&&O>m.maxContains)}function d(m,$,w){return(0,t.IsAsyncIterator)(w)}function S(m,$,w){return!(!(0,t.IsBigInt)(w)||u(m.exclusiveMaximum)&&!(w<m.exclusiveMaximum)||u(m.exclusiveMinimum)&&!(w>m.exclusiveMinimum)||u(m.maximum)&&!(w<=m.maximum)||u(m.minimum)&&!(w>=m.minimum)||u(m.multipleOf)&&w%m.multipleOf!==BigInt(0))}function T(m,$,w){return(0,t.IsBoolean)(w)}function B(m,$,w){return N(m.returns,$,w.prototype)}function K(m,$,w){return!(!(0,t.IsDate)(w)||u(m.exclusiveMaximumTimestamp)&&!(w.getTime()<m.exclusiveMaximumTimestamp)||u(m.exclusiveMinimumTimestamp)&&!(w.getTime()>m.exclusiveMinimumTimestamp)||u(m.maximumTimestamp)&&!(w.getTime()<=m.maximumTimestamp)||u(m.minimumTimestamp)&&!(w.getTime()>=m.minimumTimestamp)||u(m.multipleOfTimestamp)&&w.getTime()%m.multipleOfTimestamp!==0)}function J(m,$,w){return(0,t.IsFunction)(w)}function A(m,$,w){return!(!(0,t.IsInteger)(w)||u(m.exclusiveMaximum)&&!(w<m.exclusiveMaximum)||u(m.exclusiveMinimum)&&!(w>m.exclusiveMinimum)||u(m.maximum)&&!(w<=m.maximum)||u(m.minimum)&&!(w>=m.minimum)||u(m.multipleOf)&&w%m.multipleOf!==0)}function M(m,$,w){let c=m.allOf.every(O=>N(O,$,w));if(m.unevaluatedProperties===!1){let O=new RegExp(o.KeyResolver.ResolvePattern(m)),b=Object.getOwnPropertyNames(w).every(v=>O.test(v));return c&&b}else if(o.TypeGuard.TSchema(m.unevaluatedProperties)){let O=new RegExp(o.KeyResolver.ResolvePattern(m)),b=Object.getOwnPropertyNames(w).every(v=>O.test(v)||N(m.unevaluatedProperties,$,w[v]));return c&&b}else return c}function W(m,$,w){return(0,t.IsIterator)(w)}function Y(m,$,w){return w===m.const}function F(m,$,w){return!1}function ne(m,$,w){return!N(m.not,$,w)}function V(m,$,w){return(0,t.IsNull)(w)}function pe(m,$,w){return!(!r.TypeSystemPolicy.IsNumberLike(w)||u(m.exclusiveMaximum)&&!(w<m.exclusiveMaximum)||u(m.exclusiveMinimum)&&!(w>m.exclusiveMinimum)||u(m.minimum)&&!(w>=m.minimum)||u(m.maximum)&&!(w<=m.maximum)||u(m.multipleOf)&&w%m.multipleOf!==0)}function L(m,$,w){if(!r.TypeSystemPolicy.IsObjectLike(w)||u(m.minProperties)&&!(Object.getOwnPropertyNames(w).length>=m.minProperties)||u(m.maxProperties)&&!(Object.getOwnPropertyNames(w).length<=m.maxProperties))return!1;let c=Object.getOwnPropertyNames(m.properties);for(let O of c){let b=m.properties[O];if(m.required&&m.required.includes(O)){if(!N(b,$,w[O])||(o.ExtendsUndefined.Check(b)||s(b))&&!(O in w))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(w,O)&&!N(b,$,w[O]))return!1}if(m.additionalProperties===!1){let O=Object.getOwnPropertyNames(w);return m.required&&m.required.length===c.length&&O.length===c.length?!0:O.every(b=>c.includes(b))}else return typeof m.additionalProperties=="object"?Object.getOwnPropertyNames(w).every(O=>c.includes(O)||N(m.additionalProperties,$,w[O])):!0}function D(m,$,w){return(0,t.IsPromise)(w)}function C(m,$,w){if(!r.TypeSystemPolicy.IsRecordLike(w)||u(m.minProperties)&&!(Object.getOwnPropertyNames(w).length>=m.minProperties)||u(m.maxProperties)&&!(Object.getOwnPropertyNames(w).length<=m.maxProperties))return!1;let[c,O]=Object.entries(m.patternProperties)[0],b=new RegExp(c),v=Object.entries(w).every(([Q,ie])=>b.test(Q)?N(O,$,ie):!0),U=typeof m.additionalProperties=="object"?Object.entries(w).every(([Q,ie])=>b.test(Q)?!0:N(m.additionalProperties,$,ie)):!0,z=m.additionalProperties===!1?Object.getOwnPropertyNames(w).every(Q=>b.test(Q)):!0;return v&&U&&z}function re(m,$,w){return N((0,n.Deref)(m,$),$,w)}function te(m,$,w){return!(0,t.IsString)(w)||u(m.minLength)&&!(w.length>=m.minLength)||u(m.maxLength)&&!(w.length<=m.maxLength)||u(m.pattern)&&!new RegExp(m.pattern).test(w)?!1:u(m.format)?o.FormatRegistry.Has(m.format)?o.FormatRegistry.Get(m.format)(w):!1:!0}function E(m,$,w){return(0,t.IsSymbol)(w)}function G(m,$,w){return(0,t.IsString)(w)&&new RegExp(m.pattern).test(w)}function oe(m,$,w){return N((0,n.Deref)(m,$),$,w)}function H(m,$,w){if(!(0,t.IsArray)(w)||m.items===void 0&&w.length!==0||w.length!==m.maxItems)return!1;if(!m.items)return!0;for(let c=0;c<m.items.length;c++)if(!N(m.items[c],$,w[c]))return!1;return!0}function Z(m,$,w){return(0,t.IsUndefined)(w)}function fe(m,$,w){return m.anyOf.some(c=>N(c,$,w))}function p(m,$,w){return!(!(0,t.IsUint8Array)(w)||u(m.maxByteLength)&&!(w.length<=m.maxByteLength)||u(m.minByteLength)&&!(w.length>=m.minByteLength))}function _(m,$,w){return!0}function I(m,$,w){return r.TypeSystemPolicy.IsVoidLike(w)}function k(m,$,w){return o.TypeRegistry.Has(m[o.Kind])?o.TypeRegistry.Get(m[o.Kind])(m,w):!1}function N(m,$,w){let c=u(m.$id)?[...$,m]:$,O=m;switch(O[o.Kind]){case"Any":return l(O,c,w);case"Array":return f(O,c,w);case"AsyncIterator":return d(O,c,w);case"BigInt":return S(O,c,w);case"Boolean":return T(O,c,w);case"Constructor":return B(O,c,w);case"Date":return K(O,c,w);case"Function":return J(O,c,w);case"Integer":return A(O,c,w);case"Intersect":return M(O,c,w);case"Iterator":return W(O,c,w);case"Literal":return Y(O,c,w);case"Never":return F(O,c,w);case"Not":return ne(O,c,w);case"Null":return V(O,c,w);case"Number":return pe(O,c,w);case"Object":return L(O,c,w);case"Promise":return D(O,c,w);case"Record":return C(O,c,w);case"Ref":return re(O,c,w);case"String":return te(O,c,w);case"Symbol":return E(O,c,w);case"TemplateLiteral":return G(O,c,w);case"This":return oe(O,c,w);case"Tuple":return H(O,c,w);case"Undefined":return Z(O,c,w);case"Union":return fe(O,c,w);case"Uint8Array":return p(O,c,w);case"Unknown":return _(O,c,w);case"Void":return I(O,c,w);default:if(!o.TypeRegistry.Has(O[o.Kind]))throw new a(O);return k(O,c,w)}}function P(...m){return m.length===3?N(m[0],m[1],m[2]):N(m[0],[],m[1])}e.Check=P}}),Wg=qe({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/transform.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EncodeTransform=e.DecodeTransform=e.HasTransform=e.TransformEncodeError=e.TransformDecodeError=e.TransformEncodeCheckError=e.TransformDecodeCheckError=void 0;var t=xn(),r=Ko(),n=Kg(),i=vr(),o=class extends i.TypeBoxError{constructor(S,T,B){super("Unable to decode due to invalid value"),this.schema=S,this.value=T,this.error=B}};e.TransformDecodeCheckError=o;var a=class extends i.TypeBoxError{constructor(S,T,B){super("Unable to encode due to invalid value"),this.schema=S,this.value=T,this.error=B}};e.TransformEncodeCheckError=a;var s=class extends i.TypeBoxError{constructor(S,T,B){super(`${B instanceof Error?B.message:"Unknown error"}`),this.schema=S,this.value=T}};e.TransformDecodeError=s;var u=class extends i.TypeBoxError{constructor(S,T,B){super(`${B instanceof Error?B.message:"Unknown error"}`),this.schema=S,this.value=T}};e.TransformEncodeError=u;var l;(function(S){function T(E,G){return i.TypeGuard.TTransform(E)||C(E.items,G)}function B(E,G){return i.TypeGuard.TTransform(E)||C(E.items,G)}function K(E,G){return i.TypeGuard.TTransform(E)||C(E.returns,G)||E.parameters.some(oe=>C(oe,G))}function J(E,G){return i.TypeGuard.TTransform(E)||C(E.returns,G)||E.parameters.some(oe=>C(oe,G))}function A(E,G){return i.TypeGuard.TTransform(E)||i.TypeGuard.TTransform(E.unevaluatedProperties)||E.allOf.some(oe=>C(oe,G))}function M(E,G){return i.TypeGuard.TTransform(E)||C(E.items,G)}function W(E,G){return i.TypeGuard.TTransform(E)||C(E.not,G)}function Y(E,G){return i.TypeGuard.TTransform(E)||Object.values(E.properties).some(oe=>C(oe,G))||i.TypeGuard.TSchema(E.additionalProperties)&&C(E.additionalProperties,G)}function F(E,G){return i.TypeGuard.TTransform(E)||C(E.item,G)}function ne(E,G){let oe=Object.getOwnPropertyNames(E.patternProperties)[0],H=E.patternProperties[oe];return i.TypeGuard.TTransform(E)||C(H,G)||i.TypeGuard.TSchema(E.additionalProperties)&&i.TypeGuard.TTransform(E.additionalProperties)}function V(E,G){return i.TypeGuard.TTransform(E)?!0:C((0,r.Deref)(E,G),G)}function pe(E,G){return i.TypeGuard.TTransform(E)?!0:C((0,r.Deref)(E,G),G)}function L(E,G){return i.TypeGuard.TTransform(E)||!(0,t.IsUndefined)(E.items)&&E.items.some(oe=>C(oe,G))}function D(E,G){return i.TypeGuard.TTransform(E)||E.anyOf.some(oe=>C(oe,G))}function C(E,G){let oe=(0,t.IsString)(E.$id)?[...G,E]:G,H=E;if(E.$id&&re.has(E.$id))return!1;switch(E.$id&&re.add(E.$id),E[i.Kind]){case"Array":return T(H,oe);case"AsyncIterator":return B(H,oe);case"Constructor":return K(H,oe);case"Function":return J(H,oe);case"Intersect":return A(H,oe);case"Iterator":return M(H,oe);case"Not":return W(H,oe);case"Object":return Y(H,oe);case"Promise":return F(H,oe);case"Record":return ne(H,oe);case"Ref":return V(H,oe);case"This":return pe(H,oe);case"Tuple":return L(H,oe);case"Union":return D(H,oe);default:return i.TypeGuard.TTransform(E)}}let re=new Set;function te(E,G){return re.clear(),C(E,G)}S.Has=te})(l||(e.HasTransform=l={}));var f;(function(S){function T(L,D){try{return i.TypeGuard.TTransform(L)?L[i.Transform].Decode(D):D}catch(C){throw new s(L,D,C)}}function B(L,D,C){return(0,t.IsArray)(C)?T(L,C.map(re=>V(L.items,D,re))):T(L,C)}function K(L,D,C){if(!(0,t.IsPlainObject)(C)||(0,t.IsValueType)(C))return T(L,C);let re=i.KeyResolver.ResolveKeys(L,{includePatterns:!1}),te=re.reduce((H,Z)=>Z in H?{...H,[Z]:V(i.IndexedAccessor.Resolve(L,[Z]),D,H[Z])}:H,C);if(!i.TypeGuard.TTransform(L.unevaluatedProperties))return T(L,te);let E=Object.getOwnPropertyNames(te),G=L.unevaluatedProperties,oe=E.reduce((H,Z)=>re.includes(Z)?H:{...H,[Z]:T(G,H[Z])},te);return T(L,oe)}function J(L,D,C){return T(L,V(L.not,D,C))}function A(L,D,C){if(!(0,t.IsPlainObject)(C))return T(L,C);let re=i.KeyResolver.ResolveKeys(L,{includePatterns:!1}),te=re.reduce((H,Z)=>Z in H?{...H,[Z]:V(L.properties[Z],D,H[Z])}:H,C);if(!i.TypeGuard.TSchema(L.additionalProperties))return T(L,te);let E=Object.getOwnPropertyNames(te),G=L.additionalProperties,oe=E.reduce((H,Z)=>re.includes(Z)?H:{...H,[Z]:T(G,H[Z])},te);return T(L,oe)}function M(L,D,C){if(!(0,t.IsPlainObject)(C))return T(L,C);let re=Object.getOwnPropertyNames(L.patternProperties)[0],te=new RegExp(re),E=Object.getOwnPropertyNames(C).reduce((Z,fe)=>te.test(fe)?{...Z,[fe]:V(L.patternProperties[re],D,Z[fe])}:Z,C);if(!i.TypeGuard.TSchema(L.additionalProperties))return T(L,E);let G=Object.getOwnPropertyNames(E),oe=L.additionalProperties,H=G.reduce((Z,fe)=>te.test(fe)?Z:{...Z,[fe]:T(oe,Z[fe])},E);return T(L,H)}function W(L,D,C){let re=(0,r.Deref)(L,D);return T(L,V(re,D,C))}function Y(L,D,C){let re=(0,r.Deref)(L,D);return T(L,V(re,D,C))}function F(L,D,C){return(0,t.IsArray)(C)&&(0,t.IsArray)(L.items)?T(L,L.items.map((re,te)=>V(re,D,C[te]))):T(L,C)}function ne(L,D,C){let re=T(L,C);for(let te of L.anyOf)if((0,n.Check)(te,D,re))return V(te,D,re);return re}function V(L,D,C){let re=typeof L.$id=="string"?[...D,L]:D,te=L;switch(L[i.Kind]){case"Array":return B(te,re,C);case"Intersect":return K(te,re,C);case"Not":return J(te,re,C);case"Object":return A(te,re,C);case"Record":return M(te,re,C);case"Ref":return W(te,re,C);case"Symbol":return T(te,C);case"This":return Y(te,re,C);case"Tuple":return F(te,re,C);case"Union":return ne(te,re,C);default:return T(te,C)}}function pe(L,D,C){return V(L,D,C)}S.Decode=pe})(f||(e.DecodeTransform=f={}));var d;(function(S){function T(L,D){try{return i.TypeGuard.TTransform(L)?L[i.Transform].Encode(D):D}catch(C){throw new u(L,D,C)}}function B(L,D,C){let re=T(L,C);return(0,t.IsArray)(re)?re.map(te=>V(L.items,D,te)):re}function K(L,D,C){let re=T(L,C);if(!(0,t.IsPlainObject)(C)||(0,t.IsValueType)(C))return re;let te=i.KeyResolver.ResolveKeys(L,{includePatterns:!1}),E=te.reduce((H,Z)=>Z in re?{...H,[Z]:V(i.IndexedAccessor.Resolve(L,[Z]),D,H[Z])}:H,re);if(!i.TypeGuard.TTransform(L.unevaluatedProperties))return T(L,E);let G=Object.getOwnPropertyNames(E),oe=L.unevaluatedProperties;return G.reduce((H,Z)=>te.includes(Z)?H:{...H,[Z]:T(oe,H[Z])},E)}function J(L,D,C){return T(L.not,T(L,C))}function A(L,D,C){let re=T(L,C);if(!(0,t.IsPlainObject)(C))return re;let te=i.KeyResolver.ResolveKeys(L,{includePatterns:!1}),E=te.reduce((H,Z)=>Z in H?{...H,[Z]:V(L.properties[Z],D,H[Z])}:H,re);if(!i.TypeGuard.TSchema(L.additionalProperties))return E;let G=Object.getOwnPropertyNames(E),oe=L.additionalProperties;return G.reduce((H,Z)=>te.includes(Z)?H:{...H,[Z]:T(oe,H[Z])},E)}function M(L,D,C){let re=T(L,C);if(!(0,t.IsPlainObject)(C))return re;let te=Object.getOwnPropertyNames(L.patternProperties)[0],E=new RegExp(te),G=Object.getOwnPropertyNames(C).reduce((Z,fe)=>E.test(fe)?{...Z,[fe]:V(L.patternProperties[te],D,Z[fe])}:Z,re);if(!i.TypeGuard.TSchema(L.additionalProperties))return T(L,G);let oe=Object.getOwnPropertyNames(G),H=L.additionalProperties;return oe.reduce((Z,fe)=>E.test(fe)?Z:{...Z,[fe]:T(H,Z[fe])},G)}function W(L,D,C){let re=(0,r.Deref)(L,D),te=V(re,D,C);return T(L,te)}function Y(L,D,C){let re=(0,r.Deref)(L,D),te=V(re,D,C);return T(L,te)}function F(L,D,C){let re=T(L,C);return(0,t.IsArray)(L.items)?L.items.map((te,E)=>V(te,D,re[E])):[]}function ne(L,D,C){for(let re of L.anyOf){if(!(0,n.Check)(re,D,C))continue;let te=V(re,D,C);return T(L,te)}for(let re of L.anyOf){let te=V(re,D,C);if((0,n.Check)(L,D,te))return T(L,te)}return T(L,C)}function V(L,D,C){let re=typeof L.$id=="string"?[...D,L]:D,te=L;switch(L[i.Kind]){case"Array":return B(te,re,C);case"Intersect":return K(te,re,C);case"Not":return J(te,re,C);case"Object":return A(te,re,C);case"Record":return M(te,re,C);case"Ref":return W(te,re,C);case"This":return Y(te,re,C);case"Tuple":return F(te,re,C);case"Union":return ne(te,re,C);default:return T(te,C)}}function pe(L,D,C){return V(L,D,C)}S.Encode=pe})(d||(e.EncodeTransform=d={}))}}),Hg=qe({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/compiler/compiler.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeCompiler=e.Policy=e.TypeCompilerTypeGuardError=e.TypeCompilerUnknownTypeError=e.TypeCheck=void 0;var t=Wg(),r=xn(),n=Wo(),i=mf(),o=Ko(),a=ks(),s=vr(),u=class{constructor(A,M,W,Y){this.schema=A,this.references=M,this.checkFunc=W,this.code=Y,this.hasTransform=t.HasTransform.Has(A,M)}Code(){return this.code}Errors(A){return(0,n.Errors)(this.schema,this.references,A)}Check(A){return this.checkFunc(A)}Decode(A){if(!this.checkFunc(A))throw new t.TransformDecodeCheckError(this.schema,A,this.Errors(A).First());return this.hasTransform?t.DecodeTransform.Decode(this.schema,this.references,A):A}Encode(A){let M=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,A):A;if(!this.checkFunc(M))throw new t.TransformEncodeCheckError(this.schema,A,this.Errors(A).First());return M}};e.TypeCheck=u;var l;(function(A){function M(ne){return ne===36}A.DollarSign=M;function W(ne){return ne===95}A.IsUnderscore=W;function Y(ne){return ne>=65&&ne<=90||ne>=97&&ne<=122}A.IsAlpha=Y;function F(ne){return ne>=48&&ne<=57}A.IsNumeric=F})(l||(l={}));var f;(function(A){function M(ne){return ne.length===0?!1:l.IsNumeric(ne.charCodeAt(0))}function W(ne){if(M(ne))return!1;for(let V=0;V<ne.length;V++){let pe=ne.charCodeAt(V);if(!(l.IsAlpha(pe)||l.IsNumeric(pe)||l.DollarSign(pe)||l.IsUnderscore(pe)))return!1}return!0}function Y(ne){return ne.replace(/'/g,"\\'")}function F(ne,V){return W(V)?`${ne}.${V}`:`${ne}['${Y(V)}']`}A.Encode=F})(f||(f={}));var d;(function(A){function M(W){let Y=[];for(let F=0;F<W.length;F++){let ne=W.charCodeAt(F);l.IsNumeric(ne)||l.IsAlpha(ne)?Y.push(W.charAt(F)):Y.push(`_${ne}_`)}return Y.join("").replace(/__/g,"_")}A.Encode=M})(d||(d={}));var S;(function(A){function M(W){return W.replace(/'/g,"\\'")}A.Escape=M})(S||(S={}));var T=class extends s.TypeBoxError{constructor(A){super("Unknown type"),this.schema=A}};e.TypeCompilerUnknownTypeError=T;var B=class extends s.TypeBoxError{constructor(A){super("Preflight validation check failed to guard for the given schema"),this.schema=A}};e.TypeCompilerTypeGuardError=B;var K;(function(A){function M(V,pe,L){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${pe}' in ${V} ? ${L} : true)`:`(${f.Encode(V,pe)} !== undefined ? ${L} : true)`}A.IsExactOptionalProperty=M;function W(V){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${V} === 'object' && ${V} !== null)`:`(typeof ${V} === 'object' && ${V} !== null && !Array.isArray(${V}))`}A.IsObjectLike=W;function Y(V){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${V} === 'object' && ${V} !== null && !(${V} instanceof Date) && !(${V} instanceof Uint8Array))`:`(typeof ${V} === 'object' && ${V} !== null && !Array.isArray(${V}) && !(${V} instanceof Date) && !(${V} instanceof Uint8Array))`}A.IsRecordLike=Y;function F(V){return i.TypeSystemPolicy.AllowNaN?`typeof ${V} === 'number'`:`(typeof ${V} === 'number' && Number.isFinite(${V}))`}A.IsNumberLike=F;function ne(V){return i.TypeSystemPolicy.AllowNullVoid?`(${V} === undefined || ${V} === null)`:`${V} === undefined`}A.IsVoidLike=ne})(K||(e.Policy=K={}));var J;(function(A){function M(x){return x[s.Kind]==="Any"||x[s.Kind]==="Unknown"}function*W(x,ce,j){yield"true"}function*Y(x,ce,j){yield`Array.isArray(${j})`;let[ve,ae]=[Ce("value","any"),Ce("acc","number")];(0,r.IsNumber)(x.maxItems)&&(yield`${j}.length <= ${x.maxItems}`),(0,r.IsNumber)(x.minItems)&&(yield`${j}.length >= ${x.minItems}`);let de=ie(x.items,ce,"value");if(yield`${j}.every((${ve}) => ${de})`,s.TypeGuard.TSchema(x.contains)||(0,r.IsNumber)(x.minContains)||(0,r.IsNumber)(x.maxContains)){let Ae=s.TypeGuard.TSchema(x.contains)?x.contains:s.Type.Never(),Me=ie(Ae,ce,"value"),tt=(0,r.IsNumber)(x.minContains)?[`(count >= ${x.minContains})`]:[],Ze=(0,r.IsNumber)(x.maxContains)?[`(count <= ${x.maxContains})`]:[],nt=`const count = value.reduce((${ae}, ${ve}) => ${Me} ? acc + 1 : acc, 0)`,rr=["(count > 0)",...tt,...Ze].join(" && ");yield`((${ve}) => { ${nt}; return ${rr}})(${j})`}x.uniqueItems===!0&&(yield`((${ve}) => { 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 } )(${j})`)}function*F(x,ce,j){yield`(typeof value === 'object' && Symbol.asyncIterator in ${j})`}function*ne(x,ce,j){yield`(typeof ${j} === 'bigint')`,(0,r.IsBigInt)(x.exclusiveMaximum)&&(yield`${j} < BigInt(${x.exclusiveMaximum})`),(0,r.IsBigInt)(x.exclusiveMinimum)&&(yield`${j} > BigInt(${x.exclusiveMinimum})`),(0,r.IsBigInt)(x.maximum)&&(yield`${j} <= BigInt(${x.maximum})`),(0,r.IsBigInt)(x.minimum)&&(yield`${j} >= BigInt(${x.minimum})`),(0,r.IsBigInt)(x.multipleOf)&&(yield`(${j} % BigInt(${x.multipleOf})) === 0`)}function*V(x,ce,j){yield`(typeof ${j} === 'boolean')`}function*pe(x,ce,j){yield*z(x.returns,ce,`${j}.prototype`)}function*L(x,ce,j){yield`(${j} instanceof Date) && Number.isFinite(${j}.getTime())`,(0,r.IsNumber)(x.exclusiveMaximumTimestamp)&&(yield`${j}.getTime() < ${x.exclusiveMaximumTimestamp}`),(0,r.IsNumber)(x.exclusiveMinimumTimestamp)&&(yield`${j}.getTime() > ${x.exclusiveMinimumTimestamp}`),(0,r.IsNumber)(x.maximumTimestamp)&&(yield`${j}.getTime() <= ${x.maximumTimestamp}`),(0,r.IsNumber)(x.minimumTimestamp)&&(yield`${j}.getTime() >= ${x.minimumTimestamp}`),(0,r.IsNumber)(x.multipleOfTimestamp)&&(yield`(${j}.getTime() % ${x.multipleOfTimestamp}) === 0`)}function*D(x,ce,j){yield`(typeof ${j} === 'function')`}function*C(x,ce,j){yield`(typeof ${j} === 'number' && Number.isInteger(${j}))`,(0,r.IsNumber)(x.exclusiveMaximum)&&(yield`${j} < ${x.exclusiveMaximum}`),(0,r.IsNumber)(x.exclusiveMinimum)&&(yield`${j} > ${x.exclusiveMinimum}`),(0,r.IsNumber)(x.maximum)&&(yield`${j} <= ${x.maximum}`),(0,r.IsNumber)(x.minimum)&&(yield`${j} >= ${x.minimum}`),(0,r.IsNumber)(x.multipleOf)&&(yield`(${j} % ${x.multipleOf}) === 0`)}function*re(x,ce,j){let ve=x.allOf.map(ae=>ie(ae,ce,j)).join(" && ");if(x.unevaluatedProperties===!1){let ae=we(`${new RegExp(s.KeyResolver.ResolvePattern(x))};`),de=`Object.getOwnPropertyNames(${j}).every(key => ${ae}.test(key))`;yield`(${ve} && ${de})`}else if(s.TypeGuard.TSchema(x.unevaluatedProperties)){let ae=we(`${new RegExp(s.KeyResolver.ResolvePattern(x))};`),de=`Object.getOwnPropertyNames(${j}).every(key => ${ae}.test(key) || ${ie(x.unevaluatedProperties,ce,`${j}[key]`)})`;yield`(${ve} && ${de})`}else yield`(${ve})`}function*te(x,ce,j){yield`(typeof value === 'object' && Symbol.iterator in ${j})`}function*E(x,ce,j){typeof x.const=="number"||typeof x.const=="boolean"?yield`(${j} === ${x.const})`:yield`(${j} === '${S.Escape(x.const)}')`}function*G(x,ce,j){yield"false"}function*oe(x,ce,j){yield`(!${ie(x.not,ce,j)})`}function*H(x,ce,j){yield`(${j} === null)`}function*Z(x,ce,j){yield K.IsNumberLike(j),(0,r.IsNumber)(x.exclusiveMaximum)&&(yield`${j} < ${x.exclusiveMaximum}`),(0,r.IsNumber)(x.exclusiveMinimum)&&(yield`${j} > ${x.exclusiveMinimum}`),(0,r.IsNumber)(x.maximum)&&(yield`${j} <= ${x.maximum}`),(0,r.IsNumber)(x.minimum)&&(yield`${j} >= ${x.minimum}`),(0,r.IsNumber)(x.multipleOf)&&(yield`(${j} % ${x.multipleOf}) === 0`)}function*fe(x,ce,j){yield K.IsObjectLike(j),(0,r.IsNumber)(x.minProperties)&&(yield`Object.getOwnPropertyNames(${j}).length >= ${x.minProperties}`),(0,r.IsNumber)(x.maxProperties)&&(yield`Object.getOwnPropertyNames(${j}).length <= ${x.maxProperties}`);let ve=Object.getOwnPropertyNames(x.properties);for(let ae of ve){let de=f.Encode(j,ae),Ae=x.properties[ae];if(x.required&&x.required.includes(ae))yield*z(Ae,ce,de),(s.ExtendsUndefined.Check(Ae)||M(Ae))&&(yield`('${ae}' in ${j})`);else{let Me=ie(Ae,ce,de);yield K.IsExactOptionalProperty(j,ae,Me)}}if(x.additionalProperties===!1)if(x.required&&x.required.length===ve.length)yield`Object.getOwnPropertyNames(${j}).length === ${ve.length}`;else{let ae=`[${ve.map(de=>`'${de}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${j}).every(key => ${ae}.includes(key))`}if(typeof x.additionalProperties=="object"){let ae=ie(x.additionalProperties,ce,`${j}[key]`),de=`[${ve.map(Ae=>`'${Ae}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${j}).every(key => ${de}.includes(key) || ${ae}))`}}function*p(x,ce,j){yield`(typeof value === 'object' && typeof ${j}.then === 'function')`}function*_(x,ce,j){yield K.IsRecordLike(j),(0,r.IsNumber)(x.minProperties)&&(yield`Object.getOwnPropertyNames(${j}).length >= ${x.minProperties}`),(0,r.IsNumber)(x.maxProperties)&&(yield`Object.getOwnPropertyNames(${j}).length <= ${x.maxProperties}`);let[ve,ae]=Object.entries(x.patternProperties)[0],de=we(`${new RegExp(ve)}`),Ae=ie(ae,ce,"value"),Me=s.TypeGuard.TSchema(x.additionalProperties)?ie(x.additionalProperties,ce,j):x.additionalProperties===!1?"false":"true",tt=`(${de}.test(key) ? ${Ae} : ${Me})`;yield`(Object.entries(${j}).every(([key, value]) => ${tt}))`}function*I(x,ce,j){let ve=(0,o.Deref)(x,ce);if(Q.functions.has(x.$ref))return yield`${me(x.$ref)}(${j})`;yield*z(ve,ce,j)}function*k(x,ce,j){yield`(typeof ${j} === 'string')`,(0,r.IsNumber)(x.maxLength)&&(yield`${j}.length <= ${x.maxLength}`),(0,r.IsNumber)(x.minLength)&&(yield`${j}.length >= ${x.minLength}`),x.pattern!==void 0&&(yield`${we(`${new RegExp(x.pattern)};`)}.test(${j})`),x.format!==void 0&&(yield`format('${x.format}', ${j})`)}function*N(x,ce,j){yield`(typeof ${j} === 'symbol')`}function*P(x,ce,j){yield`(typeof ${j} === 'string')`,yield`${we(`${new RegExp(x.pattern)};`)}.test(${j})`}function*m(x,ce,j){yield`${me(x.$ref)}(${j})`}function*$(x,ce,j){if(yield`Array.isArray(${j})`,x.items===void 0)return yield`${j}.length === 0`;yield`(${j}.length === ${x.maxItems})`;for(let ve=0;ve<x.items.length;ve++)yield`${ie(x.items[ve],ce,`${j}[${ve}]`)}`}function*w(x,ce,j){yield`${j} === undefined`}function*c(x,ce,j){yield`(${x.anyOf.map(ve=>ie(ve,ce,j)).join(" || ")})`}function*O(x,ce,j){yield`${j} instanceof Uint8Array`,(0,r.IsNumber)(x.maxByteLength)&&(yield`(${j}.length <= ${x.maxByteLength})`),(0,r.IsNumber)(x.minByteLength)&&(yield`(${j}.length >= ${x.minByteLength})`)}function*b(x,ce,j){yield"true"}function*v(x,ce,j){yield K.IsVoidLike(j)}function*U(x,ce,j){let ve=Q.instances.size;Q.instances.set(ve,x),yield`kind('${x[s.Kind]}', ${ve}, ${j})`}function*z(x,ce,j,ve=!0){let ae=(0,r.IsString)(x.$id)?[...ce,x]:ce,de=x;if(ve&&(0,r.IsString)(x.$id)){let Ae=me(x.$id);if(Q.functions.has(Ae))return yield`${Ae}(${j})`;{let Me=ke(Ae,x,ce,"value",!1);return Q.functions.set(Ae,Me),yield`${Ae}(${j})`}}switch(de[s.Kind]){case"Any":return yield*W(de,ae,j);case"Array":return yield*Y(de,ae,j);case"AsyncIterator":return yield*F(de,ae,j);case"BigInt":return yield*ne(de,ae,j);case"Boolean":return yield*V(de,ae,j);case"Constructor":return yield*pe(de,ae,j);case"Date":return yield*L(de,ae,j);case"Function":return yield*D(de,ae,j);case"Integer":return yield*C(de,ae,j);case"Intersect":return yield*re(de,ae,j);case"Iterator":return yield*te(de,ae,j);case"Literal":return yield*E(de,ae,j);case"Never":return yield*G(de,ae,j);case"Not":return yield*oe(de,ae,j);case"Null":return yield*H(de,ae,j);case"Number":return yield*Z(de,ae,j);case"Object":return yield*fe(de,ae,j);case"Promise":return yield*p(de,ae,j);case"Record":return yield*_(de,ae,j);case"Ref":return yield*I(de,ae,j);case"String":return yield*k(de,ae,j);case"Symbol":return yield*N(de,ae,j);case"TemplateLiteral":return yield*P(de,ae,j);case"This":return yield*m(de,ae,j);case"Tuple":return yield*$(de,ae,j);case"Undefined":return yield*w(de,ae,j);case"Union":return yield*c(de,ae,j);case"Uint8Array":return yield*O(de,ae,j);case"Unknown":return yield*b(de,ae,j);case"Void":return yield*v(de,ae,j);default:if(!s.TypeRegistry.Has(de[s.Kind]))throw new T(x);return yield*U(de,ae,j)}}let Q={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function ie(x,ce,j,ve=!0){return`(${[...z(x,ce,j,ve)].join(" && ")})`}function me(x){return`check_${d.Encode(x)}`}function we(x){let ce=`local_${Q.variables.size}`;return Q.variables.set(ce,`const ${ce} = ${x}`),ce}function ke(x,ce,j,ve,ae=!0){let[de,Ae]=[`
|
|
49
|
+
`,nt=>"".padStart(nt," ")],Me=Ce("value","any"),tt=br("boolean"),Ze=[...z(ce,j,ve,ae)].map(nt=>`${Ae(4)}${nt}`).join(` &&${de}`);return`function ${x}(${Me})${tt} {${de}${Ae(2)}return (${de}${Ze}${de}${Ae(2)})
|
|
50
|
+
}`}function Ce(x,ce){let j=Q.language==="typescript"?`: ${ce}`:"";return`${x}${j}`}function br(x){return Q.language==="typescript"?`: ${x}`:""}function be(x,ce,j){let ve=ke("check",x,ce,"value"),ae=Ce("value","any"),de=br("boolean"),Ae=[...Q.functions.values()],Me=[...Q.variables.values()],tt=(0,r.IsString)(x.$id)?`return function check(${ae})${de} {
|
|
51
|
+
return ${me(x.$id)}(value)
|
|
52
|
+
}`:`return ${ve}`;return[...Me,...Ae,tt].join(`
|
|
53
|
+
`)}function tr(...x){let ce={language:"javascript"},[j,ve,ae]=x.length===2&&(0,r.IsArray)(x[1])?[x[0],x[1],ce]:x.length===2&&!(0,r.IsArray)(x[1])?[x[0],[],x[1]]:x.length===3?[x[0],x[1],x[2]]:x.length===1?[x[0],[],ce]:[null,[],ce];if(Q.language=ae.language,Q.variables.clear(),Q.functions.clear(),Q.instances.clear(),!s.TypeGuard.TSchema(j))throw new B(j);for(let de of ve)if(!s.TypeGuard.TSchema(de))throw new B(de);return be(j,ve,ae)}A.Code=tr;function wr(x,ce=[]){let j=tr(x,ce,{language:"javascript"}),ve=globalThis.Function("kind","format","hash",j),ae=new Map(Q.instances);function de(Ze,nt,rr){if(!s.TypeRegistry.Has(Ze)||!ae.has(nt))return!1;let Jr=s.TypeRegistry.Get(Ze),Yr=ae.get(nt);return Jr(Yr,rr)}function Ae(Ze,nt){return s.FormatRegistry.Has(Ze)?s.FormatRegistry.Get(Ze)(nt):!1}function Me(Ze){return(0,a.Hash)(Ze)}let tt=ve(de,Ae,Me);return new u(x,ce,tt,j)}A.Compile=wr})(J||(e.TypeCompiler=J={}))}}),Xg=qe({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/compiler/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(i,o,a,s){s===void 0&&(s=a);var u=Object.getOwnPropertyDescriptor(o,a);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(i,s,u)}:function(i,o,a,s){s===void 0&&(s=a),i[s]=o[a]}),r=e&&e.__exportStar||function(i,o){for(var a in i)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorIterator=e.ValueErrorType=void 0;var n=qg();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return n.ValueErrorIterator}}),r(Hg(),e)}}),yo=er(Fg(),1),Jg=er(zg(),1),gf=!1,vf=!1;yo.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(gf=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(vf=process?.env?.LOGGER_PERF_PREFIX==="true"));var Yg={prefix:void 0,time:gf,delta:vf,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},ba=[],bf=class{sinceFirst=0;sinceLast=0;time=!1;delta=!1;constructor(e,t,r,n){Object.assign(this,{sinceFirst:e,sinceLast:t,time:r,delta:n})}toString(){let e=this.sinceFirst*.001,t=e.toFixed(e<5?2:1),r=this.sinceLast<1e3?`${this.sinceLast.toFixed(0)}`.padStart(5," "):`${`${(this.sinceLast*.001).toFixed(this.sinceLast<1e4?1:0)}`.padStart(4," ")}s`;return`[${[this.time?t:null,this.delta?r:null].filter(n=>n!=null).join(",")}]`}},wf=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},zn=!1,$e=class it{static ERROR=2;static WARN=4;static INFO=6;static LOG=6;static DEBUG=8;static VERBOSE=10;static firstLog=0;static lastLog=0;static setup(t=it.INFO,r={}){r=Object.assign({},Yg,r),t>10&&console.debug("setup logger",{config:r});let n=this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}),i=(...u)=>{typeof window<"u"&&window?.FORCE_DISABLE_LOGLEVEL&&n(...u)};i.isDisabled=!0,i.isEnabled=!1;let o=this.wrapLog(console.groupCollapsed,r),a=(u,l)=>{function f(...S){let T=S[S.length-1];return T===i?T():(o(...S.slice(0,-1)),(async()=>{try{let B=T();return B instanceof Promise?await B:B}finally{console.groupEnd()}})())}let d=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:l});return u?d:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:d})},s=a(t>=it.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(s(...u),new Error((0,Jg.default)(u))),WARN:a(t>=it.WARN,this.wrapLog(console.warn,r)),LOG:a(t>=it.INFO,this.wrapLog(console.log,r)),DEBUG:a(t>=it.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:a(t>=it.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(yo.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=yo.isBrowser&&navigator.userAgent.includes("Chrome")?["",it.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(zn?n.push(new wf("dim",r.prefix)):n.push(r.prefix)),t.bind(console,...n)}}static timeStr(t,r,n=0){if(!performance.now)return;let i=performance.now();it.firstLog||(it.firstLog=i,it.lastLog=i);let o=new bf(i-it.firstLog,i-it.lastLog,t,r);return it.lastLog=i,n?o.toString():o}static getOriginFromStack(t){let r=!1;for(let n of t.split(`
|
|
54
|
+
`)){let i=n.match(/^\s+at\s+(.*)/);if(i){if(r)return i[1].trim().replace(__dirname,"");r=!0}}}};yo.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(ba&&ba.length){for(let t of ba)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof bf))return null;zn||(zn=!0);let t=$e.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof wf?(zn||(zn=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var _f=er(Gg(),1),gS=_f.default.configure,ii=_f.default,wa=100,{WARN:Zg,LOG:vS,DEBUG:ze,VERBOSE:Te,ERROR:bS}=$e.setup($e.INFO),mo=Be.set();og({enforceActions:"always"});if(!new class{xyz}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");var Ge=({caller:e,thread:t,pattern:r,args:n})=>Re(()=>(n=n||r,`${!Array.isArray(t)&&t?.name?t.name+" | ":""}${e??"caller?"}${n?`{${typeof n=="string"?n:ii(n)}}`:""}`));function Qg(e,t){return Re(()=>Je.structural(e.get(),t.get()))}function Ei(e,t){return Je.shallow(e.applogs,t.applogs)}function Us(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(Te.isEnabled&&Te("queryNodesComparer",r,n,i),!Je.structural(n.variables,i.variables))return Te.isEnabled&&Te("[queryNodesComparer] changed vars:",r,n,i),!1;if(!Ei(n.logsOfThisNode,i.logsOfThisNode))return Te.isEnabled&&Te("[queryNodesComparer] changed logsOfThisNode:",r,n,i),!1}return Te.isEnabled&&Te("[queryNodesComparer] equal:",{a:e,b:t}),!0}var ev=0;function Ht(e,{name:t,equals:r}={}){let n=`observableArrayMap@${++ev}{${t}}`;Te.isEnabled&&Te(`[${n}] create`,{fnname:e.name,fn:e,name:t,equals:r});let i,o=Tf(e,s=>{i?Re(()=>(r??Je.structural)(i,s))?ze.isEnabled&&ze(`[${n}] update skipped`,{updatedItems:s,observableArr:i}):(i.replace(s),ze.isEnabled&&ze(`[${n}] updated`,{updatedItems:s,observableArr:i})):i=Be.array(s,{deep:!1,name:t,equals:r})},{name:n});if(n.includes("useRoots")){var a=Rt(i);ze(`[${n}] deps`,{disposeAutorun:o,rootsAtom:a,observableArr:i,observers:lo(i)}),ti(()=>mo.add(a))}return Te.isEnabled&&Go(i,()=>{Te(`[${n}] observed`,lo(i),{rootsAtom:a,observableArr:i})}),bn(i,()=>{Te.isEnabled&&Te(`[${n}] dispose`),a&&ti(()=>mo.delete(a)),o()}),i}var tv=0;function rv(e,{name:t}={}){let r=`observableSetMap@${++tv}{${t}}`;Te.isEnabled&&Te(`[${r}] create`,{fnname:e.name,fn:e,name:t});let n,i=Tf(e,a=>{if(!n)n=Be.set(a,{deep:!1,name:t});else{let{deleted:s,added:u}=Re(()=>{let l=new Set(n.values()),f=new Set;for(let d of a)n.has(d)?(Te.isEnabled&&Te(`[${r}] unchanged`,d,{updatedItems:a,observableSet:n}),l.delete(d)):f.add(d);return ze.isEnabled&&ze(`[${r}] updated:`,{unseen:l,added:f,updatedItems:a,observableSet:n}),{added:f,deleted:l}});for(let l of s)n.delete(l);for(let l of u)n.add(l)}},{name:r});if(r.includes("useRoots")){var o=Rt(n);ze.isEnabled&&ze(`[${r}] deps`,{disposeAutorun:i,rootsAtom:o,observableSet:n,observers:lo(n)}),ti(()=>mo.add(o))}return Te.isEnabled&&Go(n,()=>{Te(`[${r}] observed`,lo(n),{rootsAtom:o,observableSet:n})}),bn(n,()=>{Te.isEnabled&&Te(`[${r}] dispose`),o&&ti(()=>mo.delete(o)),i()}),n}function Tf(e,t=null,{name:r}={}){ze.isEnabled&&ze("[autorunButAlsoImmediately] create",{fnname:e.name,fn:e,name:r});let n=`${r}.autorunImm`,i,o=new Qn(n,function(...s){ze.isEnabled&&ze(`[${n}] reaction.invalidate`,s),a()});function a(){o.track(function(){let s=wa&&performance.now();ze.isEnabled&&ze(`[${n}] runAndTrack:`,{name:r??e.name,fn:e}),i=e(),ze.isEnabled&&ze(`[${n}] runAndTrack =>`,i),ti(()=>{t?.(i)}),wa&&performance.now()-s>wa&&Zg(`[${n}] took ${performance.now()-s}ms`)})}return a(),ze.isEnabled&&ze(`[${n}] deps of reaction`,{reaction:o,result:i,deps:qo(o)}),()=>{Te.isEnabled&&Te(`[${n}] dispose`),setTimeout(()=>o.dispose())}}function Ye(e,t,r=!1){if(vn(t))throw new Error("computedFnDeepCompare shouldn't be used on actions");let n=!1,i=0,o=typeof r=="boolean"?{keepAlive:r}:r,a=new Map;return function(...s){let u,l=Re(()=>s),f=`computedFnDeepCompare(${e||t.name}#${++i})${o.argsDebugName?`{${o.argsDebugName(...s)}}`:""}`;for(let[T,B]of a.entries())if(Je.structural(T,l)){u=B;break}if(u){let T=u.get();return Te.isEnabled&&Te(`[${f}] cache hit`,{untrackedArgs:l,cachedResult:T}),T}if(!o.keepAlive&&!km())return!n&&Cm().computedRequiresReaction&&(console.warn("invoking a computedFn from outside an reactive context won't be memoized, unless keepAlive is set"),n=!0),t.apply(this,s);Te.isEnabled&&Te(`[${f}] new computation`,{untrackedArgs:l});let d,S=Le(()=>(Te.isEnabled&&Te(`[${f}] update->rerun`,Re(()=>({args:s})),t),Te.isEnabled&&ef(),d=t.apply(this,s)),{...o,name:f});if(Te.isEnabled&&Te(`[${f}] deps`,qo(S),{untrackedArgs:l}),a.set(l,S),!o.keepAlive){let T=bn(S,()=>{Te.isEnabled&&Te(`[${f}] dispose`,S),T(),a.delete(l),o.onCleanup&&o.onCleanup(d,...s),d=void 0})}return S.get()}}function nv(e){let t=0,r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("?r+=o+`
|
|
55
|
+
`+" ".repeat(++t):o===")"?r+=`
|
|
56
|
+
`+" ".repeat(--t)+o:o===","&&n===0?r+=o+`
|
|
57
|
+
`+" ".repeat(t):o==="{"&&n===0?(n++,r+=o+`
|
|
58
|
+
`+" ".repeat(t+1)):o==="}"&&n===1?(n--,r+=`
|
|
59
|
+
`+" ".repeat(t)+o):o==="{"&&n>0?(n++,r+=o):(o==="}"&&n>1&&n--,r+=o)}return r}var{WARN:qu,LOG:wS,DEBUG:iv,VERBOSE:_S,ERROR:xr}=$e.setup($e.INFO,{prefix:"[thread]"});function yr(e){return e.init!==void 0}var Rs=class{constructor(e,t,r,n=[],i={}){this.name=e,this._applogs=n,this.parents=t===null?null:ho(t),this.filters=r,Re(()=>this.parents?.length===0)&&qu("[Thread] empty parents array",e),i.skipObservable||wn(this,{applogsCids:Le,applogsByCid:Le,insert:_t,size:Le,isEmpty:Le,firstLog:Le,latestLog:Le},{name:`Thread{${e}}`})}filters;parents;_subscribers=[];get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}insert(e){if(this.readOnly)throw xr("[Thread] insert() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw xr("[Thread] insert() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw xr("[Thread] insert() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insert(e)}insertRaw(e){if(this.readOnly)throw xr("[Thread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw xr("[Thread] insertRaw() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw xr("[Thread] insertRaw() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insertRaw(e)}subscribe(e){return this._subscribers.push(e),this.unsubscribe.bind(this,e)}unsubscribe(e){let t=this._subscribers.indexOf(e);t!==-1?this._subscribers.splice(t,1):qu("unsubscribe called for non-existent",e)}notifySubscribers(e){iv(`[thread: ${this.name}] notifying`,this._subscribers.length,"subscribers of",{...e,subs:this._subscribers});for(let t of this._subscribers)t(e)}get applogs(){return this._applogs}get applogsCids(){return this._applogs.map(e=>e.cid)}map(e){return this.applogs.map(e)}get findLast(){return this.applogs.findLast.bind(this.applogs)}get findFirst(){return this.applogs.find.bind(this.applogs)}get firstLog(){return this.applogs[0]}get latestLog(){return this.applogs[this.applogs.length-1]}hasApplog(e,t){if(t)return this.applogs.includes(e);if(!e.cid)throw xr("[hasApplogs] applog without CID:",e);return this.hasApplogCid(e.cid)}hasApplogCid(e){return this.applogsCids.includes(e.toString())}get applogsByCid(){return new Map(this.applogs.map(e=>[e.cid,e]))}getApplog(e){return this.applogsByCid.get(e.toString())}hasApplogWithDiffTs(e){return this.applogs.find(t=>t.en===e.en&&t.at===e.at&&t.vl===e.vl&&t.ag===e.ag)}get isEmpty(){return this.size===0}get size(){return this.applogs.length}get length(){return this.applogs.length}get untrackedSize(){return Re(()=>this.size)}get nameAndSizeUntracked(){return Re(()=>`${this.name} (${this.size})`)}get prettyName(){return nv(this.name)}get hasParents(){return!!this.parents?.length}},ov=class Of extends Rs{static fromArray(t,r){return new Of(r||"static",null,[],t)}constructor(t,r,n,i){super(t,r,n,i,{skipObservable:!0})}get readOnly(){return!0}},av={};hf(av,{code:()=>Gf,decode:()=>Xs,encode:()=>Hs,format:()=>tl,name:()=>p0,parse:()=>h0,stringify:()=>tl});var sv=["string","number","bigint","symbol"],uv=["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 lv(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return sv.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":cv(e)?"Buffer":fv(e)||"Object"}function cv(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function fv(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(uv.includes(t))return t}var R=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}};R.uint=new R(0,"uint",!0);R.negint=new R(1,"negint",!0);R.bytes=new R(2,"bytes",!0);R.string=new R(3,"string",!0);R.array=new R(4,"array",!1);R.map=new R(5,"map",!1);R.tag=new R(6,"tag",!1);R.float=new R(7,"float",!0);R.false=new R(7,"false",!0);R.true=new R(7,"true",!0);R.null=new R(7,"null",!0);R.undefined=new R(7,"undefined",!0);R.break=new R(7,"break",!0);var ee=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}`}},En=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",pv=new TextDecoder,dv=new TextEncoder;function go(e){return En&&globalThis.Buffer.isBuffer(e)}function Bs(e){return e instanceof Uint8Array?go(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var hv=En?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Wu(e,t,r):(e,t,r)=>r-t>64?pv.decode(e.subarray(t,r)):Wu(e,t,r),xf=En?e=>e.length>64?globalThis.Buffer.from(e):Ku(e):e=>e.length>64?dv.encode(e):Ku(e),Ds=En?(e,t,r)=>go(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),yv=En?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Bs(globalThis.Buffer.concat(e,t))):(e,t)=>{let r=new Uint8Array(t),n=0;for(let i of e)n+i.length>r.length&&(i=i.subarray(0,r.length-n)),r.set(i,n),n+=i.length;return r},mv=En?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function gv(e,t){if(go(e)&&go(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 Ku(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 Wu(e,t,r){let n=[];for(;t<r;){let i=e[t],o=null,a=i>239?4:i>223?3:i>191?2:1;if(t+a<=r){let s,u,l,f;switch(a){case 1:i<128&&(o=i);break;case 2:s=e[t+1],(s&192)===128&&(f=(i&31)<<6|s&63,f>127&&(o=f));break;case 3:s=e[t+1],u=e[t+2],(s&192)===128&&(u&192)===128&&(f=(i&15)<<12|(s&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:s=e[t+1],u=e[t+2],l=e[t+3],(s&192)===128&&(u&192)===128&&(l&192)===128&&(f=(i&15)<<18|(s&63)<<12|(u&63)<<6|l&63,f>65535&&f<1114112&&(o=f))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),t+=a}return Ef(n)}var Hu=4096;function Ef(e){let t=e.length;if(t<=Hu)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Hu));return r}var vv=256,If=class{constructor(e=vv){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=mv(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=Ds(r,0,this.cursor)}else t=yv(this.chunks,this.cursor);return e&&this.reset(),t}},ye="CBOR decode error:",Ar="CBOR encode error:",Ii=[];Ii[23]=1;Ii[24]=2;Ii[25]=3;Ii[26]=5;Ii[27]=9;function In(e,t,r){if(e.length-t<r)throw new Error(`${ye} not enough data for type`)}var He=[24,256,65536,4294967296,BigInt("18446744073709551616")];function zr(e,t,r){In(e,t,1);let n=e[t];if(r.strict===!0&&n<He[0])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);return n}function Gr(e,t,r){In(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<He[1])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);return n}function qr(e,t,r){In(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<He[2])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);return n}function Kr(e,t,r){In(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<He[3])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${ye} integers outside of the safe integer range are not supported`)}function bv(e,t,r,n){return new ee(R.uint,zr(e,t+1,n),2)}function wv(e,t,r,n){return new ee(R.uint,Gr(e,t+1,n),3)}function _v(e,t,r,n){return new ee(R.uint,qr(e,t+1,n),5)}function Tv(e,t,r,n){return new ee(R.uint,Kr(e,t+1,n),9)}function Wr(e,t){return It(e,0,t.value)}function It(e,t,r){if(r<He[0]){let n=Number(r);e.push([t|n])}else if(r<He[1]){let n=Number(r);e.push([t|24,n])}else if(r<He[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<He[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<He[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,e.push(i)}else throw new Error(`${ye} encountered BigInt larger than allowable range`)}}Wr.encodedSize=function(e){return It.encodedSize(e.value)};It.encodedSize=function(e){return e<He[0]?1:e<He[1]?2:e<He[2]?3:e<He[3]?5:9};Wr.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function Ov(e,t,r,n){return new ee(R.negint,-1-zr(e,t+1,n),2)}function xv(e,t,r,n){return new ee(R.negint,-1-Gr(e,t+1,n),3)}function Ev(e,t,r,n){return new ee(R.negint,-1-qr(e,t+1,n),5)}var Cs=BigInt(-1),Sf=BigInt(1);function Iv(e,t,r,n){let i=Kr(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ee(R.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${ye} integers outside of the safe integer range are not supported`);return new ee(R.negint,Cs-BigInt(i),9)}function Ms(e,t){let r=t.value,n=typeof r=="bigint"?r*Cs-Sf:r*-1-1;It(e,t.type.majorEncoded,n)}Ms.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*Cs-Sf:t*-1-1;return r<He[0]?1:r<He[1]?2:r<He[2]?3:r<He[3]?5:9};Ms.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Si(e,t,r,n){In(e,t,r+n);let i=Ds(e,t+r,t+r+n);return new ee(R.bytes,i,r+n)}function Sv(e,t,r,n){return Si(e,t,1,r)}function Av(e,t,r,n){return Si(e,t,2,zr(e,t+1,n))}function $v(e,t,r,n){return Si(e,t,3,Gr(e,t+1,n))}function jv(e,t,r,n){return Si(e,t,5,qr(e,t+1,n))}function Nv(e,t,r,n){let i=Kr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer bytes lengths not supported`);return Si(e,t,9,i)}function vo(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===R.string?xf(e.value):e.value),e.encodedBytes}function Ho(e,t){let r=vo(t);It(e,t.type.majorEncoded,r.length),e.push(r)}Ho.encodedSize=function(e){let t=vo(e);return It.encodedSize(t.length)+t.length};Ho.compareTokens=function(e,t){return Pv(vo(e),vo(t))};function Pv(e,t){return e.length<t.length?-1:e.length>t.length?1:gv(e,t)}function Ai(e,t,r,n,i){let o=r+n;In(e,t,o);let a=new ee(R.string,hv(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=Ds(e,t+r,t+o)),a}function kv(e,t,r,n){return Ai(e,t,1,r,n)}function Uv(e,t,r,n){return Ai(e,t,2,zr(e,t+1,n),n)}function Rv(e,t,r,n){return Ai(e,t,3,Gr(e,t+1,n),n)}function Bv(e,t,r,n){return Ai(e,t,5,qr(e,t+1,n),n)}function Dv(e,t,r,n){let i=Kr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer string lengths not supported`);return Ai(e,t,9,i,n)}var Cv=Ho;function Sn(e,t,r,n){return new ee(R.array,n,r)}function Mv(e,t,r,n){return Sn(e,t,1,r)}function Lv(e,t,r,n){return Sn(e,t,2,zr(e,t+1,n))}function Vv(e,t,r,n){return Sn(e,t,3,Gr(e,t+1,n))}function Fv(e,t,r,n){return Sn(e,t,5,qr(e,t+1,n))}function zv(e,t,r,n){let i=Kr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer array lengths not supported`);return Sn(e,t,9,i)}function Gv(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ye} indefinite length items not allowed`);return Sn(e,t,1,1/0)}function Ls(e,t){It(e,R.array.majorEncoded,t.value)}Ls.compareTokens=Wr.compareTokens;Ls.encodedSize=function(e){return It.encodedSize(e.value)};function An(e,t,r,n){return new ee(R.map,n,r)}function qv(e,t,r,n){return An(e,t,1,r)}function Kv(e,t,r,n){return An(e,t,2,zr(e,t+1,n))}function Wv(e,t,r,n){return An(e,t,3,Gr(e,t+1,n))}function Hv(e,t,r,n){return An(e,t,5,qr(e,t+1,n))}function Xv(e,t,r,n){let i=Kr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer map lengths not supported`);return An(e,t,9,i)}function Jv(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ye} indefinite length items not allowed`);return An(e,t,1,1/0)}function Vs(e,t){It(e,R.map.majorEncoded,t.value)}Vs.compareTokens=Wr.compareTokens;Vs.encodedSize=function(e){return It.encodedSize(e.value)};function Yv(e,t,r,n){return new ee(R.tag,r,1)}function Zv(e,t,r,n){return new ee(R.tag,zr(e,t+1,n),2)}function Qv(e,t,r,n){return new ee(R.tag,Gr(e,t+1,n),3)}function eb(e,t,r,n){return new ee(R.tag,qr(e,t+1,n),5)}function tb(e,t,r,n){return new ee(R.tag,Kr(e,t+1,n),9)}function Fs(e,t){It(e,R.tag.majorEncoded,t.value)}Fs.compareTokens=Wr.compareTokens;Fs.encodedSize=function(e){return It.encodedSize(e.value)};var rb=20,nb=21,ib=22,ob=23;function ab(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${ye} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ee(R.null,null,1):new ee(R.undefined,void 0,1)}function sb(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ye} indefinite length items not allowed`);return new ee(R.break,void 0,1)}function zs(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${ye} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${ye} Infinity values are not supported`)}return new ee(R.float,e,t)}function ub(e,t,r,n){return zs(qs(e,t+1),3,n)}function lb(e,t,r,n){return zs(Ks(e,t+1),5,n)}function cb(e,t,r,n){return zs(Nf(e,t+1),9,n)}function Gs(e,t,r){let n=t.value;if(n===!1)e.push([R.float.majorEncoded|rb]);else if(n===!0)e.push([R.float.majorEncoded|nb]);else if(n===null)e.push([R.float.majorEncoded|ib]);else if(n===void 0)e.push([R.float.majorEncoded|ob]);else{let i,o=!1;(!r||r.float64!==!0)&&($f(n),i=qs($t,1),n===i||Number.isNaN(n)?($t[0]=249,e.push($t.slice(0,3)),o=!0):(jf(n),i=Ks($t,1),n===i&&($t[0]=250,e.push($t.slice(0,5)),o=!0))),o||(fb(n),i=Nf($t,1),$t[0]=251,e.push($t.slice(0,9)))}}Gs.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){$f(r);let n=qs($t,1);if(r===n||Number.isNaN(r))return 3;if(jf(r),n=Ks($t,1),r===n)return 5}return 9};var Af=new ArrayBuffer(9),yt=new DataView(Af,1),$t=new Uint8Array(Af,0);function $f(e){if(e===1/0)yt.setUint16(0,31744,!1);else if(e===-1/0)yt.setUint16(0,64512,!1);else if(Number.isNaN(e))yt.setUint16(0,32256,!1);else{yt.setFloat32(0,e);let t=yt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)yt.setUint16(0,31744,!1);else if(r===0)yt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?yt.setUint16(0,0):i<-14?yt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):yt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function qs(e,t){if(e.length-t<2)throw new Error(`${ye} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function jf(e){yt.setFloat32(0,e,!1)}function Ks(e,t){if(e.length-t<4)throw new Error(`${ye} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function fb(e){yt.setFloat64(0,e,!1)}function Nf(e,t){if(e.length-t<8)throw new Error(`${ye} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Gs.compareTokens=Wr.compareTokens;function Se(e,t,r){throw new Error(`${ye} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Xo(e){return()=>{throw new Error(`${ye} ${e}`)}}var ue=[];for(let e=0;e<=23;e++)ue[e]=Se;ue[24]=bv;ue[25]=wv;ue[26]=_v;ue[27]=Tv;ue[28]=Se;ue[29]=Se;ue[30]=Se;ue[31]=Se;for(let e=32;e<=55;e++)ue[e]=Se;ue[56]=Ov;ue[57]=xv;ue[58]=Ev;ue[59]=Iv;ue[60]=Se;ue[61]=Se;ue[62]=Se;ue[63]=Se;for(let e=64;e<=87;e++)ue[e]=Sv;ue[88]=Av;ue[89]=$v;ue[90]=jv;ue[91]=Nv;ue[92]=Se;ue[93]=Se;ue[94]=Se;ue[95]=Xo("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ue[e]=kv;ue[120]=Uv;ue[121]=Rv;ue[122]=Bv;ue[123]=Dv;ue[124]=Se;ue[125]=Se;ue[126]=Se;ue[127]=Xo("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ue[e]=Mv;ue[152]=Lv;ue[153]=Vv;ue[154]=Fv;ue[155]=zv;ue[156]=Se;ue[157]=Se;ue[158]=Se;ue[159]=Gv;for(let e=160;e<=183;e++)ue[e]=qv;ue[184]=Kv;ue[185]=Wv;ue[186]=Hv;ue[187]=Xv;ue[188]=Se;ue[189]=Se;ue[190]=Se;ue[191]=Jv;for(let e=192;e<=215;e++)ue[e]=Yv;ue[216]=Zv;ue[217]=Qv;ue[218]=eb;ue[219]=tb;ue[220]=Se;ue[221]=Se;ue[222]=Se;ue[223]=Se;for(let e=224;e<=243;e++)ue[e]=Xo("simple values are not supported");ue[244]=Se;ue[245]=Se;ue[246]=Se;ue[247]=ab;ue[248]=Xo("simple values are not supported");ue[249]=ub;ue[250]=lb;ue[251]=cb;ue[252]=Se;ue[253]=Se;ue[254]=Se;ue[255]=sb;var qt=[];for(let e=0;e<24;e++)qt[e]=new ee(R.uint,e,1);for(let e=-1;e>=-24;e--)qt[31-e]=new ee(R.negint,e,1);qt[64]=new ee(R.bytes,new Uint8Array(0),1);qt[96]=new ee(R.string,"",1);qt[128]=new ee(R.array,0,1);qt[160]=new ee(R.map,0,1);qt[244]=new ee(R.false,!1,1);qt[245]=new ee(R.true,!0,1);qt[246]=new ee(R.null,null,1);function Pf(){let e=[];return e[R.uint.major]=Wr,e[R.negint.major]=Ms,e[R.bytes.major]=Ho,e[R.string.major]=Cv,e[R.array.major]=Ls,e[R.map.major]=Vs,e[R.tag.major]=Fs,e[R.float.major]=Gs,e}var TS=Pf(),_a=new If,Xu=class kf{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(`${Ar} object contains circular references`);return new kf(r,t)}},ir={null:new ee(R.null,null),undefined:new ee(R.undefined,void 0),true:new ee(R.true,!0),false:new ee(R.false,!1),emptyArray:new ee(R.array,0),emptyMap:new ee(R.map,0)},mr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ee(R.float,e):e>=0?new ee(R.uint,e):new ee(R.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ee(R.uint,e):new ee(R.negint,e)},Uint8Array(e,t,r,n){return new ee(R.bytes,e)},string(e,t,r,n){return new ee(R.string,e)},boolean(e,t,r,n){return e?ir.true:ir.false},null(e,t,r,n){return ir.null},undefined(e,t,r,n){return ir.undefined},ArrayBuffer(e,t,r,n){return new ee(R.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ee(R.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[ir.emptyArray,new ee(R.break)]:ir.emptyArray;n=Xu.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=qi(a,r,n);return r.addBreakTokens?[new ee(R.array,e.length),i,new ee(R.break)]:[new ee(R.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length;if(!a)return r.addBreakTokens===!0?[ir.emptyMap,new ee(R.break)]:ir.emptyMap;n=Xu.createCheck(n,e);let s=[],u=0;for(let l of o)s[u++]=[qi(l,r,n),qi(i?e.get(l):e[l],r,n)];return pb(s,r),r.addBreakTokens?[new ee(R.map,a),s,new ee(R.break)]:[new ee(R.map,a),s]}};mr.Map=mr.Object;mr.Buffer=mr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))mr[`${e}Array`]=mr.DataView;function qi(e,t={},r){let n=lv(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||mr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=mr[n];if(!o)throw new Error(`${Ar} unsupported type: ${n}`);return o(e,n,t,r)}function pb(e,t){t.mapSorter&&e.sort(t.mapSorter)}function Uf(e,t,r,n){if(Array.isArray(t))for(let i of t)Uf(e,i,r,n);else r[t.type.major](e,t,n)}function db(e,t,r){let n=qi(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let i=r.quickEncodeToken(n);if(i)return i;let o=t[n.type.major];if(o.encodedSize){let a=o.encodedSize(n,r),s=new If(a);if(o(s,n,r),s.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return Bs(s.chunks[0])}}return _a.reset(),Uf(_a,n,t,r),_a.toBytes(!0)}var hb={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},yb=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=qt[e];if(t===void 0){let r=ue[e];if(!r)throw new Error(`${ye} 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}},oi=Symbol.for("DONE"),Jo=Symbol.for("BREAK");function mb(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=ai(t,r);if(o===Jo){if(e.value===1/0)break;throw new Error(`${ye} got unexpected break to lengthed array`)}if(o===oi)throw new Error(`${ye} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function gb(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},o=n?new Map:void 0;for(let a=0;a<e.value;a++){let s=ai(t,r);if(s===Jo){if(e.value===1/0)break;throw new Error(`${ye} got unexpected break to lengthed map`)}if(s===oi)throw new Error(`${ye} found map but not enough entries (got ${a} [no key], expected ${e.value})`);if(n!==!0&&typeof s!="string")throw new Error(`${ye} non-string keys not supported (got ${typeof s})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(s)||!n&&s in i))throw new Error(`${ye} found repeat map key "${s}"`);let u=ai(t,r);if(u===oi)throw new Error(`${ye} found map but not enough entries (got ${a} [no value], expected ${e.value})`);n?o.set(s,u):i[s]=u}return n?o:i}function ai(e,t){if(e.done())return oi;let r=e.next();if(r.type===R.break)return Jo;if(r.type.terminal)return r.value;if(r.type===R.array)return mb(r,e,t);if(r.type===R.map)return gb(r,e,t);if(r.type===R.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=ai(e,t);return t.tags[r.value](n)}throw new Error(`${ye} tag not supported (${r.value})`)}throw new Error("unsupported")}function vb(e,t){if(!(e instanceof Uint8Array))throw new Error(`${ye} data to decode must be a Uint8Array`);t=Object.assign({},hb,t);let r=t.tokenizer||new yb(e,t),n=ai(r,t);if(n===oi)throw new Error(`${ye} did not find any content to decode`);if(n===Jo)throw new Error(`${ye} got unexpected break`);return[n,e.subarray(r.pos())]}function bb(e,t){let[r,n]=vb(e,t);if(n.length>0)throw new Error(`${ye} too many terminals, data makes no sense`);return r}var wb=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(t.type===R.array&&(t.elements++,t.elements!==1&&e.push([44])),t.type===R.map&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[R.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)}[R.negint.major](e,t){this[R.uint.major](e,t)}[R.bytes.major](e,t){throw new Error(`${Ar} unsupported type: Uint8Array`)}[R.string.major](e,t){this.prefix(e);let r=xf(JSON.stringify(t.value));e.push(r.length>32?Bs(r):r)}[R.array.major](e,t){this.prefix(e),this.inRecursive.push({type:R.array,elements:0}),e.push([91])}[R.map.major](e,t){this.prefix(e),this.inRecursive.push({type:R.map,elements:0}),e.push([123])}[R.tag.major](e,t){}[R.float.major](e,t){if(t.type.name==="break"){let o=this.inRecursive.pop();if(o){if(o.type===R.array)e.push([93]);else if(o.type===R.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(`${Ar} unsupported type: undefined`);if(this.prefix(e),t.type.name==="true"){e.push([116,114,117,101]);return}else if(t.type.name==="false"){e.push([102,97,108,115,101]);return}else if(t.type.name==="null"){e.push([110,117,108,108]);return}let r=String(t.value),n=[],i=!1;for(let o=0;o<r.length;o++)n[o]=r.charCodeAt(o),!i&&(n[o]===46||n[o]===101||n[o]===69)&&(i=!0);i||(n.push(46),n.push(48)),e.push(n)}};function _b(e,t){if(Array.isArray(e[0])||Array.isArray(t[0]))throw new Error(`${Ar} complex map keys are not supported`);let r=e[0],n=t[0];if(r.type!==R.string||n.type!==R.string)throw new Error(`${Ar} non-string map keys are not supported`);if(r<n)return-1;if(r>n)return 1;throw new Error(`${Ar} unexpected duplicate map keys, this is not supported`)}var Tb={addBreakTokens:!0,mapSorter:_b};function Ob(e,t){return t=Object.assign({},Tb,t),db(e,new wb,t)}var Rf=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(`${ye} 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(`${ye} unexpected token at position ${this._pos}, expected to find '${String.fromCharCode(...e)}'`)}parseNumber(){let e=this._pos,t=!1,r=!1,n=a=>{for(;!this.done();){let s=this.ch();if(a.includes(s))this._pos++;else break}};if(this.ch()===45&&(t=!0,this._pos++),this.ch()===48)if(this._pos++,this.ch()===46)this._pos++,r=!0;else return new ee(R.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(`${ye} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(r)throw new Error(`${ye} unexpected token at position ${this._pos}`);r=!0,this._pos++,n([48,49,50,51,52,53,54,55,56,57])}!this.done()&&(this.ch()===101||this.ch()===69)&&(r=!0,this._pos++,!this.done()&&(this.ch()===43||this.ch()===45)&&this._pos++,n([48,49,50,51,52,53,54,55,56,57]));let i=String.fromCharCode.apply(null,this.data.subarray(e,this._pos)),o=parseFloat(i);return r?new ee(R.float,o,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(o)?new ee(o>=0?R.uint:R.negint,o,this._pos-e):new ee(o>=0?R.uint:R.negint,BigInt(i),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${ye} unexpected character at position ${this._pos}; this shouldn't happen`);this._pos++;for(let i=this._pos,o=0;i<this.data.length&&o<65536;i++,o++){let a=this.data[i];if(a===92||a<32||a>=128)break;if(a===34){let s=String.fromCharCode.apply(null,this.data.subarray(this._pos,i));return this._pos=i+1,new ee(R.string,s,o)}}let e=this._pos,t=[],r=()=>{if(this._pos+4>=this.data.length)throw new Error(`${ye} unexpected end of unicode escape sequence at position ${this._pos}`);let i=0;for(let o=0;o<4;o++){let a=this.ch();if(a>=48&&a<=57)a-=48;else if(a>=97&&a<=102)a=a-97+10;else if(a>=65&&a<=70)a=a-65+10;else throw new Error(`${ye} unexpected unicode escape character at position ${this._pos}`);i=i*16+a,this._pos++}return i},n=()=>{let i=this.ch(),o=null,a=i>239?4:i>223?3:i>191?2:1;if(this._pos+a>this.data.length)throw new Error(`${ye} unexpected unicode sequence at position ${this._pos}`);let s,u,l,f;switch(a){case 1:i<128&&(o=i);break;case 2:s=this.data[this._pos+1],(s&192)===128&&(f=(i&31)<<6|s&63,f>127&&(o=f));break;case 3:s=this.data[this._pos+1],u=this.data[this._pos+2],(s&192)===128&&(u&192)===128&&(f=(i&15)<<12|(s&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:s=this.data[this._pos+1],u=this.data[this._pos+2],l=this.data[this._pos+3],(s&192)===128&&(u&192)===128&&(l&192)===128&&(f=(i&15)<<18|(s&63)<<12|(u&63)<<6|l&63,f>65535&&f<1114112&&(o=f))}o===null?(o=65533,a=1):o>65535&&(o-=65536,t.push(o>>>10&1023|55296),o=56320|o&1023),t.push(o),this._pos+=a};for(;!this.done();){let i=this.ch(),o;switch(i){case 92:if(this._pos++,this.done())throw new Error(`${ye} unexpected string termination at position ${this._pos}`);switch(o=this.ch(),this._pos++,o){case 34:case 39:case 92:case 47:t.push(o);break;case 98:t.push(8);break;case 116:t.push(9);break;case 110:t.push(10);break;case 102:t.push(12);break;case 114:t.push(13);break;case 117:t.push(r());break;default:throw new Error(`${ye} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new ee(R.string,Ef(t),this._pos-e);default:if(i<32)throw new Error(`${ye} invalid control character at position ${this._pos}`);i<128?(t.push(i),this._pos++):n()}}throw new Error(`${ye} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new ee(R.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new ee(R.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new ee(R.null,null,4);case 102:return this.expect([102,97,108,115,101]),new ee(R.false,!1,5);case 116:return this.expect([116,114,117,101]),new ee(R.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(`${ye} 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 ee(R.break,void 0,1);if(this.ch()!==44)throw new Error(`${ye} 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 ee(R.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 ee(R.break,void 0,1);if(this.ch()!==44)throw new Error(`${ye} 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 ee(R.break,void 0,1);let e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${ye} 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(`${ye} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}};function xb(e,t){return t=Object.assign({tokenizer:new Rf(e,t)},t),bb(e,t)}var OS=new Uint8Array(0);function Eb(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function Ws(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 Ib(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(B){if(B instanceof Uint8Array||(ArrayBuffer.isView(B)?B=new Uint8Array(B.buffer,B.byteOffset,B.byteLength):Array.isArray(B)&&(B=Uint8Array.from(B))),!(B instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(B.length===0)return"";for(var K=0,J=0,A=0,M=B.length;A!==M&&B[A]===0;)A++,K++;for(var W=(M-A)*f+1>>>0,Y=new Uint8Array(W);A!==M;){for(var F=B[A],ne=0,V=W-1;(F!==0||ne<J)&&V!==-1;V--,ne++)F+=256*Y[V]>>>0,Y[V]=F%s>>>0,F=F/s>>>0;if(F!==0)throw new Error("Non-zero carry");J=ne,A++}for(var pe=W-J;pe!==W&&Y[pe]===0;)pe++;for(var L=u.repeat(K);pe<W;++pe)L+=e.charAt(Y[pe]);return L}function S(B){if(typeof B!="string")throw new TypeError("Expected String");if(B.length===0)return new Uint8Array;var K=0;if(B[K]!==" "){for(var J=0,A=0;B[K]===u;)J++,K++;for(var M=(B.length-K)*l+1>>>0,W=new Uint8Array(M);B[K];){var Y=r[B.charCodeAt(K)];if(Y===255)return;for(var F=0,ne=M-1;(Y!==0||F<A)&&ne!==-1;ne--,F++)Y+=s*W[ne]>>>0,W[ne]=Y%256>>>0,Y=Y/256>>>0;if(Y!==0)throw new Error("Non-zero carry");A=F,K++}if(B[K]!==" "){for(var V=M-A;V!==M&&W[V]===0;)V++;for(var pe=new Uint8Array(J+(M-V)),L=J;V!==M;)pe[L++]=W[V++];return pe}}}function T(B){var K=S(B);if(K)return K;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:S,decode:T}}var Sb=Ib,Ab=Sb,$b=Ab,jb=class{name;prefix;baseEncode;constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Nb=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,r){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Bf(this,e)}},Pb=class{decoders;constructor(e){this.decoders=e}or(e){return Bf(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Bf(e,t){return new Pb({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var kb=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new jb(e,t,r),this.decoder=new Nb(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Df({name:e,prefix:t,encode:r,decode:n}){return new kb(e,t,r,n)}function Yo({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=$b(r,e);return Df({prefix:t,name:e,encode:n,decode:o=>Ws(i(o))})}function Ub(e,t,r,n){let i={};for(let f=0;f<t.length;++f)i[t[f]]=f;let o=e.length;for(;e[o-1]==="=";)--o;let a=new Uint8Array(o*r/8|0),s=0,u=0,l=0;for(let f=0;f<o;++f){let d=i[e[f]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|d,s+=r,s>=8&&(s-=8,a[l++]=255&u>>s)}if(s>=r||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a}function Rb(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",a=0,s=0;for(let u=0;u<e.length;++u)for(s=s<<8|e[u],a+=8;a>r;)a-=r,o+=t[i&s>>a];if(a!==0&&(o+=t[i&s<<r-a]),n)for(;o.length*r&7;)o+="=";return o}function ft({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return Df({prefix:t,name:e,encode(i){return Rb(i,n,r)},decode(i){return Ub(i,n,r,e)}})}var Ki=ft({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),xS=ft({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ES=ft({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),IS=ft({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),SS=ft({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),AS=ft({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),$S=ft({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),jS=ft({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),NS=ft({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),ur=Yo({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),PS=Yo({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Cf={};hf(Cf,{Digest:()=>Zo,create:()=>To,decode:()=>Lf,equals:()=>Vf});var Bb=Mf,Ju=128,Db=127,Cb=~Db,Mb=Math.pow(2,31);function Mf(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Mb;)t[r++]=e&255|Ju,e/=128;for(;e&Cb;)t[r++]=e&255|Ju,e>>>=7;return t[r]=e|0,Mf.bytes=r-n+1,t}var Lb=Wa,Vb=128,Yu=127;function Wa(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Wa.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Yu)<<i:(a&Yu)*Math.pow(2,i),i+=7}while(a>=Vb);return Wa.bytes=o-n,r}var Fb=Math.pow(2,7),zb=Math.pow(2,14),Gb=Math.pow(2,21),qb=Math.pow(2,28),Kb=Math.pow(2,35),Wb=Math.pow(2,42),Hb=Math.pow(2,49),Xb=Math.pow(2,56),Jb=Math.pow(2,63),Yb=function(e){return e<Fb?1:e<zb?2:e<Gb?3:e<qb?4:e<Kb?5:e<Wb?6:e<Hb?7:e<Xb?8:e<Jb?9:10},Zb={encode:Bb,decode:Lb,encodingLength:Yb},Qb=Zb,bo=Qb;function Ha(e,t=0){return[bo.decode(e,t),bo.decode.bytes]}function wo(e,t,r=0){return bo.encode(e,t,r),t}function _o(e){return bo.encodingLength(e)}function To(e,t){let r=t.byteLength,n=_o(e),i=n+_o(r),o=new Uint8Array(i+r);return wo(e,o,0),wo(r,o,n),o.set(t,i),new Zo(e,r,t,o)}function Lf(e){let t=Ws(e),[r,n]=Ha(t),[i,o]=Ha(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Zo(r,i,a,t)}function Vf(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Eb(e.bytes,r.bytes)}}var Zo=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Zu(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return t0(r,Xa(e),t??ur.encoder);default:return r0(r,Xa(e),t??Ki.encoder)}}var Qu=new WeakMap;function Xa(e){let t=Qu.get(e);if(t==null){let r=new Map;return Qu.set(e,r),r}return t}var lt=class et{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==Cn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==n0)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return et.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=To(t,r);return et.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 et.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&Vf(t.multihash,n.multihash)}toString(t){return Zu(this,t)}toJSON(){return{"/":Zu(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof et)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new et(n,i,o,a??el(n,i,o.bytes))}else if(r[i0]===!0){let{version:n,multihash:i,code:o}=r,a=Lf(i);return et.create(n,o,a)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==Cn)throw new Error(`Version 0 CID must use dag-pb (code: ${Cn}) block encoding`);return new et(t,r,n,n.bytes)}case 1:{let i=el(t,r,n.bytes);return new et(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return et.create(0,Cn,t)}static createV1(t,r){return et.create(1,t,r)}static decode(t){let[r,n]=et.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=et.inspectBytes(t),n=r.size-r.multihashSize,i=Ws(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),a=new Zo(r.multihashCode,r.digestSize,o,i);return[r.version===0?et.createV0(a):et.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,S]=Ha(t.subarray(r));return r+=S,d},i=n(),o=Cn;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=e0(t,r),o=et.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Xa(o).set(n,t),o}};function e0(e,t){switch(e[0]){case"Q":{let r=t??ur;return[ur.prefix,r.decode(`${ur.prefix}${e}`)]}case ur.prefix:{let r=t??ur;return[ur.prefix,r.decode(e)]}case Ki.prefix:{let r=t??Ki;return[Ki.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function t0(e,t,r){let{prefix:n}=r;if(n!==ur.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function r0(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var Cn=112,n0=18;function el(e,t,r){let n=_o(e),i=n+_o(t),o=new Uint8Array(i+r.byteLength);return wo(e,o,0),wo(t,o,n),o.set(r,i),o}var i0=Symbol.for("@ipld/js-cid/CID");function Ff({name:e,code:t,encode:r}){return new o0(e,t,r)}var o0=class{name;code;encode;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?To(this.code,t):t.then(r=>To(this.code,r))}else throw Error("Unknown type, must be binary type")}},zf=ft({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),kS=ft({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),US=ft({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),RS=ft({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function a0(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=lt.asCID(e);if(!t)return null;let r=t.toString();return[new ee(R.map,1/0,1),new ee(R.string,"/",1),new ee(R.string,r,r.length),new ee(R.break,void 0,1)]}function Oo(e){let t=zf.encode(e).slice(1);return[new ee(R.map,1/0,1),new ee(R.string,"/",1),new ee(R.map,1/0,1),new ee(R.string,"bytes",5),new ee(R.string,t,t.length),new ee(R.break,void 0,1),new ee(R.break,void 0,1)]}function St(e){return Oo(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function s0(e){return Oo(new Uint8Array(e))}function u0(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function l0(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 c0={typeEncoders:{Object:a0,Buffer:Oo,Uint8Array:Oo,Int8Array:St,Uint16Array:St,Int16Array:St,Uint32Array:St,Int32Array:St,Float32Array:St,Float64Array:St,Uint8ClampedArray:St,BigInt64Array:St,BigUint64Array:St,DataView:St,ArrayBuffer:s0,undefined:u0,number:l0}},f0=class extends Rf{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===R.map){let t=this._next();if(t.type===R.string&&t.value==="/"){let r=this._next();if(r.type===R.string){if(this._next().type!==R.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new ee(R.tag,42,0)}if(r.type===R.map){let n=this._next();if(n.type===R.string&&n.value==="bytes"){let i=this._next();if(i.type===R.string){for(let a=0;a<2;a++)if(this._next().type!==R.break)throw new Error("Invalid encoded Bytes form");let o=zf.decode(`m${i.value}`);return new ee(R.bytes,o,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(n)}this.tokenBuffer.push(r)}this.tokenBuffer.push(t)}return e}},Ja={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Ja.tags[42]=lt.parse;var p0="dag-json",Gf=297,Hs=e=>Ob(e,c0),Xs=e=>{let t=Object.assign(Ja,{tokenizer:new f0(e,Ja)});return xb(e,t)},tl=e=>d0.decode(Hs(e)),d0=new TextDecoder,h0=e=>Xs(y0.encode(e)),y0=new TextEncoder;function m0(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function g0(e,...t){if(!m0(e))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 rl(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 v0(e,t){g0(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}function b0(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}var Ta=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Ct=(e,t)=>e<<32-t|e>>>t,w0=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!w0)throw new Error("Non little-endian hardware is not supported");function _0(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function qf(e){if(typeof e=="string"&&(e=_0(e)),!b0(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}var T0=class{clone(){return this._cloneInto()}},BS={}.toString;function O0(e){let t=n=>e().update(qf(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function x0(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let i=BigInt(32),o=BigInt(4294967295),a=Number(r>>i&o),s=Number(r&o),u=n?4:0,l=n?0:4;e.setUint32(t+u,a,n),e.setUint32(t+l,s,n)}var E0=class extends T0{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=Ta(this.buffer)}update(e){rl(this);let{view:t,buffer:r,blockLen:n}=this;e=qf(e);let i=e.length;for(let o=0;o<i;){let a=Math.min(n-this.pos,i-o);if(a===n){let s=Ta(e);for(;n<=i-o;o+=n)this.process(s,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){rl(this),v0(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let f=o;f<n;f++)t[f]=0;x0(r,n-8,BigInt(this.length*8),i),this.process(r,0);let a=Ta(e),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let u=s/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)a.setUint32(4*f,l[f],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:a}=this;return e.length=n,e.pos=a,e.finished=i,e.destroyed=o,n%t&&e.buffer.set(r),e}},I0=(e,t,r)=>e&t^~e&r,S0=(e,t,r)=>e&t^e&r^t&r,A0=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]),or=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ar=new Uint32Array(64),$0=class extends E0{constructor(){super(64,32,8,!1),this.A=or[0]|0,this.B=or[1]|0,this.C=or[2]|0,this.D=or[3]|0,this.E=or[4]|0,this.F=or[5]|0,this.G=or[6]|0,this.H=or[7]|0}get(){let{A:e,B:t,C:r,D:n,E:i,F:o,G:a,H:s}=this;return[e,t,r,n,i,o,a,s]}set(e,t,r,n,i,o,a,s){this.A=e|0,this.B=t|0,this.C=r|0,this.D=n|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=s|0}process(e,t){for(let f=0;f<16;f++,t+=4)ar[f]=e.getUint32(t,!1);for(let f=16;f<64;f++){let d=ar[f-15],S=ar[f-2],T=Ct(d,7)^Ct(d,18)^d>>>3,B=Ct(S,17)^Ct(S,19)^S>>>10;ar[f]=B+ar[f-7]+T+ar[f-16]|0}let{A:r,B:n,C:i,D:o,E:a,F:s,G:u,H:l}=this;for(let f=0;f<64;f++){let d=Ct(a,6)^Ct(a,11)^Ct(a,25),S=l+d+I0(a,s,u)+A0[f]+ar[f]|0,T=(Ct(r,2)^Ct(r,13)^Ct(r,22))+S0(r,n,i)|0;l=u,u=s,s=a,a=o+S|0,o=i,i=n,n=r,r=S+T|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,n,i,o,a,s,u,l)}roundClean(){ar.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},j0=O0(()=>new $0),Ke=er(vr(),1),Kf=er(Xg(),1),nl=e=>Ke.Type.Union([e,Ke.Type.Null()]),Wf=/^(k51qz|baguq)[0-9a-z]{56,57}$/,N0=/^[0-9A-Fa-f]{7,8}$/g;Ke.FormatRegistry.Set("EntityID",e=>!!e.match(N0)||!!e.match(Wf));var P0=Ke.Type.String(),Ya=e=>e?.enc instanceof Uint8Array;Ke.FormatRegistry.Set("CID",e=>!!e.match(Wf));var Hf=Ke.Type.String({format:"CID"}),k0=/^http([s]?):\/\/.*\..*/;Ke.FormatRegistry.Set("URL",e=>!!e.match(k0));var DS=Ke.Type.String({format:"URL"}),Xf=Ke.Type.Object({en:P0,at:Ke.Type.String(),vl:nl(Ke.Type.Union([Ke.Type.String(),Ke.Type.Boolean(),Ke.Type.Number()])),ts:Ke.Type.String(),ag:Ke.Type.String(),pv:nl(Hf)}),il=Kf.TypeCompiler.Compile(Xf),CS=il.Check.bind(il),U0=Ke.Type.Composite([Ke.Type.Object({cid:Hf}),Xf]),Za=Kf.TypeCompiler.Compile(U0),R0=e=>Array.from(Za.Errors(e)),Jf=Za.Check.bind(Za),B0=Yo({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),MS=Yo({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});function Yf(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var D0=Ff({name:"sha2-256",code:18,encode:Yf("SHA-256")}),LS=Ff({name:"sha2-512",code:19,encode:Yf("SHA-512")}),{WARN:ol,LOG:VS,DEBUG:C0,VERBOSE:xo,ERROR:M0}=$e.setup($e.INFO),L0=114;function V0(e,t=["cid"]){if(!e)throw M0("falsy log",e);let r=e.cid;if(Ya(e))return r||(r=Js(Zf(e).bytes).toString()),ol("preparing an encrypted applog - really?"),{log:e,cid:r};let n={};for(let[i,o]of Object.entries(e))o===void 0&&(ol(`log.${i} is undefined, which is not allowed - encoding as null`,e),o=null),t.includes(i)?xo("excluding app log",{key:i,val:o}):n[i]=o;return{log:n,cid:r}}function F0(e){return Js(z0(e).bytes)}function z0(e){return Zf(V0(e)?.log)}function Js(e){let t=j0(e),r=Cf.create(D0.code,t),n=lt.create(1,Gf,r);return xo("[getCidSync]",{bytes:e,hash:t,digest:r,cid:n}),n}function Zf(e){C0("[encodeBlock]",e);let t=Hs(e);return{bytes:t,cid:Js(t)}}function G0(e){let t=null,r=[];try{t=lt.parse(e)}catch(n){xo("[retrieveThread] couldn't parse pubID with default base"),r.push(n)}if(!t)try{t=lt.parse(e,B0)}catch(n){xo("[retrieveThread] couldn't parse pubID with base36"),r.push(n)}return{cid:t,errors:t?null:r,isIpns:t&&Ys(t)}}function Ys(e){return e.code===L0}function Qa(e){return typeof e=="string"?lt.parse(e):typeof e.toV1!="function"?lt.decode(e.bytes):e}function Zs(e,t){if(!e||!t)throw new Error(`[areCidsEqual] invalid params: ${e}, ${t}`);if(e===t)return!0;let r=Qa(e),n=Qa(t);return r.toV1().toString()===n.toV1().toString()}function q0(e,t){return e instanceof Set?e.has(typeof t=="string"?t:t.toV1().toString()):e.some(r=>Zs(r,t))}function al(e){let t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function K0(e,t){let r=al(e),n=al(t);return+r<+n}var W0=typeof global=="object"&&global&&global.Object===Object&&global,Qf=W0,H0=typeof self=="object"&&self&&self.Object===Object&&self,X0=Qf||H0||Function("return this")(),pt=X0,J0=pt.Symbol,Ft=J0,ep=Object.prototype,Y0=ep.hasOwnProperty,Z0=ep.toString,Mn=Ft?Ft.toStringTag:void 0;function Q0(e){var t=Y0.call(e,Mn),r=e[Mn];try{e[Mn]=void 0;var n=!0}catch{}var i=Z0.call(e);return n&&(t?e[Mn]=r:delete e[Mn]),i}var ew=Q0,tw=Object.prototype,rw=tw.toString;function nw(e){return rw.call(e)}var iw=nw,ow="[object Null]",aw="[object Undefined]",sl=Ft?Ft.toStringTag:void 0;function sw(e){return e==null?e===void 0?aw:ow:sl&&sl in Object(e)?ew(e):iw(e)}var $n=sw;function uw(e){return e!=null&&typeof e=="object"}var kr=uw,lw="[object Symbol]";function cw(e){return typeof e=="symbol"||kr(e)&&$n(e)==lw}var sn=cw;function fw(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 pw=fw,dw=Array.isArray,Bt=dw,hw=1/0,ul=Ft?Ft.prototype:void 0,ll=ul?ul.toString:void 0;function tp(e){if(typeof e=="string")return e;if(Bt(e))return pw(e,tp)+"";if(sn(e))return ll?ll.call(e):"";var t=e+"";return t=="0"&&1/e==-hw?"-0":t}var yw=tp,mw=/\s/;function gw(e){for(var t=e.length;t--&&mw.test(e.charAt(t)););return t}var vw=gw,bw=/^\s+/;function ww(e){return e&&e.slice(0,vw(e)+1).replace(bw,"")}var _w=ww;function Tw(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Yt=Tw,cl=NaN,Ow=/^[-+]0x[0-9a-f]+$/i,xw=/^0b[01]+$/i,Ew=/^0o[0-7]+$/i,Iw=parseInt;function Sw(e){if(typeof e=="number")return e;if(sn(e))return cl;if(Yt(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Yt(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=_w(e);var r=xw.test(e);return r||Ew.test(e)?Iw(e.slice(2),r?2:8):Ow.test(e)?cl:+e}var Aw=Sw,fl=1/0,$w=17976931348623157e292;function jw(e){if(!e)return e===0?e:0;if(e=Aw(e),e===fl||e===-fl){var t=e<0?-1:1;return t*$w}return e===e?e:0}var Nw=jw;function Pw(e){var t=Nw(e),r=t%1;return t===t?r?t-r:t:0}var pl=Pw;function kw(e){return e}var Qo=kw,Uw="[object AsyncFunction]",Rw="[object Function]",Bw="[object GeneratorFunction]",Dw="[object Proxy]";function Cw(e){if(!Yt(e))return!1;var t=$n(e);return t==Rw||t==Bw||t==Uw||t==Dw}var rp=Cw,Mw=pt["__core-js_shared__"],Oa=Mw,dl=function(){var e=/[^.]+$/.exec(Oa&&Oa.keys&&Oa.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Lw(e){return!!dl&&dl in e}var Vw=Lw,Fw=Function.prototype,zw=Fw.toString;function Gw(e){if(e!=null){try{return zw.call(e)}catch{}try{return e+""}catch{}}return""}var Hr=Gw,qw=/[\\^$.*+?()[\]{}|]/g,Kw=/^\[object .+?Constructor\]$/,Ww=Function.prototype,Hw=Object.prototype,Xw=Ww.toString,Jw=Hw.hasOwnProperty,Yw=RegExp("^"+Xw.call(Jw).replace(qw,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Zw(e){if(!Yt(e)||Vw(e))return!1;var t=rp(e)?Yw:Kw;return t.test(Hr(e))}var Qw=Zw;function e1(e,t){return e?.[t]}var t1=e1;function r1(e,t){var r=t1(e,t);return Qw(r)?r:void 0}var Xr=r1,n1=Xr(pt,"WeakMap"),si=n1,i1=si&&new si,Eo=i1,o1=Eo?function(e,t){return Eo.set(e,t),e}:Qo,np=o1,hl=Object.create,a1=function(){function e(){}return function(t){if(!Yt(t))return{};if(hl)return hl(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),Qs=a1;function s1(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=Qs(e.prototype),n=e.apply(r,t);return Yt(n)?n:r}}var ui=s1,u1=1;function l1(e,t,r){var n=t&u1,i=ui(e);function o(){var a=this&&this!==pt&&this instanceof o?i:e;return a.apply(n?r:this,arguments)}return o}var c1=l1;function f1(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var eu=f1,p1=Math.max;function d1(e,t,r,n){for(var i=-1,o=e.length,a=r.length,s=-1,u=t.length,l=p1(o-a,0),f=Array(u+l),d=!n;++s<u;)f[s]=t[s];for(;++i<a;)(d||i<o)&&(f[r[i]]=e[i]);for(;l--;)f[s++]=e[i++];return f}var ip=d1,h1=Math.max;function y1(e,t,r,n){for(var i=-1,o=e.length,a=-1,s=r.length,u=-1,l=t.length,f=h1(o-s,0),d=Array(f+l),S=!n;++i<f;)d[i]=e[i];for(var T=i;++u<l;)d[T+u]=t[u];for(;++a<s;)(S||i<o)&&(d[T+r[a]]=e[i++]);return d}var op=y1;function m1(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var g1=m1;function v1(){}var tu=v1,b1=4294967295;function Io(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=b1,this.__views__=[]}Io.prototype=Qs(tu.prototype);Io.prototype.constructor=Io;var ru=Io;function w1(){}var ap=w1,_1=Eo?function(e){return Eo.get(e)}:ap,sp=_1,T1={},yl=T1,O1=Object.prototype,x1=O1.hasOwnProperty;function E1(e){for(var t=e.name+"",r=yl[t],n=x1.call(yl,t)?r.length:0;n--;){var i=r[n],o=i.func;if(o==null||o==e)return i.name}return t}var I1=E1;function So(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}So.prototype=Qs(tu.prototype);So.prototype.constructor=So;var es=So;function S1(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var up=S1;function A1(e){if(e instanceof ru)return e.clone();var t=new es(e.__wrapped__,e.__chain__);return t.__actions__=up(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var $1=A1,j1=Object.prototype,N1=j1.hasOwnProperty;function Ao(e){if(kr(e)&&!Bt(e)&&!(e instanceof ru)){if(e instanceof es)return e;if(N1.call(e,"__wrapped__"))return $1(e)}return new es(e)}Ao.prototype=tu.prototype;Ao.prototype.constructor=Ao;var P1=Ao;function k1(e){var t=I1(e),r=P1[t];if(typeof r!="function"||!(t in ru.prototype))return!1;if(e===r)return!0;var n=sp(r);return!!n&&e===n[0]}var U1=k1,R1=800,B1=16,D1=Date.now;function C1(e){var t=0,r=0;return function(){var n=D1(),i=B1-(n-r);if(r=n,i>0){if(++t>=R1)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var lp=C1,M1=lp(np),cp=M1,L1=/\{\n\/\* \[wrapped with (.+)\] \*/,V1=/,? & /;function F1(e){var t=e.match(L1);return t?t[1].split(V1):[]}var z1=F1,G1=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function q1(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(G1,`{
|
|
60
|
+
/* [wrapped with `+t+`] */
|
|
61
|
+
`)}var K1=q1;function W1(e){return function(){return e}}var H1=W1,X1=function(){try{var e=Xr(Object,"defineProperty");return e({},"",{}),e}catch{}}(),$o=X1,J1=$o?function(e,t){return $o(e,"toString",{configurable:!0,enumerable:!1,value:H1(t),writable:!0})}:Qo,Y1=J1,Z1=lp(Y1),nu=Z1;function Q1(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var e_=Q1;function t_(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}var r_=t_;function n_(e){return e!==e}var i_=n_;function o_(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}var a_=o_;function s_(e,t,r){return t===t?a_(e,t,r):r_(e,i_,r)}var u_=s_;function l_(e,t){var r=e==null?0:e.length;return!!r&&u_(e,t,0)>-1}var c_=l_,f_=1,p_=2,d_=8,h_=16,y_=32,m_=64,g_=128,v_=256,b_=512,w_=[["ary",g_],["bind",f_],["bindKey",p_],["curry",d_],["curryRight",h_],["flip",b_],["partial",y_],["partialRight",m_],["rearg",v_]];function __(e,t){return e_(w_,function(r){var n="_."+r[0];t&r[1]&&!c_(e,n)&&e.push(n)}),e.sort()}var T_=__;function O_(e,t,r){var n=t+"";return nu(e,K1(n,T_(z1(n),r)))}var fp=O_,x_=1,E_=2,I_=4,S_=8,ml=32,gl=64;function A_(e,t,r,n,i,o,a,s,u,l){var f=t&S_,d=f?a:void 0,S=f?void 0:a,T=f?o:void 0,B=f?void 0:o;t|=f?ml:gl,t&=~(f?gl:ml),t&I_||(t&=~(x_|E_));var K=[e,t,i,T,d,B,S,s,u,l],J=r.apply(void 0,K);return U1(e)&&cp(J,K),J.placeholder=n,fp(J,e,t)}var pp=A_;function $_(e){var t=e;return t.placeholder}var iu=$_,j_=9007199254740991,N_=/^(?:0|[1-9]\d*)$/;function P_(e,t){var r=typeof e;return t=t??j_,!!t&&(r=="number"||r!="symbol"&&N_.test(e))&&e>-1&&e%1==0&&e<t}var ea=P_,k_=Math.min;function U_(e,t){for(var r=e.length,n=k_(t.length,r),i=up(e);n--;){var o=t[n];e[n]=ea(o,r)?i[o]:void 0}return e}var R_=U_,vl="__lodash_placeholder__";function B_(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r];(a===t||a===vl)&&(e[r]=vl,o[i++]=r)}return o}var li=B_,D_=1,C_=2,M_=8,L_=16,V_=128,F_=512;function dp(e,t,r,n,i,o,a,s,u,l){var f=t&V_,d=t&D_,S=t&C_,T=t&(M_|L_),B=t&F_,K=S?void 0:ui(e);function J(){for(var A=arguments.length,M=Array(A),W=A;W--;)M[W]=arguments[W];if(T)var Y=iu(J),F=g1(M,Y);if(n&&(M=ip(M,n,i,T)),o&&(M=op(M,o,a,T)),A-=F,T&&A<l){var ne=li(M,Y);return pp(e,t,dp,J.placeholder,r,M,ne,s,u,l-A)}var V=d?r:this,pe=S?V[e]:e;return A=M.length,s?M=R_(M,s):B&&A>1&&M.reverse(),f&&u<A&&(M.length=u),this&&this!==pt&&this instanceof J&&(pe=K||ui(pe)),pe.apply(V,M)}return J}var hp=dp;function z_(e,t,r){var n=ui(e);function i(){for(var o=arguments.length,a=Array(o),s=o,u=iu(i);s--;)a[s]=arguments[s];var l=o<3&&a[0]!==u&&a[o-1]!==u?[]:li(a,u);if(o-=l.length,o<r)return pp(e,t,hp,i.placeholder,void 0,a,l,void 0,void 0,r-o);var f=this&&this!==pt&&this instanceof i?n:e;return eu(f,this,a)}return i}var G_=z_,q_=1;function K_(e,t,r,n){var i=t&q_,o=ui(e);function a(){for(var s=-1,u=arguments.length,l=-1,f=n.length,d=Array(f+u),S=this&&this!==pt&&this instanceof a?o:e;++l<f;)d[l]=n[l];for(;u--;)d[l++]=arguments[++s];return eu(S,i?r:this,d)}return a}var W_=K_,bl="__lodash_placeholder__",xa=1,H_=2,X_=4,wl=8,Ln=128,_l=256,J_=Math.min;function Y_(e,t){var r=e[1],n=t[1],i=r|n,o=i<(xa|H_|Ln),a=n==Ln&&r==wl||n==Ln&&r==_l&&e[7].length<=t[8]||n==(Ln|_l)&&t[7].length<=t[8]&&r==wl;if(!(o||a))return e;n&xa&&(e[2]=t[2],i|=r&xa?0:X_);var s=t[3];if(s){var u=e[3];e[3]=u?ip(u,s,t[4]):s,e[4]=u?li(e[3],bl):t[4]}return s=t[5],s&&(u=e[5],e[5]=u?op(u,s,t[6]):s,e[6]=u?li(e[5],bl):t[6]),s=t[7],s&&(e[7]=s),n&Ln&&(e[8]=e[8]==null?t[8]:J_(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}var Z_=Y_,Q_="Expected a function",Tl=1,eT=2,Ea=8,Ia=16,Sa=32,Ol=64,xl=Math.max;function tT(e,t,r,n,i,o,a,s){var u=t&eT;if(!u&&typeof e!="function")throw new TypeError(Q_);var l=n?n.length:0;if(l||(t&=~(Sa|Ol),n=i=void 0),a=a===void 0?a:xl(pl(a),0),s=s===void 0?s:pl(s),l-=i?i.length:0,t&Ol){var f=n,d=i;n=i=void 0}var S=u?void 0:sp(e),T=[e,t,r,n,i,f,d,o,a,s];if(S&&Z_(T,S),e=T[0],t=T[1],r=T[2],n=T[3],i=T[4],s=T[9]=T[9]===void 0?u?0:e.length:xl(T[9]-l,0),!s&&t&(Ea|Ia)&&(t&=~(Ea|Ia)),!t||t==Tl)var B=c1(e,t,r);else t==Ea||t==Ia?B=G_(e,t,s):(t==Sa||t==(Tl|Sa))&&!i.length?B=W_(e,t,r,n):B=hp.apply(void 0,T);var K=S?np:cp;return fp(K(B,T),e,t)}var rT=tT;function nT(e,t,r){t=="__proto__"&&$o?$o(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var iT=nT;function oT(e,t){return e===t||e!==e&&t!==t}var ou=oT,aT=Object.prototype,sT=aT.hasOwnProperty;function uT(e,t,r){var n=e[t];(!(sT.call(e,t)&&ou(n,r))||r===void 0&&!(t in e))&&iT(e,t,r)}var lT=uT,El=Math.max;function cT(e,t,r){return t=El(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=El(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),eu(e,this,s)}}var yp=cT;function fT(e,t){return nu(yp(e,t,Qo),e+"")}var pT=fT,dT=9007199254740991;function hT(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=dT}var au=hT;function yT(e){return e!=null&&au(e.length)&&!rp(e)}var mT=yT,gT=Object.prototype;function vT(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||gT;return e===r}var bT=vT;function wT(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var _T=wT,TT="[object Arguments]";function OT(e){return kr(e)&&$n(e)==TT}var Il=OT,mp=Object.prototype,xT=mp.hasOwnProperty,ET=mp.propertyIsEnumerable,IT=Il(function(){return arguments}())?Il:function(e){return kr(e)&&xT.call(e,"callee")&&!ET.call(e,"callee")},su=IT;function ST(){return!1}var AT=ST,gp=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Sl=gp&&typeof module=="object"&&module&&!module.nodeType&&module,$T=Sl&&Sl.exports===gp,Al=$T?pt.Buffer:void 0,jT=Al?Al.isBuffer:void 0,NT=jT||AT,ts=NT,PT="[object Arguments]",kT="[object Array]",UT="[object Boolean]",RT="[object Date]",BT="[object Error]",DT="[object Function]",CT="[object Map]",MT="[object Number]",LT="[object Object]",VT="[object RegExp]",FT="[object Set]",zT="[object String]",GT="[object WeakMap]",qT="[object ArrayBuffer]",KT="[object DataView]",WT="[object Float32Array]",HT="[object Float64Array]",XT="[object Int8Array]",JT="[object Int16Array]",YT="[object Int32Array]",ZT="[object Uint8Array]",QT="[object Uint8ClampedArray]",eO="[object Uint16Array]",tO="[object Uint32Array]",Ue={};Ue[WT]=Ue[HT]=Ue[XT]=Ue[JT]=Ue[YT]=Ue[ZT]=Ue[QT]=Ue[eO]=Ue[tO]=!0;Ue[PT]=Ue[kT]=Ue[qT]=Ue[UT]=Ue[KT]=Ue[RT]=Ue[BT]=Ue[DT]=Ue[CT]=Ue[MT]=Ue[LT]=Ue[VT]=Ue[FT]=Ue[zT]=Ue[GT]=!1;function rO(e){return kr(e)&&au(e.length)&&!!Ue[$n(e)]}var nO=rO;function iO(e){return function(t){return e(t)}}var oO=iO,vp=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Xn=vp&&typeof module=="object"&&module&&!module.nodeType&&module,aO=Xn&&Xn.exports===vp,Aa=aO&&Qf.process,sO=function(){try{var e=Xn&&Xn.require&&Xn.require("util").types;return e||Aa&&Aa.binding&&Aa.binding("util")}catch{}}(),$l=sO,jl=$l&&$l.isTypedArray,uO=jl?oO(jl):nO,bp=uO,lO=Object.prototype,cO=lO.hasOwnProperty;function fO(e,t){var r=Bt(e),n=!r&&su(e),i=!r&&!n&&ts(e),o=!r&&!n&&!i&&bp(e),a=r||n||i||o,s=a?_T(e.length,String):[],u=s.length;for(var l in e)(t||cO.call(e,l))&&!(a&&(l=="length"||i&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||ea(l,u)))&&s.push(l);return s}var pO=fO;function dO(e,t){return function(r){return e(t(r))}}var hO=dO,yO=hO(Object.keys,Object),mO=yO,gO=Object.prototype,vO=gO.hasOwnProperty;function bO(e){if(!bT(e))return mO(e);var t=[];for(var r in Object(e))vO.call(e,r)&&r!="constructor"&&t.push(r);return t}var wO=bO;function _O(e){return mT(e)?pO(e):wO(e)}var wp=_O,TO=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,OO=/^\w*$/;function xO(e,t){if(Bt(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||sn(e)?!0:OO.test(e)||!TO.test(e)||t!=null&&e in Object(t)}var uu=xO,EO=Xr(Object,"create"),ci=EO;function IO(){this.__data__=ci?ci(null):{},this.size=0}var SO=IO;function AO(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var $O=AO,jO="__lodash_hash_undefined__",NO=Object.prototype,PO=NO.hasOwnProperty;function kO(e){var t=this.__data__;if(ci){var r=t[e];return r===jO?void 0:r}return PO.call(t,e)?t[e]:void 0}var UO=kO,RO=Object.prototype,BO=RO.hasOwnProperty;function DO(e){var t=this.__data__;return ci?t[e]!==void 0:BO.call(t,e)}var CO=DO,MO="__lodash_hash_undefined__";function LO(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ci&&t===void 0?MO:t,this}var VO=LO;function jn(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])}}jn.prototype.clear=SO;jn.prototype.delete=$O;jn.prototype.get=UO;jn.prototype.has=CO;jn.prototype.set=VO;var Nl=jn;function FO(){this.__data__=[],this.size=0}var zO=FO;function GO(e,t){for(var r=e.length;r--;)if(ou(e[r][0],t))return r;return-1}var ta=GO,qO=Array.prototype,KO=qO.splice;function WO(e){var t=this.__data__,r=ta(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():KO.call(t,r,1),--this.size,!0}var HO=WO;function XO(e){var t=this.__data__,r=ta(t,e);return r<0?void 0:t[r][1]}var JO=XO;function YO(e){return ta(this.__data__,e)>-1}var ZO=YO;function QO(e,t){var r=this.__data__,n=ta(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var ex=QO;function Nn(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])}}Nn.prototype.clear=zO;Nn.prototype.delete=HO;Nn.prototype.get=JO;Nn.prototype.has=ZO;Nn.prototype.set=ex;var ra=Nn,tx=Xr(pt,"Map"),fi=tx;function rx(){this.size=0,this.__data__={hash:new Nl,map:new(fi||ra),string:new Nl}}var nx=rx;function ix(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var ox=ix;function ax(e,t){var r=e.__data__;return ox(t)?r[typeof t=="string"?"string":"hash"]:r.map}var na=ax;function sx(e){var t=na(this,e).delete(e);return this.size-=t?1:0,t}var ux=sx;function lx(e){return na(this,e).get(e)}var cx=lx;function fx(e){return na(this,e).has(e)}var px=fx;function dx(e,t){var r=na(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var hx=dx;function Pn(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])}}Pn.prototype.clear=nx;Pn.prototype.delete=ux;Pn.prototype.get=cx;Pn.prototype.has=px;Pn.prototype.set=hx;var ia=Pn,yx="Expected a function";function lu(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(yx);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(lu.Cache||ia),r}lu.Cache=ia;var mx=lu,gx=500;function vx(e){var t=mx(e,function(n){return r.size===gx&&r.clear(),n}),r=t.cache;return t}var bx=vx,wx=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,_x=/\\(\\)?/g,Tx=bx(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(wx,function(r,n,i,o){t.push(i?o.replace(_x,"$1"):n||r)}),t}),Ox=Tx;function xx(e){return e==null?"":yw(e)}var Ex=xx;function Ix(e,t){return Bt(e)?e:uu(e,t)?[e]:Ox(Ex(e))}var oa=Ix,Sx=1/0;function Ax(e){if(typeof e=="string"||sn(e))return e;var t=e+"";return t=="0"&&1/e==-Sx?"-0":t}var $i=Ax;function $x(e,t){t=oa(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[$i(t[r++])];return r&&r==n?e:void 0}var cu=$x;function jx(e,t,r){var n=e==null?void 0:cu(e,t);return n===void 0?r:n}var Nx=jx;function Px(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var _p=Px,Pl=Ft?Ft.isConcatSpreadable:void 0;function kx(e){return Bt(e)||su(e)||!!(Pl&&e&&e[Pl])}var Ux=kx;function Tp(e,t,r,n,i){var o=-1,a=e.length;for(r||(r=Ux),i||(i=[]);++o<a;){var s=e[o];t>0&&r(s)?t>1?Tp(s,t-1,r,n,i):_p(i,s):n||(i[i.length]=s)}return i}var Rx=Tp;function Bx(e){var t=e==null?0:e.length;return t?Rx(e,1):[]}var Dx=Bx;function Cx(e){return nu(yp(e,void 0,Dx),e+"")}var Mx=Cx;function Lx(){this.__data__=new ra,this.size=0}var Vx=Lx;function Fx(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var zx=Fx;function Gx(e){return this.__data__.get(e)}var qx=Gx;function Kx(e){return this.__data__.has(e)}var Wx=Kx,Hx=200;function Xx(e,t){var r=this.__data__;if(r instanceof ra){var n=r.__data__;if(!fi||n.length<Hx-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new ia(n)}return r.set(e,t),this.size=r.size,this}var Jx=Xx;function kn(e){var t=this.__data__=new ra(e);this.size=t.size}kn.prototype.clear=Vx;kn.prototype.delete=zx;kn.prototype.get=qx;kn.prototype.has=Wx;kn.prototype.set=Jx;var Wi=kn;function Yx(e,t){for(var r=-1,n=e==null?0:e.length,i=0,o=[];++r<n;){var a=e[r];t(a,r,e)&&(o[i++]=a)}return o}var Zx=Yx;function Qx(){return[]}var eE=Qx,tE=Object.prototype,rE=tE.propertyIsEnumerable,kl=Object.getOwnPropertySymbols,nE=kl?function(e){return e==null?[]:(e=Object(e),Zx(kl(e),function(t){return rE.call(e,t)}))}:eE,iE=nE;function oE(e,t,r){var n=t(e);return Bt(e)?n:_p(n,r(e))}var aE=oE;function sE(e){return aE(e,wp,iE)}var Ul=sE,uE=Xr(pt,"DataView"),rs=uE,lE=Xr(pt,"Promise"),ns=lE,cE=Xr(pt,"Set"),rn=cE,Rl="[object Map]",fE="[object Object]",Bl="[object Promise]",Dl="[object Set]",Cl="[object WeakMap]",Ml="[object DataView]",pE=Hr(rs),dE=Hr(fi),hE=Hr(ns),yE=Hr(rn),mE=Hr(si),Ir=$n;(rs&&Ir(new rs(new ArrayBuffer(1)))!=Ml||fi&&Ir(new fi)!=Rl||ns&&Ir(ns.resolve())!=Bl||rn&&Ir(new rn)!=Dl||si&&Ir(new si)!=Cl)&&(Ir=function(e){var t=$n(e),r=t==fE?e.constructor:void 0,n=r?Hr(r):"";if(n)switch(n){case pE:return Ml;case dE:return Rl;case hE:return Bl;case yE:return Dl;case mE:return Cl}return t});var Ll=Ir,gE=pt.Uint8Array,Vl=gE,vE="__lodash_hash_undefined__";function bE(e){return this.__data__.set(e,vE),this}var wE=bE;function _E(e){return this.__data__.has(e)}var TE=_E;function jo(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new ia;++t<r;)this.add(e[t])}jo.prototype.add=jo.prototype.push=wE;jo.prototype.has=TE;var OE=jo;function xE(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 EE=xE;function IE(e,t){return e.has(t)}var SE=IE,AE=1,$E=2;function jE(e,t,r,n,i,o){var a=r&AE,s=e.length,u=t.length;if(s!=u&&!(a&&u>s))return!1;var l=o.get(e),f=o.get(t);if(l&&f)return l==t&&f==e;var d=-1,S=!0,T=r&$E?new OE:void 0;for(o.set(e,t),o.set(t,e);++d<s;){var B=e[d],K=t[d];if(n)var J=a?n(K,B,d,t,e,o):n(B,K,d,e,t,o);if(J!==void 0){if(J)continue;S=!1;break}if(T){if(!EE(t,function(A,M){if(!SE(T,M)&&(B===A||i(B,A,r,n,o)))return T.push(M)})){S=!1;break}}else if(!(B===K||i(B,K,r,n,o))){S=!1;break}}return o.delete(e),o.delete(t),S}var Op=jE;function NE(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var PE=NE;function kE(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var xp=kE,UE=1,RE=2,BE="[object Boolean]",DE="[object Date]",CE="[object Error]",ME="[object Map]",LE="[object Number]",VE="[object RegExp]",FE="[object Set]",zE="[object String]",GE="[object Symbol]",qE="[object ArrayBuffer]",KE="[object DataView]",Fl=Ft?Ft.prototype:void 0,$a=Fl?Fl.valueOf:void 0;function WE(e,t,r,n,i,o,a){switch(r){case KE:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case qE:return!(e.byteLength!=t.byteLength||!o(new Vl(e),new Vl(t)));case BE:case DE:case LE:return ou(+e,+t);case CE:return e.name==t.name&&e.message==t.message;case VE:case zE:return e==t+"";case ME:var s=PE;case FE:var u=n&UE;if(s||(s=xp),e.size!=t.size&&!u)return!1;var l=a.get(e);if(l)return l==t;n|=RE,a.set(e,t);var f=Op(s(e),s(t),n,i,o,a);return a.delete(e),f;case GE:if($a)return $a.call(e)==$a.call(t)}return!1}var HE=WE,XE=1,JE=Object.prototype,YE=JE.hasOwnProperty;function ZE(e,t,r,n,i,o){var a=r&XE,s=Ul(e),u=s.length,l=Ul(t),f=l.length;if(u!=f&&!a)return!1;for(var d=u;d--;){var S=s[d];if(!(a?S in t:YE.call(t,S)))return!1}var T=o.get(e),B=o.get(t);if(T&&B)return T==t&&B==e;var K=!0;o.set(e,t),o.set(t,e);for(var J=a;++d<u;){S=s[d];var A=e[S],M=t[S];if(n)var W=a?n(M,A,S,t,e,o):n(A,M,S,e,t,o);if(!(W===void 0?A===M||i(A,M,r,n,o):W)){K=!1;break}J||(J=S=="constructor")}if(K&&!J){var Y=e.constructor,F=t.constructor;Y!=F&&"constructor"in e&&"constructor"in t&&!(typeof Y=="function"&&Y instanceof Y&&typeof F=="function"&&F instanceof F)&&(K=!1)}return o.delete(e),o.delete(t),K}var QE=ZE,e2=1,zl="[object Arguments]",Gl="[object Array]",Di="[object Object]",t2=Object.prototype,ql=t2.hasOwnProperty;function r2(e,t,r,n,i,o){var a=Bt(e),s=Bt(t),u=a?Gl:Ll(e),l=s?Gl:Ll(t);u=u==zl?Di:u,l=l==zl?Di:l;var f=u==Di,d=l==Di,S=u==l;if(S&&ts(e)){if(!ts(t))return!1;a=!0,f=!1}if(S&&!f)return o||(o=new Wi),a||bp(e)?Op(e,t,r,n,i,o):HE(e,t,u,r,n,i,o);if(!(r&e2)){var T=f&&ql.call(e,"__wrapped__"),B=d&&ql.call(t,"__wrapped__");if(T||B){var K=T?e.value():e,J=B?t.value():t;return o||(o=new Wi),i(K,J,r,n,o)}}return S?(o||(o=new Wi),QE(e,t,r,n,i,o)):!1}var n2=r2;function Ep(e,t,r,n,i){return e===t?!0:e==null||t==null||!kr(e)&&!kr(t)?e!==e&&t!==t:n2(e,t,r,n,Ep,i)}var Ip=Ep,i2=1,o2=2;function a2(e,t,r,n){var i=r.length,o=i,a=!n;if(e==null)return!o;for(e=Object(e);i--;){var s=r[i];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){s=r[i];var u=s[0],l=e[u],f=s[1];if(a&&s[2]){if(l===void 0&&!(u in e))return!1}else{var d=new Wi;if(n)var S=n(l,f,u,e,t,d);if(!(S===void 0?Ip(f,l,i2|o2,n,d):S))return!1}}return!0}var s2=a2;function u2(e){return e===e&&!Yt(e)}var Sp=u2;function l2(e){for(var t=wp(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Sp(i)]}return t}var c2=l2;function f2(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var Ap=f2;function p2(e){var t=c2(e);return t.length==1&&t[0][2]?Ap(t[0][0],t[0][1]):function(r){return r===e||s2(r,e,t)}}var d2=p2;function h2(e,t){return e!=null&&t in Object(e)}var y2=h2;function m2(e,t,r){t=oa(t,e);for(var n=-1,i=t.length,o=!1;++n<i;){var a=$i(t[n]);if(!(o=e!=null&&r(e,a)))break;e=e[a]}return o||++n!=i?o:(i=e==null?0:e.length,!!i&&au(i)&&ea(a,i)&&(Bt(e)||su(e)))}var g2=m2;function v2(e,t){return e!=null&&g2(e,t,y2)}var $p=v2,b2=1,w2=2;function _2(e,t){return uu(e)&&Sp(t)?Ap($i(e),t):function(r){var n=Nx(r,e);return n===void 0&&n===t?$p(r,e):Ip(t,n,b2|w2)}}var T2=_2;function O2(e){return function(t){return t?.[e]}}var x2=O2;function E2(e){return function(t){return cu(t,e)}}var I2=E2;function S2(e){return uu(e)?x2($i(e)):I2(e)}var A2=S2;function $2(e){return typeof e=="function"?e:e==null?Qo:typeof e=="object"?Bt(e)?T2(e[0],e[1]):d2(e):A2(e)}var j2=$2;function N2(e,t,r,n){if(!Yt(e))return e;t=oa(t,e);for(var i=-1,o=t.length,a=o-1,s=e;s!=null&&++i<o;){var u=$i(t[i]),l=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return e;if(i!=a){var f=s[u];l=n?n(f,u,s):void 0,l===void 0&&(l=Yt(f)?f:ea(t[i+1])?[]:{})}lT(s,u,l),s=s[u]}return e}var P2=N2;function k2(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var a=t[n],s=cu(e,a);r(s,a)&&P2(o,oa(a,e),s)}return o}var U2=k2,R2=32,fu=pT(function(e,t){var r=li(t,iu(fu));return rT(e,R2,void 0,t,r)});fu.placeholder={};var B2=fu;function D2(e,t){return U2(e,t,function(r,n){return $p(e,n)})}var C2=D2,M2=Mx(function(e,t){return e==null?{}:C2(e,t)}),Kl=M2,L2=4294967295,V2=L2-1,F2=Math.floor,z2=Math.min;function G2(e,t,r,n){var i=0,o=e==null?0:e.length;if(o===0)return 0;t=r(t);for(var a=t!==t,s=t===null,u=sn(t),l=t===void 0;i<o;){var f=F2((i+o)/2),d=r(e[f]),S=d!==void 0,T=d===null,B=d===d,K=sn(d);if(a)var J=n||B;else l?J=B&&(n||S):s?J=B&&S&&(n||!T):u?J=B&&S&&!T&&(n||!K):T||K?J=!1:J=n?d<=t:d<t;J?i=f+1:o=f}return z2(o,V2)}var q2=G2;function K2(e,t,r){return q2(e,t,j2(r,2))}var W2=K2,H2=1/0,FS=rn&&1/xp(new rn([,-0]))[1]==H2?function(e){return new rn(e)}:ap,{WARN:zS,LOG:GS,DEBUG:qS,VERBOSE:X2,ERROR:J2}=$e.setup($e.INFO),Y2=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),jp=(e,t,r)=>Je.structural(Kl(t,e),Kl(r,e)),Z2=(e,t,r="asc")=>Y2(e.ts,t.ts,r),KS=B2(jp,["en","at"]);function pi(e,t="asc"){return e.sort((r,n)=>Z2(r,n,t))}var Q2=(e,t)=>K0(new Date(e.ts),new Date(t.ts)),Np=e=>{let t=new Map;for(let r of e){if(!r)throw J2("falsy entry in applogs",e),new Error("falsy entry in applogs");let n=r.cid;t.has(n)?X2("Skipping duplicate applog:",[t.get(n),r]):t.set(n,r)}return Array.from(t.values())};function eI(e){return typeof e=="string"&&e.startsWith("?")}function tI(e){return e.slice(1)}function Pp(e,t){let r={},n={};for(let[i,o]of Object.entries(e))if(eI(o)){let a=tI(o),s=t[a];s?n[i]=s:r[i]=a}else n[i]=o;return[n,r]}function rI(e,t,r){let n;if(t){let i=typeof t;i==="string"?n=t===r:i==="function"?n=t(r):typeof t.has=="function"?n=t.has(r):Array.isArray(t)&&!Array.isArray(r)?n=t.includes(r):n=t===r}else n=t===r;return e.charAt(0)==="!"?!n:n}var kp=function(e){for(var t=0,r=0,n=e.length;r<n;r++)t+=e[r];return t},Wl=function(e){return kp(e)/e.length},mt={max:function(e){return Math.max.apply(null,e)},min:function(e){return Math.min.apply(null,e)},range:function(e){return mt.max(e)-mt.min(e)},midrange:function(e){return mt.range(e)/2},sum:kp,mean:Wl,average:Wl,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=mt.mean(e);return mt.mean(e.map(function(r){return Math.pow(r-t,2)}))},standardDeviation:function(e){return Math.sqrt(mt.variance(e))},meanAbsoluteDeviation:function(e){var t=mt.mean(e);return mt.mean(e.map(function(r){return Math.abs(r-t)}))},zScores:function(e){var t=mt.mean(e),r=mt.standardDeviation(e);return e.map(function(n){return(n-t)/r})}};mt.average=mt.mean;function Up(){return new Date().toISOString()}var{WARN:nI,LOG:WS,DEBUG:iI,VERBOSE:HS,ERROR:No}=$e.setup($e.INFO);function oI(e,t){let r=Up(),n=t;return e.map(i=>aI(i,{ts:r,threadForPv:n}))}function aI(e,{ts:t,threadForPv:r}={}){let n=lI(e,t??Up()),i=cI(n,r),o=F0(i).toString();e.cid&&e.cid!==o&&nI("[finalizeApplogForInsert] overwriting wrong CID",{log:e,cid:o,logWithPv:i});let a={...i,cid:o};if(!Jf(a))throw No(`Bogus Applog ${JSON.stringify(a)}`,R0(a));return Object.freeze(a)}function sI(e){return!!e.ts}function uI(e){return!!e.pv}function lI(e,t){return sI(e)?e:{...e,ts:t}}function cI(e,t){if(e.pv!==void 0)return e;if(t){let{en:r,at:n}=e,i=t.findLast(a=>a.en==r&&a.at==n);if(jp(["en","at","vl","ts","ag"],e,i))throw No("[withPvFrom] Same as previous:",{log:e,pv:i,thread:t});let o=(e.pv!==void 0?e.pv:i?.cid)??null;return{...e,pv:o}}else{if(!uI(e))throw No("[withPvFrom] no thread and no pv:",e);return e}}function is(e){let t=()=>(Re(()=>e.length<2&&iI(`joinThreads with count=${e.length}`)),pi(Np(e.flatMap(i=>{let o=i.applogs;if(!o)throw No("falsy applogs of thread",i),new Error("falsy applogs of thread");return o})))),r=Re(()=>t()),n=_t(function(i,o){return yr(i)?{init:Re(()=>t())}:{added:i.added.filter(a=>!this.hasApplog(a,!0)),removed:i.removed?.filter(a=>!!this.parents.some(s=>s===o?!1:s.hasApplog(a,!0)))}});return new pu(Re(()=>`join(~ ${e.map(i=>i.name).join(", ")})`),e,["?"],r,n)}var{WARN:Hl,LOG:XS,DEBUG:Xl,VERBOSE:Er,ERROR:Jl}=$e.setup($e.INFO),pu=class Rp extends Rs{constructor(t,r,n,i,o,a=null){super(t,r,n,o?Be.array([...i],{deep:!1,name:`${t}.array`}):i),this.name=t,this._initialLogs=i,this._eventMapper=o,this._writeMapper=a,wn(this,{onParentUpdate:_t}),o&&this.subscribeToParents()}static mapWrites(t,r,n){return new Rp(`${r}<${t.nameAndSizeUntracked}>`,t,t.filters,t._applogs,null,n)}_parentSubscriptions=null;insert(t){let r=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!r))return this.parents.forEach(n=>n.insert(r))}insertRaw(t){let r=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!r))return this.parents.forEach(n=>n.insertRaw(r))}subscribeToParents(){this._parentSubscriptions=new Map;let t=Ut(()=>{this.parents.length||Hl("MappedThread has no parents",this),Er(`[MappedThread: ${this.name}] subscribing to parents:`,this.parents.map(n=>n.name));let r=new Set([...this._parentSubscriptions.keys()]);for(let n of this.parents){r.delete(n)&&Er(`[MappedThread: ${this.name}] Skipping re-sub to parent`,n.nameAndSizeUntracked),Er(`[MappedThread: ${this.name}] sub to new parent`,n.nameAndSizeUntracked);let i=this.onParentUpdate.bind(this,n),o=n.subscribe(i);this._parentSubscriptions.set(n,o)}for(let n of r)Er(`[MappedThread: ${this.name}] un-subscribing from old parent`,n.nameAndSizeUntracked),this._parentSubscriptions.get(n)(),this._parentSubscriptions.delete(n)})}subscribe(t){return this._parentSubscriptions||this.subscribeToParents(),super.subscribe(t)}triggerRemap(){if(!this._eventMapper)throw Jl("triggerRemap on a thread that is not actually mapping?!",this.nameAndSizeUntracked);Xl(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.length!==1&&Hl(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap with parentCount=${this.parents.length} - not meant for this`),this.parents.forEach(t=>{this.onParentUpdate(t,{init:Re(()=>dr(t.applogs))})})}onParentUpdate(t,r){Er(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate`,r);let n=this._eventMapper?this._eventMapper(r,t):r;if(this._eventMapper)if(Er(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => mapped`,n),yr(n))this._applogs.replace([...n.init]);else{for(let i of n.added)this._applogs.splice(W2(this._applogs,i,"ts"),0,i);if(n.removed){for(let i of n.removed)if(!this._applogs.remove(i))if(!yr(r)&&r.removed?.includes(i))Xl("Ignoring remove event for non-existent because it was part of parent event's removed",i,r);else throw Jl(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,i,{thread:this,event:r,mapResult:n})}}Er(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,qo(this._applogs)),this.notifySubscribers(n)}get readOnly(){return!1}},{WARN:JS,LOG:YS,DEBUG:ZS,VERBOSE:ja,ERROR:fI}=$e.setup($e.INFO),un=Ye("rollingFilter",function(e,t,r={}){let n=dI(t),i=Yl(n),o=Be.array(Re(function(){return i(e.applogs)}),{deep:!1,name:`${e.name} | ${r.name||`rollingFilter.array{${ii(n)}}`}`}),a=f=>{let d;return yr(f)?d={init:i(f.init)}:d={added:i(f.added),removed:f.removed},ja(`rollingFilter{${e.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,n,f,"=>",d),d},s=new pu(`${e.name} | ${r.name||`rollingFilter{${ii(n)}}`}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],o,a),u=Qm(()=>dr(t),f=>{ja(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,n,"=>",f),n=f,i=Yl(n),s.triggerRemap()}),l=bn(o,()=>{ja(`rollingFilter<${Re(()=>e.name)}>${r.name?` '${r.name}'`:""} unobserve`,n),u(),l()});return s},{equals:Ei,argsDebugName:(e,t,r)=>Ge({caller:"rollingFilter",thread:e,pattern:t,args:r})}),pI=Ye("rollingMapper",function(e,t,r={}){let n=Re(()=>t.call(null,{init:e.applogs},e));if(!yr(n))throw fI("Initial run must return init event");let i=n.init;return new pu(`${e.name} | ${r.name||"rollingMapper"}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],i,t)},{equals:Ei,argsDebugName:(e,t,r)=>Ge({caller:"rollingMapper",thread:e,args:r})}),QS=Ye("rollingAcc",function(e,t,r,n={}){let i=_t(r);return i({init:e.applogs},t),e.subscribe(o=>{i(o,t)}),t},{argsDebugName:(e,t,r,n)=>`rollingAcc{${e.nameAndSizeUntracked}${n?.name?` | ${n?.name}`:""}}`}),dI=function(e){let t=Re(function(){return Object.fromEntries(Object.entries(dr(e)).map(([r,n])=>[dr(r),dr(n)]))});if(!Object.entries(t).length)throw new Error("Pattern is empty");return t};function Yl(e){return function(t){return t.filter(function(r){for(let n of Object.keys(e)){let i=e[n];if(i===void 0)continue;let o=r[n.startsWith("!")?n.slice(1):n];if(!rI(n,i,o))return!1}return!0})}}var{WARN:hI,LOG:yI,DEBUG:mI,VERBOSE:gI,ERROR:Hi}=$e.setup($e.INFO),vI=class extends Rs{constructor(e,t=[],r){super(e,null,r,t),wn(this,{})}purge(e){let t=this.applogs.length;return this._applogs=this.applogs.filter(r=>!e.includes(r.cid)),t-this.applogs.length}insert(e){let t=oI(e,this);return this.insertRaw(t)}insertRaw(e){let t=Np(e);if(t.length!==e.length)throw Hi(`[insertRaw] duplicate applogs passed: ${e.length-t.length}`,{appLogsToInsert:e,deduplicated:t});let r=e.filter(o=>!Jf(o));if(r.length)throw Hi(`[insertRaw] bogus applogs passed: ${r.length}`,{bogus:r});let n=e.filter(o=>this.hasApplog(o,!1));if(n.length)throw Hi(`[insertRaw] already existing applogs passed: ${n.length}`,{existing:n});if(!e.length){hI("[insertRaw] skipping empty insert empty logs array");return}(!this.hasParents&&!(this instanceof aa)?yI:mI)("Inserting:",e.length===1?e[0]:e,{ds:this}),pi(e);let i=this._applogs.length&&Q2(e[0],this._applogs[this._applogs.length-1]);return this._applogs.push(...e),i&&pi(this._applogs),this.notifySubscribers({added:e,removed:null}),this.persist(e),e}get readOnly(){return!1}},aa=class os extends vI{constructor(t,r,n,i){super(t,r,n),this._readOnly=i,wn(this,{_applogs:Be.shallow})}static empty(t){return os.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new os(r??"in-memory",t,[],n)}get readOnly(){return this._readOnly}async persist(t){if(gI("[InMem.persist] no persist for",t),this.readOnly)throw Hi("[persist] called for readOnly thread")}},{WARN:eA,LOG:tA,DEBUG:rA,VERBOSE:nA,ERROR:iA}=$e.setup($e.DEBUG),bI=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=r,wn(this,{threadOfTrail:Le})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?is([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},Bp=class{constructor(e){this.nodes=e,wn(this,{threadOfAllTrails:Le,size:Le,isEmpty:Le})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return Re(()=>this.records.length)}get records(){return Ht(()=>this.nodes.map(({variables:e})=>e),{name:"QueryResult.records"})}get leafNodeThread(){return is(Ht(()=>this.nodes.map(({logsOfThisNode:e})=>e),{name:"QueryResult.leafNodeThread"}))}get leafNodeLogs(){return Ht(()=>this.nodes.map(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogs"})}get threadOfAllTrails(){return is(Ht(()=>this.nodes.map(e=>e.threadOfTrail),{name:"QueryResult.threadOfAllTrails"}))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},{WARN:oA,LOG:sa,DEBUG:Zt,VERBOSE:Oe,ERROR:Ur}=$e.setup($e.INFO,{prefix:"[q]"}),aA=Ye("lastWriteWins",function(e,{inverseToOnlyReturnFirstLogs:t,tolerateAlreadyFiltered:r}={}){if(Oe(`lastWriteWins${t?".inversed":""} < ${e.nameAndSizeUntracked} > initializing`),e.filters.includes("lastWriteWins")){if(r)return Zt("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),e;throw Ur("thread already filtered lastWriteWins:",e.filters,{name:e.name})}let n,i=pI(e,function(o,a){let s=yr(o),u,l=[],f=s?null:[];s?(n=new Map,u=o.init):u=o.added;let d;for(let S=t?0:u.length-1;t?S<u.length:S>=0;t?S++:S--){let T=u[S],B=T.en+"|"+T.at;if(d&&(t?d>T.ts:d<T.ts))throw Ur("lastWriteWins.mapper logs not sorted:",d,t?">":"<",T.ts,{log:T,i:S,newLogs:u,inverseToOnlyReturnFirstLogs:t});d=T.ts;let K=n.get(B);(!K||(t?K.ts>T.ts:K.ts<T.ts))&&(K&&!s&&f.push(K),l.push(T),n.set(B,T))}return pi(l),Oe.isDisabled||Oe(`lastWriteWins${t?".inversed":""}<${e.nameAndSizeUntracked}> mapped event`,s?{...Object.fromEntries(Object.entries(o).map(([S,T])=>[S,T?.length])),toAdd:l.length,toRemove:f}:{...o,toAdd:l,toRemove:f}),s?{init:l}:{added:l,removed:f}},{name:`lastWriteWins${t?".inversed":""}`,extraFilterName:"lastWriteWins"});return Oe.isDisabled||Ut(()=>{Oe(`lastWriteWins<${e.nameAndSizeUntracked}> filtered down to`,i.applogs.length)}),i},{equals:Ei,argsDebugName:e=>Ge({caller:"lastWriteWins",thread:e})}),sA=Ye("withoutDeleted",function(e){if(Oe.isEnabled&&Oe(`withoutDeleted<${e.nameAndSizeUntracked}>`),e.filters.includes("withoutDeleted"))throw Ur("thread already filtered withoutDeleted:",e.filters,{name:e.name});let t=un(e,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});Oe.isEnabled&&Oe(`withoutDeleted<${e.nameAndSizeUntracked}> deletionLogs:`,Re(function(){return[...t.applogs]}));let r=Ge({caller:"allDeletedEntities",thread:e}),n=rv(function(){return t.map(i=>i.en)},{name:r});return Oe.isEnabled&&Ut(()=>{Oe(`withoutDeleted<${e.nameAndSizeUntracked}> deleted:`,[...n])}),un(e,{"!en":n},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:Ei}),Dp=Ye("query",function e(t,r,n={},i={}){let o=Cp(t);Zt(`query<${o.nameAndSizeUntracked}>:`,r);let a=Array.isArray(r)?r:[r],s;if(a.length===1)s=null;else{let f=a.slice(0,-1);s=e(o,f,n,i)}let u=a[a.length-1],l=wI(o,s,u,i);return Oe.isDisabled||Ut(()=>Oe("query result:",dr(l))),l},{equals:Us,argsDebugName:(e,t,r)=>Ge({caller:"query",thread:e,args:r?{pattern:t,startVars:r}:t})}),wI=Ye("queryStep",function(e,t,r,n={}){if(Zt(`queryStep<${e.nameAndSizeUntracked}> with`,t?.untrackedSize??"all","nodes, pattern:",r),!Object.entries(r).length)throw new Error("Pattern is empty");function i(a){let[s,u]=Pp(r,a?.variables??{});Oe("[queryStep.doQuery] patternWithoutVars: ",s);let l=un(e,s),f=ua(u),d=Ht(function(){let S=l.map(T=>({log:T,vars:f(T)}));return Oe.isEnabled&&Oe("[queryStep.doQuery] step node:",a?.variables," =>",S,"from:",Re(()=>l.applogs)),S.map(({log:T,vars:B})=>{let K=Object.assign({},a?.variables,B);return new bI(ov.fromArray([T],Ge({caller:"QueryNode",thread:l,pattern:`${ii(K)}@${ii(s)}`})),K,a)})},{name:Ge({caller:"doQuery.mapNodes",thread:l,pattern:r})});return Oe.isEnabled&&Ut(()=>Oe("[queryStep.doQuery] resultNodes:",[...d])),n.debug&&sa("[queryStep] step result:",Re(()=>d.map(({variables:S,logsOfThisNode:T})=>({variables:S,thread:T})))),d}let o=Ht(function(){return Zt(`[queryStep] Running with ${t?.nodes?.length} input nodes:`),t?[...t.nodes.flatMap(i)]:[...i(null)]},{name:Ge({caller:"queryStep",thread:e,pattern:r})});return Oe.isEnabled&&Ut(()=>Oe("[queryStep] observableResultNodes:",[...o])),new Bp(o)},{equals:Us,argsDebugName:(e,t,r)=>Ge({caller:"queryStep",thread:e,pattern:r})}),uA=Ye("queryNot",function(e,t,r,n={}){let i=t.nodes;Zt.force(`queryNot<${e.nameAndSizeUntracked}> from: ${i.length} nodes`);let o=Array.isArray(r)?r:[r];for(let a of o){if(!Object.entries(r).length)throw new Error("Pattern is empty");i=i.filter(function({variables:s}){let[u,l]=Pp(a,s??{});Oe("[queryNot] patternWithoutVars: ",u);let f=un(e,u);return Oe("[queryNot] step node:",s," =>",f.size,"applogs"),Oe.isDisabled||Oe("[queryNot] step node:",s," => empty?",Re(()=>f.applogs)),n.debug&&sa("[queryNot] node result:",s,"=>",f.applogs),f.isEmpty})}return new Bp(i)},{equals:Us,argsDebugName:(e,t,r)=>Ge({caller:"queryNot",thread:e,pattern:r})}),lA=Ye("filterAndMap",function(e,t,r){Zt(`filterAndMap<${e.nameAndSizeUntracked}>`,t);let n=un(e,t);Oe("[filterAndMap] filtered:",n.untrackedSize),Oe.isDisabled||Ut(()=>Oe("[filterAndMap] filtered:",n.applogs));let i=Ge({thread:e,pattern:t,caller:"filterAndMap"}),o=Ht(()=>OI(n,r),{name:i});return Oe.isDisabled||Ut(()=>Oe("[filterAndMap] mapped:",o)),o},{equals:Je.structural,argsDebugName:(e,t)=>Ge({caller:"filterAndMap",thread:e,pattern:t})}),cA=Ye("queryAndMap",function(e,t,r,n={}){let i=Cp(e);Zt(`queryAndMap<${i.nameAndSizeUntracked}>`,{patternOrPatterns:t,variables:n,map:r});let o=Ge({thread:i,caller:"queryAndMap"}),a=Dp(i,t);Oe("[queryAndMap] filtered count:",a.untrackedSize);let s=Ht(()=>xI(a,r),{name:o});return Oe.isDisabled||Ut(()=>Oe("[queryAndMap] result:",dr(s))),s},{equals:Je.structural,argsDebugName:(e,t)=>Ge({caller:"queryAndMap",thread:e,pattern:t})}),fA=Ye("queryEntity",function(e,t,r,n){Zt(`queryEntity<${e.nameAndSizeUntracked}>`,r,t);let i=un(e,{en:r,at:EI(t,n)});return Oe("queryEntity applogs:",i.applogs),Le(()=>i.isEmpty?null:Object.fromEntries(i.map(({at:o,vl:a})=>[o.slice(t.length+1),a])))},{equals:Qg,argsDebugName:(e,t,r)=>Ge({caller:"queryEntity",thread:e,args:{name:t,entityID:r}})}),pA=Ye("agentsOfThread",function(e){Zt(`agentsOfThread<${e.nameAndSizeUntracked}>`);let t=Be.map(),r=_t(i=>{for(let o of yr(i)?i.init:i.added){let a=t.get(o.ag)??0;t.set(o.ag,a+1)}for(let o of!yr(i)&&i.removed||[]){let a=t.get(o.ag);if(!a||a<1)throw Ur("[agentsOfThread] number is now negative",{log:o,event:i,mapped:t,prev:a});t.set(o.ag,a-1)}sa(`agentsOfThread<${e.nameAndSizeUntracked}> processed event`,{event:i,mapped:t})});r({init:e.applogs});let n=e.subscribe(r);return Go(t,n),t}),_I=Ye("entityOverlap",function(e,t){return sa(`entityOverlap<${e.nameAndSizeUntracked}, ${t.nameAndSizeUntracked}>`),Le(()=>{let r=new Set(e.map(i=>i.en)),n=new Set(t.map(i=>i.en));return[...r].filter(i=>n.has(i))})}),dA=Ye("entityOverlapCount",function(e,t){return Le(()=>_I(e,t).get().length)}),TI=Ye("querySingle",function(e,t,r={}){let n=Dp(e,t,r);return Le(()=>{if(n.isEmpty)return null;if(n.size>1)throw Ur("[querySingle] got",n.size,"results:",n);let i=n.nodes[0].logsOfThisNode;if(i.size!=1)throw Ur("[querySingle] single result, but got",i.size,"logs:",i.applogs);return i.applogs[0]})},{equals:Je.structural,argsDebugName:(e,t)=>Ge({caller:"querySingle",thread:e,pattern:t})}),hA=Ye("querySingleAndMap",function(e,t,r,n={}){let i=TI(e,t,n);return Le(()=>{let o=i.get();if(o)return typeof r=="string"?o[r]:ua(r)(o)})},{equals:Je.structural,argsDebugName:(e,t)=>Ge({caller:"querySingleAndMap",thread:e,pattern:t})}),OI=function(e,t){return typeof t=="function"?e.map(t):typeof t=="string"?e.map(r=>r[t]):e.map(ua(t))},xI=function(e,t){return typeof t=="function"?e.records.map(t):typeof t=="string"?e.nodes.map(r=>{if(!Object.hasOwn(r.record,t)){if(r.logsOfThisNode.size!==1)throw Ur(`not sure what to map (it's not a var and a result node log count of ${r.logsOfThisNode.size})`);return r.logsOfThisNode.firstLog[t]}return r.record[t]}):e.nodes.map(r=>ua(t)(e))};function ua(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function EI(e,t){return t.map(r=>II(e,r))}function II(e,t){return`${e}/${t}`}function Cp(e){return Array.isArray(e)?aa.fromArray(e,`threadFromArray[${e.length}]`,!0):e}var{WARN:SI,LOG:yA,DEBUG:AI,VERBOSE:Ci,ERROR:mA}=$e.setup($e.INFO),gA=Ye("queryDivergencesByPrev",function(e){AI(`queryDivergencesByPrev<${e.nameAndSizeUntracked}>`),e.filters.includes("lastWriteWins")&&SI("queryDivergencesByPrev on thread lastWriteWins",e);let t=Ht(()=>{let r=new Map,n=new Set;Ci("all applogs:",e.applogs);for(let i of e.applogs){let o;i.pv&&(o=i.pv&&r.get(i.pv.toString()),n.delete(i.pv.toString())),Ci("traversing log",{log:i,prevLogs:o,leafs:Array.from(n)}),r.set(i.cid,o?[...o,i]:[i]),n.add(i.cid)}return Array.from(n).map(i=>{let o=new aa(Ge({caller:"DivergenceLeaf",thread:e,pattern:`leaf: ${i}`}),r.get(i),e.filters,!0);return{log:o.latestLog,thread:o}})},{name:Ge({caller:"queryDivergencesByPrev",thread:e})});return Ci.isDisabled||Ut(()=>Ci("[queryDivergencesByPrev] result:",dr(t))),t},{equals:Je.structural}),$I=qe({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js"(e,t){"use strict";t.exports=a;var r=128,n=127,i=~n,o=Math.pow(2,31);function a(s,u,l){if(Number.MAX_SAFE_INTEGER&&s>Number.MAX_SAFE_INTEGER)throw a.bytes=0,new RangeError("Could not encode varint");u=u||[],l=l||0;for(var f=l;s>=o;)u[l++]=s&255|r,s/=128;for(;s&i;)u[l++]=s&255|r,s>>>=7;return u[l]=s|0,a.bytes=l-f+1,u}}}),jI=qe({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/decode.js"(e,t){"use strict";t.exports=i;var r=128,n=127;function i(o,u){var s=0,u=u||0,l=0,f=u,d,S=o.length;do{if(f>=S||l>49)throw i.bytes=0,new RangeError("Could not decode varint");d=o[f++],s+=l<28?(d&n)<<l:(d&n)*Math.pow(2,l),l+=7}while(d>=r);return i.bytes=f-u,s}}}),NI=qe({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js"(e,t){"use strict";var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),a=Math.pow(2,35),s=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),f=Math.pow(2,63);t.exports=function(d){return d<r?1:d<n?2:d<i?3:d<o?4:d<a?5:d<s?6:d<u?7:d<l?8:d<f?9:10}}}),du=qe({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js"(e,t){"use strict";t.exports={encode:$I(),decode:jI(),encodingLength:NI()}}}),Mp=42;function PI(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=lt.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new ee(R.tag,Mp),new ee(R.bytes,r)]}function kI(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function UI(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var Zl={float64:!0,typeEncoders:{Object:PI,undefined:kI,number:UI}},vA={...Zl,typeEncoders:{...Zl.typeEncoders}};function RI(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return lt.decode(e.subarray(1))}var as={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};as.tags[Mp]=RI;var bA={...as,tags:as.tags.slice()},wA=er(du(),1),fr={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},Gn={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":fr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(fr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Gn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Gn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:fr.Int,CarV1HeaderOrV2Pragma:e=>{if(fr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,a]=t[i];switch(o){case"roots":{let s=Gn["CarV1HeaderOrV2Pragma > roots (anon)"](e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=Gn.Int(e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},qn={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":fr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(fr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=qn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=qn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:fr.Int,CarV1HeaderOrV2Pragma:e=>{if(fr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,a]=t[i];switch(o){case"roots":{let s=qn["CarV1HeaderOrV2Pragma > roots (anon)"](a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=qn.Int(a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},_A={toTyped:Gn.CarV1HeaderOrV2Pragma,toRepresentation:qn.CarV1HeaderOrV2Pragma},TA=Pf(),OA=er(du(),1),xA=[new ee(R.map,2),new ee(R.string,"version"),new ee(R.uint,1),new ee(R.string,"roots")],EA=new ee(R.tag,42),IA=er(du(),1),{WARN:SA,LOG:AA,DEBUG:$A,VERBOSE:jA,ERROR:NA}=$e.setup($e.DEBUG),{WARN:PA,LOG:kA,DEBUG:UA,VERBOSE:RA,ERROR:BI}=$e.setup($e.DEBUG);async function DI(e,t){return CI(e)?(await Promise.all(e.chunks.map(async r=>{let n=await Kn(t,r);if(!n.logs)throw BI("Weird chunk",n);return n.logs}))).flat():e.logs}function CI(e){return e.chunks}var{WARN:Lp,LOG:BA,DEBUG:Ql,VERBOSE:hu,ERROR:Mi}=$e.setup($e.DEBUG);async function MI(e){let t=await LI(e);return await Vp(t)}async function Vp({rootCID:e,blockStore:t},r=[]){if(!e||!t)throw Mi("Empty roots/blocks",{rootCID:e,blockStore:t});let n=await Kn(t,e),i,o=null,a=null;if(hu("[decodePubFromBlocks] root:",e.toString(),n,{blockStore:t}),!n)throw Mi("root not found in blockStore",{blockStore:t,rootCID:e});if(n?.info){o=n.applogs;let f=await Kn(t,o);i=await DI(f,t),a=await Kn(t,n.info),Ql("new format - infoLogs",a.logs.map(d=>({[d.toString()]:d})))}else i=n.applogs;let s=async f=>{let d=f,S=await Kn(t,d);if(!S)throw Mi("Could not find applog CID in pub blocks:",d.toString(),{cid:d,root:n,blockStore:t}),new Error(`Could not find applog CID in pub blocks: ${d.toString()}`);return S.pv instanceof lt&&(S.pv=S.pv.toV1().toString()),{...S,cid:d.toV1().toString()}},u;if(u=await Promise.all(i.map(s)),n.prev){if(Zs(n.prev,e)||q0(r,n.prev))throw Mi("[pubFromBlocks] pub chain has a loop",{rootCID:e,prev:n.prev,recursionTrace:r});u.push(...(await Vp({rootCID:n.prev,blockStore:t},[...r,e])).applogs)}let l={cid:e,info:{...a,logs:await Promise.all(a.logs.map(s))},applogsCID:o,applogs:u};return Ql("[decodePubFromBlocks] result:",l,{rootCID:e.toString(),root:n,blockStore:t,applogs:u,info:a}),l}async function LI(e){let t=(await e.getRoots()).map(n=>(typeof n.toV1=="function"?n:lt.decode(n.bytes)).toV1().toString()),r=new Map;for await(let{cid:n,bytes:i}of e.blocks()){let o=typeof n.toV1=="function"?n:lt.decode(n.bytes);hu({cidFromCarblocks:n,cid:o}),r.set(o.toV1().toString(),i)}return t.length!==1&&Lp("Unexpected roots count:",t),{rootCID:lt.parse(t[0]),blockStore:{get:n=>r.get(n.toV1().toString())}}}async function Kn(e,t){try{var r=await e.get(t);if(!r)return Lp("returning null"),null}catch(n){if(n.message==="Not Found")return null;throw n}return Xs(r)}function VI(e){return async function*(){for(;;){let{done:t,value:r}=await e.read();if(hu("[car] chunk",{done:t,value:r}),t)break;yield r}}()}var Po=di(fd(),1),FI=di(pd(),1),Fp=!1,zp=!1;Po.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(Fp=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(zp=process?.env?.LOGGER_PERF_PREFIX==="true"));var zI={prefix:void 0,time:Fp,delta:zp,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},Na=[],Gp=class{sinceFirst=0;sinceLast=0;time=!1;delta=!1;constructor(e,t,r,n){Object.assign(this,{sinceFirst:e,sinceLast:t,time:r,delta:n})}toString(){let e=this.sinceFirst*.001,t=e.toFixed(e<5?2:1),r=this.sinceLast<1e3?`${this.sinceLast.toFixed(0)}`.padStart(5," "):`${`${(this.sinceLast*.001).toFixed(this.sinceLast<1e4?1:0)}`.padStart(4," ")}s`;return`[${[this.time?t:null,this.delta?r:null].filter(n=>n!=null).join(",")}]`}},qp=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Wn=!1,ln=class ot{static ERROR=2;static WARN=4;static INFO=6;static LOG=6;static DEBUG=8;static VERBOSE=10;static firstLog=0;static lastLog=0;static setup(t=ot.INFO,r={}){r=Object.assign({},zI,r),t>10&&console.debug("setup logger",{config:r});let n=this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}),i=(...u)=>{typeof window<"u"&&window?.FORCE_DISABLE_LOGLEVEL&&n(...u)};i.isDisabled=!0,i.isEnabled=!1;let o=this.wrapLog(console.groupCollapsed,r),a=(u,l)=>{function f(...S){let T=S[S.length-1];return T===i?T():(o(...S.slice(0,-1)),(async()=>{try{let B=T();return B instanceof Promise?await B:B}finally{console.groupEnd()}})())}let d=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:l});return u?d:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:d})},s=a(t>=ot.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(s(...u),new Error((0,FI.default)(u))),WARN:a(t>=ot.WARN,this.wrapLog(console.warn,r)),LOG:a(t>=ot.INFO,this.wrapLog(console.log,r)),DEBUG:a(t>=ot.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:a(t>=ot.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(Po.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=Po.isBrowser&&navigator.userAgent.includes("Chrome")?["",ot.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(Wn?n.push(new qp("dim",r.prefix)):n.push(r.prefix)),t.bind(console,...n)}}static timeStr(t,r,n=0){if(!performance.now)return;let i=performance.now();ot.firstLog||(ot.firstLog=i,ot.lastLog=i);let o=new Gp(i-ot.firstLog,i-ot.lastLog,t,r);return ot.lastLog=i,n?o.toString():o}static getOriginFromStack(t){let r=!1;for(let n of t.split(`
|
|
62
|
+
`)){let i=n.match(/^\s+at\s+(.*)/);if(i){if(r)return i[1].trim().replace(__dirname,"");r=!0}}}};Po.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(Na&&Na.length){for(let t of Na)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof Gp))return null;Wn||(Wn=!0);let t=ln.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof qp?(Wn||(Wn=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var{WARN:GI,LOG:DA,DEBUG:Jn,VERBOSE:CA,ERROR:la}=ln.setup(ln.DEBUG),yu=["https://cloudflare-ipfs.com/","https://ipfs.4everland.io/"].map(e=>({url:e}));async function mu(e,{readOnly:t=!0,pinnedCID:r,gateways:n=yu}={}){let{cid:i,errors:o,isIpns:a}=G0(e);if(!i)throw la("Failed to parse pubID",e,o);Jn("[retrieveThread] parsedPubID",{cid:i.toString(),errors:o,isIpns:a});let s=await Kp(i),{applogs:u,info:l}=await MI(s),f=u.filter(Ya);f.length&&GI(`Found ${f.length} encrypted logs - skipping`);let d=u.filter(T=>!Ya(T));pi(d);let S=aa.fromArray(d,`preview${e&&e!==i.toString()?"-"+e:""}@${i.toString()}`,t);return{cid:i,info:l,thread:S,encryptedCount:f.length}}async function Kp(e,t=yu){return e=Qa(e),Jn("Retrieving:",e,e.toString(),"from",t),await gu(t,async(r,n)=>{var i=Wp(r,e);n>1&&(i+=`&cache-bust=${performance.now()}`);let o=await fetch(i),a=await qI(o,i);Jn("[retrieveCar] GW result",{result:a,gateway:r});let s=await mc.fromIterable(a);Jn("[retrieveCar] GW decodeResult",{car:s,gateway:r});let u=(await s.getRoots())[0];if(!Ys(e)&&!Zs(e,u))throw la("Fetched CAR has different CID",u.toString(),"than the one asked for:",e.toString());return s})}function Wp(e,t){let r=new URL(e.url),n=Ys(t),i=`${r}${n?"ipns/":"ipfs/"}${t.toString()}?format=car&dag-scope=all`;return Jn({isIpns:n,url:i}),i}async function qI(e,t){if(!e?.ok||!e?.body)throw la("[retrieveCar] unexpected response",e?.statusText,{url:t});return VI(e.body.getReader())}async function gu(e,t,r=1){try{return await Promise.any(ho(e).map(async n=>{try{return await t(n,r)}catch(i){throw la("still trying",i),i instanceof Error?i:new Error(`[retrieveCar] error: ${i}`)}}))}catch(n){if(r<3)return await gu(e,t,r+1);throw new Error("[Gateway] no valid results after 3 attempts via: "+ho(e).map(({url:i})=>i)+`
|
|
63
|
+
`+n.errors.map(i=>i.message))}}var{WARN:Y$,LOG:Z$,DEBUG:Q$,VERBOSE:ej,ERROR:tj}=ln.setup(ln.DEBUG);var{WARN:oj,LOG:aj,DEBUG:sj,VERBOSE:uj,ERROR:lj}=ha.setup(ha.DEBUG),KI="https://nftstorage.link";async function cj(e,{readOnly:t=!0,pinnedCID:r}={}){return mu(e,{readOnly:t,pinnedCID:r,gateways:[{url:KI}]})}export{KI as a,cj as b};
|
|
64
|
+
/*! Bundled license information:
|
|
65
|
+
|
|
66
|
+
@noble/hashes/esm/utils.js:
|
|
67
|
+
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
68
|
+
|
|
69
|
+
lodash-es/lodash.js:
|
|
70
|
+
(**
|
|
71
|
+
* @license
|
|
72
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
73
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
74
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
75
|
+
* Released under MIT license <https://lodash.com/license>
|
|
76
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
77
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
78
|
+
*)
|
|
79
|
+
*/
|
|
80
|
+
//# sourceMappingURL=chunk-CMDKOQ7H.min.js.map
|