@junobuild/core-standalone 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var zu=Object.create;var Mn=Object.defineProperty;var Ku=Object.getOwnPropertyDescriptor;var Zu=Object.getOwnPropertyNames;var Wu=Object.getPrototypeOf,Xu=Object.prototype.hasOwnProperty;var Qu=(r,e)=>()=>(r&&(e=r(r=0)),e);var ze=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),fs=(r,e)=>{for(var t in e)Mn(r,t,{get:e[t],enumerable:!0})},Lo=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Zu(e))!Xu.call(r,i)&&i!==t&&Mn(r,i,{get:()=>e[i],enumerable:!(n=Ku(e,i))||n.enumerable});return r};var rn=(r,e,t)=>(t=r!=null?zu(Wu(r)):{},Lo(e||!r||!r.__esModule?Mn(t,"default",{value:r,enumerable:!0}):t,r)),Ju=r=>Lo(Mn({},"__esModule",{value:!0}),r);var la={};fs(la,{Buffer:()=>z,INSPECT_MAX_BYTES:()=>Qo,SlowBuffer:()=>xf,isBuffer:()=>ua,kMaxLength:()=>mf});function Zo(){bs=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,t=r.length;e<t;++e)Ft[e]=r[e],mt[r.charCodeAt(e)]=e;mt[45]=62,mt[95]=63}function lf(r){bs||Zo();var e,t,n,i,s,o,c=r.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=r[c-2]==="="?2:r[c-1]==="="?1:0,o=new ff(c*3/4-s),n=s>0?c-4:c;var a=0;for(e=0,t=0;e<n;e+=4,t+=3)i=mt[r.charCodeAt(e)]<<18|mt[r.charCodeAt(e+1)]<<12|mt[r.charCodeAt(e+2)]<<6|mt[r.charCodeAt(e+3)],o[a++]=i>>16&255,o[a++]=i>>8&255,o[a++]=i&255;return s===2?(i=mt[r.charCodeAt(e)]<<2|mt[r.charCodeAt(e+1)]>>4,o[a++]=i&255):s===1&&(i=mt[r.charCodeAt(e)]<<10|mt[r.charCodeAt(e+1)]<<4|mt[r.charCodeAt(e+2)]>>2,o[a++]=i>>8&255,o[a++]=i&255),o}function hf(r){return Ft[r>>18&63]+Ft[r>>12&63]+Ft[r>>6&63]+Ft[r&63]}function df(r,e,t){for(var n,i=[],s=e;s<t;s+=3)n=(r[s]<<16)+(r[s+1]<<8)+r[s+2],i.push(hf(n));return i.join("")}function Yo(r){bs||Zo();for(var e,t=r.length,n=t%3,i="",s=[],o=16383,c=0,a=t-n;c<a;c+=o)s.push(df(r,c,c+o>a?a:c+o));return n===1?(e=r[t-1],i+=Ft[e>>2],i+=Ft[e<<4&63],i+="=="):n===2&&(e=(r[t-2]<<8)+r[t-1],i+=Ft[e>>10],i+=Ft[e>>4&63],i+=Ft[e<<2&63],i+="="),s.push(i),s.join("")}function jn(r,e,t,n,i){var s,o,c=i*8-n-1,a=(1<<c)-1,h=a>>1,p=-7,g=t?i-1:0,w=t?-1:1,x=r[e+g];for(g+=w,s=x&(1<<-p)-1,x>>=-p,p+=c;p>0;s=s*256+r[e+g],g+=w,p-=8);for(o=s&(1<<-p)-1,s>>=-p,p+=n;p>0;o=o*256+r[e+g],g+=w,p-=8);if(s===0)s=1-h;else{if(s===a)return o?NaN:(x?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(x?-1:1)*o*Math.pow(2,s-n)}function Wo(r,e,t,n,i,s){var o,c,a,h=s*8-i-1,p=(1<<h)-1,g=p>>1,w=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=n?0:s-1,f=n?1:-1,N=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=p):(o=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+g>=1?e+=w/a:e+=w*Math.pow(2,1-g),e*a>=2&&(o++,a/=2),o+g>=p?(c=0,o=p):o+g>=1?(c=(e*a-1)*Math.pow(2,i),o=o+g):(c=e*Math.pow(2,g-1)*Math.pow(2,i),o=0));i>=8;r[t+x]=c&255,x+=f,c/=256,i-=8);for(o=o<<i|c,h+=i;h>0;r[t+x]=o&255,x+=f,o/=256,h-=8);r[t+x-f]|=N*128}function Gn(){return z.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Ht(r,e){if(Gn()<e)throw new RangeError("Invalid typed array length");return z.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=z.prototype):(r===null&&(r=new z(e)),r.length=e),r}function z(r,e,t){if(!z.TYPED_ARRAY_SUPPORT&&!(this instanceof z))return new z(r,e,t);if(typeof r=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return xs(this,r)}return Jo(this,r,e,t)}function Jo(r,e,t,n){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?wf(r,e,t,n):typeof e=="string"?yf(r,e,t):bf(r,e)}function ea(r){if(typeof r!="number")throw new TypeError('"size" argument must be a number');if(r<0)throw new RangeError('"size" argument must not be negative')}function gf(r,e,t,n){return ea(e),e<=0?Ht(r,e):t!==void 0?typeof n=="string"?Ht(r,e).fill(t,n):Ht(r,e).fill(t):Ht(r,e)}function xs(r,e){if(ea(e),r=Ht(r,e<0?0:_s(e)|0),!z.TYPED_ARRAY_SUPPORT)for(var t=0;t<e;++t)r[t]=0;return r}function yf(r,e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!z.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var n=ta(e,t)|0;r=Ht(r,n);var i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function ws(r,e){var t=e.length<0?0:_s(e.length)|0;r=Ht(r,t);for(var n=0;n<t;n+=1)r[n]=e[n]&255;return r}function wf(r,e,t,n){if(e.byteLength,t<0||e.byteLength<t)throw new RangeError("'offset' is out of bounds");if(e.byteLength<t+(n||0))throw new RangeError("'length' is out of bounds");return t===void 0&&n===void 0?e=new Uint8Array(e):n===void 0?e=new Uint8Array(e,t):e=new Uint8Array(e,t,n),z.TYPED_ARRAY_SUPPORT?(r=e,r.__proto__=z.prototype):r=ws(r,e),r}function bf(r,e){if(Pt(e)){var t=_s(e.length)|0;return r=Ht(r,t),r.length===0||e.copy(r,0,0,t),r}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||qf(e.length)?Ht(r,0):ws(r,e);if(e.type==="Buffer"&&Xo(e.data))return ws(r,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function _s(r){if(r>=Gn())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Gn().toString(16)+" bytes");return r|0}function xf(r){return+r!=r&&(r=0),z.alloc(+r)}function Pt(r){return!!(r!=null&&r._isBuffer)}function ta(r,e){if(Pt(r))return r.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(r)||r instanceof ArrayBuffer))return r.byteLength;typeof r!="string"&&(r=""+r);var t=r.length;if(t===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":case void 0:return Vn(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return ca(r).length;default:if(n)return Vn(r).length;e=(""+e).toLowerCase(),n=!0}}function _f(r,e,t){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Of(this,e,t);case"utf8":case"utf-8":return ia(this,e,t);case"ascii":return Nf(this,e,t);case"latin1":case"binary":return Rf(this,e,t);case"base64":return Bf(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Uf(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}function xr(r,e,t){var n=r[e];r[e]=r[t],r[t]=n}function ra(r,e,t,n,i){if(r.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,isNaN(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e=="string"&&(e=z.from(e,n)),Pt(e))return e.length===0?-1:zo(r,e,t,n,i);if(typeof e=="number")return e=e&255,z.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):zo(r,[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}function zo(r,e,t,n,i){var s=1,o=r.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,c/=2,t/=2}function a(x,f){return s===1?x[f]:x.readUInt16BE(f*s)}var h;if(i){var p=-1;for(h=t;h<o;h++)if(a(r,h)===a(e,p===-1?0:h-p)){if(p===-1&&(p=h),h-p+1===c)return p*s}else p!==-1&&(h-=h-p),p=-1}else for(t+c>o&&(t=o-c),h=t;h>=0;h--){for(var g=!0,w=0;w<c;w++)if(a(r,h+w)!==a(e,w)){g=!1;break}if(g)return h}return-1}function Ef(r,e,t,n){t=Number(t)||0;var i=r.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;var s=e.length;if(s%2!==0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var o=0;o<n;++o){var c=parseInt(e.substr(o*2,2),16);if(isNaN(c))return o;r[t+o]=c}return o}function vf(r,e,t,n){return Kn(Vn(e,r.length-t),r,t,n)}function na(r,e,t,n){return Kn(Df(e),r,t,n)}function If(r,e,t,n){return na(r,e,t,n)}function Af(r,e,t,n){return Kn(ca(e),r,t,n)}function Sf(r,e,t,n){return Kn(kf(e,r.length-t),r,t,n)}function Bf(r,e,t){return e===0&&t===r.length?Yo(r):Yo(r.slice(e,t))}function ia(r,e,t){t=Math.min(r.length,t);for(var n=[],i=e;i<t;){var s=r[i],o=null,c=s>239?4:s>223?3:s>191?2:1;if(i+c<=t){var a,h,p,g;switch(c){case 1:s<128&&(o=s);break;case 2:a=r[i+1],(a&192)===128&&(g=(s&31)<<6|a&63,g>127&&(o=g));break;case 3:a=r[i+1],h=r[i+2],(a&192)===128&&(h&192)===128&&(g=(s&15)<<12|(a&63)<<6|h&63,g>2047&&(g<55296||g>57343)&&(o=g));break;case 4:a=r[i+1],h=r[i+2],p=r[i+3],(a&192)===128&&(h&192)===128&&(p&192)===128&&(g=(s&15)<<18|(a&63)<<12|(h&63)<<6|p&63,g>65535&&g<1114112&&(o=g))}}o===null?(o=65533,c=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=c}return Tf(n)}function Tf(r){var e=r.length;if(e<=Ko)return String.fromCharCode.apply(String,r);for(var t="",n=0;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=Ko));return t}function Nf(r,e,t){var n="";t=Math.min(r.length,t);for(var i=e;i<t;++i)n+=String.fromCharCode(r[i]&127);return n}function Rf(r,e,t){var n="";t=Math.min(r.length,t);for(var i=e;i<t;++i)n+=String.fromCharCode(r[i]);return n}function Of(r,e,t){var n=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>n)&&(t=n);for(var i="",s=e;s<t;++s)i+=Mf(r[s]);return i}function Uf(r,e,t){for(var n=r.slice(e,t),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}function Ke(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}function at(r,e,t,n,i,s){if(!Pt(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError("Index out of range")}function Yn(r,e,t,n){e<0&&(e=65535+e+1);for(var i=0,s=Math.min(r.length-t,2);i<s;++i)r[t+i]=(e&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}function zn(r,e,t,n){e<0&&(e=4294967295+e+1);for(var i=0,s=Math.min(r.length-t,4);i<s;++i)r[t+i]=e>>>(n?i:3-i)*8&255}function sa(r,e,t,n,i,s){if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function oa(r,e,t,n,i){return i||sa(r,e,t,4),Wo(r,e,t,n,23,4),t+4}function aa(r,e,t,n,i){return i||sa(r,e,t,8),Wo(r,e,t,n,52,8),t+8}function Pf(r){if(r=Lf(r).replace(Ff,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Lf(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function Mf(r){return r<16?"0"+r.toString(16):r.toString(16)}function Vn(r,e){e=e||1/0;for(var t,n=r.length,i=null,s=[],o=0;o<n;++o){if(t=r.charCodeAt(o),t>55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function Df(r){for(var e=[],t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function kf(r,e){for(var t,n,i,s=[],o=0;o<r.length&&!((e-=2)<0);++o)t=r.charCodeAt(o),n=t>>8,i=t%256,s.push(i),s.push(n);return s}function ca(r){return lf(Pf(r))}function Kn(r,e,t,n){for(var i=0;i<n&&!(i+t>=e.length||i>=r.length);++i)e[i+t]=r[i];return i}function qf(r){return r!==r}function ua(r){return r!=null&&(!!r._isBuffer||fa(r)||Cf(r))}function fa(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Cf(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&fa(r.slice(0,0))}var Ft,mt,ff,bs,pf,Xo,Qo,mf,Ko,Ff,ha=Qu(()=>{Ft=[],mt=[],ff=typeof Uint8Array<"u"?Uint8Array:Array,bs=!1;pf={}.toString,Xo=Array.isArray||function(r){return pf.call(r)=="[object Array]"};Qo=50;z.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;mf=Gn();z.poolSize=8192;z._augment=function(r){return r.__proto__=z.prototype,r};z.from=function(r,e,t){return Jo(null,r,e,t)};z.TYPED_ARRAY_SUPPORT&&(z.prototype.__proto__=Uint8Array.prototype,z.__proto__=Uint8Array);z.alloc=function(r,e,t){return gf(null,r,e,t)};z.allocUnsafe=function(r){return xs(null,r)};z.allocUnsafeSlow=function(r){return xs(null,r)};z.isBuffer=ua;z.compare=function(e,t){if(!Pt(e)||!Pt(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,i=t.length,s=0,o=Math.min(n,i);s<o;++s)if(e[s]!==t[s]){n=e[s],i=t[s];break}return n<i?-1:i<n?1:0};z.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};z.concat=function(e,t){if(!Xo(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return z.alloc(0);var n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var i=z.allocUnsafe(t),s=0;for(n=0;n<e.length;++n){var o=e[n];if(!Pt(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,s),s+=o.length}return i};z.byteLength=ta;z.prototype._isBuffer=!0;z.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)xr(this,t,t+1);return this};z.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)xr(this,t,t+3),xr(this,t+1,t+2);return this};z.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)xr(this,t,t+7),xr(this,t+1,t+6),xr(this,t+2,t+5),xr(this,t+3,t+4);return this};z.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?ia(this,0,e):_f.apply(this,arguments)};z.prototype.equals=function(e){if(!Pt(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:z.compare(this,e)===0};z.prototype.inspect=function(){var e="",t=Qo;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"};z.prototype.compare=function(e,t,n,i,s){if(!Pt(e))throw new TypeError("Argument must be a Buffer");if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),t<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&t>=n)return 0;if(i>=s)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;for(var o=s-i,c=n-t,a=Math.min(o,c),h=this.slice(i,s),p=e.slice(t,n),g=0;g<a;++g)if(h[g]!==p[g]){o=h[g],c=p[g];break}return o<c?-1:c<o?1:0};z.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1};z.prototype.indexOf=function(e,t,n){return ra(this,e,t,n,!0)};z.prototype.lastIndexOf=function(e,t,n){return ra(this,e,t,n,!1)};z.prototype.write=function(e,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-t;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return Ef(this,e,t,n);case"utf8":case"utf-8":return vf(this,e,t,n);case"ascii":return na(this,e,t,n);case"latin1":case"binary":return If(this,e,t,n);case"base64":return Af(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Sf(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Ko=4096;z.prototype.slice=function(e,t){var n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);var i;if(z.TYPED_ARRAY_SUPPORT)i=this.subarray(e,t),i.__proto__=z.prototype;else{var s=t-e;i=new z(s,void 0);for(var o=0;o<s;++o)i[o]=this[o+e]}return i};z.prototype.readUIntLE=function(e,t,n){e=e|0,t=t|0,n||Ke(e,t,this.length);for(var i=this[e],s=1,o=0;++o<t&&(s*=256);)i+=this[e+o]*s;return i};z.prototype.readUIntBE=function(e,t,n){e=e|0,t=t|0,n||Ke(e,t,this.length);for(var i=this[e+--t],s=1;t>0&&(s*=256);)i+=this[e+--t]*s;return i};z.prototype.readUInt8=function(e,t){return t||Ke(e,1,this.length),this[e]};z.prototype.readUInt16LE=function(e,t){return t||Ke(e,2,this.length),this[e]|this[e+1]<<8};z.prototype.readUInt16BE=function(e,t){return t||Ke(e,2,this.length),this[e]<<8|this[e+1]};z.prototype.readUInt32LE=function(e,t){return t||Ke(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};z.prototype.readUInt32BE=function(e,t){return t||Ke(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};z.prototype.readIntLE=function(e,t,n){e=e|0,t=t|0,n||Ke(e,t,this.length);for(var i=this[e],s=1,o=0;++o<t&&(s*=256);)i+=this[e+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*t)),i};z.prototype.readIntBE=function(e,t,n){e=e|0,t=t|0,n||Ke(e,t,this.length);for(var i=t,s=1,o=this[e+--i];i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};z.prototype.readInt8=function(e,t){return t||Ke(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};z.prototype.readInt16LE=function(e,t){t||Ke(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};z.prototype.readInt16BE=function(e,t){t||Ke(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};z.prototype.readInt32LE=function(e,t){return t||Ke(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};z.prototype.readInt32BE=function(e,t){return t||Ke(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};z.prototype.readFloatLE=function(e,t){return t||Ke(e,4,this.length),jn(this,e,!0,23,4)};z.prototype.readFloatBE=function(e,t){return t||Ke(e,4,this.length),jn(this,e,!1,23,4)};z.prototype.readDoubleLE=function(e,t){return t||Ke(e,8,this.length),jn(this,e,!0,52,8)};z.prototype.readDoubleBE=function(e,t){return t||Ke(e,8,this.length),jn(this,e,!1,52,8)};z.prototype.writeUIntLE=function(e,t,n,i){if(e=+e,t=t|0,n=n|0,!i){var s=Math.pow(2,8*n)-1;at(this,e,t,n,s,0)}var o=1,c=0;for(this[t]=e&255;++c<n&&(o*=256);)this[t+c]=e/o&255;return t+n};z.prototype.writeUIntBE=function(e,t,n,i){if(e=+e,t=t|0,n=n|0,!i){var s=Math.pow(2,8*n)-1;at(this,e,t,n,s,0)}var o=n-1,c=1;for(this[t+o]=e&255;--o>=0&&(c*=256);)this[t+o]=e/c&255;return t+n};z.prototype.writeUInt8=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,1,255,0),z.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e&255,t+1};z.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,2,65535,0),z.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):Yn(this,e,t,!0),t+2};z.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,2,65535,0),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):Yn(this,e,t,!1),t+2};z.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,4,4294967295,0),z.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255):zn(this,e,t,!0),t+4};z.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,4,4294967295,0),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):zn(this,e,t,!1),t+4};z.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t=t|0,!i){var s=Math.pow(2,8*n-1);at(this,e,t,n,s-1,-s)}var o=0,c=1,a=0;for(this[t]=e&255;++o<n&&(c*=256);)e<0&&a===0&&this[t+o-1]!==0&&(a=1),this[t+o]=(e/c>>0)-a&255;return t+n};z.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t=t|0,!i){var s=Math.pow(2,8*n-1);at(this,e,t,n,s-1,-s)}var o=n-1,c=1,a=0;for(this[t+o]=e&255;--o>=0&&(c*=256);)e<0&&a===0&&this[t+o+1]!==0&&(a=1),this[t+o]=(e/c>>0)-a&255;return t+n};z.prototype.writeInt8=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,1,127,-128),z.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=e&255,t+1};z.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,2,32767,-32768),z.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):Yn(this,e,t,!0),t+2};z.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,2,32767,-32768),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):Yn(this,e,t,!1),t+2};z.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,4,2147483647,-2147483648),z.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):zn(this,e,t,!0),t+4};z.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):zn(this,e,t,!1),t+4};z.prototype.writeFloatLE=function(e,t,n){return oa(this,e,t,!0,n)};z.prototype.writeFloatBE=function(e,t,n){return oa(this,e,t,!1,n)};z.prototype.writeDoubleLE=function(e,t,n){return aa(this,e,t,!0,n)};z.prototype.writeDoubleBE=function(e,t,n){return aa(this,e,t,!1,n)};z.prototype.copy=function(e,t,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);var s=i-n,o;if(this===e&&n<t&&t<i)for(o=s-1;o>=0;--o)e[o+t]=this[o+n];else if(s<1e3||!z.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+t]=this[o+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+s),t);return s};z.prototype.fill=function(e,t,n,i){if(typeof e=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),e.length===1){var s=e.charCodeAt(0);s<256&&(e=s)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!z.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof e=="number"&&(e=e&255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var o;if(typeof e=="number")for(o=t;o<n;++o)this[o]=e;else{var c=Pt(e)?e:Vn(new z(e,i).toString()),a=c.length;for(o=0;o<n-t;++o)this[o+t]=c[o%a]}return this};Ff=/[^+\/0-9A-Za-z-_]/g});var an=ze((ed,Zn)=>{var _r=(ha(),Ju(la));if(_r&&_r.default){Zn.exports=_r.default;for(let r in _r)Zn.exports[r]=_r[r]}else _r&&(Zn.exports=_r)});var da=ze(Es=>{Es.read=function(r,e,t,n,i){var s,o,c=i*8-n-1,a=(1<<c)-1,h=a>>1,p=-7,g=t?i-1:0,w=t?-1:1,x=r[e+g];for(g+=w,s=x&(1<<-p)-1,x>>=-p,p+=c;p>0;s=s*256+r[e+g],g+=w,p-=8);for(o=s&(1<<-p)-1,s>>=-p,p+=n;p>0;o=o*256+r[e+g],g+=w,p-=8);if(s===0)s=1-h;else{if(s===a)return o?NaN:(x?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(x?-1:1)*o*Math.pow(2,s-n)};Es.write=function(r,e,t,n,i,s){var o,c,a,h=s*8-i-1,p=(1<<h)-1,g=p>>1,w=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=n?0:s-1,f=n?1:-1,N=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=p):(o=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+g>=1?e+=w/a:e+=w*Math.pow(2,1-g),e*a>=2&&(o++,a/=2),o+g>=p?(c=0,o=p):o+g>=1?(c=(e*a-1)*Math.pow(2,i),o=o+g):(c=e*Math.pow(2,g-1)*Math.pow(2,i),o=0));i>=8;r[t+x]=c&255,x+=f,c/=256,i-=8);for(o=o<<i|c,h+=i;h>0;r[t+x]=o&255,x+=f,o/=256,h-=8);r[t+x-f]|=N*128}});var cn=ze((pa,Wn)=>{(function(r){"use strict";var e,t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",c=1e14,a=14,h=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,w=1e9;function x(E){var C,G,j,k=U.prototype={constructor:U,toString:null,valueOf:null},fe=new U(1),re=20,te=4,y=-7,I=21,q=-1e7,F=1e7,P=!1,$=1,Z=0,ue={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},ce="0123456789abcdefghijklmnopqrstuvwxyz",Y=!0;function U(u,l){var m,S,v,A,M,b,B,L,R=this;if(!(R instanceof U))return new U(u,l);if(l==null){if(u&&u._isBigNumber===!0){R.s=u.s,!u.c||u.e>F?R.c=R.e=null:u.e<q?R.c=[R.e=0]:(R.e=u.e,R.c=u.c.slice());return}if((b=typeof u=="number")&&u*0==0){if(R.s=1/u<0?(u=-u,-1):1,u===~~u){for(A=0,M=u;M>=10;M/=10,A++);A>F?R.c=R.e=null:(R.e=A,R.c=[u]);return}L=String(u)}else{if(!t.test(L=String(u)))return j(R,L,b);R.s=L.charCodeAt(0)==45?(L=L.slice(1),-1):1}(A=L.indexOf("."))>-1&&(L=L.replace(".","")),(M=L.search(/e/i))>0?(A<0&&(A=M),A+=+L.slice(M+1),L=L.substring(0,M)):A<0&&(A=L.length)}else{if(O(l,2,ce.length,"Base"),l==10&&Y)return R=new U(u),ae(R,re+R.e+1,te);if(L=String(u),b=typeof u=="number"){if(u*0!=0)return j(R,L,b,l);if(R.s=1/u<0?(L=L.slice(1),-1):1,U.DEBUG&&L.replace(/^0\.0*|\./,"").length>15)throw Error(o+u)}else R.s=L.charCodeAt(0)===45?(L=L.slice(1),-1):1;for(m=ce.slice(0,l),A=M=0,B=L.length;M<B;M++)if(m.indexOf(S=L.charAt(M))<0){if(S=="."){if(M>A){A=B;continue}}else if(!v&&(L==L.toUpperCase()&&(L=L.toLowerCase())||L==L.toLowerCase()&&(L=L.toUpperCase()))){v=!0,M=-1,A=0;continue}return j(R,String(u),b,l)}b=!1,L=G(L,l,10,R.s),(A=L.indexOf("."))>-1?L=L.replace(".",""):A=L.length}for(M=0;L.charCodeAt(M)===48;M++);for(B=L.length;L.charCodeAt(--B)===48;);if(L=L.slice(M,++B)){if(B-=M,b&&U.DEBUG&&B>15&&(u>h||u!==i(u)))throw Error(o+R.s*u);if((A=A-M-1)>F)R.c=R.e=null;else if(A<q)R.c=[R.e=0];else{if(R.e=A,R.c=[],M=(A+1)%a,A<0&&(M+=a),M<B){for(M&&R.c.push(+L.slice(0,M)),B-=a;M<B;)R.c.push(+L.slice(M,M+=a));M=a-(L=L.slice(M)).length}else M-=B;for(;M--;L+="0");R.c.push(+L)}}else R.c=[R.e=0]}U.clone=x,U.ROUND_UP=0,U.ROUND_DOWN=1,U.ROUND_CEIL=2,U.ROUND_FLOOR=3,U.ROUND_HALF_UP=4,U.ROUND_HALF_DOWN=5,U.ROUND_HALF_EVEN=6,U.ROUND_HALF_CEIL=7,U.ROUND_HALF_FLOOR=8,U.EUCLID=9,U.config=U.set=function(u){var l,m;if(u!=null)if(typeof u=="object"){if(u.hasOwnProperty(l="DECIMAL_PLACES")&&(m=u[l],O(m,0,w,l),re=m),u.hasOwnProperty(l="ROUNDING_MODE")&&(m=u[l],O(m,0,8,l),te=m),u.hasOwnProperty(l="EXPONENTIAL_AT")&&(m=u[l],m&&m.pop?(O(m[0],-w,0,l),O(m[1],0,w,l),y=m[0],I=m[1]):(O(m,-w,w,l),y=-(I=m<0?-m:m))),u.hasOwnProperty(l="RANGE"))if(m=u[l],m&&m.pop)O(m[0],-w,-1,l),O(m[1],1,w,l),q=m[0],F=m[1];else if(O(m,-w,w,l),m)q=-(F=m<0?-m:m);else throw Error(s+l+" cannot be zero: "+m);if(u.hasOwnProperty(l="CRYPTO"))if(m=u[l],m===!!m)if(m)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))P=m;else throw P=!m,Error(s+"crypto unavailable");else P=m;else throw Error(s+l+" not true or false: "+m);if(u.hasOwnProperty(l="MODULO_MODE")&&(m=u[l],O(m,0,9,l),$=m),u.hasOwnProperty(l="POW_PRECISION")&&(m=u[l],O(m,0,w,l),Z=m),u.hasOwnProperty(l="FORMAT"))if(m=u[l],typeof m=="object")ue=m;else throw Error(s+l+" not an object: "+m);if(u.hasOwnProperty(l="ALPHABET"))if(m=u[l],typeof m=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(m))Y=m.slice(0,10)=="0123456789",ce=m;else throw Error(s+l+" invalid: "+m)}else throw Error(s+"Object expected: "+u);return{DECIMAL_PLACES:re,ROUNDING_MODE:te,EXPONENTIAL_AT:[y,I],RANGE:[q,F],CRYPTO:P,MODULO_MODE:$,POW_PRECISION:Z,FORMAT:ue,ALPHABET:ce}},U.isBigNumber=function(u){if(!u||u._isBigNumber!==!0)return!1;if(!U.DEBUG)return!0;var l,m,S=u.c,v=u.e,A=u.s;e:if({}.toString.call(S)=="[object Array]"){if((A===1||A===-1)&&v>=-w&&v<=w&&v===i(v)){if(S[0]===0){if(v===0&&S.length===1)return!0;break e}if(l=(v+1)%a,l<1&&(l+=a),String(S[0]).length==l){for(l=0;l<S.length;l++)if(m=S[l],m<0||m>=c||m!==i(m))break e;if(m!==0)return!0}}}else if(S===null&&v===null&&(A===null||A===1||A===-1))return!0;throw Error(s+"Invalid BigNumber: "+u)},U.maximum=U.max=function(){return J(arguments,-1)},U.minimum=U.min=function(){return J(arguments,1)},U.random=function(){var u=9007199254740992,l=Math.random()*u&2097151?function(){return i(Math.random()*u)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(m){var S,v,A,M,b,B=0,L=[],R=new U(fe);if(m==null?m=re:O(m,0,w),M=n(m/a),P)if(crypto.getRandomValues){for(S=crypto.getRandomValues(new Uint32Array(M*=2));B<M;)b=S[B]*131072+(S[B+1]>>>11),b>=9e15?(v=crypto.getRandomValues(new Uint32Array(2)),S[B]=v[0],S[B+1]=v[1]):(L.push(b%1e14),B+=2);B=M/2}else if(crypto.randomBytes){for(S=crypto.randomBytes(M*=7);B<M;)b=(S[B]&31)*281474976710656+S[B+1]*1099511627776+S[B+2]*4294967296+S[B+3]*16777216+(S[B+4]<<16)+(S[B+5]<<8)+S[B+6],b>=9e15?crypto.randomBytes(7).copy(S,B):(L.push(b%1e14),B+=7);B=M/7}else throw P=!1,Error(s+"crypto unavailable");if(!P)for(;B<M;)b=l(),b<9e15&&(L[B++]=b%1e14);for(M=L[--B],m%=a,M&&m&&(b=p[a-m],L[B]=i(M/b)*b);L[B]===0;L.pop(),B--);if(B<0)L=[A=0];else{for(A=-1;L[0]===0;L.splice(0,1),A-=a);for(B=1,b=L[0];b>=10;b/=10,B++);B<a&&(A-=a-B)}return R.e=A,R.c=L,R}}(),U.sum=function(){for(var u=1,l=arguments,m=new U(l[0]);u<l.length;)m=m.plus(l[u++]);return m},G=function(){var u="0123456789";function l(m,S,v,A){for(var M,b=[0],B,L=0,R=m.length;L<R;){for(B=b.length;B--;b[B]*=S);for(b[0]+=A.indexOf(m.charAt(L++)),M=0;M<b.length;M++)b[M]>v-1&&(b[M+1]==null&&(b[M+1]=0),b[M+1]+=b[M]/v|0,b[M]%=v)}return b.reverse()}return function(m,S,v,A,M){var b,B,L,R,V,W,ie,de,Ee=m.indexOf("."),Ne=re,he=te;for(Ee>=0&&(R=Z,Z=0,m=m.replace(".",""),de=new U(S),W=de.pow(m.length-Ee),Z=R,de.c=l(K(N(W.c),W.e,"0"),10,v,u),de.e=de.c.length),ie=l(m,S,v,M?(b=ce,u):(b=u,ce)),L=R=ie.length;ie[--R]==0;ie.pop());if(!ie[0])return b.charAt(0);if(Ee<0?--L:(W.c=ie,W.e=L,W.s=A,W=C(W,de,Ne,he,v),ie=W.c,V=W.r,L=W.e),B=L+Ne+1,Ee=ie[B],R=v/2,V=V||B<0||ie[B+1]!=null,V=he<4?(Ee!=null||V)&&(he==0||he==(W.s<0?3:2)):Ee>R||Ee==R&&(he==4||V||he==6&&ie[B-1]&1||he==(W.s<0?8:7)),B<1||!ie[0])m=V?K(b.charAt(1),-Ne,b.charAt(0)):b.charAt(0);else{if(ie.length=B,V)for(--v;++ie[--B]>v;)ie[B]=0,B||(++L,ie=[1].concat(ie));for(R=ie.length;!ie[--R];);for(Ee=0,m="";Ee<=R;m+=b.charAt(ie[Ee++]));m=K(m,L,b.charAt(0))}return m}}(),C=function(){function u(S,v,A){var M,b,B,L,R=0,V=S.length,W=v%g,ie=v/g|0;for(S=S.slice();V--;)B=S[V]%g,L=S[V]/g|0,M=ie*B+L*W,b=W*B+M%g*g+R,R=(b/A|0)+(M/g|0)+ie*L,S[V]=b%A;return R&&(S=[R].concat(S)),S}function l(S,v,A,M){var b,B;if(A!=M)B=A>M?1:-1;else for(b=B=0;b<A;b++)if(S[b]!=v[b]){B=S[b]>v[b]?1:-1;break}return B}function m(S,v,A,M){for(var b=0;A--;)S[A]-=b,b=S[A]<v[A]?1:0,S[A]=b*M+S[A]-v[A];for(;!S[0]&&S.length>1;S.splice(0,1));}return function(S,v,A,M,b){var B,L,R,V,W,ie,de,Ee,Ne,he,oe,ke,Qt,mr,gr,pt,be,ot=S.s==v.s?1:-1,We=S.c,Re=v.c;if(!We||!We[0]||!Re||!Re[0])return new U(!S.s||!v.s||(We?Re&&We[0]==Re[0]:!Re)?NaN:We&&We[0]==0||!Re?ot*0:ot/0);for(Ee=new U(ot),Ne=Ee.c=[],L=S.e-v.e,ot=A+L+1,b||(b=c,L=f(S.e/a)-f(v.e/a),ot=ot/a|0),R=0;Re[R]==(We[R]||0);R++);if(Re[R]>(We[R]||0)&&L--,ot<0)Ne.push(1),V=!0;else{for(mr=We.length,pt=Re.length,R=0,ot+=2,W=i(b/(Re[0]+1)),W>1&&(Re=u(Re,W,b),We=u(We,W,b),pt=Re.length,mr=We.length),Qt=pt,he=We.slice(0,pt),oe=he.length;oe<pt;he[oe++]=0);be=Re.slice(),be=[0].concat(be),gr=Re[0],Re[1]>=b/2&&gr++;do{if(W=0,B=l(Re,he,pt,oe),B<0){if(ke=he[0],pt!=oe&&(ke=ke*b+(he[1]||0)),W=i(ke/gr),W>1)for(W>=b&&(W=b-1),ie=u(Re,W,b),de=ie.length,oe=he.length;l(ie,he,de,oe)==1;)W--,m(ie,pt<de?be:Re,de,b),de=ie.length,B=1;else W==0&&(B=W=1),ie=Re.slice(),de=ie.length;if(de<oe&&(ie=[0].concat(ie)),m(he,ie,oe,b),oe=he.length,B==-1)for(;l(Re,he,pt,oe)<1;)W++,m(he,pt<oe?be:Re,oe,b),oe=he.length}else B===0&&(W++,he=[0]);Ne[R++]=W,he[0]?he[oe++]=We[Qt]||0:(he=[We[Qt]],oe=1)}while((Qt++<mr||he[0]!=null)&&ot--);V=he[0]!=null,Ne[0]||Ne.splice(0,1)}if(b==c){for(R=1,ot=Ne[0];ot>=10;ot/=10,R++);ae(Ee,A+(Ee.e=R+L*a-1)+1,M,V)}else Ee.e=L,Ee.r=+V;return Ee}}();function d(u,l,m,S){var v,A,M,b,B;if(m==null?m=te:O(m,0,8),!u.c)return u.toString();if(v=u.c[0],M=u.e,l==null)B=N(u.c),B=S==1||S==2&&(M<=y||M>=I)?D(B,M):K(B,M,"0");else if(u=ae(new U(u),l,m),A=u.e,B=N(u.c),b=B.length,S==1||S==2&&(l<=A||A<=y)){for(;b<l;B+="0",b++);B=D(B,A)}else if(l-=M,B=K(B,A,"0"),A+1>b){if(--l>0)for(B+=".";l--;B+="0");}else if(l+=A-b,l>0)for(A+1==b&&(B+=".");l--;B+="0");return u.s<0&&v?"-"+B:B}function J(u,l){for(var m,S,v=1,A=new U(u[0]);v<u.length;v++)S=new U(u[v]),(!S.s||(m=T(A,S))===l||m===0&&A.s===l)&&(A=S);return A}function ee(u,l,m){for(var S=1,v=l.length;!l[--v];l.pop());for(v=l[0];v>=10;v/=10,S++);return(m=S+m*a-1)>F?u.c=u.e=null:m<q?u.c=[u.e=0]:(u.e=m,u.c=l),u}j=function(){var u=/^(-?)0([xbo])(?=\w[\w.]*$)/i,l=/^([^.]+)\.$/,m=/^\.([^.]+)$/,S=/^-?(Infinity|NaN)$/,v=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(A,M,b,B){var L,R=b?M:M.replace(v,"");if(S.test(R))A.s=isNaN(R)?null:R<0?-1:1;else{if(!b&&(R=R.replace(u,function(V,W,ie){return L=(ie=ie.toLowerCase())=="x"?16:ie=="b"?2:8,!B||B==L?W:V}),B&&(L=B,R=R.replace(l,"$1").replace(m,"0.$1")),M!=R))return new U(R,L);if(U.DEBUG)throw Error(s+"Not a"+(B?" base "+B:"")+" number: "+M);A.s=null}A.c=A.e=null}}();function ae(u,l,m,S){var v,A,M,b,B,L,R,V=u.c,W=p;if(V){e:{for(v=1,b=V[0];b>=10;b/=10,v++);if(A=l-v,A<0)A+=a,M=l,B=V[L=0],R=i(B/W[v-M-1]%10);else if(L=n((A+1)/a),L>=V.length)if(S){for(;V.length<=L;V.push(0));B=R=0,v=1,A%=a,M=A-a+1}else break e;else{for(B=b=V[L],v=1;b>=10;b/=10,v++);A%=a,M=A-a+v,R=M<0?0:i(B/W[v-M-1]%10)}if(S=S||l<0||V[L+1]!=null||(M<0?B:B%W[v-M-1]),S=m<4?(R||S)&&(m==0||m==(u.s<0?3:2)):R>5||R==5&&(m==4||S||m==6&&(A>0?M>0?B/W[v-M]:0:V[L-1])%10&1||m==(u.s<0?8:7)),l<1||!V[0])return V.length=0,S?(l-=u.e+1,V[0]=W[(a-l%a)%a],u.e=-l||0):V[0]=u.e=0,u;if(A==0?(V.length=L,b=1,L--):(V.length=L+1,b=W[a-A],V[L]=M>0?i(B/W[v-M]%W[M])*b:0),S)for(;;)if(L==0){for(A=1,M=V[0];M>=10;M/=10,A++);for(M=V[0]+=b,b=1;M>=10;M/=10,b++);A!=b&&(u.e++,V[0]==c&&(V[0]=1));break}else{if(V[L]+=b,V[L]!=c)break;V[L--]=0,b=1}for(A=V.length;V[--A]===0;V.pop());}u.e>F?u.c=u.e=null:u.e<q&&(u.c=[u.e=0])}return u}function Q(u){var l,m=u.e;return m===null?u.toString():(l=N(u.c),l=m<=y||m>=I?D(l,m):K(l,m,"0"),u.s<0?"-"+l:l)}return k.absoluteValue=k.abs=function(){var u=new U(this);return u.s<0&&(u.s=1),u},k.comparedTo=function(u,l){return T(this,new U(u,l))},k.decimalPlaces=k.dp=function(u,l){var m,S,v,A=this;if(u!=null)return O(u,0,w),l==null?l=te:O(l,0,8),ae(new U(A),u+A.e+1,l);if(!(m=A.c))return null;if(S=((v=m.length-1)-f(this.e/a))*a,v=m[v])for(;v%10==0;v/=10,S--);return S<0&&(S=0),S},k.dividedBy=k.div=function(u,l){return C(this,new U(u,l),re,te)},k.dividedToIntegerBy=k.idiv=function(u,l){return C(this,new U(u,l),0,1)},k.exponentiatedBy=k.pow=function(u,l){var m,S,v,A,M,b,B,L,R,V=this;if(u=new U(u),u.c&&!u.isInteger())throw Error(s+"Exponent not an integer: "+Q(u));if(l!=null&&(l=new U(l)),b=u.e>14,!V.c||!V.c[0]||V.c[0]==1&&!V.e&&V.c.length==1||!u.c||!u.c[0])return R=new U(Math.pow(+Q(V),b?u.s*(2-H(u)):+Q(u))),l?R.mod(l):R;if(B=u.s<0,l){if(l.c?!l.c[0]:!l.s)return new U(NaN);S=!B&&V.isInteger()&&l.isInteger(),S&&(V=V.mod(l))}else{if(u.e>9&&(V.e>0||V.e<-1||(V.e==0?V.c[0]>1||b&&V.c[1]>=24e7:V.c[0]<8e13||b&&V.c[0]<=9999975e7)))return A=V.s<0&&H(u)?-0:0,V.e>-1&&(A=1/A),new U(B?1/A:A);Z&&(A=n(Z/a+2))}for(b?(m=new U(.5),B&&(u.s=1),L=H(u)):(v=Math.abs(+Q(u)),L=v%2),R=new U(fe);;){if(L){if(R=R.times(V),!R.c)break;A?R.c.length>A&&(R.c.length=A):S&&(R=R.mod(l))}if(v){if(v=i(v/2),v===0)break;L=v%2}else if(u=u.times(m),ae(u,u.e+1,1),u.e>14)L=H(u);else{if(v=+Q(u),v===0)break;L=v%2}V=V.times(V),A?V.c&&V.c.length>A&&(V.c.length=A):S&&(V=V.mod(l))}return S?R:(B&&(R=fe.div(R)),l?R.mod(l):A?ae(R,Z,te,M):R)},k.integerValue=function(u){var l=new U(this);return u==null?u=te:O(u,0,8),ae(l,l.e+1,u)},k.isEqualTo=k.eq=function(u,l){return T(this,new U(u,l))===0},k.isFinite=function(){return!!this.c},k.isGreaterThan=k.gt=function(u,l){return T(this,new U(u,l))>0},k.isGreaterThanOrEqualTo=k.gte=function(u,l){return(l=T(this,new U(u,l)))===1||l===0},k.isInteger=function(){return!!this.c&&f(this.e/a)>this.c.length-2},k.isLessThan=k.lt=function(u,l){return T(this,new U(u,l))<0},k.isLessThanOrEqualTo=k.lte=function(u,l){return(l=T(this,new U(u,l)))===-1||l===0},k.isNaN=function(){return!this.s},k.isNegative=function(){return this.s<0},k.isPositive=function(){return this.s>0},k.isZero=function(){return!!this.c&&this.c[0]==0},k.minus=function(u,l){var m,S,v,A,M=this,b=M.s;if(u=new U(u,l),l=u.s,!b||!l)return new U(NaN);if(b!=l)return u.s=-l,M.plus(u);var B=M.e/a,L=u.e/a,R=M.c,V=u.c;if(!B||!L){if(!R||!V)return R?(u.s=-l,u):new U(V?M:NaN);if(!R[0]||!V[0])return V[0]?(u.s=-l,u):new U(R[0]?M:te==3?-0:0)}if(B=f(B),L=f(L),R=R.slice(),b=B-L){for((A=b<0)?(b=-b,v=R):(L=B,v=V),v.reverse(),l=b;l--;v.push(0));v.reverse()}else for(S=(A=(b=R.length)<(l=V.length))?b:l,b=l=0;l<S;l++)if(R[l]!=V[l]){A=R[l]<V[l];break}if(A&&(v=R,R=V,V=v,u.s=-u.s),l=(S=V.length)-(m=R.length),l>0)for(;l--;R[m++]=0);for(l=c-1;S>b;){if(R[--S]<V[S]){for(m=S;m&&!R[--m];R[m]=l);--R[m],R[S]+=c}R[S]-=V[S]}for(;R[0]==0;R.splice(0,1),--L);return R[0]?ee(u,R,L):(u.s=te==3?-1:1,u.c=[u.e=0],u)},k.modulo=k.mod=function(u,l){var m,S,v=this;return u=new U(u,l),!v.c||!u.s||u.c&&!u.c[0]?new U(NaN):!u.c||v.c&&!v.c[0]?new U(v):($==9?(S=u.s,u.s=1,m=C(v,u,0,3),u.s=S,m.s*=S):m=C(v,u,0,$),u=v.minus(m.times(u)),!u.c[0]&&$==1&&(u.s=v.s),u)},k.multipliedBy=k.times=function(u,l){var m,S,v,A,M,b,B,L,R,V,W,ie,de,Ee,Ne,he=this,oe=he.c,ke=(u=new U(u,l)).c;if(!oe||!ke||!oe[0]||!ke[0])return!he.s||!u.s||oe&&!oe[0]&&!ke||ke&&!ke[0]&&!oe?u.c=u.e=u.s=null:(u.s*=he.s,!oe||!ke?u.c=u.e=null:(u.c=[0],u.e=0)),u;for(S=f(he.e/a)+f(u.e/a),u.s*=he.s,B=oe.length,V=ke.length,B<V&&(de=oe,oe=ke,ke=de,v=B,B=V,V=v),v=B+V,de=[];v--;de.push(0));for(Ee=c,Ne=g,v=V;--v>=0;){for(m=0,W=ke[v]%Ne,ie=ke[v]/Ne|0,M=B,A=v+M;A>v;)L=oe[--M]%Ne,R=oe[M]/Ne|0,b=ie*L+R*W,L=W*L+b%Ne*Ne+de[A]+m,m=(L/Ee|0)+(b/Ne|0)+ie*R,de[A--]=L%Ee;de[A]=m}return m?++S:de.splice(0,1),ee(u,de,S)},k.negated=function(){var u=new U(this);return u.s=-u.s||null,u},k.plus=function(u,l){var m,S=this,v=S.s;if(u=new U(u,l),l=u.s,!v||!l)return new U(NaN);if(v!=l)return u.s=-l,S.minus(u);var A=S.e/a,M=u.e/a,b=S.c,B=u.c;if(!A||!M){if(!b||!B)return new U(v/0);if(!b[0]||!B[0])return B[0]?u:new U(b[0]?S:v*0)}if(A=f(A),M=f(M),b=b.slice(),v=A-M){for(v>0?(M=A,m=B):(v=-v,m=b),m.reverse();v--;m.push(0));m.reverse()}for(v=b.length,l=B.length,v-l<0&&(m=B,B=b,b=m,l=v),v=0;l;)v=(b[--l]=b[l]+B[l]+v)/c|0,b[l]=c===b[l]?0:b[l]%c;return v&&(b=[v].concat(b),++M),ee(u,b,M)},k.precision=k.sd=function(u,l){var m,S,v,A=this;if(u!=null&&u!==!!u)return O(u,1,w),l==null?l=te:O(l,0,8),ae(new U(A),u,l);if(!(m=A.c))return null;if(v=m.length-1,S=v*a+1,v=m[v]){for(;v%10==0;v/=10,S--);for(v=m[0];v>=10;v/=10,S++);}return u&&A.e+1>S&&(S=A.e+1),S},k.shiftedBy=function(u){return O(u,-h,h),this.times("1e"+u)},k.squareRoot=k.sqrt=function(){var u,l,m,S,v,A=this,M=A.c,b=A.s,B=A.e,L=re+4,R=new U("0.5");if(b!==1||!M||!M[0])return new U(!b||b<0&&(!M||M[0])?NaN:M?A:1/0);if(b=Math.sqrt(+Q(A)),b==0||b==1/0?(l=N(M),(l.length+B)%2==0&&(l+="0"),b=Math.sqrt(+l),B=f((B+1)/2)-(B<0||B%2),b==1/0?l="5e"+B:(l=b.toExponential(),l=l.slice(0,l.indexOf("e")+1)+B),m=new U(l)):m=new U(b+""),m.c[0]){for(B=m.e,b=B+L,b<3&&(b=0);;)if(v=m,m=R.times(v.plus(C(A,v,L,1))),N(v.c).slice(0,b)===(l=N(m.c)).slice(0,b))if(m.e<B&&--b,l=l.slice(b-3,b+1),l=="9999"||!S&&l=="4999"){if(!S&&(ae(v,v.e+re+2,0),v.times(v).eq(A))){m=v;break}L+=4,b+=4,S=1}else{(!+l||!+l.slice(1)&&l.charAt(0)=="5")&&(ae(m,m.e+re+2,1),u=!m.times(m).eq(A));break}}return ae(m,m.e+re+1,te,u)},k.toExponential=function(u,l){return u!=null&&(O(u,0,w),u++),d(this,u,l,1)},k.toFixed=function(u,l){return u!=null&&(O(u,0,w),u=u+this.e+1),d(this,u,l)},k.toFormat=function(u,l,m){var S,v=this;if(m==null)u!=null&&l&&typeof l=="object"?(m=l,l=null):u&&typeof u=="object"?(m=u,u=l=null):m=ue;else if(typeof m!="object")throw Error(s+"Argument not an object: "+m);if(S=v.toFixed(u,l),v.c){var A,M=S.split("."),b=+m.groupSize,B=+m.secondaryGroupSize,L=m.groupSeparator||"",R=M[0],V=M[1],W=v.s<0,ie=W?R.slice(1):R,de=ie.length;if(B&&(A=b,b=B,B=A,de-=A),b>0&&de>0){for(A=de%b||b,R=ie.substr(0,A);A<de;A+=b)R+=L+ie.substr(A,b);B>0&&(R+=L+ie.slice(A)),W&&(R="-"+R)}S=V?R+(m.decimalSeparator||"")+((B=+m.fractionGroupSize)?V.replace(new RegExp("\\d{"+B+"}\\B","g"),"$&"+(m.fractionGroupSeparator||"")):V):R}return(m.prefix||"")+S+(m.suffix||"")},k.toFraction=function(u){var l,m,S,v,A,M,b,B,L,R,V,W,ie=this,de=ie.c;if(u!=null&&(b=new U(u),!b.isInteger()&&(b.c||b.s!==1)||b.lt(fe)))throw Error(s+"Argument "+(b.isInteger()?"out of range: ":"not an integer: ")+Q(b));if(!de)return new U(ie);for(l=new U(fe),L=m=new U(fe),S=B=new U(fe),W=N(de),A=l.e=W.length-ie.e-1,l.c[0]=p[(M=A%a)<0?a+M:M],u=!u||b.comparedTo(l)>0?A>0?l:L:b,M=F,F=1/0,b=new U(W),B.c[0]=0;R=C(b,l,0,1),v=m.plus(R.times(S)),v.comparedTo(u)!=1;)m=S,S=v,L=B.plus(R.times(v=L)),B=v,l=b.minus(R.times(v=l)),b=v;return v=C(u.minus(m),S,0,1),B=B.plus(v.times(L)),m=m.plus(v.times(S)),B.s=L.s=ie.s,A=A*2,V=C(L,S,A,te).minus(ie).abs().comparedTo(C(B,m,A,te).minus(ie).abs())<1?[L,S]:[B,m],F=M,V},k.toNumber=function(){return+Q(this)},k.toPrecision=function(u,l){return u!=null&&O(u,1,w),d(this,u,l,2)},k.toString=function(u){var l,m=this,S=m.s,v=m.e;return v===null?S?(l="Infinity",S<0&&(l="-"+l)):l="NaN":(u==null?l=v<=y||v>=I?D(N(m.c),v):K(N(m.c),v,"0"):u===10&&Y?(m=ae(new U(m),re+v+1,te),l=K(N(m.c),m.e,"0")):(O(u,2,ce.length,"Base"),l=G(K(N(m.c),v,"0"),10,u,S,!0)),S<0&&m.c[0]&&(l="-"+l)),l},k.valueOf=k.toJSON=function(){return Q(this)},k._isBigNumber=!0,E!=null&&U.set(E),U}function f(E){var C=E|0;return E>0||E===C?C:C-1}function N(E){for(var C,G,j=1,k=E.length,fe=E[0]+"";j<k;){for(C=E[j++]+"",G=a-C.length;G--;C="0"+C);fe+=C}for(k=fe.length;fe.charCodeAt(--k)===48;);return fe.slice(0,k+1||1)}function T(E,C){var G,j,k=E.c,fe=C.c,re=E.s,te=C.s,y=E.e,I=C.e;if(!re||!te)return null;if(G=k&&!k[0],j=fe&&!fe[0],G||j)return G?j?0:-te:re;if(re!=te)return re;if(G=re<0,j=y==I,!k||!fe)return j?0:!k^G?1:-1;if(!j)return y>I^G?1:-1;for(te=(y=k.length)<(I=fe.length)?y:I,re=0;re<te;re++)if(k[re]!=fe[re])return k[re]>fe[re]^G?1:-1;return y==I?0:y>I^G?1:-1}function O(E,C,G,j){if(E<C||E>G||E!==i(E))throw Error(s+(j||"Argument")+(typeof E=="number"?E<C||E>G?" out of range: ":" not an integer: ":" not a primitive number: ")+String(E))}function H(E){var C=E.c.length-1;return f(E.e/a)==C&&E.c[C]%2!=0}function D(E,C){return(E.length>1?E.charAt(0)+"."+E.slice(1):E)+(C<0?"e":"e+")+C}function K(E,C,G){var j,k;if(C<0){for(k=G+".";++C;k+=G);E=k+E}else if(j=E.length,++C>j){for(k=G,C-=j;--C;k+=G);E+=k}else C<j&&(E=E.slice(0,C)+"."+E.slice(C));return E}e=x(),e.default=e.BigNumber=e,typeof define=="function"&&define.amd?define(function(){return e}):typeof Wn<"u"&&Wn.exports?Wn.exports=e:(r||(r=typeof self<"u"&&self?self:window),r.BigNumber=e)})(pa)});var ga=ze((rd,ma)=>{ma.exports=function(e,t,n){var i=new e.Uint8Array(n),s=t.pushInt,o=t.pushInt32,c=t.pushInt32Neg,a=t.pushInt64,h=t.pushInt64Neg,p=t.pushFloat,g=t.pushFloatSingle,w=t.pushFloatDouble,x=t.pushTrue,f=t.pushFalse,N=t.pushUndefined,T=t.pushNull,O=t.pushInfinity,H=t.pushInfinityNeg,D=t.pushNaN,K=t.pushNaNNeg,E=t.pushArrayStart,C=t.pushArrayStartFixed,G=t.pushArrayStartFixed32,j=t.pushArrayStartFixed64,k=t.pushObjectStart,fe=t.pushObjectStartFixed,re=t.pushObjectStartFixed32,te=t.pushObjectStartFixed64,y=t.pushByteString,I=t.pushByteStringStart,q=t.pushUtf8String,F=t.pushUtf8StringStart,P=t.pushSimpleUnassigned,$=t.pushTagStart,Z=t.pushTagStart4,ue=t.pushTagStart8,ce=t.pushTagUnassigned,Y=t.pushBreak,U=e.Math.pow,d=0,J=0,ee=0;function ae(_){for(_=_|0,d=0,J=_;(d|0)<(J|0)&&(ee=Yu[i[d]&255](i[d]|0)|0,!((ee|0)>0)););return ee|0}function Q(_){return _=_|0,((d|0)+(_|0)|0)<(J|0)?0:1}function u(_){return _=_|0,i[_|0]<<8|i[_+1|0]|0}function l(_){return _=_|0,i[_|0]<<24|i[_+1|0]<<16|i[_+2|0]<<8|i[_+3|0]|0}function m(_){return _=_|0,s(_|0),d=d+1|0,0}function S(_){return _=_|0,Q(1)|0?1:(s(i[d+1|0]|0),d=d+2|0,0)}function v(_){return _=_|0,Q(2)|0?1:(s(u(d+1|0)|0),d=d+3|0,0)}function A(_){return _=_|0,Q(4)|0?1:(o(u(d+1|0)|0,u(d+3|0)|0),d=d+5|0,0)}function M(_){return _=_|0,Q(8)|0?1:(a(u(d+1|0)|0,u(d+3|0)|0,u(d+5|0)|0,u(d+7|0)|0),d=d+9|0,0)}function b(_){return _=_|0,s(-1-(_-32|0)|0),d=d+1|0,0}function B(_){return _=_|0,Q(1)|0?1:(s(-1-(i[d+1|0]|0)|0),d=d+2|0,0)}function L(_){_=_|0;var ye=0;return Q(2)|0?1:(ye=u(d+1|0)|0,s(-1-(ye|0)|0),d=d+3|0,0)}function R(_){return _=_|0,Q(4)|0?1:(c(u(d+1|0)|0,u(d+3|0)|0),d=d+5|0,0)}function V(_){return _=_|0,Q(8)|0?1:(h(u(d+1|0)|0,u(d+3|0)|0,u(d+5|0)|0,u(d+7|0)|0),d=d+9|0,0)}function W(_){_=_|0;var ye=0,we=0,pe=0;return pe=_-64|0,Q(pe|0)|0?1:(ye=d+1|0,we=(d+1|0)+(pe|0)|0,y(ye|0,we|0),d=we|0,0)}function ie(_){_=_|0;var ye=0,we=0,pe=0;return Q(1)|0||(pe=i[d+1|0]|0,ye=d+2|0,we=(d+2|0)+(pe|0)|0,Q(pe+1|0)|0)?1:(y(ye|0,we|0),d=we|0,0)}function de(_){_=_|0;var ye=0,we=0,pe=0;return Q(2)|0||(pe=u(d+1|0)|0,ye=d+3|0,we=(d+3|0)+(pe|0)|0,Q(pe+2|0)|0)?1:(y(ye|0,we|0),d=we|0,0)}function Ee(_){_=_|0;var ye=0,we=0,pe=0;return Q(4)|0||(pe=l(d+1|0)|0,ye=d+5|0,we=(d+5|0)+(pe|0)|0,Q(pe+4|0)|0)?1:(y(ye|0,we|0),d=we|0,0)}function Ne(_){return _=_|0,1}function he(_){return _=_|0,I(),d=d+1|0,0}function oe(_){_=_|0;var ye=0,we=0,pe=0;return pe=_-96|0,Q(pe|0)|0?1:(ye=d+1|0,we=(d+1|0)+(pe|0)|0,q(ye|0,we|0),d=we|0,0)}function ke(_){_=_|0;var ye=0,we=0,pe=0;return Q(1)|0||(pe=i[d+1|0]|0,ye=d+2|0,we=(d+2|0)+(pe|0)|0,Q(pe+1|0)|0)?1:(q(ye|0,we|0),d=we|0,0)}function Qt(_){_=_|0;var ye=0,we=0,pe=0;return Q(2)|0||(pe=u(d+1|0)|0,ye=d+3|0,we=(d+3|0)+(pe|0)|0,Q(pe+2|0)|0)?1:(q(ye|0,we|0),d=we|0,0)}function mr(_){_=_|0;var ye=0,we=0,pe=0;return Q(4)|0||(pe=l(d+1|0)|0,ye=d+5|0,we=(d+5|0)+(pe|0)|0,Q(pe+4|0)|0)?1:(q(ye|0,we|0),d=we|0,0)}function gr(_){return _=_|0,1}function pt(_){return _=_|0,F(),d=d+1|0,0}function be(_){return _=_|0,C(_-128|0),d=d+1|0,0}function ot(_){return _=_|0,Q(1)|0?1:(C(i[d+1|0]|0),d=d+2|0,0)}function We(_){return _=_|0,Q(2)|0?1:(C(u(d+1|0)|0),d=d+3|0,0)}function Re(_){return _=_|0,Q(4)|0?1:(G(u(d+1|0)|0,u(d+3|0)|0),d=d+5|0,0)}function Su(_){return _=_|0,Q(8)|0?1:(j(u(d+1|0)|0,u(d+3|0)|0,u(d+5|0)|0,u(d+7|0)|0),d=d+9|0,0)}function Bu(_){return _=_|0,E(),d=d+1|0,0}function Oe(_){_=_|0;var ye=0;return ye=_-160|0,Q(ye|0)|0?1:(fe(ye|0),d=d+1|0,0)}function Tu(_){return _=_|0,Q(1)|0?1:(fe(i[d+1|0]|0),d=d+2|0,0)}function Nu(_){return _=_|0,Q(2)|0?1:(fe(u(d+1|0)|0),d=d+3|0,0)}function Ru(_){return _=_|0,Q(4)|0?1:(re(u(d+1|0)|0,u(d+3|0)|0),d=d+5|0,0)}function Ou(_){return _=_|0,Q(8)|0?1:(te(u(d+1|0)|0,u(d+3|0)|0,u(d+5|0)|0,u(d+7|0)|0),d=d+9|0,0)}function Uu(_){return _=_|0,k(),d=d+1|0,0}function Fr(_){return _=_|0,$(_-192|0|0),d=d+1|0,0}function wh(_){return _=_|0,$(_|0),d=d+1|0,0}function bh(_){return _=_|0,$(_|0),d=d+1|0,0}function xh(_){return _=_|0,$(_|0),d=d+1|0,0}function _h(_){return _=_|0,$(_|0),d=d+1|0,0}function Ye(_){return _=_|0,$(_-192|0|0),d=d+1|0,0}function Eh(_){return _=_|0,$(_|0),d=d+1|0,0}function vh(_){return _=_|0,$(_|0),d=d+1|0,0}function Ih(_){return _=_|0,$(_|0),d=d+1|0,0}function Fu(_){return _=_|0,Q(1)|0?1:($(i[d+1|0]|0),d=d+2|0,0)}function Pu(_){return _=_|0,Q(2)|0?1:($(u(d+1|0)|0),d=d+3|0,0)}function Lu(_){return _=_|0,Q(4)|0?1:(Z(u(d+1|0)|0,u(d+3|0)|0),d=d+5|0,0)}function Mu(_){return _=_|0,Q(8)|0?1:(ue(u(d+1|0)|0,u(d+3|0)|0,u(d+5|0)|0,u(d+7|0)|0),d=d+9|0,0)}function qe(_){return _=_|0,P((_|0)-224|0),d=d+1|0,0}function Du(_){return _=_|0,f(),d=d+1|0,0}function ku(_){return _=_|0,x(),d=d+1|0,0}function qu(_){return _=_|0,T(),d=d+1|0,0}function Cu(_){return _=_|0,N(),d=d+1|0,0}function $u(_){return _=_|0,Q(1)|0?1:(P(i[d+1|0]|0),d=d+2|0,0)}function Hu(_){_=_|0;var ye=0,we=0,pe=1,Ln=0,tn=0,Ah=0;return Q(2)|0?1:(ye=i[d+1|0]|0,we=i[d+2|0]|0,(ye|0)&128&&(pe=-1),Ln=+(((ye|0)&124)>>2),tn=+(((ye|0)&3)<<8|we),+Ln==0?p(+(+pe*5960464477539063e-23*+tn)):+Ln==31?+pe==1?+tn>0?D():O():+tn>0?K():H():p(+(+pe*U(2,+(+Ln-25))*+(1024+tn))),d=d+3|0,0)}function Gu(_){return _=_|0,Q(4)|0?1:(g(i[d+1|0]|0,i[d+2|0]|0,i[d+3|0]|0,i[d+4|0]|0),d=d+5|0,0)}function Vu(_){return _=_|0,Q(8)|0?1:(w(i[d+1|0]|0,i[d+2|0]|0,i[d+3|0]|0,i[d+4|0]|0,i[d+5|0]|0,i[d+6|0]|0,i[d+7|0]|0,i[d+8|0]|0),d=d+9|0,0)}function ve(_){return _=_|0,1}function ju(_){return _=_|0,Y(),d=d+1|0,0}var Yu=[m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,S,v,A,M,ve,ve,ve,ve,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,B,L,R,V,ve,ve,ve,ve,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,ie,de,Ee,Ne,ve,ve,ve,he,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,ke,Qt,mr,gr,ve,ve,ve,pt,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,ot,We,Re,Su,ve,ve,ve,Bu,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Tu,Nu,Ru,Ou,ve,ve,ve,Uu,Fr,Fr,Fr,Fr,Fr,Fr,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Fu,Pu,Lu,Mu,ve,ve,ve,ve,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,Du,ku,qu,Cu,$u,Hu,Gu,Vu,ve,ve,ve,ju];return{parse:ae}}});var un=ze(ft=>{"use strict";var vs=cn().BigNumber;ft.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7};ft.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36};ft.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31};ft.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23};ft.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")};ft.SHIFT32=Math.pow(2,32);ft.SHIFT16=Math.pow(2,16);ft.MAX_SAFE_HIGH=2097151;ft.NEG_ONE=new vs(-1);ft.TEN=new vs(10);ft.TWO=new vs(2);ft.PARENT={ARRAY:0,OBJECT:1,MAP:2,TAG:3,BYTE_STRING:4,UTF8_STRING:5}});var Xn=ze(gt=>{"use strict";var{Buffer:$f}=an(),wa=cn().BigNumber,ba=un(),ya=ba.SHIFT32,Hf=ba.SHIFT16,Gf=2097151;gt.parseHalf=function(e){var t,n,i;return i=e[0]&128?-1:1,t=(e[0]&124)>>2,n=(e[0]&3)<<8|e[1],t?t===31?i*(n?NaN:1/0):i*Math.pow(2,t-25)*(1024+n):i*5960464477539063e-23*n};function Vf(r){return r<16?"0"+r.toString(16):r.toString(16)}gt.arrayBufferToBignumber=function(r){let e=r.byteLength,t="";for(let n=0;n<e;n++)t+=Vf(r[n]);return new wa(t,16)};gt.buildMap=r=>{let e=new Map,t=Object.keys(r),n=t.length;for(let i=0;i<n;i++)e.set(t[i],r[t[i]]);return e};gt.buildInt32=(r,e)=>r*Hf+e;gt.buildInt64=(r,e,t,n)=>{let i=gt.buildInt32(r,e),s=gt.buildInt32(t,n);return i>Gf?new wa(i).times(ya).plus(s):i*ya+s};gt.writeHalf=function(e,t){let n=$f.allocUnsafe(4);n.writeFloatBE(t,0);let i=n.readUInt32BE(0);if(i&8191)return!1;var s=i>>16&32768;let o=i>>23&255,c=i&8388607;if(o>=113&&o<=142)s+=(o-112<<10)+(c>>13);else if(o>=103&&o<113){if(c&(1<<126-o)-1)return!1;s+=c+8388608>>126-o}else return!1;return e.writeUInt16BE(s,0),!0};gt.keySorter=function(r,e){var t=r[0].byteLength,n=e[0].byteLength;return t>n?1:n>t?-1:r[0].compare(e[0])};gt.isNegativeZero=r=>r===0&&1/r<0;gt.nextPowerOf2=r=>{let e=0;if(r&&!(r&r-1))return r;for(;r!==0;)r>>=1,e+=1;return 1<<e}});var Bs=ze((sd,xa)=>{"use strict";var Ss=un(),jf=Ss.MT,Qn=Ss.SIMPLE,Is=Ss.SYMS,As=class r{constructor(e){if(typeof e!="number")throw new Error("Invalid Simple type: "+typeof e);if(e<0||e>255||(e|0)!==e)throw new Error("value must be a small positive integer: "+e);this.value=e}toString(){return"simple("+this.value+")"}inspect(){return"simple("+this.value+")"}encodeCBOR(e){return e._pushInt(this.value,jf.SIMPLE_FLOAT)}static isSimple(e){return e instanceof r}static decode(e,t){switch(t==null&&(t=!0),e){case Qn.FALSE:return!1;case Qn.TRUE:return!0;case Qn.NULL:return t?null:Is.NULL;case Qn.UNDEFINED:return t?void 0:Is.UNDEFINED;case-1:if(!t)throw new Error("Invalid BREAK");return Is.BREAK;default:return new r(e)}}};xa.exports=As});var Ns=ze((od,_a)=>{"use strict";var Ts=class r{constructor(e,t,n){if(this.tag=e,this.value=t,this.err=n,typeof this.tag!="number")throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(this.tag|0)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(e){return e._pushTag(this.tag),e.pushAny(this.value)}convert(e){var t,n;if(n=e?.[this.tag],typeof n!="function"&&(n=r["_tag"+this.tag],typeof n!="function"))return this;try{return n.call(r,this.value)}catch(i){return t=i,this.err=t,this}}};_a.exports=Ts});var Us=ze((ad,va)=>{"use strict";var Ea=self.location?self.location.protocol+"//"+self.location.host:"",Rs=self.URL,Os=class{constructor(e="",t=Ea){this.super=new Rs(e,t),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set origin(e){this.super.origin=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set searchParams(e){this.super.searchParams=e}set username(e){this.super.username=e}createObjectURL(e){return this.super.createObjectURL(e)}revokeObjectURL(e){this.super.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}};function Yf(r){if(typeof r=="string")return new Rs(r).toString();if(!(r instanceof Rs)){let e=r.username&&r.password?`${r.username}:${r.password}@`:"",t=r.auth?r.auth+"@":"",n=r.port?":"+r.port:"",i=r.protocol?r.protocol+"//":"",s=r.host||"",o=r.hostname||"",c=r.search||(r.query?"?"+r.query:""),a=r.hash||"",h=r.pathname||"",p=r.path||h+c;return`${i}${e||t}${s||o+n}${p}${a}`}}va.exports={URLWithLegacySupport:Os,URLSearchParams:self.URLSearchParams,defaultBase:Ea,format:Yf}});var Sa=ze((cd,Aa)=>{"use strict";var{URLWithLegacySupport:Ia,format:zf}=Us();Aa.exports=(r,e={},t={},n)=>{let i=e.protocol?e.protocol.replace(":",""):"http";i=(t[i]||n||i)+":";let s;try{s=new Ia(r)}catch{s={}}let o=Object.assign({},e,{protocol:i||s.protocol,host:e.host||s.host});return new Ia(r,zf(o)).toString()}});var Fs=ze((ud,Ba)=>{"use strict";var{URLWithLegacySupport:Kf,format:Zf,URLSearchParams:Wf,defaultBase:Xf}=Us(),Qf=Sa();Ba.exports={URL:Kf,URLSearchParams:Wf,format:Zf,relative:Qf,defaultBase:Xf}});var Ps=ze((fd,Na)=>{"use strict";var{Buffer:Mr}=an(),Ta=da(),Jf=cn().BigNumber,e0=ga(),nt=Xn(),_e=un(),t0=Bs(),r0=Ns(),{URL:n0}=Fs(),fn=class r{constructor(e){e=e||{},!e.size||e.size<65536?e.size=65536:e.size=nt.nextPowerOf2(e.size),this._heap=new ArrayBuffer(e.size),this._heap8=new Uint8Array(this._heap),this._buffer=Mr.from(this._heap),this._reset(),this._knownTags=Object.assign({0:t=>new Date(t),1:t=>new Date(t*1e3),2:t=>nt.arrayBufferToBignumber(t),3:t=>_e.NEG_ONE.minus(nt.arrayBufferToBignumber(t)),4:t=>_e.TEN.pow(t[0]).times(t[1]),5:t=>_e.TWO.pow(t[0]).times(t[1]),32:t=>new n0(t),35:t=>new RegExp(t)},e.tags),this.parser=e0(globalThis,{log:console.log.bind(console),pushInt:this.pushInt.bind(this),pushInt32:this.pushInt32.bind(this),pushInt32Neg:this.pushInt32Neg.bind(this),pushInt64:this.pushInt64.bind(this),pushInt64Neg:this.pushInt64Neg.bind(this),pushFloat:this.pushFloat.bind(this),pushFloatSingle:this.pushFloatSingle.bind(this),pushFloatDouble:this.pushFloatDouble.bind(this),pushTrue:this.pushTrue.bind(this),pushFalse:this.pushFalse.bind(this),pushUndefined:this.pushUndefined.bind(this),pushNull:this.pushNull.bind(this),pushInfinity:this.pushInfinity.bind(this),pushInfinityNeg:this.pushInfinityNeg.bind(this),pushNaN:this.pushNaN.bind(this),pushNaNNeg:this.pushNaNNeg.bind(this),pushArrayStart:this.pushArrayStart.bind(this),pushArrayStartFixed:this.pushArrayStartFixed.bind(this),pushArrayStartFixed32:this.pushArrayStartFixed32.bind(this),pushArrayStartFixed64:this.pushArrayStartFixed64.bind(this),pushObjectStart:this.pushObjectStart.bind(this),pushObjectStartFixed:this.pushObjectStartFixed.bind(this),pushObjectStartFixed32:this.pushObjectStartFixed32.bind(this),pushObjectStartFixed64:this.pushObjectStartFixed64.bind(this),pushByteString:this.pushByteString.bind(this),pushByteStringStart:this.pushByteStringStart.bind(this),pushUtf8String:this.pushUtf8String.bind(this),pushUtf8StringStart:this.pushUtf8StringStart.bind(this),pushSimpleUnassigned:this.pushSimpleUnassigned.bind(this),pushTagUnassigned:this.pushTagUnassigned.bind(this),pushTagStart:this.pushTagStart.bind(this),pushTagStart4:this.pushTagStart4.bind(this),pushTagStart8:this.pushTagStart8.bind(this),pushBreak:this.pushBreak.bind(this)},this._heap)}get _depth(){return this._parents.length}get _currentParent(){return this._parents[this._depth-1]}get _ref(){return this._currentParent.ref}_closeParent(){var e=this._parents.pop();if(e.length>0)throw new Error(`Missing ${e.length} elements`);switch(e.type){case _e.PARENT.TAG:this._push(this.createTag(e.ref[0],e.ref[1]));break;case _e.PARENT.BYTE_STRING:this._push(this.createByteString(e.ref,e.length));break;case _e.PARENT.UTF8_STRING:this._push(this.createUtf8String(e.ref,e.length));break;case _e.PARENT.MAP:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createMap(e.ref,e.length));break;case _e.PARENT.OBJECT:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createObject(e.ref,e.length));break;case _e.PARENT.ARRAY:this._push(this.createArray(e.ref,e.length));break;default:break}this._currentParent&&this._currentParent.type===_e.PARENT.TAG&&this._dec()}_dec(){let e=this._currentParent;e.length<0||(e.length--,e.length===0&&this._closeParent())}_push(e,t){let n=this._currentParent;switch(n.values++,n.type){case _e.PARENT.ARRAY:case _e.PARENT.BYTE_STRING:case _e.PARENT.UTF8_STRING:n.length>-1?this._ref[this._ref.length-n.length]=e:this._ref.push(e),this._dec();break;case _e.PARENT.OBJECT:n.tmpKey!=null?(this._ref[n.tmpKey]=e,n.tmpKey=null,this._dec()):(n.tmpKey=e,typeof n.tmpKey!="string"&&(n.type=_e.PARENT.MAP,n.ref=nt.buildMap(n.ref)));break;case _e.PARENT.MAP:n.tmpKey!=null?(this._ref.set(n.tmpKey,e),n.tmpKey=null,this._dec()):n.tmpKey=e;break;case _e.PARENT.TAG:this._ref.push(e),t||this._dec();break;default:throw new Error("Unknown parent type")}}_createParent(e,t,n){this._parents[this._depth]={type:t,length:n,ref:e,values:0,tmpKey:null}}_reset(){this._res=[],this._parents=[{type:_e.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}createTag(e,t){let n=this._knownTags[e];return n?n(t):new r0(e,t)}createMap(e,t){return e}createObject(e,t){return e}createArray(e,t){return e}createByteString(e,t){return Mr.concat(e)}createByteStringFromHeap(e,t){return e===t?Mr.alloc(0):Mr.from(this._heap.slice(e,t))}createInt(e){return e}createInt32(e,t){return nt.buildInt32(e,t)}createInt64(e,t,n,i){return nt.buildInt64(e,t,n,i)}createFloat(e){return e}createFloatSingle(e,t,n,i){return Ta.read([e,t,n,i],0,!1,23,4)}createFloatDouble(e,t,n,i,s,o,c,a){return Ta.read([e,t,n,i,s,o,c,a],0,!1,52,8)}createInt32Neg(e,t){return-1-nt.buildInt32(e,t)}createInt64Neg(e,t,n,i){let s=nt.buildInt32(e,t),o=nt.buildInt32(n,i);return s>_e.MAX_SAFE_HIGH?_e.NEG_ONE.minus(new Jf(s).times(_e.SHIFT32).plus(o)):-1-(s*_e.SHIFT32+o)}createTrue(){return!0}createFalse(){return!1}createNull(){return null}createUndefined(){}createInfinity(){return 1/0}createInfinityNeg(){return-1/0}createNaN(){return NaN}createNaNNeg(){return NaN}createUtf8String(e,t){return e.join("")}createUtf8StringFromHeap(e,t){return e===t?"":this._buffer.toString("utf8",e,t)}createSimpleUnassigned(e){return new t0(e)}pushInt(e){this._push(this.createInt(e))}pushInt32(e,t){this._push(this.createInt32(e,t))}pushInt64(e,t,n,i){this._push(this.createInt64(e,t,n,i))}pushFloat(e){this._push(this.createFloat(e))}pushFloatSingle(e,t,n,i){this._push(this.createFloatSingle(e,t,n,i))}pushFloatDouble(e,t,n,i,s,o,c,a){this._push(this.createFloatDouble(e,t,n,i,s,o,c,a))}pushInt32Neg(e,t){this._push(this.createInt32Neg(e,t))}pushInt64Neg(e,t,n,i){this._push(this.createInt64Neg(e,t,n,i))}pushTrue(){this._push(this.createTrue())}pushFalse(){this._push(this.createFalse())}pushNull(){this._push(this.createNull())}pushUndefined(){this._push(this.createUndefined())}pushInfinity(){this._push(this.createInfinity())}pushInfinityNeg(){this._push(this.createInfinityNeg())}pushNaN(){this._push(this.createNaN())}pushNaNNeg(){this._push(this.createNaNNeg())}pushArrayStart(){this._createParent([],_e.PARENT.ARRAY,-1)}pushArrayStartFixed(e){this._createArrayStartFixed(e)}pushArrayStartFixed32(e,t){let n=nt.buildInt32(e,t);this._createArrayStartFixed(n)}pushArrayStartFixed64(e,t,n,i){let s=nt.buildInt64(e,t,n,i);this._createArrayStartFixed(s)}pushObjectStart(){this._createObjectStartFixed(-1)}pushObjectStartFixed(e){this._createObjectStartFixed(e)}pushObjectStartFixed32(e,t){let n=nt.buildInt32(e,t);this._createObjectStartFixed(n)}pushObjectStartFixed64(e,t,n,i){let s=nt.buildInt64(e,t,n,i);this._createObjectStartFixed(s)}pushByteStringStart(){this._parents[this._depth]={type:_e.PARENT.BYTE_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushByteString(e,t){this._push(this.createByteStringFromHeap(e,t))}pushUtf8StringStart(){this._parents[this._depth]={type:_e.PARENT.UTF8_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushUtf8String(e,t){this._push(this.createUtf8StringFromHeap(e,t))}pushSimpleUnassigned(e){this._push(this.createSimpleUnassigned(e))}pushTagStart(e){this._parents[this._depth]={type:_e.PARENT.TAG,length:1,ref:[e]}}pushTagStart4(e,t){this.pushTagStart(nt.buildInt32(e,t))}pushTagStart8(e,t,n,i){this.pushTagStart(nt.buildInt64(e,t,n,i))}pushTagUnassigned(e){this._push(this.createTag(e))}pushBreak(){if(this._currentParent.length>-1)throw new Error("Unexpected break");this._closeParent()}_createObjectStartFixed(e){if(e===0){this._push(this.createObject({}));return}this._createParent({},_e.PARENT.OBJECT,e)}_createArrayStartFixed(e){if(e===0){this._push(this.createArray([]));return}this._createParent(new Array(e),_e.PARENT.ARRAY,e)}_decode(e){if(e.byteLength===0)throw new Error("Input too short");this._reset(),this._heap8.set(e);let t=this.parser.parse(e.byteLength);if(this._depth>1){for(;this._currentParent.length===0;)this._closeParent();if(this._depth>1)throw new Error("Undeterminated nesting")}if(t>0)throw new Error("Failed to parse");if(this._res.length===0)throw new Error("No valid result")}decodeFirst(e){return this._decode(e),this._res[0]}decodeAll(e){return this._decode(e),this._res}static decode(e,t){return typeof e=="string"&&(e=Mr.from(e,t||"hex")),new r({size:e.length}).decodeFirst(e)}static decodeAll(e,t){return typeof e=="string"&&(e=Mr.from(e,t||"hex")),new r({size:e.length}).decodeAll(e)}};fn.decodeFirst=fn.decode;Na.exports=fn});var Ua=ze((ld,Oa)=>{"use strict";var{Buffer:Ls}=an(),i0=Ps(),s0=Xn(),Ms=class r extends i0{createTag(e,t){return`${e}(${t})`}createInt(e){return super.createInt(e).toString()}createInt32(e,t){return super.createInt32(e,t).toString()}createInt64(e,t,n,i){return super.createInt64(e,t,n,i).toString()}createInt32Neg(e,t){return super.createInt32Neg(e,t).toString()}createInt64Neg(e,t,n,i){return super.createInt64Neg(e,t,n,i).toString()}createTrue(){return"true"}createFalse(){return"false"}createFloat(e){let t=super.createFloat(e);return s0.isNegativeZero(e)?"-0_1":`${t}_1`}createFloatSingle(e,t,n,i){return`${super.createFloatSingle(e,t,n,i)}_2`}createFloatDouble(e,t,n,i,s,o,c,a){return`${super.createFloatDouble(e,t,n,i,s,o,c,a)}_3`}createByteString(e,t){let n=e.join(", ");return t===-1?`(_ ${n})`:`h'${n}`}createByteStringFromHeap(e,t){return`h'${Ls.from(super.createByteStringFromHeap(e,t)).toString("hex")}'`}createInfinity(){return"Infinity_1"}createInfinityNeg(){return"-Infinity_1"}createNaN(){return"NaN_1"}createNaNNeg(){return"-NaN_1"}createNull(){return"null"}createUndefined(){return"undefined"}createSimpleUnassigned(e){return`simple(${e})`}createArray(e,t){let n=super.createArray(e,t);return t===-1?`[_ ${n.join(", ")}]`:`[${n.join(", ")}]`}createMap(e,t){let n=super.createMap(e),i=Array.from(n.keys()).reduce(Ra(n),"");return t===-1?`{_ ${i}}`:`{${i}}`}createObject(e,t){let n=super.createObject(e),i=Object.keys(n).reduce(Ra(n),"");return t===-1?`{_ ${i}}`:`{${i}}`}createUtf8String(e,t){let n=e.join(", ");return t===-1?`(_ ${n})`:`"${n}"`}createUtf8StringFromHeap(e,t){return`"${Ls.from(super.createUtf8StringFromHeap(e,t)).toString("utf8")}"`}static diagnose(e,t){return typeof e=="string"&&(e=Ls.from(e,t||"hex")),new r().decodeFirst(e)}};Oa.exports=Ms;function Ra(r){return(e,t)=>e?`${e}, ${t}: ${r[t]}`:`${t}: ${r[t]}`}});var Da=ze((hd,Ma)=>{"use strict";var{Buffer:Lt}=an(),{URL:o0}=Fs(),ks=cn().BigNumber,Ds=Xn(),Ge=un(),xt=Ge.MT,Jn=Ge.NUMBYTES,Fa=Ge.SHIFT32,Pa=Ge.SYMS,Dr=Ge.TAG,a0=Ge.MT.SIMPLE_FLOAT<<5|Ge.NUMBYTES.TWO,c0=Ge.MT.SIMPLE_FLOAT<<5|Ge.NUMBYTES.FOUR,u0=Ge.MT.SIMPLE_FLOAT<<5|Ge.NUMBYTES.EIGHT,f0=Ge.MT.SIMPLE_FLOAT<<5|Ge.SIMPLE.TRUE,l0=Ge.MT.SIMPLE_FLOAT<<5|Ge.SIMPLE.FALSE,h0=Ge.MT.SIMPLE_FLOAT<<5|Ge.SIMPLE.UNDEFINED,La=Ge.MT.SIMPLE_FLOAT<<5|Ge.SIMPLE.NULL,d0=new ks("0x20000000000000"),p0=Lt.from("f97e00","hex"),m0=Lt.from("f9fc00","hex"),g0=Lt.from("f97c00","hex");function y0(r){return{}.toString.call(r).slice(8,-1)}var qs=class r{constructor(e){e=e||{},this.streaming=typeof e.stream=="function",this.onData=e.stream,this.semanticTypes=[[o0,this._pushUrl],[ks,this._pushBigNumber]];let t=e.genTypes||[],n=t.length;for(let i=0;i<n;i++)this.addSemanticType(t[i][0],t[i][1]);this._reset()}addSemanticType(e,t){let n=this.semanticTypes.length;for(let i=0;i<n;i++)if(this.semanticTypes[i][0]===e){let o=this.semanticTypes[i][1];return this.semanticTypes[i][1]=t,o}return this.semanticTypes.push([e,t]),null}push(e){return e&&(this.result[this.offset]=e,this.resultMethod[this.offset]=0,this.resultLength[this.offset]=e.length,this.offset++,this.streaming&&this.onData(this.finalize())),!0}pushWrite(e,t,n){return this.result[this.offset]=e,this.resultMethod[this.offset]=t,this.resultLength[this.offset]=n,this.offset++,this.streaming&&this.onData(this.finalize()),!0}_pushUInt8(e){return this.pushWrite(e,1,1)}_pushUInt16BE(e){return this.pushWrite(e,2,2)}_pushUInt32BE(e){return this.pushWrite(e,3,4)}_pushDoubleBE(e){return this.pushWrite(e,4,8)}_pushNaN(){return this.push(p0)}_pushInfinity(e){let t=e<0?m0:g0;return this.push(t)}_pushFloat(e){let t=Lt.allocUnsafe(2);if(Ds.writeHalf(t,e)&&Ds.parseHalf(t)===e)return this._pushUInt8(a0)&&this.push(t);let n=Lt.allocUnsafe(4);return n.writeFloatBE(e,0),n.readFloatBE(0)===e?this._pushUInt8(c0)&&this.push(n):this._pushUInt8(u0)&&this._pushDoubleBE(e)}_pushInt(e,t,n){let i=t<<5;return e<24?this._pushUInt8(i|e):e<=255?this._pushUInt8(i|Jn.ONE)&&this._pushUInt8(e):e<=65535?this._pushUInt8(i|Jn.TWO)&&this._pushUInt16BE(e):e<=4294967295?this._pushUInt8(i|Jn.FOUR)&&this._pushUInt32BE(e):e<=Number.MAX_SAFE_INTEGER?this._pushUInt8(i|Jn.EIGHT)&&this._pushUInt32BE(Math.floor(e/Fa))&&this._pushUInt32BE(e%Fa):t===xt.NEG_INT?this._pushFloat(n):this._pushFloat(e)}_pushIntNum(e){return e<0?this._pushInt(-e-1,xt.NEG_INT,e):this._pushInt(e,xt.POS_INT)}_pushNumber(e){switch(!1){case e===e:return this._pushNaN(e);case isFinite(e):return this._pushInfinity(e);case e%1!==0:return this._pushIntNum(e);default:return this._pushFloat(e)}}_pushString(e){let t=Lt.byteLength(e,"utf8");return this._pushInt(t,xt.UTF8_STRING)&&this.pushWrite(e,5,t)}_pushBoolean(e){return this._pushUInt8(e?f0:l0)}_pushUndefined(e){return this._pushUInt8(h0)}_pushArray(e,t){let n=t.length;if(!e._pushInt(n,xt.ARRAY))return!1;for(let i=0;i<n;i++)if(!e.pushAny(t[i]))return!1;return!0}_pushTag(e){return this._pushInt(e,xt.TAG)}_pushDate(e,t){return e._pushTag(Dr.DATE_EPOCH)&&e.pushAny(Math.round(t/1e3))}_pushBuffer(e,t){return e._pushInt(t.length,xt.BYTE_STRING)&&e.push(t)}_pushNoFilter(e,t){return e._pushBuffer(e,t.slice())}_pushRegexp(e,t){return e._pushTag(Dr.REGEXP)&&e.pushAny(t.source)}_pushSet(e,t){if(!e._pushInt(t.size,xt.ARRAY))return!1;for(let n of t)if(!e.pushAny(n))return!1;return!0}_pushUrl(e,t){return e._pushTag(Dr.URI)&&e.pushAny(t.format())}_pushBigint(e){let t=Dr.POS_BIGINT;e.isNegative()&&(e=e.negated().minus(1),t=Dr.NEG_BIGINT);let n=e.toString(16);n.length%2&&(n="0"+n);let i=Lt.from(n,"hex");return this._pushTag(t)&&this._pushBuffer(this,i)}_pushBigNumber(e,t){if(t.isNaN())return e._pushNaN();if(!t.isFinite())return e._pushInfinity(t.isNegative()?-1/0:1/0);if(t.isInteger())return e._pushBigint(t);if(!(e._pushTag(Dr.DECIMAL_FRAC)&&e._pushInt(2,xt.ARRAY)))return!1;let n=t.decimalPlaces(),i=t.multipliedBy(new ks(10).pow(n));return e._pushIntNum(-n)?i.abs().isLessThan(d0)?e._pushIntNum(i.toNumber()):e._pushBigint(i):!1}_pushMap(e,t){return e._pushInt(t.size,xt.MAP)?this._pushRawMap(t.size,Array.from(t)):!1}_pushObject(e){if(!e)return this._pushUInt8(La);for(var t=this.semanticTypes.length,n=0;n<t;n++)if(e instanceof this.semanticTypes[n][0])return this.semanticTypes[n][1].call(e,this,e);var i=e.encodeCBOR;if(typeof i=="function")return i.call(e,this);var s=Object.keys(e),o=s.length;return this._pushInt(o,xt.MAP)?this._pushRawMap(o,s.map(c=>[c,e[c]])):!1}_pushRawMap(e,t){t=t.map(function(i){return i[0]=r.encode(i[0]),i}).sort(Ds.keySorter);for(var n=0;n<e;n++)if(!this.push(t[n][0])||!this.pushAny(t[n][1]))return!1;return!0}write(e){return this.pushAny(e)}pushAny(e){var t=y0(e);switch(t){case"Number":return this._pushNumber(e);case"String":return this._pushString(e);case"Boolean":return this._pushBoolean(e);case"Object":return this._pushObject(e);case"Array":return this._pushArray(this,e);case"Uint8Array":return this._pushBuffer(this,Lt.isBuffer(e)?e:Lt.from(e));case"Null":return this._pushUInt8(La);case"Undefined":return this._pushUndefined(e);case"Map":return this._pushMap(this,e);case"Set":return this._pushSet(this,e);case"URL":return this._pushUrl(this,e);case"BigNumber":return this._pushBigNumber(this,e);case"Date":return this._pushDate(this,e);case"RegExp":return this._pushRegexp(this,e);case"Symbol":switch(e){case Pa.NULL:return this._pushObject(null);case Pa.UNDEFINED:return this._pushUndefined(void 0);default:throw new Error("Unknown symbol: "+e.toString())}default:throw new Error("Unknown type: "+typeof e+", "+(e?e.toString():""))}}finalize(){if(this.offset===0)return null;for(var e=this.result,t=this.resultLength,n=this.resultMethod,i=this.offset,s=0,o=0;o<i;o++)s+=t[o];var c=Lt.allocUnsafe(s),a=0,h=0;for(o=0;o<i;o++){switch(h=t[o],n[o]){case 0:e[o].copy(c,a);break;case 1:c.writeUInt8(e[o],a,!0);break;case 2:c.writeUInt16BE(e[o],a,!0);break;case 3:c.writeUInt32BE(e[o],a,!0);break;case 4:c.writeDoubleBE(e[o],a,!0);break;case 5:c.write(e[o],a,h,"utf8");break;default:throw new Error("unkown method")}a+=h}var p=c;return this._reset(),p}_reset(){this.result=[],this.resultMethod=[],this.resultLength=[],this.offset=0}static encode(e){let t=new r;if(!t.pushAny(e))throw new Error("Failed to encode input");return t.finalize()}};Ma.exports=qs});var Cs=ze(Ve=>{"use strict";Ve.Diagnose=Ua();Ve.Decoder=Ps();Ve.Encoder=Da();Ve.Simple=Bs();Ve.Tagged=Ns();Ve.decodeAll=Ve.Decoder.decodeAll;Ve.decodeFirst=Ve.Decoder.decodeFirst;Ve.diagnose=Ve.Diagnose.diagnose;Ve.encode=Ve.Encoder.encode;Ve.decode=Ve.Decoder.decode;Ve.leveldb={decode:Ve.Decoder.decodeAll,encode:Ve.Encoder.encode,buffer:!0,name:"cbor"}});var Gs=ze(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});var w0=9007199254740992;function Gt(r,...e){let t=new Uint8Array(r.byteLength+e.reduce((i,s)=>i+s.byteLength,0));t.set(new Uint8Array(r),0);let n=r.byteLength;for(let i of e)t.set(new Uint8Array(i),n),n+=i.byteLength;return t.buffer}function _t(r,e,t){t=t.replace(/[^0-9a-fA-F]/g,"");let n=2**(e-24);t=t.slice(-n*2).padStart(n*2,"0");let i=[(r<<5)+e].concat(t.match(/../g).map(s=>parseInt(s,16)));return new Uint8Array(i).buffer}function ei(r,e){if(e<24)return new Uint8Array([(r<<5)+e]).buffer;{let t=e<=255?24:e<=65535?25:e<=4294967295?26:27;return _t(r,t,e.toString(16))}}function ka(r){let e=[];for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);n<128?e.push(n):n<2048?e.push(192|n>>6,128|n&63):n<55296||n>=57344?e.push(224|n>>12,128|n>>6&63,128|n&63):(t++,n=(n&1023)<<10|r.charCodeAt(t)&1023,e.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|n&63))}return Gt(new Uint8Array(ei(3,r.length)),new Uint8Array(e))}function b0(r,e){if(r==14277111)return Gt(new Uint8Array([217,217,247]),e);if(r<24)return Gt(new Uint8Array([192+r]),e);{let t=r<=255?24:r<=65535?25:r<=4294967295?26:27,n=2**(t-24),i=r.toString(16).slice(-n*2).padStart(n*2,"0"),s=[192+t].concat(i.match(/../g).map(o=>parseInt(o,16)));return new Uint8Array(s).buffer}}Ae.tagged=b0;function ln(r){return new Uint8Array(r).buffer}Ae.raw=ln;function $s(r){if(isNaN(r))throw new RangeError("Invalid number.");r=Math.min(Math.max(0,r),23);let e=[0+r];return new Uint8Array(e).buffer}Ae.uSmall=$s;function qa(r,e){if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),255),r=r.toString(16),_t(0,24,r)}Ae.u8=qa;function Ca(r,e){if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),65535),r=r.toString(16),_t(0,25,r)}Ae.u16=Ca;function $a(r,e){if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),4294967295),r=r.toString(16),_t(0,26,r)}Ae.u32=$a;function Hs(r,e){if(typeof r=="string"&&e==16){if(r.match(/[^0-9a-fA-F]/))throw new RangeError("Invalid number.");return _t(0,27,r)}if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),w0),r=r.toString(16),_t(0,27,r)}Ae.u64=Hs;function Ha(r){if(isNaN(r))throw new RangeError("Invalid number.");if(r===0)return $s(0);r=Math.min(Math.max(0,-r),24)-1;let e=[32+r];return new Uint8Array(e).buffer}Ae.iSmall=Ha;function Ga(r,e){if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),255),r=r.toString(16),_t(1,24,r)}Ae.i8=Ga;function Va(r,e){if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),65535),r=r.toString(16),_t(1,25,r)}Ae.i16=Va;function ja(r,e){if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),4294967295),r=r.toString(16),_t(1,26,r)}Ae.i32=ja;function Ya(r,e){if(typeof r=="string"&&e==16){if(r.startsWith("-")?r=r.slice(1):r="0",r.match(/[^0-9a-fA-F]/)||r.length>16)throw new RangeError("Invalid number.");let t=!1,n=r.split("").reduceRight((i,s)=>{if(t)return s+i;let o=parseInt(s,16)-1;return o>=0?(t=!0,o.toString(16)+i):"f"+i},"");return t?_t(1,27,n):Hs(0)}if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),9007199254740992),r=r.toString(16),_t(1,27,r)}Ae.i64=Ya;function x0(r){return r>=0?r<24?$s(r):r<=255?qa(r):r<=65535?Ca(r):r<=4294967295?$a(r):Hs(r):r>=-24?Ha(r):r>=-255?Ga(r):r>=-65535?Va(r):r>=-4294967295?ja(r):Ya(r)}Ae.number=x0;function _0(r){return Gt(ei(2,r.byteLength),r)}Ae.bytes=_0;function E0(r){return ka(r)}Ae.string=E0;function v0(r){return Gt(ei(4,r.length),...r)}Ae.array=v0;function I0(r,e=!1){r instanceof Map||(r=new Map(Object.entries(r)));let t=Array.from(r.entries());return e&&(t=t.sort(([n],[i])=>n.localeCompare(i))),Gt(ei(5,r.size),...t.map(([n,i])=>Gt(ka(n),i)))}Ae.map=I0;function A0(r){let e=new Float32Array([r]);return Gt(new Uint8Array([250]),new Uint8Array(e.buffer))}Ae.singleFloat=A0;function S0(r){let e=new Float64Array([r]);return Gt(new Uint8Array([251]),new Uint8Array(e.buffer))}Ae.doubleFloat=S0;function B0(r){return r?za():Ka()}Ae.bool=B0;function za(){return ln(new Uint8Array([245]))}Ae.true_=za;function Ka(){return ln(new Uint8Array([244]))}Ae.false_=Ka;function T0(){return ln(new Uint8Array([246]))}Ae.null_=T0;function N0(){return ln(new Uint8Array([247]))}Ae.undefined_=N0});var Za=ze(tr=>{"use strict";var R0=tr&&tr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e};Object.defineProperty(tr,"__esModule",{value:!0});var Et=R0(Gs()),O0=[ArrayBuffer,Uint8Array,Uint16Array,Uint32Array,Int8Array,Int16Array,Int32Array,Float32Array,Float64Array],ti=class{constructor(e,t=!1){this._serializer=e,this._stable=t,this.name="jsonDefault",this.priority=-100}match(e){return["undefined","boolean","number","string","object"].indexOf(typeof e)!=-1}encode(e){switch(typeof e){case"undefined":return Et.undefined_();case"boolean":return Et.bool(e);case"number":return Math.floor(e)===e?Et.number(e):Et.doubleFloat(e);case"string":return Et.string(e);case"object":if(e===null)return Et.null_();if(Array.isArray(e))return Et.array(e.map(t=>this._serializer.serializeValue(t)));if(O0.find(t=>e instanceof t))return Et.bytes(e.buffer);if(Object.getOwnPropertyNames(e).indexOf("toJSON")!==-1)return this.encode(e.toJSON());if(e instanceof Map){let t=new Map;for(let[n,i]of e.entries())t.set(n,this._serializer.serializeValue(i));return Et.map(t,this._stable)}else{let t=new Map;for(let[n,i]of Object.entries(e))t.set(n,this._serializer.serializeValue(i));return Et.map(t,this._stable)}default:throw new Error("Invalid value.")}}};tr.JsonDefaultCborEncoder=ti;var ri=class{constructor(){this.name="cborEncoder",this.priority=-90}match(e){return typeof e=="object"&&typeof e.toCBOR=="function"}encode(e){return e.toCBOR()}};tr.ToCborEncoder=ri;var ni=class{constructor(){this._encoders=new Set}static withDefaultEncoders(e=!1){let t=new this;return t.addEncoder(new ti(t,e)),t.addEncoder(new ri),t}removeEncoder(e){for(let t of this._encoders.values())t.name==e&&this._encoders.delete(t)}addEncoder(e){this._encoders.add(e)}getEncoderFor(e){let t=null;for(let n of this._encoders)(!t||n.priority>t.priority)&&n.match(e)&&(t=n);if(t===null)throw new Error("Could not find an encoder for value.");return t}serializeValue(e){return this.getEncoderFor(e).encode(e)}serialize(e){return this.serializeValue(e)}};tr.CborSerializer=ni;var Vs=class extends ni{serialize(e){return Et.raw(new Uint8Array([...new Uint8Array([217,217,247]),...new Uint8Array(super.serializeValue(e))]))}};tr.SelfDescribeCborSerializer=Vs});var ii=ze(Er=>{"use strict";function U0(r){for(var e in r)Er.hasOwnProperty(e)||(Er[e]=r[e])}var F0=Er&&Er.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e};Object.defineProperty(Er,"__esModule",{value:!0});U0(Za());var P0=F0(Gs());Er.value=P0});var Dn="abcdefghijklmnopqrstuvwxyz234567",Pr=Object.create(null);for(let r=0;r<Dn.length;r++)Pr[Dn[r]]=r;Pr[0]=Pr.o;Pr[1]=Pr.i;function Mo(r){let e=0,t=0,n="";function i(s){return e<0?t|=s>>-e:t=s<<e&248,e>3?(e-=8,1):(e<4&&(n+=Dn[t>>3],e+=5),0)}for(let s=0;s<r.length;)s+=i(r[s]);return n+(e<0?Dn[t>>3]:"")}function Do(r){let e=0,t=0,n=new Uint8Array(r.length*4/3|0),i=0;function s(o){let c=Pr[o.toLowerCase()];if(c===void 0)throw new Error(`Invalid character: ${JSON.stringify(o)}`);c<<=3,t|=c>>>e,e+=5,e>=8&&(n[i++]=t,e-=8,e>0?t=c<<5-e&255:t=0)}for(let o of r)s(o);return n.slice(0,i)}var ef=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function ko(r){let e=new Uint8Array(r),t=-1;for(let n=0;n<e.length;n++){let s=(e[n]^t)&255;t=ef[s]^t>>>8}return(t^-1)>>>0}function tf(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function ls(r,...e){if(!tf(r))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(r.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${r.length}`)}function hs(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function qo(r,e){ls(r);let t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}var yr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var qn=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),bt=(r,e)=>r<<32-e|r>>>e;var Fh=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Co(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function ds(r){return typeof r=="string"&&(r=Co(r)),ls(r),r}var kn=class{clone(){return this._cloneInto()}},Ph={}.toString;function nn(r){let e=n=>r().update(ds(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}function Cn(r=32){if(yr&&typeof yr.getRandomValues=="function")return yr.getRandomValues(new Uint8Array(r));if(yr&&typeof yr.randomBytes=="function")return yr.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}function rf(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let i=BigInt(32),s=BigInt(4294967295),o=Number(t>>i&s),c=Number(t&s),a=n?4:0,h=n?0:4;r.setUint32(e+a,o,n),r.setUint32(e+h,c,n)}var $o=(r,e,t)=>r&e^~r&t,Ho=(r,e,t)=>r&e^r&t^e&t,Lr=class extends kn{constructor(e,t,n,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=qn(this.buffer)}update(e){hs(this);let{view:t,buffer:n,blockLen:i}=this;e=ds(e);let s=e.length;for(let o=0;o<s;){let c=Math.min(i-this.pos,s-o);if(c===i){let a=qn(e);for(;i<=s-o;o+=i)this.process(a,o);continue}n.set(e.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){hs(this),qo(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:i,isLE:s}=this,{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(n,0),o=0);for(let g=o;g<i;g++)t[g]=0;rf(n,i-8,BigInt(this.length*8),s),this.process(n,0);let c=qn(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let h=a/4,p=this.get();if(h>p.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g<h;g++)c.setUint32(4*g,p[g],s)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:i,finished:s,destroyed:o,pos:c}=this;return e.length=i,e.pos=c,e.finished=s,e.destroyed=o,i%t&&e.buffer.set(n),e}};var nf=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]),Jt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),er=new Uint32Array(64),$n=class extends Lr{constructor(){super(64,32,8,!1),this.A=Jt[0]|0,this.B=Jt[1]|0,this.C=Jt[2]|0,this.D=Jt[3]|0,this.E=Jt[4]|0,this.F=Jt[5]|0,this.G=Jt[6]|0,this.H=Jt[7]|0}get(){let{A:e,B:t,C:n,D:i,E:s,F:o,G:c,H:a}=this;return[e,t,n,i,s,o,c,a]}set(e,t,n,i,s,o,c,a){this.A=e|0,this.B=t|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=a|0}process(e,t){for(let g=0;g<16;g++,t+=4)er[g]=e.getUint32(t,!1);for(let g=16;g<64;g++){let w=er[g-15],x=er[g-2],f=bt(w,7)^bt(w,18)^w>>>3,N=bt(x,17)^bt(x,19)^x>>>10;er[g]=N+er[g-7]+f+er[g-16]|0}let{A:n,B:i,C:s,D:o,E:c,F:a,G:h,H:p}=this;for(let g=0;g<64;g++){let w=bt(c,6)^bt(c,11)^bt(c,25),x=p+w+$o(c,a,h)+nf[g]+er[g]|0,N=(bt(n,2)^bt(n,13)^bt(n,22))+Ho(n,i,s)|0;p=h,h=a,a=c,c=o+x|0,o=s,s=i,i=n,n=x+N|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,a=a+this.F|0,h=h+this.G|0,p=p+this.H|0,this.set(n,i,s,o,c,a,h,p)}roundClean(){er.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},ps=class extends $n{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}},sn=nn(()=>new $n),Go=nn(()=>new ps);function Vo(r){return Go.create().update(new Uint8Array(r)).digest()}var Hn="__principal__",sf=2,jo=4,of="aaaaa-aa",af=r=>{var e;return new Uint8Array(((e=r.match(/.{1,2}/g))!==null&&e!==void 0?e:[]).map(t=>parseInt(t,16)))},cf=r=>r.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),""),me=class r{constructor(e){this._arr=e,this._isPrincipal=!0}static anonymous(){return new this(new Uint8Array([jo]))}static managementCanister(){return this.fromHex(of)}static selfAuthenticating(e){let t=Vo(e);return new this(new Uint8Array([...t,sf]))}static from(e){if(typeof e=="string")return r.fromText(e);if(Object.getPrototypeOf(e)===Uint8Array.prototype)return new r(e);if(typeof e=="object"&&e!==null&&e._isPrincipal===!0)return new r(e._arr);throw new Error(`Impossible to convert ${JSON.stringify(e)} to Principal.`)}static fromHex(e){return new this(af(e))}static fromText(e){let t=e;if(e.includes(Hn)){let o=JSON.parse(e);Hn in o&&(t=o[Hn])}let n=t.toLowerCase().replace(/-/g,""),i=Do(n);i=i.slice(4,i.length);let s=new this(i);if(s.toText()!==t)throw new Error(`Principal "${s.toText()}" does not have a valid checksum (original value "${t}" may not be a valid Principal ID).`);return s}static fromUint8Array(e){return new this(e)}isAnonymous(){return this._arr.byteLength===1&&this._arr[0]===jo}toUint8Array(){return this._arr}toHex(){return cf(this._arr).toUpperCase()}toText(){let e=new ArrayBuffer(4);new DataView(e).setUint32(0,ko(this._arr));let n=new Uint8Array(e),i=Uint8Array.from(this._arr),s=new Uint8Array([...n,...i]),c=Mo(s).match(/.{1,5}/g);if(!c)throw new Error;return c.join("-")}toString(){return this.toText()}toJSON(){return{[Hn]:this.toText()}}compareTo(e){for(let t=0;t<Math.min(this._arr.length,e._arr.length);t++){if(this._arr[t]<e._arr[t])return"lt";if(this._arr[t]>e._arr[t])return"gt"}return this._arr.length<e._arr.length?"lt":this._arr.length>e._arr.length?"gt":"eq"}ltEq(e){let t=this.compareTo(e);return t=="lt"||t=="eq"}gtEq(e){let t=this.compareTo(e);return t=="gt"||t=="eq"}};var ms;(function(r){r[r.SysFatal=1]="SysFatal",r[r.SysTransient=2]="SysTransient",r[r.DestinationInvalid=3]="DestinationInvalid",r[r.CanisterReject=4]="CanisterReject",r[r.CanisterError=5]="CanisterError"})(ms||(ms={}));function Qe(...r){let e=new Uint8Array(r.reduce((n,i)=>n+i.byteLength,0)),t=0;for(let n of r)e.set(new Uint8Array(n),t),t+=n.byteLength;return e.buffer}function Fe(r){return[...new Uint8Array(r)].map(e=>e.toString(16).padStart(2,"0")).join("")}var uf=new RegExp(/^[0-9a-fA-F]+$/);function wr(r){if(!uf.test(r))throw new Error("Invalid hexadecimal string.");let e=[...r].reduce((t,n,i)=>(t[i/2|0]=(t[i/2|0]||"")+n,t),[]).map(t=>Number.parseInt(t,16));return new Uint8Array(e).buffer}function gs(r,e){if(r.byteLength!==e.byteLength)return r.byteLength-e.byteLength;let t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<t.length;i++)if(t[i]!==n[i])return t[i]-n[i];return 0}function br(r,e){return gs(r,e)===0}function on(r){return new DataView(r.buffer,r.byteOffset,r.byteLength).buffer}function ys(r){return r instanceof Uint8Array?on(r):r instanceof ArrayBuffer?r:Array.isArray(r)?on(new Uint8Array(r)):"buffer"in r?ys(r.buffer):on(new Uint8Array(r))}var Ue=class r extends Error{constructor(e){super(e),this.message=e,this.name="AgentError",this.__proto__=r.prototype,Object.setPrototypeOf(this,r.prototype)}};var Xa=rn(Cs()),vr=rn(ii()),Qa=rn(ii());var js=class{get name(){return"Principal"}get priority(){return 0}match(e){return e&&e._isPrincipal===!0}encode(e){return vr.value.bytes(e.toUint8Array())}},Ys=class{get name(){return"Buffer"}get priority(){return 1}match(e){return e instanceof ArrayBuffer||ArrayBuffer.isView(e)}encode(e){return vr.value.bytes(new Uint8Array(e))}},zs=class{get name(){return"BigInt"}get priority(){return 1}match(e){return typeof e=="bigint"}encode(e){return e>BigInt(0)?vr.value.tagged(2,vr.value.bytes(wr(e.toString(16)))):vr.value.tagged(3,vr.value.bytes(wr((BigInt("-1")*e).toString(16))))}},si=Qa.SelfDescribeCborSerializer.withDefaultEncoders(!0);si.addEncoder(new js);si.addEncoder(new Ys);si.addEncoder(new zs);var Ks;(function(r){r[r.Uint64LittleEndian=71]="Uint64LittleEndian",r[r.Semantic=55799]="Semantic"})(Ks||(Ks={}));function oi(r){return si.serialize(r)}function Wa(r){let e=r.byteLength,t=BigInt(0);for(let n=0;n<e;n++)t=t*BigInt(256)+BigInt(r[n]);return t}var Zs=class extends Xa.default.Decoder{createByteString(e){return Qe(...e)}createByteStringFromHeap(e,t){return e===t?new ArrayBuffer(0):new Uint8Array(this._heap.slice(e,t))}};function yt(r){let e=new Uint8Array(r),t=new Zs({size:e.byteLength,tags:{2:n=>Wa(n),3:n=>-Wa(n),[Ks.Semantic]:n=>n}});try{return t.decodeFirst(e)}catch(n){throw new Error(`Failed to decode CBOR: ${n}, input: ${Fe(e)}`)}}var no={};fs(no,{Bool:()=>sc,BoolClass:()=>hi,ConstructType:()=>Dt,Empty:()=>nc,EmptyClass:()=>fi,FixedIntClass:()=>jt,FixedNatClass:()=>Mt,Float32:()=>fc,Float64:()=>lc,FloatClass:()=>dn,Func:()=>Bc,FuncClass:()=>mn,Int:()=>cc,Int16:()=>dc,Int32:()=>pc,Int64:()=>mc,Int8:()=>hc,IntClass:()=>mi,Nat:()=>uc,Nat16:()=>yc,Nat32:()=>wc,Nat64:()=>bc,Nat8:()=>gc,NatClass:()=>gi,Null:()=>oc,NullClass:()=>di,Opt:()=>vc,OptClass:()=>Cr,PrimitiveType:()=>ct,Principal:()=>xc,PrincipalClass:()=>xi,Rec:()=>Sc,RecClass:()=>ir,Record:()=>Ic,RecordClass:()=>pn,Reserved:()=>ic,ReservedClass:()=>qr,Service:()=>Tc,ServiceClass:()=>_i,Text:()=>ac,TextClass:()=>pi,Tuple:()=>_c,TupleClass:()=>wi,Type:()=>kr,Unknown:()=>k0,UnknownClass:()=>li,Variant:()=>Ac,VariantClass:()=>bi,Vec:()=>Ec,VecClass:()=>yi,Visitor:()=>ui,decode:()=>D0,encode:()=>M0});function xe(...r){let e=new Uint8Array(r.reduce((n,i)=>n+i.byteLength,0)),t=0;for(let n of r)e.set(new Uint8Array(n),t),t+=n.byteLength;return e}var vt=class{constructor(e,t=e?.byteLength||0){this._buffer=Qs(e||new ArrayBuffer(0)),this._view=new Uint8Array(this._buffer,0,t)}get buffer(){return Qs(this._view.slice())}get byteLength(){return this._view.byteLength}read(e){let t=this._view.subarray(0,e);return this._view=this._view.subarray(e),t.slice().buffer}readUint8(){let e=this._view[0];return this._view=this._view.subarray(1),e}write(e){let t=new Uint8Array(e),n=this._view.byteLength;this._view.byteOffset+this._view.byteLength+t.byteLength>=this._buffer.byteLength?this.alloc(t.byteLength):this._view=new Uint8Array(this._buffer,this._view.byteOffset,this._view.byteLength+t.byteLength),this._view.set(t,n)}get end(){return this._view.byteLength===0}alloc(e){let t=new ArrayBuffer((this._buffer.byteLength+e)*1.2|0),n=new Uint8Array(t,0,this._view.byteLength+e);n.set(this._view),this._buffer=t,this._view=n}};function Xs(r){return new DataView(r.buffer,r.byteOffset,r.byteLength).buffer}function Qs(r){return r instanceof Uint8Array?Xs(r):r instanceof ArrayBuffer?r:Array.isArray(r)?Xs(new Uint8Array(r)):"buffer"in r?Qs(r.buffer):Xs(new Uint8Array(r))}function L0(r){let t=new TextEncoder().encode(r),n=0;for(let i of t)n=(n*223+i)%2**32;return n}function It(r){if(/^_\d+_$/.test(r)||/^_0x[0-9a-fA-F]+_$/.test(r)){let e=+r.slice(1,-1);if(Number.isSafeInteger(e)&&e>=0&&e<2**32)return e}return L0(r)}function Ja(){throw new Error("unexpected end of buffer")}function nr(r,e){return r.byteLength<e&&Ja(),r.read(e)}function rr(r){let e=r.readUint8();return e===void 0&&Ja(),e}function Be(r){if(typeof r=="number"&&(r=BigInt(r)),r<BigInt(0))throw new Error("Cannot leb encode negative values.");let e=(r===BigInt(0)?0:Math.ceil(Math.log2(Number(r))))+1,t=new vt(new ArrayBuffer(e),0);for(;;){let n=Number(r&BigInt(127));if(r/=BigInt(128),r===BigInt(0)){t.write(new Uint8Array([n]));break}else t.write(new Uint8Array([n|128]))}return t.buffer}function Ce(r){let e=BigInt(1),t=BigInt(0),n;do n=rr(r),t+=BigInt(n&127).valueOf()*e,e*=BigInt(128);while(n>=128);return t}function $e(r){typeof r=="number"&&(r=BigInt(r));let e=r<BigInt(0);e&&(r=-r-BigInt(1));let t=(r===BigInt(0)?0:Math.ceil(Math.log2(Number(r))))+1,n=new vt(new ArrayBuffer(t),0);for(;;){let s=i(r);if(r/=BigInt(128),e&&r===BigInt(0)&&s&64||!e&&r===BigInt(0)&&!(s&64)){n.write(new Uint8Array([s]));break}else n.write(new Uint8Array([s|128]))}function i(s){let o=s%BigInt(128);return Number(e?BigInt(128)-o-BigInt(1):o)}return n.buffer}function Vt(r){let e=new Uint8Array(r.buffer),t=0;for(;t<e.byteLength;t++)if(e[t]<128){if(!(e[t]&64))return Ce(r);break}let n=new Uint8Array(nr(r,t+1)),i=BigInt(0);for(let s=n.byteLength-1;s>=0;s--)i=i*BigInt(128)+BigInt(128-(n[s]&127)-1);return-i-BigInt(1)}function ec(r,e){if(BigInt(r)<BigInt(0))throw new Error("Cannot write negative values.");return Js(r,e)}function Js(r,e){r=BigInt(r);let t=new vt(new ArrayBuffer(Math.min(1,e)),0),n=0,i=BigInt(256),s=BigInt(0),o=Number(r%i);for(t.write(new Uint8Array([o]));++n<e;)r<0&&s===BigInt(0)&&o!==0&&(s=BigInt(1)),o=Number((r/i-s)%BigInt(256)),t.write(new Uint8Array([o])),i*=BigInt(256);return t.buffer}function eo(r,e){let t=BigInt(rr(r)),n=BigInt(1),i=0;for(;++i<e;){n*=BigInt(256);let s=BigInt(rr(r));t=t+n*s}return t}function tc(r,e){let t=eo(r,e),n=BigInt(2)**(BigInt(8)*BigInt(e-1)+BigInt(7));return t>=n&&(t-=n*BigInt(2)),t}function ai(r){let e=BigInt(r);if(r<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<e}var ci="DIDL",rc=400;function hn(r,e,t){return r.map((n,i)=>t(n,e[i]))}var to=class{constructor(){this._typs=[],this._idx=new Map}has(e){return this._idx.has(e.name)}add(e,t){let n=this._typs.length;this._idx.set(e.name,n),this._typs.push(t)}merge(e,t){let n=this._idx.get(e.name),i=this._idx.get(t);if(n===void 0)throw new Error("Missing type index for "+e);if(i===void 0)throw new Error("Missing type index for "+t);this._typs[n]=this._typs[i],this._typs.splice(i,1),this._idx.delete(t)}encode(){let e=Be(this._typs.length),t=xe(...this._typs);return xe(e,t)}indexOf(e){if(!this._idx.has(e))throw new Error("Missing type index for "+e);return $e(this._idx.get(e)||0)}},ui=class{visitType(e,t){throw new Error("Not implemented")}visitPrimitive(e,t){return this.visitType(e,t)}visitEmpty(e,t){return this.visitPrimitive(e,t)}visitBool(e,t){return this.visitPrimitive(e,t)}visitNull(e,t){return this.visitPrimitive(e,t)}visitReserved(e,t){return this.visitPrimitive(e,t)}visitText(e,t){return this.visitPrimitive(e,t)}visitNumber(e,t){return this.visitPrimitive(e,t)}visitInt(e,t){return this.visitNumber(e,t)}visitNat(e,t){return this.visitNumber(e,t)}visitFloat(e,t){return this.visitPrimitive(e,t)}visitFixedInt(e,t){return this.visitNumber(e,t)}visitFixedNat(e,t){return this.visitNumber(e,t)}visitPrincipal(e,t){return this.visitPrimitive(e,t)}visitConstruct(e,t){return this.visitType(e,t)}visitVec(e,t,n){return this.visitConstruct(e,n)}visitOpt(e,t,n){return this.visitConstruct(e,n)}visitRecord(e,t,n){return this.visitConstruct(e,n)}visitTuple(e,t,n){let i=t.map((s,o)=>[`_${o}_`,s]);return this.visitRecord(e,i,n)}visitVariant(e,t,n){return this.visitConstruct(e,n)}visitRec(e,t,n){return this.visitConstruct(t,n)}visitFunc(e,t){return this.visitConstruct(e,t)}visitService(e,t){return this.visitConstruct(e,t)}},kr=class{display(){return this.name}valueToString(e){return Pe(e)}buildTypeTable(e){e.has(this)||this._buildTypeTableImpl(e)}},ct=class extends kr{checkType(e){if(this.name!==e.name)throw new Error(`type mismatch: type on the wire ${e.name}, expect type ${this.name}`);return e}_buildTypeTableImpl(e){}},Dt=class extends kr{checkType(e){if(e instanceof ir){let t=e.getType();if(typeof t>"u")throw new Error("type mismatch with uninitialized type");return t}throw new Error(`type mismatch: type on the wire ${e.name}, expect type ${this.name}`)}encodeType(e){return e.indexOf(this.name)}},fi=class extends ct{accept(e,t){return e.visitEmpty(this,t)}covariant(e){throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(){throw new Error("Empty cannot appear as a function argument")}valueToString(){throw new Error("Empty cannot appear as a value")}encodeType(){return $e(-17)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}},li=class extends kr{checkType(e){throw new Error("Method not implemented for unknown.")}accept(e,t){throw e.visitType(this,t)}covariant(e){throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(){throw new Error("Unknown cannot appear as a function argument")}valueToString(){throw new Error("Unknown cannot appear as a value")}encodeType(){throw new Error("Unknown cannot be serialized")}decodeValue(e,t){let n=t.decodeValue(e,t);Object(n)!==n&&(n=Object(n));let i;return t instanceof ir?i=()=>t.getType():i=()=>t,Object.defineProperty(n,"type",{value:i,writable:!0,enumerable:!1,configurable:!0}),n}_buildTypeTableImpl(){throw new Error("Unknown cannot be serialized")}get name(){return"Unknown"}},hi=class extends ct{accept(e,t){return e.visitBool(this,t)}covariant(e){if(typeof e=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(e){return new Uint8Array([e?1:0])}encodeType(){return $e(-2)}decodeValue(e,t){switch(this.checkType(t),rr(e)){case 0:return!1;case 1:return!0;default:throw new Error("Boolean value out of range")}}get name(){return"bool"}},di=class extends ct{accept(e,t){return e.visitNull(this,t)}covariant(e){if(e===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(){return new ArrayBuffer(0)}encodeType(){return $e(-1)}decodeValue(e,t){return this.checkType(t),null}get name(){return"null"}},qr=class extends ct{accept(e,t){return e.visitReserved(this,t)}covariant(e){return!0}encodeValue(){return new ArrayBuffer(0)}encodeType(){return $e(-16)}decodeValue(e,t){return t.name!==this.name&&t.decodeValue(e,t),null}get name(){return"reserved"}},pi=class extends ct{accept(e,t){return e.visitText(this,t)}covariant(e){if(typeof e=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(e){let t=new TextEncoder().encode(e),n=Be(t.byteLength);return xe(n,t)}encodeType(){return $e(-15)}decodeValue(e,t){this.checkType(t);let n=Ce(e),i=nr(e,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(i)}get name(){return"text"}valueToString(e){return'"'+e+'"'}},mi=class extends ct{accept(e,t){return e.visitInt(this,t)}covariant(e){if(typeof e=="bigint"||Number.isInteger(e))return!0;throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(e){return $e(e)}encodeType(){return $e(-4)}decodeValue(e,t){return this.checkType(t),Vt(e)}get name(){return"int"}valueToString(e){return e.toString()}},gi=class extends ct{accept(e,t){return e.visitNat(this,t)}covariant(e){if(typeof e=="bigint"&&e>=BigInt(0)||Number.isInteger(e)&&e>=0)return!0;throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(e){return Be(e)}encodeType(){return $e(-3)}decodeValue(e,t){return this.checkType(t),Ce(e)}get name(){return"nat"}valueToString(e){return e.toString()}},dn=class extends ct{constructor(e){if(super(),this._bits=e,e!==32&&e!==64)throw new Error("not a valid float type")}accept(e,t){return e.visitFloat(this,t)}covariant(e){if(typeof e=="number"||e instanceof Number)return!0;throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(e){let t=new ArrayBuffer(this._bits/8),n=new DataView(t);return this._bits===32?n.setFloat32(0,e,!0):n.setFloat64(0,e,!0),t}encodeType(){let e=this._bits===32?-13:-14;return $e(e)}decodeValue(e,t){this.checkType(t);let n=nr(e,this._bits/8),i=new DataView(n);return this._bits===32?i.getFloat32(0,!0):i.getFloat64(0,!0)}get name(){return"float"+this._bits}valueToString(e){return e.toString()}},jt=class extends ct{constructor(e){super(),this._bits=e}accept(e,t){return e.visitFixedInt(this,t)}covariant(e){let t=ai(this._bits-1)*BigInt(-1),n=ai(this._bits-1)-BigInt(1),i=!1;if(typeof e=="bigint")i=e>=t&&e<=n;else if(Number.isInteger(e)){let s=BigInt(e);i=s>=t&&s<=n}else i=!1;if(i)return!0;throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(e){return Js(e,this._bits/8)}encodeType(){let e=Math.log2(this._bits)-3;return $e(-9-e)}decodeValue(e,t){this.checkType(t);let n=tc(e,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(e){return e.toString()}},Mt=class extends ct{constructor(e){super(),this._bits=e}accept(e,t){return e.visitFixedNat(this,t)}covariant(e){let t=ai(this._bits),n=!1;if(typeof e=="bigint"&&e>=BigInt(0)?n=e<t:Number.isInteger(e)&&e>=0?n=BigInt(e)<t:n=!1,n)return!0;throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(e){return ec(e,this._bits/8)}encodeType(){let e=Math.log2(this._bits)-3;return $e(-5-e)}decodeValue(e,t){this.checkType(t);let n=eo(e,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(e){return e.toString()}},yi=class r extends Dt{constructor(e){super(),this._type=e,this._blobOptimization=!1,e instanceof Mt&&e._bits===8&&(this._blobOptimization=!0)}accept(e,t){return e.visitVec(this,this._type,t)}covariant(e){let t=this._type instanceof Mt?this._type._bits:this._type instanceof jt?this._type._bits:0;if(ArrayBuffer.isView(e)&&t==e.BYTES_PER_ELEMENT*8||Array.isArray(e)&&e.every((n,i)=>{try{return this._type.covariant(n)}catch(s){throw new Error(`Invalid ${this.display()} argument:
1
+ var zu=Object.create;var Mn=Object.defineProperty;var Ku=Object.getOwnPropertyDescriptor;var Zu=Object.getOwnPropertyNames;var Wu=Object.getPrototypeOf,Xu=Object.prototype.hasOwnProperty;var Qu=(r,e)=>()=>(r&&(e=r(r=0)),e);var ze=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),fs=(r,e)=>{for(var t in e)Mn(r,t,{get:e[t],enumerable:!0})},Lo=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Zu(e))!Xu.call(r,i)&&i!==t&&Mn(r,i,{get:()=>e[i],enumerable:!(n=Ku(e,i))||n.enumerable});return r};var rn=(r,e,t)=>(t=r!=null?zu(Wu(r)):{},Lo(e||!r||!r.__esModule?Mn(t,"default",{value:r,enumerable:!0}):t,r)),Ju=r=>Lo(Mn({},"__esModule",{value:!0}),r);var la={};fs(la,{Buffer:()=>z,INSPECT_MAX_BYTES:()=>Qo,SlowBuffer:()=>xf,isBuffer:()=>ua,kMaxLength:()=>mf});function Zo(){bs=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,t=r.length;e<t;++e)Ft[e]=r[e],mt[r.charCodeAt(e)]=e;mt[45]=62,mt[95]=63}function lf(r){bs||Zo();var e,t,n,i,s,o,c=r.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=r[c-2]==="="?2:r[c-1]==="="?1:0,o=new ff(c*3/4-s),n=s>0?c-4:c;var a=0;for(e=0,t=0;e<n;e+=4,t+=3)i=mt[r.charCodeAt(e)]<<18|mt[r.charCodeAt(e+1)]<<12|mt[r.charCodeAt(e+2)]<<6|mt[r.charCodeAt(e+3)],o[a++]=i>>16&255,o[a++]=i>>8&255,o[a++]=i&255;return s===2?(i=mt[r.charCodeAt(e)]<<2|mt[r.charCodeAt(e+1)]>>4,o[a++]=i&255):s===1&&(i=mt[r.charCodeAt(e)]<<10|mt[r.charCodeAt(e+1)]<<4|mt[r.charCodeAt(e+2)]>>2,o[a++]=i>>8&255,o[a++]=i&255),o}function hf(r){return Ft[r>>18&63]+Ft[r>>12&63]+Ft[r>>6&63]+Ft[r&63]}function df(r,e,t){for(var n,i=[],s=e;s<t;s+=3)n=(r[s]<<16)+(r[s+1]<<8)+r[s+2],i.push(hf(n));return i.join("")}function Yo(r){bs||Zo();for(var e,t=r.length,n=t%3,i="",s=[],o=16383,c=0,a=t-n;c<a;c+=o)s.push(df(r,c,c+o>a?a:c+o));return n===1?(e=r[t-1],i+=Ft[e>>2],i+=Ft[e<<4&63],i+="=="):n===2&&(e=(r[t-2]<<8)+r[t-1],i+=Ft[e>>10],i+=Ft[e>>4&63],i+=Ft[e<<2&63],i+="="),s.push(i),s.join("")}function jn(r,e,t,n,i){var s,o,c=i*8-n-1,a=(1<<c)-1,h=a>>1,p=-7,g=t?i-1:0,w=t?-1:1,x=r[e+g];for(g+=w,s=x&(1<<-p)-1,x>>=-p,p+=c;p>0;s=s*256+r[e+g],g+=w,p-=8);for(o=s&(1<<-p)-1,s>>=-p,p+=n;p>0;o=o*256+r[e+g],g+=w,p-=8);if(s===0)s=1-h;else{if(s===a)return o?NaN:(x?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(x?-1:1)*o*Math.pow(2,s-n)}function Wo(r,e,t,n,i,s){var o,c,a,h=s*8-i-1,p=(1<<h)-1,g=p>>1,w=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=n?0:s-1,f=n?1:-1,N=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=p):(o=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+g>=1?e+=w/a:e+=w*Math.pow(2,1-g),e*a>=2&&(o++,a/=2),o+g>=p?(c=0,o=p):o+g>=1?(c=(e*a-1)*Math.pow(2,i),o=o+g):(c=e*Math.pow(2,g-1)*Math.pow(2,i),o=0));i>=8;r[t+x]=c&255,x+=f,c/=256,i-=8);for(o=o<<i|c,h+=i;h>0;r[t+x]=o&255,x+=f,o/=256,h-=8);r[t+x-f]|=N*128}function Gn(){return z.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Ht(r,e){if(Gn()<e)throw new RangeError("Invalid typed array length");return z.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=z.prototype):(r===null&&(r=new z(e)),r.length=e),r}function z(r,e,t){if(!z.TYPED_ARRAY_SUPPORT&&!(this instanceof z))return new z(r,e,t);if(typeof r=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return xs(this,r)}return Jo(this,r,e,t)}function Jo(r,e,t,n){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?wf(r,e,t,n):typeof e=="string"?yf(r,e,t):bf(r,e)}function ea(r){if(typeof r!="number")throw new TypeError('"size" argument must be a number');if(r<0)throw new RangeError('"size" argument must not be negative')}function gf(r,e,t,n){return ea(e),e<=0?Ht(r,e):t!==void 0?typeof n=="string"?Ht(r,e).fill(t,n):Ht(r,e).fill(t):Ht(r,e)}function xs(r,e){if(ea(e),r=Ht(r,e<0?0:_s(e)|0),!z.TYPED_ARRAY_SUPPORT)for(var t=0;t<e;++t)r[t]=0;return r}function yf(r,e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!z.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var n=ta(e,t)|0;r=Ht(r,n);var i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function ws(r,e){var t=e.length<0?0:_s(e.length)|0;r=Ht(r,t);for(var n=0;n<t;n+=1)r[n]=e[n]&255;return r}function wf(r,e,t,n){if(e.byteLength,t<0||e.byteLength<t)throw new RangeError("'offset' is out of bounds");if(e.byteLength<t+(n||0))throw new RangeError("'length' is out of bounds");return t===void 0&&n===void 0?e=new Uint8Array(e):n===void 0?e=new Uint8Array(e,t):e=new Uint8Array(e,t,n),z.TYPED_ARRAY_SUPPORT?(r=e,r.__proto__=z.prototype):r=ws(r,e),r}function bf(r,e){if(Pt(e)){var t=_s(e.length)|0;return r=Ht(r,t),r.length===0||e.copy(r,0,0,t),r}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||qf(e.length)?Ht(r,0):ws(r,e);if(e.type==="Buffer"&&Xo(e.data))return ws(r,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function _s(r){if(r>=Gn())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Gn().toString(16)+" bytes");return r|0}function xf(r){return+r!=r&&(r=0),z.alloc(+r)}function Pt(r){return!!(r!=null&&r._isBuffer)}function ta(r,e){if(Pt(r))return r.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(r)||r instanceof ArrayBuffer))return r.byteLength;typeof r!="string"&&(r=""+r);var t=r.length;if(t===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":case void 0:return Vn(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return ca(r).length;default:if(n)return Vn(r).length;e=(""+e).toLowerCase(),n=!0}}function _f(r,e,t){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Of(this,e,t);case"utf8":case"utf-8":return ia(this,e,t);case"ascii":return Nf(this,e,t);case"latin1":case"binary":return Rf(this,e,t);case"base64":return Bf(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Uf(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}function xr(r,e,t){var n=r[e];r[e]=r[t],r[t]=n}function ra(r,e,t,n,i){if(r.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,isNaN(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e=="string"&&(e=z.from(e,n)),Pt(e))return e.length===0?-1:zo(r,e,t,n,i);if(typeof e=="number")return e=e&255,z.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):zo(r,[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}function zo(r,e,t,n,i){var s=1,o=r.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,c/=2,t/=2}function a(x,f){return s===1?x[f]:x.readUInt16BE(f*s)}var h;if(i){var p=-1;for(h=t;h<o;h++)if(a(r,h)===a(e,p===-1?0:h-p)){if(p===-1&&(p=h),h-p+1===c)return p*s}else p!==-1&&(h-=h-p),p=-1}else for(t+c>o&&(t=o-c),h=t;h>=0;h--){for(var g=!0,w=0;w<c;w++)if(a(r,h+w)!==a(e,w)){g=!1;break}if(g)return h}return-1}function Ef(r,e,t,n){t=Number(t)||0;var i=r.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;var s=e.length;if(s%2!==0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var o=0;o<n;++o){var c=parseInt(e.substr(o*2,2),16);if(isNaN(c))return o;r[t+o]=c}return o}function vf(r,e,t,n){return Kn(Vn(e,r.length-t),r,t,n)}function na(r,e,t,n){return Kn(Df(e),r,t,n)}function If(r,e,t,n){return na(r,e,t,n)}function Af(r,e,t,n){return Kn(ca(e),r,t,n)}function Sf(r,e,t,n){return Kn(kf(e,r.length-t),r,t,n)}function Bf(r,e,t){return e===0&&t===r.length?Yo(r):Yo(r.slice(e,t))}function ia(r,e,t){t=Math.min(r.length,t);for(var n=[],i=e;i<t;){var s=r[i],o=null,c=s>239?4:s>223?3:s>191?2:1;if(i+c<=t){var a,h,p,g;switch(c){case 1:s<128&&(o=s);break;case 2:a=r[i+1],(a&192)===128&&(g=(s&31)<<6|a&63,g>127&&(o=g));break;case 3:a=r[i+1],h=r[i+2],(a&192)===128&&(h&192)===128&&(g=(s&15)<<12|(a&63)<<6|h&63,g>2047&&(g<55296||g>57343)&&(o=g));break;case 4:a=r[i+1],h=r[i+2],p=r[i+3],(a&192)===128&&(h&192)===128&&(p&192)===128&&(g=(s&15)<<18|(a&63)<<12|(h&63)<<6|p&63,g>65535&&g<1114112&&(o=g))}}o===null?(o=65533,c=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=c}return Tf(n)}function Tf(r){var e=r.length;if(e<=Ko)return String.fromCharCode.apply(String,r);for(var t="",n=0;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=Ko));return t}function Nf(r,e,t){var n="";t=Math.min(r.length,t);for(var i=e;i<t;++i)n+=String.fromCharCode(r[i]&127);return n}function Rf(r,e,t){var n="";t=Math.min(r.length,t);for(var i=e;i<t;++i)n+=String.fromCharCode(r[i]);return n}function Of(r,e,t){var n=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>n)&&(t=n);for(var i="",s=e;s<t;++s)i+=Mf(r[s]);return i}function Uf(r,e,t){for(var n=r.slice(e,t),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}function Ke(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}function at(r,e,t,n,i,s){if(!Pt(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError("Index out of range")}function Yn(r,e,t,n){e<0&&(e=65535+e+1);for(var i=0,s=Math.min(r.length-t,2);i<s;++i)r[t+i]=(e&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}function zn(r,e,t,n){e<0&&(e=4294967295+e+1);for(var i=0,s=Math.min(r.length-t,4);i<s;++i)r[t+i]=e>>>(n?i:3-i)*8&255}function sa(r,e,t,n,i,s){if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function oa(r,e,t,n,i){return i||sa(r,e,t,4),Wo(r,e,t,n,23,4),t+4}function aa(r,e,t,n,i){return i||sa(r,e,t,8),Wo(r,e,t,n,52,8),t+8}function Pf(r){if(r=Lf(r).replace(Ff,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Lf(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function Mf(r){return r<16?"0"+r.toString(16):r.toString(16)}function Vn(r,e){e=e||1/0;for(var t,n=r.length,i=null,s=[],o=0;o<n;++o){if(t=r.charCodeAt(o),t>55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function Df(r){for(var e=[],t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function kf(r,e){for(var t,n,i,s=[],o=0;o<r.length&&!((e-=2)<0);++o)t=r.charCodeAt(o),n=t>>8,i=t%256,s.push(i),s.push(n);return s}function ca(r){return lf(Pf(r))}function Kn(r,e,t,n){for(var i=0;i<n&&!(i+t>=e.length||i>=r.length);++i)e[i+t]=r[i];return i}function qf(r){return r!==r}function ua(r){return r!=null&&(!!r._isBuffer||fa(r)||Cf(r))}function fa(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Cf(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&fa(r.slice(0,0))}var Ft,mt,ff,bs,pf,Xo,Qo,mf,Ko,Ff,ha=Qu(()=>{Ft=[],mt=[],ff=typeof Uint8Array<"u"?Uint8Array:Array,bs=!1;pf={}.toString,Xo=Array.isArray||function(r){return pf.call(r)=="[object Array]"};Qo=50;z.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;mf=Gn();z.poolSize=8192;z._augment=function(r){return r.__proto__=z.prototype,r};z.from=function(r,e,t){return Jo(null,r,e,t)};z.TYPED_ARRAY_SUPPORT&&(z.prototype.__proto__=Uint8Array.prototype,z.__proto__=Uint8Array);z.alloc=function(r,e,t){return gf(null,r,e,t)};z.allocUnsafe=function(r){return xs(null,r)};z.allocUnsafeSlow=function(r){return xs(null,r)};z.isBuffer=ua;z.compare=function(e,t){if(!Pt(e)||!Pt(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,i=t.length,s=0,o=Math.min(n,i);s<o;++s)if(e[s]!==t[s]){n=e[s],i=t[s];break}return n<i?-1:i<n?1:0};z.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};z.concat=function(e,t){if(!Xo(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return z.alloc(0);var n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var i=z.allocUnsafe(t),s=0;for(n=0;n<e.length;++n){var o=e[n];if(!Pt(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,s),s+=o.length}return i};z.byteLength=ta;z.prototype._isBuffer=!0;z.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)xr(this,t,t+1);return this};z.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)xr(this,t,t+3),xr(this,t+1,t+2);return this};z.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)xr(this,t,t+7),xr(this,t+1,t+6),xr(this,t+2,t+5),xr(this,t+3,t+4);return this};z.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?ia(this,0,e):_f.apply(this,arguments)};z.prototype.equals=function(e){if(!Pt(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:z.compare(this,e)===0};z.prototype.inspect=function(){var e="",t=Qo;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"};z.prototype.compare=function(e,t,n,i,s){if(!Pt(e))throw new TypeError("Argument must be a Buffer");if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),t<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&t>=n)return 0;if(i>=s)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;for(var o=s-i,c=n-t,a=Math.min(o,c),h=this.slice(i,s),p=e.slice(t,n),g=0;g<a;++g)if(h[g]!==p[g]){o=h[g],c=p[g];break}return o<c?-1:c<o?1:0};z.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1};z.prototype.indexOf=function(e,t,n){return ra(this,e,t,n,!0)};z.prototype.lastIndexOf=function(e,t,n){return ra(this,e,t,n,!1)};z.prototype.write=function(e,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-t;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return Ef(this,e,t,n);case"utf8":case"utf-8":return vf(this,e,t,n);case"ascii":return na(this,e,t,n);case"latin1":case"binary":return If(this,e,t,n);case"base64":return Af(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Sf(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Ko=4096;z.prototype.slice=function(e,t){var n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);var i;if(z.TYPED_ARRAY_SUPPORT)i=this.subarray(e,t),i.__proto__=z.prototype;else{var s=t-e;i=new z(s,void 0);for(var o=0;o<s;++o)i[o]=this[o+e]}return i};z.prototype.readUIntLE=function(e,t,n){e=e|0,t=t|0,n||Ke(e,t,this.length);for(var i=this[e],s=1,o=0;++o<t&&(s*=256);)i+=this[e+o]*s;return i};z.prototype.readUIntBE=function(e,t,n){e=e|0,t=t|0,n||Ke(e,t,this.length);for(var i=this[e+--t],s=1;t>0&&(s*=256);)i+=this[e+--t]*s;return i};z.prototype.readUInt8=function(e,t){return t||Ke(e,1,this.length),this[e]};z.prototype.readUInt16LE=function(e,t){return t||Ke(e,2,this.length),this[e]|this[e+1]<<8};z.prototype.readUInt16BE=function(e,t){return t||Ke(e,2,this.length),this[e]<<8|this[e+1]};z.prototype.readUInt32LE=function(e,t){return t||Ke(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};z.prototype.readUInt32BE=function(e,t){return t||Ke(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};z.prototype.readIntLE=function(e,t,n){e=e|0,t=t|0,n||Ke(e,t,this.length);for(var i=this[e],s=1,o=0;++o<t&&(s*=256);)i+=this[e+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*t)),i};z.prototype.readIntBE=function(e,t,n){e=e|0,t=t|0,n||Ke(e,t,this.length);for(var i=t,s=1,o=this[e+--i];i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};z.prototype.readInt8=function(e,t){return t||Ke(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};z.prototype.readInt16LE=function(e,t){t||Ke(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};z.prototype.readInt16BE=function(e,t){t||Ke(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};z.prototype.readInt32LE=function(e,t){return t||Ke(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};z.prototype.readInt32BE=function(e,t){return t||Ke(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};z.prototype.readFloatLE=function(e,t){return t||Ke(e,4,this.length),jn(this,e,!0,23,4)};z.prototype.readFloatBE=function(e,t){return t||Ke(e,4,this.length),jn(this,e,!1,23,4)};z.prototype.readDoubleLE=function(e,t){return t||Ke(e,8,this.length),jn(this,e,!0,52,8)};z.prototype.readDoubleBE=function(e,t){return t||Ke(e,8,this.length),jn(this,e,!1,52,8)};z.prototype.writeUIntLE=function(e,t,n,i){if(e=+e,t=t|0,n=n|0,!i){var s=Math.pow(2,8*n)-1;at(this,e,t,n,s,0)}var o=1,c=0;for(this[t]=e&255;++c<n&&(o*=256);)this[t+c]=e/o&255;return t+n};z.prototype.writeUIntBE=function(e,t,n,i){if(e=+e,t=t|0,n=n|0,!i){var s=Math.pow(2,8*n)-1;at(this,e,t,n,s,0)}var o=n-1,c=1;for(this[t+o]=e&255;--o>=0&&(c*=256);)this[t+o]=e/c&255;return t+n};z.prototype.writeUInt8=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,1,255,0),z.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e&255,t+1};z.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,2,65535,0),z.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):Yn(this,e,t,!0),t+2};z.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,2,65535,0),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):Yn(this,e,t,!1),t+2};z.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,4,4294967295,0),z.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255):zn(this,e,t,!0),t+4};z.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,4,4294967295,0),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):zn(this,e,t,!1),t+4};z.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t=t|0,!i){var s=Math.pow(2,8*n-1);at(this,e,t,n,s-1,-s)}var o=0,c=1,a=0;for(this[t]=e&255;++o<n&&(c*=256);)e<0&&a===0&&this[t+o-1]!==0&&(a=1),this[t+o]=(e/c>>0)-a&255;return t+n};z.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t=t|0,!i){var s=Math.pow(2,8*n-1);at(this,e,t,n,s-1,-s)}var o=n-1,c=1,a=0;for(this[t+o]=e&255;--o>=0&&(c*=256);)e<0&&a===0&&this[t+o+1]!==0&&(a=1),this[t+o]=(e/c>>0)-a&255;return t+n};z.prototype.writeInt8=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,1,127,-128),z.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=e&255,t+1};z.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,2,32767,-32768),z.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):Yn(this,e,t,!0),t+2};z.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,2,32767,-32768),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):Yn(this,e,t,!1),t+2};z.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,4,2147483647,-2147483648),z.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):zn(this,e,t,!0),t+4};z.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t|0,n||at(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):zn(this,e,t,!1),t+4};z.prototype.writeFloatLE=function(e,t,n){return oa(this,e,t,!0,n)};z.prototype.writeFloatBE=function(e,t,n){return oa(this,e,t,!1,n)};z.prototype.writeDoubleLE=function(e,t,n){return aa(this,e,t,!0,n)};z.prototype.writeDoubleBE=function(e,t,n){return aa(this,e,t,!1,n)};z.prototype.copy=function(e,t,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);var s=i-n,o;if(this===e&&n<t&&t<i)for(o=s-1;o>=0;--o)e[o+t]=this[o+n];else if(s<1e3||!z.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+t]=this[o+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+s),t);return s};z.prototype.fill=function(e,t,n,i){if(typeof e=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),e.length===1){var s=e.charCodeAt(0);s<256&&(e=s)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!z.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof e=="number"&&(e=e&255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var o;if(typeof e=="number")for(o=t;o<n;++o)this[o]=e;else{var c=Pt(e)?e:Vn(new z(e,i).toString()),a=c.length;for(o=0;o<n-t;++o)this[o+t]=c[o%a]}return this};Ff=/[^+\/0-9A-Za-z-_]/g});var an=ze((ed,Zn)=>{var _r=(ha(),Ju(la));if(_r&&_r.default){Zn.exports=_r.default;for(let r in _r)Zn.exports[r]=_r[r]}else _r&&(Zn.exports=_r)});var da=ze(Es=>{Es.read=function(r,e,t,n,i){var s,o,c=i*8-n-1,a=(1<<c)-1,h=a>>1,p=-7,g=t?i-1:0,w=t?-1:1,x=r[e+g];for(g+=w,s=x&(1<<-p)-1,x>>=-p,p+=c;p>0;s=s*256+r[e+g],g+=w,p-=8);for(o=s&(1<<-p)-1,s>>=-p,p+=n;p>0;o=o*256+r[e+g],g+=w,p-=8);if(s===0)s=1-h;else{if(s===a)return o?NaN:(x?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(x?-1:1)*o*Math.pow(2,s-n)};Es.write=function(r,e,t,n,i,s){var o,c,a,h=s*8-i-1,p=(1<<h)-1,g=p>>1,w=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=n?0:s-1,f=n?1:-1,N=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=p):(o=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+g>=1?e+=w/a:e+=w*Math.pow(2,1-g),e*a>=2&&(o++,a/=2),o+g>=p?(c=0,o=p):o+g>=1?(c=(e*a-1)*Math.pow(2,i),o=o+g):(c=e*Math.pow(2,g-1)*Math.pow(2,i),o=0));i>=8;r[t+x]=c&255,x+=f,c/=256,i-=8);for(o=o<<i|c,h+=i;h>0;r[t+x]=o&255,x+=f,o/=256,h-=8);r[t+x-f]|=N*128}});var cn=ze((pa,Wn)=>{(function(r){"use strict";var e,t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",c=1e14,a=14,h=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,w=1e9;function x(E){var C,G,j,k=U.prototype={constructor:U,toString:null,valueOf:null},fe=new U(1),re=20,te=4,y=-7,I=21,q=-1e7,F=1e7,P=!1,$=1,Z=0,ue={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},ce="0123456789abcdefghijklmnopqrstuvwxyz",Y=!0;function U(u,l){var m,S,v,A,M,b,B,L,R=this;if(!(R instanceof U))return new U(u,l);if(l==null){if(u&&u._isBigNumber===!0){R.s=u.s,!u.c||u.e>F?R.c=R.e=null:u.e<q?R.c=[R.e=0]:(R.e=u.e,R.c=u.c.slice());return}if((b=typeof u=="number")&&u*0==0){if(R.s=1/u<0?(u=-u,-1):1,u===~~u){for(A=0,M=u;M>=10;M/=10,A++);A>F?R.c=R.e=null:(R.e=A,R.c=[u]);return}L=String(u)}else{if(!t.test(L=String(u)))return j(R,L,b);R.s=L.charCodeAt(0)==45?(L=L.slice(1),-1):1}(A=L.indexOf("."))>-1&&(L=L.replace(".","")),(M=L.search(/e/i))>0?(A<0&&(A=M),A+=+L.slice(M+1),L=L.substring(0,M)):A<0&&(A=L.length)}else{if(O(l,2,ce.length,"Base"),l==10&&Y)return R=new U(u),ae(R,re+R.e+1,te);if(L=String(u),b=typeof u=="number"){if(u*0!=0)return j(R,L,b,l);if(R.s=1/u<0?(L=L.slice(1),-1):1,U.DEBUG&&L.replace(/^0\.0*|\./,"").length>15)throw Error(o+u)}else R.s=L.charCodeAt(0)===45?(L=L.slice(1),-1):1;for(m=ce.slice(0,l),A=M=0,B=L.length;M<B;M++)if(m.indexOf(S=L.charAt(M))<0){if(S=="."){if(M>A){A=B;continue}}else if(!v&&(L==L.toUpperCase()&&(L=L.toLowerCase())||L==L.toLowerCase()&&(L=L.toUpperCase()))){v=!0,M=-1,A=0;continue}return j(R,String(u),b,l)}b=!1,L=G(L,l,10,R.s),(A=L.indexOf("."))>-1?L=L.replace(".",""):A=L.length}for(M=0;L.charCodeAt(M)===48;M++);for(B=L.length;L.charCodeAt(--B)===48;);if(L=L.slice(M,++B)){if(B-=M,b&&U.DEBUG&&B>15&&(u>h||u!==i(u)))throw Error(o+R.s*u);if((A=A-M-1)>F)R.c=R.e=null;else if(A<q)R.c=[R.e=0];else{if(R.e=A,R.c=[],M=(A+1)%a,A<0&&(M+=a),M<B){for(M&&R.c.push(+L.slice(0,M)),B-=a;M<B;)R.c.push(+L.slice(M,M+=a));M=a-(L=L.slice(M)).length}else M-=B;for(;M--;L+="0");R.c.push(+L)}}else R.c=[R.e=0]}U.clone=x,U.ROUND_UP=0,U.ROUND_DOWN=1,U.ROUND_CEIL=2,U.ROUND_FLOOR=3,U.ROUND_HALF_UP=4,U.ROUND_HALF_DOWN=5,U.ROUND_HALF_EVEN=6,U.ROUND_HALF_CEIL=7,U.ROUND_HALF_FLOOR=8,U.EUCLID=9,U.config=U.set=function(u){var l,m;if(u!=null)if(typeof u=="object"){if(u.hasOwnProperty(l="DECIMAL_PLACES")&&(m=u[l],O(m,0,w,l),re=m),u.hasOwnProperty(l="ROUNDING_MODE")&&(m=u[l],O(m,0,8,l),te=m),u.hasOwnProperty(l="EXPONENTIAL_AT")&&(m=u[l],m&&m.pop?(O(m[0],-w,0,l),O(m[1],0,w,l),y=m[0],I=m[1]):(O(m,-w,w,l),y=-(I=m<0?-m:m))),u.hasOwnProperty(l="RANGE"))if(m=u[l],m&&m.pop)O(m[0],-w,-1,l),O(m[1],1,w,l),q=m[0],F=m[1];else if(O(m,-w,w,l),m)q=-(F=m<0?-m:m);else throw Error(s+l+" cannot be zero: "+m);if(u.hasOwnProperty(l="CRYPTO"))if(m=u[l],m===!!m)if(m)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))P=m;else throw P=!m,Error(s+"crypto unavailable");else P=m;else throw Error(s+l+" not true or false: "+m);if(u.hasOwnProperty(l="MODULO_MODE")&&(m=u[l],O(m,0,9,l),$=m),u.hasOwnProperty(l="POW_PRECISION")&&(m=u[l],O(m,0,w,l),Z=m),u.hasOwnProperty(l="FORMAT"))if(m=u[l],typeof m=="object")ue=m;else throw Error(s+l+" not an object: "+m);if(u.hasOwnProperty(l="ALPHABET"))if(m=u[l],typeof m=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(m))Y=m.slice(0,10)=="0123456789",ce=m;else throw Error(s+l+" invalid: "+m)}else throw Error(s+"Object expected: "+u);return{DECIMAL_PLACES:re,ROUNDING_MODE:te,EXPONENTIAL_AT:[y,I],RANGE:[q,F],CRYPTO:P,MODULO_MODE:$,POW_PRECISION:Z,FORMAT:ue,ALPHABET:ce}},U.isBigNumber=function(u){if(!u||u._isBigNumber!==!0)return!1;if(!U.DEBUG)return!0;var l,m,S=u.c,v=u.e,A=u.s;e:if({}.toString.call(S)=="[object Array]"){if((A===1||A===-1)&&v>=-w&&v<=w&&v===i(v)){if(S[0]===0){if(v===0&&S.length===1)return!0;break e}if(l=(v+1)%a,l<1&&(l+=a),String(S[0]).length==l){for(l=0;l<S.length;l++)if(m=S[l],m<0||m>=c||m!==i(m))break e;if(m!==0)return!0}}}else if(S===null&&v===null&&(A===null||A===1||A===-1))return!0;throw Error(s+"Invalid BigNumber: "+u)},U.maximum=U.max=function(){return J(arguments,-1)},U.minimum=U.min=function(){return J(arguments,1)},U.random=function(){var u=9007199254740992,l=Math.random()*u&2097151?function(){return i(Math.random()*u)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(m){var S,v,A,M,b,B=0,L=[],R=new U(fe);if(m==null?m=re:O(m,0,w),M=n(m/a),P)if(crypto.getRandomValues){for(S=crypto.getRandomValues(new Uint32Array(M*=2));B<M;)b=S[B]*131072+(S[B+1]>>>11),b>=9e15?(v=crypto.getRandomValues(new Uint32Array(2)),S[B]=v[0],S[B+1]=v[1]):(L.push(b%1e14),B+=2);B=M/2}else if(crypto.randomBytes){for(S=crypto.randomBytes(M*=7);B<M;)b=(S[B]&31)*281474976710656+S[B+1]*1099511627776+S[B+2]*4294967296+S[B+3]*16777216+(S[B+4]<<16)+(S[B+5]<<8)+S[B+6],b>=9e15?crypto.randomBytes(7).copy(S,B):(L.push(b%1e14),B+=7);B=M/7}else throw P=!1,Error(s+"crypto unavailable");if(!P)for(;B<M;)b=l(),b<9e15&&(L[B++]=b%1e14);for(M=L[--B],m%=a,M&&m&&(b=p[a-m],L[B]=i(M/b)*b);L[B]===0;L.pop(),B--);if(B<0)L=[A=0];else{for(A=-1;L[0]===0;L.splice(0,1),A-=a);for(B=1,b=L[0];b>=10;b/=10,B++);B<a&&(A-=a-B)}return R.e=A,R.c=L,R}}(),U.sum=function(){for(var u=1,l=arguments,m=new U(l[0]);u<l.length;)m=m.plus(l[u++]);return m},G=function(){var u="0123456789";function l(m,S,v,A){for(var M,b=[0],B,L=0,R=m.length;L<R;){for(B=b.length;B--;b[B]*=S);for(b[0]+=A.indexOf(m.charAt(L++)),M=0;M<b.length;M++)b[M]>v-1&&(b[M+1]==null&&(b[M+1]=0),b[M+1]+=b[M]/v|0,b[M]%=v)}return b.reverse()}return function(m,S,v,A,M){var b,B,L,R,V,W,ie,de,Ee=m.indexOf("."),Ne=re,he=te;for(Ee>=0&&(R=Z,Z=0,m=m.replace(".",""),de=new U(S),W=de.pow(m.length-Ee),Z=R,de.c=l(K(N(W.c),W.e,"0"),10,v,u),de.e=de.c.length),ie=l(m,S,v,M?(b=ce,u):(b=u,ce)),L=R=ie.length;ie[--R]==0;ie.pop());if(!ie[0])return b.charAt(0);if(Ee<0?--L:(W.c=ie,W.e=L,W.s=A,W=C(W,de,Ne,he,v),ie=W.c,V=W.r,L=W.e),B=L+Ne+1,Ee=ie[B],R=v/2,V=V||B<0||ie[B+1]!=null,V=he<4?(Ee!=null||V)&&(he==0||he==(W.s<0?3:2)):Ee>R||Ee==R&&(he==4||V||he==6&&ie[B-1]&1||he==(W.s<0?8:7)),B<1||!ie[0])m=V?K(b.charAt(1),-Ne,b.charAt(0)):b.charAt(0);else{if(ie.length=B,V)for(--v;++ie[--B]>v;)ie[B]=0,B||(++L,ie=[1].concat(ie));for(R=ie.length;!ie[--R];);for(Ee=0,m="";Ee<=R;m+=b.charAt(ie[Ee++]));m=K(m,L,b.charAt(0))}return m}}(),C=function(){function u(S,v,A){var M,b,B,L,R=0,V=S.length,W=v%g,ie=v/g|0;for(S=S.slice();V--;)B=S[V]%g,L=S[V]/g|0,M=ie*B+L*W,b=W*B+M%g*g+R,R=(b/A|0)+(M/g|0)+ie*L,S[V]=b%A;return R&&(S=[R].concat(S)),S}function l(S,v,A,M){var b,B;if(A!=M)B=A>M?1:-1;else for(b=B=0;b<A;b++)if(S[b]!=v[b]){B=S[b]>v[b]?1:-1;break}return B}function m(S,v,A,M){for(var b=0;A--;)S[A]-=b,b=S[A]<v[A]?1:0,S[A]=b*M+S[A]-v[A];for(;!S[0]&&S.length>1;S.splice(0,1));}return function(S,v,A,M,b){var B,L,R,V,W,ie,de,Ee,Ne,he,oe,ke,Qt,mr,gr,pt,be,ot=S.s==v.s?1:-1,We=S.c,Re=v.c;if(!We||!We[0]||!Re||!Re[0])return new U(!S.s||!v.s||(We?Re&&We[0]==Re[0]:!Re)?NaN:We&&We[0]==0||!Re?ot*0:ot/0);for(Ee=new U(ot),Ne=Ee.c=[],L=S.e-v.e,ot=A+L+1,b||(b=c,L=f(S.e/a)-f(v.e/a),ot=ot/a|0),R=0;Re[R]==(We[R]||0);R++);if(Re[R]>(We[R]||0)&&L--,ot<0)Ne.push(1),V=!0;else{for(mr=We.length,pt=Re.length,R=0,ot+=2,W=i(b/(Re[0]+1)),W>1&&(Re=u(Re,W,b),We=u(We,W,b),pt=Re.length,mr=We.length),Qt=pt,he=We.slice(0,pt),oe=he.length;oe<pt;he[oe++]=0);be=Re.slice(),be=[0].concat(be),gr=Re[0],Re[1]>=b/2&&gr++;do{if(W=0,B=l(Re,he,pt,oe),B<0){if(ke=he[0],pt!=oe&&(ke=ke*b+(he[1]||0)),W=i(ke/gr),W>1)for(W>=b&&(W=b-1),ie=u(Re,W,b),de=ie.length,oe=he.length;l(ie,he,de,oe)==1;)W--,m(ie,pt<de?be:Re,de,b),de=ie.length,B=1;else W==0&&(B=W=1),ie=Re.slice(),de=ie.length;if(de<oe&&(ie=[0].concat(ie)),m(he,ie,oe,b),oe=he.length,B==-1)for(;l(Re,he,pt,oe)<1;)W++,m(he,pt<oe?be:Re,oe,b),oe=he.length}else B===0&&(W++,he=[0]);Ne[R++]=W,he[0]?he[oe++]=We[Qt]||0:(he=[We[Qt]],oe=1)}while((Qt++<mr||he[0]!=null)&&ot--);V=he[0]!=null,Ne[0]||Ne.splice(0,1)}if(b==c){for(R=1,ot=Ne[0];ot>=10;ot/=10,R++);ae(Ee,A+(Ee.e=R+L*a-1)+1,M,V)}else Ee.e=L,Ee.r=+V;return Ee}}();function d(u,l,m,S){var v,A,M,b,B;if(m==null?m=te:O(m,0,8),!u.c)return u.toString();if(v=u.c[0],M=u.e,l==null)B=N(u.c),B=S==1||S==2&&(M<=y||M>=I)?D(B,M):K(B,M,"0");else if(u=ae(new U(u),l,m),A=u.e,B=N(u.c),b=B.length,S==1||S==2&&(l<=A||A<=y)){for(;b<l;B+="0",b++);B=D(B,A)}else if(l-=M,B=K(B,A,"0"),A+1>b){if(--l>0)for(B+=".";l--;B+="0");}else if(l+=A-b,l>0)for(A+1==b&&(B+=".");l--;B+="0");return u.s<0&&v?"-"+B:B}function J(u,l){for(var m,S,v=1,A=new U(u[0]);v<u.length;v++)S=new U(u[v]),(!S.s||(m=T(A,S))===l||m===0&&A.s===l)&&(A=S);return A}function ee(u,l,m){for(var S=1,v=l.length;!l[--v];l.pop());for(v=l[0];v>=10;v/=10,S++);return(m=S+m*a-1)>F?u.c=u.e=null:m<q?u.c=[u.e=0]:(u.e=m,u.c=l),u}j=function(){var u=/^(-?)0([xbo])(?=\w[\w.]*$)/i,l=/^([^.]+)\.$/,m=/^\.([^.]+)$/,S=/^-?(Infinity|NaN)$/,v=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(A,M,b,B){var L,R=b?M:M.replace(v,"");if(S.test(R))A.s=isNaN(R)?null:R<0?-1:1;else{if(!b&&(R=R.replace(u,function(V,W,ie){return L=(ie=ie.toLowerCase())=="x"?16:ie=="b"?2:8,!B||B==L?W:V}),B&&(L=B,R=R.replace(l,"$1").replace(m,"0.$1")),M!=R))return new U(R,L);if(U.DEBUG)throw Error(s+"Not a"+(B?" base "+B:"")+" number: "+M);A.s=null}A.c=A.e=null}}();function ae(u,l,m,S){var v,A,M,b,B,L,R,V=u.c,W=p;if(V){e:{for(v=1,b=V[0];b>=10;b/=10,v++);if(A=l-v,A<0)A+=a,M=l,B=V[L=0],R=i(B/W[v-M-1]%10);else if(L=n((A+1)/a),L>=V.length)if(S){for(;V.length<=L;V.push(0));B=R=0,v=1,A%=a,M=A-a+1}else break e;else{for(B=b=V[L],v=1;b>=10;b/=10,v++);A%=a,M=A-a+v,R=M<0?0:i(B/W[v-M-1]%10)}if(S=S||l<0||V[L+1]!=null||(M<0?B:B%W[v-M-1]),S=m<4?(R||S)&&(m==0||m==(u.s<0?3:2)):R>5||R==5&&(m==4||S||m==6&&(A>0?M>0?B/W[v-M]:0:V[L-1])%10&1||m==(u.s<0?8:7)),l<1||!V[0])return V.length=0,S?(l-=u.e+1,V[0]=W[(a-l%a)%a],u.e=-l||0):V[0]=u.e=0,u;if(A==0?(V.length=L,b=1,L--):(V.length=L+1,b=W[a-A],V[L]=M>0?i(B/W[v-M]%W[M])*b:0),S)for(;;)if(L==0){for(A=1,M=V[0];M>=10;M/=10,A++);for(M=V[0]+=b,b=1;M>=10;M/=10,b++);A!=b&&(u.e++,V[0]==c&&(V[0]=1));break}else{if(V[L]+=b,V[L]!=c)break;V[L--]=0,b=1}for(A=V.length;V[--A]===0;V.pop());}u.e>F?u.c=u.e=null:u.e<q&&(u.c=[u.e=0])}return u}function Q(u){var l,m=u.e;return m===null?u.toString():(l=N(u.c),l=m<=y||m>=I?D(l,m):K(l,m,"0"),u.s<0?"-"+l:l)}return k.absoluteValue=k.abs=function(){var u=new U(this);return u.s<0&&(u.s=1),u},k.comparedTo=function(u,l){return T(this,new U(u,l))},k.decimalPlaces=k.dp=function(u,l){var m,S,v,A=this;if(u!=null)return O(u,0,w),l==null?l=te:O(l,0,8),ae(new U(A),u+A.e+1,l);if(!(m=A.c))return null;if(S=((v=m.length-1)-f(this.e/a))*a,v=m[v])for(;v%10==0;v/=10,S--);return S<0&&(S=0),S},k.dividedBy=k.div=function(u,l){return C(this,new U(u,l),re,te)},k.dividedToIntegerBy=k.idiv=function(u,l){return C(this,new U(u,l),0,1)},k.exponentiatedBy=k.pow=function(u,l){var m,S,v,A,M,b,B,L,R,V=this;if(u=new U(u),u.c&&!u.isInteger())throw Error(s+"Exponent not an integer: "+Q(u));if(l!=null&&(l=new U(l)),b=u.e>14,!V.c||!V.c[0]||V.c[0]==1&&!V.e&&V.c.length==1||!u.c||!u.c[0])return R=new U(Math.pow(+Q(V),b?u.s*(2-H(u)):+Q(u))),l?R.mod(l):R;if(B=u.s<0,l){if(l.c?!l.c[0]:!l.s)return new U(NaN);S=!B&&V.isInteger()&&l.isInteger(),S&&(V=V.mod(l))}else{if(u.e>9&&(V.e>0||V.e<-1||(V.e==0?V.c[0]>1||b&&V.c[1]>=24e7:V.c[0]<8e13||b&&V.c[0]<=9999975e7)))return A=V.s<0&&H(u)?-0:0,V.e>-1&&(A=1/A),new U(B?1/A:A);Z&&(A=n(Z/a+2))}for(b?(m=new U(.5),B&&(u.s=1),L=H(u)):(v=Math.abs(+Q(u)),L=v%2),R=new U(fe);;){if(L){if(R=R.times(V),!R.c)break;A?R.c.length>A&&(R.c.length=A):S&&(R=R.mod(l))}if(v){if(v=i(v/2),v===0)break;L=v%2}else if(u=u.times(m),ae(u,u.e+1,1),u.e>14)L=H(u);else{if(v=+Q(u),v===0)break;L=v%2}V=V.times(V),A?V.c&&V.c.length>A&&(V.c.length=A):S&&(V=V.mod(l))}return S?R:(B&&(R=fe.div(R)),l?R.mod(l):A?ae(R,Z,te,M):R)},k.integerValue=function(u){var l=new U(this);return u==null?u=te:O(u,0,8),ae(l,l.e+1,u)},k.isEqualTo=k.eq=function(u,l){return T(this,new U(u,l))===0},k.isFinite=function(){return!!this.c},k.isGreaterThan=k.gt=function(u,l){return T(this,new U(u,l))>0},k.isGreaterThanOrEqualTo=k.gte=function(u,l){return(l=T(this,new U(u,l)))===1||l===0},k.isInteger=function(){return!!this.c&&f(this.e/a)>this.c.length-2},k.isLessThan=k.lt=function(u,l){return T(this,new U(u,l))<0},k.isLessThanOrEqualTo=k.lte=function(u,l){return(l=T(this,new U(u,l)))===-1||l===0},k.isNaN=function(){return!this.s},k.isNegative=function(){return this.s<0},k.isPositive=function(){return this.s>0},k.isZero=function(){return!!this.c&&this.c[0]==0},k.minus=function(u,l){var m,S,v,A,M=this,b=M.s;if(u=new U(u,l),l=u.s,!b||!l)return new U(NaN);if(b!=l)return u.s=-l,M.plus(u);var B=M.e/a,L=u.e/a,R=M.c,V=u.c;if(!B||!L){if(!R||!V)return R?(u.s=-l,u):new U(V?M:NaN);if(!R[0]||!V[0])return V[0]?(u.s=-l,u):new U(R[0]?M:te==3?-0:0)}if(B=f(B),L=f(L),R=R.slice(),b=B-L){for((A=b<0)?(b=-b,v=R):(L=B,v=V),v.reverse(),l=b;l--;v.push(0));v.reverse()}else for(S=(A=(b=R.length)<(l=V.length))?b:l,b=l=0;l<S;l++)if(R[l]!=V[l]){A=R[l]<V[l];break}if(A&&(v=R,R=V,V=v,u.s=-u.s),l=(S=V.length)-(m=R.length),l>0)for(;l--;R[m++]=0);for(l=c-1;S>b;){if(R[--S]<V[S]){for(m=S;m&&!R[--m];R[m]=l);--R[m],R[S]+=c}R[S]-=V[S]}for(;R[0]==0;R.splice(0,1),--L);return R[0]?ee(u,R,L):(u.s=te==3?-1:1,u.c=[u.e=0],u)},k.modulo=k.mod=function(u,l){var m,S,v=this;return u=new U(u,l),!v.c||!u.s||u.c&&!u.c[0]?new U(NaN):!u.c||v.c&&!v.c[0]?new U(v):($==9?(S=u.s,u.s=1,m=C(v,u,0,3),u.s=S,m.s*=S):m=C(v,u,0,$),u=v.minus(m.times(u)),!u.c[0]&&$==1&&(u.s=v.s),u)},k.multipliedBy=k.times=function(u,l){var m,S,v,A,M,b,B,L,R,V,W,ie,de,Ee,Ne,he=this,oe=he.c,ke=(u=new U(u,l)).c;if(!oe||!ke||!oe[0]||!ke[0])return!he.s||!u.s||oe&&!oe[0]&&!ke||ke&&!ke[0]&&!oe?u.c=u.e=u.s=null:(u.s*=he.s,!oe||!ke?u.c=u.e=null:(u.c=[0],u.e=0)),u;for(S=f(he.e/a)+f(u.e/a),u.s*=he.s,B=oe.length,V=ke.length,B<V&&(de=oe,oe=ke,ke=de,v=B,B=V,V=v),v=B+V,de=[];v--;de.push(0));for(Ee=c,Ne=g,v=V;--v>=0;){for(m=0,W=ke[v]%Ne,ie=ke[v]/Ne|0,M=B,A=v+M;A>v;)L=oe[--M]%Ne,R=oe[M]/Ne|0,b=ie*L+R*W,L=W*L+b%Ne*Ne+de[A]+m,m=(L/Ee|0)+(b/Ne|0)+ie*R,de[A--]=L%Ee;de[A]=m}return m?++S:de.splice(0,1),ee(u,de,S)},k.negated=function(){var u=new U(this);return u.s=-u.s||null,u},k.plus=function(u,l){var m,S=this,v=S.s;if(u=new U(u,l),l=u.s,!v||!l)return new U(NaN);if(v!=l)return u.s=-l,S.minus(u);var A=S.e/a,M=u.e/a,b=S.c,B=u.c;if(!A||!M){if(!b||!B)return new U(v/0);if(!b[0]||!B[0])return B[0]?u:new U(b[0]?S:v*0)}if(A=f(A),M=f(M),b=b.slice(),v=A-M){for(v>0?(M=A,m=B):(v=-v,m=b),m.reverse();v--;m.push(0));m.reverse()}for(v=b.length,l=B.length,v-l<0&&(m=B,B=b,b=m,l=v),v=0;l;)v=(b[--l]=b[l]+B[l]+v)/c|0,b[l]=c===b[l]?0:b[l]%c;return v&&(b=[v].concat(b),++M),ee(u,b,M)},k.precision=k.sd=function(u,l){var m,S,v,A=this;if(u!=null&&u!==!!u)return O(u,1,w),l==null?l=te:O(l,0,8),ae(new U(A),u,l);if(!(m=A.c))return null;if(v=m.length-1,S=v*a+1,v=m[v]){for(;v%10==0;v/=10,S--);for(v=m[0];v>=10;v/=10,S++);}return u&&A.e+1>S&&(S=A.e+1),S},k.shiftedBy=function(u){return O(u,-h,h),this.times("1e"+u)},k.squareRoot=k.sqrt=function(){var u,l,m,S,v,A=this,M=A.c,b=A.s,B=A.e,L=re+4,R=new U("0.5");if(b!==1||!M||!M[0])return new U(!b||b<0&&(!M||M[0])?NaN:M?A:1/0);if(b=Math.sqrt(+Q(A)),b==0||b==1/0?(l=N(M),(l.length+B)%2==0&&(l+="0"),b=Math.sqrt(+l),B=f((B+1)/2)-(B<0||B%2),b==1/0?l="5e"+B:(l=b.toExponential(),l=l.slice(0,l.indexOf("e")+1)+B),m=new U(l)):m=new U(b+""),m.c[0]){for(B=m.e,b=B+L,b<3&&(b=0);;)if(v=m,m=R.times(v.plus(C(A,v,L,1))),N(v.c).slice(0,b)===(l=N(m.c)).slice(0,b))if(m.e<B&&--b,l=l.slice(b-3,b+1),l=="9999"||!S&&l=="4999"){if(!S&&(ae(v,v.e+re+2,0),v.times(v).eq(A))){m=v;break}L+=4,b+=4,S=1}else{(!+l||!+l.slice(1)&&l.charAt(0)=="5")&&(ae(m,m.e+re+2,1),u=!m.times(m).eq(A));break}}return ae(m,m.e+re+1,te,u)},k.toExponential=function(u,l){return u!=null&&(O(u,0,w),u++),d(this,u,l,1)},k.toFixed=function(u,l){return u!=null&&(O(u,0,w),u=u+this.e+1),d(this,u,l)},k.toFormat=function(u,l,m){var S,v=this;if(m==null)u!=null&&l&&typeof l=="object"?(m=l,l=null):u&&typeof u=="object"?(m=u,u=l=null):m=ue;else if(typeof m!="object")throw Error(s+"Argument not an object: "+m);if(S=v.toFixed(u,l),v.c){var A,M=S.split("."),b=+m.groupSize,B=+m.secondaryGroupSize,L=m.groupSeparator||"",R=M[0],V=M[1],W=v.s<0,ie=W?R.slice(1):R,de=ie.length;if(B&&(A=b,b=B,B=A,de-=A),b>0&&de>0){for(A=de%b||b,R=ie.substr(0,A);A<de;A+=b)R+=L+ie.substr(A,b);B>0&&(R+=L+ie.slice(A)),W&&(R="-"+R)}S=V?R+(m.decimalSeparator||"")+((B=+m.fractionGroupSize)?V.replace(new RegExp("\\d{"+B+"}\\B","g"),"$&"+(m.fractionGroupSeparator||"")):V):R}return(m.prefix||"")+S+(m.suffix||"")},k.toFraction=function(u){var l,m,S,v,A,M,b,B,L,R,V,W,ie=this,de=ie.c;if(u!=null&&(b=new U(u),!b.isInteger()&&(b.c||b.s!==1)||b.lt(fe)))throw Error(s+"Argument "+(b.isInteger()?"out of range: ":"not an integer: ")+Q(b));if(!de)return new U(ie);for(l=new U(fe),L=m=new U(fe),S=B=new U(fe),W=N(de),A=l.e=W.length-ie.e-1,l.c[0]=p[(M=A%a)<0?a+M:M],u=!u||b.comparedTo(l)>0?A>0?l:L:b,M=F,F=1/0,b=new U(W),B.c[0]=0;R=C(b,l,0,1),v=m.plus(R.times(S)),v.comparedTo(u)!=1;)m=S,S=v,L=B.plus(R.times(v=L)),B=v,l=b.minus(R.times(v=l)),b=v;return v=C(u.minus(m),S,0,1),B=B.plus(v.times(L)),m=m.plus(v.times(S)),B.s=L.s=ie.s,A=A*2,V=C(L,S,A,te).minus(ie).abs().comparedTo(C(B,m,A,te).minus(ie).abs())<1?[L,S]:[B,m],F=M,V},k.toNumber=function(){return+Q(this)},k.toPrecision=function(u,l){return u!=null&&O(u,1,w),d(this,u,l,2)},k.toString=function(u){var l,m=this,S=m.s,v=m.e;return v===null?S?(l="Infinity",S<0&&(l="-"+l)):l="NaN":(u==null?l=v<=y||v>=I?D(N(m.c),v):K(N(m.c),v,"0"):u===10&&Y?(m=ae(new U(m),re+v+1,te),l=K(N(m.c),m.e,"0")):(O(u,2,ce.length,"Base"),l=G(K(N(m.c),v,"0"),10,u,S,!0)),S<0&&m.c[0]&&(l="-"+l)),l},k.valueOf=k.toJSON=function(){return Q(this)},k._isBigNumber=!0,E!=null&&U.set(E),U}function f(E){var C=E|0;return E>0||E===C?C:C-1}function N(E){for(var C,G,j=1,k=E.length,fe=E[0]+"";j<k;){for(C=E[j++]+"",G=a-C.length;G--;C="0"+C);fe+=C}for(k=fe.length;fe.charCodeAt(--k)===48;);return fe.slice(0,k+1||1)}function T(E,C){var G,j,k=E.c,fe=C.c,re=E.s,te=C.s,y=E.e,I=C.e;if(!re||!te)return null;if(G=k&&!k[0],j=fe&&!fe[0],G||j)return G?j?0:-te:re;if(re!=te)return re;if(G=re<0,j=y==I,!k||!fe)return j?0:!k^G?1:-1;if(!j)return y>I^G?1:-1;for(te=(y=k.length)<(I=fe.length)?y:I,re=0;re<te;re++)if(k[re]!=fe[re])return k[re]>fe[re]^G?1:-1;return y==I?0:y>I^G?1:-1}function O(E,C,G,j){if(E<C||E>G||E!==i(E))throw Error(s+(j||"Argument")+(typeof E=="number"?E<C||E>G?" out of range: ":" not an integer: ":" not a primitive number: ")+String(E))}function H(E){var C=E.c.length-1;return f(E.e/a)==C&&E.c[C]%2!=0}function D(E,C){return(E.length>1?E.charAt(0)+"."+E.slice(1):E)+(C<0?"e":"e+")+C}function K(E,C,G){var j,k;if(C<0){for(k=G+".";++C;k+=G);E=k+E}else if(j=E.length,++C>j){for(k=G,C-=j;--C;k+=G);E+=k}else C<j&&(E=E.slice(0,C)+"."+E.slice(C));return E}e=x(),e.default=e.BigNumber=e,typeof define=="function"&&define.amd?define(function(){return e}):typeof Wn<"u"&&Wn.exports?Wn.exports=e:(r||(r=typeof self<"u"&&self?self:window),r.BigNumber=e)})(pa)});var ga=ze((rd,ma)=>{ma.exports=function(e,t,n){var i=new e.Uint8Array(n),s=t.pushInt,o=t.pushInt32,c=t.pushInt32Neg,a=t.pushInt64,h=t.pushInt64Neg,p=t.pushFloat,g=t.pushFloatSingle,w=t.pushFloatDouble,x=t.pushTrue,f=t.pushFalse,N=t.pushUndefined,T=t.pushNull,O=t.pushInfinity,H=t.pushInfinityNeg,D=t.pushNaN,K=t.pushNaNNeg,E=t.pushArrayStart,C=t.pushArrayStartFixed,G=t.pushArrayStartFixed32,j=t.pushArrayStartFixed64,k=t.pushObjectStart,fe=t.pushObjectStartFixed,re=t.pushObjectStartFixed32,te=t.pushObjectStartFixed64,y=t.pushByteString,I=t.pushByteStringStart,q=t.pushUtf8String,F=t.pushUtf8StringStart,P=t.pushSimpleUnassigned,$=t.pushTagStart,Z=t.pushTagStart4,ue=t.pushTagStart8,ce=t.pushTagUnassigned,Y=t.pushBreak,U=e.Math.pow,d=0,J=0,ee=0;function ae(_){for(_=_|0,d=0,J=_;(d|0)<(J|0)&&(ee=Yu[i[d]&255](i[d]|0)|0,!((ee|0)>0)););return ee|0}function Q(_){return _=_|0,((d|0)+(_|0)|0)<(J|0)?0:1}function u(_){return _=_|0,i[_|0]<<8|i[_+1|0]|0}function l(_){return _=_|0,i[_|0]<<24|i[_+1|0]<<16|i[_+2|0]<<8|i[_+3|0]|0}function m(_){return _=_|0,s(_|0),d=d+1|0,0}function S(_){return _=_|0,Q(1)|0?1:(s(i[d+1|0]|0),d=d+2|0,0)}function v(_){return _=_|0,Q(2)|0?1:(s(u(d+1|0)|0),d=d+3|0,0)}function A(_){return _=_|0,Q(4)|0?1:(o(u(d+1|0)|0,u(d+3|0)|0),d=d+5|0,0)}function M(_){return _=_|0,Q(8)|0?1:(a(u(d+1|0)|0,u(d+3|0)|0,u(d+5|0)|0,u(d+7|0)|0),d=d+9|0,0)}function b(_){return _=_|0,s(-1-(_-32|0)|0),d=d+1|0,0}function B(_){return _=_|0,Q(1)|0?1:(s(-1-(i[d+1|0]|0)|0),d=d+2|0,0)}function L(_){_=_|0;var ye=0;return Q(2)|0?1:(ye=u(d+1|0)|0,s(-1-(ye|0)|0),d=d+3|0,0)}function R(_){return _=_|0,Q(4)|0?1:(c(u(d+1|0)|0,u(d+3|0)|0),d=d+5|0,0)}function V(_){return _=_|0,Q(8)|0?1:(h(u(d+1|0)|0,u(d+3|0)|0,u(d+5|0)|0,u(d+7|0)|0),d=d+9|0,0)}function W(_){_=_|0;var ye=0,we=0,pe=0;return pe=_-64|0,Q(pe|0)|0?1:(ye=d+1|0,we=(d+1|0)+(pe|0)|0,y(ye|0,we|0),d=we|0,0)}function ie(_){_=_|0;var ye=0,we=0,pe=0;return Q(1)|0||(pe=i[d+1|0]|0,ye=d+2|0,we=(d+2|0)+(pe|0)|0,Q(pe+1|0)|0)?1:(y(ye|0,we|0),d=we|0,0)}function de(_){_=_|0;var ye=0,we=0,pe=0;return Q(2)|0||(pe=u(d+1|0)|0,ye=d+3|0,we=(d+3|0)+(pe|0)|0,Q(pe+2|0)|0)?1:(y(ye|0,we|0),d=we|0,0)}function Ee(_){_=_|0;var ye=0,we=0,pe=0;return Q(4)|0||(pe=l(d+1|0)|0,ye=d+5|0,we=(d+5|0)+(pe|0)|0,Q(pe+4|0)|0)?1:(y(ye|0,we|0),d=we|0,0)}function Ne(_){return _=_|0,1}function he(_){return _=_|0,I(),d=d+1|0,0}function oe(_){_=_|0;var ye=0,we=0,pe=0;return pe=_-96|0,Q(pe|0)|0?1:(ye=d+1|0,we=(d+1|0)+(pe|0)|0,q(ye|0,we|0),d=we|0,0)}function ke(_){_=_|0;var ye=0,we=0,pe=0;return Q(1)|0||(pe=i[d+1|0]|0,ye=d+2|0,we=(d+2|0)+(pe|0)|0,Q(pe+1|0)|0)?1:(q(ye|0,we|0),d=we|0,0)}function Qt(_){_=_|0;var ye=0,we=0,pe=0;return Q(2)|0||(pe=u(d+1|0)|0,ye=d+3|0,we=(d+3|0)+(pe|0)|0,Q(pe+2|0)|0)?1:(q(ye|0,we|0),d=we|0,0)}function mr(_){_=_|0;var ye=0,we=0,pe=0;return Q(4)|0||(pe=l(d+1|0)|0,ye=d+5|0,we=(d+5|0)+(pe|0)|0,Q(pe+4|0)|0)?1:(q(ye|0,we|0),d=we|0,0)}function gr(_){return _=_|0,1}function pt(_){return _=_|0,F(),d=d+1|0,0}function be(_){return _=_|0,C(_-128|0),d=d+1|0,0}function ot(_){return _=_|0,Q(1)|0?1:(C(i[d+1|0]|0),d=d+2|0,0)}function We(_){return _=_|0,Q(2)|0?1:(C(u(d+1|0)|0),d=d+3|0,0)}function Re(_){return _=_|0,Q(4)|0?1:(G(u(d+1|0)|0,u(d+3|0)|0),d=d+5|0,0)}function Su(_){return _=_|0,Q(8)|0?1:(j(u(d+1|0)|0,u(d+3|0)|0,u(d+5|0)|0,u(d+7|0)|0),d=d+9|0,0)}function Bu(_){return _=_|0,E(),d=d+1|0,0}function Oe(_){_=_|0;var ye=0;return ye=_-160|0,Q(ye|0)|0?1:(fe(ye|0),d=d+1|0,0)}function Tu(_){return _=_|0,Q(1)|0?1:(fe(i[d+1|0]|0),d=d+2|0,0)}function Nu(_){return _=_|0,Q(2)|0?1:(fe(u(d+1|0)|0),d=d+3|0,0)}function Ru(_){return _=_|0,Q(4)|0?1:(re(u(d+1|0)|0,u(d+3|0)|0),d=d+5|0,0)}function Ou(_){return _=_|0,Q(8)|0?1:(te(u(d+1|0)|0,u(d+3|0)|0,u(d+5|0)|0,u(d+7|0)|0),d=d+9|0,0)}function Uu(_){return _=_|0,k(),d=d+1|0,0}function Fr(_){return _=_|0,$(_-192|0|0),d=d+1|0,0}function wh(_){return _=_|0,$(_|0),d=d+1|0,0}function bh(_){return _=_|0,$(_|0),d=d+1|0,0}function xh(_){return _=_|0,$(_|0),d=d+1|0,0}function _h(_){return _=_|0,$(_|0),d=d+1|0,0}function Ye(_){return _=_|0,$(_-192|0|0),d=d+1|0,0}function Eh(_){return _=_|0,$(_|0),d=d+1|0,0}function vh(_){return _=_|0,$(_|0),d=d+1|0,0}function Ih(_){return _=_|0,$(_|0),d=d+1|0,0}function Fu(_){return _=_|0,Q(1)|0?1:($(i[d+1|0]|0),d=d+2|0,0)}function Pu(_){return _=_|0,Q(2)|0?1:($(u(d+1|0)|0),d=d+3|0,0)}function Lu(_){return _=_|0,Q(4)|0?1:(Z(u(d+1|0)|0,u(d+3|0)|0),d=d+5|0,0)}function Mu(_){return _=_|0,Q(8)|0?1:(ue(u(d+1|0)|0,u(d+3|0)|0,u(d+5|0)|0,u(d+7|0)|0),d=d+9|0,0)}function qe(_){return _=_|0,P((_|0)-224|0),d=d+1|0,0}function Du(_){return _=_|0,f(),d=d+1|0,0}function ku(_){return _=_|0,x(),d=d+1|0,0}function qu(_){return _=_|0,T(),d=d+1|0,0}function Cu(_){return _=_|0,N(),d=d+1|0,0}function $u(_){return _=_|0,Q(1)|0?1:(P(i[d+1|0]|0),d=d+2|0,0)}function Hu(_){_=_|0;var ye=0,we=0,pe=1,Ln=0,tn=0,Ah=0;return Q(2)|0?1:(ye=i[d+1|0]|0,we=i[d+2|0]|0,(ye|0)&128&&(pe=-1),Ln=+(((ye|0)&124)>>2),tn=+(((ye|0)&3)<<8|we),+Ln==0?p(+(+pe*5960464477539063e-23*+tn)):+Ln==31?+pe==1?+tn>0?D():O():+tn>0?K():H():p(+(+pe*U(2,+(+Ln-25))*+(1024+tn))),d=d+3|0,0)}function Gu(_){return _=_|0,Q(4)|0?1:(g(i[d+1|0]|0,i[d+2|0]|0,i[d+3|0]|0,i[d+4|0]|0),d=d+5|0,0)}function Vu(_){return _=_|0,Q(8)|0?1:(w(i[d+1|0]|0,i[d+2|0]|0,i[d+3|0]|0,i[d+4|0]|0,i[d+5|0]|0,i[d+6|0]|0,i[d+7|0]|0,i[d+8|0]|0),d=d+9|0,0)}function ve(_){return _=_|0,1}function ju(_){return _=_|0,Y(),d=d+1|0,0}var Yu=[m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,S,v,A,M,ve,ve,ve,ve,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,B,L,R,V,ve,ve,ve,ve,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,ie,de,Ee,Ne,ve,ve,ve,he,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,ke,Qt,mr,gr,ve,ve,ve,pt,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,ot,We,Re,Su,ve,ve,ve,Bu,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Tu,Nu,Ru,Ou,ve,ve,ve,Uu,Fr,Fr,Fr,Fr,Fr,Fr,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Ye,Fu,Pu,Lu,Mu,ve,ve,ve,ve,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,qe,Du,ku,qu,Cu,$u,Hu,Gu,Vu,ve,ve,ve,ju];return{parse:ae}}});var un=ze(ft=>{"use strict";var vs=cn().BigNumber;ft.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7};ft.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36};ft.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31};ft.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23};ft.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")};ft.SHIFT32=Math.pow(2,32);ft.SHIFT16=Math.pow(2,16);ft.MAX_SAFE_HIGH=2097151;ft.NEG_ONE=new vs(-1);ft.TEN=new vs(10);ft.TWO=new vs(2);ft.PARENT={ARRAY:0,OBJECT:1,MAP:2,TAG:3,BYTE_STRING:4,UTF8_STRING:5}});var Xn=ze(gt=>{"use strict";var{Buffer:$f}=an(),wa=cn().BigNumber,ba=un(),ya=ba.SHIFT32,Hf=ba.SHIFT16,Gf=2097151;gt.parseHalf=function(e){var t,n,i;return i=e[0]&128?-1:1,t=(e[0]&124)>>2,n=(e[0]&3)<<8|e[1],t?t===31?i*(n?NaN:1/0):i*Math.pow(2,t-25)*(1024+n):i*5960464477539063e-23*n};function Vf(r){return r<16?"0"+r.toString(16):r.toString(16)}gt.arrayBufferToBignumber=function(r){let e=r.byteLength,t="";for(let n=0;n<e;n++)t+=Vf(r[n]);return new wa(t,16)};gt.buildMap=r=>{let e=new Map,t=Object.keys(r),n=t.length;for(let i=0;i<n;i++)e.set(t[i],r[t[i]]);return e};gt.buildInt32=(r,e)=>r*Hf+e;gt.buildInt64=(r,e,t,n)=>{let i=gt.buildInt32(r,e),s=gt.buildInt32(t,n);return i>Gf?new wa(i).times(ya).plus(s):i*ya+s};gt.writeHalf=function(e,t){let n=$f.allocUnsafe(4);n.writeFloatBE(t,0);let i=n.readUInt32BE(0);if((i&8191)!==0)return!1;var s=i>>16&32768;let o=i>>23&255,c=i&8388607;if(o>=113&&o<=142)s+=(o-112<<10)+(c>>13);else if(o>=103&&o<113){if(c&(1<<126-o)-1)return!1;s+=c+8388608>>126-o}else return!1;return e.writeUInt16BE(s,0),!0};gt.keySorter=function(r,e){var t=r[0].byteLength,n=e[0].byteLength;return t>n?1:n>t?-1:r[0].compare(e[0])};gt.isNegativeZero=r=>r===0&&1/r<0;gt.nextPowerOf2=r=>{let e=0;if(r&&!(r&r-1))return r;for(;r!==0;)r>>=1,e+=1;return 1<<e}});var Bs=ze((sd,xa)=>{"use strict";var Ss=un(),jf=Ss.MT,Qn=Ss.SIMPLE,Is=Ss.SYMS,As=class r{constructor(e){if(typeof e!="number")throw new Error("Invalid Simple type: "+typeof e);if(e<0||e>255||(e|0)!==e)throw new Error("value must be a small positive integer: "+e);this.value=e}toString(){return"simple("+this.value+")"}inspect(){return"simple("+this.value+")"}encodeCBOR(e){return e._pushInt(this.value,jf.SIMPLE_FLOAT)}static isSimple(e){return e instanceof r}static decode(e,t){switch(t==null&&(t=!0),e){case Qn.FALSE:return!1;case Qn.TRUE:return!0;case Qn.NULL:return t?null:Is.NULL;case Qn.UNDEFINED:return t?void 0:Is.UNDEFINED;case-1:if(!t)throw new Error("Invalid BREAK");return Is.BREAK;default:return new r(e)}}};xa.exports=As});var Ns=ze((od,_a)=>{"use strict";var Ts=class r{constructor(e,t,n){if(this.tag=e,this.value=t,this.err=n,typeof this.tag!="number")throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(this.tag|0)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(e){return e._pushTag(this.tag),e.pushAny(this.value)}convert(e){var t,n;if(n=e?.[this.tag],typeof n!="function"&&(n=r["_tag"+this.tag],typeof n!="function"))return this;try{return n.call(r,this.value)}catch(i){return t=i,this.err=t,this}}};_a.exports=Ts});var Us=ze((ad,va)=>{"use strict";var Ea=self.location?self.location.protocol+"//"+self.location.host:"",Rs=self.URL,Os=class{constructor(e="",t=Ea){this.super=new Rs(e,t),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set origin(e){this.super.origin=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set searchParams(e){this.super.searchParams=e}set username(e){this.super.username=e}createObjectURL(e){return this.super.createObjectURL(e)}revokeObjectURL(e){this.super.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}};function Yf(r){if(typeof r=="string")return new Rs(r).toString();if(!(r instanceof Rs)){let e=r.username&&r.password?`${r.username}:${r.password}@`:"",t=r.auth?r.auth+"@":"",n=r.port?":"+r.port:"",i=r.protocol?r.protocol+"//":"",s=r.host||"",o=r.hostname||"",c=r.search||(r.query?"?"+r.query:""),a=r.hash||"",h=r.pathname||"",p=r.path||h+c;return`${i}${e||t}${s||o+n}${p}${a}`}}va.exports={URLWithLegacySupport:Os,URLSearchParams:self.URLSearchParams,defaultBase:Ea,format:Yf}});var Sa=ze((cd,Aa)=>{"use strict";var{URLWithLegacySupport:Ia,format:zf}=Us();Aa.exports=(r,e={},t={},n)=>{let i=e.protocol?e.protocol.replace(":",""):"http";i=(t[i]||n||i)+":";let s;try{s=new Ia(r)}catch{s={}}let o=Object.assign({},e,{protocol:i||s.protocol,host:e.host||s.host});return new Ia(r,zf(o)).toString()}});var Fs=ze((ud,Ba)=>{"use strict";var{URLWithLegacySupport:Kf,format:Zf,URLSearchParams:Wf,defaultBase:Xf}=Us(),Qf=Sa();Ba.exports={URL:Kf,URLSearchParams:Wf,format:Zf,relative:Qf,defaultBase:Xf}});var Ps=ze((fd,Na)=>{"use strict";var{Buffer:Mr}=an(),Ta=da(),Jf=cn().BigNumber,e0=ga(),nt=Xn(),_e=un(),t0=Bs(),r0=Ns(),{URL:n0}=Fs(),fn=class r{constructor(e){e=e||{},!e.size||e.size<65536?e.size=65536:e.size=nt.nextPowerOf2(e.size),this._heap=new ArrayBuffer(e.size),this._heap8=new Uint8Array(this._heap),this._buffer=Mr.from(this._heap),this._reset(),this._knownTags=Object.assign({0:t=>new Date(t),1:t=>new Date(t*1e3),2:t=>nt.arrayBufferToBignumber(t),3:t=>_e.NEG_ONE.minus(nt.arrayBufferToBignumber(t)),4:t=>_e.TEN.pow(t[0]).times(t[1]),5:t=>_e.TWO.pow(t[0]).times(t[1]),32:t=>new n0(t),35:t=>new RegExp(t)},e.tags),this.parser=e0(globalThis,{log:console.log.bind(console),pushInt:this.pushInt.bind(this),pushInt32:this.pushInt32.bind(this),pushInt32Neg:this.pushInt32Neg.bind(this),pushInt64:this.pushInt64.bind(this),pushInt64Neg:this.pushInt64Neg.bind(this),pushFloat:this.pushFloat.bind(this),pushFloatSingle:this.pushFloatSingle.bind(this),pushFloatDouble:this.pushFloatDouble.bind(this),pushTrue:this.pushTrue.bind(this),pushFalse:this.pushFalse.bind(this),pushUndefined:this.pushUndefined.bind(this),pushNull:this.pushNull.bind(this),pushInfinity:this.pushInfinity.bind(this),pushInfinityNeg:this.pushInfinityNeg.bind(this),pushNaN:this.pushNaN.bind(this),pushNaNNeg:this.pushNaNNeg.bind(this),pushArrayStart:this.pushArrayStart.bind(this),pushArrayStartFixed:this.pushArrayStartFixed.bind(this),pushArrayStartFixed32:this.pushArrayStartFixed32.bind(this),pushArrayStartFixed64:this.pushArrayStartFixed64.bind(this),pushObjectStart:this.pushObjectStart.bind(this),pushObjectStartFixed:this.pushObjectStartFixed.bind(this),pushObjectStartFixed32:this.pushObjectStartFixed32.bind(this),pushObjectStartFixed64:this.pushObjectStartFixed64.bind(this),pushByteString:this.pushByteString.bind(this),pushByteStringStart:this.pushByteStringStart.bind(this),pushUtf8String:this.pushUtf8String.bind(this),pushUtf8StringStart:this.pushUtf8StringStart.bind(this),pushSimpleUnassigned:this.pushSimpleUnassigned.bind(this),pushTagUnassigned:this.pushTagUnassigned.bind(this),pushTagStart:this.pushTagStart.bind(this),pushTagStart4:this.pushTagStart4.bind(this),pushTagStart8:this.pushTagStart8.bind(this),pushBreak:this.pushBreak.bind(this)},this._heap)}get _depth(){return this._parents.length}get _currentParent(){return this._parents[this._depth-1]}get _ref(){return this._currentParent.ref}_closeParent(){var e=this._parents.pop();if(e.length>0)throw new Error(`Missing ${e.length} elements`);switch(e.type){case _e.PARENT.TAG:this._push(this.createTag(e.ref[0],e.ref[1]));break;case _e.PARENT.BYTE_STRING:this._push(this.createByteString(e.ref,e.length));break;case _e.PARENT.UTF8_STRING:this._push(this.createUtf8String(e.ref,e.length));break;case _e.PARENT.MAP:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createMap(e.ref,e.length));break;case _e.PARENT.OBJECT:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createObject(e.ref,e.length));break;case _e.PARENT.ARRAY:this._push(this.createArray(e.ref,e.length));break;default:break}this._currentParent&&this._currentParent.type===_e.PARENT.TAG&&this._dec()}_dec(){let e=this._currentParent;e.length<0||(e.length--,e.length===0&&this._closeParent())}_push(e,t){let n=this._currentParent;switch(n.values++,n.type){case _e.PARENT.ARRAY:case _e.PARENT.BYTE_STRING:case _e.PARENT.UTF8_STRING:n.length>-1?this._ref[this._ref.length-n.length]=e:this._ref.push(e),this._dec();break;case _e.PARENT.OBJECT:n.tmpKey!=null?(this._ref[n.tmpKey]=e,n.tmpKey=null,this._dec()):(n.tmpKey=e,typeof n.tmpKey!="string"&&(n.type=_e.PARENT.MAP,n.ref=nt.buildMap(n.ref)));break;case _e.PARENT.MAP:n.tmpKey!=null?(this._ref.set(n.tmpKey,e),n.tmpKey=null,this._dec()):n.tmpKey=e;break;case _e.PARENT.TAG:this._ref.push(e),t||this._dec();break;default:throw new Error("Unknown parent type")}}_createParent(e,t,n){this._parents[this._depth]={type:t,length:n,ref:e,values:0,tmpKey:null}}_reset(){this._res=[],this._parents=[{type:_e.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}createTag(e,t){let n=this._knownTags[e];return n?n(t):new r0(e,t)}createMap(e,t){return e}createObject(e,t){return e}createArray(e,t){return e}createByteString(e,t){return Mr.concat(e)}createByteStringFromHeap(e,t){return e===t?Mr.alloc(0):Mr.from(this._heap.slice(e,t))}createInt(e){return e}createInt32(e,t){return nt.buildInt32(e,t)}createInt64(e,t,n,i){return nt.buildInt64(e,t,n,i)}createFloat(e){return e}createFloatSingle(e,t,n,i){return Ta.read([e,t,n,i],0,!1,23,4)}createFloatDouble(e,t,n,i,s,o,c,a){return Ta.read([e,t,n,i,s,o,c,a],0,!1,52,8)}createInt32Neg(e,t){return-1-nt.buildInt32(e,t)}createInt64Neg(e,t,n,i){let s=nt.buildInt32(e,t),o=nt.buildInt32(n,i);return s>_e.MAX_SAFE_HIGH?_e.NEG_ONE.minus(new Jf(s).times(_e.SHIFT32).plus(o)):-1-(s*_e.SHIFT32+o)}createTrue(){return!0}createFalse(){return!1}createNull(){return null}createUndefined(){}createInfinity(){return 1/0}createInfinityNeg(){return-1/0}createNaN(){return NaN}createNaNNeg(){return NaN}createUtf8String(e,t){return e.join("")}createUtf8StringFromHeap(e,t){return e===t?"":this._buffer.toString("utf8",e,t)}createSimpleUnassigned(e){return new t0(e)}pushInt(e){this._push(this.createInt(e))}pushInt32(e,t){this._push(this.createInt32(e,t))}pushInt64(e,t,n,i){this._push(this.createInt64(e,t,n,i))}pushFloat(e){this._push(this.createFloat(e))}pushFloatSingle(e,t,n,i){this._push(this.createFloatSingle(e,t,n,i))}pushFloatDouble(e,t,n,i,s,o,c,a){this._push(this.createFloatDouble(e,t,n,i,s,o,c,a))}pushInt32Neg(e,t){this._push(this.createInt32Neg(e,t))}pushInt64Neg(e,t,n,i){this._push(this.createInt64Neg(e,t,n,i))}pushTrue(){this._push(this.createTrue())}pushFalse(){this._push(this.createFalse())}pushNull(){this._push(this.createNull())}pushUndefined(){this._push(this.createUndefined())}pushInfinity(){this._push(this.createInfinity())}pushInfinityNeg(){this._push(this.createInfinityNeg())}pushNaN(){this._push(this.createNaN())}pushNaNNeg(){this._push(this.createNaNNeg())}pushArrayStart(){this._createParent([],_e.PARENT.ARRAY,-1)}pushArrayStartFixed(e){this._createArrayStartFixed(e)}pushArrayStartFixed32(e,t){let n=nt.buildInt32(e,t);this._createArrayStartFixed(n)}pushArrayStartFixed64(e,t,n,i){let s=nt.buildInt64(e,t,n,i);this._createArrayStartFixed(s)}pushObjectStart(){this._createObjectStartFixed(-1)}pushObjectStartFixed(e){this._createObjectStartFixed(e)}pushObjectStartFixed32(e,t){let n=nt.buildInt32(e,t);this._createObjectStartFixed(n)}pushObjectStartFixed64(e,t,n,i){let s=nt.buildInt64(e,t,n,i);this._createObjectStartFixed(s)}pushByteStringStart(){this._parents[this._depth]={type:_e.PARENT.BYTE_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushByteString(e,t){this._push(this.createByteStringFromHeap(e,t))}pushUtf8StringStart(){this._parents[this._depth]={type:_e.PARENT.UTF8_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushUtf8String(e,t){this._push(this.createUtf8StringFromHeap(e,t))}pushSimpleUnassigned(e){this._push(this.createSimpleUnassigned(e))}pushTagStart(e){this._parents[this._depth]={type:_e.PARENT.TAG,length:1,ref:[e]}}pushTagStart4(e,t){this.pushTagStart(nt.buildInt32(e,t))}pushTagStart8(e,t,n,i){this.pushTagStart(nt.buildInt64(e,t,n,i))}pushTagUnassigned(e){this._push(this.createTag(e))}pushBreak(){if(this._currentParent.length>-1)throw new Error("Unexpected break");this._closeParent()}_createObjectStartFixed(e){if(e===0){this._push(this.createObject({}));return}this._createParent({},_e.PARENT.OBJECT,e)}_createArrayStartFixed(e){if(e===0){this._push(this.createArray([]));return}this._createParent(new Array(e),_e.PARENT.ARRAY,e)}_decode(e){if(e.byteLength===0)throw new Error("Input too short");this._reset(),this._heap8.set(e);let t=this.parser.parse(e.byteLength);if(this._depth>1){for(;this._currentParent.length===0;)this._closeParent();if(this._depth>1)throw new Error("Undeterminated nesting")}if(t>0)throw new Error("Failed to parse");if(this._res.length===0)throw new Error("No valid result")}decodeFirst(e){return this._decode(e),this._res[0]}decodeAll(e){return this._decode(e),this._res}static decode(e,t){return typeof e=="string"&&(e=Mr.from(e,t||"hex")),new r({size:e.length}).decodeFirst(e)}static decodeAll(e,t){return typeof e=="string"&&(e=Mr.from(e,t||"hex")),new r({size:e.length}).decodeAll(e)}};fn.decodeFirst=fn.decode;Na.exports=fn});var Ua=ze((ld,Oa)=>{"use strict";var{Buffer:Ls}=an(),i0=Ps(),s0=Xn(),Ms=class r extends i0{createTag(e,t){return`${e}(${t})`}createInt(e){return super.createInt(e).toString()}createInt32(e,t){return super.createInt32(e,t).toString()}createInt64(e,t,n,i){return super.createInt64(e,t,n,i).toString()}createInt32Neg(e,t){return super.createInt32Neg(e,t).toString()}createInt64Neg(e,t,n,i){return super.createInt64Neg(e,t,n,i).toString()}createTrue(){return"true"}createFalse(){return"false"}createFloat(e){let t=super.createFloat(e);return s0.isNegativeZero(e)?"-0_1":`${t}_1`}createFloatSingle(e,t,n,i){return`${super.createFloatSingle(e,t,n,i)}_2`}createFloatDouble(e,t,n,i,s,o,c,a){return`${super.createFloatDouble(e,t,n,i,s,o,c,a)}_3`}createByteString(e,t){let n=e.join(", ");return t===-1?`(_ ${n})`:`h'${n}`}createByteStringFromHeap(e,t){return`h'${Ls.from(super.createByteStringFromHeap(e,t)).toString("hex")}'`}createInfinity(){return"Infinity_1"}createInfinityNeg(){return"-Infinity_1"}createNaN(){return"NaN_1"}createNaNNeg(){return"-NaN_1"}createNull(){return"null"}createUndefined(){return"undefined"}createSimpleUnassigned(e){return`simple(${e})`}createArray(e,t){let n=super.createArray(e,t);return t===-1?`[_ ${n.join(", ")}]`:`[${n.join(", ")}]`}createMap(e,t){let n=super.createMap(e),i=Array.from(n.keys()).reduce(Ra(n),"");return t===-1?`{_ ${i}}`:`{${i}}`}createObject(e,t){let n=super.createObject(e),i=Object.keys(n).reduce(Ra(n),"");return t===-1?`{_ ${i}}`:`{${i}}`}createUtf8String(e,t){let n=e.join(", ");return t===-1?`(_ ${n})`:`"${n}"`}createUtf8StringFromHeap(e,t){return`"${Ls.from(super.createUtf8StringFromHeap(e,t)).toString("utf8")}"`}static diagnose(e,t){return typeof e=="string"&&(e=Ls.from(e,t||"hex")),new r().decodeFirst(e)}};Oa.exports=Ms;function Ra(r){return(e,t)=>e?`${e}, ${t}: ${r[t]}`:`${t}: ${r[t]}`}});var Da=ze((hd,Ma)=>{"use strict";var{Buffer:Lt}=an(),{URL:o0}=Fs(),ks=cn().BigNumber,Ds=Xn(),Ge=un(),xt=Ge.MT,Jn=Ge.NUMBYTES,Fa=Ge.SHIFT32,Pa=Ge.SYMS,Dr=Ge.TAG,a0=Ge.MT.SIMPLE_FLOAT<<5|Ge.NUMBYTES.TWO,c0=Ge.MT.SIMPLE_FLOAT<<5|Ge.NUMBYTES.FOUR,u0=Ge.MT.SIMPLE_FLOAT<<5|Ge.NUMBYTES.EIGHT,f0=Ge.MT.SIMPLE_FLOAT<<5|Ge.SIMPLE.TRUE,l0=Ge.MT.SIMPLE_FLOAT<<5|Ge.SIMPLE.FALSE,h0=Ge.MT.SIMPLE_FLOAT<<5|Ge.SIMPLE.UNDEFINED,La=Ge.MT.SIMPLE_FLOAT<<5|Ge.SIMPLE.NULL,d0=new ks("0x20000000000000"),p0=Lt.from("f97e00","hex"),m0=Lt.from("f9fc00","hex"),g0=Lt.from("f97c00","hex");function y0(r){return{}.toString.call(r).slice(8,-1)}var qs=class r{constructor(e){e=e||{},this.streaming=typeof e.stream=="function",this.onData=e.stream,this.semanticTypes=[[o0,this._pushUrl],[ks,this._pushBigNumber]];let t=e.genTypes||[],n=t.length;for(let i=0;i<n;i++)this.addSemanticType(t[i][0],t[i][1]);this._reset()}addSemanticType(e,t){let n=this.semanticTypes.length;for(let i=0;i<n;i++)if(this.semanticTypes[i][0]===e){let o=this.semanticTypes[i][1];return this.semanticTypes[i][1]=t,o}return this.semanticTypes.push([e,t]),null}push(e){return e&&(this.result[this.offset]=e,this.resultMethod[this.offset]=0,this.resultLength[this.offset]=e.length,this.offset++,this.streaming&&this.onData(this.finalize())),!0}pushWrite(e,t,n){return this.result[this.offset]=e,this.resultMethod[this.offset]=t,this.resultLength[this.offset]=n,this.offset++,this.streaming&&this.onData(this.finalize()),!0}_pushUInt8(e){return this.pushWrite(e,1,1)}_pushUInt16BE(e){return this.pushWrite(e,2,2)}_pushUInt32BE(e){return this.pushWrite(e,3,4)}_pushDoubleBE(e){return this.pushWrite(e,4,8)}_pushNaN(){return this.push(p0)}_pushInfinity(e){let t=e<0?m0:g0;return this.push(t)}_pushFloat(e){let t=Lt.allocUnsafe(2);if(Ds.writeHalf(t,e)&&Ds.parseHalf(t)===e)return this._pushUInt8(a0)&&this.push(t);let n=Lt.allocUnsafe(4);return n.writeFloatBE(e,0),n.readFloatBE(0)===e?this._pushUInt8(c0)&&this.push(n):this._pushUInt8(u0)&&this._pushDoubleBE(e)}_pushInt(e,t,n){let i=t<<5;return e<24?this._pushUInt8(i|e):e<=255?this._pushUInt8(i|Jn.ONE)&&this._pushUInt8(e):e<=65535?this._pushUInt8(i|Jn.TWO)&&this._pushUInt16BE(e):e<=4294967295?this._pushUInt8(i|Jn.FOUR)&&this._pushUInt32BE(e):e<=Number.MAX_SAFE_INTEGER?this._pushUInt8(i|Jn.EIGHT)&&this._pushUInt32BE(Math.floor(e/Fa))&&this._pushUInt32BE(e%Fa):t===xt.NEG_INT?this._pushFloat(n):this._pushFloat(e)}_pushIntNum(e){return e<0?this._pushInt(-e-1,xt.NEG_INT,e):this._pushInt(e,xt.POS_INT)}_pushNumber(e){switch(!1){case e===e:return this._pushNaN(e);case isFinite(e):return this._pushInfinity(e);case e%1!==0:return this._pushIntNum(e);default:return this._pushFloat(e)}}_pushString(e){let t=Lt.byteLength(e,"utf8");return this._pushInt(t,xt.UTF8_STRING)&&this.pushWrite(e,5,t)}_pushBoolean(e){return this._pushUInt8(e?f0:l0)}_pushUndefined(e){return this._pushUInt8(h0)}_pushArray(e,t){let n=t.length;if(!e._pushInt(n,xt.ARRAY))return!1;for(let i=0;i<n;i++)if(!e.pushAny(t[i]))return!1;return!0}_pushTag(e){return this._pushInt(e,xt.TAG)}_pushDate(e,t){return e._pushTag(Dr.DATE_EPOCH)&&e.pushAny(Math.round(t/1e3))}_pushBuffer(e,t){return e._pushInt(t.length,xt.BYTE_STRING)&&e.push(t)}_pushNoFilter(e,t){return e._pushBuffer(e,t.slice())}_pushRegexp(e,t){return e._pushTag(Dr.REGEXP)&&e.pushAny(t.source)}_pushSet(e,t){if(!e._pushInt(t.size,xt.ARRAY))return!1;for(let n of t)if(!e.pushAny(n))return!1;return!0}_pushUrl(e,t){return e._pushTag(Dr.URI)&&e.pushAny(t.format())}_pushBigint(e){let t=Dr.POS_BIGINT;e.isNegative()&&(e=e.negated().minus(1),t=Dr.NEG_BIGINT);let n=e.toString(16);n.length%2&&(n="0"+n);let i=Lt.from(n,"hex");return this._pushTag(t)&&this._pushBuffer(this,i)}_pushBigNumber(e,t){if(t.isNaN())return e._pushNaN();if(!t.isFinite())return e._pushInfinity(t.isNegative()?-1/0:1/0);if(t.isInteger())return e._pushBigint(t);if(!(e._pushTag(Dr.DECIMAL_FRAC)&&e._pushInt(2,xt.ARRAY)))return!1;let n=t.decimalPlaces(),i=t.multipliedBy(new ks(10).pow(n));return e._pushIntNum(-n)?i.abs().isLessThan(d0)?e._pushIntNum(i.toNumber()):e._pushBigint(i):!1}_pushMap(e,t){return e._pushInt(t.size,xt.MAP)?this._pushRawMap(t.size,Array.from(t)):!1}_pushObject(e){if(!e)return this._pushUInt8(La);for(var t=this.semanticTypes.length,n=0;n<t;n++)if(e instanceof this.semanticTypes[n][0])return this.semanticTypes[n][1].call(e,this,e);var i=e.encodeCBOR;if(typeof i=="function")return i.call(e,this);var s=Object.keys(e),o=s.length;return this._pushInt(o,xt.MAP)?this._pushRawMap(o,s.map(c=>[c,e[c]])):!1}_pushRawMap(e,t){t=t.map(function(i){return i[0]=r.encode(i[0]),i}).sort(Ds.keySorter);for(var n=0;n<e;n++)if(!this.push(t[n][0])||!this.pushAny(t[n][1]))return!1;return!0}write(e){return this.pushAny(e)}pushAny(e){var t=y0(e);switch(t){case"Number":return this._pushNumber(e);case"String":return this._pushString(e);case"Boolean":return this._pushBoolean(e);case"Object":return this._pushObject(e);case"Array":return this._pushArray(this,e);case"Uint8Array":return this._pushBuffer(this,Lt.isBuffer(e)?e:Lt.from(e));case"Null":return this._pushUInt8(La);case"Undefined":return this._pushUndefined(e);case"Map":return this._pushMap(this,e);case"Set":return this._pushSet(this,e);case"URL":return this._pushUrl(this,e);case"BigNumber":return this._pushBigNumber(this,e);case"Date":return this._pushDate(this,e);case"RegExp":return this._pushRegexp(this,e);case"Symbol":switch(e){case Pa.NULL:return this._pushObject(null);case Pa.UNDEFINED:return this._pushUndefined(void 0);default:throw new Error("Unknown symbol: "+e.toString())}default:throw new Error("Unknown type: "+typeof e+", "+(e?e.toString():""))}}finalize(){if(this.offset===0)return null;for(var e=this.result,t=this.resultLength,n=this.resultMethod,i=this.offset,s=0,o=0;o<i;o++)s+=t[o];var c=Lt.allocUnsafe(s),a=0,h=0;for(o=0;o<i;o++){switch(h=t[o],n[o]){case 0:e[o].copy(c,a);break;case 1:c.writeUInt8(e[o],a,!0);break;case 2:c.writeUInt16BE(e[o],a,!0);break;case 3:c.writeUInt32BE(e[o],a,!0);break;case 4:c.writeDoubleBE(e[o],a,!0);break;case 5:c.write(e[o],a,h,"utf8");break;default:throw new Error("unkown method")}a+=h}var p=c;return this._reset(),p}_reset(){this.result=[],this.resultMethod=[],this.resultLength=[],this.offset=0}static encode(e){let t=new r;if(!t.pushAny(e))throw new Error("Failed to encode input");return t.finalize()}};Ma.exports=qs});var Cs=ze(Ve=>{"use strict";Ve.Diagnose=Ua();Ve.Decoder=Ps();Ve.Encoder=Da();Ve.Simple=Bs();Ve.Tagged=Ns();Ve.decodeAll=Ve.Decoder.decodeAll;Ve.decodeFirst=Ve.Decoder.decodeFirst;Ve.diagnose=Ve.Diagnose.diagnose;Ve.encode=Ve.Encoder.encode;Ve.decode=Ve.Decoder.decode;Ve.leveldb={decode:Ve.Decoder.decodeAll,encode:Ve.Encoder.encode,buffer:!0,name:"cbor"}});var Gs=ze(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});var w0=9007199254740992;function Gt(r,...e){let t=new Uint8Array(r.byteLength+e.reduce((i,s)=>i+s.byteLength,0));t.set(new Uint8Array(r),0);let n=r.byteLength;for(let i of e)t.set(new Uint8Array(i),n),n+=i.byteLength;return t.buffer}function _t(r,e,t){t=t.replace(/[^0-9a-fA-F]/g,"");let n=2**(e-24);t=t.slice(-n*2).padStart(n*2,"0");let i=[(r<<5)+e].concat(t.match(/../g).map(s=>parseInt(s,16)));return new Uint8Array(i).buffer}function ei(r,e){if(e<24)return new Uint8Array([(r<<5)+e]).buffer;{let t=e<=255?24:e<=65535?25:e<=4294967295?26:27;return _t(r,t,e.toString(16))}}function ka(r){let e=[];for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);n<128?e.push(n):n<2048?e.push(192|n>>6,128|n&63):n<55296||n>=57344?e.push(224|n>>12,128|n>>6&63,128|n&63):(t++,n=(n&1023)<<10|r.charCodeAt(t)&1023,e.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|n&63))}return Gt(new Uint8Array(ei(3,r.length)),new Uint8Array(e))}function b0(r,e){if(r==14277111)return Gt(new Uint8Array([217,217,247]),e);if(r<24)return Gt(new Uint8Array([192+r]),e);{let t=r<=255?24:r<=65535?25:r<=4294967295?26:27,n=2**(t-24),i=r.toString(16).slice(-n*2).padStart(n*2,"0"),s=[192+t].concat(i.match(/../g).map(o=>parseInt(o,16)));return new Uint8Array(s).buffer}}Ae.tagged=b0;function ln(r){return new Uint8Array(r).buffer}Ae.raw=ln;function $s(r){if(isNaN(r))throw new RangeError("Invalid number.");r=Math.min(Math.max(0,r),23);let e=[0+r];return new Uint8Array(e).buffer}Ae.uSmall=$s;function qa(r,e){if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),255),r=r.toString(16),_t(0,24,r)}Ae.u8=qa;function Ca(r,e){if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),65535),r=r.toString(16),_t(0,25,r)}Ae.u16=Ca;function $a(r,e){if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),4294967295),r=r.toString(16),_t(0,26,r)}Ae.u32=$a;function Hs(r,e){if(typeof r=="string"&&e==16){if(r.match(/[^0-9a-fA-F]/))throw new RangeError("Invalid number.");return _t(0,27,r)}if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),w0),r=r.toString(16),_t(0,27,r)}Ae.u64=Hs;function Ha(r){if(isNaN(r))throw new RangeError("Invalid number.");if(r===0)return $s(0);r=Math.min(Math.max(0,-r),24)-1;let e=[32+r];return new Uint8Array(e).buffer}Ae.iSmall=Ha;function Ga(r,e){if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),255),r=r.toString(16),_t(1,24,r)}Ae.i8=Ga;function Va(r,e){if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),65535),r=r.toString(16),_t(1,25,r)}Ae.i16=Va;function ja(r,e){if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),4294967295),r=r.toString(16),_t(1,26,r)}Ae.i32=ja;function Ya(r,e){if(typeof r=="string"&&e==16){if(r.startsWith("-")?r=r.slice(1):r="0",r.match(/[^0-9a-fA-F]/)||r.length>16)throw new RangeError("Invalid number.");let t=!1,n=r.split("").reduceRight((i,s)=>{if(t)return s+i;let o=parseInt(s,16)-1;return o>=0?(t=!0,o.toString(16)+i):"f"+i},"");return t?_t(1,27,n):Hs(0)}if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),9007199254740992),r=r.toString(16),_t(1,27,r)}Ae.i64=Ya;function x0(r){return r>=0?r<24?$s(r):r<=255?qa(r):r<=65535?Ca(r):r<=4294967295?$a(r):Hs(r):r>=-24?Ha(r):r>=-255?Ga(r):r>=-65535?Va(r):r>=-4294967295?ja(r):Ya(r)}Ae.number=x0;function _0(r){return Gt(ei(2,r.byteLength),r)}Ae.bytes=_0;function E0(r){return ka(r)}Ae.string=E0;function v0(r){return Gt(ei(4,r.length),...r)}Ae.array=v0;function I0(r,e=!1){r instanceof Map||(r=new Map(Object.entries(r)));let t=Array.from(r.entries());return e&&(t=t.sort(([n],[i])=>n.localeCompare(i))),Gt(ei(5,r.size),...t.map(([n,i])=>Gt(ka(n),i)))}Ae.map=I0;function A0(r){let e=new Float32Array([r]);return Gt(new Uint8Array([250]),new Uint8Array(e.buffer))}Ae.singleFloat=A0;function S0(r){let e=new Float64Array([r]);return Gt(new Uint8Array([251]),new Uint8Array(e.buffer))}Ae.doubleFloat=S0;function B0(r){return r?za():Ka()}Ae.bool=B0;function za(){return ln(new Uint8Array([245]))}Ae.true_=za;function Ka(){return ln(new Uint8Array([244]))}Ae.false_=Ka;function T0(){return ln(new Uint8Array([246]))}Ae.null_=T0;function N0(){return ln(new Uint8Array([247]))}Ae.undefined_=N0});var Za=ze(tr=>{"use strict";var R0=tr&&tr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e};Object.defineProperty(tr,"__esModule",{value:!0});var Et=R0(Gs()),O0=[ArrayBuffer,Uint8Array,Uint16Array,Uint32Array,Int8Array,Int16Array,Int32Array,Float32Array,Float64Array],ti=class{constructor(e,t=!1){this._serializer=e,this._stable=t,this.name="jsonDefault",this.priority=-100}match(e){return["undefined","boolean","number","string","object"].indexOf(typeof e)!=-1}encode(e){switch(typeof e){case"undefined":return Et.undefined_();case"boolean":return Et.bool(e);case"number":return Math.floor(e)===e?Et.number(e):Et.doubleFloat(e);case"string":return Et.string(e);case"object":if(e===null)return Et.null_();if(Array.isArray(e))return Et.array(e.map(t=>this._serializer.serializeValue(t)));if(O0.find(t=>e instanceof t))return Et.bytes(e.buffer);if(Object.getOwnPropertyNames(e).indexOf("toJSON")!==-1)return this.encode(e.toJSON());if(e instanceof Map){let t=new Map;for(let[n,i]of e.entries())t.set(n,this._serializer.serializeValue(i));return Et.map(t,this._stable)}else{let t=new Map;for(let[n,i]of Object.entries(e))t.set(n,this._serializer.serializeValue(i));return Et.map(t,this._stable)}default:throw new Error("Invalid value.")}}};tr.JsonDefaultCborEncoder=ti;var ri=class{constructor(){this.name="cborEncoder",this.priority=-90}match(e){return typeof e=="object"&&typeof e.toCBOR=="function"}encode(e){return e.toCBOR()}};tr.ToCborEncoder=ri;var ni=class{constructor(){this._encoders=new Set}static withDefaultEncoders(e=!1){let t=new this;return t.addEncoder(new ti(t,e)),t.addEncoder(new ri),t}removeEncoder(e){for(let t of this._encoders.values())t.name==e&&this._encoders.delete(t)}addEncoder(e){this._encoders.add(e)}getEncoderFor(e){let t=null;for(let n of this._encoders)(!t||n.priority>t.priority)&&n.match(e)&&(t=n);if(t===null)throw new Error("Could not find an encoder for value.");return t}serializeValue(e){return this.getEncoderFor(e).encode(e)}serialize(e){return this.serializeValue(e)}};tr.CborSerializer=ni;var Vs=class extends ni{serialize(e){return Et.raw(new Uint8Array([...new Uint8Array([217,217,247]),...new Uint8Array(super.serializeValue(e))]))}};tr.SelfDescribeCborSerializer=Vs});var ii=ze(Er=>{"use strict";function U0(r){for(var e in r)Er.hasOwnProperty(e)||(Er[e]=r[e])}var F0=Er&&Er.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e};Object.defineProperty(Er,"__esModule",{value:!0});U0(Za());var P0=F0(Gs());Er.value=P0});var Dn="abcdefghijklmnopqrstuvwxyz234567",Pr=Object.create(null);for(let r=0;r<Dn.length;r++)Pr[Dn[r]]=r;Pr[0]=Pr.o;Pr[1]=Pr.i;function Mo(r){let e=0,t=0,n="";function i(s){return e<0?t|=s>>-e:t=s<<e&248,e>3?(e-=8,1):(e<4&&(n+=Dn[t>>3],e+=5),0)}for(let s=0;s<r.length;)s+=i(r[s]);return n+(e<0?Dn[t>>3]:"")}function Do(r){let e=0,t=0,n=new Uint8Array(r.length*4/3|0),i=0;function s(o){let c=Pr[o.toLowerCase()];if(c===void 0)throw new Error(`Invalid character: ${JSON.stringify(o)}`);c<<=3,t|=c>>>e,e+=5,e>=8&&(n[i++]=t,e-=8,e>0?t=c<<5-e&255:t=0)}for(let o of r)s(o);return n.slice(0,i)}var ef=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function ko(r){let e=new Uint8Array(r),t=-1;for(let n=0;n<e.length;n++){let s=(e[n]^t)&255;t=ef[s]^t>>>8}return(t^-1)>>>0}function tf(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function ls(r,...e){if(!tf(r))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(r.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${r.length}`)}function hs(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function qo(r,e){ls(r);let t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}var yr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var qn=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),bt=(r,e)=>r<<32-e|r>>>e;var Fh=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Co(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function ds(r){return typeof r=="string"&&(r=Co(r)),ls(r),r}var kn=class{clone(){return this._cloneInto()}},Ph={}.toString;function nn(r){let e=n=>r().update(ds(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}function Cn(r=32){if(yr&&typeof yr.getRandomValues=="function")return yr.getRandomValues(new Uint8Array(r));if(yr&&typeof yr.randomBytes=="function")return yr.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}function rf(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let i=BigInt(32),s=BigInt(4294967295),o=Number(t>>i&s),c=Number(t&s),a=n?4:0,h=n?0:4;r.setUint32(e+a,o,n),r.setUint32(e+h,c,n)}var $o=(r,e,t)=>r&e^~r&t,Ho=(r,e,t)=>r&e^r&t^e&t,Lr=class extends kn{constructor(e,t,n,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=qn(this.buffer)}update(e){hs(this);let{view:t,buffer:n,blockLen:i}=this;e=ds(e);let s=e.length;for(let o=0;o<s;){let c=Math.min(i-this.pos,s-o);if(c===i){let a=qn(e);for(;i<=s-o;o+=i)this.process(a,o);continue}n.set(e.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){hs(this),qo(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:i,isLE:s}=this,{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(n,0),o=0);for(let g=o;g<i;g++)t[g]=0;rf(n,i-8,BigInt(this.length*8),s),this.process(n,0);let c=qn(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let h=a/4,p=this.get();if(h>p.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g<h;g++)c.setUint32(4*g,p[g],s)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:i,finished:s,destroyed:o,pos:c}=this;return e.length=i,e.pos=c,e.finished=s,e.destroyed=o,i%t&&e.buffer.set(n),e}};var nf=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]),Jt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),er=new Uint32Array(64),$n=class extends Lr{constructor(){super(64,32,8,!1),this.A=Jt[0]|0,this.B=Jt[1]|0,this.C=Jt[2]|0,this.D=Jt[3]|0,this.E=Jt[4]|0,this.F=Jt[5]|0,this.G=Jt[6]|0,this.H=Jt[7]|0}get(){let{A:e,B:t,C:n,D:i,E:s,F:o,G:c,H:a}=this;return[e,t,n,i,s,o,c,a]}set(e,t,n,i,s,o,c,a){this.A=e|0,this.B=t|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=a|0}process(e,t){for(let g=0;g<16;g++,t+=4)er[g]=e.getUint32(t,!1);for(let g=16;g<64;g++){let w=er[g-15],x=er[g-2],f=bt(w,7)^bt(w,18)^w>>>3,N=bt(x,17)^bt(x,19)^x>>>10;er[g]=N+er[g-7]+f+er[g-16]|0}let{A:n,B:i,C:s,D:o,E:c,F:a,G:h,H:p}=this;for(let g=0;g<64;g++){let w=bt(c,6)^bt(c,11)^bt(c,25),x=p+w+$o(c,a,h)+nf[g]+er[g]|0,N=(bt(n,2)^bt(n,13)^bt(n,22))+Ho(n,i,s)|0;p=h,h=a,a=c,c=o+x|0,o=s,s=i,i=n,n=x+N|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,a=a+this.F|0,h=h+this.G|0,p=p+this.H|0,this.set(n,i,s,o,c,a,h,p)}roundClean(){er.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},ps=class extends $n{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}},sn=nn(()=>new $n),Go=nn(()=>new ps);function Vo(r){return Go.create().update(new Uint8Array(r)).digest()}var Hn="__principal__",sf=2,jo=4,of="aaaaa-aa",af=r=>{var e;return new Uint8Array(((e=r.match(/.{1,2}/g))!==null&&e!==void 0?e:[]).map(t=>parseInt(t,16)))},cf=r=>r.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),""),me=class r{constructor(e){this._arr=e,this._isPrincipal=!0}static anonymous(){return new this(new Uint8Array([jo]))}static managementCanister(){return this.fromHex(of)}static selfAuthenticating(e){let t=Vo(e);return new this(new Uint8Array([...t,sf]))}static from(e){if(typeof e=="string")return r.fromText(e);if(Object.getPrototypeOf(e)===Uint8Array.prototype)return new r(e);if(typeof e=="object"&&e!==null&&e._isPrincipal===!0)return new r(e._arr);throw new Error(`Impossible to convert ${JSON.stringify(e)} to Principal.`)}static fromHex(e){return new this(af(e))}static fromText(e){let t=e;if(e.includes(Hn)){let o=JSON.parse(e);Hn in o&&(t=o[Hn])}let n=t.toLowerCase().replace(/-/g,""),i=Do(n);i=i.slice(4,i.length);let s=new this(i);if(s.toText()!==t)throw new Error(`Principal "${s.toText()}" does not have a valid checksum (original value "${t}" may not be a valid Principal ID).`);return s}static fromUint8Array(e){return new this(e)}isAnonymous(){return this._arr.byteLength===1&&this._arr[0]===jo}toUint8Array(){return this._arr}toHex(){return cf(this._arr).toUpperCase()}toText(){let e=new ArrayBuffer(4);new DataView(e).setUint32(0,ko(this._arr));let n=new Uint8Array(e),i=Uint8Array.from(this._arr),s=new Uint8Array([...n,...i]),c=Mo(s).match(/.{1,5}/g);if(!c)throw new Error;return c.join("-")}toString(){return this.toText()}toJSON(){return{[Hn]:this.toText()}}compareTo(e){for(let t=0;t<Math.min(this._arr.length,e._arr.length);t++){if(this._arr[t]<e._arr[t])return"lt";if(this._arr[t]>e._arr[t])return"gt"}return this._arr.length<e._arr.length?"lt":this._arr.length>e._arr.length?"gt":"eq"}ltEq(e){let t=this.compareTo(e);return t=="lt"||t=="eq"}gtEq(e){let t=this.compareTo(e);return t=="gt"||t=="eq"}};var ms;(function(r){r[r.SysFatal=1]="SysFatal",r[r.SysTransient=2]="SysTransient",r[r.DestinationInvalid=3]="DestinationInvalid",r[r.CanisterReject=4]="CanisterReject",r[r.CanisterError=5]="CanisterError"})(ms||(ms={}));function Qe(...r){let e=new Uint8Array(r.reduce((n,i)=>n+i.byteLength,0)),t=0;for(let n of r)e.set(new Uint8Array(n),t),t+=n.byteLength;return e.buffer}function Fe(r){return[...new Uint8Array(r)].map(e=>e.toString(16).padStart(2,"0")).join("")}var uf=new RegExp(/^[0-9a-fA-F]+$/);function wr(r){if(!uf.test(r))throw new Error("Invalid hexadecimal string.");let e=[...r].reduce((t,n,i)=>(t[i/2|0]=(t[i/2|0]||"")+n,t),[]).map(t=>Number.parseInt(t,16));return new Uint8Array(e).buffer}function gs(r,e){if(r.byteLength!==e.byteLength)return r.byteLength-e.byteLength;let t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<t.length;i++)if(t[i]!==n[i])return t[i]-n[i];return 0}function br(r,e){return gs(r,e)===0}function on(r){return new DataView(r.buffer,r.byteOffset,r.byteLength).buffer}function ys(r){return r instanceof Uint8Array?on(r):r instanceof ArrayBuffer?r:Array.isArray(r)?on(new Uint8Array(r)):"buffer"in r?ys(r.buffer):on(new Uint8Array(r))}var Ue=class r extends Error{constructor(e){super(e),this.message=e,this.name="AgentError",this.__proto__=r.prototype,Object.setPrototypeOf(this,r.prototype)}};var Xa=rn(Cs()),vr=rn(ii()),Qa=rn(ii());var js=class{get name(){return"Principal"}get priority(){return 0}match(e){return e&&e._isPrincipal===!0}encode(e){return vr.value.bytes(e.toUint8Array())}},Ys=class{get name(){return"Buffer"}get priority(){return 1}match(e){return e instanceof ArrayBuffer||ArrayBuffer.isView(e)}encode(e){return vr.value.bytes(new Uint8Array(e))}},zs=class{get name(){return"BigInt"}get priority(){return 1}match(e){return typeof e=="bigint"}encode(e){return e>BigInt(0)?vr.value.tagged(2,vr.value.bytes(wr(e.toString(16)))):vr.value.tagged(3,vr.value.bytes(wr((BigInt("-1")*e).toString(16))))}},si=Qa.SelfDescribeCborSerializer.withDefaultEncoders(!0);si.addEncoder(new js);si.addEncoder(new Ys);si.addEncoder(new zs);var Ks;(function(r){r[r.Uint64LittleEndian=71]="Uint64LittleEndian",r[r.Semantic=55799]="Semantic"})(Ks||(Ks={}));function oi(r){return si.serialize(r)}function Wa(r){let e=r.byteLength,t=BigInt(0);for(let n=0;n<e;n++)t=t*BigInt(256)+BigInt(r[n]);return t}var Zs=class extends Xa.default.Decoder{createByteString(e){return Qe(...e)}createByteStringFromHeap(e,t){return e===t?new ArrayBuffer(0):new Uint8Array(this._heap.slice(e,t))}};function yt(r){let e=new Uint8Array(r),t=new Zs({size:e.byteLength,tags:{2:n=>Wa(n),3:n=>-Wa(n),[Ks.Semantic]:n=>n}});try{return t.decodeFirst(e)}catch(n){throw new Error(`Failed to decode CBOR: ${n}, input: ${Fe(e)}`)}}var no={};fs(no,{Bool:()=>sc,BoolClass:()=>hi,ConstructType:()=>Dt,Empty:()=>nc,EmptyClass:()=>fi,FixedIntClass:()=>jt,FixedNatClass:()=>Mt,Float32:()=>fc,Float64:()=>lc,FloatClass:()=>dn,Func:()=>Bc,FuncClass:()=>mn,Int:()=>cc,Int16:()=>dc,Int32:()=>pc,Int64:()=>mc,Int8:()=>hc,IntClass:()=>mi,Nat:()=>uc,Nat16:()=>yc,Nat32:()=>wc,Nat64:()=>bc,Nat8:()=>gc,NatClass:()=>gi,Null:()=>oc,NullClass:()=>di,Opt:()=>vc,OptClass:()=>Cr,PrimitiveType:()=>ct,Principal:()=>xc,PrincipalClass:()=>xi,Rec:()=>Sc,RecClass:()=>ir,Record:()=>Ic,RecordClass:()=>pn,Reserved:()=>ic,ReservedClass:()=>qr,Service:()=>Tc,ServiceClass:()=>_i,Text:()=>ac,TextClass:()=>pi,Tuple:()=>_c,TupleClass:()=>wi,Type:()=>kr,Unknown:()=>k0,UnknownClass:()=>li,Variant:()=>Ac,VariantClass:()=>bi,Vec:()=>Ec,VecClass:()=>yi,Visitor:()=>ui,decode:()=>D0,encode:()=>M0});function xe(...r){let e=new Uint8Array(r.reduce((n,i)=>n+i.byteLength,0)),t=0;for(let n of r)e.set(new Uint8Array(n),t),t+=n.byteLength;return e}var vt=class{constructor(e,t=e?.byteLength||0){this._buffer=Qs(e||new ArrayBuffer(0)),this._view=new Uint8Array(this._buffer,0,t)}get buffer(){return Qs(this._view.slice())}get byteLength(){return this._view.byteLength}read(e){let t=this._view.subarray(0,e);return this._view=this._view.subarray(e),t.slice().buffer}readUint8(){let e=this._view[0];return this._view=this._view.subarray(1),e}write(e){let t=new Uint8Array(e),n=this._view.byteLength;this._view.byteOffset+this._view.byteLength+t.byteLength>=this._buffer.byteLength?this.alloc(t.byteLength):this._view=new Uint8Array(this._buffer,this._view.byteOffset,this._view.byteLength+t.byteLength),this._view.set(t,n)}get end(){return this._view.byteLength===0}alloc(e){let t=new ArrayBuffer((this._buffer.byteLength+e)*1.2|0),n=new Uint8Array(t,0,this._view.byteLength+e);n.set(this._view),this._buffer=t,this._view=n}};function Xs(r){return new DataView(r.buffer,r.byteOffset,r.byteLength).buffer}function Qs(r){return r instanceof Uint8Array?Xs(r):r instanceof ArrayBuffer?r:Array.isArray(r)?Xs(new Uint8Array(r)):"buffer"in r?Qs(r.buffer):Xs(new Uint8Array(r))}function L0(r){let t=new TextEncoder().encode(r),n=0;for(let i of t)n=(n*223+i)%2**32;return n}function It(r){if(/^_\d+_$/.test(r)||/^_0x[0-9a-fA-F]+_$/.test(r)){let e=+r.slice(1,-1);if(Number.isSafeInteger(e)&&e>=0&&e<2**32)return e}return L0(r)}function Ja(){throw new Error("unexpected end of buffer")}function nr(r,e){return r.byteLength<e&&Ja(),r.read(e)}function rr(r){let e=r.readUint8();return e===void 0&&Ja(),e}function Be(r){if(typeof r=="number"&&(r=BigInt(r)),r<BigInt(0))throw new Error("Cannot leb encode negative values.");let e=(r===BigInt(0)?0:Math.ceil(Math.log2(Number(r))))+1,t=new vt(new ArrayBuffer(e),0);for(;;){let n=Number(r&BigInt(127));if(r/=BigInt(128),r===BigInt(0)){t.write(new Uint8Array([n]));break}else t.write(new Uint8Array([n|128]))}return t.buffer}function Ce(r){let e=BigInt(1),t=BigInt(0),n;do n=rr(r),t+=BigInt(n&127).valueOf()*e,e*=BigInt(128);while(n>=128);return t}function $e(r){typeof r=="number"&&(r=BigInt(r));let e=r<BigInt(0);e&&(r=-r-BigInt(1));let t=(r===BigInt(0)?0:Math.ceil(Math.log2(Number(r))))+1,n=new vt(new ArrayBuffer(t),0);for(;;){let s=i(r);if(r/=BigInt(128),e&&r===BigInt(0)&&(s&64)!==0||!e&&r===BigInt(0)&&(s&64)===0){n.write(new Uint8Array([s]));break}else n.write(new Uint8Array([s|128]))}function i(s){let o=s%BigInt(128);return Number(e?BigInt(128)-o-BigInt(1):o)}return n.buffer}function Vt(r){let e=new Uint8Array(r.buffer),t=0;for(;t<e.byteLength;t++)if(e[t]<128){if((e[t]&64)===0)return Ce(r);break}let n=new Uint8Array(nr(r,t+1)),i=BigInt(0);for(let s=n.byteLength-1;s>=0;s--)i=i*BigInt(128)+BigInt(128-(n[s]&127)-1);return-i-BigInt(1)}function ec(r,e){if(BigInt(r)<BigInt(0))throw new Error("Cannot write negative values.");return Js(r,e)}function Js(r,e){r=BigInt(r);let t=new vt(new ArrayBuffer(Math.min(1,e)),0),n=0,i=BigInt(256),s=BigInt(0),o=Number(r%i);for(t.write(new Uint8Array([o]));++n<e;)r<0&&s===BigInt(0)&&o!==0&&(s=BigInt(1)),o=Number((r/i-s)%BigInt(256)),t.write(new Uint8Array([o])),i*=BigInt(256);return t.buffer}function eo(r,e){let t=BigInt(rr(r)),n=BigInt(1),i=0;for(;++i<e;){n*=BigInt(256);let s=BigInt(rr(r));t=t+n*s}return t}function tc(r,e){let t=eo(r,e),n=BigInt(2)**(BigInt(8)*BigInt(e-1)+BigInt(7));return t>=n&&(t-=n*BigInt(2)),t}function ai(r){let e=BigInt(r);if(r<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<e}var ci="DIDL",rc=400;function hn(r,e,t){return r.map((n,i)=>t(n,e[i]))}var to=class{constructor(){this._typs=[],this._idx=new Map}has(e){return this._idx.has(e.name)}add(e,t){let n=this._typs.length;this._idx.set(e.name,n),this._typs.push(t)}merge(e,t){let n=this._idx.get(e.name),i=this._idx.get(t);if(n===void 0)throw new Error("Missing type index for "+e);if(i===void 0)throw new Error("Missing type index for "+t);this._typs[n]=this._typs[i],this._typs.splice(i,1),this._idx.delete(t)}encode(){let e=Be(this._typs.length),t=xe(...this._typs);return xe(e,t)}indexOf(e){if(!this._idx.has(e))throw new Error("Missing type index for "+e);return $e(this._idx.get(e)||0)}},ui=class{visitType(e,t){throw new Error("Not implemented")}visitPrimitive(e,t){return this.visitType(e,t)}visitEmpty(e,t){return this.visitPrimitive(e,t)}visitBool(e,t){return this.visitPrimitive(e,t)}visitNull(e,t){return this.visitPrimitive(e,t)}visitReserved(e,t){return this.visitPrimitive(e,t)}visitText(e,t){return this.visitPrimitive(e,t)}visitNumber(e,t){return this.visitPrimitive(e,t)}visitInt(e,t){return this.visitNumber(e,t)}visitNat(e,t){return this.visitNumber(e,t)}visitFloat(e,t){return this.visitPrimitive(e,t)}visitFixedInt(e,t){return this.visitNumber(e,t)}visitFixedNat(e,t){return this.visitNumber(e,t)}visitPrincipal(e,t){return this.visitPrimitive(e,t)}visitConstruct(e,t){return this.visitType(e,t)}visitVec(e,t,n){return this.visitConstruct(e,n)}visitOpt(e,t,n){return this.visitConstruct(e,n)}visitRecord(e,t,n){return this.visitConstruct(e,n)}visitTuple(e,t,n){let i=t.map((s,o)=>[`_${o}_`,s]);return this.visitRecord(e,i,n)}visitVariant(e,t,n){return this.visitConstruct(e,n)}visitRec(e,t,n){return this.visitConstruct(t,n)}visitFunc(e,t){return this.visitConstruct(e,t)}visitService(e,t){return this.visitConstruct(e,t)}},kr=class{display(){return this.name}valueToString(e){return Pe(e)}buildTypeTable(e){e.has(this)||this._buildTypeTableImpl(e)}},ct=class extends kr{checkType(e){if(this.name!==e.name)throw new Error(`type mismatch: type on the wire ${e.name}, expect type ${this.name}`);return e}_buildTypeTableImpl(e){}},Dt=class extends kr{checkType(e){if(e instanceof ir){let t=e.getType();if(typeof t>"u")throw new Error("type mismatch with uninitialized type");return t}throw new Error(`type mismatch: type on the wire ${e.name}, expect type ${this.name}`)}encodeType(e){return e.indexOf(this.name)}},fi=class extends ct{accept(e,t){return e.visitEmpty(this,t)}covariant(e){throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(){throw new Error("Empty cannot appear as a function argument")}valueToString(){throw new Error("Empty cannot appear as a value")}encodeType(){return $e(-17)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}},li=class extends kr{checkType(e){throw new Error("Method not implemented for unknown.")}accept(e,t){throw e.visitType(this,t)}covariant(e){throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(){throw new Error("Unknown cannot appear as a function argument")}valueToString(){throw new Error("Unknown cannot appear as a value")}encodeType(){throw new Error("Unknown cannot be serialized")}decodeValue(e,t){let n=t.decodeValue(e,t);Object(n)!==n&&(n=Object(n));let i;return t instanceof ir?i=()=>t.getType():i=()=>t,Object.defineProperty(n,"type",{value:i,writable:!0,enumerable:!1,configurable:!0}),n}_buildTypeTableImpl(){throw new Error("Unknown cannot be serialized")}get name(){return"Unknown"}},hi=class extends ct{accept(e,t){return e.visitBool(this,t)}covariant(e){if(typeof e=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(e){return new Uint8Array([e?1:0])}encodeType(){return $e(-2)}decodeValue(e,t){switch(this.checkType(t),rr(e)){case 0:return!1;case 1:return!0;default:throw new Error("Boolean value out of range")}}get name(){return"bool"}},di=class extends ct{accept(e,t){return e.visitNull(this,t)}covariant(e){if(e===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(){return new ArrayBuffer(0)}encodeType(){return $e(-1)}decodeValue(e,t){return this.checkType(t),null}get name(){return"null"}},qr=class extends ct{accept(e,t){return e.visitReserved(this,t)}covariant(e){return!0}encodeValue(){return new ArrayBuffer(0)}encodeType(){return $e(-16)}decodeValue(e,t){return t.name!==this.name&&t.decodeValue(e,t),null}get name(){return"reserved"}},pi=class extends ct{accept(e,t){return e.visitText(this,t)}covariant(e){if(typeof e=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(e){let t=new TextEncoder().encode(e),n=Be(t.byteLength);return xe(n,t)}encodeType(){return $e(-15)}decodeValue(e,t){this.checkType(t);let n=Ce(e),i=nr(e,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(i)}get name(){return"text"}valueToString(e){return'"'+e+'"'}},mi=class extends ct{accept(e,t){return e.visitInt(this,t)}covariant(e){if(typeof e=="bigint"||Number.isInteger(e))return!0;throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(e){return $e(e)}encodeType(){return $e(-4)}decodeValue(e,t){return this.checkType(t),Vt(e)}get name(){return"int"}valueToString(e){return e.toString()}},gi=class extends ct{accept(e,t){return e.visitNat(this,t)}covariant(e){if(typeof e=="bigint"&&e>=BigInt(0)||Number.isInteger(e)&&e>=0)return!0;throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(e){return Be(e)}encodeType(){return $e(-3)}decodeValue(e,t){return this.checkType(t),Ce(e)}get name(){return"nat"}valueToString(e){return e.toString()}},dn=class extends ct{constructor(e){if(super(),this._bits=e,e!==32&&e!==64)throw new Error("not a valid float type")}accept(e,t){return e.visitFloat(this,t)}covariant(e){if(typeof e=="number"||e instanceof Number)return!0;throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(e){let t=new ArrayBuffer(this._bits/8),n=new DataView(t);return this._bits===32?n.setFloat32(0,e,!0):n.setFloat64(0,e,!0),t}encodeType(){let e=this._bits===32?-13:-14;return $e(e)}decodeValue(e,t){this.checkType(t);let n=nr(e,this._bits/8),i=new DataView(n);return this._bits===32?i.getFloat32(0,!0):i.getFloat64(0,!0)}get name(){return"float"+this._bits}valueToString(e){return e.toString()}},jt=class extends ct{constructor(e){super(),this._bits=e}accept(e,t){return e.visitFixedInt(this,t)}covariant(e){let t=ai(this._bits-1)*BigInt(-1),n=ai(this._bits-1)-BigInt(1),i=!1;if(typeof e=="bigint")i=e>=t&&e<=n;else if(Number.isInteger(e)){let s=BigInt(e);i=s>=t&&s<=n}else i=!1;if(i)return!0;throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(e){return Js(e,this._bits/8)}encodeType(){let e=Math.log2(this._bits)-3;return $e(-9-e)}decodeValue(e,t){this.checkType(t);let n=tc(e,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(e){return e.toString()}},Mt=class extends ct{constructor(e){super(),this._bits=e}accept(e,t){return e.visitFixedNat(this,t)}covariant(e){let t=ai(this._bits),n=!1;if(typeof e=="bigint"&&e>=BigInt(0)?n=e<t:Number.isInteger(e)&&e>=0?n=BigInt(e)<t:n=!1,n)return!0;throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(e){return ec(e,this._bits/8)}encodeType(){let e=Math.log2(this._bits)-3;return $e(-5-e)}decodeValue(e,t){this.checkType(t);let n=eo(e,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(e){return e.toString()}},yi=class r extends Dt{constructor(e){super(),this._type=e,this._blobOptimization=!1,e instanceof Mt&&e._bits===8&&(this._blobOptimization=!0)}accept(e,t){return e.visitVec(this,this._type,t)}covariant(e){let t=this._type instanceof Mt?this._type._bits:this._type instanceof jt?this._type._bits:0;if(ArrayBuffer.isView(e)&&t==e.BYTES_PER_ELEMENT*8||Array.isArray(e)&&e.every((n,i)=>{try{return this._type.covariant(n)}catch(s){throw new Error(`Invalid ${this.display()} argument:
2
2
 
3
3
  index ${i} -> ${s.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}`)}encodeValue(e){let t=Be(e.length);if(this._blobOptimization)return xe(t,new Uint8Array(e));if(ArrayBuffer.isView(e))return xe(t,new Uint8Array(e.buffer));let n=new vt(new ArrayBuffer(t.byteLength+e.length),0);n.write(t);for(let i of e){let s=this._type.encodeValue(i);n.write(new Uint8Array(s))}return n.buffer}_buildTypeTableImpl(e){this._type.buildTypeTable(e);let t=$e(-19),n=this._type.encodeType(e);e.add(this,xe(t,n))}decodeValue(e,t){let n=this.checkType(t);if(!(n instanceof r))throw new Error("Not a vector type");let i=Number(Ce(e));if(this._type instanceof Mt){if(this._type._bits==8)return new Uint8Array(e.read(i));if(this._type._bits==16)return new Uint16Array(e.read(i*2));if(this._type._bits==32)return new Uint32Array(e.read(i*4));if(this._type._bits==64)return new BigUint64Array(e.read(i*8))}if(this._type instanceof jt){if(this._type._bits==8)return new Int8Array(e.read(i));if(this._type._bits==16)return new Int16Array(e.read(i*2));if(this._type._bits==32)return new Int32Array(e.read(i*4));if(this._type._bits==64)return new BigInt64Array(e.read(i*8))}let s=[];for(let o=0;o<i;o++)s.push(this._type.decodeValue(e,n._type));return s}get name(){return`vec ${this._type.name}`}display(){return`vec ${this._type.display()}`}valueToString(e){return"vec {"+e.map(n=>this._type.valueToString(n)).join("; ")+"}"}},Cr=class r extends Dt{constructor(e){super(),this._type=e}accept(e,t){return e.visitOpt(this,this._type,t)}covariant(e){try{if(Array.isArray(e)&&(e.length===0||e.length===1&&this._type.covariant(e[0])))return!0}catch(t){throw new Error(`Invalid ${this.display()} argument: ${Pe(e)}
4
4
 
@@ -14,7 +14,7 @@ variant ${t} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.displ
14
14
  ic-request`),Qc=class{getPrincipal(){return this._principal||(this._principal=me.selfAuthenticating(new Uint8Array(this.getPublicKey().toDer()))),this._principal}async transformRequest(e){let{body:t}=e,n=gl(e,["body"]),i=gn(t);return Object.assign(Object.assign({},n),{body:{content:t,sender_pubkey:this.getPublicKey().toDer(),sender_sig:await this.sign(Qe(yl,i))}})}},An=class{getPrincipal(){return me.anonymous()}async transformRequest(e){return Object.assign(Object.assign({},e),{body:{content:e.body}})}};var eu=rn(ii());var Sn=()=>{if(typeof window<"u"&&window.crypto&&window.crypto.getRandomValues){let r=new Uint32Array(1);return window.crypto.getRandomValues(r),r[0]}if(typeof crypto<"u"&&crypto.getRandomValues){let r=new Uint32Array(1);return crypto.getRandomValues(r),r[0]}return typeof crypto<"u"&&crypto.randomInt?crypto.randomInt(0,4294967295):Math.floor(Math.random()*4294967295)};var ki;(function(r){r.Call="call"})(ki||(ki={}));function jr(){let r=new ArrayBuffer(16),e=new DataView(r),t=Sn(),n=Sn(),i=Sn(),s=Sn();return e.setUint32(0,t),e.setUint32(4,n),e.setUint32(8,i),e.setUint32(12,s),r}var Jc=BigInt(1e6),wl=60*1e3,Sr=class{constructor(e){if(e<90*1e3){let c=BigInt(Date.now()+e)*Jc/BigInt(1e9);this._value=c*BigInt(1e9);return}let s=BigInt(Math.floor(Date.now()+e-wl))*Jc/BigInt(1e9)/BigInt(60)*BigInt(60)*BigInt(1e9);this._value=s}toCBOR(){return eu.value.u64(this._value.toString(16),16)}toHash(){return Be(this._value)}};function Bo(r=jr){return async e=>{let t=e.request.headers;e.request.headers=t,e.endpoint==="call"&&(e.body.nonce=r())}}function Yr(r){let e=[];return r.forEach((t,n)=>{e.push([n,t])}),e}var zr=class extends Ue{constructor(e,t){super(e),this.response=t,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}},qi=class extends Ue{constructor(e,t,n,i,s,o){super(e),this.response=t,this.requestId=n,this.senderPubkey=i,this.senderSig=s,this.ingressExpiry=o,this.name="AgentCallError",Object.setPrototypeOf(this,new.target.prototype)}},Ci=class extends Ue{constructor(e,t,n,i,s,o){super(e),this.response=t,this.requestId=n,this.senderPubkey=i,this.senderSig=s,this.ingressExpiry=o,this.name="AgentQueryError",Object.setPrototypeOf(this,new.target.prototype)}},$i=class extends Ue{constructor(e,t,n,i,s,o){super(e),this.response=t,this.requestId=n,this.senderPubkey=i,this.senderSig=s,this.ingressExpiry=o,this.name="AgentReadStateError",Object.setPrototypeOf(this,new.target.prototype)}};var Hi=BigInt(4294967295),To=BigInt(32);function tu(r,e=!1){return e?{h:Number(r&Hi),l:Number(r>>To&Hi)}:{h:Number(r>>To&Hi)|0,l:Number(r&Hi)|0}}function bl(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let i=0;i<r.length;i++){let{h:s,l:o}=tu(r[i],e);[t[i],n[i]]=[s,o]}return[t,n]}var xl=(r,e)=>BigInt(r>>>0)<<To|BigInt(e>>>0),_l=(r,e,t)=>r>>>t,El=(r,e,t)=>r<<32-t|e>>>t,vl=(r,e,t)=>r>>>t|e<<32-t,Il=(r,e,t)=>r<<32-t|e>>>t,Al=(r,e,t)=>r<<64-t|e>>>t-32,Sl=(r,e,t)=>r>>>t-32|e<<64-t,Bl=(r,e)=>e,Tl=(r,e)=>r,Nl=(r,e,t)=>r<<t|e>>>32-t,Rl=(r,e,t)=>e<<t|r>>>32-t,Ol=(r,e,t)=>e<<t-32|r>>>64-t,Ul=(r,e,t)=>r<<t-32|e>>>64-t;function Fl(r,e,t,n){let i=(e>>>0)+(n>>>0);return{h:r+t+(i/2**32|0)|0,l:i|0}}var Pl=(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),Ll=(r,e,t,n)=>e+t+n+(r/2**32|0)|0,Ml=(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),Dl=(r,e,t,n,i)=>e+t+n+i+(r/2**32|0)|0,kl=(r,e,t,n,i)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(i>>>0),ql=(r,e,t,n,i,s)=>e+t+n+i+s+(r/2**32|0)|0;var Cl={fromBig:tu,split:bl,toBig:xl,shrSH:_l,shrSL:El,rotrSH:vl,rotrSL:Il,rotrBH:Al,rotrBL:Sl,rotr32H:Bl,rotr32L:Tl,rotlSH:Nl,rotlSL:Rl,rotlBH:Ol,rotlBL:Ul,add:Fl,add3L:Pl,add3H:Ll,add4L:Ml,add4H:Dl,add5H:ql,add5L:kl},le=Cl;var[$l,Hl]=le.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),hr=new Uint32Array(80),dr=new Uint32Array(80),No=class extends Lr{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:t,Bh:n,Bl:i,Ch:s,Cl:o,Dh:c,Dl:a,Eh:h,El:p,Fh:g,Fl:w,Gh:x,Gl:f,Hh:N,Hl:T}=this;return[e,t,n,i,s,o,c,a,h,p,g,w,x,f,N,T]}set(e,t,n,i,s,o,c,a,h,p,g,w,x,f,N,T){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=c|0,this.Dl=a|0,this.Eh=h|0,this.El=p|0,this.Fh=g|0,this.Fl=w|0,this.Gh=x|0,this.Gl=f|0,this.Hh=N|0,this.Hl=T|0}process(e,t){for(let D=0;D<16;D++,t+=4)hr[D]=e.getUint32(t),dr[D]=e.getUint32(t+=4);for(let D=16;D<80;D++){let K=hr[D-15]|0,E=dr[D-15]|0,C=le.rotrSH(K,E,1)^le.rotrSH(K,E,8)^le.shrSH(K,E,7),G=le.rotrSL(K,E,1)^le.rotrSL(K,E,8)^le.shrSL(K,E,7),j=hr[D-2]|0,k=dr[D-2]|0,fe=le.rotrSH(j,k,19)^le.rotrBH(j,k,61)^le.shrSH(j,k,6),re=le.rotrSL(j,k,19)^le.rotrBL(j,k,61)^le.shrSL(j,k,6),te=le.add4L(G,re,dr[D-7],dr[D-16]),y=le.add4H(te,C,fe,hr[D-7],hr[D-16]);hr[D]=y|0,dr[D]=te|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:c,Cl:a,Dh:h,Dl:p,Eh:g,El:w,Fh:x,Fl:f,Gh:N,Gl:T,Hh:O,Hl:H}=this;for(let D=0;D<80;D++){let K=le.rotrSH(g,w,14)^le.rotrSH(g,w,18)^le.rotrBH(g,w,41),E=le.rotrSL(g,w,14)^le.rotrSL(g,w,18)^le.rotrBL(g,w,41),C=g&x^~g&N,G=w&f^~w&T,j=le.add5L(H,E,G,Hl[D],dr[D]),k=le.add5H(j,O,K,C,$l[D],hr[D]),fe=j|0,re=le.rotrSH(n,i,28)^le.rotrBH(n,i,34)^le.rotrBH(n,i,39),te=le.rotrSL(n,i,28)^le.rotrBL(n,i,34)^le.rotrBL(n,i,39),y=n&s^n&c^s&c,I=i&o^i&a^o&a;O=N|0,H=T|0,N=x|0,T=f|0,x=g|0,f=w|0,{h:g,l:w}=le.add(h|0,p|0,k|0,fe|0),h=c|0,p=a|0,c=s|0,a=o|0,s=n|0,o=i|0;let q=le.add3L(fe,te,I);n=le.add3H(q,k,re,y),i=q|0}({h:n,l:i}=le.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=le.add(this.Bh|0,this.Bl|0,s|0,o|0),{h:c,l:a}=le.add(this.Ch|0,this.Cl|0,c|0,a|0),{h,l:p}=le.add(this.Dh|0,this.Dl|0,h|0,p|0),{h:g,l:w}=le.add(this.Eh|0,this.El|0,g|0,w|0),{h:x,l:f}=le.add(this.Fh|0,this.Fl|0,x|0,f|0),{h:N,l:T}=le.add(this.Gh|0,this.Gl|0,N|0,T|0),{h:O,l:H}=le.add(this.Hh|0,this.Hl|0,O|0,H|0),this.set(n,i,s,o,c,a,h,p,g,w,x,f,N,T,O,H)}roundClean(){hr.fill(0),dr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var ru=nn(()=>new No);var Rt=BigInt(0),ut=BigInt(1),Gi=BigInt(2),Gl=BigInt(8),Vl={zip215:!0};function jl(r){let e=Oi(r);return Tt(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function nu(r){let e=jl(r),{Fp:t,n,prehash:i,hash:s,randomBytes:o,nByteLength:c,h:a}=e,h=Gi<<BigInt(c*8)-ut,p=t.create,g=kt(e.n,e.nBitLength),w=e.uvRatio||((F,P)=>{try{return{isValid:!0,value:t.sqrt(F*t.inv(P))}}catch{return{isValid:!1,value:Rt}}}),x=e.adjustScalarBytes||(F=>F),f=e.domain||((F,P,$)=>{if(sr("phflag",$),P.length||$)throw new Error("Contexts/pre-hash are not supported");return F});function N(F,P){Bt("coordinate "+F,P,Rt,h)}function T(F){if(!(F instanceof D))throw new Error("ExtendedPoint expected")}let O=Kt((F,P)=>{let{ex:$,ey:Z,ez:ue}=F,ce=F.is0();P==null&&(P=ce?Gl:t.inv(ue));let Y=p($*P),U=p(Z*P),d=p(ue*P);if(ce)return{x:Rt,y:ut};if(d!==ut)throw new Error("invZ was invalid");return{x:Y,y:U}}),H=Kt(F=>{let{a:P,d:$}=e;if(F.is0())throw new Error("bad point: ZERO");let{ex:Z,ey:ue,ez:ce,et:Y}=F,U=p(Z*Z),d=p(ue*ue),J=p(ce*ce),ee=p(J*J),ae=p(U*P),Q=p(J*p(ae+d)),u=p(ee+p($*p(U*d)));if(Q!==u)throw new Error("bad point: equation left != right (1)");let l=p(Z*ue),m=p(ce*Y);if(l!==m)throw new Error("bad point: equation left != right (2)");return!0});class D{constructor(P,$,Z,ue){this.ex=P,this.ey=$,this.ez=Z,this.et=ue,N("x",P),N("y",$),N("z",Z),N("t",ue),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(P){if(P instanceof D)throw new Error("extended point not allowed");let{x:$,y:Z}=P||{};return N("x",$),N("y",Z),new D($,Z,ut,p($*Z))}static normalizeZ(P){let $=t.invertBatch(P.map(Z=>Z.ez));return P.map((Z,ue)=>Z.toAffine($[ue])).map(D.fromAffine)}static msm(P,$){return Ri(D,g,P,$)}_setWindowSize(P){C.setWindowSize(this,P)}assertValidity(){H(this)}equals(P){T(P);let{ex:$,ey:Z,ez:ue}=this,{ex:ce,ey:Y,ez:U}=P,d=p($*U),J=p(ce*ue),ee=p(Z*U),ae=p(Y*ue);return d===J&&ee===ae}is0(){return this.equals(D.ZERO)}negate(){return new D(p(-this.ex),this.ey,this.ez,p(-this.et))}double(){let{a:P}=e,{ex:$,ey:Z,ez:ue}=this,ce=p($*$),Y=p(Z*Z),U=p(Gi*p(ue*ue)),d=p(P*ce),J=$+Z,ee=p(p(J*J)-ce-Y),ae=d+Y,Q=ae-U,u=d-Y,l=p(ee*Q),m=p(ae*u),S=p(ee*u),v=p(Q*ae);return new D(l,m,v,S)}add(P){T(P);let{a:$,d:Z}=e,{ex:ue,ey:ce,ez:Y,et:U}=this,{ex:d,ey:J,ez:ee,et:ae}=P;if($===BigInt(-1)){let V=p((ce-ue)*(J+d)),W=p((ce+ue)*(J-d)),ie=p(W-V);if(ie===Rt)return this.double();let de=p(Y*Gi*ae),Ee=p(U*Gi*ee),Ne=Ee+de,he=W+V,oe=Ee-de,ke=p(Ne*ie),Qt=p(he*oe),mr=p(Ne*oe),gr=p(ie*he);return new D(ke,Qt,gr,mr)}let Q=p(ue*d),u=p(ce*J),l=p(U*Z*ae),m=p(Y*ee),S=p((ue+ce)*(d+J)-Q-u),v=m-l,A=m+l,M=p(u-$*Q),b=p(S*v),B=p(A*M),L=p(S*M),R=p(v*A);return new D(b,B,R,L)}subtract(P){return this.add(P.negate())}wNAF(P){return C.wNAFCached(this,P,D.normalizeZ)}multiply(P){let $=P;Bt("scalar",$,ut,n);let{p:Z,f:ue}=this.wNAF($);return D.normalizeZ([Z,ue])[0]}multiplyUnsafe(P){let $=P;return Bt("scalar",$,Rt,n),$===Rt?E:this.equals(E)||$===ut?this:this.equals(K)?this.wNAF($).p:C.unsafeLadder(this,$)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}isTorsionFree(){return C.unsafeLadder(this,n).is0()}toAffine(P){return O(this,P)}clearCofactor(){let{h:P}=e;return P===ut?this:this.multiplyUnsafe(P)}static fromHex(P,$=!1){let{d:Z,a:ue}=e,ce=t.BYTES;P=He("pointHex",P,ce),sr("zip215",$);let Y=P.slice(),U=P[ce-1];Y[ce-1]=U&-129;let d=or(Y),J=$?h:t.ORDER;Bt("pointHex.y",d,Rt,J);let ee=p(d*d),ae=p(ee-ut),Q=p(Z*ee-ue),{isValid:u,value:l}=w(ae,Q);if(!u)throw new Error("Point.fromHex: invalid y coordinate");let m=(l&ut)===ut,S=(U&128)!==0;if(!$&&l===Rt&&S)throw new Error("Point.fromHex: x=0 and x_0=1");return S!==m&&(l=p(-l)),D.fromAffine({x:l,y:d})}static fromPrivateKey(P){return k(P).point}toRawBytes(){let{x:P,y:$}=this.toAffine(),Z=Ir($,t.BYTES);return Z[Z.length-1]|=P&ut?128:0,Z}toHex(){return St(this.toRawBytes())}}D.BASE=new D(e.Gx,e.Gy,ut,p(e.Gx*e.Gy)),D.ZERO=new D(Rt,ut,ut,Rt);let{BASE:K,ZERO:E}=D,C=Ni(D,c*8);function G(F){return Se(F,n)}function j(F){return G(or(F))}function k(F){let P=c;F=He("private key",F,P);let $=He("hashed private key",s(F),2*P),Z=x($.slice(0,P)),ue=$.slice(P,2*P),ce=j(Z),Y=K.multiply(ce),U=Y.toRawBytes();return{head:Z,prefix:ue,scalar:ce,point:Y,pointBytes:U}}function fe(F){return k(F).pointBytes}function re(F=new Uint8Array,...P){let $=Ie(...P);return j(s(f($,He("context",F),!!i)))}function te(F,P,$={}){F=He("message",F),i&&(F=i(F));let{prefix:Z,scalar:ue,pointBytes:ce}=k(P),Y=re($.context,Z,F),U=K.multiply(Y).toRawBytes(),d=re($.context,U,ce,F),J=G(Y+d*ue);Bt("signature.s",J,Rt,n);let ee=Ie(U,Ir(J,t.BYTES));return He("result",ee,c*2)}let y=Vl;function I(F,P,$,Z=y){let{context:ue,zip215:ce}=Z,Y=t.BYTES;F=He("signature",F,2*Y),P=He("message",P),ce!==void 0&&sr("zip215",ce),i&&(P=i(P));let U=or(F.slice(Y,2*Y)),d,J,ee;try{d=D.fromHex($,ce),J=D.fromHex(F.slice(0,Y),ce),ee=K.multiplyUnsafe(U)}catch{return!1}if(!ce&&d.isSmallOrder())return!1;let ae=re(ue,J.toRawBytes(),d.toRawBytes(),P);return J.add(d.multiplyUnsafe(ae)).subtract(ee).clearCofactor().equals(D.ZERO)}return K._setWindowSize(8),{CURVE:e,getPublicKey:fe,sign:te,verify:I,ExtendedPoint:D,utils:{getExtendedPublicKey:k,randomPrivateKey:()=>o(t.BYTES),precompute(F=8,P=D.BASE){return P._setWindowSize(F),P.multiply(BigInt(3)),P}}}}var Ro=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),iu=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Xp=BigInt(0),Yl=BigInt(1),su=BigInt(2),Qp=BigInt(3),zl=BigInt(5),Kl=BigInt(8);function Zl(r){let e=BigInt(10),t=BigInt(20),n=BigInt(40),i=BigInt(80),s=Ro,c=r*r%s*r%s,a=Nt(c,su,s)*c%s,h=Nt(a,Yl,s)*r%s,p=Nt(h,zl,s)*h%s,g=Nt(p,e,s)*p%s,w=Nt(g,t,s)*g%s,x=Nt(w,n,s)*w%s,f=Nt(x,i,s)*x%s,N=Nt(f,i,s)*x%s,T=Nt(N,e,s)*p%s;return{pow_p_5_8:Nt(T,su,s)*r%s,b2:c}}function Wl(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function Xl(r,e){let t=Ro,n=Se(e*e*e,t),i=Se(n*n*e,t),s=Zl(r*i).pow_p_5_8,o=Se(r*n*s,t),c=Se(e*o*o,t),a=o,h=Se(o*iu,t),p=c===r,g=c===Se(-r,t),w=c===Se(-r*iu,t);return p&&(o=a),(g||w)&&(o=h),Mc(o,t)&&(o=Se(-o,t)),{isValid:p||g,value:o}}var Ql=kt(Ro,void 0,!0),Jl={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Ql,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:Kl,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:ru,randomBytes:Cn,adjustScalarBytes:Wl,uvRatio:Xl},ou=nu(Jl);var au=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},st=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},et,Bn,cu,uu,Vi=class{constructor(e={}){et.set(this,void 0),Bn.set(this,void 0),this[cu]=this.entries.bind(this),this[uu]="ExpirableMap";let{source:t=[],expirationTime:n=10*60*1e3}=e,i=Date.now();au(this,et,new Map([...t].map(([s,o])=>[s,{value:o,timestamp:i}])),"f"),au(this,Bn,n,"f")}prune(){let e=Date.now();for(let[t,n]of st(this,et,"f").entries())e-n.timestamp>st(this,Bn,"f")&&st(this,et,"f").delete(t);return this}set(e,t){this.prune();let n={value:t,timestamp:Date.now()};return st(this,et,"f").set(e,n),this}get(e){let t=st(this,et,"f").get(e);if(t!==void 0){if(Date.now()-t.timestamp>st(this,Bn,"f")){st(this,et,"f").delete(e);return}return t.value}}clear(){st(this,et,"f").clear()}entries(){let e=st(this,et,"f").entries();return function*(){for(let[n,i]of e)yield[n,i.value]}()}values(){let e=st(this,et,"f").values();return function*(){for(let n of e)yield n.value}()}keys(){return st(this,et,"f").keys()}forEach(e,t){for(let[n,i]of st(this,et,"f").entries())e.call(t,i.value,n,this)}has(e){return st(this,et,"f").has(e)}delete(e){return st(this,et,"f").delete(e)}get size(){return st(this,et,"f").size}};et=new WeakMap,Bn=new WeakMap,cu=Symbol.iterator,uu=Symbol.toStringTag;var fu=r=>{if(r<=127)return 1;if(r<=255)return 2;if(r<=65535)return 3;if(r<=16777215)return 4;throw new Error("Length too long (> 4 bytes)")},lu=(r,e,t)=>{if(t<=127)return r[e]=t,1;if(t<=255)return r[e]=129,r[e+1]=t,2;if(t<=65535)return r[e]=130,r[e+1]=t>>8,r[e+2]=t,3;if(t<=16777215)return r[e]=131,r[e+1]=t>>16,r[e+2]=t>>8,r[e+3]=t,4;throw new Error("Length too long (> 4 bytes)")},Oo=(r,e)=>{if(r[e]<128)return 1;if(r[e]===128)throw new Error("Invalid length 0");if(r[e]===129)return 2;if(r[e]===130)return 3;if(r[e]===131)return 4;throw new Error("Length too long (> 4 bytes)")},eh=(r,e)=>{let t=Oo(r,e);if(t===1)return r[e];if(t===2)return r[e+1];if(t===3)return(r[e+1]<<8)+r[e+2];if(t===4)return(r[e+1]<<16)+(r[e+2]<<8)+r[e+3];throw new Error("Length too long (> 4 bytes)")},r1=Uint8Array.from([48,12,6,10,43,6,1,4,1,131,184,67,1,1]),Uo=Uint8Array.from([48,5,6,3,43,101,112]),n1=Uint8Array.from([48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10]);function hu(r,e){let t=2+fu(r.byteLength+1),n=e.byteLength+t+r.byteLength,i=0,s=new Uint8Array(1+fu(n)+n);return s[i++]=48,i+=lu(s,i,n),s.set(e,i),i+=e.byteLength,s[i++]=3,i+=lu(s,i,r.byteLength+1),s[i++]=0,s.set(new Uint8Array(r),i),s}var du=(r,e)=>{let t=0,n=(c,a)=>{if(i[t++]!==c)throw new Error("Expected: "+a)},i=new Uint8Array(r);if(n(48,"sequence"),t+=Oo(i,t),!br(i.slice(t,t+e.byteLength),e))throw new Error("Not the expected OID.");t+=e.byteLength,n(3,"bit string");let s=eh(i,t)-1;t+=Oo(i,t),n(0,"0 padding");let o=i.slice(t);if(s!==o.length)throw new Error(`DER payload mismatch: Expected length ${s} actual length ${o.length}`);return o};var pu=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},mu=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ji,Yi,Tn=class r{constructor(e){if(ji.set(this,void 0),Yi.set(this,void 0),e.byteLength!==r.RAW_KEY_LENGTH)throw new Error("An Ed25519 public key must be exactly 32bytes long");pu(this,ji,e,"f"),pu(this,Yi,r.derEncode(e),"f")}static from(e){return this.fromDer(e.toDer())}static fromRaw(e){return new r(e)}static fromDer(e){return new r(this.derDecode(e))}static derEncode(e){return hu(e,Uo).buffer}static derDecode(e){let t=du(e,Uo);if(t.length!==this.RAW_KEY_LENGTH)throw new Error("An Ed25519 public key must be exactly 32bytes long");return t}get rawKey(){return mu(this,ji,"f")}get derKey(){return mu(this,Yi,"f")}toDer(){return this.derKey}toRaw(){return this.rawKey}};ji=new WeakMap,Yi=new WeakMap;Tn.RAW_KEY_LENGTH=32;var Fo=class{constructor(){this.observers=[]}subscribe(e){this.observers.push(e)}unsubscribe(e){this.observers=this.observers.filter(t=>t!==e)}notify(e,...t){this.observers.forEach(n=>n(e,...t))}},zi=class extends Fo{constructor(){super()}print(e,...t){this.notify({message:e,level:"info"},...t)}warn(e,...t){this.notify({message:e,level:"warn"},...t)}error(e,t,...n){this.notify({message:e,level:"error",error:t},...n)}};var qt=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},tt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Ct,Ki,Zi,Wi,Xi,Qi,Ji,es,Kr;var Nn=class r{constructor(e=r.default){Ct.set(this,void 0),Ki.set(this,void 0),Zi.set(this,void 0),Wi.set(this,void 0),Xi.set(this,void 0),Qi.set(this,void 0),Ji.set(this,void 0),es.set(this,void 0),Kr.set(this,0);let{initialInterval:t=500,randomizationFactor:n=.5,multiplier:i=1.5,maxInterval:s=6e4,maxElapsedTime:o=9e5,maxIterations:c=10,date:a=Date}=e;qt(this,Ct,t,"f"),qt(this,Ki,n,"f"),qt(this,Zi,i,"f"),qt(this,Wi,s,"f"),qt(this,es,a,"f"),qt(this,Xi,a.now(),"f"),qt(this,Qi,o,"f"),qt(this,Ji,c,"f")}get ellapsedTimeInMsec(){return tt(this,es,"f").now()-tt(this,Xi,"f")}get currentInterval(){return tt(this,Ct,"f")}get count(){return tt(this,Kr,"f")}get randomValueFromInterval(){let e=tt(this,Ki,"f")*tt(this,Ct,"f"),t=tt(this,Ct,"f")-e,n=tt(this,Ct,"f")+e;return Math.random()*(n-t)+t}incrementCurrentInterval(){var e;return qt(this,Ct,Math.min(tt(this,Ct,"f")*tt(this,Zi,"f"),tt(this,Wi,"f")),"f"),qt(this,Kr,(e=tt(this,Kr,"f"),e++,e),"f"),tt(this,Ct,"f")}next(){return this.ellapsedTimeInMsec>=tt(this,Qi,"f")||tt(this,Kr,"f")>=tt(this,Ji,"f")?null:(this.incrementCurrentInterval(),this.randomValueFromInterval)}};Ct=new WeakMap,Ki=new WeakMap,Zi=new WeakMap,Wi=new WeakMap,Xi=new WeakMap,Qi=new WeakMap,Ji=new WeakMap,es=new WeakMap,Kr=new WeakMap;Nn.default={initialInterval:500,randomizationFactor:.5,multiplier:1.5,maxInterval:6e4,maxElapsedTime:9e5,maxIterations:10,date:Date};var Xe=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},X=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},rt,Br,en,$t,Wt,Qr,Rn,Zr,Ot,Ut,Tr,Nr,On,Wr,Xr,Rr,Ur,bu,rs,ns,Or,gu;(function(r){r.Received="received",r.Processing="processing",r.Replied="replied",r.Rejected="rejected",r.Unknown="unknown",r.Done="done"})(gu||(gu={}));var ts=60*1e3,th="308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c05030201036100814c0e6ec71fab583b08bd81373c255c3c371b2e84863c98a4f1e08b74235d14fb5d9c0cd546d9685f913a0c0b2cc5341583bf4b4392e467db96d65b9bb4cb717112f8472e0d5a4d14505ffd7484b01291091c5f87b98883463f98091a0baaae",xu="aaaaa-aa",rh="ic0.app",nh=".ic0.app",ih="icp0.io",sh=".icp0.io",oh="icp-api.io",ah=".icp-api.io",Un=class extends Ue{constructor(e){super(e),this.message=e}},Jr=class extends Ue{constructor(e){super(e),this.message=e}};function ch(){let r;if(typeof window<"u")if(window.fetch)r=window.fetch.bind(window);else throw new Un("Fetch implementation was not available. You appear to be in a browser context, but window.fetch was not present.");else if(typeof globalThis<"u")if(globalThis.fetch)r=globalThis.fetch.bind(globalThis);else throw new Un("Fetch implementation was not available. You appear to be in a Node.js context, but global.fetch was not available.");else typeof self<"u"&&self.fetch&&(r=self.fetch.bind(self));if(r)return r;throw new Un("Fetch implementation was not available. Please provide fetch to the HttpAgent constructor, or ensure it is available in the window or global context.")}function uh(r){let e;if(r!==void 0)!r.match(/^[a-z]+:/)&&typeof window<"u"?e=new URL(window.location.protocol+"//"+r):e=new URL(r);else{let t=["ic0.app","icp0.io","127.0.0.1","localhost"],n=[".github.dev",".gitpod.io"],i=typeof window<"u"?window.location:void 0,s=i?.hostname,o;s&&typeof s=="string"&&(n.some(c=>s.endsWith(c))?o=s:o=t.find(c=>s.endsWith(c))),i&&o?e=new URL(`${i.protocol}//${o}${i.port?":"+i.port:""}`):e=new URL("https://icp-api.io")}return e.toString()}var yu=class r{constructor(e={}){var t,n;rt.add(this),Br.set(this,null),en.set(this,!1),$t.set(this,void 0),Wt.set(this,void 0),Qr.set(this,void 0),Rn.set(this,void 0),Zr.set(this,0),Ot.set(this,void 0),Ut.set(this,void 0),Tr.set(this,void 0),Nr.set(this,void 0),this._isAgent=!0,this.config={},On.set(this,0),this.log=new zi,Wr.set(this,[]),Xr.set(this,[]),Rr.set(this,new Vi({expirationTime:5*60*1e3})),Ur.set(this,!0),ns.set(this,(o,c)=>{if(X(this,Ur,"f")===!1)return o;if(!c)throw new ht("Invalid signature from replica signed query: no matching node key found.");let{status:a,signatures:h=[],requestId:p}=o,g=new TextEncoder().encode("\vic-response");for(let w of h){let{timestamp:x,identity:f}=w,N=me.fromUint8Array(f).toText(),T;if(a==="replied"){let{reply:E}=o;T=yn({status:a,reply:E,timestamp:BigInt(x),request_id:p})}else if(a==="rejected"){let{reject_code:E,reject_message:C,error_code:G}=o;T=yn({status:a,reject_code:E,reject_message:C,error_code:G,timestamp:BigInt(x),request_id:p})}else throw new Error(`Unknown status: ${a}`);let O=Qe(g,new Uint8Array(T)),H=c?.nodeKeys.get(N);if(!H)throw new ht("Invalid signature from replica signed query: no matching node key found.");let D=Tn.fromDer(H).rawKey;if(ou.verify(w.signature,new Uint8Array(O),new Uint8Array(D)))return o;throw new ht(`Invalid signature from replica ${N} signed query.`)}return o}),this.config=e,Xe(this,Wt,e.fetch||ch()||fetch.bind(globalThis),"f"),Xe(this,Qr,e.fetchOptions,"f"),Xe(this,Rn,e.callOptions,"f"),Xe(this,en,(t=e.shouldFetchRootKey)!==null&&t!==void 0?t:!1,"f"),e.rootKey?this.rootKey=e.rootKey:X(this,en,"f")?this.rootKey=null:this.rootKey=wr(th);let i=uh(e.host);this.host=new URL(i),e.verifyQuerySignatures!==void 0&&Xe(this,Ur,e.verifyQuerySignatures,"f"),Xe(this,Ut,(n=e.retryTimes)!==null&&n!==void 0?n:3,"f");let s=()=>new Nn({maxIterations:X(this,Ut,"f")});if(Xe(this,Tr,e.backoffStrategy||s,"f"),this.host.hostname.endsWith(nh)?this.host.hostname=rh:this.host.hostname.endsWith(sh)?this.host.hostname=ih:this.host.hostname.endsWith(ah)&&(this.host.hostname=oh),e.credentials){let{name:o,password:c}=e.credentials;Xe(this,Ot,`${o}${c?":"+c:""}`,"f")}if(Xe(this,$t,Promise.resolve(e.identity||new An),"f"),e.ingressExpiryInMinutes&&e.ingressExpiryInMinutes>5)throw new Ue(`The maximum ingress expiry time is 5 minutes. Provided ingress expiry time is ${e.ingressExpiryInMinutes} minutes.`);if(e.ingressExpiryInMinutes&&e.ingressExpiryInMinutes<=0)throw new Ue(`Ingress expiry time must be greater than 0. Provided ingress expiry time is ${e.ingressExpiryInMinutes} minutes.`);Xe(this,Nr,e.ingressExpiryInMinutes||5,"f"),this.addTransform("update",Bo(jr)),e.useQueryNonces&&this.addTransform("query",Bo(jr)),e.logToConsole&&this.log.subscribe(o=>{o.level==="error"?console.error(o.message):o.level==="warn"?console.warn(o.message):console.log(o.message)})}get waterMark(){return X(this,On,"f")}static createSync(e={}){return new this(Object.assign({},e))}static async create(e={shouldFetchRootKey:!1}){let t=r.createSync(e),n=[t.syncTime()];return t.host.toString()!=="https://icp-api.io"&&e.shouldFetchRootKey&&n.push(t.fetchRootKey()),await Promise.all(n),t}static async from(e){var t;try{return"config"in e?await r.create(e.config):await r.create({fetch:e._fetch,fetchOptions:e._fetchOptions,callOptions:e._callOptions,host:e._host.toString(),identity:(t=e._identity)!==null&&t!==void 0?t:void 0})}catch{throw new Ue("Failed to create agent from provided agent")}}isLocal(){let e=this.host.hostname;return e==="127.0.0.1"||e.endsWith("127.0.0.1")}addTransform(e,t,n=t.priority||0){if(e==="update"){let i=X(this,Xr,"f").findIndex(s=>(s.priority||0)<n);X(this,Xr,"f").splice(i>=0?i:X(this,Xr,"f").length,0,Object.assign(t,{priority:n}))}else if(e==="query"){let i=X(this,Wr,"f").findIndex(s=>(s.priority||0)<n);X(this,Wr,"f").splice(i>=0?i:X(this,Wr,"f").length,0,Object.assign(t,{priority:n}))}}async getPrincipal(){if(!X(this,$t,"f"))throw new Jr("This identity has expired due this application's security policy. Please refresh your authentication.");return(await X(this,$t,"f")).getPrincipal()}async call(e,t,n){var i,s;await X(this,rt,"m",Or).call(this);let o=(i=t.callSync)!==null&&i!==void 0?i:!0,c=await(n!==void 0?await n:await X(this,$t,"f"));if(!c)throw new Jr("This identity has expired due this application's security policy. Please refresh your authentication.");let a=me.from(e),h=t.effectiveCanisterId?me.from(t.effectiveCanisterId):a,p=c.getPrincipal()||me.anonymous(),g=new Sr(X(this,Nr,"f")*ts);Math.abs(X(this,Zr,"f"))>1e3*30&&(g=new Sr(X(this,Nr,"f")*ts+X(this,Zr,"f")));let w={request_type:ki.Call,canister_id:a,method_name:t.methodName,arg:t.arg,sender:p,ingress_expiry:g},x=await this._transform({request:{body:null,method:"POST",headers:Object.assign({"Content-Type":"application/cbor"},X(this,Ot,"f")?{Authorization:"Basic "+btoa(X(this,Ot,"f"))}:{})},endpoint:"call",body:w}),f=x.body.nonce?N(x.body.nonce):void 0;w.nonce=f;function N(D){return new Uint8Array(D)}x=await c.transformRequest(x);let T=oi(x.body),O=X(this,Tr,"f").call(this),H=gn(w);try{let D=()=>(this.log.print(`fetching "/api/v3/canister/${h.toText()}/call" with request:`,x),X(this,Wt,"f").call(this,""+new URL(`/api/v3/canister/${h.toText()}/call`,this.host),Object.assign(Object.assign(Object.assign({},X(this,Rn,"f")),x.request),{body:T}))),K=()=>(this.log.print(`fetching "/api/v2/canister/${h.toText()}/call" with request:`,x),X(this,Wt,"f").call(this,""+new URL(`/api/v2/canister/${h.toText()}/call`,this.host),Object.assign(Object.assign(Object.assign({},X(this,Rn,"f")),x.request),{body:T}))),C=await X(this,rt,"m",rs).call(this,{request:o?D:K,backoff:O,tries:0}),G=await C.arrayBuffer(),j=C.status===200&&G.byteLength>0?yt(G):null;if(j&&"certificate"in j){let k=await this.parseTimeFromResponse({certificate:j.certificate});Xe(this,On,k,"f")}return{requestId:H,response:{ok:C.ok,status:C.status,statusText:C.statusText,body:j,headers:Yr(C.headers)},requestDetails:w}}catch(D){if(D.message.includes("v3 api not supported."))return this.log.warn("v3 api not supported. Fall back to v2"),this.call(e,Object.assign(Object.assign({},t),{callSync:!1}),n);let K=`Error while making call: ${(s=D.message)!==null&&s!==void 0?s:String(D)}`,E=new qi(K,D,Fe(H),Fe(x.body.sender_pubkey),Fe(x.body.sender_sig),String(x.body.content.ingress_expiry._value));throw this.log.error(K,E),E}}async query(e,t,n){var i,s,o,c;await X(this,rt,"m",Or).call(this);let a=X(this,Tr,"f").call(this),h=t.effectiveCanisterId?me.from(t.effectiveCanisterId):me.from(e);this.log.print(`ecid ${h.toString()}`),this.log.print(`canisterId ${e.toString()}`);let p,g,w=await(n!==void 0?n:X(this,$t,"f"));if(!w)throw new Jr("This identity has expired due this application's security policy. Please refresh your authentication.");let x=me.from(e),f=w?.getPrincipal()||me.anonymous(),N={request_type:"query",canister_id:x,method_name:t.methodName,arg:t.arg,sender:f,ingress_expiry:new Sr(X(this,Nr,"f")*ts)},T=gn(N);p=await this._transform({request:{method:"POST",headers:Object.assign({"Content-Type":"application/cbor"},X(this,Ot,"f")?{Authorization:"Basic "+btoa(X(this,Ot,"f"))}:{})},endpoint:"read",body:N}),p=await w?.transformRequest(p);let O=oi(p.body),H={canister:x.toText(),ecid:h,transformedRequest:p,body:O,requestId:T,backoff:a,tries:0},D=async()=>({requestDetails:N,query:await X(this,rt,"m",bu).call(this,H)}),K=async()=>{if(!X(this,Ur,"f"))return;let E=X(this,Rr,"f").get(h.toString());return E||(await this.fetchSubnetKeys(h.toString()),X(this,Rr,"f").get(h.toString()))};try{let[E,C]=await Promise.all([D(),K()]);g=E;let{requestDetails:G,query:j}=g,k=Object.assign(Object.assign({},j),{requestDetails:G});if(this.log.print("Query response:",k),!X(this,Ur,"f"))return k;try{return X(this,ns,"f").call(this,k,C)}catch{this.log.warn("Query response verification failed. Retrying with fresh subnet keys."),X(this,Rr,"f").delete(e.toString()),await this.fetchSubnetKeys(h.toString());let re=X(this,Rr,"f").get(e.toString());if(!re)throw new ht("Invalid signature from replica signed query: no matching node key found.");return X(this,ns,"f").call(this,k,re)}}catch(E){let C=`Error while making call: ${(i=E.message)!==null&&i!==void 0?i:String(E)}`,G=new Ci(C,E,String(T),Fe((s=p?.body)===null||s===void 0?void 0:s.sender_pubkey),Fe((o=p?.body)===null||o===void 0?void 0:o.sender_sig),String((c=p?.body)===null||c===void 0?void 0:c.content.ingress_expiry._value));throw this.log.error(C,G),G}}async createReadStateRequest(e,t){await X(this,rt,"m",Or).call(this);let n=await(t!==void 0?await t:await X(this,$t,"f"));if(!n)throw new Jr("This identity has expired due this application's security policy. Please refresh your authentication.");let i=n?.getPrincipal()||me.anonymous(),s=await this._transform({request:{method:"POST",headers:Object.assign({"Content-Type":"application/cbor"},X(this,Ot,"f")?{Authorization:"Basic "+btoa(X(this,Ot,"f"))}:{})},endpoint:"read_state",body:{request_type:"read_state",paths:e.paths,sender:i,ingress_expiry:new Sr(X(this,Nr,"f")*ts)}});return n?.transformRequest(s)}async readState(e,t,n,i){var s,o,c,a;function h(N){for(let T of N.paths){let[O,H]=T,D=new TextEncoder().encode("request_status");if(br(O,D))return H}}let p=h(t);await X(this,rt,"m",Or).call(this);let g=typeof e=="string"?me.fromText(e):e,w=i??await this.createReadStateRequest(t,n),x=oi(w.body);this.log.print(`fetching "/api/v2/canister/${g}/read_state" with request:`,w);let f=X(this,Tr,"f").call(this);try{let N=await X(this,rt,"m",rs).call(this,{request:()=>X(this,Wt,"f").call(this,""+new URL(`/api/v2/canister/${g.toString()}/read_state`,this.host),Object.assign(Object.assign(Object.assign({},X(this,Qr,"f")),w.request),{body:x})),backoff:f,tries:0});if(!N.ok)throw new Error(`Server returned an error:
15
15
  Code: ${N.status} (${N.statusText})
16
16
  Body: ${await N.text()}
17
- `);let T=yt(await N.arrayBuffer());this.log.print("Read state response:",T);let O=await this.parseTimeFromResponse(T);return O>0&&(this.log.print("Read state response time:",O),Xe(this,On,O,"f")),T}catch(N){let T=`Caught exception while attempting to read state: ${(s=N.message)!==null&&s!==void 0?s:String(N)}`,O=new $i(T,N,String(p),Fe((o=w?.body)===null||o===void 0?void 0:o.sender_pubkey),Fe((c=w?.body)===null||c===void 0?void 0:c.sender_sig),String((a=w?.body)===null||a===void 0?void 0:a.content.ingress_expiry._value));throw this.log.error(T,O),O}}async parseTimeFromResponse(e){let t;if(e.certificate){let n=yt(e.certificate);if(n&&"tree"in n)t=n.tree;else throw new Error("Could not decode time from response");let i=pr(["time"],t);if(i.status!==De.Found)throw new Error("Time was not found in the response or was not in its expected format.");if(!(i.value instanceof ArrayBuffer)&&!ArrayBuffer.isView(i))throw new Error("Time was not found in the response or was not in its expected format.");let s=Vr(ys(i.value));return this.log.print("Time from response:",s),this.log.print("Time from response in milliseconds:",Number(s)),Number(s)}else this.log.warn("No certificate found in response");return 0}async syncTime(e){await X(this,rt,"m",Or).call(this);let t=await import("./canisterStatus-T6OA6ZHD.js"),n=Date.now();try{e||this.log.print("Syncing time with the IC. No canisterId provided, so falling back to ryjl3-tyaaa-aaaaa-aaaba-cai");let i=r.createSync({identity:new An,host:this.host.toString(),fetch:X(this,Wt,"f"),retryTimes:0}),o=(await t.request({canisterId:e??me.from("ryjl3-tyaaa-aaaaa-aaaba-cai"),agent:i,paths:["time"]})).get("time");o&&(Xe(this,Zr,Number(o)-Number(n),"f"),this.log.notify({message:`Syncing time: offset of ${X(this,Zr,"f")}`,level:"info"}))}catch(i){this.log.error("Caught exception while attempting to sync time",i)}}async status(){let e=X(this,Ot,"f")?{Authorization:"Basic "+btoa(X(this,Ot,"f"))}:{};this.log.print('fetching "/api/v2/status"');let t=X(this,Tr,"f").call(this),n=await X(this,rt,"m",rs).call(this,{backoff:t,request:()=>X(this,Wt,"f").call(this,""+new URL("/api/v2/status",this.host),Object.assign({headers:e},X(this,Qr,"f"))),tries:0});return yt(await n.arrayBuffer())}async fetchRootKey(){let e;return X(this,Br,"f")?e=await X(this,Br,"f"):(Xe(this,Br,new Promise((t,n)=>{this.status().then(i=>{let s=i.root_key;this.rootKey=s,t(s)}).catch(n)}),"f"),e=await X(this,Br,"f")),Xe(this,Br,null,"f"),e}invalidateIdentity(){Xe(this,$t,null,"f")}replaceIdentity(e){Xe(this,$t,Promise.resolve(e),"f")}async fetchSubnetKeys(e){await X(this,rt,"m",Or).call(this);let t=me.from(e),i=(await wu({canisterId:t,paths:["subnet"],agent:this})).get("subnet");if(i&&typeof i=="object"&&"nodeKeys"in i)return X(this,Rr,"f").set(t.toText(),i),i}_transform(e){let t=Promise.resolve(e);if(e.endpoint==="call")for(let n of X(this,Xr,"f"))t=t.then(i=>n(i).then(s=>s||i));else for(let n of X(this,Wr,"f"))t=t.then(i=>n(i).then(s=>s||i));return t}};Br=new WeakMap,en=new WeakMap,$t=new WeakMap,Wt=new WeakMap,Qr=new WeakMap,Rn=new WeakMap,Zr=new WeakMap,Ot=new WeakMap,Ut=new WeakMap,Tr=new WeakMap,Nr=new WeakMap,On=new WeakMap,Wr=new WeakMap,Xr=new WeakMap,Rr=new WeakMap,Ur=new WeakMap,ns=new WeakMap,rt=new WeakSet,bu=async function r(e){var t,n;let{ecid:i,transformedRequest:s,body:o,requestId:c,backoff:a,tries:h}=e,p=h===0?0:a.next();if(this.log.print(`fetching "/api/v2/canister/${i.toString()}/query" with tries:`,{tries:h,backoff:a,delay:p}),p===null)throw new Ue(`Timestamp failed to pass the watermark after retrying the configured ${X(this,Ut,"f")} times. We cannot guarantee the integrity of the response since it could be a replay attack.`);p>0&&await new Promise(f=>setTimeout(f,p));let g;try{this.log.print(`fetching "/api/v2/canister/${i.toString()}/query" with request:`,s);let f=await X(this,Wt,"f").call(this,""+new URL(`/api/v2/canister/${i.toString()}/query`,this.host),Object.assign(Object.assign(Object.assign({},X(this,Qr,"f")),s.request),{body:o}));if(f.status===200){let N=yt(await f.arrayBuffer());g=Object.assign(Object.assign({},N),{httpDetails:{ok:f.ok,status:f.status,statusText:f.statusText,headers:Yr(f.headers)},requestId:c})}else throw new zr(`Gateway returned an error:
17
+ `);let T=yt(await N.arrayBuffer());this.log.print("Read state response:",T);let O=await this.parseTimeFromResponse(T);return O>0&&(this.log.print("Read state response time:",O),Xe(this,On,O,"f")),T}catch(N){let T=`Caught exception while attempting to read state: ${(s=N.message)!==null&&s!==void 0?s:String(N)}`,O=new $i(T,N,String(p),Fe((o=w?.body)===null||o===void 0?void 0:o.sender_pubkey),Fe((c=w?.body)===null||c===void 0?void 0:c.sender_sig),String((a=w?.body)===null||a===void 0?void 0:a.content.ingress_expiry._value));throw this.log.error(T,O),O}}async parseTimeFromResponse(e){let t;if(e.certificate){let n=yt(e.certificate);if(n&&"tree"in n)t=n.tree;else throw new Error("Could not decode time from response");let i=pr(["time"],t);if(i.status!==De.Found)throw new Error("Time was not found in the response or was not in its expected format.");if(!(i.value instanceof ArrayBuffer)&&!ArrayBuffer.isView(i))throw new Error("Time was not found in the response or was not in its expected format.");let s=Vr(ys(i.value));return this.log.print("Time from response:",s),this.log.print("Time from response in milliseconds:",Number(s)),Number(s)}else this.log.warn("No certificate found in response");return 0}async syncTime(e){await X(this,rt,"m",Or).call(this);let t=await import("./canisterStatus-227TLZKL.js"),n=Date.now();try{e||this.log.print("Syncing time with the IC. No canisterId provided, so falling back to ryjl3-tyaaa-aaaaa-aaaba-cai");let i=r.createSync({identity:new An,host:this.host.toString(),fetch:X(this,Wt,"f"),retryTimes:0}),o=(await t.request({canisterId:e??me.from("ryjl3-tyaaa-aaaaa-aaaba-cai"),agent:i,paths:["time"]})).get("time");o&&(Xe(this,Zr,Number(o)-Number(n),"f"),this.log.notify({message:`Syncing time: offset of ${X(this,Zr,"f")}`,level:"info"}))}catch(i){this.log.error("Caught exception while attempting to sync time",i)}}async status(){let e=X(this,Ot,"f")?{Authorization:"Basic "+btoa(X(this,Ot,"f"))}:{};this.log.print('fetching "/api/v2/status"');let t=X(this,Tr,"f").call(this),n=await X(this,rt,"m",rs).call(this,{backoff:t,request:()=>X(this,Wt,"f").call(this,""+new URL("/api/v2/status",this.host),Object.assign({headers:e},X(this,Qr,"f"))),tries:0});return yt(await n.arrayBuffer())}async fetchRootKey(){let e;return X(this,Br,"f")?e=await X(this,Br,"f"):(Xe(this,Br,new Promise((t,n)=>{this.status().then(i=>{let s=i.root_key;this.rootKey=s,t(s)}).catch(n)}),"f"),e=await X(this,Br,"f")),Xe(this,Br,null,"f"),e}invalidateIdentity(){Xe(this,$t,null,"f")}replaceIdentity(e){Xe(this,$t,Promise.resolve(e),"f")}async fetchSubnetKeys(e){await X(this,rt,"m",Or).call(this);let t=me.from(e),i=(await wu({canisterId:t,paths:["subnet"],agent:this})).get("subnet");if(i&&typeof i=="object"&&"nodeKeys"in i)return X(this,Rr,"f").set(t.toText(),i),i}_transform(e){let t=Promise.resolve(e);if(e.endpoint==="call")for(let n of X(this,Xr,"f"))t=t.then(i=>n(i).then(s=>s||i));else for(let n of X(this,Wr,"f"))t=t.then(i=>n(i).then(s=>s||i));return t}};Br=new WeakMap,en=new WeakMap,$t=new WeakMap,Wt=new WeakMap,Qr=new WeakMap,Rn=new WeakMap,Zr=new WeakMap,Ot=new WeakMap,Ut=new WeakMap,Tr=new WeakMap,Nr=new WeakMap,On=new WeakMap,Wr=new WeakMap,Xr=new WeakMap,Rr=new WeakMap,Ur=new WeakMap,ns=new WeakMap,rt=new WeakSet,bu=async function r(e){var t,n;let{ecid:i,transformedRequest:s,body:o,requestId:c,backoff:a,tries:h}=e,p=h===0?0:a.next();if(this.log.print(`fetching "/api/v2/canister/${i.toString()}/query" with tries:`,{tries:h,backoff:a,delay:p}),p===null)throw new Ue(`Timestamp failed to pass the watermark after retrying the configured ${X(this,Ut,"f")} times. We cannot guarantee the integrity of the response since it could be a replay attack.`);p>0&&await new Promise(f=>setTimeout(f,p));let g;try{this.log.print(`fetching "/api/v2/canister/${i.toString()}/query" with request:`,s);let f=await X(this,Wt,"f").call(this,""+new URL(`/api/v2/canister/${i.toString()}/query`,this.host),Object.assign(Object.assign(Object.assign({},X(this,Qr,"f")),s.request),{body:o}));if(f.status===200){let N=yt(await f.arrayBuffer());g=Object.assign(Object.assign({},N),{httpDetails:{ok:f.ok,status:f.status,statusText:f.statusText,headers:Yr(f.headers)},requestId:c})}else throw new zr(`Gateway returned an error:
18
18
  Code: ${f.status} (${f.statusText})
19
19
  Body: ${await f.text()}
20
20
  `,{ok:f.ok,status:f.status,statusText:f.statusText,headers:Yr(f.headers)})}catch(f){if(h<X(this,Ut,"f"))return this.log.warn(`Caught exception while attempting to make query:
@@ -66,4 +66,4 @@ ieee754/index.js:
66
66
  @noble/curves/esm/ed25519.js:
67
67
  (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
68
68
  */
69
- //# sourceMappingURL=chunk-Q5TR3LMW.js.map
69
+ //# sourceMappingURL=chunk-S7FZSAC3.js.map