casper-js-sdk
Version:
SDK to interact with the Casper blockchain
2 lines • 1.03 MB
JavaScript
/*! For license information please see lib.web.js.LICENSE.txt */
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(self,(()=>(()=>{var t={6667:(t,e,r)=>{"use strict";r.d(e,{r:()=>n});const n="bignumber/5.7.0"},7457:(t,e,r)=>{"use strict";r.d(e,{Os:()=>v,YR:()=>d,gH:()=>p,ii:()=>w});var n=r(9404),o=r.n(n),i=r(8905),a=r(7720),s=r(6667),u=o().BN;const c=new a.Vy(s.r),f={},l=9007199254740991;function d(t){return null!=t&&(p.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||(0,i.isHexString)(t)||"bigint"==typeof t||(0,i.isBytes)(t))}let h=!1;class p{constructor(t,e){t!==f&&c.throwError("cannot call constructor directly; use BigNumber.from",a.Vy.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return m(b(this).fromTwos(t))}toTwos(t){return m(b(this).toTwos(t))}abs(){return"-"===this._hex[0]?p.from(this._hex.substring(1)):this}add(t){return m(b(this).add(b(t)))}sub(t){return m(b(this).sub(b(t)))}div(t){return p.from(t).isZero()&&g("division-by-zero","div"),m(b(this).div(b(t)))}mul(t){return m(b(this).mul(b(t)))}mod(t){const e=b(t);return e.isNeg()&&g("division-by-zero","mod"),m(b(this).umod(e))}pow(t){const e=b(t);return e.isNeg()&&g("negative-power","pow"),m(b(this).pow(e))}and(t){const e=b(t);return(this.isNegative()||e.isNeg())&&g("unbound-bitwise-result","and"),m(b(this).and(e))}or(t){const e=b(t);return(this.isNegative()||e.isNeg())&&g("unbound-bitwise-result","or"),m(b(this).or(e))}xor(t){const e=b(t);return(this.isNegative()||e.isNeg())&&g("unbound-bitwise-result","xor"),m(b(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&g("negative-width","mask"),m(b(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&g("negative-width","shl"),m(b(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&g("negative-width","shr"),m(b(this).shrn(t))}eq(t){return b(this).eq(b(t))}lt(t){return b(this).lt(b(t))}lte(t){return b(this).lte(b(t))}gt(t){return b(this).gt(b(t))}gte(t){return b(this).gte(b(t))}isNegative(){return"-"===this._hex[0]}isZero(){return b(this).isZero()}toNumber(){try{return b(this).toNumber()}catch(t){g("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return c.throwError("this platform does not support BigInt",a.Vy.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?h||(h=!0,c.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?c.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",a.Vy.errors.UNEXPECTED_ARGUMENT,{}):c.throwError("BigNumber.toString does not accept parameters",a.Vy.errors.UNEXPECTED_ARGUMENT,{})),b(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof p)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new p(f,y(t)):t.match(/^-?[0-9]+$/)?new p(f,y(new u(t))):c.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&g("underflow","BigNumber.from",t),(t>=l||t<=-l)&&g("overflow","BigNumber.from",t),p.from(String(t));const e=t;if("bigint"==typeof e)return p.from(e.toString());if((0,i.isBytes)(e))return p.from((0,i.hexlify)(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return p.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&((0,i.isHexString)(t)||"-"===t[0]&&(0,i.isHexString)(t.substring(1))))return p.from(t)}return c.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function y(t){if("string"!=typeof t)return y(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&c.throwArgumentError("invalid hex","value",t),"0x00"===(t=y(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function m(t){return p.from(y(t))}function b(t){const e=p.from(t).toHexString();return"-"===e[0]?new u("-"+e.substring(3),16):new u(e.substring(2),16)}function g(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),c.throwError(t,a.Vy.errors.NUMERIC_FAULT,n)}function v(t){return new u(t,36).toString(16)}function w(t){return new u(t,16).toString(36)}},6077:(t,e,r)=>{"use strict";r.r(e),r.d(e,{BigNumber:()=>n.gH,FixedFormat:()=>m,FixedNumber:()=>b,_base16To36:()=>n.ii,_base36To16:()=>n.Os,formatFixed:()=>p,parseFixed:()=>y});var n=r(7457),o=r(8905),i=r(7720),a=r(6667);const s=new i.Vy(a.r),u={},c=n.gH.from(0),f=n.gH.from(-1);function l(t,e,r,n){const o={fault:e,operation:r};return void 0!==n&&(o.value=n),s.throwError(t,i.Vy.errors.NUMERIC_FAULT,o)}let d="0";for(;d.length<256;)d+=d;function h(t){if("number"!=typeof t)try{t=n.gH.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+d.substring(0,t):s.throwArgumentError("invalid decimal size","decimals",t)}function p(t,e){null==e&&(e=0);const r=h(e),o=(t=n.gH.from(t)).lt(c);o&&(t=t.mul(f));let i=t.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const a=t.div(r).toString();return t=1===r.length?a:a+"."+i,o&&(t="-"+t),t}function y(t,e){null==e&&(e=0);const r=h(e);"string"==typeof t&&t.match(/^-?[0-9.]+$/)||s.throwArgumentError("invalid decimal value","value",t);const o="-"===t.substring(0,1);o&&(t=t.substring(1)),"."===t&&s.throwArgumentError("missing value","value",t);const i=t.split(".");i.length>2&&s.throwArgumentError("too many decimal points","value",t);let a=i[0],u=i[1];for(a||(a="0"),u||(u="0");"0"===u[u.length-1];)u=u.substring(0,u.length-1);for(u.length>r.length-1&&l("fractional component exceeds decimals","underflow","parseFixed"),""===u&&(u="0");u.length<r.length-1;)u+="0";const c=n.gH.from(a),d=n.gH.from(u);let p=c.mul(r).add(d);return o&&(p=p.mul(f)),p}class m{constructor(t,e,r,n){t!==u&&s.throwError("cannot use FixedFormat constructor; use FixedFormat.from",i.Vy.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=e,this.width=r,this.decimals=n,this.name=(e?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=h(n),Object.freeze(this)}static from(t){if(t instanceof m)return t;"number"==typeof t&&(t=`fixed128x${t}`);let e=!0,r=128,n=18;if("string"==typeof t)if("fixed"===t);else if("ufixed"===t)e=!1;else{const o=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);o||s.throwArgumentError("invalid fixed format","format",t),e="u"!==o[1],r=parseInt(o[2]),n=parseInt(o[3])}else if(t){const o=(e,r,n)=>null==t[e]?n:(typeof t[e]!==r&&s.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);e=o("signed","boolean",e),r=o("width","number",r),n=o("decimals","number",n)}return r%8&&s.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&s.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new m(u,e,r,n)}}class b{constructor(t,e,r,n){t!==u&&s.throwError("cannot use FixedNumber constructor; use FixedNumber.from",i.Vy.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=e,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&s.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=y(this._value,this.format.decimals),r=y(t._value,t.format.decimals);return b.fromValue(e.add(r),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=y(this._value,this.format.decimals),r=y(t._value,t.format.decimals);return b.fromValue(e.sub(r),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=y(this._value,this.format.decimals),r=y(t._value,t.format.decimals);return b.fromValue(e.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=y(this._value,this.format.decimals),r=y(t._value,t.format.decimals);return b.fromValue(e.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=b.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return this.isNegative()&&r&&(e=e.subUnsafe(g.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=b.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return!this.isNegative()&&r&&(e=e.addUnsafe(g.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&s.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const r=b.from("1"+d.substring(0,t),this.format),n=v.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(t){if(null==t)return this._hex;t%8&&s.throwArgumentError("invalid byte width","width",t);const e=n.gH.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString();return(0,o.hexZeroPad)(e,t/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return b.fromString(this._value,t)}static fromValue(t,e,r){return null!=r||null==e||(0,n.YR)(e)||(r=e,e=null),null==e&&(e=0),null==r&&(r="fixed"),b.fromString(p(t,e),m.from(r))}static fromString(t,e){null==e&&(e="fixed");const r=m.from(e),n=y(t,r.decimals);!r.signed&&n.lt(c)&&l("unsigned value cannot be negative","overflow","value",t);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=(0,o.hexZeroPad)(i,r.width/8));const a=p(n,r.decimals);return new b(u,i,a,r)}static fromBytes(t,e){null==e&&(e="fixed");const r=m.from(e);if((0,o.arrayify)(t).length>r.width/8)throw new Error("overflow");let i=n.gH.from(t);r.signed&&(i=i.fromTwos(r.width));const a=i.toTwos((r.signed?0:1)+r.width).toHexString(),s=p(i,r.decimals);return new b(u,a,s,r)}static from(t,e){if("string"==typeof t)return b.fromString(t,e);if((0,o.isBytes)(t))return b.fromBytes(t,e);try{return b.fromValue(t,0,e)}catch(t){if(t.code!==i.Vy.errors.INVALID_ARGUMENT)throw t}return s.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const g=b.from(1),v=b.from("0.5")},8905:(t,e,r)=>{"use strict";r.r(e),r.d(e,{arrayify:()=>c,concat:()=>f,hexConcat:()=>g,hexDataLength:()=>m,hexDataSlice:()=>b,hexStripZeros:()=>w,hexValue:()=>v,hexZeroPad:()=>S,hexlify:()=>y,isBytes:()=>u,isBytesLike:()=>a,isHexString:()=>h,joinSignature:()=>_,splitSignature:()=>M,stripZeros:()=>l,zeroPad:()=>d});const n=new(r(7720).Vy)("bytes/5.7.0");function o(t){return!!t.toHexString}function i(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return i(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function a(t){return h(t)&&!(t.length%2)||u(t)}function s(t){return"number"==typeof t&&t==t&&t%1==0}function u(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!s(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!s(r)||r<0||r>=256)return!1}return!0}function c(t,e){if(e||(e={}),"number"==typeof t){n.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),i(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),o(t)&&(t=t.toHexString()),h(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":n.throwArgumentError("hex data is odd-length","value",t));const o=[];for(let t=0;t<r.length;t+=2)o.push(parseInt(r.substring(t,t+2),16));return i(new Uint8Array(o))}return u(t)?i(new Uint8Array(t)):n.throwArgumentError("invalid arrayify value","value",t)}function f(t){const e=t.map((t=>c(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),i(n)}function l(t){let e=c(t);if(0===e.length)return e;let r=0;for(;r<e.length&&0===e[r];)r++;return r&&(e=e.slice(r)),e}function d(t,e){(t=c(t)).length>e&&n.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),i(r)}function h(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const p="0123456789abcdef";function y(t,e){if(e||(e={}),"number"==typeof t){n.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=p[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),o(t))return t.toHexString();if(h(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":n.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(u(t)){let e="0x";for(let r=0;r<t.length;r++){let n=t[r];e+=p[(240&n)>>4]+p[15&n]}return e}return n.throwArgumentError("invalid hexlify value","value",t)}function m(t){if("string"!=typeof t)t=y(t);else if(!h(t)||t.length%2)return null;return(t.length-2)/2}function b(t,e,r){return"string"!=typeof t?t=y(t):(!h(t)||t.length%2)&&n.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function g(t){let e="0x";return t.forEach((t=>{e+=y(t).substring(2)})),e}function v(t){const e=w(y(t,{hexPad:"left"}));return"0x"===e?"0x0":e}function w(t){"string"!=typeof t&&(t=y(t)),h(t)||n.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e<t.length&&"0"===t[e];)e++;return"0x"+t.substring(e)}function S(t,e){for("string"!=typeof t?t=y(t):h(t)||n.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&n.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function M(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(a(t)){let r=c(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=y(r.slice(0,32)),e.s=y(r.slice(32,64))):65===r.length?(e.r=y(r.slice(0,32)),e.s=y(r.slice(32,64)),e.v=r[64]):n.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:n.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=y(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=d(c(e._vs),32);e._vs=y(r);const o=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=o:e.recoveryParam!==o&&n.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const i=y(r);null==e.s?e.s=i:e.s!==i&&n.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?n.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const r=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==r&&n.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&h(e.r)?e.r=S(e.r,32):n.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&h(e.s)?e.s=S(e.s,32):n.throwArgumentError("signature missing or invalid s","signature",t);const r=c(e.s);r[0]>=128&&n.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const o=y(r);e._vs&&(h(e._vs)||n.throwArgumentError("signature invalid _vs","signature",t),e._vs=S(e._vs,32)),null==e._vs?e._vs=o:e._vs!==o&&n.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function _(t){return y(f([(t=M(t)).r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}},1551:(t,e,r)=>{"use strict";r.r(e),r.d(e,{AddressZero:()=>n,EtherSymbol:()=>d,HashZero:()=>l,MaxUint256:()=>f,NegativeOne:()=>i,One:()=>s,Two:()=>u,WeiPerEther:()=>c,Zero:()=>a});const n="0x0000000000000000000000000000000000000000";var o=r(7457);const i=o.gH.from(-1),a=o.gH.from(0),s=o.gH.from(1),u=o.gH.from(2),c=o.gH.from("1000000000000000000"),f=o.gH.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),l="0x0000000000000000000000000000000000000000000000000000000000000000",d="Ξ"},7720:(t,e,r)=>{"use strict";r.d(e,{Vy:()=>d});let n=!1,o=!1;const i={debug:1,default:2,info:2,warning:3,error:4,off:5};let a=i.default,s=null;const u=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var c,f;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(c||(c={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(f||(f={}));const l="0123456789abcdef";class d{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==i[r]&&this.throwArgumentError("invalid log level name","logLevel",t),a>i[r]||console.log.apply(console,e)}debug(...t){this._log(d.levels.DEBUG,t)}info(...t){this._log(d.levels.INFO,t)}warn(...t){this._log(d.levels.WARNING,t)}makeError(t,e,r){if(o)return this.makeError("censored error",e,{});e||(e=d.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t<e.length;t++)r+=l[e[t]>>4],r+=l[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let a="";switch(e){case f.NUMERIC_FAULT:{a="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":a+="-"+e;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result"}break}case f.CALL_EXCEPTION:case f.INSUFFICIENT_FUNDS:case f.MISSING_NEW:case f.NONCE_EXPIRED:case f.REPLACEMENT_UNDERPRICED:case f.TRANSACTION_REPLACED:case f.UNPREDICTABLE_GAS_LIMIT:a=e}a&&(t+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,d.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),u&&this.throwError("platform missing String.prototype.normalize",d.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:u})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,d.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,d.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,d.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,d.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",d.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",d.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",d.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return s||(s=new d("logger/5.7.0")),s}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",d.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),n){if(!t)return;this.globalLogger().throwError("error censorship permanent",d.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}o=!!t,n=!!e}static setLogLevel(t){const e=i[t.toLowerCase()];null!=e?a=e:d.globalLogger().warn("invalid log level - "+t)}static from(t){return new d(t)}}d.errors=f,d.levels=c},5111:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.curve25519=e.getSharedSecret=e.sync=e.verify=e.sign=e.getPublicKey=e.Signature=e.Point=e.RistrettoPoint=e.ExtendedPoint=e.CURVE=void 0;const n=r(3086),o=BigInt(0),i=BigInt(1),a=BigInt(2),s=BigInt(8),u=BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),c=Object.freeze({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l:u,n:u,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")});e.CURVE=c;const f=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),l=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),d=(BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742"),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235")),h=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),p=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),y=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");class m{constructor(t,e,r,n){this.x=t,this.y=e,this.z=r,this.t=n}static fromAffine(t){if(!(t instanceof _))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return t.equals(_.ZERO)?m.ZERO:new m(t.x,t.y,i,I(t.x*t.y))}static toAffineBatch(t){const e=function(t,e=c.P){const r=new Array(t.length),n=k(t.reduce(((t,n,i)=>n===o?t:(r[i]=t,I(t*n,e))),i),e);return t.reduceRight(((t,n,i)=>n===o?t:(r[i]=I(t*r[i],e),I(t*n,e))),n),r}(t.map((t=>t.z)));return t.map(((t,r)=>t.toAffine(e[r])))}static normalizeZ(t){return this.toAffineBatch(t).map(this.fromAffine)}equals(t){g(t);const{x:e,y:r,z:n}=this,{x:o,y:i,z:a}=t,s=I(e*a),u=I(o*n),c=I(r*a),f=I(i*n);return s===u&&c===f}negate(){return new m(I(-this.x),this.y,this.z,I(-this.t))}double(){const{x:t,y:e,z:r}=this,{a:n}=c,o=I(t*t),i=I(e*e),s=I(a*I(r*r)),u=I(n*o),f=t+e,l=I(I(f*f)-o-i),d=u+i,h=d-s,p=u-i,y=I(l*h),b=I(d*p),g=I(l*p),v=I(h*d);return new m(y,b,v,g)}add(t){g(t);const{x:e,y:r,z:n,t:i}=this,{x:s,y:u,z:c,t:f}=t,l=I((r-e)*(u+s)),d=I((r+e)*(u-s)),h=I(d-l);if(h===o)return this.double();const p=I(n*a*f),y=I(i*a*c),b=y+p,v=d+l,w=y-p,S=I(b*h),M=I(v*w),_=I(b*w),A=I(h*v);return new m(S,M,A,_)}subtract(t){return this.add(t.negate())}precomputeWindow(t){const e=1+256/t,r=[];let n=this,o=n;for(let i=0;i<e;i++){o=n,r.push(o);for(let e=1;e<2**(t-1);e++)o=o.add(n),r.push(o);n=o.double()}return r}wNAF(t,e){!e&&this.equals(m.BASE)&&(e=_.BASE);const r=e&&e._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=e&&M.get(e);n||(n=this.precomputeWindow(r),e&&1!==r&&(n=m.normalizeZ(n),M.set(e,n)));let o=m.ZERO,a=m.BASE;const s=1+256/r,u=2**(r-1),c=BigInt(2**r-1),f=2**r,l=BigInt(r);for(let e=0;e<s;e++){const r=e*u;let s=Number(t&c);t>>=l,s>u&&(s-=f,t+=i);const d=r,h=r+Math.abs(s)-1,p=e%2!=0,y=s<0;0===s?a=a.add(b(p,n[d])):o=o.add(b(y,n[h]))}return m.normalizeZ([o,a])[0]}multiply(t,e){return this.wNAF(J(t,c.l),e)}multiplyUnsafe(t){let e=J(t,c.l,!1);const r=m.BASE,n=m.ZERO;if(e===o)return n;if(this.equals(n)||e===i)return this;if(this.equals(r))return this.wNAF(e);let a=n,s=this;for(;e>o;)e&i&&(a=a.add(s)),s=s.double(),e>>=i;return a}isSmallOrder(){return this.multiplyUnsafe(c.h).equals(m.ZERO)}isTorsionFree(){let t=this.multiplyUnsafe(c.l/a).double();return c.l%a&&(t=t.add(this)),t.equals(m.ZERO)}toAffine(t){const{x:e,y:r,z:n}=this,o=this.equals(m.ZERO);null==t&&(t=o?s:k(n));const a=I(e*t),u=I(r*t),c=I(n*t);if(o)return _.ZERO;if(c!==i)throw new Error("invZ was invalid");return new _(a,u)}fromRistrettoBytes(){w()}toRistrettoBytes(){w()}fromRistrettoHash(){w()}}function b(t,e){const r=e.negate();return t?r:e}function g(t){if(!(t instanceof m))throw new TypeError("ExtendedPoint expected")}function v(t){if(!(t instanceof S))throw new TypeError("RistrettoPoint expected")}function w(){throw new Error("Legacy method: switch to RistrettoPoint")}e.ExtendedPoint=m,m.BASE=new m(c.Gx,c.Gy,i,I(c.Gx*c.Gy)),m.ZERO=new m(o,i,i,o);class S{constructor(t){this.ep=t}static calcElligatorRistrettoMap(t){const{d:e}=c,r=I(l*t*t),n=I((r+i)*p);let o=BigInt(-1);const a=I((o-e*r)*I(r+e));let{isValid:s,value:u}=L(n,a),f=I(u*t);B(f)||(f=I(-f)),s||(u=f),s||(o=r);const h=I(o*(r-i)*y-a),b=u*u,g=I((u+u)*a),v=I(h*d),w=I(i-b),S=I(i+b);return new m(I(g*S),I(w*v),I(v*S),I(g*w))}static hashToCurve(t){const e=x((t=z(t,64)).slice(0,32)),r=this.calcElligatorRistrettoMap(e),n=x(t.slice(32,64)),o=this.calcElligatorRistrettoMap(n);return new S(r.add(o))}static fromHex(t){t=z(t,32);const{a:e,d:r}=c,n="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",a=x(t);if(!function(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}(P(a),t)||B(a))throw new Error(n);const s=I(a*a),u=I(i+e*s),f=I(i-e*s),l=I(u*u),d=I(f*f),h=I(e*r*l-d),{isValid:p,value:y}=D(I(h*d)),b=I(y*f),g=I(y*b*h);let v=I((a+a)*b);B(v)&&(v=I(-v));const w=I(u*g),M=I(v*w);if(!p||B(M)||w===o)throw new Error(n);return new S(new m(v,w,i,M))}toRawBytes(){let{x:t,y:e,z:r,t:n}=this.ep;const o=I(I(r+e)*I(r-e)),i=I(t*e),a=I(i*i),{value:s}=D(I(o*a)),u=I(s*o),c=I(s*i),f=I(u*c*n);let d;if(B(n*f)){let r=I(e*l),n=I(t*l);t=r,e=n,d=I(u*h)}else d=c;B(t*f)&&(e=I(-e));let p=I((r-e)*d);return B(p)&&(p=I(-p)),P(p)}toHex(){return j(this.toRawBytes())}toString(){return this.toHex()}equals(t){v(t);const e=this.ep,r=t.ep,n=I(e.x*r.y)===I(e.y*r.x),o=I(e.y*r.y)===I(e.x*r.x);return n||o}add(t){return v(t),new S(this.ep.add(t.ep))}subtract(t){return v(t),new S(this.ep.subtract(t.ep))}multiply(t){return new S(this.ep.multiply(t))}multiplyUnsafe(t){return new S(this.ep.multiplyUnsafe(t))}}e.RistrettoPoint=S,S.BASE=new S(m.BASE),S.ZERO=new S(m.ZERO);const M=new WeakMap;class _{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,M.delete(this)}static fromHex(t,e=!0){const{d:r,P:n}=c,o=(t=z(t,32)).slice();o[31]=-129&t[31];const a=R(o);if(e&&a>=n)throw new Error("Expected 0 < hex < P");if(!e&&a>=f)throw new Error("Expected 0 < hex < 2**256");const s=I(a*a),u=I(s-i),l=I(r*s+i);let{isValid:d,value:h}=L(u,l);if(!d)throw new Error("Point.fromHex: invalid y coordinate");const p=(h&i)===i;return!!(128&t[31])!==p&&(h=I(-h)),new _(h,a)}static async fromPrivateKey(t){return(await Z(t)).point}toRawBytes(){const t=P(this.y);return t[31]|=this.x&i?128:0,t}toHex(){return j(this.toRawBytes())}toX25519(){const{y:t}=this;return P(I((i+t)*k(i-t)))}isTorsionFree(){return m.fromAffine(this).isTorsionFree()}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new _(I(-this.x),this.y)}add(t){return m.fromAffine(this).add(m.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return m.fromAffine(this).multiply(t,this).toAffine()}}e.Point=_,_.BASE=new _(c.Gx,c.Gy),_.ZERO=new _(o,i);class A{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromHex(t){const e=z(t,64),r=_.fromHex(e.slice(0,32),!1),n=R(e.slice(32,64));return new A(r,n)}assertValidity(){const{r:t,s:e}=this;if(!(t instanceof _))throw new Error("Expected Point instance");return J(e,c.l,!1),this}toRawBytes(){const t=new Uint8Array(64);return t.set(this.r.toRawBytes()),t.set(P(this.s),32),t}toHex(){return j(this.toRawBytes())}}function E(...t){if(!t.every((t=>t instanceof Uint8Array)))throw new Error("Expected Uint8Array list");if(1===t.length)return t[0];const e=t.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const o=t[e];r.set(o,n),n+=o.length}return r}e.Signature=A;const O=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function j(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=O[t[r]];return e}function T(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){const n=2*r,o=t.slice(n,n+2),i=Number.parseInt(o,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");e[r]=i}return e}function N(t){return T(t.toString(16).padStart(64,"0"))}function P(t){return N(t).reverse()}function B(t){return(I(t)&i)===i}function R(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");return BigInt("0x"+j(Uint8Array.from(t).reverse()))}const C=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function x(t){return I(R(t)&C)}function I(t,e=c.P){const r=t%e;return r>=o?r:e+r}function k(t,e=c.P){if(t===o||e<=o)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=I(t,e),n=e,a=o,s=i,u=i,f=o;for(;r!==o;){const t=n/r,e=n%r,o=a-u*t,i=s-f*t;n=r,r=e,a=u,s=f,u=o,f=i}if(n!==i)throw new Error("invert: does not exist");return I(a,e)}function H(t,e){const{P:r}=c;let n=t;for(;e-- >o;)n*=n,n%=r;return n}function U(t){const{P:e}=c,r=BigInt(5),n=BigInt(10),o=BigInt(20),s=BigInt(40),u=BigInt(80),f=t*t%e*t%e,l=H(f,a)*f%e,d=H(l,i)*t%e,h=H(d,r)*d%e,p=H(h,n)*h%e,y=H(p,o)*p%e,m=H(y,s)*y%e,b=H(m,u)*m%e,g=H(b,u)*m%e,v=H(g,n)*h%e;return{pow_p_5_8:H(v,a)*t%e,b2:f}}function L(t,e){const r=I(e*e*e),n=I(r*r*e);let o=I(t*r*U(t*n).pow_p_5_8);const i=I(e*o*o),a=o,s=I(o*l),u=i===t,c=i===I(-t),f=i===I(-t*l);return u&&(o=a),(c||f)&&(o=s),B(o)&&(o=I(-o)),{isValid:u||c,value:o}}function D(t){return L(i,t)}function V(t){return I(R(t),c.l)}function z(t,e){const r=t instanceof Uint8Array?Uint8Array.from(t):T(t);if("number"==typeof e&&r.length!==e)throw new Error(`Expected ${e} bytes`);return r}function J(t,e,r=!0){if(!e)throw new TypeError("Specify max value");if("number"==typeof t&&Number.isSafeInteger(t)&&(t=BigInt(t)),"bigint"==typeof t&&t<e)if(r){if(o<t)return t}else if(o<=t)return t;throw new TypeError("Expected valid scalar: 0 < scalar < max")}function K(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function F(t){if(32!==(t="bigint"==typeof t||"number"==typeof t?N(J(t,f)):z(t)).length)throw new Error("Expected 32 bytes");return t}function q(t){const e=K(t.slice(0,32)),r=t.slice(32,64),n=V(e),o=_.BASE.multiply(n),i=o.toRawBytes();return{head:e,prefix:r,scalar:n,point:o,pointBytes:i}}let G;function W(...t){if("function"!=typeof G)throw new Error("utils.sha512Sync must be set to use sync methods");return G(...t)}async function Z(t){return q(await e.utils.sha512(F(t)))}function $(t){return q(W(F(t)))}function Q(t,e,r){e=z(e),r instanceof _||(r=_.fromHex(r,!1));const{r:n,s:o}=t instanceof A?t.assertValidity():A.fromHex(t);return{r:n,s:o,SB:m.BASE.multiplyUnsafe(o),pub:r,msg:e}}function X(t,e,r,n){const o=V(n),i=m.fromAffine(t).multiplyUnsafe(o);return m.fromAffine(e).add(i).subtract(r).multiplyUnsafe(c.h).equals(m.ZERO)}function Y(t,e,r){const n=I(t*(e-r));return[e=I(e-n),r=I(r+n)]}e.getPublicKey=async function(t){return(await Z(t)).pointBytes},e.sign=async function(t,r){t=z(t);const{prefix:n,scalar:o,pointBytes:i}=await Z(r),a=V(await e.utils.sha512(n,t)),s=_.BASE.multiply(a),u=I(a+V(await e.utils.sha512(s.toRawBytes(),i,t))*o,c.l);return new A(s,u).toRawBytes()},e.verify=async function(t,r,n){const{r:o,SB:i,msg:a,pub:s}=Q(t,r,n),u=await e.utils.sha512(o.toRawBytes(),s.toRawBytes(),a);return X(s,o,i,u)},e.sync={getExtendedPublicKey:$,getPublicKey:function(t){return $(t).pointBytes},sign:function(t,e){t=z(t);const{prefix:r,scalar:n,pointBytes:o}=$(e),i=V(W(r,t)),a=_.BASE.multiply(i),s=I(i+V(W(a.toRawBytes(),o,t))*n,c.l);return new A(a,s).toRawBytes()},verify:function(t,e,r){const{r:n,SB:o,msg:i,pub:a}=Q(t,e,r),s=W(n.toRawBytes(),a.toRawBytes(),i);return X(a,n,o,s)}},e.getSharedSecret=async function(t,r){const{head:n}=await Z(t),o=_.fromHex(r).toX25519();return e.curve25519.scalarMult(n,o)},_.BASE._setWindowSize(8),e.curve25519={BASE_POINT_U:"0900000000000000000000000000000000000000000000000000000000000000",scalarMult(t,e){const r=function(t,e){const{P:r}=c,n=J(t,r),a=J(e,r),s=BigInt(121665),u=n;let f,l=i,d=o,h=n,p=i,y=o;for(let t=BigInt(254);t>=o;t--){const e=a>>t&i;y^=e,f=Y(y,l,h),l=f[0],h=f[1],f=Y(y,d,p),d=f[0],p=f[1],y=e;const r=l+d,n=I(r*r),o=l-d,c=I(o*o),m=n-c,b=h+p,g=I((h-p)*r),v=I(b*o),w=g+v,S=g-v;h=I(w*w),p=I(u*I(S*S)),l=I(n*c),d=I(m*(n+I(s*m)))}f=Y(y,l,h),l=f[0],h=f[1],f=Y(y,d,p),d=f[0],p=f[1];const{pow_p_5_8:m,b2:b}=U(d),g=I(H(m,BigInt(3))*b);return I(l*g)}(function(t){const e=z(t,32);return e[31]&=127,R(e)}(e),R(K(z(t,32))));if(r===o)throw new Error("Invalid private or public key received");return P(I(r,c.P))},scalarMultBase:t=>e.curve25519.scalarMult(t,e.curve25519.BASE_POINT_U)};const tt={node:n,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0};e.utils={bytesToHex:j,hexToBytes:T,concatBytes:E,getExtendedPublicKey:Z,mod:I,invert:k,TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],hashToPrivateScalar:t=>{if((t=z(t)).length<40||t.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return I(R(t),c.l-i)+i},randomBytes:(t=32)=>{if(tt.web)return tt.web.getRandomValues(new Uint8Array(t));if(tt.node){const{randomBytes:e}=tt.node;return new Uint8Array(e(t).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>e.utils.randomBytes(32),sha512:async(...t)=>{const e=E(...t);if(tt.web){const t=await tt.web.subtle.digest("SHA-512",e.buffer);return new Uint8Array(t)}if(tt.node)return Uint8Array.from(tt.node.createHash("sha512").update(e).digest());throw new Error("The environment doesn't have sha512 function")},precompute(t=8,e=_.BASE){const r=e.equals(_.BASE)?e:new _(e.x,e.y);return r._setWindowSize(t),r.multiply(a),r},sha512Sync:void 0},Object.defineProperties(e.utils,{sha512Sync:{configurable:!1,get:()=>G,set(t){G||(G=t)}}})},7557:(t,e)=>{"use strict";function r(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function n(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)}function o(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function i(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(t.outputLen),r(t.blockLen)}function a(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function s(t,e){o(t);const r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}Object.defineProperty(e,"__esModule",{value:!0}),e.output=e.exists=e.hash=e.bytes=e.bool=e.number=void 0,e.number=r,e.bool=n,e.bytes=o,e.hash=i,e.exists=a,e.output=s;const u={number:r,bool:n,bytes:o,hash:i,exists:a,output:s};e.default=u},6742:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BLAKE2=e.SIGMA=void 0;const n=r(7557),o=r(9175);e.SIGMA=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]);class i extends o.Hash{constructor(t,e,r={},i,a,s){if(super(),this.blockLen=t,this.outputLen=e,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,n.default.number(t),n.default.number(e),n.default.number(i),e<0||e>i)throw new Error("outputLen bigger than keyLen");if(void 0!==r.key&&(r.key.length<1||r.key.length>i))throw new Error(`key must be up 1..${i} byte long or undefined`);if(void 0!==r.salt&&r.salt.length!==a)throw new Error(`salt must be ${a} byte long or undefined`);if(void 0!==r.personalization&&r.personalization.length!==s)throw new Error(`personalization must be ${s} byte long or undefined`);this.buffer32=(0,o.u32)(this.buffer=new Uint8Array(t))}update(t){n.default.exists(this);const{blockLen:e,buffer:r,buffer32:i}=this,a=(t=(0,o.toBytes)(t)).length,s=t.byteOffset,u=t.buffer;for(let n=0;n<a;){this.pos===e&&(this.compress(i,0,!1),this.pos=0);const o=Math.min(e-this.pos,a-n),c=s+n;if(o!==e||c%4||!(n+o<a))r.set(t.subarray(n,n+o),this.pos),this.pos+=o,this.length+=o,n+=o;else{const t=new Uint32Array(u,c,Math.floor((a-n)/4));for(let r=0;n+e<a;r+=i.length,n+=e)this.length+=e,this.compress(t,r,!1)}}return this}digestInto(t){n.default.exists(this),n.default.output(t,this);const{pos:e,buffer32:r}=this;this.finished=!0,this.buffer.subarray(e).fill(0),this.compress(r,0,!0);const i=(0,o.u32)(t);this.get().forEach(((t,e)=>i[e]=t))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){const{buffer:e,length:r,finished:n,destroyed:o,outputLen:i,pos:a}=this;return t||(t=new this.constructor({dkLen:i})),t.set(...this.get()),t.length=r,t.finished=n,t.destroyed=o,t.outputLen=i,t.buffer.set(e),t.pos=a,t}}e.BLAKE2=i},915:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SHA2=void 0;const n=r(7557),o=r(9175);class i extends o.Hash{constructor(t,e,r,n){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,o.createView)(this.buffer)}update(t){n.default.exists(this);const{view:e,buffer:r,blockLen:i}=this,a=(t=(0,o.toBytes)(t)).length;for(let n=0;n<a;){const s=Math.min(i-this.pos,a-n);if(s!==i)r.set(t.subarray(n,n+s),this.pos),this.pos+=s,n+=s,this.pos===i&&(this.process(e,0),this.pos=0);else{const e=(0,o.createView)(t);for(;i<=a-n;n+=i)this.process(e,n)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){n.default.exists(this),n.default.output(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:i,isLE:a}=this;let{pos:s}=this;e[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(r,0),s=0);for(let t=s;t<i;t++)e[t]=0;!function(t,e,r,n){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,n);const o=BigInt(32),i=BigInt(4294967295),a=Number(r>>o&i),s=Number(r&i),u=n?4:0,c=n?0:4;t.setUint32(e+u,a,n),t.setUint32(e+c,s,n)}(r,i-8,BigInt(8*this.length),a),this.process(r,0);const u=(0,o.createView)(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const f=c/4,l=this.get();if(f>l.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<f;t++)u.setUint32(4*t,l[t],a)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:o,destroyed:i,pos:a}=this;return t.length=n,t.pos=a,t.finished=o,t.destroyed=i,n%e&&t.buffer.set(r),t}}e.SHA2=i},2318:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.add=e.toBig=e.split=e.fromBig=void 0;const r=BigInt(2**32-1),n=BigInt(32);function o(t,e=!1){return e?{h:Number(t&r),l:Number(t>>n&r)}:{h:0|Number(t>>n&r),l:0|Number(t&r)}}function i(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:a,l:s}=o(t[i],e);[r[i],n[i]]=[a,s]}return[r,n]}function a(t,e,r,n){const o=(e>>>0)+(n>>>0);return{h:t+r+(o/2**32|0)|0,l:0|o}}e.fromBig=o,e.split=i,e.toBig=(t,e)=>BigInt(t>>>0)<<n|BigInt(e>>>0),e.add=a;const s={fromBig:o,split:i,toBig:e.toBig,shrSH:(t,e,r)=>t>>>r,shrSL:(t,e,r)=>t<<32-r|e>>>r,rotrSH:(t,e,r)=>t>>>r|e<<32-r,rotrSL:(t,e,r)=>t<<32-r|e>>>r,rotrBH:(t,e,r)=>t<<64-r|e>>>r-32,rotrBL:(t,e,r)=>t>>>r-32|e<<64-r,rotr32H:(t,e)=>e,rotr32L:(t,e)=>t,rotlSH:(t,e,r)=>t<<r|e>>>32-r,rotlSL:(t,e,r)=>e<<r|t>>>32-r,rotlBH:(t,e,r)=>e<<r-32|t>>>64-r,rotlBL:(t,e,r)=>t<<r-32|e>>>64-r,add:a,add3L:(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),add3H:(t,e,r,n)=>e+r+n+(t/2**32|0)|0,add4L:(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),add4H:(t,e,r,n,o)=>e+r+n+o+(t/2**32|0)|0,add5H:(t,e,r,n,o,i)=>e+r+n+o+i+(t/2**32|0)|0,add5L:(t,e,r,n,o)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(o>>>0)};e.default=s},6719:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.blake2b=void 0;const n=r(6742),o=r(2318),i=r(9175),a=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),s=new Uint32Array(32);function u(t,e,r,n,i,a){const u=i[a],c=i[a+1];let f=s[2*t],l=s[2*t+1],d=s[2*e],h=s[2*e+1],p=s[2*r],y=s[2*r+1],m=s[2*n],b=s[2*n+1],g=o.default.add3L(f,d,u);l=o.default.add3H(g,l,h,c),f=0|g,({Dh:b,Dl:m}={Dh:b^l,Dl:m^f}),({Dh:b,Dl:m}={Dh:o.default.rotr32H(b,m),Dl:o.default.rotr32L(b,m)}),({h:y,l:p}=o.default.add(y,p,b,m)),({Bh:h,Bl:d}={Bh:h^y,Bl:d^p}),({Bh:h,Bl:d}={Bh:o.default.rotrSH(h,d,24),Bl:o.default.rotrSL(h,d,24)}),s[2*t]=f,s[2*t+1]=l,s[2*e]=d,s[2*e+1]=h,s[2*r]=p,s[2*r+1]=y,s[2*n]=m,s[2*n+1]=b}function c(t,e,r,n,i,a){const u=i[a],c=i[a+1];let f=s[2*t],l=s[2*t+1],d=s[2*e],h=s[2*e+1],p=s[2*r],y=s[2*r+1],m=s[2*n],b=s[2*n+1],g=o.default.add3L(f,d,u);l=o.default.add3H(g,l,h,c),f=0|g,({Dh:b,Dl:m}={Dh:b^l,Dl:m^f}),({Dh:b,Dl:m}={Dh:o.default.rotrSH(b,m,16),Dl:o.default.rotrSL(b,m,16)}),({h:y,l:p}=o.default.add(y,p,b,m)),({Bh:h,Bl:d}={Bh:h^y,Bl:d^p}),({Bh:h,Bl:d}={Bh:o.default.rotrBH(h,d,63),Bl:o.default.rotrBL(h,d,63)}),s[2*t]=f,s[2*t+1]=l,s[2*e]=d,s[2*e+1]=h,s[2*r]=p,s[2*r+1]=y,s[2*n]=m,s[2*n+1]=b}class f extends n.BLAKE2{constructor(t={}){super(128,void 0===t.dkLen?64:t.dkLen,t,64,16,16),this.v0l=0|a[0],this.v0h=0|a[1],this.v1l=0|a[2],this.v1h=0|a[3],this.v2l=0|a[4],this.v2h=0|a[5],this.v3l=0|a[6],this.v3h=0|a[7],this.v4l=0|a[8],this.v4h=0|a[9],this.v5l=0|a[10],this.v5h=0|a[11],this.v6l=0|a[12],this.v6h=0|a[13],this.v7l=0|a[14],this.v7h=0|a[15];const e=t.key?t.key.length:0;if(this.v0l^=this.outputLen|e<<8|65536|1<<24,t.salt){const e=(0,i.u32)((0,i.toBytes)(t.salt));this.v4l^=e[0],this.v4h^=e[1],this.v5l^=e[2],this.v5h^=e[3]}if(t.personalization){const e=(0,i.u32)((0,i.toBytes)(t.personalization));this.v6l^=e[0],this.v6h^=e[1],this.v7l^=e[2],this.v7h^=e[3]}if(t.key){const e=new Uint8Array(this.blockLen);e.set((0,i.toBytes)(t.key)),this.update(e)}}get(){let{v0l:t,v0h:e,v1l:r,v1h:n,v2l:o,v2h:i,v3l:a,v3h:s,v4l:u,v4h:c,v5l:f,v5h:l,v6l:d,v6h:h,v7l:p,v7h:y}=this;return[t,e,r,n,o,i,a,s,u,c,f,l,d,h,p,y]}set(t,e,r,n,o,i,a,s,u,c,f,l,d,h,p,y){this.v0l=0|t,this.v0h=0|e,this.v1l=0|r,this.v1h=0|n,this.v2l=0|o,this.v2h=0|i,this.v3l=0|a,this.v3h=0|s,this.v4l=0|u,this.v4h=0|c,this.v5l=0|f,this.v5h=0|l,this.v6l=0|d,this.v6h=0|h,this.v7l=0|p,this.v7h=0|y}compress(t,e,r){this.get().forEach(((t,e)=>s[e]=t)),s.set(a,16);let{h:i,l:f}=o.default.fromBig(BigInt(this.length));s[24]=a[8]^f,s[25]=a[9]^i,r&&(s[28]=~s[28],s[29]=~s[29]);let l=0;const d=n.SIGMA;for(let r=0;r<12;r++)u(0,4,8,12,t,e+2*d[l++]),c(0,4,8,12,t,e+2*d[l++]),u(1,5,9,13,t,e+2*d[l++]),c(1,5,9,13,t,e+2*d[l++]),u(2,6,10,14,t,e+2*d[l++]),c(2,6,10,14,t,e+2*d[l++]),u(3,7,11,15,t,e+2*d[l++]),c(3,7,11,15,t,e+2*d[l++]),u(0,5,10,15,t,e+2*d[l++]),c(0,5,10,15,t,e+2*d[l++]),u(1,6,11,12,t,e+2*d[l++]),c(1,6,11,12,t,e+2*d[l++]),u(2,7,8,13,t,e+2*d[l++]),c(2,7,8,13,t,e+2*d[l++]),u(3,4,9,14,t,e+2*d[l++]),c(3,4,9,14,t,e+2*d[l++]);this.v0l^=s[0]^s[16],this.v0h^=s[1]^s[17],this.v1l^=s[2]^s[18],this.v1h^=s[3]^s[19],this.v2l^=s[4]^s[20],this.v2h^=s[5]^s[21],this.v3l^=s[6]^s[22],this.v3h^=s[7]^s[23],this.v4l^=s[8]^s[24],this.v4h^=s[9]^s[25],this.v5l^=s[10]^s[26],this.v5h^=s[11]^s[27],this.v6l^=s[12]^s[28],this.v6h^=s[13]^s[29],this.v7l^=s[14]^s[30],this.v7h^=s[15]^s[31],s.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}e.blake2b=(0,i.wrapConstructorWithOpts)((t=>new f(t)))},5145:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.crypto=void 0,e.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},9615:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const n=r(7557),o=r(9175);class i extends o.Hash{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,n.default.hash(t);const r=(0,o.toBytes)(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,a=new Uint8Array(i);a.set(r.length>i?t.create().update(r).digest():r);for(let t=0;t<a.length;t++)a[t]^=54;this.iHash.update(a),this.oHash=t.create();for(let t=0;t<a.length;t++)a[t]^=106;this.oHash.update(a),a.fill(0)}update(t){return n.default.exists(this),this.iHash.update(t),this}digestInto(t){n.default.exists(this),n.default.bytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:n,destroyed:o,blockLen:i,outputLen:a}=this;return t.finished=n,t.destroyed=o,t.blockLen=i,t.outputLen=a,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=i,e.hmac=(t,e,r)=>new i(t,e).update(r).digest(),e.hmac.create=(t,e)=>new i(t,e)},2623:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sha224=e.sha256=void 0;const n=r(915),o=r(9175),i=(t,e,r)=>t&e^t&r^e&r,a=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]),s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint32Array(64);class c extends n.SHA2{constructor(){super(64,32,8,!1),this.A=0|s[0],this.B=0|s[1],this.C=0|s[2],this.D=0|s[3],this.E=0|s[4],this.F=0|s[5],this.G=0|s[6],this.H=0|s[7]}get(){const{A:t,B:e,C:r,D:n,E:o,F:i,G:a,H:s}=this;return[t,e,r,n,o,i,a,s]}set(t,e,r,n,o,i,a,s){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|o,this.F=0|i,this.G=0|a,this.H=0|s}process(t,e){for(let r=0;r<16;r++,e+=4)u[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=u[t-15],r=u[t-2],n=(0,o.rotr)(e,7)^(0,o.rotr)(e,18)^e>>>3,i=(0,o.rotr)(r,17)^(0,o.rotr)(r,19)^r>>>10;u[t]=i+u[t-7]+n+u[t-16]|0}let{A:r,B:n,C:s,D:c,E:f,F:l,G:d,H:h}=this;for(let t=0;t<64;t++){const e=h+((0,o.rotr)(f,6)^(0,o.rotr)(f,11)^(0,o.rotr)(f,25))+((p=f)&l^~p&d)+a[t]+u[t]|0,y=((0,o.rotr)(r,2)^(0,o.rotr)(r,13)^(0,o.rotr)(r,22))+i(r,n,s)|0;h=d,d=l,l=f,f=c+e|0,c=s,s=n,n=r,r=e+y|0}var p;r=r+this.A|0,n=n+this.B|0,s=s+this.C|0,c=c+this.D|0,f=f+this.E|0,l=l+this.F|0,d=d+this.G|0,h=h+this.H|0,this.set(r,n,s,c,f,l,d,h)}roundClean(){u.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class f extends c{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}}e.sha256=(0,o.wrapConstructor)((()=>new c)),e.sha