@junobuild/core 0.0.59 → 0.0.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/canisterStatus-APCJZWVG.js +2 -0
- package/dist/browser/chunk-3YVZN56F.js +46 -0
- package/dist/browser/chunk-3YVZN56F.js.map +7 -0
- package/dist/browser/index.js +14 -14
- package/dist/browser/index.js.map +3 -3
- package/dist/node/index.mjs +34 -31
- package/dist/node/index.mjs.map +4 -4
- package/dist/workers/auth.worker.js +14 -14
- package/dist/workers/auth.worker.js.map +3 -3
- package/package.json +5 -5
- package/dist/browser/canisterStatus-7ZJKVFTO.js +0 -2
- package/dist/browser/chunk-FOA6PEDK.js +0 -43
- package/dist/browser/chunk-FOA6PEDK.js.map +0 -7
- /package/dist/browser/{canisterStatus-7ZJKVFTO.js.map → canisterStatus-APCJZWVG.js.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@junobuild/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.60",
|
|
4
4
|
"description": "JavaScript core client for Juno",
|
|
5
5
|
"author": "David Dal Busco (https://daviddalbusco.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
],
|
|
51
51
|
"homepage": "https://juno.build",
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@dfinity/agent": "^
|
|
54
|
-
"@dfinity/auth-client": "^
|
|
55
|
-
"@dfinity/identity": "^
|
|
56
|
-
"@dfinity/principal": "^
|
|
53
|
+
"@dfinity/agent": "^2.0.0",
|
|
54
|
+
"@dfinity/auth-client": "^2.0.0",
|
|
55
|
+
"@dfinity/identity": "^2.0.0",
|
|
56
|
+
"@dfinity/principal": "^2.0.0",
|
|
57
57
|
"@junobuild/storage": "*",
|
|
58
58
|
"@junobuild/utils": "*"
|
|
59
59
|
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
var tc=Object.create;var Rr=Object.defineProperty;var rc=Object.getOwnPropertyDescriptor;var nc=Object.getOwnPropertyNames;var ic=Object.getPrototypeOf,sc=Object.prototype.hasOwnProperty;var oc=(r,e)=>()=>(r&&(e=r(r=0)),e);var Ge=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Mn=(r,e)=>{for(var t in e)Rr(r,t,{get:e[t],enumerable:!0})},Xi=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of nc(e))!sc.call(r,i)&&i!==t&&Rr(r,i,{get:()=>e[i],enumerable:!(n=rc(e,i))||n.enumerable});return r};var Or=(r,e,t)=>(t=r!=null?tc(ic(r)):{},Xi(e||!r||!r.__esModule?Rr(t,"default",{value:r,enumerable:!0}):t,r)),ac=r=>Xi(Rr({},"__esModule",{value:!0}),r);var Ss={};Mn(Ss,{Buffer:()=>M,INSPECT_MAX_BYTES:()=>ps,SlowBuffer:()=>Sc,isBuffer:()=>vs,kMaxLength:()=>_c});function ls(){Vn=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,t=r.length;e<t;++e)gt[e]=r[e],nt[r.charCodeAt(e)]=e;nt[45]=62,nt[95]=63}function yc(r){Vn||ls();var e,t,n,i,s,o,f=r.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=r[f-2]==="="?2:r[f-1]==="="?1:0,o=new mc(f*3/4-s),n=s>0?f-4:f;var a=0;for(e=0,t=0;e<n;e+=4,t+=3)i=nt[r.charCodeAt(e)]<<18|nt[r.charCodeAt(e+1)]<<12|nt[r.charCodeAt(e+2)]<<6|nt[r.charCodeAt(e+3)],o[a++]=i>>16&255,o[a++]=i>>8&255,o[a++]=i&255;return s===2?(i=nt[r.charCodeAt(e)]<<2|nt[r.charCodeAt(e+1)]>>4,o[a++]=i&255):s===1&&(i=nt[r.charCodeAt(e)]<<10|nt[r.charCodeAt(e+1)]<<4|nt[r.charCodeAt(e+2)]>>2,o[a++]=i>>8&255,o[a++]=i&255),o}function wc(r){return gt[r>>18&63]+gt[r>>12&63]+gt[r>>6&63]+gt[r&63]}function xc(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(wc(n));return i.join("")}function cs(r){Vn||ls();for(var e,t=r.length,n=t%3,i="",s=[],o=16383,f=0,a=t-n;f<a;f+=o)s.push(xc(r,f,f+o>a?a:f+o));return n===1?(e=r[t-1],i+=gt[e>>2],i+=gt[e<<4&63],i+="=="):n===2&&(e=(r[t-2]<<8)+r[t-1],i+=gt[e>>10],i+=gt[e>>4&63],i+=gt[e<<2&63],i+="="),s.push(i),s.join("")}function Gr(r,e,t,n,i){var s,o,f=i*8-n-1,a=(1<<f)-1,m=a>>1,E=-7,h=t?i-1:0,O=t?-1:1,B=r[e+h];for(h+=O,s=B&(1<<-E)-1,B>>=-E,E+=f;E>0;s=s*256+r[e+h],h+=O,E-=8);for(o=s&(1<<-E)-1,s>>=-E,E+=n;E>0;o=o*256+r[e+h],h+=O,E-=8);if(s===0)s=1-m;else{if(s===a)return o?NaN:(B?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-m}return(B?-1:1)*o*Math.pow(2,s-n)}function ds(r,e,t,n,i,s){var o,f,a,m=s*8-i-1,E=(1<<m)-1,h=E>>1,O=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,B=n?0:s-1,v=n?1:-1,A=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,o=E):(o=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+h>=1?e+=O/a:e+=O*Math.pow(2,1-h),e*a>=2&&(o++,a/=2),o+h>=E?(f=0,o=E):o+h>=1?(f=(e*a-1)*Math.pow(2,i),o=o+h):(f=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;r[t+B]=f&255,B+=v,f/=256,i-=8);for(o=o<<i|f,m+=i;m>0;r[t+B]=o&255,B+=v,o/=256,m-=8);r[t+B-v]|=A*128}function $r(){return M.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Et(r,e){if($r()<e)throw new RangeError("Invalid typed array length");return M.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=M.prototype):(r===null&&(r=new M(e)),r.length=e),r}function M(r,e,t){if(!M.TYPED_ARRAY_SUPPORT&&!(this instanceof M))return new M(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 Yn(this,r)}return bs(this,r,e,t)}function bs(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?vc(r,e,t,n):typeof e=="string"?Bc(r,e,t):Ac(r,e)}function gs(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 Ic(r,e,t,n){return gs(e),e<=0?Et(r,e):t!==void 0?typeof n=="string"?Et(r,e).fill(t,n):Et(r,e).fill(t):Et(r,e)}function Yn(r,e){if(gs(e),r=Et(r,e<0?0:Hn(e)|0),!M.TYPED_ARRAY_SUPPORT)for(var t=0;t<e;++t)r[t]=0;return r}function Bc(r,e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!M.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var n=ms(e,t)|0;r=Et(r,n);var i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function Gn(r,e){var t=e.length<0?0:Hn(e.length)|0;r=Et(r,t);for(var n=0;n<t;n+=1)r[n]=e[n]&255;return r}function vc(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),M.TYPED_ARRAY_SUPPORT?(r=e,r.__proto__=M.prototype):r=Gn(r,e),r}function Ac(r,e){if(mt(e)){var t=Hn(e.length)|0;return r=Et(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"||zc(e.length)?Et(r,0):Gn(r,e);if(e.type==="Buffer"&&hs(e.data))return Gn(r,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Hn(r){if(r>=$r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+$r().toString(16)+" bytes");return r|0}function Sc(r){return+r!=r&&(r=0),M.alloc(+r)}function mt(r){return!!(r!=null&&r._isBuffer)}function ms(r,e){if(mt(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 Cr(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Bs(r).length;default:if(n)return Cr(r).length;e=(""+e).toLowerCase(),n=!0}}function Tc(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 kc(this,e,t);case"utf8":case"utf-8":return xs(this,e,t);case"ascii":return Mc(this,e,t);case"latin1":case"binary":return Dc(this,e,t);case"base64":return Pc(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qc(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}function Ct(r,e,t){var n=r[e];r[e]=r[t],r[t]=n}function ys(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=M.from(e,n)),mt(e))return e.length===0?-1:fs(r,e,t,n,i);if(typeof e=="number")return e=e&255,M.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):fs(r,[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}function fs(r,e,t,n,i){var s=1,o=r.length,f=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,f/=2,t/=2}function a(B,v){return s===1?B[v]:B.readUInt16BE(v*s)}var m;if(i){var E=-1;for(m=t;m<o;m++)if(a(r,m)===a(e,E===-1?0:m-E)){if(E===-1&&(E=m),m-E+1===f)return E*s}else E!==-1&&(m-=m-E),E=-1}else for(t+f>o&&(t=o-f),m=t;m>=0;m--){for(var h=!0,O=0;O<f;O++)if(a(r,m+O)!==a(e,O)){h=!1;break}if(h)return m}return-1}function Nc(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 f=parseInt(e.substr(o*2,2),16);if(isNaN(f))return o;r[t+o]=f}return o}function Uc(r,e,t,n){return Hr(Cr(e,r.length-t),r,t,n)}function ws(r,e,t,n){return Hr(Yc(e),r,t,n)}function Rc(r,e,t,n){return ws(r,e,t,n)}function Oc(r,e,t,n){return Hr(Bs(e),r,t,n)}function Fc(r,e,t,n){return Hr(Hc(e,r.length-t),r,t,n)}function Pc(r,e,t){return e===0&&t===r.length?cs(r):cs(r.slice(e,t))}function xs(r,e,t){t=Math.min(r.length,t);for(var n=[],i=e;i<t;){var s=r[i],o=null,f=s>239?4:s>223?3:s>191?2:1;if(i+f<=t){var a,m,E,h;switch(f){case 1:s<128&&(o=s);break;case 2:a=r[i+1],(a&192)===128&&(h=(s&31)<<6|a&63,h>127&&(o=h));break;case 3:a=r[i+1],m=r[i+2],(a&192)===128&&(m&192)===128&&(h=(s&15)<<12|(a&63)<<6|m&63,h>2047&&(h<55296||h>57343)&&(o=h));break;case 4:a=r[i+1],m=r[i+2],E=r[i+3],(a&192)===128&&(m&192)===128&&(E&192)===128&&(h=(s&15)<<18|(a&63)<<12|(m&63)<<6|E&63,h>65535&&h<1114112&&(o=h))}}o===null?(o=65533,f=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=f}return Lc(n)}function Lc(r){var e=r.length;if(e<=us)return String.fromCharCode.apply(String,r);for(var t="",n=0;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=us));return t}function Mc(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 Dc(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 kc(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+=Vc(r[s]);return i}function qc(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 Ye(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 Je(r,e,t,n,i,s){if(!mt(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 Vr(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 Yr(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 Es(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 _s(r,e,t,n,i){return i||Es(r,e,t,4),ds(r,e,t,n,23,4),t+4}function Is(r,e,t,n,i){return i||Es(r,e,t,8),ds(r,e,t,n,52,8),t+8}function Cc(r){if(r=Gc(r).replace($c,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Gc(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function Vc(r){return r<16?"0"+r.toString(16):r.toString(16)}function Cr(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 Yc(r){for(var e=[],t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function Hc(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 Bs(r){return yc(Cc(r))}function Hr(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 zc(r){return r!==r}function vs(r){return r!=null&&(!!r._isBuffer||As(r)||Zc(r))}function As(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Zc(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&As(r.slice(0,0))}var gt,nt,mc,Vn,Ec,hs,ps,_c,us,$c,Ts=oc(()=>{gt=[],nt=[],mc=typeof Uint8Array<"u"?Uint8Array:Array,Vn=!1;Ec={}.toString,hs=Array.isArray||function(r){return Ec.call(r)=="[object Array]"};ps=50;M.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;_c=$r();M.poolSize=8192;M._augment=function(r){return r.__proto__=M.prototype,r};M.from=function(r,e,t){return bs(null,r,e,t)};M.TYPED_ARRAY_SUPPORT&&(M.prototype.__proto__=Uint8Array.prototype,M.__proto__=Uint8Array);M.alloc=function(r,e,t){return Ic(null,r,e,t)};M.allocUnsafe=function(r){return Yn(null,r)};M.allocUnsafeSlow=function(r){return Yn(null,r)};M.isBuffer=vs;M.compare=function(e,t){if(!mt(e)||!mt(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};M.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}};M.concat=function(e,t){if(!hs(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return M.alloc(0);var n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var i=M.allocUnsafe(t),s=0;for(n=0;n<e.length;++n){var o=e[n];if(!mt(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,s),s+=o.length}return i};M.byteLength=ms;M.prototype._isBuffer=!0;M.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)Ct(this,t,t+1);return this};M.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)Ct(this,t,t+3),Ct(this,t+1,t+2);return this};M.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)Ct(this,t,t+7),Ct(this,t+1,t+6),Ct(this,t+2,t+5),Ct(this,t+3,t+4);return this};M.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?xs(this,0,e):Tc.apply(this,arguments)};M.prototype.equals=function(e){if(!mt(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:M.compare(this,e)===0};M.prototype.inspect=function(){var e="",t=ps;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"};M.prototype.compare=function(e,t,n,i,s){if(!mt(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,f=n-t,a=Math.min(o,f),m=this.slice(i,s),E=e.slice(t,n),h=0;h<a;++h)if(m[h]!==E[h]){o=m[h],f=E[h];break}return o<f?-1:f<o?1:0};M.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1};M.prototype.indexOf=function(e,t,n){return ys(this,e,t,n,!0)};M.prototype.lastIndexOf=function(e,t,n){return ys(this,e,t,n,!1)};M.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 Nc(this,e,t,n);case"utf8":case"utf-8":return Uc(this,e,t,n);case"ascii":return ws(this,e,t,n);case"latin1":case"binary":return Rc(this,e,t,n);case"base64":return Oc(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Fc(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};M.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};us=4096;M.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(M.TYPED_ARRAY_SUPPORT)i=this.subarray(e,t),i.__proto__=M.prototype;else{var s=t-e;i=new M(s,void 0);for(var o=0;o<s;++o)i[o]=this[o+e]}return i};M.prototype.readUIntLE=function(e,t,n){e=e|0,t=t|0,n||Ye(e,t,this.length);for(var i=this[e],s=1,o=0;++o<t&&(s*=256);)i+=this[e+o]*s;return i};M.prototype.readUIntBE=function(e,t,n){e=e|0,t=t|0,n||Ye(e,t,this.length);for(var i=this[e+--t],s=1;t>0&&(s*=256);)i+=this[e+--t]*s;return i};M.prototype.readUInt8=function(e,t){return t||Ye(e,1,this.length),this[e]};M.prototype.readUInt16LE=function(e,t){return t||Ye(e,2,this.length),this[e]|this[e+1]<<8};M.prototype.readUInt16BE=function(e,t){return t||Ye(e,2,this.length),this[e]<<8|this[e+1]};M.prototype.readUInt32LE=function(e,t){return t||Ye(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};M.prototype.readUInt32BE=function(e,t){return t||Ye(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};M.prototype.readIntLE=function(e,t,n){e=e|0,t=t|0,n||Ye(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};M.prototype.readIntBE=function(e,t,n){e=e|0,t=t|0,n||Ye(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};M.prototype.readInt8=function(e,t){return t||Ye(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};M.prototype.readInt16LE=function(e,t){t||Ye(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};M.prototype.readInt16BE=function(e,t){t||Ye(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};M.prototype.readInt32LE=function(e,t){return t||Ye(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};M.prototype.readInt32BE=function(e,t){return t||Ye(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};M.prototype.readFloatLE=function(e,t){return t||Ye(e,4,this.length),Gr(this,e,!0,23,4)};M.prototype.readFloatBE=function(e,t){return t||Ye(e,4,this.length),Gr(this,e,!1,23,4)};M.prototype.readDoubleLE=function(e,t){return t||Ye(e,8,this.length),Gr(this,e,!0,52,8)};M.prototype.readDoubleBE=function(e,t){return t||Ye(e,8,this.length),Gr(this,e,!1,52,8)};M.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;Je(this,e,t,n,s,0)}var o=1,f=0;for(this[t]=e&255;++f<n&&(o*=256);)this[t+f]=e/o&255;return t+n};M.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;Je(this,e,t,n,s,0)}var o=n-1,f=1;for(this[t+o]=e&255;--o>=0&&(f*=256);)this[t+o]=e/f&255;return t+n};M.prototype.writeUInt8=function(e,t,n){return e=+e,t=t|0,n||Je(this,e,t,1,255,0),M.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e&255,t+1};M.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t|0,n||Je(this,e,t,2,65535,0),M.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):Vr(this,e,t,!0),t+2};M.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t|0,n||Je(this,e,t,2,65535,0),M.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):Vr(this,e,t,!1),t+2};M.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t|0,n||Je(this,e,t,4,4294967295,0),M.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255):Yr(this,e,t,!0),t+4};M.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t|0,n||Je(this,e,t,4,4294967295,0),M.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):Yr(this,e,t,!1),t+4};M.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t=t|0,!i){var s=Math.pow(2,8*n-1);Je(this,e,t,n,s-1,-s)}var o=0,f=1,a=0;for(this[t]=e&255;++o<n&&(f*=256);)e<0&&a===0&&this[t+o-1]!==0&&(a=1),this[t+o]=(e/f>>0)-a&255;return t+n};M.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t=t|0,!i){var s=Math.pow(2,8*n-1);Je(this,e,t,n,s-1,-s)}var o=n-1,f=1,a=0;for(this[t+o]=e&255;--o>=0&&(f*=256);)e<0&&a===0&&this[t+o+1]!==0&&(a=1),this[t+o]=(e/f>>0)-a&255;return t+n};M.prototype.writeInt8=function(e,t,n){return e=+e,t=t|0,n||Je(this,e,t,1,127,-128),M.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=e&255,t+1};M.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t|0,n||Je(this,e,t,2,32767,-32768),M.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):Vr(this,e,t,!0),t+2};M.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t|0,n||Je(this,e,t,2,32767,-32768),M.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):Vr(this,e,t,!1),t+2};M.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t|0,n||Je(this,e,t,4,2147483647,-2147483648),M.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Yr(this,e,t,!0),t+4};M.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t|0,n||Je(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),M.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):Yr(this,e,t,!1),t+4};M.prototype.writeFloatLE=function(e,t,n){return _s(this,e,t,!0,n)};M.prototype.writeFloatBE=function(e,t,n){return _s(this,e,t,!1,n)};M.prototype.writeDoubleLE=function(e,t,n){return Is(this,e,t,!0,n)};M.prototype.writeDoubleBE=function(e,t,n){return Is(this,e,t,!1,n)};M.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||!M.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};M.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"&&!M.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 f=mt(e)?e:Cr(new M(e,i).toString()),a=f.length;for(o=0;o<n-t;++o)this[o+t]=f[o%a]}return this};$c=/[^+\/0-9A-Za-z-_]/g});var lr=Ge((y0,zr)=>{var Gt=(Ts(),ac(Ss));if(Gt&&Gt.default){zr.exports=Gt.default;for(let r in Gt)zr.exports[r]=Gt[r]}else Gt&&(zr.exports=Gt)});var Ns=Ge(zn=>{zn.read=function(r,e,t,n,i){var s,o,f=i*8-n-1,a=(1<<f)-1,m=a>>1,E=-7,h=t?i-1:0,O=t?-1:1,B=r[e+h];for(h+=O,s=B&(1<<-E)-1,B>>=-E,E+=f;E>0;s=s*256+r[e+h],h+=O,E-=8);for(o=s&(1<<-E)-1,s>>=-E,E+=n;E>0;o=o*256+r[e+h],h+=O,E-=8);if(s===0)s=1-m;else{if(s===a)return o?NaN:(B?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-m}return(B?-1:1)*o*Math.pow(2,s-n)};zn.write=function(r,e,t,n,i,s){var o,f,a,m=s*8-i-1,E=(1<<m)-1,h=E>>1,O=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,B=n?0:s-1,v=n?1:-1,A=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,o=E):(o=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+h>=1?e+=O/a:e+=O*Math.pow(2,1-h),e*a>=2&&(o++,a/=2),o+h>=E?(f=0,o=E):o+h>=1?(f=(e*a-1)*Math.pow(2,i),o=o+h):(f=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;r[t+B]=f&255,B+=v,f/=256,i-=8);for(o=o<<i|f,m+=i;m>0;r[t+B]=o&255,B+=v,o/=256,m-=8);r[t+B-v]|=A*128}});var dr=Ge((Us,Zr)=>{(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: ",f=1e14,a=14,m=9007199254740991,E=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],h=1e7,O=1e9;function B(k){var F,C,Y,q=R.prototype={constructor:R,toString:null,valueOf:null},J=new R(1),Z=20,te=4,ce=-7,me=21,ue=-1e7,$=1e7,ee=!1,Q=1,re=0,fe={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},ge="0123456789abcdefghijklmnopqrstuvwxyz",Ie=!0;function R(c,u){var l,_,y,x,T,p,w,S,I=this;if(!(I instanceof R))return new R(c,u);if(u==null){if(c&&c._isBigNumber===!0){I.s=c.s,!c.c||c.e>$?I.c=I.e=null:c.e<ue?I.c=[I.e=0]:(I.e=c.e,I.c=c.c.slice());return}if((p=typeof c=="number")&&c*0==0){if(I.s=1/c<0?(c=-c,-1):1,c===~~c){for(x=0,T=c;T>=10;T/=10,x++);x>$?I.c=I.e=null:(I.e=x,I.c=[c]);return}S=String(c)}else{if(!t.test(S=String(c)))return Y(I,S,p);I.s=S.charCodeAt(0)==45?(S=S.slice(1),-1):1}(x=S.indexOf("."))>-1&&(S=S.replace(".","")),(T=S.search(/e/i))>0?(x<0&&(x=T),x+=+S.slice(T+1),S=S.substring(0,T)):x<0&&(x=S.length)}else{if(N(u,2,ge.length,"Base"),u==10&&Ie)return I=new R(c),ye(I,Z+I.e+1,te);if(S=String(c),p=typeof c=="number"){if(c*0!=0)return Y(I,S,p,u);if(I.s=1/c<0?(S=S.slice(1),-1):1,R.DEBUG&&S.replace(/^0\.0*|\./,"").length>15)throw Error(o+c)}else I.s=S.charCodeAt(0)===45?(S=S.slice(1),-1):1;for(l=ge.slice(0,u),x=T=0,w=S.length;T<w;T++)if(l.indexOf(_=S.charAt(T))<0){if(_=="."){if(T>x){x=w;continue}}else if(!y&&(S==S.toUpperCase()&&(S=S.toLowerCase())||S==S.toLowerCase()&&(S=S.toUpperCase()))){y=!0,T=-1,x=0;continue}return Y(I,String(c),p,u)}p=!1,S=C(S,u,10,I.s),(x=S.indexOf("."))>-1?S=S.replace(".",""):x=S.length}for(T=0;S.charCodeAt(T)===48;T++);for(w=S.length;S.charCodeAt(--w)===48;);if(S=S.slice(T,++w)){if(w-=T,p&&R.DEBUG&&w>15&&(c>m||c!==i(c)))throw Error(o+I.s*c);if((x=x-T-1)>$)I.c=I.e=null;else if(x<ue)I.c=[I.e=0];else{if(I.e=x,I.c=[],T=(x+1)%a,x<0&&(T+=a),T<w){for(T&&I.c.push(+S.slice(0,T)),w-=a;T<w;)I.c.push(+S.slice(T,T+=a));T=a-(S=S.slice(T)).length}else T-=w;for(;T--;S+="0");I.c.push(+S)}}else I.c=[I.e=0]}R.clone=B,R.ROUND_UP=0,R.ROUND_DOWN=1,R.ROUND_CEIL=2,R.ROUND_FLOOR=3,R.ROUND_HALF_UP=4,R.ROUND_HALF_DOWN=5,R.ROUND_HALF_EVEN=6,R.ROUND_HALF_CEIL=7,R.ROUND_HALF_FLOOR=8,R.EUCLID=9,R.config=R.set=function(c){var u,l;if(c!=null)if(typeof c=="object"){if(c.hasOwnProperty(u="DECIMAL_PLACES")&&(l=c[u],N(l,0,O,u),Z=l),c.hasOwnProperty(u="ROUNDING_MODE")&&(l=c[u],N(l,0,8,u),te=l),c.hasOwnProperty(u="EXPONENTIAL_AT")&&(l=c[u],l&&l.pop?(N(l[0],-O,0,u),N(l[1],0,O,u),ce=l[0],me=l[1]):(N(l,-O,O,u),ce=-(me=l<0?-l:l))),c.hasOwnProperty(u="RANGE"))if(l=c[u],l&&l.pop)N(l[0],-O,-1,u),N(l[1],1,O,u),ue=l[0],$=l[1];else if(N(l,-O,O,u),l)ue=-($=l<0?-l:l);else throw Error(s+u+" cannot be zero: "+l);if(c.hasOwnProperty(u="CRYPTO"))if(l=c[u],l===!!l)if(l)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))ee=l;else throw ee=!l,Error(s+"crypto unavailable");else ee=l;else throw Error(s+u+" not true or false: "+l);if(c.hasOwnProperty(u="MODULO_MODE")&&(l=c[u],N(l,0,9,u),Q=l),c.hasOwnProperty(u="POW_PRECISION")&&(l=c[u],N(l,0,O,u),re=l),c.hasOwnProperty(u="FORMAT"))if(l=c[u],typeof l=="object")fe=l;else throw Error(s+u+" not an object: "+l);if(c.hasOwnProperty(u="ALPHABET"))if(l=c[u],typeof l=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(l))Ie=l.slice(0,10)=="0123456789",ge=l;else throw Error(s+u+" invalid: "+l)}else throw Error(s+"Object expected: "+c);return{DECIMAL_PLACES:Z,ROUNDING_MODE:te,EXPONENTIAL_AT:[ce,me],RANGE:[ue,$],CRYPTO:ee,MODULO_MODE:Q,POW_PRECISION:re,FORMAT:fe,ALPHABET:ge}},R.isBigNumber=function(c){if(!c||c._isBigNumber!==!0)return!1;if(!R.DEBUG)return!0;var u,l,_=c.c,y=c.e,x=c.s;e:if({}.toString.call(_)=="[object Array]"){if((x===1||x===-1)&&y>=-O&&y<=O&&y===i(y)){if(_[0]===0){if(y===0&&_.length===1)return!0;break e}if(u=(y+1)%a,u<1&&(u+=a),String(_[0]).length==u){for(u=0;u<_.length;u++)if(l=_[u],l<0||l>=f||l!==i(l))break e;if(l!==0)return!0}}}else if(_===null&&y===null&&(x===null||x===1||x===-1))return!0;throw Error(s+"Invalid BigNumber: "+c)},R.maximum=R.max=function(){return Ue(arguments,-1)},R.minimum=R.min=function(){return Ue(arguments,1)},R.random=function(){var c=9007199254740992,u=Math.random()*c&2097151?function(){return i(Math.random()*c)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(l){var _,y,x,T,p,w=0,S=[],I=new R(J);if(l==null?l=Z:N(l,0,O),T=n(l/a),ee)if(crypto.getRandomValues){for(_=crypto.getRandomValues(new Uint32Array(T*=2));w<T;)p=_[w]*131072+(_[w+1]>>>11),p>=9e15?(y=crypto.getRandomValues(new Uint32Array(2)),_[w]=y[0],_[w+1]=y[1]):(S.push(p%1e14),w+=2);w=T/2}else if(crypto.randomBytes){for(_=crypto.randomBytes(T*=7);w<T;)p=(_[w]&31)*281474976710656+_[w+1]*1099511627776+_[w+2]*4294967296+_[w+3]*16777216+(_[w+4]<<16)+(_[w+5]<<8)+_[w+6],p>=9e15?crypto.randomBytes(7).copy(_,w):(S.push(p%1e14),w+=7);w=T/7}else throw ee=!1,Error(s+"crypto unavailable");if(!ee)for(;w<T;)p=u(),p<9e15&&(S[w++]=p%1e14);for(T=S[--w],l%=a,T&&l&&(p=E[a-l],S[w]=i(T/p)*p);S[w]===0;S.pop(),w--);if(w<0)S=[x=0];else{for(x=-1;S[0]===0;S.splice(0,1),x-=a);for(w=1,p=S[0];p>=10;p/=10,w++);w<a&&(x-=a-w)}return I.e=x,I.c=S,I}}(),R.sum=function(){for(var c=1,u=arguments,l=new R(u[0]);c<u.length;)l=l.plus(u[c++]);return l},C=function(){var c="0123456789";function u(l,_,y,x){for(var T,p=[0],w,S=0,I=l.length;S<I;){for(w=p.length;w--;p[w]*=_);for(p[0]+=x.indexOf(l.charAt(S++)),T=0;T<p.length;T++)p[T]>y-1&&(p[T+1]==null&&(p[T+1]=0),p[T+1]+=p[T]/y|0,p[T]%=y)}return p.reverse()}return function(l,_,y,x,T){var p,w,S,I,L,G,K,oe,we=l.indexOf("."),Se=Z,ie=te;for(we>=0&&(I=re,re=0,l=l.replace(".",""),oe=new R(_),G=oe.pow(l.length-we),re=I,oe.c=u(z(A(G.c),G.e,"0"),10,y,c),oe.e=oe.c.length),K=u(l,_,y,T?(p=ge,c):(p=c,ge)),S=I=K.length;K[--I]==0;K.pop());if(!K[0])return p.charAt(0);if(we<0?--S:(G.c=K,G.e=S,G.s=x,G=F(G,oe,Se,ie,y),K=G.c,L=G.r,S=G.e),w=S+Se+1,we=K[w],I=y/2,L=L||w<0||K[w+1]!=null,L=ie<4?(we!=null||L)&&(ie==0||ie==(G.s<0?3:2)):we>I||we==I&&(ie==4||L||ie==6&&K[w-1]&1||ie==(G.s<0?8:7)),w<1||!K[0])l=L?z(p.charAt(1),-Se,p.charAt(0)):p.charAt(0);else{if(K.length=w,L)for(--y;++K[--w]>y;)K[w]=0,w||(++S,K=[1].concat(K));for(I=K.length;!K[--I];);for(we=0,l="";we<=I;l+=p.charAt(K[we++]));l=z(l,S,p.charAt(0))}return l}}(),F=function(){function c(_,y,x){var T,p,w,S,I=0,L=_.length,G=y%h,K=y/h|0;for(_=_.slice();L--;)w=_[L]%h,S=_[L]/h|0,T=K*w+S*G,p=G*w+T%h*h+I,I=(p/x|0)+(T/h|0)+K*S,_[L]=p%x;return I&&(_=[I].concat(_)),_}function u(_,y,x,T){var p,w;if(x!=T)w=x>T?1:-1;else for(p=w=0;p<x;p++)if(_[p]!=y[p]){w=_[p]>y[p]?1:-1;break}return w}function l(_,y,x,T){for(var p=0;x--;)_[x]-=p,p=_[x]<y[x]?1:0,_[x]=p*T+_[x]-y[x];for(;!_[0]&&_.length>1;_.splice(0,1));}return function(_,y,x,T,p){var w,S,I,L,G,K,oe,we,Se,ie,W,$e,jt,ar,cr,rt,le,Xe=_.s==y.s?1:-1,Ze=_.c,xe=y.c;if(!Ze||!Ze[0]||!xe||!xe[0])return new R(!_.s||!y.s||(Ze?xe&&Ze[0]==xe[0]:!xe)?NaN:Ze&&Ze[0]==0||!xe?Xe*0:Xe/0);for(we=new R(Xe),Se=we.c=[],S=_.e-y.e,Xe=x+S+1,p||(p=f,S=v(_.e/a)-v(y.e/a),Xe=Xe/a|0),I=0;xe[I]==(Ze[I]||0);I++);if(xe[I]>(Ze[I]||0)&&S--,Xe<0)Se.push(1),L=!0;else{for(ar=Ze.length,rt=xe.length,I=0,Xe+=2,G=i(p/(xe[0]+1)),G>1&&(xe=c(xe,G,p),Ze=c(Ze,G,p),rt=xe.length,ar=Ze.length),jt=rt,ie=Ze.slice(0,rt),W=ie.length;W<rt;ie[W++]=0);le=xe.slice(),le=[0].concat(le),cr=xe[0],xe[1]>=p/2&&cr++;do{if(G=0,w=u(xe,ie,rt,W),w<0){if($e=ie[0],rt!=W&&($e=$e*p+(ie[1]||0)),G=i($e/cr),G>1)for(G>=p&&(G=p-1),K=c(xe,G,p),oe=K.length,W=ie.length;u(K,ie,oe,W)==1;)G--,l(K,rt<oe?le:xe,oe,p),oe=K.length,w=1;else G==0&&(w=G=1),K=xe.slice(),oe=K.length;if(oe<W&&(K=[0].concat(K)),l(ie,K,W,p),W=ie.length,w==-1)for(;u(xe,ie,rt,W)<1;)G++,l(ie,rt<W?le:xe,W,p),W=ie.length}else w===0&&(G++,ie=[0]);Se[I++]=G,ie[0]?ie[W++]=Ze[jt]||0:(ie=[Ze[jt]],W=1)}while((jt++<ar||ie[0]!=null)&&Xe--);L=ie[0]!=null,Se[0]||Se.splice(0,1)}if(p==f){for(I=1,Xe=Se[0];Xe>=10;Xe/=10,I++);ye(we,x+(we.e=I+S*a-1)+1,T,L)}else we.e=S,we.r=+L;return we}}();function g(c,u,l,_){var y,x,T,p,w;if(l==null?l=te:N(l,0,8),!c.c)return c.toString();if(y=c.c[0],T=c.e,u==null)w=A(c.c),w=_==1||_==2&&(T<=ce||T>=me)?H(w,T):z(w,T,"0");else if(c=ye(new R(c),u,l),x=c.e,w=A(c.c),p=w.length,_==1||_==2&&(u<=x||x<=ce)){for(;p<u;w+="0",p++);w=H(w,x)}else if(u-=T,w=z(w,x,"0"),x+1>p){if(--u>0)for(w+=".";u--;w+="0");}else if(u+=x-p,u>0)for(x+1==p&&(w+=".");u--;w+="0");return c.s<0&&y?"-"+w:w}function Ue(c,u){for(var l,_,y=1,x=new R(c[0]);y<c.length;y++)_=new R(c[y]),(!_.s||(l=P(x,_))===u||l===0&&x.s===u)&&(x=_);return x}function Re(c,u,l){for(var _=1,y=u.length;!u[--y];u.pop());for(y=u[0];y>=10;y/=10,_++);return(l=_+l*a-1)>$?c.c=c.e=null:l<ue?c.c=[c.e=0]:(c.e=l,c.c=u),c}Y=function(){var c=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,l=/^\.([^.]+)$/,_=/^-?(Infinity|NaN)$/,y=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(x,T,p,w){var S,I=p?T:T.replace(y,"");if(_.test(I))x.s=isNaN(I)?null:I<0?-1:1;else{if(!p&&(I=I.replace(c,function(L,G,K){return S=(K=K.toLowerCase())=="x"?16:K=="b"?2:8,!w||w==S?G:L}),w&&(S=w,I=I.replace(u,"$1").replace(l,"0.$1")),T!=I))return new R(I,S);if(R.DEBUG)throw Error(s+"Not a"+(w?" base "+w:"")+" number: "+T);x.s=null}x.c=x.e=null}}();function ye(c,u,l,_){var y,x,T,p,w,S,I,L=c.c,G=E;if(L){e:{for(y=1,p=L[0];p>=10;p/=10,y++);if(x=u-y,x<0)x+=a,T=u,w=L[S=0],I=i(w/G[y-T-1]%10);else if(S=n((x+1)/a),S>=L.length)if(_){for(;L.length<=S;L.push(0));w=I=0,y=1,x%=a,T=x-a+1}else break e;else{for(w=p=L[S],y=1;p>=10;p/=10,y++);x%=a,T=x-a+y,I=T<0?0:i(w/G[y-T-1]%10)}if(_=_||u<0||L[S+1]!=null||(T<0?w:w%G[y-T-1]),_=l<4?(I||_)&&(l==0||l==(c.s<0?3:2)):I>5||I==5&&(l==4||_||l==6&&(x>0?T>0?w/G[y-T]:0:L[S-1])%10&1||l==(c.s<0?8:7)),u<1||!L[0])return L.length=0,_?(u-=c.e+1,L[0]=G[(a-u%a)%a],c.e=-u||0):L[0]=c.e=0,c;if(x==0?(L.length=S,p=1,S--):(L.length=S+1,p=G[a-x],L[S]=T>0?i(w/G[y-T]%G[T])*p:0),_)for(;;)if(S==0){for(x=1,T=L[0];T>=10;T/=10,x++);for(T=L[0]+=p,p=1;T>=10;T/=10,p++);x!=p&&(c.e++,L[0]==f&&(L[0]=1));break}else{if(L[S]+=p,L[S]!=f)break;L[S--]=0,p=1}for(x=L.length;L[--x]===0;L.pop());}c.e>$?c.c=c.e=null:c.e<ue&&(c.c=[c.e=0])}return c}function j(c){var u,l=c.e;return l===null?c.toString():(u=A(c.c),u=l<=ce||l>=me?H(u,l):z(u,l,"0"),c.s<0?"-"+u:u)}return q.absoluteValue=q.abs=function(){var c=new R(this);return c.s<0&&(c.s=1),c},q.comparedTo=function(c,u){return P(this,new R(c,u))},q.decimalPlaces=q.dp=function(c,u){var l,_,y,x=this;if(c!=null)return N(c,0,O),u==null?u=te:N(u,0,8),ye(new R(x),c+x.e+1,u);if(!(l=x.c))return null;if(_=((y=l.length-1)-v(this.e/a))*a,y=l[y])for(;y%10==0;y/=10,_--);return _<0&&(_=0),_},q.dividedBy=q.div=function(c,u){return F(this,new R(c,u),Z,te)},q.dividedToIntegerBy=q.idiv=function(c,u){return F(this,new R(c,u),0,1)},q.exponentiatedBy=q.pow=function(c,u){var l,_,y,x,T,p,w,S,I,L=this;if(c=new R(c),c.c&&!c.isInteger())throw Error(s+"Exponent not an integer: "+j(c));if(u!=null&&(u=new R(u)),p=c.e>14,!L.c||!L.c[0]||L.c[0]==1&&!L.e&&L.c.length==1||!c.c||!c.c[0])return I=new R(Math.pow(+j(L),p?c.s*(2-D(c)):+j(c))),u?I.mod(u):I;if(w=c.s<0,u){if(u.c?!u.c[0]:!u.s)return new R(NaN);_=!w&&L.isInteger()&&u.isInteger(),_&&(L=L.mod(u))}else{if(c.e>9&&(L.e>0||L.e<-1||(L.e==0?L.c[0]>1||p&&L.c[1]>=24e7:L.c[0]<8e13||p&&L.c[0]<=9999975e7)))return x=L.s<0&&D(c)?-0:0,L.e>-1&&(x=1/x),new R(w?1/x:x);re&&(x=n(re/a+2))}for(p?(l=new R(.5),w&&(c.s=1),S=D(c)):(y=Math.abs(+j(c)),S=y%2),I=new R(J);;){if(S){if(I=I.times(L),!I.c)break;x?I.c.length>x&&(I.c.length=x):_&&(I=I.mod(u))}if(y){if(y=i(y/2),y===0)break;S=y%2}else if(c=c.times(l),ye(c,c.e+1,1),c.e>14)S=D(c);else{if(y=+j(c),y===0)break;S=y%2}L=L.times(L),x?L.c&&L.c.length>x&&(L.c.length=x):_&&(L=L.mod(u))}return _?I:(w&&(I=J.div(I)),u?I.mod(u):x?ye(I,re,te,T):I)},q.integerValue=function(c){var u=new R(this);return c==null?c=te:N(c,0,8),ye(u,u.e+1,c)},q.isEqualTo=q.eq=function(c,u){return P(this,new R(c,u))===0},q.isFinite=function(){return!!this.c},q.isGreaterThan=q.gt=function(c,u){return P(this,new R(c,u))>0},q.isGreaterThanOrEqualTo=q.gte=function(c,u){return(u=P(this,new R(c,u)))===1||u===0},q.isInteger=function(){return!!this.c&&v(this.e/a)>this.c.length-2},q.isLessThan=q.lt=function(c,u){return P(this,new R(c,u))<0},q.isLessThanOrEqualTo=q.lte=function(c,u){return(u=P(this,new R(c,u)))===-1||u===0},q.isNaN=function(){return!this.s},q.isNegative=function(){return this.s<0},q.isPositive=function(){return this.s>0},q.isZero=function(){return!!this.c&&this.c[0]==0},q.minus=function(c,u){var l,_,y,x,T=this,p=T.s;if(c=new R(c,u),u=c.s,!p||!u)return new R(NaN);if(p!=u)return c.s=-u,T.plus(c);var w=T.e/a,S=c.e/a,I=T.c,L=c.c;if(!w||!S){if(!I||!L)return I?(c.s=-u,c):new R(L?T:NaN);if(!I[0]||!L[0])return L[0]?(c.s=-u,c):new R(I[0]?T:te==3?-0:0)}if(w=v(w),S=v(S),I=I.slice(),p=w-S){for((x=p<0)?(p=-p,y=I):(S=w,y=L),y.reverse(),u=p;u--;y.push(0));y.reverse()}else for(_=(x=(p=I.length)<(u=L.length))?p:u,p=u=0;u<_;u++)if(I[u]!=L[u]){x=I[u]<L[u];break}if(x&&(y=I,I=L,L=y,c.s=-c.s),u=(_=L.length)-(l=I.length),u>0)for(;u--;I[l++]=0);for(u=f-1;_>p;){if(I[--_]<L[_]){for(l=_;l&&!I[--l];I[l]=u);--I[l],I[_]+=f}I[_]-=L[_]}for(;I[0]==0;I.splice(0,1),--S);return I[0]?Re(c,I,S):(c.s=te==3?-1:1,c.c=[c.e=0],c)},q.modulo=q.mod=function(c,u){var l,_,y=this;return c=new R(c,u),!y.c||!c.s||c.c&&!c.c[0]?new R(NaN):!c.c||y.c&&!y.c[0]?new R(y):(Q==9?(_=c.s,c.s=1,l=F(y,c,0,3),c.s=_,l.s*=_):l=F(y,c,0,Q),c=y.minus(l.times(c)),!c.c[0]&&Q==1&&(c.s=y.s),c)},q.multipliedBy=q.times=function(c,u){var l,_,y,x,T,p,w,S,I,L,G,K,oe,we,Se,ie=this,W=ie.c,$e=(c=new R(c,u)).c;if(!W||!$e||!W[0]||!$e[0])return!ie.s||!c.s||W&&!W[0]&&!$e||$e&&!$e[0]&&!W?c.c=c.e=c.s=null:(c.s*=ie.s,!W||!$e?c.c=c.e=null:(c.c=[0],c.e=0)),c;for(_=v(ie.e/a)+v(c.e/a),c.s*=ie.s,w=W.length,L=$e.length,w<L&&(oe=W,W=$e,$e=oe,y=w,w=L,L=y),y=w+L,oe=[];y--;oe.push(0));for(we=f,Se=h,y=L;--y>=0;){for(l=0,G=$e[y]%Se,K=$e[y]/Se|0,T=w,x=y+T;x>y;)S=W[--T]%Se,I=W[T]/Se|0,p=K*S+I*G,S=G*S+p%Se*Se+oe[x]+l,l=(S/we|0)+(p/Se|0)+K*I,oe[x--]=S%we;oe[x]=l}return l?++_:oe.splice(0,1),Re(c,oe,_)},q.negated=function(){var c=new R(this);return c.s=-c.s||null,c},q.plus=function(c,u){var l,_=this,y=_.s;if(c=new R(c,u),u=c.s,!y||!u)return new R(NaN);if(y!=u)return c.s=-u,_.minus(c);var x=_.e/a,T=c.e/a,p=_.c,w=c.c;if(!x||!T){if(!p||!w)return new R(y/0);if(!p[0]||!w[0])return w[0]?c:new R(p[0]?_:y*0)}if(x=v(x),T=v(T),p=p.slice(),y=x-T){for(y>0?(T=x,l=w):(y=-y,l=p),l.reverse();y--;l.push(0));l.reverse()}for(y=p.length,u=w.length,y-u<0&&(l=w,w=p,p=l,u=y),y=0;u;)y=(p[--u]=p[u]+w[u]+y)/f|0,p[u]=f===p[u]?0:p[u]%f;return y&&(p=[y].concat(p),++T),Re(c,p,T)},q.precision=q.sd=function(c,u){var l,_,y,x=this;if(c!=null&&c!==!!c)return N(c,1,O),u==null?u=te:N(u,0,8),ye(new R(x),c,u);if(!(l=x.c))return null;if(y=l.length-1,_=y*a+1,y=l[y]){for(;y%10==0;y/=10,_--);for(y=l[0];y>=10;y/=10,_++);}return c&&x.e+1>_&&(_=x.e+1),_},q.shiftedBy=function(c){return N(c,-m,m),this.times("1e"+c)},q.squareRoot=q.sqrt=function(){var c,u,l,_,y,x=this,T=x.c,p=x.s,w=x.e,S=Z+4,I=new R("0.5");if(p!==1||!T||!T[0])return new R(!p||p<0&&(!T||T[0])?NaN:T?x:1/0);if(p=Math.sqrt(+j(x)),p==0||p==1/0?(u=A(T),(u.length+w)%2==0&&(u+="0"),p=Math.sqrt(+u),w=v((w+1)/2)-(w<0||w%2),p==1/0?u="5e"+w:(u=p.toExponential(),u=u.slice(0,u.indexOf("e")+1)+w),l=new R(u)):l=new R(p+""),l.c[0]){for(w=l.e,p=w+S,p<3&&(p=0);;)if(y=l,l=I.times(y.plus(F(x,y,S,1))),A(y.c).slice(0,p)===(u=A(l.c)).slice(0,p))if(l.e<w&&--p,u=u.slice(p-3,p+1),u=="9999"||!_&&u=="4999"){if(!_&&(ye(y,y.e+Z+2,0),y.times(y).eq(x))){l=y;break}S+=4,p+=4,_=1}else{(!+u||!+u.slice(1)&&u.charAt(0)=="5")&&(ye(l,l.e+Z+2,1),c=!l.times(l).eq(x));break}}return ye(l,l.e+Z+1,te,c)},q.toExponential=function(c,u){return c!=null&&(N(c,0,O),c++),g(this,c,u,1)},q.toFixed=function(c,u){return c!=null&&(N(c,0,O),c=c+this.e+1),g(this,c,u)},q.toFormat=function(c,u,l){var _,y=this;if(l==null)c!=null&&u&&typeof u=="object"?(l=u,u=null):c&&typeof c=="object"?(l=c,c=u=null):l=fe;else if(typeof l!="object")throw Error(s+"Argument not an object: "+l);if(_=y.toFixed(c,u),y.c){var x,T=_.split("."),p=+l.groupSize,w=+l.secondaryGroupSize,S=l.groupSeparator||"",I=T[0],L=T[1],G=y.s<0,K=G?I.slice(1):I,oe=K.length;if(w&&(x=p,p=w,w=x,oe-=x),p>0&&oe>0){for(x=oe%p||p,I=K.substr(0,x);x<oe;x+=p)I+=S+K.substr(x,p);w>0&&(I+=S+K.slice(x)),G&&(I="-"+I)}_=L?I+(l.decimalSeparator||"")+((w=+l.fractionGroupSize)?L.replace(new RegExp("\\d{"+w+"}\\B","g"),"$&"+(l.fractionGroupSeparator||"")):L):I}return(l.prefix||"")+_+(l.suffix||"")},q.toFraction=function(c){var u,l,_,y,x,T,p,w,S,I,L,G,K=this,oe=K.c;if(c!=null&&(p=new R(c),!p.isInteger()&&(p.c||p.s!==1)||p.lt(J)))throw Error(s+"Argument "+(p.isInteger()?"out of range: ":"not an integer: ")+j(p));if(!oe)return new R(K);for(u=new R(J),S=l=new R(J),_=w=new R(J),G=A(oe),x=u.e=G.length-K.e-1,u.c[0]=E[(T=x%a)<0?a+T:T],c=!c||p.comparedTo(u)>0?x>0?u:S:p,T=$,$=1/0,p=new R(G),w.c[0]=0;I=F(p,u,0,1),y=l.plus(I.times(_)),y.comparedTo(c)!=1;)l=_,_=y,S=w.plus(I.times(y=S)),w=y,u=p.minus(I.times(y=u)),p=y;return y=F(c.minus(l),_,0,1),w=w.plus(y.times(S)),l=l.plus(y.times(_)),w.s=S.s=K.s,x=x*2,L=F(S,_,x,te).minus(K).abs().comparedTo(F(w,l,x,te).minus(K).abs())<1?[S,_]:[w,l],$=T,L},q.toNumber=function(){return+j(this)},q.toPrecision=function(c,u){return c!=null&&N(c,1,O),g(this,c,u,2)},q.toString=function(c){var u,l=this,_=l.s,y=l.e;return y===null?_?(u="Infinity",_<0&&(u="-"+u)):u="NaN":(c==null?u=y<=ce||y>=me?H(A(l.c),y):z(A(l.c),y,"0"):c===10&&Ie?(l=ye(new R(l),Z+y+1,te),u=z(A(l.c),l.e,"0")):(N(c,2,ge.length,"Base"),u=C(z(A(l.c),y,"0"),10,c,_,!0)),_<0&&l.c[0]&&(u="-"+u)),u},q.valueOf=q.toJSON=function(){return j(this)},q._isBigNumber=!0,k!=null&&R.set(k),R}function v(k){var F=k|0;return k>0||k===F?F:F-1}function A(k){for(var F,C,Y=1,q=k.length,J=k[0]+"";Y<q;){for(F=k[Y++]+"",C=a-F.length;C--;F="0"+F);J+=F}for(q=J.length;J.charCodeAt(--q)===48;);return J.slice(0,q+1||1)}function P(k,F){var C,Y,q=k.c,J=F.c,Z=k.s,te=F.s,ce=k.e,me=F.e;if(!Z||!te)return null;if(C=q&&!q[0],Y=J&&!J[0],C||Y)return C?Y?0:-te:Z;if(Z!=te)return Z;if(C=Z<0,Y=ce==me,!q||!J)return Y?0:!q^C?1:-1;if(!Y)return ce>me^C?1:-1;for(te=(ce=q.length)<(me=J.length)?ce:me,Z=0;Z<te;Z++)if(q[Z]!=J[Z])return q[Z]>J[Z]^C?1:-1;return ce==me?0:ce>me^C?1:-1}function N(k,F,C,Y){if(k<F||k>C||k!==i(k))throw Error(s+(Y||"Argument")+(typeof k=="number"?k<F||k>C?" out of range: ":" not an integer: ":" not a primitive number: ")+String(k))}function D(k){var F=k.c.length-1;return v(k.e/a)==F&&k.c[F]%2!=0}function H(k,F){return(k.length>1?k.charAt(0)+"."+k.slice(1):k)+(F<0?"e":"e+")+F}function z(k,F,C){var Y,q;if(F<0){for(q=C+".";++F;q+=C);k=q+k}else if(Y=k.length,++F>Y){for(q=C,F-=Y;--F;q+=C);k+=q}else F<Y&&(k=k.slice(0,F)+"."+k.slice(F));return k}e=B(),e.default=e.BigNumber=e,typeof define=="function"&&define.amd?define(function(){return e}):typeof Zr<"u"&&Zr.exports?Zr.exports=e:(r||(r=typeof self<"u"&&self?self:window),r.BigNumber=e)})(Us)});var Os=Ge((x0,Rs)=>{Rs.exports=function(e,t,n){var i=new e.Uint8Array(n),s=t.pushInt,o=t.pushInt32,f=t.pushInt32Neg,a=t.pushInt64,m=t.pushInt64Neg,E=t.pushFloat,h=t.pushFloatSingle,O=t.pushFloatDouble,B=t.pushTrue,v=t.pushFalse,A=t.pushUndefined,P=t.pushNull,N=t.pushInfinity,D=t.pushInfinityNeg,H=t.pushNaN,z=t.pushNaNNeg,k=t.pushArrayStart,F=t.pushArrayStartFixed,C=t.pushArrayStartFixed32,Y=t.pushArrayStartFixed64,q=t.pushObjectStart,J=t.pushObjectStartFixed,Z=t.pushObjectStartFixed32,te=t.pushObjectStartFixed64,ce=t.pushByteString,me=t.pushByteStringStart,ue=t.pushUtf8String,$=t.pushUtf8StringStart,ee=t.pushSimpleUnassigned,Q=t.pushTagStart,re=t.pushTagStart4,fe=t.pushTagStart8,ge=t.pushTagUnassigned,Ie=t.pushBreak,R=e.Math.pow,g=0,Ue=0,Re=0;function ye(b){for(b=b|0,g=0,Ue=b;(g|0)<(Ue|0)&&(Re=ec[i[g]&255](i[g]|0)|0,!((Re|0)>0)););return Re|0}function j(b){return b=b|0,((g|0)+(b|0)|0)<(Ue|0)?0:1}function c(b){return b=b|0,i[b|0]<<8|i[b+1|0]|0}function u(b){return b=b|0,i[b|0]<<24|i[b+1|0]<<16|i[b+2|0]<<8|i[b+3|0]|0}function l(b){return b=b|0,s(b|0),g=g+1|0,0}function _(b){return b=b|0,j(1)|0?1:(s(i[g+1|0]|0),g=g+2|0,0)}function y(b){return b=b|0,j(2)|0?1:(s(c(g+1|0)|0),g=g+3|0,0)}function x(b){return b=b|0,j(4)|0?1:(o(c(g+1|0)|0,c(g+3|0)|0),g=g+5|0,0)}function T(b){return b=b|0,j(8)|0?1:(a(c(g+1|0)|0,c(g+3|0)|0,c(g+5|0)|0,c(g+7|0)|0),g=g+9|0,0)}function p(b){return b=b|0,s(-1-(b-32|0)|0),g=g+1|0,0}function w(b){return b=b|0,j(1)|0?1:(s(-1-(i[g+1|0]|0)|0),g=g+2|0,0)}function S(b){b=b|0;var se=0;return j(2)|0?1:(se=c(g+1|0)|0,s(-1-(se|0)|0),g=g+3|0,0)}function I(b){return b=b|0,j(4)|0?1:(f(c(g+1|0)|0,c(g+3|0)|0),g=g+5|0,0)}function L(b){return b=b|0,j(8)|0?1:(m(c(g+1|0)|0,c(g+3|0)|0,c(g+5|0)|0,c(g+7|0)|0),g=g+9|0,0)}function G(b){b=b|0;var se=0,ae=0,ne=0;return ne=b-64|0,j(ne|0)|0?1:(se=g+1|0,ae=(g+1|0)+(ne|0)|0,ce(se|0,ae|0),g=ae|0,0)}function K(b){b=b|0;var se=0,ae=0,ne=0;return j(1)|0||(ne=i[g+1|0]|0,se=g+2|0,ae=(g+2|0)+(ne|0)|0,j(ne+1|0)|0)?1:(ce(se|0,ae|0),g=ae|0,0)}function oe(b){b=b|0;var se=0,ae=0,ne=0;return j(2)|0||(ne=c(g+1|0)|0,se=g+3|0,ae=(g+3|0)+(ne|0)|0,j(ne+2|0)|0)?1:(ce(se|0,ae|0),g=ae|0,0)}function we(b){b=b|0;var se=0,ae=0,ne=0;return j(4)|0||(ne=u(g+1|0)|0,se=g+5|0,ae=(g+5|0)+(ne|0)|0,j(ne+4|0)|0)?1:(ce(se|0,ae|0),g=ae|0,0)}function Se(b){return b=b|0,1}function ie(b){return b=b|0,me(),g=g+1|0,0}function W(b){b=b|0;var se=0,ae=0,ne=0;return ne=b-96|0,j(ne|0)|0?1:(se=g+1|0,ae=(g+1|0)+(ne|0)|0,ue(se|0,ae|0),g=ae|0,0)}function $e(b){b=b|0;var se=0,ae=0,ne=0;return j(1)|0||(ne=i[g+1|0]|0,se=g+2|0,ae=(g+2|0)+(ne|0)|0,j(ne+1|0)|0)?1:(ue(se|0,ae|0),g=ae|0,0)}function jt(b){b=b|0;var se=0,ae=0,ne=0;return j(2)|0||(ne=c(g+1|0)|0,se=g+3|0,ae=(g+3|0)+(ne|0)|0,j(ne+2|0)|0)?1:(ue(se|0,ae|0),g=ae|0,0)}function ar(b){b=b|0;var se=0,ae=0,ne=0;return j(4)|0||(ne=u(g+1|0)|0,se=g+5|0,ae=(g+5|0)+(ne|0)|0,j(ne+4|0)|0)?1:(ue(se|0,ae|0),g=ae|0,0)}function cr(b){return b=b|0,1}function rt(b){return b=b|0,$(),g=g+1|0,0}function le(b){return b=b|0,F(b-128|0),g=g+1|0,0}function Xe(b){return b=b|0,j(1)|0?1:(F(i[g+1|0]|0),g=g+2|0,0)}function Ze(b){return b=b|0,j(2)|0?1:(F(c(g+1|0)|0),g=g+3|0,0)}function xe(b){return b=b|0,j(4)|0?1:(C(c(g+1|0)|0,c(g+3|0)|0),g=g+5|0,0)}function Pa(b){return b=b|0,j(8)|0?1:(Y(c(g+1|0)|0,c(g+3|0)|0,c(g+5|0)|0,c(g+7|0)|0),g=g+9|0,0)}function La(b){return b=b|0,k(),g=g+1|0,0}function Ee(b){b=b|0;var se=0;return se=b-160|0,j(se|0)|0?1:(J(se|0),g=g+1|0,0)}function Ma(b){return b=b|0,j(1)|0?1:(J(i[g+1|0]|0),g=g+2|0,0)}function Da(b){return b=b|0,j(2)|0?1:(J(c(g+1|0)|0),g=g+3|0,0)}function ka(b){return b=b|0,j(4)|0?1:(Z(c(g+1|0)|0,c(g+3|0)|0),g=g+5|0,0)}function qa(b){return b=b|0,j(8)|0?1:(te(c(g+1|0)|0,c(g+3|0)|0,c(g+5|0)|0,c(g+7|0)|0),g=g+9|0,0)}function $a(b){return b=b|0,q(),g=g+1|0,0}function Kt(b){return b=b|0,Q(b-192|0|0),g=g+1|0,0}function Cu(b){return b=b|0,Q(b|0),g=g+1|0,0}function Gu(b){return b=b|0,Q(b|0),g=g+1|0,0}function Vu(b){return b=b|0,Q(b|0),g=g+1|0,0}function Yu(b){return b=b|0,Q(b|0),g=g+1|0,0}function Ce(b){return b=b|0,Q(b-192|0|0),g=g+1|0,0}function Hu(b){return b=b|0,Q(b|0),g=g+1|0,0}function zu(b){return b=b|0,Q(b|0),g=g+1|0,0}function Zu(b){return b=b|0,Q(b|0),g=g+1|0,0}function Ca(b){return b=b|0,j(1)|0?1:(Q(i[g+1|0]|0),g=g+2|0,0)}function Ga(b){return b=b|0,j(2)|0?1:(Q(c(g+1|0)|0),g=g+3|0,0)}function Va(b){return b=b|0,j(4)|0?1:(re(c(g+1|0)|0,c(g+3|0)|0),g=g+5|0,0)}function Ya(b){return b=b|0,j(8)|0?1:(fe(c(g+1|0)|0,c(g+3|0)|0,c(g+5|0)|0,c(g+7|0)|0),g=g+9|0,0)}function Oe(b){return b=b|0,ee((b|0)-224|0),g=g+1|0,0}function Ha(b){return b=b|0,v(),g=g+1|0,0}function za(b){return b=b|0,B(),g=g+1|0,0}function Za(b){return b=b|0,P(),g=g+1|0,0}function ja(b){return b=b|0,A(),g=g+1|0,0}function Ka(b){return b=b|0,j(1)|0?1:(ee(i[g+1|0]|0),g=g+2|0,0)}function Wa(b){b=b|0;var se=0,ae=0,ne=1,Ur=0,fr=0,ju=0;return j(2)|0?1:(se=i[g+1|0]|0,ae=i[g+2|0]|0,(se|0)&128&&(ne=-1),Ur=+(((se|0)&124)>>2),fr=+(((se|0)&3)<<8|ae),+Ur==0?E(+(+ne*5960464477539063e-23*+fr)):+Ur==31?+ne==1?+fr>0?H():N():+fr>0?z():D():E(+(+ne*R(2,+(+Ur-25))*+(1024+fr))),g=g+3|0,0)}function Xa(b){return b=b|0,j(4)|0?1:(h(i[g+1|0]|0,i[g+2|0]|0,i[g+3|0]|0,i[g+4|0]|0),g=g+5|0,0)}function Ja(b){return b=b|0,j(8)|0?1:(O(i[g+1|0]|0,i[g+2|0]|0,i[g+3|0]|0,i[g+4|0]|0,i[g+5|0]|0,i[g+6|0]|0,i[g+7|0]|0,i[g+8|0]|0),g=g+9|0,0)}function pe(b){return b=b|0,1}function Qa(b){return b=b|0,Ie(),g=g+1|0,0}var ec=[l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,_,y,x,T,pe,pe,pe,pe,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,w,S,I,L,pe,pe,pe,pe,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,K,oe,we,Se,pe,pe,pe,ie,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,$e,jt,ar,cr,pe,pe,pe,rt,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,le,Xe,Ze,xe,Pa,pe,pe,pe,La,Ee,Ee,Ee,Ee,Ee,Ee,Ee,Ee,Ee,Ee,Ee,Ee,Ee,Ee,Ee,Ee,Ee,Ee,Ee,Ee,Ee,Ee,Ee,Ee,Ma,Da,ka,qa,pe,pe,pe,$a,Kt,Kt,Kt,Kt,Kt,Kt,Ce,Ce,Ce,Ce,Ce,Ce,Ce,Ce,Ce,Ce,Ce,Ce,Ce,Ce,Ce,Ce,Ce,Ce,Ca,Ga,Va,Ya,pe,pe,pe,pe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Ha,za,Za,ja,Ka,Wa,Xa,Ja,pe,pe,pe,Qa];return{parse:ye}}});var hr=Ge(et=>{"use strict";var Zn=dr().BigNumber;et.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7};et.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};et.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31};et.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23};et.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")};et.SHIFT32=Math.pow(2,32);et.SHIFT16=Math.pow(2,16);et.MAX_SAFE_HIGH=2097151;et.NEG_ONE=new Zn(-1);et.TEN=new Zn(10);et.TWO=new Zn(2);et.PARENT={ARRAY:0,OBJECT:1,MAP:2,TAG:3,BYTE_STRING:4,UTF8_STRING:5}});var jr=Ge(it=>{"use strict";var{Buffer:jc}=lr(),Ps=dr().BigNumber,Ls=hr(),Fs=Ls.SHIFT32,Kc=Ls.SHIFT16,Wc=2097151;it.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 Xc(r){return r<16?"0"+r.toString(16):r.toString(16)}it.arrayBufferToBignumber=function(r){let e=r.byteLength,t="";for(let n=0;n<e;n++)t+=Xc(r[n]);return new Ps(t,16)};it.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};it.buildInt32=(r,e)=>r*Kc+e;it.buildInt64=(r,e,t,n)=>{let i=it.buildInt32(r,e),s=it.buildInt32(t,n);return i>Wc?new Ps(i).times(Fs).plus(s):i*Fs+s};it.writeHalf=function(e,t){let n=jc.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,f=i&8388607;if(o>=113&&o<=142)s+=(o-112<<10)+(f>>13);else if(o>=103&&o<113){if(f&(1<<126-o)-1)return!1;s+=f+8388608>>126-o}else return!1;return e.writeUInt16BE(s,0),!0};it.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])};it.isNegativeZero=r=>r===0&&1/r<0;it.nextPowerOf2=r=>{let e=0;if(r&&!(r&r-1))return r;for(;r!==0;)r>>=1,e+=1;return 1<<e}});var Xn=Ge((I0,Ms)=>{"use strict";var Wn=hr(),Jc=Wn.MT,Kr=Wn.SIMPLE,jn=Wn.SYMS,Kn=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,Jc.SIMPLE_FLOAT)}static isSimple(e){return e instanceof r}static decode(e,t){switch(t==null&&(t=!0),e){case Kr.FALSE:return!1;case Kr.TRUE:return!0;case Kr.NULL:return t?null:jn.NULL;case Kr.UNDEFINED:return t?void 0:jn.UNDEFINED;case-1:if(!t)throw new Error("Invalid BREAK");return jn.BREAK;default:return new r(e)}}};Ms.exports=Kn});var Qn=Ge((B0,Ds)=>{"use strict";var Jn=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}}};Ds.exports=Jn});var ri=Ge((v0,qs)=>{"use strict";var ks=self.location?self.location.protocol+"//"+self.location.host:"",ei=self.URL,ti=class{constructor(e="",t=ks){this.super=new ei(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 Qc(r){if(typeof r=="string")return new ei(r).toString();if(!(r instanceof ei)){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||"",f=r.search||(r.query?"?"+r.query:""),a=r.hash||"",m=r.pathname||"",E=r.path||m+f;return`${i}${e||t}${s||o+n}${E}${a}`}}qs.exports={URLWithLegacySupport:ti,URLSearchParams:self.URLSearchParams,defaultBase:ks,format:Qc}});var Gs=Ge((A0,Cs)=>{"use strict";var{URLWithLegacySupport:$s,format:ef}=ri();Cs.exports=(r,e={},t={},n)=>{let i=e.protocol?e.protocol.replace(":",""):"http";i=(t[i]||n||i)+":";let s;try{s=new $s(r)}catch{s={}}let o=Object.assign({},e,{protocol:i||s.protocol,host:e.host||s.host});return new $s(r,ef(o)).toString()}});var ni=Ge((S0,Vs)=>{"use strict";var{URLWithLegacySupport:tf,format:rf,URLSearchParams:nf,defaultBase:sf}=ri(),of=Gs();Vs.exports={URL:tf,URLSearchParams:nf,format:rf,relative:of,defaultBase:sf}});var ii=Ge((T0,Hs)=>{"use strict";var{Buffer:Jt}=lr(),Ys=Ns(),af=dr().BigNumber,cf=Os(),Ke=jr(),he=hr(),ff=Xn(),uf=Qn(),{URL:lf}=ni(),pr=class r{constructor(e){e=e||{},!e.size||e.size<65536?e.size=65536:e.size=Ke.nextPowerOf2(e.size),this._heap=new ArrayBuffer(e.size),this._heap8=new Uint8Array(this._heap),this._buffer=Jt.from(this._heap),this._reset(),this._knownTags=Object.assign({0:t=>new Date(t),1:t=>new Date(t*1e3),2:t=>Ke.arrayBufferToBignumber(t),3:t=>he.NEG_ONE.minus(Ke.arrayBufferToBignumber(t)),4:t=>he.TEN.pow(t[0]).times(t[1]),5:t=>he.TWO.pow(t[0]).times(t[1]),32:t=>new lf(t),35:t=>new RegExp(t)},e.tags),this.parser=cf(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 he.PARENT.TAG:this._push(this.createTag(e.ref[0],e.ref[1]));break;case he.PARENT.BYTE_STRING:this._push(this.createByteString(e.ref,e.length));break;case he.PARENT.UTF8_STRING:this._push(this.createUtf8String(e.ref,e.length));break;case he.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 he.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 he.PARENT.ARRAY:this._push(this.createArray(e.ref,e.length));break;default:break}this._currentParent&&this._currentParent.type===he.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 he.PARENT.ARRAY:case he.PARENT.BYTE_STRING:case he.PARENT.UTF8_STRING:n.length>-1?this._ref[this._ref.length-n.length]=e:this._ref.push(e),this._dec();break;case he.PARENT.OBJECT:n.tmpKey!=null?(this._ref[n.tmpKey]=e,n.tmpKey=null,this._dec()):(n.tmpKey=e,typeof n.tmpKey!="string"&&(n.type=he.PARENT.MAP,n.ref=Ke.buildMap(n.ref)));break;case he.PARENT.MAP:n.tmpKey!=null?(this._ref.set(n.tmpKey,e),n.tmpKey=null,this._dec()):n.tmpKey=e;break;case he.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:he.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}createTag(e,t){let n=this._knownTags[e];return n?n(t):new uf(e,t)}createMap(e,t){return e}createObject(e,t){return e}createArray(e,t){return e}createByteString(e,t){return Jt.concat(e)}createByteStringFromHeap(e,t){return e===t?Jt.alloc(0):Jt.from(this._heap.slice(e,t))}createInt(e){return e}createInt32(e,t){return Ke.buildInt32(e,t)}createInt64(e,t,n,i){return Ke.buildInt64(e,t,n,i)}createFloat(e){return e}createFloatSingle(e,t,n,i){return Ys.read([e,t,n,i],0,!1,23,4)}createFloatDouble(e,t,n,i,s,o,f,a){return Ys.read([e,t,n,i,s,o,f,a],0,!1,52,8)}createInt32Neg(e,t){return-1-Ke.buildInt32(e,t)}createInt64Neg(e,t,n,i){let s=Ke.buildInt32(e,t),o=Ke.buildInt32(n,i);return s>he.MAX_SAFE_HIGH?he.NEG_ONE.minus(new af(s).times(he.SHIFT32).plus(o)):-1-(s*he.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 ff(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,f,a){this._push(this.createFloatDouble(e,t,n,i,s,o,f,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([],he.PARENT.ARRAY,-1)}pushArrayStartFixed(e){this._createArrayStartFixed(e)}pushArrayStartFixed32(e,t){let n=Ke.buildInt32(e,t);this._createArrayStartFixed(n)}pushArrayStartFixed64(e,t,n,i){let s=Ke.buildInt64(e,t,n,i);this._createArrayStartFixed(s)}pushObjectStart(){this._createObjectStartFixed(-1)}pushObjectStartFixed(e){this._createObjectStartFixed(e)}pushObjectStartFixed32(e,t){let n=Ke.buildInt32(e,t);this._createObjectStartFixed(n)}pushObjectStartFixed64(e,t,n,i){let s=Ke.buildInt64(e,t,n,i);this._createObjectStartFixed(s)}pushByteStringStart(){this._parents[this._depth]={type:he.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:he.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:he.PARENT.TAG,length:1,ref:[e]}}pushTagStart4(e,t){this.pushTagStart(Ke.buildInt32(e,t))}pushTagStart8(e,t,n,i){this.pushTagStart(Ke.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({},he.PARENT.OBJECT,e)}_createArrayStartFixed(e){if(e===0){this._push(this.createArray([]));return}this._createParent(new Array(e),he.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=Jt.from(e,t||"hex")),new r({size:e.length}).decodeFirst(e)}static decodeAll(e,t){return typeof e=="string"&&(e=Jt.from(e,t||"hex")),new r({size:e.length}).decodeAll(e)}};pr.decodeFirst=pr.decode;Hs.exports=pr});var js=Ge((N0,Zs)=>{"use strict";var{Buffer:si}=lr(),df=ii(),hf=jr(),oi=class r extends df{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 hf.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,f,a){return`${super.createFloatDouble(e,t,n,i,s,o,f,a)}_3`}createByteString(e,t){let n=e.join(", ");return t===-1?`(_ ${n})`:`h'${n}`}createByteStringFromHeap(e,t){return`h'${si.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(zs(n),"");return t===-1?`{_ ${i}}`:`{${i}}`}createObject(e,t){let n=super.createObject(e),i=Object.keys(n).reduce(zs(n),"");return t===-1?`{_ ${i}}`:`{${i}}`}createUtf8String(e,t){let n=e.join(", ");return t===-1?`(_ ${n})`:`"${n}"`}createUtf8StringFromHeap(e,t){return`"${si.from(super.createUtf8StringFromHeap(e,t)).toString("utf8")}"`}static diagnose(e,t){return typeof e=="string"&&(e=si.from(e,t||"hex")),new r().decodeFirst(e)}};Zs.exports=oi;function zs(r){return(e,t)=>e?`${e}, ${t}: ${r[t]}`:`${t}: ${r[t]}`}});var Qs=Ge((U0,Js)=>{"use strict";var{Buffer:yt}=lr(),{URL:pf}=ni(),ci=dr().BigNumber,ai=jr(),Me=hr(),ct=Me.MT,Wr=Me.NUMBYTES,Ks=Me.SHIFT32,Ws=Me.SYMS,Qt=Me.TAG,bf=Me.MT.SIMPLE_FLOAT<<5|Me.NUMBYTES.TWO,gf=Me.MT.SIMPLE_FLOAT<<5|Me.NUMBYTES.FOUR,mf=Me.MT.SIMPLE_FLOAT<<5|Me.NUMBYTES.EIGHT,yf=Me.MT.SIMPLE_FLOAT<<5|Me.SIMPLE.TRUE,wf=Me.MT.SIMPLE_FLOAT<<5|Me.SIMPLE.FALSE,xf=Me.MT.SIMPLE_FLOAT<<5|Me.SIMPLE.UNDEFINED,Xs=Me.MT.SIMPLE_FLOAT<<5|Me.SIMPLE.NULL,Ef=new ci("0x20000000000000"),_f=yt.from("f97e00","hex"),If=yt.from("f9fc00","hex"),Bf=yt.from("f97c00","hex");function vf(r){return{}.toString.call(r).slice(8,-1)}var fi=class r{constructor(e){e=e||{},this.streaming=typeof e.stream=="function",this.onData=e.stream,this.semanticTypes=[[pf,this._pushUrl],[ci,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(_f)}_pushInfinity(e){let t=e<0?If:Bf;return this.push(t)}_pushFloat(e){let t=yt.allocUnsafe(2);if(ai.writeHalf(t,e)&&ai.parseHalf(t)===e)return this._pushUInt8(bf)&&this.push(t);let n=yt.allocUnsafe(4);return n.writeFloatBE(e,0),n.readFloatBE(0)===e?this._pushUInt8(gf)&&this.push(n):this._pushUInt8(mf)&&this._pushDoubleBE(e)}_pushInt(e,t,n){let i=t<<5;return e<24?this._pushUInt8(i|e):e<=255?this._pushUInt8(i|Wr.ONE)&&this._pushUInt8(e):e<=65535?this._pushUInt8(i|Wr.TWO)&&this._pushUInt16BE(e):e<=4294967295?this._pushUInt8(i|Wr.FOUR)&&this._pushUInt32BE(e):e<=Number.MAX_SAFE_INTEGER?this._pushUInt8(i|Wr.EIGHT)&&this._pushUInt32BE(Math.floor(e/Ks))&&this._pushUInt32BE(e%Ks):t===ct.NEG_INT?this._pushFloat(n):this._pushFloat(e)}_pushIntNum(e){return e<0?this._pushInt(-e-1,ct.NEG_INT,e):this._pushInt(e,ct.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=yt.byteLength(e,"utf8");return this._pushInt(t,ct.UTF8_STRING)&&this.pushWrite(e,5,t)}_pushBoolean(e){return this._pushUInt8(e?yf:wf)}_pushUndefined(e){return this._pushUInt8(xf)}_pushArray(e,t){let n=t.length;if(!e._pushInt(n,ct.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,ct.TAG)}_pushDate(e,t){return e._pushTag(Qt.DATE_EPOCH)&&e.pushAny(Math.round(t/1e3))}_pushBuffer(e,t){return e._pushInt(t.length,ct.BYTE_STRING)&&e.push(t)}_pushNoFilter(e,t){return e._pushBuffer(e,t.slice())}_pushRegexp(e,t){return e._pushTag(Qt.REGEXP)&&e.pushAny(t.source)}_pushSet(e,t){if(!e._pushInt(t.size,ct.ARRAY))return!1;for(let n of t)if(!e.pushAny(n))return!1;return!0}_pushUrl(e,t){return e._pushTag(Qt.URI)&&e.pushAny(t.format())}_pushBigint(e){let t=Qt.POS_BIGINT;e.isNegative()&&(e=e.negated().minus(1),t=Qt.NEG_BIGINT);let n=e.toString(16);n.length%2&&(n="0"+n);let i=yt.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(Qt.DECIMAL_FRAC)&&e._pushInt(2,ct.ARRAY)))return!1;let n=t.decimalPlaces(),i=t.multipliedBy(new ci(10).pow(n));return e._pushIntNum(-n)?i.abs().isLessThan(Ef)?e._pushIntNum(i.toNumber()):e._pushBigint(i):!1}_pushMap(e,t){return e._pushInt(t.size,ct.MAP)?this._pushRawMap(t.size,Array.from(t)):!1}_pushObject(e){if(!e)return this._pushUInt8(Xs);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,ct.MAP)?this._pushRawMap(o,s.map(f=>[f,e[f]])):!1}_pushRawMap(e,t){t=t.map(function(i){return i[0]=r.encode(i[0]),i}).sort(ai.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=vf(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,yt.isBuffer(e)?e:yt.from(e));case"Null":return this._pushUInt8(Xs);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 Ws.NULL:return this._pushObject(null);case Ws.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 f=yt.allocUnsafe(s),a=0,m=0;for(o=0;o<i;o++){switch(m=t[o],n[o]){case 0:e[o].copy(f,a);break;case 1:f.writeUInt8(e[o],a,!0);break;case 2:f.writeUInt16BE(e[o],a,!0);break;case 3:f.writeUInt32BE(e[o],a,!0);break;case 4:f.writeDoubleBE(e[o],a,!0);break;case 5:f.write(e[o],a,m,"utf8");break;default:throw new Error("unkown method")}a+=m}var E=f;return this._reset(),E}_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()}};Js.exports=fi});var ui=Ge(De=>{"use strict";De.Diagnose=js();De.Decoder=ii();De.Encoder=Qs();De.Simple=Xn();De.Tagged=Qn();De.decodeAll=De.Decoder.decodeAll;De.decodeFirst=De.Decoder.decodeFirst;De.diagnose=De.Diagnose.diagnose;De.encode=De.Encoder.encode;De.decode=De.Decoder.decode;De.leveldb={decode:De.Decoder.decodeAll,encode:De.Encoder.encode,buffer:!0,name:"cbor"}});var hi=Ge(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});var Af=9007199254740992;function _t(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 ft(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 Xr(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 ft(r,t,e.toString(16))}}function eo(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 _t(new Uint8Array(Xr(3,r.length)),new Uint8Array(e))}function Sf(r,e){if(r==14277111)return _t(new Uint8Array([217,217,247]),e);if(r<24)return _t(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}}be.tagged=Sf;function br(r){return new Uint8Array(r).buffer}be.raw=br;function li(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}be.uSmall=li;function to(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),ft(0,24,r)}be.u8=to;function ro(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),ft(0,25,r)}be.u16=ro;function no(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),ft(0,26,r)}be.u32=no;function di(r,e){if(typeof r=="string"&&e==16){if(r.match(/[^0-9a-fA-F]/))throw new RangeError("Invalid number.");return ft(0,27,r)}if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),Af),r=r.toString(16),ft(0,27,r)}be.u64=di;function io(r){if(isNaN(r))throw new RangeError("Invalid number.");if(r===0)return li(0);r=Math.min(Math.max(0,-r),24)-1;let e=[32+r];return new Uint8Array(e).buffer}be.iSmall=io;function so(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),ft(1,24,r)}be.i8=so;function oo(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),ft(1,25,r)}be.i16=oo;function ao(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),ft(1,26,r)}be.i32=ao;function co(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?ft(1,27,n):di(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),ft(1,27,r)}be.i64=co;function Tf(r){return r>=0?r<24?li(r):r<=255?to(r):r<=65535?ro(r):r<=4294967295?no(r):di(r):r>=-24?io(r):r>=-255?so(r):r>=-65535?oo(r):r>=-4294967295?ao(r):co(r)}be.number=Tf;function Nf(r){return _t(Xr(2,r.byteLength),r)}be.bytes=Nf;function Uf(r){return eo(r)}be.string=Uf;function Rf(r){return _t(Xr(4,r.length),...r)}be.array=Rf;function Of(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))),_t(Xr(5,r.size),...t.map(([n,i])=>_t(eo(n),i)))}be.map=Of;function Ff(r){let e=new Float32Array([r]);return _t(new Uint8Array([250]),new Uint8Array(e.buffer))}be.singleFloat=Ff;function Pf(r){let e=new Float64Array([r]);return _t(new Uint8Array([251]),new Uint8Array(e.buffer))}be.doubleFloat=Pf;function Lf(r){return r?fo():uo()}be.bool=Lf;function fo(){return br(new Uint8Array([245]))}be.true_=fo;function uo(){return br(new Uint8Array([244]))}be.false_=uo;function Mf(){return br(new Uint8Array([246]))}be.null_=Mf;function Df(){return br(new Uint8Array([247]))}be.undefined_=Df});var lo=Ge(Rt=>{"use strict";var kf=Rt&&Rt.__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(Rt,"__esModule",{value:!0});var ut=kf(hi()),qf=[ArrayBuffer,Uint8Array,Uint16Array,Uint32Array,Int8Array,Int16Array,Int32Array,Float32Array,Float64Array],Jr=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 ut.undefined_();case"boolean":return ut.bool(e);case"number":return Math.floor(e)===e?ut.number(e):ut.doubleFloat(e);case"string":return ut.string(e);case"object":if(e===null)return ut.null_();if(Array.isArray(e))return ut.array(e.map(t=>this._serializer.serializeValue(t)));if(qf.find(t=>e instanceof t))return ut.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 ut.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 ut.map(t,this._stable)}default:throw new Error("Invalid value.")}}};Rt.JsonDefaultCborEncoder=Jr;var Qr=class{constructor(){this.name="cborEncoder",this.priority=-90}match(e){return typeof e=="object"&&typeof e.toCBOR=="function"}encode(e){return e.toCBOR()}};Rt.ToCborEncoder=Qr;var en=class{constructor(){this._encoders=new Set}static withDefaultEncoders(e=!1){let t=new this;return t.addEncoder(new Jr(t,e)),t.addEncoder(new Qr),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)}};Rt.CborSerializer=en;var pi=class extends en{serialize(e){return ut.raw(new Uint8Array([...new Uint8Array([217,217,247]),...new Uint8Array(super.serializeValue(e))]))}};Rt.SelfDescribeCborSerializer=pi});var bi=Ge(Vt=>{"use strict";function $f(r){for(var e in r)Vt.hasOwnProperty(e)||(Vt[e]=r[e])}var Cf=Vt&&Vt.__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(Vt,"__esModule",{value:!0});$f(lo());var Gf=Cf(hi());Vt.value=Gf});var Fr="abcdefghijklmnopqrstuvwxyz234567",Wt=Object.create(null);for(let r=0;r<Fr.length;r++)Wt[Fr[r]]=r;Wt[0]=Wt.o;Wt[1]=Wt.i;function Ji(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+=Fr[t>>3],e+=5),0)}for(let s=0;s<r.length;)s+=i(r[s]);return n+(e<0?Fr[t>>3]:"")}function Qi(r){let e=0,t=0,n=new Uint8Array(r.length*4/3|0),i=0;function s(o){let f=Wt[o.toLowerCase()];if(f===void 0)throw new Error(`Invalid character: ${JSON.stringify(o)}`);f<<=3,t|=f>>>e,e+=5,e>=8&&(n[i++]=t,e-=8,e>0?t=f<<5-e&255:t=0)}for(let o of r)s(o);return n.slice(0,i)}var cc=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 es(r){let e=new Uint8Array(r),t=-1;for(let n=0;n<e.length;n++){let s=(e[n]^t)&255;t=cc[s]^t>>>8}return(t^-1)>>>0}function fc(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Dn(r,...e){if(!fc(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 kn(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 ts(r,e){Dn(r);let t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}var Pr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var Mr=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),at=(r,e)=>r<<32-e|r>>>e;var r0=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function uc(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function qn(r){return typeof r=="string"&&(r=uc(r)),Dn(r),r}var Lr=class{clone(){return this._cloneInto()}},n0={}.toString;function $n(r){let e=n=>r().update(qn(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}function rs(r=32){if(Pr&&typeof Pr.getRandomValues=="function")return Pr.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}function lc(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),f=Number(t&s),a=n?4:0,m=n?0:4;r.setUint32(e+a,o,n),r.setUint32(e+m,f,n)}var ns=(r,e,t)=>r&e^~r&t,is=(r,e,t)=>r&e^r&t^e&t,Dr=class extends Lr{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=Mr(this.buffer)}update(e){kn(this);let{view:t,buffer:n,blockLen:i}=this;e=qn(e);let s=e.length;for(let o=0;o<s;){let f=Math.min(i-this.pos,s-o);if(f===i){let a=Mr(e);for(;i<=s-o;o+=i)this.process(a,o);continue}n.set(e.subarray(o,o+f),this.pos),this.pos+=f,o+=f,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){kn(this),ts(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 h=o;h<i;h++)t[h]=0;lc(n,i-8,BigInt(this.length*8),s),this.process(n,0);let f=Mr(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let m=a/4,E=this.get();if(m>E.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<m;h++)f.setUint32(4*h,E[h],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:f}=this;return e.length=i,e.pos=f,e.finished=s,e.destroyed=o,i%t&&e.buffer.set(n),e}};var dc=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]),Nt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ut=new Uint32Array(64),kr=class extends Dr{constructor(){super(64,32,8,!1),this.A=Nt[0]|0,this.B=Nt[1]|0,this.C=Nt[2]|0,this.D=Nt[3]|0,this.E=Nt[4]|0,this.F=Nt[5]|0,this.G=Nt[6]|0,this.H=Nt[7]|0}get(){let{A:e,B:t,C:n,D:i,E:s,F:o,G:f,H:a}=this;return[e,t,n,i,s,o,f,a]}set(e,t,n,i,s,o,f,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=f|0,this.H=a|0}process(e,t){for(let h=0;h<16;h++,t+=4)Ut[h]=e.getUint32(t,!1);for(let h=16;h<64;h++){let O=Ut[h-15],B=Ut[h-2],v=at(O,7)^at(O,18)^O>>>3,A=at(B,17)^at(B,19)^B>>>10;Ut[h]=A+Ut[h-7]+v+Ut[h-16]|0}let{A:n,B:i,C:s,D:o,E:f,F:a,G:m,H:E}=this;for(let h=0;h<64;h++){let O=at(f,6)^at(f,11)^at(f,25),B=E+O+ns(f,a,m)+dc[h]+Ut[h]|0,A=(at(n,2)^at(n,13)^at(n,22))+is(n,i,s)|0;E=m,m=a,a=f,f=o+B|0,o=s,s=i,i=n,n=B+A|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,f=f+this.E|0,a=a+this.F|0,m=m+this.G|0,E=E+this.H|0,this.set(n,i,s,o,f,a,m,E)}roundClean(){Ut.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Cn=class extends kr{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}},ur=$n(()=>new kr),ss=$n(()=>new Cn);function os(r){return ss.create().update(new Uint8Array(r)).digest()}var qr="__principal__",hc=2,as=4,pc="aaaaa-aa",bc=r=>{var e;return new Uint8Array(((e=r.match(/.{1,2}/g))!==null&&e!==void 0?e:[]).map(t=>parseInt(t,16)))},gc=r=>r.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),""),Ve=class r{constructor(e){this._arr=e,this._isPrincipal=!0}static anonymous(){return new this(new Uint8Array([as]))}static managementCanister(){return this.fromHex(pc)}static selfAuthenticating(e){let t=os(e);return new this(new Uint8Array([...t,hc]))}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(bc(e))}static fromText(e){let t=e;if(e.includes(qr)){let o=JSON.parse(e);qr in o&&(t=o[qr])}let n=t.toLowerCase().replace(/-/g,""),i=Qi(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]===as}toUint8Array(){return this._arr}toHex(){return gc(this._arr).toUpperCase()}toText(){let e=new ArrayBuffer(4);new DataView(e).setUint32(0,es(this._arr));let n=new Uint8Array(e),i=Uint8Array.from(this._arr),s=new Uint8Array([...n,...i]),f=Ji(s).match(/.{1,5}/g);if(!f)throw new Error;return f.join("-")}toString(){return this.toText()}toJSON(){return{[qr]: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 Xt=class r extends Error{constructor(e){super(e),this.message=e,Object.setPrototypeOf(this,r.prototype)}};var po=Or(ui()),Yt=Or(bi()),bo=Or(bi());function st(...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 lt(r){return[...new Uint8Array(r)].map(e=>e.toString(16).padStart(2,"0")).join("")}var Vf=new RegExp(/^[0-9a-fA-F]+$/);function mr(r){if(!Vf.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 gi(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 mi(r,e){return gi(r,e)===0}function gr(r){return new DataView(r.buffer,r.byteOffset,r.byteLength).buffer}function Yf(r){return r instanceof Uint8Array?gr(r):r instanceof ArrayBuffer?r:Array.isArray(r)?gr(new Uint8Array(r)):"buffer"in r?Yf(r.buffer):gr(new Uint8Array(r))}var yi=class{get name(){return"Principal"}get priority(){return 0}match(e){return e&&e._isPrincipal===!0}encode(e){return Yt.value.bytes(e.toUint8Array())}},wi=class{get name(){return"Buffer"}get priority(){return 1}match(e){return e instanceof ArrayBuffer||ArrayBuffer.isView(e)}encode(e){return Yt.value.bytes(new Uint8Array(e))}},xi=class{get name(){return"BigInt"}get priority(){return 1}match(e){return typeof e=="bigint"}encode(e){return e>BigInt(0)?Yt.value.tagged(2,Yt.value.bytes(mr(e.toString(16)))):Yt.value.tagged(3,Yt.value.bytes(mr((BigInt("-1")*e).toString(16))))}},tn=bo.SelfDescribeCborSerializer.withDefaultEncoders(!0);tn.addEncoder(new yi);tn.addEncoder(new wi);tn.addEncoder(new xi);var Ei;(function(r){r[r.Uint64LittleEndian=71]="Uint64LittleEndian",r[r.Semantic=55799]="Semantic"})(Ei||(Ei={}));function D0(r){return tn.serialize(r)}function ho(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 _i=class extends po.default.Decoder{createByteString(e){return st(...e)}createByteStringFromHeap(e,t){return e===t?new ArrayBuffer(0):new Uint8Array(this._heap.slice(e,t))}};function er(r){let e=new Uint8Array(r),t=new _i({size:e.byteLength,tags:{2:n=>ho(n),3:n=>-ho(n),[Ei.Semantic]:n=>n}});try{return t.decodeFirst(e)}catch(n){throw new Error(`Failed to decode CBOR: ${n}, input: ${lt(e)}`)}}var Ni={};Mn(Ni,{Bool:()=>Io,BoolClass:()=>cn,ConstructType:()=>xt,Empty:()=>Eo,EmptyClass:()=>on,FixedIntClass:()=>Bt,FixedNatClass:()=>wt,Float32:()=>To,Float64:()=>No,FloatClass:()=>wr,Func:()=>Ho,FuncClass:()=>Er,Int:()=>Ao,Int16:()=>Ro,Int32:()=>Oo,Int64:()=>Fo,Int8:()=>Uo,IntClass:()=>ln,Nat:()=>So,Nat16:()=>Lo,Nat32:()=>Mo,Nat64:()=>Do,Nat8:()=>Po,NatClass:()=>dn,Null:()=>Bo,NullClass:()=>fn,Opt:()=>Co,OptClass:()=>nr,PrimitiveType:()=>Qe,Principal:()=>ko,PrincipalClass:()=>gn,Rec:()=>Yo,RecClass:()=>Pt,Record:()=>Go,RecordClass:()=>xr,Reserved:()=>_o,ReservedClass:()=>rr,Service:()=>zo,ServiceClass:()=>mn,Text:()=>vo,TextClass:()=>un,Tuple:()=>qo,TupleClass:()=>pn,Type:()=>tr,Unknown:()=>jf,UnknownClass:()=>an,Variant:()=>Vo,VariantClass:()=>bn,Vec:()=>$o,VecClass:()=>hn,Visitor:()=>sn,decode:()=>Zf,encode:()=>zf});function de(...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 dt=class{constructor(e,t=e?.byteLength||0){this._buffer=Bi(e||new ArrayBuffer(0)),this._view=new Uint8Array(this._buffer,0,t)}get buffer(){return Bi(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 Ii(r){return new DataView(r.buffer,r.byteOffset,r.byteLength).buffer}function Bi(r){return r instanceof Uint8Array?Ii(r):r instanceof ArrayBuffer?r:Array.isArray(r)?Ii(new Uint8Array(r)):"buffer"in r?Bi(r.buffer):Ii(new Uint8Array(r))}function Hf(r){let t=new TextEncoder().encode(r),n=0;for(let i of t)n=(n*223+i)%2**32;return n}function ht(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 Hf(r)}function mo(){throw new Error("unexpected end of buffer")}function Ft(r,e){return r.byteLength<e&&mo(),r.read(e)}function Ot(r){let e=r.readUint8();return e===void 0&&mo(),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 dt(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 Fe(r){let e=BigInt(1),t=BigInt(0),n;do n=Ot(r),t+=BigInt(n&127).valueOf()*e,e*=BigInt(128);while(n>=128);return t}function Pe(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 dt(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 It(r){let e=new Uint8Array(r.buffer),t=0;for(;t<e.byteLength;t++)if(e[t]<128){if(!(e[t]&64))return Fe(r);break}let n=new Uint8Array(Ft(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 yo(r,e){if(BigInt(r)<BigInt(0))throw new Error("Cannot write negative values.");return vi(r,e)}function vi(r,e){r=BigInt(r);let t=new dt(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 Ai(r,e){let t=BigInt(Ot(r)),n=BigInt(1),i=0;for(;++i<e;){n*=BigInt(256);let s=BigInt(Ot(r));t=t+n*s}return t}function wo(r,e){let t=Ai(r,e),n=BigInt(2)**(BigInt(8)*BigInt(e-1)+BigInt(7));return t>=n&&(t-=n*BigInt(2)),t}function rn(r){let e=BigInt(r);if(r<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<e}var nn="DIDL",xo=400;function yr(r,e,t){return r.map((n,i)=>t(n,e[i]))}var Si=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=de(...this._typs);return de(e,t)}indexOf(e){if(!this._idx.has(e))throw new Error("Missing type index for "+e);return Pe(this._idx.get(e)||0)}},sn=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)}},tr=class{display(){return this.name}valueToString(e){return Te(e)}buildTypeTable(e){e.has(this)||this._buildTypeTableImpl(e)}},Qe=class extends tr{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){}},xt=class extends tr{checkType(e){if(e instanceof Pt){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)}},on=class extends Qe{accept(e,t){return e.visitEmpty(this,t)}covariant(e){throw new Error(`Invalid ${this.display()} argument: ${Te(e)}`)}encodeValue(){throw new Error("Empty cannot appear as a function argument")}valueToString(){throw new Error("Empty cannot appear as a value")}encodeType(){return Pe(-17)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}},an=class extends tr{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: ${Te(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 Pt?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"}},cn=class extends Qe{accept(e,t){return e.visitBool(this,t)}covariant(e){if(typeof e=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${Te(e)}`)}encodeValue(e){return new Uint8Array([e?1:0])}encodeType(){return Pe(-2)}decodeValue(e,t){switch(this.checkType(t),Ot(e)){case 0:return!1;case 1:return!0;default:throw new Error("Boolean value out of range")}}get name(){return"bool"}},fn=class extends Qe{accept(e,t){return e.visitNull(this,t)}covariant(e){if(e===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${Te(e)}`)}encodeValue(){return new ArrayBuffer(0)}encodeType(){return Pe(-1)}decodeValue(e,t){return this.checkType(t),null}get name(){return"null"}},rr=class extends Qe{accept(e,t){return e.visitReserved(this,t)}covariant(e){return!0}encodeValue(){return new ArrayBuffer(0)}encodeType(){return Pe(-16)}decodeValue(e,t){return t.name!==this.name&&t.decodeValue(e,t),null}get name(){return"reserved"}},un=class extends Qe{accept(e,t){return e.visitText(this,t)}covariant(e){if(typeof e=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${Te(e)}`)}encodeValue(e){let t=new TextEncoder().encode(e),n=Be(t.byteLength);return de(n,t)}encodeType(){return Pe(-15)}decodeValue(e,t){this.checkType(t);let n=Fe(e),i=Ft(e,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(i)}get name(){return"text"}valueToString(e){return'"'+e+'"'}},ln=class extends Qe{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: ${Te(e)}`)}encodeValue(e){return Pe(e)}encodeType(){return Pe(-4)}decodeValue(e,t){return this.checkType(t),It(e)}get name(){return"int"}valueToString(e){return e.toString()}},dn=class extends Qe{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: ${Te(e)}`)}encodeValue(e){return Be(e)}encodeType(){return Pe(-3)}decodeValue(e,t){return this.checkType(t),Fe(e)}get name(){return"nat"}valueToString(e){return e.toString()}},wr=class extends Qe{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: ${Te(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 Pe(e)}decodeValue(e,t){this.checkType(t);let n=Ft(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()}},Bt=class extends Qe{constructor(e){super(),this._bits=e}accept(e,t){return e.visitFixedInt(this,t)}covariant(e){let t=rn(this._bits-1)*BigInt(-1),n=rn(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: ${Te(e)}`)}encodeValue(e){return vi(e,this._bits/8)}encodeType(){let e=Math.log2(this._bits)-3;return Pe(-9-e)}decodeValue(e,t){this.checkType(t);let n=wo(e,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(e){return e.toString()}},wt=class extends Qe{constructor(e){super(),this._bits=e}accept(e,t){return e.visitFixedNat(this,t)}covariant(e){let t=rn(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: ${Te(e)}`)}encodeValue(e){return yo(e,this._bits/8)}encodeType(){let e=Math.log2(this._bits)-3;return Pe(-5-e)}decodeValue(e,t){this.checkType(t);let n=Ai(e,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(e){return e.toString()}},hn=class r extends xt{constructor(e){super(),this._type=e,this._blobOptimization=!1,e instanceof wt&&e._bits===8&&(this._blobOptimization=!0)}accept(e,t){return e.visitVec(this,this._type,t)}covariant(e){let t=this._type instanceof wt?this._type._bits:this._type instanceof Bt?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
|
-
|
|
3
|
-
index ${i} -> ${s.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${Te(e)}`)}encodeValue(e){let t=Be(e.length);if(this._blobOptimization)return de(t,new Uint8Array(e));if(ArrayBuffer.isView(e))return de(t,new Uint8Array(e.buffer));let n=new dt(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=Pe(-19),n=this._type.encodeType(e);e.add(this,de(t,n))}decodeValue(e,t){let n=this.checkType(t);if(!(n instanceof r))throw new Error("Not a vector type");let i=Number(Fe(e));if(this._type instanceof wt){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 Bt){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("; ")+"}"}},nr=class r extends xt{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: ${Te(e)}
|
|
4
|
-
|
|
5
|
-
-> ${t.message}`)}throw new Error(`Invalid ${this.display()} argument: ${Te(e)}`)}encodeValue(e){return e.length===0?new Uint8Array([0]):de(new Uint8Array([1]),this._type.encodeValue(e[0]))}_buildTypeTableImpl(e){this._type.buildTypeTable(e);let t=Pe(-18),n=this._type.encodeType(e);e.add(this,de(t,n))}decodeValue(e,t){let n=this.checkType(t);if(!(n instanceof r))throw new Error("Not an option type");switch(Ot(e)){case 0:return[];case 1:return[this._type.decodeValue(e,n._type)];default:throw new Error("Not an option value")}}get name(){return`opt ${this._type.name}`}display(){return`opt ${this._type.display()}`}valueToString(e){return e.length===0?"null":`opt ${this._type.valueToString(e[0])}`}},xr=class r extends xt{constructor(e={}){super(),this._fields=Object.entries(e).sort((t,n)=>ht(t[0])-ht(n[0]))}accept(e,t){return e.visitRecord(this,this._fields,t)}tryAsTuple(){let e=[];for(let t=0;t<this._fields.length;t++){let[n,i]=this._fields[t];if(n!==`_${t}_`)return null;e.push(i)}return e}covariant(e){if(typeof e=="object"&&this._fields.every(([t,n])=>{if(!e.hasOwnProperty(t))throw new Error(`Record is missing key "${t}".`);try{return n.covariant(e[t])}catch(i){throw new Error(`Invalid ${this.display()} argument:
|
|
6
|
-
|
|
7
|
-
field ${t} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${Te(e)}`)}encodeValue(e){let t=this._fields.map(([i])=>e[i]),n=yr(this._fields,t,([,i],s)=>i.encodeValue(s));return de(...n)}_buildTypeTableImpl(e){this._fields.forEach(([s,o])=>o.buildTypeTable(e));let t=Pe(-20),n=Be(this._fields.length),i=this._fields.map(([s,o])=>de(Be(ht(s)),o.encodeType(e)));e.add(this,de(t,n,de(...i)))}decodeValue(e,t){let n=this.checkType(t);if(!(n instanceof r))throw new Error("Not a record type");let i={},s=0,o=0;for(;o<n._fields.length;){let[f,a]=n._fields[o];if(s>=this._fields.length){a.decodeValue(e,a),o++;continue}let[m,E]=this._fields[s],h=ht(this._fields[s][0]),O=ht(f);if(h===O)i[m]=E.decodeValue(e,a),s++,o++;else if(O>h)if(E instanceof nr||E instanceof rr)i[m]=[],s++;else throw new Error("Cannot find required field "+m);else a.decodeValue(e,a),o++}for(let[f,a]of this._fields.slice(s))if(a instanceof nr||a instanceof rr)i[f]=[];else throw new Error("Cannot find required field "+f);return i}get name(){return`record {${this._fields.map(([t,n])=>t+":"+n.name).join("; ")}}`}display(){return`record {${this._fields.map(([t,n])=>t+":"+n.display()).join("; ")}}`}valueToString(e){let t=this._fields.map(([i])=>e[i]);return`record {${yr(this._fields,t,([i,s],o)=>i+"="+s.valueToString(o)).join("; ")}}`}},pn=class r extends xr{constructor(e){let t={};e.forEach((n,i)=>t["_"+i+"_"]=n),super(t),this._components=e}accept(e,t){return e.visitTuple(this,this._components,t)}covariant(e){if(Array.isArray(e)&&e.length>=this._fields.length&&this._components.every((t,n)=>{try{return t.covariant(e[n])}catch(i){throw new Error(`Invalid ${this.display()} argument:
|
|
8
|
-
|
|
9
|
-
index ${n} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${Te(e)}`)}encodeValue(e){let t=yr(this._components,e,(n,i)=>n.encodeValue(i));return de(...t)}decodeValue(e,t){let n=this.checkType(t);if(!(n instanceof r))throw new Error("not a tuple type");if(n._components.length<this._components.length)throw new Error("tuple mismatch");let i=[];for(let[s,o]of n._components.entries())s>=this._components.length?o.decodeValue(e,o):i.push(this._components[s].decodeValue(e,o));return i}display(){return`record {${this._components.map(t=>t.display()).join("; ")}}`}valueToString(e){return`record {${yr(this._components,e,(n,i)=>n.valueToString(i)).join("; ")}}`}},bn=class r extends xt{constructor(e={}){super(),this._fields=Object.entries(e).sort((t,n)=>ht(t[0])-ht(n[0]))}accept(e,t){return e.visitVariant(this,this._fields,t)}covariant(e){if(typeof e=="object"&&Object.entries(e).length===1&&this._fields.every(([t,n])=>{try{return!e.hasOwnProperty(t)||n.covariant(e[t])}catch(i){throw new Error(`Invalid ${this.display()} argument:
|
|
10
|
-
|
|
11
|
-
variant ${t} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${Te(e)}`)}encodeValue(e){for(let t=0;t<this._fields.length;t++){let[n,i]=this._fields[t];if(e.hasOwnProperty(n)){let s=Be(t),o=i.encodeValue(e[n]);return de(s,o)}}throw Error("Variant has no data: "+e)}_buildTypeTableImpl(e){this._fields.forEach(([,s])=>{s.buildTypeTable(e)});let t=Pe(-21),n=Be(this._fields.length),i=this._fields.map(([s,o])=>de(Be(ht(s)),o.encodeType(e)));e.add(this,de(t,n,...i))}decodeValue(e,t){let n=this.checkType(t);if(!(n instanceof r))throw new Error("Not a variant type");let i=Number(Fe(e));if(i>=n._fields.length)throw Error("Invalid variant index: "+i);let[s,o]=n._fields[i];for(let[f,a]of this._fields)if(ht(s)===ht(f)){let m=a.decodeValue(e,o);return{[f]:m}}throw new Error("Cannot find field hash "+s)}get name(){return`variant {${this._fields.map(([t,n])=>t+":"+n.name).join("; ")}}`}display(){return`variant {${this._fields.map(([t,n])=>t+(n.name==="null"?"":`:${n.display()}`)).join("; ")}}`}valueToString(e){for(let[t,n]of this._fields)if(e.hasOwnProperty(t)){let i=n.valueToString(e[t]);return i==="null"?`variant {${t}}`:`variant {${t}=${i}}`}throw new Error("Variant has no data: "+e)}},Pt=class r extends xt{constructor(){super(...arguments),this._id=r._counter++,this._type=void 0}accept(e,t){if(!this._type)throw Error("Recursive type uninitialized.");return e.visitRec(this,this._type,t)}fill(e){this._type=e}getType(){return this._type}covariant(e){if(this._type&&this._type.covariant(e))return!0;throw new Error(`Invalid ${this.display()} argument: ${Te(e)}`)}encodeValue(e){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.encodeValue(e)}_buildTypeTableImpl(e){if(!this._type)throw Error("Recursive type uninitialized.");e.add(this,new Uint8Array([])),this._type.buildTypeTable(e),e.merge(this,this._type.name)}decodeValue(e,t){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.decodeValue(e,t)}get name(){return`rec_${this._id}`}display(){if(!this._type)throw Error("Recursive type uninitialized.");return`\u03BC${this.name}.${this._type.name}`}valueToString(e){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.valueToString(e)}};Pt._counter=0;function Ti(r){if(Ot(r)!==1)throw new Error("Cannot decode principal");let t=Number(Fe(r));return Ve.fromUint8Array(new Uint8Array(Ft(r,t)))}var gn=class extends Qe{accept(e,t){return e.visitPrincipal(this,t)}covariant(e){if(e&&e._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${Te(e)}`)}encodeValue(e){let t=e.toUint8Array(),n=Be(t.byteLength);return de(new Uint8Array([1]),n,t)}encodeType(){return Pe(-24)}decodeValue(e,t){return this.checkType(t),Ti(e)}get name(){return"principal"}valueToString(e){return`${this.name} "${e.toText()}"`}},Er=class extends xt{constructor(e,t,n=[]){super(),this.argTypes=e,this.retTypes=t,this.annotations=n}static argsToString(e,t){if(e.length!==t.length)throw new Error("arity mismatch");return"("+e.map((n,i)=>n.valueToString(t[i])).join(", ")+")"}accept(e,t){return e.visitFunc(this,t)}covariant(e){if(Array.isArray(e)&&e.length===2&&e[0]&&e[0]._isPrincipal&&typeof e[1]=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${Te(e)}`)}encodeValue([e,t]){let n=e.toUint8Array(),i=Be(n.byteLength),s=de(new Uint8Array([1]),i,n),o=new TextEncoder().encode(t),f=Be(o.byteLength);return de(new Uint8Array([1]),s,f,o)}_buildTypeTableImpl(e){this.argTypes.forEach(m=>m.buildTypeTable(e)),this.retTypes.forEach(m=>m.buildTypeTable(e));let t=Pe(-22),n=Be(this.argTypes.length),i=de(...this.argTypes.map(m=>m.encodeType(e))),s=Be(this.retTypes.length),o=de(...this.retTypes.map(m=>m.encodeType(e))),f=Be(this.annotations.length),a=de(...this.annotations.map(m=>this.encodeAnnotation(m)));e.add(this,de(t,n,i,s,o,f,a))}decodeValue(e){if(Ot(e)!==1)throw new Error("Cannot decode function reference");let n=Ti(e),i=Number(Fe(e)),s=Ft(e,i),f=new TextDecoder("utf8",{fatal:!0}).decode(s);return[n,f]}get name(){let e=this.argTypes.map(i=>i.name).join(", "),t=this.retTypes.map(i=>i.name).join(", "),n=" "+this.annotations.join(" ");return`(${e}) -> (${t})${n}`}valueToString([e,t]){return`func "${e.toText()}".${t}`}display(){let e=this.argTypes.map(i=>i.display()).join(", "),t=this.retTypes.map(i=>i.display()).join(", "),n=" "+this.annotations.join(" ");return`(${e}) \u2192 (${t})${n}`}encodeAnnotation(e){if(e==="query")return new Uint8Array([1]);if(e==="oneway")return new Uint8Array([2]);if(e==="composite_query")return new Uint8Array([3]);throw new Error("Illegal function annotation")}},mn=class extends xt{constructor(e){super(),this._fields=Object.entries(e).sort((t,n)=>t[0]<n[0]?-1:t[0]>n[0]?1:0)}accept(e,t){return e.visitService(this,t)}covariant(e){if(e&&e._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${Te(e)}`)}encodeValue(e){let t=e.toUint8Array(),n=Be(t.length);return de(new Uint8Array([1]),n,t)}_buildTypeTableImpl(e){this._fields.forEach(([s,o])=>o.buildTypeTable(e));let t=Pe(-23),n=Be(this._fields.length),i=this._fields.map(([s,o])=>{let f=new TextEncoder().encode(s),a=Be(f.length);return de(a,f,o.encodeType(e))});e.add(this,de(t,n,...i))}decodeValue(e){return Ti(e)}get name(){return`service {${this._fields.map(([t,n])=>t+":"+n.name).join("; ")}}`}valueToString(e){return`service "${e.toText()}"`}};function Te(r){let e=JSON.stringify(r,(t,n)=>typeof n=="bigint"?`BigInt(${n})`:n);return e&&e.length>xo?e.substring(0,xo-3)+"...":e}function zf(r,e){if(e.length<r.length)throw Error("Wrong number of message arguments");let t=new Si;r.forEach(a=>a.buildTypeTable(t));let n=new TextEncoder().encode(nn),i=t.encode(),s=Be(e.length),o=de(...r.map(a=>a.encodeType(t))),f=de(...yr(r,e,(a,m)=>{try{a.covariant(m)}catch(E){throw new Error(E.message+`
|
|
12
|
-
|
|
13
|
-
`)}return a.encodeValue(m)}));return de(n,i,s,o,f)}function Zf(r,e){let t=new dt(e);if(e.byteLength<nn.length)throw new Error("Message length smaller than magic number");let n=Ft(t,nn.length),i=new TextDecoder().decode(n);if(i!==nn)throw new Error("Wrong magic number: "+JSON.stringify(i));function s(B){let v=[],A=Number(Fe(B));for(let D=0;D<A;D++){let H=Number(It(B));switch(H){case-18:case-19:{let z=Number(It(B));v.push([H,z]);break}case-20:case-21:{let z=[],k=Number(Fe(B)),F;for(;k--;){let C=Number(Fe(B));if(C>=Math.pow(2,32))throw new Error("field id out of 32-bit range");if(typeof F=="number"&&F>=C)throw new Error("field id collision or not sorted");F=C;let Y=Number(It(B));z.push([C,Y])}v.push([H,z]);break}case-22:{let z=[],k=Number(Fe(B));for(;k--;)z.push(Number(It(B)));let F=[],C=Number(Fe(B));for(;C--;)F.push(Number(It(B)));let Y=[],q=Number(Fe(B));for(;q--;)switch(Number(Fe(B))){case 1:{Y.push("query");break}case 2:{Y.push("oneway");break}case 3:{Y.push("composite_query");break}default:throw new Error("unknown annotation")}v.push([H,[z,F,Y]]);break}case-23:{let z=Number(Fe(B)),k=[];for(;z--;){let F=Number(Fe(B)),C=new TextDecoder().decode(Ft(B,F)),Y=It(B);k.push([C,Y])}v.push([H,k]);break}default:throw new Error("Illegal op_code: "+H)}}let P=[],N=Number(Fe(B));for(let D=0;D<N;D++)P.push(Number(It(B)));return[v,P]}let[o,f]=s(t);if(f.length<r.length)throw new Error("Wrong number of return values");let a=o.map(B=>Yo());function m(B){if(B<-24)throw new Error("future value not supported");if(B<0)switch(B){case-1:return Bo;case-2:return Io;case-3:return So;case-4:return Ao;case-5:return Po;case-6:return Lo;case-7:return Mo;case-8:return Do;case-9:return Uo;case-10:return Ro;case-11:return Oo;case-12:return Fo;case-13:return To;case-14:return No;case-15:return vo;case-16:return _o;case-17:return Eo;case-24:return ko;default:throw new Error("Illegal op_code: "+B)}if(B>=o.length)throw new Error("type index out of range");return a[B]}function E(B){switch(B[0]){case-19:{let v=m(B[1]);return $o(v)}case-18:{let v=m(B[1]);return Co(v)}case-20:{let v={};for(let[N,D]of B[1]){let H=`_${N}_`;v[H]=m(D)}let A=Go(v),P=A.tryAsTuple();return Array.isArray(P)?qo(...P):A}case-21:{let v={};for(let[A,P]of B[1]){let N=`_${A}_`;v[N]=m(P)}return Vo(v)}case-22:{let[v,A,P]=B[1];return Ho(v.map(N=>m(N)),A.map(N=>m(N)),P)}case-23:{let v={},A=B[1];for(let[P,N]of A){let D=m(N);if(D instanceof Pt&&(D=D.getType()),!(D instanceof Er))throw new Error("Illegal service definition: services can only contain functions");v[P]=D}return zo(v)}default:throw new Error("Illegal op_code: "+B[0])}}o.forEach((B,v)=>{if(B[0]===-22){let A=E(B);a[v].fill(A)}}),o.forEach((B,v)=>{if(B[0]!==-22){let A=E(B);a[v].fill(A)}});let h=f.map(B=>m(B)),O=r.map((B,v)=>B.decodeValue(t,h[v]));for(let B=r.length;B<h.length;B++)h[B].decodeValue(t,h[B]);if(t.byteLength>0)throw new Error("decode: Left-over bytes");return O}var Eo=new on,_o=new rr,jf=new an,Io=new cn,Bo=new fn,vo=new un,Ao=new ln,So=new dn,To=new wr(32),No=new wr(64),Uo=new Bt(8),Ro=new Bt(16),Oo=new Bt(32),Fo=new Bt(64),Po=new wt(8),Lo=new wt(16),Mo=new wt(32),Do=new wt(64),ko=new gn;function qo(...r){return new pn(r)}function $o(r){return new hn(r)}function Co(r){return new nr(r)}function Go(r){return new xr(r)}function Vo(r){return new bn(r)}function Yo(){return new Pt}function Ho(r,e,t=[]){return new Er(r,e,t)}function zo(r){return new mn(r)}var Zo=Or(ui());function ot(r){return gr(ur.create().update(new Uint8Array(r)).digest())}function yn(r){if(r instanceof Zo.default.Tagged)return yn(r.value);if(typeof r=="string")return jo(r);if(typeof r=="number")return ot(Be(r));if(r instanceof ArrayBuffer||ArrayBuffer.isView(r))return ot(r);if(Array.isArray(r)){let e=r.map(yn);return ot(st(...e))}else{if(r&&typeof r=="object"&&r._isPrincipal)return ot(r.toUint8Array());if(typeof r=="object"&&r!==null&&typeof r.toHash=="function")return yn(r.toHash());if(typeof r=="object")return Ko(r);if(typeof r=="bigint")return ot(Be(r))}throw Object.assign(new Error(`Attempt to hash a value of unsupported type: ${r}`),{value:r})}var jo=r=>{let e=new TextEncoder().encode(r);return ot(e)};function dl(r){return Ko(r)}function Ko(r){let n=Object.entries(r).filter(([,o])=>o!==void 0).map(([o,f])=>{let a=jo(o),m=yn(f);return[a,m]}).sort(([o],[f])=>gi(o,f)),i=st(...n.map(o=>st(...o)));return ot(i)}var Oi={};Mn(Oi,{abytes:()=>pt,bitGet:()=>sr,bitLen:()=>Lt,bitMask:()=>Mt,bitSet:()=>eu,bytesToHex:()=>At,bytesToNumberBE:()=>je,bytesToNumberLE:()=>xn,concatBytes:()=>ve,createHmacDrbg:()=>ea,ensureBytes:()=>bt,equalBytes:()=>Qf,hexToBytes:()=>_r,hexToNumber:()=>Ri,isBytes:()=>ir,numberToBytesBE:()=>Ne,numberToBytesLE:()=>En,numberToHexUnpadded:()=>Qo,numberToVarBytesBE:()=>Jf,utf8ToBytes:()=>Ir,validateObject:()=>St});var Jo=BigInt(0),wn=BigInt(1),Wf=BigInt(2);function ir(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function pt(r){if(!ir(r))throw new Error("Uint8Array expected")}var Xf=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function At(r){pt(r);let e="";for(let t=0;t<r.length;t++)e+=Xf[r[t]];return e}function Qo(r){let e=r.toString(16);return e.length&1?`0${e}`:e}function Ri(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}var vt={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Wo(r){if(r>=vt._0&&r<=vt._9)return r-vt._0;if(r>=vt._A&&r<=vt._F)return r-(vt._A-10);if(r>=vt._a&&r<=vt._f)return r-(vt._a-10)}function _r(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let e=r.length,t=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(t);for(let i=0,s=0;i<t;i++,s+=2){let o=Wo(r.charCodeAt(s)),f=Wo(r.charCodeAt(s+1));if(o===void 0||f===void 0){let a=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+s)}n[i]=o*16+f}return n}function je(r){return Ri(At(r))}function xn(r){return pt(r),Ri(At(Uint8Array.from(r).reverse()))}function Ne(r,e){return _r(r.toString(16).padStart(e*2,"0"))}function En(r,e){return Ne(r,e).reverse()}function Jf(r){return _r(Qo(r))}function bt(r,e,t){let n;if(typeof e=="string")try{n=_r(e)}catch(s){throw new Error(`${r} must be valid hex string, got "${e}". Cause: ${s}`)}else if(ir(e))n=Uint8Array.from(e);else throw new Error(`${r} must be hex string or Uint8Array`);let i=n.length;if(typeof t=="number"&&i!==t)throw new Error(`${r} expected ${t} bytes, got ${i}`);return n}function ve(...r){let e=0;for(let n=0;n<r.length;n++){let i=r[n];pt(i),e+=i.length}let t=new Uint8Array(e);for(let n=0,i=0;n<r.length;n++){let s=r[n];t.set(s,i),i+=s.length}return t}function Qf(r,e){if(r.length!==e.length)return!1;let t=0;for(let n=0;n<r.length;n++)t|=r[n]^e[n];return t===0}function Ir(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function Lt(r){let e;for(e=0;r>Jo;r>>=wn,e+=1);return e}function sr(r,e){return r>>BigInt(e)&wn}function eu(r,e,t){return r|(t?wn:Jo)<<BigInt(e)}var Mt=r=>(Wf<<BigInt(r-1))-wn,Ui=r=>new Uint8Array(r),Xo=r=>Uint8Array.from(r);function ea(r,e,t){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let n=Ui(r),i=Ui(r),s=0,o=()=>{n.fill(1),i.fill(0),s=0},f=(...h)=>t(i,n,...h),a=(h=Ui())=>{i=f(Xo([0]),h),n=f(),h.length!==0&&(i=f(Xo([1]),h),n=f())},m=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let h=0,O=[];for(;h<e;){n=f();let B=n.slice();O.push(B),h+=n.length}return ve(...O)};return(h,O)=>{o(),a(h);let B;for(;!(B=O(m()));)a();return o(),B}}var tu={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||ir(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,e)=>e.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function St(r,e,t={}){let n=(i,s,o)=>{let f=tu[s];if(typeof f!="function")throw new Error(`Invalid validator "${s}", expected function`);let a=r[i];if(!(o&&a===void 0)&&!f(a,r))throw new Error(`Invalid param ${String(i)}=${a} (${typeof a}), expected ${s}`)};for(let[i,s]of Object.entries(e))n(i,s,!1);for(let[i,s]of Object.entries(t))n(i,s,!0);return r}var ke=BigInt(0),_e=BigInt(1),Ht=BigInt(2),ru=BigInt(3),Fi=BigInt(4),ta=BigInt(5),ra=BigInt(8),nu=BigInt(9),iu=BigInt(16);function We(r,e){let t=r%e;return t>=ke?t:e+t}function su(r,e,t){if(t<=ke||e<ke)throw new Error("Expected power/modulo > 0");if(t===_e)return ke;let n=_e;for(;e>ke;)e&_e&&(n=n*r%t),r=r*r%t,e>>=_e;return n}function bl(r,e,t){let n=r;for(;e-- >ke;)n*=n,n%=t;return n}function Pi(r,e){if(r===ke||e<=ke)throw new Error(`invert: expected positive integers, got n=${r} mod=${e}`);let t=We(r,e),n=e,i=ke,s=_e,o=_e,f=ke;for(;t!==ke;){let m=n/t,E=n%t,h=i-o*m,O=s-f*m;n=t,t=E,i=o,s=f,o=h,f=O}if(n!==_e)throw new Error("invert: does not exist");return We(i,e)}function ou(r){let e=(r-_e)/Ht,t,n,i;for(t=r-_e,n=0;t%Ht===ke;t/=Ht,n++);for(i=Ht;i<r&&su(i,e,r)!==r-_e;i++);if(n===1){let o=(r+_e)/Fi;return function(a,m){let E=a.pow(m,o);if(!a.eql(a.sqr(E),m))throw new Error("Cannot find square root");return E}}let s=(t+_e)/Ht;return function(f,a){if(f.pow(a,e)===f.neg(f.ONE))throw new Error("Cannot find square root");let m=n,E=f.pow(f.mul(f.ONE,i),t),h=f.pow(a,s),O=f.pow(a,t);for(;!f.eql(O,f.ONE);){if(f.eql(O,f.ZERO))return f.ZERO;let B=1;for(let A=f.sqr(O);B<m&&!f.eql(A,f.ONE);B++)A=f.sqr(A);let v=f.pow(E,_e<<BigInt(m-B-1));E=f.sqr(v),h=f.mul(h,v),O=f.mul(O,E),m=B}return h}}function au(r){if(r%Fi===ru){let e=(r+_e)/Fi;return function(n,i){let s=n.pow(i,e);if(!n.eql(n.sqr(s),i))throw new Error("Cannot find square root");return s}}if(r%ra===ta){let e=(r-ta)/ra;return function(n,i){let s=n.mul(i,Ht),o=n.pow(s,e),f=n.mul(i,o),a=n.mul(n.mul(f,Ht),o),m=n.mul(f,n.sub(a,n.ONE));if(!n.eql(n.sqr(m),i))throw new Error("Cannot find square root");return m}}return r%iu,ou(r)}var gl=(r,e)=>(We(r,e)&_e)===_e,cu=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function _n(r){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=cu.reduce((n,i)=>(n[i]="function",n),e);return St(r,t)}function Br(r,e,t){if(t<ke)throw new Error("Expected power > 0");if(t===ke)return r.ONE;if(t===_e)return e;let n=r.ONE,i=e;for(;t>ke;)t&_e&&(n=r.mul(n,i)),i=r.sqr(i),t>>=_e;return n}function vr(r,e){let t=new Array(e.length),n=e.reduce((s,o,f)=>r.is0(o)?s:(t[f]=s,r.mul(s,o)),r.ONE),i=r.inv(n);return e.reduceRight((s,o,f)=>r.is0(o)?s:(t[f]=r.mul(s,t[f]),r.mul(s,o)),i),t}function Li(r,e){let t=e!==void 0?e:r.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function Mi(r,e,t=!1,n={}){if(r<=ke)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:i,nByteLength:s}=Li(r,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let o=au(r),f=Object.freeze({ORDER:r,BITS:i,BYTES:s,MASK:Mt(i),ZERO:ke,ONE:_e,create:a=>We(a,r),isValid:a=>{if(typeof a!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof a}`);return ke<=a&&a<r},is0:a=>a===ke,isOdd:a=>(a&_e)===_e,neg:a=>We(-a,r),eql:(a,m)=>a===m,sqr:a=>We(a*a,r),add:(a,m)=>We(a+m,r),sub:(a,m)=>We(a-m,r),mul:(a,m)=>We(a*m,r),pow:(a,m)=>Br(f,a,m),div:(a,m)=>We(a*Pi(m,r),r),sqrN:a=>a*a,addN:(a,m)=>a+m,subN:(a,m)=>a-m,mulN:(a,m)=>a*m,inv:a=>Pi(a,r),sqrt:n.sqrt||(a=>o(f,a)),invertBatch:a=>vr(f,a),cmov:(a,m,E)=>E?m:a,toBytes:a=>t?En(a,s):Ne(a,s),fromBytes:a=>{if(a.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${a.length}`);return t?xn(a):je(a)}});return Object.freeze(f)}function na(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let e=r.toString(2).length;return Math.ceil(e/8)}function In(r){let e=na(r);return e+Math.ceil(e/2)}function Di(r,e,t=!1){let n=r.length,i=na(e),s=In(e);if(n<16||n<s||n>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);let o=t?je(r):xn(r),f=We(o,e-_e)+_e;return t?En(f,i):Ne(f,i)}var fu=je;function Dt(r,e){if(r<0||r>=1<<8*e)throw new Error(`bad I2OSP call: value=${r} length=${e}`);let t=Array.from({length:e}).fill(0);for(let n=e-1;n>=0;n--)t[n]=r&255,r>>>=8;return new Uint8Array(t)}function uu(r,e){let t=new Uint8Array(r.length);for(let n=0;n<r.length;n++)t[n]=r[n]^e[n];return t}function ki(r){if(!Number.isSafeInteger(r))throw new Error("number expected")}function lu(r,e,t,n){pt(r),pt(e),ki(t),e.length>255&&(e=n(ve(Ir("H2C-OVERSIZE-DST-"),e)));let{outputLen:i,blockLen:s}=n,o=Math.ceil(t/i);if(o>255)throw new Error("Invalid xmd length");let f=ve(e,Dt(e.length,1)),a=Dt(0,s),m=Dt(t,2),E=new Array(o),h=n(ve(a,r,m,Dt(0,1),f));E[0]=n(ve(h,Dt(1,1),f));for(let B=1;B<=o;B++){let v=[uu(h,E[B-1]),Dt(B+1,1),f];E[B]=n(ve(...v))}return ve(...E).slice(0,t)}function du(r,e,t,n,i){if(pt(r),pt(e),ki(t),e.length>255){let s=Math.ceil(2*n/8);e=i.create({dkLen:s}).update(Ir("H2C-OVERSIZE-DST-")).update(e).digest()}if(t>65535||e.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:t}).update(r).update(Dt(t,2)).update(e).update(Dt(e.length,1)).digest()}function sa(r,e,t){St(t,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});let{p:n,k:i,m:s,hash:o,expand:f,DST:a}=t;pt(r),ki(e);let m=typeof a=="string"?Ir(a):a,E=n.toString(2).length,h=Math.ceil((E+i)/8),O=e*s*h,B;if(f==="xmd")B=lu(r,m,O,o);else if(f==="xof")B=du(r,m,O,i,o);else if(f==="_internal_pass")B=r;else throw new Error('expand must be "xmd" or "xof"');let v=new Array(e);for(let A=0;A<e;A++){let P=new Array(s);for(let N=0;N<s;N++){let D=h*(N+A*s),H=B.subarray(D,D+h);P[N]=We(fu(H),n)}v[A]=P}return v}function qi(r,e){let t=e.map(n=>Array.from(n).reverse());return(n,i)=>{let[s,o,f,a]=t.map(m=>m.reduce((E,h)=>r.add(r.mul(E,n),h)));return n=r.div(s,o),i=r.mul(i,r.div(f,a)),{x:n,y:i}}}function $i(r,e,t){if(typeof e!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(n,i){let s=sa(n,2,{...t,DST:t.DST,...i}),o=r.fromAffine(e(s[0])),f=r.fromAffine(e(s[1])),a=o.add(f).clearCofactor();return a.assertValidity(),a},encodeToCurve(n,i){let s=sa(n,1,{...t,DST:t.encodeDST,...i}),o=r.fromAffine(e(s[0])).clearCofactor();return o.assertValidity(),o},mapToCurve(n){if(!Array.isArray(n))throw new Error("mapToCurve: expected array of bigints");for(let s of n)if(typeof s!="bigint")throw new Error(`mapToCurve: expected array of bigints, got ${s} in array`);let i=r.fromAffine(e(n)).clearCofactor();return i.assertValidity(),i}}}var hu=BigInt(0),Ci=BigInt(1);function oa(r,e){let t=(i,s)=>{let o=s.negate();return i?o:s},n=i=>{let s=Math.ceil(e/i)+1,o=2**(i-1);return{windows:s,windowSize:o}};return{constTimeNegate:t,unsafeLadder(i,s){let o=r.ZERO,f=i;for(;s>hu;)s&Ci&&(o=o.add(f)),f=f.double(),s>>=Ci;return o},precomputeWindow(i,s){let{windows:o,windowSize:f}=n(s),a=[],m=i,E=m;for(let h=0;h<o;h++){E=m,a.push(E);for(let O=1;O<f;O++)E=E.add(m),a.push(E);m=E.double()}return a},wNAF(i,s,o){let{windows:f,windowSize:a}=n(i),m=r.ZERO,E=r.BASE,h=BigInt(2**i-1),O=2**i,B=BigInt(i);for(let v=0;v<f;v++){let A=v*a,P=Number(o&h);o>>=B,P>a&&(P-=O,o+=Ci);let N=A,D=A+Math.abs(P)-1,H=v%2!==0,z=P<0;P===0?E=E.add(t(H,s[N])):m=m.add(t(z,s[D]))}return{p:m,f:E}},wNAFCached(i,s,o,f){let a=i._WINDOW_SIZE||1,m=s.get(i);return m||(m=this.precomputeWindow(i,a),a!==1&&s.set(i,f(m))),this.wNAF(a,m,o)}}}function aa(r){return _n(r.Fp),St(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Li(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}function pu(r){let e=aa(r);St(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:t,Fp:n,a:i}=e;if(t){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}var{bytesToNumberBE:vl,hexToBytes:Al}=Oi;var zt=BigInt(0),He=BigInt(1),kt=BigInt(2),Bn=BigInt(3),ca=BigInt(4);function Gi(r){let e=pu(r),{Fp:t}=e,n=e.toBytes||((v,A,P)=>{let N=A.toAffine();return ve(Uint8Array.from([4]),t.toBytes(N.x),t.toBytes(N.y))}),i=e.fromBytes||(v=>{let A=v.subarray(1),P=t.fromBytes(A.subarray(0,t.BYTES)),N=t.fromBytes(A.subarray(t.BYTES,2*t.BYTES));return{x:P,y:N}});function s(v){let{a:A,b:P}=e,N=t.sqr(v),D=t.mul(N,v);return t.add(t.add(D,t.mul(v,A)),P)}if(!t.eql(t.sqr(e.Gy),s(e.Gx)))throw new Error("bad generator point: equation left != right");function o(v){return typeof v=="bigint"&&zt<v&&v<e.n}function f(v){if(!o(v))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function a(v){let{allowedPrivateKeyLengths:A,nByteLength:P,wrapPrivateKey:N,n:D}=e;if(A&&typeof v!="bigint"){if(ir(v)&&(v=At(v)),typeof v!="string"||!A.includes(v.length))throw new Error("Invalid key");v=v.padStart(P*2,"0")}let H;try{H=typeof v=="bigint"?v:je(bt("private key",v,P))}catch{throw new Error(`private key must be ${P} bytes, hex or bigint, not ${typeof v}`)}return N&&(H=We(H,D)),f(H),H}let m=new Map;function E(v){if(!(v instanceof h))throw new Error("ProjectivePoint expected")}class h{constructor(A,P,N){if(this.px=A,this.py=P,this.pz=N,A==null||!t.isValid(A))throw new Error("x required");if(P==null||!t.isValid(P))throw new Error("y required");if(N==null||!t.isValid(N))throw new Error("z required")}static fromAffine(A){let{x:P,y:N}=A||{};if(!A||!t.isValid(P)||!t.isValid(N))throw new Error("invalid affine point");if(A instanceof h)throw new Error("projective point not allowed");let D=H=>t.eql(H,t.ZERO);return D(P)&&D(N)?h.ZERO:new h(P,N,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(A){let P=t.invertBatch(A.map(N=>N.pz));return A.map((N,D)=>N.toAffine(P[D])).map(h.fromAffine)}static fromHex(A){let P=h.fromAffine(i(bt("pointHex",A)));return P.assertValidity(),P}static fromPrivateKey(A){return h.BASE.multiply(a(A))}_setWindowSize(A){this._WINDOW_SIZE=A,m.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:A,y:P}=this.toAffine();if(!t.isValid(A)||!t.isValid(P))throw new Error("bad point: x or y not FE");let N=t.sqr(P),D=s(A);if(!t.eql(N,D))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:A}=this.toAffine();if(t.isOdd)return!t.isOdd(A);throw new Error("Field doesn't support isOdd")}equals(A){E(A);let{px:P,py:N,pz:D}=this,{px:H,py:z,pz:k}=A,F=t.eql(t.mul(P,k),t.mul(H,D)),C=t.eql(t.mul(N,k),t.mul(z,D));return F&&C}negate(){return new h(this.px,t.neg(this.py),this.pz)}double(){let{a:A,b:P}=e,N=t.mul(P,Bn),{px:D,py:H,pz:z}=this,k=t.ZERO,F=t.ZERO,C=t.ZERO,Y=t.mul(D,D),q=t.mul(H,H),J=t.mul(z,z),Z=t.mul(D,H);return Z=t.add(Z,Z),C=t.mul(D,z),C=t.add(C,C),k=t.mul(A,C),F=t.mul(N,J),F=t.add(k,F),k=t.sub(q,F),F=t.add(q,F),F=t.mul(k,F),k=t.mul(Z,k),C=t.mul(N,C),J=t.mul(A,J),Z=t.sub(Y,J),Z=t.mul(A,Z),Z=t.add(Z,C),C=t.add(Y,Y),Y=t.add(C,Y),Y=t.add(Y,J),Y=t.mul(Y,Z),F=t.add(F,Y),J=t.mul(H,z),J=t.add(J,J),Y=t.mul(J,Z),k=t.sub(k,Y),C=t.mul(J,q),C=t.add(C,C),C=t.add(C,C),new h(k,F,C)}add(A){E(A);let{px:P,py:N,pz:D}=this,{px:H,py:z,pz:k}=A,F=t.ZERO,C=t.ZERO,Y=t.ZERO,q=e.a,J=t.mul(e.b,Bn),Z=t.mul(P,H),te=t.mul(N,z),ce=t.mul(D,k),me=t.add(P,N),ue=t.add(H,z);me=t.mul(me,ue),ue=t.add(Z,te),me=t.sub(me,ue),ue=t.add(P,D);let $=t.add(H,k);return ue=t.mul(ue,$),$=t.add(Z,ce),ue=t.sub(ue,$),$=t.add(N,D),F=t.add(z,k),$=t.mul($,F),F=t.add(te,ce),$=t.sub($,F),Y=t.mul(q,ue),F=t.mul(J,ce),Y=t.add(F,Y),F=t.sub(te,Y),Y=t.add(te,Y),C=t.mul(F,Y),te=t.add(Z,Z),te=t.add(te,Z),ce=t.mul(q,ce),ue=t.mul(J,ue),te=t.add(te,ce),ce=t.sub(Z,ce),ce=t.mul(q,ce),ue=t.add(ue,ce),Z=t.mul(te,ue),C=t.add(C,Z),Z=t.mul($,ue),F=t.mul(me,F),F=t.sub(F,Z),Z=t.mul(me,te),Y=t.mul($,Y),Y=t.add(Y,Z),new h(F,C,Y)}subtract(A){return this.add(A.negate())}is0(){return this.equals(h.ZERO)}wNAF(A){return B.wNAFCached(this,m,A,P=>{let N=t.invertBatch(P.map(D=>D.pz));return P.map((D,H)=>D.toAffine(N[H])).map(h.fromAffine)})}multiplyUnsafe(A){let P=h.ZERO;if(A===zt)return P;if(f(A),A===He)return this;let{endo:N}=e;if(!N)return B.unsafeLadder(this,A);let{k1neg:D,k1:H,k2neg:z,k2:k}=N.splitScalar(A),F=P,C=P,Y=this;for(;H>zt||k>zt;)H&He&&(F=F.add(Y)),k&He&&(C=C.add(Y)),Y=Y.double(),H>>=He,k>>=He;return D&&(F=F.negate()),z&&(C=C.negate()),C=new h(t.mul(C.px,N.beta),C.py,C.pz),F.add(C)}multiply(A){f(A);let P=A,N,D,{endo:H}=e;if(H){let{k1neg:z,k1:k,k2neg:F,k2:C}=H.splitScalar(P),{p:Y,f:q}=this.wNAF(k),{p:J,f:Z}=this.wNAF(C);Y=B.constTimeNegate(z,Y),J=B.constTimeNegate(F,J),J=new h(t.mul(J.px,H.beta),J.py,J.pz),N=Y.add(J),D=q.add(Z)}else{let{p:z,f:k}=this.wNAF(P);N=z,D=k}return h.normalizeZ([N,D])[0]}multiplyAndAddUnsafe(A,P,N){let D=h.BASE,H=(k,F)=>F===zt||F===He||!k.equals(D)?k.multiplyUnsafe(F):k.multiply(F),z=H(this,P).add(H(A,N));return z.is0()?void 0:z}toAffine(A){let{px:P,py:N,pz:D}=this,H=this.is0();A==null&&(A=H?t.ONE:t.inv(D));let z=t.mul(P,A),k=t.mul(N,A),F=t.mul(D,A);if(H)return{x:t.ZERO,y:t.ZERO};if(!t.eql(F,t.ONE))throw new Error("invZ was invalid");return{x:z,y:k}}isTorsionFree(){let{h:A,isTorsionFree:P}=e;if(A===He)return!0;if(P)return P(h,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:A,clearCofactor:P}=e;return A===He?this:P?P(h,this):this.multiplyUnsafe(e.h)}toRawBytes(A=!0){return this.assertValidity(),n(h,this,A)}toHex(A=!0){return At(this.toRawBytes(A))}}h.BASE=new h(e.Gx,e.Gy,t.ONE),h.ZERO=new h(t.ZERO,t.ONE,t.ZERO);let O=e.nBitLength,B=oa(h,e.endo?Math.ceil(O/2):O);return{CURVE:e,ProjectivePoint:h,normPrivateKeyToScalar:a,weierstrassEquation:s,isWithinCurveOrder:o}}function bu(r,e){let t=r.ORDER,n=zt;for(let v=t-He;v%kt===zt;v/=kt)n+=He;let i=n,s=kt<<i-He-He,o=s*kt,f=(t-He)/o,a=(f-He)/kt,m=o-He,E=s,h=r.pow(e,f),O=r.pow(e,(f+He)/kt),B=(v,A)=>{let P=h,N=r.pow(A,m),D=r.sqr(N);D=r.mul(D,A);let H=r.mul(v,D);H=r.pow(H,a),H=r.mul(H,N),N=r.mul(H,A),D=r.mul(H,v);let z=r.mul(D,N);H=r.pow(z,E);let k=r.eql(H,r.ONE);N=r.mul(D,O),H=r.mul(z,P),D=r.cmov(N,D,k),z=r.cmov(H,z,k);for(let F=i;F>He;F--){let C=F-kt;C=kt<<C-He;let Y=r.pow(z,C),q=r.eql(Y,r.ONE);N=r.mul(D,P),P=r.mul(P,P),Y=r.mul(z,P),D=r.cmov(N,D,q),z=r.cmov(Y,z,q)}return{isValid:k,value:D}};if(r.ORDER%ca===Bn){let v=(r.ORDER-Bn)/ca,A=r.sqrt(r.neg(e));B=(P,N)=>{let D=r.sqr(N),H=r.mul(P,N);D=r.mul(D,H);let z=r.pow(D,v);z=r.mul(z,H);let k=r.mul(z,A),F=r.mul(r.sqr(z),N),C=r.eql(F,P),Y=r.cmov(k,z,C);return{isValid:C,value:Y}}}return B}function Vi(r,e){if(_n(r),!r.isValid(e.A)||!r.isValid(e.B)||!r.isValid(e.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");let t=bu(r,e.Z);if(!r.isOdd)throw new Error("Fp.isOdd is not implemented!");return n=>{let i,s,o,f,a,m,E,h;i=r.sqr(n),i=r.mul(i,e.Z),s=r.sqr(i),s=r.add(s,i),o=r.add(s,r.ONE),o=r.mul(o,e.B),f=r.cmov(e.Z,r.neg(s),!r.eql(s,r.ZERO)),f=r.mul(f,e.A),s=r.sqr(o),m=r.sqr(f),a=r.mul(m,e.A),s=r.add(s,a),s=r.mul(s,o),m=r.mul(m,f),a=r.mul(m,e.B),s=r.add(s,a),E=r.mul(i,o);let{isValid:O,value:B}=t(s,m);h=r.mul(i,n),h=r.mul(h,B),E=r.cmov(E,o,O),h=r.cmov(h,B,O);let v=r.isOdd(n)===r.isOdd(h);return h=r.cmov(r.neg(h),h,v),E=r.div(E,f),{x:E,y:h}}}var Yi=BigInt(2),vn=BigInt(3);function fa(r){let{Fp:e,Fr:t,Fp2:n,Fp6:i,Fp12:s}=r.fields,o=Lt(r.params.x);function f($){let{x:ee,y:Q}=$,re=ee,fe=Q,ge=n.ONE,Ie=re,R=fe,g=ge,Ue=[];for(let Re=o-2;Re>=0;Re--){let ye=n.sqr(R),j=n.sqr(g),c=n.multiplyByB(n.mul(j,vn)),u=n.mul(c,vn),l=n.sub(n.sub(n.sqr(n.add(R,g)),j),ye);if(Ue.push([n.sub(c,ye),n.mul(n.sqr(Ie),vn),n.neg(l)]),Ie=n.div(n.mul(n.mul(n.sub(ye,u),Ie),R),Yi),R=n.sub(n.sqr(n.div(n.add(ye,u),Yi)),n.mul(n.sqr(c),vn)),g=n.mul(ye,l),sr(r.params.x,Re)){let _=n.sub(R,n.mul(fe,g)),y=n.sub(Ie,n.mul(re,g));Ue.push([n.sub(n.mul(_,re),n.mul(y,fe)),n.neg(_),y]);let x=n.sqr(y),T=n.mul(x,y),p=n.mul(x,Ie),w=n.add(n.sub(T,n.mul(p,Yi)),n.mul(n.sqr(_),g));Ie=n.mul(y,w),R=n.sub(n.mul(n.sub(p,w),_),n.mul(T,R)),g=n.mul(g,T)}}return Ue}function a($,ee){let{x:Q}=r.params,re=ee[0],fe=ee[1],ge=s.ONE;for(let Ie=0,R=o-2;R>=0;R--,Ie++){let g=$[Ie];if(ge=s.multiplyBy014(ge,g[0],n.mul(g[1],re),n.mul(g[2],fe)),sr(Q,R)){Ie+=1;let Ue=$[Ie];ge=s.multiplyBy014(ge,Ue[0],n.mul(Ue[1],re),n.mul(Ue[2],fe))}R!==0&&(ge=s.sqr(ge))}return s.conjugate(ge)}let m={randomPrivateKey:()=>{let $=In(t.ORDER);return Di(r.randomBytes($),t.ORDER)},calcPairingPrecomputes:f},E=Gi({n:t.ORDER,...r.G1}),h=Object.assign(E,$i(E.ProjectivePoint,r.G1.mapToCurve,{...r.htfDefaults,...r.G1.htfDefaults}));function O($){let ee=$;return ee._PPRECOMPUTES||(ee._PPRECOMPUTES=f($.toAffine())),ee._PPRECOMPUTES}let B=Gi({n:t.ORDER,...r.G2}),v=Object.assign(B,$i(B.ProjectivePoint,r.G2.mapToCurve,{...r.htfDefaults,...r.G2.htfDefaults})),{ShortSignature:A}=r.G1,{Signature:P}=r.G2;function N($,ee,Q=!0){if($.equals(h.ProjectivePoint.ZERO)||ee.equals(v.ProjectivePoint.ZERO))throw new Error("pairing is not available for ZERO point");$.assertValidity(),ee.assertValidity();let re=$.toAffine(),fe=a(O(ee),[re.x,re.y]);return Q?s.finalExponentiate(fe):fe}function D($){return $ instanceof h.ProjectivePoint?$:h.ProjectivePoint.fromHex($)}function H($,ee){return $ instanceof h.ProjectivePoint?$:h.hashToCurve(bt("point",$),ee)}function z($){return $ instanceof v.ProjectivePoint?$:P.fromHex($)}function k($,ee){return $ instanceof v.ProjectivePoint?$:v.hashToCurve(bt("point",$),ee)}function F($){return h.ProjectivePoint.fromPrivateKey($).toRawBytes(!0)}function C($){return v.ProjectivePoint.fromPrivateKey($).toRawBytes(!0)}function Y($,ee,Q){let re=k($,Q);re.assertValidity();let fe=re.multiply(h.normPrivateKeyToScalar(ee));return $ instanceof v.ProjectivePoint?fe:P.toRawBytes(fe)}function q($,ee,Q){let re=H($,Q);re.assertValidity();let fe=re.multiply(h.normPrivateKeyToScalar(ee));return $ instanceof h.ProjectivePoint?fe:A.toRawBytes(fe)}function J($,ee,Q,re){let fe=D(Q),ge=k(ee,re),Ie=h.ProjectivePoint.BASE,R=z($),g=N(fe.negate(),ge,!1),Ue=N(Ie,R,!1),Re=s.finalExponentiate(s.mul(Ue,g));return s.eql(Re,s.ONE)}function Z($,ee,Q,re){let fe=z(Q),ge=H(ee,re),Ie=v.ProjectivePoint.BASE,R=D($),g=N(ge,fe,!1),Ue=N(R,Ie.negate(),!1),Re=s.finalExponentiate(s.mul(Ue,g));return s.eql(Re,s.ONE)}function te($){if(!$.length)throw new Error("Expected non-empty array");let Q=$.map(D).reduce((re,fe)=>re.add(fe),h.ProjectivePoint.ZERO);return $[0]instanceof h.ProjectivePoint?(Q.assertValidity(),Q):Q.toRawBytes(!0)}function ce($){if(!$.length)throw new Error("Expected non-empty array");let Q=$.map(z).reduce((re,fe)=>re.add(fe),v.ProjectivePoint.ZERO);return $[0]instanceof v.ProjectivePoint?(Q.assertValidity(),Q):P.toRawBytes(Q)}function me($){if(!$.length)throw new Error("Expected non-empty array");let Q=$.map(D).reduce((re,fe)=>re.add(fe),h.ProjectivePoint.ZERO);return $[0]instanceof h.ProjectivePoint?(Q.assertValidity(),Q):A.toRawBytes(Q)}function ue($,ee,Q,re){if(!ee.length)throw new Error("Expected non-empty messages array");if(Q.length!==ee.length)throw new Error("Pubkey count should equal msg count");let fe=z($),ge=ee.map(R=>k(R,re)),Ie=Q.map(D);try{let R=[];for(let Re of new Set(ge)){let ye=ge.reduce((j,c,u)=>c===Re?j.add(Ie[u]):j,h.ProjectivePoint.ZERO);R.push(N(ye,Re,!1))}R.push(N(h.ProjectivePoint.BASE.negate(),fe,!1));let g=R.reduce((Re,ye)=>s.mul(Re,ye),s.ONE),Ue=s.finalExponentiate(g);return s.eql(Ue,s.ONE)}catch{return!1}}return h.ProjectivePoint.BASE._setWindowSize(4),{getPublicKey:F,getPublicKeyForShortSignatures:C,sign:Y,signShortSignature:q,verify:J,verifyBatch:ue,verifyShortSignature:Z,aggregatePublicKeys:te,aggregateSignatures:ce,aggregateShortSignatures:me,millerLoop:a,pairing:N,G1:h,G2:v,Signature:P,ShortSignature:A,fields:{Fr:t,Fp:e,Fp2:n,Fp6:i,Fp12:s},params:{x:r.params.x,r:r.params.r,G1b:r.G1.b,G2b:r.G2.b},utils:m}}var Le=BigInt(0),Zt=BigInt(1),Ae=BigInt(2),An=BigInt(3),Ar=BigInt(4),gu=BigInt(8),mu=BigInt(16),Zi=BigInt("0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab"),U=Mi(Zi),ua=Mi(BigInt("0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001")),la=({c0:r,c1:e},{c0:t,c1:n})=>({c0:U.add(r,t),c1:U.add(e,n)}),da=({c0:r,c1:e},{c0:t,c1:n})=>({c0:U.sub(r,t),c1:U.sub(e,n)}),ha=({c0:r,c1:e},t)=>{if(typeof t=="bigint")return{c0:U.mul(r,t),c1:U.mul(e,t)};let{c0:n,c1:i}=t,s=U.mul(r,n),o=U.mul(e,i),f=U.sub(s,o),a=U.sub(U.mul(U.add(r,e),U.add(n,i)),U.add(s,o));return{c0:f,c1:a}},pa=({c0:r,c1:e})=>{let t=U.add(r,e),n=U.sub(r,e),i=U.add(r,r);return{c0:U.mul(t,n),c1:U.mul(i,e)}},Sn=Zi*Zi,d={ORDER:Sn,BITS:Lt(Sn),BYTES:Math.ceil(Lt(Sn)/8),MASK:Mt(Lt(Sn)),ZERO:{c0:U.ZERO,c1:U.ZERO},ONE:{c0:U.ONE,c1:U.ZERO},create:r=>r,isValid:({c0:r,c1:e})=>typeof r=="bigint"&&typeof e=="bigint",is0:({c0:r,c1:e})=>U.is0(r)&&U.is0(e),eql:({c0:r,c1:e},{c0:t,c1:n})=>U.eql(r,t)&&U.eql(e,n),neg:({c0:r,c1:e})=>({c0:U.neg(r),c1:U.neg(e)}),pow:(r,e)=>Br(d,r,e),invertBatch:r=>vr(d,r),add:la,sub:da,mul:ha,sqr:pa,addN:la,subN:da,mulN:ha,sqrN:pa,div:(r,e)=>d.mul(r,typeof e=="bigint"?U.inv(U.create(e)):d.inv(e)),inv:({c0:r,c1:e})=>{let t=U.inv(U.create(r*r+e*e));return{c0:U.mul(t,U.create(r)),c1:U.mul(t,U.create(-e))}},sqrt:r=>{if(d.eql(r,d.ZERO))return d.ZERO;let e=d.pow(r,(d.ORDER+gu)/mu),t=d.div(d.sqr(e),r),n=wu,i=[n[0],n[2],n[4],n[6]].find(B=>d.eql(B,t));if(!i)throw new Error("No root");let s=n.indexOf(i),o=n[s/2];if(!o)throw new Error("Invalid root");let f=d.div(e,o),a=d.neg(f),{re:m,im:E}=d.reim(f),{re:h,im:O}=d.reim(a);return E>O||E===O&&m>h?f:a},isOdd:r=>{let{re:e,im:t}=d.reim(r),n=e%Ae,i=e===Le,s=t%Ae;return BigInt(n||i&&s)==Zt},fromBytes(r){if(r.length!==d.BYTES)throw new Error(`fromBytes wrong length=${r.length}`);return{c0:U.fromBytes(r.subarray(0,U.BYTES)),c1:U.fromBytes(r.subarray(U.BYTES))}},toBytes:({c0:r,c1:e})=>ve(U.toBytes(r),U.toBytes(e)),cmov:({c0:r,c1:e},{c0:t,c1:n},i)=>({c0:U.cmov(r,t,i),c1:U.cmov(e,n,i)}),reim:({c0:r,c1:e})=>({re:r,im:e}),mulByNonresidue:({c0:r,c1:e})=>({c0:U.sub(r,e),c1:U.add(r,e)}),multiplyByB:({c0:r,c1:e})=>{let t=U.mul(r,Ar),n=U.mul(e,Ar);return{c0:U.sub(t,n),c1:U.add(t,n)}},fromBigTuple:r=>{if(r.length!==2)throw new Error("Invalid tuple");let e=r.map(t=>U.create(t));return{c0:e[0],c1:e[1]}},frobeniusMap:({c0:r,c1:e},t)=>({c0:r,c1:U.mul(e,yu[t%2])})},yu=[BigInt("0x1"),BigInt("0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa")].map(r=>U.create(r)),qt=BigInt("0x6af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09"),wu=[[Zt,Le],[qt,-qt],[Le,Zt],[qt,qt],[-Zt,Le],[-qt,qt],[Le,-Zt],[-qt,-qt]].map(r=>d.fromBigTuple(r)),ba=({c0:r,c1:e,c2:t},{c0:n,c1:i,c2:s})=>({c0:d.add(r,n),c1:d.add(e,i),c2:d.add(t,s)}),ga=({c0:r,c1:e,c2:t},{c0:n,c1:i,c2:s})=>({c0:d.sub(r,n),c1:d.sub(e,i),c2:d.sub(t,s)}),ma=({c0:r,c1:e,c2:t},n)=>{if(typeof n=="bigint")return{c0:d.mul(r,n),c1:d.mul(e,n),c2:d.mul(t,n)};let{c0:i,c1:s,c2:o}=n,f=d.mul(r,i),a=d.mul(e,s),m=d.mul(t,o);return{c0:d.add(f,d.mulByNonresidue(d.sub(d.mul(d.add(e,t),d.add(s,o)),d.add(a,m)))),c1:d.add(d.sub(d.mul(d.add(r,e),d.add(i,s)),d.add(f,a)),d.mulByNonresidue(m)),c2:d.sub(d.add(a,d.mul(d.add(r,t),d.add(i,o))),d.add(f,m))}},ya=({c0:r,c1:e,c2:t})=>{let n=d.sqr(r),i=d.mul(d.mul(r,e),Ae),s=d.mul(d.mul(e,t),Ae),o=d.sqr(t);return{c0:d.add(d.mulByNonresidue(s),n),c1:d.add(d.mulByNonresidue(o),i),c2:d.sub(d.sub(d.add(d.add(i,d.sqr(d.add(d.sub(r,e),t))),s),n),o)}},V={ORDER:d.ORDER,BITS:3*d.BITS,BYTES:3*d.BYTES,MASK:Mt(3*d.BITS),ZERO:{c0:d.ZERO,c1:d.ZERO,c2:d.ZERO},ONE:{c0:d.ONE,c1:d.ZERO,c2:d.ZERO},create:r=>r,isValid:({c0:r,c1:e,c2:t})=>d.isValid(r)&&d.isValid(e)&&d.isValid(t),is0:({c0:r,c1:e,c2:t})=>d.is0(r)&&d.is0(e)&&d.is0(t),neg:({c0:r,c1:e,c2:t})=>({c0:d.neg(r),c1:d.neg(e),c2:d.neg(t)}),eql:({c0:r,c1:e,c2:t},{c0:n,c1:i,c2:s})=>d.eql(r,n)&&d.eql(e,i)&&d.eql(t,s),sqrt:()=>{throw new Error("Not implemented")},div:(r,e)=>V.mul(r,typeof e=="bigint"?U.inv(U.create(e)):V.inv(e)),pow:(r,e)=>Br(V,r,e),invertBatch:r=>vr(V,r),add:ba,sub:ga,mul:ma,sqr:ya,addN:ba,subN:ga,mulN:ma,sqrN:ya,inv:({c0:r,c1:e,c2:t})=>{let n=d.sub(d.sqr(r),d.mulByNonresidue(d.mul(t,e))),i=d.sub(d.mulByNonresidue(d.sqr(t)),d.mul(r,e)),s=d.sub(d.sqr(e),d.mul(r,t)),o=d.inv(d.add(d.mulByNonresidue(d.add(d.mul(t,i),d.mul(e,s))),d.mul(r,n)));return{c0:d.mul(o,n),c1:d.mul(o,i),c2:d.mul(o,s)}},fromBytes:r=>{if(r.length!==V.BYTES)throw new Error(`fromBytes wrong length=${r.length}`);return{c0:d.fromBytes(r.subarray(0,d.BYTES)),c1:d.fromBytes(r.subarray(d.BYTES,2*d.BYTES)),c2:d.fromBytes(r.subarray(2*d.BYTES))}},toBytes:({c0:r,c1:e,c2:t})=>ve(d.toBytes(r),d.toBytes(e),d.toBytes(t)),cmov:({c0:r,c1:e,c2:t},{c0:n,c1:i,c2:s},o)=>({c0:d.cmov(r,n,o),c1:d.cmov(e,i,o),c2:d.cmov(t,s,o)}),fromBigSix:r=>{if(!Array.isArray(r)||r.length!==6)throw new Error("Invalid Fp6 usage");return{c0:d.fromBigTuple(r.slice(0,2)),c1:d.fromBigTuple(r.slice(2,4)),c2:d.fromBigTuple(r.slice(4,6))}},frobeniusMap:({c0:r,c1:e,c2:t},n)=>({c0:d.frobeniusMap(r,n),c1:d.mul(d.frobeniusMap(e,n),xu[n%6]),c2:d.mul(d.frobeniusMap(t,n),Eu[n%6])}),mulByNonresidue:({c0:r,c1:e,c2:t})=>({c0:d.mulByNonresidue(t),c1:r,c2:e}),multiplyBy1:({c0:r,c1:e,c2:t},n)=>({c0:d.mulByNonresidue(d.mul(t,n)),c1:d.mul(r,n),c2:d.mul(e,n)}),multiplyBy01({c0:r,c1:e,c2:t},n,i){let s=d.mul(r,n),o=d.mul(e,i);return{c0:d.add(d.mulByNonresidue(d.sub(d.mul(d.add(e,t),i),o)),s),c1:d.sub(d.sub(d.mul(d.add(n,i),d.add(r,e)),s),o),c2:d.add(d.sub(d.mul(d.add(r,t),n),s),o)}},multiplyByFp2:({c0:r,c1:e,c2:t},n)=>({c0:d.mul(r,n),c1:d.mul(e,n),c2:d.mul(t,n)})},xu=[[BigInt("0x1"),BigInt("0x0")],[BigInt("0x0"),BigInt("0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac")],[BigInt("0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe"),BigInt("0x0")],[BigInt("0x0"),BigInt("0x1")],[BigInt("0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac"),BigInt("0x0")],[BigInt("0x0"),BigInt("0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe")]].map(r=>d.fromBigTuple(r)),Eu=[[BigInt("0x1"),BigInt("0x0")],[BigInt("0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaad"),BigInt("0x0")],[BigInt("0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac"),BigInt("0x0")],[BigInt("0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa"),BigInt("0x0")],[BigInt("0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe"),BigInt("0x0")],[BigInt("0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffeffff"),BigInt("0x0")]].map(r=>d.fromBigTuple(r)),ji=BigInt("0xd201000000010000"),_u=Lt(ji),wa=({c0:r,c1:e},{c0:t,c1:n})=>({c0:V.add(r,t),c1:V.add(e,n)}),xa=({c0:r,c1:e},{c0:t,c1:n})=>({c0:V.sub(r,t),c1:V.sub(e,n)}),Ea=({c0:r,c1:e},t)=>{if(typeof t=="bigint")return{c0:V.mul(r,t),c1:V.mul(e,t)};let{c0:n,c1:i}=t,s=V.mul(r,n),o=V.mul(e,i);return{c0:V.add(s,V.mulByNonresidue(o)),c1:V.sub(V.mul(V.add(r,e),V.add(n,i)),V.add(s,o))}},_a=({c0:r,c1:e})=>{let t=V.mul(r,e);return{c0:V.sub(V.sub(V.mul(V.add(V.mulByNonresidue(e),r),V.add(r,e)),t),V.mulByNonresidue(t)),c1:V.add(t,t)}};function Hi(r,e){let t=d.sqr(r),n=d.sqr(e);return{first:d.add(d.mulByNonresidue(n),t),second:d.sub(d.sub(d.sqr(d.add(r,e)),t),n)}}var X={ORDER:d.ORDER,BITS:2*d.BITS,BYTES:2*d.BYTES,MASK:Mt(2*d.BITS),ZERO:{c0:V.ZERO,c1:V.ZERO},ONE:{c0:V.ONE,c1:V.ZERO},create:r=>r,isValid:({c0:r,c1:e})=>V.isValid(r)&&V.isValid(e),is0:({c0:r,c1:e})=>V.is0(r)&&V.is0(e),neg:({c0:r,c1:e})=>({c0:V.neg(r),c1:V.neg(e)}),eql:({c0:r,c1:e},{c0:t,c1:n})=>V.eql(r,t)&&V.eql(e,n),sqrt:()=>{throw new Error("Not implemented")},inv:({c0:r,c1:e})=>{let t=V.inv(V.sub(V.sqr(r),V.mulByNonresidue(V.sqr(e))));return{c0:V.mul(r,t),c1:V.neg(V.mul(e,t))}},div:(r,e)=>X.mul(r,typeof e=="bigint"?U.inv(U.create(e)):X.inv(e)),pow:(r,e)=>Br(X,r,e),invertBatch:r=>vr(X,r),add:wa,sub:xa,mul:Ea,sqr:_a,addN:wa,subN:xa,mulN:Ea,sqrN:_a,fromBytes:r=>{if(r.length!==X.BYTES)throw new Error(`fromBytes wrong length=${r.length}`);return{c0:V.fromBytes(r.subarray(0,V.BYTES)),c1:V.fromBytes(r.subarray(V.BYTES))}},toBytes:({c0:r,c1:e})=>ve(V.toBytes(r),V.toBytes(e)),cmov:({c0:r,c1:e},{c0:t,c1:n},i)=>({c0:V.cmov(r,t,i),c1:V.cmov(e,n,i)}),fromBigTwelve:r=>({c0:V.fromBigSix(r.slice(0,6)),c1:V.fromBigSix(r.slice(6,12))}),frobeniusMap(r,e){let t=V.frobeniusMap(r.c0,e),{c0:n,c1:i,c2:s}=V.frobeniusMap(r.c1,e),o=Iu[e%12];return{c0:t,c1:V.create({c0:d.mul(n,o),c1:d.mul(i,o),c2:d.mul(s,o)})}},multiplyBy014:({c0:r,c1:e},t,n,i)=>{let s=V.multiplyBy01(r,t,n),o=V.multiplyBy1(e,i);return{c0:V.add(V.mulByNonresidue(o),s),c1:V.sub(V.sub(V.multiplyBy01(V.add(e,r),t,d.add(n,i)),s),o)}},multiplyByFp2:({c0:r,c1:e},t)=>({c0:V.multiplyByFp2(r,t),c1:V.multiplyByFp2(e,t)}),conjugate:({c0:r,c1:e})=>({c0:r,c1:V.neg(e)}),_cyclotomicSquare:({c0:r,c1:e})=>{let{c0:t,c1:n,c2:i}=r,{c0:s,c1:o,c2:f}=e,{first:a,second:m}=Hi(t,o),{first:E,second:h}=Hi(s,i),{first:O,second:B}=Hi(n,f),v=d.mulByNonresidue(B);return{c0:V.create({c0:d.add(d.mul(d.sub(a,t),Ae),a),c1:d.add(d.mul(d.sub(E,n),Ae),E),c2:d.add(d.mul(d.sub(O,i),Ae),O)}),c1:V.create({c0:d.add(d.mul(d.add(v,s),Ae),v),c1:d.add(d.mul(d.add(m,o),Ae),m),c2:d.add(d.mul(d.add(h,f),Ae),h)})}},_cyclotomicExp(r,e){let t=X.ONE;for(let n=_u-1;n>=0;n--)t=X._cyclotomicSquare(t),sr(e,n)&&(t=X.mul(t,r));return t},finalExponentiate:r=>{let e=ji,t=X.div(X.frobeniusMap(r,6),r),n=X.mul(X.frobeniusMap(t,2),t),i=X.conjugate(X._cyclotomicExp(n,e)),s=X.mul(X.conjugate(X._cyclotomicSquare(n)),i),o=X.conjugate(X._cyclotomicExp(s,e)),f=X.conjugate(X._cyclotomicExp(o,e)),a=X.mul(X.conjugate(X._cyclotomicExp(f,e)),X._cyclotomicSquare(i)),m=X.conjugate(X._cyclotomicExp(a,e)),E=X.frobeniusMap(X.mul(i,f),2),h=X.frobeniusMap(X.mul(o,n),3),O=X.frobeniusMap(X.mul(a,X.conjugate(n)),1),B=X.mul(X.mul(m,X.conjugate(s)),n);return X.mul(X.mul(X.mul(E,h),O),B)}},Iu=[[BigInt("0x1"),BigInt("0x0")],[BigInt("0x1904d3bf02bb0667c231beb4202c0d1f0fd603fd3cbd5f4f7b2443d784bab9c4f67ea53d63e7813d8d0775ed92235fb8"),BigInt("0x00fc3e2b36c4e03288e9e902231f9fb854a14787b6c7b36fec0c8ec971f63c5f282d5ac14d6c7ec22cf78a126ddc4af3")],[BigInt("0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffeffff"),BigInt("0x0")],[BigInt("0x135203e60180a68ee2e9c448d77a2cd91c3dedd930b1cf60ef396489f61eb45e304466cf3e67fa0af1ee7b04121bdea2"),BigInt("0x06af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09")],[BigInt("0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe"),BigInt("0x0")],[BigInt("0x144e4211384586c16bd3ad4afa99cc9170df3560e77982d0db45f3536814f0bd5871c1908bd478cd1ee605167ff82995"),BigInt("0x05b2cfd9013a5fd8df47fa6b48b1e045f39816240c0b8fee8beadf4d8e9c0566c63a3e6e257f87329b18fae980078116")],[BigInt("0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa"),BigInt("0x0")],[BigInt("0x00fc3e2b36c4e03288e9e902231f9fb854a14787b6c7b36fec0c8ec971f63c5f282d5ac14d6c7ec22cf78a126ddc4af3"),BigInt("0x1904d3bf02bb0667c231beb4202c0d1f0fd603fd3cbd5f4f7b2443d784bab9c4f67ea53d63e7813d8d0775ed92235fb8")],[BigInt("0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac"),BigInt("0x0")],[BigInt("0x06af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09"),BigInt("0x135203e60180a68ee2e9c448d77a2cd91c3dedd930b1cf60ef396489f61eb45e304466cf3e67fa0af1ee7b04121bdea2")],[BigInt("0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaad"),BigInt("0x0")],[BigInt("0x05b2cfd9013a5fd8df47fa6b48b1e045f39816240c0b8fee8beadf4d8e9c0566c63a3e6e257f87329b18fae980078116"),BigInt("0x144e4211384586c16bd3ad4afa99cc9170df3560e77982d0db45f3536814f0bd5871c1908bd478cd1ee605167ff82995")]].map(r=>d.fromBigTuple(r)),Bu=qi(d,[[["0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6","0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6"],["0x0","0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71a"],["0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71e","0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38d"],["0x171d6541fa38ccfaed6dea691f5fb614cb14b4e7f4e810aa22d6108f142b85757098e38d0f671c7188e2aaaaaaaa5ed1","0x0"]],[["0x0","0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa63"],["0xc","0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa9f"],["0x1","0x0"]],[["0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706","0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706"],["0x0","0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97be"],["0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71c","0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38f"],["0x124c9ad43b6cf79bfbf7043de3811ad0761b0f37a1e26286b0e977c69aa274524e79097a56dc4bd9e1b371c71c718b10","0x0"]],[["0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb","0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb"],["0x0","0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa9d3"],["0x12","0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa99"],["0x1","0x0"]]].map(r=>r.map(e=>d.fromBigTuple(e.map(BigInt))))),vu=qi(U,[["0x11a05f2b1e833340b809101dd99815856b303e88a2d7005ff2627b56cdb4e2c85610c2d5f2e62d6eaeac1662734649b7","0x17294ed3e943ab2f0588bab22147a81c7c17e75b2f6a8417f565e33c70d1e86b4838f2a6f318c356e834eef1b3cb83bb","0xd54005db97678ec1d1048c5d10a9a1bce032473295983e56878e501ec68e25c958c3e3d2a09729fe0179f9dac9edcb0","0x1778e7166fcc6db74e0609d307e55412d7f5e4656a8dbf25f1b33289f1b330835336e25ce3107193c5b388641d9b6861","0xe99726a3199f4436642b4b3e4118e5499db995a1257fb3f086eeb65982fac18985a286f301e77c451154ce9ac8895d9","0x1630c3250d7313ff01d1201bf7a74ab5db3cb17dd952799b9ed3ab9097e68f90a0870d2dcae73d19cd13c1c66f652983","0xd6ed6553fe44d296a3726c38ae652bfb11586264f0f8ce19008e218f9c86b2a8da25128c1052ecaddd7f225a139ed84","0x17b81e7701abdbe2e8743884d1117e53356de5ab275b4db1a682c62ef0f2753339b7c8f8c8f475af9ccb5618e3f0c88e","0x80d3cf1f9a78fc47b90b33563be990dc43b756ce79f5574a2c596c928c5d1de4fa295f296b74e956d71986a8497e317","0x169b1f8e1bcfa7c42e0c37515d138f22dd2ecb803a0c5c99676314baf4bb1b7fa3190b2edc0327797f241067be390c9e","0x10321da079ce07e272d8ec09d2565b0dfa7dccdde6787f96d50af36003b14866f69b771f8c285decca67df3f1605fb7b","0x6e08c248e260e70bd1e962381edee3d31d79d7e22c837bc23c0bf1bc24c6b68c24b1b80b64d391fa9c8ba2e8ba2d229"],["0x8ca8d548cff19ae18b2e62f4bd3fa6f01d5ef4ba35b48ba9c9588617fc8ac62b558d681be343df8993cf9fa40d21b1c","0x12561a5deb559c4348b4711298e536367041e8ca0cf0800c0126c2588c48bf5713daa8846cb026e9e5c8276ec82b3bff","0xb2962fe57a3225e8137e629bff2991f6f89416f5a718cd1fca64e00b11aceacd6a3d0967c94fedcfcc239ba5cb83e19","0x3425581a58ae2fec83aafef7c40eb545b08243f16b1655154cca8abc28d6fd04976d5243eecf5c4130de8938dc62cd8","0x13a8e162022914a80a6f1d5f43e7a07dffdfc759a12062bb8d6b44e833b306da9bd29ba81f35781d539d395b3532a21e","0xe7355f8e4e667b955390f7f0506c6e9395735e9ce9cad4d0a43bcef24b8982f7400d24bc4228f11c02df9a29f6304a5","0x772caacf16936190f3e0c63e0596721570f5799af53a1894e2e073062aede9cea73b3538f0de06cec2574496ee84a3a","0x14a7ac2a9d64a8b230b3f5b074cf01996e7f63c21bca68a81996e1cdf9822c580fa5b9489d11e2d311f7d99bbdcc5a5e","0xa10ecf6ada54f825e920b3dafc7a3cce07f8d1d7161366b74100da67f39883503826692abba43704776ec3a79a1d641","0x95fc13ab9e92ad4476d6e3eb3a56680f682b4ee96f7d03776df533978f31c1593174e4b4b7865002d6384d168ecdd0a","0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001"],["0x90d97c81ba24ee0259d1f094980dcfa11ad138e48a869522b52af6c956543d3cd0c7aee9b3ba3c2be9845719707bb33","0x134996a104ee5811d51036d776fb46831223e96c254f383d0f906343eb67ad34d6c56711962fa8bfe097e75a2e41c696","0xcc786baa966e66f4a384c86a3b49942552e2d658a31ce2c344be4b91400da7d26d521628b00523b8dfe240c72de1f6","0x1f86376e8981c217898751ad8746757d42aa7b90eeb791c09e4a3ec03251cf9de405aba9ec61deca6355c77b0e5f4cb","0x8cc03fdefe0ff135caf4fe2a21529c4195536fbe3ce50b879833fd221351adc2ee7f8dc099040a841b6daecf2e8fedb","0x16603fca40634b6a2211e11db8f0a6a074a7d0d4afadb7bd76505c3d3ad5544e203f6326c95a807299b23ab13633a5f0","0x4ab0b9bcfac1bbcb2c977d027796b3ce75bb8ca2be184cb5231413c4d634f3747a87ac2460f415ec961f8855fe9d6f2","0x987c8d5333ab86fde9926bd2ca6c674170a05bfe3bdd81ffd038da6c26c842642f64550fedfe935a15e4ca31870fb29","0x9fc4018bd96684be88c9e221e4da1bb8f3abd16679dc26c1e8b6e6a1f20cabe69d65201c78607a360370e577bdba587","0xe1bba7a1186bdb5223abde7ada14a23c42a0ca7915af6fe06985e7ed1e4d43b9b3f7055dd4eba6f2bafaaebca731c30","0x19713e47937cd1be0dfd0b8f1d43fb93cd2fcbcb6caf493fd1183e416389e61031bf3a5cce3fbafce813711ad011c132","0x18b46a908f36f6deb918c143fed2edcc523559b8aaf0c2462e6bfe7f911f643249d9cdf41b44d606ce07c8a4d0074d8e","0xb182cac101b9399d155096004f53f447aa7b12a3426b08ec02710e807b4633f06c851c1919211f20d4c04f00b971ef8","0x245a394ad1eca9b72fc00ae7be315dc757b3b080d4c158013e6632d3c40659cc6cf90ad1c232a6442d9d3f5db980133","0x5c129645e44cf1102a159f748c4a3fc5e673d81d7e86568d9ab0f5d396a7ce46ba1049b6579afb7866b1e715475224b","0x15e6be4e990f03ce4ea50b3b42df2eb5cb181d8f84965a3957add4fa95af01b2b665027efec01c7704b456be69c8b604"],["0x16112c4c3a9c98b252181140fad0eae9601a6de578980be6eec3232b5be72e7a07f3688ef60c206d01479253b03663c1","0x1962d75c2381201e1a0cbd6c43c348b885c84ff731c4d59ca4a10356f453e01f78a4260763529e3532f6102c2e49a03d","0x58df3306640da276faaae7d6e8eb15778c4855551ae7f310c35a5dd279cd2eca6757cd636f96f891e2538b53dbf67f2","0x16b7d288798e5395f20d23bf89edb4d1d115c5dbddbcd30e123da489e726af41727364f2c28297ada8d26d98445f5416","0xbe0e079545f43e4b00cc912f8228ddcc6d19c9f0f69bbb0542eda0fc9dec916a20b15dc0fd2ededda39142311a5001d","0x8d9e5297186db2d9fb266eaac783182b70152c65550d881c5ecd87b6f0f5a6449f38db9dfa9cce202c6477faaf9b7ac","0x166007c08a99db2fc3ba8734ace9824b5eecfdfa8d0cf8ef5dd365bc400a0051d5fa9c01a58b1fb93d1a1399126a775c","0x16a3ef08be3ea7ea03bcddfabba6ff6ee5a4375efa1f4fd7feb34fd206357132b920f5b00801dee460ee415a15812ed9","0x1866c8ed336c61231a1be54fd1d74cc4f9fb0ce4c6af5920abc5750c4bf39b4852cfe2f7bb9248836b233d9d55535d4a","0x167a55cda70a6e1cea820597d94a84903216f763e13d87bb5308592e7ea7d4fbc7385ea3d529b35e346ef48bb8913f55","0x4d2f259eea405bd48f010a01ad2911d9c6dd039bb61a6290e591b36e636a5c871a5c29f4f83060400f8b49cba8f6aa8","0xaccbb67481d033ff5852c1e48c50c477f94ff8aefce42d28c0f9a88cea7913516f968986f7ebbea9684b529e2561092","0xad6b9514c767fe3c3613144b45f1496543346d98adf02267d5ceef9a00d9b8693000763e3b90ac11e99b138573345cc","0x2660400eb2e4f3b628bdd0d53cd76f2bf565b94e72927c1cb748df27942480e420517bd8714cc80d1fadc1326ed06f7","0xe0fa1d816ddc03e6b24255e0d7819c171c40f65e273b853324efcd6356caa205ca2f570f13497804415473a1d634b8f","0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001"]].map(r=>r.map(e=>BigInt(e)))),Au=Vi(d,{A:d.create({c0:U.create(Le),c1:U.create(BigInt(240))}),B:d.create({c0:U.create(BigInt(1012)),c1:U.create(BigInt(1012))}),Z:d.create({c0:U.create(BigInt(-2)),c1:U.create(BigInt(-1))})}),Su=Vi(U,{A:U.create(BigInt("0x144698a3b8e9433d693a02c96d4982b0ea985383ee66a8d8e8981aefd881ac98936f8da0e0f97f5cf428082d584c1d")),B:U.create(BigInt("0x12e2908d11688030018b12e8753eee3b2016c1f0f24f4070a0b9c14fcef35ef55a23215a316ceaa5d1cc48e98e172be0")),Z:U.create(BigInt(11))}),Aa=V.create({c0:d.ZERO,c1:d.ONE,c2:d.ZERO}),Sa=X.create({c0:Aa,c1:V.ZERO}),Ta=X.create({c0:V.ZERO,c1:Aa}),[Tu,Nu]=X.invertBatch([Sa,Ta]);function Uu(r,e){let t=X.mul(X.frobeniusMap(X.multiplyByFp2(Tu,r),1),Sa).c0.c0,n=X.mul(X.frobeniusMap(X.multiplyByFp2(Nu,e),1),Ta).c0.c0;return[t,n]}function Ia(r,e){let t=e.toAffine(),n=Uu(t.x,t.y);return new r(n[0],n[1],d.ONE)}var Ru=BigInt("0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac");function Ou(r,e){return[d.mul(r,Ru),d.neg(e)]}function Fu(r,e){let t=e.toAffine(),n=Ou(t.x,t.y);return new r(n[0],n[1],d.ONE)}var zi=Object.freeze({DST:"BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_",encodeDST:"BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_",p:U.ORDER,m:2,k:128,expand:"xmd",hash:ur}),Nn=Sr(U.toBytes(Le),{infinity:!0,compressed:!0});function Tn(r){r=r.slice();let e=r[0]&224,t=!!(e>>7&1),n=!!(e>>6&1),i=!!(e>>5&1);return r[0]&=31,{compressed:t,infinity:n,sort:i,value:r}}function Sr(r,e){if(r[0]&224)throw new Error("setMask: non-empty mask");return e.compressed&&(r[0]|=128),e.infinity&&(r[0]|=64),e.sort&&(r[0]|=32),r}function Ba(r){r.assertValidity();let e=r.equals(ze.G1.ProjectivePoint.ZERO),{x:t,y:n}=r.toAffine();if(e)return Nn.slice();let i=U.ORDER,s=!!(n*Ae/i);return Sr(Ne(t,U.BYTES),{compressed:!0,sort:s})}function va(r){r.assertValidity();let e=U.BYTES;if(r.equals(ze.G2.ProjectivePoint.ZERO))return ve(Nn,Ne(Le,e));let{x:t,y:n}=r.toAffine(),{re:i,im:s}=d.reim(t),{re:o,im:f}=d.reim(n),m=!!((f>Le?f*Ae:o*Ae)/U.ORDER&Zt),E=i;return ve(Sr(Ne(s,e),{sort:m,compressed:!0}),Ne(E,e))}var ze=fa({fields:{Fp:U,Fp2:d,Fp6:V,Fp12:X,Fr:ua},G1:{Fp:U,h:BigInt("0x396c8c005555e1568c00aaab0000aaab"),Gx:BigInt("0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb"),Gy:BigInt("0x08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1"),a:U.ZERO,b:Ar,htfDefaults:{...zi,m:1,DST:"BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"},wrapPrivateKey:!0,allowInfinityPoint:!0,isTorsionFree:(r,e)=>{let t=BigInt("0x5f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe"),n=new r(U.mul(e.px,t),e.py,e.pz);return e.multiplyUnsafe(ze.params.x).negate().multiplyUnsafe(ze.params.x).equals(n)},clearCofactor:(r,e)=>e.multiplyUnsafe(ze.params.x).add(e),mapToCurve:r=>{let{x:e,y:t}=Su(U.create(r[0]));return vu(e,t)},fromBytes:r=>{let{compressed:e,infinity:t,sort:n,value:i}=Tn(r);if(i.length===48&&e){let s=U.ORDER,o=je(i),f=U.create(o&U.MASK);if(t){if(f!==Le)throw new Error("G1: non-empty compressed point at infinity");return{x:Le,y:Le}}let a=U.add(U.pow(f,An),U.create(ze.params.G1b)),m=U.sqrt(a);if(!m)throw new Error("Invalid compressed G1 point");return m*Ae/s!==BigInt(n)&&(m=U.neg(m)),{x:U.create(f),y:U.create(m)}}else if(i.length===96&&!e){let s=je(i.subarray(0,U.BYTES)),o=je(i.subarray(U.BYTES));if(t){if(s!==Le||o!==Le)throw new Error("G1: non-empty point at infinity");return ze.G1.ProjectivePoint.ZERO.toAffine()}return{x:U.create(s),y:U.create(o)}}else throw new Error("Invalid point G1, expected 48/96 bytes")},toBytes:(r,e,t)=>{let n=e.equals(r.ZERO),{x:i,y:s}=e.toAffine();if(t){if(n)return Nn.slice();let o=U.ORDER,f=!!(s*Ae/o);return Sr(Ne(i,U.BYTES),{compressed:!0,sort:f})}else return n?ve(new Uint8Array([64]),new Uint8Array(2*U.BYTES-1)):ve(Ne(i,U.BYTES),Ne(s,U.BYTES))},ShortSignature:{fromHex(r){let{infinity:e,sort:t,value:n}=Tn(bt("signatureHex",r,48)),i=U.ORDER,s=je(n);if(e)return ze.G1.ProjectivePoint.ZERO;let o=U.create(s&U.MASK),f=U.add(U.pow(o,An),U.create(ze.params.G1b)),a=U.sqrt(f);if(!a)throw new Error("Invalid compressed G1 point");let m=BigInt(t);a*Ae/i!==m&&(a=U.neg(a));let E=ze.G1.ProjectivePoint.fromAffine({x:o,y:a});return E.assertValidity(),E},toRawBytes(r){return Ba(r)},toHex(r){return At(Ba(r))}}},G2:{Fp:d,h:BigInt("0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5"),Gx:d.fromBigTuple([BigInt("0x024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8"),BigInt("0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e")]),Gy:d.fromBigTuple([BigInt("0x0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801"),BigInt("0x0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be")]),a:d.ZERO,b:d.fromBigTuple([Ar,Ar]),hEff:BigInt("0xbc69f08f2ee75b3584c6a0ea91b352888e2a8e9145ad7689986ff031508ffe1329c2f178731db956d82bf015d1212b02ec0ec69d7477c1ae954cbc06689f6a359894c0adebbf6b4e8020005aaa95551"),htfDefaults:{...zi},wrapPrivateKey:!0,allowInfinityPoint:!0,mapToCurve:r=>{let{x:e,y:t}=Au(d.fromBigTuple(r));return Bu(e,t)},isTorsionFree:(r,e)=>e.multiplyUnsafe(ze.params.x).negate().equals(Ia(r,e)),clearCofactor:(r,e)=>{let t=ze.params.x,n=e.multiplyUnsafe(t).negate(),i=Ia(r,e),s=e.double();return s=Fu(r,s),s=s.subtract(i),i=n.add(i),i=i.multiplyUnsafe(t).negate(),s=s.add(i),s=s.subtract(n),s.subtract(e)},fromBytes:r=>{let{compressed:e,infinity:t,sort:n,value:i}=Tn(r);if(!e&&!t&&n||!e&&t&&n||n&&t&&e)throw new Error("Invalid encoding flag: "+(r[0]&224));let s=U.BYTES,o=(f,a,m)=>je(f.slice(a,m));if(i.length===96&&e){let f=ze.params.G2b,a=U.ORDER;if(t){if(i.reduce((A,P)=>A!==0?P+1:P,0)>0)throw new Error("Invalid compressed G2 point");return{x:d.ZERO,y:d.ZERO}}let m=o(i,0,s),E=o(i,s,2*s),h=d.create({c0:U.create(E),c1:U.create(m)}),O=d.add(d.pow(h,An),f),B=d.sqrt(O),v=B.c1===Le?B.c0*Ae/a:B.c1*Ae/a?Zt:Le;return B=n&&v>0?B:d.neg(B),{x:h,y:B}}else if(i.length===192&&!e){if(t){if(i.reduce((h,O)=>h!==0?O+1:O,0)>0)throw new Error("Invalid uncompressed G2 point");return{x:d.ZERO,y:d.ZERO}}let f=o(i,0,s),a=o(i,s,2*s),m=o(i,2*s,3*s),E=o(i,3*s,4*s);return{x:d.fromBigTuple([a,f]),y:d.fromBigTuple([E,m])}}else throw new Error("Invalid point G2, expected 96/192 bytes")},toBytes:(r,e,t)=>{let{BYTES:n,ORDER:i}=U,s=e.equals(r.ZERO),{x:o,y:f}=e.toAffine();if(t){if(s)return ve(Nn,Ne(Le,n));let a=!!(f.c1===Le?f.c0*Ae/i:f.c1*Ae/i);return ve(Sr(Ne(o.c1,n),{compressed:!0,sort:a}),Ne(o.c0,n))}else{if(s)return ve(new Uint8Array([64]),new Uint8Array(4*n-1));let{re:a,im:m}=d.reim(o),{re:E,im:h}=d.reim(f);return ve(Ne(m,n),Ne(a,n),Ne(h,n),Ne(E,n))}},Signature:{fromHex(r){let{infinity:e,sort:t,value:n}=Tn(bt("signatureHex",r)),i=U.ORDER,s=n.length/2;if(s!==48&&s!==96)throw new Error("Invalid compressed signature length, must be 96 or 192");let o=je(n.slice(0,s)),f=je(n.slice(s));if(e)return ze.G2.ProjectivePoint.ZERO;let a=U.create(o&U.MASK),m=U.create(f),E=d.create({c0:m,c1:a}),h=d.add(d.pow(E,An),ze.params.G2b),O=d.sqrt(h);if(!O)throw new Error("Failed to find a square root");let{re:B,im:v}=d.reim(O),A=BigInt(t),P=v>Le&&v*Ae/i!==A,N=v===Le&&B*Ae/i!==A;(P||N)&&(O=d.neg(O));let D=ze.G2.ProjectivePoint.fromAffine({x:E,y:O});return D.assertValidity(),D},toRawBytes(r){return va(r)},toHex(r){return At(va(r))}}},params:{x:ji,r:ua.ORDER},htfDefaults:zi,hash:ur,randomBytes:rs});function Na(r,e,t){let n=typeof r=="string"?r:lt(r),i=typeof e=="string"?e:lt(e),s=typeof t=="string"?t:lt(t);return ze.verifyShortSignature(i,s,n)}var Ki=r=>Fe(new dt(r)),Un=r=>{let e=Ki(r);return new Date(Number(e)/1e6)};var $t=class extends Xt{constructor(e){super(`Invalid certificate: ${e}`)}},tt;(function(r){r[r.Empty=0]="Empty",r[r.Fork=1]="Fork",r[r.Labeled=2]="Labeled",r[r.Leaf=3]="Leaf",r[r.Pruned=4]="Pruned"})(tt||(tt={}));function Lu(r,e){let t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<t.length;i++)if(t[i]>n[i])return!0;return!1}var Fn=class r{constructor(e,t,n,i,s=5){this._rootKey=t,this._canisterId=n,this._blsVerify=i,this._maxAgeInMinutes=s,this.cert=er(new Uint8Array(e))}static async create(e){let t=r.createUnverified(e);return await t.verify(),t}static createUnverified(e){let t=e.blsVerify;return t||(t=Na),new r(e.certificate,e.rootKey,e.canisterId,t,e.maxAgeInMinutes)}lookup(e){return or(e,this.cert.tree)}lookup_label(e){return this.lookup([e])}async verify(){let e=await Rn(this.cert.tree),t=await this._checkDelegationAndGetKey(this.cert.delegation),n=this.cert.signature,i=Du(t),s=st(Nr("ic-state-root"),e),o=!1,f=Pn(this.lookup(["time"]));if(!f)throw new $t("Certificate does not contain a time");let a=5*60*1e3,m=this._maxAgeInMinutes*60*1e3,E=Date.now(),h=E-m,O=E+a,B=Un(f);if(B.getTime()<h)throw new $t(`Certificate is signed more than ${this._maxAgeInMinutes} minutes in the past. Certificate time: `+B.toISOString()+" Current time: "+new Date(E).toISOString());if(B.getTime()>O)throw new $t("Certificate is signed more than 5 minutes in the future. Certificate time: "+B.toISOString()+" Current time: "+new Date(E).toISOString());try{o=await this._blsVerify(new Uint8Array(i),new Uint8Array(n),new Uint8Array(s))}catch{o=!1}if(!o)throw new $t("Signature verification failed")}async _checkDelegationAndGetKey(e){if(!e)return this._rootKey;let t=await r.createUnverified({certificate:e.certificate,rootKey:this._rootKey,canisterId:this._canisterId,blsVerify:this._blsVerify,maxAgeInMinutes:1/0});if(t.cert.delegation)throw new $t("Delegation certificates cannot be nested");if(await t.verify(),!Wi({canisterId:this._canisterId,subnetId:Ve.fromUint8Array(new Uint8Array(e.subnet_id)),tree:t.cert.tree}))throw new $t(`Canister ${this._canisterId} not in range of delegations for subnet 0x${lt(e.subnet_id)}`);let i=Pn(t.lookup(["subnet",e.subnet_id,"public_key"]));if(!i)throw new Error(`Could not find subnet key for subnet 0x${lt(e.subnet_id)}`);return i}},Tr=mr("308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c05030201036100"),Mu=96;function Du(r){let e=Tr.byteLength+Mu;if(r.byteLength!==e)throw new TypeError(`BLS DER-encoded public key must be ${e} bytes long`);let t=r.slice(0,Tr.byteLength);if(!mi(t,Tr))throw new TypeError(`BLS DER-encoded public key is invalid. Expect the following prefix: ${Tr}, but get ${t}`);return r.slice(Tr.byteLength)}function Pn(r){if(r.status===qe.Found){if(r.value instanceof ArrayBuffer)return r.value;if(r.value instanceof Uint8Array)return r.value.buffer}}async function Rn(r){switch(r[0]){case tt.Empty:return ot(Nr("ic-hashtree-empty"));case tt.Pruned:return r[1];case tt.Leaf:return ot(st(Nr("ic-hashtree-leaf"),r[1]));case tt.Labeled:return ot(st(Nr("ic-hashtree-labeled"),r[1],await Rn(r[2])));case tt.Fork:return ot(st(Nr("ic-hashtree-fork"),await Rn(r[1]),await Rn(r[2])));default:throw new Error("unreachable")}}function Nr(r){let e=new Uint8Array([r.length]),t=new TextEncoder().encode(r);return st(e,t)}var qe;(function(r){r.Unknown="unknown",r.Absent="absent",r.Found="found"})(qe||(qe={}));var Tt;(function(r){r.Less="less",r.Greater="greater"})(Tt||(Tt={}));function or(r,e){if(r.length===0)switch(e[0]){case tt.Leaf:{if(!e[1])throw new Error("Invalid tree structure for leaf");return e[1]instanceof ArrayBuffer?{status:qe.Found,value:e[1]}:e[1]instanceof Uint8Array?{status:qe.Found,value:e[1].buffer}:{status:qe.Found,value:e[1]}}default:return{status:qe.Found,value:e}}let t=typeof r[0]=="string"?new TextEncoder().encode(r[0]):r[0],n=On(t,e);switch(n.status){case qe.Found:return or(r.slice(1),n.value);case Tt.Greater:case Tt.Less:return{status:qe.Absent};default:return n}}function Ln(r){switch(r[0]){case tt.Empty:return[];case tt.Fork:return Ln(r[1]).concat(Ln(r[2]));default:return[r]}}function On(r,e){switch(e[0]){case tt.Labeled:return Lu(r,e[1])?{status:Tt.Greater}:mi(r,e[1])?{status:qe.Found,value:e[2]}:{status:Tt.Less};case tt.Fork:let t=On(r,e[1]);switch(t.status){case Tt.Greater:{let n=On(r,e[2]);return n.status===Tt.Less?{status:qe.Absent}:n}case qe.Unknown:{let n=On(r,e[2]);return n.status===Tt.Less?{status:qe.Unknown}:n}default:return t}case tt.Pruned:return{status:qe.Unknown};default:return{status:qe.Absent}}}function Wi(r){let{canisterId:e,subnetId:t,tree:n}=r,i=or(["subnet",t.toUint8Array(),"canister_ranges"],n);if(i.status!==qe.Found||!(i.value instanceof ArrayBuffer))throw new Error(`Could not find canister ranges for subnet ${t}`);return er(i.value).map(a=>[Ve.fromUint8Array(a[0]),Ve.fromUint8Array(a[1])]).some(a=>a[0].ltEq(e)&&a[1].gtEq(e))}var Ua=class{constructor(e,t,n){this.key=e,this.path=t,this.decodeStrategy=n}},td=async r=>{let{agent:e,paths:t}=r,n=Ve.from(r.canisterId),i=[...new Set(t)],s=i.map(a=>Ra(a,n)),o=new Map,f=i.map((a,m)=>(async()=>{var E;try{let h=await e.readState(n,{paths:[s[m]]}),O=await Fn.create({certificate:h.certificate,rootKey:e.rootKey,canisterId:n}),B=(P,N)=>{if(N==="subnet"){let D=ku(h.certificate,n,e.rootKey);return{path:N,data:D}}else return{path:N,data:Pn(P.lookup(Ra(N,n)))}},{path:v,data:A}=B(O,i[m]);if(!A)console.warn(`Expected to find result for path ${v}, but instead found nothing.`),typeof v=="string"?o.set(v,null):o.set(v.key,null);else switch(v){case"time":{o.set(v,Un(A));break}case"controllers":{o.set(v,$u(A));break}case"module_hash":{o.set(v,Oa(A));break}case"subnet":{o.set(v,A);break}case"candid":{o.set(v,new TextDecoder().decode(A));break}default:if(typeof v!="string"&&"key"in v&&"path"in v)switch(v.decodeStrategy){case"raw":o.set(v.key,A);break;case"leb128":{o.set(v.key,Ki(A));break}case"cbor":{o.set(v.key,Fa(A));break}case"hex":{o.set(v.key,Oa(A));break}case"utf-8":o.set(v.key,qu(A))}}}catch(h){if(!((E=h?.message)===null||E===void 0)&&E.includes("Invalid certificate"))throw new Xt(h.message);typeof a!="string"&&"key"in a&&"path"in a?o.set(a.key,null):o.set(a,null),console.group(),console.warn(`Expected to find result for path ${a}, but instead found nothing.`),console.warn(h),console.groupEnd()}})());return await Promise.all(f),o},ku=(r,e,t)=>{if(!e._isPrincipal)throw new Error("Invalid canisterId");let n=er(new Uint8Array(r)),i=n.tree,s=n.delegation,o;if(s&&s.subnet_id?o=Ve.fromUint8Array(new Uint8Array(s.subnet_id)):!s&&typeof t<"u"?(o=Ve.selfAuthenticating(new Uint8Array(t)),s={subnet_id:o.toUint8Array(),certificate:new ArrayBuffer(0)}):(o=Ve.selfAuthenticating(Ve.fromText("tdb26-jop6k-aogll-7ltgs-eruif-6kk7m-qpktf-gdiqx-mxtrf-vb5e6-eqe").toUint8Array()),s={subnet_id:o.toUint8Array(),certificate:new ArrayBuffer(0)}),!Wi({canisterId:e,subnetId:o,tree:i}))throw new Error("Canister not in range");let a=or(["subnet",s.subnet_id,"node"],i);if(a.status!==qe.Found)throw new Error("Node not found");if(a.value instanceof ArrayBuffer)throw new Error("Invalid node tree");let m=Ln(a.value),E=new Map;return m.forEach(h=>{let O=Ve.from(new Uint8Array(h[1])).toText(),B=or(["public_key"],h[2]);if(B.status!==qe.Found)throw new Error("Public key not found");let v=B.value;if(v.byteLength!==44)throw new Error("Invalid public key length");E.set(O,v)}),{subnetId:Ve.fromUint8Array(new Uint8Array(s.subnet_id)).toText(),nodeKeys:E}},Ra=(r,e)=>{let t=new TextEncoder,n=s=>new DataView(t.encode(s).buffer).buffer,i=new DataView(e.toUint8Array().buffer).buffer;switch(r){case"time":return[n("time")];case"controllers":return[n("canister"),i,n("controllers")];case"module_hash":return[n("canister"),i,n("module_hash")];case"subnet":return[n("subnet")];case"candid":return[n("canister"),i,n("metadata"),n("candid:service")];default:if("key"in r&&"path"in r)if(typeof r.path=="string"||r.path instanceof ArrayBuffer){let s=r.path,o=typeof s=="string"?n(s):s;return[n("canister"),i,n("metadata"),o]}else return r.path}throw new Error(`An unexpeected error was encountered while encoding your path for canister status. Please ensure that your path, ${r} was formatted correctly.`)},Oa=r=>lt(r),Fa=r=>er(r),qu=r=>new TextDecoder().decode(r),$u=r=>Fa(r).map(t=>Ve.fromUint8Array(new Uint8Array(t)));export{Ge as a,Mn as b,Or as c,$n as d,rs as e,Dr as f,Ve as g,Ns as h,Xt as i,Be as j,Ni as k,ui as l,st as m,lt as n,mr as o,mi as p,gr as q,Yf as r,dl as s,Ko as t,bi as u,D0 as v,er as w,At as x,xn as y,En as z,bt as A,ve as B,St as C,We as D,bl as E,gl as F,Mi as G,oa as H,aa as I,Un as J,$t as K,Fn as L,Pn as M,qe as N,or as O,Ua as P,td as Q,ku as R,Ra as S};
|
|
14
|
-
/*!
|
|
15
|
-
* The buffer module from node.js, for the browser.
|
|
16
|
-
*
|
|
17
|
-
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
18
|
-
* @license MIT
|
|
19
|
-
*/
|
|
20
|
-
/*! Bundled license information:
|
|
21
|
-
|
|
22
|
-
ieee754/index.js:
|
|
23
|
-
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
24
|
-
|
|
25
|
-
@noble/hashes/esm/utils.js:
|
|
26
|
-
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
27
|
-
|
|
28
|
-
@noble/curves/esm/abstract/utils.js:
|
|
29
|
-
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
30
|
-
|
|
31
|
-
@noble/curves/esm/abstract/modular.js:
|
|
32
|
-
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
33
|
-
|
|
34
|
-
@noble/curves/esm/abstract/curve.js:
|
|
35
|
-
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
36
|
-
|
|
37
|
-
@noble/curves/esm/abstract/weierstrass.js:
|
|
38
|
-
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
39
|
-
|
|
40
|
-
@noble/curves/esm/bls12-381.js:
|
|
41
|
-
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
42
|
-
*/
|
|
43
|
-
//# sourceMappingURL=chunk-FOA6PEDK.js.map
|