@junobuild/core 0.0.60 → 0.0.61-next-2024-09-15
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-Y5DRSSOV.js +2 -0
- package/dist/browser/chunk-DMT35GPT.js +49 -0
- package/dist/browser/chunk-DMT35GPT.js.map +7 -0
- package/dist/browser/index.js +22 -22
- package/dist/browser/index.js.map +4 -4
- package/dist/node/index.mjs +34 -31
- package/dist/node/index.mjs.map +4 -4
- package/dist/types/api/actor.api.d.ts +7 -1
- package/dist/types/index.d.ts +7 -6
- package/dist/types/services/factory.services.d.ts +8 -0
- package/dist/types/stores/actor.store.d.ts +21 -0
- package/dist/types/stores/agent.store.d.ts +13 -0
- package/dist/types/types/build.types.d.ts +5 -0
- package/dist/workers/auth.worker.js +12 -12
- package/dist/workers/auth.worker.js.map +3 -3
- package/package.json +6 -6
- package/dist/browser/canisterStatus-APCJZWVG.js +0 -2
- package/dist/browser/chunk-3YVZN56F.js +0 -46
- package/dist/browser/chunk-3YVZN56F.js.map +0 -7
- package/dist/types/utils/actor.utils.d.ts +0 -6
- /package/dist/browser/{canisterStatus-APCJZWVG.js.map → canisterStatus-Y5DRSSOV.js.map} +0 -0
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";(()=>{var xu=Object.create;var li=Object.defineProperty;var _u=Object.getOwnPropertyDescriptor;var bu=Object.getOwnPropertyNames;var Eu=Object.getPrototypeOf,Au=Object.prototype.hasOwnProperty;var ct=(r,t)=>()=>(r&&(t=r(r=0)),t);var Bt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),vu=(r,t)=>{for(var e in t)li(r,e,{get:t[e],enumerable:!0})},Tu=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of bu(t))!Au.call(r,i)&&i!==e&&li(r,i,{get:()=>t[i],enumerable:!(n=_u(t,i))||n.enumerable});return r};var Te=(r,t,e)=>(e=r!=null?xu(Eu(r)):{},Tu(t||!r||!r.__esModule?li(e,"default",{value:r,enumerable:!0}):e,r));var di=Bt(nn=>{"use strict";nn.byteLength=Bu;nn.toByteArray=Nu;nn.fromByteArray=Fu;var fe=[],Qt=[],Su=typeof Uint8Array<"u"?Uint8Array:Array,hi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ve=0,so=hi.length;Ve<so;++Ve)fe[Ve]=hi[Ve],Qt[hi.charCodeAt(Ve)]=Ve;var Ve,so;Qt[45]=62;Qt[95]=63;function oo(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");e===-1&&(e=t);var n=e===t?0:4-e%4;return[e,n]}function Bu(r){var t=oo(r),e=t[0],n=t[1];return(e+n)*3/4-n}function Iu(r,t,e){return(t+e)*3/4-e}function Nu(r){var t,e=oo(r),n=e[0],i=e[1],s=new Su(Iu(r,n,i)),o=0,c=i>0?n-4:n,u;for(u=0;u<c;u+=4)t=Qt[r.charCodeAt(u)]<<18|Qt[r.charCodeAt(u+1)]<<12|Qt[r.charCodeAt(u+2)]<<6|Qt[r.charCodeAt(u+3)],s[o++]=t>>16&255,s[o++]=t>>8&255,s[o++]=t&255;return i===2&&(t=Qt[r.charCodeAt(u)]<<2|Qt[r.charCodeAt(u+1)]>>4,s[o++]=t&255),i===1&&(t=Qt[r.charCodeAt(u)]<<10|Qt[r.charCodeAt(u+1)]<<4|Qt[r.charCodeAt(u+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function Uu(r){return fe[r>>18&63]+fe[r>>12&63]+fe[r>>6&63]+fe[r&63]}function Ru(r,t,e){for(var n,i=[],s=t;s<e;s+=3)n=(r[s]<<16&16711680)+(r[s+1]<<8&65280)+(r[s+2]&255),i.push(Uu(n));return i.join("")}function Fu(r){for(var t,e=r.length,n=e%3,i=[],s=16383,o=0,c=e-n;o<c;o+=s)i.push(Ru(r,o,o+s>c?c:o+s));return n===1?(t=r[e-1],i.push(fe[t>>2]+fe[t<<4&63]+"==")):n===2&&(t=(r[e-2]<<8)+r[e-1],i.push(fe[t>>10]+fe[t>>4&63]+fe[t<<2&63]+"=")),i.join("")}});var sn=Bt(pi=>{pi.read=function(r,t,e,n,i){var s,o,c=i*8-n-1,u=(1<<c)-1,w=u>>1,y=-7,m=e?i-1:0,N=e?-1:1,M=r[t+m];for(m+=N,s=M&(1<<-y)-1,M>>=-y,y+=c;y>0;s=s*256+r[t+m],m+=N,y-=8);for(o=s&(1<<-y)-1,s>>=-y,y+=n;y>0;o=o*256+r[t+m],m+=N,y-=8);if(s===0)s=1-w;else{if(s===u)return o?NaN:(M?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-w}return(M?-1:1)*o*Math.pow(2,s-n)};pi.write=function(r,t,e,n,i,s){var o,c,u,w=s*8-i-1,y=(1<<w)-1,m=y>>1,N=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=n?0:s-1,O=n?1:-1,G=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(c=isNaN(t)?1:0,o=y):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+m>=1?t+=N/u:t+=N*Math.pow(2,1-m),t*u>=2&&(o++,u/=2),o+m>=y?(c=0,o=y):o+m>=1?(c=(t*u-1)*Math.pow(2,i),o=o+m):(c=t*Math.pow(2,m-1)*Math.pow(2,i),o=0));i>=8;r[e+M]=c&255,M+=O,c/=256,i-=8);for(o=o<<i|c,w+=i;w>0;r[e+M]=o&255,M+=O,o/=256,w-=8);r[e+M-O]|=G*128}});var vo=Bt(er=>{"use strict";var yi=di(),Qe=sn(),ao=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;er.Buffer=T;er.SlowBuffer=$u;er.INSPECT_MAX_BYTES=50;var on=2147483647;er.kMaxLength=on;T.TYPED_ARRAY_SUPPORT=Ou();!T.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Ou(){try{let r=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(r,t),r.foo()===42}catch{return!1}}Object.defineProperty(T.prototype,"parent",{enumerable:!0,get:function(){if(T.isBuffer(this))return this.buffer}});Object.defineProperty(T.prototype,"offset",{enumerable:!0,get:function(){if(T.isBuffer(this))return this.byteOffset}});function xe(r){if(r>on)throw new RangeError('The value "'+r+'" is invalid for option "size"');let t=new Uint8Array(r);return Object.setPrototypeOf(t,T.prototype),t}function T(r,t,e){if(typeof r=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return xi(r)}return lo(r,t,e)}T.poolSize=8192;function lo(r,t,e){if(typeof r=="string")return ku(r,t);if(ArrayBuffer.isView(r))return Mu(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(le(r,ArrayBuffer)||r&&le(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(le(r,SharedArrayBuffer)||r&&le(r.buffer,SharedArrayBuffer)))return gi(r,t,e);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return T.from(n,t,e);let i=Cu(r);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return T.from(r[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}T.from=function(r,t,e){return lo(r,t,e)};Object.setPrototypeOf(T.prototype,Uint8Array.prototype);Object.setPrototypeOf(T,Uint8Array);function ho(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function Pu(r,t,e){return ho(r),r<=0?xe(r):t!==void 0?typeof e=="string"?xe(r).fill(t,e):xe(r).fill(t):xe(r)}T.alloc=function(r,t,e){return Pu(r,t,e)};function xi(r){return ho(r),xe(r<0?0:_i(r)|0)}T.allocUnsafe=function(r){return xi(r)};T.allocUnsafeSlow=function(r){return xi(r)};function ku(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!T.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=po(r,t)|0,n=xe(e),i=n.write(r,t);return i!==e&&(n=n.slice(0,i)),n}function wi(r){let t=r.length<0?0:_i(r.length)|0,e=xe(t);for(let n=0;n<t;n+=1)e[n]=r[n]&255;return e}function Mu(r){if(le(r,Uint8Array)){let t=new Uint8Array(r);return gi(t.buffer,t.byteOffset,t.byteLength)}return wi(r)}function gi(r,t,e){if(t<0||r.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<t+(e||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&e===void 0?n=new Uint8Array(r):e===void 0?n=new Uint8Array(r,t):n=new Uint8Array(r,t,e),Object.setPrototypeOf(n,T.prototype),n}function Cu(r){if(T.isBuffer(r)){let t=_i(r.length)|0,e=xe(t);return e.length===0||r.copy(e,0,0,t),e}if(r.length!==void 0)return typeof r.length!="number"||Ei(r.length)?xe(0):wi(r);if(r.type==="Buffer"&&Array.isArray(r.data))return wi(r.data)}function _i(r){if(r>=on)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+on.toString(16)+" bytes");return r|0}function $u(r){return+r!=r&&(r=0),T.alloc(+r)}T.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==T.prototype};T.compare=function(t,e){if(le(t,Uint8Array)&&(t=T.from(t,t.offset,t.byteLength)),le(e,Uint8Array)&&(e=T.from(e,e.offset,e.byteLength)),!T.isBuffer(t)||!T.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,i=e.length;for(let s=0,o=Math.min(n,i);s<o;++s)if(t[s]!==e[s]){n=t[s],i=e[s];break}return n<i?-1:i<n?1:0};T.isEncoding=function(t){switch(String(t).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}};T.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return T.alloc(0);let n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;let i=T.allocUnsafe(e),s=0;for(n=0;n<t.length;++n){let o=t[n];if(le(o,Uint8Array))s+o.length>i.length?(T.isBuffer(o)||(o=T.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(T.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function po(r,t){if(T.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||le(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let e=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&e===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return mi(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Ao(r).length;default:if(i)return n?-1:mi(r).length;t=(""+t).toLowerCase(),i=!0}}T.byteLength=po;function Vu(r,t,e){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(r||(r="utf8");;)switch(r){case"hex":return Yu(this,t,e);case"utf8":case"utf-8":return wo(this,t,e);case"ascii":return Wu(this,t,e);case"latin1":case"binary":return zu(this,t,e);case"base64":return Du(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Xu(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}T.prototype._isBuffer=!0;function Le(r,t,e){let n=r[t];r[t]=r[e],r[e]=n}T.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)Le(this,e,e+1);return this};T.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)Le(this,e,e+3),Le(this,e+1,e+2);return this};T.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)Le(this,e,e+7),Le(this,e+1,e+6),Le(this,e+2,e+5),Le(this,e+3,e+4);return this};T.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?wo(this,0,t):Vu.apply(this,arguments)};T.prototype.toLocaleString=T.prototype.toString;T.prototype.equals=function(t){if(!T.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:T.compare(this,t)===0};T.prototype.inspect=function(){let t="",e=er.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"};ao&&(T.prototype[ao]=T.prototype.inspect);T.prototype.compare=function(t,e,n,i,s){if(le(t,Uint8Array)&&(t=T.from(t,t.offset,t.byteLength)),!T.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),e<0||n>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&e>=n)return 0;if(i>=s)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,s>>>=0,this===t)return 0;let o=s-i,c=n-e,u=Math.min(o,c),w=this.slice(i,s),y=t.slice(e,n);for(let m=0;m<u;++m)if(w[m]!==y[m]){o=w[m],c=y[m];break}return o<c?-1:c<o?1:0};function yo(r,t,e,n,i){if(r.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,Ei(e)&&(e=i?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(i)return-1;e=r.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=T.from(t,n)),T.isBuffer(t))return t.length===0?-1:co(r,t,e,n,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):co(r,[t],e,n,i);throw new TypeError("val must be string, number or Buffer")}function co(r,t,e,n,i){let s=1,o=r.length,c=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;s=2,o/=2,c/=2,e/=2}function u(y,m){return s===1?y[m]:y.readUInt16BE(m*s)}let w;if(i){let y=-1;for(w=e;w<o;w++)if(u(r,w)===u(t,y===-1?0:w-y)){if(y===-1&&(y=w),w-y+1===c)return y*s}else y!==-1&&(w-=w-y),y=-1}else for(e+c>o&&(e=o-c),w=e;w>=0;w--){let y=!0;for(let m=0;m<c;m++)if(u(r,w+m)!==u(t,m)){y=!1;break}if(y)return w}return-1}T.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1};T.prototype.indexOf=function(t,e,n){return yo(this,t,e,n,!0)};T.prototype.lastIndexOf=function(t,e,n){return yo(this,t,e,n,!1)};function Lu(r,t,e,n){e=Number(e)||0;let i=r.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;let s=t.length;n>s/2&&(n=s/2);let o;for(o=0;o<n;++o){let c=parseInt(t.substr(o*2,2),16);if(Ei(c))return o;r[e+o]=c}return o}function qu(r,t,e,n){return an(mi(t,r.length-e),r,e,n)}function Hu(r,t,e,n){return an(tf(t),r,e,n)}function Gu(r,t,e,n){return an(Ao(t),r,e,n)}function Ku(r,t,e,n){return an(ef(t,r.length-e),r,e,n)}T.prototype.write=function(t,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e>>>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");let s=this.length-e;if((n===void 0||n>s)&&(n=s),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return Lu(this,t,e,n);case"utf8":case"utf-8":return qu(this,t,e,n);case"ascii":case"latin1":case"binary":return Hu(this,t,e,n);case"base64":return Gu(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ku(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};T.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Du(r,t,e){return t===0&&e===r.length?yi.fromByteArray(r):yi.fromByteArray(r.slice(t,e))}function wo(r,t,e){e=Math.min(r.length,e);let n=[],i=t;for(;i<e;){let s=r[i],o=null,c=s>239?4:s>223?3:s>191?2:1;if(i+c<=e){let u,w,y,m;switch(c){case 1:s<128&&(o=s);break;case 2:u=r[i+1],(u&192)===128&&(m=(s&31)<<6|u&63,m>127&&(o=m));break;case 3:u=r[i+1],w=r[i+2],(u&192)===128&&(w&192)===128&&(m=(s&15)<<12|(u&63)<<6|w&63,m>2047&&(m<55296||m>57343)&&(o=m));break;case 4:u=r[i+1],w=r[i+2],y=r[i+3],(u&192)===128&&(w&192)===128&&(y&192)===128&&(m=(s&15)<<18|(u&63)<<12|(w&63)<<6|y&63,m>65535&&m<1114112&&(o=m))}}o===null?(o=65533,c=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=c}return ju(n)}var uo=4096;function ju(r){let t=r.length;if(t<=uo)return String.fromCharCode.apply(String,r);let e="",n=0;for(;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=uo));return e}function Wu(r,t,e){let n="";e=Math.min(r.length,e);for(let i=t;i<e;++i)n+=String.fromCharCode(r[i]&127);return n}function zu(r,t,e){let n="";e=Math.min(r.length,e);for(let i=t;i<e;++i)n+=String.fromCharCode(r[i]);return n}function Yu(r,t,e){let n=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>n)&&(e=n);let i="";for(let s=t;s<e;++s)i+=rf[r[s]];return i}function Xu(r,t,e){let n=r.slice(t,e),i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}T.prototype.slice=function(t,e){let n=this.length;t=~~t,e=e===void 0?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);let i=this.subarray(t,e);return Object.setPrototypeOf(i,T.prototype),i};function kt(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}T.prototype.readUintLE=T.prototype.readUIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||kt(t,e,this.length);let i=this[t],s=1,o=0;for(;++o<e&&(s*=256);)i+=this[t+o]*s;return i};T.prototype.readUintBE=T.prototype.readUIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||kt(t,e,this.length);let i=this[t+--e],s=1;for(;e>0&&(s*=256);)i+=this[t+--e]*s;return i};T.prototype.readUint8=T.prototype.readUInt8=function(t,e){return t=t>>>0,e||kt(t,1,this.length),this[t]};T.prototype.readUint16LE=T.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||kt(t,2,this.length),this[t]|this[t+1]<<8};T.prototype.readUint16BE=T.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||kt(t,2,this.length),this[t]<<8|this[t+1]};T.prototype.readUint32LE=T.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||kt(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};T.prototype.readUint32BE=T.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||kt(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};T.prototype.readBigUInt64LE=Se(function(t){t=t>>>0,tr(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Ir(t,this.length-8);let i=e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,s=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))});T.prototype.readBigUInt64BE=Se(function(t){t=t>>>0,tr(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Ir(t,this.length-8);let i=e*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],s=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(s)});T.prototype.readIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||kt(t,e,this.length);let i=this[t],s=1,o=0;for(;++o<e&&(s*=256);)i+=this[t+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i};T.prototype.readIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||kt(t,e,this.length);let i=e,s=1,o=this[t+--i];for(;i>0&&(s*=256);)o+=this[t+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*e)),o};T.prototype.readInt8=function(t,e){return t=t>>>0,e||kt(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};T.prototype.readInt16LE=function(t,e){t=t>>>0,e||kt(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};T.prototype.readInt16BE=function(t,e){t=t>>>0,e||kt(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};T.prototype.readInt32LE=function(t,e){return t=t>>>0,e||kt(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};T.prototype.readInt32BE=function(t,e){return t=t>>>0,e||kt(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};T.prototype.readBigInt64LE=Se(function(t){t=t>>>0,tr(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Ir(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});T.prototype.readBigInt64BE=Se(function(t){t=t>>>0,tr(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Ir(t,this.length-8);let i=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n)});T.prototype.readFloatLE=function(t,e){return t=t>>>0,e||kt(t,4,this.length),Qe.read(this,t,!0,23,4)};T.prototype.readFloatBE=function(t,e){return t=t>>>0,e||kt(t,4,this.length),Qe.read(this,t,!1,23,4)};T.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||kt(t,8,this.length),Qe.read(this,t,!0,52,8)};T.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||kt(t,8,this.length),Qe.read(this,t,!1,52,8)};function qt(r,t,e,n,i,s){if(!T.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(e+n>r.length)throw new RangeError("Index out of range")}T.prototype.writeUintLE=T.prototype.writeUIntLE=function(t,e,n,i){if(t=+t,e=e>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;qt(this,t,e,n,c,0)}let s=1,o=0;for(this[e]=t&255;++o<n&&(s*=256);)this[e+o]=t/s&255;return e+n};T.prototype.writeUintBE=T.prototype.writeUIntBE=function(t,e,n,i){if(t=+t,e=e>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;qt(this,t,e,n,c,0)}let s=n-1,o=1;for(this[e+s]=t&255;--s>=0&&(o*=256);)this[e+s]=t/o&255;return e+n};T.prototype.writeUint8=T.prototype.writeUInt8=function(t,e,n){return t=+t,e=e>>>0,n||qt(this,t,e,1,255,0),this[e]=t&255,e+1};T.prototype.writeUint16LE=T.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||qt(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};T.prototype.writeUint16BE=T.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||qt(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};T.prototype.writeUint32LE=T.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||qt(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4};T.prototype.writeUint32BE=T.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||qt(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function go(r,t,e,n,i){Eo(t,n,i,r,e,7);let s=Number(t&BigInt(4294967295));r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return r[e++]=o,o=o>>8,r[e++]=o,o=o>>8,r[e++]=o,o=o>>8,r[e++]=o,e}function mo(r,t,e,n,i){Eo(t,n,i,r,e,7);let s=Number(t&BigInt(4294967295));r[e+7]=s,s=s>>8,r[e+6]=s,s=s>>8,r[e+5]=s,s=s>>8,r[e+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return r[e+3]=o,o=o>>8,r[e+2]=o,o=o>>8,r[e+1]=o,o=o>>8,r[e]=o,e+8}T.prototype.writeBigUInt64LE=Se(function(t,e=0){return go(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});T.prototype.writeBigUInt64BE=Se(function(t,e=0){return mo(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});T.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e=e>>>0,!i){let u=Math.pow(2,8*n-1);qt(this,t,e,n,u-1,-u)}let s=0,o=1,c=0;for(this[e]=t&255;++s<n&&(o*=256);)t<0&&c===0&&this[e+s-1]!==0&&(c=1),this[e+s]=(t/o>>0)-c&255;return e+n};T.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e=e>>>0,!i){let u=Math.pow(2,8*n-1);qt(this,t,e,n,u-1,-u)}let s=n-1,o=1,c=0;for(this[e+s]=t&255;--s>=0&&(o*=256);)t<0&&c===0&&this[e+s+1]!==0&&(c=1),this[e+s]=(t/o>>0)-c&255;return e+n};T.prototype.writeInt8=function(t,e,n){return t=+t,e=e>>>0,n||qt(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};T.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||qt(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};T.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||qt(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};T.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||qt(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4};T.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||qt(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};T.prototype.writeBigInt64LE=Se(function(t,e=0){return go(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});T.prototype.writeBigInt64BE=Se(function(t,e=0){return mo(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function xo(r,t,e,n,i,s){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function _o(r,t,e,n,i){return t=+t,e=e>>>0,i||xo(r,t,e,4,34028234663852886e22,-34028234663852886e22),Qe.write(r,t,e,n,23,4),e+4}T.prototype.writeFloatLE=function(t,e,n){return _o(this,t,e,!0,n)};T.prototype.writeFloatBE=function(t,e,n){return _o(this,t,e,!1,n)};function bo(r,t,e,n,i){return t=+t,e=e>>>0,i||xo(r,t,e,8,17976931348623157e292,-17976931348623157e292),Qe.write(r,t,e,n,52,8),e+8}T.prototype.writeDoubleLE=function(t,e,n){return bo(this,t,e,!0,n)};T.prototype.writeDoubleBE=function(t,e,n){return bo(this,t,e,!1,n)};T.prototype.copy=function(t,e,n,i){if(!T.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-n&&(i=t.length-e+n);let s=i-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(e,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),e),s};T.prototype.fill=function(t,e,n,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!T.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){let o=t.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(t=o)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let s;if(typeof t=="number")for(s=e;s<n;++s)this[s]=t;else{let o=T.isBuffer(t)?t:T.from(t,i),c=o.length;if(c===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-e;++s)this[s+e]=o[s%c]}return this};var Ze={};function bi(r,t,e){Ze[r]=class extends e{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}bi("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);bi("ERR_INVALID_ARG_TYPE",function(r,t){return`The "${r}" argument must be of type number. Received type ${typeof t}`},TypeError);bi("ERR_OUT_OF_RANGE",function(r,t,e){let n=`The value of "${r}" is out of range.`,i=e;return Number.isInteger(e)&&Math.abs(e)>2**32?i=fo(String(e)):typeof e=="bigint"&&(i=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(i=fo(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function fo(r){let t="",e=r.length,n=r[0]==="-"?1:0;for(;e>=n+4;e-=3)t=`_${r.slice(e-3,e)}${t}`;return`${r.slice(0,e)}${t}`}function Ju(r,t,e){tr(t,"offset"),(r[t]===void 0||r[t+e]===void 0)&&Ir(t,r.length-(e+1))}function Eo(r,t,e,n,i,s){if(r>e||r<t){let o=typeof t=="bigint"?"n":"",c;throw s>3?t===0||t===BigInt(0)?c=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:c=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:c=`>= ${t}${o} and <= ${e}${o}`,new Ze.ERR_OUT_OF_RANGE("value",c,r)}Ju(n,i,s)}function tr(r,t){if(typeof r!="number")throw new Ze.ERR_INVALID_ARG_TYPE(t,"number",r)}function Ir(r,t,e){throw Math.floor(r)!==r?(tr(r,e),new Ze.ERR_OUT_OF_RANGE(e||"offset","an integer",r)):t<0?new Ze.ERR_BUFFER_OUT_OF_BOUNDS:new Ze.ERR_OUT_OF_RANGE(e||"offset",`>= ${e?1:0} and <= ${t}`,r)}var Zu=/[^+/0-9A-Za-z-_]/g;function Qu(r){if(r=r.split("=")[0],r=r.trim().replace(Zu,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function mi(r,t){t=t||1/0;let e,n=r.length,i=null,s=[];for(let o=0;o<n;++o){if(e=r.charCodeAt(o),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;s.push(e)}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return s}function tf(r){let t=[];for(let e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function ef(r,t){let e,n,i,s=[];for(let o=0;o<r.length&&!((t-=2)<0);++o)e=r.charCodeAt(o),n=e>>8,i=e%256,s.push(i),s.push(n);return s}function Ao(r){return yi.toByteArray(Qu(r))}function an(r,t,e,n){let i;for(i=0;i<n&&!(i+e>=t.length||i>=r.length);++i)t[i+e]=r[i];return i}function le(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function Ei(r){return r!==r}var rf=function(){let r="0123456789abcdef",t=new Array(256);for(let e=0;e<16;++e){let n=e*16;for(let i=0;i<16;++i)t[n+i]=r[e]+r[i]}return t}();function Se(r){return typeof BigInt>"u"?nf:r}function nf(){throw new Error("BigInt not supported")}});function To(r){let t=0,e=0,n="";function i(s){return t<0?e|=s>>-t:e=s<<t&248,t>3?(t-=8,1):(t<4&&(n+=cn[e>>3],t+=5),0)}for(let s=0;s<r.length;)s+=i(r[s]);return n+(t<0?cn[e>>3]:"")}function So(r){let t=0,e=0,n=new Uint8Array(r.length*4/3|0),i=0;function s(o){let c=rr[o.toLowerCase()];if(c===void 0)throw new Error(`Invalid character: ${JSON.stringify(o)}`);c<<=3,e|=c>>>t,t+=5,t>=8&&(n[i++]=e,t-=8,t>0?e=c<<5-t&255:e=0)}for(let o of r)s(o);return n.slice(0,i)}var cn,rr,Bo=ct(()=>{cn="abcdefghijklmnopqrstuvwxyz234567",rr=Object.create(null);for(let r=0;r<cn.length;r++)rr[cn[r]]=r;rr[0]=rr.o;rr[1]=rr.i});function Io(r){let t=new Uint8Array(r),e=-1;for(let n=0;n<t.length;n++){let s=(t[n]^e)&255;e=sf[s]^e>>>8}return(e^-1)>>>0}var sf,No=ct(()=>{sf=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 of(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function vi(r,...t){if(!of(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${r.length}`)}function Ti(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function Uo(r,t){vi(r);let e=t.outputLen;if(r.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var Si=ct(()=>{});var un,Ro=ct(()=>{un=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});function Fo(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function Bi(r){return typeof r=="string"&&(r=Fo(r)),vi(r),r}function Nr(r){let t=n=>r().update(Bi(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function Oo(r=32){if(un&&typeof un.getRandomValues=="function")return un.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}var ln,ne,cd,fn,ud,Ur=ct(()=>{Ro();Si();ln=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),ne=(r,t)=>r<<32-t|r>>>t,cd=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;fn=class{clone(){return this._cloneInto()}},ud={}.toString});function af(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let i=BigInt(32),s=BigInt(4294967295),o=Number(e>>i&s),c=Number(e&s),u=n?4:0,w=n?0:4;r.setUint32(t+u,o,n),r.setUint32(t+w,c,n)}var Po,ko,nr,Ii=ct(()=>{Si();Ur();Po=(r,t,e)=>r&t^~r&e,ko=(r,t,e)=>r&t^r&e^t&e,nr=class extends fn{constructor(t,e,n,i){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=ln(this.buffer)}update(t){Ti(this);let{view:e,buffer:n,blockLen:i}=this;t=Bi(t);let s=t.length;for(let o=0;o<s;){let c=Math.min(i-this.pos,s-o);if(c===i){let u=ln(t);for(;i<=s-o;o+=i)this.process(u,o);continue}n.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===i&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ti(this),Uo(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:i,isLE:s}=this,{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(n,0),o=0);for(let m=o;m<i;m++)e[m]=0;af(n,i-8,BigInt(this.length*8),s),this.process(n,0);let c=ln(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let w=u/4,y=this.get();if(w>y.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<w;m++)c.setUint32(4*m,y[m],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:i,finished:s,destroyed:o,pos:c}=this;return t.length=i,t.pos=c,t.finished=s,t.destroyed=o,i%e&&t.buffer.set(n),t}}});var cf,Be,Ie,hn,Ni,Mo,Co,Ui=ct(()=>{Ii();Ur();cf=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]),Be=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ie=new Uint32Array(64),hn=class extends nr{constructor(){super(64,32,8,!1),this.A=Be[0]|0,this.B=Be[1]|0,this.C=Be[2]|0,this.D=Be[3]|0,this.E=Be[4]|0,this.F=Be[5]|0,this.G=Be[6]|0,this.H=Be[7]|0}get(){let{A:t,B:e,C:n,D:i,E:s,F:o,G:c,H:u}=this;return[t,e,n,i,s,o,c,u]}set(t,e,n,i,s,o,c,u){this.A=t|0,this.B=e|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=u|0}process(t,e){for(let m=0;m<16;m++,e+=4)Ie[m]=t.getUint32(e,!1);for(let m=16;m<64;m++){let N=Ie[m-15],M=Ie[m-2],O=ne(N,7)^ne(N,18)^N>>>3,G=ne(M,17)^ne(M,19)^M>>>10;Ie[m]=G+Ie[m-7]+O+Ie[m-16]|0}let{A:n,B:i,C:s,D:o,E:c,F:u,G:w,H:y}=this;for(let m=0;m<64;m++){let N=ne(c,6)^ne(c,11)^ne(c,25),M=y+N+Po(c,u,w)+cf[m]+Ie[m]|0,G=(ne(n,2)^ne(n,13)^ne(n,22))+ko(n,i,s)|0;y=w,w=u,u=c,c=o+M|0,o=s,s=i,i=n,n=M+G|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,u=u+this.F|0,w=w+this.G|0,y=y+this.H|0,this.set(n,i,s,o,c,u,w,y)}roundClean(){Ie.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Ni=class extends hn{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}},Mo=Nr(()=>new hn),Co=Nr(()=>new Ni)});function $o(r){return Co.create().update(new Uint8Array(r)).digest()}var Vo=ct(()=>{Ui()});var dn,uf,Lo,ff,lf,hf,It,te=ct(()=>{Bo();No();Vo();dn="__principal__",uf=2,Lo=4,ff="aaaaa-aa",lf=r=>{var t;return new Uint8Array(((t=r.match(/.{1,2}/g))!==null&&t!==void 0?t:[]).map(e=>parseInt(e,16)))},hf=r=>r.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),""),It=class r{constructor(t){this._arr=t,this._isPrincipal=!0}static anonymous(){return new this(new Uint8Array([Lo]))}static managementCanister(){return this.fromHex(ff)}static selfAuthenticating(t){let e=$o(t);return new this(new Uint8Array([...e,uf]))}static from(t){if(typeof t=="string")return r.fromText(t);if(Object.getPrototypeOf(t)===Uint8Array.prototype)return new r(t);if(typeof t=="object"&&t!==null&&t._isPrincipal===!0)return new r(t._arr);throw new Error(`Impossible to convert ${JSON.stringify(t)} to Principal.`)}static fromHex(t){return new this(lf(t))}static fromText(t){let e=t;if(t.includes(dn)){let o=JSON.parse(t);dn in o&&(e=o[dn])}let n=e.toLowerCase().replace(/-/g,""),i=So(n);i=i.slice(4,i.length);let s=new this(i);if(s.toText()!==e)throw new Error(`Principal "${s.toText()}" does not have a valid checksum (original value "${e}" may not be a valid Principal ID).`);return s}static fromUint8Array(t){return new this(t)}isAnonymous(){return this._arr.byteLength===1&&this._arr[0]===Lo}toUint8Array(){return this._arr}toHex(){return hf(this._arr).toUpperCase()}toText(){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,Io(this._arr));let n=new Uint8Array(t),i=Uint8Array.from(this._arr),s=new Uint8Array([...n,...i]),c=To(s).match(/.{1,5}/g);if(!c)throw new Error;return c.join("-")}toString(){return this.toText()}toJSON(){return{[dn]:this.toText()}}compareTo(t){for(let e=0;e<Math.min(this._arr.length,t._arr.length);e++){if(this._arr[e]<t._arr[e])return"lt";if(this._arr[e]>t._arr[e])return"gt"}return this._arr.length<t._arr.length?"lt":this._arr.length>t._arr.length?"gt":"eq"}ltEq(t){let e=this.compareTo(t);return e=="lt"||e=="eq"}gtEq(t){let e=this.compareTo(t);return e=="gt"||e=="eq"}}});var ee,ir=ct(()=>{ee=class r extends Error{constructor(t){super(t),this.message=t,Object.setPrototypeOf(this,r.prototype)}}});function Fi(...r){let t=new Uint8Array(r.reduce((n,i)=>n+i.byteLength,0)),e=0;for(let n of r)t.set(new Uint8Array(n),e),e+=n.byteLength;return t}function Ri(r){return new DataView(r.buffer,r.byteOffset,r.byteLength).buffer}function pn(r){return r instanceof Uint8Array?Ri(r):r instanceof ArrayBuffer?r:Array.isArray(r)?Ri(new Uint8Array(r)):"buffer"in r?pn(r.buffer):Ri(new Uint8Array(r))}var Ne,yn=ct(()=>{Ne=class{constructor(t,e=t?.byteLength||0){this._buffer=pn(t||new ArrayBuffer(0)),this._view=new Uint8Array(this._buffer,0,e)}get buffer(){return pn(this._view.slice())}get byteLength(){return this._view.byteLength}read(t){let e=this._view.subarray(0,t);return this._view=this._view.subarray(t),e.slice().buffer}readUint8(){let t=this._view[0];return this._view=this._view.subarray(1),t}write(t){let e=new Uint8Array(t),n=this._view.byteLength;this._view.byteOffset+this._view.byteLength+e.byteLength>=this._buffer.byteLength?this.alloc(e.byteLength):this._view=new Uint8Array(this._buffer,this._view.byteOffset,this._view.byteLength+e.byteLength),this._view.set(e,n)}get end(){return this._view.byteLength===0}alloc(t){let e=new ArrayBuffer((this._buffer.byteLength+t)*1.2|0),n=new Uint8Array(e,0,this._view.byteLength+t);n.set(this._view),this._buffer=e,this._view=n}}});var Oi=ct(()=>{});function qo(){throw new Error("unexpected end of buffer")}function Rr(r,t){return r.byteLength<t&&qo(),r.read(t)}function sr(r){let t=r.readUint8();return t===void 0&&qo(),t}function Ue(r){if(typeof r=="number"&&(r=BigInt(r)),r<BigInt(0))throw new Error("Cannot leb encode negative values.");let t=(r===BigInt(0)?0:Math.ceil(Math.log2(Number(r))))+1,e=new Ne(new ArrayBuffer(t),0);for(;;){let n=Number(r&BigInt(127));if(r/=BigInt(128),r===BigInt(0)){e.write(new Uint8Array([n]));break}else e.write(new Uint8Array([n|128]))}return e.buffer}function or(r){let t=BigInt(1),e=BigInt(0),n;do n=sr(r),e+=BigInt(n&127).valueOf()*t,t*=BigInt(128);while(n>=128);return e}function jt(r){typeof r=="number"&&(r=BigInt(r));let t=r<BigInt(0);t&&(r=-r-BigInt(1));let e=(r===BigInt(0)?0:Math.ceil(Math.log2(Number(r))))+1,n=new Ne(new ArrayBuffer(e),0);for(;;){let s=i(r);if(r/=BigInt(128),t&&r===BigInt(0)&&s&64||!t&&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(t?BigInt(128)-o-BigInt(1):o)}return n.buffer}function Ho(r){let t=new Uint8Array(r.buffer),e=0;for(;e<t.byteLength;e++)if(t[e]<128){if(!(t[e]&64))return or(r);break}let n=new Uint8Array(Rr(r,e+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 Go(r,t){if(BigInt(r)<BigInt(0))throw new Error("Cannot write negative values.");return Pi(r,t)}function Pi(r,t){r=BigInt(r);let e=new Ne(new ArrayBuffer(Math.min(1,t)),0),n=0,i=BigInt(256),s=BigInt(0),o=Number(r%i);for(e.write(new Uint8Array([o]));++n<t;)r<0&&s===BigInt(0)&&o!==0&&(s=BigInt(1)),o=Number((r/i-s)%BigInt(256)),e.write(new Uint8Array([o])),i*=BigInt(256);return e.buffer}function ki(r,t){let e=BigInt(sr(r)),n=BigInt(1),i=0;for(;++i<t;){n*=BigInt(256);let s=BigInt(sr(r));e=e+n*s}return e}function Ko(r,t){let e=ki(r,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return e>=n&&(e-=n*BigInt(2)),e}var Mi=ct(()=>{yn()});function wn(r){let t=BigInt(r);if(r<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}var Do=ct(()=>{});function df(r){if(sr(r)!==1)throw new Error("Cannot decode principal");let e=Number(or(r));return It.fromUint8Array(new Uint8Array(Rr(r,e)))}function zt(r){let t=JSON.stringify(r,(e,n)=>typeof n=="bigint"?`BigInt(${n})`:n);return t&&t.length>jo?t.substring(0,jo-3)+"...":t}var jo,Fr,Wt,Ci,$i,Vi,Li,qi,Hi,Gi,Ki,Di,gn,ar,cr,Or,ji,kd,Md,Cd,$d,Vd,Ld,qd,Hd,Gd,Kd,Dd,jd,Wd,zd,Yd,Xd,Jd,Zd,Qd,zi=ct(()=>{te();yn();Oi();Mi();Do();jo=400,Fr=class{display(){return this.name}valueToString(t){return zt(t)}buildTypeTable(t){t.has(this)||this._buildTypeTableImpl(t)}},Wt=class extends Fr{checkType(t){if(this.name!==t.name)throw new Error(`type mismatch: type on the wire ${t.name}, expect type ${this.name}`);return t}_buildTypeTableImpl(t){}},Ci=class extends Fr{checkType(t){if(t instanceof Or){let e=t.getType();if(typeof e>"u")throw new Error("type mismatch with uninitialized type");return e}throw new Error(`type mismatch: type on the wire ${t.name}, expect type ${this.name}`)}encodeType(t){return t.indexOf(this.name)}},$i=class extends Wt{accept(t,e){return t.visitEmpty(this,e)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${zt(t)}`)}encodeValue(){throw new Error("Empty cannot appear as a function argument")}valueToString(){throw new Error("Empty cannot appear as a value")}encodeType(){return jt(-17)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}},Vi=class extends Fr{checkType(t){throw new Error("Method not implemented for unknown.")}accept(t,e){throw t.visitType(this,e)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${zt(t)}`)}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(t,e){let n=e.decodeValue(t,e);Object(n)!==n&&(n=Object(n));let i;return e instanceof Or?i=()=>e.getType():i=()=>e,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"}},Li=class extends Wt{accept(t,e){return t.visitBool(this,e)}covariant(t){if(typeof t=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${zt(t)}`)}encodeValue(t){return new Uint8Array([t?1:0])}encodeType(){return jt(-2)}decodeValue(t,e){switch(this.checkType(e),sr(t)){case 0:return!1;case 1:return!0;default:throw new Error("Boolean value out of range")}}get name(){return"bool"}},qi=class extends Wt{accept(t,e){return t.visitNull(this,e)}covariant(t){if(t===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${zt(t)}`)}encodeValue(){return new ArrayBuffer(0)}encodeType(){return jt(-1)}decodeValue(t,e){return this.checkType(e),null}get name(){return"null"}},Hi=class extends Wt{accept(t,e){return t.visitReserved(this,e)}covariant(t){return!0}encodeValue(){return new ArrayBuffer(0)}encodeType(){return jt(-16)}decodeValue(t,e){return e.name!==this.name&&e.decodeValue(t,e),null}get name(){return"reserved"}},Gi=class extends Wt{accept(t,e){return t.visitText(this,e)}covariant(t){if(typeof t=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${zt(t)}`)}encodeValue(t){let e=new TextEncoder().encode(t),n=Ue(e.byteLength);return Fi(n,e)}encodeType(){return jt(-15)}decodeValue(t,e){this.checkType(e);let n=or(t),i=Rr(t,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(i)}get name(){return"text"}valueToString(t){return'"'+t+'"'}},Ki=class extends Wt{accept(t,e){return t.visitInt(this,e)}covariant(t){if(typeof t=="bigint"||Number.isInteger(t))return!0;throw new Error(`Invalid ${this.display()} argument: ${zt(t)}`)}encodeValue(t){return jt(t)}encodeType(){return jt(-4)}decodeValue(t,e){return this.checkType(e),Ho(t)}get name(){return"int"}valueToString(t){return t.toString()}},Di=class extends Wt{accept(t,e){return t.visitNat(this,e)}covariant(t){if(typeof t=="bigint"&&t>=BigInt(0)||Number.isInteger(t)&&t>=0)return!0;throw new Error(`Invalid ${this.display()} argument: ${zt(t)}`)}encodeValue(t){return Ue(t)}encodeType(){return jt(-3)}decodeValue(t,e){return this.checkType(e),or(t)}get name(){return"nat"}valueToString(t){return t.toString()}},gn=class extends Wt{constructor(t){if(super(),this._bits=t,t!==32&&t!==64)throw new Error("not a valid float type")}accept(t,e){return t.visitFloat(this,e)}covariant(t){if(typeof t=="number"||t instanceof Number)return!0;throw new Error(`Invalid ${this.display()} argument: ${zt(t)}`)}encodeValue(t){let e=new ArrayBuffer(this._bits/8),n=new DataView(e);return this._bits===32?n.setFloat32(0,t,!0):n.setFloat64(0,t,!0),e}encodeType(){let t=this._bits===32?-13:-14;return jt(t)}decodeValue(t,e){this.checkType(e);let n=Rr(t,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(t){return t.toString()}},ar=class extends Wt{constructor(t){super(),this._bits=t}accept(t,e){return t.visitFixedInt(this,e)}covariant(t){let e=wn(this._bits-1)*BigInt(-1),n=wn(this._bits-1)-BigInt(1),i=!1;if(typeof t=="bigint")i=t>=e&&t<=n;else if(Number.isInteger(t)){let s=BigInt(t);i=s>=e&&s<=n}else i=!1;if(i)return!0;throw new Error(`Invalid ${this.display()} argument: ${zt(t)}`)}encodeValue(t){return Pi(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return jt(-9-t)}decodeValue(t,e){this.checkType(e);let n=Ko(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(t){return t.toString()}},cr=class extends Wt{constructor(t){super(),this._bits=t}accept(t,e){return t.visitFixedNat(this,e)}covariant(t){let e=wn(this._bits),n=!1;if(typeof t=="bigint"&&t>=BigInt(0)?n=t<e:Number.isInteger(t)&&t>=0?n=BigInt(t)<e:n=!1,n)return!0;throw new Error(`Invalid ${this.display()} argument: ${zt(t)}`)}encodeValue(t){return Go(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return jt(-5-t)}decodeValue(t,e){this.checkType(e);let n=ki(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(t){return t.toString()}},Or=class r extends Ci{constructor(){super(...arguments),this._id=r._counter++,this._type=void 0}accept(t,e){if(!this._type)throw Error("Recursive type uninitialized.");return t.visitRec(this,this._type,e)}fill(t){this._type=t}getType(){return this._type}covariant(t){if(this._type&&this._type.covariant(t))return!0;throw new Error(`Invalid ${this.display()} argument: ${zt(t)}`)}encodeValue(t){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.encodeValue(t)}_buildTypeTableImpl(t){if(!this._type)throw Error("Recursive type uninitialized.");t.add(this,new Uint8Array([])),this._type.buildTypeTable(t),t.merge(this,this._type.name)}decodeValue(t,e){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.decodeValue(t,e)}get name(){return`rec_${this._id}`}display(){if(!this._type)throw Error("Recursive type uninitialized.");return`\u03BC${this.name}.${this._type.name}`}valueToString(t){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.valueToString(t)}};Or._counter=0;ji=class extends Wt{accept(t,e){return t.visitPrincipal(this,e)}covariant(t){if(t&&t._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${zt(t)}`)}encodeValue(t){let e=t.toUint8Array(),n=Ue(e.byteLength);return Fi(new Uint8Array([1]),n,e)}encodeType(){return jt(-24)}decodeValue(t,e){return this.checkType(e),df(t)}get name(){return"principal"}valueToString(t){return`${this.name} "${t.toText()}"`}};kd=new $i,Md=new Hi,Cd=new Vi,$d=new Li,Vd=new qi,Ld=new Gi,qd=new Ki,Hd=new Di,Gd=new gn(32),Kd=new gn(64),Dd=new ar(8),jd=new ar(16),Wd=new ar(32),zd=new ar(64),Yd=new cr(8),Xd=new cr(16),Jd=new cr(32),Zd=new cr(64),Qd=new ji});var Yi=ct(()=>{});var Wo=ct(()=>{zi();te();Yi()});var zo=ct(()=>{});var ur=ct(()=>{Wo();Yi();zi();Oi();Mi();yn();zo()});var Pr=Bt(lr=>{"use strict";var Xi=di(),fr=sn(),Yo=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;lr.Buffer=S;lr.SlowBuffer=_f;lr.INSPECT_MAX_BYTES=50;var mn=2147483647;lr.kMaxLength=mn;S.TYPED_ARRAY_SUPPORT=yf();!S.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function yf(){try{var r=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(r,t),r.foo()===42}catch{return!1}}Object.defineProperty(S.prototype,"parent",{enumerable:!0,get:function(){if(S.isBuffer(this))return this.buffer}});Object.defineProperty(S.prototype,"offset",{enumerable:!0,get:function(){if(S.isBuffer(this))return this.byteOffset}});function _e(r){if(r>mn)throw new RangeError('The value "'+r+'" is invalid for option "size"');var t=new Uint8Array(r);return Object.setPrototypeOf(t,S.prototype),t}function S(r,t,e){if(typeof r=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return ts(r)}return Zo(r,t,e)}S.poolSize=8192;function Zo(r,t,e){if(typeof r=="string")return gf(r,t);if(ArrayBuffer.isView(r))return mf(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(he(r,ArrayBuffer)||r&&he(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(he(r,SharedArrayBuffer)||r&&he(r.buffer,SharedArrayBuffer)))return Zi(r,t,e);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return S.from(n,t,e);var i=xf(r);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return S.from(r[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}S.from=function(r,t,e){return Zo(r,t,e)};Object.setPrototypeOf(S.prototype,Uint8Array.prototype);Object.setPrototypeOf(S,Uint8Array);function Qo(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function wf(r,t,e){return Qo(r),r<=0?_e(r):t!==void 0?typeof e=="string"?_e(r).fill(t,e):_e(r).fill(t):_e(r)}S.alloc=function(r,t,e){return wf(r,t,e)};function ts(r){return Qo(r),_e(r<0?0:es(r)|0)}S.allocUnsafe=function(r){return ts(r)};S.allocUnsafeSlow=function(r){return ts(r)};function gf(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!S.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var e=ta(r,t)|0,n=_e(e),i=n.write(r,t);return i!==e&&(n=n.slice(0,i)),n}function Ji(r){for(var t=r.length<0?0:es(r.length)|0,e=_e(t),n=0;n<t;n+=1)e[n]=r[n]&255;return e}function mf(r){if(he(r,Uint8Array)){var t=new Uint8Array(r);return Zi(t.buffer,t.byteOffset,t.byteLength)}return Ji(r)}function Zi(r,t,e){if(t<0||r.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<t+(e||0))throw new RangeError('"length" is outside of buffer bounds');var n;return t===void 0&&e===void 0?n=new Uint8Array(r):e===void 0?n=new Uint8Array(r,t):n=new Uint8Array(r,t,e),Object.setPrototypeOf(n,S.prototype),n}function xf(r){if(S.isBuffer(r)){var t=es(r.length)|0,e=_e(t);return e.length===0||r.copy(e,0,0,t),e}if(r.length!==void 0)return typeof r.length!="number"||rs(r.length)?_e(0):Ji(r);if(r.type==="Buffer"&&Array.isArray(r.data))return Ji(r.data)}function es(r){if(r>=mn)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+mn.toString(16)+" bytes");return r|0}function _f(r){return+r!=r&&(r=0),S.alloc(+r)}S.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==S.prototype};S.compare=function(t,e){if(he(t,Uint8Array)&&(t=S.from(t,t.offset,t.byteLength)),he(e,Uint8Array)&&(e=S.from(e,e.offset,e.byteLength)),!S.isBuffer(t)||!S.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var n=t.length,i=e.length,s=0,o=Math.min(n,i);s<o;++s)if(t[s]!==e[s]){n=t[s],i=e[s];break}return n<i?-1:i<n?1:0};S.isEncoding=function(t){switch(String(t).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}};S.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return S.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var i=S.allocUnsafe(e),s=0;for(n=0;n<t.length;++n){var o=t[n];if(he(o,Uint8Array))s+o.length>i.length?S.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if(S.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function ta(r,t){if(S.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||he(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);var e=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&e===0)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return Qi(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return oa(r).length;default:if(i)return n?-1:Qi(r).length;t=(""+t).toLowerCase(),i=!0}}S.byteLength=ta;function bf(r,t,e){var n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(r||(r="utf8");;)switch(r){case"hex":return Rf(this,t,e);case"utf8":case"utf-8":return ra(this,t,e);case"ascii":return Nf(this,t,e);case"latin1":case"binary":return Uf(this,t,e);case"base64":return Bf(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ff(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}S.prototype._isBuffer=!0;function qe(r,t,e){var n=r[t];r[t]=r[e],r[e]=n}S.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)qe(this,e,e+1);return this};S.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)qe(this,e,e+3),qe(this,e+1,e+2);return this};S.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)qe(this,e,e+7),qe(this,e+1,e+6),qe(this,e+2,e+5),qe(this,e+3,e+4);return this};S.prototype.toString=function(){var t=this.length;return t===0?"":arguments.length===0?ra(this,0,t):bf.apply(this,arguments)};S.prototype.toLocaleString=S.prototype.toString;S.prototype.equals=function(t){if(!S.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:S.compare(this,t)===0};S.prototype.inspect=function(){var t="",e=lr.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"};Yo&&(S.prototype[Yo]=S.prototype.inspect);S.prototype.compare=function(t,e,n,i,s){if(he(t,Uint8Array)&&(t=S.from(t,t.offset,t.byteLength)),!S.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),e<0||n>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&e>=n)return 0;if(i>=s)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var o=s-i,c=n-e,u=Math.min(o,c),w=this.slice(i,s),y=t.slice(e,n),m=0;m<u;++m)if(w[m]!==y[m]){o=w[m],c=y[m];break}return o<c?-1:c<o?1:0};function ea(r,t,e,n,i){if(r.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,rs(e)&&(e=i?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(i)return-1;e=r.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=S.from(t,n)),S.isBuffer(t))return t.length===0?-1:Xo(r,t,e,n,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):Xo(r,[t],e,n,i);throw new TypeError("val must be string, number or Buffer")}function Xo(r,t,e,n,i){var s=1,o=r.length,c=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;s=2,o/=2,c/=2,e/=2}function u(M,O){return s===1?M[O]:M.readUInt16BE(O*s)}var w;if(i){var y=-1;for(w=e;w<o;w++)if(u(r,w)===u(t,y===-1?0:w-y)){if(y===-1&&(y=w),w-y+1===c)return y*s}else y!==-1&&(w-=w-y),y=-1}else for(e+c>o&&(e=o-c),w=e;w>=0;w--){for(var m=!0,N=0;N<c;N++)if(u(r,w+N)!==u(t,N)){m=!1;break}if(m)return w}return-1}S.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1};S.prototype.indexOf=function(t,e,n){return ea(this,t,e,n,!0)};S.prototype.lastIndexOf=function(t,e,n){return ea(this,t,e,n,!1)};function Ef(r,t,e,n){e=Number(e)||0;var i=r.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;var s=t.length;n>s/2&&(n=s/2);for(var o=0;o<n;++o){var c=parseInt(t.substr(o*2,2),16);if(rs(c))return o;r[e+o]=c}return o}function Af(r,t,e,n){return xn(Qi(t,r.length-e),r,e,n)}function vf(r,t,e,n){return xn(kf(t),r,e,n)}function Tf(r,t,e,n){return xn(oa(t),r,e,n)}function Sf(r,t,e,n){return xn(Mf(t,r.length-e),r,e,n)}S.prototype.write=function(t,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e>>>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-e;if((n===void 0||n>s)&&(n=s),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return Ef(this,t,e,n);case"utf8":case"utf-8":return Af(this,t,e,n);case"ascii":case"latin1":case"binary":return vf(this,t,e,n);case"base64":return Tf(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Sf(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};S.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Bf(r,t,e){return t===0&&e===r.length?Xi.fromByteArray(r):Xi.fromByteArray(r.slice(t,e))}function ra(r,t,e){e=Math.min(r.length,e);for(var n=[],i=t;i<e;){var s=r[i],o=null,c=s>239?4:s>223?3:s>191?2:1;if(i+c<=e){var u,w,y,m;switch(c){case 1:s<128&&(o=s);break;case 2:u=r[i+1],(u&192)===128&&(m=(s&31)<<6|u&63,m>127&&(o=m));break;case 3:u=r[i+1],w=r[i+2],(u&192)===128&&(w&192)===128&&(m=(s&15)<<12|(u&63)<<6|w&63,m>2047&&(m<55296||m>57343)&&(o=m));break;case 4:u=r[i+1],w=r[i+2],y=r[i+3],(u&192)===128&&(w&192)===128&&(y&192)===128&&(m=(s&15)<<18|(u&63)<<12|(w&63)<<6|y&63,m>65535&&m<1114112&&(o=m))}}o===null?(o=65533,c=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=c}return If(n)}var Jo=4096;function If(r){var t=r.length;if(t<=Jo)return String.fromCharCode.apply(String,r);for(var e="",n=0;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=Jo));return e}function Nf(r,t,e){var n="";e=Math.min(r.length,e);for(var i=t;i<e;++i)n+=String.fromCharCode(r[i]&127);return n}function Uf(r,t,e){var n="";e=Math.min(r.length,e);for(var i=t;i<e;++i)n+=String.fromCharCode(r[i]);return n}function Rf(r,t,e){var n=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>n)&&(e=n);for(var i="",s=t;s<e;++s)i+=Cf[r[s]];return i}function Ff(r,t,e){for(var n=r.slice(t,e),i="",s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}S.prototype.slice=function(t,e){var n=this.length;t=~~t,e=e===void 0?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);var i=this.subarray(t,e);return Object.setPrototypeOf(i,S.prototype),i};function Mt(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}S.prototype.readUintLE=S.prototype.readUIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||Mt(t,e,this.length);for(var i=this[t],s=1,o=0;++o<e&&(s*=256);)i+=this[t+o]*s;return i};S.prototype.readUintBE=S.prototype.readUIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||Mt(t,e,this.length);for(var i=this[t+--e],s=1;e>0&&(s*=256);)i+=this[t+--e]*s;return i};S.prototype.readUint8=S.prototype.readUInt8=function(t,e){return t=t>>>0,e||Mt(t,1,this.length),this[t]};S.prototype.readUint16LE=S.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||Mt(t,2,this.length),this[t]|this[t+1]<<8};S.prototype.readUint16BE=S.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||Mt(t,2,this.length),this[t]<<8|this[t+1]};S.prototype.readUint32LE=S.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||Mt(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};S.prototype.readUint32BE=S.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||Mt(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};S.prototype.readIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||Mt(t,e,this.length);for(var i=this[t],s=1,o=0;++o<e&&(s*=256);)i+=this[t+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i};S.prototype.readIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||Mt(t,e,this.length);for(var i=e,s=1,o=this[t+--i];i>0&&(s*=256);)o+=this[t+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*e)),o};S.prototype.readInt8=function(t,e){return t=t>>>0,e||Mt(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};S.prototype.readInt16LE=function(t,e){t=t>>>0,e||Mt(t,2,this.length);var n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};S.prototype.readInt16BE=function(t,e){t=t>>>0,e||Mt(t,2,this.length);var n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};S.prototype.readInt32LE=function(t,e){return t=t>>>0,e||Mt(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};S.prototype.readInt32BE=function(t,e){return t=t>>>0,e||Mt(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};S.prototype.readFloatLE=function(t,e){return t=t>>>0,e||Mt(t,4,this.length),fr.read(this,t,!0,23,4)};S.prototype.readFloatBE=function(t,e){return t=t>>>0,e||Mt(t,4,this.length),fr.read(this,t,!1,23,4)};S.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||Mt(t,8,this.length),fr.read(this,t,!0,52,8)};S.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||Mt(t,8,this.length),fr.read(this,t,!1,52,8)};function Ht(r,t,e,n,i,s){if(!S.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(e+n>r.length)throw new RangeError("Index out of range")}S.prototype.writeUintLE=S.prototype.writeUIntLE=function(t,e,n,i){if(t=+t,e=e>>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Ht(this,t,e,n,s,0)}var o=1,c=0;for(this[e]=t&255;++c<n&&(o*=256);)this[e+c]=t/o&255;return e+n};S.prototype.writeUintBE=S.prototype.writeUIntBE=function(t,e,n,i){if(t=+t,e=e>>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Ht(this,t,e,n,s,0)}var o=n-1,c=1;for(this[e+o]=t&255;--o>=0&&(c*=256);)this[e+o]=t/c&255;return e+n};S.prototype.writeUint8=S.prototype.writeUInt8=function(t,e,n){return t=+t,e=e>>>0,n||Ht(this,t,e,1,255,0),this[e]=t&255,e+1};S.prototype.writeUint16LE=S.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||Ht(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};S.prototype.writeUint16BE=S.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||Ht(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};S.prototype.writeUint32LE=S.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||Ht(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4};S.prototype.writeUint32BE=S.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||Ht(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};S.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e=e>>>0,!i){var s=Math.pow(2,8*n-1);Ht(this,t,e,n,s-1,-s)}var o=0,c=1,u=0;for(this[e]=t&255;++o<n&&(c*=256);)t<0&&u===0&&this[e+o-1]!==0&&(u=1),this[e+o]=(t/c>>0)-u&255;return e+n};S.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e=e>>>0,!i){var s=Math.pow(2,8*n-1);Ht(this,t,e,n,s-1,-s)}var o=n-1,c=1,u=0;for(this[e+o]=t&255;--o>=0&&(c*=256);)t<0&&u===0&&this[e+o+1]!==0&&(u=1),this[e+o]=(t/c>>0)-u&255;return e+n};S.prototype.writeInt8=function(t,e,n){return t=+t,e=e>>>0,n||Ht(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};S.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||Ht(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};S.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||Ht(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};S.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||Ht(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4};S.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||Ht(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function na(r,t,e,n,i,s){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function ia(r,t,e,n,i){return t=+t,e=e>>>0,i||na(r,t,e,4,34028234663852886e22,-34028234663852886e22),fr.write(r,t,e,n,23,4),e+4}S.prototype.writeFloatLE=function(t,e,n){return ia(this,t,e,!0,n)};S.prototype.writeFloatBE=function(t,e,n){return ia(this,t,e,!1,n)};function sa(r,t,e,n,i){return t=+t,e=e>>>0,i||na(r,t,e,8,17976931348623157e292,-17976931348623157e292),fr.write(r,t,e,n,52,8),e+8}S.prototype.writeDoubleLE=function(t,e,n){return sa(this,t,e,!0,n)};S.prototype.writeDoubleBE=function(t,e,n){return sa(this,t,e,!1,n)};S.prototype.copy=function(t,e,n,i){if(!S.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-n&&(i=t.length-e+n);var s=i-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(e,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),e),s};S.prototype.fill=function(t,e,n,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!S.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){var s=t.charCodeAt(0);(i==="utf8"&&s<128||i==="latin1")&&(t=s)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);var o;if(typeof t=="number")for(o=e;o<n;++o)this[o]=t;else{var c=S.isBuffer(t)?t:S.from(t,i),u=c.length;if(u===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<n-e;++o)this[o+e]=c[o%u]}return this};var Of=/[^+/0-9A-Za-z-_]/g;function Pf(r){if(r=r.split("=")[0],r=r.trim().replace(Of,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Qi(r,t){t=t||1/0;for(var e,n=r.length,i=null,s=[],o=0;o<n;++o){if(e=r.charCodeAt(o),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;s.push(e)}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return s}function kf(r){for(var t=[],e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function Mf(r,t){for(var e,n,i,s=[],o=0;o<r.length&&!((t-=2)<0);++o)e=r.charCodeAt(o),n=e>>8,i=e%256,s.push(i),s.push(n);return s}function oa(r){return Xi.toByteArray(Pf(r))}function xn(r,t,e,n){for(var i=0;i<n&&!(i+e>=t.length||i>=r.length);++i)t[i+e]=r[i];return i}function he(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function rs(r){return r!==r}var Cf=function(){for(var r="0123456789abcdef",t=new Array(256),e=0;e<16;++e)for(var n=e*16,i=0;i<16;++i)t[n+i]=r[e]+r[i];return t}()});var kr=Bt((aa,_n)=>{(function(r){"use strict";var t,e=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",c=1e14,u=14,w=9007199254740991,y=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],m=1e7,N=1e9;function M(C){var H,nt,Y,R=B.prototype={constructor:B,toString:null,valueOf:null},it=new B(1),st=20,ot=4,wt=-7,Ot=21,V=-1e7,U=1e7,P=!1,L=1,K=0,J={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},tt="0123456789abcdefghijklmnopqrstuvwxyz",ut=!0;function B(a,f){var l,b,g,_,v,d,x,A,E=this;if(!(E instanceof B))return new B(a,f);if(f==null){if(a&&a._isBigNumber===!0){E.s=a.s,!a.c||a.e>U?E.c=E.e=null:a.e<V?E.c=[E.e=0]:(E.e=a.e,E.c=a.c.slice());return}if((d=typeof a=="number")&&a*0==0){if(E.s=1/a<0?(a=-a,-1):1,a===~~a){for(_=0,v=a;v>=10;v/=10,_++);_>U?E.c=E.e=null:(E.e=_,E.c=[a]);return}A=String(a)}else{if(!e.test(A=String(a)))return Y(E,A,d);E.s=A.charCodeAt(0)==45?(A=A.slice(1),-1):1}(_=A.indexOf("."))>-1&&(A=A.replace(".","")),(v=A.search(/e/i))>0?(_<0&&(_=v),_+=+A.slice(v+1),A=A.substring(0,v)):_<0&&(_=A.length)}else{if(j(f,2,tt.length,"Base"),f==10&&ut)return E=new B(a),gt(E,st+E.e+1,ot);if(A=String(a),d=typeof a=="number"){if(a*0!=0)return Y(E,A,d,f);if(E.s=1/a<0?(A=A.slice(1),-1):1,B.DEBUG&&A.replace(/^0\.0*|\./,"").length>15)throw Error(o+a)}else E.s=A.charCodeAt(0)===45?(A=A.slice(1),-1):1;for(l=tt.slice(0,f),_=v=0,x=A.length;v<x;v++)if(l.indexOf(b=A.charAt(v))<0){if(b=="."){if(v>_){_=x;continue}}else if(!g&&(A==A.toUpperCase()&&(A=A.toLowerCase())||A==A.toLowerCase()&&(A=A.toUpperCase()))){g=!0,v=-1,_=0;continue}return Y(E,String(a),d,f)}d=!1,A=nt(A,f,10,E.s),(_=A.indexOf("."))>-1?A=A.replace(".",""):_=A.length}for(v=0;A.charCodeAt(v)===48;v++);for(x=A.length;A.charCodeAt(--x)===48;);if(A=A.slice(v,++x)){if(x-=v,d&&B.DEBUG&&x>15&&(a>w||a!==i(a)))throw Error(o+E.s*a);if((_=_-v-1)>U)E.c=E.e=null;else if(_<V)E.c=[E.e=0];else{if(E.e=_,E.c=[],v=(_+1)%u,_<0&&(v+=u),v<x){for(v&&E.c.push(+A.slice(0,v)),x-=u;v<x;)E.c.push(+A.slice(v,v+=u));v=u-(A=A.slice(v)).length}else v-=x;for(;v--;A+="0");E.c.push(+A)}}else E.c=[E.e=0]}B.clone=M,B.ROUND_UP=0,B.ROUND_DOWN=1,B.ROUND_CEIL=2,B.ROUND_FLOOR=3,B.ROUND_HALF_UP=4,B.ROUND_HALF_DOWN=5,B.ROUND_HALF_EVEN=6,B.ROUND_HALF_CEIL=7,B.ROUND_HALF_FLOOR=8,B.EUCLID=9,B.config=B.set=function(a){var f,l;if(a!=null)if(typeof a=="object"){if(a.hasOwnProperty(f="DECIMAL_PLACES")&&(l=a[f],j(l,0,N,f),st=l),a.hasOwnProperty(f="ROUNDING_MODE")&&(l=a[f],j(l,0,8,f),ot=l),a.hasOwnProperty(f="EXPONENTIAL_AT")&&(l=a[f],l&&l.pop?(j(l[0],-N,0,f),j(l[1],0,N,f),wt=l[0],Ot=l[1]):(j(l,-N,N,f),wt=-(Ot=l<0?-l:l))),a.hasOwnProperty(f="RANGE"))if(l=a[f],l&&l.pop)j(l[0],-N,-1,f),j(l[1],1,N,f),V=l[0],U=l[1];else if(j(l,-N,N,f),l)V=-(U=l<0?-l:l);else throw Error(s+f+" cannot be zero: "+l);if(a.hasOwnProperty(f="CRYPTO"))if(l=a[f],l===!!l)if(l)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))P=l;else throw P=!l,Error(s+"crypto unavailable");else P=l;else throw Error(s+f+" not true or false: "+l);if(a.hasOwnProperty(f="MODULO_MODE")&&(l=a[f],j(l,0,9,f),L=l),a.hasOwnProperty(f="POW_PRECISION")&&(l=a[f],j(l,0,N,f),K=l),a.hasOwnProperty(f="FORMAT"))if(l=a[f],typeof l=="object")J=l;else throw Error(s+f+" not an object: "+l);if(a.hasOwnProperty(f="ALPHABET"))if(l=a[f],typeof l=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(l))ut=l.slice(0,10)=="0123456789",tt=l;else throw Error(s+f+" invalid: "+l)}else throw Error(s+"Object expected: "+a);return{DECIMAL_PLACES:st,ROUNDING_MODE:ot,EXPONENTIAL_AT:[wt,Ot],RANGE:[V,U],CRYPTO:P,MODULO_MODE:L,POW_PRECISION:K,FORMAT:J,ALPHABET:tt}},B.isBigNumber=function(a){if(!a||a._isBigNumber!==!0)return!1;if(!B.DEBUG)return!0;var f,l,b=a.c,g=a.e,_=a.s;t:if({}.toString.call(b)=="[object Array]"){if((_===1||_===-1)&&g>=-N&&g<=N&&g===i(g)){if(b[0]===0){if(g===0&&b.length===1)return!0;break t}if(f=(g+1)%u,f<1&&(f+=u),String(b[0]).length==f){for(f=0;f<b.length;f++)if(l=b[f],l<0||l>=c||l!==i(l))break t;if(l!==0)return!0}}}else if(b===null&&g===null&&(_===null||_===1||_===-1))return!0;throw Error(s+"Invalid BigNumber: "+a)},B.maximum=B.max=function(){return mt(arguments,-1)},B.minimum=B.min=function(){return mt(arguments,1)},B.random=function(){var a=9007199254740992,f=Math.random()*a&2097151?function(){return i(Math.random()*a)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(l){var b,g,_,v,d,x=0,A=[],E=new B(it);if(l==null?l=st:j(l,0,N),v=n(l/u),P)if(crypto.getRandomValues){for(b=crypto.getRandomValues(new Uint32Array(v*=2));x<v;)d=b[x]*131072+(b[x+1]>>>11),d>=9e15?(g=crypto.getRandomValues(new Uint32Array(2)),b[x]=g[0],b[x+1]=g[1]):(A.push(d%1e14),x+=2);x=v/2}else if(crypto.randomBytes){for(b=crypto.randomBytes(v*=7);x<v;)d=(b[x]&31)*281474976710656+b[x+1]*1099511627776+b[x+2]*4294967296+b[x+3]*16777216+(b[x+4]<<16)+(b[x+5]<<8)+b[x+6],d>=9e15?crypto.randomBytes(7).copy(b,x):(A.push(d%1e14),x+=7);x=v/7}else throw P=!1,Error(s+"crypto unavailable");if(!P)for(;x<v;)d=f(),d<9e15&&(A[x++]=d%1e14);for(v=A[--x],l%=u,v&&l&&(d=y[u-l],A[x]=i(v/d)*d);A[x]===0;A.pop(),x--);if(x<0)A=[_=0];else{for(_=-1;A[0]===0;A.splice(0,1),_-=u);for(x=1,d=A[0];d>=10;d/=10,x++);x<u&&(_-=u-x)}return E.e=_,E.c=A,E}}(),B.sum=function(){for(var a=1,f=arguments,l=new B(f[0]);a<f.length;)l=l.plus(f[a++]);return l},nt=function(){var a="0123456789";function f(l,b,g,_){for(var v,d=[0],x,A=0,E=l.length;A<E;){for(x=d.length;x--;d[x]*=b);for(d[0]+=_.indexOf(l.charAt(A++)),v=0;v<d.length;v++)d[v]>g-1&&(d[v+1]==null&&(d[v+1]=0),d[v+1]+=d[v]/g|0,d[v]%=g)}return d.reverse()}return function(l,b,g,_,v){var d,x,A,E,I,F,$,Z,ht=l.indexOf("."),xt=st,X=ot;for(ht>=0&&(E=K,K=0,l=l.replace(".",""),Z=new B(b),F=Z.pow(l.length-ht),K=E,Z.c=f(yt(G(F.c),F.e,"0"),10,g,a),Z.e=Z.c.length),$=f(l,b,g,v?(d=tt,a):(d=a,tt)),A=E=$.length;$[--E]==0;$.pop());if(!$[0])return d.charAt(0);if(ht<0?--A:(F.c=$,F.e=A,F.s=_,F=H(F,Z,xt,X,g),$=F.c,I=F.r,A=F.e),x=A+xt+1,ht=$[x],E=g/2,I=I||x<0||$[x+1]!=null,I=X<4?(ht!=null||I)&&(X==0||X==(F.s<0?3:2)):ht>E||ht==E&&(X==4||I||X==6&&$[x-1]&1||X==(F.s<0?8:7)),x<1||!$[0])l=I?yt(d.charAt(1),-xt,d.charAt(0)):d.charAt(0);else{if($.length=x,I)for(--g;++$[--x]>g;)$[x]=0,x||(++A,$=[1].concat($));for(E=$.length;!$[--E];);for(ht=0,l="";ht<=E;l+=d.charAt($[ht++]));l=yt(l,A,d.charAt(0))}return l}}(),H=function(){function a(b,g,_){var v,d,x,A,E=0,I=b.length,F=g%m,$=g/m|0;for(b=b.slice();I--;)x=b[I]%m,A=b[I]/m|0,v=$*x+A*F,d=F*x+v%m*m+E,E=(d/_|0)+(v/m|0)+$*A,b[I]=d%_;return E&&(b=[E].concat(b)),b}function f(b,g,_,v){var d,x;if(_!=v)x=_>v?1:-1;else for(d=x=0;d<_;d++)if(b[d]!=g[d]){x=b[d]>g[d]?1:-1;break}return x}function l(b,g,_,v){for(var d=0;_--;)b[_]-=d,d=b[_]<g[_]?1:0,b[_]=d*v+b[_]-g[_];for(;!b[0]&&b.length>1;b.splice(0,1));}return function(b,g,_,v,d){var x,A,E,I,F,$,Z,ht,xt,X,q,Tt,ve,$e,Sr,Zt,at,Lt=b.s==g.s?1:-1,Ct=b.c,_t=g.c;if(!Ct||!Ct[0]||!_t||!_t[0])return new B(!b.s||!g.s||(Ct?_t&&Ct[0]==_t[0]:!_t)?NaN:Ct&&Ct[0]==0||!_t?Lt*0:Lt/0);for(ht=new B(Lt),xt=ht.c=[],A=b.e-g.e,Lt=_+A+1,d||(d=c,A=O(b.e/u)-O(g.e/u),Lt=Lt/u|0),E=0;_t[E]==(Ct[E]||0);E++);if(_t[E]>(Ct[E]||0)&&A--,Lt<0)xt.push(1),I=!0;else{for($e=Ct.length,Zt=_t.length,E=0,Lt+=2,F=i(d/(_t[0]+1)),F>1&&(_t=a(_t,F,d),Ct=a(Ct,F,d),Zt=_t.length,$e=Ct.length),ve=Zt,X=Ct.slice(0,Zt),q=X.length;q<Zt;X[q++]=0);at=_t.slice(),at=[0].concat(at),Sr=_t[0],_t[1]>=d/2&&Sr++;do{if(F=0,x=f(_t,X,Zt,q),x<0){if(Tt=X[0],Zt!=q&&(Tt=Tt*d+(X[1]||0)),F=i(Tt/Sr),F>1)for(F>=d&&(F=d-1),$=a(_t,F,d),Z=$.length,q=X.length;f($,X,Z,q)==1;)F--,l($,Zt<Z?at:_t,Z,d),Z=$.length,x=1;else F==0&&(x=F=1),$=_t.slice(),Z=$.length;if(Z<q&&($=[0].concat($)),l(X,$,q,d),q=X.length,x==-1)for(;f(_t,X,Zt,q)<1;)F++,l(X,Zt<q?at:_t,q,d),q=X.length}else x===0&&(F++,X=[0]);xt[E++]=F,X[0]?X[q++]=Ct[ve]||0:(X=[Ct[ve]],q=1)}while((ve++<$e||X[0]!=null)&&Lt--);I=X[0]!=null,xt[0]||xt.splice(0,1)}if(d==c){for(E=1,Lt=xt[0];Lt>=10;Lt/=10,E++);gt(ht,_+(ht.e=E+A*u-1)+1,v,I)}else ht.e=A,ht.r=+I;return ht}}();function h(a,f,l,b){var g,_,v,d,x;if(l==null?l=ot:j(l,0,8),!a.c)return a.toString();if(g=a.c[0],v=a.e,f==null)x=G(a.c),x=b==1||b==2&&(v<=wt||v>=Ot)?z(x,v):yt(x,v,"0");else if(a=gt(new B(a),f,l),_=a.e,x=G(a.c),d=x.length,b==1||b==2&&(f<=_||_<=wt)){for(;d<f;x+="0",d++);x=z(x,_)}else if(f-=v,x=yt(x,_,"0"),_+1>d){if(--f>0)for(x+=".";f--;x+="0");}else if(f+=_-d,f>0)for(_+1==d&&(x+=".");f--;x+="0");return a.s<0&&g?"-"+x:x}function mt(a,f){for(var l,b,g=1,_=new B(a[0]);g<a.length;g++)b=new B(a[g]),(!b.s||(l=lt(_,b))===f||l===0&&_.s===f)&&(_=b);return _}function Et(a,f,l){for(var b=1,g=f.length;!f[--g];f.pop());for(g=f[0];g>=10;g/=10,b++);return(l=b+l*u-1)>U?a.c=a.e=null:l<V?a.c=[a.e=0]:(a.e=l,a.c=f),a}Y=function(){var a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,f=/^([^.]+)\.$/,l=/^\.([^.]+)$/,b=/^-?(Infinity|NaN)$/,g=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(_,v,d,x){var A,E=d?v:v.replace(g,"");if(b.test(E))_.s=isNaN(E)?null:E<0?-1:1;else{if(!d&&(E=E.replace(a,function(I,F,$){return A=($=$.toLowerCase())=="x"?16:$=="b"?2:8,!x||x==A?F:I}),x&&(A=x,E=E.replace(f,"$1").replace(l,"0.$1")),v!=E))return new B(E,A);if(B.DEBUG)throw Error(s+"Not a"+(x?" base "+x:"")+" number: "+v);_.s=null}_.c=_.e=null}}();function gt(a,f,l,b){var g,_,v,d,x,A,E,I=a.c,F=y;if(I){t:{for(g=1,d=I[0];d>=10;d/=10,g++);if(_=f-g,_<0)_+=u,v=f,x=I[A=0],E=i(x/F[g-v-1]%10);else if(A=n((_+1)/u),A>=I.length)if(b){for(;I.length<=A;I.push(0));x=E=0,g=1,_%=u,v=_-u+1}else break t;else{for(x=d=I[A],g=1;d>=10;d/=10,g++);_%=u,v=_-u+g,E=v<0?0:i(x/F[g-v-1]%10)}if(b=b||f<0||I[A+1]!=null||(v<0?x:x%F[g-v-1]),b=l<4?(E||b)&&(l==0||l==(a.s<0?3:2)):E>5||E==5&&(l==4||b||l==6&&(_>0?v>0?x/F[g-v]:0:I[A-1])%10&1||l==(a.s<0?8:7)),f<1||!I[0])return I.length=0,b?(f-=a.e+1,I[0]=F[(u-f%u)%u],a.e=-f||0):I[0]=a.e=0,a;if(_==0?(I.length=A,d=1,A--):(I.length=A+1,d=F[u-_],I[A]=v>0?i(x/F[g-v]%F[v])*d:0),b)for(;;)if(A==0){for(_=1,v=I[0];v>=10;v/=10,_++);for(v=I[0]+=d,d=1;v>=10;v/=10,d++);_!=d&&(a.e++,I[0]==c&&(I[0]=1));break}else{if(I[A]+=d,I[A]!=c)break;I[A--]=0,d=1}for(_=I.length;I[--_]===0;I.pop());}a.e>U?a.c=a.e=null:a.e<V&&(a.c=[a.e=0])}return a}function k(a){var f,l=a.e;return l===null?a.toString():(f=G(a.c),f=l<=wt||l>=Ot?z(f,l):yt(f,l,"0"),a.s<0?"-"+f:f)}return R.absoluteValue=R.abs=function(){var a=new B(this);return a.s<0&&(a.s=1),a},R.comparedTo=function(a,f){return lt(this,new B(a,f))},R.decimalPlaces=R.dp=function(a,f){var l,b,g,_=this;if(a!=null)return j(a,0,N),f==null?f=ot:j(f,0,8),gt(new B(_),a+_.e+1,f);if(!(l=_.c))return null;if(b=((g=l.length-1)-O(this.e/u))*u,g=l[g])for(;g%10==0;g/=10,b--);return b<0&&(b=0),b},R.dividedBy=R.div=function(a,f){return H(this,new B(a,f),st,ot)},R.dividedToIntegerBy=R.idiv=function(a,f){return H(this,new B(a,f),0,1)},R.exponentiatedBy=R.pow=function(a,f){var l,b,g,_,v,d,x,A,E,I=this;if(a=new B(a),a.c&&!a.isInteger())throw Error(s+"Exponent not an integer: "+k(a));if(f!=null&&(f=new B(f)),d=a.e>14,!I.c||!I.c[0]||I.c[0]==1&&!I.e&&I.c.length==1||!a.c||!a.c[0])return E=new B(Math.pow(+k(I),d?a.s*(2-W(a)):+k(a))),f?E.mod(f):E;if(x=a.s<0,f){if(f.c?!f.c[0]:!f.s)return new B(NaN);b=!x&&I.isInteger()&&f.isInteger(),b&&(I=I.mod(f))}else{if(a.e>9&&(I.e>0||I.e<-1||(I.e==0?I.c[0]>1||d&&I.c[1]>=24e7:I.c[0]<8e13||d&&I.c[0]<=9999975e7)))return _=I.s<0&&W(a)?-0:0,I.e>-1&&(_=1/_),new B(x?1/_:_);K&&(_=n(K/u+2))}for(d?(l=new B(.5),x&&(a.s=1),A=W(a)):(g=Math.abs(+k(a)),A=g%2),E=new B(it);;){if(A){if(E=E.times(I),!E.c)break;_?E.c.length>_&&(E.c.length=_):b&&(E=E.mod(f))}if(g){if(g=i(g/2),g===0)break;A=g%2}else if(a=a.times(l),gt(a,a.e+1,1),a.e>14)A=W(a);else{if(g=+k(a),g===0)break;A=g%2}I=I.times(I),_?I.c&&I.c.length>_&&(I.c.length=_):b&&(I=I.mod(f))}return b?E:(x&&(E=it.div(E)),f?E.mod(f):_?gt(E,K,ot,v):E)},R.integerValue=function(a){var f=new B(this);return a==null?a=ot:j(a,0,8),gt(f,f.e+1,a)},R.isEqualTo=R.eq=function(a,f){return lt(this,new B(a,f))===0},R.isFinite=function(){return!!this.c},R.isGreaterThan=R.gt=function(a,f){return lt(this,new B(a,f))>0},R.isGreaterThanOrEqualTo=R.gte=function(a,f){return(f=lt(this,new B(a,f)))===1||f===0},R.isInteger=function(){return!!this.c&&O(this.e/u)>this.c.length-2},R.isLessThan=R.lt=function(a,f){return lt(this,new B(a,f))<0},R.isLessThanOrEqualTo=R.lte=function(a,f){return(f=lt(this,new B(a,f)))===-1||f===0},R.isNaN=function(){return!this.s},R.isNegative=function(){return this.s<0},R.isPositive=function(){return this.s>0},R.isZero=function(){return!!this.c&&this.c[0]==0},R.minus=function(a,f){var l,b,g,_,v=this,d=v.s;if(a=new B(a,f),f=a.s,!d||!f)return new B(NaN);if(d!=f)return a.s=-f,v.plus(a);var x=v.e/u,A=a.e/u,E=v.c,I=a.c;if(!x||!A){if(!E||!I)return E?(a.s=-f,a):new B(I?v:NaN);if(!E[0]||!I[0])return I[0]?(a.s=-f,a):new B(E[0]?v:ot==3?-0:0)}if(x=O(x),A=O(A),E=E.slice(),d=x-A){for((_=d<0)?(d=-d,g=E):(A=x,g=I),g.reverse(),f=d;f--;g.push(0));g.reverse()}else for(b=(_=(d=E.length)<(f=I.length))?d:f,d=f=0;f<b;f++)if(E[f]!=I[f]){_=E[f]<I[f];break}if(_&&(g=E,E=I,I=g,a.s=-a.s),f=(b=I.length)-(l=E.length),f>0)for(;f--;E[l++]=0);for(f=c-1;b>d;){if(E[--b]<I[b]){for(l=b;l&&!E[--l];E[l]=f);--E[l],E[b]+=c}E[b]-=I[b]}for(;E[0]==0;E.splice(0,1),--A);return E[0]?Et(a,E,A):(a.s=ot==3?-1:1,a.c=[a.e=0],a)},R.modulo=R.mod=function(a,f){var l,b,g=this;return a=new B(a,f),!g.c||!a.s||a.c&&!a.c[0]?new B(NaN):!a.c||g.c&&!g.c[0]?new B(g):(L==9?(b=a.s,a.s=1,l=H(g,a,0,3),a.s=b,l.s*=b):l=H(g,a,0,L),a=g.minus(l.times(a)),!a.c[0]&&L==1&&(a.s=g.s),a)},R.multipliedBy=R.times=function(a,f){var l,b,g,_,v,d,x,A,E,I,F,$,Z,ht,xt,X=this,q=X.c,Tt=(a=new B(a,f)).c;if(!q||!Tt||!q[0]||!Tt[0])return!X.s||!a.s||q&&!q[0]&&!Tt||Tt&&!Tt[0]&&!q?a.c=a.e=a.s=null:(a.s*=X.s,!q||!Tt?a.c=a.e=null:(a.c=[0],a.e=0)),a;for(b=O(X.e/u)+O(a.e/u),a.s*=X.s,x=q.length,I=Tt.length,x<I&&(Z=q,q=Tt,Tt=Z,g=x,x=I,I=g),g=x+I,Z=[];g--;Z.push(0));for(ht=c,xt=m,g=I;--g>=0;){for(l=0,F=Tt[g]%xt,$=Tt[g]/xt|0,v=x,_=g+v;_>g;)A=q[--v]%xt,E=q[v]/xt|0,d=$*A+E*F,A=F*A+d%xt*xt+Z[_]+l,l=(A/ht|0)+(d/xt|0)+$*E,Z[_--]=A%ht;Z[_]=l}return l?++b:Z.splice(0,1),Et(a,Z,b)},R.negated=function(){var a=new B(this);return a.s=-a.s||null,a},R.plus=function(a,f){var l,b=this,g=b.s;if(a=new B(a,f),f=a.s,!g||!f)return new B(NaN);if(g!=f)return a.s=-f,b.minus(a);var _=b.e/u,v=a.e/u,d=b.c,x=a.c;if(!_||!v){if(!d||!x)return new B(g/0);if(!d[0]||!x[0])return x[0]?a:new B(d[0]?b:g*0)}if(_=O(_),v=O(v),d=d.slice(),g=_-v){for(g>0?(v=_,l=x):(g=-g,l=d),l.reverse();g--;l.push(0));l.reverse()}for(g=d.length,f=x.length,g-f<0&&(l=x,x=d,d=l,f=g),g=0;f;)g=(d[--f]=d[f]+x[f]+g)/c|0,d[f]=c===d[f]?0:d[f]%c;return g&&(d=[g].concat(d),++v),Et(a,d,v)},R.precision=R.sd=function(a,f){var l,b,g,_=this;if(a!=null&&a!==!!a)return j(a,1,N),f==null?f=ot:j(f,0,8),gt(new B(_),a,f);if(!(l=_.c))return null;if(g=l.length-1,b=g*u+1,g=l[g]){for(;g%10==0;g/=10,b--);for(g=l[0];g>=10;g/=10,b++);}return a&&_.e+1>b&&(b=_.e+1),b},R.shiftedBy=function(a){return j(a,-w,w),this.times("1e"+a)},R.squareRoot=R.sqrt=function(){var a,f,l,b,g,_=this,v=_.c,d=_.s,x=_.e,A=st+4,E=new B("0.5");if(d!==1||!v||!v[0])return new B(!d||d<0&&(!v||v[0])?NaN:v?_:1/0);if(d=Math.sqrt(+k(_)),d==0||d==1/0?(f=G(v),(f.length+x)%2==0&&(f+="0"),d=Math.sqrt(+f),x=O((x+1)/2)-(x<0||x%2),d==1/0?f="5e"+x:(f=d.toExponential(),f=f.slice(0,f.indexOf("e")+1)+x),l=new B(f)):l=new B(d+""),l.c[0]){for(x=l.e,d=x+A,d<3&&(d=0);;)if(g=l,l=E.times(g.plus(H(_,g,A,1))),G(g.c).slice(0,d)===(f=G(l.c)).slice(0,d))if(l.e<x&&--d,f=f.slice(d-3,d+1),f=="9999"||!b&&f=="4999"){if(!b&&(gt(g,g.e+st+2,0),g.times(g).eq(_))){l=g;break}A+=4,d+=4,b=1}else{(!+f||!+f.slice(1)&&f.charAt(0)=="5")&&(gt(l,l.e+st+2,1),a=!l.times(l).eq(_));break}}return gt(l,l.e+st+1,ot,a)},R.toExponential=function(a,f){return a!=null&&(j(a,0,N),a++),h(this,a,f,1)},R.toFixed=function(a,f){return a!=null&&(j(a,0,N),a=a+this.e+1),h(this,a,f)},R.toFormat=function(a,f,l){var b,g=this;if(l==null)a!=null&&f&&typeof f=="object"?(l=f,f=null):a&&typeof a=="object"?(l=a,a=f=null):l=J;else if(typeof l!="object")throw Error(s+"Argument not an object: "+l);if(b=g.toFixed(a,f),g.c){var _,v=b.split("."),d=+l.groupSize,x=+l.secondaryGroupSize,A=l.groupSeparator||"",E=v[0],I=v[1],F=g.s<0,$=F?E.slice(1):E,Z=$.length;if(x&&(_=d,d=x,x=_,Z-=_),d>0&&Z>0){for(_=Z%d||d,E=$.substr(0,_);_<Z;_+=d)E+=A+$.substr(_,d);x>0&&(E+=A+$.slice(_)),F&&(E="-"+E)}b=I?E+(l.decimalSeparator||"")+((x=+l.fractionGroupSize)?I.replace(new RegExp("\\d{"+x+"}\\B","g"),"$&"+(l.fractionGroupSeparator||"")):I):E}return(l.prefix||"")+b+(l.suffix||"")},R.toFraction=function(a){var f,l,b,g,_,v,d,x,A,E,I,F,$=this,Z=$.c;if(a!=null&&(d=new B(a),!d.isInteger()&&(d.c||d.s!==1)||d.lt(it)))throw Error(s+"Argument "+(d.isInteger()?"out of range: ":"not an integer: ")+k(d));if(!Z)return new B($);for(f=new B(it),A=l=new B(it),b=x=new B(it),F=G(Z),_=f.e=F.length-$.e-1,f.c[0]=y[(v=_%u)<0?u+v:v],a=!a||d.comparedTo(f)>0?_>0?f:A:d,v=U,U=1/0,d=new B(F),x.c[0]=0;E=H(d,f,0,1),g=l.plus(E.times(b)),g.comparedTo(a)!=1;)l=b,b=g,A=x.plus(E.times(g=A)),x=g,f=d.minus(E.times(g=f)),d=g;return g=H(a.minus(l),b,0,1),x=x.plus(g.times(A)),l=l.plus(g.times(b)),x.s=A.s=$.s,_=_*2,I=H(A,b,_,ot).minus($).abs().comparedTo(H(x,l,_,ot).minus($).abs())<1?[A,b]:[x,l],U=v,I},R.toNumber=function(){return+k(this)},R.toPrecision=function(a,f){return a!=null&&j(a,1,N),h(this,a,f,2)},R.toString=function(a){var f,l=this,b=l.s,g=l.e;return g===null?b?(f="Infinity",b<0&&(f="-"+f)):f="NaN":(a==null?f=g<=wt||g>=Ot?z(G(l.c),g):yt(G(l.c),g,"0"):a===10&&ut?(l=gt(new B(l),st+g+1,ot),f=yt(G(l.c),l.e,"0")):(j(a,2,tt.length,"Base"),f=nt(yt(G(l.c),g,"0"),10,a,b,!0)),b<0&&l.c[0]&&(f="-"+f)),f},R.valueOf=R.toJSON=function(){return k(this)},R._isBigNumber=!0,C!=null&&B.set(C),B}function O(C){var H=C|0;return C>0||C===H?H:H-1}function G(C){for(var H,nt,Y=1,R=C.length,it=C[0]+"";Y<R;){for(H=C[Y++]+"",nt=u-H.length;nt--;H="0"+H);it+=H}for(R=it.length;it.charCodeAt(--R)===48;);return it.slice(0,R+1||1)}function lt(C,H){var nt,Y,R=C.c,it=H.c,st=C.s,ot=H.s,wt=C.e,Ot=H.e;if(!st||!ot)return null;if(nt=R&&!R[0],Y=it&&!it[0],nt||Y)return nt?Y?0:-ot:st;if(st!=ot)return st;if(nt=st<0,Y=wt==Ot,!R||!it)return Y?0:!R^nt?1:-1;if(!Y)return wt>Ot^nt?1:-1;for(ot=(wt=R.length)<(Ot=it.length)?wt:Ot,st=0;st<ot;st++)if(R[st]!=it[st])return R[st]>it[st]^nt?1:-1;return wt==Ot?0:wt>Ot^nt?1:-1}function j(C,H,nt,Y){if(C<H||C>nt||C!==i(C))throw Error(s+(Y||"Argument")+(typeof C=="number"?C<H||C>nt?" out of range: ":" not an integer: ":" not a primitive number: ")+String(C))}function W(C){var H=C.c.length-1;return O(C.e/u)==H&&C.c[H]%2!=0}function z(C,H){return(C.length>1?C.charAt(0)+"."+C.slice(1):C)+(H<0?"e":"e+")+H}function yt(C,H,nt){var Y,R;if(H<0){for(R=nt+".";++H;R+=nt);C=R+C}else if(Y=C.length,++H>Y){for(R=nt,H-=Y;--H;R+=nt);C+=R}else H<Y&&(C=C.slice(0,H)+"."+C.slice(H));return C}t=M(),t.default=t.BigNumber=t,typeof define=="function"&&define.amd?define(function(){return t}):typeof _n<"u"&&_n.exports?_n.exports=t:(r||(r=typeof self<"u"&&self?self:window),r.BigNumber=t)})(aa)});var ua=Bt((gp,ca)=>{ca.exports=function(t,e,n){var i=new t.Uint8Array(n),s=e.pushInt,o=e.pushInt32,c=e.pushInt32Neg,u=e.pushInt64,w=e.pushInt64Neg,y=e.pushFloat,m=e.pushFloatSingle,N=e.pushFloatDouble,M=e.pushTrue,O=e.pushFalse,G=e.pushUndefined,lt=e.pushNull,j=e.pushInfinity,W=e.pushInfinityNeg,z=e.pushNaN,yt=e.pushNaNNeg,C=e.pushArrayStart,H=e.pushArrayStartFixed,nt=e.pushArrayStartFixed32,Y=e.pushArrayStartFixed64,R=e.pushObjectStart,it=e.pushObjectStartFixed,st=e.pushObjectStartFixed32,ot=e.pushObjectStartFixed64,wt=e.pushByteString,Ot=e.pushByteStringStart,V=e.pushUtf8String,U=e.pushUtf8StringStart,P=e.pushSimpleUnassigned,L=e.pushTagStart,K=e.pushTagStart4,J=e.pushTagStart8,tt=e.pushTagUnassigned,ut=e.pushBreak,B=t.Math.pow,h=0,mt=0,Et=0;function gt(p){for(p=p|0,h=0,mt=p;(h|0)<(mt|0)&&(Et=mu[i[h]&255](i[h]|0)|0,!((Et|0)>0)););return Et|0}function k(p){return p=p|0,((h|0)+(p|0)|0)<(mt|0)?0:1}function a(p){return p=p|0,i[p|0]<<8|i[p+1|0]|0}function f(p){return p=p|0,i[p|0]<<24|i[p+1|0]<<16|i[p+2|0]<<8|i[p+3|0]|0}function l(p){return p=p|0,s(p|0),h=h+1|0,0}function b(p){return p=p|0,k(1)|0?1:(s(i[h+1|0]|0),h=h+2|0,0)}function g(p){return p=p|0,k(2)|0?1:(s(a(h+1|0)|0),h=h+3|0,0)}function _(p){return p=p|0,k(4)|0?1:(o(a(h+1|0)|0,a(h+3|0)|0),h=h+5|0,0)}function v(p){return p=p|0,k(8)|0?1:(u(a(h+1|0)|0,a(h+3|0)|0,a(h+5|0)|0,a(h+7|0)|0),h=h+9|0,0)}function d(p){return p=p|0,s(-1-(p-32|0)|0),h=h+1|0,0}function x(p){return p=p|0,k(1)|0?1:(s(-1-(i[h+1|0]|0)|0),h=h+2|0,0)}function A(p){p=p|0;var et=0;return k(2)|0?1:(et=a(h+1|0)|0,s(-1-(et|0)|0),h=h+3|0,0)}function E(p){return p=p|0,k(4)|0?1:(c(a(h+1|0)|0,a(h+3|0)|0),h=h+5|0,0)}function I(p){return p=p|0,k(8)|0?1:(w(a(h+1|0)|0,a(h+3|0)|0,a(h+5|0)|0,a(h+7|0)|0),h=h+9|0,0)}function F(p){p=p|0;var et=0,rt=0,Q=0;return Q=p-64|0,k(Q|0)|0?1:(et=h+1|0,rt=(h+1|0)+(Q|0)|0,wt(et|0,rt|0),h=rt|0,0)}function $(p){p=p|0;var et=0,rt=0,Q=0;return k(1)|0||(Q=i[h+1|0]|0,et=h+2|0,rt=(h+2|0)+(Q|0)|0,k(Q+1|0)|0)?1:(wt(et|0,rt|0),h=rt|0,0)}function Z(p){p=p|0;var et=0,rt=0,Q=0;return k(2)|0||(Q=a(h+1|0)|0,et=h+3|0,rt=(h+3|0)+(Q|0)|0,k(Q+2|0)|0)?1:(wt(et|0,rt|0),h=rt|0,0)}function ht(p){p=p|0;var et=0,rt=0,Q=0;return k(4)|0||(Q=f(h+1|0)|0,et=h+5|0,rt=(h+5|0)+(Q|0)|0,k(Q+4|0)|0)?1:(wt(et|0,rt|0),h=rt|0,0)}function xt(p){return p=p|0,1}function X(p){return p=p|0,Ot(),h=h+1|0,0}function q(p){p=p|0;var et=0,rt=0,Q=0;return Q=p-96|0,k(Q|0)|0?1:(et=h+1|0,rt=(h+1|0)+(Q|0)|0,V(et|0,rt|0),h=rt|0,0)}function Tt(p){p=p|0;var et=0,rt=0,Q=0;return k(1)|0||(Q=i[h+1|0]|0,et=h+2|0,rt=(h+2|0)+(Q|0)|0,k(Q+1|0)|0)?1:(V(et|0,rt|0),h=rt|0,0)}function ve(p){p=p|0;var et=0,rt=0,Q=0;return k(2)|0||(Q=a(h+1|0)|0,et=h+3|0,rt=(h+3|0)+(Q|0)|0,k(Q+2|0)|0)?1:(V(et|0,rt|0),h=rt|0,0)}function $e(p){p=p|0;var et=0,rt=0,Q=0;return k(4)|0||(Q=f(h+1|0)|0,et=h+5|0,rt=(h+5|0)+(Q|0)|0,k(Q+4|0)|0)?1:(V(et|0,rt|0),h=rt|0,0)}function Sr(p){return p=p|0,1}function Zt(p){return p=p|0,U(),h=h+1|0,0}function at(p){return p=p|0,H(p-128|0),h=h+1|0,0}function Lt(p){return p=p|0,k(1)|0?1:(H(i[h+1|0]|0),h=h+2|0,0)}function Ct(p){return p=p|0,k(2)|0?1:(H(a(h+1|0)|0),h=h+3|0,0)}function _t(p){return p=p|0,k(4)|0?1:(nt(a(h+1|0)|0,a(h+3|0)|0),h=h+5|0,0)}function Zc(p){return p=p|0,k(8)|0?1:(Y(a(h+1|0)|0,a(h+3|0)|0,a(h+5|0)|0,a(h+7|0)|0),h=h+9|0,0)}function Qc(p){return p=p|0,C(),h=h+1|0,0}function bt(p){p=p|0;var et=0;return et=p-160|0,k(et|0)|0?1:(it(et|0),h=h+1|0,0)}function tu(p){return p=p|0,k(1)|0?1:(it(i[h+1|0]|0),h=h+2|0,0)}function eu(p){return p=p|0,k(2)|0?1:(it(a(h+1|0)|0),h=h+3|0,0)}function ru(p){return p=p|0,k(4)|0?1:(st(a(h+1|0)|0,a(h+3|0)|0),h=h+5|0,0)}function nu(p){return p=p|0,k(8)|0?1:(ot(a(h+1|0)|0,a(h+3|0)|0,a(h+5|0)|0,a(h+7|0)|0),h=h+9|0,0)}function iu(p){return p=p|0,R(),h=h+1|0,0}function Je(p){return p=p|0,L(p-192|0|0),h=h+1|0,0}function H0(p){return p=p|0,L(p|0),h=h+1|0,0}function G0(p){return p=p|0,L(p|0),h=h+1|0,0}function K0(p){return p=p|0,L(p|0),h=h+1|0,0}function D0(p){return p=p|0,L(p|0),h=h+1|0,0}function Pt(p){return p=p|0,L(p-192|0|0),h=h+1|0,0}function j0(p){return p=p|0,L(p|0),h=h+1|0,0}function W0(p){return p=p|0,L(p|0),h=h+1|0,0}function z0(p){return p=p|0,L(p|0),h=h+1|0,0}function su(p){return p=p|0,k(1)|0?1:(L(i[h+1|0]|0),h=h+2|0,0)}function ou(p){return p=p|0,k(2)|0?1:(L(a(h+1|0)|0),h=h+3|0,0)}function au(p){return p=p|0,k(4)|0?1:(K(a(h+1|0)|0,a(h+3|0)|0),h=h+5|0,0)}function cu(p){return p=p|0,k(8)|0?1:(J(a(h+1|0)|0,a(h+3|0)|0,a(h+5|0)|0,a(h+7|0)|0),h=h+9|0,0)}function St(p){return p=p|0,P((p|0)-224|0),h=h+1|0,0}function uu(p){return p=p|0,O(),h=h+1|0,0}function fu(p){return p=p|0,M(),h=h+1|0,0}function lu(p){return p=p|0,lt(),h=h+1|0,0}function hu(p){return p=p|0,G(),h=h+1|0,0}function du(p){return p=p|0,k(1)|0?1:(P(i[h+1|0]|0),h=h+2|0,0)}function pu(p){p=p|0;var et=0,rt=0,Q=1,rn=0,Br=0,Y0=0;return k(2)|0?1:(et=i[h+1|0]|0,rt=i[h+2|0]|0,(et|0)&128&&(Q=-1),rn=+(((et|0)&124)>>2),Br=+(((et|0)&3)<<8|rt),+rn==0?y(+(+Q*5960464477539063e-23*+Br)):+rn==31?+Q==1?+Br>0?z():j():+Br>0?yt():W():y(+(+Q*B(2,+(+rn-25))*+(1024+Br))),h=h+3|0,0)}function yu(p){return p=p|0,k(4)|0?1:(m(i[h+1|0]|0,i[h+2|0]|0,i[h+3|0]|0,i[h+4|0]|0),h=h+5|0,0)}function wu(p){return p=p|0,k(8)|0?1:(N(i[h+1|0]|0,i[h+2|0]|0,i[h+3|0]|0,i[h+4|0]|0,i[h+5|0]|0,i[h+6|0]|0,i[h+7|0]|0,i[h+8|0]|0),h=h+9|0,0)}function dt(p){return p=p|0,1}function gu(p){return p=p|0,ut(),h=h+1|0,0}var mu=[l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,b,g,_,v,dt,dt,dt,dt,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,x,A,E,I,dt,dt,dt,dt,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,$,Z,ht,xt,dt,dt,dt,X,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,Tt,ve,$e,Sr,dt,dt,dt,Zt,at,at,at,at,at,at,at,at,at,at,at,at,at,at,at,at,at,at,at,at,at,at,at,at,Lt,Ct,_t,Zc,dt,dt,dt,Qc,bt,bt,bt,bt,bt,bt,bt,bt,bt,bt,bt,bt,bt,bt,bt,bt,bt,bt,bt,bt,bt,bt,bt,bt,tu,eu,ru,nu,dt,dt,dt,iu,Je,Je,Je,Je,Je,Je,Pt,Pt,Pt,Pt,Pt,Pt,Pt,Pt,Pt,Pt,Pt,Pt,Pt,Pt,Pt,Pt,Pt,Pt,su,ou,au,cu,dt,dt,dt,dt,St,St,St,St,St,St,St,St,St,St,St,St,St,St,St,St,St,St,St,St,uu,fu,lu,hu,du,pu,yu,wu,dt,dt,dt,gu];return{parse:gt}}});var Mr=Bt(Yt=>{"use strict";var ns=kr().BigNumber;Yt.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7};Yt.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};Yt.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31};Yt.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23};Yt.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")};Yt.SHIFT32=Math.pow(2,32);Yt.SHIFT16=Math.pow(2,16);Yt.MAX_SAFE_HIGH=2097151;Yt.NEG_ONE=new ns(-1);Yt.TEN=new ns(10);Yt.TWO=new ns(2);Yt.PARENT={ARRAY:0,OBJECT:1,MAP:2,TAG:3,BYTE_STRING:4,UTF8_STRING:5}});var bn=Bt(re=>{"use strict";var{Buffer:$f}=Pr(),la=kr().BigNumber,ha=Mr(),fa=ha.SHIFT32,Vf=ha.SHIFT16,Lf=2097151;re.parseHalf=function(t){var e,n,i;return i=t[0]&128?-1:1,e=(t[0]&124)>>2,n=(t[0]&3)<<8|t[1],e?e===31?i*(n?NaN:1/0):i*Math.pow(2,e-25)*(1024+n):i*5960464477539063e-23*n};function qf(r){return r<16?"0"+r.toString(16):r.toString(16)}re.arrayBufferToBignumber=function(r){let t=r.byteLength,e="";for(let n=0;n<t;n++)e+=qf(r[n]);return new la(e,16)};re.buildMap=r=>{let t=new Map,e=Object.keys(r),n=e.length;for(let i=0;i<n;i++)t.set(e[i],r[e[i]]);return t};re.buildInt32=(r,t)=>r*Vf+t;re.buildInt64=(r,t,e,n)=>{let i=re.buildInt32(r,t),s=re.buildInt32(e,n);return i>Lf?new la(i).times(fa).plus(s):i*fa+s};re.writeHalf=function(t,e){let n=$f.allocUnsafe(4);n.writeFloatBE(e,0);let i=n.readUInt32BE(0);if(i&8191)return!1;var s=i>>16&32768;let o=i>>23&255,c=i&8388607;if(o>=113&&o<=142)s+=(o-112<<10)+(c>>13);else if(o>=103&&o<113){if(c&(1<<126-o)-1)return!1;s+=c+8388608>>126-o}else return!1;return t.writeUInt16BE(s,0),!0};re.keySorter=function(r,t){var e=r[0].byteLength,n=t[0].byteLength;return e>n?1:n>e?-1:r[0].compare(t[0])};re.isNegativeZero=r=>r===0&&1/r<0;re.nextPowerOf2=r=>{let t=0;if(r&&!(r&r-1))return r;for(;r!==0;)r>>=1,t+=1;return 1<<t}});var as=Bt((_p,da)=>{"use strict";var os=Mr(),Hf=os.MT,En=os.SIMPLE,is=os.SYMS,ss=class r{constructor(t){if(typeof t!="number")throw new Error("Invalid Simple type: "+typeof t);if(t<0||t>255||(t|0)!==t)throw new Error("value must be a small positive integer: "+t);this.value=t}toString(){return"simple("+this.value+")"}inspect(){return"simple("+this.value+")"}encodeCBOR(t){return t._pushInt(this.value,Hf.SIMPLE_FLOAT)}static isSimple(t){return t instanceof r}static decode(t,e){switch(e==null&&(e=!0),t){case En.FALSE:return!1;case En.TRUE:return!0;case En.NULL:return e?null:is.NULL;case En.UNDEFINED:return e?void 0:is.UNDEFINED;case-1:if(!e)throw new Error("Invalid BREAK");return is.BREAK;default:return new r(t)}}};da.exports=ss});var us=Bt((bp,pa)=>{"use strict";var cs=class r{constructor(t,e,n){if(this.tag=t,this.value=e,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(t){return t._pushTag(this.tag),t.pushAny(this.value)}convert(t){var e,n;if(n=t?.[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 e=i,this.err=e,this}}};pa.exports=cs});var hs=Bt((Ep,wa)=>{"use strict";var ya=self.location?self.location.protocol+"//"+self.location.host:"",fs=self.URL,ls=class{constructor(t="",e=ya){this.super=new fs(t,e),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(t){this.super.hash=t}set host(t){this.super.host=t}set hostname(t){this.super.hostname=t}set href(t){this.super.href=t}set origin(t){this.super.origin=t}set password(t){this.super.password=t}set pathname(t){this.super.pathname=t}set port(t){this.super.port=t}set protocol(t){this.super.protocol=t}set search(t){this.super.search=t}set searchParams(t){this.super.searchParams=t}set username(t){this.super.username=t}createObjectURL(t){return this.super.createObjectURL(t)}revokeObjectURL(t){this.super.revokeObjectURL(t)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}};function Gf(r){if(typeof r=="string")return new fs(r).toString();if(!(r instanceof fs)){let t=r.username&&r.password?`${r.username}:${r.password}@`:"",e=r.auth?r.auth+"@":"",n=r.port?":"+r.port:"",i=r.protocol?r.protocol+"//":"",s=r.host||"",o=r.hostname||"",c=r.search||(r.query?"?"+r.query:""),u=r.hash||"",w=r.pathname||"",y=r.path||w+c;return`${i}${t||e}${s||o+n}${y}${u}`}}wa.exports={URLWithLegacySupport:ls,URLSearchParams:self.URLSearchParams,defaultBase:ya,format:Gf}});var xa=Bt((Ap,ma)=>{"use strict";var{URLWithLegacySupport:ga,format:Kf}=hs();ma.exports=(r,t={},e={},n)=>{let i=t.protocol?t.protocol.replace(":",""):"http";i=(e[i]||n||i)+":";let s;try{s=new ga(r)}catch{s={}}let o=Object.assign({},t,{protocol:i||s.protocol,host:t.host||s.host});return new ga(r,Kf(o)).toString()}});var ds=Bt((vp,_a)=>{"use strict";var{URLWithLegacySupport:Df,format:jf,URLSearchParams:Wf,defaultBase:zf}=hs(),Yf=xa();_a.exports={URL:Df,URLSearchParams:Wf,format:jf,relative:Yf,defaultBase:zf}});var ps=Bt((Tp,Ea)=>{"use strict";var{Buffer:hr}=Pr(),ba=sn(),Xf=kr().BigNumber,Jf=ua(),Vt=bn(),ft=Mr(),Zf=as(),Qf=us(),{URL:tl}=ds(),Cr=class r{constructor(t){t=t||{},!t.size||t.size<65536?t.size=65536:t.size=Vt.nextPowerOf2(t.size),this._heap=new ArrayBuffer(t.size),this._heap8=new Uint8Array(this._heap),this._buffer=hr.from(this._heap),this._reset(),this._knownTags=Object.assign({0:e=>new Date(e),1:e=>new Date(e*1e3),2:e=>Vt.arrayBufferToBignumber(e),3:e=>ft.NEG_ONE.minus(Vt.arrayBufferToBignumber(e)),4:e=>ft.TEN.pow(e[0]).times(e[1]),5:e=>ft.TWO.pow(e[0]).times(e[1]),32:e=>new tl(e),35:e=>new RegExp(e)},t.tags),this.parser=Jf(global,{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 t=this._parents.pop();if(t.length>0)throw new Error(`Missing ${t.length} elements`);switch(t.type){case ft.PARENT.TAG:this._push(this.createTag(t.ref[0],t.ref[1]));break;case ft.PARENT.BYTE_STRING:this._push(this.createByteString(t.ref,t.length));break;case ft.PARENT.UTF8_STRING:this._push(this.createUtf8String(t.ref,t.length));break;case ft.PARENT.MAP:if(t.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createMap(t.ref,t.length));break;case ft.PARENT.OBJECT:if(t.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createObject(t.ref,t.length));break;case ft.PARENT.ARRAY:this._push(this.createArray(t.ref,t.length));break;default:break}this._currentParent&&this._currentParent.type===ft.PARENT.TAG&&this._dec()}_dec(){let t=this._currentParent;t.length<0||(t.length--,t.length===0&&this._closeParent())}_push(t,e){let n=this._currentParent;switch(n.values++,n.type){case ft.PARENT.ARRAY:case ft.PARENT.BYTE_STRING:case ft.PARENT.UTF8_STRING:n.length>-1?this._ref[this._ref.length-n.length]=t:this._ref.push(t),this._dec();break;case ft.PARENT.OBJECT:n.tmpKey!=null?(this._ref[n.tmpKey]=t,n.tmpKey=null,this._dec()):(n.tmpKey=t,typeof n.tmpKey!="string"&&(n.type=ft.PARENT.MAP,n.ref=Vt.buildMap(n.ref)));break;case ft.PARENT.MAP:n.tmpKey!=null?(this._ref.set(n.tmpKey,t),n.tmpKey=null,this._dec()):n.tmpKey=t;break;case ft.PARENT.TAG:this._ref.push(t),e||this._dec();break;default:throw new Error("Unknown parent type")}}_createParent(t,e,n){this._parents[this._depth]={type:e,length:n,ref:t,values:0,tmpKey:null}}_reset(){this._res=[],this._parents=[{type:ft.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}createTag(t,e){let n=this._knownTags[t];return n?n(e):new Qf(t,e)}createMap(t,e){return t}createObject(t,e){return t}createArray(t,e){return t}createByteString(t,e){return hr.concat(t)}createByteStringFromHeap(t,e){return t===e?hr.alloc(0):hr.from(this._heap.slice(t,e))}createInt(t){return t}createInt32(t,e){return Vt.buildInt32(t,e)}createInt64(t,e,n,i){return Vt.buildInt64(t,e,n,i)}createFloat(t){return t}createFloatSingle(t,e,n,i){return ba.read([t,e,n,i],0,!1,23,4)}createFloatDouble(t,e,n,i,s,o,c,u){return ba.read([t,e,n,i,s,o,c,u],0,!1,52,8)}createInt32Neg(t,e){return-1-Vt.buildInt32(t,e)}createInt64Neg(t,e,n,i){let s=Vt.buildInt32(t,e),o=Vt.buildInt32(n,i);return s>ft.MAX_SAFE_HIGH?ft.NEG_ONE.minus(new Xf(s).times(ft.SHIFT32).plus(o)):-1-(s*ft.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(t,e){return t.join("")}createUtf8StringFromHeap(t,e){return t===e?"":this._buffer.toString("utf8",t,e)}createSimpleUnassigned(t){return new Zf(t)}pushInt(t){this._push(this.createInt(t))}pushInt32(t,e){this._push(this.createInt32(t,e))}pushInt64(t,e,n,i){this._push(this.createInt64(t,e,n,i))}pushFloat(t){this._push(this.createFloat(t))}pushFloatSingle(t,e,n,i){this._push(this.createFloatSingle(t,e,n,i))}pushFloatDouble(t,e,n,i,s,o,c,u){this._push(this.createFloatDouble(t,e,n,i,s,o,c,u))}pushInt32Neg(t,e){this._push(this.createInt32Neg(t,e))}pushInt64Neg(t,e,n,i){this._push(this.createInt64Neg(t,e,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([],ft.PARENT.ARRAY,-1)}pushArrayStartFixed(t){this._createArrayStartFixed(t)}pushArrayStartFixed32(t,e){let n=Vt.buildInt32(t,e);this._createArrayStartFixed(n)}pushArrayStartFixed64(t,e,n,i){let s=Vt.buildInt64(t,e,n,i);this._createArrayStartFixed(s)}pushObjectStart(){this._createObjectStartFixed(-1)}pushObjectStartFixed(t){this._createObjectStartFixed(t)}pushObjectStartFixed32(t,e){let n=Vt.buildInt32(t,e);this._createObjectStartFixed(n)}pushObjectStartFixed64(t,e,n,i){let s=Vt.buildInt64(t,e,n,i);this._createObjectStartFixed(s)}pushByteStringStart(){this._parents[this._depth]={type:ft.PARENT.BYTE_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushByteString(t,e){this._push(this.createByteStringFromHeap(t,e))}pushUtf8StringStart(){this._parents[this._depth]={type:ft.PARENT.UTF8_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushUtf8String(t,e){this._push(this.createUtf8StringFromHeap(t,e))}pushSimpleUnassigned(t){this._push(this.createSimpleUnassigned(t))}pushTagStart(t){this._parents[this._depth]={type:ft.PARENT.TAG,length:1,ref:[t]}}pushTagStart4(t,e){this.pushTagStart(Vt.buildInt32(t,e))}pushTagStart8(t,e,n,i){this.pushTagStart(Vt.buildInt64(t,e,n,i))}pushTagUnassigned(t){this._push(this.createTag(t))}pushBreak(){if(this._currentParent.length>-1)throw new Error("Unexpected break");this._closeParent()}_createObjectStartFixed(t){if(t===0){this._push(this.createObject({}));return}this._createParent({},ft.PARENT.OBJECT,t)}_createArrayStartFixed(t){if(t===0){this._push(this.createArray([]));return}this._createParent(new Array(t),ft.PARENT.ARRAY,t)}_decode(t){if(t.byteLength===0)throw new Error("Input too short");this._reset(),this._heap8.set(t);let e=this.parser.parse(t.byteLength);if(this._depth>1){for(;this._currentParent.length===0;)this._closeParent();if(this._depth>1)throw new Error("Undeterminated nesting")}if(e>0)throw new Error("Failed to parse");if(this._res.length===0)throw new Error("No valid result")}decodeFirst(t){return this._decode(t),this._res[0]}decodeAll(t){return this._decode(t),this._res}static decode(t,e){return typeof t=="string"&&(t=hr.from(t,e||"hex")),new r({size:t.length}).decodeFirst(t)}static decodeAll(t,e){return typeof t=="string"&&(t=hr.from(t,e||"hex")),new r({size:t.length}).decodeAll(t)}};Cr.decodeFirst=Cr.decode;Ea.exports=Cr});var Ta=Bt((Sp,va)=>{"use strict";var{Buffer:ys}=Pr(),el=ps(),rl=bn(),ws=class r extends el{createTag(t,e){return`${t}(${e})`}createInt(t){return super.createInt(t).toString()}createInt32(t,e){return super.createInt32(t,e).toString()}createInt64(t,e,n,i){return super.createInt64(t,e,n,i).toString()}createInt32Neg(t,e){return super.createInt32Neg(t,e).toString()}createInt64Neg(t,e,n,i){return super.createInt64Neg(t,e,n,i).toString()}createTrue(){return"true"}createFalse(){return"false"}createFloat(t){let e=super.createFloat(t);return rl.isNegativeZero(t)?"-0_1":`${e}_1`}createFloatSingle(t,e,n,i){return`${super.createFloatSingle(t,e,n,i)}_2`}createFloatDouble(t,e,n,i,s,o,c,u){return`${super.createFloatDouble(t,e,n,i,s,o,c,u)}_3`}createByteString(t,e){let n=t.join(", ");return e===-1?`(_ ${n})`:`h'${n}`}createByteStringFromHeap(t,e){return`h'${ys.from(super.createByteStringFromHeap(t,e)).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(t){return`simple(${t})`}createArray(t,e){let n=super.createArray(t,e);return e===-1?`[_ ${n.join(", ")}]`:`[${n.join(", ")}]`}createMap(t,e){let n=super.createMap(t),i=Array.from(n.keys()).reduce(Aa(n),"");return e===-1?`{_ ${i}}`:`{${i}}`}createObject(t,e){let n=super.createObject(t),i=Object.keys(n).reduce(Aa(n),"");return e===-1?`{_ ${i}}`:`{${i}}`}createUtf8String(t,e){let n=t.join(", ");return e===-1?`(_ ${n})`:`"${n}"`}createUtf8StringFromHeap(t,e){return`"${ys.from(super.createUtf8StringFromHeap(t,e)).toString("utf8")}"`}static diagnose(t,e){return typeof t=="string"&&(t=ys.from(t,e||"hex")),new r().decodeFirst(t)}};va.exports=ws;function Aa(r){return(t,e)=>t?`${t}, ${e}: ${r[e]}`:`${e}: ${r[e]}`}});var Ua=Bt((Bp,Na)=>{"use strict";var{Buffer:de}=Pr(),{URL:nl}=ds(),ms=kr().BigNumber,gs=bn(),Ut=Mr(),ie=Ut.MT,An=Ut.NUMBYTES,Sa=Ut.SHIFT32,Ba=Ut.SYMS,dr=Ut.TAG,il=Ut.MT.SIMPLE_FLOAT<<5|Ut.NUMBYTES.TWO,sl=Ut.MT.SIMPLE_FLOAT<<5|Ut.NUMBYTES.FOUR,ol=Ut.MT.SIMPLE_FLOAT<<5|Ut.NUMBYTES.EIGHT,al=Ut.MT.SIMPLE_FLOAT<<5|Ut.SIMPLE.TRUE,cl=Ut.MT.SIMPLE_FLOAT<<5|Ut.SIMPLE.FALSE,ul=Ut.MT.SIMPLE_FLOAT<<5|Ut.SIMPLE.UNDEFINED,Ia=Ut.MT.SIMPLE_FLOAT<<5|Ut.SIMPLE.NULL,fl=new ms("0x20000000000000"),ll=de.from("f97e00","hex"),hl=de.from("f9fc00","hex"),dl=de.from("f97c00","hex");function pl(r){return{}.toString.call(r).slice(8,-1)}var xs=class r{constructor(t){t=t||{},this.streaming=typeof t.stream=="function",this.onData=t.stream,this.semanticTypes=[[nl,this._pushUrl],[ms,this._pushBigNumber]];let e=t.genTypes||[],n=e.length;for(let i=0;i<n;i++)this.addSemanticType(e[i][0],e[i][1]);this._reset()}addSemanticType(t,e){let n=this.semanticTypes.length;for(let i=0;i<n;i++)if(this.semanticTypes[i][0]===t){let o=this.semanticTypes[i][1];return this.semanticTypes[i][1]=e,o}return this.semanticTypes.push([t,e]),null}push(t){return t&&(this.result[this.offset]=t,this.resultMethod[this.offset]=0,this.resultLength[this.offset]=t.length,this.offset++,this.streaming&&this.onData(this.finalize())),!0}pushWrite(t,e,n){return this.result[this.offset]=t,this.resultMethod[this.offset]=e,this.resultLength[this.offset]=n,this.offset++,this.streaming&&this.onData(this.finalize()),!0}_pushUInt8(t){return this.pushWrite(t,1,1)}_pushUInt16BE(t){return this.pushWrite(t,2,2)}_pushUInt32BE(t){return this.pushWrite(t,3,4)}_pushDoubleBE(t){return this.pushWrite(t,4,8)}_pushNaN(){return this.push(ll)}_pushInfinity(t){let e=t<0?hl:dl;return this.push(e)}_pushFloat(t){let e=de.allocUnsafe(2);if(gs.writeHalf(e,t)&&gs.parseHalf(e)===t)return this._pushUInt8(il)&&this.push(e);let n=de.allocUnsafe(4);return n.writeFloatBE(t,0),n.readFloatBE(0)===t?this._pushUInt8(sl)&&this.push(n):this._pushUInt8(ol)&&this._pushDoubleBE(t)}_pushInt(t,e,n){let i=e<<5;return t<24?this._pushUInt8(i|t):t<=255?this._pushUInt8(i|An.ONE)&&this._pushUInt8(t):t<=65535?this._pushUInt8(i|An.TWO)&&this._pushUInt16BE(t):t<=4294967295?this._pushUInt8(i|An.FOUR)&&this._pushUInt32BE(t):t<=Number.MAX_SAFE_INTEGER?this._pushUInt8(i|An.EIGHT)&&this._pushUInt32BE(Math.floor(t/Sa))&&this._pushUInt32BE(t%Sa):e===ie.NEG_INT?this._pushFloat(n):this._pushFloat(t)}_pushIntNum(t){return t<0?this._pushInt(-t-1,ie.NEG_INT,t):this._pushInt(t,ie.POS_INT)}_pushNumber(t){switch(!1){case t===t:return this._pushNaN(t);case isFinite(t):return this._pushInfinity(t);case t%1!==0:return this._pushIntNum(t);default:return this._pushFloat(t)}}_pushString(t){let e=de.byteLength(t,"utf8");return this._pushInt(e,ie.UTF8_STRING)&&this.pushWrite(t,5,e)}_pushBoolean(t){return this._pushUInt8(t?al:cl)}_pushUndefined(t){return this._pushUInt8(ul)}_pushArray(t,e){let n=e.length;if(!t._pushInt(n,ie.ARRAY))return!1;for(let i=0;i<n;i++)if(!t.pushAny(e[i]))return!1;return!0}_pushTag(t){return this._pushInt(t,ie.TAG)}_pushDate(t,e){return t._pushTag(dr.DATE_EPOCH)&&t.pushAny(Math.round(e/1e3))}_pushBuffer(t,e){return t._pushInt(e.length,ie.BYTE_STRING)&&t.push(e)}_pushNoFilter(t,e){return t._pushBuffer(t,e.slice())}_pushRegexp(t,e){return t._pushTag(dr.REGEXP)&&t.pushAny(e.source)}_pushSet(t,e){if(!t._pushInt(e.size,ie.ARRAY))return!1;for(let n of e)if(!t.pushAny(n))return!1;return!0}_pushUrl(t,e){return t._pushTag(dr.URI)&&t.pushAny(e.format())}_pushBigint(t){let e=dr.POS_BIGINT;t.isNegative()&&(t=t.negated().minus(1),e=dr.NEG_BIGINT);let n=t.toString(16);n.length%2&&(n="0"+n);let i=de.from(n,"hex");return this._pushTag(e)&&this._pushBuffer(this,i)}_pushBigNumber(t,e){if(e.isNaN())return t._pushNaN();if(!e.isFinite())return t._pushInfinity(e.isNegative()?-1/0:1/0);if(e.isInteger())return t._pushBigint(e);if(!(t._pushTag(dr.DECIMAL_FRAC)&&t._pushInt(2,ie.ARRAY)))return!1;let n=e.decimalPlaces(),i=e.multipliedBy(new ms(10).pow(n));return t._pushIntNum(-n)?i.abs().isLessThan(fl)?t._pushIntNum(i.toNumber()):t._pushBigint(i):!1}_pushMap(t,e){return t._pushInt(e.size,ie.MAP)?this._pushRawMap(e.size,Array.from(e)):!1}_pushObject(t){if(!t)return this._pushUInt8(Ia);for(var e=this.semanticTypes.length,n=0;n<e;n++)if(t instanceof this.semanticTypes[n][0])return this.semanticTypes[n][1].call(t,this,t);var i=t.encodeCBOR;if(typeof i=="function")return i.call(t,this);var s=Object.keys(t),o=s.length;return this._pushInt(o,ie.MAP)?this._pushRawMap(o,s.map(c=>[c,t[c]])):!1}_pushRawMap(t,e){e=e.map(function(i){return i[0]=r.encode(i[0]),i}).sort(gs.keySorter);for(var n=0;n<t;n++)if(!this.push(e[n][0])||!this.pushAny(e[n][1]))return!1;return!0}write(t){return this.pushAny(t)}pushAny(t){var e=pl(t);switch(e){case"Number":return this._pushNumber(t);case"String":return this._pushString(t);case"Boolean":return this._pushBoolean(t);case"Object":return this._pushObject(t);case"Array":return this._pushArray(this,t);case"Uint8Array":return this._pushBuffer(this,de.isBuffer(t)?t:de.from(t));case"Null":return this._pushUInt8(Ia);case"Undefined":return this._pushUndefined(t);case"Map":return this._pushMap(this,t);case"Set":return this._pushSet(this,t);case"URL":return this._pushUrl(this,t);case"BigNumber":return this._pushBigNumber(this,t);case"Date":return this._pushDate(this,t);case"RegExp":return this._pushRegexp(this,t);case"Symbol":switch(t){case Ba.NULL:return this._pushObject(null);case Ba.UNDEFINED:return this._pushUndefined(void 0);default:throw new Error("Unknown symbol: "+t.toString())}default:throw new Error("Unknown type: "+typeof t+", "+(t?t.toString():""))}}finalize(){if(this.offset===0)return null;for(var t=this.result,e=this.resultLength,n=this.resultMethod,i=this.offset,s=0,o=0;o<i;o++)s+=e[o];var c=de.allocUnsafe(s),u=0,w=0;for(o=0;o<i;o++){switch(w=e[o],n[o]){case 0:t[o].copy(c,u);break;case 1:c.writeUInt8(t[o],u,!0);break;case 2:c.writeUInt16BE(t[o],u,!0);break;case 3:c.writeUInt32BE(t[o],u,!0);break;case 4:c.writeDoubleBE(t[o],u,!0);break;case 5:c.write(t[o],u,w,"utf8");break;default:throw new Error("unkown method")}u+=w}var y=c;return this._reset(),y}_reset(){this.result=[],this.resultMethod=[],this.resultLength=[],this.offset=0}static encode(t){let e=new r;if(!e.pushAny(t))throw new Error("Failed to encode input");return e.finalize()}};Na.exports=xs});var vn=Bt(Rt=>{"use strict";Rt.Diagnose=Ta();Rt.Decoder=ps();Rt.Encoder=Ua();Rt.Simple=as();Rt.Tagged=us();Rt.decodeAll=Rt.Decoder.decodeAll;Rt.decodeFirst=Rt.Decoder.decodeFirst;Rt.diagnose=Rt.Diagnose.diagnose;Rt.encode=Rt.Encoder.encode;Rt.decode=Rt.Decoder.decode;Rt.leveldb={decode:Rt.Decoder.decodeAll,encode:Rt.Encoder.encode,buffer:!0,name:"cbor"}});function pe(...r){let t=new Uint8Array(r.reduce((n,i)=>n+i.byteLength,0)),e=0;for(let n of r)t.set(new Uint8Array(n),e),e+=n.byteLength;return t.buffer}function Nt(r){return[...new Uint8Array(r)].map(t=>t.toString(16).padStart(2,"0")).join("")}function Gt(r){if(!yl.test(r))throw new Error("Invalid hexadecimal string.");let t=[...r].reduce((e,n,i)=>(e[i/2|0]=(e[i/2|0]||"")+n,e),[]).map(e=>Number.parseInt(e,16));return new Uint8Array(t).buffer}function _s(r,t){if(r.byteLength!==t.byteLength)return r.byteLength-t.byteLength;let e=new Uint8Array(r),n=new Uint8Array(t);for(let i=0;i<e.length;i++)if(e[i]!==n[i])return e[i]-n[i];return 0}function $r(r,t){return _s(r,t)===0}function He(r){return new DataView(r.buffer,r.byteOffset,r.byteLength).buffer}function Tn(r){return r instanceof Uint8Array?He(r):r instanceof ArrayBuffer?r:Array.isArray(r)?He(new Uint8Array(r)):"buffer"in r?Tn(r.buffer):He(new Uint8Array(r))}var yl,Xt=ct(()=>{yl=new RegExp(/^[0-9a-fA-F]+$/)});function Re(r){return He(Mo.create().update(new Uint8Array(r)).digest())}function Sn(r){if(r instanceof Ra.default.Tagged)return Sn(r.value);if(typeof r=="string")return Fa(r);if(typeof r=="number")return Re(Ue(r));if(r instanceof ArrayBuffer||ArrayBuffer.isView(r))return Re(r);if(Array.isArray(r)){let t=r.map(Sn);return Re(pe(...t))}else{if(r&&typeof r=="object"&&r._isPrincipal)return Re(r.toUint8Array());if(typeof r=="object"&&r!==null&&typeof r.toHash=="function")return Sn(r.toHash());if(typeof r=="object")return bs(r);if(typeof r=="bigint")return Re(Ue(r))}throw Object.assign(new Error(`Attempt to hash a value of unsupported type: ${r}`),{value:r})}function pr(r){return bs(r)}function bs(r){let n=Object.entries(r).filter(([,o])=>o!==void 0).map(([o,c])=>{let u=Fa(o),w=Sn(c);return[u,w]}).sort(([o],[c])=>_s(o,c)),i=pe(...n.map(o=>pe(...o)));return Re(i)}var Ra,Fa,Vr=ct(()=>{ur();Ra=Te(vn());Ui();Xt();Fa=r=>{let t=new TextEncoder().encode(r);return Re(t)}});var vs=Bt(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});var ml=9007199254740992;function Ee(r,...t){let e=new Uint8Array(r.byteLength+t.reduce((i,s)=>i+s.byteLength,0));e.set(new Uint8Array(r),0);let n=r.byteLength;for(let i of t)e.set(new Uint8Array(i),n),n+=i.byteLength;return e.buffer}function se(r,t,e){e=e.replace(/[^0-9a-fA-F]/g,"");let n=2**(t-24);e=e.slice(-n*2).padStart(n*2,"0");let i=[(r<<5)+t].concat(e.match(/../g).map(s=>parseInt(s,16)));return new Uint8Array(i).buffer}function Bn(r,t){if(t<24)return new Uint8Array([(r<<5)+t]).buffer;{let e=t<=255?24:t<=65535?25:t<=4294967295?26:27;return se(r,e,t.toString(16))}}function Oa(r){let t=[];for(let e=0;e<r.length;e++){let n=r.charCodeAt(e);n<128?t.push(n):n<2048?t.push(192|n>>6,128|n&63):n<55296||n>=57344?t.push(224|n>>12,128|n>>6&63,128|n&63):(e++,n=(n&1023)<<10|r.charCodeAt(e)&1023,t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|n&63))}return Ee(new Uint8Array(Bn(3,r.length)),new Uint8Array(t))}function xl(r,t){if(r==14277111)return Ee(new Uint8Array([217,217,247]),t);if(r<24)return Ee(new Uint8Array([192+r]),t);{let e=r<=255?24:r<=65535?25:r<=4294967295?26:27,n=2**(e-24),i=r.toString(16).slice(-n*2).padStart(n*2,"0"),s=[192+e].concat(i.match(/../g).map(o=>parseInt(o,16)));return new Uint8Array(s).buffer}}pt.tagged=xl;function Lr(r){return new Uint8Array(r).buffer}pt.raw=Lr;function Es(r){if(isNaN(r))throw new RangeError("Invalid number.");r=Math.min(Math.max(0,r),23);let t=[0+r];return new Uint8Array(t).buffer}pt.uSmall=Es;function Pa(r,t){if(r=parseInt(""+r,t),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),255),r=r.toString(16),se(0,24,r)}pt.u8=Pa;function ka(r,t){if(r=parseInt(""+r,t),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),65535),r=r.toString(16),se(0,25,r)}pt.u16=ka;function Ma(r,t){if(r=parseInt(""+r,t),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),4294967295),r=r.toString(16),se(0,26,r)}pt.u32=Ma;function As(r,t){if(typeof r=="string"&&t==16){if(r.match(/[^0-9a-fA-F]/))throw new RangeError("Invalid number.");return se(0,27,r)}if(r=parseInt(""+r,t),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),ml),r=r.toString(16),se(0,27,r)}pt.u64=As;function Ca(r){if(isNaN(r))throw new RangeError("Invalid number.");if(r===0)return Es(0);r=Math.min(Math.max(0,-r),24)-1;let t=[32+r];return new Uint8Array(t).buffer}pt.iSmall=Ca;function $a(r,t){if(r=parseInt(""+r,t),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),255),r=r.toString(16),se(1,24,r)}pt.i8=$a;function Va(r,t){if(r=parseInt(""+r,t),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),65535),r=r.toString(16),se(1,25,r)}pt.i16=Va;function La(r,t){if(r=parseInt(""+r,t),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),4294967295),r=r.toString(16),se(1,26,r)}pt.i32=La;function qa(r,t){if(typeof r=="string"&&t==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 e=!1,n=r.split("").reduceRight((i,s)=>{if(e)return s+i;let o=parseInt(s,16)-1;return o>=0?(e=!0,o.toString(16)+i):"f"+i},"");return e?se(1,27,n):As(0)}if(r=parseInt(""+r,t),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),9007199254740992),r=r.toString(16),se(1,27,r)}pt.i64=qa;function _l(r){return r>=0?r<24?Es(r):r<=255?Pa(r):r<=65535?ka(r):r<=4294967295?Ma(r):As(r):r>=-24?Ca(r):r>=-255?$a(r):r>=-65535?Va(r):r>=-4294967295?La(r):qa(r)}pt.number=_l;function bl(r){return Ee(Bn(2,r.byteLength),r)}pt.bytes=bl;function El(r){return Oa(r)}pt.string=El;function Al(r){return Ee(Bn(4,r.length),...r)}pt.array=Al;function vl(r,t=!1){r instanceof Map||(r=new Map(Object.entries(r)));let e=Array.from(r.entries());return t&&(e=e.sort(([n],[i])=>n.localeCompare(i))),Ee(Bn(5,r.size),...e.map(([n,i])=>Ee(Oa(n),i)))}pt.map=vl;function Tl(r){let t=new Float32Array([r]);return Ee(new Uint8Array([250]),new Uint8Array(t.buffer))}pt.singleFloat=Tl;function Sl(r){let t=new Float64Array([r]);return Ee(new Uint8Array([251]),new Uint8Array(t.buffer))}pt.doubleFloat=Sl;function Bl(r){return r?Ha():Ga()}pt.bool=Bl;function Ha(){return Lr(new Uint8Array([245]))}pt.true_=Ha;function Ga(){return Lr(new Uint8Array([244]))}pt.false_=Ga;function Il(){return Lr(new Uint8Array([246]))}pt.null_=Il;function Nl(){return Lr(new Uint8Array([247]))}pt.undefined_=Nl});var Ka=Bt(Fe=>{"use strict";var Ul=Fe&&Fe.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)Object.hasOwnProperty.call(r,e)&&(t[e]=r[e]);return t.default=r,t};Object.defineProperty(Fe,"__esModule",{value:!0});var oe=Ul(vs()),Rl=[ArrayBuffer,Uint8Array,Uint16Array,Uint32Array,Int8Array,Int16Array,Int32Array,Float32Array,Float64Array],In=class{constructor(t,e=!1){this._serializer=t,this._stable=e,this.name="jsonDefault",this.priority=-100}match(t){return["undefined","boolean","number","string","object"].indexOf(typeof t)!=-1}encode(t){switch(typeof t){case"undefined":return oe.undefined_();case"boolean":return oe.bool(t);case"number":return Math.floor(t)===t?oe.number(t):oe.doubleFloat(t);case"string":return oe.string(t);case"object":if(t===null)return oe.null_();if(Array.isArray(t))return oe.array(t.map(e=>this._serializer.serializeValue(e)));if(Rl.find(e=>t instanceof e))return oe.bytes(t.buffer);if(Object.getOwnPropertyNames(t).indexOf("toJSON")!==-1)return this.encode(t.toJSON());if(t instanceof Map){let e=new Map;for(let[n,i]of t.entries())e.set(n,this._serializer.serializeValue(i));return oe.map(e,this._stable)}else{let e=new Map;for(let[n,i]of Object.entries(t))e.set(n,this._serializer.serializeValue(i));return oe.map(e,this._stable)}default:throw new Error("Invalid value.")}}};Fe.JsonDefaultCborEncoder=In;var Nn=class{constructor(){this.name="cborEncoder",this.priority=-90}match(t){return typeof t=="object"&&typeof t.toCBOR=="function"}encode(t){return t.toCBOR()}};Fe.ToCborEncoder=Nn;var Un=class{constructor(){this._encoders=new Set}static withDefaultEncoders(t=!1){let e=new this;return e.addEncoder(new In(e,t)),e.addEncoder(new Nn),e}removeEncoder(t){for(let e of this._encoders.values())e.name==t&&this._encoders.delete(e)}addEncoder(t){this._encoders.add(t)}getEncoderFor(t){let e=null;for(let n of this._encoders)(!e||n.priority>e.priority)&&n.match(t)&&(e=n);if(e===null)throw new Error("Could not find an encoder for value.");return e}serializeValue(t){return this.getEncoderFor(t).encode(t)}serialize(t){return this.serializeValue(t)}};Fe.CborSerializer=Un;var Ts=class extends Un{serialize(t){return oe.raw(new Uint8Array([...new Uint8Array([217,217,247]),...new Uint8Array(super.serializeValue(t))]))}};Fe.SelfDescribeCborSerializer=Ts});var qr=Bt(Ge=>{"use strict";function Fl(r){for(var t in r)Ge.hasOwnProperty(t)||(Ge[t]=r[t])}var Ol=Ge&&Ge.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)Object.hasOwnProperty.call(r,e)&&(t[e]=r[e]);return t.default=r,t};Object.defineProperty(Ge,"__esModule",{value:!0});Fl(Ka());var Pl=Ol(vs());Ge.value=Pl});function Da(r){let t=r.byteLength,e=BigInt(0);for(let n=0;n<t;n++)e=e*BigInt(256)+BigInt(r[n]);return e}function Rn(r){let t=new Uint8Array(r),e=new Us({size:t.byteLength,tags:{2:n=>Da(n),3:n=>-Da(n),[Ns.Semantic]:n=>n}});try{return e.decodeFirst(t)}catch(n){throw new Error(`Failed to decode CBOR: ${n}, input: ${Nt(t)}`)}}var ja,Ke,Wa,Ss,Bs,Is,Rs,Ns,Us,Hr=ct(()=>{ja=Te(vn()),Ke=Te(qr()),Wa=Te(qr());Xt();Ss=class{get name(){return"Principal"}get priority(){return 0}match(t){return t&&t._isPrincipal===!0}encode(t){return Ke.value.bytes(t.toUint8Array())}},Bs=class{get name(){return"Buffer"}get priority(){return 1}match(t){return t instanceof ArrayBuffer||ArrayBuffer.isView(t)}encode(t){return Ke.value.bytes(new Uint8Array(t))}},Is=class{get name(){return"BigInt"}get priority(){return 1}match(t){return typeof t=="bigint"}encode(t){return t>BigInt(0)?Ke.value.tagged(2,Ke.value.bytes(Gt(t.toString(16)))):Ke.value.tagged(3,Ke.value.bytes(Gt((BigInt("-1")*t).toString(16))))}},Rs=Wa.SelfDescribeCborSerializer.withDefaultEncoders(!0);Rs.addEncoder(new Ss);Rs.addEncoder(new Bs);Rs.addEncoder(new Is);(function(r){r[r.Uint64LittleEndian=71]="Uint64LittleEndian",r[r.Semantic=55799]="Semantic"})(Ns||(Ns={}));Us=class extends ja.default.Decoder{createByteString(t){return pe(...t)}createByteStringFromHeap(t,e){return t===e?new ArrayBuffer(0):new Uint8Array(this._heap.slice(t,e))}}});function Ps(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function ks(r){if(!Ps(r))throw new Error("Uint8Array expected")}function Pn(r,t){if(typeof t!="boolean")throw new Error(`${r} must be valid boolean, got "${t}".`)}function kn(r){ks(r);let t="";for(let e=0;e<r.length;e++)t+=Vl[r[e]];return t}function Xa(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}function Ya(r){if(r>=Ae._0&&r<=Ae._9)return r-Ae._0;if(r>=Ae._A&&r<=Ae._F)return r-(Ae._A-10);if(r>=Ae._a&&r<=Ae._f)return r-(Ae._a-10)}function Ja(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(e);for(let i=0,s=0;i<e;i++,s+=2){let o=Ya(r.charCodeAt(s)),c=Ya(r.charCodeAt(s+1));if(o===void 0||c===void 0){let u=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+s)}n[i]=o*16+c}return n}function Za(r){return Xa(kn(r))}function wr(r){return ks(r),Xa(kn(Uint8Array.from(r).reverse()))}function Ms(r,t){return Ja(r.toString(16).padStart(t*2,"0"))}function Kr(r,t){return Ms(r,t).reverse()}function ye(r,t,e){let n;if(typeof t=="string")try{n=Ja(t)}catch(s){throw new Error(`${r} must be valid hex string, got "${t}". Cause: ${s}`)}else if(Ps(t))n=Uint8Array.from(t);else throw new Error(`${r} must be hex string or Uint8Array`);let i=n.length;if(typeof e=="number"&&i!==e)throw new Error(`${r} expected ${e} bytes, got ${i}`);return n}function Cs(...r){let t=0;for(let n=0;n<r.length;n++){let i=r[n];ks(i),t+=i.length}let e=new Uint8Array(t);for(let n=0,i=0;n<r.length;n++){let s=r[n];e.set(s,i),i+=s.length}return e}function Ll(r,t,e){return Os(r)&&Os(t)&&Os(e)&&t<=r&&r<e}function gr(r,t,e,n){if(!Ll(t,e,n))throw new Error(`expected valid ${r}: ${e} <= n < ${n}, got ${typeof t} ${t}`)}function mr(r,t,e={}){let n=(i,s,o)=>{let c=ql[s];if(typeof c!="function")throw new Error(`Invalid validator "${s}", expected function`);let u=r[i];if(!(o&&u===void 0)&&!c(u,r))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${s}`)};for(let[i,s]of Object.entries(t))n(i,s,!1);for(let[i,s]of Object.entries(e))n(i,s,!0);return r}function $s(r){let t=new WeakMap;return(e,...n)=>{let i=t.get(e);if(i!==void 0)return i;let s=r(e,...n);return t.set(e,s),s}}var Ml,Cl,$l,Vl,Ae,Os,Qa,ql,Dr=ct(()=>{Ml=BigInt(0),Cl=BigInt(1),$l=BigInt(2);Vl=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));Ae={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};Os=r=>typeof r=="bigint"&&Ml<=r;Qa=r=>($l<<BigInt(r-1))-Cl,ql={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"||Ps(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)}});function vt(r,t){let e=r%t;return e>=Ft?e:t+e}function jl(r,t,e){if(e<=Ft||t<Ft)throw new Error("Expected power/modulo > 0");if(e===At)return Ft;let n=At;for(;t>Ft;)t&At&&(n=n*r%e),r=r*r%e,t>>=At;return n}function ae(r,t,e){let n=r;for(;t-- >Ft;)n*=n,n%=e;return n}function rc(r,t){if(r===Ft||t<=Ft)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=vt(r,t),n=t,i=Ft,s=At,o=At,c=Ft;for(;e!==Ft;){let w=n/e,y=n%e,m=i-o*w,N=s-c*w;n=e,e=y,i=o,s=c,o=m,c=N}if(n!==At)throw new Error("invert: does not exist");return vt(i,t)}function Wl(r){let t=(r-At)/De,e,n,i;for(e=r-At,n=0;e%De===Ft;e/=De,n++);for(i=De;i<r&&jl(i,t,r)!==r-At;i++);if(n===1){let o=(r+At)/Vs;return function(u,w){let y=u.pow(w,o);if(!u.eql(u.sqr(y),w))throw new Error("Cannot find square root");return y}}let s=(e+At)/De;return function(c,u){if(c.pow(u,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let w=n,y=c.pow(c.mul(c.ONE,i),e),m=c.pow(u,s),N=c.pow(u,e);for(;!c.eql(N,c.ONE);){if(c.eql(N,c.ZERO))return c.ZERO;let M=1;for(let G=c.sqr(N);M<w&&!c.eql(G,c.ONE);M++)G=c.sqr(G);let O=c.pow(y,At<<BigInt(w-M-1));y=c.sqr(O),m=c.mul(m,O),N=c.mul(N,y),w=M}return m}}function zl(r){if(r%Vs===Gl){let t=(r+At)/Vs;return function(n,i){let s=n.pow(i,t);if(!n.eql(n.sqr(s),i))throw new Error("Cannot find square root");return s}}if(r%ec===tc){let t=(r-tc)/ec;return function(n,i){let s=n.mul(i,De),o=n.pow(s,t),c=n.mul(i,o),u=n.mul(n.mul(c,De),o),w=n.mul(c,n.sub(u,n.ONE));if(!n.eql(n.sqr(w),i))throw new Error("Cannot find square root");return w}}return r%Dl,Wl(r)}function ic(r){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=Yl.reduce((n,i)=>(n[i]="function",n),t);return mr(r,e)}function Xl(r,t,e){if(e<Ft)throw new Error("Expected power > 0");if(e===Ft)return r.ONE;if(e===At)return t;let n=r.ONE,i=t;for(;e>Ft;)e&At&&(n=r.mul(n,i)),i=r.sqr(i),e>>=At;return n}function Jl(r,t){let e=new Array(t.length),n=t.reduce((s,o,c)=>r.is0(o)?s:(e[c]=s,r.mul(s,o)),r.ONE),i=r.inv(n);return t.reduceRight((s,o,c)=>r.is0(o)?s:(e[c]=r.mul(s,e[c]),r.mul(s,o)),i),e}function Ls(r,t){let e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function sc(r,t,e=!1,n={}){if(r<=Ft)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:i,nByteLength:s}=Ls(r,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let o=zl(r),c=Object.freeze({ORDER:r,BITS:i,BYTES:s,MASK:Qa(i),ZERO:Ft,ONE:At,create:u=>vt(u,r),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return Ft<=u&&u<r},is0:u=>u===Ft,isOdd:u=>(u&At)===At,neg:u=>vt(-u,r),eql:(u,w)=>u===w,sqr:u=>vt(u*u,r),add:(u,w)=>vt(u+w,r),sub:(u,w)=>vt(u-w,r),mul:(u,w)=>vt(u*w,r),pow:(u,w)=>Xl(c,u,w),div:(u,w)=>vt(u*rc(w,r),r),sqrN:u=>u*u,addN:(u,w)=>u+w,subN:(u,w)=>u-w,mulN:(u,w)=>u*w,inv:u=>rc(u,r),sqrt:n.sqrt||(u=>o(c,u)),invertBatch:u=>Jl(c,u),cmov:(u,w,y)=>y?w:u,toBytes:u=>e?Kr(u,s):Ms(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return e?wr(u):Za(u)}});return Object.freeze(c)}var Ft,At,De,Gl,Vs,tc,ec,Kl,Dl,nc,Yl,Mn=ct(()=>{Dr();Ft=BigInt(0),At=BigInt(1),De=BigInt(2),Gl=BigInt(3),Vs=BigInt(4),tc=BigInt(5),ec=BigInt(8),Kl=BigInt(9),Dl=BigInt(16);nc=(r,t)=>(vt(r,t)&At)===At,Yl=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"]});function ac(r,t){let e=(s,o)=>{let c=o.negate();return s?c:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>t)throw new Error(`Wrong window size=${s}, should be [1..${t}]`)},i=s=>{n(s);let o=Math.ceil(t/s)+1,c=2**(s-1);return{windows:o,windowSize:c}};return{constTimeNegate:e,unsafeLadder(s,o){let c=r.ZERO,u=s;for(;o>Zl;)o&qs&&(c=c.add(u)),u=u.double(),o>>=qs;return c},precomputeWindow(s,o){let{windows:c,windowSize:u}=i(o),w=[],y=s,m=y;for(let N=0;N<c;N++){m=y,w.push(m);for(let M=1;M<u;M++)m=m.add(y),w.push(m);y=m.double()}return w},wNAF(s,o,c){let{windows:u,windowSize:w}=i(s),y=r.ZERO,m=r.BASE,N=BigInt(2**s-1),M=2**s,O=BigInt(s);for(let G=0;G<u;G++){let lt=G*w,j=Number(c&N);c>>=O,j>w&&(j-=M,c+=qs);let W=lt,z=lt+Math.abs(j)-1,yt=G%2!==0,C=j<0;j===0?m=m.add(e(yt,o[W])):y=y.add(e(C,o[z]))}return{p:y,f:m}},wNAFCached(s,o,c){let u=oc.get(s)||1,w=Hs.get(s);return w||(w=this.precomputeWindow(s,u),u!==1&&Hs.set(s,c(w))),this.wNAF(u,w,o)},setWindowSize(s,o){n(o),oc.set(s,o),Hs.delete(s)}}}function cc(r){return ic(r.Fp),mr(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ls(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}var Zl,qs,Hs,oc,uc=ct(()=>{Mn();Dr();Zl=BigInt(0),qs=BigInt(1),Hs=new WeakMap,oc=new WeakMap});var Gs=ct(()=>{Xt()});var Cn=ct(()=>{ur()});var fc,dy,$n,lc,jr=ct(()=>{Hr();ir();Vr();Xt();te();Gs();Cn();(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"})(fc||(fc={}));dy=Gt("308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c05030201036100");(function(r){r.Unknown="unknown",r.Absent="absent",r.Found="found"})($n||($n={}));(function(r){r.Less="less",r.Greater="greater"})(lc||(lc={}))});var Vn=ct(()=>{te();ir();jr();Xt();Hr();Cn()});var a0=Te(vo());var Ai;(function(r){r[r.SysFatal=1]="SysFatal",r[r.SysTransient=2]="SysTransient",r[r.DestinationInvalid=3]="DestinationInvalid",r[r.CanisterReject=4]="CanisterReject",r[r.CanisterError=5]="CanisterError"})(Ai||(Ai={}));te();ir();te();Vr();Xt();var wl=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e},gl=new TextEncoder().encode(`
|
|
2
|
-
ic-request`),be=class{getPrincipal(){return this._principal||(this._principal=It.selfAuthenticating(new Uint8Array(this.getPublicKey().toDer()))),this._principal}async transformRequest(t){let{body:e}=t,n=wl(t,["body"]),i=await pr(e);return Object.assign(Object.assign({},n),{body:{content:e,sender_pubkey:this.getPublicKey().toDer(),sender_sig:await this.sign(pe(gl,i))}})}},yr=class{getPrincipal(){return It.anonymous()}async transformRequest(t){return Object.assign(Object.assign({},t),{body:{content:t.body}})}};Hr();Vr();Xt();ur();var kl=Te(qr());var Fs;(function(r){r.Call="call"})(Fs||(Fs={}));var zp=BigInt(1e6),Yp=60*1e3;function On(r){let t=[];return r.forEach((e,n)=>{t.push([n,e])}),t}ir();var Gr=class extends ee{constructor(t,e){super(t),this.response=e,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}};Vn();jr();Ii();var Ln=BigInt(4294967295),Ks=BigInt(32);function pc(r,t=!1){return t?{h:Number(r&Ln),l:Number(r>>Ks&Ln)}:{h:Number(r>>Ks&Ln)|0,l:Number(r&Ln)|0}}function nh(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let i=0;i<r.length;i++){let{h:s,l:o}=pc(r[i],t);[e[i],n[i]]=[s,o]}return[e,n]}var ih=(r,t)=>BigInt(r>>>0)<<Ks|BigInt(t>>>0),sh=(r,t,e)=>r>>>e,oh=(r,t,e)=>r<<32-e|t>>>e,ah=(r,t,e)=>r>>>e|t<<32-e,ch=(r,t,e)=>r<<32-e|t>>>e,uh=(r,t,e)=>r<<64-e|t>>>e-32,fh=(r,t,e)=>r>>>e-32|t<<64-e,lh=(r,t)=>t,hh=(r,t)=>r,dh=(r,t,e)=>r<<e|t>>>32-e,ph=(r,t,e)=>t<<e|r>>>32-e,yh=(r,t,e)=>t<<e-32|r>>>64-e,wh=(r,t,e)=>r<<e-32|t>>>64-e;function gh(r,t,e,n){let i=(t>>>0)+(n>>>0);return{h:r+e+(i/2**32|0)|0,l:i|0}}var mh=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),xh=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,_h=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),bh=(r,t,e,n,i)=>t+e+n+i+(r/2**32|0)|0,Eh=(r,t,e,n,i)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(i>>>0),Ah=(r,t,e,n,i,s)=>t+e+n+i+s+(r/2**32|0)|0;var vh={fromBig:pc,split:nh,toBig:ih,shrSH:sh,shrSL:oh,rotrSH:ah,rotrSL:ch,rotrBH:uh,rotrBL:fh,rotr32H:lh,rotr32L:hh,rotlSH:dh,rotlSL:ph,rotlBH:yh,rotlBL:wh,add:gh,add3L:mh,add3H:xh,add4L:_h,add4H:bh,add5H:Ah,add5L:Eh},D=vh;Ur();var[Th,Sh]=D.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),Oe=new Uint32Array(80),Pe=new Uint32Array(80),Ds=class extends nr{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:n,Bl:i,Ch:s,Cl:o,Dh:c,Dl:u,Eh:w,El:y,Fh:m,Fl:N,Gh:M,Gl:O,Hh:G,Hl:lt}=this;return[t,e,n,i,s,o,c,u,w,y,m,N,M,O,G,lt]}set(t,e,n,i,s,o,c,u,w,y,m,N,M,O,G,lt){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=c|0,this.Dl=u|0,this.Eh=w|0,this.El=y|0,this.Fh=m|0,this.Fl=N|0,this.Gh=M|0,this.Gl=O|0,this.Hh=G|0,this.Hl=lt|0}process(t,e){for(let z=0;z<16;z++,e+=4)Oe[z]=t.getUint32(e),Pe[z]=t.getUint32(e+=4);for(let z=16;z<80;z++){let yt=Oe[z-15]|0,C=Pe[z-15]|0,H=D.rotrSH(yt,C,1)^D.rotrSH(yt,C,8)^D.shrSH(yt,C,7),nt=D.rotrSL(yt,C,1)^D.rotrSL(yt,C,8)^D.shrSL(yt,C,7),Y=Oe[z-2]|0,R=Pe[z-2]|0,it=D.rotrSH(Y,R,19)^D.rotrBH(Y,R,61)^D.shrSH(Y,R,6),st=D.rotrSL(Y,R,19)^D.rotrBL(Y,R,61)^D.shrSL(Y,R,6),ot=D.add4L(nt,st,Pe[z-7],Pe[z-16]),wt=D.add4H(ot,H,it,Oe[z-7],Oe[z-16]);Oe[z]=wt|0,Pe[z]=ot|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:c,Cl:u,Dh:w,Dl:y,Eh:m,El:N,Fh:M,Fl:O,Gh:G,Gl:lt,Hh:j,Hl:W}=this;for(let z=0;z<80;z++){let yt=D.rotrSH(m,N,14)^D.rotrSH(m,N,18)^D.rotrBH(m,N,41),C=D.rotrSL(m,N,14)^D.rotrSL(m,N,18)^D.rotrBL(m,N,41),H=m&M^~m&G,nt=N&O^~N<,Y=D.add5L(W,C,nt,Sh[z],Pe[z]),R=D.add5H(Y,j,yt,H,Th[z],Oe[z]),it=Y|0,st=D.rotrSH(n,i,28)^D.rotrBH(n,i,34)^D.rotrBH(n,i,39),ot=D.rotrSL(n,i,28)^D.rotrBL(n,i,34)^D.rotrBL(n,i,39),wt=n&s^n&c^s&c,Ot=i&o^i&u^o&u;j=G|0,W=lt|0,G=M|0,lt=O|0,M=m|0,O=N|0,{h:m,l:N}=D.add(w|0,y|0,R|0,it|0),w=c|0,y=u|0,c=s|0,u=o|0,s=n|0,o=i|0;let V=D.add3L(it,ot,Ot);n=D.add3H(V,R,st,wt),i=V|0}({h:n,l:i}=D.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=D.add(this.Bh|0,this.Bl|0,s|0,o|0),{h:c,l:u}=D.add(this.Ch|0,this.Cl|0,c|0,u|0),{h:w,l:y}=D.add(this.Dh|0,this.Dl|0,w|0,y|0),{h:m,l:N}=D.add(this.Eh|0,this.El|0,m|0,N|0),{h:M,l:O}=D.add(this.Fh|0,this.Fl|0,M|0,O|0),{h:G,l:lt}=D.add(this.Gh|0,this.Gl|0,G|0,lt|0),{h:j,l:W}=D.add(this.Hh|0,this.Hl|0,j|0,W|0),this.set(n,i,s,o,c,u,w,y,m,N,M,O,G,lt,j,W)}roundClean(){Oe.fill(0),Pe.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var yc=Nr(()=>new Ds);Ur();uc();Mn();Dr();Dr();var ce=BigInt(0),Kt=BigInt(1),qn=BigInt(2),Bh=BigInt(8),Ih={zip215:!0};function Nh(r){let t=cc(r);return mr(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function wc(r){let t=Nh(r),{Fp:e,n,prehash:i,hash:s,randomBytes:o,nByteLength:c,h:u}=t,w=qn<<BigInt(c*8)-Kt,y=e.create,m=t.uvRatio||((V,U)=>{try{return{isValid:!0,value:e.sqrt(V*e.inv(U))}}catch{return{isValid:!1,value:ce}}}),N=t.adjustScalarBytes||(V=>V),M=t.domain||((V,U,P)=>{if(Pn("phflag",P),U.length||P)throw new Error("Contexts/pre-hash are not supported");return V});function O(V,U){gr("coordinate "+V,U,ce,w)}function G(V){if(!(V instanceof W))throw new Error("ExtendedPoint expected")}let lt=$s((V,U)=>{let{ex:P,ey:L,ez:K}=V,J=V.is0();U==null&&(U=J?Bh:e.inv(K));let tt=y(P*U),ut=y(L*U),B=y(K*U);if(J)return{x:ce,y:Kt};if(B!==Kt)throw new Error("invZ was invalid");return{x:tt,y:ut}}),j=$s(V=>{let{a:U,d:P}=t;if(V.is0())throw new Error("bad point: ZERO");let{ex:L,ey:K,ez:J,et:tt}=V,ut=y(L*L),B=y(K*K),h=y(J*J),mt=y(h*h),Et=y(ut*U),gt=y(h*y(Et+B)),k=y(mt+y(P*y(ut*B)));if(gt!==k)throw new Error("bad point: equation left != right (1)");let a=y(L*K),f=y(J*tt);if(a!==f)throw new Error("bad point: equation left != right (2)");return!0});class W{constructor(U,P,L,K){this.ex=U,this.ey=P,this.ez=L,this.et=K,O("x",U),O("y",P),O("z",L),O("t",K),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(U){if(U instanceof W)throw new Error("extended point not allowed");let{x:P,y:L}=U||{};return O("x",P),O("y",L),new W(P,L,Kt,y(P*L))}static normalizeZ(U){let P=e.invertBatch(U.map(L=>L.ez));return U.map((L,K)=>L.toAffine(P[K])).map(W.fromAffine)}_setWindowSize(U){C.setWindowSize(this,U)}assertValidity(){j(this)}equals(U){G(U);let{ex:P,ey:L,ez:K}=this,{ex:J,ey:tt,ez:ut}=U,B=y(P*ut),h=y(J*K),mt=y(L*ut),Et=y(tt*K);return B===h&&mt===Et}is0(){return this.equals(W.ZERO)}negate(){return new W(y(-this.ex),this.ey,this.ez,y(-this.et))}double(){let{a:U}=t,{ex:P,ey:L,ez:K}=this,J=y(P*P),tt=y(L*L),ut=y(qn*y(K*K)),B=y(U*J),h=P+L,mt=y(y(h*h)-J-tt),Et=B+tt,gt=Et-ut,k=B-tt,a=y(mt*gt),f=y(Et*k),l=y(mt*k),b=y(gt*Et);return new W(a,f,b,l)}add(U){G(U);let{a:P,d:L}=t,{ex:K,ey:J,ez:tt,et:ut}=this,{ex:B,ey:h,ez:mt,et:Et}=U;if(P===BigInt(-1)){let E=y((J-K)*(h+B)),I=y((J+K)*(h-B)),F=y(I-E);if(F===ce)return this.double();let $=y(tt*qn*Et),Z=y(ut*qn*mt),ht=Z+$,xt=I+E,X=Z-$,q=y(ht*F),Tt=y(xt*X),ve=y(ht*X),$e=y(F*xt);return new W(q,Tt,$e,ve)}let gt=y(K*B),k=y(J*h),a=y(ut*L*Et),f=y(tt*mt),l=y((K+J)*(B+h)-gt-k),b=f-a,g=f+a,_=y(k-P*gt),v=y(l*b),d=y(g*_),x=y(l*_),A=y(b*g);return new W(v,d,A,x)}subtract(U){return this.add(U.negate())}wNAF(U){return C.wNAFCached(this,U,W.normalizeZ)}multiply(U){let P=U;gr("scalar",P,Kt,n);let{p:L,f:K}=this.wNAF(P);return W.normalizeZ([L,K])[0]}multiplyUnsafe(U){let P=U;return gr("scalar",P,ce,n),P===ce?yt:this.equals(yt)||P===Kt?this:this.equals(z)?this.wNAF(P).p:C.unsafeLadder(this,P)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}isTorsionFree(){return C.unsafeLadder(this,n).is0()}toAffine(U){return lt(this,U)}clearCofactor(){let{h:U}=t;return U===Kt?this:this.multiplyUnsafe(U)}static fromHex(U,P=!1){let{d:L,a:K}=t,J=e.BYTES;U=ye("pointHex",U,J),Pn("zip215",P);let tt=U.slice(),ut=U[J-1];tt[J-1]=ut&-129;let B=wr(tt),h=P?w:e.ORDER;gr("pointHex.y",B,ce,h);let mt=y(B*B),Et=y(mt-Kt),gt=y(L*mt-K),{isValid:k,value:a}=m(Et,gt);if(!k)throw new Error("Point.fromHex: invalid y coordinate");let f=(a&Kt)===Kt,l=(ut&128)!==0;if(!P&&a===ce&&l)throw new Error("Point.fromHex: x=0 and x_0=1");return l!==f&&(a=y(-a)),W.fromAffine({x:a,y:B})}static fromPrivateKey(U){return Y(U).point}toRawBytes(){let{x:U,y:P}=this.toAffine(),L=Kr(P,e.BYTES);return L[L.length-1]|=U&Kt?128:0,L}toHex(){return kn(this.toRawBytes())}}W.BASE=new W(t.Gx,t.Gy,Kt,y(t.Gx*t.Gy)),W.ZERO=new W(ce,Kt,Kt,ce);let{BASE:z,ZERO:yt}=W,C=ac(W,c*8);function H(V){return vt(V,n)}function nt(V){return H(wr(V))}function Y(V){let U=c;V=ye("private key",V,U);let P=ye("hashed private key",s(V),2*U),L=N(P.slice(0,U)),K=P.slice(U,2*U),J=nt(L),tt=z.multiply(J),ut=tt.toRawBytes();return{head:L,prefix:K,scalar:J,point:tt,pointBytes:ut}}function R(V){return Y(V).pointBytes}function it(V=new Uint8Array,...U){let P=Cs(...U);return nt(s(M(P,ye("context",V),!!i)))}function st(V,U,P={}){V=ye("message",V),i&&(V=i(V));let{prefix:L,scalar:K,pointBytes:J}=Y(U),tt=it(P.context,L,V),ut=z.multiply(tt).toRawBytes(),B=it(P.context,ut,J,V),h=H(tt+B*K);gr("signature.s",h,ce,n);let mt=Cs(ut,Kr(h,e.BYTES));return ye("result",mt,c*2)}let ot=Ih;function wt(V,U,P,L=ot){let{context:K,zip215:J}=L,tt=e.BYTES;V=ye("signature",V,2*tt),U=ye("message",U),J!==void 0&&Pn("zip215",J),i&&(U=i(U));let ut=wr(V.slice(tt,2*tt)),B,h,mt;try{B=W.fromHex(P,J),h=W.fromHex(V.slice(0,tt),J),mt=z.multiplyUnsafe(ut)}catch{return!1}if(!J&&B.isSmallOrder())return!1;let Et=it(K,h.toRawBytes(),B.toRawBytes(),U);return h.add(B.multiplyUnsafe(Et)).subtract(mt).clearCofactor().equals(W.ZERO)}return z._setWindowSize(8),{CURVE:t,getPublicKey:R,sign:st,verify:wt,ExtendedPoint:W,utils:{getExtendedPublicKey:Y,randomPrivateKey:()=>o(e.BYTES),precompute(V=8,U=W.BASE){return U._setWindowSize(V),U.multiply(BigInt(3)),U}}}}Mn();var js=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),gc=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),$y=BigInt(0),Uh=BigInt(1),mc=BigInt(2),Vy=BigInt(3),Rh=BigInt(5),Fh=BigInt(8);function Oh(r){let t=BigInt(10),e=BigInt(20),n=BigInt(40),i=BigInt(80),s=js,c=r*r%s*r%s,u=ae(c,mc,s)*c%s,w=ae(u,Uh,s)*r%s,y=ae(w,Rh,s)*w%s,m=ae(y,t,s)*y%s,N=ae(m,e,s)*m%s,M=ae(N,n,s)*N%s,O=ae(M,i,s)*M%s,G=ae(O,i,s)*M%s,lt=ae(G,t,s)*y%s;return{pow_p_5_8:ae(lt,mc,s)*r%s,b2:c}}function Ph(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function kh(r,t){let e=js,n=vt(t*t*t,e),i=vt(n*n*t,e),s=Oh(r*i).pow_p_5_8,o=vt(r*n*s,e),c=vt(t*o*o,e),u=o,w=vt(o*gc,e),y=c===r,m=c===vt(-r,e),N=c===vt(-r*gc,e);return y&&(o=u),(m||N)&&(o=w),nc(o,e)&&(o=vt(-o,e)),{isValid:y||m,value:o}}var Mh=sc(js,void 0,!0),Ch={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Mh,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:Fh,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:yc,randomBytes:Oo,adjustScalarBytes:Ph,uvRatio:kh},xr=wc(Ch);var $h,Vh,Lh,qh;$h=new WeakMap,Vh=new WeakMap,Lh=Symbol.iterator,qh=Symbol.toStringTag;Xt();var xc=r=>{if(r<=127)return 1;if(r<=255)return 2;if(r<=65535)return 3;if(r<=16777215)return 4;throw new Error("Length too long (> 4 bytes)")},_c=(r,t,e)=>{if(e<=127)return r[t]=e,1;if(e<=255)return r[t]=129,r[t+1]=e,2;if(e<=65535)return r[t]=130,r[t+1]=e>>8,r[t+2]=e,3;if(e<=16777215)return r[t]=131,r[t+1]=e>>16,r[t+2]=e>>8,r[t+3]=e,4;throw new Error("Length too long (> 4 bytes)")},Ws=(r,t)=>{if(r[t]<128)return 1;if(r[t]===128)throw new Error("Invalid length 0");if(r[t]===129)return 2;if(r[t]===130)return 3;if(r[t]===131)return 4;throw new Error("Length too long (> 4 bytes)")},Hh=(r,t)=>{let e=Ws(r,t);if(e===1)return r[t];if(e===2)return r[t+1];if(e===3)return(r[t+1]<<8)+r[t+2];if(e===4)return(r[t+1]<<16)+(r[t+2]<<8)+r[t+3];throw new Error("Length too long (> 4 bytes)")},bc=Uint8Array.from([48,12,6,10,43,6,1,4,1,131,184,67,1,1]),je=Uint8Array.from([48,5,6,3,43,101,112]),Gy=Uint8Array.from([48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10]);function _r(r,t){let e=2+xc(r.byteLength+1),n=t.byteLength+e+r.byteLength,i=0,s=new Uint8Array(1+xc(n)+n);return s[i++]=48,i+=_c(s,i,n),s.set(t,i),i+=t.byteLength,s[i++]=3,i+=_c(s,i,r.byteLength+1),s[i++]=0,s.set(new Uint8Array(r),i),s}var Wr=(r,t)=>{let e=0,n=(c,u)=>{if(i[e++]!==c)throw new Error("Expected: "+u)},i=new Uint8Array(r);if(n(48,"sequence"),e+=Ws(i,e),!$r(i.slice(e,e+t.byteLength),t))throw new Error("Not the expected OID.");e+=t.byteLength,n(3,"bit string");let s=Hh(i,e)-1;e+=Ws(i,e),n(0,"0 padding");let o=i.slice(e);if(s!==o.length)throw new Error(`DER payload mismatch: Expected length ${s} actual length ${o.length}`);return o};var Ec=function(r,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!i:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,e):i?i.value=e:t.set(r,e),e},Ac=function(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)},Hn,Gn,Kn=class r{constructor(t){if(Hn.set(this,void 0),Gn.set(this,void 0),t.byteLength!==r.RAW_KEY_LENGTH)throw new Error("An Ed25519 public key must be exactly 32bytes long");Ec(this,Hn,t,"f"),Ec(this,Gn,r.derEncode(t),"f")}static from(t){return this.fromDer(t.toDer())}static fromRaw(t){return new r(t)}static fromDer(t){return new r(this.derDecode(t))}static derEncode(t){return _r(t,je).buffer}static derDecode(t){let e=Wr(t,je);if(e.length!==this.RAW_KEY_LENGTH)throw new Error("An Ed25519 public key must be exactly 32bytes long");return e}get rawKey(){return Ac(this,Hn,"f")}get derKey(){return Ac(this,Gn,"f")}toDer(){return this.derKey}toRaw(){return this.rawKey}};Hn=new WeakMap,Gn=new WeakMap;Kn.RAW_KEY_LENGTH=32;Cn();var we=function(r,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!i:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,e):i?i.value=e:t.set(r,e),e},$t=function(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)},ge,Dn,jn,Wn,zn,Yn,Xn,Jn,br;var Zn=class r{constructor(t=r.default){ge.set(this,void 0),Dn.set(this,void 0),jn.set(this,void 0),Wn.set(this,void 0),zn.set(this,void 0),Yn.set(this,void 0),Xn.set(this,void 0),Jn.set(this,void 0),br.set(this,0);let{initialInterval:e=500,randomizationFactor:n=.5,multiplier:i=1.5,maxInterval:s=6e4,maxElapsedTime:o=9e5,maxIterations:c=10,date:u=Date}=t;we(this,ge,e,"f"),we(this,Dn,n,"f"),we(this,jn,i,"f"),we(this,Wn,s,"f"),we(this,Jn,u,"f"),we(this,zn,u.now(),"f"),we(this,Yn,o,"f"),we(this,Xn,c,"f")}get ellapsedTimeInMsec(){return $t(this,Jn,"f").now()-$t(this,zn,"f")}get currentInterval(){return $t(this,ge,"f")}get count(){return $t(this,br,"f")}get randomValueFromInterval(){let t=$t(this,Dn,"f")*$t(this,ge,"f"),e=$t(this,ge,"f")-t,n=$t(this,ge,"f")+t;return Math.random()*(n-e)+e}incrementCurrentInterval(){var t;return we(this,ge,Math.min($t(this,ge,"f")*$t(this,jn,"f"),$t(this,Wn,"f")),"f"),we(this,br,(t=$t(this,br,"f"),t++,t),"f"),$t(this,ge,"f")}next(){return this.ellapsedTimeInMsec>=$t(this,Yn,"f")||$t(this,br,"f")>=$t(this,Xn,"f")?null:(this.incrementCurrentInterval(),this.randomValueFromInterval)}};ge=new WeakMap,Dn=new WeakMap,jn=new WeakMap,Wn=new WeakMap,zn=new WeakMap,Yn=new WeakMap,Xn=new WeakMap,Jn=new WeakMap,br=new WeakMap;Zn.default={initialInterval:500,randomizationFactor:.5,multiplier:1.5,maxInterval:6e4,maxElapsedTime:9e5,maxIterations:10,date:Date};var Dt=function(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)},zr,Kh,vc,Tc,Dh,jh,Wh,zh,ke,Yh,Xh,Jh,Zh,Qh,Sc,t0,e0,r0,zs;(function(r){r.Received="received",r.Processing="processing",r.Replied="replied",r.Rejected="rejected",r.Unknown="unknown",r.Done="done"})(zs||(zs={}));var ww=5*60*1e3;Kh=new WeakMap,vc=new WeakMap,Tc=new WeakMap,Dh=new WeakMap,jh=new WeakMap,Wh=new WeakMap,zh=new WeakMap,ke=new WeakMap,Yh=new WeakMap,Xh=new WeakMap,Jh=new WeakMap,Zh=new WeakMap,Qh=new WeakMap,Sc=new WeakMap,r0=new WeakMap,zr=new WeakSet,t0=async function r(t){var e,n;let{ecid:i,transformedRequest:s,body:o,requestId:c,backoff:u,tries:w}=t,y=w===0?0:u.next();if(this.log.print(`fetching "/api/v2/canister/${i.toString()}/query" with tries:`,{tries:w,backoff:u,delay:y}),y===null)throw new ee(`Timestamp failed to pass the watermark after retrying the configured ${Dt(this,ke,"f")} times. We cannot guarantee the integrity of the response since it could be a replay attack.`);y>0&&await new Promise(O=>setTimeout(O,y));let m;try{this.log.print(`fetching "/api/v2/canister/${i.toString()}/query" with request:`,s);let O=await Dt(this,vc,"f").call(this,""+new URL(`/api/v2/canister/${i.toString()}/query`,this.host),Object.assign(Object.assign(Object.assign({},Dt(this,Tc,"f")),s.request),{body:o}));if(O.status===200){let G=Rn(await O.arrayBuffer());m=Object.assign(Object.assign({},G),{httpDetails:{ok:O.ok,status:O.status,statusText:O.statusText,headers:On(O.headers)},requestId:c})}else throw new Gr(`Gateway returned an error:
|
|
1
|
+
"use strict";(()=>{var Su=Object.create;var hi=Object.defineProperty;var Bu=Object.getOwnPropertyDescriptor;var Iu=Object.getOwnPropertyNames;var Nu=Object.getPrototypeOf,Uu=Object.prototype.hasOwnProperty;var ut=(r,t)=>()=>(r&&(t=r(r=0)),t);var vt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Ru=(r,t)=>{for(var e in t)hi(r,e,{get:t[e],enumerable:!0})},Fu=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Iu(t))!Uu.call(r,i)&&i!==e&&hi(r,i,{get:()=>t[i],enumerable:!(n=Bu(t,i))||n.enumerable});return r};var ve=(r,t,e)=>(e=r!=null?Su(Nu(r)):{},Fu(t||!r||!r.__esModule?hi(e,"default",{value:r,enumerable:!0}):e,r));var pi=vt(an=>{"use strict";an.byteLength=Pu;an.toByteArray=Mu;an.fromByteArray=Vu;var fe=[],te=[],Ou=typeof Uint8Array<"u"?Uint8Array:Array,di="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(qe=0,co=di.length;qe<co;++qe)fe[qe]=di[qe],te[di.charCodeAt(qe)]=qe;var qe,co;te[45]=62;te[95]=63;function uo(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");e===-1&&(e=t);var n=e===t?0:4-e%4;return[e,n]}function Pu(r){var t=uo(r),e=t[0],n=t[1];return(e+n)*3/4-n}function ku(r,t,e){return(t+e)*3/4-e}function Mu(r){var t,e=uo(r),n=e[0],i=e[1],s=new Ou(ku(r,n,i)),o=0,c=i>0?n-4:n,u;for(u=0;u<c;u+=4)t=te[r.charCodeAt(u)]<<18|te[r.charCodeAt(u+1)]<<12|te[r.charCodeAt(u+2)]<<6|te[r.charCodeAt(u+3)],s[o++]=t>>16&255,s[o++]=t>>8&255,s[o++]=t&255;return i===2&&(t=te[r.charCodeAt(u)]<<2|te[r.charCodeAt(u+1)]>>4,s[o++]=t&255),i===1&&(t=te[r.charCodeAt(u)]<<10|te[r.charCodeAt(u+1)]<<4|te[r.charCodeAt(u+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function Cu(r){return fe[r>>18&63]+fe[r>>12&63]+fe[r>>6&63]+fe[r&63]}function $u(r,t,e){for(var n,i=[],s=t;s<e;s+=3)n=(r[s]<<16&16711680)+(r[s+1]<<8&65280)+(r[s+2]&255),i.push(Cu(n));return i.join("")}function Vu(r){for(var t,e=r.length,n=e%3,i=[],s=16383,o=0,c=e-n;o<c;o+=s)i.push($u(r,o,o+s>c?c:o+s));return n===1?(t=r[e-1],i.push(fe[t>>2]+fe[t<<4&63]+"==")):n===2&&(t=(r[e-2]<<8)+r[e-1],i.push(fe[t>>10]+fe[t>>4&63]+fe[t<<2&63]+"=")),i.join("")}});var cn=vt(wi=>{wi.read=function(r,t,e,n,i){var s,o,c=i*8-n-1,u=(1<<c)-1,y=u>>1,w=-7,g=e?i-1:0,N=e?-1:1,k=r[t+g];for(g+=N,s=k&(1<<-w)-1,k>>=-w,w+=c;w>0;s=s*256+r[t+g],g+=N,w-=8);for(o=s&(1<<-w)-1,s>>=-w,w+=n;w>0;o=o*256+r[t+g],g+=N,w-=8);if(s===0)s=1-y;else{if(s===u)return o?NaN:(k?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-y}return(k?-1:1)*o*Math.pow(2,s-n)};wi.write=function(r,t,e,n,i,s){var o,c,u,y=s*8-i-1,w=(1<<y)-1,g=w>>1,N=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,k=n?0:s-1,O=n?1:-1,G=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(c=isNaN(t)?1:0,o=w):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+g>=1?t+=N/u:t+=N*Math.pow(2,1-g),t*u>=2&&(o++,u/=2),o+g>=w?(c=0,o=w):o+g>=1?(c=(t*u-1)*Math.pow(2,i),o=o+g):(c=t*Math.pow(2,g-1)*Math.pow(2,i),o=0));i>=8;r[e+k]=c&255,k+=O,c/=256,i-=8);for(o=o<<i|c,y+=i;y>0;r[e+k]=o&255,k+=O,o/=256,y-=8);r[e+k-O]|=G*128}});var Bo=vt(nr=>{"use strict";var yi=pi(),er=cn(),fo=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;nr.Buffer=v;nr.SlowBuffer=ju;nr.INSPECT_MAX_BYTES=50;var un=2147483647;nr.kMaxLength=un;v.TYPED_ARRAY_SUPPORT=qu();!v.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function qu(){try{let r=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(r,t),r.foo()===42}catch{return!1}}Object.defineProperty(v.prototype,"parent",{enumerable:!0,get:function(){if(v.isBuffer(this))return this.buffer}});Object.defineProperty(v.prototype,"offset",{enumerable:!0,get:function(){if(v.isBuffer(this))return this.byteOffset}});function xe(r){if(r>un)throw new RangeError('The value "'+r+'" is invalid for option "size"');let t=new Uint8Array(r);return Object.setPrototypeOf(t,v.prototype),t}function v(r,t,e){if(typeof r=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return _i(r)}return wo(r,t,e)}v.poolSize=8192;function wo(r,t,e){if(typeof r=="string")return Lu(r,t);if(ArrayBuffer.isView(r))return Gu(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(le(r,ArrayBuffer)||r&&le(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(le(r,SharedArrayBuffer)||r&&le(r.buffer,SharedArrayBuffer)))return gi(r,t,e);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return v.from(n,t,e);let i=Ku(r);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return v.from(r[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}v.from=function(r,t,e){return wo(r,t,e)};Object.setPrototypeOf(v.prototype,Uint8Array.prototype);Object.setPrototypeOf(v,Uint8Array);function yo(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function Hu(r,t,e){return yo(r),r<=0?xe(r):t!==void 0?typeof e=="string"?xe(r).fill(t,e):xe(r).fill(t):xe(r)}v.alloc=function(r,t,e){return Hu(r,t,e)};function _i(r){return yo(r),xe(r<0?0:bi(r)|0)}v.allocUnsafe=function(r){return _i(r)};v.allocUnsafeSlow=function(r){return _i(r)};function Lu(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!v.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=mo(r,t)|0,n=xe(e),i=n.write(r,t);return i!==e&&(n=n.slice(0,i)),n}function mi(r){let t=r.length<0?0:bi(r.length)|0,e=xe(t);for(let n=0;n<t;n+=1)e[n]=r[n]&255;return e}function Gu(r){if(le(r,Uint8Array)){let t=new Uint8Array(r);return gi(t.buffer,t.byteOffset,t.byteLength)}return mi(r)}function gi(r,t,e){if(t<0||r.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<t+(e||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&e===void 0?n=new Uint8Array(r):e===void 0?n=new Uint8Array(r,t):n=new Uint8Array(r,t,e),Object.setPrototypeOf(n,v.prototype),n}function Ku(r){if(v.isBuffer(r)){let t=bi(r.length)|0,e=xe(t);return e.length===0||r.copy(e,0,0,t),e}if(r.length!==void 0)return typeof r.length!="number"||Ai(r.length)?xe(0):mi(r);if(r.type==="Buffer"&&Array.isArray(r.data))return mi(r.data)}function bi(r){if(r>=un)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+un.toString(16)+" bytes");return r|0}function ju(r){return+r!=r&&(r=0),v.alloc(+r)}v.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==v.prototype};v.compare=function(t,e){if(le(t,Uint8Array)&&(t=v.from(t,t.offset,t.byteLength)),le(e,Uint8Array)&&(e=v.from(e,e.offset,e.byteLength)),!v.isBuffer(t)||!v.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,i=e.length;for(let s=0,o=Math.min(n,i);s<o;++s)if(t[s]!==e[s]){n=t[s],i=e[s];break}return n<i?-1:i<n?1:0};v.isEncoding=function(t){switch(String(t).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}};v.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return v.alloc(0);let n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;let i=v.allocUnsafe(e),s=0;for(n=0;n<t.length;++n){let o=t[n];if(le(o,Uint8Array))s+o.length>i.length?(v.isBuffer(o)||(o=v.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(v.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function mo(r,t){if(v.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||le(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let e=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&e===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return xi(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return So(r).length;default:if(i)return n?-1:xi(r).length;t=(""+t).toLowerCase(),i=!0}}v.byteLength=mo;function Du(r,t,e){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(r||(r="utf8");;)switch(r){case"hex":return rf(this,t,e);case"utf8":case"utf-8":return xo(this,t,e);case"ascii":return tf(this,t,e);case"latin1":case"binary":return ef(this,t,e);case"base64":return Zu(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return nf(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}v.prototype._isBuffer=!0;function He(r,t,e){let n=r[t];r[t]=r[e],r[e]=n}v.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)He(this,e,e+1);return this};v.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)He(this,e,e+3),He(this,e+1,e+2);return this};v.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)He(this,e,e+7),He(this,e+1,e+6),He(this,e+2,e+5),He(this,e+3,e+4);return this};v.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?xo(this,0,t):Du.apply(this,arguments)};v.prototype.toLocaleString=v.prototype.toString;v.prototype.equals=function(t){if(!v.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:v.compare(this,t)===0};v.prototype.inspect=function(){let t="",e=nr.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"};fo&&(v.prototype[fo]=v.prototype.inspect);v.prototype.compare=function(t,e,n,i,s){if(le(t,Uint8Array)&&(t=v.from(t,t.offset,t.byteLength)),!v.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),e<0||n>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&e>=n)return 0;if(i>=s)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,s>>>=0,this===t)return 0;let o=s-i,c=n-e,u=Math.min(o,c),y=this.slice(i,s),w=t.slice(e,n);for(let g=0;g<u;++g)if(y[g]!==w[g]){o=y[g],c=w[g];break}return o<c?-1:c<o?1:0};function go(r,t,e,n,i){if(r.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,Ai(e)&&(e=i?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(i)return-1;e=r.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=v.from(t,n)),v.isBuffer(t))return t.length===0?-1:lo(r,t,e,n,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):lo(r,[t],e,n,i);throw new TypeError("val must be string, number or Buffer")}function lo(r,t,e,n,i){let s=1,o=r.length,c=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;s=2,o/=2,c/=2,e/=2}function u(w,g){return s===1?w[g]:w.readUInt16BE(g*s)}let y;if(i){let w=-1;for(y=e;y<o;y++)if(u(r,y)===u(t,w===-1?0:y-w)){if(w===-1&&(w=y),y-w+1===c)return w*s}else w!==-1&&(y-=y-w),w=-1}else for(e+c>o&&(e=o-c),y=e;y>=0;y--){let w=!0;for(let g=0;g<c;g++)if(u(r,y+g)!==u(t,g)){w=!1;break}if(w)return y}return-1}v.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1};v.prototype.indexOf=function(t,e,n){return go(this,t,e,n,!0)};v.prototype.lastIndexOf=function(t,e,n){return go(this,t,e,n,!1)};function Wu(r,t,e,n){e=Number(e)||0;let i=r.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;let s=t.length;n>s/2&&(n=s/2);let o;for(o=0;o<n;++o){let c=parseInt(t.substr(o*2,2),16);if(Ai(c))return o;r[e+o]=c}return o}function zu(r,t,e,n){return fn(xi(t,r.length-e),r,e,n)}function Yu(r,t,e,n){return fn(cf(t),r,e,n)}function Xu(r,t,e,n){return fn(So(t),r,e,n)}function Ju(r,t,e,n){return fn(uf(t,r.length-e),r,e,n)}v.prototype.write=function(t,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e>>>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");let s=this.length-e;if((n===void 0||n>s)&&(n=s),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return Wu(this,t,e,n);case"utf8":case"utf-8":return zu(this,t,e,n);case"ascii":case"latin1":case"binary":return Yu(this,t,e,n);case"base64":return Xu(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ju(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};v.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Zu(r,t,e){return t===0&&e===r.length?yi.fromByteArray(r):yi.fromByteArray(r.slice(t,e))}function xo(r,t,e){e=Math.min(r.length,e);let n=[],i=t;for(;i<e;){let s=r[i],o=null,c=s>239?4:s>223?3:s>191?2:1;if(i+c<=e){let u,y,w,g;switch(c){case 1:s<128&&(o=s);break;case 2:u=r[i+1],(u&192)===128&&(g=(s&31)<<6|u&63,g>127&&(o=g));break;case 3:u=r[i+1],y=r[i+2],(u&192)===128&&(y&192)===128&&(g=(s&15)<<12|(u&63)<<6|y&63,g>2047&&(g<55296||g>57343)&&(o=g));break;case 4:u=r[i+1],y=r[i+2],w=r[i+3],(u&192)===128&&(y&192)===128&&(w&192)===128&&(g=(s&15)<<18|(u&63)<<12|(y&63)<<6|w&63,g>65535&&g<1114112&&(o=g))}}o===null?(o=65533,c=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=c}return Qu(n)}var ho=4096;function Qu(r){let t=r.length;if(t<=ho)return String.fromCharCode.apply(String,r);let e="",n=0;for(;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=ho));return e}function tf(r,t,e){let n="";e=Math.min(r.length,e);for(let i=t;i<e;++i)n+=String.fromCharCode(r[i]&127);return n}function ef(r,t,e){let n="";e=Math.min(r.length,e);for(let i=t;i<e;++i)n+=String.fromCharCode(r[i]);return n}function rf(r,t,e){let n=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>n)&&(e=n);let i="";for(let s=t;s<e;++s)i+=ff[r[s]];return i}function nf(r,t,e){let n=r.slice(t,e),i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}v.prototype.slice=function(t,e){let n=this.length;t=~~t,e=e===void 0?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);let i=this.subarray(t,e);return Object.setPrototypeOf(i,v.prototype),i};function Ot(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}v.prototype.readUintLE=v.prototype.readUIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||Ot(t,e,this.length);let i=this[t],s=1,o=0;for(;++o<e&&(s*=256);)i+=this[t+o]*s;return i};v.prototype.readUintBE=v.prototype.readUIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||Ot(t,e,this.length);let i=this[t+--e],s=1;for(;e>0&&(s*=256);)i+=this[t+--e]*s;return i};v.prototype.readUint8=v.prototype.readUInt8=function(t,e){return t=t>>>0,e||Ot(t,1,this.length),this[t]};v.prototype.readUint16LE=v.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||Ot(t,2,this.length),this[t]|this[t+1]<<8};v.prototype.readUint16BE=v.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||Ot(t,2,this.length),this[t]<<8|this[t+1]};v.prototype.readUint32LE=v.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||Ot(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};v.prototype.readUint32BE=v.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||Ot(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};v.prototype.readBigUInt64LE=Se(function(t){t=t>>>0,rr(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Rr(t,this.length-8);let i=e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,s=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))});v.prototype.readBigUInt64BE=Se(function(t){t=t>>>0,rr(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Rr(t,this.length-8);let i=e*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],s=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(s)});v.prototype.readIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||Ot(t,e,this.length);let i=this[t],s=1,o=0;for(;++o<e&&(s*=256);)i+=this[t+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i};v.prototype.readIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||Ot(t,e,this.length);let i=e,s=1,o=this[t+--i];for(;i>0&&(s*=256);)o+=this[t+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*e)),o};v.prototype.readInt8=function(t,e){return t=t>>>0,e||Ot(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};v.prototype.readInt16LE=function(t,e){t=t>>>0,e||Ot(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};v.prototype.readInt16BE=function(t,e){t=t>>>0,e||Ot(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};v.prototype.readInt32LE=function(t,e){return t=t>>>0,e||Ot(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};v.prototype.readInt32BE=function(t,e){return t=t>>>0,e||Ot(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};v.prototype.readBigInt64LE=Se(function(t){t=t>>>0,rr(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Rr(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});v.prototype.readBigInt64BE=Se(function(t){t=t>>>0,rr(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Rr(t,this.length-8);let i=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n)});v.prototype.readFloatLE=function(t,e){return t=t>>>0,e||Ot(t,4,this.length),er.read(this,t,!0,23,4)};v.prototype.readFloatBE=function(t,e){return t=t>>>0,e||Ot(t,4,this.length),er.read(this,t,!1,23,4)};v.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||Ot(t,8,this.length),er.read(this,t,!0,52,8)};v.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||Ot(t,8,this.length),er.read(this,t,!1,52,8)};function Lt(r,t,e,n,i,s){if(!v.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(e+n>r.length)throw new RangeError("Index out of range")}v.prototype.writeUintLE=v.prototype.writeUIntLE=function(t,e,n,i){if(t=+t,e=e>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;Lt(this,t,e,n,c,0)}let s=1,o=0;for(this[e]=t&255;++o<n&&(s*=256);)this[e+o]=t/s&255;return e+n};v.prototype.writeUintBE=v.prototype.writeUIntBE=function(t,e,n,i){if(t=+t,e=e>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;Lt(this,t,e,n,c,0)}let s=n-1,o=1;for(this[e+s]=t&255;--s>=0&&(o*=256);)this[e+s]=t/o&255;return e+n};v.prototype.writeUint8=v.prototype.writeUInt8=function(t,e,n){return t=+t,e=e>>>0,n||Lt(this,t,e,1,255,0),this[e]=t&255,e+1};v.prototype.writeUint16LE=v.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||Lt(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};v.prototype.writeUint16BE=v.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||Lt(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};v.prototype.writeUint32LE=v.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||Lt(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4};v.prototype.writeUint32BE=v.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||Lt(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function _o(r,t,e,n,i){vo(t,n,i,r,e,7);let s=Number(t&BigInt(4294967295));r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return r[e++]=o,o=o>>8,r[e++]=o,o=o>>8,r[e++]=o,o=o>>8,r[e++]=o,e}function bo(r,t,e,n,i){vo(t,n,i,r,e,7);let s=Number(t&BigInt(4294967295));r[e+7]=s,s=s>>8,r[e+6]=s,s=s>>8,r[e+5]=s,s=s>>8,r[e+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return r[e+3]=o,o=o>>8,r[e+2]=o,o=o>>8,r[e+1]=o,o=o>>8,r[e]=o,e+8}v.prototype.writeBigUInt64LE=Se(function(t,e=0){return _o(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});v.prototype.writeBigUInt64BE=Se(function(t,e=0){return bo(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});v.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e=e>>>0,!i){let u=Math.pow(2,8*n-1);Lt(this,t,e,n,u-1,-u)}let s=0,o=1,c=0;for(this[e]=t&255;++s<n&&(o*=256);)t<0&&c===0&&this[e+s-1]!==0&&(c=1),this[e+s]=(t/o>>0)-c&255;return e+n};v.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e=e>>>0,!i){let u=Math.pow(2,8*n-1);Lt(this,t,e,n,u-1,-u)}let s=n-1,o=1,c=0;for(this[e+s]=t&255;--s>=0&&(o*=256);)t<0&&c===0&&this[e+s+1]!==0&&(c=1),this[e+s]=(t/o>>0)-c&255;return e+n};v.prototype.writeInt8=function(t,e,n){return t=+t,e=e>>>0,n||Lt(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};v.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||Lt(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};v.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||Lt(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};v.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||Lt(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4};v.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||Lt(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};v.prototype.writeBigInt64LE=Se(function(t,e=0){return _o(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});v.prototype.writeBigInt64BE=Se(function(t,e=0){return bo(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Eo(r,t,e,n,i,s){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Ao(r,t,e,n,i){return t=+t,e=e>>>0,i||Eo(r,t,e,4,34028234663852886e22,-34028234663852886e22),er.write(r,t,e,n,23,4),e+4}v.prototype.writeFloatLE=function(t,e,n){return Ao(this,t,e,!0,n)};v.prototype.writeFloatBE=function(t,e,n){return Ao(this,t,e,!1,n)};function To(r,t,e,n,i){return t=+t,e=e>>>0,i||Eo(r,t,e,8,17976931348623157e292,-17976931348623157e292),er.write(r,t,e,n,52,8),e+8}v.prototype.writeDoubleLE=function(t,e,n){return To(this,t,e,!0,n)};v.prototype.writeDoubleBE=function(t,e,n){return To(this,t,e,!1,n)};v.prototype.copy=function(t,e,n,i){if(!v.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-n&&(i=t.length-e+n);let s=i-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(e,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),e),s};v.prototype.fill=function(t,e,n,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!v.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){let o=t.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(t=o)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let s;if(typeof t=="number")for(s=e;s<n;++s)this[s]=t;else{let o=v.isBuffer(t)?t:v.from(t,i),c=o.length;if(c===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-e;++s)this[s+e]=o[s%c]}return this};var tr={};function Ei(r,t,e){tr[r]=class extends e{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}Ei("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Ei("ERR_INVALID_ARG_TYPE",function(r,t){return`The "${r}" argument must be of type number. Received type ${typeof t}`},TypeError);Ei("ERR_OUT_OF_RANGE",function(r,t,e){let n=`The value of "${r}" is out of range.`,i=e;return Number.isInteger(e)&&Math.abs(e)>2**32?i=po(String(e)):typeof e=="bigint"&&(i=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(i=po(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function po(r){let t="",e=r.length,n=r[0]==="-"?1:0;for(;e>=n+4;e-=3)t=`_${r.slice(e-3,e)}${t}`;return`${r.slice(0,e)}${t}`}function sf(r,t,e){rr(t,"offset"),(r[t]===void 0||r[t+e]===void 0)&&Rr(t,r.length-(e+1))}function vo(r,t,e,n,i,s){if(r>e||r<t){let o=typeof t=="bigint"?"n":"",c;throw s>3?t===0||t===BigInt(0)?c=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:c=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:c=`>= ${t}${o} and <= ${e}${o}`,new tr.ERR_OUT_OF_RANGE("value",c,r)}sf(n,i,s)}function rr(r,t){if(typeof r!="number")throw new tr.ERR_INVALID_ARG_TYPE(t,"number",r)}function Rr(r,t,e){throw Math.floor(r)!==r?(rr(r,e),new tr.ERR_OUT_OF_RANGE(e||"offset","an integer",r)):t<0?new tr.ERR_BUFFER_OUT_OF_BOUNDS:new tr.ERR_OUT_OF_RANGE(e||"offset",`>= ${e?1:0} and <= ${t}`,r)}var of=/[^+/0-9A-Za-z-_]/g;function af(r){if(r=r.split("=")[0],r=r.trim().replace(of,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function xi(r,t){t=t||1/0;let e,n=r.length,i=null,s=[];for(let o=0;o<n;++o){if(e=r.charCodeAt(o),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;s.push(e)}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return s}function cf(r){let t=[];for(let e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function uf(r,t){let e,n,i,s=[];for(let o=0;o<r.length&&!((t-=2)<0);++o)e=r.charCodeAt(o),n=e>>8,i=e%256,s.push(i),s.push(n);return s}function So(r){return yi.toByteArray(af(r))}function fn(r,t,e,n){let i;for(i=0;i<n&&!(i+e>=t.length||i>=r.length);++i)t[i+e]=r[i];return i}function le(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function Ai(r){return r!==r}var ff=function(){let r="0123456789abcdef",t=new Array(256);for(let e=0;e<16;++e){let n=e*16;for(let i=0;i<16;++i)t[n+i]=r[e]+r[i]}return t}();function Se(r){return typeof BigInt>"u"?lf:r}function lf(){throw new Error("BigInt not supported")}});function Io(r){let t=0,e=0,n="";function i(s){return t<0?e|=s>>-t:e=s<<t&248,t>3?(t-=8,1):(t<4&&(n+=ln[e>>3],t+=5),0)}for(let s=0;s<r.length;)s+=i(r[s]);return n+(t<0?ln[e>>3]:"")}function No(r){let t=0,e=0,n=new Uint8Array(r.length*4/3|0),i=0;function s(o){let c=ir[o.toLowerCase()];if(c===void 0)throw new Error(`Invalid character: ${JSON.stringify(o)}`);c<<=3,e|=c>>>t,t+=5,t>=8&&(n[i++]=e,t-=8,t>0?e=c<<5-t&255:e=0)}for(let o of r)s(o);return n.slice(0,i)}var ln,ir,Uo=ut(()=>{ln="abcdefghijklmnopqrstuvwxyz234567",ir=Object.create(null);for(let r=0;r<ln.length;r++)ir[ln[r]]=r;ir[0]=ir.o;ir[1]=ir.i});function Ro(r){let t=new Uint8Array(r),e=-1;for(let n=0;n<t.length;n++){let s=(t[n]^e)&255;e=hf[s]^e>>>8}return(e^-1)>>>0}var hf,Fo=ut(()=>{hf=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 df(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function vi(r,...t){if(!df(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${r.length}`)}function Si(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function Oo(r,t){vi(r);let e=t.outputLen;if(r.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var Bi=ut(()=>{});var Le,Po=ut(()=>{Le=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});function ko(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function Ii(r){return typeof r=="string"&&(r=ko(r)),vi(r),r}function Fr(r){let t=n=>r().update(Ii(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function Mo(r=32){if(Le&&typeof Le.getRandomValues=="function")return Le.getRandomValues(new Uint8Array(r));if(Le&&typeof Le.randomBytes=="function")return Le.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}var dn,ne,dd,hn,pd,Or=ut(()=>{Po();Bi();dn=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),ne=(r,t)=>r<<32-t|r>>>t,dd=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;hn=class{clone(){return this._cloneInto()}},pd={}.toString});function pf(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let i=BigInt(32),s=BigInt(4294967295),o=Number(e>>i&s),c=Number(e&s),u=n?4:0,y=n?0:4;r.setUint32(t+u,o,n),r.setUint32(t+y,c,n)}var Co,$o,sr,Ni=ut(()=>{Bi();Or();Co=(r,t,e)=>r&t^~r&e,$o=(r,t,e)=>r&t^r&e^t&e,sr=class extends hn{constructor(t,e,n,i){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=dn(this.buffer)}update(t){Si(this);let{view:e,buffer:n,blockLen:i}=this;t=Ii(t);let s=t.length;for(let o=0;o<s;){let c=Math.min(i-this.pos,s-o);if(c===i){let u=dn(t);for(;i<=s-o;o+=i)this.process(u,o);continue}n.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===i&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Si(this),Oo(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:i,isLE:s}=this,{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(n,0),o=0);for(let g=o;g<i;g++)e[g]=0;pf(n,i-8,BigInt(this.length*8),s),this.process(n,0);let c=dn(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let y=u/4,w=this.get();if(y>w.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g<y;g++)c.setUint32(4*g,w[g],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:i,finished:s,destroyed:o,pos:c}=this;return t.length=i,t.pos=c,t.finished=s,t.destroyed=o,i%e&&t.buffer.set(n),t}}});var wf,Be,Ie,pn,Ui,Vo,qo,Ri=ut(()=>{Ni();Or();wf=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]),Be=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ie=new Uint32Array(64),pn=class extends sr{constructor(){super(64,32,8,!1),this.A=Be[0]|0,this.B=Be[1]|0,this.C=Be[2]|0,this.D=Be[3]|0,this.E=Be[4]|0,this.F=Be[5]|0,this.G=Be[6]|0,this.H=Be[7]|0}get(){let{A:t,B:e,C:n,D:i,E:s,F:o,G:c,H:u}=this;return[t,e,n,i,s,o,c,u]}set(t,e,n,i,s,o,c,u){this.A=t|0,this.B=e|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=u|0}process(t,e){for(let g=0;g<16;g++,e+=4)Ie[g]=t.getUint32(e,!1);for(let g=16;g<64;g++){let N=Ie[g-15],k=Ie[g-2],O=ne(N,7)^ne(N,18)^N>>>3,G=ne(k,17)^ne(k,19)^k>>>10;Ie[g]=G+Ie[g-7]+O+Ie[g-16]|0}let{A:n,B:i,C:s,D:o,E:c,F:u,G:y,H:w}=this;for(let g=0;g<64;g++){let N=ne(c,6)^ne(c,11)^ne(c,25),k=w+N+Co(c,u,y)+wf[g]+Ie[g]|0,G=(ne(n,2)^ne(n,13)^ne(n,22))+$o(n,i,s)|0;w=y,y=u,u=c,c=o+k|0,o=s,s=i,i=n,n=k+G|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,u=u+this.F|0,y=y+this.G|0,w=w+this.H|0,this.set(n,i,s,o,c,u,y,w)}roundClean(){Ie.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Ui=class extends pn{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}},Vo=Fr(()=>new pn),qo=Fr(()=>new Ui)});function Ho(r){return qo.create().update(new Uint8Array(r)).digest()}var Lo=ut(()=>{Ri()});var wn,yf,Go,mf,gf,xf,St,ee=ut(()=>{Uo();Fo();Lo();wn="__principal__",yf=2,Go=4,mf="aaaaa-aa",gf=r=>{var t;return new Uint8Array(((t=r.match(/.{1,2}/g))!==null&&t!==void 0?t:[]).map(e=>parseInt(e,16)))},xf=r=>r.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),""),St=class r{constructor(t){this._arr=t,this._isPrincipal=!0}static anonymous(){return new this(new Uint8Array([Go]))}static managementCanister(){return this.fromHex(mf)}static selfAuthenticating(t){let e=Ho(t);return new this(new Uint8Array([...e,yf]))}static from(t){if(typeof t=="string")return r.fromText(t);if(Object.getPrototypeOf(t)===Uint8Array.prototype)return new r(t);if(typeof t=="object"&&t!==null&&t._isPrincipal===!0)return new r(t._arr);throw new Error(`Impossible to convert ${JSON.stringify(t)} to Principal.`)}static fromHex(t){return new this(gf(t))}static fromText(t){let e=t;if(t.includes(wn)){let o=JSON.parse(t);wn in o&&(e=o[wn])}let n=e.toLowerCase().replace(/-/g,""),i=No(n);i=i.slice(4,i.length);let s=new this(i);if(s.toText()!==e)throw new Error(`Principal "${s.toText()}" does not have a valid checksum (original value "${e}" may not be a valid Principal ID).`);return s}static fromUint8Array(t){return new this(t)}isAnonymous(){return this._arr.byteLength===1&&this._arr[0]===Go}toUint8Array(){return this._arr}toHex(){return xf(this._arr).toUpperCase()}toText(){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,Ro(this._arr));let n=new Uint8Array(t),i=Uint8Array.from(this._arr),s=new Uint8Array([...n,...i]),c=Io(s).match(/.{1,5}/g);if(!c)throw new Error;return c.join("-")}toString(){return this.toText()}toJSON(){return{[wn]:this.toText()}}compareTo(t){for(let e=0;e<Math.min(this._arr.length,t._arr.length);e++){if(this._arr[e]<t._arr[e])return"lt";if(this._arr[e]>t._arr[e])return"gt"}return this._arr.length<t._arr.length?"lt":this._arr.length>t._arr.length?"gt":"eq"}ltEq(t){let e=this.compareTo(t);return e=="lt"||e=="eq"}gtEq(t){let e=this.compareTo(t);return e=="gt"||e=="eq"}}});var Dt,or=ut(()=>{Dt=class r extends Error{constructor(t){super(t),this.message=t,Object.setPrototypeOf(this,r.prototype)}}});function Oi(...r){let t=new Uint8Array(r.reduce((n,i)=>n+i.byteLength,0)),e=0;for(let n of r)t.set(new Uint8Array(n),e),e+=n.byteLength;return t}function Fi(r){return new DataView(r.buffer,r.byteOffset,r.byteLength).buffer}function Pr(r){return r instanceof Uint8Array?Fi(r):r instanceof ArrayBuffer?r:Array.isArray(r)?Fi(new Uint8Array(r)):"buffer"in r?Pr(r.buffer):Fi(new Uint8Array(r))}var Ne,yn=ut(()=>{Ne=class{constructor(t,e=t?.byteLength||0){this._buffer=Pr(t||new ArrayBuffer(0)),this._view=new Uint8Array(this._buffer,0,e)}get buffer(){return Pr(this._view.slice())}get byteLength(){return this._view.byteLength}read(t){let e=this._view.subarray(0,t);return this._view=this._view.subarray(t),e.slice().buffer}readUint8(){let t=this._view[0];return this._view=this._view.subarray(1),t}write(t){let e=new Uint8Array(t),n=this._view.byteLength;this._view.byteOffset+this._view.byteLength+e.byteLength>=this._buffer.byteLength?this.alloc(e.byteLength):this._view=new Uint8Array(this._buffer,this._view.byteOffset,this._view.byteLength+e.byteLength),this._view.set(e,n)}get end(){return this._view.byteLength===0}alloc(t){let e=new ArrayBuffer((this._buffer.byteLength+t)*1.2|0),n=new Uint8Array(e,0,this._view.byteLength+t);n.set(this._view),this._buffer=e,this._view=n}}});var Pi=ut(()=>{});function Ko(){throw new Error("unexpected end of buffer")}function kr(r,t){return r.byteLength<t&&Ko(),r.read(t)}function ar(r){let t=r.readUint8();return t===void 0&&Ko(),t}function Ue(r){if(typeof r=="number"&&(r=BigInt(r)),r<BigInt(0))throw new Error("Cannot leb encode negative values.");let t=(r===BigInt(0)?0:Math.ceil(Math.log2(Number(r))))+1,e=new Ne(new ArrayBuffer(t),0);for(;;){let n=Number(r&BigInt(127));if(r/=BigInt(128),r===BigInt(0)){e.write(new Uint8Array([n]));break}else e.write(new Uint8Array([n|128]))}return e.buffer}function cr(r){let t=BigInt(1),e=BigInt(0),n;do n=ar(r),e+=BigInt(n&127).valueOf()*t,t*=BigInt(128);while(n>=128);return e}function Wt(r){typeof r=="number"&&(r=BigInt(r));let t=r<BigInt(0);t&&(r=-r-BigInt(1));let e=(r===BigInt(0)?0:Math.ceil(Math.log2(Number(r))))+1,n=new Ne(new ArrayBuffer(e),0);for(;;){let s=i(r);if(r/=BigInt(128),t&&r===BigInt(0)&&s&64||!t&&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(t?BigInt(128)-o-BigInt(1):o)}return n.buffer}function jo(r){let t=new Uint8Array(r.buffer),e=0;for(;e<t.byteLength;e++)if(t[e]<128){if(!(t[e]&64))return cr(r);break}let n=new Uint8Array(kr(r,e+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 Do(r,t){if(BigInt(r)<BigInt(0))throw new Error("Cannot write negative values.");return ki(r,t)}function ki(r,t){r=BigInt(r);let e=new Ne(new ArrayBuffer(Math.min(1,t)),0),n=0,i=BigInt(256),s=BigInt(0),o=Number(r%i);for(e.write(new Uint8Array([o]));++n<t;)r<0&&s===BigInt(0)&&o!==0&&(s=BigInt(1)),o=Number((r/i-s)%BigInt(256)),e.write(new Uint8Array([o])),i*=BigInt(256);return e.buffer}function Mi(r,t){let e=BigInt(ar(r)),n=BigInt(1),i=0;for(;++i<t;){n*=BigInt(256);let s=BigInt(ar(r));e=e+n*s}return e}function Wo(r,t){let e=Mi(r,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return e>=n&&(e-=n*BigInt(2)),e}var Ci=ut(()=>{yn()});function mn(r){let t=BigInt(r);if(r<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}var zo=ut(()=>{});function _f(r){if(ar(r)!==1)throw new Error("Cannot decode principal");let e=Number(cr(r));return St.fromUint8Array(new Uint8Array(kr(r,e)))}function Yt(r){let t=JSON.stringify(r,(e,n)=>typeof n=="bigint"?`BigInt(${n})`:n);return t&&t.length>Yo?t.substring(0,Yo-3)+"...":t}var Yo,Mr,zt,$i,Vi,qi,Hi,Li,Gi,Ki,ji,Di,gn,ur,fr,Cr,Wi,qd,Hd,Ld,Gd,Kd,jd,Dd,Wd,zd,Yd,Xd,Jd,Zd,Qd,tp,ep,rp,np,ip,Yi=ut(()=>{ee();yn();Pi();Ci();zo();Yo=400,Mr=class{display(){return this.name}valueToString(t){return Yt(t)}buildTypeTable(t){t.has(this)||this._buildTypeTableImpl(t)}},zt=class extends Mr{checkType(t){if(this.name!==t.name)throw new Error(`type mismatch: type on the wire ${t.name}, expect type ${this.name}`);return t}_buildTypeTableImpl(t){}},$i=class extends Mr{checkType(t){if(t instanceof Cr){let e=t.getType();if(typeof e>"u")throw new Error("type mismatch with uninitialized type");return e}throw new Error(`type mismatch: type on the wire ${t.name}, expect type ${this.name}`)}encodeType(t){return t.indexOf(this.name)}},Vi=class extends zt{accept(t,e){return t.visitEmpty(this,e)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${Yt(t)}`)}encodeValue(){throw new Error("Empty cannot appear as a function argument")}valueToString(){throw new Error("Empty cannot appear as a value")}encodeType(){return Wt(-17)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}},qi=class extends Mr{checkType(t){throw new Error("Method not implemented for unknown.")}accept(t,e){throw t.visitType(this,e)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${Yt(t)}`)}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(t,e){let n=e.decodeValue(t,e);Object(n)!==n&&(n=Object(n));let i;return e instanceof Cr?i=()=>e.getType():i=()=>e,Object.defineProperty(n,"type",{value:i,writable:!0,enumerable:!1,configurable:!0}),n}_buildTypeTableImpl(){throw new Error("Unknown cannot be serialized")}get name(){return"Unknown"}},Hi=class extends zt{accept(t,e){return t.visitBool(this,e)}covariant(t){if(typeof t=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${Yt(t)}`)}encodeValue(t){return new Uint8Array([t?1:0])}encodeType(){return Wt(-2)}decodeValue(t,e){switch(this.checkType(e),ar(t)){case 0:return!1;case 1:return!0;default:throw new Error("Boolean value out of range")}}get name(){return"bool"}},Li=class extends zt{accept(t,e){return t.visitNull(this,e)}covariant(t){if(t===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${Yt(t)}`)}encodeValue(){return new ArrayBuffer(0)}encodeType(){return Wt(-1)}decodeValue(t,e){return this.checkType(e),null}get name(){return"null"}},Gi=class extends zt{accept(t,e){return t.visitReserved(this,e)}covariant(t){return!0}encodeValue(){return new ArrayBuffer(0)}encodeType(){return Wt(-16)}decodeValue(t,e){return e.name!==this.name&&e.decodeValue(t,e),null}get name(){return"reserved"}},Ki=class extends zt{accept(t,e){return t.visitText(this,e)}covariant(t){if(typeof t=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${Yt(t)}`)}encodeValue(t){let e=new TextEncoder().encode(t),n=Ue(e.byteLength);return Oi(n,e)}encodeType(){return Wt(-15)}decodeValue(t,e){this.checkType(e);let n=cr(t),i=kr(t,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(i)}get name(){return"text"}valueToString(t){return'"'+t+'"'}},ji=class extends zt{accept(t,e){return t.visitInt(this,e)}covariant(t){if(typeof t=="bigint"||Number.isInteger(t))return!0;throw new Error(`Invalid ${this.display()} argument: ${Yt(t)}`)}encodeValue(t){return Wt(t)}encodeType(){return Wt(-4)}decodeValue(t,e){return this.checkType(e),jo(t)}get name(){return"int"}valueToString(t){return t.toString()}},Di=class extends zt{accept(t,e){return t.visitNat(this,e)}covariant(t){if(typeof t=="bigint"&&t>=BigInt(0)||Number.isInteger(t)&&t>=0)return!0;throw new Error(`Invalid ${this.display()} argument: ${Yt(t)}`)}encodeValue(t){return Ue(t)}encodeType(){return Wt(-3)}decodeValue(t,e){return this.checkType(e),cr(t)}get name(){return"nat"}valueToString(t){return t.toString()}},gn=class extends zt{constructor(t){if(super(),this._bits=t,t!==32&&t!==64)throw new Error("not a valid float type")}accept(t,e){return t.visitFloat(this,e)}covariant(t){if(typeof t=="number"||t instanceof Number)return!0;throw new Error(`Invalid ${this.display()} argument: ${Yt(t)}`)}encodeValue(t){let e=new ArrayBuffer(this._bits/8),n=new DataView(e);return this._bits===32?n.setFloat32(0,t,!0):n.setFloat64(0,t,!0),e}encodeType(){let t=this._bits===32?-13:-14;return Wt(t)}decodeValue(t,e){this.checkType(e);let n=kr(t,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(t){return t.toString()}},ur=class extends zt{constructor(t){super(),this._bits=t}accept(t,e){return t.visitFixedInt(this,e)}covariant(t){let e=mn(this._bits-1)*BigInt(-1),n=mn(this._bits-1)-BigInt(1),i=!1;if(typeof t=="bigint")i=t>=e&&t<=n;else if(Number.isInteger(t)){let s=BigInt(t);i=s>=e&&s<=n}else i=!1;if(i)return!0;throw new Error(`Invalid ${this.display()} argument: ${Yt(t)}`)}encodeValue(t){return ki(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return Wt(-9-t)}decodeValue(t,e){this.checkType(e);let n=Wo(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(t){return t.toString()}},fr=class extends zt{constructor(t){super(),this._bits=t}accept(t,e){return t.visitFixedNat(this,e)}covariant(t){let e=mn(this._bits),n=!1;if(typeof t=="bigint"&&t>=BigInt(0)?n=t<e:Number.isInteger(t)&&t>=0?n=BigInt(t)<e:n=!1,n)return!0;throw new Error(`Invalid ${this.display()} argument: ${Yt(t)}`)}encodeValue(t){return Do(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return Wt(-5-t)}decodeValue(t,e){this.checkType(e);let n=Mi(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(t){return t.toString()}},Cr=class r extends $i{constructor(){super(...arguments),this._id=r._counter++,this._type=void 0}accept(t,e){if(!this._type)throw Error("Recursive type uninitialized.");return t.visitRec(this,this._type,e)}fill(t){this._type=t}getType(){return this._type}covariant(t){if(this._type&&this._type.covariant(t))return!0;throw new Error(`Invalid ${this.display()} argument: ${Yt(t)}`)}encodeValue(t){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.encodeValue(t)}_buildTypeTableImpl(t){if(!this._type)throw Error("Recursive type uninitialized.");t.add(this,new Uint8Array([])),this._type.buildTypeTable(t),t.merge(this,this._type.name)}decodeValue(t,e){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.decodeValue(t,e)}get name(){return`rec_${this._id}`}display(){if(!this._type)throw Error("Recursive type uninitialized.");return`\u03BC${this.name}.${this._type.name}`}valueToString(t){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.valueToString(t)}};Cr._counter=0;Wi=class extends zt{accept(t,e){return t.visitPrincipal(this,e)}covariant(t){if(t&&t._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${Yt(t)}`)}encodeValue(t){let e=t.toUint8Array(),n=Ue(e.byteLength);return Oi(new Uint8Array([1]),n,e)}encodeType(){return Wt(-24)}decodeValue(t,e){return this.checkType(e),_f(t)}get name(){return"principal"}valueToString(t){return`${this.name} "${t.toText()}"`}};qd=new Vi,Hd=new Gi,Ld=new qi,Gd=new Hi,Kd=new Li,jd=new Ki,Dd=new ji,Wd=new Di,zd=new gn(32),Yd=new gn(64),Xd=new ur(8),Jd=new ur(16),Zd=new ur(32),Qd=new ur(64),tp=new fr(8),ep=new fr(16),rp=new fr(32),np=new fr(64),ip=new Wi});var Xi=ut(()=>{});var Xo=ut(()=>{Yi();ee();Xi()});var Jo=ut(()=>{});var lr=ut(()=>{Xo();Xi();Yi();Pi();Ci();yn();Jo()});var $r=vt(dr=>{"use strict";var Ji=pi(),hr=cn(),Zo=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;dr.Buffer=S;dr.SlowBuffer=Bf;dr.INSPECT_MAX_BYTES=50;var xn=2147483647;dr.kMaxLength=xn;S.TYPED_ARRAY_SUPPORT=Ef();!S.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Ef(){try{var r=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(r,t),r.foo()===42}catch{return!1}}Object.defineProperty(S.prototype,"parent",{enumerable:!0,get:function(){if(S.isBuffer(this))return this.buffer}});Object.defineProperty(S.prototype,"offset",{enumerable:!0,get:function(){if(S.isBuffer(this))return this.byteOffset}});function _e(r){if(r>xn)throw new RangeError('The value "'+r+'" is invalid for option "size"');var t=new Uint8Array(r);return Object.setPrototypeOf(t,S.prototype),t}function S(r,t,e){if(typeof r=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return es(r)}return ea(r,t,e)}S.poolSize=8192;function ea(r,t,e){if(typeof r=="string")return Tf(r,t);if(ArrayBuffer.isView(r))return vf(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(he(r,ArrayBuffer)||r&&he(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(he(r,SharedArrayBuffer)||r&&he(r.buffer,SharedArrayBuffer)))return Qi(r,t,e);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return S.from(n,t,e);var i=Sf(r);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return S.from(r[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}S.from=function(r,t,e){return ea(r,t,e)};Object.setPrototypeOf(S.prototype,Uint8Array.prototype);Object.setPrototypeOf(S,Uint8Array);function ra(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function Af(r,t,e){return ra(r),r<=0?_e(r):t!==void 0?typeof e=="string"?_e(r).fill(t,e):_e(r).fill(t):_e(r)}S.alloc=function(r,t,e){return Af(r,t,e)};function es(r){return ra(r),_e(r<0?0:rs(r)|0)}S.allocUnsafe=function(r){return es(r)};S.allocUnsafeSlow=function(r){return es(r)};function Tf(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!S.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var e=na(r,t)|0,n=_e(e),i=n.write(r,t);return i!==e&&(n=n.slice(0,i)),n}function Zi(r){for(var t=r.length<0?0:rs(r.length)|0,e=_e(t),n=0;n<t;n+=1)e[n]=r[n]&255;return e}function vf(r){if(he(r,Uint8Array)){var t=new Uint8Array(r);return Qi(t.buffer,t.byteOffset,t.byteLength)}return Zi(r)}function Qi(r,t,e){if(t<0||r.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<t+(e||0))throw new RangeError('"length" is outside of buffer bounds');var n;return t===void 0&&e===void 0?n=new Uint8Array(r):e===void 0?n=new Uint8Array(r,t):n=new Uint8Array(r,t,e),Object.setPrototypeOf(n,S.prototype),n}function Sf(r){if(S.isBuffer(r)){var t=rs(r.length)|0,e=_e(t);return e.length===0||r.copy(e,0,0,t),e}if(r.length!==void 0)return typeof r.length!="number"||ns(r.length)?_e(0):Zi(r);if(r.type==="Buffer"&&Array.isArray(r.data))return Zi(r.data)}function rs(r){if(r>=xn)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+xn.toString(16)+" bytes");return r|0}function Bf(r){return+r!=r&&(r=0),S.alloc(+r)}S.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==S.prototype};S.compare=function(t,e){if(he(t,Uint8Array)&&(t=S.from(t,t.offset,t.byteLength)),he(e,Uint8Array)&&(e=S.from(e,e.offset,e.byteLength)),!S.isBuffer(t)||!S.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var n=t.length,i=e.length,s=0,o=Math.min(n,i);s<o;++s)if(t[s]!==e[s]){n=t[s],i=e[s];break}return n<i?-1:i<n?1:0};S.isEncoding=function(t){switch(String(t).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}};S.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return S.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var i=S.allocUnsafe(e),s=0;for(n=0;n<t.length;++n){var o=t[n];if(he(o,Uint8Array))s+o.length>i.length?S.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if(S.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function na(r,t){if(S.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||he(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);var e=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&e===0)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return ts(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return ua(r).length;default:if(i)return n?-1:ts(r).length;t=(""+t).toLowerCase(),i=!0}}S.byteLength=na;function If(r,t,e){var n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(r||(r="utf8");;)switch(r){case"hex":return $f(this,t,e);case"utf8":case"utf-8":return sa(this,t,e);case"ascii":return Mf(this,t,e);case"latin1":case"binary":return Cf(this,t,e);case"base64":return Pf(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Vf(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}S.prototype._isBuffer=!0;function Ge(r,t,e){var n=r[t];r[t]=r[e],r[e]=n}S.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)Ge(this,e,e+1);return this};S.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)Ge(this,e,e+3),Ge(this,e+1,e+2);return this};S.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)Ge(this,e,e+7),Ge(this,e+1,e+6),Ge(this,e+2,e+5),Ge(this,e+3,e+4);return this};S.prototype.toString=function(){var t=this.length;return t===0?"":arguments.length===0?sa(this,0,t):If.apply(this,arguments)};S.prototype.toLocaleString=S.prototype.toString;S.prototype.equals=function(t){if(!S.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:S.compare(this,t)===0};S.prototype.inspect=function(){var t="",e=dr.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"};Zo&&(S.prototype[Zo]=S.prototype.inspect);S.prototype.compare=function(t,e,n,i,s){if(he(t,Uint8Array)&&(t=S.from(t,t.offset,t.byteLength)),!S.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),e<0||n>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&e>=n)return 0;if(i>=s)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var o=s-i,c=n-e,u=Math.min(o,c),y=this.slice(i,s),w=t.slice(e,n),g=0;g<u;++g)if(y[g]!==w[g]){o=y[g],c=w[g];break}return o<c?-1:c<o?1:0};function ia(r,t,e,n,i){if(r.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,ns(e)&&(e=i?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(i)return-1;e=r.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=S.from(t,n)),S.isBuffer(t))return t.length===0?-1:Qo(r,t,e,n,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):Qo(r,[t],e,n,i);throw new TypeError("val must be string, number or Buffer")}function Qo(r,t,e,n,i){var s=1,o=r.length,c=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;s=2,o/=2,c/=2,e/=2}function u(k,O){return s===1?k[O]:k.readUInt16BE(O*s)}var y;if(i){var w=-1;for(y=e;y<o;y++)if(u(r,y)===u(t,w===-1?0:y-w)){if(w===-1&&(w=y),y-w+1===c)return w*s}else w!==-1&&(y-=y-w),w=-1}else for(e+c>o&&(e=o-c),y=e;y>=0;y--){for(var g=!0,N=0;N<c;N++)if(u(r,y+N)!==u(t,N)){g=!1;break}if(g)return y}return-1}S.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1};S.prototype.indexOf=function(t,e,n){return ia(this,t,e,n,!0)};S.prototype.lastIndexOf=function(t,e,n){return ia(this,t,e,n,!1)};function Nf(r,t,e,n){e=Number(e)||0;var i=r.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;var s=t.length;n>s/2&&(n=s/2);for(var o=0;o<n;++o){var c=parseInt(t.substr(o*2,2),16);if(ns(c))return o;r[e+o]=c}return o}function Uf(r,t,e,n){return _n(ts(t,r.length-e),r,e,n)}function Rf(r,t,e,n){return _n(Lf(t),r,e,n)}function Ff(r,t,e,n){return _n(ua(t),r,e,n)}function Of(r,t,e,n){return _n(Gf(t,r.length-e),r,e,n)}S.prototype.write=function(t,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e>>>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-e;if((n===void 0||n>s)&&(n=s),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return Nf(this,t,e,n);case"utf8":case"utf-8":return Uf(this,t,e,n);case"ascii":case"latin1":case"binary":return Rf(this,t,e,n);case"base64":return Ff(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Of(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};S.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Pf(r,t,e){return t===0&&e===r.length?Ji.fromByteArray(r):Ji.fromByteArray(r.slice(t,e))}function sa(r,t,e){e=Math.min(r.length,e);for(var n=[],i=t;i<e;){var s=r[i],o=null,c=s>239?4:s>223?3:s>191?2:1;if(i+c<=e){var u,y,w,g;switch(c){case 1:s<128&&(o=s);break;case 2:u=r[i+1],(u&192)===128&&(g=(s&31)<<6|u&63,g>127&&(o=g));break;case 3:u=r[i+1],y=r[i+2],(u&192)===128&&(y&192)===128&&(g=(s&15)<<12|(u&63)<<6|y&63,g>2047&&(g<55296||g>57343)&&(o=g));break;case 4:u=r[i+1],y=r[i+2],w=r[i+3],(u&192)===128&&(y&192)===128&&(w&192)===128&&(g=(s&15)<<18|(u&63)<<12|(y&63)<<6|w&63,g>65535&&g<1114112&&(o=g))}}o===null?(o=65533,c=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=c}return kf(n)}var ta=4096;function kf(r){var t=r.length;if(t<=ta)return String.fromCharCode.apply(String,r);for(var e="",n=0;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=ta));return e}function Mf(r,t,e){var n="";e=Math.min(r.length,e);for(var i=t;i<e;++i)n+=String.fromCharCode(r[i]&127);return n}function Cf(r,t,e){var n="";e=Math.min(r.length,e);for(var i=t;i<e;++i)n+=String.fromCharCode(r[i]);return n}function $f(r,t,e){var n=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>n)&&(e=n);for(var i="",s=t;s<e;++s)i+=Kf[r[s]];return i}function Vf(r,t,e){for(var n=r.slice(t,e),i="",s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}S.prototype.slice=function(t,e){var n=this.length;t=~~t,e=e===void 0?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);var i=this.subarray(t,e);return Object.setPrototypeOf(i,S.prototype),i};function Pt(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}S.prototype.readUintLE=S.prototype.readUIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||Pt(t,e,this.length);for(var i=this[t],s=1,o=0;++o<e&&(s*=256);)i+=this[t+o]*s;return i};S.prototype.readUintBE=S.prototype.readUIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||Pt(t,e,this.length);for(var i=this[t+--e],s=1;e>0&&(s*=256);)i+=this[t+--e]*s;return i};S.prototype.readUint8=S.prototype.readUInt8=function(t,e){return t=t>>>0,e||Pt(t,1,this.length),this[t]};S.prototype.readUint16LE=S.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||Pt(t,2,this.length),this[t]|this[t+1]<<8};S.prototype.readUint16BE=S.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||Pt(t,2,this.length),this[t]<<8|this[t+1]};S.prototype.readUint32LE=S.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||Pt(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};S.prototype.readUint32BE=S.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||Pt(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};S.prototype.readIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||Pt(t,e,this.length);for(var i=this[t],s=1,o=0;++o<e&&(s*=256);)i+=this[t+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i};S.prototype.readIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||Pt(t,e,this.length);for(var i=e,s=1,o=this[t+--i];i>0&&(s*=256);)o+=this[t+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*e)),o};S.prototype.readInt8=function(t,e){return t=t>>>0,e||Pt(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};S.prototype.readInt16LE=function(t,e){t=t>>>0,e||Pt(t,2,this.length);var n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};S.prototype.readInt16BE=function(t,e){t=t>>>0,e||Pt(t,2,this.length);var n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};S.prototype.readInt32LE=function(t,e){return t=t>>>0,e||Pt(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};S.prototype.readInt32BE=function(t,e){return t=t>>>0,e||Pt(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};S.prototype.readFloatLE=function(t,e){return t=t>>>0,e||Pt(t,4,this.length),hr.read(this,t,!0,23,4)};S.prototype.readFloatBE=function(t,e){return t=t>>>0,e||Pt(t,4,this.length),hr.read(this,t,!1,23,4)};S.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||Pt(t,8,this.length),hr.read(this,t,!0,52,8)};S.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||Pt(t,8,this.length),hr.read(this,t,!1,52,8)};function Gt(r,t,e,n,i,s){if(!S.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(e+n>r.length)throw new RangeError("Index out of range")}S.prototype.writeUintLE=S.prototype.writeUIntLE=function(t,e,n,i){if(t=+t,e=e>>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Gt(this,t,e,n,s,0)}var o=1,c=0;for(this[e]=t&255;++c<n&&(o*=256);)this[e+c]=t/o&255;return e+n};S.prototype.writeUintBE=S.prototype.writeUIntBE=function(t,e,n,i){if(t=+t,e=e>>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;Gt(this,t,e,n,s,0)}var o=n-1,c=1;for(this[e+o]=t&255;--o>=0&&(c*=256);)this[e+o]=t/c&255;return e+n};S.prototype.writeUint8=S.prototype.writeUInt8=function(t,e,n){return t=+t,e=e>>>0,n||Gt(this,t,e,1,255,0),this[e]=t&255,e+1};S.prototype.writeUint16LE=S.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||Gt(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};S.prototype.writeUint16BE=S.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||Gt(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};S.prototype.writeUint32LE=S.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||Gt(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4};S.prototype.writeUint32BE=S.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||Gt(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};S.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e=e>>>0,!i){var s=Math.pow(2,8*n-1);Gt(this,t,e,n,s-1,-s)}var o=0,c=1,u=0;for(this[e]=t&255;++o<n&&(c*=256);)t<0&&u===0&&this[e+o-1]!==0&&(u=1),this[e+o]=(t/c>>0)-u&255;return e+n};S.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e=e>>>0,!i){var s=Math.pow(2,8*n-1);Gt(this,t,e,n,s-1,-s)}var o=n-1,c=1,u=0;for(this[e+o]=t&255;--o>=0&&(c*=256);)t<0&&u===0&&this[e+o+1]!==0&&(u=1),this[e+o]=(t/c>>0)-u&255;return e+n};S.prototype.writeInt8=function(t,e,n){return t=+t,e=e>>>0,n||Gt(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};S.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||Gt(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};S.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||Gt(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};S.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||Gt(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4};S.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||Gt(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function oa(r,t,e,n,i,s){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function aa(r,t,e,n,i){return t=+t,e=e>>>0,i||oa(r,t,e,4,34028234663852886e22,-34028234663852886e22),hr.write(r,t,e,n,23,4),e+4}S.prototype.writeFloatLE=function(t,e,n){return aa(this,t,e,!0,n)};S.prototype.writeFloatBE=function(t,e,n){return aa(this,t,e,!1,n)};function ca(r,t,e,n,i){return t=+t,e=e>>>0,i||oa(r,t,e,8,17976931348623157e292,-17976931348623157e292),hr.write(r,t,e,n,52,8),e+8}S.prototype.writeDoubleLE=function(t,e,n){return ca(this,t,e,!0,n)};S.prototype.writeDoubleBE=function(t,e,n){return ca(this,t,e,!1,n)};S.prototype.copy=function(t,e,n,i){if(!S.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-n&&(i=t.length-e+n);var s=i-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(e,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),e),s};S.prototype.fill=function(t,e,n,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!S.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){var s=t.charCodeAt(0);(i==="utf8"&&s<128||i==="latin1")&&(t=s)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);var o;if(typeof t=="number")for(o=e;o<n;++o)this[o]=t;else{var c=S.isBuffer(t)?t:S.from(t,i),u=c.length;if(u===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<n-e;++o)this[o+e]=c[o%u]}return this};var qf=/[^+/0-9A-Za-z-_]/g;function Hf(r){if(r=r.split("=")[0],r=r.trim().replace(qf,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function ts(r,t){t=t||1/0;for(var e,n=r.length,i=null,s=[],o=0;o<n;++o){if(e=r.charCodeAt(o),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;s.push(e)}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return s}function Lf(r){for(var t=[],e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function Gf(r,t){for(var e,n,i,s=[],o=0;o<r.length&&!((t-=2)<0);++o)e=r.charCodeAt(o),n=e>>8,i=e%256,s.push(i),s.push(n);return s}function ua(r){return Ji.toByteArray(Hf(r))}function _n(r,t,e,n){for(var i=0;i<n&&!(i+e>=t.length||i>=r.length);++i)t[i+e]=r[i];return i}function he(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function ns(r){return r!==r}var Kf=function(){for(var r="0123456789abcdef",t=new Array(256),e=0;e<16;++e)for(var n=e*16,i=0;i<16;++i)t[n+i]=r[e]+r[i];return t}()});var Vr=vt((fa,bn)=>{(function(r){"use strict";var t,e=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",c=1e14,u=14,y=9007199254740991,w=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,N=1e9;function k(V){var q,rt,J,U=B.prototype={constructor:B,toString:null,valueOf:null},st=new B(1),tt=20,it=4,yt=-7,It=21,Ct=-1e7,L=1e7,R=!1,P=1,K=0,z={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},W="0123456789abcdefghijklmnopqrstuvwxyz",nt=!0;function B(a,f){var l,b,m,_,T,d,x,A,E=this;if(!(E instanceof B))return new B(a,f);if(f==null){if(a&&a._isBigNumber===!0){E.s=a.s,!a.c||a.e>L?E.c=E.e=null:a.e<Ct?E.c=[E.e=0]:(E.e=a.e,E.c=a.c.slice());return}if((d=typeof a=="number")&&a*0==0){if(E.s=1/a<0?(a=-a,-1):1,a===~~a){for(_=0,T=a;T>=10;T/=10,_++);_>L?E.c=E.e=null:(E.e=_,E.c=[a]);return}A=String(a)}else{if(!e.test(A=String(a)))return J(E,A,d);E.s=A.charCodeAt(0)==45?(A=A.slice(1),-1):1}(_=A.indexOf("."))>-1&&(A=A.replace(".","")),(T=A.search(/e/i))>0?(_<0&&(_=T),_+=+A.slice(T+1),A=A.substring(0,T)):_<0&&(_=A.length)}else{if(D(f,2,W.length,"Base"),f==10&&nt)return E=new B(a),ct(E,tt+E.e+1,it);if(A=String(a),d=typeof a=="number"){if(a*0!=0)return J(E,A,d,f);if(E.s=1/a<0?(A=A.slice(1),-1):1,B.DEBUG&&A.replace(/^0\.0*|\./,"").length>15)throw Error(o+a)}else E.s=A.charCodeAt(0)===45?(A=A.slice(1),-1):1;for(l=W.slice(0,f),_=T=0,x=A.length;T<x;T++)if(l.indexOf(b=A.charAt(T))<0){if(b=="."){if(T>_){_=x;continue}}else if(!m&&(A==A.toUpperCase()&&(A=A.toLowerCase())||A==A.toLowerCase()&&(A=A.toUpperCase()))){m=!0,T=-1,_=0;continue}return J(E,String(a),d,f)}d=!1,A=rt(A,f,10,E.s),(_=A.indexOf("."))>-1?A=A.replace(".",""):_=A.length}for(T=0;A.charCodeAt(T)===48;T++);for(x=A.length;A.charCodeAt(--x)===48;);if(A=A.slice(T,++x)){if(x-=T,d&&B.DEBUG&&x>15&&(a>y||a!==i(a)))throw Error(o+E.s*a);if((_=_-T-1)>L)E.c=E.e=null;else if(_<Ct)E.c=[E.e=0];else{if(E.e=_,E.c=[],T=(_+1)%u,_<0&&(T+=u),T<x){for(T&&E.c.push(+A.slice(0,T)),x-=u;T<x;)E.c.push(+A.slice(T,T+=u));T=u-(A=A.slice(T)).length}else T-=x;for(;T--;A+="0");E.c.push(+A)}}else E.c=[E.e=0]}B.clone=k,B.ROUND_UP=0,B.ROUND_DOWN=1,B.ROUND_CEIL=2,B.ROUND_FLOOR=3,B.ROUND_HALF_UP=4,B.ROUND_HALF_DOWN=5,B.ROUND_HALF_EVEN=6,B.ROUND_HALF_CEIL=7,B.ROUND_HALF_FLOOR=8,B.EUCLID=9,B.config=B.set=function(a){var f,l;if(a!=null)if(typeof a=="object"){if(a.hasOwnProperty(f="DECIMAL_PLACES")&&(l=a[f],D(l,0,N,f),tt=l),a.hasOwnProperty(f="ROUNDING_MODE")&&(l=a[f],D(l,0,8,f),it=l),a.hasOwnProperty(f="EXPONENTIAL_AT")&&(l=a[f],l&&l.pop?(D(l[0],-N,0,f),D(l[1],0,N,f),yt=l[0],It=l[1]):(D(l,-N,N,f),yt=-(It=l<0?-l:l))),a.hasOwnProperty(f="RANGE"))if(l=a[f],l&&l.pop)D(l[0],-N,-1,f),D(l[1],1,N,f),Ct=l[0],L=l[1];else if(D(l,-N,N,f),l)Ct=-(L=l<0?-l:l);else throw Error(s+f+" cannot be zero: "+l);if(a.hasOwnProperty(f="CRYPTO"))if(l=a[f],l===!!l)if(l)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))R=l;else throw R=!l,Error(s+"crypto unavailable");else R=l;else throw Error(s+f+" not true or false: "+l);if(a.hasOwnProperty(f="MODULO_MODE")&&(l=a[f],D(l,0,9,f),P=l),a.hasOwnProperty(f="POW_PRECISION")&&(l=a[f],D(l,0,N,f),K=l),a.hasOwnProperty(f="FORMAT"))if(l=a[f],typeof l=="object")z=l;else throw Error(s+f+" not an object: "+l);if(a.hasOwnProperty(f="ALPHABET"))if(l=a[f],typeof l=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(l))nt=l.slice(0,10)=="0123456789",W=l;else throw Error(s+f+" invalid: "+l)}else throw Error(s+"Object expected: "+a);return{DECIMAL_PLACES:tt,ROUNDING_MODE:it,EXPONENTIAL_AT:[yt,It],RANGE:[Ct,L],CRYPTO:R,MODULO_MODE:P,POW_PRECISION:K,FORMAT:z,ALPHABET:W}},B.isBigNumber=function(a){if(!a||a._isBigNumber!==!0)return!1;if(!B.DEBUG)return!0;var f,l,b=a.c,m=a.e,_=a.s;t:if({}.toString.call(b)=="[object Array]"){if((_===1||_===-1)&&m>=-N&&m<=N&&m===i(m)){if(b[0]===0){if(m===0&&b.length===1)return!0;break t}if(f=(m+1)%u,f<1&&(f+=u),String(b[0]).length==f){for(f=0;f<b.length;f++)if(l=b[f],l<0||l>=c||l!==i(l))break t;if(l!==0)return!0}}}else if(b===null&&m===null&&(_===null||_===1||_===-1))return!0;throw Error(s+"Invalid BigNumber: "+a)},B.maximum=B.max=function(){return at(arguments,-1)},B.minimum=B.min=function(){return at(arguments,1)},B.random=function(){var a=9007199254740992,f=Math.random()*a&2097151?function(){return i(Math.random()*a)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(l){var b,m,_,T,d,x=0,A=[],E=new B(st);if(l==null?l=tt:D(l,0,N),T=n(l/u),R)if(crypto.getRandomValues){for(b=crypto.getRandomValues(new Uint32Array(T*=2));x<T;)d=b[x]*131072+(b[x+1]>>>11),d>=9e15?(m=crypto.getRandomValues(new Uint32Array(2)),b[x]=m[0],b[x+1]=m[1]):(A.push(d%1e14),x+=2);x=T/2}else if(crypto.randomBytes){for(b=crypto.randomBytes(T*=7);x<T;)d=(b[x]&31)*281474976710656+b[x+1]*1099511627776+b[x+2]*4294967296+b[x+3]*16777216+(b[x+4]<<16)+(b[x+5]<<8)+b[x+6],d>=9e15?crypto.randomBytes(7).copy(b,x):(A.push(d%1e14),x+=7);x=T/7}else throw R=!1,Error(s+"crypto unavailable");if(!R)for(;x<T;)d=f(),d<9e15&&(A[x++]=d%1e14);for(T=A[--x],l%=u,T&&l&&(d=w[u-l],A[x]=i(T/d)*d);A[x]===0;A.pop(),x--);if(x<0)A=[_=0];else{for(_=-1;A[0]===0;A.splice(0,1),_-=u);for(x=1,d=A[0];d>=10;d/=10,x++);x<u&&(_-=u-x)}return E.e=_,E.c=A,E}}(),B.sum=function(){for(var a=1,f=arguments,l=new B(f[0]);a<f.length;)l=l.plus(f[a++]);return l},rt=function(){var a="0123456789";function f(l,b,m,_){for(var T,d=[0],x,A=0,E=l.length;A<E;){for(x=d.length;x--;d[x]*=b);for(d[0]+=_.indexOf(l.charAt(A++)),T=0;T<d.length;T++)d[T]>m-1&&(d[T+1]==null&&(d[T+1]=0),d[T+1]+=d[T]/m|0,d[T]%=m)}return d.reverse()}return function(l,b,m,_,T){var d,x,A,E,I,F,$,X,dt=l.indexOf("."),gt=tt,Y=it;for(dt>=0&&(E=K,K=0,l=l.replace(".",""),X=new B(b),F=X.pow(l.length-dt),K=E,X.c=f(lt(G(F.c),F.e,"0"),10,m,a),X.e=X.c.length),$=f(l,b,m,T?(d=W,a):(d=a,W)),A=E=$.length;$[--E]==0;$.pop());if(!$[0])return d.charAt(0);if(dt<0?--A:(F.c=$,F.e=A,F.s=_,F=q(F,X,gt,Y,m),$=F.c,I=F.r,A=F.e),x=A+gt+1,dt=$[x],E=m/2,I=I||x<0||$[x+1]!=null,I=Y<4?(dt!=null||I)&&(Y==0||Y==(F.s<0?3:2)):dt>E||dt==E&&(Y==4||I||Y==6&&$[x-1]&1||Y==(F.s<0?8:7)),x<1||!$[0])l=I?lt(d.charAt(1),-gt,d.charAt(0)):d.charAt(0);else{if($.length=x,I)for(--m;++$[--x]>m;)$[x]=0,x||(++A,$=[1].concat($));for(E=$.length;!$[--E];);for(dt=0,l="";dt<=E;l+=d.charAt($[dt++]));l=lt(l,A,d.charAt(0))}return l}}(),q=function(){function a(b,m,_){var T,d,x,A,E=0,I=b.length,F=m%g,$=m/g|0;for(b=b.slice();I--;)x=b[I]%g,A=b[I]/g|0,T=$*x+A*F,d=F*x+T%g*g+E,E=(d/_|0)+(T/g|0)+$*A,b[I]=d%_;return E&&(b=[E].concat(b)),b}function f(b,m,_,T){var d,x;if(_!=T)x=_>T?1:-1;else for(d=x=0;d<_;d++)if(b[d]!=m[d]){x=b[d]>m[d]?1:-1;break}return x}function l(b,m,_,T){for(var d=0;_--;)b[_]-=d,d=b[_]<m[_]?1:0,b[_]=d*T+b[_]-m[_];for(;!b[0]&&b.length>1;b.splice(0,1));}return function(b,m,_,T,d){var x,A,E,I,F,$,X,dt,gt,Y,H,At,Te,$e,Ve,Qt,ot,Ht=b.s==m.s?1:-1,kt=b.c,xt=m.c;if(!kt||!kt[0]||!xt||!xt[0])return new B(!b.s||!m.s||(kt?xt&&kt[0]==xt[0]:!xt)?NaN:kt&&kt[0]==0||!xt?Ht*0:Ht/0);for(dt=new B(Ht),gt=dt.c=[],A=b.e-m.e,Ht=_+A+1,d||(d=c,A=O(b.e/u)-O(m.e/u),Ht=Ht/u|0),E=0;xt[E]==(kt[E]||0);E++);if(xt[E]>(kt[E]||0)&&A--,Ht<0)gt.push(1),I=!0;else{for($e=kt.length,Qt=xt.length,E=0,Ht+=2,F=i(d/(xt[0]+1)),F>1&&(xt=a(xt,F,d),kt=a(kt,F,d),Qt=xt.length,$e=kt.length),Te=Qt,Y=kt.slice(0,Qt),H=Y.length;H<Qt;Y[H++]=0);ot=xt.slice(),ot=[0].concat(ot),Ve=xt[0],xt[1]>=d/2&&Ve++;do{if(F=0,x=f(xt,Y,Qt,H),x<0){if(At=Y[0],Qt!=H&&(At=At*d+(Y[1]||0)),F=i(At/Ve),F>1)for(F>=d&&(F=d-1),$=a(xt,F,d),X=$.length,H=Y.length;f($,Y,X,H)==1;)F--,l($,Qt<X?ot:xt,X,d),X=$.length,x=1;else F==0&&(x=F=1),$=xt.slice(),X=$.length;if(X<H&&($=[0].concat($)),l(Y,$,H,d),H=Y.length,x==-1)for(;f(xt,Y,Qt,H)<1;)F++,l(Y,Qt<H?ot:xt,H,d),H=Y.length}else x===0&&(F++,Y=[0]);gt[E++]=F,Y[0]?Y[H++]=kt[Te]||0:(Y=[kt[Te]],H=1)}while((Te++<$e||Y[0]!=null)&&Ht--);I=Y[0]!=null,gt[0]||gt.splice(0,1)}if(d==c){for(E=1,Ht=gt[0];Ht>=10;Ht/=10,E++);ct(dt,_+(dt.e=E+A*u-1)+1,T,I)}else dt.e=A,dt.r=+I;return dt}}();function h(a,f,l,b){var m,_,T,d,x;if(l==null?l=it:D(l,0,8),!a.c)return a.toString();if(m=a.c[0],T=a.e,f==null)x=G(a.c),x=b==1||b==2&&(T<=yt||T>=It)?C(x,T):lt(x,T,"0");else if(a=ct(new B(a),f,l),_=a.e,x=G(a.c),d=x.length,b==1||b==2&&(f<=_||_<=yt)){for(;d<f;x+="0",d++);x=C(x,_)}else if(f-=T,x=lt(x,_,"0"),_+1>d){if(--f>0)for(x+=".";f--;x+="0");}else if(f+=_-d,f>0)for(_+1==d&&(x+=".");f--;x+="0");return a.s<0&&m?"-"+x:x}function at(a,f){for(var l,b,m=1,_=new B(a[0]);m<a.length;m++)b=new B(a[m]),(!b.s||(l=ft(_,b))===f||l===0&&_.s===f)&&(_=b);return _}function mt(a,f,l){for(var b=1,m=f.length;!f[--m];f.pop());for(m=f[0];m>=10;m/=10,b++);return(l=b+l*u-1)>L?a.c=a.e=null:l<Ct?a.c=[a.e=0]:(a.e=l,a.c=f),a}J=function(){var a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,f=/^([^.]+)\.$/,l=/^\.([^.]+)$/,b=/^-?(Infinity|NaN)$/,m=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(_,T,d,x){var A,E=d?T:T.replace(m,"");if(b.test(E))_.s=isNaN(E)?null:E<0?-1:1;else{if(!d&&(E=E.replace(a,function(I,F,$){return A=($=$.toLowerCase())=="x"?16:$=="b"?2:8,!x||x==A?F:I}),x&&(A=x,E=E.replace(f,"$1").replace(l,"0.$1")),T!=E))return new B(E,A);if(B.DEBUG)throw Error(s+"Not a"+(x?" base "+x:"")+" number: "+T);_.s=null}_.c=_.e=null}}();function ct(a,f,l,b){var m,_,T,d,x,A,E,I=a.c,F=w;if(I){t:{for(m=1,d=I[0];d>=10;d/=10,m++);if(_=f-m,_<0)_+=u,T=f,x=I[A=0],E=i(x/F[m-T-1]%10);else if(A=n((_+1)/u),A>=I.length)if(b){for(;I.length<=A;I.push(0));x=E=0,m=1,_%=u,T=_-u+1}else break t;else{for(x=d=I[A],m=1;d>=10;d/=10,m++);_%=u,T=_-u+m,E=T<0?0:i(x/F[m-T-1]%10)}if(b=b||f<0||I[A+1]!=null||(T<0?x:x%F[m-T-1]),b=l<4?(E||b)&&(l==0||l==(a.s<0?3:2)):E>5||E==5&&(l==4||b||l==6&&(_>0?T>0?x/F[m-T]:0:I[A-1])%10&1||l==(a.s<0?8:7)),f<1||!I[0])return I.length=0,b?(f-=a.e+1,I[0]=F[(u-f%u)%u],a.e=-f||0):I[0]=a.e=0,a;if(_==0?(I.length=A,d=1,A--):(I.length=A+1,d=F[u-_],I[A]=T>0?i(x/F[m-T]%F[T])*d:0),b)for(;;)if(A==0){for(_=1,T=I[0];T>=10;T/=10,_++);for(T=I[0]+=d,d=1;T>=10;T/=10,d++);_!=d&&(a.e++,I[0]==c&&(I[0]=1));break}else{if(I[A]+=d,I[A]!=c)break;I[A--]=0,d=1}for(_=I.length;I[--_]===0;I.pop());}a.e>L?a.c=a.e=null:a.e<Ct&&(a.c=[a.e=0])}return a}function M(a){var f,l=a.e;return l===null?a.toString():(f=G(a.c),f=l<=yt||l>=It?C(f,l):lt(f,l,"0"),a.s<0?"-"+f:f)}return U.absoluteValue=U.abs=function(){var a=new B(this);return a.s<0&&(a.s=1),a},U.comparedTo=function(a,f){return ft(this,new B(a,f))},U.decimalPlaces=U.dp=function(a,f){var l,b,m,_=this;if(a!=null)return D(a,0,N),f==null?f=it:D(f,0,8),ct(new B(_),a+_.e+1,f);if(!(l=_.c))return null;if(b=((m=l.length-1)-O(this.e/u))*u,m=l[m])for(;m%10==0;m/=10,b--);return b<0&&(b=0),b},U.dividedBy=U.div=function(a,f){return q(this,new B(a,f),tt,it)},U.dividedToIntegerBy=U.idiv=function(a,f){return q(this,new B(a,f),0,1)},U.exponentiatedBy=U.pow=function(a,f){var l,b,m,_,T,d,x,A,E,I=this;if(a=new B(a),a.c&&!a.isInteger())throw Error(s+"Exponent not an integer: "+M(a));if(f!=null&&(f=new B(f)),d=a.e>14,!I.c||!I.c[0]||I.c[0]==1&&!I.e&&I.c.length==1||!a.c||!a.c[0])return E=new B(Math.pow(+M(I),d?a.s*(2-Mt(a)):+M(a))),f?E.mod(f):E;if(x=a.s<0,f){if(f.c?!f.c[0]:!f.s)return new B(NaN);b=!x&&I.isInteger()&&f.isInteger(),b&&(I=I.mod(f))}else{if(a.e>9&&(I.e>0||I.e<-1||(I.e==0?I.c[0]>1||d&&I.c[1]>=24e7:I.c[0]<8e13||d&&I.c[0]<=9999975e7)))return _=I.s<0&&Mt(a)?-0:0,I.e>-1&&(_=1/_),new B(x?1/_:_);K&&(_=n(K/u+2))}for(d?(l=new B(.5),x&&(a.s=1),A=Mt(a)):(m=Math.abs(+M(a)),A=m%2),E=new B(st);;){if(A){if(E=E.times(I),!E.c)break;_?E.c.length>_&&(E.c.length=_):b&&(E=E.mod(f))}if(m){if(m=i(m/2),m===0)break;A=m%2}else if(a=a.times(l),ct(a,a.e+1,1),a.e>14)A=Mt(a);else{if(m=+M(a),m===0)break;A=m%2}I=I.times(I),_?I.c&&I.c.length>_&&(I.c.length=_):b&&(I=I.mod(f))}return b?E:(x&&(E=st.div(E)),f?E.mod(f):_?ct(E,K,it,T):E)},U.integerValue=function(a){var f=new B(this);return a==null?a=it:D(a,0,8),ct(f,f.e+1,a)},U.isEqualTo=U.eq=function(a,f){return ft(this,new B(a,f))===0},U.isFinite=function(){return!!this.c},U.isGreaterThan=U.gt=function(a,f){return ft(this,new B(a,f))>0},U.isGreaterThanOrEqualTo=U.gte=function(a,f){return(f=ft(this,new B(a,f)))===1||f===0},U.isInteger=function(){return!!this.c&&O(this.e/u)>this.c.length-2},U.isLessThan=U.lt=function(a,f){return ft(this,new B(a,f))<0},U.isLessThanOrEqualTo=U.lte=function(a,f){return(f=ft(this,new B(a,f)))===-1||f===0},U.isNaN=function(){return!this.s},U.isNegative=function(){return this.s<0},U.isPositive=function(){return this.s>0},U.isZero=function(){return!!this.c&&this.c[0]==0},U.minus=function(a,f){var l,b,m,_,T=this,d=T.s;if(a=new B(a,f),f=a.s,!d||!f)return new B(NaN);if(d!=f)return a.s=-f,T.plus(a);var x=T.e/u,A=a.e/u,E=T.c,I=a.c;if(!x||!A){if(!E||!I)return E?(a.s=-f,a):new B(I?T:NaN);if(!E[0]||!I[0])return I[0]?(a.s=-f,a):new B(E[0]?T:it==3?-0:0)}if(x=O(x),A=O(A),E=E.slice(),d=x-A){for((_=d<0)?(d=-d,m=E):(A=x,m=I),m.reverse(),f=d;f--;m.push(0));m.reverse()}else for(b=(_=(d=E.length)<(f=I.length))?d:f,d=f=0;f<b;f++)if(E[f]!=I[f]){_=E[f]<I[f];break}if(_&&(m=E,E=I,I=m,a.s=-a.s),f=(b=I.length)-(l=E.length),f>0)for(;f--;E[l++]=0);for(f=c-1;b>d;){if(E[--b]<I[b]){for(l=b;l&&!E[--l];E[l]=f);--E[l],E[b]+=c}E[b]-=I[b]}for(;E[0]==0;E.splice(0,1),--A);return E[0]?mt(a,E,A):(a.s=it==3?-1:1,a.c=[a.e=0],a)},U.modulo=U.mod=function(a,f){var l,b,m=this;return a=new B(a,f),!m.c||!a.s||a.c&&!a.c[0]?new B(NaN):!a.c||m.c&&!m.c[0]?new B(m):(P==9?(b=a.s,a.s=1,l=q(m,a,0,3),a.s=b,l.s*=b):l=q(m,a,0,P),a=m.minus(l.times(a)),!a.c[0]&&P==1&&(a.s=m.s),a)},U.multipliedBy=U.times=function(a,f){var l,b,m,_,T,d,x,A,E,I,F,$,X,dt,gt,Y=this,H=Y.c,At=(a=new B(a,f)).c;if(!H||!At||!H[0]||!At[0])return!Y.s||!a.s||H&&!H[0]&&!At||At&&!At[0]&&!H?a.c=a.e=a.s=null:(a.s*=Y.s,!H||!At?a.c=a.e=null:(a.c=[0],a.e=0)),a;for(b=O(Y.e/u)+O(a.e/u),a.s*=Y.s,x=H.length,I=At.length,x<I&&(X=H,H=At,At=X,m=x,x=I,I=m),m=x+I,X=[];m--;X.push(0));for(dt=c,gt=g,m=I;--m>=0;){for(l=0,F=At[m]%gt,$=At[m]/gt|0,T=x,_=m+T;_>m;)A=H[--T]%gt,E=H[T]/gt|0,d=$*A+E*F,A=F*A+d%gt*gt+X[_]+l,l=(A/dt|0)+(d/gt|0)+$*E,X[_--]=A%dt;X[_]=l}return l?++b:X.splice(0,1),mt(a,X,b)},U.negated=function(){var a=new B(this);return a.s=-a.s||null,a},U.plus=function(a,f){var l,b=this,m=b.s;if(a=new B(a,f),f=a.s,!m||!f)return new B(NaN);if(m!=f)return a.s=-f,b.minus(a);var _=b.e/u,T=a.e/u,d=b.c,x=a.c;if(!_||!T){if(!d||!x)return new B(m/0);if(!d[0]||!x[0])return x[0]?a:new B(d[0]?b:m*0)}if(_=O(_),T=O(T),d=d.slice(),m=_-T){for(m>0?(T=_,l=x):(m=-m,l=d),l.reverse();m--;l.push(0));l.reverse()}for(m=d.length,f=x.length,m-f<0&&(l=x,x=d,d=l,f=m),m=0;f;)m=(d[--f]=d[f]+x[f]+m)/c|0,d[f]=c===d[f]?0:d[f]%c;return m&&(d=[m].concat(d),++T),mt(a,d,T)},U.precision=U.sd=function(a,f){var l,b,m,_=this;if(a!=null&&a!==!!a)return D(a,1,N),f==null?f=it:D(f,0,8),ct(new B(_),a,f);if(!(l=_.c))return null;if(m=l.length-1,b=m*u+1,m=l[m]){for(;m%10==0;m/=10,b--);for(m=l[0];m>=10;m/=10,b++);}return a&&_.e+1>b&&(b=_.e+1),b},U.shiftedBy=function(a){return D(a,-y,y),this.times("1e"+a)},U.squareRoot=U.sqrt=function(){var a,f,l,b,m,_=this,T=_.c,d=_.s,x=_.e,A=tt+4,E=new B("0.5");if(d!==1||!T||!T[0])return new B(!d||d<0&&(!T||T[0])?NaN:T?_:1/0);if(d=Math.sqrt(+M(_)),d==0||d==1/0?(f=G(T),(f.length+x)%2==0&&(f+="0"),d=Math.sqrt(+f),x=O((x+1)/2)-(x<0||x%2),d==1/0?f="5e"+x:(f=d.toExponential(),f=f.slice(0,f.indexOf("e")+1)+x),l=new B(f)):l=new B(d+""),l.c[0]){for(x=l.e,d=x+A,d<3&&(d=0);;)if(m=l,l=E.times(m.plus(q(_,m,A,1))),G(m.c).slice(0,d)===(f=G(l.c)).slice(0,d))if(l.e<x&&--d,f=f.slice(d-3,d+1),f=="9999"||!b&&f=="4999"){if(!b&&(ct(m,m.e+tt+2,0),m.times(m).eq(_))){l=m;break}A+=4,d+=4,b=1}else{(!+f||!+f.slice(1)&&f.charAt(0)=="5")&&(ct(l,l.e+tt+2,1),a=!l.times(l).eq(_));break}}return ct(l,l.e+tt+1,it,a)},U.toExponential=function(a,f){return a!=null&&(D(a,0,N),a++),h(this,a,f,1)},U.toFixed=function(a,f){return a!=null&&(D(a,0,N),a=a+this.e+1),h(this,a,f)},U.toFormat=function(a,f,l){var b,m=this;if(l==null)a!=null&&f&&typeof f=="object"?(l=f,f=null):a&&typeof a=="object"?(l=a,a=f=null):l=z;else if(typeof l!="object")throw Error(s+"Argument not an object: "+l);if(b=m.toFixed(a,f),m.c){var _,T=b.split("."),d=+l.groupSize,x=+l.secondaryGroupSize,A=l.groupSeparator||"",E=T[0],I=T[1],F=m.s<0,$=F?E.slice(1):E,X=$.length;if(x&&(_=d,d=x,x=_,X-=_),d>0&&X>0){for(_=X%d||d,E=$.substr(0,_);_<X;_+=d)E+=A+$.substr(_,d);x>0&&(E+=A+$.slice(_)),F&&(E="-"+E)}b=I?E+(l.decimalSeparator||"")+((x=+l.fractionGroupSize)?I.replace(new RegExp("\\d{"+x+"}\\B","g"),"$&"+(l.fractionGroupSeparator||"")):I):E}return(l.prefix||"")+b+(l.suffix||"")},U.toFraction=function(a){var f,l,b,m,_,T,d,x,A,E,I,F,$=this,X=$.c;if(a!=null&&(d=new B(a),!d.isInteger()&&(d.c||d.s!==1)||d.lt(st)))throw Error(s+"Argument "+(d.isInteger()?"out of range: ":"not an integer: ")+M(d));if(!X)return new B($);for(f=new B(st),A=l=new B(st),b=x=new B(st),F=G(X),_=f.e=F.length-$.e-1,f.c[0]=w[(T=_%u)<0?u+T:T],a=!a||d.comparedTo(f)>0?_>0?f:A:d,T=L,L=1/0,d=new B(F),x.c[0]=0;E=q(d,f,0,1),m=l.plus(E.times(b)),m.comparedTo(a)!=1;)l=b,b=m,A=x.plus(E.times(m=A)),x=m,f=d.minus(E.times(m=f)),d=m;return m=q(a.minus(l),b,0,1),x=x.plus(m.times(A)),l=l.plus(m.times(b)),x.s=A.s=$.s,_=_*2,I=q(A,b,_,it).minus($).abs().comparedTo(q(x,l,_,it).minus($).abs())<1?[A,b]:[x,l],L=T,I},U.toNumber=function(){return+M(this)},U.toPrecision=function(a,f){return a!=null&&D(a,1,N),h(this,a,f,2)},U.toString=function(a){var f,l=this,b=l.s,m=l.e;return m===null?b?(f="Infinity",b<0&&(f="-"+f)):f="NaN":(a==null?f=m<=yt||m>=It?C(G(l.c),m):lt(G(l.c),m,"0"):a===10&&nt?(l=ct(new B(l),tt+m+1,it),f=lt(G(l.c),l.e,"0")):(D(a,2,W.length,"Base"),f=rt(lt(G(l.c),m,"0"),10,a,b,!0)),b<0&&l.c[0]&&(f="-"+f)),f},U.valueOf=U.toJSON=function(){return M(this)},U._isBigNumber=!0,V!=null&&B.set(V),B}function O(V){var q=V|0;return V>0||V===q?q:q-1}function G(V){for(var q,rt,J=1,U=V.length,st=V[0]+"";J<U;){for(q=V[J++]+"",rt=u-q.length;rt--;q="0"+q);st+=q}for(U=st.length;st.charCodeAt(--U)===48;);return st.slice(0,U+1||1)}function ft(V,q){var rt,J,U=V.c,st=q.c,tt=V.s,it=q.s,yt=V.e,It=q.e;if(!tt||!it)return null;if(rt=U&&!U[0],J=st&&!st[0],rt||J)return rt?J?0:-it:tt;if(tt!=it)return tt;if(rt=tt<0,J=yt==It,!U||!st)return J?0:!U^rt?1:-1;if(!J)return yt>It^rt?1:-1;for(it=(yt=U.length)<(It=st.length)?yt:It,tt=0;tt<it;tt++)if(U[tt]!=st[tt])return U[tt]>st[tt]^rt?1:-1;return yt==It?0:yt>It^rt?1:-1}function D(V,q,rt,J){if(V<q||V>rt||V!==i(V))throw Error(s+(J||"Argument")+(typeof V=="number"?V<q||V>rt?" out of range: ":" not an integer: ":" not a primitive number: ")+String(V))}function Mt(V){var q=V.c.length-1;return O(V.e/u)==q&&V.c[q]%2!=0}function C(V,q){return(V.length>1?V.charAt(0)+"."+V.slice(1):V)+(q<0?"e":"e+")+q}function lt(V,q,rt){var J,U;if(q<0){for(U=rt+".";++q;U+=rt);V=U+V}else if(J=V.length,++q>J){for(U=rt,q-=J;--q;U+=rt);V+=U}else q<J&&(V=V.slice(0,q)+"."+V.slice(q));return V}t=k(),t.default=t.BigNumber=t,typeof define=="function"&&define.amd?define(function(){return t}):typeof bn<"u"&&bn.exports?bn.exports=t:(r||(r=typeof self<"u"&&self?self:window),r.BigNumber=t)})(fa)});var ha=vt((Ep,la)=>{la.exports=function(t,e,n){var i=new t.Uint8Array(n),s=e.pushInt,o=e.pushInt32,c=e.pushInt32Neg,u=e.pushInt64,y=e.pushInt64Neg,w=e.pushFloat,g=e.pushFloatSingle,N=e.pushFloatDouble,k=e.pushTrue,O=e.pushFalse,G=e.pushUndefined,ft=e.pushNull,D=e.pushInfinity,Mt=e.pushInfinityNeg,C=e.pushNaN,lt=e.pushNaNNeg,V=e.pushArrayStart,q=e.pushArrayStartFixed,rt=e.pushArrayStartFixed32,J=e.pushArrayStartFixed64,U=e.pushObjectStart,st=e.pushObjectStartFixed,tt=e.pushObjectStartFixed32,it=e.pushObjectStartFixed64,yt=e.pushByteString,It=e.pushByteStringStart,Ct=e.pushUtf8String,L=e.pushUtf8StringStart,R=e.pushSimpleUnassigned,P=e.pushTagStart,K=e.pushTagStart4,z=e.pushTagStart8,W=e.pushTagUnassigned,nt=e.pushBreak,B=t.Math.pow,h=0,at=0,mt=0;function ct(p){for(p=p|0,h=0,at=p;(h|0)<(at|0)&&(mt=vu[i[h]&255](i[h]|0)|0,!((mt|0)>0)););return mt|0}function M(p){return p=p|0,((h|0)+(p|0)|0)<(at|0)?0:1}function a(p){return p=p|0,i[p|0]<<8|i[p+1|0]|0}function f(p){return p=p|0,i[p|0]<<24|i[p+1|0]<<16|i[p+2|0]<<8|i[p+3|0]|0}function l(p){return p=p|0,s(p|0),h=h+1|0,0}function b(p){return p=p|0,M(1)|0?1:(s(i[h+1|0]|0),h=h+2|0,0)}function m(p){return p=p|0,M(2)|0?1:(s(a(h+1|0)|0),h=h+3|0,0)}function _(p){return p=p|0,M(4)|0?1:(o(a(h+1|0)|0,a(h+3|0)|0),h=h+5|0,0)}function T(p){return p=p|0,M(8)|0?1:(u(a(h+1|0)|0,a(h+3|0)|0,a(h+5|0)|0,a(h+7|0)|0),h=h+9|0,0)}function d(p){return p=p|0,s(-1-(p-32|0)|0),h=h+1|0,0}function x(p){return p=p|0,M(1)|0?1:(s(-1-(i[h+1|0]|0)|0),h=h+2|0,0)}function A(p){p=p|0;var Q=0;return M(2)|0?1:(Q=a(h+1|0)|0,s(-1-(Q|0)|0),h=h+3|0,0)}function E(p){return p=p|0,M(4)|0?1:(c(a(h+1|0)|0,a(h+3|0)|0),h=h+5|0,0)}function I(p){return p=p|0,M(8)|0?1:(y(a(h+1|0)|0,a(h+3|0)|0,a(h+5|0)|0,a(h+7|0)|0),h=h+9|0,0)}function F(p){p=p|0;var Q=0,et=0,Z=0;return Z=p-64|0,M(Z|0)|0?1:(Q=h+1|0,et=(h+1|0)+(Z|0)|0,yt(Q|0,et|0),h=et|0,0)}function $(p){p=p|0;var Q=0,et=0,Z=0;return M(1)|0||(Z=i[h+1|0]|0,Q=h+2|0,et=(h+2|0)+(Z|0)|0,M(Z+1|0)|0)?1:(yt(Q|0,et|0),h=et|0,0)}function X(p){p=p|0;var Q=0,et=0,Z=0;return M(2)|0||(Z=a(h+1|0)|0,Q=h+3|0,et=(h+3|0)+(Z|0)|0,M(Z+2|0)|0)?1:(yt(Q|0,et|0),h=et|0,0)}function dt(p){p=p|0;var Q=0,et=0,Z=0;return M(4)|0||(Z=f(h+1|0)|0,Q=h+5|0,et=(h+5|0)+(Z|0)|0,M(Z+4|0)|0)?1:(yt(Q|0,et|0),h=et|0,0)}function gt(p){return p=p|0,1}function Y(p){return p=p|0,It(),h=h+1|0,0}function H(p){p=p|0;var Q=0,et=0,Z=0;return Z=p-96|0,M(Z|0)|0?1:(Q=h+1|0,et=(h+1|0)+(Z|0)|0,Ct(Q|0,et|0),h=et|0,0)}function At(p){p=p|0;var Q=0,et=0,Z=0;return M(1)|0||(Z=i[h+1|0]|0,Q=h+2|0,et=(h+2|0)+(Z|0)|0,M(Z+1|0)|0)?1:(Ct(Q|0,et|0),h=et|0,0)}function Te(p){p=p|0;var Q=0,et=0,Z=0;return M(2)|0||(Z=a(h+1|0)|0,Q=h+3|0,et=(h+3|0)+(Z|0)|0,M(Z+2|0)|0)?1:(Ct(Q|0,et|0),h=et|0,0)}function $e(p){p=p|0;var Q=0,et=0,Z=0;return M(4)|0||(Z=f(h+1|0)|0,Q=h+5|0,et=(h+5|0)+(Z|0)|0,M(Z+4|0)|0)?1:(Ct(Q|0,et|0),h=et|0,0)}function Ve(p){return p=p|0,1}function Qt(p){return p=p|0,L(),h=h+1|0,0}function ot(p){return p=p|0,q(p-128|0),h=h+1|0,0}function Ht(p){return p=p|0,M(1)|0?1:(q(i[h+1|0]|0),h=h+2|0,0)}function kt(p){return p=p|0,M(2)|0?1:(q(a(h+1|0)|0),h=h+3|0,0)}function xt(p){return p=p|0,M(4)|0?1:(rt(a(h+1|0)|0,a(h+3|0)|0),h=h+5|0,0)}function su(p){return p=p|0,M(8)|0?1:(J(a(h+1|0)|0,a(h+3|0)|0,a(h+5|0)|0,a(h+7|0)|0),h=h+9|0,0)}function ou(p){return p=p|0,V(),h=h+1|0,0}function _t(p){p=p|0;var Q=0;return Q=p-160|0,M(Q|0)|0?1:(st(Q|0),h=h+1|0,0)}function au(p){return p=p|0,M(1)|0?1:(st(i[h+1|0]|0),h=h+2|0,0)}function cu(p){return p=p|0,M(2)|0?1:(st(a(h+1|0)|0),h=h+3|0,0)}function uu(p){return p=p|0,M(4)|0?1:(tt(a(h+1|0)|0,a(h+3|0)|0),h=h+5|0,0)}function fu(p){return p=p|0,M(8)|0?1:(it(a(h+1|0)|0,a(h+3|0)|0,a(h+5|0)|0,a(h+7|0)|0),h=h+9|0,0)}function lu(p){return p=p|0,U(),h=h+1|0,0}function Qe(p){return p=p|0,P(p-192|0|0),h=h+1|0,0}function W0(p){return p=p|0,P(p|0),h=h+1|0,0}function z0(p){return p=p|0,P(p|0),h=h+1|0,0}function Y0(p){return p=p|0,P(p|0),h=h+1|0,0}function X0(p){return p=p|0,P(p|0),h=h+1|0,0}function Ft(p){return p=p|0,P(p-192|0|0),h=h+1|0,0}function J0(p){return p=p|0,P(p|0),h=h+1|0,0}function Z0(p){return p=p|0,P(p|0),h=h+1|0,0}function Q0(p){return p=p|0,P(p|0),h=h+1|0,0}function hu(p){return p=p|0,M(1)|0?1:(P(i[h+1|0]|0),h=h+2|0,0)}function du(p){return p=p|0,M(2)|0?1:(P(a(h+1|0)|0),h=h+3|0,0)}function pu(p){return p=p|0,M(4)|0?1:(K(a(h+1|0)|0,a(h+3|0)|0),h=h+5|0,0)}function wu(p){return p=p|0,M(8)|0?1:(z(a(h+1|0)|0,a(h+3|0)|0,a(h+5|0)|0,a(h+7|0)|0),h=h+9|0,0)}function Tt(p){return p=p|0,R((p|0)-224|0),h=h+1|0,0}function yu(p){return p=p|0,O(),h=h+1|0,0}function mu(p){return p=p|0,k(),h=h+1|0,0}function gu(p){return p=p|0,ft(),h=h+1|0,0}function xu(p){return p=p|0,G(),h=h+1|0,0}function _u(p){return p=p|0,M(1)|0?1:(R(i[h+1|0]|0),h=h+2|0,0)}function bu(p){p=p|0;var Q=0,et=0,Z=1,on=0,Ur=0,td=0;return M(2)|0?1:(Q=i[h+1|0]|0,et=i[h+2|0]|0,(Q|0)&128&&(Z=-1),on=+(((Q|0)&124)>>2),Ur=+(((Q|0)&3)<<8|et),+on==0?w(+(+Z*5960464477539063e-23*+Ur)):+on==31?+Z==1?+Ur>0?C():D():+Ur>0?lt():Mt():w(+(+Z*B(2,+(+on-25))*+(1024+Ur))),h=h+3|0,0)}function Eu(p){return p=p|0,M(4)|0?1:(g(i[h+1|0]|0,i[h+2|0]|0,i[h+3|0]|0,i[h+4|0]|0),h=h+5|0,0)}function Au(p){return p=p|0,M(8)|0?1:(N(i[h+1|0]|0,i[h+2|0]|0,i[h+3|0]|0,i[h+4|0]|0,i[h+5|0]|0,i[h+6|0]|0,i[h+7|0]|0,i[h+8|0]|0),h=h+9|0,0)}function pt(p){return p=p|0,1}function Tu(p){return p=p|0,nt(),h=h+1|0,0}var vu=[l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,l,b,m,_,T,pt,pt,pt,pt,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,x,A,E,I,pt,pt,pt,pt,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,$,X,dt,gt,pt,pt,pt,Y,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,At,Te,$e,Ve,pt,pt,pt,Qt,ot,ot,ot,ot,ot,ot,ot,ot,ot,ot,ot,ot,ot,ot,ot,ot,ot,ot,ot,ot,ot,ot,ot,ot,Ht,kt,xt,su,pt,pt,pt,ou,_t,_t,_t,_t,_t,_t,_t,_t,_t,_t,_t,_t,_t,_t,_t,_t,_t,_t,_t,_t,_t,_t,_t,_t,au,cu,uu,fu,pt,pt,pt,lu,Qe,Qe,Qe,Qe,Qe,Qe,Ft,Ft,Ft,Ft,Ft,Ft,Ft,Ft,Ft,Ft,Ft,Ft,Ft,Ft,Ft,Ft,Ft,Ft,hu,du,pu,wu,pt,pt,pt,pt,Tt,Tt,Tt,Tt,Tt,Tt,Tt,Tt,Tt,Tt,Tt,Tt,Tt,Tt,Tt,Tt,Tt,Tt,Tt,Tt,yu,mu,gu,xu,_u,bu,Eu,Au,pt,pt,pt,Tu];return{parse:ct}}});var qr=vt(Xt=>{"use strict";var is=Vr().BigNumber;Xt.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7};Xt.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};Xt.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31};Xt.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23};Xt.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")};Xt.SHIFT32=Math.pow(2,32);Xt.SHIFT16=Math.pow(2,16);Xt.MAX_SAFE_HIGH=2097151;Xt.NEG_ONE=new is(-1);Xt.TEN=new is(10);Xt.TWO=new is(2);Xt.PARENT={ARRAY:0,OBJECT:1,MAP:2,TAG:3,BYTE_STRING:4,UTF8_STRING:5}});var En=vt(re=>{"use strict";var{Buffer:jf}=$r(),pa=Vr().BigNumber,wa=qr(),da=wa.SHIFT32,Df=wa.SHIFT16,Wf=2097151;re.parseHalf=function(t){var e,n,i;return i=t[0]&128?-1:1,e=(t[0]&124)>>2,n=(t[0]&3)<<8|t[1],e?e===31?i*(n?NaN:1/0):i*Math.pow(2,e-25)*(1024+n):i*5960464477539063e-23*n};function zf(r){return r<16?"0"+r.toString(16):r.toString(16)}re.arrayBufferToBignumber=function(r){let t=r.byteLength,e="";for(let n=0;n<t;n++)e+=zf(r[n]);return new pa(e,16)};re.buildMap=r=>{let t=new Map,e=Object.keys(r),n=e.length;for(let i=0;i<n;i++)t.set(e[i],r[e[i]]);return t};re.buildInt32=(r,t)=>r*Df+t;re.buildInt64=(r,t,e,n)=>{let i=re.buildInt32(r,t),s=re.buildInt32(e,n);return i>Wf?new pa(i).times(da).plus(s):i*da+s};re.writeHalf=function(t,e){let n=jf.allocUnsafe(4);n.writeFloatBE(e,0);let i=n.readUInt32BE(0);if(i&8191)return!1;var s=i>>16&32768;let o=i>>23&255,c=i&8388607;if(o>=113&&o<=142)s+=(o-112<<10)+(c>>13);else if(o>=103&&o<113){if(c&(1<<126-o)-1)return!1;s+=c+8388608>>126-o}else return!1;return t.writeUInt16BE(s,0),!0};re.keySorter=function(r,t){var e=r[0].byteLength,n=t[0].byteLength;return e>n?1:n>e?-1:r[0].compare(t[0])};re.isNegativeZero=r=>r===0&&1/r<0;re.nextPowerOf2=r=>{let t=0;if(r&&!(r&r-1))return r;for(;r!==0;)r>>=1,t+=1;return 1<<t}});var cs=vt((vp,ya)=>{"use strict";var as=qr(),Yf=as.MT,An=as.SIMPLE,ss=as.SYMS,os=class r{constructor(t){if(typeof t!="number")throw new Error("Invalid Simple type: "+typeof t);if(t<0||t>255||(t|0)!==t)throw new Error("value must be a small positive integer: "+t);this.value=t}toString(){return"simple("+this.value+")"}inspect(){return"simple("+this.value+")"}encodeCBOR(t){return t._pushInt(this.value,Yf.SIMPLE_FLOAT)}static isSimple(t){return t instanceof r}static decode(t,e){switch(e==null&&(e=!0),t){case An.FALSE:return!1;case An.TRUE:return!0;case An.NULL:return e?null:ss.NULL;case An.UNDEFINED:return e?void 0:ss.UNDEFINED;case-1:if(!e)throw new Error("Invalid BREAK");return ss.BREAK;default:return new r(t)}}};ya.exports=os});var fs=vt((Sp,ma)=>{"use strict";var us=class r{constructor(t,e,n){if(this.tag=t,this.value=e,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(t){return t._pushTag(this.tag),t.pushAny(this.value)}convert(t){var e,n;if(n=t?.[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 e=i,this.err=e,this}}};ma.exports=us});var ds=vt((Bp,xa)=>{"use strict";var ga=self.location?self.location.protocol+"//"+self.location.host:"",ls=self.URL,hs=class{constructor(t="",e=ga){this.super=new ls(t,e),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(t){this.super.hash=t}set host(t){this.super.host=t}set hostname(t){this.super.hostname=t}set href(t){this.super.href=t}set origin(t){this.super.origin=t}set password(t){this.super.password=t}set pathname(t){this.super.pathname=t}set port(t){this.super.port=t}set protocol(t){this.super.protocol=t}set search(t){this.super.search=t}set searchParams(t){this.super.searchParams=t}set username(t){this.super.username=t}createObjectURL(t){return this.super.createObjectURL(t)}revokeObjectURL(t){this.super.revokeObjectURL(t)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}};function Xf(r){if(typeof r=="string")return new ls(r).toString();if(!(r instanceof ls)){let t=r.username&&r.password?`${r.username}:${r.password}@`:"",e=r.auth?r.auth+"@":"",n=r.port?":"+r.port:"",i=r.protocol?r.protocol+"//":"",s=r.host||"",o=r.hostname||"",c=r.search||(r.query?"?"+r.query:""),u=r.hash||"",y=r.pathname||"",w=r.path||y+c;return`${i}${t||e}${s||o+n}${w}${u}`}}xa.exports={URLWithLegacySupport:hs,URLSearchParams:self.URLSearchParams,defaultBase:ga,format:Xf}});var Ea=vt((Ip,ba)=>{"use strict";var{URLWithLegacySupport:_a,format:Jf}=ds();ba.exports=(r,t={},e={},n)=>{let i=t.protocol?t.protocol.replace(":",""):"http";i=(e[i]||n||i)+":";let s;try{s=new _a(r)}catch{s={}}let o=Object.assign({},t,{protocol:i||s.protocol,host:t.host||s.host});return new _a(r,Jf(o)).toString()}});var ps=vt((Np,Aa)=>{"use strict";var{URLWithLegacySupport:Zf,format:Qf,URLSearchParams:tl,defaultBase:el}=ds(),rl=Ea();Aa.exports={URL:Zf,URLSearchParams:tl,format:Qf,relative:rl,defaultBase:el}});var ws=vt((Up,va)=>{"use strict";var{Buffer:pr}=$r(),Ta=cn(),nl=Vr().BigNumber,il=ha(),qt=En(),ht=qr(),sl=cs(),ol=fs(),{URL:al}=ps(),Hr=class r{constructor(t){t=t||{},!t.size||t.size<65536?t.size=65536:t.size=qt.nextPowerOf2(t.size),this._heap=new ArrayBuffer(t.size),this._heap8=new Uint8Array(this._heap),this._buffer=pr.from(this._heap),this._reset(),this._knownTags=Object.assign({0:e=>new Date(e),1:e=>new Date(e*1e3),2:e=>qt.arrayBufferToBignumber(e),3:e=>ht.NEG_ONE.minus(qt.arrayBufferToBignumber(e)),4:e=>ht.TEN.pow(e[0]).times(e[1]),5:e=>ht.TWO.pow(e[0]).times(e[1]),32:e=>new al(e),35:e=>new RegExp(e)},t.tags),this.parser=il(global,{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 t=this._parents.pop();if(t.length>0)throw new Error(`Missing ${t.length} elements`);switch(t.type){case ht.PARENT.TAG:this._push(this.createTag(t.ref[0],t.ref[1]));break;case ht.PARENT.BYTE_STRING:this._push(this.createByteString(t.ref,t.length));break;case ht.PARENT.UTF8_STRING:this._push(this.createUtf8String(t.ref,t.length));break;case ht.PARENT.MAP:if(t.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createMap(t.ref,t.length));break;case ht.PARENT.OBJECT:if(t.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createObject(t.ref,t.length));break;case ht.PARENT.ARRAY:this._push(this.createArray(t.ref,t.length));break;default:break}this._currentParent&&this._currentParent.type===ht.PARENT.TAG&&this._dec()}_dec(){let t=this._currentParent;t.length<0||(t.length--,t.length===0&&this._closeParent())}_push(t,e){let n=this._currentParent;switch(n.values++,n.type){case ht.PARENT.ARRAY:case ht.PARENT.BYTE_STRING:case ht.PARENT.UTF8_STRING:n.length>-1?this._ref[this._ref.length-n.length]=t:this._ref.push(t),this._dec();break;case ht.PARENT.OBJECT:n.tmpKey!=null?(this._ref[n.tmpKey]=t,n.tmpKey=null,this._dec()):(n.tmpKey=t,typeof n.tmpKey!="string"&&(n.type=ht.PARENT.MAP,n.ref=qt.buildMap(n.ref)));break;case ht.PARENT.MAP:n.tmpKey!=null?(this._ref.set(n.tmpKey,t),n.tmpKey=null,this._dec()):n.tmpKey=t;break;case ht.PARENT.TAG:this._ref.push(t),e||this._dec();break;default:throw new Error("Unknown parent type")}}_createParent(t,e,n){this._parents[this._depth]={type:e,length:n,ref:t,values:0,tmpKey:null}}_reset(){this._res=[],this._parents=[{type:ht.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}createTag(t,e){let n=this._knownTags[t];return n?n(e):new ol(t,e)}createMap(t,e){return t}createObject(t,e){return t}createArray(t,e){return t}createByteString(t,e){return pr.concat(t)}createByteStringFromHeap(t,e){return t===e?pr.alloc(0):pr.from(this._heap.slice(t,e))}createInt(t){return t}createInt32(t,e){return qt.buildInt32(t,e)}createInt64(t,e,n,i){return qt.buildInt64(t,e,n,i)}createFloat(t){return t}createFloatSingle(t,e,n,i){return Ta.read([t,e,n,i],0,!1,23,4)}createFloatDouble(t,e,n,i,s,o,c,u){return Ta.read([t,e,n,i,s,o,c,u],0,!1,52,8)}createInt32Neg(t,e){return-1-qt.buildInt32(t,e)}createInt64Neg(t,e,n,i){let s=qt.buildInt32(t,e),o=qt.buildInt32(n,i);return s>ht.MAX_SAFE_HIGH?ht.NEG_ONE.minus(new nl(s).times(ht.SHIFT32).plus(o)):-1-(s*ht.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(t,e){return t.join("")}createUtf8StringFromHeap(t,e){return t===e?"":this._buffer.toString("utf8",t,e)}createSimpleUnassigned(t){return new sl(t)}pushInt(t){this._push(this.createInt(t))}pushInt32(t,e){this._push(this.createInt32(t,e))}pushInt64(t,e,n,i){this._push(this.createInt64(t,e,n,i))}pushFloat(t){this._push(this.createFloat(t))}pushFloatSingle(t,e,n,i){this._push(this.createFloatSingle(t,e,n,i))}pushFloatDouble(t,e,n,i,s,o,c,u){this._push(this.createFloatDouble(t,e,n,i,s,o,c,u))}pushInt32Neg(t,e){this._push(this.createInt32Neg(t,e))}pushInt64Neg(t,e,n,i){this._push(this.createInt64Neg(t,e,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([],ht.PARENT.ARRAY,-1)}pushArrayStartFixed(t){this._createArrayStartFixed(t)}pushArrayStartFixed32(t,e){let n=qt.buildInt32(t,e);this._createArrayStartFixed(n)}pushArrayStartFixed64(t,e,n,i){let s=qt.buildInt64(t,e,n,i);this._createArrayStartFixed(s)}pushObjectStart(){this._createObjectStartFixed(-1)}pushObjectStartFixed(t){this._createObjectStartFixed(t)}pushObjectStartFixed32(t,e){let n=qt.buildInt32(t,e);this._createObjectStartFixed(n)}pushObjectStartFixed64(t,e,n,i){let s=qt.buildInt64(t,e,n,i);this._createObjectStartFixed(s)}pushByteStringStart(){this._parents[this._depth]={type:ht.PARENT.BYTE_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushByteString(t,e){this._push(this.createByteStringFromHeap(t,e))}pushUtf8StringStart(){this._parents[this._depth]={type:ht.PARENT.UTF8_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushUtf8String(t,e){this._push(this.createUtf8StringFromHeap(t,e))}pushSimpleUnassigned(t){this._push(this.createSimpleUnassigned(t))}pushTagStart(t){this._parents[this._depth]={type:ht.PARENT.TAG,length:1,ref:[t]}}pushTagStart4(t,e){this.pushTagStart(qt.buildInt32(t,e))}pushTagStart8(t,e,n,i){this.pushTagStart(qt.buildInt64(t,e,n,i))}pushTagUnassigned(t){this._push(this.createTag(t))}pushBreak(){if(this._currentParent.length>-1)throw new Error("Unexpected break");this._closeParent()}_createObjectStartFixed(t){if(t===0){this._push(this.createObject({}));return}this._createParent({},ht.PARENT.OBJECT,t)}_createArrayStartFixed(t){if(t===0){this._push(this.createArray([]));return}this._createParent(new Array(t),ht.PARENT.ARRAY,t)}_decode(t){if(t.byteLength===0)throw new Error("Input too short");this._reset(),this._heap8.set(t);let e=this.parser.parse(t.byteLength);if(this._depth>1){for(;this._currentParent.length===0;)this._closeParent();if(this._depth>1)throw new Error("Undeterminated nesting")}if(e>0)throw new Error("Failed to parse");if(this._res.length===0)throw new Error("No valid result")}decodeFirst(t){return this._decode(t),this._res[0]}decodeAll(t){return this._decode(t),this._res}static decode(t,e){return typeof t=="string"&&(t=pr.from(t,e||"hex")),new r({size:t.length}).decodeFirst(t)}static decodeAll(t,e){return typeof t=="string"&&(t=pr.from(t,e||"hex")),new r({size:t.length}).decodeAll(t)}};Hr.decodeFirst=Hr.decode;va.exports=Hr});var Ia=vt((Rp,Ba)=>{"use strict";var{Buffer:ys}=$r(),cl=ws(),ul=En(),ms=class r extends cl{createTag(t,e){return`${t}(${e})`}createInt(t){return super.createInt(t).toString()}createInt32(t,e){return super.createInt32(t,e).toString()}createInt64(t,e,n,i){return super.createInt64(t,e,n,i).toString()}createInt32Neg(t,e){return super.createInt32Neg(t,e).toString()}createInt64Neg(t,e,n,i){return super.createInt64Neg(t,e,n,i).toString()}createTrue(){return"true"}createFalse(){return"false"}createFloat(t){let e=super.createFloat(t);return ul.isNegativeZero(t)?"-0_1":`${e}_1`}createFloatSingle(t,e,n,i){return`${super.createFloatSingle(t,e,n,i)}_2`}createFloatDouble(t,e,n,i,s,o,c,u){return`${super.createFloatDouble(t,e,n,i,s,o,c,u)}_3`}createByteString(t,e){let n=t.join(", ");return e===-1?`(_ ${n})`:`h'${n}`}createByteStringFromHeap(t,e){return`h'${ys.from(super.createByteStringFromHeap(t,e)).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(t){return`simple(${t})`}createArray(t,e){let n=super.createArray(t,e);return e===-1?`[_ ${n.join(", ")}]`:`[${n.join(", ")}]`}createMap(t,e){let n=super.createMap(t),i=Array.from(n.keys()).reduce(Sa(n),"");return e===-1?`{_ ${i}}`:`{${i}}`}createObject(t,e){let n=super.createObject(t),i=Object.keys(n).reduce(Sa(n),"");return e===-1?`{_ ${i}}`:`{${i}}`}createUtf8String(t,e){let n=t.join(", ");return e===-1?`(_ ${n})`:`"${n}"`}createUtf8StringFromHeap(t,e){return`"${ys.from(super.createUtf8StringFromHeap(t,e)).toString("utf8")}"`}static diagnose(t,e){return typeof t=="string"&&(t=ys.from(t,e||"hex")),new r().decodeFirst(t)}};Ba.exports=ms;function Sa(r){return(t,e)=>t?`${t}, ${e}: ${r[e]}`:`${e}: ${r[e]}`}});var Oa=vt((Fp,Fa)=>{"use strict";var{Buffer:de}=$r(),{URL:fl}=ps(),xs=Vr().BigNumber,gs=En(),Nt=qr(),ie=Nt.MT,Tn=Nt.NUMBYTES,Na=Nt.SHIFT32,Ua=Nt.SYMS,wr=Nt.TAG,ll=Nt.MT.SIMPLE_FLOAT<<5|Nt.NUMBYTES.TWO,hl=Nt.MT.SIMPLE_FLOAT<<5|Nt.NUMBYTES.FOUR,dl=Nt.MT.SIMPLE_FLOAT<<5|Nt.NUMBYTES.EIGHT,pl=Nt.MT.SIMPLE_FLOAT<<5|Nt.SIMPLE.TRUE,wl=Nt.MT.SIMPLE_FLOAT<<5|Nt.SIMPLE.FALSE,yl=Nt.MT.SIMPLE_FLOAT<<5|Nt.SIMPLE.UNDEFINED,Ra=Nt.MT.SIMPLE_FLOAT<<5|Nt.SIMPLE.NULL,ml=new xs("0x20000000000000"),gl=de.from("f97e00","hex"),xl=de.from("f9fc00","hex"),_l=de.from("f97c00","hex");function bl(r){return{}.toString.call(r).slice(8,-1)}var _s=class r{constructor(t){t=t||{},this.streaming=typeof t.stream=="function",this.onData=t.stream,this.semanticTypes=[[fl,this._pushUrl],[xs,this._pushBigNumber]];let e=t.genTypes||[],n=e.length;for(let i=0;i<n;i++)this.addSemanticType(e[i][0],e[i][1]);this._reset()}addSemanticType(t,e){let n=this.semanticTypes.length;for(let i=0;i<n;i++)if(this.semanticTypes[i][0]===t){let o=this.semanticTypes[i][1];return this.semanticTypes[i][1]=e,o}return this.semanticTypes.push([t,e]),null}push(t){return t&&(this.result[this.offset]=t,this.resultMethod[this.offset]=0,this.resultLength[this.offset]=t.length,this.offset++,this.streaming&&this.onData(this.finalize())),!0}pushWrite(t,e,n){return this.result[this.offset]=t,this.resultMethod[this.offset]=e,this.resultLength[this.offset]=n,this.offset++,this.streaming&&this.onData(this.finalize()),!0}_pushUInt8(t){return this.pushWrite(t,1,1)}_pushUInt16BE(t){return this.pushWrite(t,2,2)}_pushUInt32BE(t){return this.pushWrite(t,3,4)}_pushDoubleBE(t){return this.pushWrite(t,4,8)}_pushNaN(){return this.push(gl)}_pushInfinity(t){let e=t<0?xl:_l;return this.push(e)}_pushFloat(t){let e=de.allocUnsafe(2);if(gs.writeHalf(e,t)&&gs.parseHalf(e)===t)return this._pushUInt8(ll)&&this.push(e);let n=de.allocUnsafe(4);return n.writeFloatBE(t,0),n.readFloatBE(0)===t?this._pushUInt8(hl)&&this.push(n):this._pushUInt8(dl)&&this._pushDoubleBE(t)}_pushInt(t,e,n){let i=e<<5;return t<24?this._pushUInt8(i|t):t<=255?this._pushUInt8(i|Tn.ONE)&&this._pushUInt8(t):t<=65535?this._pushUInt8(i|Tn.TWO)&&this._pushUInt16BE(t):t<=4294967295?this._pushUInt8(i|Tn.FOUR)&&this._pushUInt32BE(t):t<=Number.MAX_SAFE_INTEGER?this._pushUInt8(i|Tn.EIGHT)&&this._pushUInt32BE(Math.floor(t/Na))&&this._pushUInt32BE(t%Na):e===ie.NEG_INT?this._pushFloat(n):this._pushFloat(t)}_pushIntNum(t){return t<0?this._pushInt(-t-1,ie.NEG_INT,t):this._pushInt(t,ie.POS_INT)}_pushNumber(t){switch(!1){case t===t:return this._pushNaN(t);case isFinite(t):return this._pushInfinity(t);case t%1!==0:return this._pushIntNum(t);default:return this._pushFloat(t)}}_pushString(t){let e=de.byteLength(t,"utf8");return this._pushInt(e,ie.UTF8_STRING)&&this.pushWrite(t,5,e)}_pushBoolean(t){return this._pushUInt8(t?pl:wl)}_pushUndefined(t){return this._pushUInt8(yl)}_pushArray(t,e){let n=e.length;if(!t._pushInt(n,ie.ARRAY))return!1;for(let i=0;i<n;i++)if(!t.pushAny(e[i]))return!1;return!0}_pushTag(t){return this._pushInt(t,ie.TAG)}_pushDate(t,e){return t._pushTag(wr.DATE_EPOCH)&&t.pushAny(Math.round(e/1e3))}_pushBuffer(t,e){return t._pushInt(e.length,ie.BYTE_STRING)&&t.push(e)}_pushNoFilter(t,e){return t._pushBuffer(t,e.slice())}_pushRegexp(t,e){return t._pushTag(wr.REGEXP)&&t.pushAny(e.source)}_pushSet(t,e){if(!t._pushInt(e.size,ie.ARRAY))return!1;for(let n of e)if(!t.pushAny(n))return!1;return!0}_pushUrl(t,e){return t._pushTag(wr.URI)&&t.pushAny(e.format())}_pushBigint(t){let e=wr.POS_BIGINT;t.isNegative()&&(t=t.negated().minus(1),e=wr.NEG_BIGINT);let n=t.toString(16);n.length%2&&(n="0"+n);let i=de.from(n,"hex");return this._pushTag(e)&&this._pushBuffer(this,i)}_pushBigNumber(t,e){if(e.isNaN())return t._pushNaN();if(!e.isFinite())return t._pushInfinity(e.isNegative()?-1/0:1/0);if(e.isInteger())return t._pushBigint(e);if(!(t._pushTag(wr.DECIMAL_FRAC)&&t._pushInt(2,ie.ARRAY)))return!1;let n=e.decimalPlaces(),i=e.multipliedBy(new xs(10).pow(n));return t._pushIntNum(-n)?i.abs().isLessThan(ml)?t._pushIntNum(i.toNumber()):t._pushBigint(i):!1}_pushMap(t,e){return t._pushInt(e.size,ie.MAP)?this._pushRawMap(e.size,Array.from(e)):!1}_pushObject(t){if(!t)return this._pushUInt8(Ra);for(var e=this.semanticTypes.length,n=0;n<e;n++)if(t instanceof this.semanticTypes[n][0])return this.semanticTypes[n][1].call(t,this,t);var i=t.encodeCBOR;if(typeof i=="function")return i.call(t,this);var s=Object.keys(t),o=s.length;return this._pushInt(o,ie.MAP)?this._pushRawMap(o,s.map(c=>[c,t[c]])):!1}_pushRawMap(t,e){e=e.map(function(i){return i[0]=r.encode(i[0]),i}).sort(gs.keySorter);for(var n=0;n<t;n++)if(!this.push(e[n][0])||!this.pushAny(e[n][1]))return!1;return!0}write(t){return this.pushAny(t)}pushAny(t){var e=bl(t);switch(e){case"Number":return this._pushNumber(t);case"String":return this._pushString(t);case"Boolean":return this._pushBoolean(t);case"Object":return this._pushObject(t);case"Array":return this._pushArray(this,t);case"Uint8Array":return this._pushBuffer(this,de.isBuffer(t)?t:de.from(t));case"Null":return this._pushUInt8(Ra);case"Undefined":return this._pushUndefined(t);case"Map":return this._pushMap(this,t);case"Set":return this._pushSet(this,t);case"URL":return this._pushUrl(this,t);case"BigNumber":return this._pushBigNumber(this,t);case"Date":return this._pushDate(this,t);case"RegExp":return this._pushRegexp(this,t);case"Symbol":switch(t){case Ua.NULL:return this._pushObject(null);case Ua.UNDEFINED:return this._pushUndefined(void 0);default:throw new Error("Unknown symbol: "+t.toString())}default:throw new Error("Unknown type: "+typeof t+", "+(t?t.toString():""))}}finalize(){if(this.offset===0)return null;for(var t=this.result,e=this.resultLength,n=this.resultMethod,i=this.offset,s=0,o=0;o<i;o++)s+=e[o];var c=de.allocUnsafe(s),u=0,y=0;for(o=0;o<i;o++){switch(y=e[o],n[o]){case 0:t[o].copy(c,u);break;case 1:c.writeUInt8(t[o],u,!0);break;case 2:c.writeUInt16BE(t[o],u,!0);break;case 3:c.writeUInt32BE(t[o],u,!0);break;case 4:c.writeDoubleBE(t[o],u,!0);break;case 5:c.write(t[o],u,y,"utf8");break;default:throw new Error("unkown method")}u+=y}var w=c;return this._reset(),w}_reset(){this.result=[],this.resultMethod=[],this.resultLength=[],this.offset=0}static encode(t){let e=new r;if(!e.pushAny(t))throw new Error("Failed to encode input");return e.finalize()}};Fa.exports=_s});var vn=vt(Ut=>{"use strict";Ut.Diagnose=Ia();Ut.Decoder=ws();Ut.Encoder=Oa();Ut.Simple=cs();Ut.Tagged=fs();Ut.decodeAll=Ut.Decoder.decodeAll;Ut.decodeFirst=Ut.Decoder.decodeFirst;Ut.diagnose=Ut.Diagnose.diagnose;Ut.encode=Ut.Encoder.encode;Ut.decode=Ut.Decoder.decode;Ut.leveldb={decode:Ut.Decoder.decodeAll,encode:Ut.Encoder.encode,buffer:!0,name:"cbor"}});function pe(...r){let t=new Uint8Array(r.reduce((n,i)=>n+i.byteLength,0)),e=0;for(let n of r)t.set(new Uint8Array(n),e),e+=n.byteLength;return t.buffer}function Bt(r){return[...new Uint8Array(r)].map(t=>t.toString(16).padStart(2,"0")).join("")}function Kt(r){if(!El.test(r))throw new Error("Invalid hexadecimal string.");let t=[...r].reduce((e,n,i)=>(e[i/2|0]=(e[i/2|0]||"")+n,e),[]).map(e=>Number.parseInt(e,16));return new Uint8Array(t).buffer}function bs(r,t){if(r.byteLength!==t.byteLength)return r.byteLength-t.byteLength;let e=new Uint8Array(r),n=new Uint8Array(t);for(let i=0;i<e.length;i++)if(e[i]!==n[i])return e[i]-n[i];return 0}function Lr(r,t){return bs(r,t)===0}function Ke(r){return new DataView(r.buffer,r.byteOffset,r.byteLength).buffer}function Sn(r){return r instanceof Uint8Array?Ke(r):r instanceof ArrayBuffer?r:Array.isArray(r)?Ke(new Uint8Array(r)):"buffer"in r?Sn(r.buffer):Ke(new Uint8Array(r))}var El,Jt=ut(()=>{El=new RegExp(/^[0-9a-fA-F]+$/)});function Re(r){return Ke(Vo.create().update(new Uint8Array(r)).digest())}function Bn(r){if(r instanceof Pa.default.Tagged)return Bn(r.value);if(typeof r=="string")return ka(r);if(typeof r=="number")return Re(Ue(r));if(r instanceof ArrayBuffer||ArrayBuffer.isView(r))return Re(r);if(Array.isArray(r)){let t=r.map(Bn);return Re(pe(...t))}else{if(r&&typeof r=="object"&&r._isPrincipal)return Re(r.toUint8Array());if(typeof r=="object"&&r!==null&&typeof r.toHash=="function")return Bn(r.toHash());if(typeof r=="object")return Es(r);if(typeof r=="bigint")return Re(Ue(r))}throw Object.assign(new Error(`Attempt to hash a value of unsupported type: ${r}`),{value:r})}function yr(r){return Es(r)}function Es(r){let n=Object.entries(r).filter(([,o])=>o!==void 0).map(([o,c])=>{let u=ka(o),y=Bn(c);return[u,y]}).sort(([o],[c])=>bs(o,c)),i=pe(...n.map(o=>pe(...o)));return Re(i)}var Pa,ka,Gr=ut(()=>{lr();Pa=ve(vn());Ri();Jt();ka=r=>{let t=new TextEncoder().encode(r);return Re(t)}});var vs=vt(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});var vl=9007199254740992;function Ee(r,...t){let e=new Uint8Array(r.byteLength+t.reduce((i,s)=>i+s.byteLength,0));e.set(new Uint8Array(r),0);let n=r.byteLength;for(let i of t)e.set(new Uint8Array(i),n),n+=i.byteLength;return e.buffer}function se(r,t,e){e=e.replace(/[^0-9a-fA-F]/g,"");let n=2**(t-24);e=e.slice(-n*2).padStart(n*2,"0");let i=[(r<<5)+t].concat(e.match(/../g).map(s=>parseInt(s,16)));return new Uint8Array(i).buffer}function In(r,t){if(t<24)return new Uint8Array([(r<<5)+t]).buffer;{let e=t<=255?24:t<=65535?25:t<=4294967295?26:27;return se(r,e,t.toString(16))}}function Ma(r){let t=[];for(let e=0;e<r.length;e++){let n=r.charCodeAt(e);n<128?t.push(n):n<2048?t.push(192|n>>6,128|n&63):n<55296||n>=57344?t.push(224|n>>12,128|n>>6&63,128|n&63):(e++,n=(n&1023)<<10|r.charCodeAt(e)&1023,t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|n&63))}return Ee(new Uint8Array(In(3,r.length)),new Uint8Array(t))}function Sl(r,t){if(r==14277111)return Ee(new Uint8Array([217,217,247]),t);if(r<24)return Ee(new Uint8Array([192+r]),t);{let e=r<=255?24:r<=65535?25:r<=4294967295?26:27,n=2**(e-24),i=r.toString(16).slice(-n*2).padStart(n*2,"0"),s=[192+e].concat(i.match(/../g).map(o=>parseInt(o,16)));return new Uint8Array(s).buffer}}wt.tagged=Sl;function Kr(r){return new Uint8Array(r).buffer}wt.raw=Kr;function As(r){if(isNaN(r))throw new RangeError("Invalid number.");r=Math.min(Math.max(0,r),23);let t=[0+r];return new Uint8Array(t).buffer}wt.uSmall=As;function Ca(r,t){if(r=parseInt(""+r,t),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),255),r=r.toString(16),se(0,24,r)}wt.u8=Ca;function $a(r,t){if(r=parseInt(""+r,t),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),65535),r=r.toString(16),se(0,25,r)}wt.u16=$a;function Va(r,t){if(r=parseInt(""+r,t),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),4294967295),r=r.toString(16),se(0,26,r)}wt.u32=Va;function Ts(r,t){if(typeof r=="string"&&t==16){if(r.match(/[^0-9a-fA-F]/))throw new RangeError("Invalid number.");return se(0,27,r)}if(r=parseInt(""+r,t),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),vl),r=r.toString(16),se(0,27,r)}wt.u64=Ts;function qa(r){if(isNaN(r))throw new RangeError("Invalid number.");if(r===0)return As(0);r=Math.min(Math.max(0,-r),24)-1;let t=[32+r];return new Uint8Array(t).buffer}wt.iSmall=qa;function Ha(r,t){if(r=parseInt(""+r,t),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),255),r=r.toString(16),se(1,24,r)}wt.i8=Ha;function La(r,t){if(r=parseInt(""+r,t),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),65535),r=r.toString(16),se(1,25,r)}wt.i16=La;function Ga(r,t){if(r=parseInt(""+r,t),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),4294967295),r=r.toString(16),se(1,26,r)}wt.i32=Ga;function Ka(r,t){if(typeof r=="string"&&t==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 e=!1,n=r.split("").reduceRight((i,s)=>{if(e)return s+i;let o=parseInt(s,16)-1;return o>=0?(e=!0,o.toString(16)+i):"f"+i},"");return e?se(1,27,n):Ts(0)}if(r=parseInt(""+r,t),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),9007199254740992),r=r.toString(16),se(1,27,r)}wt.i64=Ka;function Bl(r){return r>=0?r<24?As(r):r<=255?Ca(r):r<=65535?$a(r):r<=4294967295?Va(r):Ts(r):r>=-24?qa(r):r>=-255?Ha(r):r>=-65535?La(r):r>=-4294967295?Ga(r):Ka(r)}wt.number=Bl;function Il(r){return Ee(In(2,r.byteLength),r)}wt.bytes=Il;function Nl(r){return Ma(r)}wt.string=Nl;function Ul(r){return Ee(In(4,r.length),...r)}wt.array=Ul;function Rl(r,t=!1){r instanceof Map||(r=new Map(Object.entries(r)));let e=Array.from(r.entries());return t&&(e=e.sort(([n],[i])=>n.localeCompare(i))),Ee(In(5,r.size),...e.map(([n,i])=>Ee(Ma(n),i)))}wt.map=Rl;function Fl(r){let t=new Float32Array([r]);return Ee(new Uint8Array([250]),new Uint8Array(t.buffer))}wt.singleFloat=Fl;function Ol(r){let t=new Float64Array([r]);return Ee(new Uint8Array([251]),new Uint8Array(t.buffer))}wt.doubleFloat=Ol;function Pl(r){return r?ja():Da()}wt.bool=Pl;function ja(){return Kr(new Uint8Array([245]))}wt.true_=ja;function Da(){return Kr(new Uint8Array([244]))}wt.false_=Da;function kl(){return Kr(new Uint8Array([246]))}wt.null_=kl;function Ml(){return Kr(new Uint8Array([247]))}wt.undefined_=Ml});var Wa=vt(Fe=>{"use strict";var Cl=Fe&&Fe.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)Object.hasOwnProperty.call(r,e)&&(t[e]=r[e]);return t.default=r,t};Object.defineProperty(Fe,"__esModule",{value:!0});var oe=Cl(vs()),$l=[ArrayBuffer,Uint8Array,Uint16Array,Uint32Array,Int8Array,Int16Array,Int32Array,Float32Array,Float64Array],Nn=class{constructor(t,e=!1){this._serializer=t,this._stable=e,this.name="jsonDefault",this.priority=-100}match(t){return["undefined","boolean","number","string","object"].indexOf(typeof t)!=-1}encode(t){switch(typeof t){case"undefined":return oe.undefined_();case"boolean":return oe.bool(t);case"number":return Math.floor(t)===t?oe.number(t):oe.doubleFloat(t);case"string":return oe.string(t);case"object":if(t===null)return oe.null_();if(Array.isArray(t))return oe.array(t.map(e=>this._serializer.serializeValue(e)));if($l.find(e=>t instanceof e))return oe.bytes(t.buffer);if(Object.getOwnPropertyNames(t).indexOf("toJSON")!==-1)return this.encode(t.toJSON());if(t instanceof Map){let e=new Map;for(let[n,i]of t.entries())e.set(n,this._serializer.serializeValue(i));return oe.map(e,this._stable)}else{let e=new Map;for(let[n,i]of Object.entries(t))e.set(n,this._serializer.serializeValue(i));return oe.map(e,this._stable)}default:throw new Error("Invalid value.")}}};Fe.JsonDefaultCborEncoder=Nn;var Un=class{constructor(){this.name="cborEncoder",this.priority=-90}match(t){return typeof t=="object"&&typeof t.toCBOR=="function"}encode(t){return t.toCBOR()}};Fe.ToCborEncoder=Un;var Rn=class{constructor(){this._encoders=new Set}static withDefaultEncoders(t=!1){let e=new this;return e.addEncoder(new Nn(e,t)),e.addEncoder(new Un),e}removeEncoder(t){for(let e of this._encoders.values())e.name==t&&this._encoders.delete(e)}addEncoder(t){this._encoders.add(t)}getEncoderFor(t){let e=null;for(let n of this._encoders)(!e||n.priority>e.priority)&&n.match(t)&&(e=n);if(e===null)throw new Error("Could not find an encoder for value.");return e}serializeValue(t){return this.getEncoderFor(t).encode(t)}serialize(t){return this.serializeValue(t)}};Fe.CborSerializer=Rn;var Ss=class extends Rn{serialize(t){return oe.raw(new Uint8Array([...new Uint8Array([217,217,247]),...new Uint8Array(super.serializeValue(t))]))}};Fe.SelfDescribeCborSerializer=Ss});var jr=vt(je=>{"use strict";function Vl(r){for(var t in r)je.hasOwnProperty(t)||(je[t]=r[t])}var ql=je&&je.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)Object.hasOwnProperty.call(r,e)&&(t[e]=r[e]);return t.default=r,t};Object.defineProperty(je,"__esModule",{value:!0});Vl(Wa());var Hl=ql(vs());je.value=Hl});function za(r){let t=r.byteLength,e=BigInt(0);for(let n=0;n<t;n++)e=e*BigInt(256)+BigInt(r[n]);return e}function Fn(r){let t=new Uint8Array(r),e=new Rs({size:t.byteLength,tags:{2:n=>za(n),3:n=>-za(n),[Us.Semantic]:n=>n}});try{return e.decodeFirst(t)}catch(n){throw new Error(`Failed to decode CBOR: ${n}, input: ${Bt(t)}`)}}var Ya,De,Xa,Bs,Is,Ns,Fs,Us,Rs,Dr=ut(()=>{Ya=ve(vn()),De=ve(jr()),Xa=ve(jr());Jt();Bs=class{get name(){return"Principal"}get priority(){return 0}match(t){return t&&t._isPrincipal===!0}encode(t){return De.value.bytes(t.toUint8Array())}},Is=class{get name(){return"Buffer"}get priority(){return 1}match(t){return t instanceof ArrayBuffer||ArrayBuffer.isView(t)}encode(t){return De.value.bytes(new Uint8Array(t))}},Ns=class{get name(){return"BigInt"}get priority(){return 1}match(t){return typeof t=="bigint"}encode(t){return t>BigInt(0)?De.value.tagged(2,De.value.bytes(Kt(t.toString(16)))):De.value.tagged(3,De.value.bytes(Kt((BigInt("-1")*t).toString(16))))}},Fs=Xa.SelfDescribeCborSerializer.withDefaultEncoders(!0);Fs.addEncoder(new Bs);Fs.addEncoder(new Is);Fs.addEncoder(new Ns);(function(r){r[r.Uint64LittleEndian=71]="Uint64LittleEndian",r[r.Semantic=55799]="Semantic"})(Us||(Us={}));Rs=class extends Ya.default.Decoder{createByteString(t){return pe(...t)}createByteStringFromHeap(t,e){return t===e?new ArrayBuffer(0):new Uint8Array(this._heap.slice(t,e))}}});function ks(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Ms(r){if(!ks(r))throw new Error("Uint8Array expected")}function Pn(r,t){if(typeof t!="boolean")throw new Error(`${r} must be valid boolean, got "${t}".`)}function kn(r){Ms(r);let t="";for(let e=0;e<r.length;e++)t+=Kl[r[e]];return t}function ec(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}function Za(r){if(r>=Ae._0&&r<=Ae._9)return r-Ae._0;if(r>=Ae._A&&r<=Ae._F)return r-(Ae._A-10);if(r>=Ae._a&&r<=Ae._f)return r-(Ae._a-10)}function rc(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(e);for(let i=0,s=0;i<e;i++,s+=2){let o=Za(r.charCodeAt(s)),c=Za(r.charCodeAt(s+1));if(o===void 0||c===void 0){let u=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+s)}n[i]=o*16+c}return n}function nc(r){return ec(kn(r))}function xr(r){return Ms(r),ec(kn(Uint8Array.from(r).reverse()))}function Cs(r,t){return rc(r.toString(16).padStart(t*2,"0"))}function zr(r,t){return Cs(r,t).reverse()}function we(r,t,e){let n;if(typeof t=="string")try{n=rc(t)}catch(s){throw new Error(`${r} must be valid hex string, got "${t}". Cause: ${s}`)}else if(ks(t))n=Uint8Array.from(t);else throw new Error(`${r} must be hex string or Uint8Array`);let i=n.length;if(typeof e=="number"&&i!==e)throw new Error(`${r} expected ${e} bytes, got ${i}`);return n}function $s(...r){let t=0;for(let n=0;n<r.length;n++){let i=r[n];Ms(i),t+=i.length}let e=new Uint8Array(t);for(let n=0,i=0;n<r.length;n++){let s=r[n];e.set(s,i),i+=s.length}return e}function jl(r,t,e){return Ps(r)&&Ps(t)&&Ps(e)&&t<=r&&r<e}function _r(r,t,e,n){if(!jl(t,e,n))throw new Error(`expected valid ${r}: ${e} <= n < ${n}, got ${typeof t} ${t}`)}function ic(r){let t;for(t=0;r>Qa;r>>=tc,t+=1);return t}function br(r,t,e={}){let n=(i,s,o)=>{let c=Dl[s];if(typeof c!="function")throw new Error(`Invalid validator "${s}", expected function`);let u=r[i];if(!(o&&u===void 0)&&!c(u,r))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${s}`)};for(let[i,s]of Object.entries(t))n(i,s,!1);for(let[i,s]of Object.entries(e))n(i,s,!0);return r}function Vs(r){let t=new WeakMap;return(e,...n)=>{let i=t.get(e);if(i!==void 0)return i;let s=r(e,...n);return t.set(e,s),s}}var Qa,tc,Gl,Kl,Ae,Ps,sc,Dl,Yr=ut(()=>{Qa=BigInt(0),tc=BigInt(1),Gl=BigInt(2);Kl=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));Ae={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};Ps=r=>typeof r=="bigint"&&Qa<=r;sc=r=>(Gl<<BigInt(r-1))-tc,Dl={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"||ks(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)}});function Et(r,t){let e=r%t;return e>=Rt?e:t+e}function Jl(r,t,e){if(e<=Rt||t<Rt)throw new Error("Expected power/modulo > 0");if(e===bt)return Rt;let n=bt;for(;t>Rt;)t&bt&&(n=n*r%e),r=r*r%e,t>>=bt;return n}function ae(r,t,e){let n=r;for(;t-- >Rt;)n*=n,n%=e;return n}function cc(r,t){if(r===Rt||t<=Rt)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=Et(r,t),n=t,i=Rt,s=bt,o=bt,c=Rt;for(;e!==Rt;){let y=n/e,w=n%e,g=i-o*y,N=s-c*y;n=e,e=w,i=o,s=c,o=g,c=N}if(n!==bt)throw new Error("invert: does not exist");return Et(i,t)}function Zl(r){let t=(r-bt)/We,e,n,i;for(e=r-bt,n=0;e%We===Rt;e/=We,n++);for(i=We;i<r&&Jl(i,t,r)!==r-bt;i++);if(n===1){let o=(r+bt)/qs;return function(u,y){let w=u.pow(y,o);if(!u.eql(u.sqr(w),y))throw new Error("Cannot find square root");return w}}let s=(e+bt)/We;return function(c,u){if(c.pow(u,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let y=n,w=c.pow(c.mul(c.ONE,i),e),g=c.pow(u,s),N=c.pow(u,e);for(;!c.eql(N,c.ONE);){if(c.eql(N,c.ZERO))return c.ZERO;let k=1;for(let G=c.sqr(N);k<y&&!c.eql(G,c.ONE);k++)G=c.sqr(G);let O=c.pow(w,bt<<BigInt(y-k-1));w=c.sqr(O),g=c.mul(g,O),N=c.mul(N,w),y=k}return g}}function Ql(r){if(r%qs===zl){let t=(r+bt)/qs;return function(n,i){let s=n.pow(i,t);if(!n.eql(n.sqr(s),i))throw new Error("Cannot find square root");return s}}if(r%ac===oc){let t=(r-oc)/ac;return function(n,i){let s=n.mul(i,We),o=n.pow(s,t),c=n.mul(i,o),u=n.mul(n.mul(c,We),o),y=n.mul(c,n.sub(u,n.ONE));if(!n.eql(n.sqr(y),i))throw new Error("Cannot find square root");return y}}return r%Xl,Zl(r)}function fc(r){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=th.reduce((n,i)=>(n[i]="function",n),t);return br(r,e)}function eh(r,t,e){if(e<Rt)throw new Error("Expected power > 0");if(e===Rt)return r.ONE;if(e===bt)return t;let n=r.ONE,i=t;for(;e>Rt;)e&bt&&(n=r.mul(n,i)),i=r.sqr(i),e>>=bt;return n}function rh(r,t){let e=new Array(t.length),n=t.reduce((s,o,c)=>r.is0(o)?s:(e[c]=s,r.mul(s,o)),r.ONE),i=r.inv(n);return t.reduceRight((s,o,c)=>r.is0(o)?s:(e[c]=r.mul(s,e[c]),r.mul(s,o)),i),e}function Hs(r,t){let e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function Mn(r,t,e=!1,n={}){if(r<=Rt)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:i,nByteLength:s}=Hs(r,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let o=Ql(r),c=Object.freeze({ORDER:r,BITS:i,BYTES:s,MASK:sc(i),ZERO:Rt,ONE:bt,create:u=>Et(u,r),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return Rt<=u&&u<r},is0:u=>u===Rt,isOdd:u=>(u&bt)===bt,neg:u=>Et(-u,r),eql:(u,y)=>u===y,sqr:u=>Et(u*u,r),add:(u,y)=>Et(u+y,r),sub:(u,y)=>Et(u-y,r),mul:(u,y)=>Et(u*y,r),pow:(u,y)=>eh(c,u,y),div:(u,y)=>Et(u*cc(y,r),r),sqrN:u=>u*u,addN:(u,y)=>u+y,subN:(u,y)=>u-y,mulN:(u,y)=>u*y,inv:u=>cc(u,r),sqrt:n.sqrt||(u=>o(c,u)),invertBatch:u=>rh(c,u),cmov:(u,y,w)=>w?y:u,toBytes:u=>e?zr(u,s):Cs(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return e?xr(u):nc(u)}});return Object.freeze(c)}var Rt,bt,We,zl,qs,oc,ac,Yl,Xl,uc,th,Cn=ut(()=>{Yr();Rt=BigInt(0),bt=BigInt(1),We=BigInt(2),zl=BigInt(3),qs=BigInt(4),oc=BigInt(5),ac=BigInt(8),Yl=BigInt(9),Xl=BigInt(16);uc=(r,t)=>(Et(r,t)&bt)===bt,th=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"]});function hc(r,t){let e=(s,o)=>{let c=o.negate();return s?c:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>t)throw new Error(`Wrong window size=${s}, should be [1..${t}]`)},i=s=>{n(s);let o=Math.ceil(t/s)+1,c=2**(s-1);return{windows:o,windowSize:c}};return{constTimeNegate:e,unsafeLadder(s,o){let c=r.ZERO,u=s;for(;o>nh;)o&Ls&&(c=c.add(u)),u=u.double(),o>>=Ls;return c},precomputeWindow(s,o){let{windows:c,windowSize:u}=i(o),y=[],w=s,g=w;for(let N=0;N<c;N++){g=w,y.push(g);for(let k=1;k<u;k++)g=g.add(w),y.push(g);w=g.double()}return y},wNAF(s,o,c){let{windows:u,windowSize:y}=i(s),w=r.ZERO,g=r.BASE,N=BigInt(2**s-1),k=2**s,O=BigInt(s);for(let G=0;G<u;G++){let ft=G*y,D=Number(c&N);c>>=O,D>y&&(D-=k,c+=Ls);let Mt=ft,C=ft+Math.abs(D)-1,lt=G%2!==0,V=D<0;D===0?g=g.add(e(lt,o[Mt])):w=w.add(e(V,o[C]))}return{p:w,f:g}},wNAFCached(s,o,c){let u=lc.get(s)||1,y=Gs.get(s);return y||(y=this.precomputeWindow(s,u),u!==1&&Gs.set(s,c(y))),this.wNAF(u,y,o)},setWindowSize(s,o){n(o),lc.set(s,o),Gs.delete(s)}}}function dc(r,t,e,n){if(!Array.isArray(e)||!Array.isArray(n)||n.length!==e.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((w,g)=>{if(!t.isValid(w))throw new Error(`wrong scalar at index ${g}`)}),e.forEach((w,g)=>{if(!(w instanceof r))throw new Error(`wrong point at index ${g}`)});let i=ic(BigInt(e.length)),s=i>12?i-3:i>4?i-2:i?2:1,o=(1<<s)-1,c=new Array(o+1).fill(r.ZERO),u=Math.floor((t.BITS-1)/s)*s,y=r.ZERO;for(let w=u;w>=0;w-=s){c.fill(r.ZERO);for(let N=0;N<n.length;N++){let k=n[N],O=Number(k>>BigInt(w)&BigInt(o));c[O]=c[O].add(e[N])}let g=r.ZERO;for(let N=c.length-1,k=r.ZERO;N>0;N--)k=k.add(c[N]),g=g.add(k);if(y=y.add(g),w!==0)for(let N=0;N<s;N++)y=y.double()}return y}function pc(r){return fc(r.Fp),br(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Hs(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}var nh,Ls,Gs,lc,wc=ut(()=>{Cn();Yr();nh=BigInt(0),Ls=BigInt(1),Gs=new WeakMap,lc=new WeakMap});var Ks=ut(()=>{Jt()});var $n=ut(()=>{lr()});var sh,yc,gw,Vn,mc,Er=ut(()=>{Dr();or();Gr();Jt();ee();Ks();$n();(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"})(yc||(yc={}));sh=new WeakMap;gw=Kt("308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c05030201036100");(function(r){r.Unknown="unknown",r.Absent="absent",r.Found="found"})(Vn||(Vn={}));(function(r){r.Less="less",r.Greater="greater"})(mc||(mc={}))});var qn=ut(()=>{ee();or();Er();Jt();Dr();$n()});var h0=ve(Bo());var Ti;(function(r){r[r.SysFatal=1]="SysFatal",r[r.SysTransient=2]="SysTransient",r[r.DestinationInvalid=3]="DestinationInvalid",r[r.CanisterReject=4]="CanisterReject",r[r.CanisterError=5]="CanisterError"})(Ti||(Ti={}));ee();or();ee();Gr();Jt();var Al=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e},Tl=new TextEncoder().encode(`
|
|
2
|
+
ic-request`),be=class{getPrincipal(){return this._principal||(this._principal=St.selfAuthenticating(new Uint8Array(this.getPublicKey().toDer()))),this._principal}async transformRequest(t){let{body:e}=t,n=Al(t,["body"]),i=await yr(e);return Object.assign(Object.assign({},n),{body:{content:e,sender_pubkey:this.getPublicKey().toDer(),sender_sig:await this.sign(pe(Tl,i))}})}},mr=class{getPrincipal(){return St.anonymous()}async transformRequest(t){return Object.assign(Object.assign({},t),{body:{content:t.body}})}};Dr();Gr();Jt();lr();var Ll=ve(jr());var Os;(function(r){r.Call="call"})(Os||(Os={}));var Qp=BigInt(1e6),tw=60*1e3;function Wr(r){let t=[];return r.forEach((e,n)=>{t.push([n,e])}),t}or();var gr=class extends Dt{constructor(t,e){super(t),this.response=e,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}};qn();Er();Ni();var Hn=BigInt(4294967295),js=BigInt(32);function Ec(r,t=!1){return t?{h:Number(r&Hn),l:Number(r>>js&Hn)}:{h:Number(r>>js&Hn)|0,l:Number(r&Hn)|0}}function ah(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let i=0;i<r.length;i++){let{h:s,l:o}=Ec(r[i],t);[e[i],n[i]]=[s,o]}return[e,n]}var ch=(r,t)=>BigInt(r>>>0)<<js|BigInt(t>>>0),uh=(r,t,e)=>r>>>e,fh=(r,t,e)=>r<<32-e|t>>>e,lh=(r,t,e)=>r>>>e|t<<32-e,hh=(r,t,e)=>r<<32-e|t>>>e,dh=(r,t,e)=>r<<64-e|t>>>e-32,ph=(r,t,e)=>r>>>e-32|t<<64-e,wh=(r,t)=>t,yh=(r,t)=>r,mh=(r,t,e)=>r<<e|t>>>32-e,gh=(r,t,e)=>t<<e|r>>>32-e,xh=(r,t,e)=>t<<e-32|r>>>64-e,_h=(r,t,e)=>r<<e-32|t>>>64-e;function bh(r,t,e,n){let i=(t>>>0)+(n>>>0);return{h:r+e+(i/2**32|0)|0,l:i|0}}var Eh=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),Ah=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,Th=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),vh=(r,t,e,n,i)=>t+e+n+i+(r/2**32|0)|0,Sh=(r,t,e,n,i)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(i>>>0),Bh=(r,t,e,n,i,s)=>t+e+n+i+s+(r/2**32|0)|0;var Ih={fromBig:Ec,split:ah,toBig:ch,shrSH:uh,shrSL:fh,rotrSH:lh,rotrSL:hh,rotrBH:dh,rotrBL:ph,rotr32H:wh,rotr32L:yh,rotlSH:mh,rotlSL:gh,rotlBH:xh,rotlBL:_h,add:bh,add3L:Eh,add3H:Ah,add4L:Th,add4H:vh,add5H:Bh,add5L:Sh},j=Ih;Or();var[Nh,Uh]=j.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),Oe=new Uint32Array(80),Pe=new Uint32Array(80),Ds=class extends sr{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:n,Bl:i,Ch:s,Cl:o,Dh:c,Dl:u,Eh:y,El:w,Fh:g,Fl:N,Gh:k,Gl:O,Hh:G,Hl:ft}=this;return[t,e,n,i,s,o,c,u,y,w,g,N,k,O,G,ft]}set(t,e,n,i,s,o,c,u,y,w,g,N,k,O,G,ft){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=c|0,this.Dl=u|0,this.Eh=y|0,this.El=w|0,this.Fh=g|0,this.Fl=N|0,this.Gh=k|0,this.Gl=O|0,this.Hh=G|0,this.Hl=ft|0}process(t,e){for(let C=0;C<16;C++,e+=4)Oe[C]=t.getUint32(e),Pe[C]=t.getUint32(e+=4);for(let C=16;C<80;C++){let lt=Oe[C-15]|0,V=Pe[C-15]|0,q=j.rotrSH(lt,V,1)^j.rotrSH(lt,V,8)^j.shrSH(lt,V,7),rt=j.rotrSL(lt,V,1)^j.rotrSL(lt,V,8)^j.shrSL(lt,V,7),J=Oe[C-2]|0,U=Pe[C-2]|0,st=j.rotrSH(J,U,19)^j.rotrBH(J,U,61)^j.shrSH(J,U,6),tt=j.rotrSL(J,U,19)^j.rotrBL(J,U,61)^j.shrSL(J,U,6),it=j.add4L(rt,tt,Pe[C-7],Pe[C-16]),yt=j.add4H(it,q,st,Oe[C-7],Oe[C-16]);Oe[C]=yt|0,Pe[C]=it|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:c,Cl:u,Dh:y,Dl:w,Eh:g,El:N,Fh:k,Fl:O,Gh:G,Gl:ft,Hh:D,Hl:Mt}=this;for(let C=0;C<80;C++){let lt=j.rotrSH(g,N,14)^j.rotrSH(g,N,18)^j.rotrBH(g,N,41),V=j.rotrSL(g,N,14)^j.rotrSL(g,N,18)^j.rotrBL(g,N,41),q=g&k^~g&G,rt=N&O^~N&ft,J=j.add5L(Mt,V,rt,Uh[C],Pe[C]),U=j.add5H(J,D,lt,q,Nh[C],Oe[C]),st=J|0,tt=j.rotrSH(n,i,28)^j.rotrBH(n,i,34)^j.rotrBH(n,i,39),it=j.rotrSL(n,i,28)^j.rotrBL(n,i,34)^j.rotrBL(n,i,39),yt=n&s^n&c^s&c,It=i&o^i&u^o&u;D=G|0,Mt=ft|0,G=k|0,ft=O|0,k=g|0,O=N|0,{h:g,l:N}=j.add(y|0,w|0,U|0,st|0),y=c|0,w=u|0,c=s|0,u=o|0,s=n|0,o=i|0;let Ct=j.add3L(st,it,It);n=j.add3H(Ct,U,tt,yt),i=Ct|0}({h:n,l:i}=j.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=j.add(this.Bh|0,this.Bl|0,s|0,o|0),{h:c,l:u}=j.add(this.Ch|0,this.Cl|0,c|0,u|0),{h:y,l:w}=j.add(this.Dh|0,this.Dl|0,y|0,w|0),{h:g,l:N}=j.add(this.Eh|0,this.El|0,g|0,N|0),{h:k,l:O}=j.add(this.Fh|0,this.Fl|0,k|0,O|0),{h:G,l:ft}=j.add(this.Gh|0,this.Gl|0,G|0,ft|0),{h:D,l:Mt}=j.add(this.Hh|0,this.Hl|0,D|0,Mt|0),this.set(n,i,s,o,c,u,y,w,g,N,k,O,G,ft,D,Mt)}roundClean(){Oe.fill(0),Pe.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var Ac=Fr(()=>new Ds);Or();wc();Cn();Yr();Yr();var ce=BigInt(0),jt=BigInt(1),Ln=BigInt(2),Rh=BigInt(8),Fh={zip215:!0};function Oh(r){let t=pc(r);return br(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function Tc(r){let t=Oh(r),{Fp:e,n,prehash:i,hash:s,randomBytes:o,nByteLength:c,h:u}=t,y=Ln<<BigInt(c*8)-jt,w=e.create,g=Mn(t.n,t.nBitLength),N=t.uvRatio||((L,R)=>{try{return{isValid:!0,value:e.sqrt(L*e.inv(R))}}catch{return{isValid:!1,value:ce}}}),k=t.adjustScalarBytes||(L=>L),O=t.domain||((L,R,P)=>{if(Pn("phflag",P),R.length||P)throw new Error("Contexts/pre-hash are not supported");return L});function G(L,R){_r("coordinate "+L,R,ce,y)}function ft(L){if(!(L instanceof C))throw new Error("ExtendedPoint expected")}let D=Vs((L,R)=>{let{ex:P,ey:K,ez:z}=L,W=L.is0();R==null&&(R=W?Rh:e.inv(z));let nt=w(P*R),B=w(K*R),h=w(z*R);if(W)return{x:ce,y:jt};if(h!==jt)throw new Error("invZ was invalid");return{x:nt,y:B}}),Mt=Vs(L=>{let{a:R,d:P}=t;if(L.is0())throw new Error("bad point: ZERO");let{ex:K,ey:z,ez:W,et:nt}=L,B=w(K*K),h=w(z*z),at=w(W*W),mt=w(at*at),ct=w(B*R),M=w(at*w(ct+h)),a=w(mt+w(P*w(B*h)));if(M!==a)throw new Error("bad point: equation left != right (1)");let f=w(K*z),l=w(W*nt);if(f!==l)throw new Error("bad point: equation left != right (2)");return!0});class C{constructor(R,P,K,z){this.ex=R,this.ey=P,this.ez=K,this.et=z,G("x",R),G("y",P),G("z",K),G("t",z),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(R){if(R instanceof C)throw new Error("extended point not allowed");let{x:P,y:K}=R||{};return G("x",P),G("y",K),new C(P,K,jt,w(P*K))}static normalizeZ(R){let P=e.invertBatch(R.map(K=>K.ez));return R.map((K,z)=>K.toAffine(P[z])).map(C.fromAffine)}static msm(R,P){return dc(C,g,R,P)}_setWindowSize(R){q.setWindowSize(this,R)}assertValidity(){Mt(this)}equals(R){ft(R);let{ex:P,ey:K,ez:z}=this,{ex:W,ey:nt,ez:B}=R,h=w(P*B),at=w(W*z),mt=w(K*B),ct=w(nt*z);return h===at&&mt===ct}is0(){return this.equals(C.ZERO)}negate(){return new C(w(-this.ex),this.ey,this.ez,w(-this.et))}double(){let{a:R}=t,{ex:P,ey:K,ez:z}=this,W=w(P*P),nt=w(K*K),B=w(Ln*w(z*z)),h=w(R*W),at=P+K,mt=w(w(at*at)-W-nt),ct=h+nt,M=ct-B,a=h-nt,f=w(mt*M),l=w(ct*a),b=w(mt*a),m=w(M*ct);return new C(f,l,m,b)}add(R){ft(R);let{a:P,d:K}=t,{ex:z,ey:W,ez:nt,et:B}=this,{ex:h,ey:at,ez:mt,et:ct}=R;if(P===BigInt(-1)){let I=w((W-z)*(at+h)),F=w((W+z)*(at-h)),$=w(F-I);if($===ce)return this.double();let X=w(nt*Ln*ct),dt=w(B*Ln*mt),gt=dt+X,Y=F+I,H=dt-X,At=w(gt*$),Te=w(Y*H),$e=w(gt*H),Ve=w($*Y);return new C(At,Te,Ve,$e)}let M=w(z*h),a=w(W*at),f=w(B*K*ct),l=w(nt*mt),b=w((z+W)*(h+at)-M-a),m=l-f,_=l+f,T=w(a-P*M),d=w(b*m),x=w(_*T),A=w(b*T),E=w(m*_);return new C(d,x,E,A)}subtract(R){return this.add(R.negate())}wNAF(R){return q.wNAFCached(this,R,C.normalizeZ)}multiply(R){let P=R;_r("scalar",P,jt,n);let{p:K,f:z}=this.wNAF(P);return C.normalizeZ([K,z])[0]}multiplyUnsafe(R){let P=R;return _r("scalar",P,ce,n),P===ce?V:this.equals(V)||P===jt?this:this.equals(lt)?this.wNAF(P).p:q.unsafeLadder(this,P)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}isTorsionFree(){return q.unsafeLadder(this,n).is0()}toAffine(R){return D(this,R)}clearCofactor(){let{h:R}=t;return R===jt?this:this.multiplyUnsafe(R)}static fromHex(R,P=!1){let{d:K,a:z}=t,W=e.BYTES;R=we("pointHex",R,W),Pn("zip215",P);let nt=R.slice(),B=R[W-1];nt[W-1]=B&-129;let h=xr(nt),at=P?y:e.ORDER;_r("pointHex.y",h,ce,at);let mt=w(h*h),ct=w(mt-jt),M=w(K*mt-z),{isValid:a,value:f}=N(ct,M);if(!a)throw new Error("Point.fromHex: invalid y coordinate");let l=(f&jt)===jt,b=(B&128)!==0;if(!P&&f===ce&&b)throw new Error("Point.fromHex: x=0 and x_0=1");return b!==l&&(f=w(-f)),C.fromAffine({x:f,y:h})}static fromPrivateKey(R){return U(R).point}toRawBytes(){let{x:R,y:P}=this.toAffine(),K=zr(P,e.BYTES);return K[K.length-1]|=R&jt?128:0,K}toHex(){return kn(this.toRawBytes())}}C.BASE=new C(t.Gx,t.Gy,jt,w(t.Gx*t.Gy)),C.ZERO=new C(ce,jt,jt,ce);let{BASE:lt,ZERO:V}=C,q=hc(C,c*8);function rt(L){return Et(L,n)}function J(L){return rt(xr(L))}function U(L){let R=c;L=we("private key",L,R);let P=we("hashed private key",s(L),2*R),K=k(P.slice(0,R)),z=P.slice(R,2*R),W=J(K),nt=lt.multiply(W),B=nt.toRawBytes();return{head:K,prefix:z,scalar:W,point:nt,pointBytes:B}}function st(L){return U(L).pointBytes}function tt(L=new Uint8Array,...R){let P=$s(...R);return J(s(O(P,we("context",L),!!i)))}function it(L,R,P={}){L=we("message",L),i&&(L=i(L));let{prefix:K,scalar:z,pointBytes:W}=U(R),nt=tt(P.context,K,L),B=lt.multiply(nt).toRawBytes(),h=tt(P.context,B,W,L),at=rt(nt+h*z);_r("signature.s",at,ce,n);let mt=$s(B,zr(at,e.BYTES));return we("result",mt,c*2)}let yt=Fh;function It(L,R,P,K=yt){let{context:z,zip215:W}=K,nt=e.BYTES;L=we("signature",L,2*nt),R=we("message",R),W!==void 0&&Pn("zip215",W),i&&(R=i(R));let B=xr(L.slice(nt,2*nt)),h,at,mt;try{h=C.fromHex(P,W),at=C.fromHex(L.slice(0,nt),W),mt=lt.multiplyUnsafe(B)}catch{return!1}if(!W&&h.isSmallOrder())return!1;let ct=tt(z,at.toRawBytes(),h.toRawBytes(),R);return at.add(h.multiplyUnsafe(ct)).subtract(mt).clearCofactor().equals(C.ZERO)}return lt._setWindowSize(8),{CURVE:t,getPublicKey:st,sign:it,verify:It,ExtendedPoint:C,utils:{getExtendedPublicKey:U,randomPrivateKey:()=>o(e.BYTES),precompute(L=8,R=C.BASE){return R._setWindowSize(L),R.multiply(BigInt(3)),R}}}}Cn();var Ws=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),vc=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Gw=BigInt(0),Ph=BigInt(1),Sc=BigInt(2),Kw=BigInt(3),kh=BigInt(5),Mh=BigInt(8);function Ch(r){let t=BigInt(10),e=BigInt(20),n=BigInt(40),i=BigInt(80),s=Ws,c=r*r%s*r%s,u=ae(c,Sc,s)*c%s,y=ae(u,Ph,s)*r%s,w=ae(y,kh,s)*y%s,g=ae(w,t,s)*w%s,N=ae(g,e,s)*g%s,k=ae(N,n,s)*N%s,O=ae(k,i,s)*k%s,G=ae(O,i,s)*k%s,ft=ae(G,t,s)*w%s;return{pow_p_5_8:ae(ft,Sc,s)*r%s,b2:c}}function $h(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function Vh(r,t){let e=Ws,n=Et(t*t*t,e),i=Et(n*n*t,e),s=Ch(r*i).pow_p_5_8,o=Et(r*n*s,e),c=Et(t*o*o,e),u=o,y=Et(o*vc,e),w=c===r,g=c===Et(-r,e),N=c===Et(-r*vc,e);return w&&(o=u),(g||N)&&(o=y),uc(o,e)&&(o=Et(-o,e)),{isValid:w||g,value:o}}var qh=Mn(Ws,void 0,!0),Hh={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:qh,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:Mh,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Ac,randomBytes:Mo,adjustScalarBytes:$h,uvRatio:Vh},Ar=Tc(Hh);var Lh,Gh,Kh,jh;Lh=new WeakMap,Gh=new WeakMap,Kh=Symbol.iterator,jh=Symbol.toStringTag;Jt();var Bc=r=>{if(r<=127)return 1;if(r<=255)return 2;if(r<=65535)return 3;if(r<=16777215)return 4;throw new Error("Length too long (> 4 bytes)")},Ic=(r,t,e)=>{if(e<=127)return r[t]=e,1;if(e<=255)return r[t]=129,r[t+1]=e,2;if(e<=65535)return r[t]=130,r[t+1]=e>>8,r[t+2]=e,3;if(e<=16777215)return r[t]=131,r[t+1]=e>>16,r[t+2]=e>>8,r[t+3]=e,4;throw new Error("Length too long (> 4 bytes)")},zs=(r,t)=>{if(r[t]<128)return 1;if(r[t]===128)throw new Error("Invalid length 0");if(r[t]===129)return 2;if(r[t]===130)return 3;if(r[t]===131)return 4;throw new Error("Length too long (> 4 bytes)")},Dh=(r,t)=>{let e=zs(r,t);if(e===1)return r[t];if(e===2)return r[t+1];if(e===3)return(r[t+1]<<8)+r[t+2];if(e===4)return(r[t+1]<<16)+(r[t+2]<<8)+r[t+3];throw new Error("Length too long (> 4 bytes)")},Nc=Uint8Array.from([48,12,6,10,43,6,1,4,1,131,184,67,1,1]),ze=Uint8Array.from([48,5,6,3,43,101,112]),zw=Uint8Array.from([48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10]);function Tr(r,t){let e=2+Bc(r.byteLength+1),n=t.byteLength+e+r.byteLength,i=0,s=new Uint8Array(1+Bc(n)+n);return s[i++]=48,i+=Ic(s,i,n),s.set(t,i),i+=t.byteLength,s[i++]=3,i+=Ic(s,i,r.byteLength+1),s[i++]=0,s.set(new Uint8Array(r),i),s}var Xr=(r,t)=>{let e=0,n=(c,u)=>{if(i[e++]!==c)throw new Error("Expected: "+u)},i=new Uint8Array(r);if(n(48,"sequence"),e+=zs(i,e),!Lr(i.slice(e,e+t.byteLength),t))throw new Error("Not the expected OID.");e+=t.byteLength,n(3,"bit string");let s=Dh(i,e)-1;e+=zs(i,e),n(0,"0 padding");let o=i.slice(e);if(s!==o.length)throw new Error(`DER payload mismatch: Expected length ${s} actual length ${o.length}`);return o};var Uc=function(r,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!i:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,e):i?i.value=e:t.set(r,e),e},Rc=function(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)},Gn,Kn,jn=class r{constructor(t){if(Gn.set(this,void 0),Kn.set(this,void 0),t.byteLength!==r.RAW_KEY_LENGTH)throw new Error("An Ed25519 public key must be exactly 32bytes long");Uc(this,Gn,t,"f"),Uc(this,Kn,r.derEncode(t),"f")}static from(t){return this.fromDer(t.toDer())}static fromRaw(t){return new r(t)}static fromDer(t){return new r(this.derDecode(t))}static derEncode(t){return Tr(t,ze).buffer}static derDecode(t){let e=Xr(t,ze);if(e.length!==this.RAW_KEY_LENGTH)throw new Error("An Ed25519 public key must be exactly 32bytes long");return e}get rawKey(){return Rc(this,Gn,"f")}get derKey(){return Rc(this,Kn,"f")}toDer(){return this.derKey}toRaw(){return this.rawKey}};Gn=new WeakMap,Kn=new WeakMap;jn.RAW_KEY_LENGTH=32;$n();var ye=function(r,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!i:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,e):i?i.value=e:t.set(r,e),e},$t=function(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)},me,Dn,Wn,zn,Yn,Xn,Jn,Zn,vr;var Qn=class r{constructor(t=r.default){me.set(this,void 0),Dn.set(this,void 0),Wn.set(this,void 0),zn.set(this,void 0),Yn.set(this,void 0),Xn.set(this,void 0),Jn.set(this,void 0),Zn.set(this,void 0),vr.set(this,0);let{initialInterval:e=500,randomizationFactor:n=.5,multiplier:i=1.5,maxInterval:s=6e4,maxElapsedTime:o=9e5,maxIterations:c=10,date:u=Date}=t;ye(this,me,e,"f"),ye(this,Dn,n,"f"),ye(this,Wn,i,"f"),ye(this,zn,s,"f"),ye(this,Zn,u,"f"),ye(this,Yn,u.now(),"f"),ye(this,Xn,o,"f"),ye(this,Jn,c,"f")}get ellapsedTimeInMsec(){return $t(this,Zn,"f").now()-$t(this,Yn,"f")}get currentInterval(){return $t(this,me,"f")}get count(){return $t(this,vr,"f")}get randomValueFromInterval(){let t=$t(this,Dn,"f")*$t(this,me,"f"),e=$t(this,me,"f")-t,n=$t(this,me,"f")+t;return Math.random()*(n-e)+e}incrementCurrentInterval(){var t;return ye(this,me,Math.min($t(this,me,"f")*$t(this,Wn,"f"),$t(this,zn,"f")),"f"),ye(this,vr,(t=$t(this,vr,"f"),t++,t),"f"),$t(this,me,"f")}next(){return this.ellapsedTimeInMsec>=$t(this,Xn,"f")||$t(this,vr,"f")>=$t(this,Jn,"f")?null:(this.incrementCurrentInterval(),this.randomValueFromInterval)}};me=new WeakMap,Dn=new WeakMap,Wn=new WeakMap,zn=new WeakMap,Yn=new WeakMap,Xn=new WeakMap,Jn=new WeakMap,Zn=new WeakMap,vr=new WeakMap;Qn.default={initialInterval:500,randomizationFactor:.5,multiplier:1.5,maxInterval:6e4,maxElapsedTime:9e5,maxIterations:10,date:Date};var Vt=function(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)},Jr,zh,Fc,Oc,Yh,Xh,Jh,ke,Zh,Qh,t0,e0,r0,n0,i0,Pc,s0,o0,a0,Ys,Xs;(function(r){r.Received="received",r.Processing="processing",r.Replied="replied",r.Rejected="rejected",r.Unknown="unknown",r.Done="done"})(Xs||(Xs={}));var vy=5*60*1e3;zh=new WeakMap,Fc=new WeakMap,Oc=new WeakMap,Yh=new WeakMap,Xh=new WeakMap,Jh=new WeakMap,ke=new WeakMap,Zh=new WeakMap,Qh=new WeakMap,t0=new WeakMap,e0=new WeakMap,r0=new WeakMap,n0=new WeakMap,i0=new WeakMap,Pc=new WeakMap,a0=new WeakMap,Ys=new WeakMap,Jr=new WeakSet,s0=async function r(t){var e,n;let{ecid:i,transformedRequest:s,body:o,requestId:c,backoff:u,tries:y}=t,w=y===0?0:u.next();if(this.log.print(`fetching "/api/v2/canister/${i.toString()}/query" with tries:`,{tries:y,backoff:u,delay:w}),w===null)throw new Dt(`Timestamp failed to pass the watermark after retrying the configured ${Vt(this,ke,"f")} times. We cannot guarantee the integrity of the response since it could be a replay attack.`);w>0&&await new Promise(O=>setTimeout(O,w));let g;try{this.log.print(`fetching "/api/v2/canister/${i.toString()}/query" with request:`,s);let O=await Vt(this,Fc,"f").call(this,""+new URL(`/api/v2/canister/${i.toString()}/query`,this.host),Object.assign(Object.assign(Object.assign({},Vt(this,Oc,"f")),s.request),{body:o}));if(O.status===200){let G=Fn(await O.arrayBuffer());g=Object.assign(Object.assign({},G),{httpDetails:{ok:O.ok,status:O.status,statusText:O.statusText,headers:Wr(O.headers)},requestId:c})}else throw new gr(`Gateway returned an error:
|
|
3
3
|
Code: ${O.status} (${O.statusText})
|
|
4
4
|
Body: ${await O.text()}
|
|
5
|
-
`,{ok:O.ok,status:O.status,statusText:O.statusText,headers:
|
|
5
|
+
`,{ok:O.ok,status:O.status,statusText:O.statusText,headers:Wr(O.headers)})}catch(O){if(this.log.error("Caught exception while attempting to read state",O),Vt(this,Ys,"f").call(this,O),y<Vt(this,ke,"f"))return this.log.warn(`Caught exception while attempting to make query:
|
|
6
6
|
${O}
|
|
7
|
-
Retrying query.`),await
|
|
8
|
-
${
|
|
9
|
-
Retrying request.`),await
|
|
7
|
+
Retrying query.`),await Vt(this,Jr,"m",r).call(this,Object.assign(Object.assign({},t),{tries:y+1}));throw O}let N=(n=(e=g.signatures)===null||e===void 0?void 0:e[0])===null||n===void 0?void 0:n.timestamp;if(!Vt(this,Pc,"f"))return g;if(!N)throw new Error("Timestamp not found in query response. This suggests a malformed or malicious response.");let k=Number(BigInt(N)/BigInt(1e6));if(this.log.print("watermark and timestamp",{waterMark:this.waterMark,timestamp:k}),Number(this.waterMark)>k){let O=new Dt("Timestamp is below the watermark. Retrying query.");if(this.log.error("Timestamp is below",O,{timestamp:N,waterMark:this.waterMark}),y<Vt(this,ke,"f"))return await Vt(this,Jr,"m",r).call(this,Object.assign(Object.assign({},t),{tries:y+1}));throw new Dt(`Timestamp failed to pass the watermark after retrying the configured ${Vt(this,ke,"f")} times. We cannot guarantee the integrity of the response since it could be a replay attack.`)}return g},o0=async function r(t){let{request:e,backoff:n,tries:i}=t,s=i===0?0:n.next();if(s===null)throw new Dt(`Timestamp failed to pass the watermark after retrying the configured ${Vt(this,ke,"f")} times. We cannot guarantee the integrity of the response since it could be a replay attack.`);s>0&&await new Promise(y=>setTimeout(y,s));let o;try{o=await e()}catch(y){if(Vt(this,ke,"f")>i)return this.log.warn(`Caught exception while attempting to make request:
|
|
8
|
+
${y}
|
|
9
|
+
Retrying request.`),await Vt(this,Jr,"m",r).call(this,{request:e,backoff:n,tries:i+1});throw y}if(o.ok)return o;let c=await o.clone().text();o.status===400&&c.includes("ingress_expiry")&&Vt(this,Ys,"f").call(this,new Dt(c));let u=`Server returned an error:
|
|
10
10
|
Code: ${o.status} (${o.statusText})
|
|
11
11
|
Body: ${c}
|
|
12
|
-
`;if(i<
|
|
13
|
-
Request ID: ${
|
|
12
|
+
`;if(o.status===404&&o.url.includes("api/v3"))throw new gr("v3 api not supported. Fall back to v2",{ok:o.ok,status:o.status,statusText:o.statusText,headers:Wr(o.headers)});if(i<Vt(this,ke,"f"))return await Vt(this,Jr,"m",r).call(this,{request:e,backoff:n,tries:i+1});throw new gr(u,{ok:o.ok,status:o.status,statusText:o.statusText,headers:Wr(o.headers)})};ee();var kc;(function(r){r.Error="err",r.GetPrincipal="gp",r.GetPrincipalResponse="gpr",r.Query="q",r.QueryResponse="qr",r.Call="c",r.CallResponse="cr",r.ReadState="rs",r.ReadStateResponse="rsr",r.Status="s",r.StatusResponse="sr"})(kc||(kc={}));or();lr();Er();Jt();var ti={};Ru(ti,{backoff:()=>Vc,chain:()=>qc,conditionalDelay:()=>Cc,defaultStrategy:()=>Js,maxAttempts:()=>u0,once:()=>Mc,throttle:()=>f0,timeout:()=>$c});Jt();var c0=5*60*1e3;function Js(){return qc(Cc(Mc(),1e3),Vc(1e3,1.2),$c(c0))}function Mc(){let r=!0;return async()=>r?(r=!1,!0):!1}function Cc(r,t){return async(e,n,i)=>{if(await r(e,n,i))return new Promise(s=>setTimeout(s,t))}}function u0(r){let t=r;return async(e,n,i)=>{if(--t<=0)throw new Error(`Failed to retrieve a reply for request after ${r} attempts:
|
|
13
|
+
Request ID: ${Bt(n)}
|
|
14
14
|
Request status: ${i}
|
|
15
|
-
`)}}function
|
|
16
|
-
Request ID: ${
|
|
15
|
+
`)}}function f0(r){return()=>new Promise(t=>setTimeout(t,r))}function $c(r){let t=Date.now()+r;return async(e,n,i)=>{if(Date.now()>t)throw new Error(`Request timed out after ${r} msec:
|
|
16
|
+
Request ID: ${Bt(n)}
|
|
17
17
|
Request status: ${i}
|
|
18
|
-
`)}}function
|
|
19
|
-
ic-request`);function Xs(r){if(typeof r!="string"||r.length<64)throw new Error("Invalid public key.");return Gt(r)}var Tr=class{constructor(t,e,n){this.pubkey=t,this.expiration=e,this.targets=n}toCBOR(){return vr.value.map(Object.assign({pubkey:vr.value.bytes(this.pubkey),expiration:vr.value.u64(this.expiration.toString(16),16)},this.targets&&{targets:vr.value.array(this.targets.map(t=>vr.value.bytes(t.toUint8Array())))}))}toJSON(){return Object.assign({expiration:this.expiration.toString(16),pubkey:Nt(this.pubkey)},this.targets&&{targets:this.targets.map(t=>t.toHex())})}};async function y0(r,t,e,n){let i=new Tr(t.toDer(),BigInt(+e)*BigInt(1e6),n),s=new Uint8Array([...d0,...new Uint8Array(pr(i))]),o=await r.sign(s);return{delegation:i,signature:o}}var Ye=class r{constructor(t,e){this.delegations=t,this.publicKey=e}static async create(t,e,n=new Date(Date.now()+15*60*1e3),i={}){var s,o;let c=await y0(t,e,n,i.targets);return new r([...((s=i.previous)===null||s===void 0?void 0:s.delegations)||[],c],((o=i.previous)===null||o===void 0?void 0:o.publicKey)||t.getPublicKey().toDer())}static fromJSON(t){let{publicKey:e,delegations:n}=typeof t=="string"?JSON.parse(t):t;if(!Array.isArray(n))throw new Error("Invalid delegations.");let i=n.map(s=>{let{delegation:o,signature:c}=s,{pubkey:u,expiration:w,targets:y}=o;if(y!==void 0&&!Array.isArray(y))throw new Error("Invalid targets.");return{delegation:new Tr(Xs(u),BigInt("0x"+w),y&&y.map(m=>{if(typeof m!="string")throw new Error("Invalid target.");return It.fromHex(m)})),signature:Xs(c)}});return new this(i,Xs(e))}static fromDelegations(t,e){return new this(t,e)}toJSON(){return{delegations:this.delegations.map(t=>{let{delegation:e,signature:n}=t,{targets:i}=e;return{delegation:Object.assign({expiration:e.expiration.toString(16),pubkey:Nt(e.pubkey)},i&&{targets:i.map(s=>s.toHex())}),signature:Nt(n)}}),publicKey:Nt(this.publicKey)}}},Jr=class extends be{constructor(t,e){super(),this._inner=t,this._delegation=e}static fromDelegation(t,e){return new this(t,e)}getDelegation(){return this._delegation}getPublicKey(){return{derKey:this._delegation.publicKey,toDer:()=>this._delegation.publicKey}}sign(t){return this._inner.sign(t)}async transformRequest(t){let{body:e}=t,n=h0(t,["body"]),i=await pr(e);return Object.assign(Object.assign({},n),{body:{content:e,sender_sig:await this.sign(new Uint8Array([...p0,...new Uint8Array(i)])),sender_delegation:this._delegation.delegations,sender_pubkey:this._delegation.publicKey}})}},Zr=class r extends ni{constructor(t,e){super(t),ii.set(this,void 0),f0(this,ii,e,"f")}get delegation(){return l0(this,ii,"f")}static fromDelegation(t,e){return new r(t,e)}};ii=new WeakMap;function si(r,t){for(let{delegation:i}of r.delegations)if(+new Date(Number(i.expiration/BigInt(1e6)))<=+Date.now())return!1;let e=[],n=t?.scope;n&&(Array.isArray(n)?e.push(...n.map(i=>typeof i=="string"?It.fromText(i):i)):e.push(typeof n=="string"?It.fromText(n):n));for(let i of e){let s=i.toText();for(let{delegation:o}of r.delegations){if(o.targets===void 0)continue;let c=!0;for(let u of o.targets)if(u.toText()===s){c=!1;break}if(c)return!1}}return!0}var w0=Te(vn());ur();var Mc;(function(r){r[r.ECDSA_WITH_SHA256=-7]="ECDSA_WITH_SHA256"})(Mc||(Mc={}));var Cc=["mousedown","mousemove","keydown","touchstart","wheel"],Qr=class{constructor(t={}){var e;this.callbacks=[],this.idleTimeout=10*60*1e3,this.timeoutID=void 0;let{onIdle:n,idleTimeout:i=10*60*1e3}=t||{};this.callbacks=n?[n]:[],this.idleTimeout=i;let s=this._resetTimer.bind(this);window.addEventListener("load",s,!0),Cc.forEach(function(c){document.addEventListener(c,s,!0)});let o=(c,u)=>{let w;return(...y)=>{let m=this,N=function(){w=void 0,c.apply(m,y)};clearTimeout(w),w=window.setTimeout(N,u)}};if(t?.captureScroll){let c=o(s,(e=t?.scrollDebounce)!==null&&e!==void 0?e:100);window.addEventListener("scroll",c,!0)}s()}static create(t={}){return new this(t)}registerCallback(t){this.callbacks.push(t)}exit(){clearTimeout(this.timeoutID),window.removeEventListener("load",this._resetTimer,!0);let t=this._resetTimer.bind(this);Cc.forEach(function(e){document.removeEventListener(e,t,!0)}),this.callbacks.forEach(e=>e())}_resetTimer(){let t=this.exit.bind(this);window.clearTimeout(this.timeoutID),this.timeoutID=window.setTimeout(t,this.idleTimeout)}};var g0=(r,t)=>t.some(e=>r instanceof e),$c,Vc;function m0(){return $c||($c=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function x0(){return Vc||(Vc=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Lc=new WeakMap,Zs=new WeakMap,qc=new WeakMap,Js=new WeakMap,to=new WeakMap;function _0(r){let t=new Promise((e,n)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{e(me(r.result)),i()},o=()=>{n(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return t.then(e=>{e instanceof IDBCursor&&Lc.set(e,r)}).catch(()=>{}),to.set(t,r),t}function b0(r){if(Zs.has(r))return;let t=new Promise((e,n)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{e(),i()},o=()=>{n(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});Zs.set(r,t)}var Qs={get(r,t,e){if(r instanceof IDBTransaction){if(t==="done")return Zs.get(r);if(t==="objectStoreNames")return r.objectStoreNames||qc.get(r);if(t==="store")return e.objectStoreNames[1]?void 0:e.objectStore(e.objectStoreNames[0])}return me(r[t])},set(r,t,e){return r[t]=e,!0},has(r,t){return r instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in r}};function Hc(r){Qs=r(Qs)}function E0(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...e){let n=r.call(oi(this),t,...e);return qc.set(n,t.sort?t.sort():[t]),me(n)}:x0().includes(r)?function(...t){return r.apply(oi(this),t),me(Lc.get(this))}:function(...t){return me(r.apply(oi(this),t))}}function A0(r){return typeof r=="function"?E0(r):(r instanceof IDBTransaction&&b0(r),g0(r,m0())?new Proxy(r,Qs):r)}function me(r){if(r instanceof IDBRequest)return _0(r);if(Js.has(r))return Js.get(r);let t=A0(r);return t!==r&&(Js.set(r,t),to.set(t,r)),t}var oi=r=>to.get(r);function Kc(r,t,{blocked:e,upgrade:n,blocking:i,terminated:s}={}){let o=indexedDB.open(r,t),c=me(o);return n&&o.addEventListener("upgradeneeded",u=>{n(me(o.result),u.oldVersion,u.newVersion,me(o.transaction),u)}),e&&o.addEventListener("blocked",u=>e(u.oldVersion,u.newVersion,u)),c.then(u=>{s&&u.addEventListener("close",()=>s()),i&&u.addEventListener("versionchange",w=>i(w.oldVersion,w.newVersion,w))}).catch(()=>{}),c}var v0=["get","getKey","getAll","getAllKeys","count"],T0=["put","add","delete","clear"],eo=new Map;function Gc(r,t){if(!(r instanceof IDBDatabase&&!(t in r)&&typeof t=="string"))return;if(eo.get(t))return eo.get(t);let e=t.replace(/FromIndex$/,""),n=t!==e,i=T0.includes(e);if(!(e in(n?IDBIndex:IDBObjectStore).prototype)||!(i||v0.includes(e)))return;let s=async function(o,...c){let u=this.transaction(o,i?"readwrite":"readonly"),w=u.store;return n&&(w=w.index(c.shift())),(await Promise.all([w[e](...c),i&&u.done]))[0]};return eo.set(t,s),s}Hc(r=>({...r,get:(t,e,n)=>Gc(t,e)||r.get(t,e,n),has:(t,e)=>!!Gc(t,e)||r.has(t,e)}));var Dc="auth-client-db",jc="ic-keyval",S0=async(r=Dc,t=jc,e)=>(ai&&(localStorage!=null&&localStorage.getItem(Jt))&&(localStorage.removeItem(Jt),localStorage.removeItem(ue)),await Kc(r,e,{upgrade:n=>{n.objectStoreNames,n.objectStoreNames.contains(t)&&n.clear(t),n.createObjectStore(t)}}));async function B0(r,t,e){return await r.get(t,e)}async function I0(r,t,e,n){return await r.put(t,n,e)}async function N0(r,t,e){return await r.delete(t,e)}var tn=class r{constructor(t,e){this._db=t,this._storeName=e}static async create(t){let{dbName:e=Dc,storeName:n=jc,version:i=Wc}=t??{},s=await S0(e,n,i);return new r(s,n)}async set(t,e){return await I0(this._db,this._storeName,t,e)}async get(t){var e;return(e=await B0(this._db,this._storeName,t))!==null&&e!==void 0?e:null}async remove(t){return await N0(this._db,this._storeName,t)}};var U0=function(r,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!i:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,e):i?i.value=e:t.set(r,e),e},R0=function(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)},ci,ue="identity",Jt="delegation",zc="iv",Wc=1,ai=typeof window<"u",en=class{constructor(t="ic-",e){this.prefix=t,this._localStorage=e}get(t){return Promise.resolve(this._getLocalStorage().getItem(this.prefix+t))}set(t,e){return this._getLocalStorage().setItem(this.prefix+t,e),Promise.resolve()}remove(t){return this._getLocalStorage().removeItem(this.prefix+t),Promise.resolve()}_getLocalStorage(){if(this._localStorage)return this._localStorage;let t=typeof window>"u"?typeof global>"u"?typeof self>"u"?void 0:self.localStorage:global.localStorage:window.localStorage;if(!t)throw new Error("Could not find local storage.");return t}},Xe=class{constructor(t){ci.set(this,void 0),U0(this,ci,t??{},"f")}get _db(){return new Promise(t=>{if(this.initializedDb){t(this.initializedDb);return}tn.create(R0(this,ci,"f")).then(e=>{this.initializedDb=e,t(e)})})}async get(t){return await(await this._db).get(t)}async set(t,e){await(await this._db).set(t,e)}async remove(t){await(await this._db).remove(t)}};ci=new WeakMap;var F0="https://identity.ic0.app",O0="#authorize",ro="ECDSA",no="Ed25519",P0=500,k0="UserInterrupt",ui=class{constructor(t,e,n,i,s,o,c,u){this._identity=t,this._key=e,this._chain=n,this._storage=i,this.idleManager=s,this._createOptions=o,this._idpWindow=c,this._eventHandler=u,this._registerDefaultIdleCallback()}static async create(t={}){var e,n,i;let s=(e=t.storage)!==null&&e!==void 0?e:new Xe,o=(n=t.keyType)!==null&&n!==void 0?n:ro,c=null;if(t.identity)c=t.identity;else{let m=await s.get(ue);if(!m&&ai)try{let N=new en,M=await N.get(Jt),O=await N.get(ue);M&&O&&o===ro&&(console.log("Discovered an identity stored in localstorage. Migrating to IndexedDB"),await s.set(Jt,M),await s.set(ue,O),m=M,await N.remove(Jt),await N.remove(ue))}catch(N){console.error("error while attempting to recover localstorage: "+N)}if(m)try{typeof m=="object"?o===no&&typeof m=="string"?c=await ze.fromJSON(m):c=await Yr.fromKeyPair(m):typeof m=="string"&&(c=ze.fromJSON(m))}catch{}}let u=new yr,w=null;if(c)try{let m=await s.get(Jt);if(typeof m=="object"&&m!==null)throw new Error("Delegation chain is incorrectly stored. A delegation chain should be stored as a string.");t.identity?u=t.identity:m&&(w=Ye.fromJSON(m),si(w)?"toDer"in c?u=Zr.fromDelegation(c,w):u=Jr.fromDelegation(c,w):(await io(s),c=null))}catch(m){console.error(m),await io(s),c=null}let y;return!((i=t.idleOptions)===null||i===void 0)&&i.disableIdle?y=void 0:(w||t.identity)&&(y=Qr.create(t.idleOptions)),c||(o===no?(c=await ze.generate(),await s.set(ue,JSON.stringify(c.toJSON()))):(t.storage&&o===ro&&console.warn(`You are using a custom storage provider that may not support CryptoKey storage. If you are using a custom storage provider that does not support CryptoKey storage, you should use '${no}' as the key type, as it can serialize to a string`),c=await Yr.generate(),await s.set(ue,c.getKeyPair()))),new this(u,c,w,s,y,t)}_registerDefaultIdleCallback(){var t,e;let n=(t=this._createOptions)===null||t===void 0?void 0:t.idleOptions;!n?.onIdle&&!n?.disableDefaultIdleCallback&&((e=this.idleManager)===null||e===void 0||e.registerCallback(()=>{this.logout(),location.reload()}))}async _handleSuccess(t,e){var n,i;let s=t.delegations.map(w=>({delegation:new Tr(w.delegation.pubkey,w.delegation.expiration,w.delegation.targets),signature:w.signature.buffer})),o=Ye.fromDelegations(s,t.userPublicKey.buffer),c=this._key;if(!c)return;this._chain=o,"toDer"in c?this._identity=Zr.fromDelegation(c,this._chain):this._identity=Jr.fromDelegation(c,this._chain),(n=this._idpWindow)===null||n===void 0||n.close();let u=(i=this._createOptions)===null||i===void 0?void 0:i.idleOptions;!this.idleManager&&!u?.disableIdle&&(this.idleManager=Qr.create(u),this._registerDefaultIdleCallback()),this._removeEventListener(),delete this._idpWindow,this._chain&&await this._storage.set(Jt,JSON.stringify(this._chain.toJSON())),e?.(t)}getIdentity(){return this._identity}async isAuthenticated(){return!this.getIdentity().getPrincipal().isAnonymous()&&this._chain!==null}async login(t){var e,n,i,s;let o=BigInt(8)*BigInt(36e11),c=new URL(((e=t?.identityProvider)===null||e===void 0?void 0:e.toString())||F0);c.hash=O0,(n=this._idpWindow)===null||n===void 0||n.close(),this._removeEventListener(),this._eventHandler=this._getEventHandler(c,Object.assign({maxTimeToLive:(i=t?.maxTimeToLive)!==null&&i!==void 0?i:o},t)),window.addEventListener("message",this._eventHandler),this._idpWindow=(s=window.open(c.toString(),"idpWindow",t?.windowOpenerFeatures))!==null&&s!==void 0?s:void 0;let u=()=>{this._idpWindow&&(this._idpWindow.closed?this._handleFailure(k0,t?.onError):setTimeout(u,P0))};u()}_getEventHandler(t,e){return async n=>{var i,s,o;if(n.origin!==t.origin){console.warn(`WARNING: expected origin '${t.origin}', got '${n.origin}' (ignoring)`);return}let c=n.data;switch(c.kind){case"authorize-ready":{let u=Object.assign({kind:"authorize-client",sessionPublicKey:new Uint8Array((i=this._key)===null||i===void 0?void 0:i.getPublicKey().toDer()),maxTimeToLive:e?.maxTimeToLive,allowPinAuthentication:e?.allowPinAuthentication,derivationOrigin:(s=e?.derivationOrigin)===null||s===void 0?void 0:s.toString()},e?.customValues);(o=this._idpWindow)===null||o===void 0||o.postMessage(u,t.origin);break}case"authorize-client-success":try{await this._handleSuccess(c,e?.onSuccess)}catch(u){this._handleFailure(u.message,e?.onError)}break;case"authorize-client-failure":this._handleFailure(c.text,e?.onError);break;default:break}}}_handleFailure(t,e){var n;(n=this._idpWindow)===null||n===void 0||n.close(),e?.(t),this._removeEventListener(),delete this._idpWindow}_removeEventListener(){this._eventHandler&&window.removeEventListener("message",this._eventHandler),this._eventHandler=void 0}async logout(t={}){if(await io(this._storage),this._identity=new yr,this._chain=null,t.returnTo)try{window.history.pushState({},"",t.returnTo)}catch{window.location.href=t.returnTo}}};async function io(r){await r.remove(ue),await r.remove(Jt),await r.remove(zc)}var im=BigInt(144e11);var Yc=1e3;var Xc=()=>ui.create({idleOptions:{disableIdle:!0,disableDefaultIdleCallback:!0}});onmessage=({data:r})=>{let{msg:t}=r;switch(t){case"junoStartAuthTimer":M0();return;case"junoStopAuthTimer":Jc();return}};var fi,M0=()=>fi=setInterval(async()=>await C0(),Yc),Jc=()=>{fi&&(clearInterval(fi),fi=void 0)},C0=async()=>{let[r,t]=await Promise.all([$0(),V0()]);if(r&&t.valid&&t.delegation!==null){q0(t.delegation);return}L0()},$0=async()=>(await Xc()).isAuthenticated(),V0=async()=>{let t=await new Xe().get(Jt),e=t!==null?Ye.fromJSON(t):null;return{valid:e!==null&&si(e),delegation:e}},L0=()=>{Jc(),postMessage({msg:"junoSignOutAuthTimer"})},q0=r=>{let t=r.delegations[0]?.delegation.expiration;if(t===void 0)return;let e=new Date(Number(t/BigInt(1e6))).getTime()-Date.now();postMessage({msg:"junoDelegationRemainingTime",data:{authRemainingTime:e}})};})();
|
|
18
|
+
`)}}function Vc(r,t){let e=r;return()=>new Promise(n=>setTimeout(()=>{e*=t,n()},e))}function qc(...r){return async(t,e,n)=>{for(let i of r)await i(t,e,n)}}ee();Jt();Er();var tm=Symbol.for("ic-agent-metadata");var em={pollingStrategyFactory:ti.defaultStrategy};Er();ee();qn();Gr();Ks();Jt();qn();Dr();var ni=function(r,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!i:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,e):i?i.value=e:t.set(r,e),e},Me=function(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)},ei,ri,Sr,Br;function Hc(r){return r!==null&&typeof r=="object"}var Ye=class r{constructor(t){if(ei.set(this,void 0),ri.set(this,void 0),t.byteLength!==r.RAW_KEY_LENGTH)throw new Error("An Ed25519 public key must be exactly 32bytes long");ni(this,ei,t,"f"),ni(this,ri,r.derEncode(t),"f")}static from(t){if(typeof t=="string"){let e=Kt(t);return this.fromRaw(e)}else if(Hc(t)){let e=t;if(Hc(e)&&Object.hasOwnProperty.call(e,"__derEncodedPublicKey__"))return this.fromDer(e);if(ArrayBuffer.isView(e)){let n=e;return this.fromRaw(Sn(n.buffer))}else{if(e instanceof ArrayBuffer)return this.fromRaw(e);if("rawKey"in e)return this.fromRaw(e.rawKey);if("derKey"in e)return this.fromDer(e.derKey);if("toDer"in e)return this.fromDer(e.toDer())}}throw new Error("Cannot construct Ed25519PublicKey from the provided key.")}static fromRaw(t){return new r(t)}static fromDer(t){return new r(this.derDecode(t))}static derEncode(t){let e=Tr(t,ze).buffer;return e.__derEncodedPublicKey__=void 0,e}static derDecode(t){let e=Xr(t,ze);if(e.length!==this.RAW_KEY_LENGTH)throw new Error("An Ed25519 public key must be exactly 32bytes long");return e}get rawKey(){return Me(this,ei,"f")}get derKey(){return Me(this,ri,"f")}toDer(){return this.derKey}toRaw(){return this.rawKey}};ei=new WeakMap,ri=new WeakMap;Ye.RAW_KEY_LENGTH=32;var Xe=class r extends be{constructor(t,e){super(),Sr.set(this,void 0),Br.set(this,void 0),ni(this,Sr,Ye.from(t),"f"),ni(this,Br,new Uint8Array(e),"f")}static generate(t){if(t&&t.length!==32)throw new Error("Ed25519 Seed needs to be 32 bytes long.");t||(t=Ar.utils.randomPrivateKey()),Lr(t,new Uint8Array(new Array(32).fill(0)))&&console.warn("Seed is all zeros. This is not a secure seed. Please provide a seed with sufficient entropy if this is a production environment.");let e=new Uint8Array(32);for(let i=0;i<32;i++)e[i]=new Uint8Array(t)[i];let n=Ar.getPublicKey(e);return r.fromKeyPair(n,e)}static fromParsedJson(t){let[e,n]=t;return new r(Ye.fromDer(Kt(e)),Kt(n))}static fromJSON(t){let e=JSON.parse(t);if(Array.isArray(e)){if(typeof e[0]=="string"&&typeof e[1]=="string")return this.fromParsedJson([e[0],e[1]]);throw new Error("Deserialization error: JSON must have at least 2 items.")}throw new Error(`Deserialization error: Invalid JSON type for string: ${JSON.stringify(t)}`)}static fromKeyPair(t,e){return new r(Ye.fromRaw(t),e)}static fromSecretKey(t){let e=Ar.getPublicKey(new Uint8Array(t));return r.fromKeyPair(e,t)}toJSON(){return[Bt(Me(this,Sr,"f").toDer()),Bt(Me(this,Br,"f"))]}getKeyPair(){return{secretKey:Me(this,Br,"f"),publicKey:Me(this,Sr,"f")}}getPublicKey(){return Me(this,Sr,"f")}async sign(t){let e=new Uint8Array(t),n=Ke(Ar.sign(e,Me(this,Br,"f").slice(0,32)));return Object.defineProperty(n,"__signature__",{enumerable:!1,value:void 0}),n}static verify(t,e,n){let[i,s,o]=[t,e,n].map(c=>(typeof c=="string"&&(c=Kt(c)),c instanceof Uint8Array&&(c=c.buffer),new Uint8Array(c)));return Ar.verify(s,i,o)}};Sr=new WeakMap,Br=new WeakMap;var Zs=class r extends Error{constructor(t){super(t),this.message=t,Object.setPrototypeOf(this,r.prototype)}};function Lc(r){if(typeof global<"u"&&global.crypto&&global.crypto.subtle)return global.crypto.subtle;if(r)return r;if(typeof crypto<"u"&&crypto.subtle)return crypto.subtle;throw new Zs("Global crypto was not available and none was provided. Please inlcude a SubtleCrypto implementation. See https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto")}var Zr=class r extends be{constructor(t,e,n){super(),this._keyPair=t,this._derKey=e,this._subtleCrypto=n}static async generate(t){let{extractable:e=!1,keyUsages:n=["sign","verify"],subtleCrypto:i}=t??{},s=Lc(i),o=await s.generateKey({name:"ECDSA",namedCurve:"P-256"},e,n),c=await s.exportKey("spki",o.publicKey);return new this(o,c,s)}static async fromKeyPair(t,e){let n=Lc(e),i=await n.exportKey("spki",t.publicKey);return new r(t,i,n)}getKeyPair(){return this._keyPair}getPublicKey(){let t=this._derKey,e=Object.create(this._keyPair.publicKey);return e.toDer=function(){return t},e}async sign(t){let e={name:"ECDSA",hash:{name:"SHA-256"}};return await this._subtleCrypto.sign(e,this._keyPair.privateKey,t)}};ee();var Ir=ve(jr());ee();var p0=function(r,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!i:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,e):i?i.value=e:t.set(r,e),e},Qr=function(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)},Ce,ii=class{constructor(t){Ce.set(this,void 0),p0(this,Ce,t,"f")}get rawKey(){return Qr(this,Ce,"f").rawKey}get derKey(){return Qr(this,Ce,"f").derKey}toDer(){return Qr(this,Ce,"f").toDer()}getPublicKey(){return Qr(this,Ce,"f")}getPrincipal(){return St.from(Qr(this,Ce,"f").rawKey)}transformRequest(){return Promise.reject("Not implemented. You are attempting to use a partial identity to sign calls, but this identity only has access to the public key.To sign calls, use a DelegationIdentity instead.")}};Ce=new WeakMap;var w0=function(r,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!i:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,e):i?i.value=e:t.set(r,e),e},y0=function(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)},m0=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e},si,g0=new TextEncoder().encode("ic-request-auth-delegation"),x0=new TextEncoder().encode(`
|
|
19
|
+
ic-request`);function Qs(r){if(typeof r!="string"||r.length<64)throw new Error("Invalid public key.");return Kt(r)}var Nr=class{constructor(t,e,n){this.pubkey=t,this.expiration=e,this.targets=n}toCBOR(){return Ir.value.map(Object.assign({pubkey:Ir.value.bytes(this.pubkey),expiration:Ir.value.u64(this.expiration.toString(16),16)},this.targets&&{targets:Ir.value.array(this.targets.map(t=>Ir.value.bytes(t.toUint8Array())))}))}toJSON(){return Object.assign({expiration:this.expiration.toString(16),pubkey:Bt(this.pubkey)},this.targets&&{targets:this.targets.map(t=>t.toHex())})}};async function _0(r,t,e,n){let i=new Nr(t.toDer(),BigInt(+e)*BigInt(1e6),n),s=new Uint8Array([...g0,...new Uint8Array(yr(i))]),o=await r.sign(s);return{delegation:i,signature:o}}var Je=class r{constructor(t,e){this.delegations=t,this.publicKey=e}static async create(t,e,n=new Date(Date.now()+15*60*1e3),i={}){var s,o;let c=await _0(t,e,n,i.targets);return new r([...((s=i.previous)===null||s===void 0?void 0:s.delegations)||[],c],((o=i.previous)===null||o===void 0?void 0:o.publicKey)||t.getPublicKey().toDer())}static fromJSON(t){let{publicKey:e,delegations:n}=typeof t=="string"?JSON.parse(t):t;if(!Array.isArray(n))throw new Error("Invalid delegations.");let i=n.map(s=>{let{delegation:o,signature:c}=s,{pubkey:u,expiration:y,targets:w}=o;if(w!==void 0&&!Array.isArray(w))throw new Error("Invalid targets.");return{delegation:new Nr(Qs(u),BigInt("0x"+y),w&&w.map(g=>{if(typeof g!="string")throw new Error("Invalid target.");return St.fromHex(g)})),signature:Qs(c)}});return new this(i,Qs(e))}static fromDelegations(t,e){return new this(t,e)}toJSON(){return{delegations:this.delegations.map(t=>{let{delegation:e,signature:n}=t,{targets:i}=e;return{delegation:Object.assign({expiration:e.expiration.toString(16),pubkey:Bt(e.pubkey)},i&&{targets:i.map(s=>s.toHex())}),signature:Bt(n)}}),publicKey:Bt(this.publicKey)}}},tn=class extends be{constructor(t,e){super(),this._inner=t,this._delegation=e}static fromDelegation(t,e){return new this(t,e)}getDelegation(){return this._delegation}getPublicKey(){return{derKey:this._delegation.publicKey,toDer:()=>this._delegation.publicKey}}sign(t){return this._inner.sign(t)}async transformRequest(t){let{body:e}=t,n=m0(t,["body"]),i=await yr(e);return Object.assign(Object.assign({},n),{body:{content:e,sender_sig:await this.sign(new Uint8Array([...x0,...new Uint8Array(i)])),sender_delegation:this._delegation.delegations,sender_pubkey:this._delegation.publicKey}})}},en=class r extends ii{constructor(t,e){super(t),si.set(this,void 0),w0(this,si,e,"f")}get delegation(){return y0(this,si,"f")}static fromDelegation(t,e){return new r(t,e)}};si=new WeakMap;function oi(r,t){for(let{delegation:i}of r.delegations)if(+new Date(Number(i.expiration/BigInt(1e6)))<=+Date.now())return!1;let e=[],n=t?.scope;n&&(Array.isArray(n)?e.push(...n.map(i=>typeof i=="string"?St.fromText(i):i)):e.push(typeof n=="string"?St.fromText(n):n));for(let i of e){let s=i.toText();for(let{delegation:o}of r.delegations){if(o.targets===void 0)continue;let c=!0;for(let u of o.targets)if(u.toText()===s){c=!1;break}if(c)return!1}}return!0}var b0=ve(vn());lr();var Gc;(function(r){r[r.ECDSA_WITH_SHA256=-7]="ECDSA_WITH_SHA256"})(Gc||(Gc={}));var Kc=["mousedown","mousemove","keydown","touchstart","wheel"],rn=class{constructor(t={}){var e;this.callbacks=[],this.idleTimeout=10*60*1e3,this.timeoutID=void 0;let{onIdle:n,idleTimeout:i=10*60*1e3}=t||{};this.callbacks=n?[n]:[],this.idleTimeout=i;let s=this._resetTimer.bind(this);window.addEventListener("load",s,!0),Kc.forEach(function(c){document.addEventListener(c,s,!0)});let o=(c,u)=>{let y;return(...w)=>{let g=this,N=function(){y=void 0,c.apply(g,w)};clearTimeout(y),y=window.setTimeout(N,u)}};if(t?.captureScroll){let c=o(s,(e=t?.scrollDebounce)!==null&&e!==void 0?e:100);window.addEventListener("scroll",c,!0)}s()}static create(t={}){return new this(t)}registerCallback(t){this.callbacks.push(t)}exit(){clearTimeout(this.timeoutID),window.removeEventListener("load",this._resetTimer,!0);let t=this._resetTimer.bind(this);Kc.forEach(function(e){document.removeEventListener(e,t,!0)}),this.callbacks.forEach(e=>e())}_resetTimer(){let t=this.exit.bind(this);window.clearTimeout(this.timeoutID),this.timeoutID=window.setTimeout(t,this.idleTimeout)}};var E0=(r,t)=>t.some(e=>r instanceof e),jc,Dc;function A0(){return jc||(jc=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function T0(){return Dc||(Dc=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Wc=new WeakMap,eo=new WeakMap,zc=new WeakMap,to=new WeakMap,no=new WeakMap;function v0(r){let t=new Promise((e,n)=>{let i=()=>{r.removeEventListener("success",s),r.removeEventListener("error",o)},s=()=>{e(ge(r.result)),i()},o=()=>{n(r.error),i()};r.addEventListener("success",s),r.addEventListener("error",o)});return t.then(e=>{e instanceof IDBCursor&&Wc.set(e,r)}).catch(()=>{}),no.set(t,r),t}function S0(r){if(eo.has(r))return;let t=new Promise((e,n)=>{let i=()=>{r.removeEventListener("complete",s),r.removeEventListener("error",o),r.removeEventListener("abort",o)},s=()=>{e(),i()},o=()=>{n(r.error||new DOMException("AbortError","AbortError")),i()};r.addEventListener("complete",s),r.addEventListener("error",o),r.addEventListener("abort",o)});eo.set(r,t)}var ro={get(r,t,e){if(r instanceof IDBTransaction){if(t==="done")return eo.get(r);if(t==="objectStoreNames")return r.objectStoreNames||zc.get(r);if(t==="store")return e.objectStoreNames[1]?void 0:e.objectStore(e.objectStoreNames[0])}return ge(r[t])},set(r,t,e){return r[t]=e,!0},has(r,t){return r instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in r}};function Yc(r){ro=r(ro)}function B0(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...e){let n=r.call(ai(this),t,...e);return zc.set(n,t.sort?t.sort():[t]),ge(n)}:T0().includes(r)?function(...t){return r.apply(ai(this),t),ge(Wc.get(this))}:function(...t){return ge(r.apply(ai(this),t))}}function I0(r){return typeof r=="function"?B0(r):(r instanceof IDBTransaction&&S0(r),E0(r,A0())?new Proxy(r,ro):r)}function ge(r){if(r instanceof IDBRequest)return v0(r);if(to.has(r))return to.get(r);let t=I0(r);return t!==r&&(to.set(r,t),no.set(t,r)),t}var ai=r=>no.get(r);function Jc(r,t,{blocked:e,upgrade:n,blocking:i,terminated:s}={}){let o=indexedDB.open(r,t),c=ge(o);return n&&o.addEventListener("upgradeneeded",u=>{n(ge(o.result),u.oldVersion,u.newVersion,ge(o.transaction),u)}),e&&o.addEventListener("blocked",u=>e(u.oldVersion,u.newVersion,u)),c.then(u=>{s&&u.addEventListener("close",()=>s()),i&&u.addEventListener("versionchange",y=>i(y.oldVersion,y.newVersion,y))}).catch(()=>{}),c}var N0=["get","getKey","getAll","getAllKeys","count"],U0=["put","add","delete","clear"],io=new Map;function Xc(r,t){if(!(r instanceof IDBDatabase&&!(t in r)&&typeof t=="string"))return;if(io.get(t))return io.get(t);let e=t.replace(/FromIndex$/,""),n=t!==e,i=U0.includes(e);if(!(e in(n?IDBIndex:IDBObjectStore).prototype)||!(i||N0.includes(e)))return;let s=async function(o,...c){let u=this.transaction(o,i?"readwrite":"readonly"),y=u.store;return n&&(y=y.index(c.shift())),(await Promise.all([y[e](...c),i&&u.done]))[0]};return io.set(t,s),s}Yc(r=>({...r,get:(t,e,n)=>Xc(t,e)||r.get(t,e,n),has:(t,e)=>!!Xc(t,e)||r.has(t,e)}));var Zc="auth-client-db",Qc="ic-keyval",R0=async(r=Zc,t=Qc,e)=>(ci&&(localStorage!=null&&localStorage.getItem(Zt))&&(localStorage.removeItem(Zt),localStorage.removeItem(ue)),await Jc(r,e,{upgrade:n=>{n.objectStoreNames.contains(t)&&n.clear(t),n.createObjectStore(t)}}));async function F0(r,t,e){return await r.get(t,e)}async function O0(r,t,e,n){return await r.put(t,n,e)}async function P0(r,t,e){return await r.delete(t,e)}var nn=class r{constructor(t,e){this._db=t,this._storeName=e}static async create(t){let{dbName:e=Zc,storeName:n=Qc,version:i=tu}=t??{},s=await R0(e,n,i);return new r(s,n)}async set(t,e){return await O0(this._db,this._storeName,t,e)}async get(t){var e;return(e=await F0(this._db,this._storeName,t))!==null&&e!==void 0?e:null}async remove(t){return await P0(this._db,this._storeName,t)}};var k0=function(r,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!i:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,e):i?i.value=e:t.set(r,e),e},M0=function(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)},ui,ue="identity",Zt="delegation",eu="iv",tu=1,ci=typeof window<"u",sn=class{constructor(t="ic-",e){this.prefix=t,this._localStorage=e}get(t){return Promise.resolve(this._getLocalStorage().getItem(this.prefix+t))}set(t,e){return this._getLocalStorage().setItem(this.prefix+t,e),Promise.resolve()}remove(t){return this._getLocalStorage().removeItem(this.prefix+t),Promise.resolve()}_getLocalStorage(){if(this._localStorage)return this._localStorage;let t=typeof window>"u"?typeof global>"u"?typeof self>"u"?void 0:self.localStorage:global.localStorage:window.localStorage;if(!t)throw new Error("Could not find local storage.");return t}},Ze=class{constructor(t){ui.set(this,void 0),k0(this,ui,t??{},"f")}get _db(){return new Promise(t=>{if(this.initializedDb){t(this.initializedDb);return}nn.create(M0(this,ui,"f")).then(e=>{this.initializedDb=e,t(e)})})}async get(t){return await(await this._db).get(t)}async set(t,e){await(await this._db).set(t,e)}async remove(t){await(await this._db).remove(t)}};ui=new WeakMap;var C0="https://identity.ic0.app",$0="#authorize",so="ECDSA",oo="Ed25519",V0=500,q0="UserInterrupt",fi=class{constructor(t,e,n,i,s,o,c,u){this._identity=t,this._key=e,this._chain=n,this._storage=i,this.idleManager=s,this._createOptions=o,this._idpWindow=c,this._eventHandler=u,this._registerDefaultIdleCallback()}static async create(t={}){var e,n,i;let s=(e=t.storage)!==null&&e!==void 0?e:new Ze,o=(n=t.keyType)!==null&&n!==void 0?n:so,c=null;if(t.identity)c=t.identity;else{let g=await s.get(ue);if(!g&&ci)try{let N=new sn,k=await N.get(Zt),O=await N.get(ue);k&&O&&o===so&&(console.log("Discovered an identity stored in localstorage. Migrating to IndexedDB"),await s.set(Zt,k),await s.set(ue,O),g=k,await N.remove(Zt),await N.remove(ue))}catch(N){console.error("error while attempting to recover localstorage: "+N)}if(g)try{typeof g=="object"?o===oo&&typeof g=="string"?c=await Xe.fromJSON(g):c=await Zr.fromKeyPair(g):typeof g=="string"&&(c=Xe.fromJSON(g))}catch{}}let u=new mr,y=null;if(c)try{let g=await s.get(Zt);if(typeof g=="object"&&g!==null)throw new Error("Delegation chain is incorrectly stored. A delegation chain should be stored as a string.");t.identity?u=t.identity:g&&(y=Je.fromJSON(g),oi(y)?"toDer"in c?u=en.fromDelegation(c,y):u=tn.fromDelegation(c,y):(await ao(s),c=null))}catch(g){console.error(g),await ao(s),c=null}let w;return!((i=t.idleOptions)===null||i===void 0)&&i.disableIdle?w=void 0:(y||t.identity)&&(w=rn.create(t.idleOptions)),c||(o===oo?(c=await Xe.generate(),await s.set(ue,JSON.stringify(c.toJSON()))):(t.storage&&o===so&&console.warn(`You are using a custom storage provider that may not support CryptoKey storage. If you are using a custom storage provider that does not support CryptoKey storage, you should use '${oo}' as the key type, as it can serialize to a string`),c=await Zr.generate(),await s.set(ue,c.getKeyPair()))),new this(u,c,y,s,w,t)}_registerDefaultIdleCallback(){var t,e;let n=(t=this._createOptions)===null||t===void 0?void 0:t.idleOptions;!n?.onIdle&&!n?.disableDefaultIdleCallback&&((e=this.idleManager)===null||e===void 0||e.registerCallback(()=>{this.logout(),location.reload()}))}async _handleSuccess(t,e){var n,i;let s=t.delegations.map(y=>({delegation:new Nr(y.delegation.pubkey,y.delegation.expiration,y.delegation.targets),signature:y.signature.buffer})),o=Je.fromDelegations(s,t.userPublicKey.buffer),c=this._key;if(!c)return;this._chain=o,"toDer"in c?this._identity=en.fromDelegation(c,this._chain):this._identity=tn.fromDelegation(c,this._chain),(n=this._idpWindow)===null||n===void 0||n.close();let u=(i=this._createOptions)===null||i===void 0?void 0:i.idleOptions;!this.idleManager&&!u?.disableIdle&&(this.idleManager=rn.create(u),this._registerDefaultIdleCallback()),this._removeEventListener(),delete this._idpWindow,this._chain&&await this._storage.set(Zt,JSON.stringify(this._chain.toJSON())),e?.(t)}getIdentity(){return this._identity}async isAuthenticated(){return!this.getIdentity().getPrincipal().isAnonymous()&&this._chain!==null}async login(t){var e,n,i,s;let o=BigInt(8)*BigInt(36e11),c=new URL(((e=t?.identityProvider)===null||e===void 0?void 0:e.toString())||C0);c.hash=$0,(n=this._idpWindow)===null||n===void 0||n.close(),this._removeEventListener(),this._eventHandler=this._getEventHandler(c,Object.assign({maxTimeToLive:(i=t?.maxTimeToLive)!==null&&i!==void 0?i:o},t)),window.addEventListener("message",this._eventHandler),this._idpWindow=(s=window.open(c.toString(),"idpWindow",t?.windowOpenerFeatures))!==null&&s!==void 0?s:void 0;let u=()=>{this._idpWindow&&(this._idpWindow.closed?this._handleFailure(q0,t?.onError):setTimeout(u,V0))};u()}_getEventHandler(t,e){return async n=>{var i,s,o;if(n.origin!==t.origin){console.warn(`WARNING: expected origin '${t.origin}', got '${n.origin}' (ignoring)`);return}let c=n.data;switch(c.kind){case"authorize-ready":{let u=Object.assign({kind:"authorize-client",sessionPublicKey:new Uint8Array((i=this._key)===null||i===void 0?void 0:i.getPublicKey().toDer()),maxTimeToLive:e?.maxTimeToLive,allowPinAuthentication:e?.allowPinAuthentication,derivationOrigin:(s=e?.derivationOrigin)===null||s===void 0?void 0:s.toString()},e?.customValues);(o=this._idpWindow)===null||o===void 0||o.postMessage(u,t.origin);break}case"authorize-client-success":try{await this._handleSuccess(c,e?.onSuccess)}catch(u){this._handleFailure(u.message,e?.onError)}break;case"authorize-client-failure":this._handleFailure(c.text,e?.onError);break;default:break}}}_handleFailure(t,e){var n;(n=this._idpWindow)===null||n===void 0||n.close(),e?.(t),this._removeEventListener(),delete this._idpWindow}_removeEventListener(){this._eventHandler&&window.removeEventListener("message",this._eventHandler),this._eventHandler=void 0}async logout(t={}){if(await ao(this._storage),this._identity=new mr,this._chain=null,t.returnTo)try{window.history.pushState({},"",t.returnTo)}catch{window.location.href=t.returnTo}}};async function ao(r){await r.remove(ue),await r.remove(Zt),await r.remove(eu)}var yg=BigInt(144e11);var ru=1e3;var nu=()=>fi.create({idleOptions:{disableIdle:!0,disableDefaultIdleCallback:!0}});onmessage=({data:r})=>{let{msg:t}=r;switch(t){case"junoStartAuthTimer":H0();return;case"junoStopAuthTimer":iu();return}};var li,H0=()=>li=setInterval(async()=>await L0(),ru),iu=()=>{li&&(clearInterval(li),li=void 0)},L0=async()=>{let[r,t]=await Promise.all([G0(),K0()]);if(r&&t.valid&&t.delegation!==null){D0(t.delegation);return}j0()},G0=async()=>(await nu()).isAuthenticated(),K0=async()=>{let t=await new Ze().get(Zt),e=t!==null?Je.fromJSON(t):null;return{valid:e!==null&&oi(e),delegation:e}},j0=()=>{iu(),postMessage({msg:"junoSignOutAuthTimer"})},D0=r=>{let t=r.delegations[0]?.delegation.expiration;if(t===void 0)return;let e=new Date(Number(t/BigInt(1e6))).getTime()-Date.now();postMessage({msg:"junoDelegationRemainingTime",data:{authRemainingTime:e}})};})();
|
|
20
20
|
/*! Bundled license information:
|
|
21
21
|
|
|
22
22
|
ieee754/index.js:
|