!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).layeredToolkit=t()}(this,(function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,r||"default");if("object"!=e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}function r(e,r,n){return(r=t(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t>18&63]+l[i>>12&63]+l[i>>6&63]+l[63&i]);return o.join("")}function b(e){var t;h||p();for(var r=e.length,n=r%3,i="",o=[],a=16383,s=0,c=r-n;sc?c:s+a));return 1===n?(t=e[r-1],i+=l[t>>2],i+=l[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=l[t>>10],i+=l[t>>4&63],i+=l[t<<2&63],i+="="),o.push(i),o.join("")}function g(e,t,r,n,i){var o,a,s=8*i-n-1,c=(1<>1,l=-7,f=r?i-1:0,d=r?-1:1,h=e[t+f];for(f+=d,o=h&(1<<-l)-1,h>>=-l,l+=s;l>0;o=256*o+e[t+f],f+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+e[t+f],f+=d,l-=8);if(0===o)o=1-u;else{if(o===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,n),o-=u}return(h?-1:1)*a*Math.pow(2,o-n)}function y(e,t,r,n,i,o){var a,s,c,u=8*o-i-1,l=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+f>=1?d/c:d*Math.pow(2,1-f))*c>=2&&(a++,c/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(t*c-1)*Math.pow(2,i),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;e[r+h]=255&s,h+=p,s/=256,i-=8);for(a=a<0;e[r+h]=255&a,h+=p,a/=256,u-=8);e[r+h-p]|=128*m}var v={}.toString,w=Array.isArray||function(e){return"[object Array]"==v.call(e)};_.TYPED_ARRAY_SUPPORT=void 0===u.TYPED_ARRAY_SUPPORT||u.TYPED_ARRAY_SUPPORT;var E=A();function A(){return _.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function x(e,t){if(A()=A())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+A().toString(16)+" bytes");return 0|e}function O(e){return!(null==e||!e._isBuffer)}function M(e,t){if(O(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return ie(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return oe(e).length;default:if(n)return ie(e).length;t=(""+t).toLowerCase(),n=!0}}function C(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return V(this,t,r);case"utf8":case"utf-8":return H(this,t,r);case"ascii":return q(this,t,r);case"latin1":case"binary":return K(this,t,r);case"base64":return $(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return W(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function B(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function N(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=_.from(t,n)),O(t))return 0===t.length?-1:R(e,t,r,n,i);if("number"==typeof t)return t&=255,_.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):R(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function R(e,t,r,n,i){var o,a=1,s=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var l=-1;for(o=r;os&&(r=s-c),o=r;o>=0;o--){for(var f=!0,d=0;di&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function $(e,t,r){return 0===t&&r===e.length?b(e):b(e.slice(t,r))}function H(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:u>223?3:u>191?2:1;if(i+f<=r)switch(f){case 1:u<128&&(l=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(c=(15&u)<<12|(63&o)<<6|63&a)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(c=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&c<1114112&&(l=c)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(e){var t=e.length;if(t<=G)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},_.prototype.compare=function(e,t,r,n,i){if(!O(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(o,a),c=this.slice(n,i),u=e.slice(t,r),l=0;li)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return F(this,e,t,r);case"utf8":case"utf-8":return L(this,e,t,r);case"ascii":return j(this,e,t,r);case"latin1":case"binary":return U(this,e,t,r);case"base64":return D(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},_.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var G=4096;function q(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function Z(e,t,r,n,i,o){if(!O(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function Y(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function X(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function Q(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function ee(e,t,r,n,i){return i||Q(e,0,r,4),y(e,t,r,n,23,4),r+4}function te(e,t,r,n,i){return i||Q(e,0,r,8),y(e,t,r,n,52,8),r+8}_.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)n+=this[e+--t]*i;return n},_.prototype.readUInt8=function(e,t){return t||J(e,1,this.length),this[e]},_.prototype.readUInt16LE=function(e,t){return t||J(e,2,this.length),this[e]|this[e+1]<<8},_.prototype.readUInt16BE=function(e,t){return t||J(e,2,this.length),this[e]<<8|this[e+1]},_.prototype.readUInt32LE=function(e,t){return t||J(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},_.prototype.readUInt32BE=function(e,t){return t||J(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},_.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||J(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},_.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||J(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},_.prototype.readInt8=function(e,t){return t||J(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},_.prototype.readInt16LE=function(e,t){t||J(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},_.prototype.readInt16BE=function(e,t){t||J(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},_.prototype.readInt32LE=function(e,t){return t||J(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},_.prototype.readInt32BE=function(e,t){return t||J(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},_.prototype.readFloatLE=function(e,t){return t||J(e,4,this.length),g(this,e,!0,23,4)},_.prototype.readFloatBE=function(e,t){return t||J(e,4,this.length),g(this,e,!1,23,4)},_.prototype.readDoubleLE=function(e,t){return t||J(e,8,this.length),g(this,e,!0,52,8)},_.prototype.readDoubleBE=function(e,t){return t||J(e,8,this.length),g(this,e,!1,52,8)},_.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||Z(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+r},_.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,1,255,0),_.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},_.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,2,65535,0),_.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Y(this,e,t,!0),t+2},_.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,2,65535,0),_.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Y(this,e,t,!1),t+2},_.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,4,4294967295,0),_.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):X(this,e,t,!0),t+4},_.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,4,4294967295,0),_.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):X(this,e,t,!1),t+4},_.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Z(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a|0)-s&255;return t+r},_.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,1,127,-128),_.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},_.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,2,32767,-32768),_.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Y(this,e,t,!0),t+2},_.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,2,32767,-32768),_.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Y(this,e,t,!1),t+2},_.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,4,2147483647,-2147483648),_.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):X(this,e,t,!0),t+4},_.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),_.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):X(this,e,t,!1),t+4},_.prototype.writeFloatLE=function(e,t,r){return ee(this,e,t,!0,r)},_.prototype.writeFloatBE=function(e,t,r){return ee(this,e,t,!1,r)},_.prototype.writeDoubleLE=function(e,t,r){return te(this,e,t,!0,r)},_.prototype.writeDoubleBE=function(e,t,r){return te(this,e,t,!1,r)},_.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(o<1e3||!_.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function oe(e){return function(e){var t,r,n,i,o,a;h||p();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new d(3*s/4-o),n=o>0?s-4:s;var c=0;for(t=0,r=0;t>16&255,a[c++]=i>>8&255,a[c++]=255&i;return 2===o?(i=f[e.charCodeAt(t)]<<2|f[e.charCodeAt(t+1)]>>4,a[c++]=255&i):1===o&&(i=f[e.charCodeAt(t)]<<10|f[e.charCodeAt(t+1)]<<4|f[e.charCodeAt(t+2)]>>2,a[c++]=i>>8&255,a[c++]=255&i),a}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(re,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ae(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function se(e){return null!=e&&(!!e._isBuffer||ce(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&ce(e.slice(0,0))}(e))}function ce(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var ue,le=Object.freeze({__proto__:null,Buffer:_,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),_.alloc(+e)},isBuffer:se,kMaxLength:E}),fe=s(le),de={ArrayIsArray:e=>Array.isArray(e),ArrayPrototypeIncludes:(e,t)=>e.includes(t),ArrayPrototypeIndexOf:(e,t)=>e.indexOf(t),ArrayPrototypeJoin:(e,t)=>e.join(t),ArrayPrototypeMap:(e,t)=>e.map(t),ArrayPrototypePop:(e,t)=>e.pop(t),ArrayPrototypePush:(e,t)=>e.push(t),ArrayPrototypeSlice:(e,t,r)=>e.slice(t,r),Error:Error,FunctionPrototypeCall:(e,t,...r)=>e.call(t,...r),FunctionPrototypeSymbolHasInstance:(e,t)=>Function.prototype[Symbol.hasInstance].call(e,t),MathFloor:Math.floor,Number:Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties:(e,t)=>Object.defineProperties(e,t),ObjectDefineProperty:(e,t,r)=>Object.defineProperty(e,t,r),ObjectGetOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(e,t),ObjectKeys:e=>Object.keys(e),ObjectSetPrototypeOf:(e,t)=>Object.setPrototypeOf(e,t),Promise:Promise,PromisePrototypeCatch:(e,t)=>e.catch(t),PromisePrototypeThen:(e,t,r)=>e.then(t,r),PromiseReject:e=>Promise.reject(e),PromiseResolve:e=>Promise.resolve(e),ReflectApply:Reflect.apply,RegExpPrototypeTest:(e,t)=>e.test(t),SafeSet:Set,String:String,StringPrototypeSlice:(e,t,r)=>e.slice(t,r),StringPrototypeToLowerCase:e=>e.toLowerCase(),StringPrototypeToUpperCase:e=>e.toUpperCase(),StringPrototypeTrim:e=>e.trim(),Symbol:Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet:(e,t,r)=>e.set(t,r),Boolean:Boolean,Uint8Array:Uint8Array},he={exports:{}},pe={exports:{}};function me(){if(ue)return pe.exports;ue=1;const{AbortController:e,AbortSignal:t}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;return pe.exports=e,pe.exports.AbortSignal=t,pe.exports.default=e,pe.exports}function be(){}function ge(){ge.init.call(this)}function ye(e){return void 0===e._maxListeners?ge.defaultMaxListeners:e._maxListeners}function ve(e,t,r,n){var i,o,a,s;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]):(o=e._events=new be,e._eventsCount=0),a){if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),!a.warned&&(i=ye(e))&&i>0&&a.length>i){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,s=c,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=r,++e._eventsCount;return e}function we(e,t,r){var n=!1;function i(){e.removeListener(t,i),n||(n=!0,r.apply(e,arguments))}return i.listener=r,i}function Ee(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function Ae(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}be.prototype=Object.create(null),ge.EventEmitter=ge,ge.usingDomains=!1,ge.prototype.domain=void 0,ge.prototype._events=void 0,ge.prototype._maxListeners=void 0,ge.defaultMaxListeners=10,ge.init=function(){this.domain=null,ge.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new be,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ge.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},ge.prototype.getMaxListeners=function(){return ye(this)},ge.prototype.emit=function(e){var t,r,n,i,o,a,s,c="error"===e;if(a=this._events)c=c&&null==a.error;else if(!c)return!1;if(s=this.domain,c){if(t=arguments[1],!s){if(t instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(r=a[e]))return!1;var l="function"==typeof r;switch(n=arguments.length){case 1:!function(e,t,r){if(t)e.call(r);else for(var n=e.length,i=Ae(e,n),o=0;o0;)if(r[o]===t||r[o].listener&&r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new be,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,i=e.length;n0?Reflect.ownKeys(this._events):[]};var xe=s(Object.freeze({__proto__:null,EventEmitter:ge,default:ge}));!function(e){const t=fe,{kResistStopPropagation:r,SymbolDispose:n}=de,i=globalThis.AbortSignal||me().AbortSignal,o=globalThis.AbortController||me().AbortController,a=Object.getPrototypeOf((async function(){})).constructor,s=globalThis.Blob||t.Blob,c=void 0!==s?function(e){return e instanceof s}:function(e){return!1},u=(e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new ERR_INVALID_ARG_TYPE(t,"AbortSignal",e)};class l extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+typeof e);let t="";for(let r=0;r{e=r,t=n})),resolve:e,reject:t}},promisify:e=>new Promise(((t,r)=>{e(((e,...n)=>e?r(e):t(...n)))})),debuglog:()=>function(){},format:(e,...t)=>e.replace(/%([sdifj])/g,(function(...[e,r]){const n=t.shift();if("f"===r)return n.toFixed(6);if("j"===r)return JSON.stringify(n);if("s"===r&&"object"==typeof n){return`${n.constructor!==Object?n.constructor.name:""} {}`.trim()}return n.toString()})),inspect(e){switch(typeof e){case"string":if(e.includes("'")){if(!e.includes('"'))return`"${e}"`;if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}return`'${e}'`;case"number":return isNaN(e)?"NaN":Object.is(e,-0)?String(e):e;case"bigint":return`${String(e)}n`;case"boolean":case"undefined":return String(e);case"object":return"{}"}},types:{isAsyncFunction:e=>e instanceof a,isArrayBufferView:e=>ArrayBuffer.isView(e)},isBlob:c,deprecate:(e,t)=>e,addAbortListener:xe.addAbortListener||function(e,t){if(void 0===e)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);let i;return u(e,"signal"),((e,t)=>{if("function"!=typeof e)throw new ERR_INVALID_ARG_TYPE(t,"Function",e)})(t,"listener"),e.aborted?queueMicrotask((()=>t())):(e.addEventListener("abort",t,{__proto__:null,once:!0,[r]:!0}),i=()=>{e.removeEventListener("abort",t)}),{__proto__:null,[n](){var e;null===(e=i)||void 0===e||e()}}},AbortSignalAny:i.any||function(e){if(1===e.length)return e[0];const t=new o,r=()=>t.abort();return e.forEach((e=>{u(e,"signals"),e.addEventListener("abort",r,{once:!0})})),t.signal.addEventListener("abort",(()=>{e.forEach((e=>e.removeEventListener("abort",r)))}),{once:!0}),t.signal}},e.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}(he);var _e=he.exports,ke={};const{format:Se,inspect:Pe,AggregateError:Ie}=_e,Te=globalThis.AggregateError||Ie,Oe=Symbol("kIsNodeError"),Me=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Ce=/^([A-Z][a-z0-9]*)+$/,Be={};function Ne(e,t){if(!e)throw new Be.ERR_INTERNAL_ASSERTION(t)}function Re(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function Fe(e,t,r){r||(r=Error);class n extends r{constructor(...r){super(function(e,t,r){if("function"==typeof t)return Ne(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);const n=(t.match(/%[dfijoOs]/g)||[]).length;return Ne(n===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),0===r.length?t:Se(t,...r)}(e,t,r))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=e,n.prototype[Oe]=!0,Be[e]=n}function Le(e){const t="__node_internal_"+e.name;return Object.defineProperty(e,"name",{value:t}),e}let je=class extends Error{constructor(e="The operation was aborted",t=void 0){if(void 0!==t&&"object"!=typeof t)throw new Be.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError"}};Fe("ERR_ASSERTION","%s",Error),Fe("ERR_INVALID_ARG_TYPE",((e,t,r)=>{Ne("string"==typeof e,"'name' must be a string"),Array.isArray(t)||(t=[t]);let n="The ";e.endsWith(" argument")?n+=`${e} `:n+=`"${e}" ${e.includes(".")?"property":"argument"} `,n+="must be ";const i=[],o=[],a=[];for(const e of t)Ne("string"==typeof e,"All expected entries have to be of type string"),Me.includes(e)?i.push(e.toLowerCase()):Ce.test(e)?o.push(e):(Ne("object"!==e,'The value "object" should be written as "Object"'),a.push(e));if(o.length>0){const e=i.indexOf("object");-1!==e&&(i.splice(i,e,1),o.push("Object"))}if(i.length>0){switch(i.length){case 1:n+=`of type ${i[0]}`;break;case 2:n+=`one of type ${i[0]} or ${i[1]}`;break;default:{const e=i.pop();n+=`one of type ${i.join(", ")}, or ${e}`}}(o.length>0||a.length>0)&&(n+=" or ")}if(o.length>0){switch(o.length){case 1:n+=`an instance of ${o[0]}`;break;case 2:n+=`an instance of ${o[0]} or ${o[1]}`;break;default:{const e=o.pop();n+=`an instance of ${o.join(", ")}, or ${e}`}}a.length>0&&(n+=" or ")}switch(a.length){case 0:break;case 1:a[0].toLowerCase()!==a[0]&&(n+="an "),n+=`${a[0]}`;break;case 2:n+=`one of ${a[0]} or ${a[1]}`;break;default:{const e=a.pop();n+=`one of ${a.join(", ")}, or ${e}`}}if(null==r)n+=`. Received ${r}`;else if("function"==typeof r&&r.name)n+=`. Received function ${r.name}`;else if("object"==typeof r){var s;if(null!==(s=r.constructor)&&void 0!==s&&s.name)n+=`. Received an instance of ${r.constructor.name}`;else{n+=`. Received ${Pe(r,{depth:-1})}`}}else{let e=Pe(r,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),n+=`. Received type ${typeof r} (${e})`}return n}),TypeError),Fe("ERR_INVALID_ARG_VALUE",((e,t,r="is invalid")=>{let n=Pe(t);n.length>128&&(n=n.slice(0,128)+"...");return`The ${e.includes(".")?"property":"argument"} '${e}' ${r}. Received ${n}`}),TypeError),Fe("ERR_INVALID_RETURN_VALUE",((e,t,r)=>{var n;return`Expected ${e} to be returned from the "${t}" function but got ${null!=r&&null!==(n=r.constructor)&&void 0!==n&&n.name?`instance of ${r.constructor.name}`:"type "+typeof r}.`}),TypeError),Fe("ERR_MISSING_ARGS",((...e)=>{let t;Ne(e.length>0,"At least one arg needs to be specified");const r=e.length;switch(e=(Array.isArray(e)?e:[e]).map((e=>`"${e}"`)).join(" or "),r){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{const r=e.pop();t+=`The ${e.join(", ")}, and ${r} arguments`}}return`${t} must be specified`}),TypeError),Fe("ERR_OUT_OF_RANGE",((e,t,r)=>{let n;return Ne(t,'Missing "range" argument'),Number.isInteger(r)&&Math.abs(r)>2**32?n=Re(String(r)):"bigint"==typeof r?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=Re(n)),n+="n"):n=Pe(r),`The value of "${e}" is out of range. It must be ${t}. Received ${n}`}),RangeError),Fe("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),Fe("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),Fe("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),Fe("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),Fe("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),Fe("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Fe("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),Fe("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),Fe("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),Fe("ERR_STREAM_WRITE_AFTER_END","write after end",Error),Fe("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);var Ue={AbortError:je,aggregateTwoErrors:Le((function(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;const r=new Te([t,e],t.message);return r.code=t.code,r}return e||t})),hideStackFrames:Le,codes:Be};const{ArrayIsArray:De,ArrayPrototypeIncludes:ze,ArrayPrototypeJoin:$e,ArrayPrototypeMap:He,NumberIsInteger:Ge,NumberIsNaN:qe,NumberMAX_SAFE_INTEGER:Ke,NumberMIN_SAFE_INTEGER:Ve,NumberParseInt:We,ObjectPrototypeHasOwnProperty:Je,RegExpPrototypeExec:Ze,String:Ye,StringPrototypeToUpperCase:Xe,StringPrototypeTrim:Qe}=de,{hideStackFrames:et,codes:{ERR_SOCKET_BAD_PORT:tt,ERR_INVALID_ARG_TYPE:rt,ERR_INVALID_ARG_VALUE:nt,ERR_OUT_OF_RANGE:it,ERR_UNKNOWN_SIGNAL:ot}}=Ue,{normalizeEncoding:at}=_e,{isAsyncFunction:st,isArrayBufferView:ct}=_e.types,ut={};const lt=/^[0-7]+$/;const ft=et(((e,t,r=Ve,n=Ke)=>{if("number"!=typeof e)throw new rt(t,"number",e);if(!Ge(e))throw new it(t,"an integer",e);if(en)throw new it(t,`>= ${r} && <= ${n}`,e)})),dt=et(((e,t,r=-2147483648,n=2147483647)=>{if("number"!=typeof e)throw new rt(t,"number",e);if(!Ge(e))throw new it(t,"an integer",e);if(en)throw new it(t,`>= ${r} && <= ${n}`,e)})),ht=et(((e,t,r=!1)=>{if("number"!=typeof e)throw new rt(t,"number",e);if(!Ge(e))throw new it(t,"an integer",e);const n=r?1:0,i=4294967295;if(ei)throw new it(t,`>= ${n} && <= ${i}`,e)}));function pt(e,t){if("string"!=typeof e)throw new rt(t,"string",e)}const mt=et(((e,t,r)=>{if(!ze(r,e)){const n=$e(He(r,(e=>"string"==typeof e?`'${e}'`:Ye(e))),", ");throw new nt(t,e,"must be one of: "+n)}}));function bt(e,t){if("boolean"!=typeof e)throw new rt(t,"boolean",e)}function gt(e,t,r){return null!=e&&Je(e,t)?e[t]:r}const yt=et(((e,t,r=null)=>{const n=gt(r,"allowArray",!1),i=gt(r,"allowFunction",!1);if(!gt(r,"nullable",!1)&&null===e||!n&&De(e)||"object"!=typeof e&&(!i||"function"!=typeof e))throw new rt(t,"Object",e)})),vt=et(((e,t)=>{if(null!=e&&"object"!=typeof e&&"function"!=typeof e)throw new rt(t,"a dictionary",e)})),wt=et(((e,t,r=0)=>{if(!De(e))throw new rt(t,"Array",e);if(e.length{if(!ct(e))throw new rt(t,["Buffer","TypedArray","DataView"],e)}));const At=et(((e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new rt(t,"AbortSignal",e)})),xt=et(((e,t)=>{if("function"!=typeof e)throw new rt(t,"Function",e)})),_t=et(((e,t)=>{if("function"!=typeof e||st(e))throw new rt(t,"Function",e)})),kt=et(((e,t)=>{if(void 0!==e)throw new rt(t,"undefined",e)}));const St=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Pt(e,t){if(void 0===e||!Ze(St,e))throw new nt(t,e,'must be an array or string of format "; rel=preload; as=style"')}var It={isInt32:function(e){return e===(0|e)},isUint32:function(e){return e===e>>>0},parseFileMode:function(e,t,r){if(void 0===e&&(e=r),"string"==typeof e){if(null===Ze(lt,e))throw new nt(t,e,"must be a 32-bit unsigned integer or an octal string");e=We(e,8)}return ht(e,t),e},validateArray:wt,validateStringArray:function(e,t){wt(e,t);for(let r=0;rn||(null!=r||null!=n)&&qe(e))throw new it(t,`${null!=r?`>= ${r}`:""}${null!=r&&null!=n?" && ":""}${null!=n?`<= ${n}`:""}`,e)},validateObject:yt,validateOneOf:mt,validatePlainFunction:_t,validatePort:function(e,t="Port",r=!0){if("number"!=typeof e&&"string"!=typeof e||"string"==typeof e&&0===Qe(e).length||+e!=+e>>>0||e>65535||0===e&&!r)throw new tt(t,e,r);return 0|e},validateSignalName:function(e,t="signal"){if(pt(e,t),void 0===ut[e]){if(void 0!==ut[Xe(e)])throw new ot(e+" (signals must use all capital letters)");throw new ot(e)}},validateString:pt,validateUint32:ht,validateUndefined:kt,validateUnion:function(e,t,r){if(!ze(r,e))throw new rt(t,`('${$e(r,"|")}')`,e)},validateAbortSignal:At,validateLinkHeaderValue:function(e){if("string"==typeof e)return Pt(e,"hints"),e;if(De(e)){const t=e.length;let r="";if(0===t)return r;for(let n=0;n; rel=preload; as=style"')}},Tt={exports:{}};function Ot(){throw new Error("setTimeout has not been defined")}function Mt(){throw new Error("clearTimeout has not been defined")}var Ct=Ot,Bt=Mt;function Nt(e){if(Ct===setTimeout)return setTimeout(e,0);if((Ct===Ot||!Ct)&&setTimeout)return Ct=setTimeout,setTimeout(e,0);try{return Ct(e,0)}catch(t){try{return Ct.call(null,e,0)}catch(t){return Ct.call(this,e,0)}}}"function"==typeof u.setTimeout&&(Ct=setTimeout),"function"==typeof u.clearTimeout&&(Bt=clearTimeout);var Rt,Ft=[],Lt=!1,jt=-1;function Ut(){Lt&&Rt&&(Lt=!1,Rt.length?Ft=Rt.concat(Ft):jt=-1,Ft.length&&Dt())}function Dt(){if(!Lt){var e=Nt(Ut);Lt=!0;for(var t=Ft.length;t;){for(Rt=Ft,Ft=[];++jt1)for(var r=1;r{};function gn(e,t,r){var n,i;if(2===arguments.length?(r=t,t=qr):null==t?t=qr:Jr(t,"options"),Wr(r,"callback"),Vr(t.signal,"options.signal"),r=Kr(r),nn(e)||un(e))return function(e,t,r){let n=!1,i=bn;if(t.signal)if(i=()=>{n=!0,r.call(e,new zr(void 0,{cause:t.signal.reason}))},t.signal.aborted)Dr.nextTick(i);else{mn=mn||_e.addAbortListener;const n=mn(t.signal,i),o=r;r=Kr(((...t)=>{n[Qr](),o.apply(e,t)}))}const o=(...t)=>{n||Dr.nextTick((()=>r.apply(e,t)))};return Xr(e[pn].promise,o,o),bn}(e,t,r);if(!dn(e))throw new Hr("stream",["ReadableStream","WritableStream","Stream"],e);const o=null!==(n=t.readable)&&void 0!==n?n:rn(e),a=null!==(i=t.writable)&&void 0!==i?i:cn(e),s=e._writableState,c=e._readableState,u=()=>{e.writable||d()};let l=hn(e)&&rn(e)===o&&cn(e)===a,f=ln(e,!1);const d=()=>{f=!0,e.destroyed&&(l=!1),(!l||e.readable&&!o)&&(o&&!h||r.call(e))};let h=on(e,!1);const p=()=>{h=!0,e.destroyed&&(l=!1),(!l||e.writable&&!a)&&(a&&!f||r.call(e))},m=t=>{r.call(e,t)};let b=en(e);const g=()=>{b=!0;const t=fn(e)||an(e);return t&&"boolean"!=typeof t?r.call(e,t):o&&!h&&rn(e,!0)&&!on(e,!1)?r.call(e,new Gr):!a||f||ln(e,!1)?void r.call(e):r.call(e,new Gr)},y=()=>{b=!0;const t=fn(e)||an(e);if(t&&"boolean"!=typeof t)return r.call(e,t);r.call(e)},v=()=>{e.req.on("finish",d)};!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?a&&!s&&(e.on("end",u),e.on("close",u)):(e.on("complete",d),l||e.on("abort",g),e.req?v():e.on("request",v)),l||"boolean"!=typeof e.aborted||e.on("aborted",g),e.on("end",p),e.on("finish",d),!1!==t.error&&e.on("error",m),e.on("close",g),b?Dr.nextTick(g):null!=s&&s.errorEmitted||null!=c&&c.errorEmitted?l||Dr.nextTick(y):(o||l&&!tn(e)||!f&&!1!==sn(e))&&(a||l&&!sn(e)||!h&&!1!==tn(e))?c&&e.req&&e.aborted&&Dr.nextTick(y):Dr.nextTick(y);const w=()=>{r=bn,e.removeListener("aborted",g),e.removeListener("complete",d),e.removeListener("abort",g),e.removeListener("request",v),e.req&&e.req.removeListener("finish",d),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",d),e.removeListener("end",p),e.removeListener("error",m),e.removeListener("close",g)};if(t.signal&&!b){const n=()=>{const n=r;w(),n.call(e,new zr(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)Dr.nextTick(n);else{mn=mn||_e.addAbortListener;const i=mn(t.signal,n),o=r;r=Kr(((...t)=>{i[Qr](),o.apply(e,t)}))}}return w}Tt.exports=gn,Tt.exports.finished=function(e,t){var r;let n=!1;return null===t&&(t=qr),null!==(r=t)&&void 0!==r&&r.cleanup&&(Zr(t.cleanup,"cleanup"),n=t.cleanup),new Yr(((r,i)=>{const o=gn(e,t,(e=>{n&&o(),e?i(e):r()}))}))};var yn=Tt.exports;const vn=mr,{aggregateTwoErrors:wn,codes:{ERR_MULTIPLE_CALLBACK:En},AbortError:An}=Ue,{Symbol:xn}=de,{kIsDestroyed:_n,isDestroyed:kn,isFinished:Sn,isServerRequest:Pn}=Ur,In=xn("kDestroy"),Tn=xn("kConstruct");function On(e,t,r){e&&(e.stack,t&&!t.errored&&(t.errored=e),r&&!r.errored&&(r.errored=e))}function Mn(e,t,r){let n=!1;function i(t){if(n)return;n=!0;const i=e._readableState,o=e._writableState;On(t,o,i),o&&(o.closed=!0),i&&(i.closed=!0),"function"==typeof r&&r(t),t?vn.nextTick(Cn,e,t):vn.nextTick(Bn,e)}try{e._destroy(t||null,i)}catch(t){i(t)}}function Cn(e,t){Nn(e,t),Bn(e)}function Bn(e){const t=e._readableState,r=e._writableState;r&&(r.closeEmitted=!0),t&&(t.closeEmitted=!0),(null!=r&&r.emitClose||null!=t&&t.emitClose)&&e.emit("close")}function Nn(e,t){const r=e._readableState,n=e._writableState;null!=n&&n.errorEmitted||null!=r&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),e.emit("error",t))}function Rn(e,t,r){const n=e._readableState,i=e._writableState;if(null!=i&&i.destroyed||null!=n&&n.destroyed)return this;null!=n&&n.autoDestroy||null!=i&&i.autoDestroy?e.destroy(t):t&&(t.stack,i&&!i.errored&&(i.errored=t),n&&!n.errored&&(n.errored=t),r?vn.nextTick(Nn,e,t):Nn(e,t))}function Fn(e){let t=!1;function r(r){if(t)return void Rn(e,null!=r?r:new En);t=!0;const n=e._readableState,i=e._writableState,o=i||n;n&&(n.constructed=!0),i&&(i.constructed=!0),o.destroyed?e.emit(In,r):r?Rn(e,r,!0):vn.nextTick(Ln,e)}try{e._construct((e=>{vn.nextTick(r,e)}))}catch(e){vn.nextTick(r,e)}}function Ln(e){e.emit(Tn)}function jn(e){return(null==e?void 0:e.setHeader)&&"function"==typeof e.abort}function Un(e){e.emit("close")}function Dn(e,t){e.emit("error",t),vn.nextTick(Un,e)}var zn={construct:function(e,t){if("function"!=typeof e._construct)return;const r=e._readableState,n=e._writableState;r&&(r.constructed=!1),n&&(n.constructed=!1),e.once(Tn,t),e.listenerCount(Tn)>1||vn.nextTick(Fn,e)},destroyer:function(e,t){e&&!kn(e)&&(t||Sn(e)||(t=new An),Pn(e)?(e.socket=null,e.destroy(t)):jn(e)?e.abort():jn(e.req)?e.req.abort():"function"==typeof e.destroy?e.destroy(t):"function"==typeof e.close?e.close():t?vn.nextTick(Dn,e,t):vn.nextTick(Un,e),e.destroyed||(e[_n]=!0))},destroy:function(e,t){const r=this._readableState,n=this._writableState,i=n||r;return null!=n&&n.destroyed||null!=r&&r.destroyed?("function"==typeof t&&t(),this):(On(e,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?Mn(this,e,t):this.once(In,(function(r){Mn(this,wn(r,e),t)})),this)},undestroy:function(){const e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=!1===e.readable,e.endEmitted=!1===e.readable),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=!1===t.writable,t.ending=!1===t.writable,t.finished=!1===t.writable)},errorOrDestroy:Rn};const{ArrayIsArray:$n,ObjectSetPrototypeOf:Hn}=de,{EventEmitter:Gn}=xe;function qn(e){Gn.call(this,e)}function Kn(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?$n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}Hn(qn.prototype,Gn.prototype),Hn(qn,Gn),qn.prototype.pipe=function(e,t){const r=this;function n(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function i(){r.readable&&r.resume&&r.resume()}r.on("data",n),e.on("drain",i),e._isStdio||t&&!1===t.end||(r.on("end",a),r.on("close",s));let o=!1;function a(){o||(o=!0,e.end())}function s(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function c(e){u(),0===Gn.listenerCount(this,"error")&&this.emit("error",e)}function u(){r.removeListener("data",n),e.removeListener("drain",i),r.removeListener("end",a),r.removeListener("close",s),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",u),r.removeListener("close",u),e.removeListener("close",u)}return Kn(r,"error",c),Kn(e,"error",c),r.on("end",u),r.on("close",u),e.on("close",u),e.emit("pipe",r),e};var Vn={Stream:qn,prependListener:Kn},Wn={exports:{}};!function(e){const{SymbolDispose:t}=de,{AbortError:r,codes:n}=Ue,{isNodeStream:i,isWebStream:o,kControllerErrorFunction:a}=Ur,s=yn,{ERR_INVALID_ARG_TYPE:c}=n;let u;e.exports.addAbortSignal=function(t,r){if(((e,t)=>{if("object"!=typeof e||!("aborted"in e))throw new c(t,"AbortSignal",e)})(t,"signal"),!i(r)&&!o(r))throw new c("stream",["ReadableStream","WritableStream","Stream"],r);return e.exports.addAbortSignalNoValidate(t,r)},e.exports.addAbortSignalNoValidate=function(e,n){if("object"!=typeof e||!("aborted"in e))return n;const o=i(n)?()=>{n.destroy(new r(void 0,{cause:e.reason}))}:()=>{n[a](new r(void 0,{cause:e.reason}))};if(e.aborted)o();else{u=u||_e.addAbortListener;const r=u(e,o);s(n,r[t])}return n}}(Wn);var Jn=Wn.exports;const{StringPrototypeSlice:Zn,SymbolIterator:Yn,TypedArrayPrototypeSet:Xn,Uint8Array:Qn}=de,{Buffer:ei}=fe,{inspect:ti}=_e;var ri=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){const t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){const t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}shift(){if(0===this.length)return;const e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(0===this.length)return"";let t=this.head,r=""+t.data;for(;null!==(t=t.next);)r+=e+t.data;return r}concat(e){if(0===this.length)return ei.alloc(0);const t=ei.allocUnsafe(e>>>0);let r=this.head,n=0;for(;r;)Xn(t,r.data,n),n+=r.data.length,r=r.next;return t}consume(e,t){const r=this.head.data;if(ei.length)){e===i.length?(t+=i,++n,r.next?this.head=r.next:this.head=this.tail=null):(t+=Zn(i,0,e),this.head=r,r.data=Zn(i,e));break}t+=i,e-=i.length,++n}while(null!==(r=r.next));return this.length-=n,t}_getBuffer(e){const t=ei.allocUnsafe(e),r=e;let n=this.head,i=0;do{const o=n.data;if(!(e>o.length)){e===o.length?(Xn(t,o,r-e),++i,n.next?this.head=n.next:this.head=this.tail=null):(Xn(t,new Qn(o.buffer,o.byteOffset,e),r-e),this.head=n,n.data=o.slice(e));break}Xn(t,o,r-e),e-=o.length,++i}while(null!==(n=n.next));return this.length-=i,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return ti(this,{...t,depth:0,customInspect:!1})}};const{MathFloor:ni,NumberIsInteger:ii}=de,{validateInteger:oi}=It,{ERR_INVALID_ARG_VALUE:ai}=Ue.codes;let si=16384,ci=16;function ui(e){return e?ci:si}var li={getHighWaterMark:function(e,t,r,n){const i=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=i){if(!ii(i)||i<0){throw new ai(n?`options.${r}`:"options.highWaterMark",i)}return ni(i)}return ui(e.objectMode)},getDefaultHighWaterMark:ui,setDefaultHighWaterMark:function(e,t){oi(t,"value",0),e?ci=t:si=t}},fi=_.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function di(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!fi(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=pi;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=mi;break;default:return void(this.write=hi)}this.charBuffer=new _(6),this.charReceived=0,this.charLength=0}function hi(e){return e.toString(this.encoding)}function pi(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function mi(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}di.prototype.write=function(e){for(var t="";this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var n=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,n),n-=this.charReceived);var i;n=(t+=e.toString(this.encoding,0,n)).length-1;if((i=t.charCodeAt(n))>=55296&&i<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,n)}return t},di.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var r=e[e.length-t];if(1==t&&r>>5==6){this.charLength=2;break}if(t<=2&&r>>4==14){this.charLength=3;break}if(t<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=t},di.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;t+=n.slice(0,r).toString(i)}return t};var bi=s(Object.freeze({__proto__:null,StringDecoder:di}));const gi=mr,{PromisePrototypeThen:yi,SymbolAsyncIterator:vi,SymbolIterator:wi}=de,{Buffer:Ei}=fe,{ERR_INVALID_ARG_TYPE:Ai,ERR_STREAM_NULL_VALUES:xi}=Ue.codes;var _i,ki,Si,Pi,Ii,Ti,Oi,Mi,Ci=function(e,t,r){let n,i;if("string"==typeof t||t instanceof Ei)return new e({objectMode:!0,...r,read(){this.push(t),this.push(null)}});if(t&&t[vi])i=!0,n=t[vi]();else{if(!t||!t[wi])throw new Ai("iterable",["Iterable"],t);i=!1,n=t[wi]()}const o=new e({objectMode:!0,highWaterMark:1,...r});let a=!1;return o._read=function(){a||(a=!0,async function(){for(;;){try{const{value:e,done:t}=i?await n.next():n.next();if(t)o.push(null);else{const t=e&&"function"==typeof e.then?await e:e;if(null===t)throw a=!1,new xi;if(o.push(t))continue;a=!1}}catch(e){o.destroy(e)}break}}())},o._destroy=function(e,t){yi(async function(e){const t=null!=e,r="function"==typeof n.throw;if(t&&r){const{value:t,done:r}=await n.throw(e);if(await t,r)return}if("function"==typeof n.return){const{value:e}=await n.return();await e}}(e),(()=>gi.nextTick(t,e)),(r=>gi.nextTick(t,r||e)))},o};function Bi(){if(ki)return _i;ki=1;const e=mr,{ArrayPrototypeIndexOf:t,NumberIsInteger:r,NumberIsNaN:n,NumberParseInt:i,ObjectDefineProperties:o,ObjectKeys:a,ObjectSetPrototypeOf:s,Promise:c,SafeSet:u,SymbolAsyncDispose:l,SymbolAsyncIterator:f,Symbol:d}=de;_i=K,K.ReadableState=q;const{EventEmitter:h}=xe,{Stream:p,prependListener:m}=Vn,{Buffer:b}=fe,{addAbortSignal:g}=Jn,y=yn;let v=_e.debuglog("stream",(e=>{v=e}));const w=ri,E=zn,{getHighWaterMark:A,getDefaultHighWaterMark:x}=li,{aggregateTwoErrors:_,codes:{ERR_INVALID_ARG_TYPE:k,ERR_METHOD_NOT_IMPLEMENTED:S,ERR_OUT_OF_RANGE:P,ERR_STREAM_PUSH_AFTER_EOF:I,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:T},AbortError:O}=Ue,{validateObject:M}=It,C=d("kPaused"),{StringDecoder:B}=bi,N=Ci;s(K.prototype,p.prototype),s(K,p);const R=()=>{},{errorOrDestroy:F}=E,L=1,j=16,U=32,D=64,z=2048,$=4096,H=65536;function G(e){return{enumerable:!1,get(){return!!(this.state&e)},set(t){t?this.state|=e:this.state&=~e}}}function q(e,t,r){"boolean"!=typeof r&&(r=t instanceof Fi()),this.state=z|$|j|U,e&&e.objectMode&&(this.state|=L),r&&e&&e.readableObjectMode&&(this.state|=L),this.highWaterMark=e?A(this,e,"readableHighWaterMark",r):x(!1),this.buffer=new w,this.length=0,this.pipes=[],this.flowing=null,this[C]=null,e&&!1===e.emitClose&&(this.state&=~z),e&&!1===e.autoDestroy&&(this.state&=~$),this.errored=null,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new B(e.encoding),this.encoding=e.encoding)}function K(e){if(!(this instanceof K))return new K(e);const t=this instanceof Fi();this._readableState=new q(e,this,t),e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.construct&&(this._construct=e.construct),e.signal&&!t&&g(e.signal,this)),p.call(this,e),E.construct(this,(()=>{this._readableState.needReadable&&X(this,this._readableState)}))}function V(e,t,r,n){v("readableAddChunk",t);const i=e._readableState;let o;if(i.state&L||("string"==typeof t?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?t=b.from(t,r).toString(i.encoding):(t=b.from(t,r),r=""))):t instanceof b?r="":p._isUint8Array(t)?(t=p._uint8ArrayToBuffer(t),r=""):null!=t&&(o=new k("chunk",["string","Buffer","Uint8Array"],t))),o)F(e,o);else if(null===t)i.state&=-9,function(e,t){if(v("onEofChunk"),t.ended)return;if(t.decoder){const e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length)}t.ended=!0,t.sync?Z(e):(t.needReadable=!1,t.emittedReadable=!0,Y(e))}(e,i);else if(i.state&L||t&&t.length>0)if(n)if(4&i.state)F(e,new T);else{if(i.destroyed||i.errored)return!1;W(e,i,t,!0)}else if(i.ended)F(e,new I);else{if(i.destroyed||i.errored)return!1;i.state&=-9,i.decoder&&!r?(t=i.decoder.write(t),i.objectMode||0!==t.length?W(e,i,t,!1):X(e,i)):W(e,i,t,!1)}else n||(i.state&=-9,X(e,i));return!i.ended&&(i.length0?(t.state&H?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.state&D&&Z(e)),X(e,t)}o(q.prototype,{objectMode:G(L),ended:G(2),endEmitted:G(4),reading:G(8),constructed:G(j),sync:G(U),needReadable:G(D),emittedReadable:G(128),readableListening:G(256),resumeScheduled:G(512),errorEmitted:G(1024),emitClose:G(z),autoDestroy:G($),destroyed:G(8192),closed:G(16384),closeEmitted:G(32768),multiAwaitDrain:G(H),readingMore:G(1<<17),dataEmitted:G(1<<18)}),K.prototype.destroy=E.destroy,K.prototype._undestroy=E.undestroy,K.prototype._destroy=function(e,t){t(e)},K.prototype[h.captureRejectionSymbol]=function(e){this.destroy(e)},K.prototype[l]=function(){let e;return this.destroyed||(e=this.readableEnded?null:new O,this.destroy(e)),new c(((t,r)=>y(this,(n=>n&&n!==e?r(n):t(null)))))},K.prototype.push=function(e,t){return V(this,e,t,!1)},K.prototype.unshift=function(e,t){return V(this,e,t,!0)},K.prototype.isPaused=function(){const e=this._readableState;return!0===e[C]||!1===e.flowing},K.prototype.setEncoding=function(e){const t=new B(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;const r=this._readableState.buffer;let n="";for(const e of r)n+=t.write(e);return r.clear(),""!==n&&r.push(n),this._readableState.length=n.length,this};function J(e,t){return e<=0||0===t.length&&t.ended?0:t.state&L?1:n(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}function Z(t){const r=t._readableState;v("emitReadable",r.needReadable,r.emittedReadable),r.needReadable=!1,r.emittedReadable||(v("emitReadable",r.flowing),r.emittedReadable=!0,e.nextTick(Y,t))}function Y(e){const t=e._readableState;v("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||t.errored||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,ne(e)}function X(t,r){!r.readingMore&&r.constructed&&(r.readingMore=!0,e.nextTick(Q,t,r))}function Q(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!1===t[C]?t.flowing=!0:e.listenerCount("data")>0?e.resume():t.readableListening||(t.flowing=null)}function te(e){v("readable nexttick read 0"),e.read(0)}function re(e,t){v("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),ne(e),t.flowing&&!t.reading&&e.read(0)}function ne(e){const t=e._readableState;for(v("flow",t.flowing);t.flowing&&null!==e.read(););}function ie(e,t){"function"!=typeof e.read&&(e=K.wrap(e,{objectMode:!0}));const r=async function*(e,t){let r,n=R;function i(t){this===e?(n(),n=R):n=t}e.on("readable",i);const o=y(e,{writable:!1},(e=>{r=e?_(r,e):null,n(),n=R}));try{for(;;){const t=e.destroyed?null:e.read();if(null!==t)yield t;else{if(r)throw r;if(null===r)return;await new c(i)}}}catch(e){throw r=_(r,e),r}finally{!r&&!1===(null==t?void 0:t.destroyOnReturn)||void 0!==r&&!e._readableState.autoDestroy?(e.off("readable",i),o()):E.destroyer(e,null)}}(e,t);return r.stream=e,r}function oe(e,t){if(0===t.length)return null;let r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}function ae(t){const r=t._readableState;v("endReadable",r.endEmitted),r.endEmitted||(r.ended=!0,e.nextTick(se,r,t))}function se(t,r){if(v("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&0===t.length)if(t.endEmitted=!0,r.emit("end"),r.writable&&!1===r.allowHalfOpen)e.nextTick(ce,r);else if(t.autoDestroy){const e=r._writableState;(!e||e.autoDestroy&&(e.finished||!1===e.writable))&&r.destroy()}}function ce(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}let ue;function le(){return void 0===ue&&(ue={}),ue}return K.prototype.read=function(e){v("read",e),void 0===e?e=NaN:r(e)||(e=i(e,10));const t=this._readableState,n=e;if(e>t.highWaterMark&&(t.highWaterMark=function(e){if(e>1073741824)throw new P("size","<= 1GiB",e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,++e}(e)),0!==e&&(t.state&=-129),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return v("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?ae(this):Z(this),null;if(0===(e=J(e,t))&&t.ended)return 0===t.length&&ae(this),null;let o,a=!!(t.state&D);if(v("need readable",a),(0===t.length||t.length-e0?oe(e,t):null,null===o?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&ae(this)),null===o||t.errorEmitted||t.closeEmitted||(t.dataEmitted=!0,this.emit("data",o)),o},K.prototype._read=function(e){throw new S("_read()")},K.prototype.pipe=function(t,r){const n=this,i=this._readableState;1===i.pipes.length&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new u(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(t),v("pipe count=%d opts=%j",i.pipes.length,r);const o=(!r||!1!==r.end)&&t!==e.stdout&&t!==e.stderr?s:g;function a(e,r){v("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,function(){v("cleanup"),t.removeListener("close",p),t.removeListener("finish",b),c&&t.removeListener("drain",c);t.removeListener("error",h),t.removeListener("unpipe",a),n.removeListener("end",s),n.removeListener("end",g),n.removeListener("data",d),l=!0,c&&i.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&c()}())}function s(){v("onend"),t.end()}let c;i.endEmitted?e.nextTick(o):n.once("end",o),t.on("unpipe",a);let l=!1;function f(){l||(1===i.pipes.length&&i.pipes[0]===t?(v("false write response, pause",0),i.awaitDrainWriters=t,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(t)&&(v("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),n.pause()),c||(c=function(e,t){return function(){const r=e._readableState;r.awaitDrainWriters===t?(v("pipeOnDrain",1),r.awaitDrainWriters=null):r.multiAwaitDrain&&(v("pipeOnDrain",r.awaitDrainWriters.size),r.awaitDrainWriters.delete(t)),r.awaitDrainWriters&&0!==r.awaitDrainWriters.size||!e.listenerCount("data")||e.resume()}}(n,t),t.on("drain",c))}function d(e){v("ondata");const r=t.write(e);v("dest.write",r),!1===r&&f()}function h(e){if(v("onerror",e),g(),t.removeListener("error",h),0===t.listenerCount("error")){const r=t._writableState||t._readableState;r&&!r.errorEmitted?F(t,e):t.emit("error",e)}}function p(){t.removeListener("finish",b),g()}function b(){v("onfinish"),t.removeListener("close",p),g()}function g(){v("unpipe"),n.unpipe(t)}return n.on("data",d),m(t,"error",h),t.once("close",p),t.once("finish",b),t.emit("pipe",n),!0===t.writableNeedDrain?f():i.flowing||(v("pipe resume"),n.resume()),t},K.prototype.unpipe=function(e){const r=this._readableState;if(0===r.pipes.length)return this;if(!e){const e=r.pipes;r.pipes=[],this.pause();for(let t=0;t0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,v("on readable",i.length,i.reading),i.length?Z(this):i.reading||e.nextTick(te,this))),n},K.prototype.addListener=K.prototype.on,K.prototype.removeListener=function(t,r){const n=p.prototype.removeListener.call(this,t,r);return"readable"===t&&e.nextTick(ee,this),n},K.prototype.off=K.prototype.removeListener,K.prototype.removeAllListeners=function(t){const r=p.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||e.nextTick(ee,this),r},K.prototype.resume=function(){const t=this._readableState;return t.flowing||(v("resume"),t.flowing=!t.readableListening,function(t,r){r.resumeScheduled||(r.resumeScheduled=!0,e.nextTick(re,t,r))}(this,t)),t[C]=!1,this},K.prototype.pause=function(){return v("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(v("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[C]=!0,this},K.prototype.wrap=function(e){let t=!1;e.on("data",(r=>{!this.push(r)&&e.pause&&(t=!0,e.pause())})),e.on("end",(()=>{this.push(null)})),e.on("error",(e=>{F(this,e)})),e.on("close",(()=>{this.destroy()})),e.on("destroy",(()=>{this.destroy()})),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};const r=a(e);for(let t=1;t{const e=this._writableState;e.writing||U(this,e),$(this,e)}))}function C(t,r,n,i){const o=t._writableState;if("function"==typeof n)i=n,n=o.defaultEncoding;else{if(n){if("buffer"!==n&&!d.isEncoding(n))throw new k(n)}else n=o.defaultEncoding;"function"!=typeof i&&(i=P)}if(null===r)throw new x;if(!o.objectMode)if("string"==typeof r)!1!==o.decodeStrings&&(r=d.from(r,n),n="buffer");else if(r instanceof d)n="buffer";else{if(!f._isUint8Array(r))throw new g("chunk",["string","Buffer","Uint8Array"],r);r=f._uint8ArrayToBuffer(r),n="buffer"}let a;return o.ending?a=new _:o.destroyed&&(a=new E("write")),a?(e.nextTick(i,a),S(t,a,!0),a):(o.pendingcb++,function(e,t,r,n,i){const o=t.objectMode?1:r.length;t.length+=o;const a=t.lengthn.bufferedIndex&&U(t,n),i?null!==n.afterWriteTickInfo&&n.afterWriteTickInfo.cb===o?n.afterWriteTickInfo.count++:(n.afterWriteTickInfo={count:1,cb:o,stream:t,state:n},e.nextTick(F,n.afterWriteTickInfo)):L(t,n,1,o))):S(t,new v)}function F({stream:e,state:t,count:r,cb:n}){return t.afterWriteTickInfo=null,L(e,t,r,n)}function L(e,t,r,n){for(!t.ending&&!e.destroyed&&0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"));r-- >0;)t.pendingcb--,n();t.destroyed&&j(t),$(e,t)}function j(e){if(e.writing)return;for(let r=e.bufferedIndex;r1&&e._writev){r.pendingcb-=a-1;const i=r.allNoop?P:e=>{for(let t=s;t256?(n.splice(0,s),r.bufferedIndex=0):r.bufferedIndex=s}r.bufferProcessing=!1}function D(e){return e.ending&&!e.destroyed&&e.constructed&&0===e.length&&!e.errored&&0===e.buffered.length&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function z(t,r){r.prefinished||r.finalCalled||("function"!=typeof t._final||r.destroyed?(r.prefinished=!0,t.emit("prefinish")):(r.finalCalled=!0,function(t,r){let n=!1;function i(i){if(n)S(t,null!=i?i:v());else if(n=!0,r.pendingcb--,i){const e=r[I].splice(0);for(let t=0;t{D(t)?H(e,t):t.pendingcb--}),t,r)):D(r)&&(r.pendingcb++,H(t,r))))}function H(e,t){t.pendingcb--,t.finished=!0;const r=t[I].splice(0);for(let e=0;e{h=!1,e&&m(t,e),p(e)})),u._write=function(e,t,r){i.write(e,t)?r():o=r},u._final=function(e){i.end(),a=e},i.on("drain",(function(){if(o){const e=o;o=null,e()}})),i.on("finish",(function(){if(a){const e=a;a=null,e()}}))),l&&(f(t,(e=>{l=!1,e&&m(t,e),p(e)})),t.on("readable",(function(){if(s){const e=s;s=null,e()}})),t.on("end",(function(){u.push(null)})),u._read=function(){for(;;){const e=t.read();if(null===e)return void(s=u._read);if(!u.push(e))return}}),u._destroy=function(e,r){e||null===c||(e=new d),s=null,o=null,a=null,null===c?r(e):(c=r,m(i,e),m(t,e))},u}return Ii=function t(r,n){if(c(r))return r;if(a(r))return S({readable:r});if(s(r))return S({writable:r});if(o(r))return S({writable:!1,readable:!1});if(u(r))return S({readable:g.fromWeb(r)});if(l(r))return S({writable:y.fromWeb(r)});if("function"==typeof r){const{value:t,write:o,final:a,destroy:s}=function(t){let{promise:r,resolve:n}=v();const i=new x,o=i.signal,a=t(async function*(){for(;;){const t=r;r=null;const{chunk:i,done:a,cb:s}=await t;if(e.nextTick(s),a)return;if(o.aborted)throw new d(void 0,{cause:o.reason});({promise:r,resolve:n}=v()),yield i}}(),{signal:o});return{value:a,write(e,t,r){const i=n;n=null,i({chunk:e,done:!1,cb:r})},final(e){const t=n;n=null,t({done:!0,cb:e})},destroy(e,t){i.abort(),t(e)}}}(r);if(i(t))return w(k,t,{objectMode:!0,write:o,final:a,destroy:s});const c=null==t?void 0:t.then;if("function"==typeof c){let r;const n=_(c,t,(e=>{if(null!=e)throw new p("nully","body",e)}),(e=>{m(r,e)}));return r=new k({objectMode:!0,readable:!1,write:o,final(t){a((async()=>{try{await n,e.nextTick(t,null)}catch(r){e.nextTick(t,r)}}))},destroy:s})}throw new p("Iterable, AsyncIterable or AsyncFunction",n,t)}if(A(r))return t(r.arrayBuffer());if(i(r))return w(k,r,{objectMode:!0,writable:!1});if(u(null==r?void 0:r.readable)&&l(null==r?void 0:r.writable))return k.fromWeb(r);if("object"==typeof(null==r?void 0:r.writable)||"object"==typeof(null==r?void 0:r.readable)){return S({readable:null!=r&&r.readable?a(null==r?void 0:r.readable)?null==r?void 0:r.readable:t(r.readable):void 0,writable:null!=r&&r.writable?s(null==r?void 0:r.writable)?null==r?void 0:r.writable:t(r.writable):void 0})}const f=null==r?void 0:r.then;if("function"==typeof f){let e;return _(f,r,(t=>{null!=t&&e.push(t),e.push(null)}),(t=>{m(e,t)})),e=new k({objectMode:!0,writable:!1,read(){}})}throw new h(n,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],r)},Ii}function Fi(){if(Mi)return Oi;Mi=1;const{ObjectDefineProperties:e,ObjectGetOwnPropertyDescriptor:t,ObjectKeys:r,ObjectSetPrototypeOf:n}=de;Oi=a;const i=Bi(),o=Ni();n(a.prototype,i.prototype),n(a,i);{const e=r(o.prototype);for(let t=0;t{t?e?e(t):this.destroy(t):(null!=r&&this.push(r),this.push(null),e&&e())}))}function Ki(){this._final!==qi&&qi.call(this)}Gi.prototype._final=qi,Gi.prototype._transform=function(e,t,r){throw new Di("_transform()")},Gi.prototype._write=function(e,t,r){const n=this._readableState,i=this._writableState,o=n.length;this._transform(e,t,((e,t)=>{e?r(e):(null!=t&&this.push(t),i.ended||o===n.length||n.length{n=!0}));const i=ro(e,{readable:t,writable:r},(e=>{n=!e}));return{destroy:t=>{n||(n=!0,io.destroyer(e,t||new lo("pipe")))},cleanup:i}}function To(e){if(bo(e))return e;if(yo(e))return async function*(e){So||(So=Bi());yield*So.prototype[eo].call(e)}(e);throw new so("val",["Readable","Iterable","AsyncIterable"],e)}async function Oo(e,t,r,{end:n}){let i,o=null;const a=e=>{if(e&&(i=e),o){const e=o;o=null,e()}},s=()=>new Qi(((e,t)=>{i?t(i):o=()=>{i?t(i):e()}}));t.on("drain",a);const c=ro(t,{readable:!1},a);try{t.writableNeedDrain&&await s();for await(const r of e)t.write(r)||await s();n&&(t.end(),await s()),r()}catch(e){r(i!==e?ao(i,e):e)}finally{c(),t.off("drain",a)}}async function Mo(e,t,r,{end:n}){wo(t)&&(t=t.writable);const i=t.getWriter();try{for await(const t of e)await i.ready,i.write(t).catch((()=>{}));await i.ready,n&&await i.close(),r()}catch(e){try{await i.abort(e),r(e)}catch(e){r(e)}}}function Co(e,t,r){if(1===e.length&&Xi(e[0])&&(e=e[0]),e.length<2)throw new uo("streams");const n=new _o,i=n.signal,o=null==r?void 0:r.signal,a=[];function s(){m(new ho)}let c,u,l;mo(o,"options.signal"),Po=Po||_e.addAbortListener,o&&(c=Po(o,s));const f=[];let d,h=0;function p(e){m(e,0==--h)}function m(e,r){var i;if(!e||u&&"ERR_STREAM_PREMATURE_CLOSE"!==u.code||(u=e),u||r){for(;f.length;)f.shift()(u);null===(i=c)||void 0===i||i[to](),n.abort(),r&&(u||a.forEach((e=>e())),Yi.nextTick(t,u,l))}}for(let y=0;y0,A=w||!1!==(null==r?void 0:r.end),x=y===e.length-1;if(vo(v)){if(A){const{destroy:k,cleanup:S}=Io(v,w,E);f.push(k),go(v)&&x&&a.push(S)}function _(e){e&&"AbortError"!==e.name&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code&&p(e)}v.on("error",_),go(v)&&x&&a.push((()=>{v.removeListener("error",_)}))}if(0===y)if("function"==typeof v){if(d=v({signal:i}),!bo(d))throw new co("Iterable, AsyncIterable or Stream","source",d)}else d=bo(v)||yo(v)||wo(v)?v:oo.from(v);else if("function"==typeof v){var b;if(wo(d))d=To(null===(b=d)||void 0===b?void 0:b.readable);else d=To(d);if(d=v(d,{signal:i}),w){if(!bo(d,!0))throw new co("AsyncIterable",`transform[${y-1}]`,d)}else{var g;ko||(ko=Wi);const P=new ko({objectMode:!0}),I=null===(g=d)||void 0===g?void 0:g.then;if("function"==typeof I)h++,I.call(d,(e=>{l=e,null!=e&&P.write(e),A&&P.end(),Yi.nextTick(p)}),(e=>{P.destroy(e),Yi.nextTick(p,e)}));else if(bo(d,!0))h++,Oo(d,P,p,{end:A});else{if(!Ao(d)&&!wo(d))throw new co("AsyncIterable or Promise","destination",d);{const M=d.readable||d;h++,Oo(M,P,p,{end:A})}}d=P;const{destroy:T,cleanup:O}=Io(d,!1,!0);f.push(T),x&&a.push(O)}}else if(vo(v)){if(yo(d)){h+=2;const C=Bo(d,v,p,{end:A});go(v)&&x&&a.push(C)}else if(wo(d)||Ao(d)){const B=d.readable||d;h++,Oo(B,v,p,{end:A})}else{if(!bo(d))throw new so("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],d);h++,Oo(d,v,p,{end:A})}d=v}else if(Eo(v)){if(yo(d))h++,Mo(To(d),v,p,{end:A});else if(Ao(d)||bo(d))h++,Mo(d,v,p,{end:A});else{if(!wo(d))throw new so("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],d);h++,Mo(d.readable,v,p,{end:A})}d=v}else d=oo.from(v)}return(null!=i&&i.aborted||null!=o&&o.aborted)&&Yi.nextTick(s),d}function Bo(e,t,r,{end:n}){let i=!1;if(t.on("close",(()=>{i||r(new fo)})),e.pipe(t,{end:!1}),n){function o(){i=!0,t.end()}xo(e)?Yi.nextTick(o):e.once("end",o)}else r();return ro(e,{readable:!0,writable:!1},(t=>{const n=e._readableState;t&&"ERR_STREAM_PREMATURE_CLOSE"===t.code&&n&&n.ended&&!n.errored&&!n.errorEmitted?e.once("end",r).once("error",r):r(t)})),ro(t,{readable:!1,writable:!0},r)}var No={pipelineImpl:Co,pipeline:function(...e){return Co(e,no(function(e){return po(e[e.length-1],"streams[stream.length - 1]"),e.pop()}(e)))}};const{pipeline:Ro}=No,Fo=Fi(),{destroyer:Lo}=zn,{isNodeStream:jo,isReadable:Uo,isWritable:Do,isWebStream:zo,isTransformStream:$o,isWritableStream:Ho,isReadableStream:Go}=Ur,{AbortError:qo,codes:{ERR_INVALID_ARG_VALUE:Ko,ERR_MISSING_ARGS:Vo}}=Ue,Wo=yn;var Jo=function(...e){if(0===e.length)throw new Vo("streams");if(1===e.length)return Fo.from(e[0]);const t=[...e];if("function"==typeof e[0]&&(e[0]=Fo.from(e[0])),"function"==typeof e[e.length-1]){const t=e.length-1;e[t]=Fo.from(e[t])}for(let r=0;r0&&!(Do(e[r])||Ho(e[r])||$o(e[r])))throw new Ko(`streams[${r}]`,t[r],"must be writable")}let r,n,i,o,a;const s=e[0],c=Ro(e,(function(e){const t=o;o=null,t?t(e):e?a.destroy(e):l||u||a.destroy()})),u=!!(Do(s)||Ho(s)||$o(s)),l=!!(Uo(c)||Go(c)||$o(c));if(a=new Fo({writableObjectMode:!(null==s||!s.writableObjectMode),readableObjectMode:!(null==c||!c.readableObjectMode),writable:u,readable:l}),u){if(jo(s))a._write=function(e,t,n){s.write(e,t)?n():r=n},a._final=function(e){s.end(),n=e},s.on("drain",(function(){if(r){const e=r;r=null,e()}}));else if(zo(s)){const e=($o(s)?s.writable:s).getWriter();a._write=async function(t,r,n){try{await e.ready,e.write(t).catch((()=>{})),n()}catch(e){n(e)}},a._final=async function(t){try{await e.ready,e.close().catch((()=>{})),n=t}catch(e){t(e)}}}const e=$o(c)?c.readable:c;Wo(e,(()=>{if(n){const e=n;n=null,e()}}))}if(l)if(jo(c))c.on("readable",(function(){if(i){const e=i;i=null,e()}})),c.on("end",(function(){a.push(null)})),a._read=function(){for(;;){const e=c.read();if(null===e)return void(i=a._read);if(!a.push(e))return}};else if(zo(c)){const e=($o(c)?c.readable:c).getReader();a._read=async function(){for(;;)try{const{value:t,done:r}=await e.read();if(!a.push(t))return;if(r)return void a.push(null)}catch{return}}}return a._destroy=function(e,t){e||null===o||(e=new qo),i=null,r=null,n=null,null===o?t(e):(o=t,jo(c)&&Lo(c,e))},a};const Zo=globalThis.AbortController||me().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Yo,ERR_INVALID_ARG_TYPE:Xo,ERR_MISSING_ARGS:Qo,ERR_OUT_OF_RANGE:ea},AbortError:ta}=Ue,{validateAbortSignal:ra,validateInteger:na,validateObject:ia}=It,oa=de.Symbol("kWeak"),aa=de.Symbol("kResistStopPropagation"),{finished:sa}=yn,ca=Jo,{addAbortSignalNoValidate:ua}=Jn,{isWritable:la,isNodeStream:fa}=Ur,{deprecate:da}=_e,{ArrayPrototypePush:ha,Boolean:pa,MathFloor:ma,Number:ba,NumberIsNaN:ga,Promise:ya,PromiseReject:va,PromiseResolve:wa,PromisePrototypeThen:Ea,Symbol:Aa}=de,xa=Aa("kEmpty"),_a=Aa("kEof");function ka(e,t){if("function"!=typeof e)throw new Xo("fn",["Function","AsyncFunction"],e);null!=t&&ia(t,"options"),null!=(null==t?void 0:t.signal)&&ra(t.signal,"options.signal");let r=1;null!=(null==t?void 0:t.concurrency)&&(r=ma(t.concurrency));let n=r-1;return null!=(null==t?void 0:t.highWaterMark)&&(n=ma(t.highWaterMark)),na(r,"options.concurrency",1),na(n,"options.highWaterMark",0),n+=r,async function*(){const i=_e.AbortSignalAny([null==t?void 0:t.signal].filter(pa)),o=this,a=[],s={signal:i};let c,u,l=!1,f=0;function d(){l=!0,h()}function h(){f-=1,p()}function p(){u&&!l&&f=n||f>=r)&&await new ya((e=>{u=e}))}a.push(_a)}catch(e){const t=va(e);Ea(t,h,d),a.push(t)}finally{l=!0,c&&(c(),c=null)}}();try{for(;;){for(;a.length>0;){const e=await a[0];if(e===_a)return;if(i.aborted)throw new ta;e!==xa&&(yield e),a.shift(),p()}await new ya((e=>{c=e}))}}finally{l=!0,u&&(u(),u=null)}}.call(this)}async function Sa(e,t=void 0){for await(const r of Pa.call(this,e,t))return!0;return!1}function Pa(e,t){if("function"!=typeof e)throw new Xo("fn",["Function","AsyncFunction"],e);return ka.call(this,(async function(t,r){return await e(t,r)?t:xa}),t)}class Ia extends Qo{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}function Ta(e){if(e=ba(e),ga(e))return 0;if(e<0)throw new ea("number",">= 0",e);return e}var Oa,Ma,Ca;function Ba(){if(Ma)return Oa;Ma=1;const{ArrayPrototypePop:e,Promise:t}=de,{isIterable:r,isNodeStream:n,isWebStream:i}=Ur,{pipelineImpl:o}=No,{finished:a}=yn;return Na(),Oa={finished:a,pipeline:function(...a){return new t(((t,s)=>{let c,u;const l=a[a.length-1];if(l&&"object"==typeof l&&!n(l)&&!r(l)&&!i(l)){const t=e(a);c=t.signal,u=t.end}o(a,((e,r)=>{e?s(e):t(r)}),{signal:c,end:u})}))}},Oa}function Na(){if(Ca)return c.exports;Ca=1;const{Buffer:e}=fe,{ObjectDefineProperty:t,ObjectKeys:r,ReflectApply:n}=de,{promisify:{custom:i}}=_e,{streamReturningOperators:o,promiseReturningOperators:a}=ke,{codes:{ERR_ILLEGAL_CONSTRUCTOR:s}}=Ue,u=Jo,{setDefaultHighWaterMark:l,getDefaultHighWaterMark:f}=li,{pipeline:d}=No,{destroyer:h}=zn,p=yn,m=Ba(),b=Ur,g=c.exports=Vn.Stream;g.isDestroyed=b.isDestroyed,g.isDisturbed=b.isDisturbed,g.isErrored=b.isErrored,g.isReadable=b.isReadable,g.isWritable=b.isWritable,g.Readable=Bi();for(const v of r(o)){const w=o[v];function E(...e){if(new.target)throw s();return g.Readable.from(n(w,this,e))}t(E,"name",{__proto__:null,value:w.name}),t(E,"length",{__proto__:null,value:w.length}),t(g.Readable.prototype,v,{__proto__:null,value:E,enumerable:!1,configurable:!0,writable:!0})}for(const A of r(a)){const x=a[A];function _(...e){if(new.target)throw s();return n(x,this,e)}t(_,"name",{__proto__:null,value:x.name}),t(_,"length",{__proto__:null,value:x.length}),t(g.Readable.prototype,A,{__proto__:null,value:_,enumerable:!1,configurable:!0,writable:!0})}g.Writable=Ni(),g.Duplex=Fi(),g.Transform=Ui,g.PassThrough=Wi,g.pipeline=d;const{addAbortSignal:y}=Jn;return g.addAbortSignal=y,g.finished=p,g.destroy=h,g.compose=u,g.setDefaultHighWaterMark=l,g.getDefaultHighWaterMark=f,t(g,"promises",{__proto__:null,configurable:!0,enumerable:!0,get:()=>m}),t(d,i,{__proto__:null,enumerable:!0,get:()=>m.pipeline}),t(p,i,{__proto__:null,enumerable:!0,get:()=>m.finished}),g.Stream=g,g._isUint8Array=function(e){return e instanceof Uint8Array},g._uint8ArrayToBuffer=function(t){return e.from(t.buffer,t.byteOffset,t.byteLength)},c.exports}ke.streamReturningOperators={asIndexedPairs:da((function(e=void 0){return null!=e&&ia(e,"options"),null!=(null==e?void 0:e.signal)&&ra(e.signal,"options.signal"),async function*(){let t=0;for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new ta({cause:e.signal.reason});yield[t++,n]}}.call(this)}),"readable.asIndexedPairs will be removed in a future version."),drop:function(e,t=void 0){return null!=t&&ia(t,"options"),null!=(null==t?void 0:t.signal)&&ra(t.signal,"options.signal"),e=Ta(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new ta;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new ta;e--<=0&&(yield r)}}.call(this)},filter:Pa,flatMap:function(e,t){const r=ka.call(this,e,t);return async function*(){for await(const e of r)yield*e}.call(this)},map:ka,take:function(e,t=void 0){return null!=t&&ia(t,"options"),null!=(null==t?void 0:t.signal)&&ra(t.signal,"options.signal"),e=Ta(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new ta;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new ta;if(e-- >0&&(yield r),e<=0)return}}.call(this)},compose:function(e,t){if(null!=t&&ia(t,"options"),null!=(null==t?void 0:t.signal)&&ra(t.signal,"options.signal"),fa(e)&&!la(e))throw new Yo("stream",e,"must be writable");const r=ca(this,e);return null!=t&&t.signal&&ua(t.signal,r),r}},ke.promiseReturningOperators={every:async function(e,t=void 0){if("function"!=typeof e)throw new Xo("fn",["Function","AsyncFunction"],e);return!await Sa.call(this,(async(...t)=>!await e(...t)),t)},forEach:async function(e,t){if("function"!=typeof e)throw new Xo("fn",["Function","AsyncFunction"],e);for await(const r of ka.call(this,(async function(t,r){return await e(t,r),xa}),t));},reduce:async function(e,t,r){var n;if("function"!=typeof e)throw new Xo("reducer",["Function","AsyncFunction"],e);null!=r&&ia(r,"options"),null!=(null==r?void 0:r.signal)&&ra(r.signal,"options.signal");let i=arguments.length>1;if(null!=r&&null!==(n=r.signal)&&void 0!==n&&n.aborted){const e=new ta(void 0,{cause:r.signal.reason});throw this.once("error",(()=>{})),await sa(this.destroy(e)),e}const o=new Zo,a=o.signal;if(null!=r&&r.signal){const e={once:!0,[oa]:this,[aa]:!0};r.signal.addEventListener("abort",(()=>o.abort()),e)}let s=!1;try{for await(const n of this){var c;if(s=!0,null!=r&&null!==(c=r.signal)&&void 0!==c&&c.aborted)throw new ta;i?t=await e(t,n,{signal:a}):(t=n,i=!0)}if(!s&&!i)throw new Ia}finally{o.abort()}return t},toArray:async function(e){null!=e&&ia(e,"options"),null!=(null==e?void 0:e.signal)&&ra(e.signal,"options.signal");const t=[];for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new ta(void 0,{cause:e.signal.reason});ha(t,n)}return t},some:Sa,find:async function(e,t){for await(const r of Pa.call(this,e,t))return r}},function(e){const t=Na(),r=Ba(),n=t.Readable.destroy;e.exports=t.Readable,e.exports._uint8ArrayToBuffer=t._uint8ArrayToBuffer,e.exports._isUint8Array=t._isUint8Array,e.exports.isDisturbed=t.isDisturbed,e.exports.isErrored=t.isErrored,e.exports.isReadable=t.isReadable,e.exports.Readable=t.Readable,e.exports.Writable=t.Writable,e.exports.Duplex=t.Duplex,e.exports.Transform=t.Transform,e.exports.PassThrough=t.PassThrough,e.exports.addAbortSignal=t.addAbortSignal,e.exports.finished=t.finished,e.exports.destroy=t.destroy,e.exports.destroy=n,e.exports.pipeline=t.pipeline,e.exports.compose=t.compose,Object.defineProperty(t,"promises",{configurable:!0,enumerable:!0,get:()=>r}),e.exports.Stream=t.Stream,e.exports.default=e.exports}({exports:{}});var Ra=za;za.default=za,za.stable=qa,za.stableStringify=qa;var Fa="[...]",La="[Circular]",ja=[],Ua=[];function Da(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function za(e,t,r,n){var i;void 0===n&&(n=Da()),Ha(e,"",0,[],void 0,0,n);try{i=0===Ua.length?JSON.stringify(e,t,r):JSON.stringify(e,Va(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==ja.length;){var o=ja.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function $a(e,t,r,n){var i=Object.getOwnPropertyDescriptor(n,r);void 0!==i.get?i.configurable?(Object.defineProperty(n,r,{value:e}),ja.push([n,r,t,i])):Ua.push([t,r,e]):(n[r]=e,ja.push([n,r,t]))}function Ha(e,t,r,n,i,o,a){var s;if(o+=1,"object"==typeof e&&null!==e){for(s=0;sa.depthLimit)return void $a(Fa,e,t,i);if(void 0!==a.edgesLimit&&r+1>a.edgesLimit)return void $a(Fa,e,t,i);if(n.push(e),Array.isArray(e))for(s=0;st?1:0}function qa(e,t,r,n){void 0===n&&(n=Da());var i,o=Ka(e,"",0,[],void 0,0,n)||e;try{i=0===Ua.length?JSON.stringify(o,t,r):JSON.stringify(o,Va(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==ja.length;){var a=ja.pop();4===a.length?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return i}function Ka(e,t,r,n,i,o,a){var s;if(o+=1,"object"==typeof e&&null!==e){for(s=0;sa.depthLimit)return void $a(Fa,e,t,i);if(void 0!==a.edgesLimit&&r+1>a.edgesLimit)return void $a(Fa,e,t,i);if(n.push(e),Array.isArray(e))for(s=0;s0)for(var n=0;nr??(r=[e,...t()])}};function Qa(e){return"object"==typeof e&&null!==e}function es(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function ts(e,t,r,n){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:i,branch:o}=t,{type:a}=r,{refinement:s,message:c=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${es(n)}\``}=e;return{value:n,type:a,refinement:s,key:i[i.length-1],path:i,branch:o,...e,message:c}}function*rs(e,t,r,n){(function(e){return Qa(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const i of e){const e=ts(i,t,r,n);e&&(yield e)}}function*ns(e,t,r={}){const{path:n=[],branch:i=[e],coerce:o=!1,mask:a=!1}=r,s={path:n,branch:i};if(o&&(e=t.coercer(e,s),a&&"type"!==t.type&&Qa(t.schema)&&Qa(e)&&!Array.isArray(e)))for(const r in e)void 0===t.schema[r]&&delete e[r];let c="valid";for(const n of t.validator(e,s))n.explanation=r.message,c="not_valid",yield[n,void 0];for(let[u,l,f]of t.entries(e,s)){const t=ns(l,f,{path:void 0===u?n:[...n,u],branch:void 0===u?i:[...i,l],coerce:o,mask:a,message:r.message});for(const r of t)r[0]?(c=null===r[0].refinement||void 0===r[0].refinement?"not_valid":"not_refined",yield[r[0],void 0]):o&&(l=r[1],void 0===u?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):Qa(e)&&(void 0!==l||u in e)&&(e[u]=l))}if("not_valid"!==c)for(const n of t.refiner(e,s))n.explanation=r.message,c="not_refined",yield[n,void 0];"valid"===c&&(yield[void 0,e])}let is=class{constructor(e){const{type:t,schema:r,validator:n,refiner:i,coercer:o=e=>e,entries:a=function*(){}}=e;this.type=t,this.schema=r,this.entries=a,this.coercer=o,this.validator=n?(e,t)=>rs(n(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>rs(i(e,t),t,this,e):()=>[]}assert(e,t){return os(e,this,t)}create(e,t){return as(e,this,t)}is(e){return ss(e,this)}mask(e,t){return function(e,t,r){const n=cs(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}(e,this,t)}validate(e,t={}){return cs(e,this,t)}};function os(e,t,r){const n=cs(e,t,{message:r});if(n[0])throw n[0]}function as(e,t,r){const n=cs(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function ss(e,t){return!cs(e,t)[0]}function cs(e,t,r={}){const n=ns(e,t,r),i=function(e){const{done:t,value:r}=e.next();return t?void 0:r}(n);if(i[0]){return[new Xa(i[0],(function*(){for(const e of n)e[0]&&(yield e[0])})),void 0]}return[void 0,i[1]]}function us(e,t){return new is({type:e,schema:null,validator:t})}function ls(e){let t;return new is({type:"lazy",schema:null,*entries(r,n){t??(t=e()),yield*t.entries(r,n)},validator:(r,n)=>(t??(t=e()),t.validator(r,n)),coercer:(r,n)=>(t??(t=e()),t.coercer(r,n)),refiner:(r,n)=>(t??(t=e()),t.refiner(r,n))})}function fs(e){return new is({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${es(e)}`})}function ds(e){const t=es(e),r=typeof e;return new is({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?e:null,validator:r=>r===e||`Expected the literal \`${t}\`, but received: ${es(r)}`})}function hs(){return us("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${es(e)}`))}function ps(e){const t=e?Object.keys(e):[],r=us("never",(()=>!1));return new is({type:"object",schema:e??null,*entries(n){if(e&&Qa(n)){const i=new Set(Object.keys(n));for(const r of t)i.delete(r),yield[r,n[r],e[r]];for(const e of i)yield[e,n[e],r]}},validator:e=>Qa(e)||`Expected an object, but received: ${es(e)}`,coercer:e=>Qa(e)?{...e}:e})}function ms(e){return new is({...e,validator:(t,r)=>void 0===t||e.validator(t,r),refiner:(t,r)=>void 0===t||e.refiner(t,r)})}function bs(e,t){return new is({type:"record",schema:null,*entries(r){if(Qa(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator:e=>Qa(e)||`Expected an object, but received: ${es(e)}`})}function gs(){return us("string",(e=>"string"==typeof e||`Expected a string, but received: ${es(e)}`))}function ys(e){const t=e.map((e=>e.type)).join(" | ");return new is({type:"union",schema:null,coercer(t){for(const r of e){const[e,n]=r.validate(t,{coerce:!0});if(!e)return n}return t},validator(r,n){const i=[];for(const t of e){const[...e]=ns(r,t,n),[o]=e;if(!o?.[0])return[];for(const[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${es(r)}`,...i]}})}let vs=class e extends Error{constructor(t,{cause:r}={}){super(t),this.name=e.name,r&&(this.cause=r),this.message=t}};var ws=Object.freeze({__proto__:null,ErrorWithCause:vs});const Es=e=>{if(e&&"object"==typeof e&&"cause"in e){if("function"==typeof e.cause){const t=e.cause();return t instanceof Error?t:void 0}return e.cause instanceof Error?e.cause:void 0}},As=(e,t)=>{if(!(e instanceof Error))return"";const r=e.stack||"";if(t.has(e))return r+"\ncauses have become circular...";const n=Es(e);return n?(t.add(e),r+"\ncaused by: "+As(n,t)):r},xs=(e,t,r)=>{if(!(e instanceof Error))return"";const n=r?"":e.message||"";if(t.has(e))return n+": ...";const i=Es(e);if(i){t.add(e);const r="cause"in e&&"function"==typeof e.cause;return n+(r?"":": ")+xs(i,t,r)}return n};var _s=Object.freeze({__proto__:null,findCauseByReference:(e,t)=>{if(!e||!t)return;if(!(e instanceof Error))return;if(!(t.prototype instanceof Error)&&t!==Error)return;const r=new Set;let n=e;for(;n&&!r.has(n);){if(r.add(n),n instanceof t)return n;n=Es(n)}},getErrorCause:Es,messageWithCauses:e=>xs(e,new Set),stackWithCauses:e=>As(e,new Set)});function ks(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)}const Ss=(e,t)=>Object.hasOwnProperty.call(e,t);var Ps;function Is(e){return function(e){return function(e){return"object"==typeof e&&null!==e&&"message"in e}(e)&&"string"==typeof e.message?e.message:function(e){return null==e}(e)?"":String(e)}(e).replace(/\.$/u,"")}function Ts(e,t){return r=e,Boolean("string"==typeof r?.prototype?.constructor?.name)?new e({message:t}):e({message:t});var r}!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(Ps=Ps||(Ps={}));let Os=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}};function Ms(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function Cs(e,...t){if(!((r=e)instanceof Uint8Array||null!=r&&"object"==typeof r&&"Uint8Array"===r.constructor.name))throw new Error("Uint8Array expected");var r;if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function Bs(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");Ms(e.outputLen),Ms(e.blockLen)}function Ns(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Rs(e,t){Cs(e);const r=t.outputLen;if(e.length>js&Ls)}:{h:0|Number(e>>js&Ls),l:0|Number(e&Ls)}}function Ds(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;inew DataView(e.buffer,e.byteOffset,e.byteLength),Hs=(e,t)=>e<<32-t|e>>>t,Gs=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];function qs(e){for(let r=0;r>>8&65280|t>>>24&255;var t}function Ks(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function Vs(e){return"string"==typeof e&&(e=Ks(e)),Cs(e),e}function Ws(...e){let t=0;for(let r=0;re().update(Vs(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Ys(e=32){if(zs&&"function"==typeof zs.getRandomValues)return zs.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}const Xs=[],Qs=[],ec=[],tc=BigInt(0),rc=BigInt(1),nc=BigInt(2),ic=BigInt(7),oc=BigInt(256),ac=BigInt(113);for(let e=0,t=rc,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],Xs.push(2*(5*n+r)),Qs.push((e+1)*(e+2)/2%64);let i=tc;for(let e=0;e<7;e++)t=(t<>ic)*ac)%oc,t&nc&&(i^=rc<<(rc<r>32?((e,t,r)=>t<>>64-r)(e,t,r):((e,t,r)=>e<>>32-r)(e,t,r),lc=(e,t,r)=>r>32?((e,t,r)=>e<>>64-r)(e,t,r):((e,t,r)=>t<>>32-r)(e,t,r);let fc=class e extends Js{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Ms(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)))(this.state)}keccak(){Gs||qs(this.state32),function(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,o=r[i],a=r[i+1],s=uc(o,a,1)^r[n],c=lc(o,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=s,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=Qs[r],o=uc(t,i,n),a=lc(t,i,n),s=Xs[r];t=e[s],i=e[s+1],e[s]=o,e[s+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=sc[n],e[1]^=cc[n]}r.fill(0)}(this.state32,this.rounds),Gs||qs(this.state32),this.posOut=0,this.pos=0}update(e){Ns(this);const{blockLen:t,state:r}=this,n=(e=Vs(e)).length;for(let i=0;i=r&&this.keccak();const o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Ms(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Rs(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:r,suffix:n,outputLen:i,rounds:o,enableXOF:a}=this;return t||(t=new e(r,n,i,a,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=n,t.outputLen=i,t.enableXOF=a,t.destroyed=this.destroyed,t}};const dc=((e,t,r)=>Zs((()=>new fc(t,e,r))))(1,136,32),hc=e=>ps(e);function pc({path:e,branch:t}){const r=e[e.length-1];return Ss(t[t.length-2],r)}function mc(e){return new is({...e,type:`optional ${e.type}`,validator:(t,r)=>!pc(r)||e.validator(t,r),refiner:(t,r)=>!pc(r)||e.refiner(t,r)})}const bc=ys([ds(null),us("boolean",(e=>"boolean"==typeof e)),us("finite number",(e=>ss(e,hs())&&Number.isFinite(e))),gs(),fs(ls((()=>bc))),bs(gs(),ls((()=>bc)))]),gc=function(e,t,r){return new is({...e,coercer:(n,i)=>ss(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}(bc,us("any",(()=>!0)),(e=>(function(e,t,r="Assertion failed",n=Os){try{os(e,t)}catch(e){throw Ts(n,`${r}: ${Is(e)}.`)}}(e,bc),JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t}))))));function yc(e){try{return function(e){as(e,gc)}(e),!0}catch{return!1}}const vc=ds("2.0"),wc=function(e){return new is({...e,validator:(t,r)=>null===t||e.validator(t,r),refiner:(t,r)=>null===t||e.refiner(t,r)})}(ys([hs(),gs()])),Ec=hc({code:us("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${es(e)}`)),message:gs(),data:mc(gc),stack:mc(gs())}),Ac=ys([bs(gs(),gc),fs(gc)]);hc({id:wc,jsonrpc:vc,method:gs(),params:mc(Ac)}),hc({jsonrpc:vc,method:gs(),params:mc(Ac)}),ps({id:wc,jsonrpc:vc,result:ms(us("unknown",(()=>!0))),error:ms(Ec)});function xc(e){return ss(e,Ec)}ys([hc({id:wc,jsonrpc:vc,result:gc}),hc({id:wc,jsonrpc:vc,error:Ec})]);var _c,kc,Sc={exports:{}};function Pc(){if(kc)return _c;kc=1;var e=1e3,t=60*e,r=60*t,n=24*r,i=7*n,o=365.25*n;function a(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}return _c=function(s,c){c=c||{};var u=typeof s;if("string"===u&&s.length>0)return function(a){if((a=String(a)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(a);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*i;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===u&&isFinite(s))return c.long?function(i){var o=Math.abs(i);if(o>=n)return a(i,o,n,"day");if(o>=r)return a(i,o,r,"hour");if(o>=t)return a(i,o,t,"minute");if(o>=e)return a(i,o,e,"second");return i+" ms"}(s):function(i){var o=Math.abs(i);if(o>=n)return Math.round(i/n)+"d";if(o>=r)return Math.round(i/r)+"h";if(o>=t)return Math.round(i/t)+"m";if(o>=e)return Math.round(i/e)+"s";return i+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))},_c}var Ic=function(e){function t(e){let n,i,o,a=null;function s(...e){if(!s.enabled)return;const r=s,i=Number(new Date),o=i-(n||i);r.diff=o,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";a++;const o=t.formatters[i];if("function"==typeof o){const t=e[a];n=o.call(r,t),e.splice(a,1),a--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=r,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{a=e}}),"function"==typeof t.init&&t.init(s),s}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t{"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==pr&&"env"in pr&&(e=pr.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Ic(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Sc,Sc.exports);var Tc=Sc.exports,Oc={exports:{}};var Mc={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};const Cc="object"==typeof pr&&pr.env&&pr.env.NODE_DEBUG&&/\bsemver\b/i.test(pr.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var Bc=Cc;!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=Mc,o=Bc,a=(t=e.exports={}).re=[],s=t.safeRe=[],c=t.src=[],u=t.t={};let l=0;const f="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",i],[f,n]],h=(e,t,r)=>{const n=(e=>{for(const[t,r]of d)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),i=l++;o(e,i,t),u[e]=i,c[i]=t,a[i]=new RegExp(t,r?"g":void 0),s[i]=new RegExp(n,r?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),h("MAINVERSION",`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${c[u.NUMERICIDENTIFIER]}|${c[u.NONNUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${c[u.NUMERICIDENTIFIERLOOSE]}|${c[u.NONNUMERICIDENTIFIER]})`),h("PRERELEASE",`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${f}+`),h("BUILD",`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h("FULL",`^${c[u.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h("LOOSE",`^${c[u.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h("XRANGE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),h("COERCE",`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h("COERCEFULL",c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?`+`(?:${c[u.BUILD]})?(?:$|[^\\d])`),h("COERCERTL",c[u.COERCE],!0),h("COERCERTLFULL",c[u.COERCEFULL],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${c[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",h("TILDE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${c[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",h("CARET",`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(Oc,Oc.exports);var Nc=Oc.exports;const Rc=Object.freeze({loose:!0}),Fc=Object.freeze({});var Lc=e=>e?"object"!=typeof e?Rc:e:Fc;const jc=/^[0-9]+$/,Uc=(e,t)=>{const r=jc.test(e),n=jc.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:eUc(t,e)};const zc=Bc,{MAX_LENGTH:$c,MAX_SAFE_INTEGER:Hc}=Mc,{safeRe:Gc,t:qc}=Nc,Kc=Lc,{compareIdentifiers:Vc}=Dc;var Wc=class e{constructor(t,r){if(r=Kc(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>$c)throw new TypeError(`version is longer than ${$c} characters`);zc("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?Gc[qc.LOOSE]:Gc[qc.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Hc||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Hc||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Hc||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),0===Vc(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};const Jc=Wc;var Zc=(e,t,r=!1)=>{if(e instanceof Jc)return e;try{return new Jc(e,t)}catch(e){if(!r)return null;throw e}};const Yc=Zc;var Xc=(e,t)=>{const r=Yc(e,t);return r?r.version:null};const Qc=Zc;var eu=(e,t)=>{const r=Qc(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};const tu=Wc;var ru=(e,t,r,n,i)=>{"string"==typeof r&&(i=n,n=r,r=void 0);try{return new tu(e instanceof tu?e.version:e,r).inc(t,n,i).version}catch(e){return null}};const nu=Zc;var iu=(e,t)=>{const r=nu(e,null,!0),n=nu(t,null,!0),i=r.compare(n);if(0===i)return null;const o=i>0,a=o?r:n,s=o?n:r,c=!!a.prerelease.length;if(!!s.prerelease.length&&!c)return s.patch||s.minor?a.patch?"patch":a.minor?"minor":"major":"major";const u=c?"pre":"";return r.major!==n.major?u+"major":r.minor!==n.minor?u+"minor":r.patch!==n.patch?u+"patch":"prerelease"};const ou=Wc;var au=(e,t)=>new ou(e,t).major;const su=Wc;var cu=(e,t)=>new su(e,t).minor;const uu=Wc;var lu=(e,t)=>new uu(e,t).patch;const fu=Zc;var du=(e,t)=>{const r=fu(e,t);return r&&r.prerelease.length?r.prerelease:null};const hu=Wc;var pu=(e,t,r)=>new hu(e,r).compare(new hu(t,r));const mu=pu;var bu=(e,t,r)=>mu(t,e,r);const gu=pu;var yu=(e,t)=>gu(e,t,!0);const vu=Wc;var wu=(e,t,r)=>{const n=new vu(e,r),i=new vu(t,r);return n.compare(i)||n.compareBuild(i)};const Eu=wu;var Au=(e,t)=>e.sort(((e,r)=>Eu(e,r,t)));const xu=wu;var _u=(e,t)=>e.sort(((e,r)=>xu(r,e,t)));const ku=pu;var Su=(e,t,r)=>ku(e,t,r)>0;const Pu=pu;var Iu=(e,t,r)=>Pu(e,t,r)<0;const Tu=pu;var Ou=(e,t,r)=>0===Tu(e,t,r);const Mu=pu;var Cu=(e,t,r)=>0!==Mu(e,t,r);const Bu=pu;var Nu=(e,t,r)=>Bu(e,t,r)>=0;const Ru=pu;var Fu=(e,t,r)=>Ru(e,t,r)<=0;const Lu=Ou,ju=Cu,Uu=Su,Du=Nu,zu=Iu,$u=Fu;var Hu=(e,t,r,n)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return Lu(e,r,n);case"!=":return ju(e,r,n);case">":return Uu(e,r,n);case">=":return Du(e,r,n);case"<":return zu(e,r,n);case"<=":return $u(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};const Gu=Wc,qu=Zc,{safeRe:Ku,t:Vu}=Nc;var Wu=(e,t)=>{if(e instanceof Gu)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){const n=t.includePrerelease?Ku[Vu.COERCERTLFULL]:Ku[Vu.COERCERTL];let i;for(;(i=n.exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&i.index+i[0].length===r.index+r[0].length||(r=i),n.lastIndex=i.index+i[1].length+i[2].length;n.lastIndex=-1}else r=e.match(t.includePrerelease?Ku[Vu.COERCEFULL]:Ku[Vu.COERCE]);if(null===r)return null;const n=r[2],i=r[3]||"0",o=r[4]||"0",a=t.includePrerelease&&r[5]?`-${r[5]}`:"",s=t.includePrerelease&&r[6]?`+${r[6]}`:"";return qu(`${n}.${i}.${o}${a}${s}`,t)};var Ju,Zu,Yu,Xu,Qu=class{constructor(){this.max=1e3,this.map=new Map}get(e){const t=this.map.get(e);return void 0===t?void 0:(this.map.delete(e),this.map.set(e,t),t)}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}};function el(){if(Zu)return Ju;Zu=1;const e=/\s+/g;class t{constructor(r,o){if(o=n(o),r instanceof t)return r.loose===!!o.loose&&r.includePrerelease===!!o.includePrerelease?r:new t(r.raw,o);if(r instanceof i)return this.raw=r.value,this.set=[[r]],this.formatted=void 0,this;if(this.options=o,this.loose=!!o.loose,this.includePrerelease=!!o.includePrerelease,this.raw=r.trim().replace(e," "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!p(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&m(e[0])){this.set=[e];break}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e0&&(this.formatted+="||");const t=this.set[e];for(let e=0;e0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&d)|(this.options.loose&&h))+":"+e,n=r.get(t);if(n)return n;const a=this.options.loose,m=a?s[c.HYPHENRANGELOOSE]:s[c.HYPHENRANGE];e=e.replace(m,P(this.options.includePrerelease)),o("hyphen replace",e),e=e.replace(s[c.COMPARATORTRIM],u),o("comparator trim",e),e=e.replace(s[c.TILDETRIM],l),o("tilde trim",e),e=e.replace(s[c.CARETTRIM],f),o("caret trim",e);let b=e.split(" ").map((e=>g(e,this.options))).join(" ").split(/\s+/).map((e=>S(e,this.options)));a&&(b=b.filter((e=>(o("loose invalid filter",e,this.options),!!e.match(s[c.COMPARATORLOOSE]))))),o("range list",b);const y=new Map,v=b.map((e=>new i(e,this.options)));for(const e of v){if(p(e))return[e];y.set(e.value,e)}y.size>1&&y.has("")&&y.delete("");const w=[...y.values()];return r.set(t,w),w}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some((t=>b(t,r)&&e.set.some((e=>b(e,r)&&t.every((t=>e.every((e=>t.intersects(e,r)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new a(e,this.options)}catch(e){return!1}for(let t=0;t"<0.0.0-0"===e.value,m=e=>""===e.value,b=(e,t)=>{let r=!0;const n=e.slice();let i=n.pop();for(;r&&n.length;)r=n.every((e=>i.intersects(e,t))),i=n.pop();return r},g=(e,t)=>(o("comp",e,t),e=E(e,t),o("caret",e),e=v(e,t),o("tildes",e),e=x(e,t),o("xrange",e),e=k(e,t),o("stars",e),e),y=e=>!e||"x"===e.toLowerCase()||"*"===e,v=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{const r=t.loose?s[c.TILDELOOSE]:s[c.TILDE];return e.replace(r,((t,r,n,i,a)=>{let s;return o("tilde",e,t,r,n,i,a),y(r)?s="":y(n)?s=`>=${r}.0.0 <${+r+1}.0.0-0`:y(i)?s=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:a?(o("replaceTilde pr",a),s=`>=${r}.${n}.${i}-${a} <${r}.${+n+1}.0-0`):s=`>=${r}.${n}.${i} <${r}.${+n+1}.0-0`,o("tilde return",s),s}))},E=(e,t)=>e.trim().split(/\s+/).map((e=>A(e,t))).join(" "),A=(e,t)=>{o("caret",e,t);const r=t.loose?s[c.CARETLOOSE]:s[c.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,a,s)=>{let c;return o("caret",e,t,r,i,a,s),y(r)?c="":y(i)?c=`>=${r}.0.0${n} <${+r+1}.0.0-0`:y(a)?c="0"===r?`>=${r}.${i}.0${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${n} <${+r+1}.0.0-0`:s?(o("replaceCaret pr",s),c="0"===r?"0"===i?`>=${r}.${i}.${a}-${s} <${r}.${i}.${+a+1}-0`:`>=${r}.${i}.${a}-${s} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${a}-${s} <${+r+1}.0.0-0`):(o("no pr"),c="0"===r?"0"===i?`>=${r}.${i}.${a}${n} <${r}.${i}.${+a+1}-0`:`>=${r}.${i}.${a}${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${a} <${+r+1}.0.0-0`),o("caret return",c),c}))},x=(e,t)=>(o("replaceXRanges",e,t),e.split(/\s+/).map((e=>_(e,t))).join(" ")),_=(e,t)=>{e=e.trim();const r=t.loose?s[c.XRANGELOOSE]:s[c.XRANGE];return e.replace(r,((r,n,i,a,s,c)=>{o("xRange",e,r,n,i,a,s,c);const u=y(i),l=u||y(a),f=l||y(s),d=f;return"="===n&&d&&(n=""),c=t.includePrerelease?"-0":"",u?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&d?(l&&(a=0),s=0,">"===n?(n=">=",l?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):"<="===n&&(n="<",l?i=+i+1:a=+a+1),"<"===n&&(c="-0"),r=`${n+i}.${a}.${s}${c}`):l?r=`>=${i}.0.0${c} <${+i+1}.0.0-0`:f&&(r=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o("xRange return",r),r}))},k=(e,t)=>(o("replaceStars",e,t),e.trim().replace(s[c.STAR],"")),S=(e,t)=>(o("replaceGTE0",e,t),e.trim().replace(s[t.includePrerelease?c.GTE0PRE:c.GTE0],"")),P=e=>(t,r,n,i,o,a,s,c,u,l,f,d)=>`${r=y(n)?"":y(i)?`>=${n}.0.0${e?"-0":""}`:y(o)?`>=${n}.${i}.0${e?"-0":""}`:a?`>=${r}`:`>=${r}${e?"-0":""}`} ${c=y(u)?"":y(l)?`<${+u+1}.0.0-0`:y(f)?`<${u}.${+l+1}.0-0`:d?`<=${u}.${l}.${f}-${d}`:e?`<${u}.${l}.${+f+1}-0`:`<=${c}`}`.trim(),I=(e,t,r)=>{for(let r=0;r0){const n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0};return Ju}function tl(){if(Xu)return Yu;Xu=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(n,i){if(i=r(i),n instanceof t){if(n.loose===!!i.loose)return n;n=n.value}n=n.trim().split(/\s+/).join(" "),a("comparator",n,i),this.options=i,this.loose=!!i.loose,this.parse(n),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(t){const r=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],o=t.match(r);if(!o)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==o[1]?o[1]:"","="===this.operator&&(this.operator=""),o[2]?this.semver=new s(o[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(a("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new s(t,this.options)}catch(e){return!1}return o(t,this.operator,this.semver,this.options)}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new c(e.value,n).test(this.value):""===e.operator?""===e.value||new c(this.value,n).test(e.semver):(!(n=r(n)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!n.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||(!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||(!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||(!!(o(this.semver,"<",e.semver,n)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(o(this.semver,">",e.semver,n)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}Yu=t;const r=Lc,{safeRe:n,t:i}=Nc,o=Hu,a=Bc,s=Wc,c=el();return Yu}const rl=el();var nl=(e,t,r)=>{try{t=new rl(t,r)}catch(e){return!1}return t.test(e)};const il=el();var ol=(e,t)=>new il(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")));const al=Wc,sl=el();var cl=(e,t,r)=>{let n=null,i=null,o=null;try{o=new sl(t,r)}catch(e){return null}return e.forEach((e=>{o.test(e)&&(n&&-1!==i.compare(e)||(n=e,i=new al(n,r)))})),n};const ul=Wc,ll=el();var fl=(e,t,r)=>{let n=null,i=null,o=null;try{o=new ll(t,r)}catch(e){return null}return e.forEach((e=>{o.test(e)&&(n&&1!==i.compare(e)||(n=e,i=new ul(n,r)))})),n};const dl=Wc,hl=el(),pl=Su;var ml=(e,t)=>{e=new hl(e,t);let r=new dl("0.0.0");if(e.test(r))return r;if(r=new dl("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t{const t=new dl(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":i&&!pl(t,i)||(i=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!i||r&&!pl(r,i)||(r=i)}return r&&e.test(r)?r:null};const bl=el();var gl=(e,t)=>{try{return new bl(e,t).range||"*"}catch(e){return null}};const yl=Wc,vl=tl(),{ANY:wl}=vl,El=el(),Al=nl,xl=Su,_l=Iu,kl=Fu,Sl=Nu;var Pl=(e,t,r,n)=>{let i,o,a,s,c;switch(e=new yl(e,n),t=new El(t,n),r){case">":i=xl,o=kl,a=_l,s=">",c=">=";break;case"<":i=_l,o=Sl,a=xl,s="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Al(e,t,n))return!1;for(let r=0;r{e.semver===wl&&(e=new vl(">=0.0.0")),l=l||e,f=f||e,i(e.semver,l.semver,n)?l=e:a(e.semver,f.semver,n)&&(f=e)})),l.operator===s||l.operator===c)return!1;if((!f.operator||f.operator===s)&&o(e,f.semver))return!1;if(f.operator===c&&a(e,f.semver))return!1}return!0};const Il=Pl;var Tl=(e,t,r)=>Il(e,t,">",r);const Ol=Pl;var Ml=(e,t,r)=>Ol(e,t,"<",r);const Cl=el();var Bl=(e,t,r)=>(e=new Cl(e,r),t=new Cl(t,r),e.intersects(t,r));const Nl=nl,Rl=pu;const Fl=el(),Ll=tl(),{ANY:jl}=Ll,Ul=nl,Dl=pu,zl=[new Ll(">=0.0.0-0")],$l=[new Ll(">=0.0.0")],Hl=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===jl){if(1===t.length&&t[0].semver===jl)return!0;e=r.includePrerelease?zl:$l}if(1===t.length&&t[0].semver===jl){if(r.includePrerelease)return!0;t=$l}const n=new Set;let i,o,a,s,c,u,l;for(const t of e)">"===t.operator||">="===t.operator?i=Gl(i,t,r):"<"===t.operator||"<="===t.operator?o=ql(o,t,r):n.add(t.semver);if(n.size>1)return null;if(i&&o){if(a=Dl(i.semver,o.semver,r),a>0)return null;if(0===a&&(">="!==i.operator||"<="!==o.operator))return null}for(const e of n){if(i&&!Ul(e,String(i),r))return null;if(o&&!Ul(e,String(o),r))return null;for(const n of t)if(!Ul(e,String(n),r))return!1;return!0}let f=!(!o||r.includePrerelease||!o.semver.prerelease.length)&&o.semver,d=!(!i||r.includePrerelease||!i.semver.prerelease.length)&&i.semver;f&&1===f.prerelease.length&&"<"===o.operator&&0===f.prerelease[0]&&(f=!1);for(const e of t){if(l=l||">"===e.operator||">="===e.operator,u=u||"<"===e.operator||"<="===e.operator,i)if(d&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===d.major&&e.semver.minor===d.minor&&e.semver.patch===d.patch&&(d=!1),">"===e.operator||">="===e.operator){if(s=Gl(i,e,r),s===e&&s!==i)return!1}else if(">="===i.operator&&!Ul(i.semver,String(e),r))return!1;if(o)if(f&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===f.major&&e.semver.minor===f.minor&&e.semver.patch===f.patch&&(f=!1),"<"===e.operator||"<="===e.operator){if(c=ql(o,e,r),c===e&&c!==o)return!1}else if("<="===o.operator&&!Ul(o.semver,String(e),r))return!1;if(!e.operator&&(o||i)&&0!==a)return!1}return!(i&&u&&!o&&0!==a)&&(!(o&&l&&!i&&0!==a)&&(!d&&!f))},Gl=(e,t,r)=>{if(!e)return t;const n=Dl(e.semver,t.semver,r);return n>0?e:n<0||">"===t.operator&&">="===e.operator?t:e},ql=(e,t,r)=>{if(!e)return t;const n=Dl(e.semver,t.semver,r);return n<0?e:n>0||"<"===t.operator&&"<="===e.operator?t:e};var Kl=(e,t,r={})=>{if(e===t)return!0;e=new Fl(e,r),t=new Fl(t,r);let n=!1;e:for(const i of e.set){for(const e of t.set){const t=Hl(i,e,r);if(n=n||null!==t,t)continue e}if(n)return!1}return!0};const Vl=Nc,Wl=Mc,Jl=Wc,Zl=Dc,Yl=(e,t,r)=>{const n=[];let i=null,o=null;const a=e.sort(((e,t)=>Rl(e,t,r)));for(const e of a){Nl(e,t,r)?(o=e,i||(i=e)):(o&&n.push([i,o]),o=null,i=null)}i&&n.push([i,null]);const s=[];for(const[e,t]of n)e===t?s.push(e):t||e!==a[0]?t?e===a[0]?s.push(`<=${t}`):s.push(`${e} - ${t}`):s.push(`>=${e}`):s.push("*");const c=s.join(" || "),u="string"==typeof t.raw?t.raw:String(t);return c.length=-32099&&e<=-32e3}(e))return rf}return t}function of(e,{fallbackError:t=tf,shouldIncludeStack:r=!0}={}){if(!xc(t))throw new Error("Must provide fallback error with integer number code and string message.");const n=function(e,t){if(e&&"object"==typeof e&&"serialize"in e&&"function"==typeof e.serialize)return e.serialize();if(xc(e))return e;const r=af(e),n={...t,data:{cause:r}};return n}(e,t);return r||delete n.stack,n}function af(e){return Array.isArray(e)?e.map((e=>yc(e)?e:ks(e)?sf(e):null)):ks(e)?sf(e):yc(e)?e:null}function sf(e){return Object.getOwnPropertyNames(e).reduce(((t,r)=>{const n=e[r];return yc(n)&&(t[r]=n),t}),{})}var cf=class extends Error{constructor(e,t,r){var n=(...e)=>{super(...e)};if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a non-empty string.');!function(e){return ks(e)&&Ss(e,"cause")&&ks(e.cause)}(r)?n(t):(n(t,{cause:r.cause}),Ss(this,"cause")||Object.assign(this,{cause:r.cause})),void 0!==r&&(this.data=r),this.code=e}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data,function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}(this.data)&&(e.data.cause=af(this.data.cause))),this.stack&&(e.stack=this.stack),e}toString(){return Wa(this.serialize(),lf,2)}},uf=class extends cf{constructor(e,t,r){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}};function lf(e,t){if("[Circular]"!==t)return t}var ff={parse:e=>hf(Ja.parse,e),invalidRequest:e=>hf(Ja.invalidRequest,e),invalidParams:e=>hf(Ja.invalidParams,e),methodNotFound:e=>hf(Ja.methodNotFound,e),internal:e=>hf(Ja.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return hf(t,e)},invalidInput:e=>hf(Ja.invalidInput,e),resourceNotFound:e=>hf(Ja.resourceNotFound,e),resourceUnavailable:e=>hf(Ja.resourceUnavailable,e),transactionRejected:e=>hf(Ja.transactionRejected,e),methodNotSupported:e=>hf(Ja.methodNotSupported,e),limitExceeded:e=>hf(Ja.limitExceeded,e)},df={userRejectedRequest:e=>pf(Za.userRejectedRequest,e),unauthorized:e=>pf(Za.unauthorized,e),unsupportedMethod:e=>pf(Za.unsupportedMethod,e),disconnected:e=>pf(Za.disconnected,e),chainDisconnected:e=>pf(Za.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:n}=e;if(!r||"string"!=typeof r)throw new Error('"message" must be a nonempty string');return new uf(t,r,n)}};function hf(e,t){const[r,n]=mf(t);return new cf(e,r??nf(e),n)}function pf(e,t){const[r,n]=mf(t);return new uf(e,r??nf(e),n)}function mf(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t??void 0,r]}}return[]}var bf={exports:{}},gf=function e(t,r){if(t&&r)return e(t)(r);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(e){n[e]=t[e]})),n;function n(){for(var e=new Array(arguments.length),r=0;r{throw e}))}}bf.exports=yf(vf),bf.exports.strict=yf(wf),vf.proto=vf((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return vf(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return wf(this)},configurable:!0})})),/^v?\.0/.test(pr.version);class Af extends ge{emit(e){let t="error"===e;const r=this._events;if(void 0!==r)t=t&&void 0===r.error;else if(!t)return!1;for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o0&&([e]=i),e instanceof Error)throw e;const t=new Error("Unhandled error."+(e?` (${e.message})`:""));throw t.context=e,t}const a=r[e];if(void 0===a)return!1;if("function"==typeof a)Ef(a,this,i);else{const e=a.length,t=function(e){const t=e.length,r=new Array(t);for(let n=0;n{const o=e[t.method];return void 0===o?n():"function"==typeof o?o(t,r,n,i):(r.result=o,i())}}function kf(e){return async(t,r,n,i)=>{let o;const a=new Promise((e=>{o=e}));let s=null,c=!1;const u=async()=>{c=!0,n((e=>{s=e,o()})),await a};try{await e(t,r,u),c?(await a,s(null)):i(null)}catch(e){const t=e;s?s(t):i(t)}}}class Sf extends Af{constructor(){super(),r(this,"_middleware",void 0),this._middleware=[]}static async _runAllMiddleware(e,t,r){const n=[];let i=null,o=!1;for(const a of r)if([i,o]=await Sf._runMiddleware(e,t,a,n),o)break;return[i,o,n.reverse()]}static _runMiddleware(e,t,r,n){return new Promise((i=>{const o=e=>{const r=e||t.error;r&&(!1===Object.keys(r).includes("stack")&&(r.stack="Stack trace is not available."),t.error=of(r,{shouldIncludeStack:!0,fallbackError:{message:(null==r?void 0:r.message)||(null==r?void 0:r.toString()),code:(null==r?void 0:r.code)||-32603,stack:null==r?void 0:r.stack,data:(null==r?void 0:r.data)||(null==r?void 0:r.message)||(null==r?void 0:r.toString())}})),i([r,!0])},a=e=>{t.error?o(t.error):(e&&("function"!=typeof e&&o(new xf({code:-32603,message:"JRPCEngine: 'next' return handlers must be functions"})),n.push(e)),i([null,!1]))};try{r(e,t,a,o)}catch(e){o(e)}}))}static async _runReturnHandlers(e){for(const t of e)await new Promise(((e,r)=>{t((t=>t?r(t):e()))}))}static _checkForCompletion(e,t,r){if(!("result"in t)&&!("error"in t))throw new xf({code:-32603,message:"Response has no error or result for request"});if(!r)throw new xf({code:-32603,message:"Nothing ended request"})}push(e){this._middleware.push(e)}handle(e,t){if(t&&"function"!=typeof t)throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?t?this._handleBatch(e,t):this._handleBatch(e):t?this._handle(e,t):this._promiseHandle(e)}asMiddleware(){return async(e,t,r,n)=>{try{const[i,o,a]=await Sf._runAllMiddleware(e,t,this._middleware);return o?(await Sf._runReturnHandlers(a),n(i)):r((async e=>{try{await Sf._runReturnHandlers(a)}catch(t){return e(t)}return e()}))}catch(e){return n(e)}}}async _handleBatch(e,t){try{const r=await Promise.all(e.map(this._promiseHandle.bind(this)));return t?t(null,r):r}catch(e){if(t)return t(e);throw e}}_promiseHandle(e){return new Promise(((t,r)=>{this._handle(e,((e,n)=>{e&&void 0===n?r(e):t(n)})).catch(r)}))}async _handle(e,t){if(!e||Array.isArray(e)||"object"!=typeof e){const e=new xf({code:-32603,message:"request must be plain object"});return t(e,{id:void 0,jsonrpc:"2.0",error:e})}if("string"!=typeof e.method){const r=new xf({code:-32603,message:"method must be string"});return t(r,{id:e.id,jsonrpc:"2.0",error:r})}const r=i({},e),n={id:r.id,jsonrpc:r.jsonrpc};let o=null;try{await this._processRequest(r,n)}catch(e){o=e}var a,s,c,u,l,f,d;o&&(delete n.result,n.error||(!1===Object.keys(o).includes("stack")&&(o.stack="Stack trace is not available."),n.error=of(o,{shouldIncludeStack:!0,fallbackError:{message:(null===(a=o)||void 0===a?void 0:a.message)||(null===(s=o)||void 0===s?void 0:s.toString()),code:(null===(c=o)||void 0===c?void 0:c.code)||-32603,stack:null===(u=o)||void 0===u?void 0:u.stack,data:(null===(l=o)||void 0===l?void 0:l.data)||(null===(f=o)||void 0===f?void 0:f.message)||(null===(d=o)||void 0===d?void 0:d.toString())}})));return t(o,n)}async _processRequest(e,t){const[r,n,i]=await Sf._runAllMiddleware(e,t,this._middleware);if(Sf._checkForCompletion(e,t,n),await Sf._runReturnHandlers(i),r)throw r}}function Pf(e){const t=new Sf;return e.forEach((e=>t.push(e))),t.asMiddleware()}function If(e){const t=new Af;return t.sendAsync=async t=>{const r=await e.handle(t);if(r.error){var n,i,o,a,s,c,u;!1===Object.keys(r.error).includes("stack")&&(r.error.stack="Stack trace is not available.");const e=of(r.error,{fallbackError:{message:(null===(n=r.error)||void 0===n?void 0:n.message)||(null===(i=r.error)||void 0===i?void 0:i.toString()),code:(null===(o=r.error)||void 0===o?void 0:o.code)||-32603,stack:null===(a=r.error)||void 0===a?void 0:a.stack,data:(null===(s=r.error)||void 0===s?void 0:s.data)||(null===(c=r.error)||void 0===c?void 0:c.message)||(null===(u=r.error)||void 0===u?void 0:u.toString())},shouldIncludeStack:!0});throw ff.internal(e)}return r.result},t.send=(t,r)=>{if("function"!=typeof r)throw new Error('Must provide callback to "send" method.');e.handle(t,r)},e.on&&e.on("notification",(e=>{t.emit("data",null,e)})),t.request=async e=>{const r=i(i({},e),{},{id:Math.random().toString(36).slice(2),jsonrpc:"2.0"});return await t.sendAsync(r)},t}var Tf={exports:{}},Of={},Mf={};Object.defineProperty(Mf,"__esModule",{value:!0}),Mf.default=function(e){var t=e.length,r=t%4;if(!r)return e;var n=t,i=4-r,o=t+i,a=_.alloc(o);for(a.write(e);i--;)a.write("=",n++);return a.toString()},Object.defineProperty(Of,"__esModule",{value:!0});var Cf=Mf;function Bf(e,t){return void 0===t&&(t="utf8"),_.isBuffer(e)?Rf(e.toString("base64")):Rf(_.from(e,t).toString("base64"))}function Nf(e){return e=e.toString(),Cf.default(e).replace(/\-/g,"+").replace(/_/g,"/")}function Rf(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var Ff=Bf;Ff.encode=Bf,Ff.decode=function(e,t){return void 0===t&&(t="utf8"),_.from(Nf(e),"base64").toString(t)},Ff.toBase64=Nf,Ff.fromBase64=Rf,Ff.toBuffer=function(e){return _.from(Nf(e),"base64")},Of.default=Ff,function(e){e.exports=Of.default,e.exports.default=e.exports}(Tf);const Lf={MAINNET:"mainnet",TESTNET:"testnet",CYAN:"cyan",AQUA:"aqua",CELESTE:"celeste"},jf={SAPPHIRE_DEVNET:"sapphire_devnet",SAPPHIRE_MAINNET:"sapphire_mainnet"},Uf=a(Tf.exports);function Df(e){return Uf.decode(e)}function zf(e){return Uf.encode(JSON.stringify(e))}function $f(e){let t,r=!1,n=0;try{t=window[e],r=!0,n=t.length;const i="__storage_test__";return t.setItem(i,i),t.removeItem(i),!0}catch(e){const t=e;return t&&(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name)&&r&&0!==n}}class Hf{constructor(){r(this,"store",new Map)}getItem(e){return this.store.get(e)||null}setItem(e,t){this.store.set(e,t)}removeItem(e){this.store.delete(e)}}class Gf{constructor(e,t){r(this,"storage",void 0),r(this,"_storeKey",void 0),this.storage=t,this._storeKey=e;try{t.getItem(e)||this.resetStore()}catch(e){}}static getInstance(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"local";if(!this.instanceMap.has(e)){let r;r="local"===t&&$f("localStorage")?window.localStorage:"session"===t&&$f("sessionStorage")?window.sessionStorage:new Hf,this.instanceMap.set(e,new this(e,r))}return this.instanceMap.get(e)}toJSON(){return this.storage.getItem(this._storeKey)}resetStore(){const e=this.getStore();return this.storage.removeItem(this._storeKey),e}getStore(){return JSON.parse(this.storage.getItem(this._storeKey)||"{}")}get(e){return JSON.parse(this.storage.getItem(this._storeKey)||"{}")[e]}set(e,t){const r=JSON.parse(this.storage.getItem(this._storeKey)||"{}");r[e]=t,this.storage.setItem(this._storeKey,JSON.stringify(r))}}r(Gf,"instanceMap",new Map);const qf="popup",Kf="redirect",Vf=i(i({},jf),Lf),Wf="secp256k1",Jf="ed25519",Zf="facebook",Yf="line",Xf="login",Qf="enable_mfa",ed="manage_mfa",td="modify_social_factor",rd="production",nd="development",id="staging",od="testing";var ad,sd=(ad=function(e,t){return ad=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},ad(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}ad(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),cd=function(e){function t(t,r){var n=this.constructor,i=e.call(this,t,r)||this;return Object.defineProperty(i,"name",{value:n.name,enumerable:!1,configurable:!0}),function(e,t){var r=Object.setPrototypeOf;r?r(e,t):e.__proto__=t}(i,n.prototype),function(e,t){void 0===t&&(t=e.constructor);var r=Error.captureStackTrace;r&&r(e,t)}(i),i}return sd(t,e),t}(Error),ud={exports:{}};!function(e,t){var r="__lodash_hash_undefined__",n=9007199254740991,i="[object Arguments]",a="[object AsyncFunction]",s="[object Function]",c="[object GeneratorFunction]",u="[object Null]",l="[object Object]",f="[object Proxy]",d="[object Undefined]",h=/^\[object .+?Constructor\]$/,p=/^(?:0|[1-9]\d*)$/,m={};m["[object Float32Array]"]=m["[object Float64Array]"]=m["[object Int8Array]"]=m["[object Int16Array]"]=m["[object Int32Array]"]=m["[object Uint8Array]"]=m["[object Uint8ClampedArray]"]=m["[object Uint16Array]"]=m["[object Uint32Array]"]=!0,m[i]=m["[object Array]"]=m["[object ArrayBuffer]"]=m["[object Boolean]"]=m["[object DataView]"]=m["[object Date]"]=m["[object Error]"]=m[s]=m["[object Map]"]=m["[object Number]"]=m[l]=m["[object RegExp]"]=m["[object Set]"]=m["[object String]"]=m["[object WeakMap]"]=!1;var b="object"==typeof o&&o&&o.Object===Object&&o,g="object"==typeof self&&self&&self.Object===Object&&self,y=b||g||Function("return this")(),v=t&&!t.nodeType&&t,w=v&&e&&!e.nodeType&&e,E=w&&w.exports===v,A=E&&b.process,x=function(){try{var e=w&&w.require&&w.require("util").types;return e||A&&A.binding&&A.binding("util")}catch(e){}}(),_=x&&x.isTypedArray;var k=Array.prototype,S=Function.prototype,P=Object.prototype,I=y["__core-js_shared__"],T=S.toString,O=P.hasOwnProperty,M=function(){var e=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),C=P.toString,B=T.call(Object),N=RegExp("^"+T.call(O).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),R=E?y.Buffer:void 0,F=y.Symbol,L=y.Uint8Array;R&&R.allocUnsafe;var j=function(e,t){return function(r){return e(t(r))}}(Object.getPrototypeOf,Object),U=Object.create,D=P.propertyIsEnumerable,z=k.splice,$=F?F.toStringTag:void 0,H=function(){try{var e=pe(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),G=R?R.isBuffer:void 0,q=Math.max,K=Date.now,V=pe(y,"Map"),W=pe(Object,"create"),J=function(){function e(){}return function(t){if(!Te(t))return{};if(U)return U(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function Z(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t-1},Y.prototype.set=function(e,t){var r=this.__data__,n=ne(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},X.prototype.clear=function(){this.size=0,this.__data__={hash:new Z,map:new(V||Y),string:new Z}},X.prototype.delete=function(e){var t=he(this,e).delete(e);return this.size-=t?1:0,t},X.prototype.get=function(e){return he(this,e).get(e)},X.prototype.has=function(e){return he(this,e).has(e)},X.prototype.set=function(e,t){var r=he(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Q.prototype.clear=function(){this.__data__=new Y,this.size=0},Q.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Q.prototype.get=function(e){return this.__data__.get(e)},Q.prototype.has=function(e){return this.__data__.has(e)},Q.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Y){var n=r.__data__;if(!V||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new X(n)}return r.set(e,t),this.size=r.size,this};var oe=function(e,t,r){for(var n=-1,i=Object(e),o=r(e),a=o.length;a--;){var s=o[++n];if(!1===t(i[s],s,i))break}return e};function ae(e){return null==e?void 0===e?d:u:$&&$ in Object(e)?function(e){var t=O.call(e,$),r=e[$];try{e[$]=void 0;var n=!0}catch(e){}var i=C.call(e);n&&(t?e[$]=r:delete e[$]);return i}(e):function(e){return C.call(e)}(e)}function se(e){return Oe(e)&&ae(e)==i}function ce(e){return!(!Te(e)||(t=e,M&&M in t))&&(Pe(e)?N:h).test(function(e){if(null!=e){try{return T.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function ue(e){if(!Te(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=be(e),r=[];for(var n in e)("constructor"!=n||!t&&O.call(e,n))&&r.push(n);return r}function le(e,t,r,n,i){e!==t&&oe(t,(function(o,a){if(i||(i=new Q),Te(o))!function(e,t,r,n,i,o,a){var s=ge(e,r),c=ge(t,r),u=a.get(c);if(u)return void te(e,r,u);var f=o?o(s,c,r+"",e,t,a):void 0,d=void 0===f;if(d){var h=_e(c),p=!h&&Se(c),m=!h&&!p&&Me(c);f=c,h||p||m?_e(s)?f=s:!function(e){return Oe(e)&&ke(e)}(s)?p?(d=!1,f=function(e){return e.slice()}(c)):m?(d=!1,f=function(e){var t=(r=e.buffer,n=new r.constructor(r.byteLength),new L(n).set(new L(r)),n);var r,n;return new e.constructor(t,e.byteOffset,e.length)}(c)):f=[]:f=function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r-1&&e%1==0&&e0){if(++ve>=800)return arguments[0]}else ve=0;return ye.apply(void 0,arguments)});function Ae(e,t){return e===t||e!=e&&t!=t}var xe=se(function(){return arguments}())?se:function(e){return Oe(e)&&O.call(e,"callee")&&!D.call(e,"callee")},_e=Array.isArray;function ke(e){return null!=e&&Ie(e.length)&&!Pe(e)}var Se=G||function(){return!1};function Pe(e){if(!Te(e))return!1;var t=ae(e);return t==s||t==c||t==a||t==f}function Ie(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}function Te(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Oe(e){return null!=e&&"object"==typeof e}var Me=_?function(e){return function(t){return e(t)}}(_):function(e){return Oe(e)&&Ie(e.length)&&!!m[ae(e)]};function Ce(e){return ke(e)?ee(e):ue(e)}var Be,Ne=(Be=function(e,t,r){le(e,t,r)},fe((function(e,t){var r=-1,n=t.length,i=n>1?t[n-1]:void 0,o=n>2?t[2]:void 0;for(i=Be.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!Te(r))return!1;var n=typeof t;return!!("number"==n?ke(r)&&me(t,r.length):"string"==n&&t in r)&&Ae(r[t],e)}(t[0],t[1],o)&&(i=n<3?void 0:i,n=1),e=Object(e);++r=0&&t<=f.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?d+=":"+e:"symbol"==typeof e&&(d=void 0),f.name=e,f.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},f.methodFactory=r||l,f.getLevel=function(){return null!=u?u:null!=s?s:a},f.setLevel=function(e,r){return u=p(e),!1!==r&&function(e){var r=(n[e]||"silent").toUpperCase();if(typeof window!==t&&d){try{return void(window.localStorage[d]=r)}catch(e){}try{window.document.cookie=encodeURIComponent(d)+"="+r+";"}catch(e){}}}(u),c.call(f)},f.setDefaultLevel=function(e){s=p(e),h()||f.setLevel(e,!1)},f.resetLevel=function(){u=null,function(){if(typeof window!==t&&d){try{window.localStorage.removeItem(d)}catch(e){}try{window.document.cookie=encodeURIComponent(d)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),c.call(f)},f.enableAll=function(e){f.setLevel(f.levels.TRACE,e)},f.disableAll=function(e){f.setLevel(f.levels.SILENT,e)},f.rebuild=function(){if(o!==f&&(a=p(o.getLevel())),c.call(f),o===f)for(var e in i)i[e].rebuild()},a=p(o?o.getLevel():"WARN");var m=h();null!=m&&(u=p(m)),c.call(f)}(o=new f).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=i[e];return t||(t=i[e]=new f(e,o.methodFactory)),t};var d=typeof window!==t?window.log:void 0;return o.noConflict=function(){return typeof window!==t&&window.log===o&&(window.log=d),o},o.getLoggers=function(){return i},o.default=o,o}))}(fd);var dd=fd.exports,hd=a(dd);const pd=hd.getLogger("http-helpers");pd.setLevel(dd.levels.INFO);async function md(e,t){let r=null;try{r=new URL(e)}catch(e){}return fetch(e,t)}function bd(){const e={"x-api-key":"torus-default"};return e}function gd(e){pd.info(`Response: ${e.status} ${e.statusText}`),pd.info(`Url: ${e.url}`)}const yd=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r={mode:"cors",headers:{}};(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).useAPIKey&&(r.headers=i(i({},r.headers),bd()));const n=ld(r,t,{method:"GET"}),o=await md(e,n);if(o.ok){const e=o.headers.get("content-type");return null!=e&&e.includes("application/json")?o.json():o.text()}throw gd(o),o},vd=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};n.useAPIKey&&(o.headers=i(i({},o.headers),bd()));const a=ld(o,r,{method:"POST"});return n.isUrlEncodedData?(a.body=t,"application/json; charset=utf-8"===a.headers["Content-Type"]&&delete a.headers["Content-Type"]):a.body=JSON.stringify(t),(async(e,t)=>{let r=null;try{const n=new Promise(((t,n)=>{r=setTimeout((()=>{n(new Error(`Timed out in ${e}ms`))}),e)})),i=await Promise.race([t,n]);return null!=r&&clearTimeout(r),i}catch(e){throw null!=r&&clearTimeout(r),e}})(n.timeout||6e4,md(e,a).then((e=>{if(n.logTracingHeader&&function(e){const t=e.headers.get("x-web3-correlation-id");t&&pd.info(`Request tracing with traceID = ${t}`)}(e),e.ok){const t=e.headers.get("content-type");return null!=t&&t.includes("application/json")?e.json():e.text()}throw gd(e),e})))};class wd extends Error{}wd.prototype.name="InvalidTokenError";const Ed={EIP155:"eip155",SOLANA:"solana",OTHER:"other"},Ad="multichain",xd=(e,t)=>{if(e===Ed.OTHER)return null;const r=t?"number"==typeof t?t:parseInt(t,16):(e=>{if(e===Ed.EIP155)return 1;if(e===Ed.SOLANA)return 1;throw new Error(`Chain namespace ${e} is not supported`)})(e);return e===Ed.EIP155?(e=>{const t=Ed.EIP155;return 1===e?{chainNamespace:t,chainId:"0x1",rpcTarget:"https://rpc.ankr.com/eth",displayName:"Ethereum Mainnet",blockExplorer:"https://etherscan.io/",ticker:"ETH",tickerName:"Ethereum",decimals:18}:5===e?{chainNamespace:t,chainId:"0x5",rpcTarget:"https://rpc.ankr.com/eth_goerli",displayName:"Goerli Testnet",blockExplorer:"https://goerli.etherscan.io/",ticker:"ETH",tickerName:"Ethereum",decimals:18}:11155111===e?{chainNamespace:t,chainId:"0xaa36a7",rpcTarget:"https://rpc.ankr.com/eth_sepolia",displayName:"Sepolia Testnet",blockExplorer:"https://sepolia.etherscan.io/",ticker:"ETH",tickerName:"Ethereum",decimals:18}:137===e?{chainNamespace:t,chainId:"0x89",rpcTarget:"https://rpc.ankr.com/polygon",displayName:"Polygon Mainnet",blockExplorer:"https://polygonscan.com",ticker:"MATIC",tickerName:"Polygon"}:80001===e?{chainNamespace:t,chainId:"0x13881",rpcTarget:"https://rpc.ankr.com/polygon_mumbai",displayName:"Polygon Mumbai Testnet",blockExplorer:"https://mumbai.polygonscan.com/",ticker:"MATIC",tickerName:"Polygon",decimals:18}:56===e?{chainNamespace:t,chainId:"0x38",rpcTarget:"https://rpc.ankr.com/bsc",displayName:"Binance SmartChain Mainnet",blockExplorer:"https://bscscan.com",ticker:"BNB",tickerName:"Binance SmartChain",decimals:18}:97===e?{chainNamespace:t,chainId:"0x61",rpcTarget:"https://rpc.ankr.com/bsc_testnet_chapel",displayName:"Binance SmartChain Testnet",blockExplorer:"https://testnet.bscscan.com",ticker:"BNB",tickerName:"Binance SmartChain",decimals:18}:25===e?{chainNamespace:t,chainId:"0x19",rpcTarget:"https://rpc.cronos.org",displayName:"Cronos Mainnet",blockExplorer:"https://cronoscan.com/",ticker:"CRO",tickerName:"Cronos"}:338===e?{chainNamespace:t,chainId:"0x152",rpcTarget:"https://rpc-t3.cronos.org/",displayName:"Cronos Testnet",blockExplorer:"https://cronoscan.com/",ticker:"CRO",tickerName:"Cronos",decimals:18}:8217===e?{chainNamespace:t,chainId:"0x2019",rpcTarget:"https://public-node-api.klaytnapi.com/v1/cypress",displayName:"Klaytn Mainnet",blockExplorer:"https://scope.klaytn.com",ticker:"KLAY",tickerName:"Klaytn",decimals:18}:null})(r):e===Ed.SOLANA?(e=>{const t=Ed.SOLANA;return 1===e?{chainNamespace:t,chainId:"0x1",rpcTarget:"https://rpc.ankr.com/solana",displayName:"Solana Mainnet",blockExplorer:"https://explorer.solana.com",ticker:"SOL",tickerName:"Solana",decimals:9}:2===e?{chainNamespace:t,chainId:"0x2",rpcTarget:"https://api.testnet.solana.com",displayName:"Solana Testnet",blockExplorer:"https://explorer.solana.com?cluster=testnet",ticker:"SOL",tickerName:"Solana",decimals:9}:3===e?{chainNamespace:t,chainId:"0x3",rpcTarget:"https://api.devnet.solana.com",displayName:"Solana Devnet",blockExplorer:"https://explorer.solana.com?cluster=devnet",ticker:"SOL",tickerName:"Solana",decimals:9}:null})(r):null};class _d extends cd{constructor(e,t){super(t),r(this,"code",void 0),r(this,"message",void 0),this.code=e,this.message=t||"",Object.defineProperty(this,"name",{value:"Web3AuthError"})}toJSON(){return{name:this.name,code:this.code,message:this.message}}toString(){return JSON.stringify(this.toJSON())}}class kd extends _d{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{value:"WalletInitializationError"})}static fromCode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new kd(e,`${kd.messages[e]}, ${t}`)}static notFound(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return kd.fromCode(5001,e)}static notInstalled(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return kd.fromCode(5002,e)}static notReady(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return kd.fromCode(5003,e)}static windowBlocked(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return kd.fromCode(5004,e)}static windowClosed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return kd.fromCode(5005,e)}static incompatibleChainNameSpace(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return kd.fromCode(5006,e)}static duplicateAdapterError(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return kd.fromCode(5007,e)}static invalidProviderConfigError(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return kd.fromCode(5008,e)}static providerNotReadyError(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return kd.fromCode(5009,e)}static rpcConnectionError(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return kd.fromCode(5010,e)}static invalidParams(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return kd.fromCode(5011,e)}static invalidNetwork(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return kd.fromCode(5013,e)}}r(kd,"messages",{5e3:"Custom",5001:"Wallet is not found",5002:"Wallet is not installed",5003:"Wallet is not ready yet",5004:"Wallet window is blocked",5005:"Wallet window has been closed by the user",5006:"Incompatible chain namespace provided",5007:"Adapter has already been included",5008:"Invalid provider Config",5009:"Provider is not ready yet",5010:"Failed to connect with rpc url",5011:"Invalid params passed in",5013:"Invalid network provided"});class Sd extends _d{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{value:"WalletLoginError"})}static fromCode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new Sd(e,`${Sd.messages[e]}. ${t}`)}static connectionError(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Sd.fromCode(5111,e)}static disconnectionError(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Sd.fromCode(5112,e)}static notConnectedError(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Sd.fromCode(5113,e)}static popupClosed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Sd.fromCode(5114,e)}static mfaEnabled(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Sd.fromCode(5115,e)}static chainConfigNotAdded(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Sd.fromCode(5116,e)}static unsupportedOperation(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Sd.fromCode(5117,e)}static coreKitKeyNotFound(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Sd.fromCode(5118,e)}static userNotLoggedIn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Sd.fromCode(5119,e)}}r(Sd,"messages",{5e3:"Custom",5111:"Failed to connect with wallet",5112:"Failed to disconnect from wallet",5113:"Wallet is not connected",5114:"Wallet popup has been closed by the user",5115:"User has already enabled mfa, please use the @web3auth/web3auth-web sdk for login with mfa",5116:"Chain config has not been added. Please add the chain config before calling switchChain",5117:"Unsupported operation",5118:"useCoreKitKey flag is enabled but coreKitKey is not available",5119:"User not logged in."});class Pd extends _d{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{value:"WalletOperationsError"})}static fromCode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new Pd(e,`${Pd.messages[e]}, ${t}`)}static chainIDNotAllowed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Pd.fromCode(5201,e)}static operationNotAllowed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Pd.fromCode(5202,e)}static chainNamespaceNotAllowed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Pd.fromCode(5203,e)}}r(Pd,"messages",{5e3:"Custom",5201:"Provided chainId is not allowed",5202:"This operation is not allowed"});class Id extends _d{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{value:"WalletProviderError"})}static fromCode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new Pd(e,`${Id.messages[e]}, ${t}`)}static invalidRequestArgs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Pd.fromCode(5301,e)}static invalidRequestMethod(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Pd.fromCode(5302,e)}static invalidRequestParams(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Pd.fromCode(5303,e)}}r(Id,"messages",{5e3:"Custom",5301:"Expected a single, non-array, object argument.",5302:"'args.method' must be a non-empty string.",5303:"'args.params' must be an object or array if provided."});const Td={OPENLOGIN:"openlogin",WALLET_CONNECT_V2:"wallet-connect-v2"},Od=i({TORUS_SOLANA:"torus-solana",PHANTOM:"phantom",SOLFLARE:"solflare",SLOPE:"slope"},Td),Md=i({TORUS_EVM:"torus-evm",METAMASK:"metamask",COINBASE:"coinbase"},Td),Cd=i(i({},Md),Od);Od.TORUS_SOLANA,Od.PHANTOM,Od.SOLFLARE,Od.SLOPE,Md.TORUS_EVM,Md.METAMASK,Md.COINBASE;const Bd="in_app",Nd={NOT_READY:"not_ready",READY:"ready",CONNECTING:"connecting",CONNECTED:"connected",DISCONNECTED:"disconnected",ERRORED:"errored"},Rd=i(i({},Nd),{},{ADAPTER_DATA_UPDATED:"adapter_data_updated",CACHE_CLEAR:"cache_clear"});class Fd extends Af{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),r(this,"adapterData",{}),r(this,"sessionTime",86400),r(this,"clientId",void 0),r(this,"web3AuthNetwork",Vf.MAINNET),r(this,"useCoreKitKey",void 0),r(this,"rehydrated",!1),r(this,"chainConfig",null),r(this,"knownChainConfigs",{}),r(this,"adapterNamespace",void 0),r(this,"currentChainNamespace",void 0),r(this,"type",void 0),r(this,"name",void 0),r(this,"status",void 0),this.setAdapterSettings(e)}get chainConfigProxy(){return this.chainConfig?i({},this.chainConfig):null}get connnected(){return this.status===Nd.CONNECTED}setAdapterSettings(e){if(this.status===Nd.READY)return;null!=e&&e.sessionTime&&(this.sessionTime=e.sessionTime),null!=e&&e.clientId&&(this.clientId=e.clientId),null!=e&&e.web3AuthNetwork&&(this.web3AuthNetwork=e.web3AuthNetwork),void 0!==(null==e?void 0:e.useCoreKitKey)&&(this.useCoreKitKey=e.useCoreKitKey);const t=e.chainConfig;if(t){if(!t.chainNamespace)throw kd.notReady("ChainNamespace is required while setting chainConfig");this.currentChainNamespace=t.chainNamespace;const e=i(i({},xd(t.chainNamespace,t.chainId)||{}),t);this.chainConfig=e,this.addChainConfig(e)}}checkConnectionRequirements(){if(this.name!==Cd.WALLET_CONNECT_V2||this.status!==Nd.CONNECTING){if(this.status===Nd.CONNECTING)throw kd.notReady("Already connecting");if(this.status===Nd.CONNECTED)throw Sd.connectionError("Already connected");if(this.status!==Nd.READY)throw Sd.connectionError("Wallet adapter is not ready yet, Please wait for init function to resolve before calling connect/connectTo function")}}checkInitializationRequirements(){if(!this.clientId)throw kd.invalidParams("Please initialize Web3Auth with a valid clientId in constructor");if(!this.chainConfig)throw kd.invalidParams("rpcTarget is required in chainConfig");if(!this.chainConfig.rpcTarget&&this.chainConfig.chainNamespace!==Ed.OTHER)throw kd.invalidParams("rpcTarget is required in chainConfig");if(!this.chainConfig.chainId&&this.chainConfig.chainNamespace!==Ed.OTHER)throw kd.invalidParams("chainID is required in chainConfig");if(this.status!==Nd.NOT_READY){if(this.status===Nd.CONNECTED)throw kd.notReady("Already connected");if(this.status===Nd.READY)throw kd.notReady("Adapter is already initialized")}}checkDisconnectionRequirements(){if(this.status!==Nd.CONNECTED)throw Sd.disconnectionError("Not connected with wallet")}checkAddChainRequirements(e){if(!(arguments.length>1&&void 0!==arguments[1]&&arguments[1])&&!this.provider)throw Sd.notConnectedError("Not connected with wallet.");if(this.currentChainNamespace!==e.chainNamespace)throw Pd.chainNamespaceNotAllowed("This adapter doesn't support this chainNamespace")}checkSwitchChainRequirements(e){let{chainId:t}=e;if(!(arguments.length>1&&void 0!==arguments[1]&&arguments[1])&&!this.provider)throw Sd.notConnectedError("Not connected with wallet.");if(!this.knownChainConfigs[t])throw Sd.chainConfigNotAdded("Invalid chainId")}updateAdapterData(e){this.adapterData=e,this.emit(Rd.ADAPTER_DATA_UPDATED,{adapterName:this.name,data:e})}addChainConfig(e){const t=this.knownChainConfigs[e.chainId];this.knownChainConfigs[e.chainId]=i(i({},t||{}),e)}getChainConfig(e){return this.knownChainConfigs[e]||null}}var Ld=hd.getLogger("web3auth-logger");function jd(e){let t,r=!1,n=0;try{t=window[e],r=!0,n=t.length;const i="__storage_test__";return t.setItem(i,i),t.removeItem(i),!0}catch(e){const t=e;return!(!t||22!==t.code&&1014!==t.code&&"QuotaExceededError"!==t.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==t.name||!r||0===n)}}const Ud=e=>("string"==typeof e||"number"==typeof e)&&/^(-)?0x[0-9a-f]*$/i.test(e),Dd=i(i({},Ed),{},{MULTICHAIN:"multichain"});const zd=(e,t,r)=>e&t^e&r^t&r;let $d=class extends Js{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=$s(this.buffer)}update(e){Ns(this);const{view:t,buffer:r,blockLen:n}=this,i=(e=Vs(e)).length;for(let o=0;on-o&&(this.process(r,0),o=0);for(let e=o;e>i&o),s=Number(r&o),c=n?4:0,u=n?0:4;e.setUint32(t+c,a,n),e.setUint32(t+u,s,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const a=$s(e),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=s/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e>>3,i=Hs(r,17)^Hs(r,19)^r>>>10;qd[e]=i+qd[e-7]+n+qd[e-16]|0}let{A:r,B:n,C:i,D:o,E:a,F:s,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(Hs(a,6)^Hs(a,11)^Hs(a,25))+((l=a)&s^~l&c)+Hd[e]+qd[e]|0,f=(Hs(r,2)^Hs(r,13)^Hs(r,22))+zd(r,n,i)|0;u=c,c=s,s=a,a=o+t|0,o=i,i=n,n=r,r=t+f|0}var l;r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,n,i,o,a,s,c,u)}roundClean(){qd.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Vd=Zs((()=>new Kd));let Wd=class extends Js{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,Bs(e);const r=Vs(t);if(this.iHash=e.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 n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?e.create().update(r).digest():r);for(let e=0;enew Wd(e,t).update(r).digest();Jd.create=(e,t)=>new Wd(e,t) /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */;const Zd=BigInt(0),Yd=BigInt(1),Xd=BigInt(2);function Qd(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function eh(e){if(!Qd(e))throw new Error("Uint8Array expected")}const th=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function rh(e){eh(e);let t="";for(let r=0;r=oh._0&&e<=oh._9?e-oh._0:e>=oh._A&&e<=oh._F?e-(oh._A-10):e>=oh._a&&e<=oh._f?e-(oh._a-10):void 0}function sh(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t(Xd<new Uint8Array(e),bh=e=>Uint8Array.from(e);function gh(e,t,r){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let n=mh(e),i=mh(e),o=0;const a=()=>{n.fill(1),i.fill(0),o=0},s=(...e)=>r(i,n,...e),c=(e=mh())=>{i=s(bh([0]),e),n=s(),0!==e.length&&(i=s(bh([1]),e),n=s())},u=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e{let r;for(a(),c(e);!(r=t(u()));)c();return a(),r}}const yh={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||Qd(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function vh(e,t,r={}){const n=(t,r,n)=>{const i=yh[r];if("function"!=typeof i)throw new Error(`Invalid validator "${r}", expected function`);const o=e[t];if(!(n&&void 0===o||i(o,e)))throw new Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${r}`)};for(const[e,r]of Object.entries(t))n(e,r,!1);for(const[e,t]of Object.entries(r))n(e,t,!0);return e}var wh=Object.freeze({__proto__:null,abytes:eh,bitGet:function(e,t){return e>>BigInt(t)&Yd},bitLen:function(e){let t;for(t=0;e>Zd;e>>=Yd,t+=1);return t},bitMask:ph,bitSet:function(e,t,r){return e|(r?Yd:Zd)<=Eh?r:t+r}function Th(e,t,r){if(r<=Eh||t 0");if(r===Ah)return Eh;let n=Ah;for(;t>Eh;)t&Ah&&(n=n*e%r),e=e*e%r,t>>=Ah;return n}function Oh(e,t,r){let n=e;for(;t-- >Eh;)n*=n,n%=r;return n}function Mh(e,t){if(e===Eh||t<=Eh)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=Ih(e,t),n=t,i=Eh,o=Ah;for(;r!==Eh;){const e=n%r,t=i-o*(n/r);n=r,r=e,i=o,o=t}if(n!==Ah)throw new Error("invert: does not exist");return Ih(i,t)}function Ch(e){if(e%kh===_h){const t=(e+Ah)/kh;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}if(e%Ph===Sh){const t=(e-Sh)/Ph;return function(e,r){const n=e.mul(r,xh),i=e.pow(n,t),o=e.mul(r,i),a=e.mul(e.mul(o,xh),i),s=e.mul(o,e.sub(a,e.ONE));if(!e.eql(e.sqr(s),r))throw new Error("Cannot find square root");return s}}return function(e){const t=(e-Ah)/xh;let r,n,i;for(r=e-Ah,n=0;r%xh===Eh;r/=xh,n++);for(i=xh;i(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});vh(e,t)}(e.Fp),vh(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Nh(e.n,e.nBitLength),...e,p:e.Fp.ORDER})} /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const{bytesToNumberBE:Dh,hexToBytes:zh}=wh,$h={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:t}=$h;if(e.length<2||2!==e[0])throw new t("Invalid signature integer tag");const r=e[1],n=e.subarray(2,r+2);if(!r||n.length!==r)throw new t("Invalid signature integer: wrong length");if(128&n[0])throw new t("Invalid signature integer: negative");if(0===n[0]&&!(128&n[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:Dh(n),l:e.subarray(r+2)}},toSig(e){const{Err:t}=$h,r="string"==typeof e?zh(e):e;eh(r);let n=r.length;if(n<2||48!=r[0])throw new t("Invalid signature tag");if(r[1]!==n-2)throw new t("Invalid signature: incorrect length");const{d:i,l:o}=$h._parseInt(r.subarray(2)),{d:a,l:s}=$h._parseInt(o);if(s.length)throw new t("Invalid signature: left bytes after parsing");return{r:i,s:a}},hexFromSig(e){const t=e=>8&Number.parseInt(e[0],16)?"00"+e:e,r=e=>{const t=e.toString(16);return 1&t.length?`0${t}`:t},n=t(r(e.s)),i=t(r(e.r)),o=n.length/2,a=i.length/2,s=r(o),c=r(a);return`30${r(a+o+4)}02${c}${i}02${s}${n}`}},Hh=BigInt(0),Gh=BigInt(1);BigInt(2);const qh=BigInt(3);function Kh(e){const t=function(e){const t=Uh(e);vh(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:i}=t;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:r}=t,n=t.toBytes||((e,t,n)=>{const i=t.toAffine();return hh(Uint8Array.from([4]),r.toBytes(i.x),r.toBytes(i.y))}),i=t.fromBytes||(e=>{const t=e.subarray(1);return{x:r.fromBytes(t.subarray(0,r.BYTES)),y:r.fromBytes(t.subarray(r.BYTES,2*r.BYTES))}});function o(e){const{a:n,b:i}=t,o=r.sqr(e),a=r.mul(o,e);return r.add(r.add(a,r.mul(e,n)),i)}if(!r.eql(r.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function a(e){return"bigint"==typeof e&&Hhr.eql(e,r.ZERO);return i(t)&&i(n)?f.ZERO:new f(t,n,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=r.invertBatch(e.map((e=>e.pz)));return e.map(((e,r)=>e.toAffine(t[r]))).map(f.fromAffine)}static fromHex(e){const t=f.fromAffine(i(dh("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return f.BASE.multiply(c(e))}_setWindowSize(e){this._WINDOW_SIZE=e,u.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:e,y:n}=this.toAffine();if(!r.isValid(e)||!r.isValid(n))throw new Error("bad point: x or y not FE");const i=r.sqr(n),a=o(e);if(!r.eql(i,a))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(r.isOdd)return!r.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){l(e);const{px:t,py:n,pz:i}=this,{px:o,py:a,pz:s}=e,c=r.eql(r.mul(t,s),r.mul(o,i)),u=r.eql(r.mul(n,s),r.mul(a,i));return c&&u}negate(){return new f(this.px,r.neg(this.py),this.pz)}double(){const{a:e,b:n}=t,i=r.mul(n,qh),{px:o,py:a,pz:s}=this;let c=r.ZERO,u=r.ZERO,l=r.ZERO,d=r.mul(o,o),h=r.mul(a,a),p=r.mul(s,s),m=r.mul(o,a);return m=r.add(m,m),l=r.mul(o,s),l=r.add(l,l),c=r.mul(e,l),u=r.mul(i,p),u=r.add(c,u),c=r.sub(h,u),u=r.add(h,u),u=r.mul(c,u),c=r.mul(m,c),l=r.mul(i,l),p=r.mul(e,p),m=r.sub(d,p),m=r.mul(e,m),m=r.add(m,l),l=r.add(d,d),d=r.add(l,d),d=r.add(d,p),d=r.mul(d,m),u=r.add(u,d),p=r.mul(a,s),p=r.add(p,p),d=r.mul(p,m),c=r.sub(c,d),l=r.mul(p,h),l=r.add(l,l),l=r.add(l,l),new f(c,u,l)}add(e){l(e);const{px:n,py:i,pz:o}=this,{px:a,py:s,pz:c}=e;let u=r.ZERO,d=r.ZERO,h=r.ZERO;const p=t.a,m=r.mul(t.b,qh);let b=r.mul(n,a),g=r.mul(i,s),y=r.mul(o,c),v=r.add(n,i),w=r.add(a,s);v=r.mul(v,w),w=r.add(b,g),v=r.sub(v,w),w=r.add(n,o);let E=r.add(a,c);return w=r.mul(w,E),E=r.add(b,y),w=r.sub(w,E),E=r.add(i,o),u=r.add(s,c),E=r.mul(E,u),u=r.add(g,y),E=r.sub(E,u),h=r.mul(p,w),u=r.mul(m,y),h=r.add(u,h),u=r.sub(g,h),h=r.add(g,h),d=r.mul(u,h),g=r.add(b,b),g=r.add(g,b),y=r.mul(p,y),w=r.mul(m,w),g=r.add(g,y),y=r.sub(b,y),y=r.mul(p,y),w=r.add(w,y),b=r.mul(g,w),d=r.add(d,b),b=r.mul(E,w),u=r.mul(v,u),u=r.sub(u,b),b=r.mul(v,g),h=r.mul(E,h),h=r.add(h,b),new f(u,d,h)}subtract(e){return this.add(e.negate())}is0(){return this.equals(f.ZERO)}wNAF(e){return h.wNAFCached(this,u,e,(e=>{const t=r.invertBatch(e.map((e=>e.pz)));return e.map(((e,r)=>e.toAffine(t[r]))).map(f.fromAffine)}))}multiplyUnsafe(e){const n=f.ZERO;if(e===Hh)return n;if(s(e),e===Gh)return this;const{endo:i}=t;if(!i)return h.unsafeLadder(this,e);let{k1neg:o,k1:a,k2neg:c,k2:u}=i.splitScalar(e),l=n,d=n,p=this;for(;a>Hh||u>Hh;)a&Gh&&(l=l.add(p)),u&Gh&&(d=d.add(p)),p=p.double(),a>>=Gh,u>>=Gh;return o&&(l=l.negate()),c&&(d=d.negate()),d=new f(r.mul(d.px,i.beta),d.py,d.pz),l.add(d)}multiply(e){s(e);let n,i,o=e;const{endo:a}=t;if(a){const{k1neg:e,k1:t,k2neg:s,k2:c}=a.splitScalar(o);let{p:u,f:l}=this.wNAF(t),{p:d,f:p}=this.wNAF(c);u=h.constTimeNegate(e,u),d=h.constTimeNegate(s,d),d=new f(r.mul(d.px,a.beta),d.py,d.pz),n=u.add(d),i=l.add(p)}else{const{p:e,f:t}=this.wNAF(o);n=e,i=t}return f.normalizeZ([n,i])[0]}multiplyAndAddUnsafe(e,t,r){const n=f.BASE,i=(e,t)=>t!==Hh&&t!==Gh&&e.equals(n)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,r));return o.is0()?void 0:o}toAffine(e){const{px:t,py:n,pz:i}=this,o=this.is0();null==e&&(e=o?r.ONE:r.inv(i));const a=r.mul(t,e),s=r.mul(n,e),c=r.mul(i,e);if(o)return{x:r.ZERO,y:r.ZERO};if(!r.eql(c,r.ONE))throw new Error("invZ was invalid");return{x:a,y:s}}isTorsionFree(){const{h:e,isTorsionFree:r}=t;if(e===Gh)return!0;if(r)return r(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:r}=t;return e===Gh?this:r?r(f,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return this.assertValidity(),n(f,this,e)}toHex(e=!0){return rh(this.toRawBytes(e))}}f.BASE=new f(t.Gx,t.Gy,r.ONE),f.ZERO=new f(r.ZERO,r.ONE,r.ZERO);const d=t.nBitLength,h=function(e,t){const r=(e,t)=>{const r=t.negate();return e?r:t},n=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:r,unsafeLadder(t,r){let n=e.ZERO,i=t;for(;r>Lh;)r&jh&&(n=n.add(i)),i=i.double(),r>>=jh;return n},precomputeWindow(e,t){const{windows:r,windowSize:i}=n(t),o=[];let a=e,s=a;for(let e=0;e>=d,n>s&&(n-=f,o+=jh);const a=t,h=t+Math.abs(n)-1,p=e%2!=0,m=n<0;0===n?u=u.add(r(p,i[a])):c=c.add(r(m,i[h]))}return{p:c,f:u}},wNAFCached(e,t,r,n){const i=e._WINDOW_SIZE||1;let o=t.get(e);return o||(o=this.precomputeWindow(e,i),1!==i&&t.set(e,n(o))),this.wNAF(i,o,r)}}}(f,t.endo?Math.ceil(d/2):d);return{CURVE:t,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:a}}function Vh(e){const t=function(e){const t=Uh(e);return vh(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:r,n:n}=t,i=r.BYTES+1,o=2*r.BYTES+1;function a(e){return Ih(e,n)}function s(e){return Mh(e,n)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:f}=Kh({...t,toBytes(e,t,n){const i=t.toAffine(),o=r.toBytes(i.x),a=hh;return n?a(Uint8Array.from([t.hasEvenY()?2:3]),o):a(Uint8Array.from([4]),o,r.toBytes(i.y))},fromBytes(e){const t=e.length,n=e[0],a=e.subarray(1);if(t!==i||2!==n&&3!==n){if(t===o&&4===n){return{x:r.fromBytes(a.subarray(0,r.BYTES)),y:r.fromBytes(a.subarray(r.BYTES,2*r.BYTES))}}throw new Error(`Point of length ${t} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const e=ch(a);if(!(Hh<(s=e)&&srh(lh(e,t.nByteLength));function h(e){return e>n>>Gh}const p=(e,t,r)=>ch(e.slice(t,r));class m{constructor(e,t,r){this.r=e,this.s=t,this.recovery=r,this.assertValidity()}static fromCompact(e){const r=t.nByteLength;return e=dh("compactSignature",e,2*r),new m(p(e,0,r),p(e,r,2*r))}static fromDER(e){const{r:t,s:r}=$h.toSig(dh("DER",e));return new m(t,r)}assertValidity(){if(!f(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!f(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(e){return new m(this.r,this.s,e)}recoverPublicKey(e){const{r:n,s:i,recovery:o}=this,u=v(dh("msgHash",e));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const l=2===o||3===o?n+t.n:n;if(l>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const f=1&o?"03":"02",h=c.fromHex(f+d(l)),p=s(l),m=a(-u*p),b=a(i*p),g=c.BASE.multiplyAndAddUnsafe(h,m,b);if(!g)throw new Error("point at infinify");return g.assertValidity(),g}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return sh(this.toDERHex())}toDERHex(){return $h.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return sh(this.toCompactHex())}toCompactHex(){return d(this.r)+d(this.s)}}const b={isValidPrivateKey(e){try{return u(e),!0}catch(e){return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const e=Fh(t.n);return function(e,t,r=!1){const n=e.length,i=Rh(t),o=Fh(t);if(n<16||n1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);const a=Ih(r?ch(e):uh(e),t-Ah)+Ah;return r?fh(a,i):lh(a,i)}(t.randomBytes(e),t.n)},precompute:(e=8,t=c.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function g(e){const t=Qd(e),r="string"==typeof e,n=(t||r)&&e.length;return t?n===i||n===o:r?n===2*i||n===2*o:e instanceof c}const y=t.bits2int||function(e){const r=ch(e),n=8*e.length-t.nBitLength;return n>0?r>>BigInt(n):r},v=t.bits2int_modN||function(e){return a(y(e))},w=ph(t.nBitLength);function E(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(Hh<=e&&ee in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:l}=t;let{lowS:d,prehash:p,extraEntropy:b}=i;null==d&&(d=!0),e=dh("msgHash",e),p&&(e=dh("prehashed msgHash",o(e)));const g=v(e),w=u(n),A=[E(w),E(g)];if(null!=b&&!1!==b){const e=!0===b?l(r.BYTES):b;A.push(dh("extraEntropy",e))}const _=hh(...A),k=g;return{seed:_,k2sig:function(e){const t=y(e);if(!f(t))return;const r=s(t),n=c.BASE.multiply(t).toAffine(),i=a(n.x);if(i===Hh)return;const o=a(r*a(k+i*w));if(o===Hh)return;let u=(n.x===i?0:2)|Number(n.y&Gh),l=o;return d&&h(o)&&(l=function(e){return h(e)?a(-e):e}(o),u^=1),new m(i,l,u)}}}const x={lowS:t.lowS,prehash:!1},_={lowS:t.lowS,prehash:!1};return c.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return c.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,r=!0){if(g(e))throw new Error("first arg must be private key");if(!g(t))throw new Error("second arg must be public key");return c.fromHex(t).multiply(u(e)).toRawBytes(r)},sign:function(e,r,n=x){const{seed:i,k2sig:o}=A(e,r,n),a=t;return gh(a.hash.outputLen,a.nByteLength,a.hmac)(i,o)},verify:function(e,r,n,i=_){const o=e;if(r=dh("msgHash",r),n=dh("publicKey",n),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:u,prehash:l}=i;let f,d;try{if("string"==typeof o||Qd(o))try{f=m.fromDER(o)}catch(e){if(!(e instanceof $h.Err))throw e;f=m.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:e,s:t}=o;f=new m(e,t)}}d=c.fromHex(n)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(u&&f.hasHighS())return!1;l&&(r=t.hash(r));const{r:h,s:p}=f,b=v(r),g=s(p),y=a(b*g),w=a(h*g),E=c.BASE.multiplyAndAddUnsafe(d,y,w)?.toAffine();return!!E&&a(E.x)===h},ProjectivePoint:c,Signature:m,utils:b}} /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Wh(e){return{hash:e,hmac:(t,...r)=>Jd(e,t,Ws(...r)),randomBytes:Ys}}BigInt(4); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const Jh=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Zh=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Yh=BigInt(1),Xh=BigInt(2),Qh=(e,t)=>(e+t/Xh)/t;const ep=function(e,t,r=!1,n={}){if(e<=Eh)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:o}=Nh(e,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=Ch(e),s=Object.freeze({ORDER:e,BITS:i,BYTES:o,MASK:ph(i),ZERO:Eh,ONE:Ah,create:t=>Ih(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return Eh<=t&&te===Eh,isOdd:e=>(e&Ah)===Ah,neg:t=>Ih(-t,e),eql:(e,t)=>e===t,sqr:t=>Ih(t*t,e),add:(t,r)=>Ih(t+r,e),sub:(t,r)=>Ih(t-r,e),mul:(t,r)=>Ih(t*r,e),pow:(e,t)=>function(e,t,r){if(r 0");if(r===Eh)return e.ONE;if(r===Ah)return t;let n=e.ONE,i=t;for(;r>Eh;)r&Ah&&(n=e.mul(n,i)),i=e.sqr(i),r>>=Ah;return n}(s,e,t),div:(t,r)=>Ih(t*Mh(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>Mh(t,e),sqrt:n.sqrt||(e=>a(s,e)),invertBatch:e=>function(e,t){const r=new Array(t.length),n=t.reduce(((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n))),e.ONE),i=e.inv(n);return t.reduceRight(((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n))),i),r}(s,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?fh(e,o):lh(e,o),fromBytes:e=>{if(e.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return r?uh(e):ch(e)}});return Object.freeze(s)}(Jh,void 0,void 0,{sqrt:function(e){const t=Jh,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),a=BigInt(23),s=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,f=Oh(l,r,t)*l%t,d=Oh(f,r,t)*l%t,h=Oh(d,Xh,t)*u%t,p=Oh(h,i,t)*h%t,m=Oh(p,o,t)*p%t,b=Oh(m,s,t)*m%t,g=Oh(b,c,t)*b%t,y=Oh(g,s,t)*m%t,v=Oh(y,r,t)*l%t,w=Oh(v,a,t)*p%t,E=Oh(w,n,t)*u%t,A=Oh(E,Xh,t);if(!ep.eql(ep.sqr(A),e))throw new Error("Cannot find square root");return A}}),tp=function(e,t){const r=t=>Vh({...e,...Wh(t)});return Object.freeze({...r(t),create:r})}({a:BigInt(0),b:BigInt(7),Fp:ep,n:Zh,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=Zh,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Yh*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,a=BigInt("0x100000000000000000000000000000000"),s=Qh(o*e,t),c=Qh(-n*e,t);let u=Ih(e-s*r-c*i,t),l=Ih(-s*n-c*o,t);const f=u>a,d=l>a;if(f&&(u=t-u),d&&(l=t-l),u>a||l>a)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:u,k2neg:d,k2:l}}}},Vd);function rp(e,t){if(e.length!==t.length)return!1;for(let r=0;r(Fs.bytes(t),e(t))}function ip(e){if("string"!=typeof e)throw new Error("[isHexPrefixed] input must be type 'string', received type "+typeof e);return"0"===e[0]&&"x"===e[1]}BigInt(0),tp.ProjectivePoint,(()=>{const e="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,t="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);t&&!e&&t("crypto")})();const op=e=>{if("string"!=typeof e)throw new Error("[stripHexPrefix] input must be type 'string', received "+typeof e);return ip(e)?e.slice(2):e};function ap(e){let t=e;if("string"!=typeof t)throw new Error("[padToEven] value must be type 'string', received "+typeof t);return t.length%2&&(t=`0${t}`),t}const sp=BigInt(0),cp={},up={};for(let e=0;e<16;e++){const t=e,r=16*e,n=e.toString(16).toLowerCase();up[n]=t,up[n.toUpperCase()]=t,cp[n]=r,cp[n.toUpperCase()]=r}function lp(e){const t=e.length,r=new Uint8Array(t/2);for(let n=0;nt.toString(16).padStart(2,"0"))),dp=[];for(let e=0;e<=65535;e++)dp[e]=BigInt(e);const hp=(e,t=!1)=>{t&&e.reverse();const r=(e=>{let t="0x";if(void 0===e||0===e.length)return t;for(const r of e)t+=fp[r];return t})(e);return"0x"===r?sp:4===r.length?dp[e[0]]:6===r.length?dp[256*e[0]+e[1]]:BigInt(r)},pp=e=>{if("string"!=typeof e)throw new Error(`hex argument type ${typeof e} must be of type string`);if(!/^0x[0-9a-fA-F]*$/.test(e))throw new Error(`Input must be a 0x-prefixed hexadecimal string, got ${e}`);return(e=e.slice(2)).length%2!=0&&(e=ap(e)),lp(e)},mp=e=>{const t=(e=>{if(!Number.isSafeInteger(e)||e<0)throw new Error(`Received an invalid integer type: ${e}`);return`0x${e.toString(16)}`})(e);return pp(t)},bp=(e,t=!1)=>{const r=gp("0x"+ap(e.toString(16)));return t?r.reverse():r},gp=e=>{if(null==e)return new Uint8Array;if(Array.isArray(e)||e instanceof Uint8Array)return Uint8Array.from(e);if("string"==typeof e){if(!function(e){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))}(e))throw new Error(`Cannot convert string to Uint8Array. toBytes only supports 0x-prefixed hex strings and this string was given: ${e}`);return pp(e)}if("number"==typeof e)return mp(e);if("bigint"==typeof e){if(e{if("0x"===e.slice(0,2))throw new Error("hex string is prefixed with 0x, should be unprefixed");return lp(ap(e))})(t)}if(void 0!==e.toBytes)return e.toBytes();throw new Error("invalid type")},yp=e=>BigInt.asIntN(256,hp(e)),vp=e=>bp(BigInt.asUintN(256,e));BigInt("0xffffffffffffffff"),BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),tp.CURVE.n,tp.CURVE.n,BigInt(2),BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");pp("0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");pp("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347");pp("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"),Uint8Array.from([128]),BigInt(-1),BigInt(0),BigInt(1),BigInt(2),BigInt(3),BigInt(7),BigInt(8),BigInt(27),BigInt(28),BigInt(31),BigInt(32),BigInt(64),BigInt(128),BigInt(255),BigInt(256),BigInt(96),BigInt(100),BigInt(160),BigInt(224),BigInt(7922816251426434e13),BigInt(1461501637330903e33),BigInt(2695994666715064e52),BigInt(1e9),Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));const wp=(()=>{const e=np(dc);return e.create=dc.create,e})();var Ep,Ap,xp;!function(e){e.String="string",e.Bytes="view",e.Number="number"}(Ep||(Ep={})),function(e){e.String="string",e.Bytes="view",e.JSON="json"}(Ap||(Ap={})),function(e){e[e.Number=0]="Number",e[e.BigInt=1]="BigInt",e[e.Uint8Array=2]="Uint8Array",e[e.PrefixedHexString=3]="PrefixedHexString"}(xp||(xp={}));const _p=np(Vd);var kp=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Sp=Math.ceil,Pp=Math.floor,Ip="[BigNumber Error] ",Tp=Ip+"Number primitive has more than 15 significant digits: ",Op=1e14,Mp=14,Cp=9007199254740991,Bp=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Np=1e7,Rp=1e9;function Fp(e){var t=0|e;return e>0||e===t?t:t-1}function Lp(e){for(var t,r,n=1,i=e.length,o=e[0]+"";nu^r?1:-1;for(s=(c=i.length)<(u=o.length)?c:u,a=0;ao[a]^r?1:-1;return c==u?0:c>u^r?1:-1}function Up(e,t,r,n){if(er||e!==Pp(e))throw Error(Ip+(n||"Argument")+("number"==typeof e?er?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Dp(e){var t=e.c.length-1;return Fp(e.e/Mp)==t&&e.c[t]%2!=0}function zp(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function $p(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else tv?d.c=d.e=null:e.e=10;c/=10,s++);return void(s>v?d.c=d.e=null:(d.e=s,d.c=[e]))}f=String(e)}else{if(!kp.test(f=String(e)))return i(d,f,u);d.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(s=f.indexOf("."))>-1&&(f=f.replace(".","")),(c=f.search(/e/i))>0?(s<0&&(s=c),s+=+f.slice(c+1),f=f.substring(0,c)):s<0&&(s=f.length)}else{if(Up(t,2,_.length,"Base"),10==t&&k)return O(d=new S(e),p+d.e+1,m);if(f=String(e),u="number"==typeof e){if(0*e!=0)return i(d,f,u,t);if(d.s=1/e<0?(f=f.slice(1),-1):1,S.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(Tp+e)}else d.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(r=_.slice(0,t),s=c=0,l=f.length;cs){s=l;continue}}else if(!a&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){a=!0,c=-1,s=0;continue}return i(d,String(e),u,t)}u=!1,(s=(f=n(f,t,10,d.s)).indexOf("."))>-1?f=f.replace(".",""):s=f.length}for(c=0;48===f.charCodeAt(c);c++);for(l=f.length;48===f.charCodeAt(--l););if(f=f.slice(c,++l)){if(l-=c,u&&S.DEBUG&&l>15&&(e>Cp||e!==Pp(e)))throw Error(Tp+d.s*e);if((s=s-c-1)>v)d.c=d.e=null;else if(s=g)?zp(c,a):$p(c,a,"0");else if(o=(e=O(new S(e),t,r)).e,s=(c=Lp(e.c)).length,1==n||2==n&&(t<=o||o<=b)){for(;ss){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-s)>0)for(o+1==s&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function I(e,t){for(var r,n,i=1,o=new S(e[0]);i=10;i/=10,n++);return(r=n+r*Mp-1)>v?e.c=e.e=null:r=10;s/=10,i++);if((o=t-i)<0)o+=Mp,a=t,c=f[u=0],l=Pp(c/d[i-a-1]%10);else if((u=Sp((o+1)/Mp))>=f.length){if(!n)break e;for(;f.length<=u;f.push(0));c=l=0,i=1,a=(o%=Mp)-Mp+1}else{for(c=s=f[u],i=1;s>=10;s/=10,i++);l=(a=(o%=Mp)-Mp+i)<0?0:Pp(c/d[i-a-1]%10)}if(n=n||t<0||null!=f[u+1]||(a<0?c:c%d[i-a-1]),n=r<4?(l||n)&&(0==r||r==(e.s<0?3:2)):l>5||5==l&&(4==r||n||6==r&&(o>0?a>0?c/d[i-a]:0:f[u-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,n?(t-=e.e+1,f[0]=d[(Mp-t%Mp)%Mp],e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=u,s=1,u--):(f.length=u+1,s=d[Mp-o],f[u]=a>0?Pp(c/d[i-a]%d[a])*s:0),n)for(;;){if(0==u){for(o=1,a=f[0];a>=10;a/=10,o++);for(a=f[0]+=s,s=1;a>=10;a/=10,s++);o!=s&&(e.e++,f[0]==Op&&(f[0]=1));break}if(f[u]+=s,f[u]!=Op)break;f[u--]=0,s=1}for(o=f.length;0===f[--o];f.pop());}e.e>v?e.c=e.e=null:e.e=g?zp(t,r):$p(t,r,"0"),e.s<0?"-"+t:t)}return S.clone=e,S.ROUND_UP=0,S.ROUND_DOWN=1,S.ROUND_CEIL=2,S.ROUND_FLOOR=3,S.ROUND_HALF_UP=4,S.ROUND_HALF_DOWN=5,S.ROUND_HALF_EVEN=6,S.ROUND_HALF_CEIL=7,S.ROUND_HALF_FLOOR=8,S.EUCLID=9,S.config=S.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(Ip+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(Up(r=e[t],0,Rp,t),p=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(Up(r=e[t],0,8,t),m=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(Up(r[0],-Rp,0,t),Up(r[1],0,Rp,t),b=r[0],g=r[1]):(Up(r,-Rp,Rp,t),b=-(g=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)Up(r[0],-Rp,-1,t),Up(r[1],1,Rp,t),y=r[0],v=r[1];else{if(Up(r,-Rp,Rp,t),!r)throw Error(Ip+t+" cannot be zero: "+r);y=-(v=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(Ip+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw w=!r,Error(Ip+"crypto unavailable");w=r}else w=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(Up(r=e[t],0,9,t),E=r),e.hasOwnProperty(t="POW_PRECISION")&&(Up(r=e[t],0,Rp,t),A=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(Ip+t+" not an object: "+r);x=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(Ip+t+" invalid: "+r);k="0123456789"==r.slice(0,10),_=r}}return{DECIMAL_PLACES:p,ROUNDING_MODE:m,EXPONENTIAL_AT:[b,g],RANGE:[y,v],CRYPTO:w,MODULO_MODE:E,POW_PRECISION:A,FORMAT:x,ALPHABET:_}},S.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!S.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-Rp&&i<=Rp&&i===Pp(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%Mp)<1&&(t+=Mp),String(n[0]).length==t){for(t=0;t=Op||r!==Pp(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(Ip+"Invalid BigNumber: "+e)},S.maximum=S.max=function(){return I(arguments,-1)},S.minimum=S.min=function(){return I(arguments,1)},S.random=(o=9007199254740992,a=Math.random()*o&2097151?function(){return Pp(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,s=0,c=[],u=new S(h);if(null==e?e=p:Up(e,0,Rp),i=Sp(e/Mp),w)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));s>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(c.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw w=!1,Error(Ip+"crypto unavailable");for(t=crypto.randomBytes(i*=7);s=9e15?crypto.randomBytes(7).copy(t,s):(c.push(o%1e14),s+=7);s=i/7}if(!w)for(;s=10;o/=10,s++);sr-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}return function(n,i,o,a,s){var c,u,l,f,d,h,b,g,y=n.indexOf("."),v=p,w=m;for(y>=0&&(f=A,A=0,n=n.replace(".",""),h=(g=new S(i)).pow(n.length-y),A=f,g.c=t($p(Lp(h.c),h.e,"0"),10,o,e),g.e=g.c.length),l=f=(b=t(n,i,o,s?(c=_,e):(c=e,_))).length;0==b[--f];b.pop());if(!b[0])return c.charAt(0);if(y<0?--l:(h.c=b,h.e=l,h.s=a,b=(h=r(h,g,v,w,o)).c,d=h.r,l=h.e),y=b[u=l+v+1],f=o/2,d=d||u<0||null!=b[u+1],d=w<4?(null!=y||d)&&(0==w||w==(h.s<0?3:2)):y>f||y==f&&(4==w||d||6==w&&1&b[u-1]||w==(h.s<0?8:7)),u<1||!b[0])n=d?$p(c.charAt(1),-v,c.charAt(0)):c.charAt(0);else{if(b.length=u,d)for(--o;++b[--u]>o;)b[u]=0,u||(++l,b=[1].concat(b));for(f=b.length;!b[--f];);for(y=0,n="";y<=f;n+=c.charAt(b[y++]));n=$p(n,l,c.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,o,a,s=0,c=e.length,u=t%Np,l=t/Np|0;for(e=e.slice();c--;)s=((i=u*(o=e[c]%Np)+(n=l*o+(a=e[c]/Np|0)*u)%Np*Np+s)/r|0)+(n/Np|0)+l*a,e[c]=i%r;return s&&(e=[s].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;e.splice(0,1));}return function(n,i,o,a,s){var c,u,l,f,d,h,p,m,b,g,y,v,w,E,A,x,_,k=n.s==i.s?1:-1,P=n.c,I=i.c;if(!(P&&P[0]&&I&&I[0]))return new S(n.s&&i.s&&(P?!I||P[0]!=I[0]:I)?P&&0==P[0]||!I?0*k:k/0:NaN);for(b=(m=new S(k)).c=[],k=o+(u=n.e-i.e)+1,s||(s=Op,u=Fp(n.e/Mp)-Fp(i.e/Mp),k=k/Mp|0),l=0;I[l]==(P[l]||0);l++);if(I[l]>(P[l]||0)&&u--,k<0)b.push(1),f=!0;else{for(E=P.length,x=I.length,l=0,k+=2,(d=Pp(s/(I[0]+1)))>1&&(I=e(I,d,s),P=e(P,d,s),x=I.length,E=P.length),w=x,y=(g=P.slice(0,x)).length;y=s/2&&A++;do{if(d=0,(c=t(I,g,x,y))<0){if(v=g[0],x!=y&&(v=v*s+(g[1]||0)),(d=Pp(v/A))>1)for(d>=s&&(d=s-1),p=(h=e(I,d,s)).length,y=g.length;1==t(h,g,p,y);)d--,r(h,x=10;k/=10,l++);O(m,o+(m.e=l+u*Mp-1)+1,a,f)}else m.e=u,m.r=+f;return m}}(),s=/^(-?)0([xbo])(?=\w[\w.]*$)/i,c=/^([^.]+)\.$/,u=/^\.([^.]+)$/,l=/^-?(Infinity|NaN)$/,f=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,o=r?t:t.replace(f,"");if(l.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(s,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,o=o.replace(c,"$1").replace(u,"0.$1")),t!=o))return new S(o,i);if(S.DEBUG)throw Error(Ip+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},d.absoluteValue=d.abs=function(){var e=new S(this);return e.s<0&&(e.s=1),e},d.comparedTo=function(e,t){return jp(this,new S(e,t))},d.decimalPlaces=d.dp=function(e,t){var r,n,i,o=this;if(null!=e)return Up(e,0,Rp),null==t?t=m:Up(t,0,8),O(new S(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-Fp(this.e/Mp))*Mp,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},d.dividedBy=d.div=function(e,t){return r(this,new S(e,t),p,m)},d.dividedToIntegerBy=d.idiv=function(e,t){return r(this,new S(e,t),0,1)},d.exponentiatedBy=d.pow=function(e,t){var r,n,i,o,a,s,c,u,l=this;if((e=new S(e)).c&&!e.isInteger())throw Error(Ip+"Exponent not an integer: "+M(e));if(null!=t&&(t=new S(t)),a=e.e>14,!l.c||!l.c[0]||1==l.c[0]&&!l.e&&1==l.c.length||!e.c||!e.c[0])return u=new S(Math.pow(+M(l),a?e.s*(2-Dp(e)):+M(e))),t?u.mod(t):u;if(s=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new S(NaN);(n=!s&&l.isInteger()&&t.isInteger())&&(l=l.mod(t))}else{if(e.e>9&&(l.e>0||l.e<-1||(0==l.e?l.c[0]>1||a&&l.c[1]>=24e7:l.c[0]<8e13||a&&l.c[0]<=9999975e7)))return o=l.s<0&&Dp(e)?-0:0,l.e>-1&&(o=1/o),new S(s?1/o:o);A&&(o=Sp(A/Mp+2))}for(a?(r=new S(.5),s&&(e.s=1),c=Dp(e)):c=(i=Math.abs(+M(e)))%2,u=new S(h);;){if(c){if(!(u=u.times(l)).c)break;o?u.c.length>o&&(u.c.length=o):n&&(u=u.mod(t))}if(i){if(0===(i=Pp(i/2)))break;c=i%2}else if(O(e=e.times(r),e.e+1,1),e.e>14)c=Dp(e);else{if(0===(i=+M(e)))break;c=i%2}l=l.times(l),o?l.c&&l.c.length>o&&(l.c.length=o):n&&(l=l.mod(t))}return n?u:(s&&(u=h.div(u)),t?u.mod(t):o?O(u,A,m,undefined):u)},d.integerValue=function(e){var t=new S(this);return null==e?e=m:Up(e,0,8),O(t,t.e+1,e)},d.isEqualTo=d.eq=function(e,t){return 0===jp(this,new S(e,t))},d.isFinite=function(){return!!this.c},d.isGreaterThan=d.gt=function(e,t){return jp(this,new S(e,t))>0},d.isGreaterThanOrEqualTo=d.gte=function(e,t){return 1===(t=jp(this,new S(e,t)))||0===t},d.isInteger=function(){return!!this.c&&Fp(this.e/Mp)>this.c.length-2},d.isLessThan=d.lt=function(e,t){return jp(this,new S(e,t))<0},d.isLessThanOrEqualTo=d.lte=function(e,t){return-1===(t=jp(this,new S(e,t)))||0===t},d.isNaN=function(){return!this.s},d.isNegative=function(){return this.s<0},d.isPositive=function(){return this.s>0},d.isZero=function(){return!!this.c&&0==this.c[0]},d.minus=function(e,t){var r,n,i,o,a=this,s=a.s;if(t=(e=new S(e,t)).s,!s||!t)return new S(NaN);if(s!=t)return e.s=-t,a.plus(e);var c=a.e/Mp,u=e.e/Mp,l=a.c,f=e.c;if(!c||!u){if(!l||!f)return l?(e.s=-t,e):new S(f?a:NaN);if(!l[0]||!f[0])return f[0]?(e.s=-t,e):new S(l[0]?a:3==m?-0:0)}if(c=Fp(c),u=Fp(u),l=l.slice(),s=c-u){for((o=s<0)?(s=-s,i=l):(u=c,i=f),i.reverse(),t=s;t--;i.push(0));i.reverse()}else for(n=(o=(s=l.length)<(t=f.length))?s:t,s=t=0;t0)for(;t--;l[r++]=0);for(t=Op-1;n>s;){if(l[--n]=0;){for(r=0,d=v[i]%b,h=v[i]/b|0,o=i+(a=c);o>i;)r=((u=d*(u=y[--a]%b)+(s=h*u+(l=y[a]/b|0)*d)%b*b+p[o]+r)/m|0)+(s/b|0)+h*l,p[o--]=u%m;p[o]=r}return r?++n:p.splice(0,1),T(e,p,n)},d.negated=function(){var e=new S(this);return e.s=-e.s||null,e},d.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new S(e,t)).s,!i||!t)return new S(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/Mp,a=e.e/Mp,s=n.c,c=e.c;if(!o||!a){if(!s||!c)return new S(i/0);if(!s[0]||!c[0])return c[0]?e:new S(s[0]?n:0*i)}if(o=Fp(o),a=Fp(a),s=s.slice(),i=o-a){for(i>0?(a=o,r=c):(i=-i,r=s),r.reverse();i--;r.push(0));r.reverse()}for((i=s.length)-(t=c.length)<0&&(r=c,c=s,s=r,t=i),i=0;t;)i=(s[--t]=s[t]+c[t]+i)/Op|0,s[t]=Op===s[t]?0:s[t]%Op;return i&&(s=[i].concat(s),++a),T(e,s,a)},d.precision=d.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return Up(e,1,Rp),null==t?t=m:Up(t,0,8),O(new S(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*Mp+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},d.shiftedBy=function(e){return Up(e,-9007199254740991,Cp),this.times("1e"+e)},d.squareRoot=d.sqrt=function(){var e,t,n,i,o,a=this,s=a.c,c=a.s,u=a.e,l=p+4,f=new S("0.5");if(1!==c||!s||!s[0])return new S(!c||c<0&&(!s||s[0])?NaN:s?a:1/0);if(0==(c=Math.sqrt(+M(a)))||c==1/0?(((t=Lp(s)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=Fp((u+1)/2)-(u<0||u%2),n=new S(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):n=new S(c+""),n.c[0])for((c=(u=n.e)+l)<3&&(c=0);;)if(o=n,n=f.times(o.plus(r(a,o,l,1))),Lp(o.c).slice(0,c)===(t=Lp(n.c)).slice(0,c)){if(n.e0&&p>0){for(o=p%s||s,l=h.substr(0,o);o0&&(l+=u+h.slice(o)),d&&(l="-"+l)}n=f?l+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?f.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):f):l}return(r.prefix||"")+n+(r.suffix||"")},d.toFraction=function(e){var t,n,i,o,a,s,c,u,l,f,d,p,b=this,g=b.c;if(null!=e&&(!(c=new S(e)).isInteger()&&(c.c||1!==c.s)||c.lt(h)))throw Error(Ip+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+M(c));if(!g)return new S(b);for(t=new S(h),l=n=new S(h),i=u=new S(h),p=Lp(g),a=t.e=p.length-b.e-1,t.c[0]=Bp[(s=a%Mp)<0?Mp+s:s],e=!e||c.comparedTo(t)>0?a>0?t:l:c,s=v,v=1/0,c=new S(p),u.c[0]=0;f=r(c,t,0,1),1!=(o=n.plus(f.times(i))).comparedTo(e);)n=i,i=o,l=u.plus(f.times(o=l)),u=o,t=c.minus(f.times(o=t)),c=o;return o=r(e.minus(n),i,0,1),u=u.plus(o.times(l)),n=n.plus(o.times(i)),u.s=l.s=b.s,d=r(l,i,a*=2,m).minus(b).abs().comparedTo(r(u,n,a,m).minus(b).abs())<1?[l,i]:[u,n],v=s,d},d.toNumber=function(){return+M(this)},d.toPrecision=function(e,t){return null!=e&&Up(e,1,Rp),P(this,e,t,2)},d.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=b||o>=g?zp(Lp(r.c),o):$p(Lp(r.c),o,"0"):10===e&&k?t=$p(Lp((r=O(new S(r),p+o+1,m)).c),r.e,"0"):(Up(e,2,_.length,"Base"),t=n($p(Lp(r.c),o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},d.valueOf=d.toJSON=function(){return M(this)},d._isBigNumber=!0,d[Symbol.toStringTag]="BigNumber",d[Symbol.for("nodejs.util.inspect.custom")]=d.valueOf,null!=t&&S.set(t),S}(),Gp={exports:{}};!function(e){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=90)}({17:function(e,t,r){t.__esModule=!0,t.default=void 0;var n=r(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||""},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||""},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,r,n){void 0===n&&(n=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(r),a=Math.max(i,o),s=0,c=e.map([t,r],(function(t){var r=a-e.getVersionPrecision(t),n=t+new Array(r+1).join(".0");return e.map(n.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(n&&(s=a-Math.min(i,o)),a-=1;a>=s;){if(c[0][a]>c[1][a])return 1;if(c[0][a]===c[1][a]){if(a===s)return 0;a-=1}else if(c[0][a]1?i-1:0),a=1;a0){var a=Object.keys(r),c=s.default.find(a,(function(e){return t.isOS(e)}));if(c){var u=this.satisfies(r[c]);if(void 0!==u)return u}var l=s.default.find(a,(function(e){return t.isPlatform(e)}));if(l){var f=this.satisfies(r[l]);if(void 0!==f)return f}}if(o>0){var d=Object.keys(i),h=s.default.find(d,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),n=e.toLowerCase(),i=s.default.getBrowserTypeByAlias(n);return t&&i&&(n=i.toLowerCase()),n===r},t.compareVersion=function(e){var t=[0],r=e,n=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(n=!0,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(n=!0,r=e.substr(1)),t.indexOf(s.default.compareVersions(i,r,n))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=u,e.exports=t.default},92:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},r=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},r=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},r=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},r=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},r=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},r=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},r=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},r=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},r=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:"Android Browser"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},r=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=i.default.getMacOSVersionName(t),n={name:o.OS_MAP.MacOS,version:t};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=i.default.getAndroidVersionName(t),n={name:o.OS_MAP.Android,version:t};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:o.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},r=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},r=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},r=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},r=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=a,e.exports=t.default}})}(Gp);var qp=a(Gp.exports);function Kp(e){if(e)return function(e){for(var t in Kp.prototype)e[t]=Kp.prototype[t];return e}(e)}Kp.prototype.on=Kp.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Kp.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},Kp.prototype.off=Kp.prototype.removeListener=Kp.prototype.removeAllListeners=Kp.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function c(e,t,r,n){for(var i=0,o=Math.min(e.length,r),a=t;a=49?s-49+10:s>=17?s-17+10:s}return i}i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},i.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=s(e,t,n)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,l=r;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u>>26,f=67108863&c,d=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=d;h++){var p=u-h|0;l+=(a=(i=0|e.words[p])*(o=0|t.words[h])+f)/67108864|0,f=67108863&a}r.words[u]=0|f,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}i.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,a=0;a>>24-i&16777215)||a!==this.length-1?u[6-c.length]+c+n:c+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var d=l[e],h=f[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(h).toString(e);n=(p=p.idivn(h)).isZero()?m+n:u[d-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return r(void 0!==o),this.toArrayLike(o,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(o),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,m=h>>>13,b=0|a[2],g=8191&b,y=b>>>13,v=0|a[3],w=8191&v,E=v>>>13,A=0|a[4],x=8191&A,_=A>>>13,k=0|a[5],S=8191&k,P=k>>>13,I=0|a[6],T=8191&I,O=I>>>13,M=0|a[7],C=8191&M,B=M>>>13,N=0|a[8],R=8191&N,F=N>>>13,L=0|a[9],j=8191&L,U=L>>>13,D=0|s[0],z=8191&D,$=D>>>13,H=0|s[1],G=8191&H,q=H>>>13,K=0|s[2],V=8191&K,W=K>>>13,J=0|s[3],Z=8191&J,Y=J>>>13,X=0|s[4],Q=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],fe=8191&le,de=le>>>13,he=0|s[9],pe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(u+(n=Math.imul(f,z))|0)+((8191&(i=(i=Math.imul(f,$))+Math.imul(d,z)|0))<<13)|0;u=((o=Math.imul(d,$))+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,$))+Math.imul(m,z)|0,o=Math.imul(m,$);var ge=(u+(n=n+Math.imul(f,G)|0)|0)+((8191&(i=(i=i+Math.imul(f,q)|0)+Math.imul(d,G)|0))<<13)|0;u=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,z),i=(i=Math.imul(g,$))+Math.imul(y,z)|0,o=Math.imul(y,$),n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,q)|0;var ye=(u+(n=n+Math.imul(f,V)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,W)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(w,z),i=(i=Math.imul(w,$))+Math.imul(E,z)|0,o=Math.imul(E,$),n=n+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var ve=(u+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(x,z),i=(i=Math.imul(x,$))+Math.imul(_,z)|0,o=Math.imul(_,$),n=n+Math.imul(w,G)|0,i=(i=i+Math.imul(w,q)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,q)|0,n=n+Math.imul(g,V)|0,i=(i=i+Math.imul(g,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,Y)|0;var we=(u+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,ee)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(S,z),i=(i=Math.imul(S,$))+Math.imul(P,z)|0,o=Math.imul(P,$),n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,q)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,Y)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0;var Ee=(u+(n=n+Math.imul(f,re)|0)|0)+((8191&(i=(i=i+Math.imul(f,ne)|0)+Math.imul(d,re)|0))<<13)|0;u=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(T,z),i=(i=Math.imul(T,$))+Math.imul(O,z)|0,o=Math.imul(O,$),n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,Y)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0;var Ae=(u+(n=n+Math.imul(f,oe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ae)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(C,z),i=(i=Math.imul(C,$))+Math.imul(B,z)|0,o=Math.imul(B,$),n=n+Math.imul(T,G)|0,i=(i=i+Math.imul(T,q)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,q)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,W)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,ee)|0,n=n+Math.imul(g,re)|0,i=(i=i+Math.imul(g,ne)|0)+Math.imul(y,re)|0,o=o+Math.imul(y,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var xe=(u+(n=n+Math.imul(f,ce)|0)|0)+((8191&(i=(i=i+Math.imul(f,ue)|0)+Math.imul(d,ce)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(R,z),i=(i=Math.imul(R,$))+Math.imul(F,z)|0,o=Math.imul(F,$),n=n+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,q)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,W)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,Y)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(E,re)|0,o=o+Math.imul(E,ne)|0,n=n+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,ue)|0;var _e=(u+(n=n+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,de)|0)+Math.imul(d,fe)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(j,z),i=(i=Math.imul(j,$))+Math.imul(U,z)|0,o=Math.imul(U,$),n=n+Math.imul(R,G)|0,i=(i=i+Math.imul(R,q)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,q)|0,n=n+Math.imul(C,V)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,W)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,Y)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,ae)|0,n=n+Math.imul(g,ce)|0,i=(i=i+Math.imul(g,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,n=n+Math.imul(p,fe)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(m,fe)|0,o=o+Math.imul(m,de)|0;var ke=(u+(n=n+Math.imul(f,pe)|0)|0)+((8191&(i=(i=i+Math.imul(f,me)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(j,G),i=(i=Math.imul(j,q))+Math.imul(U,G)|0,o=Math.imul(U,q),n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(F,V)|0,o=o+Math.imul(F,W)|0,n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,Y)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,ee)|0,n=n+Math.imul(S,re)|0,i=(i=i+Math.imul(S,ne)|0)+Math.imul(P,re)|0,o=o+Math.imul(P,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,n=n+Math.imul(g,fe)|0,i=(i=i+Math.imul(g,de)|0)+Math.imul(y,fe)|0,o=o+Math.imul(y,de)|0;var Se=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(j,V),i=(i=Math.imul(j,W))+Math.imul(U,V)|0,o=Math.imul(U,W),n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(F,Z)|0,o=o+Math.imul(F,Y)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ne)|0,n=n+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,ae)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,ae)|0,n=n+Math.imul(x,ce)|0,i=(i=i+Math.imul(x,ue)|0)+Math.imul(_,ce)|0,o=o+Math.imul(_,ue)|0,n=n+Math.imul(w,fe)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(E,fe)|0,o=o+Math.imul(E,de)|0;var Pe=(u+(n=n+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,me)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(j,Z),i=(i=Math.imul(j,Y))+Math.imul(U,Z)|0,o=Math.imul(U,Y),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ne)|0,n=n+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,n=n+Math.imul(S,ce)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(P,ce)|0,o=o+Math.imul(P,ue)|0,n=n+Math.imul(x,fe)|0,i=(i=i+Math.imul(x,de)|0)+Math.imul(_,fe)|0,o=o+Math.imul(_,de)|0;var Ie=(u+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(j,Q),i=(i=Math.imul(j,ee))+Math.imul(U,Q)|0,o=Math.imul(U,ee),n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(F,re)|0,o=o+Math.imul(F,ne)|0,n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,ae)|0,n=n+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(O,ce)|0,o=o+Math.imul(O,ue)|0,n=n+Math.imul(S,fe)|0,i=(i=i+Math.imul(S,de)|0)+Math.imul(P,fe)|0,o=o+Math.imul(P,de)|0;var Te=(u+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,me)|0)+Math.imul(_,pe)|0))<<13)|0;u=((o=o+Math.imul(_,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(j,re),i=(i=Math.imul(j,ne))+Math.imul(U,re)|0,o=Math.imul(U,ne),n=n+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,ae)|0)+Math.imul(F,oe)|0,o=o+Math.imul(F,ae)|0,n=n+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(B,ce)|0,o=o+Math.imul(B,ue)|0,n=n+Math.imul(T,fe)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(O,fe)|0,o=o+Math.imul(O,de)|0;var Oe=(u+(n=n+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,me)|0)+Math.imul(P,pe)|0))<<13)|0;u=((o=o+Math.imul(P,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(j,oe),i=(i=Math.imul(j,ae))+Math.imul(U,oe)|0,o=Math.imul(U,ae),n=n+Math.imul(R,ce)|0,i=(i=i+Math.imul(R,ue)|0)+Math.imul(F,ce)|0,o=o+Math.imul(F,ue)|0,n=n+Math.imul(C,fe)|0,i=(i=i+Math.imul(C,de)|0)+Math.imul(B,fe)|0,o=o+Math.imul(B,de)|0;var Me=(u+(n=n+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(j,ce),i=(i=Math.imul(j,ue))+Math.imul(U,ce)|0,o=Math.imul(U,ue),n=n+Math.imul(R,fe)|0,i=(i=i+Math.imul(R,de)|0)+Math.imul(F,fe)|0,o=o+Math.imul(F,de)|0;var Ce=(u+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,me)|0)+Math.imul(B,pe)|0))<<13)|0;u=((o=o+Math.imul(B,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(j,fe),i=(i=Math.imul(j,de))+Math.imul(U,fe)|0,o=Math.imul(U,de);var Be=(u+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,me)|0)+Math.imul(F,pe)|0))<<13)|0;u=((o=o+Math.imul(F,me)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863;var Ne=(u+(n=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(U,pe)|0))<<13)|0;return u=((o=Math.imul(U,me))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=be,c[1]=ge,c[2]=ye,c[3]=ve,c[4]=we,c[5]=Ee,c[6]=Ae,c[7]=xe,c[8]=_e,c[9]=ke,c[10]=Se,c[11]=Pe,c[12]=Ie,c[13]=Te,c[14]=Oe,c[15]=Me,c[16]=Ce,c[17]=Be,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function p(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=d),i.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):n<63?d(this,e,t):n<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):p(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=i.prototype._countBits(e)-1,n=0;n>=1;return n},m.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*t;a>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,this.length++),this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,u=0;u=0&&(0!==l||u>=i);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),o=e,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,c=n.length-o.length;if("mod"!==t){(s=new i(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u=0;f--){var d=67108864*(0|n.words[o.length+f])+(0|n.words[o.length+f-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(o,d,f);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(o,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=d)}return s&&s.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modn(e.words[0]))}:this._wordDiv(e,t);var o,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(t*n+(0|this.words[i]))%e;return n},i.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*t;this.words[n]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),c=new i(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),f=t.clone();!t.isZero();){for(var d=0,h=1;!(t.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(f)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;!(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(f)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(s),a.isub(c)):(n.isub(t),s.isub(o),c.isub(a))}return{a:s,b:c,gcd:n.iushln(u)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var f=0,d=1;!(n.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(n.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s)):(n.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return!(1&this.words[0])},i.prototype.isOdd=function(){return!(1&~this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new A(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function x(e){A.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},n(y,g),y.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(b[e])return b[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return b[e]=t,t},A.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},A.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},A.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},A.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},A.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},A.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},A.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},A.prototype.isqr=function(e){return this.imul(e,e.clone())},A.prototype.sqr=function(e){return this.mul(e,e)},A.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new i(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var f=this.pow(l,o),d=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b=0;n--){for(var u=t.words[n],l=c-1;l>=0;l--){var f=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===n&&0===l)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}c=26}return o},A.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},A.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new x(e)},n(x,A),x.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},x.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},x.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},x.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,o)}(Xp);var Qp=Xp.exports,em=tm;function tm(e,t){if(!e)throw new Error(t||"Assertion failed")}tm.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var rm={};!function(e){var t=e;function r(e){return 1===e.length?"0"+e:e}function n(e){for(var t="",n=0;n>8,a=255&i;o?r.push(o,a):r.push(a)}return r},t.zero2=r,t.toHex=n,t.encode=function(e,t){return"hex"===t?n(e):e}}(rm),function(e){var t=e,r=Qp,n=em,i=rm;t.assert=n,t.toArray=i.toArray,t.zero2=i.zero2,t.toHex=i.toHex,t.encode=i.encode,t.getNAF=function(e,t,r){var n,i=new Array(Math.max(e.bitLength(),r)+1);for(n=0;n(o>>1)-1?(o>>1)-c:c,a.isubn(s)):s=0,i[n]=s,a.iushrn(1)}return i},t.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),a=1&c?3!==(n=e.andln(7)+i&7)&&5!==n||2!==u?c:-c:0,r[0].push(a),s=1&u?3!==(n=t.andln(7)+o&7)&&5!==n||2!==c?u:-u:0,r[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},t.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},t.parseBytes=function(e){return"string"==typeof e?t.toArray(e,"hex"):e},t.intFromLE=function(e){return new r(e,"hex","le")}}(Yp);var nm,im={exports:{}},om=s(Wp);function am(e){this.rand=e}if(im.exports=function(e){return nm||(nm=new am(null)),nm.generate(e)},im.exports.Rand=am,am.prototype.generate=function(e){return this._rand(e)},am.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var bm=mm;function gm(e,t){this.curve=e,this.type=t,this.precomputed=null}mm.prototype.point=function(){throw new Error("Not implemented")},mm.prototype.validate=function(){throw new Error("Not implemented")},mm.prototype._fixedNafMul=function(e,t){pm(e.precomputed);var r=e._getDoubles(),n=dm(t,1,this._bitLength),i=(1<=o;c--)a=(a<<1)+n[c];s.push(a)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),f=i;f>0;f--){for(o=0;o=0;s--){for(var c=0;s>=0&&0===o[s];s--)c++;if(s>=0&&c++,a=a.dblp(c),s<0)break;var u=o[s];pm(0!==u),a="affine"===e.type?u>0?a.mixedAdd(i[u-1>>1]):a.mixedAdd(i[-u-1>>1].neg()):u>0?a.add(i[u-1>>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},mm.prototype._wnafMulAdd=function(e,t,r,n,i){var o,a,s,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,f=0;for(o=0;o=1;o-=2){var h=o-1,p=o;if(1===c[h]&&1===c[p]){var m=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(m[1]=t[h].add(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].add(t[p].neg())):(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],g=hm(r[h],r[p]);for(f=Math.max(g[0].length,f),l[h]=new Array(f),l[p]=new Array(f),a=0;a=0;o--){for(var A=0;o>=0;){var x=!0;for(a=0;a=0&&A++,w=w.dblp(A),o<0)break;for(a=0;a0?s=u[a][_-1>>1]:_<0&&(s=u[a][-_-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(o=0;o=Math.ceil((e.bitLength()+1)/t.step)},gm.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(o=t,a=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:i},{a:o,b:a}]},_m.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),c=i.mul(r.b),u=o.mul(n.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},_m.prototype.pointFromX=function(e,t){(e=new wm(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},_m.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},_m.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},Sm.prototype.isInfinity=function(){return this.inf},Sm.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Sm.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Sm.prototype.getX=function(){return this.x.fromRed()},Sm.prototype.getY=function(){return this.y.fromRed()},Sm.prototype.mul=function(e){return e=new wm(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Sm.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},Sm.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},Sm.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},Sm.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},Sm.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Em(Pm,Am.BasePoint),_m.prototype.jpoint=function(e,t,r){return new Pm(this,e,t,r)},Pm.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},Pm.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Pm.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(i),c=o.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),f=n.redMul(u),d=c.redSqr().redIAdd(l).redISub(f).redISub(f),h=c.redMul(f.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(d,h,p)},Pm.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),l=r.redMul(c),f=s.redSqr().redIAdd(u).redISub(l).redISub(l),d=s.redMul(l.redISub(f)).redISub(i.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(f,d,h)},Pm.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},Pm.prototype.inspect=function(){return this.isInfinity()?"":""},Pm.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var Im=Qp,Tm=vm,Om=bm,Mm=Yp;function Cm(e){Om.call(this,"mont",e),this.a=new Im(e.a,16).toRed(this.red),this.b=new Im(e.b,16).toRed(this.red),this.i4=new Im(4).toRed(this.red).redInvm(),this.two=new Im(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}Tm(Cm,Om);var Bm=Cm;function Nm(e,t,r){Om.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Im(t,16),this.z=new Im(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}Cm.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},Tm(Nm,Om.BasePoint),Cm.prototype.decodePoint=function(e,t){return this.point(Mm.toArray(e,t),1)},Cm.prototype.point=function(e,t){return new Nm(this,e,t)},Cm.prototype.pointFromJSON=function(e){return Nm.fromJSON(this,e)},Nm.prototype.precompute=function(){},Nm.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Nm.fromJSON=function(e,t){return new Nm(e,t[0],t[1]||e.one)},Nm.prototype.inspect=function(){return this.isInfinity()?"":""},Nm.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Nm.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},Nm.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Nm.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),a=i.redMul(n),s=t.z.redMul(o.redAdd(a).redSqr()),c=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,c)},Nm.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},Nm.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Nm.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Nm.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},Nm.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Nm.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var Rm=Qp,Fm=vm,Lm=bm,jm=Yp.assert;function Um(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,Lm.call(this,"edwards",e),this.a=new Rm(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Rm(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Rm(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),jm(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}Fm(Um,Lm);var Dm=Um;function zm(e,t,r,n,i){Lm.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new Rm(t,16),this.y=new Rm(r,16),this.z=n?new Rm(n,16):this.curve.one,this.t=i&&new Rm(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}Um.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},Um.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},Um.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},Um.prototype.pointFromX=function(e,t){(e=new Rm(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),i=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=n.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(t&&!s||!t&&s)&&(a=a.redNeg()),this.point(e,a)},Um.prototype.pointFromY=function(e,t){(e=new Rm(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),i=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=n.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},Um.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(i)},Fm(zm,Lm.BasePoint),Um.prototype.pointFromJSON=function(e){return zm.fromJSON(this,e)},Um.prototype.point=function(e,t,r,n){return new zm(this,e,t,r,n)},zm.fromJSON=function(e,t){return new zm(e,t[0],t[1],t[2])},zm.prototype.inspect=function(){return this.isInfinity()?"":""},zm.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},zm.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),a=o.redSub(r),s=n.redSub(t),c=i.redMul(a),u=o.redMul(s),l=i.redMul(s),f=a.redMul(o);return this.curve.point(c,u,f,l)},zm.prototype._projDbl=function(){var e,t,r,n,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(s)).redAdd(c);this.zOne?(e=a.redSub(s).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(n.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=a.redSub(s).redISub(c).redMul(o),t=u.redMul(n.redSub(c)),r=u.redMul(o))}else n=s.redAdd(c),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),e=this.curve._mulC(a.redISub(n)).redMul(o),t=this.curve._mulC(n).redMul(s.redISub(c)),r=n.redMul(o);return this.curve.point(e,t,r)},zm.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},zm.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),a=i.redSub(n),s=i.redAdd(n),c=r.redAdd(t),u=o.redMul(a),l=s.redMul(c),f=o.redMul(c),d=a.redMul(s);return this.curve.point(u,l,d,f)},zm.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),c=i.redSub(s),u=i.redAdd(s),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),f=n.redMul(c).redMul(l);return this.curve.twisted?(t=n.redMul(u).redMul(a.redSub(this.curve._mulA(o))),r=c.redMul(u)):(t=n.redMul(u).redMul(a.redSub(o)),r=this.curve._mulC(c).redMul(u)),this.curve.point(f,t,r)},zm.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},zm.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},zm.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},zm.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},zm.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},zm.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},zm.prototype.getX=function(){return this.normalize(),this.x.fromRed()},zm.prototype.getY=function(){return this.normalize(),this.y.fromRed()},zm.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},zm.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},zm.prototype.toP=zm.prototype.normalize,zm.prototype.mixedAdd=zm.prototype.add,function(e){var t=e;t.base=bm,t.short=km,t.mont=Bm,t.edwards=Dm}(um);var $m={},Hm={},Gm={},qm=em,Km=vm;function Vm(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function Wm(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function Jm(e){return 1===e.length?"0"+e:e}function Zm(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}Gm.inherits=Km,Gm.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i>6|192,r[n++]=63&o|128):Vm(e,i)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i>>0}return o},Gm.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},Gm.rotr32=function(e,t){return e>>>t|e<<32-t},Gm.rotl32=function(e,t){return e<>>32-t},Gm.sum32=function(e,t){return e+t>>>0},Gm.sum32_3=function(e,t,r){return e+t+r>>>0},Gm.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},Gm.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},Gm.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,a=(o>>0,e[t+1]=o},Gm.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},Gm.sum64_lo=function(e,t,r,n){return t+n>>>0},Gm.sum64_4_hi=function(e,t,r,n,i,o,a,s){var c=0,u=t;return c+=(u=u+n>>>0)>>0)>>0)>>0},Gm.sum64_4_lo=function(e,t,r,n,i,o,a,s){return t+n+o+s>>>0},Gm.sum64_5_hi=function(e,t,r,n,i,o,a,s,c,u){var l=0,f=t;return l+=(f=f+n>>>0)>>0)>>0)>>0)>>0},Gm.sum64_5_lo=function(e,t,r,n,i,o,a,s,c,u){return t+n+o+s+u>>>0},Gm.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},Gm.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},Gm.shr64_hi=function(e,t,r){return e>>>r},Gm.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0};var Ym={},Xm=Gm,Qm=em;function eb(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Ym.BlockHash=eb,eb.prototype.update=function(e,t){if(e=Xm.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=Xm.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o>>3},rb.g1_256=function(e){return nb(e,17)^nb(e,19)^e>>>10};var sb=Gm,cb=Ym,ub=rb,lb=sb.rotl32,fb=sb.sum32,db=sb.sum32_5,hb=ub.ft_1,pb=cb.BlockHash,mb=[1518500249,1859775393,2400959708,3395469782];function bb(){if(!(this instanceof bb))return new bb;pb.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}sb.inherits(bb,pb);var gb=bb;bb.blockSize=512,bb.outSize=160,bb.hmacStrength=80,bb.padLength=64,bb.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;nthis.blockSize&&(e=(new this.Hash).update(e).digest()),Fg(e.length<=this.blockSize);for(var t=e.length;t=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var Kg=qg;qg.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},qg.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=Hg.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var Yg=Qp,Xg=Yp,Qg=Xg.assert;function ey(e,t){if(e instanceof ey)return e;this._importDER(e,t)||(Qg(e.r&&e.s,"Signature without r or s"),this.r=new Yg(e.r,16),this.s=new Yg(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var ty=ey;function ry(){this.place=0}function ny(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;if(0===e[t.place])return!1;for(var i=0,o=0,a=t.place;o>>=0;return!(i<=127)&&(t.place=a,i)}function iy(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}ey.prototype._importDER=function(e,t){e=Xg.toArray(e,t);var r=new ry;if(48!==e[r.place++])return!1;var n=ny(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=ny(e,r);if(!1===i)return!1;if(128&e[r.place])return!1;var o=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var a=ny(e,r);if(!1===a)return!1;if(e.length!==a+r.place)return!1;if(128&e[r.place])return!1;var s=e.slice(r.place,a+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new Yg(o),this.s=new Yg(s),this.recoveryParam=null,!0},ey.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=iy(t),r=iy(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];oy(n,t.length),(n=n.concat(t)).push(2),oy(n,r.length);var i=n.concat(r),o=[48];return oy(o,i.length),o=o.concat(i),Xg.encode(o,e)};var ay=Qp,sy=Kg,cy=$m,uy=cm,ly=Yp.assert,fy=Zg,dy=ty;function hy(e){if(!(this instanceof hy))return new hy(e);"string"==typeof e&&(ly(Object.prototype.hasOwnProperty.call(cy,e),"Unknown curve "+e),e=cy[e]),e instanceof cy.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var py=hy;hy.prototype.keyPair=function(e){return new fy(this,e)},hy.prototype.keyFromPrivate=function(e,t){return fy.fromPrivate(this,e,t)},hy.prototype.keyFromPublic=function(e,t){return fy.fromPublic(this,e,t)},hy.prototype.genKeyPair=function(e){e||(e={});for(var t=new sy({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||uy(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new ay(2));;){var i=new ay(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},hy.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},hy.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new ay(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),a=e.toArray("be",i),s=new sy({hash:this.hash,entropy:o,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new ay(1)),u=0;;u++){var l=n.k?n.k(u):new ay(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(c)>=0)){var f=this.g.mul(l);if(!f.isInfinity()){var d=f.getX(),h=d.umod(this.n);if(0!==h.cmpn(0)){var p=l.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(f.getY().isOdd()?1:0)|(0!==d.cmp(h)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new dy({r:h,s:p,recoveryParam:m})}}}}}},hy.prototype.verify=function(e,t,r,n){e=this._truncateToN(new ay(e,16)),r=this.keyFromPublic(r,n);var i=(t=new dy(t,"hex")).r,o=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),c=s.mul(e).umod(this.n),u=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,r.getPublic(),u)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(c,r.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},hy.prototype.recoverPubKey=function(e,t,r,n){ly((3&r)===r,"The recovery param is more than two bits"),t=new dy(t,n);var i=this.n,o=new ay(e),a=t.r,s=t.s,c=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var l=t.r.invm(i),f=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(f,a,d)},hy.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new dy(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var my=Yp,by=my.assert,gy=my.parseBytes,yy=my.cachedProperty;function vy(e,t){this.eddsa=e,this._secret=gy(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=gy(t.pub)}vy.fromPublic=function(e,t){return t instanceof vy?t:new vy(e,{pub:t})},vy.fromSecret=function(e,t){return t instanceof vy?t:new vy(e,{secret:t})},vy.prototype.secret=function(){return this._secret},yy(vy,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),yy(vy,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),yy(vy,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),yy(vy,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),yy(vy,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),yy(vy,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),vy.prototype.sign=function(e){return by(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},vy.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},vy.prototype.getSecret=function(e){return by(this._secret,"KeyPair is public only"),my.encode(this.secret(),e)},vy.prototype.getPublic=function(e){return my.encode(this.pubBytes(),e)};var wy=vy,Ey=Qp,Ay=Yp,xy=Ay.assert,_y=Ay.cachedProperty,ky=Ay.parseBytes;function Sy(e,t){this.eddsa=e,"object"!=typeof t&&(t=ky(t)),Array.isArray(t)&&(xy(t.length===2*e.encodingLength,"Signature has invalid size"),t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),xy(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof Ey&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}_y(Sy,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),_y(Sy,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),_y(Sy,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),_y(Sy,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),Sy.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Sy.prototype.toHex=function(){return Ay.encode(this.toBytes(),"hex").toUpperCase()};var Py=Sy,Iy=Hm,Ty=$m,Oy=Yp,My=Oy.assert,Cy=Oy.parseBytes,By=wy,Ny=Py;function Ry(e){if(My("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof Ry))return new Ry(e);e=Ty[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=Iy.sha512}var Fy=Ry;Ry.prototype.sign=function(e,t){e=Cy(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),s=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},Ry.prototype.verify=function(e,t,r){if(e=Cy(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},Ry.prototype.hashInt=function(){for(var e=this.hash(),t=0;t0&&e.compare(Dy)<0)}function Gy(e){const t=new Uint8Array(e);return void 0===jy.getRandomValues?_.from(Vp.randomBytes(e)):(jy.getRandomValues(t),_.from(t))}async function qy(e){if(Uy){const t=await Uy.digest("SHA-512",e);return new Uint8Array(t)}const t=Vp.createHash("sha512").update(e).digest();return new Uint8Array(t)}function Ky(e){return async function(t,r,n){if(Uy){const i={name:"AES-CBC"},o=await Uy.importKey("raw",r,i,!1,[e]),a={name:"AES-CBC",iv:t},s=await Uy[e](a,o,n);return _.from(new Uint8Array(s))}if("encrypt"===e){const e=Vp.createCipheriv("aes-256-cbc",r,t),i=e.update(n),o=e.final();return _.concat([i,o])}if("decrypt"===e){const e=Vp.createDecipheriv("aes-256-cbc",r,t),i=e.update(n),o=e.final();return _.concat([i,o])}throw new Error(`Unsupported operation: ${e}`)}}const Vy=Ky("encrypt"),Wy=Ky("decrypt");async function Jy(e,t){if(Uy){const r={name:"HMAC",hash:{name:"SHA-256"}},n=await Uy.importKey("raw",new Uint8Array(e),r,!1,["sign","verify"]),i=await Uy.sign("HMAC",n,t);return _.from(new Uint8Array(i))}const r=Vp.createHmac("sha256",_.from(e));r.update(t);return r.digest()}const Zy=function(e){return $y(32===e.length,"Bad private key"),$y(Hy(e),"Bad private key"),_.from(Ly.keyFromPrivate(e).getPublic("array"))},Yy=async function(e,t){return $y(32===e.length,"Bad private key"),$y(Hy(e),"Bad private key"),$y(t.length>0,"Message should not be empty"),$y(t.length<=32,"Message is too long"),_.from(Ly.sign(t,e,{canonical:!0}).toDER())},Xy=async function(e,t){$y(_.isBuffer(e),"Bad private key"),$y(_.isBuffer(t),"Bad public key"),$y(32===e.length,"Bad private key"),$y(Hy(e),"Bad private key"),$y(65===t.length||33===t.length,"Bad public key"),65===t.length&&$y(4===t[0],"Bad public key"),33===t.length&&$y(2===t[0]||3===t[0],"Bad public key");const r=Ly.keyFromPrivate(e),n=Ly.keyFromPublic(t),i=r.derive(n.getPublic());return _.from(i.toArray())},Qy=async function(e,t){$y(_.isBuffer(e),"Bad private key"),$y(_.isBuffer(t),"Bad public key"),$y(32===e.length,"Bad private key"),$y(Hy(e),"Bad private key"),$y(65===t.length||33===t.length,"Bad public key"),65===t.length&&$y(4===t[0],"Bad public key"),33===t.length&&$y(2===t[0]||3===t[0],"Bad public key");const r=Ly.keyFromPrivate(e),n=Ly.keyFromPublic(t),i=r.derive(n.getPublic());return _.from(i.toString(16,64),"hex")},ev=async function(e,t,r){const n=null!=r&&r,i=n?Qy:Xy,o=await i(e,t.ephemPublicKey),a=await qy(o),s=a.slice(0,32),c=a.slice(32),u=_.concat([t.iv,t.ephemPublicKey,t.ciphertext]),l=await async function(e,t,r){return function(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n="0"&&t<="9";)r+=t,o();if("."===t)for(r+=".";o()&&t>="0"&&t<="9";)r+=t;if("e"===t||"E"===t)for(r+=t,o(),"-"!==t&&"+"!==t||(r+=t,o());t>="0"&&t<="9";)r+=t,o();return e=Number(r),isFinite(e)||i("Bad number"),e}function s(){var e,r,a,s="";if('"'===t)for(;o();){if('"'===t)return o(),s;if("\\"===t)if(o(),"u"===t){for(a=0,r=0;r<4&&(e=parseInt(o(),16),isFinite(e));r+=1)a=16*a+e;s+=String.fromCharCode(a)}else{if("string"!=typeof n[t])break;s+=n[t]}else s+=t}i("Bad string")}function c(){for(;t&&t<=" ";)o()}function u(){switch(c(),t){case"{":return function(){var e,r={};if("{"===t){if(o("{"),c(),"}"===t)return o("}"),r;for(;t;){if(e=s(),c(),o(":"),Object.prototype.hasOwnProperty.call(r,e)&&i('Duplicate key "'+e+'"'),r[e]=u(),c(),"}"===t)return o("}"),r;o(","),c()}}i("Bad object")}();case"[":return function(){var e=[];if("["===t){if(o("["),c(),"]"===t)return o("]"),e;for(;t;){if(e.push(u()),c(),"]"===t)return o("]"),e;o(","),c()}}i("Bad array")}();case'"':return s();case"-":return a();default:return t>="0"&&t<="9"?a():function(){switch(t){case"t":return o("t"),o("r"),o("u"),o("e"),!0;case"f":return o("f"),o("a"),o("l"),o("s"),o("e"),!1;case"n":return o("n"),o("u"),o("l"),o("l"),null;default:i("Unexpected '"+t+"'")}}()}}return tv=function(n,o){var a;return r=n,e=0,t=" ",a=u(),c(),t&&i("Syntax error"),"function"==typeof o?function e(t,r){var n,i,a=t[r];if(a&&"object"==typeof a)for(n in u)Object.prototype.hasOwnProperty.call(a,n)&&(void 0===(i=e(a,n))?delete a[n]:a[n]=i);return o.call(t,r,a)}({"":a},""):a},tv}function cv(){if(iv)return nv;iv=1;var e,t,r,n=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,i={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function o(e){return n.lastIndex=0,n.test(e)?'"'+e.replace(n,(function(e){var t=i[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'}function a(n,i){var s,c,u,l,f,d=e,h=i[n];switch(h&&"object"==typeof h&&"function"==typeof h.toJSON&&(h=h.toJSON(n)),"function"==typeof r&&(h=r.call(i,n,h)),typeof h){case"string":return o(h);case"number":return isFinite(h)?String(h):"null";case"boolean":case"null":return String(h);case"object":if(!h)return"null";if(e+=t,f=[],"[object Array]"===Object.prototype.toString.apply(h)){for(l=h.length,s=0;s=0&&"[object Function]"===fv.call(e.callee)),r};var hv=Array.prototype.slice,pv=dv,mv=Object.keys,bv=mv?function(e){return mv(e)}:function(){if(lv)return uv;var e;if(lv=1,!Object.keys){var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,n=dv,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),a=i.call((function(){}),"prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],c=function(e){var t=e.constructor;return t&&t.prototype===e},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},l=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!u["$"+e]&&t.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{c(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();e=function(e){var i=null!==e&&"object"==typeof e,u="[object Function]"===r.call(e),f=n(e),d=i&&"[object String]"===r.call(e),h=[];if(!i&&!u&&!f)throw new TypeError("Object.keys called on a non-object");var p=a&&u;if(d&&e.length>0&&!t.call(e,0))for(var m=0;m0)for(var b=0;b1&&"boolean"!=typeof t)throw new Gv('"allowMissing" argument must be a boolean');if(null===pw(/^%?[^%]*%?$/,e))throw new Hv("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(e){var t=hw(e,0,1),r=hw(e,-1);if("%"===t&&"%"!==r)throw new Hv("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new Hv("invalid intrinsic syntax, expected opening `%`");var n=[];return dw(e,mw,(function(e,t,r,i){n[n.length]=r?dw(i,bw,"$1"):t||e})),n}(e),n=r.length>0?r[0]:"",i=gw("%"+n+"%",t),o=i.name,a=i.value,s=!1,c=i.alias;c&&(n=c[0],fw(r,lw([0,1],c)));for(var u=1,l=!0;u=r.length){var p=Wv(a,f);a=(l=!!p)&&"get"in p&&!("originalValue"in p.get)?p.get:a[f]}else l=uw(a,f),a=a[f];l&&!s&&(rw[o]=a)}}return a};function vw(){if(ow)return iw;ow=1;var e=yw("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch(t){e=!1}return iw=e}var ww=yw("%Object.getOwnPropertyDescriptor%",!0);if(ww)try{ww([],"length")}catch(M1){ww=null}var Ew=ww,Aw=vw(),xw=Tv,_w=Ov,kw=Ew,Sw=vw(),Pw=function(){return!!Sw};Pw.hasArrayLengthDefineBug=function(){if(!Sw)return null;try{return 1!==Sw([],"length",{value:1}).length}catch(e){return!0}};var Iw=yw,Tw=function(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new _w("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new _w("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new _w("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new _w("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new _w("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new _w("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,i=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6&&arguments[6],s=!!kw&&kw(e,t);if(Aw)Aw(e,t,{configurable:null===o&&s?s.configurable:!o,enumerable:null===n&&s?s.enumerable:!n,value:r,writable:null===i&&s?s.writable:!i});else{if(!a&&(n||i||o))throw new xw("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}},Ow=Pw(),Mw=Ew,Cw=Ov,Bw=Iw("%Math.floor%"),Nw=function(e,t){if("function"!=typeof e)throw new Cw("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||Bw(t)!==t)throw new Cw("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,i=!0;if("length"in e&&Mw){var o=Mw(e,"length");o&&!o.configurable&&(n=!1),o&&!o.writable&&(i=!1)}return(n||i||!r)&&(Ow?Tw(e,"length",t,!0,!0):Tw(e,"length",t)),e};!function(e){var t=_v,r=yw,n=Nw,i=Ov,o=r("%Function.prototype.apply%"),a=r("%Function.prototype.call%"),s=r("%Reflect.apply%",!0)||t.call(a,o),c=vw(),u=r("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new i("a function is required");var r=s(t,a,arguments);return n(r,1+u(0,e.length-(arguments.length-1)),!0)};var l=function(){return s(t,o,arguments)};c?c(e.exports,"apply",{value:l}):e.exports.apply=l}(vv);var Rw=yw,Fw=vv.exports,Lw=Fw(Rw("String.prototype.indexOf"));("undefined"!=typeof JSON?JSON:(ov||(ov=1,av.parse=sv(),av.stringify=cv()),av)).stringify;var jw=function(e,t){var r=Rw(e,!!t);return"function"==typeof r&&Lw(e,".prototype.")>-1?Fw(r):r};function Uw(e){return _.from(wp(e))}jw("Array.prototype.join"),jw("Array.prototype.push");const Dw=new Jp.ec("secp256k1");async function zw(e,t){const r=JSON.stringify(t),n=_.from(r,"utf-8"),i=await async function(e,t,r){let n=(r=r||{}).ephemPrivateKey||Gy(32);for(;!Hy(n);)n=r.ephemPrivateKey||Gy(32);const i=Zy(n),o=await Xy(n,e),a=await qy(o),s=r.iv||Gy(16),c=a.slice(0,32),u=a.slice(32),l=await Vy(s,_.from(c),t),f=_.concat([s,i,l]);return{iv:s,ephemPublicKey:i,ciphertext:l,mac:await Jy(_.from(u),f)}}(Zy(_.from(e,"hex")),n),o=function(e){return{iv:_.from(e.iv).toString("hex"),ephemPublicKey:_.from(e.ephemPublicKey).toString("hex"),ciphertext:_.from(e.ciphertext).toString("hex"),mac:_.from(e.mac).toString("hex")}}(i);return JSON.stringify(o)}async function $w(e,t){const r=function(e){return{iv:_.from(e.iv,"hex"),ephemPublicKey:_.from(e.ephemPublicKey,"hex"),ciphertext:_.from(e.ciphertext,"hex"),mac:_.from(e.mac,"hex")}}(JSON.parse(t)),n=Dw.keyFromPrivate(e),i=(await ev(_.from(n.getPrivate().toString("hex",64),"hex"),r)).toString("utf-8");return JSON.parse(i)}var Hw={exports:{}}; /** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */!function(e,t){(function(){var r,n="Expected a function",i="__lodash_hash_undefined__",a="__lodash_placeholder__",s=16,c=32,u=64,l=128,f=256,d=1/0,h=9007199254740991,p=NaN,m=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",s],["flip",512],["partial",c],["partialRight",u],["rearg",f]],g="[object Arguments]",y="[object Array]",v="[object Boolean]",w="[object Date]",E="[object Error]",A="[object Function]",x="[object GeneratorFunction]",_="[object Map]",k="[object Number]",S="[object Object]",P="[object Promise]",I="[object RegExp]",T="[object Set]",O="[object String]",M="[object Symbol]",C="[object WeakMap]",B="[object ArrayBuffer]",N="[object DataView]",R="[object Float32Array]",F="[object Float64Array]",L="[object Int8Array]",j="[object Int16Array]",U="[object Int32Array]",D="[object Uint8Array]",z="[object Uint8ClampedArray]",$="[object Uint16Array]",H="[object Uint32Array]",G=/\b__p \+= '';/g,q=/\b(__p \+=) '' \+/g,K=/(__e\(.*?\)|\b__t\)) \+\n'';/g,V=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,J=RegExp(V.source),Z=RegExp(W.source),Y=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,ee=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,te=/^\w*$/,re=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ne=/[\\^$.*+?()[\]{}|]/g,ie=RegExp(ne.source),oe=/^\s+/,ae=/\s/,se=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ce=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,fe=/[()=,{}\[\]\/\s]/,de=/\\(\\)?/g,he=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,me=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,ge=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,ve=/^(?:0|[1-9]\d*)$/,we=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ee=/($^)/,Ae=/['\n\r\u2028\u2029\\]/g,xe="\\ud800-\\udfff",_e="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ke="\\u2700-\\u27bf",Se="a-z\\xdf-\\xf6\\xf8-\\xff",Pe="A-Z\\xc0-\\xd6\\xd8-\\xde",Ie="\\ufe0e\\ufe0f",Te="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Oe="['’]",Me="["+xe+"]",Ce="["+Te+"]",Be="["+_e+"]",Ne="\\d+",Re="["+ke+"]",Fe="["+Se+"]",Le="[^"+xe+Te+Ne+ke+Se+Pe+"]",je="\\ud83c[\\udffb-\\udfff]",Ue="[^"+xe+"]",De="(?:\\ud83c[\\udde6-\\uddff]){2}",ze="[\\ud800-\\udbff][\\udc00-\\udfff]",$e="["+Pe+"]",He="\\u200d",Ge="(?:"+Fe+"|"+Le+")",qe="(?:"+$e+"|"+Le+")",Ke="(?:['’](?:d|ll|m|re|s|t|ve))?",Ve="(?:['’](?:D|LL|M|RE|S|T|VE))?",We="(?:"+Be+"|"+je+")"+"?",Je="["+Ie+"]?",Ze=Je+We+("(?:"+He+"(?:"+[Ue,De,ze].join("|")+")"+Je+We+")*"),Ye="(?:"+[Re,De,ze].join("|")+")"+Ze,Xe="(?:"+[Ue+Be+"?",Be,De,ze,Me].join("|")+")",Qe=RegExp(Oe,"g"),et=RegExp(Be,"g"),tt=RegExp(je+"(?="+je+")|"+Xe+Ze,"g"),rt=RegExp([$e+"?"+Fe+"+"+Ke+"(?="+[Ce,$e,"$"].join("|")+")",qe+"+"+Ve+"(?="+[Ce,$e+Ge,"$"].join("|")+")",$e+"?"+Ge+"+"+Ke,$e+"+"+Ve,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ne,Ye].join("|"),"g"),nt=RegExp("["+He+xe+_e+Ie+"]"),it=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ot=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],at=-1,st={};st[R]=st[F]=st[L]=st[j]=st[U]=st[D]=st[z]=st[$]=st[H]=!0,st[g]=st[y]=st[B]=st[v]=st[N]=st[w]=st[E]=st[A]=st[_]=st[k]=st[S]=st[I]=st[T]=st[O]=st[C]=!1;var ct={};ct[g]=ct[y]=ct[B]=ct[N]=ct[v]=ct[w]=ct[R]=ct[F]=ct[L]=ct[j]=ct[U]=ct[_]=ct[k]=ct[S]=ct[I]=ct[T]=ct[O]=ct[M]=ct[D]=ct[z]=ct[$]=ct[H]=!0,ct[E]=ct[A]=ct[C]=!1;var ut={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},lt=parseFloat,ft=parseInt,dt="object"==typeof o&&o&&o.Object===Object&&o,ht="object"==typeof self&&self&&self.Object===Object&&self,pt=dt||ht||Function("return this")(),mt=t&&!t.nodeType&&t,bt=mt&&e&&!e.nodeType&&e,gt=bt&&bt.exports===mt,yt=gt&&dt.process,vt=function(){try{var e=bt&&bt.require&&bt.require("util").types;return e||yt&&yt.binding&&yt.binding("util")}catch(e){}}(),wt=vt&&vt.isArrayBuffer,Et=vt&&vt.isDate,At=vt&&vt.isMap,xt=vt&&vt.isRegExp,_t=vt&&vt.isSet,kt=vt&&vt.isTypedArray;function St(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function Pt(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i-1}function Bt(e,t,r){for(var n=-1,i=null==e?0:e.length;++n-1;);return r}function rr(e,t){for(var r=e.length;r--&&$t(t,e[r],0)>-1;);return r}var nr=Vt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),ir=Vt({"&":"&","<":"<",">":">",'"':""","'":"'"});function or(e){return"\\"+ut[e]}function ar(e){return nt.test(e)}function sr(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function cr(e,t){return function(r){return e(t(r))}}function ur(e,t){for(var r=-1,n=e.length,i=0,o=[];++r",""":'"',"'":"'"});var br=function e(t){var o=(t=null==t?pt:br.defaults(pt.Object(),t,br.pick(pt,ot))).Array,ae=t.Date,xe=t.Error,_e=t.Function,ke=t.Math,Se=t.Object,Pe=t.RegExp,Ie=t.String,Te=t.TypeError,Oe=o.prototype,Me=_e.prototype,Ce=Se.prototype,Be=t["__core-js_shared__"],Ne=Me.toString,Re=Ce.hasOwnProperty,Fe=0,Le=function(){var e=/[^.]+$/.exec(Be&&Be.keys&&Be.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),je=Ce.toString,Ue=Ne.call(Se),De=pt._,ze=Pe("^"+Ne.call(Re).replace(ne,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$e=gt?t.Buffer:r,He=t.Symbol,Ge=t.Uint8Array,qe=$e?$e.allocUnsafe:r,Ke=cr(Se.getPrototypeOf,Se),Ve=Se.create,We=Ce.propertyIsEnumerable,Je=Oe.splice,Ze=He?He.isConcatSpreadable:r,Ye=He?He.iterator:r,Xe=He?He.toStringTag:r,tt=function(){try{var e=fo(Se,"defineProperty");return e({},"",{}),e}catch(e){}}(),nt=t.clearTimeout!==pt.clearTimeout&&t.clearTimeout,ut=ae&&ae.now!==pt.Date.now&&ae.now,dt=t.setTimeout!==pt.setTimeout&&t.setTimeout,ht=ke.ceil,mt=ke.floor,bt=Se.getOwnPropertySymbols,yt=$e?$e.isBuffer:r,vt=t.isFinite,Ut=Oe.join,Vt=cr(Se.keys,Se),gr=ke.max,yr=ke.min,vr=ae.now,wr=t.parseInt,Er=ke.random,Ar=Oe.reverse,xr=fo(t,"DataView"),_r=fo(t,"Map"),kr=fo(t,"Promise"),Sr=fo(t,"Set"),Pr=fo(t,"WeakMap"),Ir=fo(Se,"create"),Tr=Pr&&new Pr,Or={},Mr=jo(xr),Cr=jo(_r),Br=jo(kr),Nr=jo(Sr),Rr=jo(Pr),Fr=He?He.prototype:r,Lr=Fr?Fr.valueOf:r,jr=Fr?Fr.toString:r;function Ur(e){if(ts(e)&&!Ga(e)&&!(e instanceof Hr)){if(e instanceof $r)return e;if(Re.call(e,"__wrapped__"))return Uo(e)}return new $r(e)}var Dr=function(){function e(){}return function(t){if(!es(t))return{};if(Ve)return Ve(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function zr(){}function $r(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}function Hr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function Gr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function cn(e,t,n,i,o,a){var s,c=1&t,u=2&t,l=4&t;if(n&&(s=o?n(e,i,o,a):n(e)),s!==r)return s;if(!es(e))return e;var f=Ga(e);if(f){if(s=function(e){var t=e.length,r=new e.constructor(t);t&&"string"==typeof e[0]&&Re.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!c)return Ti(e,s)}else{var d=mo(e),h=d==A||d==x;if(Wa(e))return xi(e,c);if(d==S||d==g||h&&!o){if(s=u||h?{}:go(e),!c)return u?function(e,t){return Oi(e,po(e),t)}(e,function(e,t){return e&&Oi(t,Cs(t),e)}(s,e)):function(e,t){return Oi(e,ho(e),t)}(e,nn(s,e))}else{if(!ct[d])return o?e:{};s=function(e,t,r){var n=e.constructor;switch(t){case B:return _i(e);case v:case w:return new n(+e);case N:return function(e,t){var r=t?_i(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case R:case F:case L:case j:case U:case D:case z:case $:case H:return ki(e,r);case _:return new n;case k:case O:return new n(e);case I:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case T:return new n;case M:return i=e,Lr?Se(Lr.call(i)):{}}var i}(e,d,c)}}a||(a=new Wr);var p=a.get(e);if(p)return p;a.set(e,s),as(e)?e.forEach((function(r){s.add(cn(r,t,n,r,e,a))})):rs(e)&&e.forEach((function(r,i){s.set(i,cn(r,t,n,i,e,a))}));var m=f?r:(l?u?io:no:u?Cs:Ms)(e);return It(m||e,(function(r,i){m&&(r=e[i=r]),en(s,i,cn(r,t,n,i,e,a))})),s}function un(e,t,n){var i=n.length;if(null==e)return!i;for(e=Se(e);i--;){var o=n[i],a=t[o],s=e[o];if(s===r&&!(o in e)||!a(s))return!1}return!0}function ln(e,t,i){if("function"!=typeof e)throw new Te(n);return Mo((function(){e.apply(r,i)}),t)}function fn(e,t,r,n){var i=-1,o=Ct,a=!0,s=e.length,c=[],u=t.length;if(!s)return c;r&&(t=Nt(t,Xt(r))),n?(o=Bt,a=!1):t.length>=200&&(o=er,a=!1,t=new Vr(t));e:for(;++i-1},qr.prototype.set=function(e,t){var r=this.__data__,n=tn(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Kr.prototype.clear=function(){this.size=0,this.__data__={hash:new Gr,map:new(_r||qr),string:new Gr}},Kr.prototype.delete=function(e){var t=uo(this,e).delete(e);return this.size-=t?1:0,t},Kr.prototype.get=function(e){return uo(this,e).get(e)},Kr.prototype.has=function(e){return uo(this,e).has(e)},Kr.prototype.set=function(e,t){var r=uo(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Vr.prototype.add=Vr.prototype.push=function(e){return this.__data__.set(e,i),this},Vr.prototype.has=function(e){return this.__data__.has(e)},Wr.prototype.clear=function(){this.__data__=new qr,this.size=0},Wr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Wr.prototype.get=function(e){return this.__data__.get(e)},Wr.prototype.has=function(e){return this.__data__.has(e)},Wr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof qr){var n=r.__data__;if(!_r||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Kr(n)}return r.set(e,t),this.size=r.size,this};var dn=Bi(wn),hn=Bi(En,!0);function pn(e,t){var r=!0;return dn(e,(function(e,n,i){return r=!!t(e,n,i)})),r}function mn(e,t,n){for(var i=-1,o=e.length;++i0&&r(s)?t>1?gn(s,t-1,r,n,i):Rt(i,s):n||(i[i.length]=s)}return i}var yn=Ni(),vn=Ni(!0);function wn(e,t){return e&&yn(e,t,Ms)}function En(e,t){return e&&vn(e,t,Ms)}function An(e,t){return Mt(t,(function(t){return Ya(e[t])}))}function xn(e,t){for(var n=0,i=(t=vi(t,e)).length;null!=e&&nt}function Pn(e,t){return null!=e&&Re.call(e,t)}function In(e,t){return null!=e&&t in Se(e)}function Tn(e,t,n){for(var i=n?Bt:Ct,a=e[0].length,s=e.length,c=s,u=o(s),l=1/0,f=[];c--;){var d=e[c];c&&t&&(d=Nt(d,Xt(t))),l=yr(d.length,l),u[c]=!n&&(t||a>=120&&d.length>=120)?new Vr(c&&d):r}d=e[0];var h=-1,p=u[0];e:for(;++h=s?c:c*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)}))}function qn(e,t,r){for(var n=-1,i=t.length,o={};++n-1;)s!==e&&Je.call(s,c,1),Je.call(e,c,1);return e}function Vn(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==o){var o=i;vo(i)?Je.call(e,i,1):fi(e,i)}}return e}function Wn(e,t){return e+mt(Er()*(t-e+1))}function Jn(e,t){var r="";if(!e||t<1||t>h)return r;do{t%2&&(r+=e),(t=mt(t/2))&&(e+=e)}while(t);return r}function Zn(e,t){return Co(Po(e,t,nc),e+"")}function Yn(e){return Zr(Ds(e))}function Xn(e,t){var r=Ds(e);return Ro(r,sn(t,0,r.length))}function Qn(e,t,n,i){if(!es(e))return e;for(var o=-1,a=(t=vi(t,e)).length,s=a-1,c=e;null!=c&&++oi?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=o(i);++n>>1,a=e[o];null!==a&&!cs(a)&&(r?a<=t:a=200){var u=t?null:Ji(e);if(u)return lr(u);a=!1,i=er,c=new Vr}else c=t?[]:s;e:for(;++n=i?e:ni(e,t,n)}var Ai=nt||function(e){return pt.clearTimeout(e)};function xi(e,t){if(t)return e.slice();var r=e.length,n=qe?qe(r):new e.constructor(r);return e.copy(n),n}function _i(e){var t=new e.constructor(e.byteLength);return new Ge(t).set(new Ge(e)),t}function ki(e,t){var r=t?_i(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Si(e,t){if(e!==t){var n=e!==r,i=null===e,o=e==e,a=cs(e),s=t!==r,c=null===t,u=t==t,l=cs(t);if(!c&&!l&&!a&&e>t||a&&s&&u&&!c&&!l||i&&s&&u||!n&&u||!o)return 1;if(!i&&!a&&!l&&e1?n[o-1]:r,s=o>2?n[2]:r;for(a=e.length>3&&"function"==typeof a?(o--,a):r,s&&wo(n[0],n[1],s)&&(a=o<3?r:a,o=1),t=Se(t);++i-1?o[a?t[s]:s]:r}}function Ui(e){return ro((function(t){var i=t.length,o=i,a=$r.prototype.thru;for(e&&t.reverse();o--;){var s=t[o];if("function"!=typeof s)throw new Te(n);if(a&&!c&&"wrapper"==ao(s))var c=new $r([],!0)}for(o=c?o:i;++o1&&w.reverse(),h&&fc))return!1;var l=a.get(e),f=a.get(t);if(l&&f)return l==t&&f==e;var d=-1,h=!0,p=2&n?new Vr:r;for(a.set(e,t),a.set(t,e);++d-1&&e%1==0&&e1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(se,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return It(b,(function(r){var n="_."+r[0];t&r[1]&&!Ct(e,n)&&e.push(n)})),e.sort()}(function(e){var t=e.match(ce);return t?t[1].split(ue):[]}(n),r)))}function No(e){var t=0,n=0;return function(){var i=vr(),o=16-(i-n);if(n=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(r,arguments)}}function Ro(e,t){var n=-1,i=e.length,o=i-1;for(t=t===r?i:t;++n1?e[t-1]:r;return n="function"==typeof n?(e.pop(),n):r,oa(e,n)}));function da(e){var t=Ur(e);return t.__chain__=!0,t}function ha(e,t){return t(e)}var pa=ro((function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,o=function(t){return an(t,e)};return!(t>1||this.__actions__.length)&&i instanceof Hr&&vo(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:ha,args:[o],thisArg:r}),new $r(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(r),e}))):this.thru(o)}));var ma=Mi((function(e,t,r){Re.call(e,r)?++e[r]:on(e,r,1)}));var ba=ji(Ho),ga=ji(Go);function ya(e,t){return(Ga(e)?It:dn)(e,co(t,3))}function va(e,t){return(Ga(e)?Tt:hn)(e,co(t,3))}var wa=Mi((function(e,t,r){Re.call(e,r)?e[r].push(t):on(e,r,[t])}));var Ea=Zn((function(e,t,r){var n=-1,i="function"==typeof t,a=Ka(e)?o(e.length):[];return dn(e,(function(e){a[++n]=i?St(t,e,r):On(e,t,r)})),a})),Aa=Mi((function(e,t,r){on(e,r,t)}));function xa(e,t){return(Ga(e)?Nt:Un)(e,co(t,3))}var _a=Mi((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]}));var ka=Zn((function(e,t){if(null==e)return[];var r=t.length;return r>1&&wo(e,t[0],t[1])?t=[]:r>2&&wo(t[0],t[1],t[2])&&(t=[t[0]]),Gn(e,gn(t,1),[])})),Sa=ut||function(){return pt.Date.now()};function Pa(e,t,n){return t=n?r:t,t=e&&null==t?e.length:t,Yi(e,l,r,r,r,r,t)}function Ia(e,t){var i;if("function"!=typeof t)throw new Te(n);return e=ps(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=r),i}}var Ta=Zn((function(e,t,r){var n=1;if(r.length){var i=ur(r,so(Ta));n|=c}return Yi(e,n,t,r,i)})),Oa=Zn((function(e,t,r){var n=3;if(r.length){var i=ur(r,so(Oa));n|=c}return Yi(t,n,e,r,i)}));function Ma(e,t,i){var o,a,s,c,u,l,f=0,d=!1,h=!1,p=!0;if("function"!=typeof e)throw new Te(n);function m(t){var n=o,i=a;return o=a=r,f=t,c=e.apply(i,n)}function b(e){var n=e-l;return l===r||n>=t||n<0||h&&e-f>=s}function g(){var e=Sa();if(b(e))return y(e);u=Mo(g,function(e){var r=t-(e-l);return h?yr(r,s-(e-f)):r}(e))}function y(e){return u=r,p&&o?m(e):(o=a=r,c)}function v(){var e=Sa(),n=b(e);if(o=arguments,a=this,l=e,n){if(u===r)return function(e){return f=e,u=Mo(g,t),d?m(e):c}(l);if(h)return Ai(u),u=Mo(g,t),m(l)}return u===r&&(u=Mo(g,t)),c}return t=bs(t)||0,es(i)&&(d=!!i.leading,s=(h="maxWait"in i)?gr(bs(i.maxWait)||0,t):s,p="trailing"in i?!!i.trailing:p),v.cancel=function(){u!==r&&Ai(u),f=0,o=l=a=u=r},v.flush=function(){return u===r?c:y(Sa())},v}var Ca=Zn((function(e,t){return ln(e,1,t)})),Ba=Zn((function(e,t,r){return ln(e,bs(t)||0,r)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Te(n);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(Na.Cache||Kr),r}function Ra(e){if("function"!=typeof e)throw new Te(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Kr;var Fa=wi((function(e,t){var r=(t=1==t.length&&Ga(t[0])?Nt(t[0],Xt(co())):Nt(gn(t,1),Xt(co()))).length;return Zn((function(n){for(var i=-1,o=yr(n.length,r);++i=t})),Ha=Mn(function(){return arguments}())?Mn:function(e){return ts(e)&&Re.call(e,"callee")&&!We.call(e,"callee")},Ga=o.isArray,qa=wt?Xt(wt):function(e){return ts(e)&&kn(e)==B};function Ka(e){return null!=e&&Qa(e.length)&&!Ya(e)}function Va(e){return ts(e)&&Ka(e)}var Wa=yt||bc,Ja=Et?Xt(Et):function(e){return ts(e)&&kn(e)==w};function Za(e){if(!ts(e))return!1;var t=kn(e);return t==E||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!is(e)}function Ya(e){if(!es(e))return!1;var t=kn(e);return t==A||t==x||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Xa(e){return"number"==typeof e&&e==ps(e)}function Qa(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=h}function es(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ts(e){return null!=e&&"object"==typeof e}var rs=At?Xt(At):function(e){return ts(e)&&mo(e)==_};function ns(e){return"number"==typeof e||ts(e)&&kn(e)==k}function is(e){if(!ts(e)||kn(e)!=S)return!1;var t=Ke(e);if(null===t)return!0;var r=Re.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Ne.call(r)==Ue}var os=xt?Xt(xt):function(e){return ts(e)&&kn(e)==I};var as=_t?Xt(_t):function(e){return ts(e)&&mo(e)==T};function ss(e){return"string"==typeof e||!Ga(e)&&ts(e)&&kn(e)==O}function cs(e){return"symbol"==typeof e||ts(e)&&kn(e)==M}var us=kt?Xt(kt):function(e){return ts(e)&&Qa(e.length)&&!!st[kn(e)]};var ls=Ki(jn),fs=Ki((function(e,t){return e<=t}));function ds(e){if(!e)return[];if(Ka(e))return ss(e)?hr(e):Ti(e);if(Ye&&e[Ye])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[Ye]());var t=mo(e);return(t==_?sr:t==T?lr:Ds)(e)}function hs(e){return e?(e=bs(e))===d||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ps(e){var t=hs(e),r=t%1;return t==t?r?t-r:t:0}function ms(e){return e?sn(ps(e),0,m):0}function bs(e){if("number"==typeof e)return e;if(cs(e))return p;if(es(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=es(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Yt(e);var r=be.test(e);return r||ye.test(e)?ft(e.slice(2),r?2:8):me.test(e)?p:+e}function gs(e){return Oi(e,Cs(e))}function ys(e){return null==e?"":ui(e)}var vs=Ci((function(e,t){if(_o(t)||Ka(t))Oi(t,Ms(t),e);else for(var r in t)Re.call(t,r)&&en(e,r,t[r])})),ws=Ci((function(e,t){Oi(t,Cs(t),e)})),Es=Ci((function(e,t,r,n){Oi(t,Cs(t),e,n)})),As=Ci((function(e,t,r,n){Oi(t,Ms(t),e,n)})),xs=ro(an);var _s=Zn((function(e,t){e=Se(e);var n=-1,i=t.length,o=i>2?t[2]:r;for(o&&wo(t[0],t[1],o)&&(i=1);++n1),t})),Oi(e,io(e),r),n&&(r=cn(r,7,eo));for(var i=t.length;i--;)fi(r,t[i]);return r}));var Fs=ro((function(e,t){return null==e?{}:function(e,t){return qn(e,t,(function(t,r){return Ps(e,r)}))}(e,t)}));function Ls(e,t){if(null==e)return{};var r=Nt(io(e),(function(e){return[e]}));return t=co(t),qn(e,r,(function(e,r){return t(e,r[0])}))}var js=Zi(Ms),Us=Zi(Cs);function Ds(e){return null==e?[]:Qt(e,Ms(e))}var zs=Fi((function(e,t,r){return t=t.toLowerCase(),e+(r?$s(t):t)}));function $s(e){return Zs(ys(e).toLowerCase())}function Hs(e){return(e=ys(e))&&e.replace(we,nr).replace(et,"")}var Gs=Fi((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})),qs=Fi((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()})),Ks=Ri("toLowerCase");var Vs=Fi((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}));var Ws=Fi((function(e,t,r){return e+(r?" ":"")+Zs(t)}));var Js=Fi((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()})),Zs=Ri("toUpperCase");function Ys(e,t,n){return e=ys(e),(t=n?r:t)===r?function(e){return it.test(e)}(e)?function(e){return e.match(rt)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Xs=Zn((function(e,t){try{return St(e,r,t)}catch(e){return Za(e)?e:new xe(e)}})),Qs=ro((function(e,t){return It(t,(function(t){t=Lo(t),on(e,t,Ta(e[t],e))})),e}));function ec(e){return function(){return e}}var tc=Ui(),rc=Ui(!0);function nc(e){return e}function ic(e){return Rn("function"==typeof e?e:cn(e,1))}var oc=Zn((function(e,t){return function(r){return On(r,e,t)}})),ac=Zn((function(e,t){return function(r){return On(e,r,t)}}));function sc(e,t,r){var n=Ms(t),i=An(t,n);null!=r||es(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=An(t,Ms(t)));var o=!(es(r)&&"chain"in r&&!r.chain),a=Ya(e);return It(i,(function(r){var n=t[r];e[r]=n,a&&(e.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=e(this.__wrapped__);return(r.__actions__=Ti(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,Rt([this.value()],arguments))})})),e}function cc(){}var uc=Hi(Nt),lc=Hi(Ot),fc=Hi(jt);function dc(e){return Eo(e)?Kt(Lo(e)):function(e){return function(t){return xn(t,e)}}(e)}var hc=qi(),pc=qi(!0);function mc(){return[]}function bc(){return!1}var gc=$i((function(e,t){return e+t}),0),yc=Wi("ceil"),vc=$i((function(e,t){return e/t}),1),wc=Wi("floor");var Ec,Ac=$i((function(e,t){return e*t}),1),xc=Wi("round"),_c=$i((function(e,t){return e-t}),0);return Ur.after=function(e,t){if("function"!=typeof t)throw new Te(n);return e=ps(e),function(){if(--e<1)return t.apply(this,arguments)}},Ur.ary=Pa,Ur.assign=vs,Ur.assignIn=ws,Ur.assignInWith=Es,Ur.assignWith=As,Ur.at=xs,Ur.before=Ia,Ur.bind=Ta,Ur.bindAll=Qs,Ur.bindKey=Oa,Ur.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ga(e)?e:[e]},Ur.chain=da,Ur.chunk=function(e,t,n){t=(n?wo(e,t,n):t===r)?1:gr(ps(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,s=0,c=o(ht(i/t));ao?0:o+n),(i=i===r||i>o?o:ps(i))<0&&(i+=o),i=n>i?0:ms(i);n>>0)?(e=ys(e))&&("string"==typeof t||null!=t&&!os(t))&&!(t=ui(t))&&ar(e)?Ei(hr(e),0,n):e.split(t,n):[]},Ur.spread=function(e,t){if("function"!=typeof e)throw new Te(n);return t=null==t?0:gr(ps(t),0),Zn((function(r){var n=r[t],i=Ei(r,0,t);return n&&Rt(i,n),St(e,this,i)}))},Ur.tail=function(e){var t=null==e?0:e.length;return t?ni(e,1,t):[]},Ur.take=function(e,t,n){return e&&e.length?ni(e,0,(t=n||t===r?1:ps(t))<0?0:t):[]},Ur.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?ni(e,(t=i-(t=n||t===r?1:ps(t)))<0?0:t,i):[]},Ur.takeRightWhile=function(e,t){return e&&e.length?hi(e,co(t,3),!1,!0):[]},Ur.takeWhile=function(e,t){return e&&e.length?hi(e,co(t,3)):[]},Ur.tap=function(e,t){return t(e),e},Ur.throttle=function(e,t,r){var i=!0,o=!0;if("function"!=typeof e)throw new Te(n);return es(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),Ma(e,t,{leading:i,maxWait:t,trailing:o})},Ur.thru=ha,Ur.toArray=ds,Ur.toPairs=js,Ur.toPairsIn=Us,Ur.toPath=function(e){return Ga(e)?Nt(e,Lo):cs(e)?[e]:Ti(Fo(ys(e)))},Ur.toPlainObject=gs,Ur.transform=function(e,t,r){var n=Ga(e),i=n||Wa(e)||us(e);if(t=co(t,4),null==r){var o=e&&e.constructor;r=i?n?new o:[]:es(e)&&Ya(o)?Dr(Ke(e)):{}}return(i?It:wn)(e,(function(e,n,i){return t(r,e,n,i)})),r},Ur.unary=function(e){return Pa(e,1)},Ur.union=ta,Ur.unionBy=ra,Ur.unionWith=na,Ur.uniq=function(e){return e&&e.length?li(e):[]},Ur.uniqBy=function(e,t){return e&&e.length?li(e,co(t,2)):[]},Ur.uniqWith=function(e,t){return t="function"==typeof t?t:r,e&&e.length?li(e,r,t):[]},Ur.unset=function(e,t){return null==e||fi(e,t)},Ur.unzip=ia,Ur.unzipWith=oa,Ur.update=function(e,t,r){return null==e?e:di(e,t,yi(r))},Ur.updateWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:di(e,t,yi(n),i)},Ur.values=Ds,Ur.valuesIn=function(e){return null==e?[]:Qt(e,Cs(e))},Ur.without=aa,Ur.words=Ys,Ur.wrap=function(e,t){return La(yi(t),e)},Ur.xor=sa,Ur.xorBy=ca,Ur.xorWith=ua,Ur.zip=la,Ur.zipObject=function(e,t){return bi(e||[],t||[],en)},Ur.zipObjectDeep=function(e,t){return bi(e||[],t||[],Qn)},Ur.zipWith=fa,Ur.entries=js,Ur.entriesIn=Us,Ur.extend=ws,Ur.extendWith=Es,sc(Ur,Ur),Ur.add=gc,Ur.attempt=Xs,Ur.camelCase=zs,Ur.capitalize=$s,Ur.ceil=yc,Ur.clamp=function(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=(n=bs(n))==n?n:0),t!==r&&(t=(t=bs(t))==t?t:0),sn(bs(e),t,n)},Ur.clone=function(e){return cn(e,4)},Ur.cloneDeep=function(e){return cn(e,5)},Ur.cloneDeepWith=function(e,t){return cn(e,5,t="function"==typeof t?t:r)},Ur.cloneWith=function(e,t){return cn(e,4,t="function"==typeof t?t:r)},Ur.conformsTo=function(e,t){return null==t||un(e,t,Ms(t))},Ur.deburr=Hs,Ur.defaultTo=function(e,t){return null==e||e!=e?t:e},Ur.divide=vc,Ur.endsWith=function(e,t,n){e=ys(e),t=ui(t);var i=e.length,o=n=n===r?i:sn(ps(n),0,i);return(n-=t.length)>=0&&e.slice(n,o)==t},Ur.eq=Da,Ur.escape=function(e){return(e=ys(e))&&Z.test(e)?e.replace(W,ir):e},Ur.escapeRegExp=function(e){return(e=ys(e))&&ie.test(e)?e.replace(ne,"\\$&"):e},Ur.every=function(e,t,n){var i=Ga(e)?Ot:pn;return n&&wo(e,t,n)&&(t=r),i(e,co(t,3))},Ur.find=ba,Ur.findIndex=Ho,Ur.findKey=function(e,t){return Dt(e,co(t,3),wn)},Ur.findLast=ga,Ur.findLastIndex=Go,Ur.findLastKey=function(e,t){return Dt(e,co(t,3),En)},Ur.floor=wc,Ur.forEach=ya,Ur.forEachRight=va,Ur.forIn=function(e,t){return null==e?e:yn(e,co(t,3),Cs)},Ur.forInRight=function(e,t){return null==e?e:vn(e,co(t,3),Cs)},Ur.forOwn=function(e,t){return e&&wn(e,co(t,3))},Ur.forOwnRight=function(e,t){return e&&En(e,co(t,3))},Ur.get=Ss,Ur.gt=za,Ur.gte=$a,Ur.has=function(e,t){return null!=e&&bo(e,t,Pn)},Ur.hasIn=Ps,Ur.head=Ko,Ur.identity=nc,Ur.includes=function(e,t,r,n){e=Ka(e)?e:Ds(e),r=r&&!n?ps(r):0;var i=e.length;return r<0&&(r=gr(i+r,0)),ss(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&$t(e,t,r)>-1},Ur.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:ps(r);return i<0&&(i=gr(n+i,0)),$t(e,t,i)},Ur.inRange=function(e,t,n){return t=hs(t),n===r?(n=t,t=0):n=hs(n),function(e,t,r){return e>=yr(t,r)&&e=-9007199254740991&&e<=h},Ur.isSet=as,Ur.isString=ss,Ur.isSymbol=cs,Ur.isTypedArray=us,Ur.isUndefined=function(e){return e===r},Ur.isWeakMap=function(e){return ts(e)&&mo(e)==C},Ur.isWeakSet=function(e){return ts(e)&&"[object WeakSet]"==kn(e)},Ur.join=function(e,t){return null==e?"":Ut.call(e,t)},Ur.kebabCase=Gs,Ur.last=Zo,Ur.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i;return n!==r&&(o=(o=ps(n))<0?gr(i+o,0):yr(o,i-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,o):zt(e,Gt,o,!0)},Ur.lowerCase=qs,Ur.lowerFirst=Ks,Ur.lt=ls,Ur.lte=fs,Ur.max=function(e){return e&&e.length?mn(e,nc,Sn):r},Ur.maxBy=function(e,t){return e&&e.length?mn(e,co(t,2),Sn):r},Ur.mean=function(e){return qt(e,nc)},Ur.meanBy=function(e,t){return qt(e,co(t,2))},Ur.min=function(e){return e&&e.length?mn(e,nc,jn):r},Ur.minBy=function(e,t){return e&&e.length?mn(e,co(t,2),jn):r},Ur.stubArray=mc,Ur.stubFalse=bc,Ur.stubObject=function(){return{}},Ur.stubString=function(){return""},Ur.stubTrue=function(){return!0},Ur.multiply=Ac,Ur.nth=function(e,t){return e&&e.length?Hn(e,ps(t)):r},Ur.noConflict=function(){return pt._===this&&(pt._=De),this},Ur.noop=cc,Ur.now=Sa,Ur.pad=function(e,t,r){e=ys(e);var n=(t=ps(t))?dr(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return Gi(mt(i),r)+e+Gi(ht(i),r)},Ur.padEnd=function(e,t,r){e=ys(e);var n=(t=ps(t))?dr(e):0;return t&&nt){var i=e;e=t,t=i}if(n||e%1||t%1){var o=Er();return yr(e+o*(t-e+lt("1e-"+((o+"").length-1))),t)}return Wn(e,t)},Ur.reduce=function(e,t,r){var n=Ga(e)?Ft:Wt,i=arguments.length<3;return n(e,co(t,4),r,i,dn)},Ur.reduceRight=function(e,t,r){var n=Ga(e)?Lt:Wt,i=arguments.length<3;return n(e,co(t,4),r,i,hn)},Ur.repeat=function(e,t,n){return t=(n?wo(e,t,n):t===r)?1:ps(t),Jn(ys(e),t)},Ur.replace=function(){var e=arguments,t=ys(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ur.result=function(e,t,n){var i=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=r);++ih)return[];var r=m,n=yr(e,m);t=co(t),e-=m;for(var i=Zt(n,t);++r=a)return e;var c=n-dr(i);if(c<1)return i;var u=s?Ei(s,0,c).join(""):e.slice(0,c);if(o===r)return u+i;if(s&&(c+=u.length-c),os(o)){if(e.slice(c).search(o)){var l,f=u;for(o.global||(o=Pe(o.source,ys(pe.exec(o))+"g")),o.lastIndex=0;l=o.exec(f);)var d=l.index;u=u.slice(0,d===r?c:d)}}else if(e.indexOf(ui(o),c)!=c){var h=u.lastIndexOf(o);h>-1&&(u=u.slice(0,h))}return u+i},Ur.unescape=function(e){return(e=ys(e))&&J.test(e)?e.replace(V,mr):e},Ur.uniqueId=function(e){var t=++Fe;return ys(e)+t},Ur.upperCase=Js,Ur.upperFirst=Zs,Ur.each=ya,Ur.eachRight=va,Ur.first=Ko,sc(Ur,(Ec={},wn(Ur,(function(e,t){Re.call(Ur.prototype,t)||(Ec[t]=e)})),Ec),{chain:!1}),Ur.VERSION="4.17.21",It(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ur[e].placeholder=Ur})),It(["drop","take"],(function(e,t){Hr.prototype[e]=function(n){n=n===r?1:gr(ps(n),0);var i=this.__filtered__&&!t?new Hr(this):this.clone();return i.__filtered__?i.__takeCount__=yr(n,i.__takeCount__):i.__views__.push({size:yr(n,m),type:e+(i.__dir__<0?"Right":"")}),i},Hr.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),It(["filter","map","takeWhile"],(function(e,t){var r=t+1,n=1==r||3==r;Hr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:co(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}})),It(["head","last"],(function(e,t){var r="take"+(t?"Right":"");Hr.prototype[e]=function(){return this[r](1).value()[0]}})),It(["initial","tail"],(function(e,t){var r="drop"+(t?"":"Right");Hr.prototype[e]=function(){return this.__filtered__?new Hr(this):this[r](1)}})),Hr.prototype.compact=function(){return this.filter(nc)},Hr.prototype.find=function(e){return this.filter(e).head()},Hr.prototype.findLast=function(e){return this.reverse().find(e)},Hr.prototype.invokeMap=Zn((function(e,t){return"function"==typeof e?new Hr(this):this.map((function(r){return On(r,e,t)}))})),Hr.prototype.reject=function(e){return this.filter(Ra(co(e)))},Hr.prototype.slice=function(e,t){e=ps(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Hr(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(n=(t=ps(t))<0?n.dropRight(-t):n.take(t-e)),n)},Hr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Hr.prototype.toArray=function(){return this.take(m)},wn(Hr.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=Ur[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(Ur.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,c=t instanceof Hr,u=s[0],l=c||Ga(t),f=function(e){var t=o.apply(Ur,Rt([e],s));return i&&d?t[0]:t};l&&n&&"function"==typeof u&&1!=u.length&&(c=l=!1);var d=this.__chain__,h=!!this.__actions__.length,p=a&&!d,m=c&&!h;if(!a&&l){t=m?t:new Hr(this);var b=e.apply(t,s);return b.__actions__.push({func:ha,args:[f],thisArg:r}),new $r(b,d)}return p&&m?e.apply(this,s):(b=this.thru(f),p?i?b.value()[0]:b.value():b)})})),It(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Oe[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Ur.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(Ga(i)?i:[],e)}return this[r]((function(r){return t.apply(Ga(r)?r:[],e)}))}})),wn(Hr.prototype,(function(e,t){var r=Ur[t];if(r){var n=r.name+"";Re.call(Or,n)||(Or[n]=[]),Or[n].push({name:t,func:r})}})),Or[Di(r,2).name]=[{name:"wrapper",func:r}],Hr.prototype.clone=function(){var e=new Hr(this.__wrapped__);return e.__actions__=Ti(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ti(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ti(this.__views__),e},Hr.prototype.reverse=function(){if(this.__filtered__){var e=new Hr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Hr.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=Ga(e),n=t<0,i=r?e.length:0,o=function(e,t,r){var n=-1,i=r.length;for(;++n=this.__values__.length;return{done:e,value:e?r:this.__values__[this.__index__++]}},Ur.prototype.plant=function(e){for(var t,n=this;n instanceof zr;){var i=Uo(n);i.__index__=0,i.__values__=r,t?o.__wrapped__=i:t=i;var o=i;n=n.__wrapped__}return o.__wrapped__=e,t},Ur.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Hr){var t=e;return this.__actions__.length&&(t=new Hr(this)),(t=t.reverse()).__actions__.push({func:ha,args:[ea],thisArg:r}),new $r(t,this.__chain__)}return this.thru(ea)},Ur.prototype.toJSON=Ur.prototype.valueOf=Ur.prototype.value=function(){return pi(this.__wrapped__,this.__actions__)},Ur.prototype.first=Ur.prototype.head,Ye&&(Ur.prototype[Ye]=function(){return this}),Ur}();bt?((bt.exports=br)._=br,mt._=br):pt._=br}).call(o)}(Hw,Hw.exports);class Gw extends Af{constructor(e){let{config:t={},state:n={}}=e;super(),r(this,"defaultConfig",{}),r(this,"defaultState",{}),r(this,"disabled",!1),r(this,"name","BaseController"),r(this,"initialConfig",void 0),r(this,"initialState",void 0),r(this,"internalConfig",this.defaultConfig),r(this,"internalState",this.defaultState),this.initialState=n,this.initialConfig=t}get config(){return this.internalConfig}get state(){return this.internalState}configure(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]){this.internalConfig=t?e:Object.assign(this.internalConfig,e);for(const e in this.internalConfig)void 0!==this.internalConfig[e]&&(this[e]=this.internalConfig[e])}else for(const t in e)void 0!==this.internalConfig[t]&&(this.internalConfig[t]=e[t],this[t]=e[t])}update(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.internalState=i(t?{}:i({},this.internalState),e),this.emit("store",this.internalState)}initialize(){return this.internalState=this.defaultState,this.internalConfig=this.defaultConfig,this.configure(this.initialConfig),this.update(this.initialState),this}}const qw=()=>!0,Kw=["newListener","removeListener"],Vw=e=>!Kw.includes(e);function Ww(e,t){let r={}.eventFilter||qw;if("string"==typeof r&&"skipInternal"===r&&(r=Vw),"function"!=typeof r)throw new Error("createEventEmitterProxy - Invalid eventFilter");let n=e,i=e=>{const t=n;n=e,t.eventNames().filter(r).forEach((r=>{(function(e,t){return void 0!==e.rawListeners?e.rawListeners(t):e.listeners(t)})(t,r).forEach((t=>e.on(r,t)))})),t.removeAllListeners()};const o=new Proxy({},{get:(e,t)=>"setTarget"===t?i:n[t],set:(e,t,r)=>"setTarget"===t?(i=r,!0):(n[t]=r,!0)});return o}function Jw(e,t){if(""!==e&&!/^[a-f0-9]+$/iu.test(e))throw new Error(`Expected an unprefixed hex string. Received: ${e}`);return String.prototype.padStart.call(e,t,"0")}function Zw(e,t,r){const n=yp(t),i=yp(r),o=hp(e),a=Jw(_.from(vp(n)).toString("hex"),64),s=Jw(_.from(vp(i)).toString("hex"),64),c=op("0x"+o.toString(16));var u;return"string"!=typeof(u=a.concat(s,c))||ip(u)?u:"0x"+u}const Yw=async(e,t)=>{const r=_.from(e,"hex"),n=op(t),i=function(e,t){const r=tp.sign(e,t),n=r.toCompactRawBytes();return{r:n.slice(0,32),s:n.slice(32,64),v:BigInt(r.recovery+27)}}(_.from(n,"hex"),r);return Zw(_.from(bp(i.v)),_.from(i.r),_.from(i.s))},Xw=["Gateway timeout","ETIMEDOUT","failed to parse response body","Failed to fetch"];function Qw(e){switch(e.status){case 405:throw ff.methodNotFound();case 418:throw ff.internal({message:"Request is being rate limited."});case 503:case 504:throw ff.internal({message:"Gateway timeout. The request took too long to process.This can happen when querying over too wide a block range."})}}function eE(e){return new Promise((t=>{setTimeout(t,e)}))}function tE(e,t){if(200!==e.status)throw ff.internal({message:`Non-200 status code: '${e.status}'`,data:t});if(t.error)throw ff.internal({data:t.error});return t.result}function rE(e){let{rpcTarget:t,originHttpHeaderKey:r}=e;return kf((async(e,n,i)=>{const{fetchUrl:o,fetchParams:a}=function(e){let{req:t,rpcTarget:r,originHttpHeaderKey:n}=e;const i=new URL(r),o={id:t.id,jsonrpc:t.jsonrpc,method:t.method,params:t.params},a=t.origin,s={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(o)};return n&&a&&(s.headers[n]=a),{fetchUrl:i.href,fetchParams:s}}({req:e,rpcTarget:t,originHttpHeaderKey:r});for(let e=0;e<5;e++){try{const e=await fetch(o,a);Qw(e);const t=await e.json(),r=tE(e,t);return void(n.result=r)}catch(e){const t=e.toString();if(!Xw.some((e=>t.includes(e))))throw e}await eE(1e3)}}))}var nE=function(e){var t=(e=e||{}).max||Number.MAX_SAFE_INTEGER,r=void 0!==e.start?e.start:Math.floor(Math.random()*t);return function(){return r%=t,r++}};var iE=a(nE);let oE=class extends Gw{constructor(e){let{config:t,state:n}=e;if(super({config:t,state:n}),r(this,"_providerEngineProxy",null),!t.chainConfig)throw kd.invalidProviderConfigError("Please provide chainConfig");if(!t.chainConfig.chainId)throw kd.invalidProviderConfigError("Please provide chainId inside chainConfig");if(!t.chainConfig.rpcTarget)throw kd.invalidProviderConfigError("Please provide rpcTarget inside chainConfig");this.defaultState={chainId:"loading"},this.defaultConfig={chainConfig:t.chainConfig,networks:{[t.chainConfig.chainId]:t.chainConfig}},super.initialize()}get currentChainConfig(){return this.config.chainConfig}get provider(){return this._providerEngineProxy}get chainId(){return this.state.chainId}set provider(e){throw new Error("Method not implemented.")}async request(e){var t;if(!e||"object"!=typeof e||Array.isArray(e))throw ff.invalidRequest({message:Id.invalidRequestArgs().message,data:i(i({},e||{}),{},{cause:Id.invalidRequestArgs().message})});const{method:r,params:n}=e;if("string"!=typeof r||0===r.length)throw ff.invalidRequest({message:Id.invalidRequestMethod().message,data:i(i({},e||{}),{},{cause:Id.invalidRequestMethod().message})});if(void 0!==n&&!Array.isArray(n)&&("object"!=typeof n||null===n))throw ff.invalidRequest({message:Id.invalidRequestParams().message,data:i(i({},e||{}),{},{cause:Id.invalidRequestParams().message})});return null===(t=this.provider)||void 0===t?void 0:t.request(e)}sendAsync(e,t){return t?this.send(e,t):this.request(e)}send(e,t){this.request(e).then((e=>t(null,{result:e}))).catch((e=>t(e,null)))}addChain(e){if(!e.chainId)throw ff.invalidParams("chainId is required");if(!e.rpcTarget)throw ff.invalidParams("chainId is required");this.configure({networks:i(i({},this.config.networks),{},{[e.chainId]:e})})}getChainConfig(e){var t;const r=null===(t=this.config.networks)||void 0===t?void 0:t[e];if(!r)throw ff.invalidRequest(`Chain ${e} is not supported, please add chainConfig for it`);return r}updateProviderEngineProxy(e){this._providerEngineProxy?this._providerEngineProxy.setTarget(e):this._providerEngineProxy=Ww(e)}getProviderEngineProxy(){return this._providerEngineProxy}};function aE(e){return(t,r,n,i)=>"chainId"===t.method?(r.result=e,i()):n()}function sE(e){return(t,r,n,i)=>"provider_config"===t.method?(r.result=e,i()):n()}var cE,uE;class lE extends oE{constructor(e){let{config:t,state:r}=e;super({config:t,state:r})}async setupProvider(){const{networkMiddleware:e}=function(e){const{chainId:t,rpcTarget:r}=e,n=rE({rpcTarget:r});return{networkMiddleware:Pf([aE(t),sE(e),n]),fetchMiddleware:n}}(this.config.chainConfig),t=new Sf;t.push(e);const r=If(t);this.updateProviderEngineProxy(r);const n=this.config.chainConfig.chainId;this.state.chainId!==n&&(this.emit("chainChanged",n),this.emit("connect",{chainId:n})),this.update({chainId:this.config.chainConfig.chainId})}async switchChain(e){if(!this._providerEngineProxy)throw df.custom({message:"Provider is not initialized",code:4902});const t=this.getChainConfig(e.chainId);this.update({chainId:"loading"}),this.configure({chainConfig:t}),await this.setupProvider()}updateProviderEngineProxy(e){this._providerEngineProxy?this._providerEngineProxy.setTarget(e):this._providerEngineProxy=Ww(e)}getProviderEngineProxy(){return this._providerEngineProxy}lookupNetwork(){throw new Error("Method not implemented.")}}cE=lE,r(lE,"getProviderInstance",(async e=>{const t=new cE({config:{chainConfig:e.chainConfig}});return await t.setupProvider(),t}));class fE extends oE{constructor(e){let{config:t,state:n}=e;super({config:{chainConfig:i(i({},t.chainConfig),{},{chainNamespace:Ed.OTHER})},state:n}),r(this,"_providerEngineProxy",null)}get provider(){return this._providerEngineProxy}set provider(e){throw new Error("Method not implemented.")}addChain(e){throw new Error("Method not implemented.")}async setupProvider(e){const t=this.getPrivKeyMiddleware(e),r=new Sf;r.push(t);const n=If(r);this.updateProviderEngineProxy(n)}updateProviderEngineProxy(e){this._providerEngineProxy?this._providerEngineProxy.setTarget(e):this._providerEngineProxy=Ww(e)}async switchChain(e){return Promise.resolve()}getProviderEngineProxy(){return this._providerEngineProxy}async lookupNetwork(){return Promise.resolve("")}getPrivKeyMiddleware(e){const t={getPrivatekey:async()=>e};return this.createPrivKeyMiddleware(t)}createPrivKeyMiddleware(e){let{getPrivatekey:t}=e;return _f({private_key:kf((async function(e,r){r.result=await t()}))})}}uE=fE,r(fE,"getProviderInstance",(async e=>{const t=new uE({config:{chainConfig:e.chainConfig}});return await t.setupProvider(e.privKey),t})),iE();const dE="Web3Auth-cachedAdapter";class hE extends Af{constructor(e){var t,n,o,a;if(super(),r(this,"coreOptions",void 0),r(this,"connectedAdapterName",null),r(this,"status",Nd.NOT_READY),r(this,"cachedAdapter",null),r(this,"walletAdapters",{}),r(this,"commonJRPCProvider",null),r(this,"plugins",{}),r(this,"storage","localStorage"),!e.clientId)throw kd.invalidParams("Please provide a valid clientId in constructor");if(e.enableLogging?Ld.enableAll():Ld.setLevel("error"),null===(t=e.chainConfig)||void 0===t||!t.chainNamespace||!Object.values(Ed).includes(null===(n=e.chainConfig)||void 0===n?void 0:n.chainNamespace))throw kd.invalidParams("Please provide a valid chainNamespace in chainConfig");"session"===e.storageKey&&(this.storage="sessionStorage"),this.cachedAdapter=jd(this.storage)?window[this.storage].getItem(dE):null,this.coreOptions=i(i({},e),{},{chainConfig:i(i({},xd(null===(o=e.chainConfig)||void 0===o?void 0:o.chainNamespace,null===(a=e.chainConfig)||void 0===a?void 0:a.chainId)||{}),e.chainConfig)}),this.subscribeToAdapterEvents=this.subscribeToAdapterEvents.bind(this)}get connected(){return Boolean(this.connectedAdapterName)}get provider(){return this.status!==Nd.NOT_READY&&this.commonJRPCProvider?this.commonJRPCProvider:null}set provider(e){throw new Error("Not implemented")}async init(){this.commonJRPCProvider=await lE.getProviderInstance({chainConfig:this.coreOptions.chainConfig});const e=Object.keys(this.walletAdapters).map((e=>{if(this.subscribeToAdapterEvents(this.walletAdapters[e]),this.walletAdapters[e].chainConfigProxy)this.walletAdapters[e].setAdapterSettings({sessionTime:this.coreOptions.sessionTime,clientId:this.coreOptions.clientId,web3AuthNetwork:this.coreOptions.web3AuthNetwork,useCoreKitKey:this.coreOptions.useCoreKitKey});else{const t=this.coreOptions.chainConfig;if(!t.chainNamespace)throw kd.invalidParams("Please provide chainNamespace in chainConfig");this.walletAdapters[e].setAdapterSettings({chainConfig:t,sessionTime:this.coreOptions.sessionTime,clientId:this.coreOptions.clientId,web3AuthNetwork:this.coreOptions.web3AuthNetwork,useCoreKitKey:this.coreOptions.useCoreKitKey})}return this.walletAdapters[e].init({autoConnect:this.cachedAdapter===e}).catch((e=>Ld.error(e)))}));this.status=Nd.READY,await Promise.all(e)}configureAdapter(e){this.checkInitRequirements();const t=this.coreOptions.chainConfig;if(!t.chainNamespace)throw kd.invalidParams("Please provide chainNamespace in chainConfig");if(this.walletAdapters[e.name])throw kd.duplicateAdapterError(`Wallet adapter for ${e.name} already exists`);if(e.adapterNamespace!==Ad&&e.adapterNamespace!==t.chainNamespace)throw kd.incompatibleChainNameSpace(`This wallet adapter belongs to ${e.adapterNamespace} which is incompatible with currently used namespace: ${t.chainNamespace}`);return e.adapterNamespace===Ad&&e.currentChainNamespace&&t.chainNamespace!==e.currentChainNamespace&&e.setAdapterSettings({chainConfig:t}),this.walletAdapters[e.name]=e,this}clearCache(){jd(this.storage)&&(window[this.storage].removeItem(dE),this.cachedAdapter=null)}async addChain(e){if(this.status===Nd.CONNECTED&&this.connectedAdapterName)return this.walletAdapters[this.connectedAdapterName].addChain(e);if(this.commonJRPCProvider)return this.commonJRPCProvider.addChain(e);throw kd.notReady("No wallet is ready")}async switchChain(e){if(this.status===Nd.CONNECTED&&this.connectedAdapterName)return this.walletAdapters[this.connectedAdapterName].switchChain(e);if(this.commonJRPCProvider)return this.commonJRPCProvider.switchChain(e);throw kd.notReady("No wallet is ready")}async connectTo(e,t){if(!this.walletAdapters[e]||!this.commonJRPCProvider)throw kd.notFound(`Please add wallet adapter for ${e} wallet, before connecting`);const r=await this.walletAdapters[e].connect(t);return this.commonJRPCProvider.updateProviderEngineProxy(r.provider||r),this.provider}async logout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{cleanup:!1};if(this.status!==Nd.CONNECTED||!this.connectedAdapterName)throw Sd.notConnectedError("No wallet is connected");await this.walletAdapters[this.connectedAdapterName].disconnect(e)}async getUserInfo(){if(Ld.debug("Getting user info",this.status,this.connectedAdapterName),this.status!==Nd.CONNECTED||!this.connectedAdapterName)throw Sd.notConnectedError("No wallet is connected");return this.walletAdapters[this.connectedAdapterName].getUserInfo()}async authenticateUser(){if(this.status!==Nd.CONNECTED||!this.connectedAdapterName)throw Sd.notConnectedError("No wallet is connected");return this.walletAdapters[this.connectedAdapterName].authenticateUser()}async addPlugin(e){if(this.plugins[e.name])throw new Error(`Plugin ${e.name} already exist`);if(e.pluginNamespace!==Dd.MULTICHAIN&&e.pluginNamespace!==this.coreOptions.chainConfig.chainNamespace)throw new Error(`This plugin belongs to ${e.pluginNamespace} namespace which is incompatible with currently used namespace: ${this.coreOptions.chainConfig.chainNamespace}`);return this.plugins[e.name]=e,this}subscribeToAdapterEvents(e){e.on(Rd.CONNECTED,(async e=>{if(!this.commonJRPCProvider)throw kd.notFound("CommonJrpcProvider not found");const{provider:t}=this.walletAdapters[e.adapter];this.commonJRPCProvider.updateProviderEngineProxy(t.provider||t),this.status=Nd.CONNECTED,this.connectedAdapterName=e.adapter,this.cacheWallet(e.adapter),Ld.debug("connected",this.status,this.connectedAdapterName),Object.values(this.plugins).map((async t=>{try{if(!t.SUPPORTED_ADAPTERS.includes(e.adapter))return;await t.initWithWeb3Auth(this),await t.connect()}catch(e){if(5211===e.code)return;Ld.error(e)}})),this.emit(Rd.CONNECTED,i({},e))})),e.on(Rd.DISCONNECTED,(async e=>{if(this.status=Nd.READY,jd(this.storage)){const e=window[this.storage].getItem(dE);this.connectedAdapterName===e&&this.clearCache()}Ld.debug("disconnected",this.status,this.connectedAdapterName),await Promise.all(Object.values(this.plugins).map((e=>e.disconnect().catch((e=>{5211!==e.code&&Ld.error(e)}))))),this.connectedAdapterName=null,this.emit(Rd.DISCONNECTED,e)})),e.on(Rd.CONNECTING,(e=>{this.status=Nd.CONNECTING,this.emit(Rd.CONNECTING,e),Ld.debug("connecting",this.status,this.connectedAdapterName)})),e.on(Rd.ERRORED,(e=>{this.status=Nd.ERRORED,this.clearCache(),this.emit(Rd.ERRORED,e),Ld.debug("errored",this.status,this.connectedAdapterName)})),e.on(Rd.ADAPTER_DATA_UPDATED,(e=>{Ld.debug("adapter data updated",e),this.emit(Rd.ADAPTER_DATA_UPDATED,e)})),e.on(Rd.CACHE_CLEAR,(e=>{Ld.debug("adapter cache clear",e),jd(this.storage)&&this.clearCache()}))}checkInitRequirements(){if(this.status===Nd.CONNECTING)throw kd.notReady("Already pending connection");if(this.status===Nd.CONNECTED)throw kd.notReady("Already connected");if(this.status===Nd.READY)throw kd.notReady("Adapter is already initialized")}cacheWallet(e){jd(this.storage)&&(window[this.storage].setItem(dE,e),this.cachedAdapter=e)}}const pE=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"kernel",type:"address"},{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnerChanged",type:"event"},{inputs:[{internalType:"bytes",name:"",type:"bytes"}],name:"disable",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"ecdsaValidatorStorage",outputs:[{internalType:"address",name:"owner",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"enable",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"_caller",type:"address"},{internalType:"bytes",name:"",type:"bytes"}],name:"validCaller",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"hash",type:"bytes32"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"validateSignature",outputs:[{internalType:"ValidationData",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"callGasLimit",type:"uint256"},{internalType:"uint256",name:"verificationGasLimit",type:"uint256"},{internalType:"uint256",name:"preVerificationGas",type:"uint256"},{internalType:"uint256",name:"maxFeePerGas",type:"uint256"},{internalType:"uint256",name:"maxPriorityFeePerGas",type:"uint256"},{internalType:"bytes",name:"paymasterAndData",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct UserOperation",name:"_userOp",type:"tuple"},{internalType:"bytes32",name:"_userOpHash",type:"bytes32"},{internalType:"uint256",name:"",type:"uint256"}],name:"validateUserOp",outputs:[{internalType:"ValidationData",name:"validationData",type:"uint256"}],stateMutability:"payable",type:"function"}],mE=[{inputs:[{internalType:"contract IEntryPoint",name:"_entryPoint",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AlreadyInitialized",type:"error"},{inputs:[],name:"DisabledMode",type:"error"},{inputs:[],name:"NotAuthorizedCaller",type:"error"},{inputs:[],name:"NotEntryPoint",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldValidator",type:"address"},{indexed:!0,internalType:"address",name:"newValidator",type:"address"}],name:"DefaultValidatorChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes4",name:"selector",type:"bytes4"},{indexed:!0,internalType:"address",name:"executor",type:"address"},{indexed:!0,internalType:"address",name:"validator",type:"address"}],name:"ExecutionChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Received",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newImplementation",type:"address"}],name:"Upgraded",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[{internalType:"bytes4",name:"_disableFlag",type:"bytes4"}],name:"disableMode",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"eip712Domain",outputs:[{internalType:"bytes1",name:"fields",type:"bytes1"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"version",type:"string"},{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"address",name:"verifyingContract",type:"address"},{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"uint256[]",name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"entryPoint",outputs:[{internalType:"contract IEntryPoint",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"},{internalType:"enum Operation",name:"",type:"uint8"}],name:"execute",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],internalType:"struct Call[]",name:"calls",type:"tuple[]"}],name:"executeBatch",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"getDefaultValidator",outputs:[{internalType:"contract IKernelValidator",name:"validator",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getDisabledMode",outputs:[{internalType:"bytes4",name:"disabled",type:"bytes4"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"_selector",type:"bytes4"}],name:"getExecution",outputs:[{components:[{internalType:"ValidAfter",name:"validAfter",type:"uint48"},{internalType:"ValidUntil",name:"validUntil",type:"uint48"},{internalType:"address",name:"executor",type:"address"},{internalType:"contract IKernelValidator",name:"validator",type:"address"}],internalType:"struct ExecutionDetail",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastDisabledTime",outputs:[{internalType:"uint48",name:"",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint192",name:"key",type:"uint192"}],name:"getNonce",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getNonce",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IKernelValidator",name:"_defaultValidator",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"initialize",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"hash",type:"bytes32"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"isValidSignature",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256[]",name:"",type:"uint256[]"},{internalType:"uint256[]",name:"",type:"uint256[]"},{internalType:"bytes",name:"",type:"bytes"}],name:"onERC1155BatchReceived",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],name:"onERC1155Received",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],name:"onERC721Received",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"contract IKernelValidator",name:"_defaultValidator",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"setDefaultValidator",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes4",name:"_selector",type:"bytes4"},{internalType:"address",name:"_executor",type:"address"},{internalType:"contract IKernelValidator",name:"_validator",type:"address"},{internalType:"ValidUntil",name:"_validUntil",type:"uint48"},{internalType:"ValidAfter",name:"_validAfter",type:"uint48"},{internalType:"bytes",name:"_enableData",type:"bytes"}],name:"setExecution",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"_newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"callGasLimit",type:"uint256"},{internalType:"uint256",name:"verificationGasLimit",type:"uint256"},{internalType:"uint256",name:"preVerificationGas",type:"uint256"},{internalType:"uint256",name:"maxFeePerGas",type:"uint256"},{internalType:"uint256",name:"maxPriorityFeePerGas",type:"uint256"},{internalType:"bytes",name:"paymasterAndData",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct UserOperation",name:"_userOp",type:"tuple"},{internalType:"bytes32",name:"userOpHash",type:"bytes32"},{internalType:"uint256",name:"missingAccountFunds",type:"uint256"}],name:"validateUserOp",outputs:[{internalType:"ValidationData",name:"validationData",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[],name:"version",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}],bE=[{inputs:[{internalType:"address",name:"_owner",type:"address"},{internalType:"contract IEntryPoint",name:"_entryPoint",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"DeploymentFailed",type:"error"},{inputs:[],name:"NewOwnerIsZeroAddress",type:"error"},{inputs:[],name:"NoHandoverRequest",type:"error"},{inputs:[],name:"SaltDoesNotStartWithCaller",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"proxy",type:"address"},{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Deployed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"pendingOwner",type:"address"}],name:"OwnershipHandoverCanceled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"pendingOwner",type:"address"}],name:"OwnershipHandoverRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[{internalType:"uint32",name:"unstakeDelaySec",type:"uint32"}],name:"addStake",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"cancelOwnershipHandover",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"pendingOwner",type:"address"}],name:"completeOwnershipHandover",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"_implementation",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"},{internalType:"uint256",name:"_index",type:"uint256"}],name:"createAccount",outputs:[{internalType:"address",name:"proxy",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[],name:"entryPoint",outputs:[{internalType:"contract IEntryPoint",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"},{internalType:"uint256",name:"_index",type:"uint256"}],name:"getAccountAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"initCodeHash",outputs:[{internalType:"bytes32",name:"result",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"isAllowedImplementation",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"pendingOwner",type:"address"}],name:"ownershipHandoverExpiresAt",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"ownershipHandoverValidFor",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"salt",type:"bytes32"}],name:"predictDeterministicAddress",outputs:[{internalType:"address",name:"predicted",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"requestOwnershipHandover",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"contract IEntryPoint",name:"_entryPoint",type:"address"}],name:"setEntryPoint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_implementation",type:"address"},{internalType:"bool",name:"_allow",type:"bool"}],name:"setImplementation",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"unlockStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address payable",name:"withdrawAddress",type:"address"}],name:"withdrawStake",outputs:[],stateMutability:"nonpayable",type:"function"}],gE=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"bytes",name:"transactions",type:"bytes"}],name:"multiSend",outputs:[],stateMutability:"payable",type:"function"}],yE=[{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"},{internalType:"uint8",name:"decimals_",type:"uint8"},{internalType:"uint256",name:"initialBalance_",type:"uint256"},{internalType:"address payable",name:"feeReceiver_",type:"address"}],stateMutability:"payable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}];function vE(e,t={}){const{fees:r=e.fees,formatters:n=e.formatters,serializers:i=e.serializers}=t;return{...e,fees:r,formatters:n,serializers:i}}const wE=vE({id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),EE=vE({id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Arbitrum Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:88114}},testnet:!0});let AE=class e extends Error{constructor(t,r={}){super(),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ViemError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"viem@1.21.3"});const n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,i=r.cause instanceof e&&r.cause.docsPath||r.docsPath;this.message=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...i?[`Docs: https://viem.sh${i}.html${r.docsSlug?`#${r.docsSlug}`:""}`]:[],...n?[`Details: ${n}`]:[],`Version: ${this.version}`].join("\n"),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.shortMessage=t}walk(e){return xE(this,e)}};function xE(e,t){return t?.(e)?e:e&&"object"==typeof e&&"cause"in e?xE(e.cause,t):t?null:e}let _E=class extends AE{constructor({max:e,min:t,signed:r,size:n,value:i}){super(`Number "${i}" is not in safe ${n?`${8*n}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntegerOutOfRangeError"})}},kE=class extends AE{constructor(e){super(`Hex value "${e}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidHexBooleanError"})}},SE=class extends AE{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeOverflowError"})}};function PE(e,{strict:t=!0}={}){return!!e&&("string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")))}function IE(e){return PE(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function TE(e,{dir:t="left"}={}){let r="string"==typeof e?e.replace("0x",""):e,n=0;for(let e=0;er)throw new ME({size:e.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;i2*r)throw new ME({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n["right"===t?"padEnd":"padStart"](2*r,"0")}`}const NE=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function RE(e,t={}){return"number"==typeof e||"bigint"==typeof e?jE(e,t):"string"==typeof e?DE(e,t):"boolean"==typeof e?FE(e,t):LE(e,t)}function FE(e,t={}){const r=`0x${Number(e)}`;return"number"==typeof t.size?(VE(r,{size:t.size}),CE(r,{size:t.size})):r}function LE(e,t={}){let r="";for(let t=0;to||i=HE.zero&&e<=HE.nine?e-HE.zero:e>=HE.A&&e<=HE.F?e-(HE.A-10):e>=HE.a&&e<=HE.f?e-(HE.a-10):void 0}function qE(e,t={}){let r=e;t.size&&(VE(r,{size:t.size}),r=CE(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,o=new Uint8Array(i);for(let e=0,t=0;et)throw new SE({givenSize:IE(e),maxSize:t})}function WE(e,t){const r={to:t},n=r.to;return"number"===n?YE(e,r):"bigint"===n?JE(e,r):"string"===n?XE(e,r):"boolean"===n?ZE(e,r):qE(e,r)}function JE(e,t={}){const{signed:r}=t;t.size&&VE(e,{size:t.size});const n=BigInt(e);if(!r)return n;const i=(e.length-2)/2;return n<=(1n<<8n*BigInt(i)-1n)-1n?n:n-BigInt(`0x${"f".padStart(2*i,"f")}`)-1n}function ZE(e,t={}){let r=e;if(t.size&&(VE(r,{size:t.size}),r=TE(r)),"0x00"===TE(r))return!1;if("0x01"===TE(r))return!0;throw new kE(r)}function YE(e,t={}){return Number(JE(e,t))}function XE(e,t={}){let r=qE(e);return t.size&&(VE(r,{size:t.size}),r=TE(r,{dir:"right"})),(new TextDecoder).decode(r)}const QE={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559"};function eA(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?YE(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?YE(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?QE[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if("bigint"==typeof t.v){if(0n===t.v||27n===t.v)return 0;if(1n===t.v||28n===t.v)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),"legacy"===t.type&&(delete t.accessList,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),"eip2930"===t.type&&(delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),t}function tA(e){const t=e.transactions?.map((e=>"string"==typeof e?e:eA(e)));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,difficulty:e.difficulty?BigInt(e.difficulty):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}function rA(e,{args:t,eventName:r}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...r?{args:t,eventName:r}:{}}}const nA={"0x0":"reverted","0x1":"success"};function iA(e){return{...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map((e=>rA(e))):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?YE(e.transactionIndex):null,status:e.status?nA[e.status]:null,type:e.type?QE[e.type]||e.type:null}}const oA={legacy:"0x0",eip2930:"0x1",eip1559:"0x2"};function aA(e){return{...e,gas:void 0!==e.gas?jE(e.gas):void 0,gasPrice:void 0!==e.gasPrice?jE(e.gasPrice):void 0,maxFeePerGas:void 0!==e.maxFeePerGas?jE(e.maxFeePerGas):void 0,maxPriorityFeePerGas:void 0!==e.maxPriorityFeePerGas?jE(e.maxPriorityFeePerGas):void 0,nonce:void 0!==e.nonce?jE(e.nonce):void 0,type:void 0!==e.type?oA[e.type]:void 0,value:void 0!==e.value?jE(e.value):void 0}}let sA=class extends AE{constructor({address:e}){super(`Address "${e}" is invalid.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAddressError"})}},cA=class extends AE{constructor({blockNumber:e,chain:t,contract:r}){super(`Chain "${t.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...e&&r.blockCreated&&r.blockCreated>e?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${r.name}" configured.`]]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDoesNotSupportContract"})}};class uA extends AE{constructor({chain:e,currentChainId:t}){super(`The current chain of the wallet (id: ${t}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${t}`,`Expected Chain ID: ${e.id} – ${e.name}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainMismatchError"})}}class lA extends AE{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotFoundError"})}}let fA=class extends AE{constructor(){super("No chain was provided to the Client."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ClientChainNotConfiguredError"})}};const dA={gwei:9,wei:18},hA={ether:-9,wei:9};function pA(e,t){let r=e.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(t,"0");let[i,o]=[r.slice(0,r.length-t),r.slice(r.length-t)];return o=o.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${o?`.${o}`:""}`}function mA(e,t="wei"){return pA(e,hA[t])}let bA=class extends AE{constructor({cause:e,message:t}={}){const r=t?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ExecutionRevertedError"})}};Object.defineProperty(bA,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(bA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});let gA=class extends AE{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${mA(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooHigh"})}};Object.defineProperty(gA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});let yA=class extends AE{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${mA(t)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooLow"})}};Object.defineProperty(yA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});let vA=class extends AE{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is higher than the next one expected.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooHighError"})}};Object.defineProperty(vA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});let wA=class extends AE{constructor({cause:e,nonce:t}={}){super([`Nonce provided for the transaction ${t?`(${t}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join("\n"),{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooLowError"})}};Object.defineProperty(wA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});let EA=class extends AE{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}exceeds the maximum allowed nonce.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceMaxValueError"})}};Object.defineProperty(EA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});let AA=class extends AE{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join("\n"),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InsufficientFundsError"})}};Object.defineProperty(AA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds/});let xA=class extends AE{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooHighError"})}};Object.defineProperty(xA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});let _A=class extends AE{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction is too low.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooLowError"})}};Object.defineProperty(_A,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});let kA=class extends AE{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionTypeNotSupportedError"})}};Object.defineProperty(kA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});let SA=class extends AE{constructor({cause:e,maxPriorityFeePerGas:t,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${mA(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${mA(r)} gwei`:""}).`].join("\n"),{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TipAboveFeeCapError"})}};Object.defineProperty(SA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});let PA=class extends AE{constructor({cause:e}){super(`An error occurred while executing: ${e?.shortMessage}`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownNodeError"})}};const IA=/^0x[a-fA-F0-9]{40}$/;function TA(e){return IA.test(e)}function OA(e){return"string"==typeof e[0]?MA(e):function(e){let t=0;for(const r of e)t+=r.length;const r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}(e)}function MA(e){return`0x${e.reduce(((e,t)=>e+t.replace("0x","")),"")}`}let CA=class e extends Error{constructor(t,r={}){const n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,i=r.cause instanceof e&&r.cause.docsPath||r.docsPath;super([t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...i?[`Docs: https://abitype.dev${i}`]:[],...n?[`Details: ${n}`]:[],"Version: abitype@0.9.8"].join("\n")),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.shortMessage=t}};function BA(e,t){const r=e.exec(t);return r?.groups}const NA=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,RA=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,FA=/^\(.+?\).*?$/,LA=/^tuple(?(\[(\d*)\])*)$/;function jA(e){let t=e.type;if(LA.test(e.type)&&"components"in e){t="(";const r=e.components.length;for(let n=0;n0?"opening":"closing"} parentheses.`],details:`Depth "${t}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}};const JA=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]),ZA=/^(?[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,YA=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,XA=/^u?int$/;function QA(e,t){const r=function(e,t){return t?`${t}:${e}`:e}(e,t?.type);if(JA.has(r))return JA.get(r);const n=FA.test(e),i=BA(n?YA:ZA,e);if(!i)throw new GA({param:e});if(i.name&&function(e){return"address"===e||"bool"===e||"function"===e||"string"===e||"tuple"===e||NA.test(e)||RA.test(e)||tx.test(e)}(i.name))throw new qA({param:e,name:i.name});const o=i.name?{name:i.name}:{},a="indexed"===i.modifier?{indexed:!0}:{},s=t?.structs??{};let c,u={};if(n){c="tuple";const e=ex(i.type),t=[],r=e.length;for(let n=0;ne[t.name||r]?.(n)??t(e,n)}function ix(e,{includeName:t=!1}={}){if("function"!==e.type&&"event"!==e.type&&"error"!==e.type)throw new Sx(e.type);return`${e.name}(${ox(e.inputs,{includeName:t})})`}function ox(e,{includeName:t=!1}={}){return e?e.map((e=>function(e,{includeName:t}){if(e.type.startsWith("tuple"))return`(${ox(e.components,{includeName:t})})${e.type.slice(5)}`;return e.type+(t&&e.name?` ${e.name}`:"")}(e,{includeName:t}))).join(t?", ":","):""}let ax=class extends AE{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join("\n"),{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorNotFoundError"})}},sx=class extends AE{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join("\n"),{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorParamsNotFoundError"})}},cx=class extends AE{constructor({data:e,params:t,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join("\n"),{metaMessages:[`Params: (${ox(t,{includeName:!0})})`,`Data: ${e} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=t,this.size=r}},ux=class extends AE{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingZeroDataError"})}},lx=class extends AE{constructor({expectedLength:e,givenLength:t,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${e}`,`Given length: ${t}`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingArrayLengthMismatchError"})}},fx=class extends AE{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${IE(t)}) does not match expected size (bytes${e}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingBytesSizeMismatchError"})}},dx=class extends AE{constructor({expectedLength:e,givenLength:t}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${t}`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingLengthMismatchError"})}},hx=class extends AE{constructor(e,{docsPath:t}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}},px=class extends AE{constructor({docsPath:e}){super("Cannot extract event signature from empty topics.",{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureEmptyTopicsError"})}},mx=class extends AE{constructor(e,{docsPath:t}){super([`Encoded event signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureNotFoundError"})}},bx=class extends AE{constructor(e,{docsPath:t}={}){super([`Event ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventNotFoundError"})}},gx=class extends AE{constructor(e,{docsPath:t}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionNotFoundError"})}},yx=class extends AE{constructor(e,{docsPath:t}){super([`Function "${e}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionOutputsNotFoundError"})}},vx=class extends AE{constructor(e,t){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${ix(e.abiItem)}\`, and`,`\`${t.type}\` in \`${ix(t.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItemAmbiguityError"})}},wx=class extends AE{constructor({expectedSize:e,givenSize:t}){super(`Expected bytes${e}, got bytes${t}.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BytesSizeMismatchError"})}},Ex=class extends AE{constructor({abiItem:e,data:t,params:r,size:n}){super([`Data size of ${n} bytes is too small for non-indexed event parameters.`].join("\n"),{metaMessages:[`Params: (${ox(r,{includeName:!0})})`,`Data: ${t} (${n} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e,this.data=t,this.params=r,this.size=n}},Ax=class extends AE{constructor({abiItem:e,param:t}){super([`Expected a topic for indexed event parameter${t.name?` "${t.name}"`:""} on event "${ix(e,{includeName:!0})}".`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e}},xx=class extends AE{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiEncodingType"})}},_x=class extends AE{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiDecodingType"})}},kx=class extends AE{constructor(e){super([`Value "${e}" is not a valid array.`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidArrayError"})}},Sx=class extends AE{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidDefinitionTypeError"})}},Px=class extends AE{constructor(e){super(`Filter type "${e}" is not supported.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FilterTypeNotSupportedError"})}};const Ix=e=>{var t;return function(e){let t=!0,r="",n=0,i="",o=!1;for(let a=0;a0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function Mx(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}const Cx=BigInt(2**32-1),Bx=BigInt(32);function Nx(e,t=!1){return t?{h:Number(e&Cx),l:Number(e>>Bx&Cx)}:{h:0|Number(e>>Bx&Cx),l:0|Number(e&Cx)}}function Rx(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;ie instanceof Uint8Array;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function Lx(e){if("string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),!Fx(e))throw new Error("expected Uint8Array, got "+typeof e);return e}let jx=class{clone(){return this._cloneInto()}};const[Ux,Dx,zx]=[[],[],[]],$x=BigInt(0),Hx=BigInt(1),Gx=BigInt(2),qx=BigInt(7),Kx=BigInt(256),Vx=BigInt(113);for(let e=0,t=Hx,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],Ux.push(2*(5*n+r)),Dx.push((e+1)*(e+2)/2%64);let i=$x;for(let e=0;e<7;e++)t=(t<>qx)*Vx)%Kx,t&Gx&&(i^=Hx<<(Hx<r>32?((e,t,r)=>t<>>64-r)(e,t,r):((e,t,r)=>e<>>32-r)(e,t,r),Yx=(e,t,r)=>r>32?((e,t,r)=>e<>>64-r) /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */(e,t,r):((e,t,r)=>t<>>32-r)(e,t,r);let Xx=class e extends jx{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Tx(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)))(this.state)}keccak(){!function(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,o=r[i],a=r[i+1],s=Zx(o,a,1)^r[n],c=Yx(o,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=s,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=Dx[r],o=Zx(t,i,n),a=Yx(t,i,n),s=Ux[r];t=e[s],i=e[s+1],e[s]=o,e[s+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=Wx[n],e[1]^=Jx[n]}r.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Mx(this);const{blockLen:t,state:r}=this,n=(e=Lx(e)).length;for(let i=0;i=r&&this.keccak();const o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Tx(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(function(e,t){Ox(e);const r=t.outputLen;if(e.lengthfunction(e){const t=t=>e().update(Lx(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}((()=>new Xx(t,e,r))),e_=Qx(1,136,32);function t_(e,t){const r=t||"hex",n=e_(PE(e,{strict:!1})?$E(e):e);return"bytes"===r?n:RE(n)}const r_=e=>(e=>t_($E(e)))((e=>Ix(e))(e));function n_(e,t,r,{strict:n}={}){return PE(e,{strict:!1})?function(e,t,r,{strict:n}={}){i_(e,t);const i=`0x${e.replace("0x","").slice(2*(t??0),2*(r??e.length))}`;n&&o_(i,t,r);return i}(e,t,r,{strict:n}):function(e,t,r,{strict:n}={}){i_(e,t);const i=e.slice(t,r);n&&o_(i,t,r);return i}(e,t,r,{strict:n})}function i_(e,t){if("number"==typeof t&&t>0&&t>IE(e)-1)throw new OE({offset:t,position:"start",size:IE(e)})}function o_(e,t,r){if("number"==typeof t&&"number"==typeof r&&IE(e)!==r-t)throw new OE({offset:r,position:"end",size:IE(e)})}function a_(e,t){if(e.length!==t.length)throw new dx({expectedLength:e.length,givenLength:t.length});const r=function({params:e,values:t}){const r=[];for(let n=0;n0?OA([t,e]):t}}if(i)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:OA(o.map((({encoded:e})=>e)))}}(t,{length:n,param:{...e,type:i}})}if("tuple"===e.type)return function(e,{param:t}){let r=!1;const n=[];for(let i=0;ie)))}}(t,{param:e});if("address"===e.type)return function(e){if(!TA(e))throw new sA({address:e});return{dynamic:!1,encoded:BE(e.toLowerCase())}}(t);if("bool"===e.type)return function(e){return{dynamic:!1,encoded:BE(FE(e))}}(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){return function(e,{signed:t}){return{dynamic:!1,encoded:jE(e,{size:32,signed:t})}}(t,{signed:e.type.startsWith("int")})}if(e.type.startsWith("bytes"))return function(e,{param:t}){const[,r]=t.type.split("bytes"),n=IE(e);if(!r){let t=e;return n%32!=0&&(t=BE(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:OA([BE(jE(n,{size:32})),t])}}if(n!==parseInt(r))throw new fx({expectedSize:parseInt(r),value:e});return{dynamic:!1,encoded:BE(e,{dir:"right"})}}(t,{param:e});if("string"===e.type)return function(e){const t=DE(e),r=Math.ceil(IE(t)/32),n=[];for(let e=0;en_((e=>t_($E(e)))(Ix(e)),0,4);function f_({abi:e,args:t=[],name:r}){const n=PE(r,{strict:!1}),i=e.filter((e=>n?"function"===e.type?l_(e)===r:"event"===e.type&&r_(e)===r:"name"in e&&e.name===r));if(0===i.length)return;if(1===i.length)return i[0];let o;for(const e of i){if(!("inputs"in e))continue;if(!t||0===t.length){if(!e.inputs||0===e.inputs.length)return e;continue}if(!e.inputs)continue;if(0===e.inputs.length)continue;if(e.inputs.length!==t.length)continue;const r=t.every(((t,r)=>{const n="inputs"in e&&e.inputs[r];return!!n&&d_(t,n)}));if(r){if(o&&"inputs"in o&&o.inputs){const r=h_(e.inputs,o.inputs,t);if(r)throw new vx({abiItem:e,type:r[0]},{abiItem:o,type:r[1]})}o=e}}return o||i[0]}function d_(e,t){const r=typeof e,n=t.type;switch(n){case"address":return TA(e);case"bool":return"boolean"===r;case"function":case"string":return"string"===r;default:return"tuple"===n&&"components"in t?Object.values(t.components).every(((t,r)=>d_(Object.values(e)[r],t))):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?"number"===r||"bigint"===r:/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?"string"===r||e instanceof Uint8Array:!!/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)&&(Array.isArray(e)&&e.every((e=>d_(e,{...t,type:n.replace(/(\[[0-9]{0,}\])$/,"")}))))}}function h_(e,t,r){for(const n in e){const i=e[n],o=t[n];if("tuple"===i.type&&"tuple"===o.type&&"components"in i&&"components"in o)return h_(i.components,o.components,r[n]);const a=[i.type,o.type];if(!(!a.includes("address")||!a.includes("bytes20"))||(a.includes("address")&&a.includes("string")||!(!a.includes("address")||!a.includes("bytes")))&&TA(r[n]))return a}}function p_({abi:e,eventName:t,args:r}){let n=e[0];if(t&&(n=f_({abi:e,args:r,name:t}),!n))throw new bx(t,{docsPath:"/docs/contract/encodeEventTopics"});if("event"!==n.type)throw new bx(void 0,{docsPath:"/docs/contract/encodeEventTopics"});const i=ix(n),o=r_(i);let a=[];if(r&&"inputs"in n){const e=n.inputs?.filter((e=>"indexed"in e&&e.indexed)),t=Array.isArray(r)?r:Object.values(r).length>0?e?.map((e=>r[e.name]))??[]:[];t.length>0&&(a=e?.map(((e,r)=>Array.isArray(t[r])?t[r].map(((n,i)=>m_({param:e,value:t[r][i]}))):t[r]?m_({param:e,value:t[r]}):null))??[])}return[o,...a]}function m_({param:e,value:t}){if("string"===e.type||"bytes"===e.type)return t_($E(t));if("tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/))throw new Px(e.type);return a_([e],[t])}function b_(e,{method:t}){const r={};return"fallback"===e.transport.type&&e.transport.onResponse?.((({method:e,response:n,status:i,transport:o})=>{"success"===i&&t===e&&(r[n]=o.request)})),t=>r[t]||e.request}async function g_(e,{address:t,abi:r,args:n,eventName:i,fromBlock:o,strict:a,toBlock:s}){const c=b_(e,{method:"eth_newFilter"}),u=i?p_({abi:r,args:n,eventName:i}):void 0,l=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:"bigint"==typeof o?jE(o):o,toBlock:"bigint"==typeof s?jE(s):s,topics:u}]});return{abi:r,args:n,eventName:i,id:l,request:c(l),strict:a,type:"event"}}function y_(e){return"string"==typeof e?{address:e,type:"json-rpc"}:e}function v_({abi:e,args:t,functionName:r}){let n=e[0];if(r&&(n=f_({abi:e,args:t,name:r}),!n))throw new gx(r,{docsPath:"/docs/contract/encodeFunctionData"});if("function"!==n.type)throw new gx(void 0,{docsPath:"/docs/contract/encodeFunctionData"});const i=ix(n);return MA([l_(i),("inputs"in n&&n.inputs?a_(n.inputs,t??[]):void 0)??"0x"])}const w_={1:"An `assert` condition failed.",17:"Arithmic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},E_={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},A_={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function x_(e,t){const r=e.substring(2).toLowerCase(),n=t_(KE(r),"bytes"),i=r.split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(15&n[e>>1])>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());return`0x${i.join("")}`}function __(e,t){if("0x"===t&&e.length>0)throw new ux;if(IE(t)&&IE(t)<32)throw new cx({data:t,params:e,size:IE(t)});return function({data:e,params:t}){const r=[];let n=0;for(let i=0;i=IE(e))throw new cx({data:e,params:t,size:IE(e)});const o=t[i],{consumed:a,value:s}=k_({data:e,param:o,position:n});r.push(s),n+=a}return r}({data:t,params:e})}function k_({data:e,param:t,position:r}){const n=u_(t.type);if(n){const[i,o]=n;return function(e,{param:t,length:r,position:n}){if(!r){const r=YE(n_(e,n,n+32,{strict:!0})),i=YE(n_(e,r,r+32,{strict:!0}));let o=0;const a=[];for(let n=0;n!e)),i=n?[]:{};let o=0;if(S_(t)){const a=YE(n_(e,r,r+32,{strict:!0}));for(let r=0;r48?JE(e,{signed:r}):YE(e,{signed:r})}}(i,{param:t});if("address"===t.type)return function(e){return{consumed:32,value:x_(n_(e,-20))}}(i);if("bool"===t.type)return function(e){return{consumed:32,value:ZE(e)}}(i);throw new _x(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}function S_(e){const{type:t}=e;if("string"===t)return!0;if("bytes"===t)return!0;if(t.endsWith("[]"))return!0;if("tuple"===t)return e.components?.some(S_);const r=u_(e.type);return!(!r||!S_({...e,type:r[1]}))}function P_({abi:e,data:t}){const r=n_(t,0,4);if("0x"===r)throw new ux;const n=[...e||[],E_,A_].find((e=>"error"===e.type&&r===l_(ix(e))));if(!n)throw new hx(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:n,args:"inputs"in n&&n.inputs&&n.inputs.length>0?__(n.inputs,n_(t,4)):void 0,errorName:n.name}}const I_=(e,t,r)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),r);function T_({abiItem:e,args:t,includeFunctionName:r=!0,includeName:n=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${r?e.name:""}(${e.inputs.map(((e,r)=>`${n&&e.name?`${e.name}: `:""}${"object"==typeof t[r]?I_(t[r]):t[r]}`)).join(", ")})`}function O_(e,t="wei"){return pA(e,dA[t])}function M_(e){const t=Object.entries(e).map((([e,t])=>void 0===t||!1===t?null:[e,t])).filter(Boolean),r=t.reduce(((e,[t])=>Math.max(e,t.length)),0);return t.map((([e,t])=>` ${`${e}:`.padEnd(r+1)} ${t}`)).join("\n")}let C_=class extends AE{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeConflictError"})}},B_=class extends AE{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",M_(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- a Legacy Transaction with `gasPrice`"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSerializableTransactionError"})}};class N_ extends AE{constructor(e,{account:t,docsPath:r,chain:n,data:i,gas:o,gasPrice:a,maxFeePerGas:s,maxPriorityFeePerGas:c,nonce:u,to:l,value:f}){const d=M_({chain:n&&`${n?.name} (id: ${n?.id})`,from:t?.address,to:l,value:void 0!==f&&`${O_(f)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:o,gasPrice:void 0!==a&&`${mA(a)} gwei`,maxFeePerGas:void 0!==s&&`${mA(s)} gwei`,maxPriorityFeePerGas:void 0!==c&&`${mA(c)} gwei`,nonce:u});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",d].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionExecutionError"}),this.cause=e}}let R_=class extends AE{constructor({blockHash:e,blockNumber:t,blockTag:r,hash:n,index:i}){let o="Transaction";r&&void 0!==i&&(o=`Transaction at block time "${r}" at index "${i}"`),e&&void 0!==i&&(o=`Transaction at block hash "${e}" at index "${i}"`),t&&void 0!==i&&(o=`Transaction at block number "${t}" at index "${i}"`),n&&(o=`Transaction with hash "${n}"`),super(`${o} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionNotFoundError"})}},F_=class extends AE{constructor({hash:e}){super(`Transaction receipt with hash "${e}" could not be found. The Transaction may not be processed on a block yet.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionReceiptNotFoundError"})}},L_=class extends AE{constructor({hash:e}){super(`Timed out while waiting for transaction with hash "${e}" to be confirmed.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WaitForTransactionReceiptTimeoutError"})}},j_=class extends AE{constructor(e,{account:t,docsPath:r,chain:n,data:i,gas:o,gasPrice:a,maxFeePerGas:s,maxPriorityFeePerGas:c,nonce:u,to:l,value:f}){const d=t?y_(t):void 0,h=M_({from:d?.address,to:l,value:void 0!==f&&`${O_(f)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:o,gasPrice:void 0!==a&&`${mA(a)} gwei`,maxFeePerGas:void 0!==s&&`${mA(s)} gwei`,maxPriorityFeePerGas:void 0!==c&&`${mA(c)} gwei`,nonce:u});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Raw Call Arguments:",h].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CallExecutionError"}),this.cause=e}},U_=class extends AE{constructor(e,{abi:t,args:r,contractAddress:n,docsPath:i,functionName:o,sender:a}){const s=f_({abi:t,args:r,name:o}),c=s?T_({abiItem:s,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=M_({address:n&&n,function:s?ix(s,{includeName:!0}):void 0,args:c&&"()"!==c&&`${[...Array(o?.length??0).keys()].map((()=>" ")).join("")}${c}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:i,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Contract Call:",u].filter(Boolean)}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionExecutionError"}),this.abi=t,this.args=r,this.cause=e,this.contractAddress=n,this.functionName=o,this.sender=a}},D_=class extends AE{constructor({abi:e,data:t,functionName:r,message:n}){let i,o,a,s,c;if(t&&"0x"!==t)try{o=P_({abi:e,data:t});const{abiItem:r,errorName:n,args:i}=o;if("Error"===n)s=i[0];else if("Panic"===n){const[e]=i;s=w_[e]}else{const e=r?ix(r,{includeName:!0}):void 0,t=r&&i?T_({abiItem:r,args:i,includeFunctionName:!1,includeName:!1}):void 0;a=[e?`Error: ${e}`:"",t&&"()"!==t?` ${[...Array(n?.length??0).keys()].map((()=>" ")).join("")}${t}`:""]}}catch(e){i=e}else n&&(s=n);i instanceof hx&&(c=i.signature,a=[`Unable to decode signature "${c}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${c}.`]),super(s&&"execution reverted"!==s||c?[`The contract function "${r}" reverted with the following ${c?"signature":"reason"}:`,s||c].join("\n"):`The contract function "${r}" reverted.`,{cause:i,metaMessages:a}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.reason=s,this.signature=c}},z_=class extends AE{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionZeroDataError"})}},$_=class extends AE{constructor({data:e,message:t}){super(t||""),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RawContractError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}},H_=class extends AE{constructor({body:e,details:t,headers:r,status:n,url:i}){super("HTTP request failed.",{details:t,metaMessages:[n&&`Status: ${n}`,`URL: ${i}`,e&&`Request body: ${I_(e)}`].filter(Boolean)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=r,this.status=n,this.url=i}},G_=class extends AE{constructor({body:e,details:t,url:r}){super("WebSocket request failed.",{details:t,metaMessages:[`URL: ${r}`,`Request body: ${I_(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WebSocketRequestError"})}},q_=class extends AE{constructor({body:e,error:t,url:r}){super("RPC Request failed.",{cause:t,details:t.message,metaMessages:[`URL: ${r}`,`Request body: ${I_(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code}},K_=class extends AE{constructor({body:e,url:t}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${t}`,`Request body: ${I_(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TimeoutError"})}};let V_=class extends AE{constructor(e,{code:t,docsPath:r,metaMessages:n,shortMessage:i}){super(i,{cause:e,docsPath:r,metaMessages:n||e?.metaMessages}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.code=e instanceof q_?e.code:t??-1}},W_=class extends V_{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderRpcError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t.data}},J_=class e extends V_{constructor(t){super(t,{code:e.code,shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ParseRpcError"})}};Object.defineProperty(J_,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});let Z_=class e extends V_{constructor(t){super(t,{code:e.code,shortMessage:"JSON is not a valid request object."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidRequestRpcError"})}};Object.defineProperty(Z_,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});let Y_=class e extends V_{constructor(t){super(t,{code:e.code,shortMessage:"The method does not exist / is not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotFoundRpcError"})}};Object.defineProperty(Y_,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});let X_=class e extends V_{constructor(t){super(t,{code:e.code,shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join("\n")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParamsRpcError"})}};Object.defineProperty(X_,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});let Q_=class e extends V_{constructor(t){super(t,{code:e.code,shortMessage:"An internal error was received."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InternalRpcError"})}};Object.defineProperty(Q_,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});let ek=class e extends V_{constructor(t){super(t,{code:e.code,shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join("\n")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidInputRpcError"})}};Object.defineProperty(ek,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});let tk=class e extends V_{constructor(t){super(t,{code:e.code,shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}};Object.defineProperty(tk,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});let rk=class e extends V_{constructor(t){super(t,{code:e.code,shortMessage:"Requested resource not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceUnavailableRpcError"})}};Object.defineProperty(rk,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});let nk=class e extends V_{constructor(t){super(t,{code:e.code,shortMessage:"Transaction creation failed."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionRejectedRpcError"})}};Object.defineProperty(nk,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});let ik=class e extends V_{constructor(t){super(t,{code:e.code,shortMessage:"Method is not implemented."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotSupportedRpcError"})}};Object.defineProperty(ik,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});let ok=class e extends V_{constructor(t){super(t,{code:e.code,shortMessage:"Request exceeds defined limit."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"LimitExceededRpcError"})}};Object.defineProperty(ok,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});let ak=class e extends V_{constructor(t){super(t,{code:e.code,shortMessage:"Version of JSON-RPC protocol is not supported."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"JsonRpcVersionUnsupportedError"})}};Object.defineProperty(ak,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});let sk=class e extends W_{constructor(t){super(t,{code:e.code,shortMessage:"User rejected the request."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UserRejectedRequestError"})}};Object.defineProperty(sk,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});let ck=class e extends W_{constructor(t){super(t,{code:e.code,shortMessage:"The requested method and/or account has not been authorized by the user."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnauthorizedProviderError"})}};Object.defineProperty(ck,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});let uk=class e extends W_{constructor(t){super(t,{code:e.code,shortMessage:"The Provider does not support the requested method."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedProviderMethodError"})}};Object.defineProperty(uk,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});let lk=class e extends W_{constructor(t){super(t,{code:e.code,shortMessage:"The Provider is disconnected from all chains."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderDisconnectedError"})}};Object.defineProperty(lk,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});let fk=class e extends W_{constructor(t){super(t,{code:e.code,shortMessage:"The Provider is not connected to the requested chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDisconnectedError"})}};Object.defineProperty(fk,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});let dk=class e extends W_{constructor(t){super(t,{code:e.code,shortMessage:"An error occurred when attempting to switch chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainError"})}};Object.defineProperty(dk,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});let hk=class extends V_{constructor(e){super(e,{shortMessage:"An unknown RPC error occurred."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownRpcError"})}};const pk=3;function mk(e,{abi:t,address:r,args:n,docsPath:i,functionName:o,sender:a}){const{code:s,data:c,message:u,shortMessage:l}=e instanceof $_?e:e instanceof AE?e.walk((e=>"data"in e))||e.walk():{},f=e instanceof ux?new z_({functionName:o}):[pk,Q_.code].includes(s)&&(c||u||l)?new D_({abi:t,data:"object"==typeof c?c.data:c,functionName:o,message:l??u}):e;return new U_(f,{abi:t,args:n,contractAddress:r,docsPath:i,functionName:o,sender:a})}let bk=class extends AE{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the WalletClient."].join("\n"),{docsPath:e,docsSlug:"account"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountNotFoundError"})}},gk=class extends AE{constructor(e,{account:t,docsPath:r,chain:n,data:i,gas:o,gasPrice:a,maxFeePerGas:s,maxPriorityFeePerGas:c,nonce:u,to:l,value:f}){const d=M_({from:t?.address,to:l,value:void 0!==f&&`${O_(f)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:o,gasPrice:void 0!==a&&`${mA(a)} gwei`,maxFeePerGas:void 0!==s&&`${mA(s)} gwei`,maxPriorityFeePerGas:void 0!==c&&`${mA(c)} gwei`,nonce:u});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",d].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EstimateGasExecutionError"}),this.cause=e}};function yk(e,t){const r=(e.details||"").toLowerCase(),n=e.walk((e=>e.code===bA.code));return n instanceof AE?new bA({cause:e,message:n.details}):bA.nodeMessage.test(r)?new bA({cause:e,message:e.details}):gA.nodeMessage.test(r)?new gA({cause:e,maxFeePerGas:t?.maxFeePerGas}):yA.nodeMessage.test(r)?new yA({cause:e,maxFeePerGas:t?.maxFeePerGas}):vA.nodeMessage.test(r)?new vA({cause:e,nonce:t?.nonce}):wA.nodeMessage.test(r)?new wA({cause:e,nonce:t?.nonce}):EA.nodeMessage.test(r)?new EA({cause:e,nonce:t?.nonce}):AA.nodeMessage.test(r)?new AA({cause:e}):xA.nodeMessage.test(r)?new xA({cause:e,gas:t?.gas}):_A.nodeMessage.test(r)?new _A({cause:e,gas:t?.gas}):kA.nodeMessage.test(r)?new kA({cause:e}):SA.nodeMessage.test(r)?new SA({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new PA({cause:e})}function vk(e,{format:t}){if(!t)return{};const r={};return function t(n){const i=Object.keys(n);for(const o of i)o in e&&(r[o]=e[o]),n[o]&&"object"==typeof n[o]&&!Array.isArray(n[o])&&t(n[o])}(t(e||{})),r}function wk(e){const{account:t,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:o}=e,a=t?y_(t):void 0;if(a&&!TA(a.address))throw new sA({address:a.address});if(o&&!TA(o))throw new sA({address:o});if(void 0!==r&&(void 0!==n||void 0!==i))throw new C_;if(n&&n>2n**256n-1n)throw new gA({maxFeePerGas:n});if(i&&n&&i>n)throw new SA({maxFeePerGas:n,maxPriorityFeePerGas:i})}let Ek=class extends AE{constructor(){super("`baseFeeMultiplier` must be greater than 1."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseFeeScalarError"})}},Ak=class extends AE{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}},xk=class extends AE{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${mA(e)} gwei).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MaxFeePerGasTooLowError"})}},_k=class extends AE{constructor({blockHash:e,blockNumber:t}){let r="Block";e&&(r=`Block at hash "${e}"`),t&&(r=`Block at number "${t}"`),super(`${r} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlockNotFoundError"})}};async function kk(e,{blockHash:t,blockNumber:r,blockTag:n,includeTransactions:i}={}){const o=n??"latest",a=i??!1,s=void 0!==r?jE(r):void 0;let c=null;if(c=t?await e.request({method:"eth_getBlockByHash",params:[t,a]}):await e.request({method:"eth_getBlockByNumber",params:[s||o,a]}),!c)throw new _k({blockHash:t,blockNumber:r});return(e.chain?.formatters?.block?.format||tA)(c)}async function Sk(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function Pk(e,t){const{block:r,chain:n=e.chain,request:i}=t||{};if("function"==typeof n?.fees?.defaultPriorityFee){const t=r||await nx(e,kk,"getBlock")({});return n.fees.defaultPriorityFee({block:t,client:e,request:i})}if(void 0!==n?.fees?.defaultPriorityFee)return n?.fees?.defaultPriorityFee;try{return JE(await e.request({method:"eth_maxPriorityFeePerGas"}))}catch{const[t,n]=await Promise.all([r?Promise.resolve(r):nx(e,kk,"getBlock")({}),nx(e,Sk,"getGasPrice")({})]);if("bigint"!=typeof t.baseFeePerGas)throw new Ak;const i=n-t.baseFeePerGas;return i<0n?0n:i}}async function Ik(e,t){const{block:r,chain:n=e.chain,request:i,type:o="eip1559"}=t||{},a=await(async()=>"function"==typeof n?.fees?.baseFeeMultiplier?n.fees.baseFeeMultiplier({block:r,client:e,request:i}):n?.fees?.baseFeeMultiplier??1.2)();if(a<1)throw new Ek;const s=10**(a.toString().split(".")[1]?.length??0),c=e=>e*BigInt(Math.ceil(a*s))/BigInt(s),u=r||await nx(e,kk,"getBlock")({});if("function"==typeof n?.fees?.estimateFeesPerGas)return n.fees.estimateFeesPerGas({block:r,client:e,multiply:c,request:i,type:o});if("eip1559"===o){if("bigint"!=typeof u.baseFeePerGas)throw new Ak;const t=i?.maxPriorityFeePerGas?i.maxPriorityFeePerGas:await Pk(e,{block:u,chain:n,request:i}),r=c(u.baseFeePerGas);return{maxFeePerGas:i?.maxFeePerGas??r+t,maxPriorityFeePerGas:t}}return{gasPrice:i?.gasPrice??c(await nx(e,Sk,"getGasPrice")({}))}}async function Tk(e,{address:t,blockTag:r="latest",blockNumber:n}){return YE(await e.request({method:"eth_getTransactionCount",params:[t,n?jE(n):r]}))}async function Ok(e,t){const{account:r=e.account,chain:n,gas:i,nonce:o,type:a}=t;if(!r)throw new bk;const s=y_(r),c=await nx(e,kk,"getBlock")({blockTag:"latest"}),u={...t,from:s.address};if(void 0===o&&(u.nonce=await nx(e,Tk,"getTransactionCount")({address:s.address,blockTag:"pending"})),void 0===a)try{u.type=function(e){if(e.type)return e.type;if(void 0!==e.maxFeePerGas||void 0!==e.maxPriorityFeePerGas)return"eip1559";if(void 0!==e.gasPrice)return void 0!==e.accessList?"eip2930":"legacy";throw new B_({transaction:e})}(u)}catch{u.type="bigint"==typeof c.baseFeePerGas?"eip1559":"legacy"}if("eip1559"===u.type){const{maxFeePerGas:r,maxPriorityFeePerGas:i}=await Ik(e,{block:c,chain:n,request:u});if(void 0===t.maxPriorityFeePerGas&&t.maxFeePerGas&&t.maxFeePerGas{const t=yk(e,r);return t instanceof PA?e:t})();return new gk(n,{docsPath:t,...r})}(r,{...t,account:n,chain:e.chain})}}async function Ck(e,{abi:t,address:r,args:n,functionName:i,...o}){const a=v_({abi:t,args:n,functionName:i});try{return await nx(e,Mk,"estimateGas")({data:a,to:r,...o})}catch(e){const a=o.account?y_(o.account):void 0;throw mk(e,{abi:t,address:r,args:n,docsPath:"/docs/contract/estimateContractGas",functionName:i,sender:a?.address})}}const Bk="/docs/contract/decodeEventLog";function Nk({abi:e,data:t,strict:r,topics:n}){const i=r??!0,[o,...a]=n;if(!o)throw new px({docsPath:Bk});const s=e.find((e=>"event"===e.type&&o===r_(ix(e))));if(!s||!("name"in s)||"event"!==s.type)throw new mx(o,{docsPath:Bk});const{name:c,inputs:u}=s,l=u?.some((e=>!("name"in e&&e.name)));let f=l?[]:{};const d=u.filter((e=>"indexed"in e&&e.indexed));for(let e=0;e!("indexed"in e&&e.indexed)));if(h.length>0)if(t&&"0x"!==t)try{const e=__(h,t);if(e)if(l)f=[...f,...e];else for(let t=0;t0?f:void 0}}function Rk({param:e,value:t}){if("string"===e.type||"bytes"===e.type||"tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/))return t;return(__([e],t)||[])[0]}async function Fk(e,{address:t,blockHash:r,fromBlock:n,toBlock:i,event:o,events:a,args:s,strict:c}={}){const u=c??!1,l=a??(o?[o]:void 0);let f,d=[];return l&&(d=[l.flatMap((e=>p_({abi:[e],eventName:e.name,args:s})))],o&&(d=d[0])),f=r?await e.request({method:"eth_getLogs",params:[{address:t,topics:d,blockHash:r}]}):await e.request({method:"eth_getLogs",params:[{address:t,topics:d,fromBlock:"bigint"==typeof n?jE(n):n,toBlock:"bigint"==typeof i?jE(i):i}]}),f.map((e=>{try{const{eventName:t,args:r}=l?Nk({abi:l,data:e.data,topics:e.topics,strict:u}):{eventName:void 0,args:void 0};return rA(e,{args:r,eventName:t})}catch(t){let r,n;if(t instanceof Ex||t instanceof Ax){if(u)return;r=t.abiItem.name,n=t.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}return rA(e,{args:n?[]:{},eventName:r})}})).filter(Boolean)}async function Lk(e,{abi:t,address:r,args:n,blockHash:i,eventName:o,fromBlock:a,toBlock:s,strict:c}){const u=o?f_({abi:t,name:o}):void 0,l=u?void 0:t.filter((e=>"event"===e.type));return nx(e,Fk,"getLogs")({address:r,args:n,blockHash:i,event:u,events:l,fromBlock:a,toBlock:s,strict:c})}const jk="/docs/contract/decodeFunctionResult";function Uk({abi:e,args:t,functionName:r,data:n}){let i=e[0];if(r&&(i=f_({abi:e,args:t,name:r}),!i))throw new gx(r,{docsPath:jk});if("function"!==i.type)throw new gx(void 0,{docsPath:jk});if(!i.outputs)throw new yx(i.name,{docsPath:jk});const o=__(i.outputs,n);return o&&o.length>1?o:o&&1===o.length?o[0]:void 0}const Dk=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],zk=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"}],$k=[...zk,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],Hk=[...zk,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],Gk=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],qk=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],Kk=[{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"}],Vk="0x82ad56cb";function Wk({blockNumber:e,chain:t,contract:r}){const n=t?.contracts?.[r];if(!n)throw new cA({chain:t,contract:{name:r}});if(e&&n.blockCreated&&n.blockCreated>e)throw new cA({blockNumber:e,chain:t,contract:{name:r,blockCreated:n.blockCreated}});return n.address}const Jk=new Map;function Zk({fn:e,id:t,shouldSplitBatch:r,wait:n=0,sort:i}){const o=async()=>{const t=s();a();const r=t.map((({args:e})=>e));0!==r.length&&e(r).then((e=>{i&&Array.isArray(e)&&e.sort(i);for(let r=0;r{for(let r=0;rJk.delete(t),s=()=>Jk.get(t)||[],c=e=>Jk.set(t,[...s(),e]);return{flush:a,async schedule(e){const t={},i=new Promise(((e,r)=>{t.resolve=e,t.reject=r})),a=r?.([...s().map((({args:e})=>e)),e]);a&&o();return s().length>0?(c({args:e,pendingPromise:t}),i):(c({args:e,pendingPromise:t}),setTimeout(o,n),i)}}}async function Yk(e,t){const{account:r=e.account,batch:n=Boolean(e.batch?.multicall),blockNumber:i,blockTag:o="latest",accessList:a,data:s,gas:c,gasPrice:u,maxFeePerGas:l,maxPriorityFeePerGas:f,nonce:d,to:h,value:p,...m}=t,b=r?y_(r):void 0;try{wk(t);const r=(i?jE(i):void 0)||o,g=e.chain?.formatters?.transactionRequest?.format,y=(g||aA)({...vk(m,{format:g}),from:b?.address,accessList:a,data:s,gas:c,gasPrice:u,maxFeePerGas:l,maxPriorityFeePerGas:f,nonce:d,to:h,value:p});if(n&&function({request:e}){const{data:t,to:r,...n}=e;return!!t&&(!t.startsWith(Vk)&&(!!r&&!(Object.values(n).filter((e=>void 0!==e)).length>0)))}({request:y}))try{return await async function(e,t){const{batchSize:r=1024,wait:n=0}="object"==typeof e.batch?.multicall?e.batch.multicall:{},{blockNumber:i,blockTag:o="latest",data:a,multicallAddress:s,to:c}=t;let u=s;if(!u){if(!e.chain)throw new fA;u=Wk({blockNumber:i,chain:e.chain,contract:"multicall3"})}const l=i?jE(i):void 0,f=l||o,{schedule:d}=Zk({id:`${e.uid}.${f}`,wait:n,shouldSplitBatch(e){const t=e.reduce(((e,{data:t})=>e+(t.length-2)),0);return t>2*r},fn:async t=>{const r=t.map((e=>({allowFailure:!0,callData:e.data,target:e.to}))),n=v_({abi:Dk,args:[r],functionName:"aggregate3"}),i=await e.request({method:"eth_call",params:[{data:n,to:u},f]});return Uk({abi:Dk,args:[r],functionName:"aggregate3",data:i||"0x"})}}),[{returnData:h,success:p}]=await d({data:a,to:c});if(!p)throw new $_({data:h});return"0x"===h?{data:void 0}:{data:h}}(e,{...y,blockNumber:i,blockTag:o})}catch(e){if(!(e instanceof fA||e instanceof cA))throw e}const v=await e.request({method:"eth_call",params:r?[y,r]:[y]});return"0x"===v?{data:void 0}:{data:v}}catch(r){const n=function(e){if(!(e instanceof AE))return;const t=e.walk();return"object"==typeof t.data?t.data.data:t.data}(r),{offchainLookup:i,offchainLookupSignature:o}=await Promise.resolve().then((function(){return aP}));if(n?.slice(0,10)===o&&h)return{data:await i(e,{data:n,to:h})};throw function(e,{docsPath:t,...r}){const n=(()=>{const t=yk(e,r);return t instanceof PA?e:t})();return new j_(n,{docsPath:t,...r})}(r,{...t,account:b,chain:e.chain})}}async function Xk(e,{abi:t,address:r,args:n,functionName:i,...o}){const a=v_({abi:t,args:n,functionName:i});try{const{data:s}=await nx(e,Yk,"call")({data:a,to:r,...o});return Uk({abi:t,args:n,functionName:i,data:s||"0x"})}catch(e){throw mk(e,{abi:t,address:r,args:n,docsPath:"/docs/contract/readContract",functionName:i})}}async function Qk(e,{abi:t,address:r,args:n,dataSuffix:i,functionName:o,...a}){const s=a.account?y_(a.account):void 0,c=v_({abi:t,args:n,functionName:o});try{const{data:s}=await nx(e,Yk,"call")({batch:!1,data:`${c}${i?i.replace("0x",""):""}`,to:r,...a});return{result:Uk({abi:t,args:n,functionName:o,data:s||"0x"}),request:{abi:t,address:r,args:n,dataSuffix:i,functionName:o,...a}}}catch(e){throw mk(e,{abi:t,address:r,args:n,docsPath:"/docs/contract/simulateContract",functionName:o,sender:s?.address})}}const eS=new Map,tS=new Map;let rS=0;function nS(e,t,r){const n=++rS,i=()=>eS.get(e)||[],o=()=>{const t=tS.get(e);1===i().length&&t&&t(),(()=>{const t=i();eS.set(e,t.filter((e=>e.id!==n)))})()},a=i();if(eS.set(e,[...a,{id:n,fns:t}]),a&&a.length>0)return o;const s={};for(const e in t)s[e]=(...t)=>{const r=i();if(0!==r.length)for(const n of r)n.fns[e]?.(...t)};const c=r(s);return"function"==typeof c&&tS.set(e,c),o}async function iS(e){return new Promise((t=>setTimeout(t,e)))}function oS(e,{emitOnBegin:t,initialWaitTime:r,interval:n}){let i=!0;const o=()=>i=!1;return(async()=>{let a;t&&(a=await e({unpoll:o}));const s=await(r?.(a))??n;await iS(s);const c=async()=>{i&&(await e({unpoll:o}),await iS(n),c())};c()})(),o}const aS=new Map,sS=new Map;async function cS(e,{cacheKey:t,cacheTime:r=1/0}){const n=function(e){const t=(e,t)=>({clear:()=>t.delete(e),get:()=>t.get(e),set:r=>t.set(e,r)}),r=t(e,aS),n=t(e,sS);return{clear:()=>{r.clear(),n.clear()},promise:r,response:n}}(t),i=n.response.get();if(i&&r>0){if((new Date).getTime()-i.created.getTime()`blockNumber.${e}`;async function lS(e,{cacheTime:t=e.cacheTime,maxAge:r}={}){const n=await cS((()=>e.request({method:"eth_blockNumber"})),{cacheKey:uS(e.uid),cacheTime:r??t});return BigInt(n)}async function fS(e,{filter:t}){const r="strict"in t&&t.strict;return(await t.request({method:"eth_getFilterChanges",params:[t.id]})).map((e=>{if("string"==typeof e)return e;try{const{eventName:n,args:i}="abi"in t&&t.abi?Nk({abi:t.abi,data:e.data,topics:e.topics,strict:r}):{eventName:void 0,args:void 0};return rA(e,{args:i,eventName:n})}catch(r){let n,i;if(r instanceof Ex||r instanceof Ax){if("strict"in t&&t.strict)return;n=r.abiItem.name,i=r.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}return rA(e,{args:i?[]:{},eventName:n})}})).filter(Boolean)}async function dS(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function hS(e,{abi:t,address:r,args:n,batch:i=!0,eventName:o,onError:a,onLogs:s,poll:c,pollingInterval:u=e.pollingInterval,strict:l}){return(void 0!==c?c:"webSocket"!==e.transport.type)?(()=>{const c=I_(["watchContractEvent",r,n,i,e.uid,o,u]),f=l??!1;return nS(c,{onLogs:s,onError:a},(a=>{let s,c,l=!1;const d=oS((async()=>{if(l)try{let u;if(c)u=await nx(e,fS,"getFilterChanges")({filter:c});else{const i=await nx(e,lS,"getBlockNumber")({});u=s&&s!==i?await nx(e,Lk,"getContractEvents")({abi:t,address:r,args:n,eventName:o,fromBlock:s+1n,toBlock:i,strict:f}):[],s=i}if(0===u.length)return;if(i)a.onLogs(u);else for(const e of u)a.onLogs([e])}catch(e){c&&e instanceof ek&&(l=!1),a.onError?.(e)}else{try{c=await nx(e,g_,"createContractEventFilter")({abi:t,address:r,args:n,eventName:o,strict:f})}catch{}l=!0}}),{emitOnBegin:!0,interval:u});return async()=>{c&&await nx(e,dS,"uninstallFilter")({filter:c}),d()}}))})():(()=>{let i=!0,c=()=>i=!1;return(async()=>{try{const u=o?p_({abi:t,eventName:o,args:n}):[],{unsubscribe:f}=await e.transport.subscribe({params:["logs",{address:r,topics:u}],onData(e){if(!i)return;const r=e.result;try{const{eventName:e,args:n}=Nk({abi:t,data:r.data,topics:r.topics,strict:l}),i=rA(r,{args:n,eventName:e});s([i])}catch(e){let t,n;if(e instanceof Ex||e instanceof Ax){if(l)return;t=e.abiItem.name,n=e.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}const i=rA(r,{args:n?[]:{},eventName:t});s([i])}},onError(e){a?.(e)}});c=f,i||c()}catch(e){a?.(e)}})(),c})()}async function pS(e){return YE(await e.request({method:"eth_chainId"}))}async function mS(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]})}async function bS(e,t){const{account:r=e.account,chain:n=e.chain,accessList:i,data:o,gas:a,gasPrice:s,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,to:f,value:d,...h}=t;if(!r)throw new bk({docsPath:"/docs/actions/wallet/sendTransaction"});const p=y_(r);try{let r;if(wk(t),null!==n&&(r=await nx(e,pS,"getChainId")({}),function({chain:e,currentChainId:t}){if(!e)throw new lA;if(t!==e.id)throw new uA({chain:e,currentChainId:t})}({currentChainId:r,chain:n})),"local"===p.type){const t=await nx(e,Ok,"prepareTransactionRequest")({account:p,accessList:i,chain:n,data:o,gas:a,gasPrice:s,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,to:f,value:d,...h});r||(r=await nx(e,pS,"getChainId")({}));const m=n?.serializers?.transaction,b=await p.signTransaction({...t,chainId:r},{serializer:m});return await nx(e,mS,"sendRawTransaction")({serializedTransaction:b})}const m=e.chain?.formatters?.transactionRequest?.format,b=(m||aA)({...vk(h,{format:m}),accessList:i,data:o,from:p.address,gas:a,gasPrice:s,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,to:f,value:d});return await e.request({method:"eth_sendTransaction",params:[b]})}catch(e){throw function(e,{docsPath:t,...r}){const n=(()=>{const t=yk(e,r);return t instanceof PA?e:t})();return new N_(n,{docsPath:t,...r})}(e,{...t,account:p,chain:t.chain||void 0})}}async function gS(e,{abi:t,address:r,args:n,dataSuffix:i,functionName:o,...a}){const s=v_({abi:t,args:n,functionName:o});return await nx(e,bS,"sendTransaction")({data:`${s}${i?i.replace("0x",""):""}`,to:r,...a})}function yS(e){const t=e.length&&Array.isArray(e[0]);return{args:t?e[0]:[],options:(t?e[1]:e[0])??{}}}function vS(e,t){let r=!1;Array.isArray(e[0])?r=!0:1===e.length?r=t.inputs.some((e=>e.indexed)):2===e.length&&(r=!0);return{args:r?e[0]:void 0,options:(r?e[1]:e[0])??{}}}const wS=256;let ES,AS=wS;function xS(e=11){if(!ES||AS+e>2*wS){ES="",AS=0;for(let e=0;e!0}={}){return new Promise(((i,o)=>{const a=async({count:s=0}={})=>{try{const t=await e();i(t)}catch(e){if(s{const r="function"==typeof t?t({count:s,error:e}):t;r&&await iS(r),a({count:s+1})})({error:e});o(e)}};a()}))}const kS=e=>"code"in e?-1!==e.code&&-32004!==e.code&&-32005!==e.code&&-32042!==e.code&&-32603!==e.code:!!(e instanceof H_&&e.status)&&(403!==e.status&&408!==e.status&&413!==e.status&&429!==e.status&&500!==e.status&&502!==e.status&&503!==e.status&&504!==e.status);function SS(e,{retryDelay:t=150,retryCount:r=3}={}){return async n=>_S((async()=>{try{return await e(n)}catch(e){const t=e;switch(t.code){case J_.code:throw new J_(t);case Z_.code:throw new Z_(t);case Y_.code:throw new Y_(t);case X_.code:throw new X_(t);case Q_.code:throw new Q_(t);case ek.code:throw new ek(t);case tk.code:throw new tk(t);case rk.code:throw new rk(t);case nk.code:throw new nk(t);case ik.code:throw new ik(t);case ok.code:throw new ok(t);case ak.code:throw new ak(t);case sk.code:throw new sk(t);case ck.code:throw new ck(t);case uk.code:throw new uk(t);case lk.code:throw new lk(t);case fk.code:throw new fk(t);case dk.code:throw new dk(t);case 5e3:throw new sk(t);default:if(e instanceof AE)throw e;throw new hk(t)}}}),{delay:({count:e,error:r})=>{if(r&&r instanceof H_){const e=r?.headers?.get("Retry-After");if(e?.match(/\d/))return 1e3*parseInt(e)}return(1<!kS(e)})}let PS=class extends AE{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro"})}};function IS(e,{errorInstance:t=new Error("timed out"),timeout:r,signal:n}){return new Promise(((i,o)=>{(async()=>{let a;try{const s=new AbortController;r>0&&(a=setTimeout((()=>{n?s.abort():o(t)}),r)),i(await e({signal:s?.signal}))}catch(e){"AbortError"===e.name&&o(t),o(e)}finally{clearTimeout(a)}})()}))}let TS=0;const OS={http:async function(e,{body:t,fetchOptions:r={},timeout:n=1e4}){const{headers:i,method:o,signal:a}=r;try{const s=await IS((async({signal:s})=>await fetch(e,{...r,body:Array.isArray(t)?I_(t.map((e=>({jsonrpc:"2.0",id:e.id??TS++,...e})))):I_({jsonrpc:"2.0",id:t.id??TS++,...t}),headers:{...i,"Content-Type":"application/json"},method:o||"POST",signal:a||(n>0?s:void 0)})),{errorInstance:new K_({body:t,url:e}),timeout:n,signal:!0});let c;if(c=s.headers.get("Content-Type")?.startsWith("application/json")?await s.json():await s.text(),!s.ok)throw new H_({body:t,details:I_(c.error)||s.statusText,headers:s.headers,status:s.status,url:e});return c}catch(r){if(r instanceof H_)throw r;if(r instanceof K_)throw r;throw new H_({body:t,details:r.message,url:e})}},webSocket:function(e,{body:t,onResponse:r}){if(e.readyState===e.CLOSED||e.readyState===e.CLOSING)throw new G_({body:t,url:e.url,details:"Socket is closed."});const n=TS++,i=({data:o})=>{const a=JSON.parse(o);"number"==typeof a.id&&n!==a.id||(r?.(a),"eth_subscribe"===t.method&&"string"==typeof a.result&&e.subscriptions.set(a.result,i),"eth_unsubscribe"===t.method&&e.subscriptions.delete(t.params?.[0]))};return e.requests.set(n,i),e.send(JSON.stringify({jsonrpc:"2.0",...t,id:n})),e},webSocketAsync:async function(e,{body:t,timeout:r=1e4}){return IS((()=>new Promise((r=>OS.webSocket(e,{body:t,onResponse:r})))),{errorInstance:new K_({body:t,url:e.url}),timeout:r})}};function MS(e,t={}){const{batch:r,fetchOptions:n,key:i="http",name:o="HTTP JSON-RPC",retryDelay:a}=t;return({chain:s,retryCount:c,timeout:u})=>{const{batchSize:l=1e3,wait:f=0}="object"==typeof r?r:{},d=t.retryCount??c,h=u??t.timeout??1e4,p=e||s?.rpcUrls.default.http[0];if(!p)throw new PS;return function({key:e,name:t,request:r,retryCount:n=3,retryDelay:i=150,timeout:o,type:a},s){return{config:{key:e,name:t,request:r,retryCount:n,retryDelay:i,timeout:o,type:a},request:SS(r,{retryCount:n,retryDelay:i}),value:s}}({key:i,name:o,async request({method:t,params:i}){const o={method:t,params:i},{schedule:a}=Zk({id:`${e}`,wait:f,shouldSplitBatch:e=>e.length>l,fn:e=>OS.http(p,{body:e,fetchOptions:n,timeout:h}),sort:(e,t)=>e.id-t.id}),[{error:s,result:c}]=await(async e=>r?a(e):[await OS.http(p,{body:e,fetchOptions:n,timeout:h})])(o);if(s)throw new q_({body:o,error:s,url:p});return c},retryCount:d,retryDelay:a,timeout:h,type:"http"},{fetchOptions:n,url:e})}}function CS(e,t){if(!(e instanceof AE))return!1;const r=e.walk((e=>e instanceof D_));return r instanceof D_&&("ResolverNotFound"===r.data?.errorName||("ResolverWildcardNotSupported"===r.data?.errorName||(!!r.reason?.includes("Wildcard on non-extended resolvers is not supported")||"reverse"===t&&r.reason===w_[50])))}function BS(e){if(66!==e.length)return null;if(0!==e.indexOf("["))return null;if(65!==e.indexOf("]"))return null;const t=`0x${e.slice(1,65)}`;return PE(t)?t:null}function NS(e){let t=new Uint8Array(32).fill(0);if(!e)return LE(t);const r=e.split(".");for(let e=r.length-1;e>=0;e-=1){const n=BS(r[e]),i=n?$E(n):t_(KE(r[e]),"bytes");t=t_(OA([t,i]),"bytes")}return LE(t)}function RS(e){return`[${e.slice(2)}]`}function FS(e){const t=new Uint8Array(32).fill(0);return e?BS(e)||t_(KE(e)):LE(t)}function LS(e){const t=e.replace(/^\.|\.$/gm,"");if(0===t.length)return new Uint8Array(1);const r=new Uint8Array(KE(t).byteLength+2);let n=0;const i=t.split(".");for(let e=0;e255&&(t=KE(RS(FS(i[e])))),r[n]=t.length,r.set(t,n+1),n+=t.length+1}return r.byteLength!==n+1?r.slice(0,n+1):r}let jS=class extends AE{constructor({data:e}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidMetadataError"})}},US=class extends AE{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidNftUriError"})}},DS=class extends AE{constructor({uri:e}){super(`Unable to resolve ENS avatar URI "${e}". The URI may be malformed, invalid, or does not respond with a valid image.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUriResolutionError"})}},zS=class extends AE{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUnsupportedNamespaceError"})}};const $S=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,HS=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,GS=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,qS=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;function KS(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function VS({uri:e,gatewayUrls:t}){const r=GS.test(e);if(r)return{uri:e,isOnChain:!0,isEncoded:r};const n=KS(t?.ipfs,"https://ipfs.io"),i=KS(t?.arweave,"https://arweave.net"),o=e.match($S),{protocol:a,subpath:s,target:c,subtarget:u=""}=o?.groups||{},l="ipns:/"===a||"ipns/"===s,f="ipfs:/"===a||"ipfs/"===s||HS.test(e);if(e.startsWith("http")&&!l&&!f){let r=e;return t?.arweave&&(r=e.replace(/https:\/\/arweave.net/g,t?.arweave)),{uri:r,isOnChain:!1,isEncoded:!1}}if((l||f)&&c)return{uri:`${n}/${l?"ipns":"ipfs"}/${c}${u}`,isOnChain:!1,isEncoded:!1};if("ar:/"===a&&c)return{uri:`${i}/${c}${u||""}`,isOnChain:!1,isEncoded:!1};let d=e.replace(qS,"");if(d.startsWith("{const r=new Image;r.onload=()=>{t(!0)},r.onerror=()=>{t(!1)},r.src=e}))}}(r);if(i)return r;throw new DS({uri:t})}async function ZS(e,{gatewayUrls:t,record:r}){return/eip155:/i.test(r)?async function(e,{gatewayUrls:t,record:r}){const n=function(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[r,n,i]=t.split("/"),[o,a]=r.split(":"),[s,c]=n.split(":");if(!o||"eip155"!==o.toLowerCase())throw new US({reason:"Only EIP-155 supported"});if(!a)throw new US({reason:"Chain ID not found"});if(!c)throw new US({reason:"Contract address not found"});if(!i)throw new US({reason:"Token ID not found"});if(!s)throw new US({reason:"ERC namespace not found"});return{chainID:parseInt(a),namespace:s.toLowerCase(),contractAddress:c,tokenID:i}}(r),i=await async function(e,{nft:t}){if("erc721"===t.namespace)return Xk(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if("erc1155"===t.namespace)return Xk(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new zS({namespace:t.namespace})}(e,{nft:n}),{uri:o,isOnChain:a,isEncoded:s}=VS({uri:i,gatewayUrls:t});if(a&&(o.includes("data:application/json;base64,")||o.startsWith("{"))){const e=s?atob(o.replace("data:application/json;base64,","")):o;return JS({uri:WS(JSON.parse(e)),gatewayUrls:t})}let c=n.tokenID;"erc1155"===n.namespace&&(c=c.replace("0x","").padStart(64,"0"));return async function({gatewayUrls:e,uri:t}){try{const r=await fetch(t).then((e=>e.json()));return await JS({gatewayUrls:e,uri:WS(r)})}catch{throw new DS({uri:t})}}({gatewayUrls:t,uri:o.replace(/(?:0x)?{id}/,c)})}(e,{gatewayUrls:t,record:r}):JS({uri:r,gatewayUrls:t})}async function YS(e,{blockNumber:t,blockTag:r,name:n,key:i,universalResolverAddress:o}){let a=o;if(!a){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");a=Wk({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{const o=await nx(e,Xk,"readContract")({address:a,abi:$k,functionName:"resolve",args:[RE(LS(n)),v_({abi:Gk,functionName:"text",args:[NS(n),i]})],blockNumber:t,blockTag:r});if("0x"===o[0])return null;const s=Uk({abi:Gk,functionName:"text",data:o[0]});return""===s?null:s}catch(e){if(CS(e,"resolve"))return null;throw e}}async function XS(e,{address:t,args:r,event:n,events:i,fromBlock:o,strict:a,toBlock:s}={}){const c=i??(n?[n]:void 0),u=b_(e,{method:"eth_newFilter"});let l=[];c&&(l=[c.flatMap((e=>p_({abi:[e],eventName:e.name,args:r})))],n&&(l=l[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:"bigint"==typeof o?jE(o):o,toBlock:"bigint"==typeof s?jE(s):s,...l.length?{topics:l}:{}}]});return{abi:c,args:r,eventName:n?n.name:void 0,fromBlock:o,id:f,request:u(f),strict:a,toBlock:s,type:"event"}}async function QS(e){const t=b_(e,{method:"eth_newPendingTransactionFilter"}),r=await e.request({method:"eth_newPendingTransactionFilter"});return{id:r,request:t(r),type:"transaction"}}async function eP(e,{blockCount:t,blockNumber:r,blockTag:n="latest",rewardPercentiles:i}){const o=r?jE(r):void 0;return function(e){return{baseFeePerGas:e.baseFeePerGas.map((e=>BigInt(e))),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:e.reward?.map((e=>e.map((e=>BigInt(e)))))}}(await e.request({method:"eth_feeHistory",params:[jE(t),o||n,i]}))}let tP=class extends AE{constructor({callbackSelector:e,cause:t,data:r,extraData:n,sender:i,urls:o}){super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],t.metaMessages?.length?"":[],"Offchain Gateway Call:",o&&[" Gateway URL(s):",...o.map((e=>` ${e}`))],` Sender: ${i}`,` Data: ${r}`,` Callback selector: ${e}`,` Extra data: ${n}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}},rP=class extends AE{constructor({result:e,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${t}`,`Response: ${I_(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}},nP=class extends AE{constructor({sender:e,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}};const iP={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function oP({data:e,sender:t,urls:r}){let n=new Error("An unknown error occurred.");for(let i=0;i{for(const r of e){const{name:e,type:n}=r,a=n,s=t[e],c=a.match(cP);if(c&&("number"==typeof s||"bigint"==typeof s)){const[e,t,r]=c;jE(s,{signed:"int"===t,size:parseInt(r)/8})}if("address"===a&&"string"==typeof s&&!TA(s))throw new sA({address:s});const u=a.match(sP);if(u){const[e,t]=u;if(t&&IE(s)!==parseInt(t))throw new wx({expectedSize:parseInt(t),givenSize:IE(s)})}const l=i[a];l&&o(l,s)}};i.EIP712Domain&&e&&o(i.EIP712Domain,e);if("EIP712Domain"!==r){const e=i[r];o(e,t)}}({domain:i,message:t,primaryType:r,types:o});const a=["0x1901"];return i&&a.push(function({domain:e,types:t}){return lP({data:e,primaryType:"EIP712Domain",types:t})}({domain:i,types:o})),"EIP712Domain"!==r&&a.push(lP({data:t,primaryType:r,types:o})),t_(OA(a))}function lP({data:e,primaryType:t,types:r}){return t_(fP({data:e,primaryType:t,types:r}))}function fP({data:e,primaryType:t,types:r}){const n=[{type:"bytes32"}],i=[dP({primaryType:t,types:r})];for(const o of r[t]){const[t,a]=pP({types:r,name:o.name,type:o.type,value:e[o.name]});n.push(t),i.push(a)}return a_(n,i)}function dP({primaryType:e,types:t}){const r=RE(function({primaryType:e,types:t}){let r="";const n=hP({primaryType:e,types:t});n.delete(e);const i=[e,...Array.from(n).sort()];for(const e of i)r+=`${e}(${t[e].map((({name:e,type:t})=>`${t} ${e}`)).join(",")})`;return r}({primaryType:e,types:t}));return t_(r)}function hP({primaryType:e,types:t},r=new Set){const n=e.match(/^\w*/u),i=n?.[0];if(r.has(i)||void 0===t[i])return r;r.add(i);for(const e of t[i])hP({primaryType:e.type,types:t},r);return r}function pP({types:e,name:t,type:r,value:n}){if(void 0!==e[r])return[{type:"bytes32"},t_(fP({data:n,primaryType:r,types:e}))];if("bytes"===r){return[{type:"bytes32"},t_(n=`0x${(n.length%2?"0":"")+n.slice(2)}`)]}if("string"===r)return[{type:"bytes32"},t_(RE(n))];if(r.lastIndexOf("]")===r.length-1){const i=r.slice(0,r.lastIndexOf("[")),o=n.map((r=>pP({name:t,type:i,types:e,value:r})));return[{type:"bytes32"},t_(a_(o.map((([e])=>e)),o.map((([,e])=>e))))]}return[{type:r},n]}function mP({domain:e}){return["string"==typeof e?.name&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},"number"==typeof e?.chainId&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}const bP="/docs/contract/encodeDeployData";function gP({abi:e,args:t,bytecode:r}){if(!t||0===t.length)return r;const n=e.find((e=>"type"in e&&"constructor"===e.type));if(!n)throw new ax({docsPath:bP});if(!("inputs"in n))throw new sx({docsPath:bP});if(!n.inputs||0===n.inputs.length)throw new sx({docsPath:bP});return MA([r,a_(n.inputs,t)])}const yP="Ethereum Signed Message:\n";async function vP(e,{address:t,blockNumber:r,blockTag:n,storageKeys:i}){const o=n??"latest",a=void 0!==r?jE(r):void 0;return function(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?YE(e.nonce):void 0,storageProof:e.storageProof?(t=e.storageProof,t.map((e=>({...e,value:BigInt(e.value)})))):void 0};var t}(await e.request({method:"eth_getProof",params:[t,i,a||o]}))}async function wP(e,{blockHash:t,blockNumber:r,blockTag:n,hash:i,index:o}){const a=n||"latest",s=void 0!==r?jE(r):void 0;let c=null;if(i?c=await e.request({method:"eth_getTransactionByHash",params:[i]}):t?c=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,jE(o)]}):(s||a)&&(c=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[s||a,jE(o)]})),!c)throw new R_({blockHash:t,blockNumber:r,blockTag:a,hash:i,index:o});return(e.chain?.formatters?.transaction?.format||eA)(c)}async function EP(e,{hash:t}){const r=await e.request({method:"eth_getTransactionReceipt",params:[t]});if(!r)throw new F_({hash:t});return(e.chain?.formatters?.transactionReceipt?.format||iA)(r)}const AP="0x60806040523480156200001157600080fd5b50604051620007003803806200070083398101604081905262000034916200056f565b6000620000438484846200004f565b9050806000526001601ff35b600080846001600160a01b0316803b806020016040519081016040528181526000908060200190933c90507f6492649264926492649264926492649264926492649264926492649264926492620000a68462000451565b036200021f57600060608085806020019051810190620000c79190620005ce565b8651929550909350915060000362000192576000836001600160a01b031683604051620000f5919062000643565b6000604051808303816000865af19150503d806000811462000134576040519150601f19603f3d011682016040523d82523d6000602084013e62000139565b606091505b5050905080620001905760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b505b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90620001c4908b90869060040162000661565b602060405180830381865afa158015620001e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020891906200069d565b6001600160e01b031916149450505050506200044a565b805115620002b157604051630b135d3f60e11b808252906001600160a01b03871690631626ba7e9062000259908890889060040162000661565b602060405180830381865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d91906200069d565b6001600160e01b031916149150506200044a565b8251604114620003195760405162461bcd60e51b815260206004820152603a6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e677468000000000000606482015260840162000187565b620003236200046b565b506020830151604080850151855186939260009185919081106200034b576200034b620006c9565b016020015160f81c9050601b81148015906200036b57508060ff16601c14155b15620003cf5760405162461bcd60e51b815260206004820152603b6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c75650000000000606482015260840162000187565b6040805160008152602081018083528a905260ff83169181019190915260608101849052608081018390526001600160a01b038a169060019060a0016020604051602081039080840390855afa1580156200042e573d6000803e3d6000fd5b505050602060405103516001600160a01b031614955050505050505b9392505050565b60006020825110156200046357600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b03811681146200049f57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004d5578181015183820152602001620004bb565b50506000910152565b600082601f830112620004f057600080fd5b81516001600160401b03808211156200050d576200050d620004a2565b604051601f8301601f19908116603f01168101908282118183101715620005385762000538620004a2565b816040528381528660208588010111156200055257600080fd5b62000565846020830160208901620004b8565b9695505050505050565b6000806000606084860312156200058557600080fd5b8351620005928162000489565b6020850151604086015191945092506001600160401b03811115620005b657600080fd5b620005c486828701620004de565b9150509250925092565b600080600060608486031215620005e457600080fd5b8351620005f18162000489565b60208501519093506001600160401b03808211156200060f57600080fd5b6200061d87838801620004de565b935060408601519150808211156200063457600080fd5b50620005c486828701620004de565b6000825162000657818460208701620004b8565b9190910192915050565b828152604060208201526000825180604084015262000688816060850160208701620004b8565b601f01601f1916919091016060019392505050565b600060208284031215620006b057600080fd5b81516001600160e01b0319811681146200044a57600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572"; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */async function xP(e,{address:t,hash:r,signature:n,...i}){const o=PE(n)?n:RE(n);try{const{data:n}=await nx(e,Yk,"call")({data:gP({abi:Kk,args:[t,r,o],bytecode:AP}),...i});return s="0x1",function(e,t){if(e.length!==t.length)return!1;for(let r=0;roS((async()=>{try{const t=await nx(e,lS,"getBlockNumber")({cacheTime:0});if(s){if(t===s)return;if(t-s>1&&r)for(let e=s+1n;es)&&(n.onBlockNumber(t,s),s=t)}catch(e){n.onError?.(e)}}),{emitOnBegin:t,interval:a}))):(()=>{let t=!0,r=()=>t=!1;return(async()=>{try{const{unsubscribe:o}=await e.transport.subscribe({params:["newHeads"],onData(e){if(!t)return;const r=JE(e.result?.number);n(r,s),s=r},onError(e){i?.(e)}});r=o,t||r()}catch(e){i?.(e)}})(),r})()}function SP(e){return{call:t=>Yk(e,t),createBlockFilter:()=>async function(e){const t=b_(e,{method:"eth_newBlockFilter"}),r=await e.request({method:"eth_newBlockFilter"});return{id:r,request:t(r),type:"block"}}(e),createContractEventFilter:t=>g_(e,t),createEventFilter:t=>XS(e,t),createPendingTransactionFilter:()=>QS(e),estimateContractGas:t=>Ck(e,t),estimateGas:t=>Mk(e,t),getBalance:t=>async function(e,{address:t,blockNumber:r,blockTag:n="latest"}){const i=r?jE(r):void 0,o=await e.request({method:"eth_getBalance",params:[t,i||n]});return BigInt(o)}(e,t),getBlock:t=>kk(e,t),getBlockNumber:t=>lS(e,t),getBlockTransactionCount:t=>async function(e,{blockHash:t,blockNumber:r,blockTag:n="latest"}={}){const i=void 0!==r?jE(r):void 0;let o;return o=t?await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]}):await e.request({method:"eth_getBlockTransactionCountByNumber",params:[i||n]}),YE(o)}(e,t),getBytecode:t=>async function(e,{address:t,blockNumber:r,blockTag:n="latest"}){const i=void 0!==r?jE(r):void 0,o=await e.request({method:"eth_getCode",params:[t,i||n]});if("0x"!==o)return o}(e,t),getChainId:()=>pS(e),getContractEvents:t=>Lk(e,t),getEnsAddress:t=>async function(e,{blockNumber:t,blockTag:r,coinType:n,name:i,universalResolverAddress:o}){let a=o;if(!a){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");a=Wk({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{const o=v_({abi:qk,functionName:"addr",...null!=n?{args:[NS(i),BigInt(n)]}:{args:[NS(i)]}}),s=await nx(e,Xk,"readContract")({address:a,abi:$k,functionName:"resolve",args:[RE(LS(i)),o],blockNumber:t,blockTag:r});if("0x"===s[0])return null;const c=Uk({abi:qk,args:null!=n?[NS(i),BigInt(n)]:void 0,functionName:"addr",data:s[0]});return"0x"===c||"0x00"===TE(c)?null:c}catch(e){if(CS(e,"resolve"))return null;throw e}}(e,t),getEnsAvatar:t=>async function(e,{blockNumber:t,blockTag:r,gatewayUrls:n,name:i,universalResolverAddress:o}){const a=await nx(e,YS,"getEnsText")({blockNumber:t,blockTag:r,key:"avatar",name:i,universalResolverAddress:o});if(!a)return null;try{return await ZS(e,{record:a,gatewayUrls:n})}catch{return null}}(e,t),getEnsName:t=>async function(e,{address:t,blockNumber:r,blockTag:n,universalResolverAddress:i}){let o=i;if(!o){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");o=Wk({blockNumber:r,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const[i,s]=await nx(e,Xk,"readContract")({address:o,abi:Hk,functionName:"reverse",args:[RE(LS(a))],blockNumber:r,blockTag:n});return t.toLowerCase()!==s.toLowerCase()?null:i}catch(e){if(CS(e,"reverse"))return null;throw e}}(e,t),getEnsResolver:t=>async function(e,{blockNumber:t,blockTag:r,name:n,universalResolverAddress:i}){let o=i;if(!o){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");o=Wk({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}const[a]=await nx(e,Xk,"readContract")({address:o,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[RE(LS(n))],blockNumber:t,blockTag:r});return a}(e,t),getEnsText:t=>YS(e,t),getFeeHistory:t=>eP(e,t),estimateFeesPerGas:t=>async function(e,t){return Ik(e,t)}(e,t),getFilterChanges:e=>fS(0,e),getFilterLogs:e=>async function(e,{filter:t}){const r=t.strict??!1;return(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map((e=>{try{const{eventName:n,args:i}="abi"in t&&t.abi?Nk({abi:t.abi,data:e.data,topics:e.topics,strict:r}):{eventName:void 0,args:void 0};return rA(e,{args:i,eventName:n})}catch(r){let n,i;if(r instanceof Ex||r instanceof Ax){if("strict"in t&&t.strict)return;n=r.abiItem.name,i=r.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}return rA(e,{args:i?[]:{},eventName:n})}})).filter(Boolean)}(0,e),getGasPrice:()=>Sk(e),getLogs:t=>Fk(e,t),getProof:t=>vP(e,t),estimateMaxPriorityFeePerGas:t=>async function(e,t){return Pk(e,t)}(e,t),getStorageAt:t=>async function(e,{address:t,blockNumber:r,blockTag:n="latest",slot:i}){const o=void 0!==r?jE(r):void 0;return await e.request({method:"eth_getStorageAt",params:[t,i,o||n]})}(e,t),getTransaction:t=>wP(e,t),getTransactionConfirmations:t=>async function(e,{hash:t,transactionReceipt:r}){const[n,i]=await Promise.all([nx(e,lS,"getBlockNumber")({}),t?nx(e,wP,"getBlockNumber")({hash:t}):void 0]),o=r?.blockNumber||i?.blockNumber;return o?n-o+1n:0n}(e,t),getTransactionCount:t=>Tk(e,t),getTransactionReceipt:t=>EP(e,t),multicall:t=>async function(e,t){const{allowFailure:r=!0,batchSize:n,blockNumber:i,blockTag:o,contracts:a,multicallAddress:s}=t,c=n??("object"==typeof e.batch?.multicall&&e.batch.multicall.batchSize||1024);let u=s;if(!u){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");u=Wk({blockNumber:i,chain:e.chain,contract:"multicall3"})}const l=[[]];let f=0,d=0;for(let e=0;e0&&d>c&&l[f].length>0&&(f++,d=(e.length-2)/2,l[f]=[]),l[f]=[...l[f],{allowFailure:!0,callData:e,target:n}]}catch(e){const a=mk(e,{abi:t,address:n,args:i,docsPath:"/docs/contract/multicall",functionName:o});if(!r)throw a;l[f]=[...l[f],{allowFailure:!0,callData:"0x",target:n}]}}const h=await Promise.allSettled(l.map((t=>nx(e,Xk,"readContract")({abi:Dk,address:u,args:[t],blockNumber:i,blockTag:o,functionName:"aggregate3"})))),p=[];for(let e=0;eOk(e,t),readContract:t=>Xk(e,t),sendRawTransaction:t=>mS(e,t),simulateContract:t=>Qk(e,t),verifyMessage:t=>_P(e,t),verifyTypedData:t=>async function(e,{address:t,signature:r,message:n,primaryType:i,types:o,domain:a,...s}){return xP(e,{address:t,hash:uP({message:n,primaryType:i,types:o,domain:a}),signature:r,...s})}(e,t),uninstallFilter:e=>dS(0,e),waitForTransactionReceipt:t=>async function(e,{confirmations:t=1,hash:r,onReplaced:n,pollingInterval:i=e.pollingInterval,timeout:o}){const a=I_(["waitForTransactionReceipt",e.uid,r]);let s,c,u,l=!1;return new Promise(((f,d)=>{o&&setTimeout((()=>d(new L_({hash:r}))),o);const h=nS(a,{onReplaced:n,resolve:f,reject:d},(n=>{const o=nx(e,kP,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:i,async onBlockNumber(i){if(l)return;let a=i;const f=e=>{o(),e(),h()};try{if(u){if(t>1&&(!u.blockNumber||a-u.blockNumber+1nn.resolve(u)))}if(s||(l=!0,await _S((async()=>{s=await nx(e,wP,"getTransaction")({hash:r}),s.blockNumber&&(a=s.blockNumber)}),{delay:({count:e})=>200*(1<1&&(!u.blockNumber||a-u.blockNumber+1nn.resolve(u)))}catch(r){if(s&&(r instanceof R_||r instanceof F_))try{c=s,l=!0;const r=await _S((()=>nx(e,kk,"getBlock")({blockNumber:a,includeTransactions:!0})),{delay:({count:e})=>200*(1<e instanceof _k});l=!1;const i=r.transactions.find((({from:e,nonce:t})=>e===c.from&&t===c.nonce));if(!i)return;if(u=await nx(e,EP,"getTransactionReceipt")({hash:i.hash}),t>1&&(!u.blockNumber||a-u.blockNumber+1n{n.onReplaced?.({reason:o,replacedTransaction:c,transaction:i,transactionReceipt:u}),n.resolve(u)}))}catch(e){f((()=>n.reject(e)))}else f((()=>n.reject(r)))}}})}))}))}(e,t),watchBlocks:t=>function(e,{blockTag:t="latest",emitMissed:r=!1,emitOnBegin:n=!1,onBlock:i,onError:o,includeTransactions:a,poll:s,pollingInterval:c=e.pollingInterval}){const u=void 0!==s?s:"webSocket"!==e.transport.type,l=a??!1;let f;return u?nS(I_(["watchBlocks",e.uid,r,n,l,c]),{onBlock:i,onError:o},(i=>oS((async()=>{try{const n=await nx(e,kk,"getBlock")({blockTag:t,includeTransactions:l});if(n.number&&f?.number){if(n.number===f.number)return;if(n.number-f.number>1&&r)for(let t=f?.number+1n;tf.number)&&(i.onBlock(n,f),f=n)}catch(e){i.onError?.(e)}}),{emitOnBegin:n,interval:c}))):(()=>{let t=!0,r=()=>t=!1;return(async()=>{try{const{unsubscribe:n}=await e.transport.subscribe({params:["newHeads"],onData(r){if(!t)return;const n=(e.chain?.formatters?.block?.format||tA)(r.result);i(n,f),f=n},onError(e){o?.(e)}});r=n,t||r()}catch(e){o?.(e)}})(),r})()}(e,t),watchBlockNumber:t=>kP(e,t),watchContractEvent:t=>hS(e,t),watchEvent:t=>function(e,{address:t,args:r,batch:n=!0,event:i,events:o,onError:a,onLogs:s,poll:c,pollingInterval:u=e.pollingInterval,strict:l}){const f=void 0!==c?c:"webSocket"!==e.transport.type,d=l??!1;return f?nS(I_(["watchEvent",t,r,n,e.uid,i,u]),{onLogs:s,onError:a},(a=>{let s,c,l=!1;const f=oS((async()=>{if(l)try{let u;if(c)u=await nx(e,fS,"getFilterChanges")({filter:c});else{const n=await nx(e,lS,"getBlockNumber")({});u=s&&s!==n?await nx(e,Fk,"getLogs")({address:t,args:r,event:i,events:o,fromBlock:s+1n,toBlock:n}):[],s=n}if(0===u.length)return;if(n)a.onLogs(u);else for(const e of u)a.onLogs([e])}catch(e){c&&e instanceof ek&&(l=!1),a.onError?.(e)}else{try{c=await nx(e,XS,"createEventFilter")({address:t,args:r,event:i,events:o,strict:d})}catch{}l=!0}}),{emitOnBegin:!0,interval:u});return async()=>{c&&await nx(e,dS,"uninstallFilter")({filter:c}),f()}})):(()=>{let n=!0,c=()=>n=!1;return(async()=>{try{const u=o??(i?[i]:void 0);let f=[];u&&(f=[u.flatMap((e=>p_({abi:[e],eventName:e.name,args:r})))],i&&(f=f[0]));const{unsubscribe:h}=await e.transport.subscribe({params:["logs",{address:t,topics:f}],onData(e){if(!n)return;const t=e.result;try{const{eventName:e,args:r}=Nk({abi:u,data:t.data,topics:t.topics,strict:d}),n=rA(t,{args:r,eventName:e});s([n])}catch(e){let r,n;if(e instanceof Ex||e instanceof Ax){if(l)return;r=e.abiItem.name,n=e.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}const i=rA(t,{args:n?[]:{},eventName:r});s([i])}},onError(e){a?.(e)}});c=h,n||c()}catch(e){a?.(e)}})(),c})()}(e,t),watchPendingTransactions:t=>function(e,{batch:t=!0,onError:r,onTransactions:n,poll:i,pollingInterval:o=e.pollingInterval}){return(void 0!==i?i:"webSocket"!==e.transport.type)?nS(I_(["watchPendingTransactions",e.uid,t,o]),{onTransactions:n,onError:r},(r=>{let n;const i=oS((async()=>{try{if(!n)try{return void(n=await nx(e,QS,"createPendingTransactionFilter")({}))}catch(e){throw i(),e}const o=await nx(e,fS,"getFilterChanges")({filter:n});if(0===o.length)return;if(t)r.onTransactions(o);else for(const e of o)r.onTransactions([e])}catch(e){r.onError?.(e)}}),{emitOnBegin:!0,interval:o});return async()=>{n&&await nx(e,dS,"uninstallFilter")({filter:n}),i()}})):(()=>{let t=!0,i=()=>t=!1;return(async()=>{try{const{unsubscribe:o}=await e.transport.subscribe({params:["newPendingTransactions"],onData(e){if(!t)return;const r=e.result;n([r])},onError(e){r?.(e)}});i=o,t||i()}catch(e){r?.(e)}})(),i})()}(e,t)}}function PP(e){const{key:t="public",name:r="Public Client"}=e,n=function(e){const{batch:t,cacheTime:r=e.pollingInterval??4e3,key:n="base",name:i="Base Client",pollingInterval:o=4e3,type:a="base"}=e,s=e.chain,c=e.account?y_(e.account):void 0,{config:u,request:l,value:f}=e.transport({chain:s,pollingInterval:o}),d={account:c,batch:t,cacheTime:r,chain:s,key:n,name:i,pollingInterval:o,request:l,transport:{...u,...f},type:a,uid:xS()};return Object.assign(d,{extend:function e(t){return r=>{const n=r(t);for(const e in d)delete n[e];const i={...t,...n};return Object.assign(i,{extend:e(i)})}}(d)})}({...e,key:t,name:r,type:"publicClient"});return n.extend(SP)}BigInt(0),BigInt(1),BigInt(2);const IP=[{inputs:[{internalType:"uint256",name:"preOpGas",type:"uint256"},{internalType:"uint256",name:"paid",type:"uint256"},{internalType:"uint48",name:"validAfter",type:"uint48"},{internalType:"uint48",name:"validUntil",type:"uint48"},{internalType:"bool",name:"targetSuccess",type:"bool"},{internalType:"bytes",name:"targetResult",type:"bytes"}],name:"ExecutionResult",type:"error"},{inputs:[{internalType:"uint256",name:"opIndex",type:"uint256"},{internalType:"string",name:"reason",type:"string"}],name:"FailedOp",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"SenderAddressResult",type:"error"},{inputs:[{internalType:"address",name:"aggregator",type:"address"}],name:"SignatureValidationFailed",type:"error"},{inputs:[{components:[{internalType:"uint256",name:"preOpGas",type:"uint256"},{internalType:"uint256",name:"prefund",type:"uint256"},{internalType:"bool",name:"sigFailed",type:"bool"},{internalType:"uint48",name:"validAfter",type:"uint48"},{internalType:"uint48",name:"validUntil",type:"uint48"},{internalType:"bytes",name:"paymasterContext",type:"bytes"}],internalType:"struct IEntryPoint.ReturnInfo",name:"returnInfo",type:"tuple"},{components:[{internalType:"uint256",name:"stake",type:"uint256"},{internalType:"uint256",name:"unstakeDelaySec",type:"uint256"}],internalType:"struct IStakeManager.StakeInfo",name:"senderInfo",type:"tuple"},{components:[{internalType:"uint256",name:"stake",type:"uint256"},{internalType:"uint256",name:"unstakeDelaySec",type:"uint256"}],internalType:"struct IStakeManager.StakeInfo",name:"factoryInfo",type:"tuple"},{components:[{internalType:"uint256",name:"stake",type:"uint256"},{internalType:"uint256",name:"unstakeDelaySec",type:"uint256"}],internalType:"struct IStakeManager.StakeInfo",name:"paymasterInfo",type:"tuple"}],name:"ValidationResult",type:"error"},{inputs:[{components:[{internalType:"uint256",name:"preOpGas",type:"uint256"},{internalType:"uint256",name:"prefund",type:"uint256"},{internalType:"bool",name:"sigFailed",type:"bool"},{internalType:"uint48",name:"validAfter",type:"uint48"},{internalType:"uint48",name:"validUntil",type:"uint48"},{internalType:"bytes",name:"paymasterContext",type:"bytes"}],internalType:"struct IEntryPoint.ReturnInfo",name:"returnInfo",type:"tuple"},{components:[{internalType:"uint256",name:"stake",type:"uint256"},{internalType:"uint256",name:"unstakeDelaySec",type:"uint256"}],internalType:"struct IStakeManager.StakeInfo",name:"senderInfo",type:"tuple"},{components:[{internalType:"uint256",name:"stake",type:"uint256"},{internalType:"uint256",name:"unstakeDelaySec",type:"uint256"}],internalType:"struct IStakeManager.StakeInfo",name:"factoryInfo",type:"tuple"},{components:[{internalType:"uint256",name:"stake",type:"uint256"},{internalType:"uint256",name:"unstakeDelaySec",type:"uint256"}],internalType:"struct IStakeManager.StakeInfo",name:"paymasterInfo",type:"tuple"},{components:[{internalType:"address",name:"aggregator",type:"address"},{components:[{internalType:"uint256",name:"stake",type:"uint256"},{internalType:"uint256",name:"unstakeDelaySec",type:"uint256"}],internalType:"struct IStakeManager.StakeInfo",name:"stakeInfo",type:"tuple"}],internalType:"struct IEntryPoint.AggregatorStakeInfo",name:"aggregatorInfo",type:"tuple"}],name:"ValidationResultWithAggregation",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"userOpHash",type:"bytes32"},{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"address",name:"factory",type:"address"},{indexed:!1,internalType:"address",name:"paymaster",type:"address"}],name:"AccountDeployed",type:"event"},{anonymous:!1,inputs:[],name:"BeforeExecution",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"totalDeposit",type:"uint256"}],name:"Deposited",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"aggregator",type:"address"}],name:"SignatureAggregatorChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"totalStaked",type:"uint256"},{indexed:!1,internalType:"uint256",name:"unstakeDelaySec",type:"uint256"}],name:"StakeLocked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"withdrawTime",type:"uint256"}],name:"StakeUnlocked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"address",name:"withdrawAddress",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"StakeWithdrawn",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"userOpHash",type:"bytes32"},{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"paymaster",type:"address"},{indexed:!1,internalType:"uint256",name:"nonce",type:"uint256"},{indexed:!1,internalType:"bool",name:"success",type:"bool"},{indexed:!1,internalType:"uint256",name:"actualGasCost",type:"uint256"},{indexed:!1,internalType:"uint256",name:"actualGasUsed",type:"uint256"}],name:"UserOperationEvent",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"userOpHash",type:"bytes32"},{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint256",name:"nonce",type:"uint256"},{indexed:!1,internalType:"bytes",name:"revertReason",type:"bytes"}],name:"UserOperationRevertReason",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"address",name:"withdrawAddress",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Withdrawn",type:"event"},{inputs:[],name:"SIG_VALIDATION_FAILED",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"address",name:"sender",type:"address"},{internalType:"bytes",name:"paymasterAndData",type:"bytes"}],name:"_validateSenderAndPaymaster",outputs:[],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint32",name:"unstakeDelaySec",type:"uint32"}],name:"addStake",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"depositTo",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"deposits",outputs:[{internalType:"uint112",name:"deposit",type:"uint112"},{internalType:"bool",name:"staked",type:"bool"},{internalType:"uint112",name:"stake",type:"uint112"},{internalType:"uint32",name:"unstakeDelaySec",type:"uint32"},{internalType:"uint48",name:"withdrawTime",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"getDepositInfo",outputs:[{components:[{internalType:"uint112",name:"deposit",type:"uint112"},{internalType:"bool",name:"staked",type:"bool"},{internalType:"uint112",name:"stake",type:"uint112"},{internalType:"uint32",name:"unstakeDelaySec",type:"uint32"},{internalType:"uint48",name:"withdrawTime",type:"uint48"}],internalType:"struct IStakeManager.DepositInfo",name:"info",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint192",name:"key",type:"uint192"}],name:"getNonce",outputs:[{internalType:"uint256",name:"nonce",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"initCode",type:"bytes"}],name:"getSenderAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"callGasLimit",type:"uint256"},{internalType:"uint256",name:"verificationGasLimit",type:"uint256"},{internalType:"uint256",name:"preVerificationGas",type:"uint256"},{internalType:"uint256",name:"maxFeePerGas",type:"uint256"},{internalType:"uint256",name:"maxPriorityFeePerGas",type:"uint256"},{internalType:"bytes",name:"paymasterAndData",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct UserOperation",name:"userOp",type:"tuple"}],name:"getUserOpHash",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"callGasLimit",type:"uint256"},{internalType:"uint256",name:"verificationGasLimit",type:"uint256"},{internalType:"uint256",name:"preVerificationGas",type:"uint256"},{internalType:"uint256",name:"maxFeePerGas",type:"uint256"},{internalType:"uint256",name:"maxPriorityFeePerGas",type:"uint256"},{internalType:"bytes",name:"paymasterAndData",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct UserOperation[]",name:"userOps",type:"tuple[]"},{internalType:"contract IAggregator",name:"aggregator",type:"address"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct IEntryPoint.UserOpsPerAggregator[]",name:"opsPerAggregator",type:"tuple[]"},{internalType:"address payable",name:"beneficiary",type:"address"}],name:"handleAggregatedOps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"callGasLimit",type:"uint256"},{internalType:"uint256",name:"verificationGasLimit",type:"uint256"},{internalType:"uint256",name:"preVerificationGas",type:"uint256"},{internalType:"uint256",name:"maxFeePerGas",type:"uint256"},{internalType:"uint256",name:"maxPriorityFeePerGas",type:"uint256"},{internalType:"bytes",name:"paymasterAndData",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct UserOperation[]",name:"ops",type:"tuple[]"},{internalType:"address payable",name:"beneficiary",type:"address"}],name:"handleOps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint192",name:"key",type:"uint192"}],name:"incrementNonce",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"callData",type:"bytes"},{components:[{components:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"callGasLimit",type:"uint256"},{internalType:"uint256",name:"verificationGasLimit",type:"uint256"},{internalType:"uint256",name:"preVerificationGas",type:"uint256"},{internalType:"address",name:"paymaster",type:"address"},{internalType:"uint256",name:"maxFeePerGas",type:"uint256"},{internalType:"uint256",name:"maxPriorityFeePerGas",type:"uint256"}],internalType:"struct EntryPoint.MemoryUserOp",name:"mUserOp",type:"tuple"},{internalType:"bytes32",name:"userOpHash",type:"bytes32"},{internalType:"uint256",name:"prefund",type:"uint256"},{internalType:"uint256",name:"contextOffset",type:"uint256"},{internalType:"uint256",name:"preOpGas",type:"uint256"}],internalType:"struct EntryPoint.UserOpInfo",name:"opInfo",type:"tuple"},{internalType:"bytes",name:"context",type:"bytes"}],name:"innerHandleOp",outputs:[{internalType:"uint256",name:"actualGasCost",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint192",name:"",type:"uint192"}],name:"nonceSequenceNumber",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"callGasLimit",type:"uint256"},{internalType:"uint256",name:"verificationGasLimit",type:"uint256"},{internalType:"uint256",name:"preVerificationGas",type:"uint256"},{internalType:"uint256",name:"maxFeePerGas",type:"uint256"},{internalType:"uint256",name:"maxPriorityFeePerGas",type:"uint256"},{internalType:"bytes",name:"paymasterAndData",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct UserOperation",name:"op",type:"tuple"},{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"targetCallData",type:"bytes"}],name:"simulateHandleOp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"callGasLimit",type:"uint256"},{internalType:"uint256",name:"verificationGasLimit",type:"uint256"},{internalType:"uint256",name:"preVerificationGas",type:"uint256"},{internalType:"uint256",name:"maxFeePerGas",type:"uint256"},{internalType:"uint256",name:"maxPriorityFeePerGas",type:"uint256"},{internalType:"bytes",name:"paymasterAndData",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct UserOperation",name:"userOp",type:"tuple"}],name:"simulateValidation",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unlockStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address payable",name:"withdrawAddress",type:"address"}],name:"withdrawStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address payable",name:"withdrawAddress",type:"address"},{internalType:"uint256",name:"withdrawAmount",type:"uint256"}],name:"withdrawTo",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],TP=e=>{const t=e;return{...t,estimateUserOperationGas:(e,r)=>t.request({method:"eth_estimateUserOperationGas",params:[e,r]}),sendUserOperation:(e,r)=>t.request({method:"eth_sendUserOperation",params:[e,r]}),getUserOperationByHash:e=>t.request({method:"eth_getUserOperationByHash",params:[e]}),getUserOperationReceipt:e=>t.request({method:"eth_getUserOperationReceipt",params:[e]}),getSupportedEntryPoints:()=>t.request({method:"eth_supportedEntryPoints",params:[]}),getMaxPriorityFeePerGas:()=>t.request({method:"eth_maxPriorityFeePerGas",params:[]}),async getFeeData(){const e=await t.getBlock({blockTag:"latest"});if(e&&e.baseFeePerGas){const t=BigInt(15e8);return{maxPriorityFeePerGas:t,maxFeePerGas:e.baseFeePerGas*BigInt(2)+t}}return{maxFeePerGas:0,maxPriorityFeePerGas:0}},getContractCode:async e=>await t.getBytecode({address:e})??"0x"}},OP=({chain:e,rpcUrl:t,fetchOptions:r})=>TP(PP({chain:e,transport:MS(t,{fetchOptions:{...r,headers:{...r?.headers,"Alchemy-AA-Sdk-Version":"0.1.0-alpha.23"}}})}));var MP;!function(e){e[e.DEBUG=4]="DEBUG",e[e.INFO=3]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=1]="ERROR",e[e.NONE=0]="NONE"}(MP||(MP={}));let CP=class{static setLogLevel(e){this.logLevel=e}static setLogFilter(e){this.logFilter=e}static error(e,...t){this.shouldLog(e,MP.ERROR)&&console.error(e,...t)}static warn(e,...t){this.shouldLog(e,MP.WARN)&&console.warn(e,...t)}static debug(e,...t){this.shouldLog(e,MP.DEBUG)&&console.debug(e,...t)}static info(e,...t){this.shouldLog(e,MP.INFO)&&console.info(e,...t)}static shouldLog(e,t){return!(this.logLevel(...n)=>{const{args:o,options:a}=yS(n);return nx(r,Xk,"readContract")({abi:e,address:t,functionName:i,args:o,...a})}})),c&&(a.simulate=new Proxy({},{get:(n,i)=>(...n)=>{const{args:o,options:a}=yS(n);return nx(r,Qk,"simulateContract")({abi:e,address:t,functionName:i,args:o,...a})}})),u&&(a.createEventFilter=new Proxy({},{get:(n,i)=>(...n)=>{const o=e.find((e=>"event"===e.type&&e.name===i)),{args:a,options:s}=vS(n,o);return nx(r,g_,"createContractEventFilter")({abi:e,address:t,eventName:i,args:a,...s})}}),a.getEvents=new Proxy({},{get:(n,i)=>(...n)=>{const o=e.find((e=>"event"===e.type&&e.name===i)),{args:a,options:s}=vS(n,o);return nx(r,Lk,"getContractEvents")({abi:e,address:t,eventName:i,args:a,...s})}}),a.watchEvent=new Proxy({},{get:(n,i)=>(...n)=>{const o=e.find((e=>"event"===e.type&&e.name===i)),{args:a,options:s}=vS(n,o);return nx(r,hS,"watchContractEvent")({abi:e,address:t,eventName:i,args:a,...s})}}))),o&&c&&(a.write=new Proxy({},{get:(r,i)=>(...r)=>{const{args:o,options:a}=yS(r);return nx(n,gS,"writeContract")({abi:e,address:t,functionName:i,args:o,...a})}})),(i||o)&&c&&(a.estimateGas=new Proxy({},{get:(i,o)=>(...i)=>{const{args:a,options:s}=yS(i);return nx(r??n,Ck,"estimateContractGas")({abi:e,address:t,functionName:o,args:a,...s,account:s.account??n.account})}})),a.address=t,a.abi=e,a}({address:e.entryPointAddress,abi:IP,publicClient:this.rpcProvider})}async signMessageWith6492(e){throw new Error("signMessageWith6492 not supported")}async signTypedData(e){throw new Error("signTypedData not supported")}async signTypedDataWith6492(e){throw new Error("signTypedDataWith6492 not supported")}async encodeBatchExecute(e){throw new Error("encodeBatchExecute not supported")}async getNonce(){if(!await this.isAccountDeployed())return 0n;const e=await this.getAddress();return this.entryPoint.read.getNonce([e,BigInt(0)])}async getInitCode(){if(this.deploymentState===BP.DEPLOYED)return"0x";const e=await this.rpcProvider.getContractCode(await this.getAddress());return(e?.length??0)>2?(this.deploymentState=BP.DEPLOYED,"0x"):(this.deploymentState=BP.NOT_DEPLOYED,this.getAccountInitCode())}async getAddress(){if(!this.accountAddress){const e=await this.getAccountInitCode();CP.debug("[BaseSmartContractAccount](getAddress) initCode: ",e);try{await this.entryPoint.simulate.getSenderAddress([e])}catch(e){if(CP.debug("[BaseSmartContractAccount](getAddress) entrypoint.getSenderAddress result: ",e),"SenderAddressResult"===e.cause?.data?.errorName)return this.accountAddress=e.cause.data.args[0],this.accountAddress}throw new Error("getCounterFactualAddress failed")}return this.accountAddress}async isAccountDeployed(){return await this.getDeploymentState()===BP.DEPLOYED}async getDeploymentState(){if(this.deploymentState===BP.UNDEFINED){return"0x"===await this.getInitCode()?BP.DEPLOYED:BP.NOT_DEPLOYED}return this.deploymentState}}const RP=({factoryAddress:e,initCode:t,signature:r})=>OA([a_(rx("address, bytes, bytes"),[e,t,r]),"0x6492649264926492649264926492649264926492649264926492649264926492"]);var FP={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,o||e,a),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);iasync t=>{let r=t;for(const t of e)r=await t(r);return r};async function UP(e){const t=Object.keys(e).map((t=>{const r=e[t];return Promise.resolve(r).then((e=>({key:t,value:e})))}));return(await Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}function DP(e){if("function"!=typeof e)return null==e||"string"==typeof e||"boolean"==typeof e?e:"bigint"==typeof e?RE(e):null!=e._isBigNumber||"object"!=typeof e?RE(e).replace(/^0x0/,"0x"):Array.isArray(e)?e.map((e=>DP(e))):Object.keys(e).reduce(((t,r)=>({...t,[r]:DP(e[r])})),{})}function zP(e,t,r){const n=a_([{type:"bytes32"},{type:"address"},{type:"uint256"}],[t_($P(e)),t,r]);return t_(n)}function $P(e){const t=t_(e.initCode),r=t_(e.callData),n=t_(e.paymasterAndData);return a_([{type:"address"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"bytes32"}],[e.sender,JE(e.nonce),t,r,JE(e.callGasLimit),JE(e.verificationGasLimit),JE(e.preVerificationGas),JE(e.maxFeePerGas),JE(e.maxPriorityFeePerGas),n])}function HP(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}const GP=async e=>e,qP=new Map([[wE.id,10000000n],[EE.id,10000000n]]);class KP extends LP{constructor(e,t,r,n,i){super(),Object.defineProperty(this,"entryPointAddress",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"chain",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"account",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"txMaxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"txRetryIntervalMs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"txRetryMulitplier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"minPriorityFeePerBid",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rpcClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{const{method:t,params:r}=e;switch(t){case"eth_sendTransaction":const[t]=r;return this.sendTransaction(t);case"eth_sign":case"personal_sign":const[n,i]=r;if(i!==await this.getAddress())throw new Error("cannot sign for address that is not the current account");return this.signMessage(n);default:return this.rpcClient.request(e)}}}),Object.defineProperty(this,"getAddress",{enumerable:!0,configurable:!0,writable:!0,value:()=>{if(!this.account)throw new Error("account not connected!");return this.account.getAddress()}}),Object.defineProperty(this,"sendTransaction",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{if(!e.to)throw new Error("transaction is missing to address");const t={};e.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),e.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas);const{hash:r}=await this.sendUserOperation({target:e.to,data:e.data??"0x",value:e.value?WE(e.value,"bigint"):0n},t);return await this.waitForUserOperationTransaction(r)}}),Object.defineProperty(this,"signMessage",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{if(!this.account)throw new Error("account not connected!");return this.account.signMessage(e)}}),Object.defineProperty(this,"signTypedData",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{if(!this.account)throw new Error("account not connected!");return this.account.signTypedData(e)}}),Object.defineProperty(this,"sendTransactions",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{const t=e.map((e=>{if(!e.to)throw new Error("one transaction in the batch is missing a target address");return{target:e.to,data:e.data??"0x",value:e.value?WE(e.value,"bigint"):0n}})),r=(...e)=>{if(e.length)return e.reduce(((e,t)=>e>t?e:t))},n=r(...e.filter((e=>null!=e.maxFeePerGas)).map((e=>WE(e.maxFeePerGas,"bigint")))),i=r(...e.filter((e=>null!=e.maxPriorityFeePerGas)).map((e=>WE(e.maxPriorityFeePerGas,"bigint")))),o={};null!=n&&(o.maxFeePerGas=n),null!=i&&(o.maxPriorityFeePerGas=i);const{hash:a}=await this.sendUserOperation(t,o);return await this.waitForUserOperationTransaction(a)}}),Object.defineProperty(this,"waitForUserOperationTransaction",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{for(let t=0;tsetTimeout(e,r)));const n=await this.getUserOperationReceipt(e).catch((()=>null));if(n)return this.getTransaction(n.receipt.transactionHash).then((e=>e.hash))}throw new Error("Failed to find transaction for User Operation")}}),Object.defineProperty(this,"getUserOperationByHash",{enumerable:!0,configurable:!0,writable:!0,value:e=>this.rpcClient.getUserOperationByHash(e)}),Object.defineProperty(this,"getUserOperationReceipt",{enumerable:!0,configurable:!0,writable:!0,value:e=>this.rpcClient.getUserOperationReceipt(e)}),Object.defineProperty(this,"getTransaction",{enumerable:!0,configurable:!0,writable:!0,value:e=>this.rpcClient.getTransaction({hash:e})}),Object.defineProperty(this,"sendUserOperation",{enumerable:!0,configurable:!0,writable:!0,value:async(e,t)=>{if(!this.account)throw new Error("account not connected!");const r=await this.account.getInitCode(),n=await jP(this.dummyPaymasterDataMiddleware,this.feeDataGetter,this.gasEstimator,this.paymasterDataMiddleware,this.customMiddleware??GP,(async e=>({...e,...t})))({initCode:r,sender:this.getAddress(),nonce:this.account.getNonce(),callData:Array.isArray(e)?this.account.encodeBatchExecute(e):this.account.encodeExecute(e.target,e.value??0n,e.data),signature:this.account.getDummySignature()}),i=DP(await UP(n));if(!function(e){return!!(e.callGasLimit&&e.maxFeePerGas&&null!=e.maxPriorityFeePerGas&&e.preVerificationGas&&e.verificationGasLimit)}(i))throw new Error(`Request is missing parameters. All properties on UserOperationStruct must be set. uo: ${JSON.stringify(i,null,2)}`);return i.signature=await this.account.signMessage(zP(i,this.entryPointAddress,BigInt(this.chain.id))),{hash:await this.rpcClient.sendUserOperation(i,this.entryPointAddress),request:i}}}),Object.defineProperty(this,"dummyPaymasterDataMiddleware",{enumerable:!0,configurable:!0,writable:!0,value:async e=>(e.paymasterAndData="0x",e)}),Object.defineProperty(this,"paymasterDataMiddleware",{enumerable:!0,configurable:!0,writable:!0,value:async e=>(e.paymasterAndData="0x",e)}),Object.defineProperty(this,"gasEstimator",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{const t=DP(await UP(e)),r=await this.rpcClient.estimateUserOperationGas(t,this.entryPointAddress);return e.callGasLimit=r.callGasLimit,e.verificationGasLimit=r.verificationGasLimit,e.preVerificationGas=r.preVerificationGas,e}}),Object.defineProperty(this,"feeDataGetter",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{const t=await this.rpcClient.getMaxPriorityFeePerGas(),r=await this.rpcClient.getFeeData();if(!r.maxFeePerGas||!r.maxPriorityFeePerGas)throw new Error("feeData is missing maxFeePerGas or maxPriorityFeePerGas");let n=4n*BigInt(t)/3n;n{HP(this,"dummyPaymasterDataMiddleware",e.dummyPaymasterDataMiddleware?this.overrideMiddlewareFunction(e.dummyPaymasterDataMiddleware):this.dummyPaymasterDataMiddleware);return HP(this,"paymasterDataMiddleware",e.paymasterDataMiddleware?this.overrideMiddlewareFunction(e.paymasterDataMiddleware):this.paymasterDataMiddleware),this}}),Object.defineProperty(this,"withGasEstimator",{enumerable:!0,configurable:!0,writable:!0,value:e=>(HP(this,"gasEstimator",this.overrideMiddlewareFunction(e)),this)}),Object.defineProperty(this,"withFeeDataGetter",{enumerable:!0,configurable:!0,writable:!0,value:e=>(HP(this,"feeDataGetter",this.overrideMiddlewareFunction(e)),this)}),Object.defineProperty(this,"withCustomMiddleware",{enumerable:!0,configurable:!0,writable:!0,value:e=>(HP(this,"customMiddleware",e),this)}),Object.defineProperty(this,"overrideMiddlewareFunction",{enumerable:!0,configurable:!0,writable:!0,value:e=>async t=>({...t,...await e(t)})}),this.txMaxRetries=i?.txMaxRetries??5,this.txRetryIntervalMs=i?.txRetryIntervalMs??2e3,this.txRetryMulitplier=i?.txRetryMulitplier??1.5,this.minPriorityFeePerBid=i?.minPriorityFeePerBid??qP.get(r.id)??100000000n,this.rpcClient="string"==typeof e?OP({chain:r,rpcUrl:e}):e}signMessageWith6492(e){if(!this.account)throw new Error("account not connected!");return this.account.signMessageWith6492(e)}signTypedDataWith6492(e){if(!this.account)throw new Error("account not connected!");return this.account.signTypedDataWith6492(e)}connect(e){const t=e(this.rpcClient);return HP(this,"account",t),this.emit("connect",{chainId:RE(this.chain.id)}),t.getAddress().then((e=>this.emit("accountsChanged",[e]))),this}disconnect(){return this.account&&(this.emit("disconnect"),this.emit("accountsChanged",[])),HP(this,"account",void 0),this}isConnected(){return void 0!==this.account}}let VP=class e extends Error{constructor(t,r={}){const n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,i=r.cause instanceof e&&r.cause.docsPath||r.docsPath;super([t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...i?[`Docs: https://abitype.dev${i}`]:[],...n?[`Details: ${n}`]:[],"Version: abitype@0.9.8"].join("\n")),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.shortMessage=t}};function WP(e,t){const r=e.exec(t);return r?.groups}const JP=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ZP=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,YP=/^\(.+?\).*?$/,XP=/^tuple(?(\[(\d*)\])*)$/;function QP(e){let t=e.type;if(XP.test(e.type)&&"components"in e){t="(";const r=e.components.length;for(let n=0;n[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function rI(e){return tI.test(e)}function nI(e){return WP(tI,e)}const iI=new Set(["memory","indexed","storage","calldata"]),oI=new Set(["calldata","memory","storage"]);let aI=class extends VP{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}},sI=class extends VP{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}};class cI extends VP{constructor({params:e}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(e,null,2)})`,docsPath:"/api/human.html#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}let uI=class extends VP{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}},lI=class extends VP{constructor({param:e,name:t}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${t}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}},fI=class extends VP{constructor({param:e,type:t,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${t?` in "${t}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}},dI=class extends VP{constructor({param:e,type:t,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${t?` in "${t}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}},hI=class extends VP{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}},pI=class extends VP{constructor({signature:e,type:t}){super(`Invalid ${t} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}},mI=class extends VP{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}},bI=class extends VP{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}},gI=class extends VP{constructor({current:e,depth:t}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${t>0?"opening":"closing"} parentheses.`],details:`Depth "${t}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}};const yI=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]),vI=/^(?[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,wI=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,EI=/^u?int$/;function AI(e,t){const r=function(e,t){return t?`${t}:${e}`:e}(e,t?.type);if(yI.has(r))return yI.get(r);const n=YP.test(e),i=WP(n?wI:vI,e);if(!i)throw new uI({param:e});if(i.name&&function(e){return"address"===e||"bool"===e||"function"===e||"string"===e||"tuple"===e||JP.test(e)||ZP.test(e)||kI.test(e)}(i.name))throw new lI({param:e,name:i.name});const o=i.name?{name:i.name}:{},a="indexed"===i.modifier?{indexed:!0}:{},s=t?.structs??{};let c,u={};if(n){c="tuple";const e=xI(i.type),t=[],r=e.length;for(let n=0;n[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function PI(e,t,r=new Set){const n=[],i=e.length;for(let o=0;oe[t.name||r]?.(n)??t(e,n)}function OI(e,{includeName:t=!1}={}){if("function"!==e.type&&"event"!==e.type&&"error"!==e.type)throw new nT(e.type);return`${e.name}(${MI(e.inputs,{includeName:t})})`}function MI(e,{includeName:t=!1}={}){return e?e.map((e=>function(e,{includeName:t}){if(e.type.startsWith("tuple"))return`(${MI(e.components,{includeName:t})})${e.type.slice(5)}`;return e.type+(t&&e.name?` ${e.name}`:"")}(e,{includeName:t}))).join(t?", ":","):""}function CI(e,{strict:t=!0}={}){return!!e&&("string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")))}function BI(e){return CI(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}let NI=class e extends Error{constructor(t,r={}){super(),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ViemError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"viem@1.21.3"});const n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,i=r.cause instanceof e&&r.cause.docsPath||r.docsPath;this.message=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...i?[`Docs: https://viem.sh${i}.html${r.docsSlug?`#${r.docsSlug}`:""}`]:[],...n?[`Details: ${n}`]:[],`Version: ${this.version}`].join("\n"),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.shortMessage=t}walk(e){return RI(this,e)}};function RI(e,t){return t?.(e)?e:e&&"object"==typeof e&&"cause"in e?RI(e.cause,t):t?null:e}let FI=class extends NI{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join("\n"),{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorNotFoundError"})}},LI=class extends NI{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join("\n"),{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorParamsNotFoundError"})}},jI=class extends NI{constructor({data:e,params:t,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join("\n"),{metaMessages:[`Params: (${MI(t,{includeName:!0})})`,`Data: ${e} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=t,this.size=r}},UI=class extends NI{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingZeroDataError"})}},DI=class extends NI{constructor({expectedLength:e,givenLength:t,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${e}`,`Given length: ${t}`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingArrayLengthMismatchError"})}},zI=class extends NI{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${BI(t)}) does not match expected size (bytes${e}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingBytesSizeMismatchError"})}},$I=class extends NI{constructor({expectedLength:e,givenLength:t}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${t}`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingLengthMismatchError"})}},HI=class extends NI{constructor(e,{docsPath:t}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}},GI=class extends NI{constructor({docsPath:e}){super("Cannot extract event signature from empty topics.",{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureEmptyTopicsError"})}},qI=class extends NI{constructor(e,{docsPath:t}){super([`Encoded event signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureNotFoundError"})}},KI=class extends NI{constructor(e,{docsPath:t}={}){super([`Event ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventNotFoundError"})}},VI=class extends NI{constructor(e,{docsPath:t}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionNotFoundError"})}},WI=class extends NI{constructor(e,{docsPath:t}){super([`Function "${e}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionOutputsNotFoundError"})}};class JI extends NI{constructor(e,{docsPath:t}){super([`Encoded function signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionSignatureNotFoundError"})}}let ZI=class extends NI{constructor(e,t){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${OI(e.abiItem)}\`, and`,`\`${t.type}\` in \`${OI(t.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItemAmbiguityError"})}},YI=class extends NI{constructor({expectedSize:e,givenSize:t}){super(`Expected bytes${e}, got bytes${t}.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BytesSizeMismatchError"})}},XI=class extends NI{constructor({abiItem:e,data:t,params:r,size:n}){super([`Data size of ${n} bytes is too small for non-indexed event parameters.`].join("\n"),{metaMessages:[`Params: (${MI(r,{includeName:!0})})`,`Data: ${t} (${n} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e,this.data=t,this.params=r,this.size=n}},QI=class extends NI{constructor({abiItem:e,param:t}){super([`Expected a topic for indexed event parameter${t.name?` "${t.name}"`:""} on event "${OI(e,{includeName:!0})}".`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e}},eT=class extends NI{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiEncodingType"})}},tT=class extends NI{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiDecodingType"})}},rT=class extends NI{constructor(e){super([`Value "${e}" is not a valid array.`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidArrayError"})}},nT=class extends NI{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidDefinitionTypeError"})}};class iT extends NI{constructor(e){super(`Type "${e}" is not supported for packed encoding.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedPackedAbiType"})}}let oT=class extends NI{constructor(e){super(`Filter type "${e}" is not supported.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FilterTypeNotSupportedError"})}},aT=class extends NI{constructor({offset:e,position:t,size:r}){super(`Slice ${"start"===t?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${r}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SliceOffsetOutOfBoundsError"})}},sT=class extends NI{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeExceedsPaddingSizeError"})}};function cT(e,{dir:t,size:r=32}={}){return"string"==typeof e?uT(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new sT({size:e.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;i2*r)throw new sT({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n["right"===t?"padEnd":"padStart"](2*r,"0")}`}let lT=class extends NI{constructor({max:e,min:t,signed:r,size:n,value:i}){super(`Number "${i}" is not in safe ${n?`${8*n}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntegerOutOfRangeError"})}},fT=class extends NI{constructor(e){super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidBytesBooleanError"})}};class dT extends NI{constructor(e){super(`Hex value "${e}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidHexBooleanError"})}}let hT=class extends NI{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeOverflowError"})}};function pT(e,{dir:t="left"}={}){let r="string"==typeof e?e.replace("0x",""):e,n=0;for(let e=0;et)throw new hT({givenSize:BI(e),maxSize:t})}function bT(e,t){const r={to:t},n=r.to;return"number"===n?vT(e,r):"bigint"===n?gT(e,r):"string"===n?wT(e,r):"boolean"===n?yT(e,r):CT(e,r)}function gT(e,t={}){const{signed:r}=t;t.size&&mT(e,{size:t.size});const n=BigInt(e);if(!r)return n;const i=(e.length-2)/2;return n<=(1n<<8n*BigInt(i)-1n)-1n?n:n-BigInt(`0x${"f".padStart(2*i,"f")}`)-1n}function yT(e,t={}){let r=e;if(t.size&&(mT(r,{size:t.size}),r=pT(r)),"0x00"===pT(r))return!1;if("0x01"===pT(r))return!0;throw new dT(r)}function vT(e,t={}){return Number(gT(e,t))}function wT(e,t={}){let r=CT(e);return t.size&&(mT(r,{size:t.size}),r=pT(r,{dir:"right"})),(new TextDecoder).decode(r)}const ET=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function AT(e,t={}){return"number"==typeof e||"bigint"==typeof e?kT(e,t):"string"==typeof e?PT(e,t):"boolean"==typeof e?xT(e,t):_T(e,t)}function xT(e,t={}){const r=`0x${Number(e)}`;return"number"==typeof t.size?(mT(r,{size:t.size}),cT(r,{size:t.size})):r}function _T(e,t={}){let r="";for(let t=0;to||i=OT.zero&&e<=OT.nine?e-OT.zero:e>=OT.A&&e<=OT.F?e-(OT.A-10):e>=OT.a&&e<=OT.f?e-(OT.a-10):void 0}function CT(e,t={}){let r=e;t.size&&(mT(r,{size:t.size}),r=cT(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,o=new Uint8Array(i);for(let e=0,t=0;e{var t;return function(e){let t=!0,r="",n=0,i="",o=!1;for(let a=0;a0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function LT(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function jT(e,t){FT(e);const r=t.outputLen;if(e.length>DT&UT)}:{h:0|Number(e>>DT&UT),l:0|Number(e&UT)}}function $T(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;ie instanceof Uint8Array,qT=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),KT=(e,t)=>e<<32-t|e>>>t;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function VT(e){if("string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),!GT(e))throw new Error("expected Uint8Array, got "+typeof e);return e}let WT=class{clone(){return this._cloneInto()}};function JT(e){const t=t=>e().update(VT(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function ZT(e=32){if(HT&&"function"==typeof HT.getRandomValues)return HT.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}const[YT,XT,QT]=[[],[],[]],eO=BigInt(0),tO=BigInt(1),rO=BigInt(2),nO=BigInt(7),iO=BigInt(256),oO=BigInt(113);for(let e=0,t=tO,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],YT.push(2*(5*n+r)),XT.push((e+1)*(e+2)/2%64);let i=eO;for(let e=0;e<7;e++)t=(t<>nO)*oO)%iO,t&rO&&(i^=tO<<(tO<r>32?((e,t,r)=>t<>>64-r)(e,t,r):((e,t,r)=>e<>>32-r)(e,t,r),uO=(e,t,r)=>r>32?((e,t,r)=>e<>>64-r)(e,t,r):((e,t,r)=>t<>>32-r)(e,t,r);let lO=class e extends WT{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,RT(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)))(this.state)}keccak(){!function(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,o=r[i],a=r[i+1],s=cO(o,a,1)^r[n],c=uO(o,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=s,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=XT[r],o=cO(t,i,n),a=uO(t,i,n),s=YT[r];t=e[s],i=e[s+1],e[s]=o,e[s+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=aO[n],e[1]^=sO[n]}r.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){LT(this);const{blockLen:t,state:r}=this,n=(e=VT(e)).length;for(let i=0;i=r&&this.keccak();const o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return RT(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(jT(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:r,suffix:n,outputLen:i,rounds:o,enableXOF:a}=this;return t||(t=new e(r,n,i,a,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=n,t.outputLen=i,t.enableXOF=a,t.destroyed=this.destroyed,t}};const fO=((e,t,r)=>JT((()=>new lO(t,e,r))))(1,136,32);function dO(e,t){const r=t||"hex",n=fO(CI(e,{strict:!1})?TT(e):e);return"bytes"===r?n:AT(n)}const hO=e=>(e=>dO(TT(e)))((e=>NT(e))(e));let pO=class extends NI{constructor({address:e}){super(`Address "${e}" is invalid.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAddressError"})}};const mO=/^0x[a-fA-F0-9]{40}$/;function bO(e){return mO.test(e)}function gO(e){return"string"==typeof e[0]?yO(e):function(e){let t=0;for(const r of e)t+=r.length;const r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}(e)}function yO(e){return`0x${e.reduce(((e,t)=>e+t.replace("0x","")),"")}`}function vO(e,t,r,{strict:n}={}){return CI(e,{strict:!1})?function(e,t,r,{strict:n}={}){wO(e,t);const i=`0x${e.replace("0x","").slice(2*(t??0),2*(r??e.length))}`;n&&EO(i,t,r);return i}(e,t,r,{strict:n}):function(e,t,r,{strict:n}={}){wO(e,t);const i=e.slice(t,r);n&&EO(i,t,r);return i}(e,t,r,{strict:n})}function wO(e,t){if("number"==typeof t&&t>0&&t>BI(e)-1)throw new aT({offset:t,position:"start",size:BI(e)})}function EO(e,t,r){if("number"==typeof t&&"number"==typeof r&&BI(e)!==r-t)throw new aT({offset:r,position:"end",size:BI(e)})}function AO(e,t){if(e.length!==t.length)throw new $I({expectedLength:e.length,givenLength:t.length});const r=function({params:e,values:t}){const r=[];for(let n=0;n0?gO([t,e]):t}}if(i)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:gO(o.map((({encoded:e})=>e)))}}(t,{length:n,param:{...e,type:i}})}if("tuple"===e.type)return function(e,{param:t}){let r=!1;const n=[];for(let i=0;ie)))}}(t,{param:e});if("address"===e.type)return function(e){if(!bO(e))throw new pO({address:e});return{dynamic:!1,encoded:uT(e.toLowerCase())}}(t);if("bool"===e.type)return function(e){return{dynamic:!1,encoded:uT(xT(e))}}(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){return function(e,{signed:t}){return{dynamic:!1,encoded:kT(e,{size:32,signed:t})}}(t,{signed:e.type.startsWith("int")})}if(e.type.startsWith("bytes"))return function(e,{param:t}){const[,r]=t.type.split("bytes"),n=BI(e);if(!r){let t=e;return n%32!=0&&(t=uT(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:gO([uT(kT(n,{size:32})),t])}}if(n!==parseInt(r))throw new zI({expectedSize:parseInt(r),value:e});return{dynamic:!1,encoded:uT(e,{dir:"right"})}}(t,{param:e});if("string"===e.type)return function(e){const t=PT(e),r=Math.ceil(BI(t)/32),n=[];for(let e=0;evO((e=>dO(TT(e)))(NT(e)),0,4);function PO({abi:e,args:t=[],name:r}){const n=CI(r,{strict:!1}),i=e.filter((e=>n?"function"===e.type?SO(e)===r:"event"===e.type&&hO(e)===r:"name"in e&&e.name===r));if(0===i.length)return;if(1===i.length)return i[0];let o;for(const e of i){if(!("inputs"in e))continue;if(!t||0===t.length){if(!e.inputs||0===e.inputs.length)return e;continue}if(!e.inputs)continue;if(0===e.inputs.length)continue;if(e.inputs.length!==t.length)continue;const r=t.every(((t,r)=>{const n="inputs"in e&&e.inputs[r];return!!n&&IO(t,n)}));if(r){if(o&&"inputs"in o&&o.inputs){const r=TO(e.inputs,o.inputs,t);if(r)throw new ZI({abiItem:e,type:r[0]},{abiItem:o,type:r[1]})}o=e}}return o||i[0]}function IO(e,t){const r=typeof e,n=t.type;switch(n){case"address":return bO(e);case"bool":return"boolean"===r;case"function":case"string":return"string"===r;default:return"tuple"===n&&"components"in t?Object.values(t.components).every(((t,r)=>IO(Object.values(e)[r],t))):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?"number"===r||"bigint"===r:/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?"string"===r||e instanceof Uint8Array:!!/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)&&(Array.isArray(e)&&e.every((e=>IO(e,{...t,type:n.replace(/(\[[0-9]{0,}\])$/,"")}))))}}function TO(e,t,r){for(const n in e){const i=e[n],o=t[n];if("tuple"===i.type&&"tuple"===o.type&&"components"in i&&"components"in o)return TO(i.components,o.components,r[n]);const a=[i.type,o.type];if(!(!a.includes("address")||!a.includes("bytes20"))||(a.includes("address")&&a.includes("string")||!(!a.includes("address")||!a.includes("bytes")))&&bO(r[n]))return a}}function OO({abi:e,eventName:t,args:r}){let n=e[0];if(t&&(n=PO({abi:e,args:r,name:t}),!n))throw new KI(t,{docsPath:"/docs/contract/encodeEventTopics"});if("event"!==n.type)throw new KI(void 0,{docsPath:"/docs/contract/encodeEventTopics"});const i=OI(n),o=hO(i);let a=[];if(r&&"inputs"in n){const e=n.inputs?.filter((e=>"indexed"in e&&e.indexed)),t=Array.isArray(r)?r:Object.values(r).length>0?e?.map((e=>r[e.name]))??[]:[];t.length>0&&(a=e?.map(((e,r)=>Array.isArray(t[r])?t[r].map(((n,i)=>MO({param:e,value:t[r][i]}))):t[r]?MO({param:e,value:t[r]}):null))??[])}return[o,...a]}function MO({param:e,value:t}){if("string"===e.type||"bytes"===e.type)return dO(TT(t));if("tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/))throw new oT(e.type);return AO([e],[t])}function CO(e,{method:t}){const r={};return"fallback"===e.transport.type&&e.transport.onResponse?.((({method:e,response:n,status:i,transport:o})=>{"success"===i&&t===e&&(r[n]=o.request)})),t=>r[t]||e.request}async function BO(e,{address:t,abi:r,args:n,eventName:i,fromBlock:o,strict:a,toBlock:s}){const c=CO(e,{method:"eth_newFilter"}),u=i?OO({abi:r,args:n,eventName:i}):void 0,l=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:"bigint"==typeof o?kT(o):o,toBlock:"bigint"==typeof s?kT(s):s,topics:u}]});return{abi:r,args:n,eventName:i,id:l,request:c(l),strict:a,type:"event"}}function NO(e){return"string"==typeof e?{address:e,type:"json-rpc"}:e}function RO({abi:e,args:t,functionName:r}){let n=e[0];if(r&&(n=PO({abi:e,args:t,name:r}),!n))throw new VI(r,{docsPath:"/docs/contract/encodeFunctionData"});if("function"!==n.type)throw new VI(void 0,{docsPath:"/docs/contract/encodeFunctionData"});const i=OI(n);return yO([SO(i),("inputs"in n&&n.inputs?AO(n.inputs,t??[]):void 0)??"0x"])}const FO={1:"An `assert` condition failed.",17:"Arithmic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},LO={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},jO={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function UO(e,t){const r=e.substring(2).toLowerCase(),n=dO(BT(r),"bytes"),i=r.split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(15&n[e>>1])>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());return`0x${i.join("")}`}function DO(e,t){if("0x"===t&&e.length>0)throw new UI;if(BI(t)&&BI(t)<32)throw new jI({data:t,params:e,size:BI(t)});return function({data:e,params:t}){const r=[];let n=0;for(let i=0;i=BI(e))throw new jI({data:e,params:t,size:BI(e)});const o=t[i],{consumed:a,value:s}=zO({data:e,param:o,position:n});r.push(s),n+=a}return r}({data:t,params:e})}function zO({data:e,param:t,position:r}){const n=kO(t.type);if(n){const[i,o]=n;return function(e,{param:t,length:r,position:n}){if(!r){const r=vT(vO(e,n,n+32,{strict:!0})),i=vT(vO(e,r,r+32,{strict:!0}));let o=0;const a=[];for(let n=0;n!e)),i=n?[]:{};let o=0;if($O(t)){const a=vT(vO(e,r,r+32,{strict:!0}));for(let r=0;r48?gT(e,{signed:r}):vT(e,{signed:r})}}(i,{param:t});if("address"===t.type)return function(e){return{consumed:32,value:UO(vO(e,-20))}}(i);if("bool"===t.type)return function(e){return{consumed:32,value:yT(e)}}(i);throw new tT(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}function $O(e){const{type:t}=e;if("string"===t)return!0;if("bytes"===t)return!0;if(t.endsWith("[]"))return!0;if("tuple"===t)return e.components?.some($O);const r=kO(e.type);return!(!r||!$O({...e,type:r[1]}))}function HO({abi:e,data:t}){const r=vO(t,0,4);if("0x"===r)throw new UI;const n=[...e||[],LO,jO].find((e=>"error"===e.type&&r===SO(OI(e))));if(!n)throw new HI(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:n,args:"inputs"in n&&n.inputs&&n.inputs.length>0?DO(n.inputs,vO(t,4)):void 0,errorName:n.name}}const GO=(e,t,r)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),r);function qO({abiItem:e,args:t,includeFunctionName:r=!0,includeName:n=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${r?e.name:""}(${e.inputs.map(((e,r)=>`${n&&e.name?`${e.name}: `:""}${"object"==typeof t[r]?GO(t[r]):t[r]}`)).join(", ")})`}const KO={gwei:9,wei:18},VO={ether:-9,wei:9};function WO(e,t){let r=e.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(t,"0");let[i,o]=[r.slice(0,r.length-t),r.slice(r.length-t)];return o=o.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${o?`.${o}`:""}`}function JO(e,t="wei"){return WO(e,KO[t])}function ZO(e,t="wei"){return WO(e,VO[t])}function YO(e){const t=Object.entries(e).map((([e,t])=>void 0===t||!1===t?null:[e,t])).filter(Boolean),r=t.reduce(((e,[t])=>Math.max(e,t.length)),0);return t.map((([e,t])=>` ${`${e}:`.padEnd(r+1)} ${t}`)).join("\n")}let XO=class extends NI{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeConflictError"})}};class QO extends NI{constructor({v:e}){super(`Invalid \`v\` value "${e}". Expected 27 or 28.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidLegacyVError"})}}let eM=class extends NI{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",YO(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- a Legacy Transaction with `gasPrice`"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSerializableTransactionError"})}};class tM extends NI{constructor({storageKey:e}){super(`Size for storage key "${e}" is invalid. Expected 32 bytes. Got ${Math.floor((e.length-2)/2)} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStorageKeySizeError"})}}let rM=class extends NI{constructor({blockHash:e,blockNumber:t,blockTag:r,hash:n,index:i}){let o="Transaction";r&&void 0!==i&&(o=`Transaction at block time "${r}" at index "${i}"`),e&&void 0!==i&&(o=`Transaction at block hash "${e}" at index "${i}"`),t&&void 0!==i&&(o=`Transaction at block number "${t}" at index "${i}"`),n&&(o=`Transaction with hash "${n}"`),super(`${o} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionNotFoundError"})}},nM=class extends NI{constructor({hash:e}){super(`Transaction receipt with hash "${e}" could not be found. The Transaction may not be processed on a block yet.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionReceiptNotFoundError"})}},iM=class extends NI{constructor({hash:e}){super(`Timed out while waiting for transaction with hash "${e}" to be confirmed.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WaitForTransactionReceiptTimeoutError"})}},oM=class extends NI{constructor(e,{account:t,docsPath:r,chain:n,data:i,gas:o,gasPrice:a,maxFeePerGas:s,maxPriorityFeePerGas:c,nonce:u,to:l,value:f}){const d=t?NO(t):void 0,h=YO({from:d?.address,to:l,value:void 0!==f&&`${JO(f)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:o,gasPrice:void 0!==a&&`${ZO(a)} gwei`,maxFeePerGas:void 0!==s&&`${ZO(s)} gwei`,maxPriorityFeePerGas:void 0!==c&&`${ZO(c)} gwei`,nonce:u});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Raw Call Arguments:",h].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CallExecutionError"}),this.cause=e}},aM=class extends NI{constructor(e,{abi:t,args:r,contractAddress:n,docsPath:i,functionName:o,sender:a}){const s=PO({abi:t,args:r,name:o}),c=s?qO({abiItem:s,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=YO({address:n&&n,function:s?OI(s,{includeName:!0}):void 0,args:c&&"()"!==c&&`${[...Array(o?.length??0).keys()].map((()=>" ")).join("")}${c}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:i,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Contract Call:",u].filter(Boolean)}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionExecutionError"}),this.abi=t,this.args=r,this.cause=e,this.contractAddress=n,this.functionName=o,this.sender=a}},sM=class extends NI{constructor({abi:e,data:t,functionName:r,message:n}){let i,o,a,s,c;if(t&&"0x"!==t)try{o=HO({abi:e,data:t});const{abiItem:r,errorName:n,args:i}=o;if("Error"===n)s=i[0];else if("Panic"===n){const[e]=i;s=FO[e]}else{const e=r?OI(r,{includeName:!0}):void 0,t=r&&i?qO({abiItem:r,args:i,includeFunctionName:!1,includeName:!1}):void 0;a=[e?`Error: ${e}`:"",t&&"()"!==t?` ${[...Array(n?.length??0).keys()].map((()=>" ")).join("")}${t}`:""]}}catch(e){i=e}else n&&(s=n);i instanceof HI&&(c=i.signature,a=[`Unable to decode signature "${c}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${c}.`]),super(s&&"execution reverted"!==s||c?[`The contract function "${r}" reverted with the following ${c?"signature":"reason"}:`,s||c].join("\n"):`The contract function "${r}" reverted.`,{cause:i,metaMessages:a}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.reason=s,this.signature=c}},cM=class extends NI{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionZeroDataError"})}},uM=class extends NI{constructor({data:e,message:t}){super(t||""),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RawContractError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}},lM=class extends NI{constructor({body:e,details:t,headers:r,status:n,url:i}){super("HTTP request failed.",{details:t,metaMessages:[n&&`Status: ${n}`,`URL: ${i}`,e&&`Request body: ${GO(e)}`].filter(Boolean)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=r,this.status=n,this.url=i}};class fM extends NI{constructor({body:e,details:t,url:r}){super("WebSocket request failed.",{details:t,metaMessages:[`URL: ${r}`,`Request body: ${GO(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WebSocketRequestError"})}}let dM=class extends NI{constructor({body:e,error:t,url:r}){super("RPC Request failed.",{cause:t,details:t.message,metaMessages:[`URL: ${r}`,`Request body: ${GO(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code}},hM=class extends NI{constructor({body:e,url:t}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${t}`,`Request body: ${GO(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TimeoutError"})}};let pM=class extends NI{constructor(e,{code:t,docsPath:r,metaMessages:n,shortMessage:i}){super(i,{cause:e,docsPath:r,metaMessages:n||e?.metaMessages}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.code=e instanceof dM?e.code:t??-1}},mM=class extends pM{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderRpcError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t.data}},bM=class e extends pM{constructor(t){super(t,{code:e.code,shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ParseRpcError"})}};Object.defineProperty(bM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});let gM=class e extends pM{constructor(t){super(t,{code:e.code,shortMessage:"JSON is not a valid request object."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidRequestRpcError"})}};Object.defineProperty(gM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});let yM=class e extends pM{constructor(t){super(t,{code:e.code,shortMessage:"The method does not exist / is not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotFoundRpcError"})}};Object.defineProperty(yM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});let vM=class e extends pM{constructor(t){super(t,{code:e.code,shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join("\n")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParamsRpcError"})}};Object.defineProperty(vM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});let wM=class e extends pM{constructor(t){super(t,{code:e.code,shortMessage:"An internal error was received."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InternalRpcError"})}};Object.defineProperty(wM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});let EM=class e extends pM{constructor(t){super(t,{code:e.code,shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join("\n")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidInputRpcError"})}};Object.defineProperty(EM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});let AM=class e extends pM{constructor(t){super(t,{code:e.code,shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}};Object.defineProperty(AM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});let xM=class e extends pM{constructor(t){super(t,{code:e.code,shortMessage:"Requested resource not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceUnavailableRpcError"})}};Object.defineProperty(xM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});let _M=class e extends pM{constructor(t){super(t,{code:e.code,shortMessage:"Transaction creation failed."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionRejectedRpcError"})}};Object.defineProperty(_M,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});let kM=class e extends pM{constructor(t){super(t,{code:e.code,shortMessage:"Method is not implemented."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotSupportedRpcError"})}};Object.defineProperty(kM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});let SM=class e extends pM{constructor(t){super(t,{code:e.code,shortMessage:"Request exceeds defined limit."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"LimitExceededRpcError"})}};Object.defineProperty(SM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});let PM=class e extends pM{constructor(t){super(t,{code:e.code,shortMessage:"Version of JSON-RPC protocol is not supported."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"JsonRpcVersionUnsupportedError"})}};Object.defineProperty(PM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});let IM=class e extends mM{constructor(t){super(t,{code:e.code,shortMessage:"User rejected the request."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UserRejectedRequestError"})}};Object.defineProperty(IM,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});let TM=class e extends mM{constructor(t){super(t,{code:e.code,shortMessage:"The requested method and/or account has not been authorized by the user."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnauthorizedProviderError"})}};Object.defineProperty(TM,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});let OM=class e extends mM{constructor(t){super(t,{code:e.code,shortMessage:"The Provider does not support the requested method."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedProviderMethodError"})}};Object.defineProperty(OM,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});let MM=class e extends mM{constructor(t){super(t,{code:e.code,shortMessage:"The Provider is disconnected from all chains."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderDisconnectedError"})}};Object.defineProperty(MM,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});let CM=class e extends mM{constructor(t){super(t,{code:e.code,shortMessage:"The Provider is not connected to the requested chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDisconnectedError"})}};Object.defineProperty(CM,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});let BM=class e extends mM{constructor(t){super(t,{code:e.code,shortMessage:"An error occurred when attempting to switch chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainError"})}};Object.defineProperty(BM,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});let NM=class extends pM{constructor(e){super(e,{shortMessage:"An unknown RPC error occurred."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownRpcError"})}};const RM=3;function FM(e,{abi:t,address:r,args:n,docsPath:i,functionName:o,sender:a}){const{code:s,data:c,message:u,shortMessage:l}=e instanceof uM?e:e instanceof NI?e.walk((e=>"data"in e))||e.walk():{},f=e instanceof UI?new cM({functionName:o}):[RM,wM.code].includes(s)&&(c||u||l)?new sM({abi:t,data:"object"==typeof c?c.data:c,functionName:o,message:l??u}):e;return new aM(f,{abi:t,args:n,contractAddress:r,docsPath:i,functionName:o,sender:a})}class LM extends NI{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the WalletClient."].join("\n"),{docsPath:e,docsSlug:"account"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountNotFoundError"})}}let jM=class extends NI{constructor(e,{account:t,docsPath:r,chain:n,data:i,gas:o,gasPrice:a,maxFeePerGas:s,maxPriorityFeePerGas:c,nonce:u,to:l,value:f}){const d=YO({from:t?.address,to:l,value:void 0!==f&&`${JO(f)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:o,gasPrice:void 0!==a&&`${ZO(a)} gwei`,maxFeePerGas:void 0!==s&&`${ZO(s)} gwei`,maxPriorityFeePerGas:void 0!==c&&`${ZO(c)} gwei`,nonce:u});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",d].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EstimateGasExecutionError"}),this.cause=e}},UM=class extends NI{constructor({cause:e,message:t}={}){const r=t?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ExecutionRevertedError"})}};Object.defineProperty(UM,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(UM,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});let DM=class extends NI{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${ZO(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooHigh"})}};Object.defineProperty(DM,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});let zM=class extends NI{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${ZO(t)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooLow"})}};Object.defineProperty(zM,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});let $M=class extends NI{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is higher than the next one expected.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooHighError"})}};Object.defineProperty($M,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});let HM=class extends NI{constructor({cause:e,nonce:t}={}){super([`Nonce provided for the transaction ${t?`(${t}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join("\n"),{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooLowError"})}};Object.defineProperty(HM,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});let GM=class extends NI{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}exceeds the maximum allowed nonce.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceMaxValueError"})}};Object.defineProperty(GM,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});let qM=class extends NI{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join("\n"),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InsufficientFundsError"})}};Object.defineProperty(qM,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds/});let KM=class extends NI{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooHighError"})}};Object.defineProperty(KM,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});let VM=class extends NI{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction is too low.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooLowError"})}};Object.defineProperty(VM,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});let WM=class extends NI{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionTypeNotSupportedError"})}};Object.defineProperty(WM,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});let JM=class extends NI{constructor({cause:e,maxPriorityFeePerGas:t,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${ZO(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${ZO(r)} gwei`:""}).`].join("\n"),{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TipAboveFeeCapError"})}};Object.defineProperty(JM,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});let ZM=class extends NI{constructor({cause:e}){super(`An error occurred while executing: ${e?.shortMessage}`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownNodeError"})}};function YM(e,t){const r=(e.details||"").toLowerCase(),n=e.walk((e=>e.code===UM.code));return n instanceof NI?new UM({cause:e,message:n.details}):UM.nodeMessage.test(r)?new UM({cause:e,message:e.details}):DM.nodeMessage.test(r)?new DM({cause:e,maxFeePerGas:t?.maxFeePerGas}):zM.nodeMessage.test(r)?new zM({cause:e,maxFeePerGas:t?.maxFeePerGas}):$M.nodeMessage.test(r)?new $M({cause:e,nonce:t?.nonce}):HM.nodeMessage.test(r)?new HM({cause:e,nonce:t?.nonce}):GM.nodeMessage.test(r)?new GM({cause:e,nonce:t?.nonce}):qM.nodeMessage.test(r)?new qM({cause:e}):KM.nodeMessage.test(r)?new KM({cause:e,gas:t?.gas}):VM.nodeMessage.test(r)?new VM({cause:e,gas:t?.gas}):WM.nodeMessage.test(r)?new WM({cause:e}):JM.nodeMessage.test(r)?new JM({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new ZM({cause:e})}function XM(e,{format:t}){if(!t)return{};const r={};return function t(n){const i=Object.keys(n);for(const o of i)o in e&&(r[o]=e[o]),n[o]&&"object"==typeof n[o]&&!Array.isArray(n[o])&&t(n[o])}(t(e||{})),r}function QM(e,t){return({exclude:r,format:n})=>({exclude:r,format:e=>{const i=t(e);if(r)for(const e of r)delete i[e];return{...i,...n(e)}},type:e})}const eC={legacy:"0x0",eip2930:"0x1",eip1559:"0x2"};function tC(e){return{...e,gas:void 0!==e.gas?kT(e.gas):void 0,gasPrice:void 0!==e.gasPrice?kT(e.gasPrice):void 0,maxFeePerGas:void 0!==e.maxFeePerGas?kT(e.maxFeePerGas):void 0,maxPriorityFeePerGas:void 0!==e.maxPriorityFeePerGas?kT(e.maxPriorityFeePerGas):void 0,nonce:void 0!==e.nonce?kT(e.nonce):void 0,type:void 0!==e.type?eC[e.type]:void 0,value:void 0!==e.value?kT(e.value):void 0}}const rC=QM("transactionRequest",tC);function nC(e){const{account:t,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:o}=e,a=t?NO(t):void 0;if(a&&!bO(a.address))throw new pO({address:a.address});if(o&&!bO(o))throw new pO({address:o});if(void 0!==r&&(void 0!==n||void 0!==i))throw new XO;if(n&&n>2n**256n-1n)throw new DM({maxFeePerGas:n});if(i&&n&&i>n)throw new JM({maxFeePerGas:n,maxPriorityFeePerGas:i})}let iC=class extends NI{constructor(){super("`baseFeeMultiplier` must be greater than 1."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseFeeScalarError"})}},oC=class extends NI{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}},aC=class extends NI{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${ZO(e)} gwei).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MaxFeePerGasTooLowError"})}},sC=class extends NI{constructor({blockHash:e,blockNumber:t}){let r="Block";e&&(r=`Block at hash "${e}"`),t&&(r=`Block at number "${t}"`),super(`${r} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlockNotFoundError"})}};const cC={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559"};function uC(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?vT(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?vT(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?cC[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if("bigint"==typeof t.v){if(0n===t.v||27n===t.v)return 0;if(1n===t.v||28n===t.v)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),"legacy"===t.type&&(delete t.accessList,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),"eip2930"===t.type&&(delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),t}const lC=QM("transaction",uC);function fC(e){const t=e.transactions?.map((e=>"string"==typeof e?e:uC(e)));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,difficulty:e.difficulty?BigInt(e.difficulty):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}const dC=QM("block",fC);async function hC(e,{blockHash:t,blockNumber:r,blockTag:n,includeTransactions:i}={}){const o=n??"latest",a=i??!1,s=void 0!==r?kT(r):void 0;let c=null;if(c=t?await e.request({method:"eth_getBlockByHash",params:[t,a]}):await e.request({method:"eth_getBlockByNumber",params:[s||o,a]}),!c)throw new sC({blockHash:t,blockNumber:r});return(e.chain?.formatters?.block?.format||fC)(c)}async function pC(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function mC(e,t){const{block:r,chain:n=e.chain,request:i}=t||{};if("function"==typeof n?.fees?.defaultPriorityFee){const t=r||await TI(e,hC,"getBlock")({});return n.fees.defaultPriorityFee({block:t,client:e,request:i})}if(void 0!==n?.fees?.defaultPriorityFee)return n?.fees?.defaultPriorityFee;try{return gT(await e.request({method:"eth_maxPriorityFeePerGas"}))}catch{const[t,n]=await Promise.all([r?Promise.resolve(r):TI(e,hC,"getBlock")({}),TI(e,pC,"getGasPrice")({})]);if("bigint"!=typeof t.baseFeePerGas)throw new oC;const i=n-t.baseFeePerGas;return i<0n?0n:i}}async function bC(e,t){const{block:r,chain:n=e.chain,request:i,type:o="eip1559"}=t||{},a=await(async()=>"function"==typeof n?.fees?.baseFeeMultiplier?n.fees.baseFeeMultiplier({block:r,client:e,request:i}):n?.fees?.baseFeeMultiplier??1.2)();if(a<1)throw new iC;const s=10**(a.toString().split(".")[1]?.length??0),c=e=>e*BigInt(Math.ceil(a*s))/BigInt(s),u=r||await TI(e,hC,"getBlock")({});if("function"==typeof n?.fees?.estimateFeesPerGas)return n.fees.estimateFeesPerGas({block:r,client:e,multiply:c,request:i,type:o});if("eip1559"===o){if("bigint"!=typeof u.baseFeePerGas)throw new oC;const t=i?.maxPriorityFeePerGas?i.maxPriorityFeePerGas:await mC(e,{block:u,chain:n,request:i}),r=c(u.baseFeePerGas);return{maxFeePerGas:i?.maxFeePerGas??r+t,maxPriorityFeePerGas:t}}return{gasPrice:i?.gasPrice??c(await TI(e,pC,"getGasPrice")({}))}}async function gC(e,{address:t,blockTag:r="latest",blockNumber:n}){return vT(await e.request({method:"eth_getTransactionCount",params:[t,n?kT(n):r]}))}function yC(e){if(e.type)return e.type;if(void 0!==e.maxFeePerGas||void 0!==e.maxPriorityFeePerGas)return"eip1559";if(void 0!==e.gasPrice)return void 0!==e.accessList?"eip2930":"legacy";throw new eM({transaction:e})}async function vC(e,t){const{account:r=e.account,chain:n,gas:i,nonce:o,type:a}=t;if(!r)throw new LM;const s=NO(r),c=await TI(e,hC,"getBlock")({blockTag:"latest"}),u={...t,from:s.address};if(void 0===o&&(u.nonce=await TI(e,gC,"getTransactionCount")({address:s.address,blockTag:"pending"})),void 0===a)try{u.type=yC(u)}catch{u.type="bigint"==typeof c.baseFeePerGas?"eip1559":"legacy"}if("eip1559"===u.type){const{maxFeePerGas:r,maxPriorityFeePerGas:i}=await bC(e,{block:c,chain:n,request:u});if(void 0===t.maxPriorityFeePerGas&&t.maxFeePerGas&&t.maxFeePerGas{const t=YM(e,r);return t instanceof ZM?e:t})();return new jM(n,{docsPath:t,...r})}(r,{...t,account:n,chain:e.chain})}}const EC="/docs/contract/decodeEventLog";function AC({abi:e,data:t,strict:r,topics:n}){const i=r??!0,[o,...a]=n;if(!o)throw new GI({docsPath:EC});const s=e.find((e=>"event"===e.type&&o===hO(OI(e))));if(!s||!("name"in s)||"event"!==s.type)throw new qI(o,{docsPath:EC});const{name:c,inputs:u}=s,l=u?.some((e=>!("name"in e&&e.name)));let f=l?[]:{};const d=u.filter((e=>"indexed"in e&&e.indexed));for(let e=0;e!("indexed"in e&&e.indexed)));if(h.length>0)if(t&&"0x"!==t)try{const e=DO(h,t);if(e)if(l)f=[...f,...e];else for(let t=0;t0?f:void 0}}function xC({param:e,value:t}){if("string"===e.type||"bytes"===e.type||"tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/))return t;return(DO([e],t)||[])[0]}function _C(e,{args:t,eventName:r}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...r?{args:t,eventName:r}:{}}}async function kC(e,{address:t,blockHash:r,fromBlock:n,toBlock:i,event:o,events:a,args:s,strict:c}={}){const u=c??!1,l=a??(o?[o]:void 0);let f,d=[];return l&&(d=[l.flatMap((e=>OO({abi:[e],eventName:e.name,args:s})))],o&&(d=d[0])),f=r?await e.request({method:"eth_getLogs",params:[{address:t,topics:d,blockHash:r}]}):await e.request({method:"eth_getLogs",params:[{address:t,topics:d,fromBlock:"bigint"==typeof n?kT(n):n,toBlock:"bigint"==typeof i?kT(i):i}]}),f.map((e=>{try{const{eventName:t,args:r}=l?AC({abi:l,data:e.data,topics:e.topics,strict:u}):{eventName:void 0,args:void 0};return _C(e,{args:r,eventName:t})}catch(t){let r,n;if(t instanceof XI||t instanceof QI){if(u)return;r=t.abiItem.name,n=t.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}return _C(e,{args:n?[]:{},eventName:r})}})).filter(Boolean)}async function SC(e,{abi:t,address:r,args:n,blockHash:i,eventName:o,fromBlock:a,toBlock:s,strict:c}){const u=o?PO({abi:t,name:o}):void 0,l=u?void 0:t.filter((e=>"event"===e.type));return TI(e,kC,"getLogs")({address:r,args:n,blockHash:i,event:u,events:l,fromBlock:a,toBlock:s,strict:c})}const PC="/docs/contract/decodeFunctionResult";function IC({abi:e,args:t,functionName:r,data:n}){let i=e[0];if(r&&(i=PO({abi:e,args:t,name:r}),!i))throw new VI(r,{docsPath:PC});if("function"!==i.type)throw new VI(void 0,{docsPath:PC});if(!i.outputs)throw new WI(i.name,{docsPath:PC});const o=DO(i.outputs,n);return o&&o.length>1?o:o&&1===o.length?o[0]:void 0}const TC=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],OC=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"}],MC=[...OC,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],CC=[...OC,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],BC=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],NC=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],RC=[{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"}],FC="0x82ad56cb";let LC=class extends NI{constructor({blockNumber:e,chain:t,contract:r}){super(`Chain "${t.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...e&&r.blockCreated&&r.blockCreated>e?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${r.name}" configured.`]]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDoesNotSupportContract"})}},jC=class extends NI{constructor(){super("No chain was provided to the Client."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ClientChainNotConfiguredError"})}};class UC extends NI{constructor({chainId:e}){super(`Chain ID "${e}" is invalid.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidChainIdError"})}}function DC({blockNumber:e,chain:t,contract:r}){const n=t?.contracts?.[r];if(!n)throw new LC({chain:t,contract:{name:r}});if(e&&n.blockCreated&&n.blockCreated>e)throw new LC({blockNumber:e,chain:t,contract:{name:r,blockCreated:n.blockCreated}});return n.address}const zC=new Map;function $C({fn:e,id:t,shouldSplitBatch:r,wait:n=0,sort:i}){const o=async()=>{const t=s();a();const r=t.map((({args:e})=>e));0!==r.length&&e(r).then((e=>{i&&Array.isArray(e)&&e.sort(i);for(let r=0;r{for(let r=0;rzC.delete(t),s=()=>zC.get(t)||[],c=e=>zC.set(t,[...s(),e]);return{flush:a,async schedule(e){const t={},i=new Promise(((e,r)=>{t.resolve=e,t.reject=r})),a=r?.([...s().map((({args:e})=>e)),e]);a&&o();return s().length>0?(c({args:e,pendingPromise:t}),i):(c({args:e,pendingPromise:t}),setTimeout(o,n),i)}}}async function HC(e,t){const{account:r=e.account,batch:n=Boolean(e.batch?.multicall),blockNumber:i,blockTag:o="latest",accessList:a,data:s,gas:c,gasPrice:u,maxFeePerGas:l,maxPriorityFeePerGas:f,nonce:d,to:h,value:p,...m}=t,b=r?NO(r):void 0;try{nC(t);const r=(i?kT(i):void 0)||o,g=e.chain?.formatters?.transactionRequest?.format,y=(g||tC)({...XM(m,{format:g}),from:b?.address,accessList:a,data:s,gas:c,gasPrice:u,maxFeePerGas:l,maxPriorityFeePerGas:f,nonce:d,to:h,value:p});if(n&&function({request:e}){const{data:t,to:r,...n}=e;return!!t&&(!t.startsWith(FC)&&(!!r&&!(Object.values(n).filter((e=>void 0!==e)).length>0)))}({request:y}))try{return await async function(e,t){const{batchSize:r=1024,wait:n=0}="object"==typeof e.batch?.multicall?e.batch.multicall:{},{blockNumber:i,blockTag:o="latest",data:a,multicallAddress:s,to:c}=t;let u=s;if(!u){if(!e.chain)throw new jC;u=DC({blockNumber:i,chain:e.chain,contract:"multicall3"})}const l=i?kT(i):void 0,f=l||o,{schedule:d}=$C({id:`${e.uid}.${f}`,wait:n,shouldSplitBatch(e){const t=e.reduce(((e,{data:t})=>e+(t.length-2)),0);return t>2*r},fn:async t=>{const r=t.map((e=>({allowFailure:!0,callData:e.data,target:e.to}))),n=RO({abi:TC,args:[r],functionName:"aggregate3"}),i=await e.request({method:"eth_call",params:[{data:n,to:u},f]});return IC({abi:TC,args:[r],functionName:"aggregate3",data:i||"0x"})}}),[{returnData:h,success:p}]=await d({data:a,to:c});if(!p)throw new uM({data:h});return"0x"===h?{data:void 0}:{data:h}}(e,{...y,blockNumber:i,blockTag:o})}catch(e){if(!(e instanceof jC||e instanceof LC))throw e}const v=await e.request({method:"eth_call",params:r?[y,r]:[y]});return"0x"===v?{data:void 0}:{data:v}}catch(r){const n=function(e){if(!(e instanceof NI))return;const t=e.walk();return"object"==typeof t.data?t.data.data:t.data}(r),{offchainLookup:i,offchainLookupSignature:o}=await Promise.resolve().then((function(){return KB}));if(n?.slice(0,10)===o&&h)return{data:await i(e,{data:n,to:h})};throw function(e,{docsPath:t,...r}){const n=(()=>{const t=YM(e,r);return t instanceof ZM?e:t})();return new oM(n,{docsPath:t,...r})}(r,{...t,account:b,chain:e.chain})}}async function GC(e,{abi:t,address:r,args:n,functionName:i,...o}){const a=RO({abi:t,args:n,functionName:i});try{const{data:s}=await TI(e,HC,"call")({data:a,to:r,...o});return IC({abi:t,args:n,functionName:i,data:s||"0x"})}catch(e){throw FM(e,{abi:t,address:r,args:n,docsPath:"/docs/contract/readContract",functionName:i})}}const qC=new Map,KC=new Map;let VC=0;function WC(e,t,r){const n=++VC,i=()=>qC.get(e)||[],o=()=>{const t=KC.get(e);1===i().length&&t&&t(),(()=>{const t=i();qC.set(e,t.filter((e=>e.id!==n)))})()},a=i();if(qC.set(e,[...a,{id:n,fns:t}]),a&&a.length>0)return o;const s={};for(const e in t)s[e]=(...t)=>{const r=i();if(0!==r.length)for(const n of r)n.fns[e]?.(...t)};const c=r(s);return"function"==typeof c&&KC.set(e,c),o}async function JC(e){return new Promise((t=>setTimeout(t,e)))}function ZC(e,{emitOnBegin:t,initialWaitTime:r,interval:n}){let i=!0;const o=()=>i=!1;return(async()=>{let a;t&&(a=await e({unpoll:o}));const s=await(r?.(a))??n;await JC(s);const c=async()=>{i&&(await e({unpoll:o}),await JC(n),c())};c()})(),o}const YC=new Map,XC=new Map;async function QC(e,{cacheKey:t,cacheTime:r=1/0}){const n=function(e){const t=(e,t)=>({clear:()=>t.delete(e),get:()=>t.get(e),set:r=>t.set(e,r)}),r=t(e,YC),n=t(e,XC);return{clear:()=>{r.clear(),n.clear()},promise:r,response:n}}(t),i=n.response.get();if(i&&r>0){if((new Date).getTime()-i.created.getTime()`blockNumber.${e}`;async function tB(e,{cacheTime:t=e.cacheTime,maxAge:r}={}){const n=await QC((()=>e.request({method:"eth_blockNumber"})),{cacheKey:eB(e.uid),cacheTime:r??t});return BigInt(n)}async function rB(e,{filter:t}){const r="strict"in t&&t.strict;return(await t.request({method:"eth_getFilterChanges",params:[t.id]})).map((e=>{if("string"==typeof e)return e;try{const{eventName:n,args:i}="abi"in t&&t.abi?AC({abi:t.abi,data:e.data,topics:e.topics,strict:r}):{eventName:void 0,args:void 0};return _C(e,{args:i,eventName:n})}catch(r){let n,i;if(r instanceof XI||r instanceof QI){if("strict"in t&&t.strict)return;n=r.abiItem.name,i=r.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}return _C(e,{args:i?[]:{},eventName:n})}})).filter(Boolean)}async function nB(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}const iB=256;let oB,aB=iB;function sB(e=11){if(!oB||aB+e>2*iB){oB="",aB=0;for(let e=0;e!0}={}){return new Promise(((i,o)=>{const a=async({count:s=0}={})=>{try{const t=await e();i(t)}catch(e){if(s{const r="function"==typeof t?t({count:s,error:e}):t;r&&await JC(r),a({count:s+1})})({error:e});o(e)}};a()}))}const uB=e=>"code"in e?-1!==e.code&&-32004!==e.code&&-32005!==e.code&&-32042!==e.code&&-32603!==e.code:!!(e instanceof lM&&e.status)&&(403!==e.status&&408!==e.status&&413!==e.status&&429!==e.status&&500!==e.status&&502!==e.status&&503!==e.status&&504!==e.status);function lB(e,{retryDelay:t=150,retryCount:r=3}={}){return async n=>cB((async()=>{try{return await e(n)}catch(e){const t=e;switch(t.code){case bM.code:throw new bM(t);case gM.code:throw new gM(t);case yM.code:throw new yM(t);case vM.code:throw new vM(t);case wM.code:throw new wM(t);case EM.code:throw new EM(t);case AM.code:throw new AM(t);case xM.code:throw new xM(t);case _M.code:throw new _M(t);case kM.code:throw new kM(t);case SM.code:throw new SM(t);case PM.code:throw new PM(t);case IM.code:throw new IM(t);case TM.code:throw new TM(t);case OM.code:throw new OM(t);case MM.code:throw new MM(t);case CM.code:throw new CM(t);case BM.code:throw new BM(t);case 5e3:throw new IM(t);default:if(e instanceof NI)throw e;throw new NM(t)}}}),{delay:({count:e,error:r})=>{if(r&&r instanceof lM){const e=r?.headers?.get("Retry-After");if(e?.match(/\d/))return 1e3*parseInt(e)}return(1<!uB(e)})}function fB({key:e,name:t,request:r,retryCount:n=3,retryDelay:i=150,timeout:o,type:a},s){return{config:{key:e,name:t,request:r,retryCount:n,retryDelay:i,timeout:o,type:a},request:lB(r,{retryCount:n,retryDelay:i}),value:s}}function dB(e,t={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=t;return({retryCount:o})=>fB({key:r,name:n,request:e.request.bind(e),retryCount:t.retryCount??o,retryDelay:i,type:"custom"})}let hB=class extends NI{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro"})}};function pB(e,{errorInstance:t=new Error("timed out"),timeout:r,signal:n}){return new Promise(((i,o)=>{(async()=>{let a;try{const s=new AbortController;r>0&&(a=setTimeout((()=>{n?s.abort():o(t)}),r)),i(await e({signal:s?.signal}))}catch(e){"AbortError"===e.name&&o(t),o(e)}finally{clearTimeout(a)}})()}))}let mB=0;const bB={http:async function(e,{body:t,fetchOptions:r={},timeout:n=1e4}){const{headers:i,method:o,signal:a}=r;try{const s=await pB((async({signal:s})=>await fetch(e,{...r,body:Array.isArray(t)?GO(t.map((e=>({jsonrpc:"2.0",id:e.id??mB++,...e})))):GO({jsonrpc:"2.0",id:t.id??mB++,...t}),headers:{...i,"Content-Type":"application/json"},method:o||"POST",signal:a||(n>0?s:void 0)})),{errorInstance:new hM({body:t,url:e}),timeout:n,signal:!0});let c;if(c=s.headers.get("Content-Type")?.startsWith("application/json")?await s.json():await s.text(),!s.ok)throw new lM({body:t,details:GO(c.error)||s.statusText,headers:s.headers,status:s.status,url:e});return c}catch(r){if(r instanceof lM)throw r;if(r instanceof hM)throw r;throw new lM({body:t,details:r.message,url:e})}},webSocket:function(e,{body:t,onResponse:r}){if(e.readyState===e.CLOSED||e.readyState===e.CLOSING)throw new fM({body:t,url:e.url,details:"Socket is closed."});const n=mB++,i=({data:o})=>{const a=JSON.parse(o);"number"==typeof a.id&&n!==a.id||(r?.(a),"eth_subscribe"===t.method&&"string"==typeof a.result&&e.subscriptions.set(a.result,i),"eth_unsubscribe"===t.method&&e.subscriptions.delete(t.params?.[0]))};return e.requests.set(n,i),e.send(JSON.stringify({jsonrpc:"2.0",...t,id:n})),e},webSocketAsync:async function(e,{body:t,timeout:r=1e4}){return pB((()=>new Promise((r=>bB.webSocket(e,{body:t,onResponse:r})))),{errorInstance:new hM({body:t,url:e.url}),timeout:r})}};function gB(e,t={}){const{batch:r,fetchOptions:n,key:i="http",name:o="HTTP JSON-RPC",retryDelay:a}=t;return({chain:s,retryCount:c,timeout:u})=>{const{batchSize:l=1e3,wait:f=0}="object"==typeof r?r:{},d=t.retryCount??c,h=u??t.timeout??1e4,p=e||s?.rpcUrls.default.http[0];if(!p)throw new hB;return fB({key:i,name:o,async request({method:t,params:i}){const o={method:t,params:i},{schedule:a}=$C({id:`${e}`,wait:f,shouldSplitBatch:e=>e.length>l,fn:e=>bB.http(p,{body:e,fetchOptions:n,timeout:h}),sort:(e,t)=>e.id-t.id}),[{error:s,result:c}]=await(async e=>r?a(e):[await bB.http(p,{body:e,fetchOptions:n,timeout:h})])(o);if(s)throw new dM({body:o,error:s,url:p});return c},retryCount:d,retryDelay:a,timeout:h,type:"http"},{fetchOptions:n,url:e})}}function yB(e,t){if(!(e instanceof NI))return!1;const r=e.walk((e=>e instanceof sM));return r instanceof sM&&("ResolverNotFound"===r.data?.errorName||("ResolverWildcardNotSupported"===r.data?.errorName||(!!r.reason?.includes("Wildcard on non-extended resolvers is not supported")||"reverse"===t&&r.reason===FO[50])))}function vB(e){if(66!==e.length)return null;if(0!==e.indexOf("["))return null;if(65!==e.indexOf("]"))return null;const t=`0x${e.slice(1,65)}`;return CI(t)?t:null}function wB(e){let t=new Uint8Array(32).fill(0);if(!e)return _T(t);const r=e.split(".");for(let e=r.length-1;e>=0;e-=1){const n=vB(r[e]),i=n?TT(n):dO(BT(r[e]),"bytes");t=dO(gO([t,i]),"bytes")}return _T(t)}function EB(e){return`[${e.slice(2)}]`}function AB(e){const t=new Uint8Array(32).fill(0);return e?vB(e)||dO(BT(e)):_T(t)}function xB(e){const t=e.replace(/^\.|\.$/gm,"");if(0===t.length)return new Uint8Array(1);const r=new Uint8Array(BT(t).byteLength+2);let n=0;const i=t.split(".");for(let e=0;e255&&(t=BT(EB(AB(i[e])))),r[n]=t.length,r.set(t,n+1),n+=t.length+1}return r.byteLength!==n+1?r.slice(0,n+1):r}let _B=class extends NI{constructor({data:e}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidMetadataError"})}},kB=class extends NI{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidNftUriError"})}},SB=class extends NI{constructor({uri:e}){super(`Unable to resolve ENS avatar URI "${e}". The URI may be malformed, invalid, or does not respond with a valid image.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUriResolutionError"})}},PB=class extends NI{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUnsupportedNamespaceError"})}};const IB=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,TB=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,OB=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,MB=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;function CB(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function BB({uri:e,gatewayUrls:t}){const r=OB.test(e);if(r)return{uri:e,isOnChain:!0,isEncoded:r};const n=CB(t?.ipfs,"https://ipfs.io"),i=CB(t?.arweave,"https://arweave.net"),o=e.match(IB),{protocol:a,subpath:s,target:c,subtarget:u=""}=o?.groups||{},l="ipns:/"===a||"ipns/"===s,f="ipfs:/"===a||"ipfs/"===s||TB.test(e);if(e.startsWith("http")&&!l&&!f){let r=e;return t?.arweave&&(r=e.replace(/https:\/\/arweave.net/g,t?.arweave)),{uri:r,isOnChain:!1,isEncoded:!1}}if((l||f)&&c)return{uri:`${n}/${l?"ipns":"ipfs"}/${c}${u}`,isOnChain:!1,isEncoded:!1};if("ar:/"===a&&c)return{uri:`${i}/${c}${u||""}`,isOnChain:!1,isEncoded:!1};let d=e.replace(MB,"");if(d.startsWith("{const r=new Image;r.onload=()=>{t(!0)},r.onerror=()=>{t(!1)},r.src=e}))}}(r);if(i)return r;throw new SB({uri:t})}async function FB(e,{gatewayUrls:t,record:r}){return/eip155:/i.test(r)?async function(e,{gatewayUrls:t,record:r}){const n=function(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[r,n,i]=t.split("/"),[o,a]=r.split(":"),[s,c]=n.split(":");if(!o||"eip155"!==o.toLowerCase())throw new kB({reason:"Only EIP-155 supported"});if(!a)throw new kB({reason:"Chain ID not found"});if(!c)throw new kB({reason:"Contract address not found"});if(!i)throw new kB({reason:"Token ID not found"});if(!s)throw new kB({reason:"ERC namespace not found"});return{chainID:parseInt(a),namespace:s.toLowerCase(),contractAddress:c,tokenID:i}}(r),i=await async function(e,{nft:t}){if("erc721"===t.namespace)return GC(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if("erc1155"===t.namespace)return GC(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new PB({namespace:t.namespace})}(e,{nft:n}),{uri:o,isOnChain:a,isEncoded:s}=BB({uri:i,gatewayUrls:t});if(a&&(o.includes("data:application/json;base64,")||o.startsWith("{"))){const e=s?atob(o.replace("data:application/json;base64,","")):o;return RB({uri:NB(JSON.parse(e)),gatewayUrls:t})}let c=n.tokenID;"erc1155"===n.namespace&&(c=c.replace("0x","").padStart(64,"0"));return async function({gatewayUrls:e,uri:t}){try{const r=await fetch(t).then((e=>e.json()));return await RB({gatewayUrls:e,uri:NB(r)})}catch{throw new SB({uri:t})}}({gatewayUrls:t,uri:o.replace(/(?:0x)?{id}/,c)})}(e,{gatewayUrls:t,record:r}):RB({uri:r,gatewayUrls:t})}async function LB(e,{blockNumber:t,blockTag:r,name:n,key:i,universalResolverAddress:o}){let a=o;if(!a){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");a=DC({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{const o=await TI(e,GC,"readContract")({address:a,abi:MC,functionName:"resolve",args:[AT(xB(n)),RO({abi:BC,functionName:"text",args:[wB(n),i]})],blockNumber:t,blockTag:r});if("0x"===o[0])return null;const s=IC({abi:BC,functionName:"text",data:o[0]});return""===s?null:s}catch(e){if(yB(e,"resolve"))return null;throw e}}async function jB(e,{address:t,args:r,event:n,events:i,fromBlock:o,strict:a,toBlock:s}={}){const c=i??(n?[n]:void 0),u=CO(e,{method:"eth_newFilter"});let l=[];c&&(l=[c.flatMap((e=>OO({abi:[e],eventName:e.name,args:r})))],n&&(l=l[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:"bigint"==typeof o?kT(o):o,toBlock:"bigint"==typeof s?kT(s):s,...l.length?{topics:l}:{}}]});return{abi:c,args:r,eventName:n?n.name:void 0,fromBlock:o,id:f,request:u(f),strict:a,toBlock:s,type:"event"}}async function UB(e){const t=CO(e,{method:"eth_newPendingTransactionFilter"}),r=await e.request({method:"eth_newPendingTransactionFilter"});return{id:r,request:t(r),type:"transaction"}}async function DB(e,{blockCount:t,blockNumber:r,blockTag:n="latest",rewardPercentiles:i}){const o=r?kT(r):void 0;return function(e){return{baseFeePerGas:e.baseFeePerGas.map((e=>BigInt(e))),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:e.reward?.map((e=>e.map((e=>BigInt(e)))))}}(await e.request({method:"eth_feeHistory",params:[kT(t),o||n,i]}))}let zB=class extends NI{constructor({callbackSelector:e,cause:t,data:r,extraData:n,sender:i,urls:o}){super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],t.metaMessages?.length?"":[],"Offchain Gateway Call:",o&&[" Gateway URL(s):",...o.map((e=>` ${e}`))],` Sender: ${i}`,` Data: ${r}`,` Callback selector: ${e}`,` Extra data: ${n}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}},$B=class extends NI{constructor({result:e,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${t}`,`Response: ${GO(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}},HB=class extends NI{constructor({sender:e,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}};const GB={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function qB({data:e,sender:t,urls:r}){let n=new Error("An unknown error occurred.");for(let i=0;i{for(const r of e){const{name:e,type:n}=r,a=n,s=t[e],c=a.match(ZB);if(c&&("number"==typeof s||"bigint"==typeof s)){const[e,t,r]=c;kT(s,{signed:"int"===t,size:parseInt(r)/8})}if("address"===a&&"string"==typeof s&&!bO(s))throw new pO({address:s});const u=a.match(JB);if(u){const[e,t]=u;if(t&&BI(s)!==parseInt(t))throw new YI({expectedSize:parseInt(t),givenSize:BI(s)})}const l=i[a];l&&o(l,s)}};i.EIP712Domain&&e&&o(i.EIP712Domain,e);if("EIP712Domain"!==r){const e=i[r];o(e,t)}}({domain:i,message:t,primaryType:r,types:o});const a=["0x1901"];return i&&a.push(function({domain:e,types:t}){return XB({data:e,primaryType:"EIP712Domain",types:t})}({domain:i,types:o})),"EIP712Domain"!==r&&a.push(XB({data:t,primaryType:r,types:o})),dO(gO(a))}function XB({data:e,primaryType:t,types:r}){return dO(QB({data:e,primaryType:t,types:r}))}function QB({data:e,primaryType:t,types:r}){const n=[{type:"bytes32"}],i=[eN({primaryType:t,types:r})];for(const o of r[t]){const[t,a]=rN({types:r,name:o.name,type:o.type,value:e[o.name]});n.push(t),i.push(a)}return AO(n,i)}function eN({primaryType:e,types:t}){const r=AT(function({primaryType:e,types:t}){let r="";const n=tN({primaryType:e,types:t});n.delete(e);const i=[e,...Array.from(n).sort()];for(const e of i)r+=`${e}(${t[e].map((({name:e,type:t})=>`${t} ${e}`)).join(",")})`;return r}({primaryType:e,types:t}));return dO(r)}function tN({primaryType:e,types:t},r=new Set){const n=e.match(/^\w*/u),i=n?.[0];if(r.has(i)||void 0===t[i])return r;r.add(i);for(const e of t[i])tN({primaryType:e.type,types:t},r);return r}function rN({types:e,name:t,type:r,value:n}){if(void 0!==e[r])return[{type:"bytes32"},dO(QB({data:n,primaryType:r,types:e}))];if("bytes"===r){return[{type:"bytes32"},dO(n=`0x${(n.length%2?"0":"")+n.slice(2)}`)]}if("string"===r)return[{type:"bytes32"},dO(AT(n))];if(r.lastIndexOf("]")===r.length-1){const i=r.slice(0,r.lastIndexOf("[")),o=n.map((r=>rN({name:t,type:i,types:e,value:r})));return[{type:"bytes32"},dO(AO(o.map((([e])=>e)),o.map((([,e])=>e))))]}return[{type:r},n]}function nN({domain:e}){return["string"==typeof e?.name&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},"number"==typeof e?.chainId&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}function iN({abi:e,data:t}){const r=vO(t,0,4),n=e.find((e=>"function"===e.type&&r===SO(OI(e))));if(!n)throw new JI(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:n.name,args:"inputs"in n&&n.inputs&&n.inputs.length>0?DO(n.inputs,vO(t,4)):void 0}}const oN="/docs/contract/encodeDeployData";function aN({abi:e,args:t,bytecode:r}){if(!t||0===t.length)return r;const n=e.find((e=>"type"in e&&"constructor"===e.type));if(!n)throw new FI({docsPath:oN});if(!("inputs"in n))throw new LI({docsPath:oN});if(!n.inputs||0===n.inputs.length)throw new LI({docsPath:oN});return yO([r,AO(n.inputs,t)])}function sN(e,t,r=!1){if("address"===e){const e=t;if(!bO(e))throw new pO({address:e});return cT(e.toLowerCase(),{size:r?32:null})}if("string"===e)return PT(t);if("bytes"===e)return t;if("bool"===e)return cT(xT(t),{size:r?32:1});const n=e.match(ZB);if(n){const[e,i,o="256"]=n,a=parseInt(o)/8;return kT(t,{size:r?32:a,signed:"int"===i})}const i=e.match(JB);if(i){const[e,n]=i;if(parseInt(n)!==(t.length-2)/2)throw new YI({expectedSize:parseInt(n),givenSize:(t.length-2)/2});return cT(t,{dir:"right",size:r?32:null})}const o=e.match(WB);if(o&&Array.isArray(t)){const[e,r]=o,n=[];for(let e=0;ethis.bytes.length-1)throw new uN({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new cN({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},incrementPosition(e){if(e<0)throw new cN({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const r=t??this.position;return this.assertPosition(r+e-1),this.bytes.subarray(r,r+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,255&e),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){const e=this.inspectByte();return this.position++,e},readBytes(e){const t=this.inspectBytes(e);return this.position+=e,t},readUint8(){const e=this.inspectUint8();return this.position+=1,e},readUint16(){const e=this.inspectUint16();return this.position+=2,e},readUint24(){const e=this.inspectUint24();return this.position+=3,e},readUint32(){const e=this.inspectUint32();return this.position+=4,e},setPosition(e){this.assertPosition(e),this.position=e}};function fN(e,t="hex"){const r=dN(e),n=function(e){const t=Object.create(lN);return t.bytes=e,t.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),t}(new Uint8Array(r.length));return r.encode(n),"hex"===t?_T(n.bytes):n.bytes}function dN(e){return Array.isArray(e)?function(e){const t=e.reduce(((e,t)=>e+t.length),0),r=hN(t),n=t<=55?1+t:1+r+t;return{length:n,encode(n){t<=55?n.pushByte(192+t):(n.pushByte(247+r),1===r?n.pushUint8(t):2===r?n.pushUint16(t):3===r?n.pushUint24(t):n.pushUint32(t));for(const{encode:t}of e)t(n)}}}(e.map((e=>dN(e)))):function(e){const t="string"==typeof e?CT(e):e,r=hN(t.length),n=1===t.length&&t[0]<128?1:t.length<=55?1+t.length:1+r+t.length;return{length:n,encode(e){1===t.length&&t[0]<128?e.pushBytes(t):t.length<=55?(e.pushByte(128+t.length),e.pushBytes(t)):(e.pushByte(183+r),1===r?e.pushUint8(t.length):2===r?e.pushUint16(t.length):3===r?e.pushUint24(t.length):e.pushUint32(t.length),e.pushBytes(t))}}}(e)}function hN(e){if(e<256)return 1;if(e<65536)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new NI("Length is too large.")}const pN={"0x0":"reverted","0x1":"success"};function mN(e){return{...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map((e=>_C(e))):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?vT(e.transactionIndex):null,status:e.status?pN[e.status]:null,type:e.type?cC[e.type]||e.type:null}}const bN=QM("transactionReceipt",mN);function gN(e,t){const r={to:t},n=r.to;return"number"===n?function(e,t={}){void 0!==t.size&&mT(e,{size:t.size});const r=_T(e,t);return vT(r)}(e,r):"bigint"===n?function(e,t={}){void 0!==t.size&&mT(e,{size:t.size});const r=_T(e,t);return gT(r)}(e,r):"boolean"===n?function(e,t={}){let r=e;void 0!==t.size&&(mT(r,{size:t.size}),r=pT(r));if(r.length>1||r[0]>1)throw new fT(r);return Boolean(r[0])}(e,r):"string"===n?function(e,t={}){let r=e;void 0!==t.size&&(mT(r,{size:t.size}),r=pT(r,{dir:"right"}));return(new TextDecoder).decode(r)}(e,r):_T(e,r)}class yN extends WT{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=qT(this.buffer)}update(e){LT(this);const{view:t,buffer:r,blockLen:n}=this,i=(e=VT(e)).length;for(let o=0;on-o&&(this.process(r,0),o=0);for(let e=o;e>i&o),s=Number(r&o),c=n?4:0,u=n?0:4;e.setUint32(t+c,a,n),e.setUint32(t+u,s,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const a=qT(e),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=s/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;ee&t^e&r^t&r,wN=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]),EN=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),AN=new Uint32Array(64);let xN=class extends yN{constructor(){super(64,32,8,!1),this.A=0|EN[0],this.B=0|EN[1],this.C=0|EN[2],this.D=0|EN[3],this.E=0|EN[4],this.F=0|EN[5],this.G=0|EN[6],this.H=0|EN[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:a,H:s}=this;return[e,t,r,n,i,o,a,s]}set(e,t,r,n,i,o,a,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)AN[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=AN[e-15],r=AN[e-2],n=KT(t,7)^KT(t,18)^t>>>3,i=KT(r,17)^KT(r,19)^r>>>10;AN[e]=i+AN[e-7]+n+AN[e-16]|0}let{A:r,B:n,C:i,D:o,E:a,F:s,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(KT(a,6)^KT(a,11)^KT(a,25))+((l=a)&s^~l&c)+wN[e]+AN[e]|0,f=(KT(r,2)^KT(r,13)^KT(r,22))+vN(r,n,i)|0;u=c,c=s,s=a,a=o+t|0,o=i,i=n,n=r,r=t+f|0}var l;r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,n,i,o,a,s,c,u)}roundClean(){AN.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const _N=JT((()=>new xN)),kN="Ethereum Signed Message:\n";function SN(e,t){const r="string"==typeof e?BT(e):e.raw instanceof Uint8Array?e.raw:TT(e.raw);return dO(gO([BT(`${kN}${r.length}`),r]),t)}function PN(e){if(!e||0===e.length)return[];const t=[];for(let r=0;r2n**256n-1n)throw new DM({maxFeePerGas:i});if(r&&i&&r>i)throw new JM({maxFeePerGas:i,maxPriorityFeePerGas:r})}(e);const f=PN(u),d=[AT(r),i?AT(i):"0x",c?AT(c):"0x",s?AT(s):"0x",n?AT(n):"0x",o??"0x",a?AT(a):"0x",l??"0x",f];if(t){const e=0n===t.v?"0x":1n===t.v?AT(1):27n===t.v?"0x":AT(1);d.push(e,pT(t.r),pT(t.s))}return yO(["0x02",fN(d)])}(e,t):"eip2930"===r?function(e,t){const{chainId:r,gas:n,data:i,nonce:o,to:a,value:s,accessList:c,gasPrice:u}=e;!function(e){const{chainId:t,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:i,to:o}=e;if(t<=0)throw new UC({chainId:t});if(o&&!bO(o))throw new pO({address:o});if(r||i)throw new NI("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(n&&n>2n**256n-1n)throw new DM({maxFeePerGas:n})}(e);const l=PN(c),f=[AT(r),o?AT(o):"0x",u?AT(u):"0x",n?AT(n):"0x",a??"0x",s?AT(s):"0x",i??"0x",l];if(t){const e=0n===t.v?"0x":1n===t.v?AT(1):27n===t.v?"0x":AT(1);f.push(e,pT(t.r),pT(t.s))}return yO(["0x01",fN(f)])}(e,t):function(e,t){const{chainId:r=0,gas:n,data:i,nonce:o,to:a,value:s,gasPrice:c}=e;!function(e){const{chainId:t,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:i,to:o,accessList:a}=e;if(o&&!bO(o))throw new pO({address:o});if(void 0!==t&&t<=0)throw new UC({chainId:t});if(r||i)throw new NI("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(n&&n>2n**256n-1n)throw new DM({maxFeePerGas:n});if(a)throw new NI("`accessList` is not a valid Legacy Transaction attribute.")}(e);let u=[o?AT(o):"0x",c?AT(c):"0x",n?AT(n):"0x",a??"0x",s?AT(s):"0x",i??"0x"];if(t){const e=(()=>{if(r>0)return BigInt(2*r)+BigInt(35n+t.v-27n);if(t.v>=35n){return(t.v-35n)/2n>0?t.v:27n+(35n===t.v?0n:1n)}const e=27n+(27n===t.v?0n:1n);if(t.v!==e)throw new QO({v:t.v});return e})();u=[...u,AT(e),t.r,t.s]}else r>0&&(u=[...u,AT(r),"0x","0x"]);return fN(u)}(e,t)}function TN(e,t){let[r,n="0"]=e.split(".");const i=r.startsWith("-");if(i&&(r=r.slice(1)),n=n.replace(/(0+)$/,""),0===t)1===Math.round(Number(`.${n}`))&&(r=`${BigInt(r)+1n}`),n="";else if(n.length>t){const[e,i,o]=[n.slice(0,t-1),n.slice(t-1,t),n.slice(t)],a=Math.round(Number(`${i}.${o}`));n=a>9?`${BigInt(e)+BigInt(1)}0`.padStart(e.length+1,"0"):`${e}${a}`,n.length>t&&(n=n.slice(1),r=`${BigInt(r)+1n}`),n=n.slice(0,t)}else n=n.padEnd(t,"0");return BigInt(`${i?"-":""}${r}${n}`)}async function ON(e,{address:t,blockNumber:r,blockTag:n,storageKeys:i}){const o=n??"latest",a=void 0!==r?kT(r):void 0;return function(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?vT(e.nonce):void 0,storageProof:e.storageProof?(t=e.storageProof,t.map((e=>({...e,value:BigInt(e.value)})))):void 0};var t}(await e.request({method:"eth_getProof",params:[t,i,a||o]}))}async function MN(e,{blockHash:t,blockNumber:r,blockTag:n,hash:i,index:o}){const a=n||"latest",s=void 0!==r?kT(r):void 0;let c=null;if(i?c=await e.request({method:"eth_getTransactionByHash",params:[i]}):t?c=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,kT(o)]}):(s||a)&&(c=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[s||a,kT(o)]})),!c)throw new rM({blockHash:t,blockNumber:r,blockTag:a,hash:i,index:o});return(e.chain?.formatters?.transaction?.format||uC)(c)}async function CN(e,{hash:t}){const r=await e.request({method:"eth_getTransactionReceipt",params:[t]});if(!r)throw new nM({hash:t});return(e.chain?.formatters?.transactionReceipt?.format||mN)(r)}const BN="0x60806040523480156200001157600080fd5b50604051620007003803806200070083398101604081905262000034916200056f565b6000620000438484846200004f565b9050806000526001601ff35b600080846001600160a01b0316803b806020016040519081016040528181526000908060200190933c90507f6492649264926492649264926492649264926492649264926492649264926492620000a68462000451565b036200021f57600060608085806020019051810190620000c79190620005ce565b8651929550909350915060000362000192576000836001600160a01b031683604051620000f5919062000643565b6000604051808303816000865af19150503d806000811462000134576040519150601f19603f3d011682016040523d82523d6000602084013e62000139565b606091505b5050905080620001905760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b505b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90620001c4908b90869060040162000661565b602060405180830381865afa158015620001e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020891906200069d565b6001600160e01b031916149450505050506200044a565b805115620002b157604051630b135d3f60e11b808252906001600160a01b03871690631626ba7e9062000259908890889060040162000661565b602060405180830381865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d91906200069d565b6001600160e01b031916149150506200044a565b8251604114620003195760405162461bcd60e51b815260206004820152603a6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e677468000000000000606482015260840162000187565b620003236200046b565b506020830151604080850151855186939260009185919081106200034b576200034b620006c9565b016020015160f81c9050601b81148015906200036b57508060ff16601c14155b15620003cf5760405162461bcd60e51b815260206004820152603b6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c75650000000000606482015260840162000187565b6040805160008152602081018083528a905260ff83169181019190915260608101849052608081018390526001600160a01b038a169060019060a0016020604051602081039080840390855afa1580156200042e573d6000803e3d6000fd5b505050602060405103516001600160a01b031614955050505050505b9392505050565b60006020825110156200046357600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b03811681146200049f57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004d5578181015183820152602001620004bb565b50506000910152565b600082601f830112620004f057600080fd5b81516001600160401b03808211156200050d576200050d620004a2565b604051601f8301601f19908116603f01168101908282118183101715620005385762000538620004a2565b816040528381528660208588010111156200055257600080fd5b62000565846020830160208901620004b8565b9695505050505050565b6000806000606084860312156200058557600080fd5b8351620005928162000489565b6020850151604086015191945092506001600160401b03811115620005b657600080fd5b620005c486828701620004de565b9150509250925092565b600080600060608486031215620005e457600080fd5b8351620005f18162000489565b60208501519093506001600160401b03808211156200060f57600080fd5b6200061d87838801620004de565b935060408601519150808211156200063457600080fd5b50620005c486828701620004de565b6000825162000657818460208701620004b8565b9190910192915050565b828152604060208201526000825180604084015262000688816060850160208701620004b8565b601f01601f1916919091016060019392505050565b600060208284031215620006b057600080fd5b81516001600160e01b0319811681146200044a57600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",NN=BigInt(0),RN=BigInt(1),FN=BigInt(2),LN=e=>e instanceof Uint8Array,jN=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0"))); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function UN(e){if(!LN(e))throw new Error("Uint8Array expected");let t="";for(let r=0;re+t.length),0));let r=0;return e.forEach((e=>{if(!LN(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length})),t}function JN(e,t){if(e.length!==t.length)return!1;for(let r=0;r(FN<new Uint8Array(e),XN=e=>Uint8Array.from(e);function QN(e,t,r){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let n=YN(e),i=YN(e),o=0;const a=()=>{n.fill(1),i.fill(0),o=0},s=(...e)=>r(i,n,...e),c=(e=YN())=>{i=s(XN([0]),e),n=s(),0!==e.length&&(i=s(XN([1]),e),n=s())},u=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e{let r;for(a(),c(e);!(r=t(u()));)c();return a(),r}}const eR={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function tR(e,t,r={}){const n=(t,r,n)=>{const i=eR[r];if("function"!=typeof i)throw new Error(`Invalid validator "${r}", expected function`);const o=e[t];if(!(n&&void 0===o||i(o,e)))throw new Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${r}`)};for(const[e,r]of Object.entries(t))n(e,r,!1);for(const[e,t]of Object.entries(r))n(e,t,!0);return e}var rR=Object.freeze({__proto__:null,bitGet:function(e,t){return e>>BigInt(t)&RN},bitLen:function(e){let t;for(t=0;e>NN;e>>=RN,t+=1);return t},bitMask:ZN,bitSet:(e,t,r)=>e|(r?RN:NN)<ZC((async()=>{try{const t=await TI(e,tB,"getBlockNumber")({cacheTime:0});if(s){if(t===s)return;if(t-s>1&&r)for(let e=s+1n;es)&&(n.onBlockNumber(t,s),s=t)}catch(e){n.onError?.(e)}}),{emitOnBegin:t,interval:a}))):(()=>{let t=!0,r=()=>t=!1;return(async()=>{try{const{unsubscribe:o}=await e.transport.subscribe({params:["newHeads"],onData(e){if(!t)return;const r=gT(e.result?.number);n(r,s),s=r},onError(e){i?.(e)}});r=o,t||r()}catch(e){i?.(e)}})(),r})()}function oR(e){return{call:t=>HC(e,t),createBlockFilter:()=>async function(e){const t=CO(e,{method:"eth_newBlockFilter"}),r=await e.request({method:"eth_newBlockFilter"});return{id:r,request:t(r),type:"block"}}(e),createContractEventFilter:t=>BO(e,t),createEventFilter:t=>jB(e,t),createPendingTransactionFilter:()=>UB(e),estimateContractGas:t=>async function(e,{abi:t,address:r,args:n,functionName:i,...o}){const a=RO({abi:t,args:n,functionName:i});try{return await TI(e,wC,"estimateGas")({data:a,to:r,...o})}catch(e){const a=o.account?NO(o.account):void 0;throw FM(e,{abi:t,address:r,args:n,docsPath:"/docs/contract/estimateContractGas",functionName:i,sender:a?.address})}}(e,t),estimateGas:t=>wC(e,t),getBalance:t=>async function(e,{address:t,blockNumber:r,blockTag:n="latest"}){const i=r?kT(r):void 0,o=await e.request({method:"eth_getBalance",params:[t,i||n]});return BigInt(o)}(e,t),getBlock:t=>hC(e,t),getBlockNumber:t=>tB(e,t),getBlockTransactionCount:t=>async function(e,{blockHash:t,blockNumber:r,blockTag:n="latest"}={}){const i=void 0!==r?kT(r):void 0;let o;return o=t?await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]}):await e.request({method:"eth_getBlockTransactionCountByNumber",params:[i||n]}),vT(o)}(e,t),getBytecode:t=>async function(e,{address:t,blockNumber:r,blockTag:n="latest"}){const i=void 0!==r?kT(r):void 0,o=await e.request({method:"eth_getCode",params:[t,i||n]});if("0x"!==o)return o}(e,t),getChainId:()=>async function(e){return vT(await e.request({method:"eth_chainId"}))}(e),getContractEvents:t=>SC(e,t),getEnsAddress:t=>async function(e,{blockNumber:t,blockTag:r,coinType:n,name:i,universalResolverAddress:o}){let a=o;if(!a){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");a=DC({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{const o=RO({abi:NC,functionName:"addr",...null!=n?{args:[wB(i),BigInt(n)]}:{args:[wB(i)]}}),s=await TI(e,GC,"readContract")({address:a,abi:MC,functionName:"resolve",args:[AT(xB(i)),o],blockNumber:t,blockTag:r});if("0x"===s[0])return null;const c=IC({abi:NC,args:null!=n?[wB(i),BigInt(n)]:void 0,functionName:"addr",data:s[0]});return"0x"===c||"0x00"===pT(c)?null:c}catch(e){if(yB(e,"resolve"))return null;throw e}}(e,t),getEnsAvatar:t=>async function(e,{blockNumber:t,blockTag:r,gatewayUrls:n,name:i,universalResolverAddress:o}){const a=await TI(e,LB,"getEnsText")({blockNumber:t,blockTag:r,key:"avatar",name:i,universalResolverAddress:o});if(!a)return null;try{return await FB(e,{record:a,gatewayUrls:n})}catch{return null}}(e,t),getEnsName:t=>async function(e,{address:t,blockNumber:r,blockTag:n,universalResolverAddress:i}){let o=i;if(!o){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");o=DC({blockNumber:r,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const[i,s]=await TI(e,GC,"readContract")({address:o,abi:CC,functionName:"reverse",args:[AT(xB(a))],blockNumber:r,blockTag:n});return t.toLowerCase()!==s.toLowerCase()?null:i}catch(e){if(yB(e,"reverse"))return null;throw e}}(e,t),getEnsResolver:t=>async function(e,{blockNumber:t,blockTag:r,name:n,universalResolverAddress:i}){let o=i;if(!o){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");o=DC({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}const[a]=await TI(e,GC,"readContract")({address:o,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[AT(xB(n))],blockNumber:t,blockTag:r});return a}(e,t),getEnsText:t=>LB(e,t),getFeeHistory:t=>DB(e,t),estimateFeesPerGas:t=>async function(e,t){return bC(e,t)}(e,t),getFilterChanges:e=>rB(0,e),getFilterLogs:e=>async function(e,{filter:t}){const r=t.strict??!1;return(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map((e=>{try{const{eventName:n,args:i}="abi"in t&&t.abi?AC({abi:t.abi,data:e.data,topics:e.topics,strict:r}):{eventName:void 0,args:void 0};return _C(e,{args:i,eventName:n})}catch(r){let n,i;if(r instanceof XI||r instanceof QI){if("strict"in t&&t.strict)return;n=r.abiItem.name,i=r.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}return _C(e,{args:i?[]:{},eventName:n})}})).filter(Boolean)}(0,e),getGasPrice:()=>pC(e),getLogs:t=>kC(e,t),getProof:t=>ON(e,t),estimateMaxPriorityFeePerGas:t=>async function(e,t){return mC(e,t)}(e,t),getStorageAt:t=>async function(e,{address:t,blockNumber:r,blockTag:n="latest",slot:i}){const o=void 0!==r?kT(r):void 0;return await e.request({method:"eth_getStorageAt",params:[t,i,o||n]})}(e,t),getTransaction:t=>MN(e,t),getTransactionConfirmations:t=>async function(e,{hash:t,transactionReceipt:r}){const[n,i]=await Promise.all([TI(e,tB,"getBlockNumber")({}),t?TI(e,MN,"getBlockNumber")({hash:t}):void 0]),o=r?.blockNumber||i?.blockNumber;return o?n-o+1n:0n}(e,t),getTransactionCount:t=>gC(e,t),getTransactionReceipt:t=>CN(e,t),multicall:t=>async function(e,t){const{allowFailure:r=!0,batchSize:n,blockNumber:i,blockTag:o,contracts:a,multicallAddress:s}=t,c=n??("object"==typeof e.batch?.multicall&&e.batch.multicall.batchSize||1024);let u=s;if(!u){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");u=DC({blockNumber:i,chain:e.chain,contract:"multicall3"})}const l=[[]];let f=0,d=0;for(let e=0;e0&&d>c&&l[f].length>0&&(f++,d=(e.length-2)/2,l[f]=[]),l[f]=[...l[f],{allowFailure:!0,callData:e,target:n}]}catch(e){const a=FM(e,{abi:t,address:n,args:i,docsPath:"/docs/contract/multicall",functionName:o});if(!r)throw a;l[f]=[...l[f],{allowFailure:!0,callData:"0x",target:n}]}}const h=await Promise.allSettled(l.map((t=>TI(e,GC,"readContract")({abi:TC,address:u,args:[t],blockNumber:i,blockTag:o,functionName:"aggregate3"})))),p=[];for(let e=0;evC(e,t),readContract:t=>GC(e,t),sendRawTransaction:t=>async function(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]})}(e,t),simulateContract:t=>async function(e,{abi:t,address:r,args:n,dataSuffix:i,functionName:o,...a}){const s=a.account?NO(a.account):void 0,c=RO({abi:t,args:n,functionName:o});try{const{data:s}=await TI(e,HC,"call")({batch:!1,data:`${c}${i?i.replace("0x",""):""}`,to:r,...a});return{result:IC({abi:t,args:n,functionName:o,data:s||"0x"}),request:{abi:t,address:r,args:n,dataSuffix:i,functionName:o,...a}}}catch(e){throw FM(e,{abi:t,address:r,args:n,docsPath:"/docs/contract/simulateContract",functionName:o,sender:s?.address})}}(e,t),verifyMessage:t=>async function(e,{address:t,message:r,signature:n,...i}){return nR(e,{address:t,hash:SN(r),signature:n,...i})}(e,t),verifyTypedData:t=>async function(e,{address:t,signature:r,message:n,primaryType:i,types:o,domain:a,...s}){return nR(e,{address:t,hash:YB({message:n,primaryType:i,types:o,domain:a}),signature:r,...s})}(e,t),uninstallFilter:e=>nB(0,e),waitForTransactionReceipt:t=>async function(e,{confirmations:t=1,hash:r,onReplaced:n,pollingInterval:i=e.pollingInterval,timeout:o}){const a=GO(["waitForTransactionReceipt",e.uid,r]);let s,c,u,l=!1;return new Promise(((f,d)=>{o&&setTimeout((()=>d(new iM({hash:r}))),o);const h=WC(a,{onReplaced:n,resolve:f,reject:d},(n=>{const o=TI(e,iR,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:i,async onBlockNumber(i){if(l)return;let a=i;const f=e=>{o(),e(),h()};try{if(u){if(t>1&&(!u.blockNumber||a-u.blockNumber+1nn.resolve(u)))}if(s||(l=!0,await cB((async()=>{s=await TI(e,MN,"getTransaction")({hash:r}),s.blockNumber&&(a=s.blockNumber)}),{delay:({count:e})=>200*(1<1&&(!u.blockNumber||a-u.blockNumber+1nn.resolve(u)))}catch(r){if(s&&(r instanceof rM||r instanceof nM))try{c=s,l=!0;const r=await cB((()=>TI(e,hC,"getBlock")({blockNumber:a,includeTransactions:!0})),{delay:({count:e})=>200*(1<e instanceof sC});l=!1;const i=r.transactions.find((({from:e,nonce:t})=>e===c.from&&t===c.nonce));if(!i)return;if(u=await TI(e,CN,"getTransactionReceipt")({hash:i.hash}),t>1&&(!u.blockNumber||a-u.blockNumber+1n{n.onReplaced?.({reason:o,replacedTransaction:c,transaction:i,transactionReceipt:u}),n.resolve(u)}))}catch(e){f((()=>n.reject(e)))}else f((()=>n.reject(r)))}}})}))}))}(e,t),watchBlocks:t=>function(e,{blockTag:t="latest",emitMissed:r=!1,emitOnBegin:n=!1,onBlock:i,onError:o,includeTransactions:a,poll:s,pollingInterval:c=e.pollingInterval}){const u=void 0!==s?s:"webSocket"!==e.transport.type,l=a??!1;let f;return u?WC(GO(["watchBlocks",e.uid,r,n,l,c]),{onBlock:i,onError:o},(i=>ZC((async()=>{try{const n=await TI(e,hC,"getBlock")({blockTag:t,includeTransactions:l});if(n.number&&f?.number){if(n.number===f.number)return;if(n.number-f.number>1&&r)for(let t=f?.number+1n;tf.number)&&(i.onBlock(n,f),f=n)}catch(e){i.onError?.(e)}}),{emitOnBegin:n,interval:c}))):(()=>{let t=!0,r=()=>t=!1;return(async()=>{try{const{unsubscribe:n}=await e.transport.subscribe({params:["newHeads"],onData(r){if(!t)return;const n=(e.chain?.formatters?.block?.format||fC)(r.result);i(n,f),f=n},onError(e){o?.(e)}});r=n,t||r()}catch(e){o?.(e)}})(),r})()}(e,t),watchBlockNumber:t=>iR(e,t),watchContractEvent:t=>function(e,{abi:t,address:r,args:n,batch:i=!0,eventName:o,onError:a,onLogs:s,poll:c,pollingInterval:u=e.pollingInterval,strict:l}){return(void 0!==c?c:"webSocket"!==e.transport.type)?(()=>{const c=GO(["watchContractEvent",r,n,i,e.uid,o,u]),f=l??!1;return WC(c,{onLogs:s,onError:a},(a=>{let s,c,l=!1;const d=ZC((async()=>{if(l)try{let u;if(c)u=await TI(e,rB,"getFilterChanges")({filter:c});else{const i=await TI(e,tB,"getBlockNumber")({});u=s&&s!==i?await TI(e,SC,"getContractEvents")({abi:t,address:r,args:n,eventName:o,fromBlock:s+1n,toBlock:i,strict:f}):[],s=i}if(0===u.length)return;if(i)a.onLogs(u);else for(const e of u)a.onLogs([e])}catch(e){c&&e instanceof EM&&(l=!1),a.onError?.(e)}else{try{c=await TI(e,BO,"createContractEventFilter")({abi:t,address:r,args:n,eventName:o,strict:f})}catch{}l=!0}}),{emitOnBegin:!0,interval:u});return async()=>{c&&await TI(e,nB,"uninstallFilter")({filter:c}),d()}}))})():(()=>{let i=!0,c=()=>i=!1;return(async()=>{try{const u=o?OO({abi:t,eventName:o,args:n}):[],{unsubscribe:f}=await e.transport.subscribe({params:["logs",{address:r,topics:u}],onData(e){if(!i)return;const r=e.result;try{const{eventName:e,args:n}=AC({abi:t,data:r.data,topics:r.topics,strict:l}),i=_C(r,{args:n,eventName:e});s([i])}catch(e){let t,n;if(e instanceof XI||e instanceof QI){if(l)return;t=e.abiItem.name,n=e.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}const i=_C(r,{args:n?[]:{},eventName:t});s([i])}},onError(e){a?.(e)}});c=f,i||c()}catch(e){a?.(e)}})(),c})()}(e,t),watchEvent:t=>function(e,{address:t,args:r,batch:n=!0,event:i,events:o,onError:a,onLogs:s,poll:c,pollingInterval:u=e.pollingInterval,strict:l}){const f=void 0!==c?c:"webSocket"!==e.transport.type,d=l??!1;return f?WC(GO(["watchEvent",t,r,n,e.uid,i,u]),{onLogs:s,onError:a},(a=>{let s,c,l=!1;const f=ZC((async()=>{if(l)try{let u;if(c)u=await TI(e,rB,"getFilterChanges")({filter:c});else{const n=await TI(e,tB,"getBlockNumber")({});u=s&&s!==n?await TI(e,kC,"getLogs")({address:t,args:r,event:i,events:o,fromBlock:s+1n,toBlock:n}):[],s=n}if(0===u.length)return;if(n)a.onLogs(u);else for(const e of u)a.onLogs([e])}catch(e){c&&e instanceof EM&&(l=!1),a.onError?.(e)}else{try{c=await TI(e,jB,"createEventFilter")({address:t,args:r,event:i,events:o,strict:d})}catch{}l=!0}}),{emitOnBegin:!0,interval:u});return async()=>{c&&await TI(e,nB,"uninstallFilter")({filter:c}),f()}})):(()=>{let n=!0,c=()=>n=!1;return(async()=>{try{const u=o??(i?[i]:void 0);let f=[];u&&(f=[u.flatMap((e=>OO({abi:[e],eventName:e.name,args:r})))],i&&(f=f[0]));const{unsubscribe:h}=await e.transport.subscribe({params:["logs",{address:t,topics:f}],onData(e){if(!n)return;const t=e.result;try{const{eventName:e,args:r}=AC({abi:u,data:t.data,topics:t.topics,strict:d}),n=_C(t,{args:r,eventName:e});s([n])}catch(e){let r,n;if(e instanceof XI||e instanceof QI){if(l)return;r=e.abiItem.name,n=e.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}const i=_C(t,{args:n?[]:{},eventName:r});s([i])}},onError(e){a?.(e)}});c=h,n||c()}catch(e){a?.(e)}})(),c})()}(e,t),watchPendingTransactions:t=>function(e,{batch:t=!0,onError:r,onTransactions:n,poll:i,pollingInterval:o=e.pollingInterval}){return(void 0!==i?i:"webSocket"!==e.transport.type)?WC(GO(["watchPendingTransactions",e.uid,t,o]),{onTransactions:n,onError:r},(r=>{let n;const i=ZC((async()=>{try{if(!n)try{return void(n=await TI(e,UB,"createPendingTransactionFilter")({}))}catch(e){throw i(),e}const o=await TI(e,rB,"getFilterChanges")({filter:n});if(0===o.length)return;if(t)r.onTransactions(o);else for(const e of o)r.onTransactions([e])}catch(e){r.onError?.(e)}}),{emitOnBegin:!0,interval:o});return async()=>{n&&await TI(e,nB,"uninstallFilter")({filter:n}),i()}})):(()=>{let t=!0,i=()=>t=!1;return(async()=>{try{const{unsubscribe:o}=await e.transport.subscribe({params:["newPendingTransactions"],onData(e){if(!t)return;const r=e.result;n([r])},onError(e){r?.(e)}});i=o,t||i()}catch(e){r?.(e)}})(),i})()}(e,t)}}function aR(e){const{key:t="public",name:r="Public Client"}=e,n=function(e){const{batch:t,cacheTime:r=e.pollingInterval??4e3,key:n="base",name:i="Base Client",pollingInterval:o=4e3,type:a="base"}=e,s=e.chain,c=e.account?NO(e.account):void 0,{config:u,request:l,value:f}=e.transport({chain:s,pollingInterval:o}),d={account:c,batch:t,cacheTime:r,chain:s,key:n,name:i,pollingInterval:o,request:l,transport:{...u,...f},type:a,uid:sB()};return Object.assign(d,{extend:function e(t){return r=>{const n=r(t);for(const e in d)delete n[e];const i={...t,...n};return Object.assign(i,{extend:e(i)})}}(d)})}({...e,key:t,name:r,type:"publicClient"});return n.extend(oR)}const sR=BigInt(0),cR=BigInt(1),uR=BigInt(2),lR=BigInt(3),fR=BigInt(4),dR=BigInt(5),hR=BigInt(8); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function pR(e,t){const r=e%t;return r>=sR?r:t+r}function mR(e,t,r){if(r<=sR||t 0");if(r===cR)return sR;let n=cR;for(;t>sR;)t&cR&&(n=n*e%r),e=e*e%r,t>>=cR;return n}function bR(e,t,r){let n=e;for(;t-- >sR;)n*=n,n%=r;return n}function gR(e,t){if(e===sR||t<=sR)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=pR(e,t),n=t,i=sR,o=cR;for(;r!==sR;){const e=n%r,t=i-o*(n/r);n=r,r=e,i=o,o=t}if(n!==cR)throw new Error("invert: does not exist");return pR(i,t)}function yR(e){if(e%fR===lR){const t=(e+cR)/fR;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}if(e%hR===dR){const t=(e-dR)/hR;return function(e,r){const n=e.mul(r,uR),i=e.pow(n,t),o=e.mul(r,i),a=e.mul(e.mul(o,uR),i),s=e.mul(o,e.sub(a,e.ONE));if(!e.eql(e.sqr(s),r))throw new Error("Cannot find square root");return s}}return function(e){const t=(e-cR)/uR;let r,n,i;for(r=e-cR,n=0;r%uR===sR;r/=uR,n++);for(i=uR;i(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});tR(e,t)}(e.Fp),tR(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...wR(e.n,e.nBitLength),...e,p:e.Fp.ORDER})} /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const{bytesToNumberBE:SR,hexToBytes:PR}=rR,IR={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:t}=IR;if(e.length<2||2!==e[0])throw new t("Invalid signature integer tag");const r=e[1],n=e.subarray(2,r+2);if(!r||n.length!==r)throw new t("Invalid signature integer: wrong length");if(128&n[0])throw new t("Invalid signature integer: negative");if(0===n[0]&&!(128&n[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:SR(n),l:e.subarray(r+2)}},toSig(e){const{Err:t}=IR,r="string"==typeof e?PR(e):e;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||48!=r[0])throw new t("Invalid signature tag");if(r[1]!==n-2)throw new t("Invalid signature: incorrect length");const{d:i,l:o}=IR._parseInt(r.subarray(2)),{d:a,l:s}=IR._parseInt(o);if(s.length)throw new t("Invalid signature: left bytes after parsing");return{r:i,s:a}},hexFromSig(e){const t=e=>8&Number.parseInt(e[0],16)?"00"+e:e,r=e=>{const t=e.toString(16);return 1&t.length?`0${t}`:t},n=t(r(e.s)),i=t(r(e.r)),o=n.length/2,a=i.length/2,s=r(o),c=r(a);return`30${r(a+o+4)}02${c}${i}02${s}${n}`}},TR=BigInt(0),OR=BigInt(1);BigInt(2);const MR=BigInt(3);function CR(e){const t=function(e){const t=kR(e);tR(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:i}=t;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:r}=t,n=t.toBytes||((e,t,n)=>{const i=t.toAffine();return WN(Uint8Array.from([4]),r.toBytes(i.x),r.toBytes(i.y))}),i=t.fromBytes||(e=>{const t=e.subarray(1);return{x:r.fromBytes(t.subarray(0,r.BYTES)),y:r.fromBytes(t.subarray(r.BYTES,2*r.BYTES))}});function o(e){const{a:n,b:i}=t,o=r.sqr(e),a=r.mul(o,e);return r.add(r.add(a,r.mul(e,n)),i)}if(!r.eql(r.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function a(e){return"bigint"==typeof e&&TRr.eql(e,r.ZERO);return i(t)&&i(n)?f.ZERO:new f(t,n,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=r.invertBatch(e.map((e=>e.pz)));return e.map(((e,r)=>e.toAffine(t[r]))).map(f.fromAffine)}static fromHex(e){const t=f.fromAffine(i(VN("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return f.BASE.multiply(c(e))}_setWindowSize(e){this._WINDOW_SIZE=e,u.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:e,y:n}=this.toAffine();if(!r.isValid(e)||!r.isValid(n))throw new Error("bad point: x or y not FE");const i=r.sqr(n),a=o(e);if(!r.eql(i,a))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(r.isOdd)return!r.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){l(e);const{px:t,py:n,pz:i}=this,{px:o,py:a,pz:s}=e,c=r.eql(r.mul(t,s),r.mul(o,i)),u=r.eql(r.mul(n,s),r.mul(a,i));return c&&u}negate(){return new f(this.px,r.neg(this.py),this.pz)}double(){const{a:e,b:n}=t,i=r.mul(n,MR),{px:o,py:a,pz:s}=this;let c=r.ZERO,u=r.ZERO,l=r.ZERO,d=r.mul(o,o),h=r.mul(a,a),p=r.mul(s,s),m=r.mul(o,a);return m=r.add(m,m),l=r.mul(o,s),l=r.add(l,l),c=r.mul(e,l),u=r.mul(i,p),u=r.add(c,u),c=r.sub(h,u),u=r.add(h,u),u=r.mul(c,u),c=r.mul(m,c),l=r.mul(i,l),p=r.mul(e,p),m=r.sub(d,p),m=r.mul(e,m),m=r.add(m,l),l=r.add(d,d),d=r.add(l,d),d=r.add(d,p),d=r.mul(d,m),u=r.add(u,d),p=r.mul(a,s),p=r.add(p,p),d=r.mul(p,m),c=r.sub(c,d),l=r.mul(p,h),l=r.add(l,l),l=r.add(l,l),new f(c,u,l)}add(e){l(e);const{px:n,py:i,pz:o}=this,{px:a,py:s,pz:c}=e;let u=r.ZERO,d=r.ZERO,h=r.ZERO;const p=t.a,m=r.mul(t.b,MR);let b=r.mul(n,a),g=r.mul(i,s),y=r.mul(o,c),v=r.add(n,i),w=r.add(a,s);v=r.mul(v,w),w=r.add(b,g),v=r.sub(v,w),w=r.add(n,o);let E=r.add(a,c);return w=r.mul(w,E),E=r.add(b,y),w=r.sub(w,E),E=r.add(i,o),u=r.add(s,c),E=r.mul(E,u),u=r.add(g,y),E=r.sub(E,u),h=r.mul(p,w),u=r.mul(m,y),h=r.add(u,h),u=r.sub(g,h),h=r.add(g,h),d=r.mul(u,h),g=r.add(b,b),g=r.add(g,b),y=r.mul(p,y),w=r.mul(m,w),g=r.add(g,y),y=r.sub(b,y),y=r.mul(p,y),w=r.add(w,y),b=r.mul(g,w),d=r.add(d,b),b=r.mul(E,w),u=r.mul(v,u),u=r.sub(u,b),b=r.mul(v,g),h=r.mul(E,h),h=r.add(h,b),new f(u,d,h)}subtract(e){return this.add(e.negate())}is0(){return this.equals(f.ZERO)}wNAF(e){return h.wNAFCached(this,u,e,(e=>{const t=r.invertBatch(e.map((e=>e.pz)));return e.map(((e,r)=>e.toAffine(t[r]))).map(f.fromAffine)}))}multiplyUnsafe(e){const n=f.ZERO;if(e===TR)return n;if(s(e),e===OR)return this;const{endo:i}=t;if(!i)return h.unsafeLadder(this,e);let{k1neg:o,k1:a,k2neg:c,k2:u}=i.splitScalar(e),l=n,d=n,p=this;for(;a>TR||u>TR;)a&OR&&(l=l.add(p)),u&OR&&(d=d.add(p)),p=p.double(),a>>=OR,u>>=OR;return o&&(l=l.negate()),c&&(d=d.negate()),d=new f(r.mul(d.px,i.beta),d.py,d.pz),l.add(d)}multiply(e){s(e);let n,i,o=e;const{endo:a}=t;if(a){const{k1neg:e,k1:t,k2neg:s,k2:c}=a.splitScalar(o);let{p:u,f:l}=this.wNAF(t),{p:d,f:p}=this.wNAF(c);u=h.constTimeNegate(e,u),d=h.constTimeNegate(s,d),d=new f(r.mul(d.px,a.beta),d.py,d.pz),n=u.add(d),i=l.add(p)}else{const{p:e,f:t}=this.wNAF(o);n=e,i=t}return f.normalizeZ([n,i])[0]}multiplyAndAddUnsafe(e,t,r){const n=f.BASE,i=(e,t)=>t!==TR&&t!==OR&&e.equals(n)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,r));return o.is0()?void 0:o}toAffine(e){const{px:t,py:n,pz:i}=this,o=this.is0();null==e&&(e=o?r.ONE:r.inv(i));const a=r.mul(t,e),s=r.mul(n,e),c=r.mul(i,e);if(o)return{x:r.ZERO,y:r.ZERO};if(!r.eql(c,r.ONE))throw new Error("invZ was invalid");return{x:a,y:s}}isTorsionFree(){const{h:e,isTorsionFree:r}=t;if(e===OR)return!0;if(r)return r(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:r}=t;return e===OR?this:r?r(f,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return this.assertValidity(),n(f,this,e)}toHex(e=!0){return UN(this.toRawBytes(e))}}f.BASE=new f(t.Gx,t.Gy,r.ONE),f.ZERO=new f(r.ZERO,r.ONE,r.ZERO);const d=t.nBitLength,h=function(e,t){const r=(e,t)=>{const r=t.negate();return e?r:t},n=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:r,unsafeLadder(t,r){let n=e.ZERO,i=t;for(;r>xR;)r&_R&&(n=n.add(i)),i=i.double(),r>>=_R;return n},precomputeWindow(e,t){const{windows:r,windowSize:i}=n(t),o=[];let a=e,s=a;for(let e=0;e>=d,n>s&&(n-=f,o+=_R);const a=t,h=t+Math.abs(n)-1,p=e%2!=0,m=n<0;0===n?u=u.add(r(p,i[a])):c=c.add(r(m,i[h]))}return{p:c,f:u}},wNAFCached(e,t,r,n){const i=e._WINDOW_SIZE||1;let o=t.get(e);return o||(o=this.precomputeWindow(e,i),1!==i&&t.set(e,n(o))),this.wNAF(i,o,r)}}}(f,t.endo?Math.ceil(d/2):d);return{CURVE:t,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:a}}function BR(e){const t=function(e){const t=kR(e);return tR(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:r,n:n}=t,i=r.BYTES+1,o=2*r.BYTES+1;function a(e){return pR(e,n)}function s(e){return gR(e,n)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:f}=CR({...t,toBytes(e,t,n){const i=t.toAffine(),o=r.toBytes(i.x),a=WN;return n?a(Uint8Array.from([t.hasEvenY()?2:3]),o):a(Uint8Array.from([4]),o,r.toBytes(i.y))},fromBytes(e){const t=e.length,n=e[0],a=e.subarray(1);if(t!==i||2!==n&&3!==n){if(t===o&&4===n){return{x:r.fromBytes(a.subarray(0,r.BYTES)),y:r.fromBytes(a.subarray(r.BYTES,2*r.BYTES))}}throw new Error(`Point of length ${t} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const e=HN(a);if(!(TR<(s=e)&&sUN(qN(e,t.nByteLength));function h(e){return e>n>>OR}const p=(e,t,r)=>HN(e.slice(t,r));class m{constructor(e,t,r){this.r=e,this.s=t,this.recovery=r,this.assertValidity()}static fromCompact(e){const r=t.nByteLength;return e=VN("compactSignature",e,2*r),new m(p(e,0,r),p(e,r,2*r))}static fromDER(e){const{r:t,s:r}=IR.toSig(VN("DER",e));return new m(t,r)}assertValidity(){if(!f(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!f(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(e){return new m(this.r,this.s,e)}recoverPublicKey(e){const{r:n,s:i,recovery:o}=this,u=v(VN("msgHash",e));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const l=2===o||3===o?n+t.n:n;if(l>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const f=1&o?"03":"02",h=c.fromHex(f+d(l)),p=s(l),m=a(-u*p),b=a(i*p),g=c.BASE.multiplyAndAddUnsafe(h,m,b);if(!g)throw new Error("point at infinify");return g.assertValidity(),g}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return $N(this.toDERHex())}toDERHex(){return IR.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return $N(this.toCompactHex())}toCompactHex(){return d(this.r)+d(this.s)}}const b={isValidPrivateKey(e){try{return u(e),!0}catch(e){return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const e=AR(t.n);return function(e,t,r=!1){const n=e.length,i=ER(t),o=AR(t);if(n<16||n1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);const a=pR(r?HN(e):GN(e),t-cR)+cR;return r?KN(a,i):qN(a,i)}(t.randomBytes(e),t.n)},precompute:(e=8,t=c.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function g(e){const t=e instanceof Uint8Array,r="string"==typeof e,n=(t||r)&&e.length;return t?n===i||n===o:r?n===2*i||n===2*o:e instanceof c}const y=t.bits2int||function(e){const r=HN(e),n=8*e.length-t.nBitLength;return n>0?r>>BigInt(n):r},v=t.bits2int_modN||function(e){return a(y(e))},w=ZN(t.nBitLength);function E(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(TR<=e&&ee in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:l}=t;let{lowS:d,prehash:p,extraEntropy:b}=i;null==d&&(d=!0),e=VN("msgHash",e),p&&(e=VN("prehashed msgHash",o(e)));const g=v(e),w=u(n),A=[E(w),E(g)];if(null!=b){const e=!0===b?l(r.BYTES):b;A.push(VN("extraEntropy",e))}const _=WN(...A),k=g;return{seed:_,k2sig:function(e){const t=y(e);if(!f(t))return;const r=s(t),n=c.BASE.multiply(t).toAffine(),i=a(n.x);if(i===TR)return;const o=a(r*a(k+i*w));if(o===TR)return;let u=(n.x===i?0:2)|Number(n.y&OR),l=o;return d&&h(o)&&(l=function(e){return h(e)?a(-e):e}(o),u^=1),new m(i,l,u)}}}const x={lowS:t.lowS,prehash:!1},_={lowS:t.lowS,prehash:!1};return c.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return c.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,r=!0){if(g(e))throw new Error("first arg must be private key");if(!g(t))throw new Error("second arg must be public key");return c.fromHex(t).multiply(u(e)).toRawBytes(r)},sign:function(e,r,n=x){const{seed:i,k2sig:o}=A(e,r,n),a=t;return QN(a.hash.outputLen,a.nByteLength,a.hmac)(i,o)},verify:function(e,r,n,i=_){const o=e;if(r=VN("msgHash",r),n=VN("publicKey",n),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:u,prehash:l}=i;let f,d;try{if("string"==typeof o||o instanceof Uint8Array)try{f=m.fromDER(o)}catch(e){if(!(e instanceof IR.Err))throw e;f=m.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:e,s:t}=o;f=new m(e,t)}}d=c.fromHex(n)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(u&&f.hasHighS())return!1;l&&(r=t.hash(r));const{r:h,s:p}=f,b=v(r),g=s(p),y=a(b*g),w=a(h*g),E=c.BASE.multiplyAndAddUnsafe(d,y,w)?.toAffine();return!!E&&a(E.x)===h},ProjectivePoint:c,Signature:m,utils:b}}BigInt(4);let NR=class extends WT{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");RT(e.outputLen),RT(e.blockLen)}(e);const r=VT(t);if(this.iHash=e.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 n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?e.create().update(r).digest():r);for(let e=0;enew NR(e,t).update(r).digest(); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ function FR(e){return{hash:e,hmac:(t,...r)=>RR(e,t,function(...e){const t=new Uint8Array(e.reduce(((e,t)=>e+t.length),0));let r=0;return e.forEach((e=>{if(!GT(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length})),t}(...r)),randomBytes:ZT}}RR.create=(e,t)=>new NR(e,t); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const LR=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),jR=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),UR=BigInt(1),DR=BigInt(2),zR=(e,t)=>(e+t/DR)/t;const $R=function(e,t,r=!1,n={}){if(e<=sR)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:o}=wR(e,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=yR(e),s=Object.freeze({ORDER:e,BITS:i,BYTES:o,MASK:ZN(i),ZERO:sR,ONE:cR,create:t=>pR(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return sR<=t&&te===sR,isOdd:e=>(e&cR)===cR,neg:t=>pR(-t,e),eql:(e,t)=>e===t,sqr:t=>pR(t*t,e),add:(t,r)=>pR(t+r,e),sub:(t,r)=>pR(t-r,e),mul:(t,r)=>pR(t*r,e),pow:(e,t)=>function(e,t,r){if(r 0");if(r===sR)return e.ONE;if(r===cR)return t;let n=e.ONE,i=t;for(;r>sR;)r&cR&&(n=e.mul(n,i)),i=e.sqr(i),r>>=cR;return n}(s,e,t),div:(t,r)=>pR(t*gR(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>gR(t,e),sqrt:n.sqrt||(e=>a(s,e)),invertBatch:e=>function(e,t){const r=new Array(t.length),n=t.reduce(((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n))),e.ONE),i=e.inv(n);return t.reduceRight(((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n))),i),r}(s,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?KN(e,o):qN(e,o),fromBytes:e=>{if(e.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return r?GN(e):HN(e)}});return Object.freeze(s)}(LR,void 0,void 0,{sqrt:function(e){const t=LR,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),a=BigInt(23),s=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,f=bR(l,r,t)*l%t,d=bR(f,r,t)*l%t,h=bR(d,DR,t)*u%t,p=bR(h,i,t)*h%t,m=bR(p,o,t)*p%t,b=bR(m,s,t)*m%t,g=bR(b,c,t)*b%t,y=bR(g,s,t)*m%t,v=bR(y,r,t)*l%t,w=bR(v,a,t)*p%t,E=bR(w,n,t)*u%t,A=bR(E,DR,t);if(!$R.eql($R.sqr(A),e))throw new Error("Cannot find square root");return A}}),HR=function(e,t){const r=t=>BR({...e,...FR(t)});return Object.freeze({...r(t),create:r})}({a:BigInt(0),b:BigInt(7),Fp:$R,n:jR,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=jR,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-UR*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,a=BigInt("0x100000000000000000000000000000000"),s=zR(o*e,t),c=zR(-n*e,t);let u=pR(e-s*r-c*i,t),l=pR(-s*n-c*o,t);const f=u>a,d=l>a;if(f&&(u=t-u),d&&(l=t-l),u>a||l>a)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:u,k2neg:d,k2:l}}}},_N);BigInt(0),HR.ProjectivePoint;const GR=VB({id:787,name:"Acala",network:"acala",nativeCurrency:{name:"Acala",symbol:"ACA",decimals:18},rpcUrls:{public:{http:["https://eth-rpc-acala.aca-api.network"],webSocket:["wss://eth-rpc-acala.aca-api.network"]},default:{http:["https://eth-rpc-acala.aca-api.network"],webSocket:["wss://eth-rpc-acala.aca-api.network"]}},blockExplorers:{default:{name:"Acala Blockscout",url:"https://blockscout.acala.network"}},testnet:!1}),qR=VB({id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),KR=VB({id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Arbitrum Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:88114}},testnet:!0}),VR=VB({id:42170,name:"Arbitrum Nova",network:"arbitrum-nova",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://arbitrum-nova.public.blastapi.io"],webSocket:["wss://arbitrum-nova.public.blastapi.io"]},default:{http:["https://nova.arbitrum.io/rpc"]},public:{http:["https://nova.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://nova.arbiscan.io"},blockScout:{name:"BlockScout",url:"https://nova-explorer.arbitrum.io/"},default:{name:"Arbiscan",url:"https://nova.arbiscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1746963}}}),WR=VB({id:592,name:"Astar",network:"astar-mainnet",nativeCurrency:{name:"Astar",symbol:"ASTR",decimals:18},rpcUrls:{public:{http:["https://astar.api.onfinality.io/public"]},default:{http:["https://astar.api.onfinality.io/public"]}},blockExplorers:{default:{name:"Astar Subscan",url:"https://astar.subscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:761794}},testnet:!1}),JR=VB({id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-sepolia.g.alchemy.com/v2"],webSocket:["wss://arb-sepolia.g.alchemy.com/v2"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://sepolia.arbiscan.io"},default:{name:"Arbiscan",url:"https://sepolia.arbiscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:81930}},testnet:!0}),ZR=VB({id:1261120,name:"Astar zkEVM Testnet zKatana",network:"zKatana",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.zkatana.gelato.digital","https://rpc.startale.com/zkatana"]},public:{http:["https://rpc.zkatana.gelato.digital","https://rpc.startale.com/zkatana"]}},blockExplorers:{blockscout:{name:"Blockscout zKatana chain explorer",url:"https://zkatana.blockscout.com"},default:{name:"zKatana Explorer",url:"https://zkatana.explorer.startale.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:31317}},testnet:!0}),YR=VB({id:1313161554,name:"Aurora",network:"aurora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{infura:{http:["https://aurora-mainnet.infura.io/v3"]},default:{http:["https://mainnet.aurora.dev"]},public:{http:["https://mainnet.aurora.dev"]}},blockExplorers:{etherscan:{name:"Aurorascan",url:"https://aurorascan.dev"},default:{name:"Aurorascan",url:"https://aurorascan.dev"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:62907816}}}),XR=VB({id:1313161555,name:"Aurora Testnet",network:"aurora-testnet",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{infura:{http:["https://aurora-testnet.infura.io/v3"]},default:{http:["https://testnet.aurora.dev"]},public:{http:["https://testnet.aurora.dev"]}},blockExplorers:{etherscan:{name:"Aurorascan",url:"https://testnet.aurorascan.dev"},default:{name:"Aurorascan",url:"https://testnet.aurorascan.dev"}},testnet:!0}),QR=VB({id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:11907934}}}),eF=VB({id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7096959}},testnet:!0}),tF=VB({id:5165,network:"bahamut",name:"Bahamut",nativeCurrency:{name:"Fasttoken",symbol:"FTN",decimals:18},rpcUrls:{default:{http:["https://rpc1.bahamut.io","https://bahamut.publicnode.com","https://rpc2.bahamut.io"],webSocket:["wss://ws1.sahara.bahamutchain.com","wss://bahamut.publicnode.com","wss://ws2.sahara.bahamutchain.com"]},public:{http:["https://rpc1.bahamut.io","https://bahamut.publicnode.com","https://rpc2.bahamut.io"],webSocket:["wss://ws1.sahara.bahamutchain.com","wss://bahamut.publicnode.com","wss://ws2.sahara.bahamutchain.com"]}},blockExplorers:{default:{name:"Ftnscan",url:"https://www.ftnscan.com"}}}),rF={block:dC({format(e){const t=e.transactions?.map((e=>{if("string"==typeof e)return e;const t=uC(e);return"0x7e"===t.typeHex&&(t.isSystemTx=e.isSystemTx,t.mint=e.mint?gT(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t}));return{transactions:t,stateRoot:e.stateRoot}}}),transaction:lC({format(e){const t={};return"0x7e"===e.type&&(t.isSystemTx=e.isSystemTx,t.mint=e.mint?gT(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t}}),transactionReceipt:bN({format:e=>({l1GasPrice:e.l1GasPrice?gT(e.l1GasPrice):null,l1GasUsed:e.l1GasUsed?gT(e.l1GasUsed):null,l1Fee:e.l1Fee?gT(e.l1Fee):null,l1FeeScalar:e.l1FeeScalar?Number(e.l1FeeScalar):null})})},nF=VB({id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://base-mainnet.g.alchemy.com/v2"],webSocket:["wss://base-mainnet.g.alchemy.com/v2"]},infura:{http:["https://base-mainnet.infura.io/v3"],webSocket:["wss://base-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{blockscout:{name:"Basescout",url:"https://base.blockscout.com"},default:{name:"Basescan",url:"https://basescan.org"},etherscan:{name:"Basescan",url:"https://basescan.org"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:5022}}},{formatters:rF}),iF=VB({id:84531,network:"base-goerli",name:"Base Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://base-goerli.g.alchemy.com/v2"],webSocket:["wss://base-goerli.g.alchemy.com/v2"]},default:{http:["https://goerli.base.org"]},public:{http:["https://goerli.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://goerli.basescan.org"},default:{name:"Basescan",url:"https://goerli.basescan.org"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1376988}},testnet:!0,sourceId:5},{formatters:rF}),oF=VB({id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://base-sepolia.g.alchemy.com/v2"],webSocket:["wss://base-sepolia.g.alchemy.com/v2"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{blockscout:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"},default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0,sourceId:11155111},{formatters:rF}),aF=VB({id:641230,name:"Bear Network Chain Mainnet",network:"BearNetworkChainMainnet",nativeCurrency:{decimals:18,name:"BearNetworkChain",symbol:"BRNKC"},rpcUrls:{public:{http:["https://brnkc-mainnet.bearnetwork.net"]},default:{http:["https://brnkc-mainnet.bearnetwork.net"]}},blockExplorers:{default:{name:"BrnkScan",url:"https://brnkscan.bearnetwork.net"}}}),sF=VB({id:751230,name:"Bear Network Chain Testnet",network:"BearNetworkChainTestnet",nativeCurrency:{decimals:18,name:"tBRNKC",symbol:"tBRNKC"},rpcUrls:{public:{http:["https://brnkc-test.bearnetwork.net"]},default:{http:["https://brnkc-test.bearnetwork.net"]}},blockExplorers:{default:{name:"BrnkTestScan",url:"https://brnktest-scan.bearnetwork.net"}},testnet:!0}),cF=VB({id:199,name:"BitTorrent",network:"bittorrent-chain-mainnet",nativeCurrency:{name:"BitTorrent",symbol:"BTT",decimals:18},rpcUrls:{default:{http:["https://rpc.bittorrentchain.io"]},public:{http:["https://rpc.bittorrentchain.io"]}},blockExplorers:{etherscan:{name:"Bttcscan",url:"https://bttcscan.com"},default:{name:"Bttcscan",url:"https://bttcscan.com"}}}),uF=VB({id:1028,name:"BitTorrent Chain Testnet",network:"bittorrent-chain-testnet",nativeCurrency:{name:"BitTorrent",symbol:"BTT",decimals:18},rpcUrls:{default:{http:["https://testrpc.bittorrentchain.io"]},public:{http:["https://testrpc.bittorrentchain.io"]}},blockExplorers:{etherscan:{name:"Bttcscan",url:"https://testnet.bttcscan.com"},default:{name:"Bttcscan",url:"https://testnet.bttcscan.com"}},testnet:!0}),lF=VB({id:288,name:"Boba Network",network:"boba",nativeCurrency:{decimals:18,name:"Boba",symbol:"BOBA"},rpcUrls:{default:{http:["https://mainnet.boba.network"]},public:{http:["https://mainnet.boba.network"]}},blockExplorers:{etherscan:{name:"BOBAScan",url:"https://bobascan.com"},default:{name:"BOBAScan",url:"https://bobascan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:446859}}}),fF=VB({id:1039,name:"Bronos",network:"bronos",nativeCurrency:{decimals:18,name:"BRO",symbol:"BRO"},rpcUrls:{default:{http:["https://evm.bronos.org"]},public:{http:["https://evm.bronos.org"]}},blockExplorers:{default:{name:"BronoScan",url:"https://broscan.bronos.org"}}}),dF=VB({id:1038,name:"Bronos Testnet",network:"bronos-testnet",nativeCurrency:{decimals:18,name:"Bronos Coin",symbol:"tBRO"},rpcUrls:{default:{http:["https://evm-testnet.bronos.org"]},public:{http:["https://evm-testnet.bronos.org"]}},blockExplorers:{default:{name:"BronoScan",url:"https://tbroscan.bronos.org"}},testnet:!0}),hF=VB({id:56,name:"BNB Smart Chain",network:"bsc",nativeCurrency:{decimals:18,name:"BNB",symbol:"BNB"},rpcUrls:{default:{http:["https://rpc.ankr.com/bsc"]},public:{http:["https://rpc.ankr.com/bsc"]}},blockExplorers:{etherscan:{name:"BscScan",url:"https://bscscan.com"},default:{name:"BscScan",url:"https://bscscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:15921452}}}),pF=VB({id:97,name:"Binance Smart Chain Testnet",network:"bsc-testnet",nativeCurrency:{decimals:18,name:"BNB",symbol:"tBNB"},rpcUrls:{default:{http:["https://data-seed-prebsc-1-s1.bnbchain.org:8545"]},public:{http:["https://data-seed-prebsc-1-s1.bnbchain.org:8545"]}},blockExplorers:{etherscan:{name:"BscScan",url:"https://testnet.bscscan.com"},default:{name:"BscScan",url:"https://testnet.bscscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:17422483}},testnet:!0}),mF=VB({id:4999,name:"BlackFort Exchange Network",network:"bxn",nativeCurrency:{name:"BlackFort Token",symbol:"BXN",decimals:18},rpcUrls:{default:{http:["https://mainnet.blackfort.network/rpc"]},public:{http:["https://mainnet.blackfort.network/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.blackfort.network"}}}),bF=VB({id:4777,name:"BlackFort Exchange Network Testnet",network:"bxnTestnet",nativeCurrency:{name:"BlackFort Testnet Token",symbol:"TBXN",decimals:18},rpcUrls:{default:{http:["https://testnet.blackfort.network/rpc"]},public:{http:["https://testnet.blackfort.network/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://testnet-explorer.blackfort.network"}}}),gF=VB({id:7700,name:"Canto",network:"canto",nativeCurrency:{decimals:18,name:"Canto",symbol:"CANTO"},rpcUrls:{default:{http:["https://canto.gravitychain.io"]},public:{http:["https://canto.gravitychain.io"]}},blockExplorers:{default:{name:"Tuber.Build (Blockscout)",url:"https://tuber.build"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:2905789}}});function yF(e){return 0===e||0n===e||null==e||"0"===e||""===e||"string"==typeof e&&("0x"===pT(e).toLowerCase()||"0x00"===pT(e).toLowerCase())}function vF(e){return!yF(e)}function wF(e){return vF(e.maxFeePerGas)&&vF(e.maxPriorityFeePerGas)}function EF(e){return"cip42"===e.type||wF(e)&&(vF(e.feeCurrency)||vF(e.gatewayFeeRecipient)||vF(e.gatewayFee))}function AF(e){return"cip64"===e.type||wF(e)&&vF(e.feeCurrency)&&yF(e.gatewayFee)&&yF(e.gatewayFeeRecipient)}const xF={block:dC({exclude:["difficulty","gasLimit","mixHash","nonce","uncles"],format(e){const t=e.transactions?.map((e=>"string"==typeof e?e:{...uC(e),feeCurrency:e.feeCurrency,..."0x7b"!==e.type?{gatewayFee:e.gatewayFee?gT(e.gatewayFee):null,gatewayFeeRecipient:e.gatewayFeeRecipient||null}:{}}));return{randomness:e.randomness,transactions:t}}}),transaction:lC({format(e){const t={feeCurrency:e.feeCurrency};return"0x7b"===e.type?t.type="cip64":("0x7c"===e.type&&(t.type="cip42"),t.gatewayFee=e.gatewayFee?gT(e.gatewayFee):null,t.gatewayFeeRecipient=e.gatewayFeeRecipient),t}}),transactionRequest:rC({format(e){const t={feeCurrency:e.feeCurrency};return AF(e)?t.type="0x7b":(EF(e)&&(t.type="0x7c"),t.gatewayFee=void 0!==e.gatewayFee?kT(e.gatewayFee):void 0,t.gatewayFeeRecipient=e.gatewayFeeRecipient),t}})},_F={transaction:(e,t)=>AF(e)?function(e,t){!function(e){const{chainId:t,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:i,to:o,feeCurrency:a}=e;if(t<=0)throw new UC({chainId:t});if(o&&!bO(o))throw new pO({address:o});if(n)throw new NI("`gasPrice` is not a valid CIP-64 Transaction attribute.");if(vF(i)&&i>kF)throw new DM({maxFeePerGas:i});if(vF(r)&&vF(i)&&r>i)throw new JM({maxFeePerGas:i,maxPriorityFeePerGas:r});if(vF(a)&&!bO(a))throw new NI("`feeCurrency` MUST be a token address for CIP-64 transactions.");if(yF(a))throw new NI("`feeCurrency` must be provided for CIP-64 transactions.")}(e);const{chainId:r,gas:n,nonce:i,to:o,value:a,maxFeePerGas:s,maxPriorityFeePerGas:c,accessList:u,feeCurrency:l,data:f}=e,d=[AT(r),i?AT(i):"0x",c?AT(c):"0x",s?AT(s):"0x",n?AT(n):"0x",o??"0x",a?AT(a):"0x",f??"0x",PN(u),l];t&&d.push(27n===t.v?"0x":AT(1),pT(t.r),pT(t.s));return yO(["0x7b",fN(d)])}(e,t):EF(e)?function(e,t){!function(e){const{chainId:t,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:i,to:o,feeCurrency:a,gatewayFee:s,gatewayFeeRecipient:c}=e;if(t<=0)throw new UC({chainId:t});if(o&&!bO(o))throw new pO({address:o});if(n)throw new NI("`gasPrice` is not a valid CIP-42 Transaction attribute.");if(vF(i)&&i>kF)throw new DM({maxFeePerGas:i});if(vF(r)&&vF(i)&&r>i)throw new JM({maxFeePerGas:i,maxPriorityFeePerGas:r});if(vF(s)&&yF(c)||vF(c)&&yF(s))throw new NI("`gatewayFee` and `gatewayFeeRecipient` must be provided together.");if(vF(a)&&!bO(a))throw new NI("`feeCurrency` MUST be a token address for CIP-42 transactions.");if(vF(c)&&!bO(c))throw new pO(c);if(yF(a)&&yF(c))throw new NI("Either `feeCurrency` or `gatewayFeeRecipient` must be provided for CIP-42 transactions.")}(e);const{chainId:r,gas:n,nonce:i,to:o,value:a,maxFeePerGas:s,maxPriorityFeePerGas:c,accessList:u,feeCurrency:l,gatewayFeeRecipient:f,gatewayFee:d,data:h}=e,p=[AT(r),i?AT(i):"0x",c?AT(c):"0x",s?AT(s):"0x",n?AT(n):"0x",l??"0x",f??"0x",d?AT(d):"0x",o??"0x",a?AT(a):"0x",h??"0x",PN(u)];t&&p.push(27n===t.v?"0x":AT(1),pT(t.r),pT(t.s));return yO(["0x7c",fN(p)])}(e,t):IN(e,t)};const kF=2n**256n-1n;const SF=VB({id:42220,name:"Celo",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:13112599}},testnet:!1},{formatters:xF,serializers:_F}),PF=VB({id:44787,name:"Alfajores",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"A-CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:14569001}},testnet:!0},{formatters:xF,serializers:_F}),IF=VB({id:88888,name:"Chiliz Chain",network:"chiliz-chain",nativeCurrency:{decimals:18,name:"CHZ",symbol:"CHZ"},rpcUrls:{default:{http:["https://rpc.ankr.com/chiliz","https://chiliz.publicnode.com"]},public:{http:["https://rpc.ankr.com/chiliz","https://chiliz.publicnode.com"]}},blockExplorers:{default:{name:"Chiliz Explorer",url:"https://scan.chiliz.com"}}}),TF=VB({id:17323,name:"Cannoli",network:"celo-cannoli",nativeCurrency:{decimals:18,name:"CELO",symbol:"C-CELO"},rpcUrls:{default:{http:["https://forno.cannoli.celo-testnet.org"]},public:{http:["https://forno.cannoli.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/cannoli"}},contracts:{multicall3:{address:"0x5Acb0aa8BF4E8Ff0d882Ee187140713C12BF9718",blockCreated:87429}},testnet:!0},{formatters:xF,serializers:_F}),OF=VB({id:61,name:"Ethereum Classic",network:"classic",nativeCurrency:{decimals:18,name:"ETC",symbol:"ETC"},rpcUrls:{default:{http:["https://etc.rivet.link"]},public:{http:["https://etc.rivet.link"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.com/etc/mainnet"}}}),MF=VB({id:1030,name:"Conflux eSpace",network:"cfx-espace",nativeCurrency:{name:"Conflux",symbol:"CFX",decimals:18},rpcUrls:{default:{http:["https://evm.confluxrpc.org"],webSocket:["wss://evm.confluxrpc.org/ws"]},public:{http:["https://evm.confluxrpc.org"],webSocket:["wss://evm.confluxrpc.org/ws"]}},blockExplorers:{default:{name:"ConfluxScan",url:"https://evm.confluxscan.io"}},contracts:{multicall3:{address:"0xEFf0078910f638cd81996cc117bccD3eDf2B072F",blockCreated:68602935}}}),CF=VB({id:71,name:"Conflux eSpace Testnet",network:"cfx-espace-testnet",testnet:!0,nativeCurrency:{name:"Conflux",symbol:"CFX",decimals:18},rpcUrls:{default:{http:["https://evmtestnet.confluxrpc.org"],webSocket:["wss://evmtestnet.confluxrpc.org/ws"]},public:{http:["https://evmtestnet.confluxrpc.org"],webSocket:["wss://evmtestnet.confluxrpc.org/ws"]}},blockExplorers:{default:{name:"ConfluxScan",url:"https://evmtestnet.confluxscan.io"}},contracts:{multicall3:{address:"0xEFf0078910f638cd81996cc117bccD3eDf2B072F",blockCreated:117499050}}}),BF=VB({id:1116,name:"Core Dao",network:"coreDao",nativeCurrency:{decimals:18,name:"Core",symbol:"CORE"},rpcUrls:{public:{http:["https://rpc.coredao.org"]},default:{http:["https://rpc.coredao.org"]}},blockExplorers:{default:{name:"CoreDao",url:"https://scan.coredao.org"},etherscan:{name:"CoreDao",url:"https://scan.coredao.org"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:11907934}},testnet:!1}),NF=VB({id:25,name:"Cronos Mainnet",network:"cronos",nativeCurrency:{decimals:18,name:"Cronos",symbol:"CRO"},rpcUrls:{default:{http:["https://evm.cronos.org"]},public:{http:["https://evm.cronos.org"]}},blockExplorers:{default:{name:"Cronoscan",url:"https://cronoscan.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1963112}}}),RF=VB({id:338,name:"Cronos Testnet",network:"cronos-testnet",nativeCurrency:{decimals:18,name:"CRO",symbol:"tCRO"},rpcUrls:{default:{http:["https://evm-t3.cronos.org"]},public:{http:["https://evm-t3.cronos.org"]}},blockExplorers:{default:{name:"Cronos Explorer",url:"https://cronos.org/explorer/testnet3"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:10191251}},testnet:!0}),FF=VB({id:3737,network:"crossbell",name:"Crossbell",nativeCurrency:{decimals:18,name:"CSB",symbol:"CSB"},rpcUrls:{default:{http:["https://rpc.crossbell.io"]},public:{http:["https://rpc.crossbell.io"]}},blockExplorers:{default:{name:"CrossScan",url:"https://scan.crossbell.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:38246031}}}),LF=VB({id:53935,name:"DFK Chain",network:"dfk",nativeCurrency:{decimals:18,name:"Jewel",symbol:"JEWEL"},rpcUrls:{default:{http:["https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"]},public:{http:["https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"]}},blockExplorers:{etherscan:{name:"DFKSubnetScan",url:"https://subnets.avax.network/defi-kingdoms"},default:{name:"DFKSubnetScan",url:"https://subnets.avax.network/defi-kingdoms"}}}),jF=VB({id:2e3,name:"Dogechain",network:"dogechain",nativeCurrency:{decimals:18,name:"Dogechain",symbol:"DC"},rpcUrls:{default:{http:["https://rpc.dogechain.dog"]},public:{http:["https://rpc.dogechain.dog"]}},blockExplorers:{etherscan:{name:"DogeChainExplorer",url:"https://explorer.dogechain.dog"},default:{name:"DogeChainExplorer",url:"https://explorer.dogechain.dog"}}}),UF=VB({id:2021,name:"Edgeware EdgeEVM Mainnet",network:"edgeware",nativeCurrency:{decimals:18,name:"Edgeware",symbol:"EDG"},rpcUrls:{default:{http:["https://edgeware-evm.jelliedowl.net"]},public:{http:["https://edgeware-evm.jelliedowl.net"]}},blockExplorers:{etherscan:{name:"Edgscan by Bharathcoorg",url:"https://edgscan.live"},default:{name:"Edgscan by Bharathcoorg",url:"https://edgscan.live"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:18117872}}}),DF=VB({id:2022,name:"Beresheet BereEVM Testnet",network:"edgewareTestnet",nativeCurrency:{decimals:18,name:"Testnet EDG",symbol:"tEDG"},rpcUrls:{default:{http:["https://beresheet-evm.jelliedowl.net"]},public:{http:["https://beresheet-evm.jelliedowl.net"]}},blockExplorers:{etherscan:{name:"Edgscan by Bharathcoorg",url:"https://testnet.edgscan.live"},default:{name:"Edgscan by Bharathcoorg",url:"https://testnet.edgscan.live"}}}),zF=VB({id:17777,name:"EOS EVM",network:"eos",nativeCurrency:{decimals:18,name:"EOS",symbol:"EOS"},rpcUrls:{default:{http:["https://api.evm.eosnetwork.com"]},public:{http:["https://api.evm.eosnetwork.com"]}},blockExplorers:{etherscan:{name:"EOS EVM Explorer",url:"https://explorer.evm.eosnetwork.com"},default:{name:"EOS EVM Explorer",url:"https://explorer.evm.eosnetwork.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7943933}}}),$F=VB({id:15557,name:"EOS EVM Testnet",network:"eos",nativeCurrency:{decimals:18,name:"EOS",symbol:"EOS"},rpcUrls:{default:{http:["https://api.testnet.evm.eosnetwork.com"]},public:{http:["https://api.testnet.evm.eosnetwork.com"]}},blockExplorers:{etherscan:{name:"EOS EVM Testnet Explorer",url:"https://explorer.testnet.evm.eosnetwork.com"},default:{name:"EOS EVM Testnet Explorer",url:"https://explorer.testnet.evm.eosnetwork.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:9067940}},testnet:!0}),HF=VB({id:9001,name:"Evmos",network:"evmos",nativeCurrency:{decimals:18,name:"Evmos",symbol:"EVMOS"},rpcUrls:{default:{http:["https://eth.bd.evmos.org:8545"]},public:{http:["https://eth.bd.evmos.org:8545"]}},blockExplorers:{default:{name:"Evmos Block Explorer",url:"https://escan.live"}}}),GF=VB({id:9e3,name:"Evmos Testnet",network:"evmos-testnet",nativeCurrency:{decimals:18,name:"Evmos",symbol:"EVMOS"},rpcUrls:{default:{http:["https://eth.bd.evmos.dev:8545"]},public:{http:["https://eth.bd.evmos.dev:8545"]}},blockExplorers:{default:{name:"Evmos Testnet Block Explorer",url:"https://evm.evmos.dev/"}}}),qF=VB({id:1994,name:"Ekta",network:"ekta",nativeCurrency:{decimals:18,name:"EKTA",symbol:"EKTA"},rpcUrls:{public:{http:["https://main.ekta.io"]},default:{http:["https://main.ekta.io"]}},blockExplorers:{default:{name:"Ektascan",url:"https://ektascan.io"}}}),KF=VB({id:1004,name:"Ekta Testnet",network:"ekta-testnet",nativeCurrency:{decimals:18,name:"EKTA",symbol:"EKTA"},rpcUrls:{public:{http:["https://test.ekta.io:8545"]},default:{http:["https://test.ekta.io:8545"]}},blockExplorers:{default:{name:"Test Ektascan",url:"https://test.ektascan.io"}},testnet:!0}),VF=VB({id:250,name:"Fantom",network:"fantom",nativeCurrency:{decimals:18,name:"Fantom",symbol:"FTM"},rpcUrls:{default:{http:["https://rpc.ankr.com/fantom"]},public:{http:["https://rpc.ankr.com/fantom"]}},blockExplorers:{etherscan:{name:"FTMScan",url:"https://ftmscan.com"},default:{name:"FTMScan",url:"https://ftmscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:33001987}}}),WF=VB({id:64240,name:"Fantom Sonic Open Testnet",network:"fantom-sonic-testnet",nativeCurrency:{decimals:18,name:"Fantom",symbol:"FTM"},rpcUrls:{default:{http:["https://rpcapi.sonic.fantom.network"]},public:{http:["https://rpcapi.sonic.fantom.network"]}},blockExplorers:{default:{name:"Fantom Sonic Open Testnet Explorer",url:"https://public-sonic.fantom.network"}},testnet:!0}),JF=VB({id:4002,name:"Fantom Testnet",network:"fantom-testnet",nativeCurrency:{decimals:18,name:"Fantom",symbol:"FTM"},rpcUrls:{default:{http:["https://rpc.testnet.fantom.network"]},public:{http:["https://rpc.testnet.fantom.network"]}},blockExplorers:{etherscan:{name:"FTMScan",url:"https://testnet.ftmscan.com"},default:{name:"FTMScan",url:"https://testnet.ftmscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:8328688}}}),ZF=VB({id:12306,name:"Fibo Chain",network:"fibochain",nativeCurrency:{decimals:18,name:"fibo",symbol:"FIBO"},rpcUrls:{default:{http:["https://network.hzroc.art"]},public:{http:["https://network.hzroc.art"]}},blockExplorers:{default:{name:"FiboScan",url:"https://scan.fibochain.org"}}}),YF=VB({id:314,name:"Filecoin Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3328594}}}),XF=VB({id:314159,name:"Filecoin Calibration",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}}),QF=VB({id:3141,name:"Filecoin Hyperspace",network:"filecoin-hyperspace",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.hyperspace.node.glif.io/rpc/v1"]},public:{http:["https://api.hyperspace.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://hyperspace.filfox.info/en"},filscan:{name:"Filscan",url:"https://hyperspace.filscan.io"}}}),eL=VB({id:14,name:"Flare Mainnet",network:"flare-mainnet",nativeCurrency:{decimals:18,name:"flare",symbol:"FLR"},rpcUrls:{default:{http:["https://flare-api.flare.network/ext/C/rpc"]},public:{http:["https://flare-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Flare Explorer",url:"https://flare-explorer.flare.network"}}}),tL=VB({id:114,name:"Coston2",network:"coston2",nativeCurrency:{decimals:18,name:"coston2flare",symbol:"C2FLR"},rpcUrls:{default:{http:["https://coston2-api.flare.network/ext/C/rpc"]},public:{http:["https://coston2-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Coston2 Explorer",url:"https://coston2-explorer.flare.network"}},testnet:!0}),rL=VB({id:31337,name:"Foundry",network:"foundry",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"],webSocket:["ws://127.0.0.1:8545"]},public:{http:["http://127.0.0.1:8545"],webSocket:["ws://127.0.0.1:8545"]}}}),nL=VB({id:122,name:"Fuse",network:"fuse",nativeCurrency:{name:"Fuse",symbol:"FUSE",decimals:18},rpcUrls:{default:{http:["https://rpc.fuse.io"]},public:{http:["https://rpc.fuse.io"]}},blockExplorers:{default:{name:"Fuse Explorer",url:"https://explorer.fuse.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:16146628}}}),iL=VB({id:123,name:"Fuse Sparknet",network:"fuse",nativeCurrency:{name:"Spark",symbol:"SPARK",decimals:18},rpcUrls:{default:{http:["https://rpc.fusespark.io"]},public:{http:["https://rpc.fusespark.io"]}},blockExplorers:{default:{name:"Sparkent Explorer",url:"https://explorer.fusespark.io"}}}),oL=VB({id:4689,name:"IoTeX",network:"iotex",nativeCurrency:{decimals:18,name:"IoTeX",symbol:"IOTX"},rpcUrls:{default:{http:["https://babel-api.mainnet.iotex.io"],webSocket:["wss://babel-api.mainnet.iotex.io"]},public:{http:["https://babel-api.mainnet.iotex.io"],webSocket:["wss://babel-api.mainnet.iotex.io"]}},blockExplorers:{default:{name:"IoTeXScan",url:"https://iotexscan.io"}}}),aL=VB({id:4690,name:"IoTeX Testnet",network:"iotex-testnet",nativeCurrency:{decimals:18,name:"IoTeX",symbol:"IOTX"},rpcUrls:{default:{http:["https://babel-api.testnet.iotex.io"],webSocket:["wss://babel-api.testnet.iotex.io"]},public:{http:["https://babel-api.testnet.iotex.io"],webSocket:["wss://babel-api.testnet.iotex.io"]}},blockExplorers:{default:{name:"IoTeXScan",url:"https://testnet.iotexscan.io"}}}),sL=VB({id:8899,name:"JIBCHAIN L1",network:"jbc",nativeCurrency:{name:"JBC",symbol:"JBC",decimals:18},rpcUrls:{default:{http:["https://rpc-l1.jibchain.net"]},public:{http:["https://rpc-l1.jibchain.net"]}},blockExplorers:{default:{name:"Blockscout",url:"https://exp-l1.jibchain.net"}},contracts:{multicall3:{address:"0xc0C8C486D1466C57Efe13C2bf000d4c56F47CBdC",blockCreated:2299048}},testnet:!1}),cL=VB({id:686,name:"Karura",network:"karura",nativeCurrency:{name:"Karura",symbol:"KAR",decimals:18},rpcUrls:{public:{http:["https://eth-rpc-karura.aca-api.network"],webSocket:["wss://eth-rpc-karura.aca-api.network"]},default:{http:["https://eth-rpc-karura.aca-api.network"],webSocket:["wss://eth-rpc-karura.aca-api.network"]}},blockExplorers:{default:{name:"Karura Blockscout",url:"https://blockscout.karura.network"}},testnet:!1}),uL=VB({id:1663,name:"Horizen Gobi Testnet",network:"gobi",nativeCurrency:{decimals:18,name:"Test ZEN",symbol:"tZEN"},rpcUrls:{public:{http:["https://gobi-testnet.horizenlabs.io/ethv1"]},default:{http:["https://gobi-testnet.horizenlabs.io/ethv1"]}},blockExplorers:{default:{name:"Gobi Explorer",url:"https://gobi-explorer.horizen.io"}},contracts:{},testnet:!0}),lL=VB({id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-goerli.g.alchemy.com/v2"],webSocket:["wss://eth-goerli.g.alchemy.com/v2"]},infura:{http:["https://goerli.infura.io/v3"],webSocket:["wss://goerli.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/eth_goerli"]},public:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli.etherscan.io"},default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0x56522D00C410a43BFfDF00a9A569489297385790",blockCreated:8765204},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:6507670}},testnet:!0}),fL=VB({id:100,name:"Gnosis",network:"gnosis",nativeCurrency:{decimals:18,name:"Gnosis",symbol:"xDAI"},rpcUrls:{default:{http:["https://rpc.gnosischain.com"],webSocket:["wss://rpc.gnosischain.com/wss"]},public:{http:["https://rpc.gnosischain.com"],webSocket:["wss://rpc.gnosischain.com/wss"]}},blockExplorers:{etherscan:{name:"Gnosisscan",url:"https://gnosisscan.io"},default:{name:"Gnosis Chain Explorer",url:"https://blockscout.com/xdai/mainnet"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:21022491}}}),dL=VB({id:10200,name:"Gnosis Chiado",network:"chiado",nativeCurrency:{decimals:18,name:"Gnosis",symbol:"xDAI"},rpcUrls:{default:{http:["https://rpc.chiadochain.net"],webSocket:["wss://rpc.chiadochain.net/wss"]},public:{http:["https://rpc.chiadochain.net"],webSocket:["wss://rpc.chiadochain.net/wss"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.chiadochain.net"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:4967313}},testnet:!0}),hL=VB({id:31337,name:"Hardhat",network:"hardhat",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"]},public:{http:["http://127.0.0.1:8545"]}}}),pL=VB({id:16666e5,name:"Harmony One",network:"harmony",nativeCurrency:{name:"Harmony",symbol:"ONE",decimals:18},rpcUrls:{public:{http:["https://rpc.ankr.com/harmony"]},default:{http:["https://rpc.ankr.com/harmony"]}},blockExplorers:{default:{name:"Harmony Explorer",url:"https://explorer.harmony.one"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:24185753}}}),mL=VB({id:11235,name:"HAQQ Mainnet",network:"haqq-mainnet",nativeCurrency:{decimals:18,name:"Islamic Coin",symbol:"ISLM"},rpcUrls:{default:{http:["https://rpc.eth.haqq.network"]},public:{http:["https://rpc.eth.haqq.network"]}},blockExplorers:{default:{name:"HAQQ Explorer",url:"https://explorer.haqq.network"}}}),bL=VB({id:54211,name:"HAQQ Testedge 2",network:"haqq-testedge-2",nativeCurrency:{decimals:18,name:"Islamic Coin",symbol:"ISLMT"},rpcUrls:{default:{http:["https://rpc.eth.testedge2.haqq.network"]},public:{http:["https://rpc.eth.testedge2.haqq.network"]}},blockExplorers:{default:{name:"HAQQ Explorer",url:"https://explorer.testedge2.haqq.network"}}}),gL=VB({id:17e3,network:"holesky",name:"Holesky",nativeCurrency:{name:"Holesky Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:77}},testnet:!0}),yL=VB({id:2222,name:"Kava EVM",network:"kava-mainnet",nativeCurrency:{name:"Kava",symbol:"KAVA",decimals:18},rpcUrls:{public:{http:["https://evm.kava.io"]},default:{http:["https://evm.kava.io"]}},blockExplorers:{default:{name:"Kava EVM Explorer",url:"https://kavascan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:3661165}},testnet:!1}),vL=VB({id:2221,name:"Kava EVM Testnet",network:"kava-testnet",nativeCurrency:{name:"Kava",symbol:"KAVA",decimals:18},rpcUrls:{public:{http:["https://evm.testnet.kava.io"]},default:{http:["https://evm.testnet.kava.io"]}},blockExplorers:{default:{name:"Kava EVM Testnet Explorer",url:"https://testnet.kavascan.com/"}},contracts:{multicall3:{address:"0xDf1D724A7166261eEB015418fe8c7679BBEa7fd6",blockCreated:7242179}},testnet:!0}),wL=VB({id:8217,name:"Klaytn",network:"klaytn",nativeCurrency:{decimals:18,name:"Klaytn",symbol:"KLAY"},rpcUrls:{default:{http:["https://public-en-cypress.klaytn.net"]},public:{http:["https://public-en-cypress.klaytn.net"]}},blockExplorers:{etherscan:{name:"KlaytnScope",url:"https://scope.klaytn.com"},default:{name:"KlaytnScope",url:"https://scope.klaytn.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:96002415}}}),EL=VB({id:1001,name:"Klaytn Baobab Testnet",network:"klaytn-baobab",nativeCurrency:{decimals:18,name:"Baobab Klaytn",symbol:"KLAY"},rpcUrls:{default:{http:["https://public-en-baobab.klaytn.net"]},public:{http:["https://public-en-baobab.klaytn.net"]}},blockExplorers:{etherscan:{name:"KlaytnScope",url:"https://baobab.klaytnscope.com"},default:{name:"KlaytnScope",url:"https://baobab.klaytnscope.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:123390593}},testnet:!0}),AL=VB({id:255,network:"kroma",name:"Kroma",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://api.kroma.network"]},public:{http:["https://api.kroma.network"]}},blockExplorers:{default:{name:"Kroma Explorer",url:"https://blockscout.kroma.network"}},testnet:!1}),xL=VB({id:2358,network:"kroma-sepolia",name:"Kroma Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://api.sepolia.kroma.network"]},public:{http:["https://api.sepolia.kroma.network"]}},blockExplorers:{default:{name:"Kroma Sepolia Explorer",url:"https://blockscout.sepolia.kroma.network"}},testnet:!0}),_L=VB({id:59144,name:"Linea Mainnet",network:"linea-mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-mainnet.infura.io/v3"],webSocket:["wss://linea-mainnet.infura.io/ws/v3"]},default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"},blockscout:{name:"Blockscout",url:"https://explorer.linea.build"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:42}},testnet:!1}),kL=VB({id:59140,name:"Linea Goerli Testnet",network:"linea-testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"},blockscout:{name:"Blockscout",url:"https://explorer.goerli.linea.build"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:498623}},testnet:!0}),SL=VB({id:1337,name:"Localhost",network:"localhost",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"]},public:{http:["http://127.0.0.1:8545"]}}}),PL=VB({id:42,network:"lukso",name:"LUKSO",nativeCurrency:{name:"LUKSO",symbol:"LYX",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.lukso.network"],webSocket:["wss://ws-rpc.mainnet.lukso.network"]},public:{http:["https://rpc.mainnet.lukso.network"],webSocket:["wss://ws-rpc.mainnet.lukso.network"]}},blockExplorers:{default:{name:"LUKSO Mainnet Explorer",url:"https://explorer.execution.mainnet.lukso.network"}}}),IL=VB({id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xc0497E381f536Be9ce14B0dD3817cBcAe57d2F62",blockCreated:16966585},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),TL=VB({id:595,name:"Mandala TC9",network:"mandala",nativeCurrency:{name:"Mandala",symbol:"mACA",decimals:18},rpcUrls:{public:{http:["https://eth-rpc-tc9.aca-staging.network"],webSocket:["wss://eth-rpc-tc9.aca-staging.network"]},default:{http:["https://eth-rpc-tc9.aca-staging.network"],webSocket:["wss://eth-rpc-tc9.aca-staging.network"]}},blockExplorers:{default:{name:"Mandala Blockscout",url:"https://blockscout.mandala.aca-staging.network"}},testnet:!0}),OL=VB({id:169,name:"Manta Pacific Mainnet",network:"manta",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://pacific-rpc.manta.network/http"]},public:{http:["https://pacific-rpc.manta.network/http"]}},blockExplorers:{etherscan:{name:"Manta Explorer",url:"https://pacific-explorer.manta.network"},default:{name:"Manta Explorer",url:"https://pacific-explorer.manta.network"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:332890}}}),ML=VB({id:3441005,name:"Manta Pacific Testnet",network:"manta-testnet",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://manta-testnet.calderachain.xyz/http"]},public:{http:["https://manta-testnet.calderachain.xyz/http"]}},blockExplorers:{etherscan:{name:"Manta Testnet Explorer",url:"https://pacific-explorer.testnet.manta.network"},default:{name:"Manta Testnet Explorer",url:"https://pacific-explorer.testnet.manta.network"}},contracts:{multicall3:{address:"0x211B1643b95Fe76f11eD8880EE810ABD9A4cf56C",blockCreated:419915}},testnet:!0}),CL=VB({id:5e3,name:"Mantle",network:"mantle",nativeCurrency:{decimals:18,name:"MNT",symbol:"MNT"},rpcUrls:{default:{http:["https://rpc.mantle.xyz"]},public:{http:["https://rpc.mantle.xyz"]}},blockExplorers:{etherscan:{name:"Mantle Explorer",url:"https://explorer.mantle.xyz"},default:{name:"Mantle Explorer",url:"https://explorer.mantle.xyz"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:304717}}}),BL=VB({id:5001,name:"Mantle Testnet",network:"mantle",nativeCurrency:{decimals:18,name:"MNT",symbol:"MNT"},rpcUrls:{default:{http:["https://rpc.testnet.mantle.xyz"]},public:{http:["https://rpc.testnet.mantle.xyz"]}},blockExplorers:{etherscan:{name:"Mantle Testnet Explorer",url:"https://explorer.testnet.mantle.xyz"},default:{name:"Mantle Testnet Explorer",url:"https://explorer.testnet.mantle.xyz"}},testnet:!0}),NL=VB({id:82,name:"Meter",network:"meter",nativeCurrency:{decimals:18,name:"MTR",symbol:"MTR"},rpcUrls:{default:{http:["https://rpc.meter.io"]},public:{http:["https://rpc.meter.io"]}},blockExplorers:{default:{name:"MeterScan",url:"https://scan.meter.io"}}}),RL=VB({id:83,name:"Meter Testnet",network:"meter-testnet",nativeCurrency:{decimals:18,name:"MTR",symbol:"MTR"},rpcUrls:{default:{http:["https://rpctest.meter.io"]},public:{http:["https://rpctest.meter.io"]}},blockExplorers:{default:{name:"MeterTestnetScan",url:"https://scan-warringstakes.meter.io"}}}),FL=VB({id:1088,name:"Metis",network:"andromeda",nativeCurrency:{decimals:18,name:"Metis",symbol:"METIS"},rpcUrls:{default:{http:["https://andromeda.metis.io/?owner=1088"]},public:{http:["https://andromeda.metis.io/?owner=1088"]}},blockExplorers:{default:{name:"Andromeda Explorer",url:"https://andromeda-explorer.metis.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:2338552}}}),LL=VB({id:599,name:"Metis Goerli",network:"metis-goerli",nativeCurrency:{decimals:18,name:"Metis Goerli",symbol:"METIS"},rpcUrls:{default:{http:["https://goerli.gateway.metisdevops.link"]},public:{http:["https://goerli.gateway.metisdevops.link"]}},blockExplorers:{default:{name:"Metis Goerli Explorer",url:"https://goerli.explorer.metisdevops.link"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1006207}}}),jL=VB({id:7518,network:"MEVerse",name:"MEVerse Chain Mainnet",nativeCurrency:{decimals:18,name:"MEVerse",symbol:"MEV"},rpcUrls:{default:{http:["https://rpc.meversemainnet.io"]},public:{http:["https://rpc.meversemainnet.io"]}},blockExplorers:{default:{name:"Explorer",url:"https://www.meversescan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:86881340}}}),UL=VB({id:4759,network:"MEVerse Testnet",name:"MEVerse Chain Testnet",nativeCurrency:{decimals:18,name:"MEVerse",symbol:"MEV"},rpcUrls:{default:{http:["https://rpc.meversetestnet.io"]},public:{http:["https://rpc.meversetestnet.io"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.meversescan.io/"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:64371115}},testnet:!0}),DL=VB({id:919,name:"Mode Testnet",network:"mode-testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.mode.network"]},public:{http:["https://sepolia.mode.network"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia.explorer.mode.network"}},contracts:{multicall3:{address:"0xBAba8373113Fb7a68f195deF18732e01aF8eDfCF",blockCreated:3019007}},testnet:!0}),zL=VB({id:1287,name:"Moonbase Alpha",network:"moonbase-alpha",nativeCurrency:{decimals:18,name:"DEV",symbol:"DEV"},rpcUrls:{default:{http:["https://rpc.api.moonbase.moonbeam.network"],webSocket:["wss://wss.api.moonbase.moonbeam.network"]},public:{http:["https://rpc.api.moonbase.moonbeam.network"],webSocket:["wss://wss.api.moonbase.moonbeam.network"]}},blockExplorers:{default:{name:"Moonscan",url:"https://moonbase.moonscan.io"},etherscan:{name:"Moonscan",url:"https://moonbase.moonscan.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1850686}},testnet:!0}),$L=VB({id:1284,name:"Moonbeam",network:"moonbeam",nativeCurrency:{decimals:18,name:"GLMR",symbol:"GLMR"},rpcUrls:{public:{http:["https://moonbeam.public.blastapi.io"],webSocket:["wss://moonbeam.public.blastapi.io"]},default:{http:["https://moonbeam.public.blastapi.io"],webSocket:["wss://moonbeam.public.blastapi.io"]}},blockExplorers:{default:{name:"Moonscan",url:"https://moonscan.io"},etherscan:{name:"Moonscan",url:"https://moonscan.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:609002}},testnet:!1}),HL=VB({id:1281,name:"Moonbeam Development Node",network:"development",nativeCurrency:{decimals:18,name:"DEV",symbol:"DEV"},rpcUrls:{default:{http:["http://127.0.0.1:9944"],webSocket:["wss://127.0.0.1:9944"]},public:{http:["http://127.0.0.1:9944"],webSocket:["wss://127.0.0.1:9944"]}}}),GL=VB({id:1285,name:"Moonriver",network:"moonriver",nativeCurrency:{decimals:18,name:"MOVR",symbol:"MOVR"},rpcUrls:{public:{http:["https://moonriver.public.blastapi.io"],webSocket:["wss://moonriver.public.blastapi.io"]},default:{http:["https://moonriver.public.blastapi.io"],webSocket:["wss://moonriver.public.blastapi.io"]}},blockExplorers:{default:{name:"Moonscan",url:"https://moonriver.moonscan.io"},etherscan:{name:"Moonscan",url:"https://moonriver.moonscan.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1597904}},testnet:!1}),qL=VB({id:245022926,network:"neonDevnet",name:"Neon EVM DevNet",nativeCurrency:{name:"NEON",symbol:"NEON",decimals:18},rpcUrls:{default:{http:["https://devnet.neonevm.org"]},public:{http:["https://devnet.neonevm.org"]}},blockExplorers:{default:{name:"Neonscan",url:"https://devnet.neonscan.org"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:205206112}},testnet:!0}),KL=VB({id:245022934,network:"neonMainnet",name:"Neon EVM MainNet",nativeCurrency:{name:"NEON",symbol:"NEON",decimals:18},rpcUrls:{default:{http:["https://neon-proxy-mainnet.solana.p2p.org"]},public:{http:["https://neon-proxy-mainnet.solana.p2p.org"]}},blockExplorers:{default:{name:"Neonscan",url:"https://neonscan.org"}},contracts:{},testnet:!1}),VL=VB({id:4242,name:"Nexi",network:"nexi",nativeCurrency:{name:"Nexi",symbol:"NEXI",decimals:18},rpcUrls:{default:{http:["https://rpc.chain.nexi.technology"]},public:{http:["https://rpc.chain.nexi.technology"]}},blockExplorers:{etherscan:{name:"NexiScan",url:"https://www.nexiscan.com"},default:{name:"NexiScan",url:"https://www.nexiscan.com"}},contracts:{multicall3:{address:"0x0277A46Cc69A57eE3A6C8c158bA874832F718B8E",blockCreated:25770160}}}),WL=VB({id:240,name:"Nexilix Smart Chain",network:"nexilix",nativeCurrency:{decimals:18,name:"Nexilix",symbol:"NEXILIX"},rpcUrls:{default:{http:["https://rpcurl.pos.nexilix.com"]},public:{http:["https://rpcurl.pos.nexilix.com"]}},blockExplorers:{etherscan:{name:"NexilixScan",url:"https://scan.nexilix.com"},default:{name:"NexilixScan",url:"https://scan.nexilix.com"}},contracts:{multicall3:{address:"0x58381c8e2BF9d0C2C4259cA14BdA9Afe02831244",blockCreated:74448}}}),JL=VB({id:248,name:"Oasys",network:"oasys",nativeCurrency:{name:"Oasys",symbol:"OAS",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.oasys.games"]},public:{http:["https://rpc.mainnet.oasys.games"]}},blockExplorers:{default:{name:"OasysScan",url:"https://scan.oasys.games"}}}),ZL=VB({id:4090,network:"oasis-testnet",name:"Oasis Testnet",nativeCurrency:{name:"Fasttoken",symbol:"FTN",decimals:18},rpcUrls:{default:{http:["https://rpc1.oasis.bahamutchain.com"]},public:{http:["https://rpc1.oasis.bahamutchain.com"]}},blockExplorers:{default:{name:"Ftnscan",url:"https://oasis.ftnscan.com"}},testnet:!0}),YL=VB({id:66,name:"OKC",network:"okc",nativeCurrency:{decimals:18,name:"OKT",symbol:"OKT"},rpcUrls:{default:{http:["https://exchainrpc.okex.org"]},public:{http:["https://exchainrpc.okex.org"]}},blockExplorers:{default:{name:"oklink",url:"https://www.oklink.com/okc"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:10364792}}}),XL=VB({id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263}}},{formatters:rF}),QL=VB({id:420,name:"Optimism Goerli",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-goerli.g.alchemy.com/v2"],webSocket:["wss://opt-goerli.g.alchemy.com/v2"]},infura:{http:["https://optimism-goerli.infura.io/v3"],webSocket:["wss://optimism-goerli.infura.io/ws/v3"]},default:{http:["https://goerli.optimism.io"]},public:{http:["https://goerli.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"},default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:49461}},testnet:!0},{formatters:rF}),ej=VB({id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-sepolia.g.alchemy.com/v2"],webSocket:["wss://opt-sepolia.g.alchemy.com/v2"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]}},blockExplorers:{blockscout:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"},default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1620204}},testnet:!0},{formatters:rF}),tj=VB({id:204,name:"opBNB",network:"opBNB Mainnet",nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrls:{public:{http:["https://opbnb-mainnet-rpc.bnbchain.org"]},default:{http:["https://opbnb-mainnet-rpc.bnbchain.org"]}},blockExplorers:{default:{name:"opbnbscan",url:"https://mainnet.opbnbscan.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:512881}}}),rj=VB({id:5611,name:"opBNB Testnet",network:"opBNB Testnet",nativeCurrency:{decimals:18,name:"tBNB",symbol:"tBNB"},rpcUrls:{public:{http:["https://opbnb-testnet-rpc.bnbchain.org"]},default:{http:["https://opbnb-testnet-rpc.bnbchain.org"]}},blockExplorers:{default:{name:"opbnbscan",url:"https://testnet.opbnbscan.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3705108}},testnet:!0}),nj=VB({id:424,network:"pgn",name:"PGN",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.publicgoods.network"]},public:{http:["https://rpc.publicgoods.network"]}},blockExplorers:{default:{name:"PGN Explorer",url:"https://explorer.publicgoods.network"},blocksout:{name:"PGN Explorer",url:"https://explorer.publicgoods.network"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3380209}}},{formatters:rF}),ij=VB({id:58008,network:"pgn-testnet",name:"PGN ",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.publicgoods.network"]},public:{http:["https://sepolia.publicgoods.network"]}},blockExplorers:{default:{name:"PGN Testnet Explorer",url:"https://explorer.sepolia.publicgoods.network"},blocksout:{name:"PGN Testnet Explorer",url:"https://explorer.sepolia.publicgoods.network"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3754925}},testnet:!0},{formatters:rF}),oj=VB({id:242,name:"Plinga",network:"plinga",nativeCurrency:{name:"Plinga",symbol:"PLINGA",decimals:18},rpcUrls:{default:{http:["https://rpcurl.mainnet.plgchain.com"]},public:{http:["https://rpcurl.mainnet.plgchain.com"]}},blockExplorers:{default:{name:"Plgscan",url:"https://www.plgscan.com"}},contracts:{multicall3:{address:"0x0989576160f2e7092908BB9479631b901060b6e4",blockCreated:204489}}}),aj=VB({id:137,name:"Polygon",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}}),sj=VB({id:80001,name:"Polygon Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{alchemy:{http:["https://polygon-mumbai.g.alchemy.com/v2"],webSocket:["wss://polygon-mumbai.g.alchemy.com/v2"]},infura:{http:["https://polygon-mumbai.infura.io/v3"],webSocket:["wss://polygon-mumbai.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/polygon_mumbai"]},public:{http:["https://rpc.ankr.com/polygon_mumbai"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"},default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}},testnet:!0}),cj=VB({id:1442,name:"Polygon zkEVM Testnet",network:"polygon-zkevm-testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.public.zkevm-test.net"]},public:{http:["https://rpc.public.zkevm-test.net"]}},blockExplorers:{blockscout:{name:"Blockscout",url:"https://explorer.public.zkevm-test.net"},default:{name:"PolygonScan",url:"https://testnet-zkevm.polygonscan.com"}},testnet:!0,contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:525686}}}),uj=VB({id:1101,name:"Polygon zkEVM",network:"polygon-zkevm",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://zkevm-rpc.com"]},public:{http:["https://zkevm-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://zkevm.polygonscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:57746}}}),lj=VB({id:369,network:"pulsechain",name:"PulseChain",nativeCurrency:{name:"Pulse",symbol:"PLS",decimals:18},testnet:!1,rpcUrls:{default:{http:["https://rpc.pulsechain.com"],webSocket:["wss://ws.pulsechain.com"]},public:{http:["https://rpc.pulsechain.com"],webSocket:["wss://ws.pulsechain.com"]}},blockExplorers:{default:{name:"PulseScan",url:"https://scan.pulsechain.com"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),fj=VB({id:943,network:"pulsechainV4",name:"PulseChain V4",testnet:!0,nativeCurrency:{name:"V4 Pulse",symbol:"v4PLS",decimals:18},rpcUrls:{default:{http:["https://rpc.v4.testnet.pulsechain.com"],webSocket:["wss://ws.v4.testnet.pulsechain.com"]},public:{http:["https://rpc.v4.testnet.pulsechain.com"],webSocket:["wss://ws.v4.testnet.pulsechain.com"]}},blockExplorers:{default:{name:"PulseScan",url:"https://scan.v4.testnet.pulsechain.com"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),dj=VB({id:35441,name:"Q Mainnet",network:"q-mainnet",nativeCurrency:{decimals:18,name:"Q",symbol:"Q"},rpcUrls:{default:{http:["https://rpc.q.org"]},public:{http:["https://rpc.q.org"]}},blockExplorers:{default:{name:"Q Mainnet Explorer",url:"https://explorer.q.org"}}}),hj=VB({id:35443,name:"Q Testnet",network:"q-testnet",nativeCurrency:{decimals:18,name:"Q",symbol:"Q"},rpcUrls:{default:{http:["https://rpc.qtestnet.org"]},public:{http:["https://rpc.qtestnet.org"]}},blockExplorers:{default:{name:"Q Testnet Explorer",url:"https://explorer.qtestnet.org"}},testnet:!0}),pj=VB({id:570,name:"Rollux Mainnet",network:"rollux",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc.rollux.com"],webSocket:["wss://rpc.rollux.com/wss"]},public:{http:["https://rollux.public-rpc.com"]}},blockExplorers:{default:{name:"RolluxExplorer",url:"https://explorer.rollux.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:119222}}}),mj=VB({id:57e3,name:"Rollux Testnet",network:"rollux-testnet",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc-tanenbaum.rollux.com/"],webSocket:["wss://rpc-tanenbaum.rollux.com/wss"]},public:{http:["https://rpc-tanenbaum.rollux.com/"]}},blockExplorers:{default:{name:"RolluxTestnetExplorer",url:"https://rollux.tanenbaum.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1813675}}}),bj=VB({id:2020,name:"Ronin",network:"ronin",nativeCurrency:{name:"RON",symbol:"RON",decimals:18},rpcUrls:{default:{http:["https://api.roninchain.com/rpc"]},public:{http:["https://api.roninchain.com/rpc"]}},blockExplorers:{default:{name:"Ronin Explorer",url:"https://app.roninchain.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:26023535}}}),gj=VB({id:30,name:"Rootstock Mainnet",network:"rootstock",nativeCurrency:{decimals:18,name:"Rootstock Bitcoin",symbol:"RBTC"},rpcUrls:{public:{http:["https://public-node.rsk.co"]},default:{http:["https://public-node.rsk.co"]}},blockExplorers:{blockscout:{name:"Blockscout",url:"https://rootstock.blockscout.com"},default:{name:"RSK Explorer",url:"https://explorer.rsk.co"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:4249540}}}),yj=VB({id:2021,name:"Saigon Testnet",network:"saigon",nativeCurrency:{name:"RON",symbol:"RON",decimals:18},rpcUrls:{default:{http:["https://saigon-testnet.roninchain.com/rpc"]},public:{http:["https://saigon-testnet.roninchain.com/rpc"]}},blockExplorers:{default:{name:"Saigon Explorer",url:"https://saigon-explorer.roninchain.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:18736871}},testnet:!0}),vj=VB({id:23294,name:"Oasis Sapphire",network:"sapphire",nativeCurrency:{name:"Sapphire Rose",symbol:"ROSE",decimals:18},rpcUrls:{default:{http:["https://sapphire.oasis.io"],webSocket:["wss://sapphire.oasis.io/ws"]},public:{http:["https://sapphire.oasis.io"],webSocket:["wss://sapphire.oasis.io/ws"]}},blockExplorers:{default:{name:"Oasis Sapphire Explorer",url:"https://explorer.sapphire.oasis.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:734531}}}),wj=VB({id:23295,name:"Oasis Sapphire Testnet",network:"sapphire-testnet",nativeCurrency:{name:"Sapphire Test Rose",symbol:"TEST",decimals:18},rpcUrls:{default:{http:["https://testnet.sapphire.oasis.dev"],webSocket:["wss://testnet.sapphire.oasis.dev/ws"]},public:{http:["https://testnet.sapphire.oasis.dev"],webSocket:["wss://testnet.sapphire.oasis.dev/ws"]}},blockExplorers:{default:{name:"Oasis Sapphire Testnet Explorer",url:"https://testnet.explorer.sapphire.oasis.dev"}},testnet:!0}),Ej=VB({id:534352,name:"Scroll",network:"scroll",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.scroll.io"],webSocket:["wss://wss-rpc.scroll.io/ws"]},public:{http:["https://rpc.scroll.io"],webSocket:["wss://wss-rpc.scroll.io/ws"]}},blockExplorers:{default:{name:"Scrollscan",url:"https://scrollscan.com"},blockscout:{name:"Blockscout",url:"https://blockscout.scroll.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14}},testnet:!1}),Aj=VB({id:534351,name:"Scroll Sepolia",network:"scroll-sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rpc.scroll.io"]},public:{http:["https://sepolia-rpc.scroll.io"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-blockscout.scroll.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:9473}},testnet:!0}),xj=VB({id:534353,name:"Scroll Testnet",network:"scroll-testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://alpha-rpc.scroll.io/l2"],webSocket:["wss://alpha-rpc.scroll.io/l2/ws"]},public:{http:["https://alpha-rpc.scroll.io/l2"],webSocket:["wss://alpha-rpc.scroll.io/l2/ws"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.scroll.io"}},testnet:!0}),_j=VB({id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0x21B000Fd62a880b2125A61e36a284BB757b76025",blockCreated:3914906}},testnet:!0}),kj=VB({id:148,name:"Shimmer",network:"shimmer",nativeCurrency:{decimals:18,name:"Shimmer",symbol:"SMR"},rpcUrls:{public:{http:["https://json-rpc.evm.shimmer.network"]},default:{http:["https://json-rpc.evm.shimmer.network"]}},blockExplorers:{default:{name:"Shimmer Network Explorer",url:"https://explorer.evm.shimmer.network"}}}),Sj=VB({id:1073,name:"Shimmer Testnet",network:"shimmer-testnet",nativeCurrency:{decimals:18,name:"Shimmer",symbol:"SMR"},rpcUrls:{public:{http:["https://json-rpc.evm.testnet.shimmer.network"]},default:{http:["https://json-rpc.evm.testnet.shimmer.network"]}},blockExplorers:{default:{name:"Shimmer Network Explorer",url:"https://explorer.evm.testnet.shimmer.network"}},testnet:!0}),Pj=VB({id:391845894,name:"SKALE | Block Brawlers",network:"skale-brawl",nativeCurrency:{name:"BRAWL",symbol:"BRAWL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/frayed-decent-antares"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/frayed-decent-antares"]},public:{http:["https://mainnet.skalenodes.com/v1/frayed-decent-antares"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/frayed-decent-antares"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://frayed-decent-antares.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://frayed-decent-antares.explorer.mainnet.skalenodes.com"}},contracts:{}}),Ij=VB({id:1564830818,name:"SKALE | Calypso NFT Hub",network:"skale-calypso",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/honorable-steel-rasalhague"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/honorable-steel-rasalhague"]},public:{http:["https://mainnet.skalenodes.com/v1/honorable-steel-rasalhague"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/honorable-steel-rasalhague"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://honorable-steel-rasalhague.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://honorable-steel-rasalhague.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3107626}}}),Tj=VB({id:344106930,name:"SKALE | Calypso NFT Hub Testnet",network:"skale-calypso-testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://staging-v3.skalenodes.com/v1/staging-utter-unripe-menkar"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-utter-unripe-menkar"]},public:{http:["https://staging-v3.skalenodes.com/v1/staging-utter-unripe-menkar"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-utter-unripe-menkar"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://staging-utter-unripe-menkar.explorer.staging-v3.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://staging-utter-unripe-menkar.explorer.staging-v3.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2131424}},testnet:!0}),Oj=VB({id:1351057110,name:"SKALE | Chaos Testnet",network:"skale-chaos-testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://staging-v3.skalenodes.com/v1/staging-fast-active-bellatrix"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-fast-active-bellatrix"]},public:{http:["https://staging-v3.skalenodes.com/v1/staging-fast-active-bellatrix"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-fast-active-bellatrix"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://staging-fast-active-bellatrix.explorer.staging-v3.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://staging-fast-active-bellatrix.explorer.staging-v3.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1192202}},testnet:!0}),Mj=VB({id:1026062157,name:"SKALE | CryptoBlades",network:"skale-cryptoblades",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/affectionate-immediate-pollux"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/affectionate-immediate-pollux"]},public:{http:["https://mainnet.skalenodes.com/v1/affectionate-immediate-pollux"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/affectionate-immediate-pollux"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://affectionate-immediate-pollux.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://affectionate-immediate-pollux.explorer.mainnet.skalenodes.com"}},contracts:{}}),Cj=VB({id:2046399126,name:"SKALE | Crypto Colosseum",network:"skale-crypto-coloseeum",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/haunting-devoted-deneb"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/haunting-devoted-deneb"]},public:{http:["https://mainnet.skalenodes.com/v1/haunting-devoted-deneb"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/haunting-devoted-deneb"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://haunting-devoted-deneb.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://haunting-devoted-deneb.explorer.mainnet.skalenodes.com"}},contracts:{}}),Bj=VB({id:2046399126,name:"SKALE | Europa Liquidity Hub",network:"skale-europa",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/elated-tan-skat"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/elated-tan-skat"]},public:{http:["https://mainnet.skalenodes.com/v1/elated-tan-skat"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/elated-tan-skat"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://elated-tan-skat.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://elated-tan-skat.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3113495}}}),Nj=VB({id:476158412,name:"SKALE | Europa Liquidity Hub Testnet",network:"skale-europa-testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://staging-v3.skalenodes.com/v1/staging-legal-crazy-castor"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-legal-crazy-castor"]},public:{http:["https://staging-v3.skalenodes.com/v1/staging-legal-crazy-castor"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-legal-crazy-castor"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://staging-legal-crazy-castor.explorer.staging-v3.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://staging-legal-crazy-castor.explorer.staging-v3.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2071911}},testnet:!0}),Rj=VB({id:2139927552,name:"SKALE | Exorde",network:"skale-exorde",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/light-vast-diphda"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/light-vast-diphda"]},public:{http:["https://mainnet.skalenodes.com/v1/light-vast-diphda"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/light-vast-diphda"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://light-vast-diphda.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://light-vast-diphda.explorer.mainnet.skalenodes.com"}},contracts:{}}),Fj=VB({id:1273227453,name:"SKALE | Human Protocol",network:"skale-human-protocol",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/wan-red-ain"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/wan-red-ain"]},public:{http:["https://mainnet.skalenodes.com/v1/wan-red-ain"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/wan-red-ain"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://wan-red-ain.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://wan-red-ain.explorer.mainnet.skalenodes.com"}},contracts:{}}),Lj=VB({id:1482601649,name:"SKALE | Nebula Gaming Hub",network:"skale-nebula",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/green-giddy-denebola"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/green-giddy-denebola"]},public:{http:["https://mainnet.skalenodes.com/v1/green-giddy-denebola"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/green-giddy-denebola"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://green-giddy-denebola.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://green-giddy-denebola.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2372986}}}),jj=VB({id:503129905,name:"SKALE | Nebula Gaming Hub Testnet",network:"skale-nebula-testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://staging-v3.skalenodes.com/v1/staging-faint-slimy-achird"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-faint-slimy-achird"]},public:{http:["https://staging-v3.skalenodes.com/v1/staging-faint-slimy-achird"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-faint-slimy-achird"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://staging-faint-slimy-achird.explorer.staging-v3.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://staging-faint-slimy-achird.explorer.staging-v3.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2205882}},testnet:!0}),Uj=VB({id:278611351,name:"SKALE | Razor Network",network:"skale-razor",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/turbulent-unique-scheat"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/turbulent-unique-scheat"]},public:{http:["https://mainnet.skalenodes.com/v1/turbulent-unique-scheat"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/turbulent-unique-scheat"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://turbulent-unique-scheat.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://turbulent-unique-scheat.explorer.mainnet.skalenodes.com"}},contracts:{}}),Dj=VB({id:1350216234,name:"SKALE | Titan Community Hub",network:"skale-titan",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/parallel-stormy-spica"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/parallel-stormy-spica"]},public:{http:["https://mainnet.skalenodes.com/v1/parallel-stormy-spica"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/parallel-stormy-spica"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://parallel-stormy-spica.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://parallel-stormy-spica.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2076458}}}),zj=VB({id:1517929550,name:"SKALE | Titan Community Hub Testnet",network:"skale-titan-testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://staging-v3.skalenodes.com/v1/staging-aware-chief-gianfar"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-aware-chief-gianfar"]},public:{http:["https://staging-v3.skalenodes.com/v1/staging-aware-chief-gianfar"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-aware-chief-gianfar"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://staging-aware-chief-gianfar.explorer.staging-v3.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://staging-aware-chief-gianfar.explorer.staging-v3.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2085155}},testnet:!0}),$j=VB({id:19,name:"Songbird Mainnet",network:"songbird-mainnet",nativeCurrency:{decimals:18,name:"songbird",symbol:"SGB"},rpcUrls:{default:{http:["https://songbird-api.flare.network/ext/C/rpc"]},public:{http:["https://songbird-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Songbird Explorer",url:"https://songbird-explorer.flare.network"}}}),Hj=VB({id:16,name:"Coston",network:"coston",nativeCurrency:{decimals:18,name:"costonflare",symbol:"CFLR"},rpcUrls:{default:{http:["https://coston-api.flare.network/ext/C/rpc"]},public:{http:["https://coston-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Coston Explorer",url:"https://coston-explorer.flare.network"}},testnet:!0}),Gj=VB({id:88882,name:"Chiliz Spicy Testnet",network:"chiliz-spicy-Testnet",nativeCurrency:{decimals:18,name:"CHZ",symbol:"CHZ"},rpcUrls:{default:{http:["https://spicy-rpc.chiliz.com","https://chiliz-spicy.publicnode.com"],webSocket:["wss://spicy-rpc-ws.chiliz.com","wss://chiliz-spicy.publicnode.com"]},public:{http:["https://spicy-rpc.chiliz.com","https://chiliz-spicy.publicnode.com"],webSocket:["wss://spicy-rpc-ws.chiliz.com","wss://chiliz-spicy.publicnode.com"]}},blockExplorers:{default:{name:"Chiliz Explorer",url:"http://spicy-explorer.chiliz.com"}},testnet:!0}),qj=VB({id:8082,name:"Shardeum Sphinx",network:"shmSphinx",nativeCurrency:{name:"SHARDEUM",symbol:"SHM",decimals:18},rpcUrls:{default:{http:["https://sphinx.shardeum.org"]},public:{http:["https://sphinx.shardeum.org"]}},blockExplorers:{default:{name:"Shardeum Explorer",url:"https://explorer-sphinx.shardeum.org"}},testnet:!0}),Kj=VB({id:109,name:"Shibarium",network:"shibarium",nativeCurrency:{name:"Bone",symbol:"BONE",decimals:18},rpcUrls:{default:{http:["https://rpc.shibrpc.com"]},public:{http:["https://rpc.shibrpc.com"]}},blockExplorers:{etherscan:{name:"Blockscout",url:"https://shibariumscan.io"},default:{name:"Blockscout",url:"https://shibariumscan.io"}},contracts:{multicall3:{address:"0x864Bf681ADD6052395188A89101A1B37d3B4C961",blockCreated:265900}}}),Vj=VB({id:57,name:"Syscoin Mainnet",network:"syscoin",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc.syscoin.org"],webSocket:["wss://rpc.syscoin.org/wss"]},public:{http:["https://rpc.syscoin.org"],webSocket:["wss://rpc.syscoin.org/wss"]}},blockExplorers:{default:{name:"SyscoinExplorer",url:"https://explorer.syscoin.org"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:287139}}}),Wj=VB({id:5700,name:"Syscoin Tanenbaum Testnet",network:"syscoin-testnet",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc.tanenbaum.io"],webSocket:["wss://rpc.tanenbaum.io/wss"]},public:{http:["https://rpc.tanenbaum.io"],webSocket:["wss://rpc.tanenbaum.io/wss"]}},blockExplorers:{default:{name:"SyscoinTestnetExplorer",url:"https://tanenbaum.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:271288}}}),Jj=VB({id:841,name:"Taraxa Mainnet",network:"taraxa",nativeCurrency:{name:"Tara",symbol:"TARA",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.taraxa.io"]},public:{http:["https://rpc.mainnet.taraxa.io"]}},blockExplorers:{default:{name:"Taraxa Explorer",url:"https://explorer.mainnet.taraxa.io"}}}),Zj=VB({id:167007,name:"Taiko Jolnir (Alpha-5 Testnet)",network:"tko-jolnir",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.jolnir.taiko.xyz"]},public:{http:["https://rpc.jolnir.taiko.xyz"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer.jolnir.taiko.xyz"}}}),Yj=VB({id:167005,name:"Taiko (Alpha-3 Testnet)",network:"taiko-sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.test.taiko.xyz"]},public:{http:["https://rpc.test.taiko.xyz"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer.test.taiko.xyz"}}}),Xj=VB({id:842,name:"Taraxa Testnet",network:"taraxa-testnet",nativeCurrency:{name:"Tara",symbol:"TARA",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.taraxa.io"]},public:{http:["https://rpc.testnet.taraxa.io"]}},blockExplorers:{default:{name:"Taraxa Explorer",url:"https://explorer.testnet.taraxa.io"}},testnet:!0}),Qj=VB({id:40,name:"Telos",network:"telos",nativeCurrency:{decimals:18,name:"Telos",symbol:"TLOS"},rpcUrls:{default:{http:["https://mainnet.telos.net/evm"]},public:{http:["https://mainnet.telos.net/evm"]}},blockExplorers:{default:{name:"Teloscan",url:"https://www.teloscan.io/"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:246530709}}}),eU=VB({id:41,name:"Telos",network:"telosTestnet",nativeCurrency:{decimals:18,name:"Telos",symbol:"TLOS"},rpcUrls:{default:{http:["https://testnet.telos.net/evm"]},public:{http:["https://testnet.telos.net/evm"]}},blockExplorers:{default:{name:"Teloscan (testnet)",url:"https://testnet.teloscan.io/"}},testnet:!0}),tU=VB({id:1559,name:"Tenet",network:"tenet-mainnet",nativeCurrency:{name:"TENET",symbol:"TENET",decimals:18},rpcUrls:{public:{http:["https://rpc.tenet.org"]},default:{http:["https://rpc.tenet.org"]}},blockExplorers:{default:{name:"TenetScan Mainnet",url:"https://tenetscan.io"}},testnet:!1}),rU=VB({id:997,name:"5ireChain Thunder Testnet",network:"5ireChain",nativeCurrency:{name:"5ire Token",symbol:"5IRE",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.5ire.network"]},public:{http:["https://rpc-testnet.5ire.network"]}},blockExplorers:{default:{name:"5ireChain Explorer",url:"https://explorer.5ire.network"}},testnet:!0}),nU=VB({id:100009,name:"Vechain",network:"vechain",nativeCurrency:{name:"VeChain",symbol:"VET",decimals:18},rpcUrls:{default:{http:["https://mainnet.vechain.org"]},public:{http:["https://mainnet.vechain.org"]}},blockExplorers:{default:{name:"Vechain Explorer",url:"https://explore.vechain.org"},vechainStats:{name:"Vechain Stats",url:"https://vechainstats.com"}}}),iU=VB({id:888,name:"Wanchain",network:"wanchain",nativeCurrency:{name:"WANCHAIN",symbol:"WAN",decimals:18},rpcUrls:{default:{http:["https://gwan-ssl.wandevs.org:56891","https://gwan2-ssl.wandevs.org"]},public:{http:["https://gwan-ssl.wandevs.org:56891","https://gwan2-ssl.wandevs.org"]}},blockExplorers:{etherscan:{name:"WanScan",url:"https://wanscan.org"},default:{name:"WanScan",url:"https://wanscan.org"}},contracts:{multicall3:{address:"0xcDF6A1566e78EB4594c86Fe73Fcdc82429e97fbB",blockCreated:25312390}}}),oU=VB({id:999,name:"Wanchain Testnet",network:"wanchainTestnet",nativeCurrency:{name:"WANCHAIN",symbol:"WANt",decimals:18},rpcUrls:{default:{http:["https://gwan-ssl.wandevs.org:46891"]},public:{http:["https://gwan-ssl.wandevs.org:46891"]}},blockExplorers:{etherscan:{name:"WanScanTest",url:"https://wanscan.org"},default:{name:"WanScanTest",url:"https://wanscan.org"}},contracts:{multicall3:{address:"0x11c89bF4496c39FB80535Ffb4c92715839CC5324",blockCreated:24743448}},testnet:!0}),aU=VB({id:1111,name:"WEMIX",network:"wemix-mainnet",nativeCurrency:{name:"WEMIX",symbol:"WEMIX",decimals:18},rpcUrls:{default:{http:["https://api.wemix.com"]},public:{http:["https://api.wemix.com"]}},blockExplorers:{etherscan:{name:"wemixExplorer",url:"https://explorer.wemix.com"},default:{name:"wemixExplorer",url:"https://explorer.wemix.com"}}}),sU=VB({id:1112,name:"WEMIX Testnet",network:"wemix-testnet",nativeCurrency:{name:"WEMIX",symbol:"tWEMIX",decimals:18},rpcUrls:{default:{http:["https://api.test.wemix.com"]},public:{http:["https://api.test.wemix.com"]}},blockExplorers:{etherscan:{name:"wemixExplorer",url:"https://testnet.wemixscan.com"},default:{name:"wemixExplorer",url:"https://testnet.wemixscan.com"}},testnet:!0}),cU=VB({id:50,name:"XinFin Network",network:"xdc",nativeCurrency:{decimals:18,name:"XDC",symbol:"XDC"},rpcUrls:{default:{http:["https://rpc.xinfin.network"]},public:{http:["https://rpc.xinfin.network"]}},blockExplorers:{xinfin:{name:"XinFin",url:"https://explorer.xinfin.network"},default:{name:"Blocksscan",url:"https://xdc.blocksscan.io"}}}),uU=VB({id:51,name:"Apothem Network",network:"xdc-testnet",nativeCurrency:{decimals:18,name:"TXDC",symbol:"TXDC"},rpcUrls:{default:{http:["https://erpc.apothem.network"]},public:{http:["https://erpc.apothem.network"]}},blockExplorers:{xinfin:{name:"XinFin",url:"https://explorer.apothem.network"},default:{name:"Blocksscan",url:"https://apothem.blocksscan.io"}}}),lU=VB({id:1337803,network:"zhejiang",name:"Zhejiang",nativeCurrency:{name:"Zhejiang Ether",symbol:"ZhejETH",decimals:18},rpcUrls:{default:{http:["https://rpc.zhejiang.ethpandaops.io"]},public:{http:["https://rpc.zhejiang.ethpandaops.io"]}},blockExplorers:{beaconchain:{name:"Etherscan",url:"https://zhejiang.beaconcha.in"},blockscout:{name:"Blockscout",url:"https://blockscout.com/eth/zhejiang-testnet"},default:{name:"Beaconchain",url:"https://zhejiang.beaconcha.in"}},testnet:!0}),fU=VB({id:42766,name:"ZKFair Mainnet",network:"zkfair-mainnet",nativeCurrency:{decimals:18,name:"USD Coin",symbol:"USDC"},rpcUrls:{default:{http:["https://rpc.zkfair.io"]},public:{http:["https://rpc.zkfair.io"]}},blockExplorers:{default:{name:"zkFair Explorer",url:"https://scan.zkfair.io"}},testnet:!1}),dU=VB({id:43851,name:"ZKFair Testnet",network:"zkfair-testnet",nativeCurrency:{decimals:18,name:"USD Coin",symbol:"USDC"},rpcUrls:{default:{http:["https://testnet-rpc.zkfair.io"]},public:{http:["https://testnet-rpc.zkfair.io"]}},blockExplorers:{default:{name:"zkFair Explorer",url:"https://testnet-scan.zkfair.io"}},testnet:!0}),hU={block:dC({format(e){const t=e.transactions?.map((e=>{if("string"==typeof e)return e;const t=hU.transaction.format(e);return"0x71"===t.typeHex?t.type="eip712":"0xff"===t.typeHex&&(t.type="priority"),t}));return{l1BatchNumber:e.l1BatchNumber?gT(e.l1BatchNumber):null,l1BatchTimestamp:e.l1BatchTimestamp?gT(e.l1BatchTimestamp):null,transactions:t}}}),transaction:lC({format(e){const t={};return"0x71"===e.type?t.type="eip712":"0xff"===e.type&&(t.type="priority"),{...t,l1BatchNumber:e.l1BatchNumber?gT(e.l1BatchNumber):null,l1BatchTxIndex:e.l1BatchTxIndex?gT(e.l1BatchTxIndex):null}}}),transactionReceipt:bN({format:e=>({l1BatchNumber:e.l1BatchNumber?gT(e.l1BatchNumber):null,l1BatchTxIndex:e.l1BatchTxIndex?gT(e.l1BatchTxIndex):null,logs:e.logs.map((e=>({..._C(e),l1BatchNumber:e.l1BatchNumber?gT(e.l1BatchNumber):null,transactionLogIndex:vT(e.transactionLogIndex),logType:e.logType}))),l2ToL1Logs:e.l2ToL1Logs.map((e=>({blockNumber:gT(e.blockHash),blockHash:e.blockHash,l1BatchNumber:gT(e.l1BatchNumber),transactionIndex:gT(e.transactionIndex),shardId:gT(e.shardId),isService:e.isService,sender:e.sender,key:e.key,value:e.value,transactionHash:e.transactionHash,logIndex:gT(e.logIndex)})))})}),transactionRequest:rC({exclude:["customSignature","factoryDeps","gasPerPubdata","paymaster","paymasterInput"],format:e=>e.gasPerPubdata||e.paymaster&&e.paymasterInput||e.factoryDeps||e.customSignature?{eip712Meta:{...e.gasPerPubdata?{gasPerPubdata:AT(e.gasPerPubdata)}:{},...e.paymaster&&e.paymasterInput?{paymasterParams:{paymaster:e.paymaster,paymasterInput:Array.from(CT(e.paymasterInput))}}:{},...e.factoryDeps?{factoryDeps:e.factoryDeps}:{},...e.customSignature?{customSignature:e.customSignature}:{}},type:"eip712"===e.type?"0x71":"0xff"}:{}})},pU={transaction:(e,t)=>{return"customSignature"in(r=e)||"paymaster"in r||"paymasterInput"in r||"gasPerPubdata"in r||"factoryDeps"in r?function(e){const{chainId:t,gas:r,nonce:n,to:i,from:o,value:a,maxFeePerGas:s,maxPriorityFeePerGas:c,customSignature:u,factoryDeps:l,paymaster:f,paymasterInput:d,gasPerPubdata:h,data:p}=e;!function(e){const{chainId:t,to:r,from:n,paymaster:i,paymasterInput:o}=e;if(t<=0)throw new UC({chainId:t});if(r&&!bO(r))throw new pO({address:r});if(n&&!bO(n))throw new pO({address:n});if(i&&!bO(i))throw new pO({address:i});if(i&&!o)throw new NI("`paymasterInput` must be provided when `paymaster` is defined");if(!i&&o)throw new NI("`paymaster` must be provided when `paymasterInput` is defined")}(e);const m=[n?AT(n):"0x",c?AT(c):"0x",s?AT(s):"0x",r?AT(r):"0x",i??"0x",a?AT(a):"0x",p??"0x",AT(t),AT(""),AT(""),AT(t),o??"0x",h?AT(h):"0x",l??[],u??"0x",f&&d?[f,d]:[]];return yO(["0x71",fN(m)])}(e):IN(e,t);var r}};const mU=VB({id:324,name:"zkSync Era",network:"zksync-era",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://mainnet.era.zksync.io"],webSocket:["wss://mainnet.era.zksync.io/ws"]},public:{http:["https://mainnet.era.zksync.io"],webSocket:["wss://mainnet.era.zksync.io/ws"]}},blockExplorers:{default:{name:"zkExplorer",url:"https://explorer.zksync.io"}},contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963"}}},{serializers:pU,formatters:hU}),bU=VB({id:280,name:"zkSync Era Testnet",network:"zksync-era-testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://testnet.era.zksync.dev"],webSocket:["wss://testnet.era.zksync.dev/ws"]},public:{http:["https://testnet.era.zksync.dev"],webSocket:["wss://testnet.era.zksync.dev/ws"]}},blockExplorers:{default:{name:"zkExplorer",url:"https://goerli.explorer.zksync.io"}},contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963"}},testnet:!0},{serializers:pU,formatters:hU}),gU=VB({id:300,name:"zkSync Sepolia Testnet",network:"zksync-sepolia-testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.era.zksync.dev"],webSocket:["wss://sepolia.era.zksync.dev/ws"]},public:{http:["https://sepolia.era.zksync.dev"],webSocket:["wss://sepolia.era.zksync.dev/ws"]}},blockExplorers:{default:{name:"zkExplorer",url:"https://sepolia.explorer.zksync.io/"}},contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963"}},testnet:!0},{serializers:pU,formatters:hU}),yU=VB({id:7001,name:"ZetaChain Athens Testnet",network:"zetachain-athens-testnet",nativeCurrency:{decimals:18,name:"Zeta",symbol:"aZETA"},rpcUrls:{public:{http:["https://zetachain-athens-evm.blockpi.network/v1/rpc/public"]},default:{http:["https://zetachain-athens-evm.blockpi.network/v1/rpc/public"]}},blockExplorers:{default:{name:"ZetaScan",url:"https://athens3.explorer.zetachain.com"}},testnet:!0}),vU=VB({id:32769,name:"Zilliqa",network:"zilliqa",nativeCurrency:{name:"Zilliqa",symbol:"ZIL",decimals:18},rpcUrls:{default:{http:["https://api.zilliqa.com"]},public:{http:["https://api.zilliqa.com"]}},blockExplorers:{default:{name:"Ethernal",url:"https://evmx.zilliqa.com"}},testnet:!1}),wU=VB({id:33101,name:"Zilliqa Testnet",network:"zilliqa-testnet",nativeCurrency:{name:"Zilliqa",symbol:"ZIL",decimals:18},rpcUrls:{default:{http:["https://dev-api.zilliqa.com"]},public:{http:["https://dev-api.zilliqa.com"]}},blockExplorers:{default:{name:"Ethernal",url:"https://evmx.testnet.zilliqa.com"}},testnet:!0}),EU=VB({id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:5882}}},{formatters:rF}),AU=VB({id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:83160}},testnet:!0},{formatters:rF}),xU=VB({id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:189123}},testnet:!0},{formatters:rF});var _U=Object.freeze({__proto__:null,acala:GR,arbitrum:qR,arbitrumGoerli:KR,arbitrumNova:VR,arbitrumSepolia:JR,astar:WR,astarZkatana:ZR,aurora:YR,auroraTestnet:XR,avalanche:QR,avalancheFuji:eF,bahamut:tF,base:nF,baseGoerli:iF,baseSepolia:oF,bearNetworkChainMainnet:aF,bearNetworkChainTestnet:sF,bitTorrent:cF,bitTorrentTestnet:uF,boba:lF,bronos:fF,bronosTestnet:dF,bsc:hF,bscTestnet:pF,bxn:mF,bxnTestnet:bF,canto:gF,celo:SF,celoAlfajores:PF,celoCannoli:TF,chiliz:IF,classic:OF,confluxESpace:MF,confluxESpaceTestnet:CF,coreDao:BF,cronos:NF,cronosTestnet:RF,crossbell:FF,dfk:LF,dogechain:jF,edgeware:UF,edgewareTestnet:DF,ekta:qF,ektaTestnet:KF,eos:zF,eosTestnet:$F,evmos:HF,evmosTestnet:GF,fantom:VF,fantomSonicTestnet:WF,fantomTestnet:JF,fibo:ZF,filecoin:YF,filecoinCalibration:XF,filecoinHyperspace:QF,flare:eL,flareTestnet:tL,foundry:rL,fuse:nL,fuseSparknet:iL,gnosis:fL,gnosisChiado:dL,gobi:uL,goerli:lL,haqqMainnet:mL,haqqTestedge2:bL,hardhat:hL,harmonyOne:pL,holesky:gL,iotex:oL,iotexTestnet:aL,jbc:sL,karura:cL,kava:yL,kavaTestnet:vL,klaytn:wL,klaytnBaobab:EL,kroma:AL,kromaSepolia:xL,linea:_L,lineaTestnet:kL,localhost:SL,lukso:PL,mainnet:IL,mandala:TL,manta:OL,mantaTestnet:ML,mantle:CL,mantleTestnet:BL,meter:NL,meterTestnet:RL,metis:FL,metisGoerli:LL,mev:jL,mevTestnet:UL,modeTestnet:DL,moonbaseAlpha:zL,moonbeam:$L,moonbeamDev:HL,moonriver:GL,neonDevnet:qL,neonMainnet:KL,nexi:VL,nexilix:WL,oasisTestnet:ZL,oasys:JL,okc:YL,opBNB:tj,opBNBTestnet:rj,optimism:XL,optimismGoerli:QL,optimismSepolia:ej,pgn:nj,pgnTestnet:ij,plinga:oj,polygon:aj,polygonMumbai:sj,polygonZkEvm:uj,polygonZkEvmTestnet:cj,pulsechain:lj,pulsechainV4:fj,qMainnet:dj,qTestnet:hj,rollux:pj,rolluxTestnet:mj,ronin:bj,rootstock:gj,saigon:yj,sapphire:vj,sapphireTestnet:wj,scroll:Ej,scrollSepolia:Aj,scrollTestnet:xj,sepolia:_j,shardeumSphinx:qj,shibarium:Kj,shimmer:kj,shimmerTestnet:Sj,skaleBlockBrawlers:Pj,skaleCalypso:Ij,skaleCalypsoTestnet:Tj,skaleChaosTestnet:Oj,skaleCryptoBlades:Mj,skaleCryptoColosseum:Cj,skaleEuropa:Bj,skaleEuropaTestnet:Nj,skaleExorde:Rj,skaleHumanProtocol:Fj,skaleNebula:Lj,skaleNebulaTestnet:jj,skaleRazor:Uj,skaleTitan:Dj,skaleTitanTestnet:zj,songbird:$j,songbirdTestnet:Hj,spicy:Gj,syscoin:Vj,syscoinTestnet:Wj,taikoJolnir:Zj,taikoTestnetSepolia:Yj,taraxa:Jj,taraxaTestnet:Xj,telos:Qj,telosTestnet:eU,tenet:tU,thunderTestnet:rU,vechain:nU,wanchain:iU,wanchainTestnet:oU,wemix:aU,wemixTestnet:sU,xdc:cU,xdcTestnet:uU,zetachainAthensTestnet:yU,zhejiang:lU,zilliqa:vU,zilliqaTestnet:wU,zkFair:fU,zkFairTestnet:dU,zkSync:mU,zkSyncSepoliaTestnet:gU,zkSyncTestnet:bU,zora:EU,zoraSepolia:AU,zoraTestnet:xU});const kU="https://meta-aa-provider.onrender.com/api/v1/bundler",SU="https://meta-aa-provider.onrender.com/api/v1/paymaster",PU="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",IU="0x8ae01fcf7c655655ff2c6ef907b8b4718ab4e17c",TU="0x0DA6a956B9488eD4dd761E59f52FDc6c8068E6B5",OU={USDC:{1:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",137:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",42161:"0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8",43114:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"},PEPE:{1:"0x6982508145454Ce325dDbE47a25d4ec3d2311933"}},MU={[OU.USDC[1]]:TN("100",6),[OU.USDC[5]]:TN("100",6),[OU.USDC[137]]:TN("10",6),[OU.USDC[42161]]:TN("10",6),[OU.USDC[43114]]:TN("10",6),[OU.PEPE[1]]:TN("50000000",18),"0x3870419Ba2BBf0127060bCB37f69A1b1C090992B":TN("100",18)},CU=new Map([[aj.id,30000000000n]]),BU="f36f7f706a58477884ce6fe89165666c",NU={1:`https://mainnet.infura.io/v3/${BU}`,5:`https://goerli.infura.io/v3/${BU}`,11155111:"https://fittest-ultra-aura.ethereum-sepolia.quiknode.pro/3893d01b1dd411fdfa9b6dd372dd2b4f69fcf1ea/",137:`https://polygon-mainnet.infura.io/v3/${BU}`,80001:`https://polygon-mumbai.infura.io/v3/${BU}`,80002:`https://polygon-amoy.infura.io/v3/${BU}`,10:`https://optimism-mainnet.infura.io/v3/${BU}`,420:`https://optimism-goerli.infura.io/v3/${BU}`,42161:`https://arbitrum-mainnet.infura.io/v3/${BU}`,421613:`https://arbitrum-goerli.infura.io/v3/${BU}`,43114:`https://avalanche-mainnet.infura.io/v3/${BU}`,43113:`https://avalanche-fuji.infura.io/v3/${BU}`,1313161554:`https://aurora-mainnet.infura.io/v3/${BU}`,1313161555:`https://aurora-testnet.infura.io/v3/${BU}`,56:"https://neat-greatest-layer.bsc.quiknode.pro/9405a499ceee314e5f2f68c9d47518d3537fce6a/",8453:"https://twilight-red-tree.base-mainnet.quiknode.pro/dc6eb27bf0f917df215922488dd97f4de7d9b08e/",84531:"https://icy-long-mountain.base-goerli.quiknode.pro/5b80d93e97cc9412a63c10a30841869abbef9596/",100:"https://thrilling-fluent-film.xdai.quiknode.pro/305955cffb9868cdd95b5e3dc9775f20678ad9ac/",10200:"https://nd-810-853-201.p2pify.com/e828b09f0d43591de96c297b3f36fffd",59144:`https://linea-mainnet.infura.io/v3/${BU}`,59140:`https://linea-goerli.infura.io/v3/${BU}`,204:"https://opbnb.rpc.thirdweb.com/eed98c1f30120c0508f17c1f01d3102b",42069:"https://rpc.op-testnet.gelato.digital",1261120:"https://rpc.zkatana.gelato.digital",84532:"https://floral-old-feather.base-sepolia.quiknode.pro/4c3b4295d0c174410872b1e461a91cc33c7969a9/",421614:`https://arbitrum-sepolia.infura.io/v3/${BU}`,11155420:`https://optimism-sepolia.infura.io/v3/${BU}`,42220:`https://celo-mainnet.infura.io/v3/${BU}`,44787:`https://celo-alfajores.infura.io/v3/${BU}`,168587773:"https://168587773.rpc.thirdweb.com/eed98c1f30120c0508f17c1f01d3102b",81457:"https://rpc.blast.io",3776:"https://rpc.startale.com/astar-zkevm",122:"https://rpc.fuse.io",42170:"https://nova.arbitrum.io/rpc",94204209:"https://rpc.polygon-blackberry.gelato.digital",88153591557:"https://rpc.arb-blueberry.gelato.digital",123420111:"https://rpc.opcelestia-raspberry.gelato.digital",6038361:"https://rpc.startale.com/zkyoto",666666666:"https://rpc.degen.tips",7560:"https://cyber.alt.technology",111557560:"https://cyber-testnet.alt.technology"};var RU;!function(e){e.sudo="0x00000000",e.plugin="0x00000001",e.enable="0x00000002"}(RU||(RU={}));class FU{constructor(e){Object.defineProperty(this,"validatorAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"projectId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"entryPointAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"enableSignature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"validUntil",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"validAfter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"executor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"selector",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rpcUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"publicClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.projectId=e.projectId,this.validatorAddress=e.validatorAddress??"0xd9AB5096a832b9ce79914329DAEE236f8Eea0390",this.mode=e.mode??RU.sudo,this.entryPointAddress=e.entryPointAddress??PU,this.enableSignature=e.enableSignature,this.validUntil=e.validUntil??0,this.validAfter=e.validAfter??0,this.executor=e.executor,this.selector=e.selector,this.chain=e.chain,this.rpcUrl=e.rpcUrl,this.publicClient=aR({transport:gB(e.rpcUrl??NU[this.chain?.id??sj.id]),chain:this.chain??sj})}shouldDelegateViaFallback(){return!0}getPluginValidatorData(){if(!this.selector||!this.executor)throw Error("Plugin Validator data params uninitialised");return{selector:this.selector,executor:this.executor,validAfter:this.validAfter,validUntil:this.validUntil}}getNonceKey(){return 0n}async getDynamicDummySignature(e,t){const r=await this.resolveValidatorMode(e,t);if(r===RU.enable){const r=await this.getEnableData(e),n=r.length/2-1,i=65,o=yO(["0x000000000000000000000000",this.getAddress(),this.executor]);return yO([RU.enable,o,cT(AT(n),{size:32}),r,cT(AT(i),{size:32}),"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",await this.getDummyUserOpSignature(t)])}return yO([r,await this.getDummyUserOpSignature(t)])}setEnableSignature(e){this.enableSignature=e}getEnableSignature(){return this.enableSignature}getAddress(){return this.validatorAddress}getPublicClient(){if(!this.publicClient)throw new Error("Validator uninitialized: PublicClient missing");return this.publicClient}async approveExecutor(e,t,r,n,i,o){if(!this.chain)throw new Error("Validator uninitialized");let a;try{const t=await this.getPublicClient().getStorageAt({address:e,slot:"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"});a=t?"0x"+t.slice(26):t}catch(e){}const s=e,c=await this.signer();return await c.signTypedData({domain:{name:"Kernel",version:a?.toLowerCase()===TU.toLowerCase()||a?.toLowerCase()==="0x8dD4DBB54d8A8Cf0DE6F9CCC4609470A30EfF18C".toLowerCase()||void 0===a||"0x0000000000000000000000000000000000000000"===a?"0.2.2":"0.2.1",chainId:this.chain.id,verifyingContract:s},types:{ValidatorApproved:[{name:"sig",type:"bytes4"},{name:"validatorData",type:"uint256"},{name:"executor",type:"address"},{name:"enableData",type:"bytes"}]},message:{sig:t,validatorData:gT(yO([cT(AT(n),{size:6}),cT(AT(i),{size:6}),o.getAddress()]),{size:32}),executor:r,enableData:await o.getEnableData(e)},primaryType:"ValidatorApproved"})}async resolveValidatorMode(e,t){if(!this.chain||!this.publicClient)throw new Error("Validator uninitialized");let r;try{const n=await this.publicClient.readContract({abi:mE,address:e,functionName:"getDefaultValidator"});r=n?.toLowerCase()===this.validatorAddress.toLowerCase()||this.mode===RU.sudo?RU.sudo:await this.isPluginEnabled(e,t.toString().slice(0,10))?RU.plugin:RU.enable}catch(e){r=this.mode===RU.plugin?RU.enable:this.mode}return r}async getSignature(e){const t=await this.resolveValidatorMode(e.sender,e.callData);if(t===RU.sudo||t===RU.plugin)return yO([this.mode,await this.signUserOp(e)]);{const r=await this.getEnableData(e.sender),n=r.length/2-1,i=this.getEnableSignature();if(!i)throw new Error("Enable signature not set");return gO([t,cT(AT(this.validUntil),{size:6}),cT(AT(this.validAfter),{size:6}),cT(this.validatorAddress,{size:20}),cT(this.executor,{size:20}),cT(AT(n),{size:32}),r,cT(AT(i.length/2-1),{size:32}),i,await this.signUserOp(e)])}}}function LU(e,t){return function(){return e.apply(t,arguments)}}const{toString:jU}=Object.prototype,{getPrototypeOf:UU}=Object,DU=(e=>t=>{const r=jU.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),zU=e=>(e=e.toLowerCase(),t=>DU(t)===e),$U=e=>t=>typeof t===e,{isArray:HU}=Array,GU=$U("undefined");const qU=zU("ArrayBuffer");const KU=$U("string"),VU=$U("function"),WU=$U("number"),JU=e=>null!==e&&"object"==typeof e,ZU=e=>{if("object"!==DU(e))return!1;const t=UU(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},YU=zU("Date"),XU=zU("File"),QU=zU("Blob"),eD=zU("FileList"),tD=zU("URLSearchParams"),[rD,nD,iD,oD]=["ReadableStream","Request","Response","Headers"].map(zU);function aD(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),HU(e))for(n=0,i=e.length;n0;)if(n=r[i],t===n.toLowerCase())return n;return null}const cD="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:u,uD=e=>!GU(e)&&e!==cD;const lD=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&UU(Uint8Array)),fD=zU("HTMLFormElement"),dD=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),hD=zU("RegExp"),pD=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};aD(r,((r,i)=>{let o;!1!==(o=t(r,i,e))&&(n[i]=o||r)})),Object.defineProperties(e,n)},mD="abcdefghijklmnopqrstuvwxyz",bD="0123456789",gD={DIGIT:bD,ALPHA:mD,ALPHA_DIGIT:mD+mD.toUpperCase()+bD};const yD=zU("AsyncFunction"),vD=(wD="function"==typeof setImmediate,ED=VU(cD.postMessage),wD?setImmediate:ED?((e,t)=>(cD.addEventListener("message",(({source:r,data:n})=>{r===cD&&n===e&&t.length&&t.shift()()}),!1),r=>{t.push(r),cD.postMessage(e,"*")}))(`axios@${Math.random()}`,[]):e=>setTimeout(e));var wD,ED;const AD="undefined"!=typeof queueMicrotask?queueMicrotask.bind(cD):void 0!==pr&&pr.nextTick||vD;var xD={isArray:HU,isArrayBuffer:qU,isBuffer:function(e){return null!==e&&!GU(e)&&null!==e.constructor&&!GU(e.constructor)&&VU(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||VU(e.append)&&("formdata"===(t=DU(e))||"object"===t&&VU(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&qU(e.buffer),t},isString:KU,isNumber:WU,isBoolean:e=>!0===e||!1===e,isObject:JU,isPlainObject:ZU,isReadableStream:rD,isRequest:nD,isResponse:iD,isHeaders:oD,isUndefined:GU,isDate:YU,isFile:XU,isBlob:QU,isRegExp:hD,isFunction:VU,isStream:e=>JU(e)&&VU(e.pipe),isURLSearchParams:tD,isTypedArray:lD,isFileList:eD,forEach:aD,merge:function e(){const{caseless:t}=uD(this)&&this||{},r={},n=(n,i)=>{const o=t&&sD(r,i)||i;ZU(r[o])&&ZU(n)?r[o]=e(r[o],n):ZU(n)?r[o]=e({},n):HU(n)?r[o]=n.slice():r[o]=n};for(let e=0,t=arguments.length;e(aD(t,((t,n)=>{r&&VU(t)?e[n]=LU(t,r):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let i,o,a;const s={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)a=i[o],n&&!n(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==r&&UU(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:DU,kindOfTest:zU,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(HU(e))return e;let t=e.length;if(!WU(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:fD,hasOwnProperty:dD,hasOwnProp:dD,reduceDescriptors:pD,freezeMethods:e=>{pD(e,((t,r)=>{if(VU(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];VU(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return HU(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:sD,global:cD,isContextDefined:uD,ALPHABET:gD,generateString:(e=16,t=gD.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&VU(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(JU(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=HU(e)?[]:{};return aD(e,((e,t)=>{const o=r(e,n+1);!GU(o)&&(i[t]=o)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:yD,isThenable:e=>e&&(JU(e)||VU(e))&&VU(e.then)&&VU(e.catch),setImmediate:vD,asap:AD};function _D(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}xD.inherits(_D,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:xD.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const kD=_D.prototype,SD={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{SD[e]={value:e}})),Object.defineProperties(_D,SD),Object.defineProperty(kD,"isAxiosError",{value:!0}),_D.from=(e,t,r,n,i,o)=>{const a=Object.create(kD);return xD.toFlatObject(e,a,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),_D.call(a,e.message,t,r,n,i),a.cause=e,a.name=e.name,o&&Object.assign(a,o),a};function PD(e){return xD.isPlainObject(e)||xD.isArray(e)}function ID(e){return xD.endsWith(e,"[]")?e.slice(0,-2):e}function TD(e,t,r){return e?e.concat(t).map((function(e,t){return e=ID(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const OD=xD.toFlatObject(xD,{},null,(function(e){return/^is[A-Z]/.test(e)}));function MD(e,t,r){if(!xD.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=xD.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!xD.isUndefined(t[e])}))).metaTokens,i=r.visitor||u,o=r.dots,a=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&xD.isSpecCompliantForm(t);if(!xD.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(xD.isDate(e))return e.toISOString();if(!s&&xD.isBlob(e))throw new _D("Blob is not supported. Use a Buffer instead.");return xD.isArrayBuffer(e)||xD.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):_.from(e):e}function u(e,r,i){let s=e;if(e&&!i&&"object"==typeof e)if(xD.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(xD.isArray(e)&&function(e){return xD.isArray(e)&&!e.some(PD)}(e)||(xD.isFileList(e)||xD.endsWith(r,"[]"))&&(s=xD.toArray(e)))return r=ID(r),s.forEach((function(e,n){!xD.isUndefined(e)&&null!==e&&t.append(!0===a?TD([r],n,o):null===a?r:r+"[]",c(e))})),!1;return!!PD(e)||(t.append(TD(i,r,o),c(e)),!1)}const l=[],f=Object.assign(OD,{defaultVisitor:u,convertValue:c,isVisitable:PD});if(!xD.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!xD.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+n.join("."));l.push(r),xD.forEach(r,(function(r,o){!0===(!(xD.isUndefined(r)||null===r)&&i.call(t,r,xD.isString(o)?o.trim():o,n,f))&&e(r,n?n.concat(o):[o])})),l.pop()}}(e),t}function CD(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function BD(e,t){this._pairs=[],e&&MD(e,this,t)}const ND=BD.prototype;function RD(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function FD(e,t,r){if(!t)return e;const n=r&&r.encode||RD,i=r&&r.serialize;let o;if(o=i?i(t,r):xD.isURLSearchParams(t)?t.toString():new BD(t,r).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}ND.append=function(e,t){this._pairs.push([e,t])},ND.toString=function(e){const t=e?function(t){return e.call(this,t,CD)}:CD;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class LD{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){xD.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var jD={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},UD={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:BD,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const DD="undefined"!=typeof window&&"undefined"!=typeof document,zD=($D="undefined"!=typeof navigator&&navigator.product,DD&&["ReactNative","NativeScript","NS"].indexOf($D)<0);var $D;const HD="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,GD=DD&&window.location.href||"http://localhost";var qD={...Object.freeze({__proto__:null,hasBrowserEnv:DD,hasStandardBrowserEnv:zD,hasStandardBrowserWebWorkerEnv:HD,origin:GD}),...UD};function KD(e){function t(e,r,n,i){let o=e[i++];if("__proto__"===o)return!0;const a=Number.isFinite(+o),s=i>=e.length;if(o=!o&&xD.isArray(n)?n.length:o,s)return xD.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!a;n[o]&&xD.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],i)&&xD.isArray(n[o])&&(n[o]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let o;for(n=0;n{t(function(e){return xD.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const VD={transitional:jD,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=xD.isObject(e);i&&xD.isHTMLForm(e)&&(e=new FormData(e));if(xD.isFormData(e))return n?JSON.stringify(KD(e)):e;if(xD.isArrayBuffer(e)||xD.isBuffer(e)||xD.isStream(e)||xD.isFile(e)||xD.isBlob(e)||xD.isReadableStream(e))return e;if(xD.isArrayBufferView(e))return e.buffer;if(xD.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return MD(e,new qD.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return qD.isNode&&xD.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((o=xD.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return MD(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(xD.isString(e))try{return(t||JSON.parse)(e),xD.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||VD.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(xD.isResponse(e)||xD.isReadableStream(e))return e;if(e&&xD.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw _D.from(e,_D.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:qD.classes.FormData,Blob:qD.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};xD.forEach(["delete","get","head","post","put","patch"],(e=>{VD.headers[e]={}}));const WD=xD.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const JD=Symbol("internals");function ZD(e){return e&&String(e).trim().toLowerCase()}function YD(e){return!1===e||null==e?e:xD.isArray(e)?e.map(YD):String(e)}function XD(e,t,r,n,i){return xD.isFunction(n)?n.call(this,t,r):(i&&(t=r),xD.isString(t)?xD.isString(n)?-1!==t.indexOf(n):xD.isRegExp(n)?n.test(t):void 0:void 0)}let QD=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=ZD(t);if(!i)throw new Error("header name must be a non-empty string");const o=xD.findKey(n,i);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=YD(e))}const o=(e,t)=>xD.forEach(e,((e,r)=>i(e,r,t)));if(xD.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(xD.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach((function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&WD[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t);else if(xD.isHeaders(e))for(const[t,n]of e.entries())i(n,t,r);else null!=e&&i(t,e,r);return this}get(e,t){if(e=ZD(e)){const r=xD.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(xD.isFunction(t))return t.call(this,e,r);if(xD.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ZD(e)){const r=xD.findKey(this,e);return!(!r||void 0===this[r]||t&&!XD(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=ZD(e)){const i=xD.findKey(r,e);!i||t&&!XD(0,r[i],i,t)||(delete r[i],n=!0)}}return xD.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!XD(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return xD.forEach(this,((n,i)=>{const o=xD.findKey(r,i);if(o)return t[o]=YD(n),void delete t[i];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();a!==i&&delete t[i],t[a]=YD(n),r[a]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return xD.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&xD.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[JD]=this[JD]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=ZD(e);t[n]||(!function(e,t){const r=xD.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return xD.isArray(e)?e.forEach(n):n(e),this}};function ez(e,t){const r=this||VD,n=t||r,i=QD.from(n.headers);let o=n.data;return xD.forEach(e,(function(e){o=e.call(r,o,i.normalize(),t?t.status:void 0)})),i.normalize(),o}function tz(e){return!(!e||!e.__CANCEL__)}function rz(e,t,r){_D.call(this,null==e?"canceled":e,_D.ERR_CANCELED,t,r),this.name="CanceledError"}function nz(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new _D("Request failed with status code "+r.status,[_D.ERR_BAD_REQUEST,_D.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}QD.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),xD.reduceDescriptors(QD.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),xD.freezeMethods(QD),xD.inherits(rz,_D,{__CANCEL__:!0});const iz=(e,t,r=3)=>{let n=0;const i=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,o=0,a=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),u=n[a];i||(i=c),r[o]=s,n[o]=c;let l=a,f=0;for(;l!==o;)f+=r[l++],l%=e;if(o=(o+1)%e,o===a&&(a=(a+1)%e),c-i{i=o,r=null,n&&(clearTimeout(n),n=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),s=t-i;s>=o?a(e,t):(r=e,n||(n=setTimeout((()=>{n=null,a(r)}),o-s)))},()=>r&&a(r)]}((r=>{const o=r.loaded,a=r.lengthComputable?r.total:void 0,s=o-n,c=i(s);n=o;e({loaded:o,total:a,progress:a?o/a:void 0,bytes:s,rate:c||void 0,estimated:c&&a&&o<=a?(a-o)/c:void 0,event:r,lengthComputable:null!=a,[t?"download":"upload"]:!0})}),r)},oz=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},az=e=>(...t)=>xD.asap((()=>e(...t)));var sz=qD.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=xD.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0},cz=qD.hasStandardBrowserEnv?{write(e,t,r,n,i,o){const a=[e+"="+encodeURIComponent(t)];xD.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),xD.isString(n)&&a.push("path="+n),xD.isString(i)&&a.push("domain="+i),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function uz(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const lz=e=>e instanceof QD?{...e}:e;function fz(e,t){t=t||{};const r={};function n(e,t,r){return xD.isPlainObject(e)&&xD.isPlainObject(t)?xD.merge.call({caseless:r},e,t):xD.isPlainObject(t)?xD.merge({},t):xD.isArray(t)?t.slice():t}function i(e,t,r){return xD.isUndefined(t)?xD.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function o(e,t){if(!xD.isUndefined(t))return n(void 0,t)}function a(e,t){return xD.isUndefined(t)?xD.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,i,o){return o in t?n(r,i):o in e?n(void 0,r):void 0}const c={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:(e,t)=>i(lz(e),lz(t),!0)};return xD.forEach(Object.keys(Object.assign({},e,t)),(function(n){const o=c[n]||i,a=o(e[n],t[n],n);xD.isUndefined(a)&&o!==s||(r[n]=a)})),r}var dz=e=>{const t=fz({},e);let r,{data:n,withXSRFToken:i,xsrfHeaderName:o,xsrfCookieName:a,headers:s,auth:c}=t;if(t.headers=s=QD.from(s),t.url=FD(uz(t.baseURL,t.url),e.params,e.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),xD.isFormData(n))if(qD.hasStandardBrowserEnv||qD.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(!1!==(r=s.getContentType())){const[e,...t]=r?r.split(";").map((e=>e.trim())).filter(Boolean):[];s.setContentType([e||"multipart/form-data",...t].join("; "))}if(qD.hasStandardBrowserEnv&&(i&&xD.isFunction(i)&&(i=i(t)),i||!1!==i&&sz(t.url))){const e=o&&a&&cz.read(a);e&&s.set(o,e)}return t};var hz="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){const n=dz(e);let i=n.data;const o=QD.from(n.headers).normalize();let a,s,c,u,l,{responseType:f,onUploadProgress:d,onDownloadProgress:h}=n;function p(){u&&u(),l&&l(),n.cancelToken&&n.cancelToken.unsubscribe(a),n.signal&&n.signal.removeEventListener("abort",a)}let m=new XMLHttpRequest;function b(){if(!m)return;const n=QD.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());nz((function(e){t(e),p()}),(function(e){r(e),p()}),{data:f&&"text"!==f&&"json"!==f?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:n,config:e,request:m}),m=null}m.open(n.method.toUpperCase(),n.url,!0),m.timeout=n.timeout,"onloadend"in m?m.onloadend=b:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(b)},m.onabort=function(){m&&(r(new _D("Request aborted",_D.ECONNABORTED,e,m)),m=null)},m.onerror=function(){r(new _D("Network Error",_D.ERR_NETWORK,e,m)),m=null},m.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const i=n.transitional||jD;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new _D(t,i.clarifyTimeoutError?_D.ETIMEDOUT:_D.ECONNABORTED,e,m)),m=null},void 0===i&&o.setContentType(null),"setRequestHeader"in m&&xD.forEach(o.toJSON(),(function(e,t){m.setRequestHeader(t,e)})),xD.isUndefined(n.withCredentials)||(m.withCredentials=!!n.withCredentials),f&&"json"!==f&&(m.responseType=n.responseType),h&&([c,l]=iz(h,!0),m.addEventListener("progress",c)),d&&m.upload&&([s,u]=iz(d),m.upload.addEventListener("progress",s),m.upload.addEventListener("loadend",u)),(n.cancelToken||n.signal)&&(a=t=>{m&&(r(!t||t.type?new rz(null,e,m):t),m.abort(),m=null)},n.cancelToken&&n.cancelToken.subscribe(a),n.signal&&(n.signal.aborted?a():n.signal.addEventListener("abort",a)));const g=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);g&&-1===qD.protocols.indexOf(g)?r(new _D("Unsupported protocol "+g+":",_D.ERR_BAD_REQUEST,e)):m.send(i||null)}))};const pz=(e,t)=>{let r,n=new AbortController;const i=function(e){if(!r){r=!0,a();const t=e instanceof Error?e:this.reason;n.abort(t instanceof _D?t:new rz(t instanceof Error?t.message:t))}};let o=t&&setTimeout((()=>{i(new _D(`timeout ${t} of ms exceeded`,_D.ETIMEDOUT))}),t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach((e=>{e&&(e.removeEventListener?e.removeEventListener("abort",i):e.unsubscribe(i))})),e=null)};e.forEach((e=>e&&e.addEventListener&&e.addEventListener("abort",i)));const{signal:s}=n;return s.unsubscribe=a,[s,()=>{o&&clearTimeout(o),o=null}]},mz=function*(e,t){let r=e.byteLength;if(!t||r{const o=async function*(e,t,r){for await(const n of e)yield*mz(ArrayBuffer.isView(n)?n:await r(String(n)),t)}(e,t,i);let a,s=0,c=e=>{a||(a=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await o.next();if(t)return c(),void e.close();let i=n.byteLength;if(r){let e=s+=i;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw c(e),e}},cancel:e=>(c(e),o.return())},{highWaterMark:2})},gz="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,yz=gz&&"function"==typeof ReadableStream,vz=gz&&("function"==typeof TextEncoder?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),wz=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Ez=yz&&wz((()=>{let e=!1;const t=new Request(qD.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),Az=yz&&wz((()=>xD.isReadableStream(new Response("").body))),xz={stream:Az&&(e=>e.body)};var _z;gz&&(_z=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!xz[e]&&(xz[e]=xD.isFunction(_z[e])?t=>t[e]():(t,r)=>{throw new _D(`Response type '${e}' is not supported`,_D.ERR_NOT_SUPPORT,r)})})));const kz=async(e,t)=>{const r=xD.toFiniteNumber(e.getContentLength());return null==r?(async e=>null==e?0:xD.isBlob(e)?e.size:xD.isSpecCompliantForm(e)?(await new Request(e).arrayBuffer()).byteLength:xD.isArrayBufferView(e)||xD.isArrayBuffer(e)?e.byteLength:(xD.isURLSearchParams(e)&&(e+=""),xD.isString(e)?(await vz(e)).byteLength:void 0))(t):r};var Sz=gz&&(async e=>{let{url:t,method:r,data:n,signal:i,cancelToken:o,timeout:a,onDownloadProgress:s,onUploadProgress:c,responseType:u,headers:l,withCredentials:f="same-origin",fetchOptions:d}=dz(e);u=u?(u+"").toLowerCase():"text";let h,p,[m,b]=i||o||a?pz([i,o],a):[];const g=()=>{!h&&setTimeout((()=>{m&&m.unsubscribe()})),h=!0};let y;try{if(c&&Ez&&"get"!==r&&"head"!==r&&0!==(y=await kz(l,n))){let e,r=new Request(t,{method:"POST",body:n,duplex:"half"});if(xD.isFormData(n)&&(e=r.headers.get("content-type"))&&l.setContentType(e),r.body){const[e,t]=oz(y,iz(az(c)));n=bz(r.body,65536,e,t,vz)}}xD.isString(f)||(f=f?"include":"omit"),p=new Request(t,{...d,signal:m,method:r.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:f});let i=await fetch(p);const o=Az&&("stream"===u||"response"===u);if(Az&&(s||o)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=i[t]}));const t=xD.toFiniteNumber(i.headers.get("content-length")),[r,n]=s&&oz(t,iz(az(s),!0))||[];i=new Response(bz(i.body,65536,r,(()=>{n&&n(),o&&g()}),vz),e)}u=u||"text";let a=await xz[xD.findKey(xz,u)||"text"](i,e);return!o&&g(),b&&b(),await new Promise(((t,r)=>{nz(t,r,{data:a,headers:QD.from(i.headers),status:i.status,statusText:i.statusText,config:e,request:p})}))}catch(t){if(g(),t&&"TypeError"===t.name&&/fetch/i.test(t.message))throw Object.assign(new _D("Network Error",_D.ERR_NETWORK,e,p),{cause:t.cause||t});throw _D.from(t,t&&t.code,e,p)}});const Pz={http:null,xhr:hz,fetch:Sz};xD.forEach(Pz,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const Iz=e=>`- ${e}`,Tz=e=>xD.isFunction(e)||null===e||!1===e;var Oz=e=>{e=xD.isArray(e)?e:[e];const{length:t}=e;let r,n;const i={};for(let o=0;o`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new _D("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Iz).join("\n"):" "+Iz(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function Mz(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new rz(null,e)}function Cz(e){Mz(e),e.headers=QD.from(e.headers),e.data=ez.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Oz(e.adapter||VD.adapter)(e).then((function(t){return Mz(e),t.data=ez.call(e,e.transformResponse,t),t.headers=QD.from(t.headers),t}),(function(t){return tz(t)||(Mz(e),t&&t.response&&(t.response.data=ez.call(e,e.transformResponse,t.response),t.response.headers=QD.from(t.response.headers))),Promise.reject(t)}))}const Bz="1.7.4",Nz={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Nz[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const Rz={};Nz.transitional=function(e,t,r){function n(e,t){return"[Axios v1.7.4] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,o)=>{if(!1===e)throw new _D(n(i," has been removed"+(t?" in "+t:"")),_D.ERR_DEPRECATED);return t&&!Rz[i]&&(Rz[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,o)}};var Fz={assertOptions:function(e,t,r){if("object"!=typeof e)throw new _D("options must be an object",_D.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const o=n[i],a=t[o];if(a){const t=e[o],r=void 0===t||a(t,o,e);if(!0!==r)throw new _D("option "+o+" must be "+r,_D.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new _D("Unknown option "+o,_D.ERR_BAD_OPTION)}},validators:Nz};const Lz=Fz.validators;let jz=class{constructor(e){this.defaults=e,this.interceptors={request:new LD,response:new LD}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t;Error.captureStackTrace?Error.captureStackTrace(t={}):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=fz(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;void 0!==r&&Fz.assertOptions(r,{silentJSONParsing:Lz.transitional(Lz.boolean),forcedJSONParsing:Lz.transitional(Lz.boolean),clarifyTimeoutError:Lz.transitional(Lz.boolean)},!1),null!=n&&(xD.isFunction(n)?t.paramsSerializer={serialize:n}:Fz.assertOptions(n,{encode:Lz.function,serialize:Lz.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&xD.merge(i.common,i[t.method]);i&&xD.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=QD.concat(o,i);const a=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,a.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,f=0;if(!s){const e=[Cz.bind(this),void 0];for(e.unshift.apply(e,a),e.push.apply(e,c),l=e.length,u=Promise.resolve(t);f{Uz[t]=e}));const Dz=function e(t){const r=new jz(t),n=LU(jz.prototype.request,r);return xD.extend(n,jz.prototype,r,{allOwnKeys:!0}),xD.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(fz(t,r))},n}(VD);Dz.Axios=jz,Dz.CanceledError=rz,Dz.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,i){r.reason||(r.reason=new rz(e,n,i),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let t;return{token:new e((function(e){t=e})),cancel:t}}},Dz.isCancel=tz,Dz.VERSION=Bz,Dz.toFormData=MD,Dz.AxiosError=_D,Dz.Cancel=Dz.CanceledError,Dz.all=function(e){return Promise.all(e)},Dz.spread=function(e){return function(t){return e.apply(null,t)}},Dz.isAxiosError=function(e){return xD.isObject(e)&&!0===e.isAxiosError},Dz.mergeConfig=fz,Dz.AxiosHeaders=QD,Dz.formToJSON=e=>KD(xD.isHTMLForm(e)?new FormData(e):e),Dz.getAdapter=Oz,Dz.HttpStatusCode=Uz,Dz.default=Dz;const{Axios:zz,AxiosError:$z,CanceledError:Hz,isCancel:Gz,CancelToken:qz,VERSION:Kz,all:Vz,Cancel:Wz,isAxiosError:Jz,spread:Zz,toFormData:Yz,AxiosHeaders:Xz,HttpStatusCode:Qz,formToJSON:e$,getAdapter:t$,mergeConfig:r$}=Dz,n$=async(e,t)=>{try{const{data:{chainId:r}}=await Dz.post(`${t??"https://backend-vikp.onrender.com"}/v1/projects/get-chain-id`,{projectId:e},{headers:{"Content-Type":"application/json"}});return r}catch(e){return void console.log(e)}},i$=VB({id:42069,name:"Gelato OPTestnet",network:"gelatoOPTestnet",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.op-testnet.gelato.digital"],webSocket:[]},public:{http:["https://rpc.op-testnet.gelato.digital"],webSocket:[]}},blockExplorers:{default:{name:"Explorer",url:"https://blockscout.op-testnet.gelato.digital"}}}),o$=VB({id:1261120,name:"Astar zKatana",network:"astarZKatana",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zkatana.gelato.digital"],webSocket:["https://ws.zkatana.gelato.digital"]},public:{http:["https://rpc.zkatana.gelato.digital"],webSocket:["https://ws.zkatana.gelato.digital"]}},blockExplorers:{default:{name:"Explorer",url:"https://zkatana.blockscout.com"}}}),a$=VB({id:3776,name:"Astar zkEVM",network:"AstarZkEVM",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.startale.com/astar-zkevm"]},public:{http:["https://rpc.startale.com/astar-zkevm"]}},blockExplorers:{default:{name:"Astar zkEVM Explorer",url:"https://astar-zkevm.explorer.startale.com"}},contracts:{multicall3:{address:"0x36eabf148272BA81A5225C6a3637972F0EE17771",blockCreated:93528}},testnet:!1}),s$=VB({id:42170,name:"Arbitrum Nova",network:"arbitrumNova",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://nova.arbitrum.io/rpc"]},public:{http:["https://nova.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://nova.arbiscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1746963}},testnet:!1}),c$=VB({id:88153591557,name:"Arbitrum Blueberry",network:"arbitrum-blueberry",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.arb-blueberry.gelato.digital"]},public:{http:["https://rpc.arb-blueberry.gelato.digital"]}},blockExplorers:{default:{name:"Gelatoscout",url:"https://arb-blueberry.gelatoscout.com"}},testnet:!0}),u$=VB({id:123420111,name:"OP Celestia Raspberry",network:"op-celestia-raspberry",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.opcelestia-raspberry.gelato.digital"]},public:{http:["https://rpc.opcelestia-raspberry.gelato.digital"]}},blockExplorers:{default:{name:"Gelatoscout",url:"https://opcelestia-raspberry.gelatoscout.com"}},testnet:!0}),l$=VB({id:94204209,name:"Polygon Blackberry",network:"polybon-blackberry",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.polygon-blackberry.gelato.digital"]},public:{http:["https://rpc.polygon-blackberry.gelato.digital"]}},blockExplorers:{default:{name:"Gelatoscout",url:"https://polygon-blackberry.gelatoscout.com"}},testnet:!0}),f$=VB({id:7560,name:"Cyber Mainnet",network:"cyber-mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cyber.alt.technology/"]},public:{http:["https://cyber.alt.technology/"]}},blockExplorers:{default:{name:"Cyber Mainnet Explorer",url:"https://cyber-explorer.alt.technology/"}},testnet:!1}),d$=VB({id:111557560,name:"Cyber Testnet",network:"cyber-testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cyber-testnet.alt.technology"]},public:{http:["https://cyber-testnet.alt.technology"]}},blockExplorers:{default:{name:"Cyber Testnet Explorer",url:"https://cyber-testnet-explorer.alt.technology/"}},testnet:!0}),h$=VB({id:6038361,name:"Astar zkEVM Testnet zKyoto",network:"zKyoto",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.startale.com/zkyoto"]},public:{http:["https://rpc.startale.com/zkyoto"]}},blockExplorers:{default:{name:"zKyoto Explorer",url:"https://zkyoto.explorer.startale.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:196153}},testnet:!0}),p$=VB({id:666666666,name:"Degen",nativeCurrency:{decimals:18,name:"Degen",symbol:"DEGEN"},network:"degen",rpcUrls:{default:{http:["https://rpc.degen.tips"],webSocket:["wss://rpc.degen.tips"]},public:{http:["https://rpc.degen.tips"],webSocket:["wss://rpc.degen.tips"]}},blockExplorers:{default:{name:"Degen Chain Explorer",url:"https://explorer.degen.tips"}}}),m$=VB({id:80002,name:"Polygon Amoy",network:"polygon-amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://rpc-amoy.polygon.technology"]},public:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:3127388}},testnet:!0});var b$=Object.freeze({__proto__:null,arbitrumBlueberry:c$,arbitrumNova:s$,astarZKatana:o$,astarZkEVM:a$,astarZkyoto:h$,cyberMainnet:f$,cyberTestnet:d$,degen:p$,gelatoOPTestnet:i$,opCelestiaRaspberry:u$,polygonAmoy:m$,polygonBlackberry:l$});let g$=!1,y$=!1;const v$={debug:1,default:2,info:2,warning:3,error:4,off:5};let w$=v$.default,E$=null;const A$=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var x$,_$;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(x$||(x$={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(_$||(_$={}));const k$="0123456789abcdef";class S${constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==v$[r]&&this.throwArgumentError("invalid log level name","logLevel",e),w$>v$[r]||console.log.apply(console,t)}debug(...e){this._log(S$.levels.DEBUG,e)}info(...e){this._log(S$.levels.INFO,e)}warn(...e){this._log(S$.levels.WARNING,e)}makeError(e,t,r){if(y$)return this.makeError("censored error",t,{});t||(t=S$.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((e=>{const t=r[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e>4],r+=k$[15&t[e]];n.push(e+"=Uint8Array(0x"+r+")")}else n.push(e+"="+JSON.stringify(t))}catch(t){n.push(e+"="+JSON.stringify(r[e].toString()))}})),n.push(`code=${t}`),n.push(`version=${this.version}`);const i=e;let o="";switch(t){case _$.NUMERIC_FAULT:{o="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":o+="-"+t;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case _$.CALL_EXCEPTION:case _$.INSUFFICIENT_FUNDS:case _$.MISSING_NEW:case _$.NONCE_EXPIRED:case _$.REPLACEMENT_UNDERPRICED:case _$.TRANSACTION_REPLACED:case _$.UNPREDICTABLE_GAS_LIMIT:o=t}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const a=new Error(e);return a.reason=i,a.code=t,Object.keys(r).forEach((function(e){a[e]=r[e]})),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,S$.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){A$&&this.throwError("platform missing String.prototype.normalize",S$.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:A$})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,S$.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,S$.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",et&&this.throwError("too many arguments"+r,S$.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",S$.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",S$.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",S$.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return E$||(E$=new S$("logger/5.7.0")),E$}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",S$.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),g$){if(!e)return;this.globalLogger().throwError("error censorship permanent",S$.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}y$=!!e,g$=!!t}static setLogLevel(e){const t=v$[e.toLowerCase()];null!=t?w$=t:S$.globalLogger().warn("invalid log level - "+e)}static from(e){return new S$(e)}}S$.errors=_$,S$.levels=x$;var P$=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const I$=new S$("properties/5.7.0");function T$(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function O$(e,t){for(let r=0;r<32;r++){if(e[t])return e[t];if(!e.prototype||"object"!=typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function M$(e){return P$(this,void 0,void 0,(function*(){const t=Object.keys(e).map((t=>{const r=e[t];return Promise.resolve(r).then((e=>({key:t,value:e})))}));return(yield Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}))}function C$(e,t){e&&"object"==typeof e||I$.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((r=>{t[r]||I$.throwArgumentError("invalid object key - "+r,"transaction:"+r,e)}))}function B$(e){const t={};for(const r in e)t[r]=e[r];return t}const N$={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function R$(e){if(null==e||N$[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let r=0;rL$(e))));if("object"==typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&T$(t,r,L$(n))}return t}return I$.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function L$(e){return F$(e)}class j${constructor(e){for(const t in e)this[t]=L$(e[t])}}var U$=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const D$=new S$("abstract-signer/5.7.0"),z$=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],$$=[S$.errors.INSUFFICIENT_FUNDS,S$.errors.NONCE_EXPIRED,S$.errors.REPLACEMENT_UNDERPRICED];class H${constructor(){D$.checkAbstract(new.target,H$),T$(this,"_isSigner",!0)}getBalance(e){return U$(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)}))}getTransactionCount(e){return U$(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)}))}estimateGas(e){return U$(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const t=yield M$(this.checkTransaction(e));return yield this.provider.estimateGas(t)}))}call(e,t){return U$(this,void 0,void 0,(function*(){this._checkProvider("call");const r=yield M$(this.checkTransaction(e));return yield this.provider.call(r,t)}))}sendTransaction(e){return U$(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),r=yield this.signTransaction(t);return yield this.provider.sendTransaction(r)}))}getChainId(){return U$(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return U$(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return U$(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(e){return U$(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)}))}checkTransaction(e){for(const t in e)-1===z$.indexOf(t)&&D$.throwArgumentError("invalid transaction key: "+t,"transaction",e);const t=B$(e);return null==t.from?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then((t=>(t[0].toLowerCase()!==t[1].toLowerCase()&&D$.throwArgumentError("from address mismatch","transaction",e),t[0]))),t}populateTransaction(e){return U$(this,void 0,void 0,(function*(){const t=yield M$(this.checkTransaction(e));null!=t.to&&(t.to=Promise.resolve(t.to).then((e=>U$(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.resolveName(e);return null==t&&D$.throwArgumentError("provided ENS name resolves to null","tx.to",e),t})))),t.to.catch((e=>{})));const r=null!=t.maxFeePerGas||null!=t.maxPriorityFeePerGas;if(null==t.gasPrice||2!==t.type&&!r?0!==t.type&&1!==t.type||!r||D$.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e):D$.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e),2!==t.type&&null!=t.type||null==t.maxFeePerGas||null==t.maxPriorityFeePerGas)if(0===t.type||1===t.type)null==t.gasPrice&&(t.gasPrice=this.getGasPrice());else{const e=yield this.getFeeData();if(null==t.type)if(null!=e.maxFeePerGas&&null!=e.maxPriorityFeePerGas)if(t.type=2,null!=t.gasPrice){const e=t.gasPrice;delete t.gasPrice,t.maxFeePerGas=e,t.maxPriorityFeePerGas=e}else null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas);else null!=e.gasPrice?(r&&D$.throwError("network does not support EIP-1559",S$.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):D$.throwError("failed to get consistent fee data",S$.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===t.type&&(null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas))}else t.type=2;return null==t.nonce&&(t.nonce=this.getTransactionCount("pending")),null==t.gasLimit&&(t.gasLimit=this.estimateGas(t).catch((e=>{if($$.indexOf(e.code)>=0)throw e;return D$.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",S$.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,tx:t})}))),null==t.chainId?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then((t=>(0!==t[1]&&t[0]!==t[1]&&D$.throwArgumentError("chainId address mismatch","transaction",e),t[0]))),yield M$(t)}))}_checkProvider(e){this.provider||D$.throwError("missing provider",S$.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!(!e||!e._isSigner)}}class G$ extends H${constructor(e,t){super(),T$(this,"address",e),T$(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then((()=>{D$.throwError(e,S$.errors.UNSUPPORTED_OPERATION,{operation:t})}))}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,t,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new G$(this.address,e)}}const q$=new S$("bytes/5.7.0");function K$(e){return!!e.toHexString}function V$(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return V$(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function W$(e){return tH(e)&&!(e.length%2)||Z$(e)}function J$(e){return"number"==typeof e&&e==e&&e%1==0}function Z$(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!J$(e.length)||e.length<0)return!1;for(let t=0;t=256)return!1}return!0}function Y$(e,t){if(t||(t={}),"number"==typeof e){q$.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),V$(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),K$(e)&&(e=e.toHexString()),tH(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":q$.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;eY$(e))),r=t.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(r);return t.reduce(((e,t)=>(n.set(t,e),e+t.length)),0),V$(n)}function Q$(e){let t=Y$(e);if(0===t.length)return t;let r=0;for(;rt&&q$.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),V$(r)}function tH(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const rH="0123456789abcdef";function nH(e,t){if(t||(t={}),"number"==typeof e){q$.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=rH[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),K$(e))return e.toHexString();if(tH(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":q$.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(Z$(e)){let t="0x";for(let r=0;r>4]+rH[15&n]}return t}return q$.throwArgumentError("invalid hexlify value","value",e)}function iH(e){if("string"!=typeof e)e=nH(e);else if(!tH(e)||e.length%2)return null;return(e.length-2)/2}function oH(e,t,r){return"string"!=typeof e?e=nH(e):(!tH(e)||e.length%2)&&q$.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function aH(e){let t="0x";return e.forEach((e=>{t+=nH(e).substring(2)})),t}function sH(e){const t=cH(nH(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function cH(e){"string"!=typeof e&&(e=nH(e)),tH(e)||q$.throwArgumentError("invalid hex string","value",e),e=e.substring(2);let t=0;for(;t2*t+2&&q$.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function lH(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(W$(e)){let r=Y$(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=nH(r.slice(0,32)),t.s=nH(r.slice(32,64))):65===r.length?(t.r=nH(r.slice(0,32)),t.s=nH(r.slice(32,64)),t.v=r[64]):q$.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:q$.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=nH(r.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const r=eH(Y$(t._vs),32);t._vs=nH(r);const n=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=n:t.recoveryParam!==n&&q$.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const i=nH(r);null==t.s?t.s=i:t.s!==i&&q$.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?q$.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const r=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==r&&q$.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&tH(t.r)?t.r=uH(t.r,32):q$.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&tH(t.s)?t.s=uH(t.s,32):q$.throwArgumentError("signature missing or invalid s","signature",e);const r=Y$(t.s);r[0]>=128&&q$.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=nH(r);t._vs&&(tH(t._vs)||q$.throwArgumentError("signature invalid _vs","signature",e),t._vs=uH(t._vs,32)),null==t._vs?t._vs=n:t._vs!==n&&q$.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function fH(e){return nH(X$([(e=lH(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}var dH={exports:{}};!function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:fe.Buffer}catch(e){}function a(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function s(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function c(e,t,n,i){for(var o=0,a=0,s=Math.min(e.length,n),c=t;c=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=s(e,t,n)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,l=r;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(e){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),n=0!==o||a!==this.length-1?f[6-c.length]+c+n:c+n}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=d[e],l=h[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(e);n=(p=p.idivn(l)).isZero()?m+n:f[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function p(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u>>26,f=67108863&c,d=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=d;h++){var p=u-h|0;l+=(a=(i=0|e.words[p])*(o=0|t.words[h])+f)/67108864|0,f=67108863&a}r.words[u]=0|f,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r._strip()}i.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r=0&&(e[r--]=a>>8&255),r>=0&&(e[r--]=a>>16&255),6===o?(r>=0&&(e[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,m=h>>>13,b=0|a[2],g=8191&b,y=b>>>13,v=0|a[3],w=8191&v,E=v>>>13,A=0|a[4],x=8191&A,_=A>>>13,k=0|a[5],S=8191&k,P=k>>>13,I=0|a[6],T=8191&I,O=I>>>13,M=0|a[7],C=8191&M,B=M>>>13,N=0|a[8],R=8191&N,F=N>>>13,L=0|a[9],j=8191&L,U=L>>>13,D=0|s[0],z=8191&D,$=D>>>13,H=0|s[1],G=8191&H,q=H>>>13,K=0|s[2],V=8191&K,W=K>>>13,J=0|s[3],Z=8191&J,Y=J>>>13,X=0|s[4],Q=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],fe=8191&le,de=le>>>13,he=0|s[9],pe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(u+(n=Math.imul(f,z))|0)+((8191&(i=(i=Math.imul(f,$))+Math.imul(d,z)|0))<<13)|0;u=((o=Math.imul(d,$))+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,$))+Math.imul(m,z)|0,o=Math.imul(m,$);var ge=(u+(n=n+Math.imul(f,G)|0)|0)+((8191&(i=(i=i+Math.imul(f,q)|0)+Math.imul(d,G)|0))<<13)|0;u=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,z),i=(i=Math.imul(g,$))+Math.imul(y,z)|0,o=Math.imul(y,$),n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,q)|0;var ye=(u+(n=n+Math.imul(f,V)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,W)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(w,z),i=(i=Math.imul(w,$))+Math.imul(E,z)|0,o=Math.imul(E,$),n=n+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var ve=(u+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(x,z),i=(i=Math.imul(x,$))+Math.imul(_,z)|0,o=Math.imul(_,$),n=n+Math.imul(w,G)|0,i=(i=i+Math.imul(w,q)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,q)|0,n=n+Math.imul(g,V)|0,i=(i=i+Math.imul(g,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,Y)|0;var we=(u+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,ee)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(S,z),i=(i=Math.imul(S,$))+Math.imul(P,z)|0,o=Math.imul(P,$),n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,q)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,Y)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0;var Ee=(u+(n=n+Math.imul(f,re)|0)|0)+((8191&(i=(i=i+Math.imul(f,ne)|0)+Math.imul(d,re)|0))<<13)|0;u=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(T,z),i=(i=Math.imul(T,$))+Math.imul(O,z)|0,o=Math.imul(O,$),n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,Y)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0;var Ae=(u+(n=n+Math.imul(f,oe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ae)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(C,z),i=(i=Math.imul(C,$))+Math.imul(B,z)|0,o=Math.imul(B,$),n=n+Math.imul(T,G)|0,i=(i=i+Math.imul(T,q)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,q)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,W)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,ee)|0,n=n+Math.imul(g,re)|0,i=(i=i+Math.imul(g,ne)|0)+Math.imul(y,re)|0,o=o+Math.imul(y,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var xe=(u+(n=n+Math.imul(f,ce)|0)|0)+((8191&(i=(i=i+Math.imul(f,ue)|0)+Math.imul(d,ce)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(R,z),i=(i=Math.imul(R,$))+Math.imul(F,z)|0,o=Math.imul(F,$),n=n+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,q)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,W)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,Y)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(E,re)|0,o=o+Math.imul(E,ne)|0,n=n+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,ue)|0;var _e=(u+(n=n+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,de)|0)+Math.imul(d,fe)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(j,z),i=(i=Math.imul(j,$))+Math.imul(U,z)|0,o=Math.imul(U,$),n=n+Math.imul(R,G)|0,i=(i=i+Math.imul(R,q)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,q)|0,n=n+Math.imul(C,V)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,W)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,Y)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,ae)|0,n=n+Math.imul(g,ce)|0,i=(i=i+Math.imul(g,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,n=n+Math.imul(p,fe)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(m,fe)|0,o=o+Math.imul(m,de)|0;var ke=(u+(n=n+Math.imul(f,pe)|0)|0)+((8191&(i=(i=i+Math.imul(f,me)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(j,G),i=(i=Math.imul(j,q))+Math.imul(U,G)|0,o=Math.imul(U,q),n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(F,V)|0,o=o+Math.imul(F,W)|0,n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,Y)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,ee)|0,n=n+Math.imul(S,re)|0,i=(i=i+Math.imul(S,ne)|0)+Math.imul(P,re)|0,o=o+Math.imul(P,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,n=n+Math.imul(g,fe)|0,i=(i=i+Math.imul(g,de)|0)+Math.imul(y,fe)|0,o=o+Math.imul(y,de)|0;var Se=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(j,V),i=(i=Math.imul(j,W))+Math.imul(U,V)|0,o=Math.imul(U,W),n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(F,Z)|0,o=o+Math.imul(F,Y)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ne)|0,n=n+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,ae)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,ae)|0,n=n+Math.imul(x,ce)|0,i=(i=i+Math.imul(x,ue)|0)+Math.imul(_,ce)|0,o=o+Math.imul(_,ue)|0,n=n+Math.imul(w,fe)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(E,fe)|0,o=o+Math.imul(E,de)|0;var Pe=(u+(n=n+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,me)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(j,Z),i=(i=Math.imul(j,Y))+Math.imul(U,Z)|0,o=Math.imul(U,Y),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ne)|0,n=n+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,n=n+Math.imul(S,ce)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(P,ce)|0,o=o+Math.imul(P,ue)|0,n=n+Math.imul(x,fe)|0,i=(i=i+Math.imul(x,de)|0)+Math.imul(_,fe)|0,o=o+Math.imul(_,de)|0;var Ie=(u+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(j,Q),i=(i=Math.imul(j,ee))+Math.imul(U,Q)|0,o=Math.imul(U,ee),n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(F,re)|0,o=o+Math.imul(F,ne)|0,n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,ae)|0,n=n+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(O,ce)|0,o=o+Math.imul(O,ue)|0,n=n+Math.imul(S,fe)|0,i=(i=i+Math.imul(S,de)|0)+Math.imul(P,fe)|0,o=o+Math.imul(P,de)|0;var Te=(u+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,me)|0)+Math.imul(_,pe)|0))<<13)|0;u=((o=o+Math.imul(_,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(j,re),i=(i=Math.imul(j,ne))+Math.imul(U,re)|0,o=Math.imul(U,ne),n=n+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,ae)|0)+Math.imul(F,oe)|0,o=o+Math.imul(F,ae)|0,n=n+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(B,ce)|0,o=o+Math.imul(B,ue)|0,n=n+Math.imul(T,fe)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(O,fe)|0,o=o+Math.imul(O,de)|0;var Oe=(u+(n=n+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,me)|0)+Math.imul(P,pe)|0))<<13)|0;u=((o=o+Math.imul(P,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(j,oe),i=(i=Math.imul(j,ae))+Math.imul(U,oe)|0,o=Math.imul(U,ae),n=n+Math.imul(R,ce)|0,i=(i=i+Math.imul(R,ue)|0)+Math.imul(F,ce)|0,o=o+Math.imul(F,ue)|0,n=n+Math.imul(C,fe)|0,i=(i=i+Math.imul(C,de)|0)+Math.imul(B,fe)|0,o=o+Math.imul(B,de)|0;var Me=(u+(n=n+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(j,ce),i=(i=Math.imul(j,ue))+Math.imul(U,ce)|0,o=Math.imul(U,ue),n=n+Math.imul(R,fe)|0,i=(i=i+Math.imul(R,de)|0)+Math.imul(F,fe)|0,o=o+Math.imul(F,de)|0;var Ce=(u+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,me)|0)+Math.imul(B,pe)|0))<<13)|0;u=((o=o+Math.imul(B,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(j,fe),i=(i=Math.imul(j,de))+Math.imul(U,fe)|0,o=Math.imul(U,de);var Be=(u+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,me)|0)+Math.imul(F,pe)|0))<<13)|0;u=((o=o+Math.imul(F,me)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863;var Ne=(u+(n=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(U,pe)|0))<<13)|0;return u=((o=Math.imul(U,me))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=be,c[1]=ge,c[2]=ye,c[3]=ve,c[4]=we,c[5]=Ee,c[6]=Ae,c[7]=xe,c[8]=_e,c[9]=ke,c[10]=Se,c[11]=Pe,c[12]=Ie,c[13]=Te,c[14]=Oe,c[15]=Me,c[16]=Ce,c[17]=Be,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function b(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function g(e,t,r){return b(e,t,r)}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?p(this,e,t):r<1024?b(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),r("number"==typeof e),r(e<67108864);for(var n=0,i=0;i>=26,n+=o/67108864|0,n+=a>>>26,this.words[i]=67108863&a}return 0!==n&&(this.words[i]=n,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i&1}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,u=0;u=0&&(0!==l||u>=i);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===s)return this._strip();for(r(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),o=e,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,c=n.length-o.length;if("mod"!==t){(s=new i(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u=0;f--){var d=67108864*(0|n.words[o.length+f])+(0|n.words[o.length+f-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(o,d,f);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(o,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=d)}return s&&s._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var o,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),c=new i(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),f=t.clone();!t.isZero();){for(var d=0,h=1;!(t.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(f)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;!(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(f)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(s),a.isub(c)):(n.isub(t),s.isub(o),c.isub(a))}return{a:s,b:c,gcd:n.iushln(u)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var f=0,d=1;!(n.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(n.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s)):(n.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return!(1&this.words[0])},i.prototype.isOdd=function(){return!(1&~this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new _(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function x(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function k(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},n(w,v),w.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new E;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new x}return y[e]=t,t},_.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},_.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new i(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var f=this.pow(l,o),d=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b=0;n--){for(var u=t.words[n],l=c-1;l>=0;l--){var f=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===n&&0===l)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}c=26}return o},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new k(e)},n(k,_),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,o)}(dH);var hH=a(dH.exports);const pH="bignumber/5.7.0";var mH=hH.BN;const bH=new S$(pH),gH={},yH=9007199254740991;let vH=!1;class wH{constructor(e,t){e!==gH&&bH.throwError("cannot call constructor directly; use BigNumber.from",S$.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return AH(xH(this).fromTwos(e))}toTwos(e){return AH(xH(this).toTwos(e))}abs(){return"-"===this._hex[0]?wH.from(this._hex.substring(1)):this}add(e){return AH(xH(this).add(xH(e)))}sub(e){return AH(xH(this).sub(xH(e)))}div(e){return wH.from(e).isZero()&&_H("division-by-zero","div"),AH(xH(this).div(xH(e)))}mul(e){return AH(xH(this).mul(xH(e)))}mod(e){const t=xH(e);return t.isNeg()&&_H("division-by-zero","mod"),AH(xH(this).umod(t))}pow(e){const t=xH(e);return t.isNeg()&&_H("negative-power","pow"),AH(xH(this).pow(t))}and(e){const t=xH(e);return(this.isNegative()||t.isNeg())&&_H("unbound-bitwise-result","and"),AH(xH(this).and(t))}or(e){const t=xH(e);return(this.isNegative()||t.isNeg())&&_H("unbound-bitwise-result","or"),AH(xH(this).or(t))}xor(e){const t=xH(e);return(this.isNegative()||t.isNeg())&&_H("unbound-bitwise-result","xor"),AH(xH(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&_H("negative-width","mask"),AH(xH(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&_H("negative-width","shl"),AH(xH(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&_H("negative-width","shr"),AH(xH(this).shrn(e))}eq(e){return xH(this).eq(xH(e))}lt(e){return xH(this).lt(xH(e))}lte(e){return xH(this).lte(xH(e))}gt(e){return xH(this).gt(xH(e))}gte(e){return xH(this).gte(xH(e))}isNegative(){return"-"===this._hex[0]}isZero(){return xH(this).isZero()}toNumber(){try{return xH(this).toNumber()}catch(e){_H("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return bH.throwError("this platform does not support BigInt",S$.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?vH||(vH=!0,bH.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?bH.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",S$.errors.UNEXPECTED_ARGUMENT,{}):bH.throwError("BigNumber.toString does not accept parameters",S$.errors.UNEXPECTED_ARGUMENT,{})),xH(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof wH)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new wH(gH,EH(e)):e.match(/^-?[0-9]+$/)?new wH(gH,EH(new mH(e))):bH.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&_H("underflow","BigNumber.from",e),(e>=yH||e<=-yH)&&_H("overflow","BigNumber.from",e),wH.from(String(e));const t=e;if("bigint"==typeof t)return wH.from(t.toString());if(Z$(t))return wH.from(nH(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return wH.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(tH(e)||"-"===e[0]&&tH(e.substring(1))))return wH.from(e)}return bH.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function EH(e){if("string"!=typeof e)return EH(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&bH.throwArgumentError("invalid hex","value",e),"0x00"===(e=EH(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function AH(e){return wH.from(EH(e))}function xH(e){const t=wH.from(e).toHexString();return"-"===t[0]?new mH("-"+t.substring(3),16):new mH(t.substring(2),16)}function _H(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),bH.throwError(e,S$.errors.NUMERIC_FAULT,n)}const kH=new S$(pH),SH={},PH=wH.from(0),IH=wH.from(-1);function TH(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),kH.throwError(e,S$.errors.NUMERIC_FAULT,i)}let OH="0";for(;OH.length<256;)OH+=OH;function MH(e){if("number"!=typeof e)try{e=wH.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+OH.substring(0,e):kH.throwArgumentError("invalid decimal size","decimals",e)}function CH(e,t){null==t&&(t=0);const r=MH(t),n=(e=wH.from(e)).lt(PH);n&&(e=e.mul(IH));let i=e.mod(r).toString();for(;i.length2&&kH.throwArgumentError("too many decimal points","value",e);let o=i[0],a=i[1];for(o||(o="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>r.length-1&&TH("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.lengthnull==e[t]?n:(typeof e[t]!==r&&kH.throwArgumentError("invalid fixed format ("+t+" not "+r+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&kH.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&kH.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new NH(SH,t,r,n)}}class RH{constructor(e,t,r,n){e!==SH&&kH.throwError("cannot use FixedNumber constructor; use FixedNumber.from",S$.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&kH.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=BH(this._value,this.format.decimals),r=BH(e._value,e.format.decimals);return RH.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=BH(this._value,this.format.decimals),r=BH(e._value,e.format.decimals);return RH.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=BH(this._value,this.format.decimals),r=BH(e._value,e.format.decimals);return RH.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=BH(this._value,this.format.decimals),r=BH(e._value,e.format.decimals);return RH.fromValue(t.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=RH.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(FH.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=RH.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(FH.toFormat(t.format))),t}round(e){null==e&&(e=0);const t=this.toString().split(".");if(1===t.length&&t.push("0"),(e<0||e>80||e%1)&&kH.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=RH.from("1"+OH.substring(0,e),this.format),n=LH.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(e){if(null==e)return this._hex;e%8&&kH.throwArgumentError("invalid byte width","width",e);return uH(wH.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return RH.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||function(e){return null!=e&&(wH.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||tH(e)||"bigint"==typeof e||Z$(e))}(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),RH.fromString(CH(e,t),NH.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=NH.from(t),n=BH(e,r.decimals);!r.signed&&n.lt(PH)&&TH("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=uH(i,r.width/8));const o=CH(n,r.decimals);return new RH(SH,i,o,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=NH.from(t);if(Y$(e).length>r.width/8)throw new Error("overflow");let n=wH.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),o=CH(n,r.decimals);return new RH(SH,i,o,r)}static from(e,t){if("string"==typeof e)return RH.fromString(e,t);if(Z$(e))return RH.fromBytes(e,t);try{return RH.fromValue(e,0,t)}catch(e){if(e.code!==S$.errors.INVALID_ARGUMENT)throw e}return kH.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const FH=RH.from(1),LH=RH.from("0.5");var jH={exports:{}};!function(e){!function(){var t="input is invalid type",r="object"==typeof window,n=r?window:{};n.JS_SHA3_NO_WINDOW&&(r=!1);var i=!r&&"object"==typeof self;!n.JS_SHA3_NO_NODE_JS&&"object"==typeof pr&&pr.versions&&pr.versions.node?n=o:i&&(n=self);var a=!n.JS_SHA3_NO_COMMON_JS&&e.exports,s=!n.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,c="0123456789abcdef".split(""),u=[4,1024,262144,67108864],l=[0,8,16,24],f=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],d=[224,256,384,512],h=[128,256],p=["hex","buffer","arrayBuffer","array","digest"],m={128:168,256:136};!n.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!s||!n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var b=function(e,t,r){return function(n){return new M(e,t,e).update(n)[r]()}},g=function(e,t,r){return function(n,i){return new M(e,t,i).update(n)[r]()}},y=function(e,t,r){return function(t,n,i,o){return x["cshake"+e].update(t,n,i,o)[r]()}},v=function(e,t,r){return function(t,n,i,o){return x["kmac"+e].update(t,n,i,o)[r]()}},w=function(e,t,r,n){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function C(e,t,r){M.call(this,e,t,r)}M.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var r,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(t);if(null===e)throw new Error(t);if(s&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||s&&ArrayBuffer.isView(e)))throw new Error(t);r=!0}for(var i,o,a=this.blocks,c=this.byteCount,u=e.length,f=this.blockCount,d=0,h=this.s;d>2]|=e[d]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(a[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=c){for(this.start=i-c,this.block=a[f],i=0;i>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},M.prototype.encodeString=function(e){var r,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(t);if(null===e)throw new Error(t);if(s&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||s&&ArrayBuffer.isView(e)))throw new Error(t);r=!0}var i=0,o=e.length;if(r)i=o;else for(var a=0;a=57344?i+=3:(c=65536+((1023&c)<<10|1023&e.charCodeAt(++a)),i+=4)}return i+=this.encode(8*i),this.update(e),i},M.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+c[15&e]+c[e>>12&15]+c[e>>8&15]+c[e>>20&15]+c[e>>16&15]+c[e>>28&15]+c[e>>24&15];a%t==0&&(B(r),o=0)}return i&&(e=r[o],s+=c[e>>4&15]+c[15&e],i>1&&(s+=c[e>>12&15]+c[e>>8&15]),i>2&&(s+=c[e>>20&15]+c[e>>16&15])),s},M.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var c=new Uint32Array(e);a>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;s%r==0&&B(n)}return o&&(e=s<<2,t=n[a],c[e]=255&t,o>1&&(c[e+1]=t>>8&255),o>2&&(c[e+2]=t>>16&255)),c},C.prototype=new M,C.prototype.finalize=function(){return this.encode(this.outputBits,!0),M.prototype.finalize.call(this)};var B=function(e){var t,r,n,i,o,a,s,c,u,l,d,h,p,m,b,g,y,v,w,E,A,x,_,k,S,P,I,T,O,M,C,B,N,R,F,L,j,U,D,z,$,H,G,q,K,V,W,J,Z,Y,X,Q,ee,te,re,ne,ie,oe,ae,se,ce,ue,le;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],d=e[7]^e[17]^e[27]^e[37]^e[47],t=(h=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),r=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(c<<1|u>>>31),r=o^(u<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=a^(l<<1|d>>>31),r=s^(d<<1|l>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(h<<1|p>>>31),r=u^(p<<1|h>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=l^(i<<1|o>>>31),r=d^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,m=e[0],b=e[1],V=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,T=e[20]<<3|e[21]>>>29,O=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,R=e[2]<<1|e[3]>>>31,F=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,y=e[12]<<12|e[13]>>>20,J=e[22]<<10|e[23]>>>22,Z=e[23]<<10|e[22]>>>22,M=e[33]<<13|e[32]>>>19,C=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,L=e[14]<<6|e[15]>>>26,j=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,Y=e[34]<<15|e[35]>>>17,X=e[35]<<15|e[34]>>>17,B=e[45]<<29|e[44]>>>3,N=e[44]<<29|e[45]>>>3,k=e[6]<<28|e[7]>>>4,S=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,D=e[27]<<25|e[26]>>>7,E=e[36]<<21|e[37]>>>11,A=e[37]<<21|e[36]>>>11,Q=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,q=e[8]<<27|e[9]>>>5,K=e[9]<<27|e[8]>>>5,P=e[18]<<20|e[19]>>>12,I=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ae=e[28]<<7|e[29]>>>25,z=e[38]<<8|e[39]>>>24,$=e[39]<<8|e[38]>>>24,x=e[48]<<14|e[49]>>>18,_=e[49]<<14|e[48]>>>18,e[0]=m^~g&v,e[1]=b^~y&w,e[10]=k^~P&T,e[11]=S^~I&O,e[20]=R^~L&U,e[21]=F^~j&D,e[30]=q^~V&J,e[31]=K^~W&Z,e[40]=te^~ne&oe,e[41]=re^~ie&ae,e[2]=g^~v&E,e[3]=y^~w&A,e[12]=P^~T&M,e[13]=I^~O&C,e[22]=L^~U&z,e[23]=j^~D&$,e[32]=V^~J&Y,e[33]=W^~Z&X,e[42]=ne^~oe&se,e[43]=ie^~ae&ce,e[4]=v^~E&x,e[5]=w^~A&_,e[14]=T^~M&B,e[15]=O^~C&N,e[24]=U^~z&H,e[25]=D^~$&G,e[34]=J^~Y&Q,e[35]=Z^~X&ee,e[44]=oe^~se&ue,e[45]=ae^~ce&le,e[6]=E^~x&m,e[7]=A^~_&b,e[16]=M^~B&k,e[17]=C^~N&S,e[26]=z^~H&R,e[27]=$^~G&F,e[36]=Y^~Q&q,e[37]=X^~ee&K,e[46]=se^~ue&te,e[47]=ce^~le&re,e[8]=x^~m&g,e[9]=_^~b&y,e[18]=B^~k&P,e[19]=N^~S&I,e[28]=H^~R&L,e[29]=G^~F&j,e[38]=Q^~q&V,e[39]=ee^~K&W,e[48]=ue^~te&ne,e[49]=le^~re&ie,e[0]^=f[n],e[1]^=f[n+1]};if(a)e.exports=x;else for(k=0;k<_.length;++k)n[_[k]]=x[_[k]]}()}(jH);var UH=a(jH.exports);function DH(e){return"0x"+UH.keccak_256(Y$(e))}const zH=new S$("rlp/5.7.0");function $H(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function HH(e,t,r){let n=0;for(let i=0;it+1+n&&zH.throwError("child data too short",S$.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function VH(e,t){if(0===e.length&&zH.throwError("data too short",S$.errors.BUFFER_OVERRUN,{}),e[t]>=248){const r=e[t]-247;t+1+r>e.length&&zH.throwError("data short segment too short",S$.errors.BUFFER_OVERRUN,{});const n=HH(e,t+1,r);return t+1+r+n>e.length&&zH.throwError("data long segment too short",S$.errors.BUFFER_OVERRUN,{}),KH(e,t,t+1+r,r+n)}if(e[t]>=192){const r=e[t]-192;return t+1+r>e.length&&zH.throwError("data array too short",S$.errors.BUFFER_OVERRUN,{}),KH(e,t,t+1,r)}if(e[t]>=184){const r=e[t]-183;t+1+r>e.length&&zH.throwError("data array too short",S$.errors.BUFFER_OVERRUN,{});const n=HH(e,t+1,r);t+1+r+n>e.length&&zH.throwError("data array too short",S$.errors.BUFFER_OVERRUN,{});return{consumed:1+r+n,result:nH(e.slice(t+1+r,t+1+r+n))}}if(e[t]>=128){const r=e[t]-128;t+1+r>e.length&&zH.throwError("data too short",S$.errors.BUFFER_OVERRUN,{});return{consumed:1+r,result:nH(e.slice(t+1,t+1+r))}}return{consumed:1,result:nH(e[t])}}function WH(e){const t=Y$(e),r=VH(t,0);return r.consumed!==t.length&&zH.throwArgumentError("invalid rlp data","data",e),r.result}var JH=Object.freeze({__proto__:null,decode:WH,encode:qH});const ZH=new S$("address/5.7.0");function YH(e){tH(e,20)||ZH.throwArgumentError("invalid address","address",e);const t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let e=0;e<40;e++)r[e]=t[e].charCodeAt(0);const n=Y$(DH(r));for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(15&n[e>>1])>=8&&(t[e+1]=t[e+1].toUpperCase());return"0x"+t.join("")}const XH={};for(let e=0;e<10;e++)XH[String(e)]=String(e);for(let e=0;e<26;e++)XH[String.fromCharCode(65+e)]=String(10+e);const QH=Math.floor(function(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}(9007199254740991));function eG(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((e=>XH[e])).join("");for(;t.length>=QH;){let e=t.substring(0,QH);t=parseInt(e,10)%97+t.substring(e.length)}let r=String(98-parseInt(t,10)%97);for(;r.length<2;)r="0"+r;return r}function tG(e){let t=null;if("string"!=typeof e&&ZH.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=YH(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&ZH.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==eG(e)&&ZH.throwArgumentError("bad icap checksum","address",e),t=function(e){return new mH(e,36).toString(16)}(e.substring(4));t.length<40;)t="0"+t;t=YH("0x"+t)}else ZH.throwArgumentError("invalid address","address",e);return t}function rG(e){let t=null;try{t=tG(e.from)}catch(t){ZH.throwArgumentError("missing from address","transaction",e)}return tG(oH(DH(qH([t,Q$(Y$(wH.from(e.nonce).toHexString()))])),12))}var nG=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const iG=new S$("abstract-provider/5.7.0");class oG extends j${static isForkEvent(e){return!(!e||!e._isForkEvent)}}class aG{constructor(){iG.checkAbstract(new.target,aG),T$(this,"_isProvider",!0)}getFeeData(){return nG(this,void 0,void 0,(function*(){const{block:e,gasPrice:t}=yield M$({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((e=>null))});let r=null,n=null,i=null;return e&&e.baseFeePerGas&&(r=e.baseFeePerGas,i=wH.from("1500000000"),n=e.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:r,maxFeePerGas:n,maxPriorityFeePerGas:i,gasPrice:t}}))}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!(!e||!e._isProvider)}}const sG="0x0000000000000000000000000000000000000000",cG=wH.from(-1),uG=wH.from(0),lG=wH.from(1),fG=wH.from(2),dG=wH.from("1000000000000000000"),hG=wH.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),pG=wH.from("-0x8000000000000000000000000000000000000000000000000000000000000000"),mG=wH.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),bG="0x0000000000000000000000000000000000000000000000000000000000000000";var gG=Object.freeze({__proto__:null,AddressZero:sG,EtherSymbol:"Ξ",HashZero:bG,MaxInt256:mG,MaxUint256:hG,MinInt256:pG,NegativeOne:cG,One:lG,Two:fG,WeiPerEther:dG,Zero:uG});const yG=new S$("strings/5.7.0");var vG,wG;function EG(e,t,r,n,i){if(e===wG.BAD_PREFIX||e===wG.UNEXPECTED_CONTINUE){let e=0;for(let n=t+1;n>6==2;n++)e++;return e}return e===wG.OVERRUN?r.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(vG||(vG={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(wG||(wG={}));const AG=Object.freeze({error:function(e,t,r,n,i){return yG.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",r)},ignore:EG,replace:function(e,t,r,n,i){return e===wG.OVERLONG?(n.push(i),0):(n.push(65533),EG(e,t,r))}});function xG(e,t){null==t&&(t=AG.error),e=Y$(e);const r=[];let n=0;for(;n>7)){r.push(i);continue}let o=null,a=null;if(192==(224&i))o=1,a=127;else if(224==(240&i))o=2,a=2047;else{if(240!=(248&i)){n+=t(128==(192&i)?wG.UNEXPECTED_CONTINUE:wG.BAD_PREFIX,n-1,e,r);continue}o=3,a=65535}if(n-1+o>=e.length){n+=t(wG.OVERRUN,n-1,e,r);continue}let s=i&(1<<8-o-1)-1;for(let i=0;i1114111?n+=t(wG.OUT_OF_RANGE,n-1-o,e,r,s):s>=55296&&s<=57343?n+=t(wG.UTF16_SURROGATE,n-1-o,e,r,s):s<=a?n+=t(wG.OVERLONG,n-1-o,e,r,s):r.push(s))}return r}function _G(e,t=vG.current){t!=vG.current&&(yG.checkNormalize(),e=e.normalize(t));let r=[];for(let t=0;t>6|192),r.push(63&n|128);else if(55296==(64512&n)){t++;const i=e.charCodeAt(t);if(t>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return Y$(r)}function kG(e){const t="0000"+e.toString(16);return"\\u"+t.substring(t.length-4)}function SG(e){return e.map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("")}function PG(e,t){return SG(xG(e,t))}function IG(e,t=vG.current){return xG(_G(e,t))}function TG(e,t){t||(t=function(e){return[parseInt(e,16)]});let r=0,n={};return e.split(",").forEach((e=>{let i=e.split(":");r+=parseInt(i[0],16),n[r]=t(i[1])})),n}function OG(e){let t=0;return e.split(",").map((e=>{let r=e.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=t+parseInt(r[0],16);return t=parseInt(r[1],16),{l:n,h:t}}))}function MG(e,t){let r=0;for(let n=0;n=r&&e<=r+i.h&&(e-r)%(i.d||1)==0){if(i.e&&-1!==i.e.indexOf(e-r))continue;return i}}return null}const CG=OG("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),BG="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((e=>parseInt(e,16))),NG=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],RG=TG("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),FG=TG("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),LG=TG("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(e){if(e.length%4!=0)throw new Error("bad data");let t=[];for(let r=0;r0&&Array.isArray(e)?i(e,t-1):r.push(e)}))};return i(e,t),r}function qG(e){return function(e){let t=0;return()=>e[t++]}(function(e){let t=0;function r(){return e[t++]<<8|e[t++]}let n=r(),i=1,o=[0,1];for(let e=1;e>--c&1}const f=Math.pow(2,31),d=f>>>1,h=d>>1,p=f-1;let m=0;for(let e=0;e<31;e++)m=m<<1|l();let b=[],g=0,y=f;for(;;){let e=Math.floor(((m-g+1)*i-1)/y),t=0,r=n;for(;r-t>1;){let n=t+r>>>1;e>>1|l(),a=a<<1^d,s=(s^d)<<1|d|1;g=a,y=1+s-a}let v=n-4;return b.map((t=>{switch(t-v){case 3:return v+65792+(e[s++]<<16|e[s++]<<8|e[s++]);case 2:return v+256+(e[s++]<<8|e[s++]);case 1:return v+e[s++];default:return t-1}}))}(e))}function KG(e){return 1&e?~e>>1:e>>1}function VG(e,t){let r=Array(e);for(let n=0,i=-1;nt[e])):r}function ZG(e,t,r){let n=Array(e).fill(void 0).map((()=>[]));for(let i=0;in[t].push(e)));return n}function YG(e,t){let r=1+t(),n=t(),i=function(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(r)}return t}(t);return GG(ZG(i.length,1+e,t).map(((e,t)=>{const o=e[0],a=e.slice(1);return Array(i[t]).fill(void 0).map(((e,t)=>{let i=t*n;return[o+t*r,a.map((e=>e+i))]}))})))}function XG(e,t){return ZG(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}const QG=qG(zG("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")),eq=new Set(JG(QG)),tq=new Set(JG(QG)),rq=function(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(YG(r,e))}for(;;){let r=e()-1;if(r<0)break;t.push(XG(r,e))}return function(e){const t={};for(let r=0;re-t));return function r(){let n=[];for(;;){let i=JG(e,t);if(0==i.length)break;n.push({set:new Set(i),node:r()})}n.sort(((e,t)=>t.set.size-e.set.size));let i=e(),o=i%3;i=i/3|0;let a=!!(1&i);return i>>=1,{branches:n,valid:o,fe0f:a,save:1==i,check:2==i}}()}(QG),iq=45,oq=95;function aq(e){return IG(e)}function sq(e){return e.filter((e=>65039!=e))}function cq(e){for(let t of e.split(".")){let e=aq(t);try{for(let t=e.lastIndexOf(oq)-1;t>=0;t--)if(e[t]!==oq)throw new Error("underscore only allowed at start");if(e.length>=4&&e.every((e=>e<128))&&e[2]===iq&&e[3]===iq)throw new Error("invalid label extension")}catch(e){throw new Error(`Invalid label "${t}": ${e.message}`)}}return e}function uq(e){return cq(function(e,t){let r=aq(e).reverse(),n=[];for(;r.length;){let e=lq(r);if(e){n.push(...t(e));continue}let i=r.pop();if(eq.has(i)){n.push(i);continue}if(tq.has(i))continue;let o=rq[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);n.push(...o)}return cq(function(e){return e.normalize("NFC")}(String.fromCodePoint(...n)))}(e,sq))}function lq(e,t){var r;let n,i,o=nq,a=[],s=e.length;for(;s;){let t=e[--s];if(o=null===(r=o.branches.find((e=>e.set.has(t))))||void 0===r?void 0:r.node,!o)break;if(o.save)i=t;else if(o.check&&t===i)break;a.push(t),o.fe0f&&(a.push(65039),s>0&&65039==e[s-1]&&s--),o.valid&&(n=a.slice(),2==o.valid&&n.splice(1,1),e.length=s)}return n}const fq=new S$(DG),dq=new Uint8Array(32);function hq(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function pq(e){const t=_G(uq(e)),r=[];if(0===e.length)return r;let n=0;for(let e=0;e=t.length)throw new Error("invalid ENS name; empty component");return r.push(hq(t.slice(n))),r}function mq(e){"string"!=typeof e&&fq.throwArgumentError("invalid ENS name; not a string","name",e);let t=dq;const r=pq(e);for(;r.length;)t=DH(X$([t,DH(r.pop())]));return nH(t)}function bq(e){return nH(X$(pq(e).map((e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t}))))+"00"}dq.fill(0);const gq="Ethereum Signed Message:\n";function yq(e){return"string"==typeof e&&(e=_G(e)),DH(X$([_G(gq),_G(String(e.length)),e]))}var vq=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const wq=new S$(DG),Eq=new Uint8Array(32);Eq.fill(0);const Aq=wH.from(-1),xq=wH.from(0),_q=wH.from(1),kq=wH.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Sq=uH(_q.toHexString(),32),Pq=uH(xq.toHexString(),32),Iq={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Tq=["name","version","chainId","verifyingContract","salt"];function Oq(e){return function(t){return"string"!=typeof t&&wq.throwArgumentError(`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const Mq={name:Oq("name"),version:Oq("version"),chainId:function(e){try{return wH.from(e).toString()}catch(e){}return wq.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return tG(e).toLowerCase()}catch(e){}return wq.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{const t=Y$(e);if(32!==t.length)throw new Error("bad length");return nH(t)}catch(e){}return wq.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function Cq(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const r=""===t[1],n=parseInt(t[2]||"256");(n%8!=0||n>256||t[2]&&t[2]!==String(n))&&wq.throwArgumentError("invalid numeric width","type",e);const i=kq.mask(r?n-1:n),o=r?i.add(_q).mul(Aq):xq;return function(t){const r=wH.from(t);return(r.lt(o)||r.gt(i))&&wq.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),uH(r.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return(0===r||r>32||t[1]!==String(r))&&wq.throwArgumentError("invalid bytes width","type",e),function(t){return Y$(t).length!==r&&wq.throwArgumentError(`invalid length for ${e}`,"value",t),function(e){const t=Y$(e),r=t.length%32;return r?aH([t,Eq.slice(r)]):nH(t)}(t)}}}switch(e){case"address":return function(e){return uH(tG(e),32)};case"bool":return function(e){return e?Sq:Pq};case"bytes":return function(e){return DH(e)};case"string":return function(e){return UG(e)}}return null}function Bq(e,t){return`${e}(${t.map((({name:e,type:t})=>t+" "+e)).join(",")})`}class Nq{constructor(e){T$(this,"types",Object.freeze(L$(e))),T$(this,"_encoderCache",{}),T$(this,"_types",{});const t={},r={},n={};Object.keys(e).forEach((e=>{t[e]={},r[e]=[],n[e]={}}));for(const n in e){const i={};e[n].forEach((o=>{i[o.name]&&wq.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(n)}`,"types",e),i[o.name]=!0;const a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===n&&wq.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e);Cq(a)||(r[a]||wq.throwArgumentError(`unknown type ${JSON.stringify(a)}`,"types",e),r[a].push(n),t[n][a]=!0)}))}const i=Object.keys(r).filter((e=>0===r[e].length));0===i.length?wq.throwArgumentError("missing primary type","types",e):i.length>1&&wq.throwArgumentError(`ambiguous primary types or unused types: ${i.map((e=>JSON.stringify(e))).join(", ")}`,"types",e),T$(this,"primaryType",i[0]),function i(o,a){a[o]&&wq.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",e),a[o]=!0,Object.keys(t[o]).forEach((e=>{r[e]&&(i(e,a),Object.keys(a).forEach((t=>{n[t][e]=!0})))})),delete a[o]}(this.primaryType,{});for(const t in n){const r=Object.keys(n[t]);r.sort(),this._types[t]=Bq(t,e[t])+r.map((t=>Bq(t,e[t]))).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const t=Cq(e);if(t)return t}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const e=t[1],r=this.getEncoder(e),n=parseInt(t[3]);return t=>{n>=0&&t.length!==n&&wq.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t);let i=t.map(r);return this._types[e]&&(i=i.map(DH)),DH(aH(i))}}const r=this.types[e];if(r){const t=UG(this._types[e]);return e=>{const n=r.map((({name:t,type:r})=>{const n=this.getEncoder(r)(e[t]);return this._types[r]?DH(n):n}));return n.unshift(t),aH(n)}}return wq.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||wq.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return DH(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(Cq(e))return r(e,t);const n=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const e=n[1],i=parseInt(n[3]);return i>=0&&t.length!==i&&wq.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map((t=>this._visit(e,t,r)))}const i=this.types[e];return i?i.reduce(((e,{name:n,type:i})=>(e[n]=this._visit(i,t[n],r),e)),{}):wq.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new Nq(e)}static getPrimaryType(e){return Nq.from(e).primaryType}static hashStruct(e,t,r){return Nq.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const n=Iq[r];n||wq.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:n})}return t.sort(((e,t)=>Tq.indexOf(e.name)-Tq.indexOf(t.name))),Nq.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return aH(["0x1901",Nq.hashDomain(e),Nq.from(t).hash(r)])}static hash(e,t,r){return DH(Nq.encode(e,t,r))}static resolveNames(e,t,r,n){return vq(this,void 0,void 0,(function*(){e=B$(e);const i={};e.verifyingContract&&!tH(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const o=Nq.from(t);o.visit(r,((e,t)=>("address"!==e||tH(t,20)||(i[t]="0x"),t)));for(const e in i)i[e]=yield n(e);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),r=o.visit(r,((e,t)=>"address"===e&&i[t]?i[t]:t)),{domain:e,value:r}}))}static getPayload(e,t,r){Nq.hashDomain(e);const n={},i=[];Tq.forEach((t=>{const r=e[t];null!=r&&(n[t]=Mq[t](r),i.push({name:t,type:Iq[t]}))}));const o=Nq.from(t),a=B$(t);return a.EIP712Domain?wq.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):a.EIP712Domain=i,o.encode(r),{types:a,domain:n,primaryType:o.primaryType,message:o.visit(r,((e,t)=>{if(e.match(/^bytes(\d*)/))return nH(Y$(t));if(e.match(/^u?int/))return wH.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!=typeof t&&wq.throwArgumentError("invalid string","value",t),t}return wq.throwArgumentError("unsupported type","type",e)}))}}}class Rq{constructor(e){T$(this,"alphabet",e),T$(this,"base",e.length),T$(this,"_alphabetMap",{}),T$(this,"_leader",e.charAt(0));for(let t=0;t0;)r.push(n%this.base),n=n/this.base|0}let n="";for(let e=0;0===t[e]&&e=0;--e)n+=this.alphabet[r[e]];return n}decode(e){if("string"!=typeof e)throw new TypeError("Expected String");let t=[];if(0===e.length)return new Uint8Array(t);t.push(0);for(let r=0;r>=8;for(;i>0;)t.push(255&i),i>>=8}for(let r=0;e[r]===this._leader&&r>24&255,c[t.length+1]=f>>16&255,c[t.length+2]=f>>8&255,c[t.length+3]=255&f;let d=Y$(zq(i,e,c));o||(o=d.length,l=new Uint8Array(o),a=Math.ceil(n/o),u=n-(a-1)*o),l.set(d);for(let t=1;t>8,a=255&i;o?r.push(o,a):r.push(a)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}})),Vq=Hq((function(e,t){var r=t;r.assert=Gq,r.toArray=Kq.toArray,r.zero2=Kq.zero2,r.toHex=Kq.toHex,r.encode=Kq.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-c:c,o.isubn(s)):s=0,n[a]=s,o.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),a=1&c?3!==(n=e.andln(7)+i&7)&&5!==n||2!==u?c:-c:0,r[0].push(a),s=1&u?3!==(n=t.andln(7)+o&7)&&5!==n||2!==c?u:-u:0,r[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new hH(e,"hex","le")}})),Wq=Vq.getNAF,Jq=Vq.getJSF,Zq=Vq.assert;function Yq(e,t){this.type=e,this.p=new hH(t.p,16),this.red=t.prime?hH.red(t.prime):hH.mont(this.p),this.zero=new hH(0).toRed(this.red),this.one=new hH(1).toRed(this.red),this.two=new hH(2).toRed(this.red),this.n=t.n&&new hH(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Xq=Yq;function Qq(e,t){this.curve=e,this.type=t,this.precomputed=null}Yq.prototype.point=function(){throw new Error("Not implemented")},Yq.prototype.validate=function(){throw new Error("Not implemented")},Yq.prototype._fixedNafMul=function(e,t){Zq(e.precomputed);var r=e._getDoubles(),n=Wq(t,1,this._bitLength),i=(1<=o;c--)a=(a<<1)+n[c];s.push(a)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),f=i;f>0;f--){for(o=0;o=0;s--){for(var c=0;s>=0&&0===o[s];s--)c++;if(s>=0&&c++,a=a.dblp(c),s<0)break;var u=o[s];Zq(0!==u),a="affine"===e.type?u>0?a.mixedAdd(i[u-1>>1]):a.mixedAdd(i[-u-1>>1].neg()):u>0?a.add(i[u-1>>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},Yq.prototype._wnafMulAdd=function(e,t,r,n,i){var o,a,s,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,f=0;for(o=0;o=1;o-=2){var h=o-1,p=o;if(1===c[h]&&1===c[p]){var m=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(m[1]=t[h].add(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].add(t[p].neg())):(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],g=Jq(r[h],r[p]);for(f=Math.max(g[0].length,f),l[h]=new Array(f),l[p]=new Array(f),a=0;a=0;o--){for(var A=0;o>=0;){var x=!0;for(a=0;a=0&&A++,w=w.dblp(A),o<0)break;for(a=0;a0?s=u[a][_-1>>1]:_<0&&(s=u[a][-_-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(o=0;o=Math.ceil((e.bitLength()+1)/t.step)},Qq.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(o=t,a=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:i},{a:o,b:a}]},rK.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),c=i.mul(r.b),u=o.mul(n.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},rK.prototype.pointFromX=function(e,t){(e=new hH(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},rK.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},rK.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},iK.prototype.isInfinity=function(){return this.inf},iK.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},iK.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},iK.prototype.getX=function(){return this.x.fromRed()},iK.prototype.getY=function(){return this.y.fromRed()},iK.prototype.mul=function(e){return e=new hH(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},iK.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},iK.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},iK.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},iK.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},iK.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},eK(oK,Xq.BasePoint),rK.prototype.jpoint=function(e,t,r){return new oK(this,e,t,r)},oK.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},oK.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},oK.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(i),c=o.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),f=n.redMul(u),d=c.redSqr().redIAdd(l).redISub(f).redISub(f),h=c.redMul(f.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(d,h,p)},oK.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),l=r.redMul(c),f=s.redSqr().redIAdd(u).redISub(l).redISub(l),d=s.redMul(l.redISub(f)).redISub(i.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(f,d,h)},oK.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},oK.prototype.inspect=function(){return this.isInfinity()?"":""},oK.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var aK=Hq((function(e,t){var r=t;r.base=Xq,r.short=nK,r.mont=null,r.edwards=null})),sK=Hq((function(e,t){var r,n=t,i=Vq.assert;function o(e){"short"===e.type?this.curve=new aK.short(e):"edwards"===e.type?this.curve=new aK.edwards(e):this.curve=new aK.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new o(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=o,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:zg.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:zg.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:zg.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:zg.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:zg.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:zg.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:zg.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(e){r=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:zg.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function cK(e){if(!(this instanceof cK))return new cK(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=Kq.toArray(e.entropy,e.entropyEnc||"hex"),r=Kq.toArray(e.nonce,e.nonceEnc||"hex"),n=Kq.toArray(e.pers,e.persEnc||"hex");Gq(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var uK=cK;cK.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},cK.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=Kq.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var hK=Vq.assert;function pK(e,t){if(e instanceof pK)return e;this._importDER(e,t)||(hK(e.r&&e.s,"Signature without r or s"),this.r=new hH(e.r,16),this.s=new hH(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var mK=pK;function bK(){this.place=0}function gK(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,a=t.place;o>>=0;return!(i<=127)&&(t.place=a,i)}function yK(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}pK.prototype._importDER=function(e,t){e=Vq.toArray(e,t);var r=new bK;if(48!==e[r.place++])return!1;var n=gK(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=gK(e,r);if(!1===i)return!1;var o=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var a=gK(e,r);if(!1===a)return!1;if(e.length!==a+r.place)return!1;var s=e.slice(r.place,a+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new hH(o),this.s=new hH(s),this.recoveryParam=null,!0},pK.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=yK(t),r=yK(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];vK(n,t.length),(n=n.concat(t)).push(2),vK(n,r.length);var i=n.concat(r),o=[48];return vK(o,i.length),o=o.concat(i),Vq.encode(o,e)};var wK=function(){throw new Error("unsupported")},EK=Vq.assert;function AK(e){if(!(this instanceof AK))return new AK(e);"string"==typeof e&&(EK(Object.prototype.hasOwnProperty.call(sK,e),"Unknown curve "+e),e=sK[e]),e instanceof sK.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var xK=AK;AK.prototype.keyPair=function(e){return new dK(this,e)},AK.prototype.keyFromPrivate=function(e,t){return dK.fromPrivate(this,e,t)},AK.prototype.keyFromPublic=function(e,t){return dK.fromPublic(this,e,t)},AK.prototype.genKeyPair=function(e){e||(e={});for(var t=new uK({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||wK(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new hH(2));;){var i=new hH(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},AK.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},AK.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new hH(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),a=e.toArray("be",i),s=new uK({hash:this.hash,entropy:o,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new hH(1)),u=0;;u++){var l=n.k?n.k(u):new hH(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(c)>=0)){var f=this.g.mul(l);if(!f.isInfinity()){var d=f.getX(),h=d.umod(this.n);if(0!==h.cmpn(0)){var p=l.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(f.getY().isOdd()?1:0)|(0!==d.cmp(h)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new mK({r:h,s:p,recoveryParam:m})}}}}}},AK.prototype.verify=function(e,t,r,n){e=this._truncateToN(new hH(e,16)),r=this.keyFromPublic(r,n);var i=(t=new mK(t,"hex")).r,o=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),c=s.mul(e).umod(this.n),u=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,r.getPublic(),u)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(c,r.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},AK.prototype.recoverPubKey=function(e,t,r,n){EK((3&r)===r,"The recovery param is more than two bits"),t=new mK(t,n);var i=this.n,o=new hH(e),a=t.r,s=t.s,c=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var l=t.r.invm(i),f=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(f,a,d)},AK.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new mK(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var _K=Hq((function(e,t){var r=t;r.version="6.5.4",r.utils=Vq,r.rand=function(){throw new Error("unsupported")},r.curve=aK,r.curves=sK,r.ec=xK,r.eddsa=null})),kK=_K.ec;const SK=new S$("signing-key/5.7.0");let PK=null;function IK(){return PK||(PK=new kK("secp256k1")),PK}class TK{constructor(e){T$(this,"curve","secp256k1"),T$(this,"privateKey",nH(e)),32!==iH(this.privateKey)&&SK.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=IK().keyFromPrivate(Y$(this.privateKey));T$(this,"publicKey","0x"+t.getPublic(!1,"hex")),T$(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),T$(this,"_isSigningKey",!0)}_addPoint(e){const t=IK().keyFromPublic(Y$(this.publicKey)),r=IK().keyFromPublic(Y$(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=IK().keyFromPrivate(Y$(this.privateKey)),r=Y$(e);32!==r.length&&SK.throwArgumentError("bad digest length","digest",e);const n=t.sign(r,{canonical:!0});return lH({recoveryParam:n.recoveryParam,r:uH("0x"+n.r.toString(16),32),s:uH("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=IK().keyFromPrivate(Y$(this.privateKey)),r=IK().keyFromPublic(Y$(MK(e)));return uH("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function OK(e,t){const r=lH(t),n={r:Y$(r.r),s:Y$(r.s)};return"0x"+IK().recoverPubKey(Y$(e),n,r.recoveryParam).encode("hex",!1)}function MK(e,t){const r=Y$(e);if(32===r.length){const e=new TK(r);return t?"0x"+IK().keyFromPrivate(r).getPublic(!0,"hex"):e.publicKey}return 33===r.length?t?nH(r):"0x"+IK().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?t?"0x"+IK().keyFromPublic(r).getPublic(!0,"hex"):nH(r):SK.throwArgumentError("invalid public or private key","key","[REDACTED]")}const CK=new S$("transactions/5.7.0");var BK;function NK(e){return"0x"===e?null:tG(e)}function RK(e){return"0x"===e?uG:wH.from(e)}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(BK||(BK={}));const FK=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],LK={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function jK(e){return tG(oH(DH(oH(MK(e),1)),12))}function UK(e,t){return jK(OK(Y$(e),t))}function DK(e,t){const r=Q$(wH.from(e).toHexString());return r.length>32&&CK.throwArgumentError("invalid length for "+t,"transaction:"+t,e),r}function zK(e,t){return{address:tG(e),storageKeys:(t||[]).map(((t,r)=>(32!==iH(t)&&CK.throwArgumentError("invalid access list storageKey",`accessList[${e}:${r}]`,t),t.toLowerCase())))}}function $K(e){if(Array.isArray(e))return e.map(((e,t)=>Array.isArray(e)?(e.length>2&&CK.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${t}]`,e),zK(e[0],e[1])):zK(e.address,e.storageKeys)));const t=Object.keys(e).map((t=>{const r=e[t].reduce(((e,t)=>(e[t]=!0,e)),{});return zK(t,Object.keys(r).sort())}));return t.sort(((e,t)=>e.address.localeCompare(t.address))),t}function HK(e){return $K(e).map((e=>[e.address,e.storageKeys]))}function GK(e,t){if(null!=e.gasPrice){const t=wH.from(e.gasPrice),r=wH.from(e.maxFeePerGas||0);t.eq(r)||CK.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:t,maxFeePerGas:r})}const r=[DK(e.chainId||0,"chainId"),DK(e.nonce||0,"nonce"),DK(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),DK(e.maxFeePerGas||0,"maxFeePerGas"),DK(e.gasLimit||0,"gasLimit"),null!=e.to?tG(e.to):"0x",DK(e.value||0,"value"),e.data||"0x",HK(e.accessList||[])];if(t){const e=lH(t);r.push(DK(e.recoveryParam,"recoveryParam")),r.push(Q$(e.r)),r.push(Q$(e.s))}return aH(["0x02",qH(r)])}function qK(e,t){const r=[DK(e.chainId||0,"chainId"),DK(e.nonce||0,"nonce"),DK(e.gasPrice||0,"gasPrice"),DK(e.gasLimit||0,"gasLimit"),null!=e.to?tG(e.to):"0x",DK(e.value||0,"value"),e.data||"0x",HK(e.accessList||[])];if(t){const e=lH(t);r.push(DK(e.recoveryParam,"recoveryParam")),r.push(Q$(e.r)),r.push(Q$(e.s))}return aH(["0x01",qH(r)])}function KK(e,t){if(null==e.type||0===e.type)return null!=e.accessList&&CK.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",e),function(e,t){C$(e,LK);const r=[];FK.forEach((function(t){let n=e[t.name]||[];const i={};t.numeric&&(i.hexPad="left"),n=Y$(nH(n,i)),t.length&&n.length!==t.length&&n.length>0&&CK.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,n),t.maxLength&&(n=Q$(n),n.length>t.maxLength&&CK.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,n)),r.push(nH(n))}));let n=0;if(null!=e.chainId?(n=e.chainId,"number"!=typeof n&&CK.throwArgumentError("invalid transaction.chainId","transaction",e)):t&&!W$(t)&&t.v>28&&(n=Math.floor((t.v-35)/2)),0!==n&&(r.push(nH(n)),r.push("0x"),r.push("0x")),!t)return qH(r);const i=lH(t);let o=27+i.recoveryParam;return 0!==n?(r.pop(),r.pop(),r.pop(),o+=2*n+8,i.v>28&&i.v!==o&&CK.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t)):i.v!==o&&CK.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t),r.push(nH(o)),r.push(Q$(Y$(i.r))),r.push(Q$(Y$(i.s))),qH(r)}(e,t);switch(e.type){case 1:return qK(e,t);case 2:return GK(e,t)}return CK.throwError(`unsupported transaction type: ${e.type}`,S$.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:e.type})}function VK(e,t,r){try{const r=RK(t[0]).toNumber();if(0!==r&&1!==r)throw new Error("bad recid");e.v=r}catch(e){CK.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=uH(t[1],32),e.s=uH(t[2],32);try{const t=DH(r(e));e.from=UK(t,{r:e.r,s:e.s,recoveryParam:e.v})}catch(e){}}function WK(e){const t=Y$(e);if(t[0]>127)return function(e){const t=WH(e);9!==t.length&&6!==t.length&&CK.throwArgumentError("invalid raw transaction","rawTransaction",e);const r={nonce:RK(t[0]).toNumber(),gasPrice:RK(t[1]),gasLimit:RK(t[2]),to:NK(t[3]),value:RK(t[4]),data:t[5],chainId:0};if(6===t.length)return r;try{r.v=wH.from(t[6]).toNumber()}catch(e){return r}if(r.r=uH(t[7],32),r.s=uH(t[8],32),wH.from(r.r).isZero()&&wH.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=t.slice(0,6);0!==r.chainId&&(i.push(nH(r.chainId)),i.push("0x"),i.push("0x"),n-=2*r.chainId+8);const o=DH(qH(i));try{r.from=UK(o,{r:nH(r.r),s:nH(r.s),recoveryParam:n})}catch(e){}r.hash=DH(e)}return r.type=null,r}(t);switch(t[0]){case 1:return function(e){const t=WH(e.slice(1));8!==t.length&&11!==t.length&&CK.throwArgumentError("invalid component count for transaction type: 1","payload",nH(e));const r={type:1,chainId:RK(t[0]).toNumber(),nonce:RK(t[1]).toNumber(),gasPrice:RK(t[2]),gasLimit:RK(t[3]),to:NK(t[4]),value:RK(t[5]),data:t[6],accessList:$K(t[7])};return 8===t.length||(r.hash=DH(e),VK(r,t.slice(8),qK)),r}(t);case 2:return function(e){const t=WH(e.slice(1));9!==t.length&&12!==t.length&&CK.throwArgumentError("invalid component count for transaction type: 2","payload",nH(e));const r=RK(t[2]),n=RK(t[3]),i={type:2,chainId:RK(t[0]).toNumber(),nonce:RK(t[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:RK(t[4]),to:NK(t[5]),value:RK(t[6]),data:t[7],accessList:$K(t[8])};return 9===t.length||(i.hash=DH(e),VK(i,t.slice(9),GK)),i}(t)}return CK.throwError(`unsupported transaction type: ${t[0]}`,S$.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}const JK=new S$("wordlists/5.7.0");class ZK{constructor(e){JK.checkAbstract(new.target,ZK),T$(this,"locale",e)}split(e){return e.toLowerCase().split(/ +/g)}join(e){return e.join(" ")}static check(e){const t=[];for(let r=0;r<2048;r++){const n=e.getWord(r);if(r!==e.getWordIndex(n))return"0x";t.push(n)}return UG(t.join("\n")+"\n")}static register(e,t){t||(t=e.locale)}}let YK=null;function XK(e){if(null==YK&&(YK="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==ZK.check(e)))throw YK=null,new Error("BIP39 Wordlist for en (English) FAILED")}const QK=new class extends ZK{constructor(){super("en")}getWord(e){return XK(this),YK[e]}getWordIndex(e){return XK(this),YK.indexOf(e)}};ZK.register(QK);const eV={en:QK},tV=new S$("hdnode/5.7.0"),rV=wH.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),nV=_G("Bitcoin seed"),iV=2147483648;function oV(e){return(1<=256)throw new Error("Depth too large!");return sV(X$([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",nH(this.depth),this.parentFingerprint,uH(nH(this.index),4),this.chainCode,null!=this.privateKey?X$(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new fV(uV,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(e){if(e>4294967295)throw new Error("invalid index - "+String(e));let t=this.path;t&&(t+="/"+(2147483647&e));const r=new Uint8Array(37);if(e&iV){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set(Y$(this.privateKey),1),t&&(t+="'")}else r.set(Y$(this.publicKey));for(let t=24;t>=0;t-=8)r[33+(t>>3)]=e>>24-t&255;const n=Y$(zq(Lq.sha512,this.chainCode,r)),i=n.slice(0,32),o=n.slice(32);let a=null,s=null;if(this.privateKey)a=aV(wH.from(i).add(this.privateKey).mod(rV));else{s=new TK(nH(i))._addPoint(this.publicKey)}let c=t;const u=this.mnemonic;return u&&(c=Object.freeze({phrase:u.phrase,path:t,locale:u.locale||"en"})),new fV(uV,a,s,this.fingerprint,aV(o),e,this.depth+1,c)}derivePath(e){const t=e.split("/");if(0===t.length||"m"===t[0]&&0!==this.depth)throw new Error("invalid path - "+e);"m"===t[0]&&t.shift();let r=this;for(let e=0;e=iV)throw new Error("invalid path index - "+n);r=r._derive(iV+e)}else{if(!n.match(/^[0-9]+$/))throw new Error("invalid path component - "+n);{const e=parseInt(n);if(e>=iV)throw new Error("invalid path index - "+n);r=r._derive(e)}}}return r}static _fromSeed(e,t){const r=Y$(e);if(r.length<16||r.length>64)throw new Error("invalid seed");const n=Y$(zq(Lq.sha512,nV,r));return new fV(uV,aV(n.slice(0,32)),null,"0x00000000",aV(n.slice(32)),0,0,t)}static fromMnemonic(e,t,r){return e=pV(hV(e,r=cV(r)),r),fV._fromSeed(dV(e,t),{phrase:e,path:"m",locale:r.locale})}static fromSeed(e){return fV._fromSeed(e,null)}static fromExtendedKey(e){const t=Fq.decode(e);82===t.length&&sV(t.slice(0,78))===e||tV.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const r=t[4],n=nH(t.slice(5,9)),i=parseInt(nH(t.slice(9,13)).substring(2),16),o=nH(t.slice(13,45)),a=t.slice(45,78);switch(nH(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new fV(uV,null,nH(a),n,o,i,r,null);case"0x0488ade4":case"0x04358394 ":if(0!==a[0])break;return new fV(uV,nH(a.slice(1)),null,n,o,i,r,null)}return tV.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function dV(e,t){t||(t="");const r=_G("mnemonic"+t,vG.NFKD);return $q(_G(e,vG.NFKD),r,2048,64,"sha512")}function hV(e,t){t=cV(t),tV.checkNormalize();const r=t.split(e);if(r.length%3!=0)throw new Error("invalid mnemonic");const n=Y$(new Uint8Array(Math.ceil(11*r.length/8)));let i=0;for(let e=0;e>3]|=1<<7-i%8),i++}const o=32*r.length/3,a=oV(r.length/3);if((Y$(Dq(n.slice(0,o/8)))[0]&a)!==(n[n.length-1]&a))throw new Error("invalid checksum");return nH(n.slice(0,o/8))}function pV(e,t){if(t=cV(t),(e=Y$(e)).length%4!=0||e.length<16||e.length>32)throw new Error("invalid entropy");const r=[0];let n=11;for(let t=0;t8?(r[r.length-1]<<=8,r[r.length-1]|=e[t],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=e[t]>>8-n,r.push(e[t]&(1<<8-n)-1),n+=3);const i=e.length/4,o=Y$(Dq(e))[0]&oV(i);return r[r.length-1]<<=i,r[r.length-1]|=o>>8-i,t.join(r.map((e=>t.getWord(e))))}const mV=new S$("random/5.7.0");const bV=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==u)return u;throw new Error("unable to locate global object")}();let gV=bV.crypto||bV.msCrypto;function yV(e){(e<=0||e>1024||e%1||e!=e)&&mV.throwArgumentError("invalid length","length",e);const t=new Uint8Array(e);return gV.getRandomValues(t),Y$(t)}function vV(e){for(let t=(e=e.slice()).length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}gV&&gV.getRandomValues||(mV.warn("WARNING: Missing strong random number source"),gV={getRandomValues:function(e){return mV.throwError("no secure random source avaialble",S$.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});var wV={exports:{}};!function(e){!function(){function t(e){return parseInt(e)===e}function r(e){if(!t(e.length))return!1;for(var r=0;r255)return!1;return!0}function n(e,n){if(e.buffer&&ArrayBuffer.isView(e)&&"Uint8Array"===e.name)return n&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!r(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(t(e.length)&&r(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function i(e){return new Uint8Array(e)}function o(e,t,r,n,i){null==n&&null==i||(e=e.slice?e.slice(n,i):Array.prototype.slice.call(e,n,i)),t.set(e,r)}var a,s={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&n<224?(t.push(String.fromCharCode((31&n)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&n)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},c=(a="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r>4]+a[15&n])}return t.join("")}}),u={16:10,24:12,32:14},l=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],f=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],d=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],h=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],p=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],m=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],b=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],g=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],y=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],v=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],w=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],E=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],A=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],x=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],_=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function k(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=o[t],this._Kd[e-r][t%4]=o[t];for(var a,s=0,c=i;c>16&255]<<24^f[a>>8&255]<<16^f[255&a]<<8^f[a>>24&255]^l[s]<<24,s+=1,8!=i)for(t=1;t>8&255]<<8^f[a>>16&255]<<16^f[a>>24&255]<<24;for(t=i/2+1;t>2,h=c%4,this._Ke[d][h]=o[t],this._Kd[e-d][h]=o[t++],c++}for(var d=1;d>24&255]^A[a>>16&255]^x[a>>8&255]^_[255&a]},S.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],n=k(e),o=0;o<4;o++)n[o]^=this._Ke[0][o];for(var a=1;a>24&255]^p[n[(o+1)%4]>>16&255]^m[n[(o+2)%4]>>8&255]^b[255&n[(o+3)%4]]^this._Ke[a][o];n=r.slice()}var s,c=i(16);for(o=0;o<4;o++)s=this._Ke[t][o],c[4*o]=255&(f[n[o]>>24&255]^s>>24),c[4*o+1]=255&(f[n[(o+1)%4]>>16&255]^s>>16),c[4*o+2]=255&(f[n[(o+2)%4]>>8&255]^s>>8),c[4*o+3]=255&(f[255&n[(o+3)%4]]^s);return c},S.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],n=k(e),o=0;o<4;o++)n[o]^=this._Kd[0][o];for(var a=1;a>24&255]^y[n[(o+3)%4]>>16&255]^v[n[(o+2)%4]>>8&255]^w[255&n[(o+1)%4]]^this._Kd[a][o];n=r.slice()}var s,c=i(16);for(o=0;o<4;o++)s=this._Kd[t][o],c[4*o]=255&(d[n[o]>>24&255]^s>>24),c[4*o+1]=255&(d[n[(o+3)%4]>>16&255]^s>>16),c[4*o+2]=255&(d[n[(o+2)%4]>>8&255]^s>>8),c[4*o+3]=255&(d[255&n[(o+1)%4]]^s);return c};var P=function(e){if(!(this instanceof P))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new S(e)};P.prototype.encrypt=function(e){if((e=n(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=i(e.length),r=i(16),a=0;a=0;--t)this._counter[t]=e%256,e>>=8},M.prototype.setBytes=function(e){if(16!=(e=n(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},M.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var C=function(e,t){if(!(this instanceof C))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof M||(t=new M(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new S(e)};C.prototype.encrypt=function(e){for(var t=n(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,a=0;a=64;){let h,p,m,b,g,y=r,v=n,w=i,E=o,A=a,x=s,_=c,k=u;for(p=0;p<16;p++)m=f+4*p,l[p]=(255&e[m])<<24|(255&e[m+1])<<16|(255&e[m+2])<<8|255&e[m+3];for(p=16;p<64;p++)h=l[p-2],b=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10,h=l[p-15],g=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3,l[p]=(b+l[p-7]|0)+(g+l[p-16]|0)|0;for(p=0;p<64;p++)b=(((A>>>6|A<<26)^(A>>>11|A<<21)^(A>>>25|A<<7))+(A&x^~A&_)|0)+(k+(t[p]+l[p]|0)|0)|0,g=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&v^y&w^v&w)|0,k=_,_=x,x=A,A=E+b|0,E=w,w=v,v=y,y=b+g|0;r=r+y|0,n=n+v|0,i=i+w|0,o=o+E|0,a=a+A|0,s=s+x|0,c=c+_|0,u=u+k|0,f+=64,d-=64}}f(e);let d,h=e.length%64,p=e.length/536870912|0,m=e.length<<3,b=h<56?56:120,g=e.slice(e.length-h,e.length);for(g.push(128),d=h+1;d>>24&255),g.push(p>>>16&255),g.push(p>>>8&255),g.push(p>>>0&255),g.push(m>>>24&255),g.push(m>>>16&255),g.push(m>>>8&255),g.push(m>>>0&255),f(g),[r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,n>>>24&255,n>>>16&255,n>>>8&255,n>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,c>>>24&255,c>>>16&255,c>>>8&255,c>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255]}function n(e,t,n){e=e.length<=64?e:r(e);const i=64+t.length+4,o=new Array(i),a=new Array(64);let s,c=[];for(s=0;s<64;s++)o[s]=54;for(s=0;s=i-4;e--){if(o[e]++,o[e]<=255)return;o[e]=0}}for(;n>=32;)u(),c=c.concat(r(a.concat(r(o)))),n-=32;return n>0&&(u(),c=c.concat(r(a.concat(r(o))).slice(0,n))),c}function i(e,t,r,n,i){let o;for(c(e,16*(2*r-1),i,0,16),o=0;o<2*r;o++)s(e,16*o,i,16),a(i,n),c(i,0,e,t+16*o,16);for(o=0;o>>32-t}function a(e,t){c(e,0,t,0,16);for(let e=8;e>0;e-=2)t[4]^=o(t[0]+t[12],7),t[8]^=o(t[4]+t[0],9),t[12]^=o(t[8]+t[4],13),t[0]^=o(t[12]+t[8],18),t[9]^=o(t[5]+t[1],7),t[13]^=o(t[9]+t[5],9),t[1]^=o(t[13]+t[9],13),t[5]^=o(t[1]+t[13],18),t[14]^=o(t[10]+t[6],7),t[2]^=o(t[14]+t[10],9),t[6]^=o(t[2]+t[14],13),t[10]^=o(t[6]+t[2],18),t[3]^=o(t[15]+t[11],7),t[7]^=o(t[3]+t[15],9),t[11]^=o(t[7]+t[3],13),t[15]^=o(t[11]+t[7],18),t[1]^=o(t[0]+t[3],7),t[2]^=o(t[1]+t[0],9),t[3]^=o(t[2]+t[1],13),t[0]^=o(t[3]+t[2],18),t[6]^=o(t[5]+t[4],7),t[7]^=o(t[6]+t[5],9),t[4]^=o(t[7]+t[6],13),t[5]^=o(t[4]+t[7],18),t[11]^=o(t[10]+t[9],7),t[8]^=o(t[11]+t[10],9),t[9]^=o(t[8]+t[11],13),t[10]^=o(t[9]+t[8],18),t[12]^=o(t[15]+t[14],7),t[13]^=o(t[12]+t[15],9),t[14]^=o(t[13]+t[12],13),t[15]^=o(t[14]+t[13],18);for(let r=0;r<16;++r)e[r]+=t[r]}function s(e,t,r,n){for(let i=0;i=256)return!1}return!0}function l(e,t){if("number"!=typeof e||e%1)throw new Error("invalid "+t);return e}function f(e,r,o,a,f,d,h){if(o=l(o,"N"),a=l(a,"r"),f=l(f,"p"),d=l(d,"dkLen"),0===o||o&o-1)throw new Error("N must be power of 2");if(o>t/128/a)throw new Error("N too large");if(a>t/128/f)throw new Error("r too large");if(!u(e))throw new Error("password must be an array or buffer");if(e=Array.prototype.slice.call(e),!u(r))throw new Error("salt must be an array or buffer");r=Array.prototype.slice.call(r);let p=n(e,r,128*f*a);const m=new Uint32Array(32*f*a);for(let e=0;eT&&(t=T);for(let e=0;eT&&(t=T);for(let e=0;e>8&255),p.push(m[e]>>16&255),p.push(m[e]>>24&255);const r=n(e,p,d);return h&&h(null,1,r),r}h&&O(M)};if(!h)for(;;){const e=M();if(null!=e)return e}M()}const d={scrypt:function(e,t,r,n,i,o,a){return new Promise((function(s,c){let u=0;a&&a(0),f(e,t,r,n,i,o,(function(e,t,r){if(e)c(e);else if(r)a&&1!==u&&a(1),s(new Uint8Array(r));else if(a&&t!==u)return u=t,a(t)}))}))},syncScrypt:function(e,t,r,n,i,o){return new Uint8Array(f(e,t,r,n,i,o))}};e.exports=d}()}(BV);var NV=a(BV.exports),RV=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const FV=new S$(AV);function LV(e){return null!=e&&e.mnemonic&&e.mnemonic.phrase}class jV extends j${isKeystoreAccount(e){return!(!e||!e._isKeystoreAccount)}}function UV(e,t){const r=xV(SV(e,"crypto/ciphertext"));if(nH(DH(X$([t.slice(16,32),r]))).substring(2)!==SV(e,"crypto/mac").toLowerCase())throw new Error("invalid password");const n=function(e,t,r){if("aes-128-ctr"===SV(e,"crypto/cipher")){const n=xV(SV(e,"crypto/cipherparams/iv")),i=new EV.Counter(n);return Y$(new EV.ModeOfOperation.ctr(t,i).decrypt(r))}return null}(e,t.slice(0,16),r);n||FV.throwError("unsupported cipher",S$.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const i=t.slice(32,64),o=jK(n);if(e.address){let t=e.address.toLowerCase();if("0x"!==t.substring(0,2)&&(t="0x"+t),tG(t)!==o)throw new Error("address mismatch")}const a={_isKeystoreAccount:!0,address:o,privateKey:nH(n)};if("0.1"===SV(e,"x-ethers/version")){const t=xV(SV(e,"x-ethers/mnemonicCiphertext")),r=xV(SV(e,"x-ethers/mnemonicCounter")),n=new EV.Counter(r),o=new EV.ModeOfOperation.ctr(i,n),s=SV(e,"x-ethers/path")||lV,c=SV(e,"x-ethers/locale")||"en",u=Y$(o.decrypt(t));try{const e=pV(u,c),t=fV.fromMnemonic(e,null,c).derivePath(s);if(t.privateKey!=a.privateKey)throw new Error("mnemonic mismatch");a.mnemonic=t.mnemonic}catch(e){if(e.code!==S$.errors.INVALID_ARGUMENT||"wordlist"!==e.argument)throw e}}return new jV(a)}function DV(e,t,r,n,i){return Y$($q(e,t,r,n,i))}function zV(e,t,r,n,i){return Promise.resolve(DV(e,t,r,n,i))}function $V(e,t,r,n,i){const o=kV(t),a=SV(e,"crypto/kdf");if(a&&"string"==typeof a){const t=function(e,t){return FV.throwArgumentError("invalid key-derivation function parameters",e,t)};if("scrypt"===a.toLowerCase()){const r=xV(SV(e,"crypto/kdfparams/salt")),s=parseInt(SV(e,"crypto/kdfparams/n")),c=parseInt(SV(e,"crypto/kdfparams/r")),u=parseInt(SV(e,"crypto/kdfparams/p"));s&&c&&u||t("kdf",a),s&s-1&&t("N",s);const l=parseInt(SV(e,"crypto/kdfparams/dklen"));return 32!==l&&t("dklen",l),n(o,r,s,c,u,64,i)}if("pbkdf2"===a.toLowerCase()){const n=xV(SV(e,"crypto/kdfparams/salt"));let i=null;const a=SV(e,"crypto/kdfparams/prf");"hmac-sha256"===a?i="sha256":"hmac-sha512"===a?i="sha512":t("prf",a);const s=parseInt(SV(e,"crypto/kdfparams/c")),c=parseInt(SV(e,"crypto/kdfparams/dklen"));return 32!==c&&t("dklen",c),r(o,n,s,c,i)}}return FV.throwArgumentError("unsupported key-derivation function","kdf",a)}function HV(e,t,r){if(MV(e)){r&&r(0);const n=OV(e,t);return r&&r(1),Promise.resolve(n)}return CV(e)?function(e,t,r){return RV(this,void 0,void 0,(function*(){const n=JSON.parse(e);return UV(n,yield $V(n,t,zV,NV.scrypt,r))}))}(e,t,r):Promise.reject(new Error("invalid JSON wallet"))}function GV(e,t){if(MV(e))return OV(e,t);if(CV(e))return function(e,t){const r=JSON.parse(e);return UV(r,$V(r,t,DV,NV.syncScrypt))}(e,t);throw new Error("invalid JSON wallet")}var qV=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const KV=new S$("wallet/5.7.0");class VV extends H${constructor(e,t){if(super(),function(e){return null!=e&&tH(e.privateKey,32)&&null!=e.address}(e)){const t=new TK(e.privateKey);if(T$(this,"_signingKey",(()=>t)),T$(this,"address",jK(this.publicKey)),this.address!==tG(e.address)&&KV.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),function(e){const t=e.mnemonic;return t&&t.phrase}(e)){const t=e.mnemonic;T$(this,"_mnemonic",(()=>({phrase:t.phrase,path:t.path||lV,locale:t.locale||"en"})));const r=this.mnemonic;jK(fV.fromMnemonic(r.phrase,null,r.locale).derivePath(r.path).privateKey)!==this.address&&KV.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else T$(this,"_mnemonic",(()=>null))}else{if(TK.isSigningKey(e))"secp256k1"!==e.curve&&KV.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),T$(this,"_signingKey",(()=>e));else{"string"==typeof e&&e.match(/^[0-9a-f]*$/i)&&64===e.length&&(e="0x"+e);const t=new TK(e);T$(this,"_signingKey",(()=>t))}T$(this,"_mnemonic",(()=>null)),T$(this,"address",jK(this.publicKey))}t&&!aG.isProvider(t)&&KV.throwArgumentError("invalid provider","provider",t),T$(this,"provider",t||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(e){return new VV(this,e)}signTransaction(e){return M$(e).then((t=>{null!=t.from&&(tG(t.from)!==this.address&&KV.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete t.from);const r=this._signingKey().signDigest(DH(KK(t)));return KK(t,r)}))}signMessage(e){return qV(this,void 0,void 0,(function*(){return fH(this._signingKey().signDigest(yq(e)))}))}_signTypedData(e,t,r){return qV(this,void 0,void 0,(function*(){const n=yield Nq.resolveNames(e,t,r,(e=>(null==this.provider&&KV.throwError("cannot resolve ENS names without a provider",S$.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:e}),this.provider.resolveName(e))));return fH(this._signingKey().signDigest(Nq.hash(n.domain,t,n.value)))}))}encrypt(e,t,r){if("function"!=typeof t||r||(r=t,t={}),r&&"function"!=typeof r)throw new Error("invalid callback");return t||(t={}),function(e,t,r,n){try{if(tG(e.address)!==jK(e.privateKey))throw new Error("address/privateKey mismatch");if(LV(e)){const t=e.mnemonic;if(fV.fromMnemonic(t.phrase,null,t.locale).derivePath(t.path||lV).privateKey!=e.privateKey)throw new Error("mnemonic mismatch")}}catch(e){return Promise.reject(e)}"function"!=typeof r||n||(n=r,r={}),r||(r={});const i=Y$(e.privateKey),o=kV(t);let a=null,s=null,c=null;if(LV(e)){const t=e.mnemonic;a=Y$(hV(t.phrase,t.locale||"en")),s=t.path||lV,c=t.locale||"en"}let u=r.client;u||(u="ethers.js");let l=null;l=r.salt?Y$(r.salt):yV(32);let f=null;if(r.iv){if(f=Y$(r.iv),16!==f.length)throw new Error("invalid iv")}else f=yV(16);let d=null;if(r.uuid){if(d=Y$(r.uuid),16!==d.length)throw new Error("invalid uuid")}else d=yV(16);let h=1<<17,p=8,m=1;return r.scrypt&&(r.scrypt.N&&(h=r.scrypt.N),r.scrypt.r&&(p=r.scrypt.r),r.scrypt.p&&(m=r.scrypt.p)),NV.scrypt(o,l,h,p,m,64,n).then((t=>{const r=(t=Y$(t)).slice(0,16),n=t.slice(16,32),o=t.slice(32,64),b=new EV.Counter(f),g=Y$(new EV.ModeOfOperation.ctr(r,b).encrypt(i)),y=DH(X$([n,g])),v={address:e.address.substring(2).toLowerCase(),id:PV(d),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:nH(f).substring(2)},ciphertext:nH(g).substring(2),kdf:"scrypt",kdfparams:{salt:nH(l).substring(2),n:h,dklen:32,p:m,r:p},mac:y.substring(2)}};if(a){const e=yV(16),t=new EV.Counter(e),r=Y$(new EV.ModeOfOperation.ctr(o,t).encrypt(a)),n=new Date,i=n.getUTCFullYear()+"-"+_V(n.getUTCMonth()+1,2)+"-"+_V(n.getUTCDate(),2)+"T"+_V(n.getUTCHours(),2)+"-"+_V(n.getUTCMinutes(),2)+"-"+_V(n.getUTCSeconds(),2)+".0Z";v["x-ethers"]={client:u,gethFilename:"UTC--"+i+"--"+v.address,mnemonicCounter:nH(e).substring(2),mnemonicCiphertext:nH(r).substring(2),path:s,locale:c,version:"0.1"}}return JSON.stringify(v)}))}(this,e,t,r)}static createRandom(e){let t=yV(16);e||(e={}),e.extraEntropy&&(t=Y$(oH(DH(X$([t,e.extraEntropy])),0,16)));const r=pV(t,e.locale);return VV.fromMnemonic(r,e.path,e.locale)}static fromEncryptedJson(e,t,r){return HV(e,t,r).then((e=>new VV(e)))}static fromEncryptedJsonSync(e,t){return new VV(GV(e,t))}static fromMnemonic(e,t,r){return t||(t=lV),new VV(fV.fromMnemonic(e,null,r).derivePath(t))}}const WV=e=>{const t=TT(e.data),r=function(e,t){if(e.length!==t.length)throw new $I({expectedLength:e.length,givenLength:t.length});const r=[];for(let n=0;n"0x"+e.map((e=>WV(e))).join("");const ZV=e=>{let t=e;if(!CI(t)&&(t=`0x${t}`,!CI(t)))throw new Error("Invalid signed data "+e);let{r:r,s:n,v:i}=function(e){const{r:t,s:r}=HR.Signature.fromCompact(e.slice(2,130)),n=BigInt(`0x${e.slice(130)}`);return{r:kT(t,{size:32}),s:kT(r,{size:32}),v:n}}(t);0n!==i&&1n!==i||(i+=27n);const o=function({r:e,s:t,v:r}){return`0x${new HR.Signature(gT(e),gT(t)).toCompactHex()}${AT(r).slice(2)}`}({r:r,s:n,v:i});return o},YV=e=>{for(const t of Object.values(_U).concat(Object.values(b$)))if(t.id===e)return t;throw new Error("could not find chain")};class XV extends FU{constructor(e){super(e),Object.defineProperty(this,"owner",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.owner=e.owner}static async init(e){const t=await n$(e.projectId);if(!t)throw new Error("ChainId not found");const r=YV(t);return new XV({...e,chain:r})}async signer(){return await Promise.resolve(this.owner)}async getOwner(){return this.owner.getAddress()}async getEnableData(){return this.getOwner()}encodeEnable(e){return RO({abi:pE,functionName:"enable",args:[e]})}encodeDisable(e="0x"){return RO({abi:pE,functionName:"disable",args:[e]})}async getDummyUserOpSignature(){return"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"}async isPluginEnabled(e,t){if(!this.publicClient)throw new Error("Validator uninitialized: PublicClient missing");const r=await this.publicClient.readContract({abi:mE,address:e,functionName:"getExecution",args:[t]}),n=await this.publicClient.readContract({abi:pE,address:this.validatorAddress,functionName:"ecdsaValidatorStorage",args:[e]});return r.validator.toLowerCase()===this.validatorAddress.toLowerCase()&&n.toLowerCase()===(await this.getEnableData()).toLowerCase()}async signMessage(e){return await this.owner.signMessage(e)}async signTypedData(e){return ZV(await this.owner.signTypedData(e))}async signUserOp(e){if(!this.chain)throw new Error("Validator uninitialized");const t=zP({...e,signature:"0x"},this.entryPointAddress,BigInt(this.chain.id)),r="string"==typeof t?TT(t):t;return await this.owner.signMessage(r)}}SO("doRecovery(address, bytes)");var QV={},eW={exports:{}};function tW(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var rW,nW={exports:{}};function iW(){return rW||(rW=1,function(e){var t;e.exports=(t=t||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==o&&o.crypto&&(r=o.crypto),!r)try{r=om}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),a={},s=a.lib={},c=s.Base={extend:function(e){var t=i(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=s.WordArray=c.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||f).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o>>2]>>>24-o%4*8&255;t[n+o>>>2]|=a<<24-(n+o)%4*8}else for(var s=0;s>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new u.init(r,t/2)}},d=l.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new u.init(r,t)}},h=l.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},p=s.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,o=n.sigBytes,a=this.blockSize,s=o/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,l=e.min(4*c,o);if(c){for(var f=0;f>>7)^(p<<14|p>>>18)^p>>>3,b=u[h-2],g=(b<<15|b>>>17)^(b<<13|b>>>19)^b>>>10;u[h]=m+u[h-7]+g+u[h-16]}var y=n&i^n&o^i&o,v=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=d+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&l^~s&f)+c[h]+u[h];d=f,f=l,l=s,s=a+w|0,a=o,o=i,i=n,n=w+(v+y)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+s|0,r[5]=r[5]+l|0,r[6]=r[6]+f|0,r[7]=r[7]+d|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=e.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=o._createHelper(l),r.HmacSHA256=o._createHmacHelper(l)}(Math),t.SHA256)}(eW);var oW=eW.exports,aW={exports:{}};!function(e){e.exports=function(){function e(e,t){var r=t?"└":"├";return r+=e?"─ ":"──┐"}function t(e,t){var r=[];for(var n in e)e.hasOwnProperty(n)&&(t&&"function"==typeof e[n]||r.push(n));return r}function r(n,i,o,a,s,c,u){var l,f,d="",h=0,p=a.slice(0);if(p.push([i,o])&&a.length>0&&(a.forEach((function(e,t){t>0&&(d+=(e[1]?" ":"│")+" "),f||e[0]!==i||(f=!0)})),d+=e(n,o)+n,s&&("object"!=typeof i||i instanceof Date)&&(d+=": "+i),f&&(d+=" (circular ref.)"),u(d)),!f&&"object"==typeof i){var m=t(i,c);m.forEach((function(e){l=++h===m.length,r(e,i[e],l,p,s,c,u)}))}}var n={asLines:function(e,t,n,i){r(".",e,!1,[],t,"function"!=typeof n&&n,i||n)},asTree:function(e,t,n){var i="";return r(".",e,!1,[],t,n,(function(e){i+=e+"\n"})),i}};return n}()}(aW);var sW,cW=aW.exports,uW={},lW={exports:{}},fW={exports:{}};function dW(){return sW||(sW=1,function(e){var t;e.exports=(t=iW(),function(e){var r=t,n=r.lib,i=n.Base,o=n.WordArray,a=r.x64={};a.Word=i.extend({init:function(e,t){this.high=e,this.low=t}}),a.WordArray=i.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=r!=e?r:8*t.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n>>2]|=e[i]<<24-i%4*8;r.call(this,n,t)}else r.apply(this,arguments)};n.prototype=e}}(),t.lib.WordArray)}(pW)),pW.exports}var bW,gW={exports:{}};function yW(){return bW||(bW=1,function(e){var t;e.exports=(t=iW(),function(){var e=t,r=e.lib.WordArray,n=e.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i>>1]|=e.charCodeAt(i)<<16-i%2*16;return r.create(n,2*t)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o>>2]>>>16-o%4*8&65535);n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o>>1]|=i(e.charCodeAt(o)<<16-o%2*16);return r.create(n,2*t)}}}(),t.enc.Utf16)}(gW)),gW.exports}var vW,wW={exports:{}};function EW(){return vW||(vW=1,function(e){var t;e.exports=(t=iW(),function(){var e=t,r=e.lib.WordArray;function n(e,t,n){for(var i=[],o=0,a=0;a>>6-a%4*2;i[o>>>2]|=s<<24-o%4*8,o++}return r.create(i,o)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o>>6-a%4*2;i[o>>>2]|=s<<24-o%4*8,o++}return r.create(i,o)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,n=e.sigBytes,i=t?this._safe_map:this._map;e.clamp();for(var o=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,c=0;c<4&&a+.75*c>>6*(3-c)&63));var u=i.charAt(64);if(u)for(;o.length%4;)o.push(u);return o.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,i=t?this._safe_map:this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var a=0;a>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,a=e[t+0],c=e[t+1],h=e[t+2],p=e[t+3],m=e[t+4],b=e[t+5],g=e[t+6],y=e[t+7],v=e[t+8],w=e[t+9],E=e[t+10],A=e[t+11],x=e[t+12],_=e[t+13],k=e[t+14],S=e[t+15],P=o[0],I=o[1],T=o[2],O=o[3];P=u(P,I,T,O,a,7,s[0]),O=u(O,P,I,T,c,12,s[1]),T=u(T,O,P,I,h,17,s[2]),I=u(I,T,O,P,p,22,s[3]),P=u(P,I,T,O,m,7,s[4]),O=u(O,P,I,T,b,12,s[5]),T=u(T,O,P,I,g,17,s[6]),I=u(I,T,O,P,y,22,s[7]),P=u(P,I,T,O,v,7,s[8]),O=u(O,P,I,T,w,12,s[9]),T=u(T,O,P,I,E,17,s[10]),I=u(I,T,O,P,A,22,s[11]),P=u(P,I,T,O,x,7,s[12]),O=u(O,P,I,T,_,12,s[13]),T=u(T,O,P,I,k,17,s[14]),P=l(P,I=u(I,T,O,P,S,22,s[15]),T,O,c,5,s[16]),O=l(O,P,I,T,g,9,s[17]),T=l(T,O,P,I,A,14,s[18]),I=l(I,T,O,P,a,20,s[19]),P=l(P,I,T,O,b,5,s[20]),O=l(O,P,I,T,E,9,s[21]),T=l(T,O,P,I,S,14,s[22]),I=l(I,T,O,P,m,20,s[23]),P=l(P,I,T,O,w,5,s[24]),O=l(O,P,I,T,k,9,s[25]),T=l(T,O,P,I,p,14,s[26]),I=l(I,T,O,P,v,20,s[27]),P=l(P,I,T,O,_,5,s[28]),O=l(O,P,I,T,h,9,s[29]),T=l(T,O,P,I,y,14,s[30]),P=f(P,I=l(I,T,O,P,x,20,s[31]),T,O,b,4,s[32]),O=f(O,P,I,T,v,11,s[33]),T=f(T,O,P,I,A,16,s[34]),I=f(I,T,O,P,k,23,s[35]),P=f(P,I,T,O,c,4,s[36]),O=f(O,P,I,T,m,11,s[37]),T=f(T,O,P,I,y,16,s[38]),I=f(I,T,O,P,E,23,s[39]),P=f(P,I,T,O,_,4,s[40]),O=f(O,P,I,T,a,11,s[41]),T=f(T,O,P,I,p,16,s[42]),I=f(I,T,O,P,g,23,s[43]),P=f(P,I,T,O,w,4,s[44]),O=f(O,P,I,T,x,11,s[45]),T=f(T,O,P,I,S,16,s[46]),P=d(P,I=f(I,T,O,P,h,23,s[47]),T,O,a,6,s[48]),O=d(O,P,I,T,y,10,s[49]),T=d(T,O,P,I,k,15,s[50]),I=d(I,T,O,P,b,21,s[51]),P=d(P,I,T,O,x,6,s[52]),O=d(O,P,I,T,p,10,s[53]),T=d(T,O,P,I,E,15,s[54]),I=d(I,T,O,P,c,21,s[55]),P=d(P,I,T,O,v,6,s[56]),O=d(O,P,I,T,S,10,s[57]),T=d(T,O,P,I,g,15,s[58]),I=d(I,T,O,P,_,21,s[59]),P=d(P,I,T,O,m,6,s[60]),O=d(O,P,I,T,A,10,s[61]),T=d(T,O,P,I,h,15,s[62]),I=d(I,T,O,P,w,21,s[63]),o[0]=o[0]+P|0,o[1]=o[1]+I|0,o[2]=o[2]+T|0,o[3]=o[3]+O|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;r[i>>>5]|=128<<24-i%32;var o=e.floor(n/4294967296),a=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,c=s.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return s},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,r,n,i,o,a){var s=e+(t&r|~t&n)+i+a;return(s<>>32-o)+t}function l(e,t,r,n,i,o,a){var s=e+(t&n|r&~n)+i+a;return(s<>>32-o)+t}function f(e,t,r,n,i,o,a){var s=e+(t^r^n)+i+a;return(s<>>32-o)+t}function d(e,t,r,n,i,o,a){var s=e+(r^(t|~n))+i+a;return(s<>>32-o)+t}r.MD5=o._createHelper(c),r.HmacMD5=o._createHmacHelper(c)}(Math),t.MD5)}(SW)),SW.exports}var IW,TW={exports:{}};function OW(){return IW||(IW=1,function(e){var t;e.exports=(t=iW(),function(){var e=t,r=e.lib,n=r.WordArray,i=r.Hasher,o=e.algo,a=[],s=o.SHA1=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],c=r[4],u=0;u<80;u++){if(u<16)a[u]=0|e[t+u];else{var l=a[u-3]^a[u-8]^a[u-14]^a[u-16];a[u]=l<<1|l>>>31}var f=(n<<5|n>>>27)+c+a[u];f+=u<20?1518500249+(i&o|~i&s):u<40?1859775393+(i^o^s):u<60?(i&o|i&s|o&s)-1894007588:(i^o^s)-899497514,c=s,s=o,o=i<<30|i>>>2,i=n,n=f}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA1=i._createHelper(s),e.HmacSHA1=i._createHmacHelper(s)}(),t.SHA1)}(TW)),TW.exports}var MW,CW={exports:{}};var BW,NW={exports:{}};function RW(){return BW||(BW=1,function(e){var t;e.exports=(t=iW(),dW(),function(){var e=t,r=e.lib.Hasher,n=e.x64,i=n.Word,o=n.WordArray,a=e.algo;function s(){return i.create.apply(i,arguments)}var c=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],u=[];!function(){for(var e=0;e<80;e++)u[e]=s()}();var l=a.SHA512=r.extend({_doReset:function(){this._hash=new o.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],l=r[5],f=r[6],d=r[7],h=n.high,p=n.low,m=i.high,b=i.low,g=o.high,y=o.low,v=a.high,w=a.low,E=s.high,A=s.low,x=l.high,_=l.low,k=f.high,S=f.low,P=d.high,I=d.low,T=h,O=p,M=m,C=b,B=g,N=y,R=v,F=w,L=E,j=A,U=x,D=_,z=k,$=S,H=P,G=I,q=0;q<80;q++){var K,V,W=u[q];if(q<16)V=W.high=0|e[t+2*q],K=W.low=0|e[t+2*q+1];else{var J=u[q-15],Z=J.high,Y=J.low,X=(Z>>>1|Y<<31)^(Z>>>8|Y<<24)^Z>>>7,Q=(Y>>>1|Z<<31)^(Y>>>8|Z<<24)^(Y>>>7|Z<<25),ee=u[q-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ie=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),oe=u[q-7],ae=oe.high,se=oe.low,ce=u[q-16],ue=ce.high,le=ce.low;V=(V=(V=X+ae+((K=Q+se)>>>0>>0?1:0))+ne+((K+=ie)>>>0>>0?1:0))+ue+((K+=le)>>>0>>0?1:0),W.high=V,W.low=K}var fe,de=L&U^~L&z,he=j&D^~j&$,pe=T&M^T&B^M&B,me=O&C^O&N^C&N,be=(T>>>28|O<<4)^(T<<30|O>>>2)^(T<<25|O>>>7),ge=(O>>>28|T<<4)^(O<<30|T>>>2)^(O<<25|T>>>7),ye=(L>>>14|j<<18)^(L>>>18|j<<14)^(L<<23|j>>>9),ve=(j>>>14|L<<18)^(j>>>18|L<<14)^(j<<23|L>>>9),we=c[q],Ee=we.high,Ae=we.low,xe=H+ye+((fe=G+ve)>>>0>>0?1:0),_e=ge+me;H=z,G=$,z=U,$=D,U=L,D=j,L=R+(xe=(xe=(xe=xe+de+((fe+=he)>>>0>>0?1:0))+Ee+((fe+=Ae)>>>0>>0?1:0))+V+((fe+=K)>>>0>>0?1:0))+((j=F+fe|0)>>>0>>0?1:0)|0,R=B,F=N,B=M,N=C,M=T,C=O,T=xe+(be+pe+(_e>>>0>>0?1:0))+((O=fe+_e|0)>>>0>>0?1:0)|0}p=n.low=p+O,n.high=h+T+(p>>>0>>0?1:0),b=i.low=b+C,i.high=m+M+(b>>>0>>0?1:0),y=o.low=y+N,o.high=g+B+(y>>>0>>0?1:0),w=a.low=w+F,a.high=v+R+(w>>>0>>0?1:0),A=s.low=A+j,s.high=E+L+(A>>>0>>0?1:0),_=l.low=_+D,l.high=x+U+(_>>>0>>0?1:0),S=f.low=S+$,f.high=k+z+(S>>>0<$>>>0?1:0),I=d.low=I+G,d.high=P+H+(I>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=r._createHelper(l),e.HmacSHA512=r._createHmacHelper(l)}(),t.SHA512)}(NW)),NW.exports}var FW,LW={exports:{}};var jW,UW={exports:{}};function DW(){return jW||(jW=1,function(e){var t;e.exports=(t=iW(),dW(),function(e){var r=t,n=r.lib,i=n.WordArray,o=n.Hasher,a=r.x64.Word,s=r.algo,c=[],u=[],l=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)u[e+5*t]=t+(2*e+3*t)%5*5;for(var i=1,o=0;o<24;o++){for(var s=0,f=0,d=0;d<7;d++){if(1&i){var h=(1<>>24)|4278255360&(o<<24|o>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(I=r[i]).high^=a,I.low^=o}for(var s=0;s<24;s++){for(var d=0;d<5;d++){for(var h=0,p=0,m=0;m<5;m++)h^=(I=r[d+5*m]).high,p^=I.low;var b=f[d];b.high=h,b.low=p}for(d=0;d<5;d++){var g=f[(d+4)%5],y=f[(d+1)%5],v=y.high,w=y.low;for(h=g.high^(v<<1|w>>>31),p=g.low^(w<<1|v>>>31),m=0;m<5;m++)(I=r[d+5*m]).high^=h,I.low^=p}for(var E=1;E<25;E++){var A=(I=r[E]).high,x=I.low,_=c[E];_<32?(h=A<<_|x>>>32-_,p=x<<_|A>>>32-_):(h=x<<_-32|A>>>64-_,p=A<<_-32|x>>>64-_);var k=f[u[E]];k.high=h,k.low=p}var S=f[0],P=r[0];for(S.high=P.high,S.low=P.low,d=0;d<5;d++)for(m=0;m<5;m++){var I=r[E=d+5*m],T=f[E],O=f[(d+1)%5+5*m],M=f[(d+2)%5+5*m];I.high=T.high^~O.high&M.high,I.low=T.low^~O.low&M.low}I=r[0];var C=l[s];I.high^=C.high,I.low^=C.low}},_doFinalize:function(){var t=this._data,r=t.words;this._nDataBytes;var n=8*t.sigBytes,o=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(e.ceil((n+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,c=s/8,u=[],l=0;l>>24)|4278255360&(d<<24|d>>>8),h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),u.push(h),u.push(d)}return new i.init(u,s)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});r.SHA3=o._createHelper(d),r.HmacSHA3=o._createHmacHelper(d)}(Math),t.SHA3)}(UW)),UW.exports}var zW,$W={exports:{}};var HW,GW={exports:{}};function qW(){return HW||(HW=1,function(e){var t;e.exports=(t=iW(),void function(){var e=t,r=e.lib.Base,n=e.enc.Utf8;e.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),a=this._iKey=t.clone(),s=o.words,c=a.words,u=0;u>>2];e.sigBytes-=t}};n.BlockCipher=l.extend({cfg:l.cfg.extend({mode:h,padding:p}),reset:function(){var e;l.reset.call(this);var t=this.cfg,r=t.iv,n=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=n.createEncryptor:(e=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(n,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=n.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),b=(r.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?o.create([1398893684,1701076831]).concat(r).concat(t):t).toString(c)},parse:function(e){var t,r=c.parse(e),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(t=o.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),m.create({ciphertext:r,salt:t})}},g=n.SerializableCipher=i.extend({cfg:i.extend({format:b}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),o=i.finalize(t),a=i.cfg;return m.create({ciphertext:o,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(r.kdf={}).OpenSSL={execute:function(e,t,r,n,i){if(n||(n=o.random(8)),i)a=u.create({keySize:t+r,hasher:i}).compute(e,n);else var a=u.create({keySize:t+r}).compute(e,n);var s=o.create(a.words.slice(t),4*r);return a.sigBytes=4*t,m.create({key:a,iv:s,salt:n})}},v=n.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize,n.salt,n.hasher);n.iv=i.iv;var o=g.encrypt.call(this,e,t,i.key,n);return o.mixIn(i),o},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt,n.hasher);return n.iv=i.iv,g.decrypt.call(this,e,t,i.key,n)}})}()))}(XW)),XW.exports}var eJ,tJ={exports:{}};function rJ(){return eJ||(eJ=1,function(e){var t;e.exports=(t=iW(),QW(),t.mode.CFB=function(){var e=t.lib.BlockCipherMode.extend();function r(e,t,r,n){var i,o=this._iv;o?(i=o.slice(0),this._iv=void 0):i=this._prevBlock,n.encryptBlock(i,0);for(var a=0;a>24))e+=1<<24;else{var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}return e}function n(e){return 0===(e[0]=r(e[0]))&&(e[1]=r(e[1])),e}var i=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,o=this._iv,a=this._counter;o&&(a=this._counter=o.slice(0),this._iv=void 0),n(a);var s=a.slice(0);r.encryptBlock(s,0);for(var c=0;c>>5]>>>31-n%32&1}for(var i=this._subKeys=[],o=0;o<16;o++){var u=i[o]=[],l=c[o];for(r=0;r<24;r++)u[r/6|0]|=t[(s[r]-1+l)%28]<<31-r%6,u[4+(r/6|0)]|=t[28+(s[r+24]-1+l)%28]<<31-r%6;for(u[0]=u[0]<<1|u[0]>>>31,r=1;r<7;r++)u[r]=u[r]>>>4*(r-1)+3;u[7]=u[7]<<5|u[7]>>>27}var f=this._invSubKeys=[];for(r=0;r<16;r++)f[r]=i[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],d.call(this,4,252645135),d.call(this,16,65535),h.call(this,2,858993459),h.call(this,8,16711935),d.call(this,1,1431655765);for(var n=0;n<16;n++){for(var i=r[n],o=this._lBlock,a=this._rBlock,s=0,c=0;c<8;c++)s|=u[c][((a^i[c])&l[c])>>>0];this._lBlock=a,this._rBlock=o^s}var f=this._lBlock;this._lBlock=this._rBlock,this._rBlock=f,d.call(this,1,1431655765),h.call(this,8,16711935),h.call(this,2,858993459),d.call(this,16,65535),d.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function d(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),i=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=f.createEncryptor(n.create(t)),this._des2=f.createEncryptor(n.create(r)),this._des3=f.createEncryptor(n.create(i))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=i._createHelper(p)}(),t.TripleDES)}(TJ)),TJ.exports}var MJ,CJ={exports:{}};var BJ,NJ={exports:{}};var RJ,FJ={exports:{}};var LJ,jJ={exports:{}};function UJ(){return LJ||(LJ=1,function(e){var t;e.exports=(t=iW(),EW(),PW(),ZW(),QW(),function(){var e=t,r=e.lib.BlockCipher,n=e.algo;const i=16,o=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var s={pbox:[],sbox:[]};function c(e,t){let r=t>>24&255,n=t>>16&255,i=t>>8&255,o=255&t,a=e.sbox[0][r]+e.sbox[1][n];return a^=e.sbox[2][i],a+=e.sbox[3][o],a}function u(e,t,r){let n,o=t,a=r;for(let t=0;t1;--t)o^=e.pbox[t],a=c(e,o)^a,n=o,o=a,a=n;return n=o,o=a,a=n,a^=e.pbox[1],o^=e.pbox[0],{left:o,right:a}}function f(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=a[t][r]}let n=0;for(let a=0;a=r&&(n=0);let s=0,c=0,l=0;for(let t=0;t>>24)|4278255360&(i<<24|i>>>8)}var o,d,v,w,E,A,x,_,k,S,P,I=this._hash.words,T=l.words,O=f.words,M=a.words,C=s.words,B=c.words,N=u.words;for(A=o=I[0],x=d=I[1],_=v=I[2],k=w=I[3],S=E=I[4],r=0;r<80;r+=1)P=o+e[t+M[r]]|0,P+=r<16?h(d,v,w)+T[0]:r<32?p(d,v,w)+T[1]:r<48?m(d,v,w)+T[2]:r<64?b(d,v,w)+T[3]:g(d,v,w)+T[4],P=(P=y(P|=0,B[r]))+E|0,o=E,E=w,w=y(v,10),v=d,d=P,P=A+e[t+C[r]]|0,P+=r<16?g(x,_,k)+O[0]:r<32?b(x,_,k)+O[1]:r<48?m(x,_,k)+O[2]:r<64?p(x,_,k)+O[3]:h(x,_,k)+O[4],P=(P=y(P|=0,N[r]))+S|0,A=S,S=k,k=y(_,10),_=x,x=P;P=I[1]+v+k|0,I[1]=I[2]+w+S|0,I[2]=I[3]+E+A|0,I[3]=I[4]+o+x|0,I[4]=I[0]+d+_|0,I[0]=P},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var i=this._hash,o=i.words,a=0;a<5;a++){var s=o[a];o[a]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return i},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function h(e,t,r){return e^t^r}function p(e,t,r){return e&t|~e&r}function m(e,t,r){return(e|~t)^r}function b(e,t,r){return e&r|t&~r}function g(e,t,r){return e^(t|~r)}function y(e,t){return e<>>32-t}e.RIPEMD160=i._createHelper(d),e.HmacRIPEMD160=i._createHmacHelper(d)}(),t.RIPEMD160)}($W)),qW(),KW||(KW=1,function(e){var t;e.exports=(t=iW(),qW(),function(){var e=t,r=e.lib,n=r.Base,i=r.WordArray,o=e.algo,a=o.SHA256,s=o.HMAC,c=o.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:a,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=s.create(r.hasher,e),o=i.create(),a=i.create([1]),c=o.words,u=a.words,l=r.keySize,f=r.iterations;c.length>>2]|=i<<24-o%4*8,e.sigBytes+=i},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},t.pad.Ansix923)}(mJ)),bJ||(bJ=1,function(e){var t;e.exports=(t=iW(),QW(),t.pad.Iso10126={pad:function(e,r){var n=4*r,i=n-e.sigBytes%n;e.concat(t.lib.WordArray.random(i-1)).concat(t.lib.WordArray.create([i<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},t.pad.Iso10126)}(gJ)),yJ||(yJ=1,function(e){var t;e.exports=(t=iW(),QW(),t.pad.Iso97971={pad:function(e,r){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,r)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971)}(vJ)),wJ||(wJ=1,function(e){var t;e.exports=(t=iW(),QW(),t.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},t.pad.ZeroPadding)}(EJ)),AJ||(AJ=1,function(e){var t;e.exports=(t=iW(),QW(),t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding)}(xJ)),_J||(_J=1,function(e){var t,r,n,i;e.exports=(i=iW(),QW(),r=(t=i).lib.CipherParams,n=t.enc.Hex,t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return r.create({ciphertext:t})}},i.format.Hex)}(kJ)),SJ||(SJ=1,function(e){var t;e.exports=(t=iW(),EW(),PW(),ZW(),QW(),function(){var e=t,r=e.lib.BlockCipher,n=e.algo,i=[],o=[],a=[],s=[],c=[],u=[],l=[],f=[],d=[],h=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var p=n^n<<1^n<<2^n<<3^n<<4;p=p>>>8^255&p^99,i[r]=p,o[p]=r;var m=e[r],b=e[m],g=e[b],y=257*e[p]^16843008*p;a[r]=y<<24|y>>>8,s[r]=y<<16|y>>>16,c[r]=y<<8|y>>>24,u[r]=y,y=16843009*g^65537*b^257*m^16843008*r,l[p]=y<<24|y>>>8,f[p]=y<<16|y>>>16,d[p]=y<<8|y>>>24,h[p]=y,r?(r=m^e[e[e[g^m]]],n^=e[e[n]]):r=n=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=n.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),o=this._keySchedule=[],a=0;a6&&a%r==4&&(u=i[u>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u]):(u=i[(u=u<<8|u>>>24)>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u],u^=p[a/r|0]<<24),o[a]=o[a-r]^u);for(var s=this._invKeySchedule=[],c=0;c>>24]]^f[i[u>>>16&255]]^d[i[u>>>8&255]]^h[i[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,c,u,i)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,l,f,d,h,o),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,i,o,a,s){for(var c=this._nRounds,u=e[t]^r[0],l=e[t+1]^r[1],f=e[t+2]^r[2],d=e[t+3]^r[3],h=4,p=1;p>>24]^i[l>>>16&255]^o[f>>>8&255]^a[255&d]^r[h++],b=n[l>>>24]^i[f>>>16&255]^o[d>>>8&255]^a[255&u]^r[h++],g=n[f>>>24]^i[d>>>16&255]^o[u>>>8&255]^a[255&l]^r[h++],y=n[d>>>24]^i[u>>>16&255]^o[l>>>8&255]^a[255&f]^r[h++];u=m,l=b,f=g,d=y}m=(s[u>>>24]<<24|s[l>>>16&255]<<16|s[f>>>8&255]<<8|s[255&d])^r[h++],b=(s[l>>>24]<<24|s[f>>>16&255]<<16|s[d>>>8&255]<<8|s[255&u])^r[h++],g=(s[f>>>24]<<24|s[d>>>16&255]<<16|s[u>>>8&255]<<8|s[255&l])^r[h++],y=(s[d>>>24]<<24|s[u>>>16&255]<<16|s[l>>>8&255]<<8|s[255&f])^r[h++],e[t]=m,e[t+1]=b,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=r._createHelper(m)}(),t.AES)}(PJ)),OJ(),MJ||(MJ=1,function(e){var t;e.exports=(t=iW(),EW(),PW(),ZW(),QW(),function(){var e=t,r=e.lib.StreamCipher,n=e.algo,i=n.RC4=r.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,n=this._S=[],i=0;i<256;i++)n[i]=i;i=0;for(var o=0;i<256;i++){var a=i%r,s=t[a>>>2]>>>24-a%4*8&255;o=(o+n[i]+s)%256;var c=n[i];n[i]=n[o],n[o]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,r=this._j,n=0,i=0;i<4;i++){r=(r+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[r],e[r]=o,n|=e[(e[t]+e[r])%256]<<24-8*i}return this._i=t,this._j=r,n}e.RC4=r._createHelper(i);var a=n.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});e.RC4Drop=r._createHelper(a)}(),t.RC4)}(CJ)),BJ||(BJ=1,function(e){var t;e.exports=(t=iW(),EW(),PW(),ZW(),QW(),function(){var e=t,r=e.lib.StreamCipher,n=e.algo,i=[],o=[],a=[],s=n.Rabbit=r.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(t){var o=t.words,a=o[0],s=o[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),f=u>>>16|4294901760&l,d=l<<16|65535&u;for(i[0]^=u,i[1]^=f,i[2]^=l,i[3]^=d,i[4]^=u,i[5]^=f,i[6]^=l,i[7]^=d,r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=16711935&(i[n]<<8|i[n]>>>24)|4278255360&(i[n]<<24|i[n]>>>8),e[t+n]^=i[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)o[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],i=65535&n,s=n>>>16,c=((i*i>>>17)+i*s>>>15)+s*s,u=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^u}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=r._createHelper(s)}(),t.Rabbit)}(NJ)),RJ||(RJ=1,function(e){var t;e.exports=(t=iW(),EW(),PW(),ZW(),QW(),function(){var e=t,r=e.lib.StreamCipher,n=e.algo,i=[],o=[],a=[],s=n.RabbitLegacy=r.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var i=0;i<4;i++)c.call(this);for(i=0;i<8;i++)n[i]^=r[i+4&7];if(t){var o=t.words,a=o[0],s=o[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),f=u>>>16|4294901760&l,d=l<<16|65535&u;for(n[0]^=u,n[1]^=f,n[2]^=l,n[3]^=d,n[4]^=u,n[5]^=f,n[6]^=l,n[7]^=d,i=0;i<4;i++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=16711935&(i[n]<<8|i[n]>>>24)|4278255360&(i[n]<<24|i[n]>>>8),e[t+n]^=i[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)o[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],i=65535&n,s=n>>>16,c=((i*i>>>17)+i*s>>>15)+s*s,u=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^u}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=r._createHelper(s)}(),t.RabbitLegacy)}(FJ)),UJ(),t)}(lW);var DJ=lW.exports,zJ=o&&o.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(uW,"__esModule",{value:!0}),uW.Base=void 0;const $J=fe,HJ=zJ(DJ);class GJ{print(){GJ.print(this)}bufferIndexOf(e,t,r=!1){if(r)return this.binarySearch(e,t,$J.Buffer.compare);return this.linearSearch(e,t,((e,t)=>e.equals(t)))}static binarySearch(e,t,r){let n=0,i=e.length-1;for(;n<=i;){const o=Math.floor((n+i)/2),a=r(e[o],t);if(0===a){for(let n=o-1;n>=0;n--)if(0!==r(e[n],t))return n+1;return 0}a<0?n=o+1:i=o-1}return-1}binarySearch(e,t,r){return GJ.binarySearch(e,t,r)}static linearSearch(e,t,r){for(let n=0;n{const r=e(t);return $J.Buffer.isBuffer(r)?r:this.isHexString(r)?$J.Buffer.from(r.replace("0x",""),"hex"):"string"==typeof r?$J.Buffer.from(r):"bigint"==typeof r?$J.Buffer.from(t.toString(16),"hex"):ArrayBuffer.isView(r)?$J.Buffer.from(r.buffer,r.byteOffset,r.byteLength):$J.Buffer.from(e(HJ.default.enc.Hex.parse(t.toString("hex"))).toString(HJ.default.enc.Hex),"hex")}}isHexString(e){return GJ.isHexString(e)}log2(e){return 1===e?0:1+this.log2(e/2|0)}zip(e,t){return e.map(((e,r)=>[e,t[r]]))}static hexZeroPad(e,t){return"0x"+e.replace("0x","").padStart(t,"0")}}uW.Base=GJ,uW.default=GJ;var qJ=o&&o.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(QV,"__esModule",{value:!0}),QV.MerkleTree=void 0;const KJ=fe,VJ=qJ((function(e){for(var t=new _(e.length),r=0,n=e.length-1;r<=n;++r,--n)t[r]=e[n],t[n]=e[r];return t})),WJ=qJ(oW),JJ=qJ(cW),ZJ=qJ(uW);class YJ extends ZJ.default{constructor(e,t=WJ.default,r={}){if(super(),this.duplicateOdd=!1,this.concatenator=KJ.Buffer.concat,this.hashLeaves=!1,this.isBitcoinTree=!1,this.leaves=[],this.layers=[],this.sortLeaves=!1,this.sortPairs=!1,this.sort=!1,this.fillDefaultHash=null,this.complete=!1,r.complete){if(r.isBitcoinTree)throw new Error('option "complete" is incompatible with "isBitcoinTree"');if(r.duplicateOdd)throw new Error('option "complete" is incompatible with "duplicateOdd"')}if(this.isBitcoinTree=!!r.isBitcoinTree,this.hashLeaves=!!r.hashLeaves,this.sortLeaves=!!r.sortLeaves,this.sortPairs=!!r.sortPairs,this.complete=!!r.complete,r.fillDefaultHash)if("function"==typeof r.fillDefaultHash)this.fillDefaultHash=r.fillDefaultHash;else{if(!KJ.Buffer.isBuffer(r.fillDefaultHash)&&"string"!=typeof r.fillDefaultHash)throw new Error('method "fillDefaultHash" must be a function, Buffer, or string');this.fillDefaultHash=(e,t)=>r.fillDefaultHash}this.sort=!!r.sort,this.sort&&(this.sortLeaves=!0,this.sortPairs=!0),this.duplicateOdd=!!r.duplicateOdd,r.concatenator&&(this.concatenator=r.concatenator),this.hashFn=this.bufferifyFn(t),this.processLeaves(e)}getOptions(){var e,t;return{complete:this.complete,isBitcoinTree:this.isBitcoinTree,hashLeaves:this.hashLeaves,sortLeaves:this.sortLeaves,sortPairs:this.sortPairs,sort:this.sort,fillDefaultHash:null!==(t=null===(e=this.fillDefaultHash)||void 0===e?void 0:e.toString())&&void 0!==t?t:null,duplicateOdd:this.duplicateOdd}}processLeaves(e){if(this.hashLeaves&&(e=e.map(this.hashFn)),this.leaves=e.map(this.bufferify),this.sortLeaves&&(this.leaves=this.leaves.sort(KJ.Buffer.compare)),this.fillDefaultHash)for(let e=this.leaves.length;e1;){const t=this.layers.length;this.layers.push([]);const r=this.complete&&1===t&&!Number.isInteger(Math.log2(e.length))?2*e.length-Math.pow(2,Math.ceil(Math.log2(e.length))):e.length;for(let n=0;n=r){this.layers[t].push(...e.slice(r));break}if(n+1===e.length&&e.length%2==1){const r=e[e.length-1];let i=r;if(this.isBitcoinTree){i=this.hashFn(this.concatenator([VJ.default(r),VJ.default(r)])),i=VJ.default(this.hashFn(i)),this.layers[t].push(i);continue}if(!this.duplicateOdd){this.layers[t].push(e[n]);continue}}const i=e[n],o=n+1===e.length?i:e[n+1];let a=null;a=this.isBitcoinTree?[VJ.default(i),VJ.default(o)]:[i,o],this.sortPairs&&a.sort(KJ.Buffer.compare);let s=this.hashFn(this.concatenator(a));this.isBitcoinTree&&(s=VJ.default(this.hashFn(s))),this.layers[t].push(s)}e=this.layers[t]}}addLeaf(e,t=!1){t&&(e=this.hashFn(e)),this.processLeaves(this.leaves.concat(e))}addLeaves(e,t=!1){t&&(e=e.map(this.hashFn)),this.processLeaves(this.leaves.concat(e))}getLeaves(e){return Array.isArray(e)?(this.hashLeaves&&(e=e.map(this.hashFn),this.sortLeaves&&(e=e.sort(KJ.Buffer.compare))),this.leaves.filter((t=>-1!==this.bufferIndexOf(e,t,this.sortLeaves)))):this.leaves}getLeaf(e){return e<0||e>this.leaves.length-1?KJ.Buffer.from([]):this.leaves[e]}getLeafIndex(e){e=this.bufferify(e);const t=this.getLeaves();for(let r=0;rthis.bufferToHex(e)))}static marshalLeaves(e){return JSON.stringify(e.map((e=>YJ.bufferToHex(e))),null,2)}static unmarshalLeaves(e){let t=null;if("string"==typeof e)t=JSON.parse(e);else{if(!(e instanceof Object))throw new Error("Expected type of string or object");t=e}if(!t)return[];if(!Array.isArray(t))throw new Error("Expected JSON string to be array");return t.map(YJ.bufferify)}getLayers(){return this.layers}getHexLayers(){return this.layers.reduce(((e,t)=>(Array.isArray(t)?e.push(t.map((e=>this.bufferToHex(e)))):e.push(t),e)),[])}getLayersFlat(){const e=this.layers.reduce(((e,t)=>(Array.isArray(t)?e.unshift(...t):e.unshift(t),e)),[]);return e.unshift(KJ.Buffer.from([0])),e}getHexLayersFlat(){return this.getLayersFlat().map((e=>this.bufferToHex(e)))}getLayerCount(){return this.getLayers().length}getRoot(){return 0===this.layers.length?KJ.Buffer.from([]):this.layers[this.layers.length-1][0]||KJ.Buffer.from([])}getHexRoot(){return this.bufferToHex(this.getRoot())}getProof(e,t){if(void 0===e)throw new Error("leaf is required");e=this.bufferify(e);const r=[];if(!Number.isInteger(t)){t=-1;for(let r=0;rthis.bufferToHex(e.data)))}getProofs(){const e=[];return this.getProofsDFS(this.layers.length-1,0,[],e),e}getProofsDFS(e,t,r,n){const i=t%2;if(-1===e)return void(i||n.push([...r].reverse()));if(t>=this.layers[e].length)return;const o=this.layers[e],a=i?t-1:t+1;let s=!1;athis.bufferToHex(e.data)))}getPositionalHexProof(e,t){return this.getProof(e,t).map((e=>["left"===e.position?0:1,this.bufferToHex(e.data)]))}static marshalProof(e){const t=e.map((e=>"string"==typeof e?e:KJ.Buffer.isBuffer(e)?YJ.bufferToHex(e):{position:e.position,data:YJ.bufferToHex(e.data)}));return JSON.stringify(t,null,2)}static unmarshalProof(e){let t=null;if("string"==typeof e)t=JSON.parse(e);else{if(!(e instanceof Object))throw new Error("Expected type of string or object");t=e}if(!t)return[];if(!Array.isArray(t))throw new Error("Expected JSON string to be array");return t.map((e=>{if("string"==typeof e)return YJ.bufferify(e);if(e instanceof Object)return{position:e.position,data:YJ.bufferify(e.data)};throw new Error("Expected item to be of type string or object")}))}static marshalTree(e){const t=e.getHexRoot(),r=e.leaves.map((e=>YJ.bufferToHex(e))),n=e.getHexLayers(),i=e.getOptions();return JSON.stringify({options:i,root:t,layers:n,leaves:r},null,2)}static unmarshalTree(e,t=WJ.default,r={}){let n=null;if("string"==typeof e)n=JSON.parse(e);else{if(!(e instanceof Object))throw new Error("Expected type of string or object");n=e}if(!n)throw new Error("could not parse json");return r=Object.assign({},n.options||{},r),new YJ(n.leaves,t,r)}getProofIndices(e,t){const r=Math.pow(2,t);let n=new Set;for(const t of e){let e=r+t;for(;e>1;)n.add(1^e),e=e/2|0}const i=e.map((e=>r+e)),o=Array.from(n).sort(((e,t)=>e-t)).reverse();n=i.concat(o);const a=new Set,s=[];for(let e of n)if(!a.has(e))for(s.push(e);e>1&&(a.add(e),a.has(1^e));)e=e/2|0;return s.filter((t=>!e.includes(t-r)))}getProofIndicesForUnevenTree(e,t){const r=Math.ceil(Math.log2(t)),n=[];for(let e=0;ee%2==0?e+1:e-1));let r=t.filter((e=>!o.includes(e)));const a=n.find((({index:t})=>t===e));a&&o.includes(a.leavesCount-1)&&(r=r.slice(0,-1)),i.push(r),o=[...new Set(o.map((e=>e%2==0?e/2:e%2==0?(e+1)/2:(e-1)/2)))]}return i}getMultiProof(e,t){this.complete||console.warn("Warning: For correct multiProofs it's strongly recommended to set complete: true"),t||(t=e,e=this.getLayersFlat());if(this.isUnevenTree()&&t.every(Number.isInteger))return this.getMultiProofForUnevenTree(t);if(!t.every(Number.isInteger)){let e=t;this.sortPairs&&(e=e.sort(KJ.Buffer.compare));let r=e.map((e=>this.bufferIndexOf(this.leaves,e,this.sortLeaves))).sort(((e,t)=>e===t?0:e>t?1:-1));if(!r.every((e=>-1!==e)))throw new Error("Element does not exist in Merkle tree");const n=[],i=[];let o=[];for(let e=0;er.indexOf(e)===t)),o=[]}return i.filter((e=>!n.includes(e)))}return this.getProofIndices(t,Math.log2(e.length/2|0)).map((t=>e[t]))}getMultiProofForUnevenTree(e,t){t||(t=e,e=this.getLayers());let r=[],n=t;for(const t of e){const e=[];for(const r of n){if(r%2==0){const i=r+1;if(!n.includes(i)&&t[i]){e.push(t[i]);continue}}const i=r-1;n.includes(i)||!t[i]||e.push(t[i])}r=r.concat(e);const i=new Set;for(const e of n)e%2!=0?e%2!=0?i.add((e-1)/2):i.add((e+1)/2):i.add(e/2);n=Array.from(i)}return r}getHexMultiProof(e,t){return this.getMultiProof(e,t).map((e=>this.bufferToHex(e)))}getProofFlags(e,t){if(!Array.isArray(e)||e.length<=0)throw new Error("Invalid Inputs!");let r;if(r=e.every(Number.isInteger)?[...e].sort(((e,t)=>e===t?0:e>t?1:-1)):e.map((e=>this.bufferIndexOf(this.leaves,e,this.sortLeaves))).sort(((e,t)=>e===t?0:e>t?1:-1)),!r.every((e=>-1!==e)))throw new Error("Element does not exist in Merkle tree");const n=t.map((e=>this.bufferify(e))),i=[],o=[];for(let e=0;e{if(!i.includes(t[r])){const e=this.getPairNode(t,r),a=n.includes(t[r])||n.includes(e);e&&o.push(!a),i.push(t[r]),i.push(e)}return e.push(r/2|0),e}),[])}return o}verify(e,t,r){let n=this.bufferify(t);if(r=this.bufferify(r),!Array.isArray(e)||!t||!r)return!1;for(let t=0;tthis.bufferify(e))),i=i.map((e=>this.bufferify(e)));const a={};for(const[e,n]of this.zip(t,r))a[Math.pow(2,o)+e]=n;for(const[e,r]of this.zip(this.getProofIndices(t,o),i))a[e]=r;let s=Object.keys(a).map((e=>+e)).sort(((e,t)=>e-t));s=s.slice(0,s.length-1);let c=0;for(;c=2&&{}.hasOwnProperty.call(a,1^e)){let t=[a[e-e%2],a[e-e%2+1]];this.sortPairs&&(t=t.sort(KJ.Buffer.compare));const r=t[1]?this.hashFn(this.concatenator(t)):t[0];a[e/2|0]=r,s.push(e/2|0)}c+=1}return!t.length||{}.hasOwnProperty.call(a,1)&&a[1].equals(e)}verifyMultiProofWithFlags(e,t,r,n){e=this.bufferify(e),t=t.map(this.bufferify),r=r.map(this.bufferify);const i=t.length,o=n.length,a=[];let s=0,c=0,u=0;for(let e=0;ethis.bufferify(e))),i=i.map((e=>this.bufferify(e)));const o=this.calculateRootForUnevenTree(t,r,n,i);return e.equals(o)}getDepth(){return this.getLayers().length-1}getLayersAsObject(){const e=this.getLayers().map((e=>e.map((e=>this.bufferToHex(e,!1))))),t=[];for(let r=0;re-t)),o=i.map((([e])=>e)),a=this.getProofIndicesForUnevenTree(o,r);let s=0;const c=[];for(let e=0;ee-t)).map((([,e])=>e)),r=u[e].map((([e])=>e)),n=[...new Set(r.map((e=>e%2==0?e/2:e%2==0?(e+1)/2:(e-1)/2)))],i=[];for(let e=0;e0&&!(e&1<=t));o--);if(n!==r.length)throw new Error("invalid bit calculation");return r}numOfPeaks(e){let t=e,r=0;for(;t>0;)t%2==1&&r++,t>>=1;return r}peakBagging(e,t){const r=this.getSize(e);if(this.numOfPeaks(e)!==t.length)throw new Error("received invalid number of peaks");return 0!==e||t.length?this.peakBaggingFn?this.bufferify(this.peakBaggingFn(r,t)):this.hashFn(eZ.Buffer.concat([this.bufferify(r),...t.map(this.bufferify)])):eZ.Buffer.alloc(0)}getSize(e){return(e<<1)-this.numOfPeaks(e)}getRoot(){return this.root}getHexRoot(){return this.bufferToHex(this.getRoot())}getNode(e){return this.hashes[e]}mountainHeight(e){let t=1;for(;1<r;)t-=(1<this.size)throw new Error("out of range");if(!this.isLeaf(e))throw new Error("not a leaf");const t=this.root,r=this.width,n=this.getPeakIndexes(this.width),i=[];let o=0;for(let t=0;t=e&&0===o&&(o=n[t]);let a=0,s=0,c=this.heightAt(o);const u=[];for(;o!==e;)c--,[a,s]=this.getChildren(o),o=e<=a?a:s,u[c-1]=this.hashes[e<=a?s:a];return{root:t,width:r,peakBagging:i,siblings:u}}verify(e,t,r,n,i,o){n=this.bufferify(n);if(this.getSize(t)=r){a=i[e],s=c[e];break}if(!a)throw new Error("target not found");let u=o.length+1;const l=new Array(u);let f,d=0,h=0;for(;u>0&&(l[--u]=s,s!==r);)[d,h]=this.getChildren(s),s=r>d?h:d;for(;uthis.size)throw new Error("out of range");if(!this.hashes[e]){const[t,r]=this.getChildren(e),n=this._getOrCreateNode(t),i=this._getOrCreateNode(r);this.hashes[e]=this.hashBranch(e,n,i)}return this.hashes[e]}}XJ.MerkleMountainRange=nZ,"undefined"!=typeof window&&(window.MerkleMountainRange=nZ),XJ.default=nZ;var iZ={},oZ=o&&o.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(iZ,"__esModule",{value:!0}),iZ.IncrementalMerkleTree=void 0;const aZ=oZ(uW),sZ=oZ(cW);class cZ extends aZ.default{constructor(e,t){if(super(),this.hashFn=e,t.depth&&(this.depth=t.depth),t.arity&&(this.arity=t.arity),this.depth<1)throw new Error("depth must be greater than 0");if(this.arity<1)throw new Error("arity must be greater than 0");const r=[];let n=t.zeroValue;if(this.zeroValue=n,this.zeroes=[],this.depth)for(let e=0;e=this.getMaxLeaves())throw new Error("tree is full");let t=e,r=this.nodes[0].length;for(let e=0;e=this.nodes[0].length)throw new Error("out of bounds");let r=t;for(let t=0;tBigInt(e)))}getLayers(){const e=[];for(const t of this.nodes)e.push(this.copyList(t));if(e[0].length=e[r].length&&(e[r][t]=this.zeroes[r]);t=Math.floor(t/this.arity)}}return e.push([this.root]),e}getHexLayers(){return this.getLayers().reduce(((e,t)=>(Array.isArray(t)?e.push(t.map((e=>this.bufferToHex(this.bufferify(e))))):e.push(t),e)),[])}getLayersAsObject(){const e=this.getLayers().map((e=>e.map((e=>this.bufferToHex(this.bufferify(e),!1))))),t=[];for(let r=0;r=this.nodes[0].length)throw new Error("The leaf does not exist in this tree");const t=[],r=[],n=e;for(let n=0;nBigInt(e))),this.data=r}getBucket(){let e;return e=this.data?this.hashFn(this.data):_.alloc(32),new fZ(BigInt(this.rng[1])-BigInt(this.rng[0]),e)}};class dZ{constructor(e,t){this.bucket=e,this.right=t}}uZ.ProofStep=dZ;class hZ extends lZ.Base{constructor(e,t){super(),this.leaves=e,this.hashFn=t,hZ.checkConsecutive(e),this.buckets=[];for(const t of e)this.buckets.push(t.getBucket());let r=[];for(const e of this.buckets)r.push(e);for(;1!==r.length;){const e=[];for(;r.length;)if(r.length>=2){const t=r.shift(),n=r.shift(),i=t.size+n.size,o=this.hashFn(_.concat([this.sizeToBuffer(t.size),this.bufferify(t.hashed),this.sizeToBuffer(n.size),this.bufferify(n.hashed)])),a=new fZ(i,o);n.parent=a,t.parent=n.parent,t.right=n,n.left=t,e.push(a)}else e.push(r.shift());r=e}this.root=r[0]}sizeToBuffer(e){const t=_.alloc(8);return new DataView(t.buffer).setBigInt64(0,BigInt(e),!1),t}static checkConsecutive(e){let t=BigInt(0);for(const r of e){if(r.rng[0]!==t)throw new Error("leaf ranges are invalid");t=BigInt(r.rng[1])}}getProof(e){let t=this.buckets[Number(e)];const r=[];for(;t&&t.parent;){const e=!!t.right,n=t.right?t.right:t.left;t=t.parent,r.push(new dZ(n,e))}return r}sum(e){let t=BigInt(0);for(const r of e)t+=BigInt(r);return t}verifyProof(e,t,r){const n=[this.sum(r.filter((e=>!e.right)).map((e=>e.bucket.size))),BigInt(e.size)-this.sum(r.filter((e=>e.right)).map((e=>e.bucket.size)))];if(n[0]!==t.rng[0]||n[1]!==t.rng[1])return!1;let i,o=t.getBucket();for(const e of r)i=e.right?this.hashFn(_.concat([this.sizeToBuffer(o.size),this.bufferify(o.hashed),this.sizeToBuffer(e.bucket.size),this.bufferify(e.bucket.hashed)])):this.hashFn(_.concat([this.sizeToBuffer(e.bucket.size),this.bufferify(e.bucket.hashed),this.sizeToBuffer(o.size),this.bufferify(o.hashed)])),o=new fZ(BigInt(o.size)+BigInt(e.bucket.size),i);return o.size===e.size&&o.hashed.toString("hex")===e.hashed.toString("hex")}}uZ.MerkleSumTree=hZ,"undefined"!=typeof window&&(window.MerkleSumTree=hZ),uZ.default=hZ,function(e){var t=o&&o.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.MerkleTree=void 0;const r=t(QV);e.MerkleTree=r.default;var n=XJ;Object.defineProperty(e,"MerkleMountainRange",{enumerable:!0,get:function(){return n.MerkleMountainRange}});var i=iZ;Object.defineProperty(e,"IncrementalMerkleTree",{enumerable:!0,get:function(){return i.IncrementalMerkleTree}});var a=uZ;Object.defineProperty(e,"MerkleSumTree",{enumerable:!0,get:function(){return a.MerkleSumTree}}),e.default=r.default}({});const pZ=({chain:e,rpcUrl:t,bundlerRpcUrl:r,projectId:n,bundlerProvider:i})=>{const o=gB(r??kU,{fetchOptions:{headers:r===kU?{projectId:n,bundlerProvider:i}:{}},name:"Connected bundler network",key:"connected-bundler-network",retryCount:0,timeout:35e3}),a=gB(t??NU[e.id]);let s=TP(aR({chain:e,transport:dB({async request({method:t,params:r}){let n;return n=["eth_sendUserOperation","eth_estimateUserOperationGas","eth_getUserOperationReceipt","eth_getUserOperationByHash","eth_supportedEntryPoints","eth_maxPriorityFeePerGas","rundler_maxPriorityFeePerGas","pimlico_getUserOperationGasPrice"].includes(t)?await o({chain:e}).request({method:t,params:r}):await a({chain:e}).request({method:t,params:r}),n}})}));return s};var mZ;function bZ(e){return e&&void 0!==e.connectValidator}!function(e){e.UNDEFINED="0x0",e.NOT_DEPLOYED="0x1",e.DEPLOYED="0x2"}(mZ||(mZ={}));class gZ extends NP{constructor(e){super({...e,entryPointAddress:e.entryPointAddress??PU,chain:e.chain??sj,rpcClient:e.rpcClient??kU}),Object.defineProperty(this,"factoryAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"index",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"initCode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"validator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"defaultValidator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.index=e.index??0n,this.factoryAddress=e.factoryAddress??"0x5de4839a76cf55d0c90e2061ef4386d962E15ae3",this.validator=e.validator,this.defaultValidator=e.defaultValidator,this.initCode=e.initCode}static async init(e){const t=await n$(e.projectId);if(!t)throw new Error("ChainId not found");const r=YV(t),n="string"==typeof e.rpcClient?pZ({chain:r,rpcUrl:e.rpcClient,bundlerRpcUrl:e.rpcClient??kU,projectId:e.projectId,bundlerProvider:e.bundlerProvider}):e.rpcClient;return new gZ({...e,chain:r,rpcClient:n})}connectValidator(e){return HP(this,"validator",e),this}getValidator(){if(!this.validator)throw new Error("Validator not connected");return this.validator}getDummySignature(){return"0x00000000870fe151d548a1c527c3804866fab30abf28ed17b79d5fc5149f19ca0819fefc3c57f3da4fdf9b10fab3f2f3dca536467ae44943b9dbb8433efe7760ddd72aaa1c"}async getInitCode(){if(this.deploymentState===mZ.DEPLOYED)return"0x";const e=await this.rpcProvider.getContractCode(await this.getAddress());return(e?.length??0)>2?(this.deploymentState=mZ.DEPLOYED,"0x"):(this.deploymentState=mZ.NOT_DEPLOYED,this.initCode??this.getAccountInitCode())}getIndex(){return this.index}async approvePlugin(){if(!this.validator)throw new Error("Validator not connected");if(this.defaultValidator&&!this.validator.getEnableSignature()){const{executor:e,selector:t,validAfter:r,validUntil:n}=this.validator.getPluginValidatorData(),i=await this.defaultValidator.approveExecutor(await this.getAddress(),t,e,n,r,this.validator);this.validator.setEnableSignature(i)}}async encodeExecute(e,t,r){if(!this.validator)throw new Error("Validator not connected");return e.toLowerCase()===(await this.getAddress()).toLowerCase()&&this.validator.shouldDelegateViaFallback()?r:this.encodeExecuteAction(e,t,r,0)}async encodeBatchExecute(e){const t=await this.getKernelImplementationAddess(),r=await this.getInitCode();if(t?.toLowerCase()!==TU.toLowerCase()&&t?.toLowerCase()!=="0x8dD4DBB54d8A8Cf0DE6F9CCC4609470A30EfF18C".toLowerCase()&&t?.toLowerCase()!=="0xd3f582f6b4814e989ee8e96bc3175320b5a540ab".toLowerCase()&&"0x"===r){const t=RO({abi:gE,functionName:"multiSend",args:[JV(e)]});return await this.encodeExecuteDelegate(IU,BigInt(0),t)}return await this.encodeExecuteBatchAction(e)}async encodeExecuteDelegate(e,t,r){return this.encodeExecuteAction(e,t,r,1)}async encodeSetExection(){if(!this.validator)throw new Error("Validator not connected");const{executor:e,selector:t,validAfter:r,validUntil:n}=await this.validator.getPluginValidatorData(),i=await this.validator.getEnableData();return RO({abi:mE,functionName:"setExecution",args:[t,e,this.validator.validatorAddress,n,r,i]})}async encodeUgradeTo(){return RO({abi:mE,functionName:"upgradeTo",args:[TU]})}async getKernelImplementationAddess(){try{const e=await this.rpcProvider.getStorageAt({address:await this.getAddress(),slot:"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"});return e?"0x"+e.slice(26):e}catch(e){return}}async signMessageWith6492(e){try{if(!this.validator)throw new Error("Validator not connected");const t="string"==typeof e?TT(e):e;let r=await this.validator.signMessage(TT(SN({raw:t})));return await this.isAccountDeployed()||(r=RP({factoryAddress:this.factoryAddress,initCode:await this.getFactoryInitCode(),signature:r})),r}catch(e){throw console.error("Got Error - ",e.message),new Error("Message Signing with EIP6492 failed")}}async signTypedDataWith6492(e){try{if(!this.validator)throw new Error("Validator not connected");let t=await this.validator.signTypedData(e);return await this.isAccountDeployed()||(t=RP({factoryAddress:this.factoryAddress,initCode:await this.getFactoryInitCode(),signature:t})),t}catch(e){throw console.error("Got Error - ",e.message),new Error("Message Signing with EIP6492 failed")}}async signMessage(e){if(!this.validator)throw new Error("Validator not connected");const t="string"==typeof e?TT(e):e;return await this.validator.signMessage(t)}async signTypedData(e){if(!this.validator)throw new Error("Validator not connected");return await this.validator.signTypedData(e)}signUserOp(e){if(!this.validator)throw new Error("Validator not connected");return this.validator.signUserOp(e)}encodeExecuteAction(e,t,r,n){return RO({abi:mE,functionName:"execute",args:[e,t,r,n]})}encodeExecuteBatchAction(e){return RO({abi:mE,functionName:"executeBatch",args:[e.map((e=>({to:e.target,value:e.value??0n,data:e.data})))]})}async getAccountInitCode(){return yO([this.factoryAddress,await this.getFactoryInitCode()])}async getNonce(){if(!await this.isAccountDeployed())return 0n;if(!this.validator)throw Error("Validator unintialized");const e=await this.getAddress(),t=this.validator.getNonceKey();return this.entryPoint.read.getNonce([e,t])}async getFactoryInitCode(){const e=this.defaultValidator??this.validator;if(!e)throw new Error("Validator not connected");try{return RO({abi:bE,functionName:"createAccount",args:[TU,RO({abi:mE,functionName:"initialize",args:[e.getAddress(),await e.getEnableData()]}),this.index]})}catch(e){throw console.error("err occurred:",e.message),new Error("Factory Code generation failed")}}}const yZ=IP.find((e=>"simulateValidation"===e.name))?.inputs[0];function vZ(e,t=!0){if(t){let t=AO({components:[{type:"address",name:"sender"},{type:"uint256",name:"nonce"},{type:"bytes",name:"initCode"},{type:"bytes",name:"callData"},{type:"uint256",name:"callGasLimit"},{type:"uint256",name:"verificationGasLimit"},{type:"uint256",name:"preVerificationGas"},{type:"uint256",name:"maxFeePerGas"},{type:"uint256",name:"maxPriorityFeePerGas"},{type:"bytes",name:"paymasterAndData"},{type:"bytes",name:"signature"}],name:"userOp",type:"tuple"}.components,Object.values({...e,signature:"0x"}));return t="0x"+t.slice(66,t.length-64),t}return function(e,t){const r=e.map((e=>"bytes"===e.type&&t?"bytes32":e.type)).join(", "),n=e.map((e=>"bytes"===e.type&&t?dO(e.val):e.val));return AO(II(r),n)}(yZ.components.map((t=>({type:t.type,val:e[t.name]}))),t)}function wZ(e){return!!(e.callGasLimit&&e.maxFeePerGas&&null!=e.maxPriorityFeePerGas&&e.preVerificationGas&&e.verificationGasLimit)}const EZ={fixed:21e3,perUserOp:18300,perUserOpWord:4,zeroByte:4,nonZeroByte:16,bundleSize:1,sigSize:65};let AZ=class extends NI{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}};const xZ=async(e,t)=>{if(null==t||"0x"===t)return BigInt(0);const r=t.substring(0,42),n="0x"+t.substring(42);return await e.rpcClient.estimateGas({account:PU,to:r,data:n})},_Z=async e=>function(e){const t={...EZ},r=TT(vZ({preVerificationGas:21e3,signature:AT(_.alloc(t.sigSize,1)),...e},!1)),n=r.map((e=>0===e?t.zeroByte:t.nonZeroByte)).reduce(((e,t)=>e+t));return Math.round(n+t.fixed/t.bundleSize+t.perUserOp+t.perUserOpWord*r.length)}(await UP(e)),kZ={STACKUP:"eth_maxPriorityFeePerGas",ALCHEMY:"rundler_maxPriorityFeePerGas",PIMLICO:"pimlico_getUserOperationGasPrice",GELATO:"eth_maxPriorityFeePerGas"},SZ=async e=>{let[t,r]=await Promise.all([e.rpcClient.request({method:kZ[e.bundlerProvider]??"eth_maxPriorityFeePerGas",params:[]}),e.rpcClient.getBlock({blockTag:"latest"})]);if("PIMLICO"===e.bundlerProvider&&(t=t.standard.maxPriorityFeePerGas),"bigint"!=typeof r.baseFeePerGas)throw new AZ;const n=10**1.2.toString().split(".")[1].length,i=BigInt(t),o=(e=>e*BigInt(1.2*n)/BigInt(n))(r.baseFeePerGas);return{maxFeePerGas:o+i,maxPriorityFeePerGas:i}},PZ=async e=>{const{block:t,gasPrice:r}=await UP({block:e.rpcClient.getBlock({blockTag:"latest"}),gasPrice:e.rpcClient.getGasPrice().catch((e=>(console.warn("Legacy: Failed to get gas price",e),null)))});let n=null,i=null;if(t&&null!=t.baseFeePerGas){const o=BigInt("1500000000");i=r?r-t.baseFeePerGas:null,(null==i||i-BigInt(0)||i>o)&&(i=o),i=i{let t=f[e];return"string"==typeof t&&t.startsWith("0x")||(t=AT(t)),[e,t]})).reduce(((e,[t,r])=>({...e,[t]:r})),{}));const d=await n$(this.provider.getProjectId());if(!d)throw new Error("ChainId not found");let h=Object.fromEntries(Object.entries({projectId:this.provider.getProjectId(),chainId:d,userOp:c,entryPointAddress:PU,callData:t instanceof Promise?await t:t,gasTokenData:r&&l&&i?{tokenAddress:r,erc20UserOp:l,erc20CallData:i instanceof Promise?await i:i}:void 0,tokenAddress:r,erc20UserOp:l,erc20CallData:i instanceof Promise?await i:i,paymasterProvider:o,shouldOverrideFee:a,shouldConsume:s}).filter((([e,t])=>void 0!==t)));const{data:p}=await Dz.post(`${SU}/getPaymasterAndData`,{...h},{headers:{"Content-Type":"application/json"}});return p}}const CZ={VERIFYING_PAYMASTER:class extends MZ{constructor(e,t){super(e)}async getPaymasterResponse(e,t,r,n){const i=DP(await UP(e));return await this.signUserOp({userOp:i,paymasterProvider:t,shouldOverrideFee:r,shouldConsume:n})}},TOKEN_PAYMASTER:class extends MZ{constructor(e,t){super(e),Object.defineProperty(this,"paymasterConfig",{enumerable:!0,configurable:!0,writable:!0,value:t})}async getPaymasterAddress(e){const t=await n$(this.provider.getProjectId());try{const{data:r}=await Dz.post(`${SU}/getPaymasterAddress`,{chainId:t,entryPointAddress:PU,paymasterProvider:e},{headers:{"Content-Type":"application/json"}});return r}catch(e){return void console.log(e)}}async decodeMainCallFromCallData(e,t){let r="0x";if(t instanceof Promise){const e=await t;r=e instanceof Uint8Array?AT(e):e}else r=t instanceof Uint8Array?AT(t):t;try{const{functionName:e,args:t}=iN({abi:mE,data:r});if("execute"===e){const[e,r,n]=t;let i;try{({functionName:i}=iN({abi:gE,data:n}))}catch(e){}let o={target:e,value:r??0n,data:n};return"multiSend"===i&&(o={...o,target:IU,delegateCall:!0,data:n}),o}if("executeBatch"===e){const[e]=t;return e.map((e=>({target:e.to,value:e.value??0n,data:e.data})))}}catch(t){return{target:e instanceof Promise?await e:e,data:r,value:0n,delegateCall:!0}}}async getERC20UserOp(e,t,r,n){try{const i={target:r,value:BigInt(0),data:RO({abi:yE,functionName:"approve",args:[n,MU[r]]})};if(!this.provider.account)throw OZ;let o;o=function(e){return e&&Array.isArray(e)}(t)?[i,...t]:[i,t];const a=await this.provider.account.encodeBatchExecute(o);return{...e,callData:a,callGasLimit:await this.provider.rpcClient.estimateGas({account:PU,to:await this.provider.getAddress(),data:a}),signature:await this.provider.getAccount().getValidator().getDynamicDummySignature(await e.sender,a)}}catch(e){return}}async getPaymasterResponse(e,t,r,n){const i=await this.decodeMainCallFromCallData(e.sender,e.callData);if(!i)throw TZ;const o=await n$(this.provider.getProjectId());if(!o)throw new Error("ChainId not found");const a=function(e,t){return"TEST_ERC20"===e?"0x3870419Ba2BBf0127060bCB37f69A1b1C090992B":OU[e][t]||void 0}(this.paymasterConfig.gasToken,o);let s=await this.getPaymasterAddress(t);if(void 0!==a&&void 0!==s&&bO(s)){const o=await this.getERC20UserOp(e,i,a,s);if(!o)return;return await this.signUserOp({userOp:e,callData:e.callData,gasTokenAddress:a,erc20UserOp:o,erc20CallData:o.callData,paymasterProvider:t,shouldOverrideFee:r,shouldConsume:n})}}}},BZ=(e,t)=>(e.withPaymasterMiddleware(NZ(e,t)),e),NZ=(e,t)=>({dummyPaymasterDataMiddleware:async e=>(e.paymasterAndData="0xe93eca6595fe94091dc1af46aac2a8b5d79907700000000000000000000000000000000000000000000000000000000064ee5cd9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000fffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",e),paymasterDataMiddleware:async r=>{const n=BigInt("100000"),i=BigInt("1000000"),o=BigInt("55000"),a=new CZ[t.policy](e,t);let s;try{s=await a.getPaymasterResponse({...r,preVerificationGas:n,verificationGasLimit:i,callGasLimit:o},t.paymasterProvider,!1,e.shouldConsume())}catch(e){if(console.error(e),t.onlySendSponsoredTransaction)throw e instanceof $z?Error(e.response?.data.message):e}if(t.onlySendSponsoredTransaction&&(!s||!s.paymasterAndData||"0x"===s.paymasterAndData))throw new Error("Transaction is not sponsored");return s&&s.paymasterAndData&&"0x"!==s.paymasterAndData?{...r,...s}:{...r,paymasterAndData:"0x"}}});var RZ,FZ;!function(e){e[e.Call=0]="Call",e[e.DelegateCall=1]="DelegateCall"}(RZ||(RZ={}));class LZ extends KP{constructor({projectId:e,chain:t,entryPointAddress:r=PU,rpcUrl:n,bundlerRpcUrl:i=kU,account:o,bundlerProvider:a,opts:s}){const c="number"==typeof t?YV(t):t;super(pZ({chain:c,rpcUrl:n,bundlerRpcUrl:i,projectId:e,bundlerProvider:a}),r,c,o,{...s,txMaxRetries:s?.txMaxRetries??20,txRetryIntervalMs:s?.txRetryIntervalMs??1e4,minPriorityFeePerBid:s?.minPriorityFeePerBid??CU.get(c.id)}),Object.defineProperty(this,"projectId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sendTxMaxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sendTxRetryIntervalMs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bundlerProvider",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_txMaxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_txRetryIntervalMs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_shouldConsume",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"feeOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"getProjectId",{enumerable:!0,configurable:!0,writable:!0,value:()=>this.projectId}),Object.defineProperty(this,"shouldConsume",{enumerable:!0,configurable:!0,writable:!0,value:()=>this._shouldConsume}),Object.defineProperty(this,"sendTransaction",{enumerable:!0,configurable:!0,writable:!0,value:async(e,t=RZ.Call)=>{if(!e.to)throw new Error("transaction is missing to address");const r={};e.maxFeePerGas&&(r.maxFeePerGas=e.maxFeePerGas),e.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=e.maxPriorityFeePerGas);const{hash:n}=await this.sendUserOperation({target:e.to,data:e.data??"0x",value:e.value?bT(e.value,"bigint"):0n},r,t);return await this.waitForUserOperationTransaction(n)}}),Object.defineProperty(this,"buildUserOperation",{enumerable:!0,configurable:!0,writable:!0,value:async(e,t,r=RZ.Call)=>{if(this._shouldConsume=!1,!bZ(this.account))throw new Error("account not connected!");if(!this.account.validator)throw new Error("validator not connected!");let n="0x";if(Array.isArray(e)){if(r!==RZ.Call)throw IZ;n=await this.account.encodeBatchExecute(e)}else{if(!bZ(this.account))throw IZ;if(r===RZ.DelegateCall)n=await this.account.encodeExecuteDelegate(e.target,e.value??0n,e.data);else{if(r!==RZ.Call)throw IZ;n=await this.account.encodeExecute(e.target,e.value??0n,e.data)}}const i=await this.account.getInitCode(),o=await this.account.getNonce(),a=await this._runMiddlewareStack({initCode:i,sender:this.getAddress(),nonce:o,callData:n,signature:await this.account.getValidator().getDynamicDummySignature(await this.getAddress(),n)},t);return this._shouldConsume=!0,a}}),Object.defineProperty(this,"_runMiddlewareStack",{enumerable:!0,configurable:!0,writable:!0,value:async(e,t)=>{const r=await jP(this.dummyPaymasterDataMiddleware,this.feeDataGetter,this.paymasterDataMiddleware,this.gasEstimator,this.customMiddleware??GP,(async e=>({...e,...t})))(e);return DP(await UP(r))}}),Object.defineProperty(this,"sendUserOperation",{enumerable:!0,configurable:!0,writable:!0,value:async(e,t,r=RZ.Call)=>{if(!this._shouldConsume)throw new Error("Cannot send user operation while building user operation");if(!bZ(this.account))throw new Error("account not connected!");if(!this.account.validator)throw new Error("validator not connected!");let n="0x";if(Array.isArray(e)){if(r!==RZ.Call)throw IZ;n=await this.account.encodeBatchExecute(e)}else{if(!bZ(this.account))throw IZ;if(r===RZ.DelegateCall)n=await this.account.encodeExecuteDelegate(e.target,e.value??0n,e.data);else{if(r!==RZ.Call)throw IZ;n=await this.account.encodeExecute(e.target,e.value??0n,e.data)}}const i=await this.account.getInitCode();let o="",a=0;const s=await this.account.getNonce();let c,u,l,f;do{if(c=await jP(this.dummyPaymasterDataMiddleware,this.feeDataGetter,this.paymasterDataMiddleware,this.gasEstimator,this.customMiddleware??GP,(async e=>({...e,...t})))({initCode:i,sender:this.getAddress(),nonce:s,callData:n,signature:await this.account.getValidator().getDynamicDummySignature(await this.getAddress(),n),maxFeePerGas:l,maxPriorityFeePerGas:f}),u=DP(await UP(c)),!wZ(u))throw new Error(`Request is missing parameters. All properties on UserOperationStruct must be set. uo: ${JSON.stringify(u,null,2)}`);await this.account.approvePlugin(),u.signature=await this.account.validator.getSignature(u);try{o=await this.rpcClient.sendUserOperation(u,this.entryPointAddress)}catch(e){if(this.isReplacementOpError(e)&&a++setTimeout(e,this.sendTxRetryIntervalMs)));continue}throw this.unwrapError(e)}}while(""===o);return{hash:o,request:u}}}),Object.defineProperty(this,"waitForUserOperationTransaction",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{let t=await this.rpcClient.getBlockNumber();for(let r=0;rnull));if(t)return this.getTransaction(t.receipt.transactionHash).then((e=>e.hash))}else{const r=await this.rpcClient.getLogs({address:PU,event:PO({abi:IP,name:"UserOperationEvent"}),args:{userOpHash:e},fromBlock:t-100n});if(r.length)return r[0].transactionHash}await new Promise((e=>setTimeout(e,this._txRetryIntervalMs)))}throw new Error("Failed to find transaction for User Operation")}}),Object.defineProperty(this,"getAccount",{enumerable:!0,configurable:!0,writable:!0,value:()=>{if(!bZ(this.account))throw new Error("account not connected!");return this.account}}),Object.defineProperty(this,"dummyPaymasterDataMiddleware",{enumerable:!0,configurable:!0,writable:!0,value:async e=>(e.paymasterAndData="0x",e)}),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{const{method:t,params:r}=e;switch(t){case"eth_chainId":return this.chain.id;case"eth_sendTransaction":const[t]=r;return this.sendTransaction(t);case"eth_signTypedData_v4":return this.signTypedData(JSON.parse(r[1]));case"personal_sign":if(!this.account)throw new Error("account not connected!");const[n,i]=r;if(i.toLowerCase()!==(await this.getAddress()).toLowerCase())throw new Error("cannot sign for address that is not the current account");return this.account.signMessageWith6492(n);default:return this.rpcClient.request(e)}}}),this.feeOptions={maxFeePerGasBufferPercentage:s?.feeOptions?.maxFeePerGasBufferPercentage??0,maxPriorityFeePerGasBufferPercentage:s?.feeOptions?.maxPriorityFeePerGasBufferPercentage??13},this._txMaxRetries=s?.txMaxRetries??20,this._txRetryIntervalMs=s?.txRetryIntervalMs??5e3,this.bundlerProvider=a,this.projectId=e,this.sendTxMaxRetries=s?.sendTxMaxRetries??3,this.sendTxRetryIntervalMs=s?.sendTxRetryIntervalMs??6e4,(e=>{e.withFeeDataGetter((async t=>{let r,n,i=await UP({maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas});if("GELATO"===e.bundlerProvider)return{maxFeePerGas:0n,maxPriorityFeePerGas:0n};try{({maxFeePerGas:r,maxPriorityFeePerGas:n}=await SZ(e))}catch(e){console.warn("getGas: eth_maxPriorityFeePerGas failed, falling back to legacy gas price.")}if(void 0===r||void 0===n){const t=await PZ(e);r=t?.maxFeePerGas?BigInt(t?.maxFeePerGas):0n,n=t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):0n}return i.maxFeePerGas||i.maxPriorityFeePerGas?{maxFeePerGas:i.maxFeePerGas??r,maxPriorityFeePerGas:i.maxPriorityFeePerGas??n}:{maxFeePerGas:r,maxPriorityFeePerGas:n}})),e.withGasEstimator((async t=>{if(void 0!==t.callGasLimit&&void 0!==t.verificationGasLimit&&void 0!==t.preVerificationGas)return t;const r=await(e.account?.getInitCode()),n=await xZ(e,r),i={...t,callGasLimit:void 0!==r&&r.length>2?BigInt("1000000"):BigInt(55e3),verificationGasLimit:BigInt(11e4)+n,preVerificationGas:BigInt(1e5)};i.preVerificationGas=await _Z(i);const o=DP(await UP(i));let a;a=await e.rpcClient.estimateUserOperationGas(o,PU);const{preVerificationGas:s,verificationGasLimit:c,callGasLimit:u}=a;return o.preVerificationGas=BigInt(s)??o.preVerificationGas,o.verificationGasLimit=BigInt(c)??o.verificationGasLimit,o.callGasLimit=BigInt(u)??o.callGasLimit,{...t,...o}}))})(this)}isReplacementOpError(e){if(null!=e.cause){const t=e?.cause?.message;return(t?.includes("replacement op must increase maxFeePerGas and MaxPriorityFeePerGas")||null!==t?.match(/.*replacement.*underpriced.*/))??!1}return!1}unwrapError(e){if(null!=e?.cause){let t="",r=e?.cause?.message;if(!0===r?.includes("FailedOp")){const e=r.match(/FailedOp\((.*)\)/);if(null!=e){const n=e[1].split(",");t=`(paymaster address: ${n[1]})`,r=n[2]}}const n=new Error(`The bundler has failed to include UserOperation in a batch: ${r} ${t}`);return n.stack=e.stack,n}return e}withZeroDevPaymasterAndData(e){if(!this.isConnected())throw new Error("ZeroDevProvider: account is not set, did you call `connect` first?");return BZ(this,e)}}BigInt.prototype.toJSON=function(){return this.toString()},function(e){e[e.EQUAL=0]="EQUAL",e[e.GREATER_THAN=1]="GREATER_THAN",e[e.LESS_THAN=2]="LESS_THAN",e[e.GREATER_THAN_OR_EQUAL=3]="GREATER_THAN_OR_EQUAL",e[e.LESS_THAN_OR_EQUAL=4]="LESS_THAN_OR_EQUAL",e[e.NOT_EQUAL=5]="NOT_EQUAL"}(FZ||(FZ={}));class jZ extends LZ{constructor(e,t){let r=e.bundlerProvider;const n=(void 0===e.usePaymaster||e.usePaymaster)&&"GELATO"!==r;if(e.opts?.paymasterConfig&&"TOKEN_PAYMASTER"===e.opts?.paymasterConfig.policy&&n&&(r="STACKUP"),super({...e.opts?.providerConfig,chain:e.opts?.providerConfig?.chain??sj,rpcUrl:e.opts?.providerConfig?.rpcUrl,projectId:e.projectId,bundlerProvider:r}),Object.defineProperty(this,"defaultProvider",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"getValidator",{enumerable:!0,configurable:!0,writable:!0,value:()=>{if(!bZ(this.account)||!this.account.validator)throw new Error("ValidatorProvider: account with validator is not set, did you call all connects first?");return this.account.getValidator()}}),Object.defineProperty(this,"getEncodedEnableData",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{if(!bZ(this.account)||!this.account.validator)throw new Error("ValidatorProvider: account with validator is not set, did you call all connects first?");return await this.account.validator.encodeEnable(e)}}),Object.defineProperty(this,"getEncodedDisableData",{enumerable:!0,configurable:!0,writable:!0,value:async(e="0x")=>{if(!bZ(this.account)||!this.account.validator)throw new Error("ValidatorProvider: account with validator is not set, did you call all connects first?");return await this.account.validator.encodeDisable(e)}}),Object.defineProperty(this,"sendEnableUserOperation",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{const t=await this.getEncodedEnableData(e);if(!bZ(this.account)||!this.account.validator)throw new Error("ValidatorProvider: account with validator is not set, did you call all connects first?");return await this.sendUserOperation({target:this.account.validator.validatorAddress,data:t})}}),Object.defineProperty(this,"sendDisableUserOperation",{enumerable:!0,configurable:!0,writable:!0,value:async(e="0x")=>{const t=await this.getEncodedDisableData(e);if(!bZ(this.account)||!this.account.validator)throw new Error("ValidatorProvider: account with validator is not set, did you call all connects first?");if(!this.defaultProvider)throw Error("Default Validator provider unintialized");return await this.defaultProvider.sendUserOperation({target:this.account.validator.validatorAddress,data:t})}}),this.defaultProvider=e.defaultProvider,"number"==typeof e.opts?.providerConfig?.chain&&"number"==typeof e.defaultProvider?.chain&&e.opts?.providerConfig?.chain!==e.defaultProvider?.chain||"object"==typeof e.opts?.providerConfig?.chain&&"object"==typeof e.defaultProvider?.chain&&e.opts?.providerConfig?.chain.id!==e.defaultProvider?.chain.id)throw new Error("chainId mismatch between default provider and current provider - check projectIds");if(this.connect((()=>new gZ({projectId:e.projectId,validator:t,defaultValidator:e.defaultProvider?.getValidator(),rpcClient:this.rpcClient,bundlerProvider:r,index:e.defaultProvider?.getAccount().getIndex(),...e.opts?.accountConfig}))),n){let t=e.opts?.paymasterConfig??{policy:"VERIFYING_PAYMASTER"};t={...t,paymasterProvider:e.opts?.paymasterConfig?.paymasterProvider??r},BZ(this,t)}}}class UZ extends jZ{constructor(e){const t="number"==typeof e.opts?.providerConfig?.chain?YV(e.opts.providerConfig.chain):e.opts?.providerConfig?.chain??sj,r=new XV({projectId:e.projectId,owner:e.owner,chain:t,rpcUrl:e.opts?.providerConfig?.rpcUrl,...e.opts?.validatorConfig});super({...e,opts:{...e.opts,providerConfig:{...e.opts?.providerConfig,chain:t}}},r),Object.defineProperty(this,"changeOwner",{enumerable:!0,configurable:!0,writable:!0,value:this.sendEnableUserOperation}),Object.defineProperty(this,"deleteOwner",{enumerable:!0,configurable:!0,writable:!0,value:this.sendDisableUserOperation})}static async init(e){const t=await n$(e.projectId);if(!t)throw new Error("ChainId not found");const r=YV(t);return new UZ({...e,opts:{...e.opts,providerConfig:{chain:r,...e.opts?.providerConfig}}})}}const DZ=new S$("networks/5.7.1");function zZ(e){const t=function(t,r){null==r&&(r={});const n=[];if(t.InfuraProvider&&"-"!==r.infura)try{n.push(new t.InfuraProvider(e,r.infura))}catch(e){}if(t.EtherscanProvider&&"-"!==r.etherscan)try{n.push(new t.EtherscanProvider(e,r.etherscan))}catch(e){}if(t.AlchemyProvider&&"-"!==r.alchemy)try{n.push(new t.AlchemyProvider(e,r.alchemy))}catch(e){}if(t.PocketProvider&&"-"!==r.pocket){const i=["goerli","ropsten","rinkeby","sepolia"];try{const o=new t.PocketProvider(e,r.pocket);o.network&&-1===i.indexOf(o.network.name)&&n.push(o)}catch(e){}}if(t.CloudflareProvider&&"-"!==r.cloudflare)try{n.push(new t.CloudflareProvider(e))}catch(e){}if(t.AnkrProvider&&"-"!==r.ankr)try{const i=["ropsten"],o=new t.AnkrProvider(e,r.ankr);o.network&&-1===i.indexOf(o.network.name)&&n.push(o)}catch(e){}if(0===n.length)return null;if(t.FallbackProvider){let i=1;return null!=r.quorum?i=r.quorum:"homestead"===e&&(i=2),new t.FallbackProvider(n,i)}return n[0]};return t.renetwork=function(e){return zZ(e)},t}function $Z(e,t){const r=function(r,n){return r.JsonRpcProvider?new r.JsonRpcProvider(e,t):null};return r.renetwork=function(t){return $Z(e,t)},r}const HZ={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:zZ("homestead")},GZ={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:zZ("ropsten")},qZ={chainId:63,name:"classicMordor",_defaultProvider:$Z("https://www.ethercluster.com/mordor","classicMordor")},KZ={unspecified:{chainId:0,name:"unspecified"},homestead:HZ,mainnet:HZ,morden:{chainId:2,name:"morden"},ropsten:GZ,testnet:GZ,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:zZ("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:zZ("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:zZ("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:zZ("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:$Z("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:qZ,classicTestnet:qZ,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:$Z("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:zZ("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:zZ("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function VZ(e){if(null==e)return null;if("number"==typeof e){for(const t in KZ){const r=KZ[t];if(r.chainId===e)return{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress||null,_defaultProvider:r._defaultProvider||null}}return{chainId:e,name:"unknown"}}if("string"==typeof e){const t=KZ[e];return null==t?null:{name:t.name,chainId:t.chainId,ensAddress:t.ensAddress,_defaultProvider:t._defaultProvider||null}}const t=KZ[e.name];if(!t)return"number"!=typeof e.chainId&&DZ.throwArgumentError("invalid network chainId","network",e),e;0!==e.chainId&&e.chainId!==t.chainId&&DZ.throwArgumentError("network chainId mismatch","network",e);let r=e._defaultProvider||null;return null==r&&t._defaultProvider&&(r=function(e){return e&&"function"==typeof e.renetwork}(t._defaultProvider)?t._defaultProvider.renetwork(e):t._defaultProvider),{name:e.name,chainId:t.chainId,ensAddress:e.ensAddress||t.ensAddress||null,_defaultProvider:r}}var WZ=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};function JZ(e,t){return WZ(this,void 0,void 0,(function*(){null==t&&(t={});const r={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0};if(!0!==t.skipFetchSetup&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),null!=t.fetchOptions){const e=t.fetchOptions;e.mode&&(r.mode=e.mode),e.cache&&(r.cache=e.cache),e.credentials&&(r.credentials=e.credentials),e.redirect&&(r.redirect=e.redirect),e.referrer&&(r.referrer=e.referrer)}const n=yield fetch(e,r),i=yield n.arrayBuffer(),o={};return n.headers.forEach?n.headers.forEach(((e,t)=>{o[t.toLowerCase()]=e})):n.headers.keys().forEach((e=>{o[e.toLowerCase()]=n.headers.get(e)})),{headers:o,statusCode:n.status,statusMessage:n.statusText,body:Y$(new Uint8Array(i))}}))}var ZZ=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const YZ=new S$("web/5.7.1");function XZ(e){return new Promise((t=>{setTimeout(t,e)}))}function QZ(e,t){if(null==e)return null;if("string"==typeof e)return e;if(W$(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return PG(e)}catch(e){}return nH(e)}return e}function eY(e){return _G(e.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16)))))}function tY(e,t,r){const n="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;YZ.assertArgument(n>0&&n%1==0,"invalid connection throttle limit","connection.throttleLimit",n);const i="object"==typeof e?e.throttleCallback:null,o="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;YZ.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const a="object"==typeof e&&!!e.errorPassThrough,s={};let c=null;const u={method:"GET"};let l=!1,f=12e4;if("string"==typeof e)c=e;else if("object"==typeof e){if(null!=e&&null!=e.url||YZ.throwArgumentError("missing URL","connection.url",e),c=e.url,"number"==typeof e.timeout&&e.timeout>0&&(f=e.timeout),e.headers)for(const t in e.headers)s[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(l=!0);if(u.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==c.substring(0,6)&&!0!==e.allowInsecureAuthentication&&YZ.throwError("basic authentication requires a secure https url",S$.errors.INVALID_ARGUMENT,{argument:"url",url:c,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;s.authorization={key:"Authorization",value:"Basic "+$G(_G(t))}}null!=e.skipFetchSetup&&(u.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(u.fetchOptions=B$(e.fetchOptions))}const d=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),h=c?c.match(d):null;if(h)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":h[1]||"text/plain"},body:h[2]?zG(h[3]):eY(h[3])};let t=e.body;return r&&(t=r(e.body,e)),Promise.resolve(t)}catch(e){YZ.throwError("processing response error",S$.errors.SERVER_ERROR,{body:QZ(h[1],h[2]),error:e,requestBody:null,requestMethod:"GET",url:c})}t&&(u.method="POST",u.body=t,null==s["content-type"]&&(s["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==s["content-length"]&&(s["content-length"]={key:"Content-Length",value:String(t.length)}));const p={};Object.keys(s).forEach((e=>{const t=s[e];p[t.key]=t.value})),u.headers=p;const m=function(){let e=null;return{promise:new Promise((function(t,r){f&&(e=setTimeout((()=>{null!=e&&(e=null,r(YZ.makeError("timeout",S$.errors.TIMEOUT,{requestBody:QZ(u.body,p["content-type"]),requestMethod:u.method,timeout:f,url:c})))}),f))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),b=function(){return ZZ(this,void 0,void 0,(function*(){for(let e=0;e=300)&&(m.cancel(),YZ.throwError("bad response",S$.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:QZ(s,t.headers?t.headers["content-type"]:null),requestBody:QZ(u.body,p["content-type"]),requestMethod:u.method,url:c})),r)try{const e=yield r(s,t);return m.cancel(),e}catch(r){if(r.throttleRetry&&e"content-type"===e.toLowerCase())).length||(r.headers=B$(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};e=r}return tY(e,n,((e,t)=>{let n=null;if(null!=e)try{n=JSON.parse(PG(e))}catch(t){YZ.throwError("invalid JSON",S$.errors.SERVER_ERROR,{body:e,error:t})}return r&&(n=r(n,t)),n}))}function nY(e,t){return t||(t={}),null==(t=B$(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(r,n){let i=null,o=!1;const a=()=>!o&&(o=!0,i&&clearTimeout(i),!0);t.timeout&&(i=setTimeout((()=>{a()&&n(new Error("timeout"))}),t.timeout));const s=t.retryLimit;let c=0;!function i(){return e().then((function(e){if(void 0!==e)a()&&r(e);else if(t.oncePoll)t.oncePoll.once("poll",i);else if(t.onceBlock)t.onceBlock.once("block",i);else if(!o){if(c++,c>s)return void(a()&&n(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,c)));et.ceiling&&(e=t.ceiling),setTimeout(i,e)}return null}),(function(e){a()&&n(e)}))}()}))}for(var iY="qpzry9x8gf2tvdw0s3jn54khce6mua7l",oY={},aY=0;aY<32;aY++){var sY=iY.charAt(aY);if(void 0!==oY[sY])throw new TypeError(sY+" is ambiguous");oY[sY]=aY}function cY(e){var t=e>>25;return(33554431&e)<<5^996825010&-(1&t)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function uY(e){for(var t=1,r=0;r126)return"Invalid prefix ("+e+")";t=cY(t)^n>>5}for(t=cY(t),r=0;rt)return"Exceeds length limit";var r=e.toLowerCase(),n=e.toUpperCase();if(e!==r&&e!==n)return"Mixed-case string "+e;var i=(e=r).lastIndexOf("1");if(-1===i)return"No separator character for "+e;if(0===i)return"Missing prefix for "+e;var o=e.slice(0,i),a=e.slice(i+1);if(a.length<6)return"Data too short";var s=uY(o);if("string"==typeof s)return s;for(var c=[],u=0;u=a.length||c.push(f)}return 1!==s?"Invalid checksum for "+e:{prefix:o,words:c}}function fY(e,t,r,n){for(var i=0,o=0,a=(1<=r;)o-=r,s.push(i>>o&a);if(n)o>0&&s.push(i<=t)return"Excess padding";if(i<r)throw new TypeError("Exceeds length limit");var n=uY(e=e.toLowerCase());if("string"==typeof n)throw new Error(n);for(var i=e+"1",o=0;o>5)throw new Error("Non 5-bit word");n=cY(n)^a,i+=iY.charAt(a)}for(o=0;o<6;++o)n=cY(n);for(n^=1,o=0;o<6;++o){i+=iY.charAt(n>>5*(5-o)&31)}return i},toWordsUnsafe:function(e){var t=fY(e,8,5,!0);if(Array.isArray(t))return t},toWords:function(e){var t=fY(e,8,5,!0);if(Array.isArray(t))return t;throw new Error(t)},fromWordsUnsafe:function(e){var t=fY(e,5,8,!1);if(Array.isArray(t))return t},fromWords:function(e){var t=fY(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}},hY=a(dY);const pY="providers/5.7.2",mY=new S$(pY);class bY{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},t=this.address.bind(this),r=this.bigNumber.bind(this),n=this.blockTag.bind(this),i=this.data.bind(this),o=this.hash.bind(this),a=this.hex.bind(this),s=this.number.bind(this),c=this.type.bind(this);return e.transaction={hash:o,type:c,accessList:bY.allowNull(this.accessList.bind(this),null),blockHash:bY.allowNull(o,null),blockNumber:bY.allowNull(s,null),transactionIndex:bY.allowNull(s,null),confirmations:bY.allowNull(s,null),from:t,gasPrice:bY.allowNull(r),maxPriorityFeePerGas:bY.allowNull(r),maxFeePerGas:bY.allowNull(r),gasLimit:r,to:bY.allowNull(t,null),value:r,nonce:s,data:i,r:bY.allowNull(this.uint256),s:bY.allowNull(this.uint256),v:bY.allowNull(s),creates:bY.allowNull(t,null),raw:bY.allowNull(i)},e.transactionRequest={from:bY.allowNull(t),nonce:bY.allowNull(s),gasLimit:bY.allowNull(r),gasPrice:bY.allowNull(r),maxPriorityFeePerGas:bY.allowNull(r),maxFeePerGas:bY.allowNull(r),to:bY.allowNull(t),value:bY.allowNull(r),data:bY.allowNull((e=>this.data(e,!0))),type:bY.allowNull(s),accessList:bY.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:s,blockNumber:s,transactionHash:o,address:t,topics:bY.arrayOf(o),data:i,logIndex:s,blockHash:o},e.receipt={to:bY.allowNull(this.address,null),from:bY.allowNull(this.address,null),contractAddress:bY.allowNull(t,null),transactionIndex:s,root:bY.allowNull(a),gasUsed:r,logsBloom:bY.allowNull(i),blockHash:o,transactionHash:o,logs:bY.arrayOf(this.receiptLog.bind(this)),blockNumber:s,confirmations:bY.allowNull(s,null),cumulativeGasUsed:r,effectiveGasPrice:bY.allowNull(r),status:bY.allowNull(s),type:c},e.block={hash:bY.allowNull(o),parentHash:o,number:s,timestamp:s,nonce:bY.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:bY.allowNull(t),extraData:i,transactions:bY.allowNull(bY.arrayOf(o)),baseFeePerGas:bY.allowNull(r)},e.blockWithTransactions=B$(e.block),e.blockWithTransactions.transactions=bY.allowNull(bY.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:bY.allowNull(n,void 0),toBlock:bY.allowNull(n,void 0),blockHash:bY.allowNull(o,void 0),address:bY.allowNull(t,void 0),topics:bY.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:bY.allowNull(s),blockHash:bY.allowNull(o),transactionIndex:s,removed:bY.allowNull(this.boolean.bind(this)),address:t,data:bY.allowFalsish(i,"0x"),topics:bY.arrayOf(o),transactionHash:o,logIndex:s},e}accessList(e){return $K(e||[])}number(e){return"0x"===e?0:wH.from(e).toNumber()}type(e){return"0x"===e||null==e?0:wH.from(e).toNumber()}bigNumber(e){return wH.from(e)}boolean(e){if("boolean"==typeof e)return e;if("string"==typeof e){if("true"===(e=e.toLowerCase()))return!0;if("false"===e)return!1}throw new Error("invalid boolean - "+e)}hex(e,t){return"string"==typeof e&&(t||"0x"===e.substring(0,2)||(e="0x"+e),tH(e))?e.toLowerCase():mY.throwArgumentError("invalid hash","value",e)}data(e,t){const r=this.hex(e,t);if(r.length%2!=0)throw new Error("invalid data; odd-length - "+e);return r}address(e){return tG(e)}callAddress(e){if(!tH(e,32))return null;const t=tG(oH(e,12));return t===sG?null:t}contractAddress(e){return rG(e)}blockTag(e){if(null==e)return"latest";if("earliest"===e)return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if("number"==typeof e||tH(e))return sH(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return 32!==iH(r)?mY.throwArgumentError("invalid hash","value",e):r}difficulty(e){if(null==e)return null;const t=wH.from(e);try{return t.toNumber()}catch(e){}return null}uint256(e){if(!tH(e))throw new Error("invalid uint256");return uH(e,32)}_block(e,t){null!=e.author&&null==e.miner&&(e.miner=e.author);const r=null!=e._difficulty?e._difficulty:e.difficulty,n=bY.check(t,e);return n._difficulty=null==r?null:wH.from(r),n}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return bY.check(this.formats.transactionRequest,e)}transactionResponse(e){null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&wH.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),null!=e.input&&null==e.data&&(e.data=e.input),null==e.to&&null==e.creates&&(e.creates=this.contractAddress(e)),1!==e.type&&2!==e.type||null!=e.accessList||(e.accessList=[]);const t=bY.check(this.formats.transaction,e);if(null!=e.chainId){let r=e.chainId;tH(r)&&(r=wH.from(r).toNumber()),t.chainId=r}else{let r=e.networkId;null==r&&null==t.v&&(r=e.chainId),tH(r)&&(r=wH.from(r).toNumber()),"number"!=typeof r&&null!=t.v&&(r=(t.v-35)/2,r<0&&(r=0),r=parseInt(r)),"number"!=typeof r&&(r=0),t.chainId=r}return t.blockHash&&"x"===t.blockHash.replace(/0/g,"")&&(t.blockHash=null),t}transaction(e){return WK(e)}receiptLog(e){return bY.check(this.formats.receiptLog,e)}receipt(e){const t=bY.check(this.formats.receipt,e);if(null!=t.root)if(t.root.length<=4){const e=wH.from(t.root).toNumber();0===e||1===e?(null!=t.status&&t.status!==e&&mY.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=e,delete t.root):mY.throwArgumentError("invalid alt-root-status","value.root",t.root)}else 66!==t.root.length&&mY.throwArgumentError("invalid root hash","value.root",t.root);return null!=t.status&&(t.byzantium=!0),t}topics(e){return Array.isArray(e)?e.map((e=>this.topics(e))):null!=e?this.hash(e,!0):null}filter(e){return bY.check(this.formats.filter,e)}filterLog(e){return bY.check(this.formats.filterLog,e)}static check(e,t){const r={};for(const n in e)try{const i=e[n](t[n]);void 0!==i&&(r[n]=i)}catch(e){throw e.checkKey=n,e.checkValue=t[n],e}return r}static allowNull(e,t){return function(r){return null==r?t:e(r)}}static allowFalsish(e,t){return function(r){return r?e(r):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const r=[];return t.forEach((function(t){r.push(e(t))})),r}}}function gY(e){return e&&"function"==typeof e.isCommunityResource}function yY(e){return gY(e)&&e.isCommunityResource()}let vY=!1;function wY(){vY||(vY=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var EY=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const AY=new S$(pY);function xY(e){return null==e?"null":(32!==iH(e)&&AY.throwArgumentError("invalid topic","topic",e),e.toLowerCase())}function _Y(e){for(e=e.slice();e.length>0&&null==e[e.length-1];)e.pop();return e.map((e=>{if(Array.isArray(e)){const t={};e.forEach((e=>{t[xY(e)]=!0}));const r=Object.keys(t);return r.sort(),r.join("|")}return xY(e)})).join("&")}function kY(e){if("string"==typeof e){if(32===iH(e=e.toLowerCase()))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+_Y(e);if(oG.isForkEvent(e))throw AY.warn("not implemented"),new Error("not implemented");if(e&&"object"==typeof e)return"filter:"+(e.address||"*")+":"+_Y(e.topics||[])}throw new Error("invalid event - "+e)}function SY(){return(new Date).getTime()}function PY(e){return new Promise((t=>{setTimeout(t,e)}))}const IY=["block","network","pending","poll"];class TY{constructor(e,t,r){T$(this,"tag",e),T$(this,"listener",t),T$(this,"once",r),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return"tx"!==e[0]?null:e[1]}get filter(){const e=this.tag.split(":");if("filter"!==e[0])return null;const t=e[1],r=function(e){return""===e?[]:e.split(/&/g).map((e=>{if(""===e)return[];const t=e.split("|").map((e=>"null"===e?null:e));return 1===t.length?t[0]:t}))}(e[2]),n={};return r.length>0&&(n.topics=r),t&&"*"!==t&&(n.address=t),n}pollable(){return this.tag.indexOf(":")>=0||IY.indexOf(this.tag)>=0}}const OY={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function MY(e){return uH(wH.from(e).toHexString(),32)}function CY(e){return Fq.encode(X$([e,oH(Dq(Dq(e)),0,4)]))}const BY=new RegExp("^(ipfs)://(.*)$","i"),NY=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),BY,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function RY(e,t){try{return PG(FY(e,t))}catch(e){}return null}function FY(e,t){if("0x"===e)return null;const r=wH.from(oH(e,t,t+32)).toNumber(),n=wH.from(oH(e,r,r+32)).toNumber();return oH(e,r+32,r+32+n)}function LY(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):AY.throwArgumentError("unsupported IPFS format","link",e),`https://gateway.ipfs.io/ipfs/${e}`}function jY(e){const t=Y$(e);if(t.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(t,32-t.length),r}function UY(e){if(e.length%32==0)return e;const t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function DY(e){const t=[];let r=0;for(let n=0;nwH.from(e).eq(1))).catch((e=>{if(e.code===S$.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e}))),this._supportsEip2544}_fetch(e,t){return EY(this,void 0,void 0,(function*(){const r={to:this.address,ccipReadEnabled:!0,data:aH([e,mq(this.name),t||"0x"])};let n=!1;(yield this.supportsWildcard())&&(n=!0,r.data=aH(["0x9061b923",DY([bq(this.name),r.data])]));try{let e=yield this.provider.call(r);return Y$(e).length%32==4&&AY.throwError("resolver threw error",S$.errors.CALL_EXCEPTION,{transaction:r,data:e}),n&&(e=FY(e,0)),e}catch(e){if(e.code===S$.errors.CALL_EXCEPTION)return null;throw e}}))}_fetchBytes(e,t){return EY(this,void 0,void 0,(function*(){const r=yield this._fetch(e,t);return null!=r?FY(r,0):null}))}_getAddress(e,t){const r=OY[String(e)];if(null==r&&AY.throwError(`unsupported coin type: ${e}`,S$.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),"eth"===r.ilk)return this.provider.formatter.address(t);const n=Y$(t);if(null!=r.p2pkh){const e=t.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return CY(X$([[r.p2pkh],"0x"+e[2]]))}}if(null!=r.p2sh){const e=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return CY(X$([[r.p2sh],"0x"+e[2]]))}}if(null!=r.prefix){const e=n[1];let t=n[0];if(0===t?20!==e&&32!==e&&(t=-1):t=-1,t>=0&&n.length===2+e&&e>=1&&e<=75){const e=hY.toWords(n.slice(2));return e.unshift(t),hY.encode(r.prefix,e)}}return null}getAddress(e){return EY(this,void 0,void 0,(function*(){if(null==e&&(e=60),60===e)try{const e=yield this._fetch("0x3b3b57de");return"0x"===e||e===bG?null:this.provider.formatter.callAddress(e)}catch(e){if(e.code===S$.errors.CALL_EXCEPTION)return null;throw e}const t=yield this._fetchBytes("0xf1cb7e06",MY(e));if(null==t||"0x"===t)return null;const r=this._getAddress(e,t);return null==r&&AY.throwError("invalid or unsupported coin data",S$.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r}))}getAvatar(){return EY(this,void 0,void 0,(function*(){const e=[{type:"name",content:this.name}];try{const t=yield this.getText("avatar");if(null==t)return null;for(let r=0;re[t]))}return AY.throwError("invalid or unsupported content hash data",S$.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})}))}getText(e){return EY(this,void 0,void 0,(function*(){let t=_G(e);t=X$([MY(64),MY(t.length),t]),t.length%32!=0&&(t=X$([t,uH("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",nH(t));return null==r||"0x"===r?null:PG(r)}))}}let $Y=null,HY=1;class GY extends aG{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),T$(this,"anyNetwork","any"===e),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch((e=>{})),this._ready().catch((e=>{}));else{const t=O$(new.target,"getNetwork")(e);t?(T$(this,"_network",t),this.emit("network",t,null)):AY.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return EY(this,void 0,void 0,(function*(){if(null==this._network){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch(e){}null==e&&(e=yield this.detectNetwork()),e||AY.throwError("no network detected",S$.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=e:T$(this,"_network",e),this.emit("network",e,null))}return this._network}))}get ready(){return nY((()=>this._ready().then((e=>e),(e=>{if(e.code!==S$.errors.NETWORK_ERROR||"noNetwork"!==e.event)throw e}))))}static getFormatter(){return null==$Y&&($Y=new bY),$Y}static getNetwork(e){return VZ(null==e?"homestead":e)}ccipReadFetch(e,t,r){return EY(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===r.length)return null;const n=e.to.toLowerCase(),i=t.toLowerCase(),o=[];for(let e=0;e=0?null:JSON.stringify({data:i,sender:n}),c=yield rY({url:a,errorPassThrough:!0},s,((e,t)=>(e.status=t.statusCode,e)));if(c.data)return c.data;const u=c.message||"unknown error";if(c.status>=400&&c.status<500)return AY.throwError(`response not found during CCIP fetch: ${u}`,S$.errors.SERVER_ERROR,{url:t,errorMessage:u});o.push(u)}return AY.throwError(`error encountered during CCIP fetch: ${o.map((e=>JSON.stringify(e))).join(", ")}`,S$.errors.SERVER_ERROR,{urls:r,errorMessages:o})}))}_getInternalBlockNumber(e){return EY(this,void 0,void 0,(function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const t=this._internalBlockNumber;try{const r=yield t;if(SY()-r.respTime<=e)return r.blockNumber;break}catch(e){if(this._internalBlockNumber===t)break}}const t=SY(),r=M$({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((e=>null),(e=>e))}).then((({blockNumber:e,networkError:n})=>{if(n)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),n;const i=SY();return(e=wH.from(e).toNumber()){this._internalBlockNumber===r&&(this._internalBlockNumber=null)})),(yield r).blockNumber}))}poll(){return EY(this,void 0,void 0,(function*(){const e=HY++,t=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(e){return void this.emit("error",e)}if(this._setFastBlockNumber(r),this.emit("poll",e,r),r!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)AY.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",AY.makeError("network block skew detected",S$.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let e=this._emitted.block+1;e<=r;e++)this.emit("block",e);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach((e=>{if("block"===e)return;const t=this._emitted[e];"pending"!==t&&r-t>12&&delete this._emitted[e]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=r-1),this._events.forEach((e=>{switch(e.type){case"tx":{const r=e.hash;let n=this.getTransactionReceipt(r).then((e=>e&&null!=e.blockNumber?(this._emitted["t:"+r]=e.blockNumber,this.emit(r,e),null):null)).catch((e=>{this.emit("error",e)}));t.push(n);break}case"filter":if(!e._inflight){e._inflight=!0,-2===e._lastBlockNumber&&(e._lastBlockNumber=r-1);const n=e.filter;n.fromBlock=e._lastBlockNumber+1,n.toBlock=r;const i=n.toBlock-this._maxFilterBlockRange;i>n.fromBlock&&(n.fromBlock=i),n.fromBlock<0&&(n.fromBlock=0);const o=this.getLogs(n).then((t=>{e._inflight=!1,0!==t.length&&t.forEach((t=>{t.blockNumber>e._lastBlockNumber&&(e._lastBlockNumber=t.blockNumber),this._emitted["b:"+t.blockHash]=t.blockNumber,this._emitted["t:"+t.transactionHash]=t.blockNumber,this.emit(n,t)}))})).catch((t=>{this.emit("error",t),e._inflight=!1}));t.push(o)}}})),this._lastBlockNumber=r,Promise.all(t).then((()=>{this.emit("didPoll",e)})).catch((e=>{this.emit("error",e)}))}else this.emit("didPoll",e)}))}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return EY(this,void 0,void 0,(function*(){return AY.throwError("provider does not support network detection",S$.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return EY(this,void 0,void 0,(function*(){const e=yield this._ready(),t=yield this.detectNetwork();if(e.chainId!==t.chainId){if(this.anyNetwork)return this._network=t,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",t,e),yield PY(0),this._network;const r=AY.makeError("underlying network changed",S$.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",r),r}return e}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((e=>{this._setFastBlockNumber(e)}),(e=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(e){e&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if("number"!=typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const e=SY();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then((e=>((null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(e){null!=this._fastBlockNumber&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,r){return EY(this,void 0,void 0,(function*(){return this._waitForTransaction(e,null==t?1:t,r||0,null)}))}_waitForTransaction(e,t,r,n){return EY(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(e);return(i?i.confirmations:0)>=t?i:new Promise(((i,o)=>{const a=[];let s=!1;const c=function(){return!!s||(s=!0,a.forEach((e=>{e()})),!1)},u=e=>{e.confirmations{this.removeListener(e,u)})),n){let r=n.startBlock,i=null;const u=a=>EY(this,void 0,void 0,(function*(){s||(yield PY(1e3),this.getTransactionCount(n.from).then((l=>EY(this,void 0,void 0,(function*(){if(!s){if(l<=n.nonce)r=a;else{{const t=yield this.getTransaction(e);if(t&&null!=t.blockNumber)return}for(null==i&&(i=r-3,i{s||this.once("block",u)})))}));if(s)return;this.once("block",u),a.push((()=>{this.removeListener("block",u)}))}if("number"==typeof r&&r>0){const e=setTimeout((()=>{c()||o(AY.makeError("timeout exceeded",S$.errors.TIMEOUT,{timeout:r}))}),r);e.unref&&e.unref(),a.push((()=>{clearTimeout(e)}))}}))}))}getBlockNumber(){return EY(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return EY(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return wH.from(e)}catch(t){return AY.throwError("bad result from backend",S$.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}}))}getBalance(e,t){return EY(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield M$({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getBalance",r);try{return wH.from(n)}catch(e){return AY.throwError("bad result from backend",S$.errors.SERVER_ERROR,{method:"getBalance",params:r,result:n,error:e})}}))}getTransactionCount(e,t){return EY(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield M$({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getTransactionCount",r);try{return wH.from(n).toNumber()}catch(e){return AY.throwError("bad result from backend",S$.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:n,error:e})}}))}getCode(e,t){return EY(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield M$({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getCode",r);try{return nH(n)}catch(e){return AY.throwError("bad result from backend",S$.errors.SERVER_ERROR,{method:"getCode",params:r,result:n,error:e})}}))}getStorageAt(e,t,r){return EY(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield M$({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then((e=>sH(e)))}),i=yield this.perform("getStorageAt",n);try{return nH(i)}catch(e){return AY.throwError("bad result from backend",S$.errors.SERVER_ERROR,{method:"getStorageAt",params:n,result:i,error:e})}}))}_wrapTransaction(e,t,r){if(null!=t&&32!==iH(t))throw new Error("invalid response - sendTransaction");const n=e;return null!=t&&e.hash!==t&&AY.throwError("Transaction hash mismatch from Provider.sendTransaction.",S$.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),n.wait=(t,n)=>EY(this,void 0,void 0,(function*(){let i;null==t&&(t=1),null==n&&(n=0),0!==t&&null!=r&&(i={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:r});const o=yield this._waitForTransaction(e.hash,t,n,i);return null==o&&0===t?null:(this._emitted["t:"+e.hash]=o.blockNumber,0===o.status&&AY.throwError("transaction failed",S$.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:o}),o)})),n}sendTransaction(e){return EY(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then((e=>nH(e))),r=this.formatter.transaction(e);null==r.confirmations&&(r.confirmations=0);const n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const e=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(r,e,n)}catch(e){throw e.transaction=r,e.transactionHash=r.hash,e}}))}_getTransactionRequest(e){return EY(this,void 0,void 0,(function*(){const t=yield e,r={};return["from","to"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>e?this._getAddress(e):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>e?wH.from(e):null)))})),["type"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>null!=e?e:null)))})),t.accessList&&(r.accessList=this.formatter.accessList(t.accessList)),["data"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>e?nH(e):null)))})),this.formatter.transactionRequest(yield M$(r))}))}_getFilter(e){return EY(this,void 0,void 0,(function*(){e=yield e;const t={};return null!=e.address&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach((r=>{null!=e[r]&&(t[r]=e[r])})),["fromBlock","toBlock"].forEach((r=>{null!=e[r]&&(t[r]=this._getBlockTag(e[r]))})),this.formatter.filter(yield M$(t))}))}_call(e,t,r){return EY(this,void 0,void 0,(function*(){r>=10&&AY.throwError("CCIP read exceeded maximum redirections",S$.errors.SERVER_ERROR,{redirects:r,transaction:e});const n=e.to,i=yield this.perform("call",{transaction:e,blockTag:t});if(r>=0&&"latest"===t&&null!=n&&"0x556f1830"===i.substring(0,10)&&iH(i)%32==4)try{const o=oH(i,4),a=oH(o,0,32);wH.from(a).eq(n)||AY.throwError("CCIP Read sender did not match",S$.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const s=[],c=wH.from(oH(o,32,64)).toNumber(),u=wH.from(oH(o,c,c+32)).toNumber(),l=oH(o,c+32);for(let t=0;tEY(this,void 0,void 0,(function*(){const e=yield this.perform("getBlock",n);if(null==e)return null!=n.blockHash&&null==this._emitted["b:"+n.blockHash]||null!=n.blockTag&&r>this._emitted.block?null:void 0;if(t){let t=null;for(let r=0;rthis._wrapTransaction(e))),r}return this.formatter.block(e)}))),{oncePoll:this})}))}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return EY(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return nY((()=>EY(this,void 0,void 0,(function*(){const r=yield this.perform("getTransaction",t);if(null==r)return null==this._emitted["t:"+e]?null:void 0;const n=this.formatter.transactionResponse(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;e<=0&&(e=1),n.confirmations=e}return this._wrapTransaction(n)}))),{oncePoll:this})}))}getTransactionReceipt(e){return EY(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return nY((()=>EY(this,void 0,void 0,(function*(){const r=yield this.perform("getTransactionReceipt",t);if(null==r)return null==this._emitted["t:"+e]?null:void 0;if(null==r.blockHash)return;const n=this.formatter.receipt(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;e<=0&&(e=1),n.confirmations=e}return n}))),{oncePoll:this})}))}getLogs(e){return EY(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield M$({filter:this._getFilter(e)}),r=yield this.perform("getLogs",t);return r.forEach((e=>{null==e.removed&&(e.removed=!1)})),bY.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)}))}getEtherPrice(){return EY(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(e){return EY(this,void 0,void 0,(function*(){if("number"==typeof(e=yield e)&&e<0){e%1&&AY.throwArgumentError("invalid BlockTag","blockTag",e);let t=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return t+=e,t<0&&(t=0),this.formatter.blockTag(t)}return this.formatter.blockTag(e)}))}getResolver(e){return EY(this,void 0,void 0,(function*(){let t=e;for(;;){if(""===t||"."===t)return null;if("eth"!==e&&"eth"===t)return null;const r=yield this._getResolver(t,"getResolver");if(null!=r){const n=new zY(this,r,e);return t===e||(yield n.supportsWildcard())?n:null}t=t.split(".").slice(1).join(".")}}))}_getResolver(e,t){return EY(this,void 0,void 0,(function*(){null==t&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||AY.throwError("network does not support ENS",S$.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const t=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+mq(e).substring(2)});return this.formatter.callAddress(t)}catch(e){}return null}))}resolveName(e){return EY(this,void 0,void 0,(function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(t){if(tH(e))throw t}"string"!=typeof e&&AY.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null}))}lookupAddress(e){return EY(this,void 0,void 0,(function*(){e=yield e;const t=(e=this.formatter.address(e)).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(t,"lookupAddress");if(null==r)return null;const n=RY(yield this.call({to:r,data:"0x691f3431"+mq(t).substring(2)}),0);return(yield this.resolveName(n))!=e?null:n}))}getAvatar(e){return EY(this,void 0,void 0,(function*(){let t=null;if(tH(e)){const r=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"getAvatar");if(!n)return null;t=new zY(this,n,r);try{const e=yield t.getAvatar();if(e)return e.url}catch(e){if(e.code!==S$.errors.CALL_EXCEPTION)throw e}try{const e=RY(yield this.call({to:n,data:"0x691f3431"+mq(r).substring(2)}),0);t=yield this.getResolver(e)}catch(e){if(e.code!==S$.errors.CALL_EXCEPTION)throw e;return null}}else if(t=yield this.getResolver(e),!t)return null;const r=yield t.getAvatar();return null==r?null:r.url}))}perform(e,t){return AY.throwError(e+" not implemented",S$.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_stopEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_addEventListener(e,t,r){const n=new TY(kY(e),t,r);return this._events.push(n),this._startEvent(n),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let r=!1,n=[],i=kY(e);return this._events=this._events.filter((e=>e.tag!==i||(setTimeout((()=>{e.listener.apply(this,t)}),0),r=!0,!e.once||(n.push(e),!1)))),n.forEach((e=>{this._stopEvent(e)})),r}listenerCount(e){if(!e)return this._events.length;let t=kY(e);return this._events.filter((e=>e.tag===t)).length}listeners(e){if(null==e)return this._events.map((e=>e.listener));let t=kY(e);return this._events.filter((e=>e.tag===t)).map((e=>e.listener))}off(e,t){if(null==t)return this.removeAllListeners(e);const r=[];let n=!1,i=kY(e);return this._events=this._events.filter((e=>e.tag!==i||e.listener!=t||(!!n||(n=!0,r.push(e),!1)))),r.forEach((e=>{this._stopEvent(e)})),this}removeAllListeners(e){let t=[];if(null==e)t=this._events,this._events=[];else{const r=kY(e);this._events=this._events.filter((e=>e.tag!==r||(t.push(e),!1)))}return t.forEach((e=>{this._stopEvent(e)})),this}}var qY=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const KY=new S$(pY),VY=["call","estimateGas"];function WY(e,t){if(null==e)return null;if("string"==typeof e.message&&e.message.match("reverted")){const r=tH(e.data)?e.data:null;if(!t||r)return{message:e.message,data:r}}if("object"==typeof e){for(const r in e){const n=WY(e[r],t);if(n)return n}return null}if("string"==typeof e)try{return WY(JSON.parse(e),t)}catch(e){}return null}function JY(e,t,r){const n=r.transaction||r.signedTransaction;if("call"===e){const e=WY(t,!0);if(e)return e.data;KY.throwError("missing revert data in call exception; Transaction reverted without a reason string",S$.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:t})}if("estimateGas"===e){let r=WY(t.body,!1);null==r&&(r=WY(t,!1)),r&&KY.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",S$.errors.UNPREDICTABLE_GAS_LIMIT,{reason:r.message,method:e,transaction:n,error:t})}let i=t.message;throw t.code===S$.errors.SERVER_ERROR&&t.error&&"string"==typeof t.error.message?i=t.error.message:"string"==typeof t.body?i=t.body:"string"==typeof t.responseText&&(i=t.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&KY.throwError("insufficient funds for intrinsic transaction cost",S$.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:n}),i.match(/nonce (is )?too low/i)&&KY.throwError("nonce has already been used",S$.errors.NONCE_EXPIRED,{error:t,method:e,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&KY.throwError("replacement fee too low",S$.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:n}),i.match(/only replay-protected/i)&&KY.throwError("legacy pre-eip-155 transactions not supported",S$.errors.UNSUPPORTED_OPERATION,{error:t,method:e,transaction:n}),VY.indexOf(e)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&KY.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",S$.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:n}),t}function ZY(e){return new Promise((function(t){setTimeout(t,e)}))}function YY(e){if(e.error){const t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function XY(e){return e?e.toLowerCase():e}const QY={};class eX extends H${constructor(e,t,r){if(super(),e!==QY)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");T$(this,"provider",t),null==r&&(r=0),"string"==typeof r?(T$(this,"_address",this.provider.formatter.address(r)),T$(this,"_index",null)):"number"==typeof r?(T$(this,"_index",r),T$(this,"_address",null)):KY.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return KY.throwError("cannot alter JSON-RPC Signer connection",S$.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new tX(QY,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((e=>(e.length<=this._index&&KY.throwError("unknown account #"+this._index,S$.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index]))))}sendUncheckedTransaction(e){e=B$(e);const t=this.getAddress().then((e=>(e&&(e=e.toLowerCase()),e)));if(null==e.gasLimit){const r=B$(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return null!=e.to&&(e.to=Promise.resolve(e.to).then((e=>qY(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.provider.resolveName(e);return null==t&&KY.throwArgumentError("provided ENS name resolves to null","tx.to",e),t}))))),M$({tx:M$(e),sender:t}).then((({tx:t,sender:r})=>{null!=t.from?t.from.toLowerCase()!==r&&KY.throwArgumentError("from address mismatch","transaction",e):t.from=r;const n=this.provider.constructor.hexlifyTransaction(t,{from:!0});return this.provider.send("eth_sendTransaction",[n]).then((e=>e),(e=>("string"==typeof e.message&&e.message.match(/user denied/i)&&KY.throwError("user rejected transaction",S$.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:t}),JY("sendTransaction",e,n))))}))}signTransaction(e){return KY.throwError("signing transactions is unsupported",S$.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return qY(this,void 0,void 0,(function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(e);try{return yield nY((()=>qY(this,void 0,void 0,(function*(){const e=yield this.provider.getTransaction(r);if(null!==e)return this.provider._wrapTransaction(e,r,t)}))),{oncePoll:this.provider})}catch(e){throw e.transactionHash=r,e}}))}signMessage(e){return qY(this,void 0,void 0,(function*(){const t="string"==typeof e?_G(e):e,r=yield this.getAddress();try{return yield this.provider.send("personal_sign",[nH(t),r.toLowerCase()])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&KY.throwError("user rejected signing",S$.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),t}}))}_legacySignMessage(e){return qY(this,void 0,void 0,(function*(){const t="string"==typeof e?_G(e):e,r=yield this.getAddress();try{return yield this.provider.send("eth_sign",[r.toLowerCase(),nH(t)])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&KY.throwError("user rejected signing",S$.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),t}}))}_signTypedData(e,t,r){return qY(this,void 0,void 0,(function*(){const n=yield Nq.resolveNames(e,t,r,(e=>this.provider.resolveName(e))),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(Nq.getPayload(n.domain,t,n.value))])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&KY.throwError("user rejected signing",S$.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:n.domain,types:t,value:n.value}}),e}}))}unlock(e){return qY(this,void 0,void 0,(function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])}))}}class tX extends eX{sendTransaction(e){return this.sendUncheckedTransaction(e).then((e=>({hash:e,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:t=>this.provider.waitForTransaction(e,t)})))}}const rX={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class nX extends GY{constructor(e,t){let r=t;null==r&&(r=new Promise(((e,t)=>{setTimeout((()=>{this.detectNetwork().then((t=>{e(t)}),(e=>{t(e)}))}),0)}))),super(r),e||(e=O$(this.constructor,"defaultUrl")()),T$(this,"connection","string"==typeof e?Object.freeze({url:e}):Object.freeze(B$(e))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return qY(this,void 0,void 0,(function*(){yield ZY(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch(t){try{e=yield this.send("net_version",[])}catch(e){}}if(null!=e){const t=O$(this.constructor,"getNetwork");try{return t(wH.from(e).toNumber())}catch(t){return KY.throwError("could not detect network",S$.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:t})}}return KY.throwError("could not detect network",S$.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(e){return new eX(QY,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((e=>e.map((e=>this.formatter.address(e)))))}send(e,t){const r={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:L$(r),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(n&&this._cache[e])return this._cache[e];const i=rY(this.connection,JSON.stringify(r),YY).then((e=>(this.emit("debug",{action:"response",request:r,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",error:e,request:r,provider:this}),e}));return n&&(this._cache[e]=i,setTimeout((()=>{this._cache[e]=null}),0)),i}prepareRequest(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[XY(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[XY(t.address),t.blockTag]];case"getCode":return["eth_getCode",[XY(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[XY(t.address),uH(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[O$(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[O$(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=XY(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return qY(this,void 0,void 0,(function*(){if("call"===e||"estimateGas"===e){const e=t.transaction;if(e&&null!=e.type&&wH.from(e.type).isZero()&&null==e.maxFeePerGas&&null==e.maxPriorityFeePerGas){const r=yield this.getFeeData();null==r.maxFeePerGas&&null==r.maxPriorityFeePerGas&&((t=B$(t)).transaction=B$(e),delete t.transaction.type)}}const r=this.prepareRequest(e,t);null==r&&KY.throwError(e+" not implemented",S$.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(r){return JY(e,r,t)}}))}_startEvent(e){"pending"===e.tag&&this._startPending(),super._startEvent(e)}_startPending(){if(null!=this._pendingFilter)return;const e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then((function(r){return function n(){e.send("eth_getFilterChanges",[r]).then((function(r){if(e._pendingFilter!=t)return null;let n=Promise.resolve();return r.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",n=n.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),n.then((function(){return ZY(1e3)}))})).then((function(){if(e._pendingFilter==t)return setTimeout((function(){n()}),0),null;e.send("eth_uninstallFilter",[r])})).catch((e=>{}))}(),r})).catch((e=>{}))}_stopEvent(e){"pending"===e.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const r=B$(rX);if(t)for(const e in t)t[e]&&(r[e]=!0);C$(e,r);const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(t){if(null==e[t])return;const r=sH(wH.from(e[t]));"gasLimit"===t&&(t="gas"),n[t]=r})),["from","to","data"].forEach((function(t){null!=e[t]&&(n[t]=nH(e[t]))})),e.accessList&&(n.accessList=$K(e.accessList)),n}}let iX=null;try{if(iX=WebSocket,null==iX)throw new Error("inject please")}catch(yse){const e=new S$(pY);iX=function(){e.throwError("WebSockets not supported in this environment",S$.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var oX=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const aX=new S$(pY);let sX=1;class cX extends nX{constructor(e,t){"any"===t&&aX.throwError("WebSocketProvider does not support 'any' network yet",S$.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),super("string"==typeof e?e:"_websocket",t),this._pollingInterval=-1,this._wsReady=!1,T$(this,"_websocket","string"==typeof e?new iX(this.connection.url):e),T$(this,"_requests",{}),T$(this,"_subs",{}),T$(this,"_subIds",{}),T$(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach((e=>{this.websocket.send(this._requests[e].payload)}))},this.websocket.onmessage=e=>{const t=e.data,r=JSON.parse(t);if(null!=r.id){const e=String(r.id),n=this._requests[e];if(delete this._requests[e],void 0!==r.result)n.callback(null,r.result),this.emit("debug",{action:"response",request:JSON.parse(n.payload),response:r.result,provider:this});else{let e=null;r.error?(e=new Error(r.error.message||"unknown error"),T$(e,"code",r.error.code||null),T$(e,"response",t)):e=new Error("unknown error"),n.callback(e,void 0),this.emit("debug",{action:"response",error:e,request:JSON.parse(n.payload),provider:this})}}else if("eth_subscription"===r.method){const e=this._subs[r.params.subscription];e&&e.processFunc(r.params.result)}else console.warn("this should not happen")};const r=setInterval((()=>{this.emit("poll")}),1e3);r.unref&&r.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){aX.throwError("cannot reset events block on WebSocketProvider",S$.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){aX.throwError("cannot set polling interval on WebSocketProvider",S$.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return oX(this,void 0,void 0,(function*(){return null}))}set polling(e){e&&aX.throwError("cannot set polling on WebSocketProvider",S$.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,t){const r=sX++;return new Promise(((n,i)=>{const o=JSON.stringify({method:e,params:t,id:r,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(o),provider:this}),this._requests[String(r)]={callback:function(e,t){return e?i(e):n(t)},payload:o},this._wsReady&&this.websocket.send(o)}))}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,t,r){return oX(this,void 0,void 0,(function*(){let n=this._subIds[e];null==n&&(n=Promise.all(t).then((e=>this.send("eth_subscribe",e))),this._subIds[e]=n);const i=yield n;this._subs[i]={tag:e,processFunc:r}}))}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],(e=>{const t=wH.from(e.number).toNumber();this._emitted.block=t,this.emit("block",t)}));break;case"pending":this._subscribe("pending",["newPendingTransactions"],(e=>{this.emit("pending",e)}));break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],(t=>{null==t.removed&&(t.removed=!1),this.emit(e.filter,this.formatter.filterLog(t))}));break;case"tx":{const t=e=>{const t=e.hash;this.getTransactionReceipt(t).then((e=>{e&&this.emit(t,e)}))};t(e),this._subscribe("tx",["newHeads"],(e=>{this._events.filter((e=>"tx"===e.type)).forEach(t)}));break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e)}}_stopEvent(e){let t=e.tag;if("tx"===e.type){if(this._events.filter((e=>"tx"===e.type)).length)return;t="tx"}else if(this.listenerCount(e.event))return;const r=this._subIds[t];r&&(delete this._subIds[t],r.then((e=>{this._subs[e]&&(delete this._subs[e],this.send("eth_unsubscribe",[e]))})))}destroy(){return oX(this,void 0,void 0,(function*(){this.websocket.readyState===iX.CONNECTING&&(yield new Promise((e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}}))),this.websocket.close(1e3)}))}}var uX=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const lX=new S$(pY);class fX extends nX{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return uX(this,void 0,void 0,(function*(){let t=this.network;return null==t&&(t=yield e.detectNetwork.call(this),t||lX.throwError("no network detected",S$.errors.UNKNOWN_ERROR,{}),null==this._network&&(T$(this,"_network",t),this.emit("network",t,null))),t}))}}class dX extends fX{constructor(e,t){lX.checkAbstract(new.target,dX),e=O$(new.target,"getNetwork")(e),t=O$(new.target,"getApiKey")(t);super(O$(new.target,"getUrl")(e,t),e),"string"==typeof t?T$(this,"apiKey",t):null!=t&&Object.keys(t).forEach((e=>{T$(this,e,t[e])}))}_startPending(){lX.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return lX.throwError("API provider does not support signing",S$.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,t){return lX.throwError("not implemented; sub-classes must override getUrl",S$.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const hX=new S$(pY),pX="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class mX extends cX{constructor(e,t){const r=new bX(e,t);super(r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi."),r.network),T$(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===pX}}class bX extends dX{static getWebSocketProvider(e,t){return new mX(e,t)}static getApiKey(e){return null==e?pX:(e&&"string"!=typeof e&&hX.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":r="eth-goerli.g.alchemy.com/v2/";break;case"matic":r="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":r="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":r="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":r="arb-goerli.g.alchemy.com/v2/";break;case"optimism":r="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":r="opt-goerli.g.alchemy.com/v2/";break;default:hX.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+t,throttleCallback:(e,r)=>(t===pX&&wY(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===pX}}const gX=new S$(pY),yX="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function vX(e){switch(e){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return gX.throwArgumentError("unsupported network","name",e)}class wX extends dX{isCommunityResource(){return this.apiKey===yX}static getApiKey(e){return null==e?yX:e}static getUrl(e,t){null==t&&(t=yX);const r={allowGzip:!0,url:"https://"+vX(e.name)+t,throttleCallback:(e,r)=>(t.apiKey===yX&&wY(),Promise.resolve(!0))};return null!=t.projectSecret&&(r.user="",r.password=t.projectSecret),r}}var EX=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const AX=new S$(pY);class xX extends dX{static getApiKey(e){return null!=e&&AX.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,t){let r=null;if("homestead"===e.name)r="https://cloudflare-eth.com/";else AX.throwArgumentError("unsupported network","network",arguments[0]);return r}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return EX(this,void 0,void 0,(function*(){if("getBlockNumber"===e){return(yield r.perform.call(this,"getBlock",{blockTag:"latest"})).number}return r.perform.call(this,e,t)}))}}var _X=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const kX=new S$(pY);function SX(e){const t={};for(let r in e){if(null==e[r])continue;let n=e[r];"type"===r&&0===n||(n={type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?sH(nH(n)):"accessList"===r?"["+$K(n).map((e=>`{address:"${e.address}",storageKeys:["${e.storageKeys.join('","')}"]}`)).join(",")+"]":nH(n),t[r]=n)}return t}function PX(e){if(0==e.status&&("No records found"===e.message||"No transactions found"===e.message))return e.result;if(1!=e.status||"string"!=typeof e.message||!e.message.match(/^OK/)){const t=new Error("invalid response");throw t.result=JSON.stringify(e),(e.result||"").toLowerCase().indexOf("rate limit")>=0&&(t.throttleRetry=!0),t}return e.result}function IX(e){if(e&&0==e.status&&"NOTOK"==e.message&&(e.result||"").toLowerCase().indexOf("rate limit")>=0){const t=new Error("throttled response");throw t.result=JSON.stringify(e),t.throttleRetry=!0,t}if("2.0"!=e.jsonrpc){const t=new Error("invalid response");throw t.result=JSON.stringify(e),t}if(e.error){const t=new Error(e.error.message||"unknown error");throw e.error.code&&(t.code=e.error.code),e.error.data&&(t.data=e.error.data),t}return e.result}function TX(e){if("pending"===e)throw new Error("pending not supported");return"latest"===e?e:parseInt(e.substring(2),16)}function OX(e,t,r){if("call"===e&&t.code===S$.errors.SERVER_ERROR){const e=t.error;if(e&&(e.message.match(/reverted/i)||e.message.match(/VM execution error/i))){let r=e.data;if(r&&(r="0x"+r.replace(/^.*0x/i,"")),tH(r))return r;kX.throwError("missing revert data in call exception",S$.errors.CALL_EXCEPTION,{error:t,data:"0x"})}}let n=t.message;throw t.code===S$.errors.SERVER_ERROR&&(t.error&&"string"==typeof t.error.message?n=t.error.message:"string"==typeof t.body?n=t.body:"string"==typeof t.responseText&&(n=t.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&kX.throwError("insufficient funds for intrinsic transaction cost",S$.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&kX.throwError("nonce has already been used",S$.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),n.match(/another transaction with same nonce/)&&kX.throwError("replacement fee too low",S$.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&kX.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",S$.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}class MX extends GY{constructor(e,t){super(e),T$(this,"baseUrl",this.getBaseUrl()),T$(this,"apiKey",t||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return kX.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,t){const r=Object.keys(t).reduce(((e,r)=>{const n=t[r];return null!=n&&(e+=`&${r}=${n}`),e}),""),n=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${r}${n}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,t){return t.module=e,t.apikey=this.apiKey,t}fetch(e,t,r){return _X(this,void 0,void 0,(function*(){const n=r?this.getPostUrl():this.getUrl(e,t),i=r?this.getPostData(e,t):null,o="proxy"===e?IX:PX;this.emit("debug",{action:"request",request:n,provider:this});const a={url:n,throttleSlotInterval:1e3,throttleCallback:(e,t)=>(this.isCommunityResource()&&wY(),Promise.resolve(!0))};let s=null;i&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},s=Object.keys(i).map((e=>`${e}=${i[e]}`)).join("&"));const c=yield rY(a,s,o||IX);return this.emit("debug",{action:"response",request:n,response:L$(c),provider:this}),c}))}detectNetwork(){return _X(this,void 0,void 0,(function*(){return this.network}))}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return _X(this,void 0,void 0,(function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:t.address,tag:t.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:t.address,tag:t.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:t.address,tag:t.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:t.address,position:t.position,tag:t.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:t.signedTransaction},!0).catch((e=>OX("sendTransaction",e,t.signedTransaction)));case"getBlock":if(t.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:t.blockTag,boolean:t.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:t.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:t.transactionHash});case"call":{if("latest"!==t.blockTag)throw new Error("EtherscanProvider does not support blockTag for call");const e=SX(t.transaction);e.module="proxy",e.action="eth_call";try{return yield this.fetch("proxy",e,!0)}catch(e){return OX("call",e,t.transaction)}}case"estimateGas":{const e=SX(t.transaction);e.module="proxy",e.action="eth_estimateGas";try{return yield this.fetch("proxy",e,!0)}catch(e){return OX("estimateGas",e,t.transaction)}}case"getLogs":{const e={action:"getLogs"};if(t.filter.fromBlock&&(e.fromBlock=TX(t.filter.fromBlock)),t.filter.toBlock&&(e.toBlock=TX(t.filter.toBlock)),t.filter.address&&(e.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&kX.throwError("unsupported topic count",S$.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),1===t.filter.topics.length)){const r=t.filter.topics[0];"string"==typeof r&&66===r.length||kX.throwError("unsupported topic format",S$.errors.UNSUPPORTED_OPERATION,{topic0:r}),e.topic0=r}const r=yield this.fetch("logs",e);let n={};for(let e=0;e{["contractAddress","to"].forEach((function(t){""==e[t]&&delete e[t]})),null==e.creates&&null!=e.contractAddress&&(e.creates=e.contractAddress);const t=this.formatter.transactionResponse(e);return e.timeStamp&&(t.timestamp=parseInt(e.timeStamp)),t}))}))}isCommunityResource(){return null==this.apiKey}}var CX=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const BX=new S$(pY);function NX(){return(new Date).getTime()}function RX(e){let t=null;for(let r=0;rt?null:(n+i)/2}function LX(e){if(null===e)return"null";if("number"==typeof e||"boolean"==typeof e)return JSON.stringify(e);if("string"==typeof e)return e;if(wH.isBigNumber(e))return e.toString();if(Array.isArray(e))return JSON.stringify(e.map((e=>LX(e))));if("object"==typeof e){const t=Object.keys(e);return t.sort(),"{"+t.map((t=>{let r=e[t];return r="function"==typeof r?"[function]":LX(r),JSON.stringify(t)+":"+r})).join(",")+"}"}throw new Error("unknown value type: "+typeof e)}let jX=1;function UX(e){let t=null,r=null,n=new Promise((n=>{t=function(){r&&(clearTimeout(r),r=null),n()},r=setTimeout(t,e)}));return{cancel:t,getPromise:function(){return n},wait:e=>(n=n.then(e),n)}}const DX=[S$.errors.CALL_EXCEPTION,S$.errors.INSUFFICIENT_FUNDS,S$.errors.NONCE_EXPIRED,S$.errors.REPLACEMENT_UNDERPRICED,S$.errors.UNPREDICTABLE_GAS_LIMIT],zX=["address","args","errorArgs","errorSignature","method","transaction"];function $X(e,t){const r={weight:e.weight};return Object.defineProperty(r,"provider",{get:()=>e.provider}),e.start&&(r.start=e.start),t&&(r.duration=t-e.start),e.done&&(e.error?r.error=e.error:r.result=e.result||null),r}function HX(e,t,r){let n=LX;switch(t){case"getBlockNumber":return function(t){const r=t.map((e=>e.result));let n=FX(t.map((e=>e.result)),2);if(null!=n)return n=Math.ceil(n),r.indexOf(n+1)>=0&&n++,n>=e._highestBlockNumber&&(e._highestBlockNumber=n),e._highestBlockNumber};case"getGasPrice":return function(e){const t=e.map((e=>e.result));return t.sort(),t[Math.floor(t.length/2)]};case"getEtherPrice":return function(e){return FX(e.map((e=>e.result)))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(e){return null==e?null:((e=B$(e)).confirmations=-1,LX(e))};break;case"getBlock":n=r.includeTransactions?function(e){return null==e?null:((e=B$(e)).transactions=e.transactions.map((e=>((e=B$(e)).confirmations=-1,e))),LX(e))}:function(e){return null==e?null:LX(e)};break;default:throw new Error("unknown method: "+t)}return function(e,t){return function(r){const n={};r.forEach((t=>{const r=e(t.result);n[r]||(n[r]={count:0,result:t.result}),n[r].count++}));const i=Object.keys(n);for(let e=0;e=t)return r.result}}}(n,e.quorum)}function GX(e,t){return CX(this,void 0,void 0,(function*(){const r=e.provider;return null!=r.blockNumber&&r.blockNumber>=t||-1===t?r:nY((()=>new Promise(((n,i)=>{setTimeout((function(){return r.blockNumber>=t?n(r):e.cancelled?n(null):n(void 0)}),0)}))),{oncePoll:r})}))}function qX(e,t,r,n){return CX(this,void 0,void 0,(function*(){let i=e.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&tH(n.blockTag)&&(i=yield GX(e,t)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&tH(n.blockTag)&&(i=yield GX(e,t)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&tH(n.blockTag)&&(i=yield GX(e,t)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&tH(n.blockTag)&&(i=yield GX(e,t)),"call"===r&&n.blockTag?i[r](n.transaction,n.blockTag):i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let r=n.filter;return(r.fromBlock&&tH(r.fromBlock)||r.toBlock&&tH(r.toBlock))&&(i=yield GX(e,t)),i.getLogs(r)}}return BX.throwError("unknown method error",S$.errors.UNKNOWN_ERROR,{method:r,params:n})}))}class KX extends GY{constructor(e,t){0===e.length&&BX.throwArgumentError("missing providers","providers",e);const r=e.map(((e,t)=>{if(aG.isProvider(e)){const t=yY(e)?2e3:750,r=1;return Object.freeze({provider:e,weight:1,stallTimeout:t,priority:r})}const r=B$(e);null==r.priority&&(r.priority=1),null==r.stallTimeout&&(r.stallTimeout=yY(e)?2e3:750),null==r.weight&&(r.weight=1);const n=r.weight;return(n%1||n>512||n<1)&&BX.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${t}].weight`,n),Object.freeze(r)})),n=r.reduce(((e,t)=>e+t.weight),0);null==t?t=n/2:t>n&&BX.throwArgumentError("quorum will always fail; larger than total weight","quorum",t);let i=RX(r.map((e=>e.provider.network)));null==i&&(i=new Promise(((e,t)=>{setTimeout((()=>{this.detectNetwork().then(e,t)}),0)}))),super(i),T$(this,"providerConfigs",Object.freeze(r)),T$(this,"quorum",t),this._highestBlockNumber=-1}detectNetwork(){return CX(this,void 0,void 0,(function*(){return RX(yield Promise.all(this.providerConfigs.map((e=>e.provider.getNetwork()))))}))}perform(e,t){return CX(this,void 0,void 0,(function*(){if("sendTransaction"===e){const e=yield Promise.all(this.providerConfigs.map((e=>e.provider.sendTransaction(t.signedTransaction).then((e=>e.hash),(e=>e)))));for(let t=0;te.priority-t.priority));const i=this._highestBlockNumber;let o=0,a=!0;for(;;){const s=NX();let c=n.filter((e=>e.runner&&s-e.starte+t.weight),0);for(;c{r.staller=null})),r.runner=qX(r,i,e,t).then((n=>{r.done=!0,r.result=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:a,backend:$X(r,NX()),request:{method:e,params:L$(t)},provider:this})}),(n=>{r.done=!0,r.error=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:a,backend:$X(r,NX()),request:{method:e,params:L$(t)},provider:this})})),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:a,backend:$X(r,null),request:{method:e,params:L$(t)},provider:this}),c+=r.weight}const u=[];n.forEach((e=>{!e.done&&e.runner&&(u.push(e.runner),e.staller&&u.push(e.staller.getPromise()))})),u.length&&(yield Promise.race(u));const l=n.filter((e=>e.done&&null==e.error));if(l.length>=this.quorum){const e=r(l);if(void 0!==e)return n.forEach((e=>{e.staller&&e.staller.cancel(),e.cancelled=!0})),e;a||(yield UX(100).getPromise()),a=!1}const f=n.reduce(((e,t)=>{if(!t.done||null==t.error)return e;const r=t.error.code;return DX.indexOf(r)>=0&&(e[r]||(e[r]={error:t.error,weight:0}),e[r].weight+=t.weight),e}),{});if(Object.keys(f).forEach((e=>{const t=f[e];if(t.weight{e.staller&&e.staller.cancel(),e.cancelled=!0}));const r=t.error,i={};zX.forEach((e=>{null!=r[e]&&(i[e]=r[e])})),BX.throwError(r.reason||r.message,e,i)})),0===n.filter((e=>!e.done)).length)break}return n.forEach((e=>{e.staller&&e.staller.cancel(),e.cancelled=!0})),BX.throwError("failed to meet quorum",S$.errors.SERVER_ERROR,{method:e,params:t,results:n.map((e=>$X(e))),provider:this})}))}}const VX=new S$(pY),WX="84842078b09946638c03157f83405213";class JX extends cX{constructor(e,t){const r=new ZX(e,t),n=r.connection;n.password&&VX.throwError("INFURA WebSocket project secrets unsupported",S$.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});super(n.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/"),e),T$(this,"apiKey",r.projectId),T$(this,"projectId",r.projectId),T$(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===WX}}class ZX extends dX{static getWebSocketProvider(e,t){return new JX(e,t)}static getApiKey(e){const t={apiKey:WX,projectId:WX,projectSecret:null};return null==e||("string"==typeof e?t.projectId=e:null!=e.projectSecret?(VX.assertArgument("string"==typeof e.projectId,"projectSecret requires a projectId","projectId",e.projectId),VX.assertArgument("string"==typeof e.projectSecret,"invalid projectSecret","projectSecret","[REDACTED]"),t.projectId=e.projectId,t.projectSecret=e.projectSecret):e.projectId&&(t.projectId=e.projectId),t.apiKey=t.projectId),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"homestead":r="mainnet.infura.io";break;case"goerli":r="goerli.infura.io";break;case"sepolia":r="sepolia.infura.io";break;case"matic":r="polygon-mainnet.infura.io";break;case"maticmum":r="polygon-mumbai.infura.io";break;case"optimism":r="optimism-mainnet.infura.io";break;case"optimism-goerli":r="optimism-goerli.infura.io";break;case"arbitrum":r="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":r="arbitrum-goerli.infura.io";break;default:VX.throwError("unsupported network",S$.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const n={allowGzip:!0,url:"https://"+r+"/v3/"+t.projectId,throttleCallback:(e,r)=>(t.projectId===WX&&wY(),Promise.resolve(!0))};return null!=t.projectSecret&&(n.user="",n.password=t.projectSecret),n}isCommunityResource(){return this.projectId===WX}}const YX=new S$(pY);class XX extends dX{static getApiKey(e){return e&&"string"!=typeof e&&YX.throwArgumentError("invalid apiKey","apiKey",e),e||"ETHERS_JS_SHARED"}static getUrl(e,t){YX.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let r=null;switch(e.name){case"homestead":r="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":r="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":r="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":r="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":r="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:YX.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+t}}const QX=new S$(pY),eQ="62e1ad51b37b8e00394bda3b";class tQ extends dX{static getApiKey(e){const t={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return null==e?t.applicationId=eQ:"string"==typeof e?t.applicationId=e:null!=e.applicationSecretKey?(t.applicationId=e.applicationId,t.applicationSecretKey=e.applicationSecretKey):e.applicationId?t.applicationId=e.applicationId:QX.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"goerli":r="eth-goerli.gateway.pokt.network";break;case"homestead":r="eth-mainnet.gateway.pokt.network";break;case"kovan":r="poa-kovan.gateway.pokt.network";break;case"matic":r="poly-mainnet.gateway.pokt.network";break;case"maticmum":r="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":r="eth-rinkeby.gateway.pokt.network";break;case"ropsten":r="eth-ropsten.gateway.pokt.network";break;default:QX.throwError("unsupported network",S$.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const n={headers:{},url:`https://${r}/v1/lb/${t.applicationId}`};return null!=t.applicationSecretKey&&(n.user="",n.password=t.applicationSecretKey),n}isCommunityResource(){return this.applicationId===eQ}}const rQ=new S$(pY);let nQ=1;function iQ(e,t){const r="Web3LegacyFetcher";return function(e,n){const i={method:e,params:n,id:nQ++,jsonrpc:"2.0"};return new Promise(((e,n)=>{this.emit("debug",{action:"request",fetcher:r,request:L$(i),provider:this}),t(i,((t,o)=>{if(t)return this.emit("debug",{action:"response",fetcher:r,error:t,request:i,provider:this}),n(t);if(this.emit("debug",{action:"response",fetcher:r,request:i,response:o,provider:this}),o.error){const e=new Error(o.error.message);return e.code=o.error.code,e.data=o.error.data,n(e)}e(o.result)}))}))}}class oQ extends nX{constructor(e,t){null==e&&rQ.throwArgumentError("missing provider","provider",e);let r=null,n=null,i=null;"function"==typeof e?(r="unknown:",n=e):(r=e.host||e.path||"",!r&&e.isMetaMask&&(r="metamask"),i=e,e.request?(""===r&&(r="eip-1193:"),n=function(e){return function(t,r){null==r&&(r=[]);const n={method:t,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:L$(n),provider:this}),e.request(n).then((e=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:e,provider:this}),e}))}}(e)):e.sendAsync?n=iQ(0,e.sendAsync.bind(e)):e.send?n=iQ(0,e.send.bind(e)):rQ.throwArgumentError("unsupported provider","provider",e),r||(r="unknown:")),super(r,t),T$(this,"jsonRpcFetchFunc",n),T$(this,"provider",i)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}const aQ=new S$(pY);function sQ(e,t){if(null==e&&(e="homestead"),"string"==typeof e){const t=e.match(/^(ws|http)s?:/i);if(t)switch(t[1].toLowerCase()){case"http":case"https":return new nX(e);case"ws":case"wss":return new cX(e);default:aQ.throwArgumentError("unsupported URL scheme","network",e)}}const r=VZ(e);return r&&r._defaultProvider||aQ.throwError("unsupported getDefaultProvider network",S$.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:e}),r._defaultProvider({FallbackProvider:KX,AlchemyProvider:bX,AnkrProvider:wX,CloudflareProvider:xX,EtherscanProvider:MX,InfuraProvider:ZX,JsonRpcProvider:nX,NodesmithProvider:XX,PocketProvider:tQ,Web3Provider:oQ,IpcProvider:null},t)}var cQ=Object.freeze({__proto__:null,AlchemyProvider:bX,AlchemyWebSocketProvider:mX,AnkrProvider:wX,BaseProvider:GY,CloudflareProvider:xX,EtherscanProvider:MX,FallbackProvider:KX,Formatter:bY,InfuraProvider:ZX,InfuraWebSocketProvider:JX,IpcProvider:null,JsonRpcBatchProvider:class extends nX{send(e,t){const r={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const n={request:r,resolve:null,reject:null},i=new Promise(((e,t)=>{n.resolve=e,n.reject=t}));return this._pendingBatch.push(n),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const e=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const t=e.map((e=>e.request));return this.emit("debug",{action:"requestBatch",request:L$(t),provider:this}),rY(this.connection,JSON.stringify(t)).then((r=>{this.emit("debug",{action:"response",request:t,response:r,provider:this}),e.forEach(((e,t)=>{const n=r[t];if(n.error){const t=new Error(n.error.message);t.code=n.error.code,t.data=n.error.data,e.reject(t)}else e.resolve(n.result)}))}),(r=>{this.emit("debug",{action:"response",error:r,request:t,provider:this}),e.forEach((e=>{e.reject(r)}))}))}),10)),i}},JsonRpcProvider:nX,JsonRpcSigner:eX,NodesmithProvider:XX,PocketProvider:tQ,Provider:aG,Resolver:zY,StaticJsonRpcProvider:fX,UrlJsonRpcProvider:dX,Web3Provider:oQ,WebSocketProvider:cX,getDefaultProvider:sQ,getNetwork:VZ,isCommunityResourcable:gY,isCommunityResource:yY,showThrottleMessage:wY});function uQ(e){const t=new oQ(e).getSigner();return{getAddress:async()=>Promise.resolve(await t.getAddress()),signMessage:async e=>await t.signMessage(e),signTypedData:async e=>ZV(await t._signTypedData(e.domain,e.types,e.message))}}var lQ=function(e,t){return lQ=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},lQ(e,t)};function fQ(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}lQ(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var dQ=function(){return dQ=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function mQ(e,t){return function(r,n){t(r,n,e)}}function bQ(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function gQ(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function yQ(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function AQ(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function xQ(){for(var e=[],t=0;t1||s(e,t)}))},t&&(n[e]=t(n[e])))}function s(e,t){try{!function(e){e.value instanceof SQ?Promise.resolve(e.value.v).then(c,u):l(o[0][2],e)}(i[e](t))}catch(e){l(o[0][3],e)}}function c(e){s("next",e)}function u(e){s("throw",e)}function l(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}}function IQ(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,i){t[n]=e[n]?function(t){return(r=!r)?{value:SQ(e[n](t)),done:!1}:i?i(t):t}:i}}function TQ(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=EQ(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,i){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,i,(t=e[r](t)).done,t.value)}))}}}function OQ(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var MQ=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function CQ(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&vQ(t,e,r);return MQ(t,e),t}function BQ(e){return e&&e.__esModule?e:{default:e}}function NQ(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function RQ(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}function FQ(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function LQ(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n,i;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],r&&(i=n)}if("function"!=typeof n)throw new TypeError("Object not disposable.");i&&(n=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var jQ="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=new Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function UQ(e){function t(t){e.error=e.hasError?new jQ(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function r(){for(;e.stack.length;){var n=e.stack.pop();try{var i=n.dispose&&n.dispose.call(n.value);if(n.async)return Promise.resolve(i).then(r,(function(e){return t(e),r()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}var DQ,zQ={__extends:fQ,__assign:dQ,__rest:hQ,__decorate:pQ,__param:mQ,__metadata:bQ,__awaiter:gQ,__generator:yQ,__createBinding:vQ,__exportStar:wQ,__values:EQ,__read:AQ,__spread:xQ,__spreadArrays:_Q,__spreadArray:kQ,__await:SQ,__asyncGenerator:PQ,__asyncDelegator:IQ,__asyncValues:TQ,__makeTemplateObject:OQ,__importStar:CQ,__importDefault:BQ,__classPrivateFieldGet:NQ,__classPrivateFieldSet:RQ,__classPrivateFieldIn:FQ,__addDisposableResource:LQ,__disposeResources:UQ},$Q=Object.freeze({__proto__:null,__addDisposableResource:LQ,get __assign(){return dQ},__asyncDelegator:IQ,__asyncGenerator:PQ,__asyncValues:TQ,__await:SQ,__awaiter:gQ,__classPrivateFieldGet:NQ,__classPrivateFieldIn:FQ,__classPrivateFieldSet:RQ,__createBinding:vQ,__decorate:pQ,__disposeResources:UQ,__esDecorate:function(e,t,r,n,i,o){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,c=n.kind,u="getter"===c?"get":"setter"===c?"set":"value",l=!t&&e?n.static?e:e.prototype:null,f=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d=!1,h=r.length-1;h>=0;h--){var p={};for(var m in n)p[m]="access"===m?{}:n[m];for(var m in n.access)p.access[m]=n.access[m];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");o.push(a(e||null))};var b=(0,r[h])("accessor"===c?{get:f.get,set:f.set}:f[u],p);if("accessor"===c){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(s=a(b.get))&&(f.get=s),(s=a(b.set))&&(f.set=s),(s=a(b.init))&&i.unshift(s)}else(s=a(b))&&("field"===c?i.unshift(s):f[u]=s)}l&&Object.defineProperty(l,n.name,f),d=!0},__exportStar:wQ,__extends:fQ,__generator:yQ,__importDefault:BQ,__importStar:CQ,__makeTemplateObject:OQ,__metadata:bQ,__param:mQ,__propKey:function(e){return"symbol"==typeof e?e:"".concat(e)},__read:AQ,__rest:hQ,__runInitializers:function(e,t,r){for(var n=arguments.length>2,i=0;i{setTimeout((()=>{t(!0)}),e)}))}),qQ),e),t.__exportStar(function(){if(XQ)return VQ;XQ=1,Object.defineProperty(VQ,"__esModule",{value:!0}),VQ.fromMiliseconds=VQ.toMiliseconds=void 0;const e=t0();return VQ.toMiliseconds=function(t){return t*e.ONE_THOUSAND},VQ.fromMiliseconds=function(t){return Math.floor(t/e.ONE_THOUSAND)},VQ}(),e)}(GQ)),GQ}var n0,i0={};var o0,a0,s0={},c0={};function u0(){return a0||(a0=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});HQ.__exportStar((o0||(o0=1,Object.defineProperty(c0,"__esModule",{value:!0}),c0.IWatch=void 0,c0.IWatch=class{}),c0),e)}(s0)),s0}!function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=HQ;t.__exportStar(r0(),e),t.__exportStar(function(){if(n0)return i0;n0=1,Object.defineProperty(i0,"__esModule",{value:!0}),i0.Watch=void 0;class e{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){const t=this.get(e);if(void 0!==t.elapsed)throw new Error(`Watch already stopped for label: ${e}`);const r=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:r})}get(e){const t=this.timestamps.get(e);if(void 0===t)throw new Error(`No timestamp found for label: ${e}`);return t}elapsed(e){const t=this.get(e);return t.elapsed||Date.now()-t.started}}return i0.Watch=e,i0.default=e,i0}(),e),t.__exportStar(u0(),e),t.__exportStar(t0(),e)}({});var l0={};function f0(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}function d0(e){const t=f0(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}Object.defineProperty(l0,"__esModule",{value:!0}),l0.getLocalStorage=l0.getLocalStorageOrThrow=l0.getCrypto=l0.getCryptoOrThrow=l0.getLocation=l0.getLocationOrThrow=l0.getNavigator=l0.getNavigatorOrThrow=l0.getDocument=l0.getDocumentOrThrow=l0.getFromWindowOrThrow=l0.getFromWindow=void 0,l0.getFromWindow=f0,l0.getFromWindowOrThrow=d0,l0.getDocumentOrThrow=function(){return d0("document")},l0.getDocument=function(){return f0("document")},l0.getNavigatorOrThrow=function(){return d0("navigator")},l0.getNavigator=function(){return f0("navigator")},l0.getLocationOrThrow=function(){return d0("location")},l0.getLocation=function(){return f0("location")},l0.getCryptoOrThrow=function(){return d0("crypto")},l0.getCrypto=function(){return f0("crypto")},l0.getLocalStorageOrThrow=function(){return d0("localStorage")},l0.getLocalStorage=function(){return f0("localStorage")};var h0={};Object.defineProperty(h0,"__esModule",{value:!0}),h0.getWindowMetadata=void 0;const p0=l0;h0.getWindowMetadata=function(){let e,t;try{e=p0.getDocumentOrThrow(),t=p0.getLocationOrThrow()}catch(e){return null}function r(...t){const r=e.getElementsByTagName("meta");for(let e=0;en.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(i.length&&i){const e=n.getAttribute("content");if(e)return e}}return""}const n=function(){let t=r("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}(),i=r("description","og:description","twitter:description","keywords"),o=t.origin,a=function(){const r=e.getElementsByTagName("link"),n=[];for(let e=0;e-1){const e=i.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let r=t.protocol+"//"+t.host;if(0===e.indexOf("/"))r+=e;else{const n=t.pathname.split("/");n.pop();r+=n.join("/")+"/"+e}n.push(r)}else if(0===e.indexOf("//")){const r=t.protocol+e;n.push(r)}else n.push(e)}}return n}();return{description:i,url:o,icons:a,name:n}};var m0=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)),b0="%[a-f0-9]{2}",g0=new RegExp("("+b0+")|([^%]+?)","gi"),y0=new RegExp("("+b0+")+","gi");function v0(e,t){try{return[decodeURIComponent(e.join(""))]}catch(e){}if(1===e.length)return e;t=t||1;var r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],v0(r),v0(n))}function w0(e){try{return decodeURIComponent(e)}catch(n){for(var t=e.match(g0)||[],r=1;r{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]},x0=function(e,t){for(var r={},n=Object.keys(e),i=Array.isArray(t),o=0;oNumber(e)-Number(t))).map((t=>e[t])):e}function l(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function f(e){const t=(e=l(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function d(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function h(e,t){a((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"colon-list-separator":return(e,r,n)=>{t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{const i="string"==typeof r&&r.includes(e.arrayFormatSeparator),o="string"==typeof r&&!i&&c(r,e).includes(e.arrayFormatSeparator);r=o?c(r,e):r;const a=i||o?r.split(e.arrayFormatSeparator).map((t=>c(t,e))):null===r?r:c(r,e);n[t]=a};case"bracket-separator":return(t,r,n)=>{const i=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!i)return void(n[t]=r?c(r,e):r);const o=null===r?[]:r.split(e.arrayFormatSeparator).map((t=>c(t,e)));void 0!==n[t]?n[t]=[].concat(n[t],o):n[t]=o};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),i=Object.create(null);if("string"!=typeof e)return i;if(!(e=e.trim().replace(/^[?#&]/,"")))return i;for(const o of e.split("&")){if(""===o)continue;let[e,a]=n(t.decode?o.replace(/\+/g," "):o,"=");a=void 0===a?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?a:c(a,t),r(c(e,t),a,i)}for(const e of Object.keys(i)){const r=i[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=d(r[e],t);else i[e]=d(r,t)}return!1===t.sort?i:(!0===t.sort?Object.keys(i).sort():Object.keys(i).sort(t.sort)).reduce(((e,t)=>{const r=i[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=u(r):e[t]=r,e}),Object.create(null))}e.extract=f,e.parse=h,e.stringify=(e,t)=>{if(!e)return"";a((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&(e=>null==e)(e[r])||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const i=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[s(t,e),"[",i,"]"].join("")]:[...r,[s(t,e),"[",s(i,e),"]=",s(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[s(t,e),"[]"].join("")]:[...r,[s(t,e),"[]=",s(n,e)].join("")];case"colon-list-separator":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[s(t,e),":list="].join("")]:[...r,[s(t,e),":list=",s(n,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return r=>(n,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?n:(i=null===i?"":i,0===n.length?[[s(r,e),t,s(i,e)].join("")]:[[n,s(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,s(t,e)]:[...r,[s(t,e),"=",s(n,e)].join("")]}}(t),i={};for(const t of Object.keys(e))r(t)||(i[t]=e[t]);const o=Object.keys(i);return!1!==t.sort&&o.sort(t.sort),o.map((r=>{const i=e[r];return void 0===i?"":null===i?s(r,t):Array.isArray(i)?0===i.length&&"bracket-separator"===t.arrayFormat?s(r,t)+"[]":i.reduce(n(r),[]).join("&"):s(r,t)+"="+s(i,t)})).filter((e=>e.length>0)).join("&")},e.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,i]=n(e,"#");return Object.assign({url:r.split("?")[0]||"",query:h(f(e),t)},t&&t.parseFragmentIdentifier&&i?{fragmentIdentifier:c(i,t)}:{})},e.stringifyUrl=(t,r)=>{r=Object.assign({encode:!0,strict:!0,[o]:!0},r);const n=l(t.url).split("?")[0]||"",i=e.extract(t.url),a=e.parse(i,{sort:!1}),c=Object.assign(a,t.query);let u=e.stringify(c,r);u&&(u=`?${u}`);let f=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(t.url);return t.fragmentIdentifier&&(f=`#${r[o]?s(t.fragmentIdentifier,r):t.fragmentIdentifier}`),`${n}${u}${f}`},e.pick=(t,r,n)=>{n=Object.assign({parseFragmentIdentifier:!0,[o]:!1},n);const{url:a,query:s,fragmentIdentifier:c}=e.parseUrl(t,n);return e.stringifyUrl({url:a,query:i(s,r),fragmentIdentifier:c},n)},e.exclude=(t,r,n)=>{const i=Array.isArray(r)?e=>!r.includes(e):(e,t)=>!r(e,t);return e.pick(t,i,n)}}({});var _0={},k0={},S0={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mul=Math.imul||function(e,t){var r=65535&e,n=65535&t;return r*n+((e>>>16&65535)*n+r*(t>>>16&65535)<<16>>>0)|0},e.add=function(e,t){return e+t|0},e.sub=function(e,t){return e-t|0},e.rotl=function(e,t){return e<>>32-t},e.rotr=function(e,t){return e<<32-t|e>>>t},e.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(t){return e.isInteger(t)&&t>=-e.MAX_SAFE_INTEGER&&t<=e.MAX_SAFE_INTEGER}}(S0),Object.defineProperty(k0,"__esModule",{value:!0});var P0=S0;function I0(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}function T0(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}function O0(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function M0(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function C0(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function B0(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function N0(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}function R0(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}function F0(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),N0(e/4294967296>>>0,t,r),N0(e>>>0,t,r+4),t}function L0(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),R0(e>>>0,t,r),R0(e/4294967296>>>0,t,r+4),t}k0.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},k0.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},k0.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},k0.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},k0.writeUint16BE=I0,k0.writeInt16BE=I0,k0.writeUint16LE=T0,k0.writeInt16LE=T0,k0.readInt32BE=O0,k0.readUint32BE=M0,k0.readInt32LE=C0,k0.readUint32LE=B0,k0.writeUint32BE=N0,k0.writeInt32BE=N0,k0.writeUint32LE=R0,k0.writeInt32LE=R0,k0.readInt64BE=function(e,t){void 0===t&&(t=0);var r=O0(e,t),n=O0(e,t+4);return 4294967296*r+n-4294967296*(n>>31)},k0.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*M0(e,t)+M0(e,t+4)},k0.readInt64LE=function(e,t){void 0===t&&(t=0);var r=C0(e,t);return 4294967296*C0(e,t+4)+r-4294967296*(r>>31)},k0.readUint64LE=function(e,t){void 0===t&&(t=0);var r=B0(e,t);return 4294967296*B0(e,t+4)+r},k0.writeUint64BE=F0,k0.writeInt64BE=F0,k0.writeUint64LE=L0,k0.writeInt64LE=L0,k0.readUintBE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,o=e/8+r-1;o>=r;o--)n+=t[o]*i,i*=256;return n},k0.readUintLE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,o=r;o=n;o--)r[o]=t/i&255,i*=256;return r},k0.writeUintLE=function(e,t,r,n){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===n&&(n=0),e%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!P0.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var i=1,o=n;o>>16|M<<16)|0)>>>20|x<<12,_=(_^=I=I+(C=(C^=w=w+_|0)>>>16|C<<16)|0)>>>20|_<<12,k=(k^=T=T+(B=(B^=E=E+k|0)>>>16|B<<16)|0)>>>20|k<<12,S=(S^=O=O+(N=(N^=A=A+S|0)>>>16|N<<16)|0)>>>20|S<<12,k=(k^=T=T+(B=(B^=E=E+k|0)>>>24|B<<8)|0)>>>25|k<<7,S=(S^=O=O+(N=(N^=A=A+S|0)>>>24|N<<8)|0)>>>25|S<<7,_=(_^=I=I+(C=(C^=w=w+_|0)>>>24|C<<8)|0)>>>25|_<<7,x=(x^=P=P+(M=(M^=v=v+x|0)>>>24|M<<8)|0)>>>25|x<<7,_=(_^=T=T+(N=(N^=v=v+_|0)>>>16|N<<16)|0)>>>20|_<<12,k=(k^=O=O+(M=(M^=w=w+k|0)>>>16|M<<16)|0)>>>20|k<<12,S=(S^=P=P+(C=(C^=E=E+S|0)>>>16|C<<16)|0)>>>20|S<<12,x=(x^=I=I+(B=(B^=A=A+x|0)>>>16|B<<16)|0)>>>20|x<<12,S=(S^=P=P+(C=(C^=E=E+S|0)>>>24|C<<8)|0)>>>25|S<<7,x=(x^=I=I+(B=(B^=A=A+x|0)>>>24|B<<8)|0)>>>25|x<<7,k=(k^=O=O+(M=(M^=w=w+k|0)>>>24|M<<8)|0)>>>25|k<<7,_=(_^=T=T+(N=(N^=v=v+_|0)>>>24|N<<8)|0)>>>25|_<<7;U0.writeUint32LE(v+n|0,e,0),U0.writeUint32LE(w+i|0,e,4),U0.writeUint32LE(E+o|0,e,8),U0.writeUint32LE(A+a|0,e,12),U0.writeUint32LE(x+s|0,e,16),U0.writeUint32LE(_+c|0,e,20),U0.writeUint32LE(k+u|0,e,24),U0.writeUint32LE(S+l|0,e,28),U0.writeUint32LE(P+f|0,e,32),U0.writeUint32LE(I+d|0,e,36),U0.writeUint32LE(T+h|0,e,40),U0.writeUint32LE(O+p|0,e,44),U0.writeUint32LE(M+m|0,e,48),U0.writeUint32LE(C+b|0,e,52),U0.writeUint32LE(B+g|0,e,56),U0.writeUint32LE(N+y|0,e,60)}function H0(e,t,r,n,i){if(void 0===i&&(i=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,t++;if(n>0)throw new Error("ChaCha: counter overflow")}_0.streamXOR=H0,_0.stream=function(e,t,r,n){return void 0===n&&(n=0),D0.wipe(r),H0(e,t,r,r,n)};var q0={},K0={};function V0(e,t){if(e.length!==t.length)return 0;for(var r=0,n=0;n>>8}Object.defineProperty(K0,"__esModule",{value:!0}),K0.select=function(e,t,r){return~(e-1)&t|e-1&r},K0.lessOrEqual=function(e,t){return(0|e)-(0|t)-1>>>31&1},K0.compare=V0,K0.equal=function(e,t){return 0!==e.length&&0!==t.length&&0!==V0(e,t)},function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=K0,r=j0;e.DIGEST_LENGTH=16;var n=function(){function t(t){this.digestLength=e.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=t[0]|t[1]<<8;this._r[0]=8191&r;var n=t[2]|t[3]<<8;this._r[1]=8191&(r>>>13|n<<3);var i=t[4]|t[5]<<8;this._r[2]=7939&(n>>>10|i<<6);var o=t[6]|t[7]<<8;this._r[3]=8191&(i>>>7|o<<9);var a=t[8]|t[9]<<8;this._r[4]=255&(o>>>4|a<<12),this._r[5]=a>>>1&8190;var s=t[10]|t[11]<<8;this._r[6]=8191&(a>>>14|s<<2);var c=t[12]|t[13]<<8;this._r[7]=8065&(s>>>11|c<<5);var u=t[14]|t[15]<<8;this._r[8]=8191&(c>>>8|u<<8),this._r[9]=u>>>5&127,this._pad[0]=t[16]|t[17]<<8,this._pad[1]=t[18]|t[19]<<8,this._pad[2]=t[20]|t[21]<<8,this._pad[3]=t[22]|t[23]<<8,this._pad[4]=t[24]|t[25]<<8,this._pad[5]=t[26]|t[27]<<8,this._pad[6]=t[28]|t[29]<<8,this._pad[7]=t[30]|t[31]<<8}return t.prototype._blocks=function(e,t,r){for(var n=this._fin?0:2048,i=this._h[0],o=this._h[1],a=this._h[2],s=this._h[3],c=this._h[4],u=this._h[5],l=this._h[6],f=this._h[7],d=this._h[8],h=this._h[9],p=this._r[0],m=this._r[1],b=this._r[2],g=this._r[3],y=this._r[4],v=this._r[5],w=this._r[6],E=this._r[7],A=this._r[8],x=this._r[9];r>=16;){var _=e[t+0]|e[t+1]<<8;i+=8191&_;var k=e[t+2]|e[t+3]<<8;o+=8191&(_>>>13|k<<3);var S=e[t+4]|e[t+5]<<8;a+=8191&(k>>>10|S<<6);var P=e[t+6]|e[t+7]<<8;s+=8191&(S>>>7|P<<9);var I=e[t+8]|e[t+9]<<8;c+=8191&(P>>>4|I<<12),u+=I>>>1&8191;var T=e[t+10]|e[t+11]<<8;l+=8191&(I>>>14|T<<2);var O=e[t+12]|e[t+13]<<8;f+=8191&(T>>>11|O<<5);var M=e[t+14]|e[t+15]<<8,C=0,B=C;B+=i*p,B+=o*(5*x),B+=a*(5*A),B+=s*(5*E),C=(B+=c*(5*w))>>>13,B&=8191,B+=u*(5*v),B+=l*(5*y),B+=f*(5*g),B+=(d+=8191&(O>>>8|M<<8))*(5*b);var N=C+=(B+=(h+=M>>>5|n)*(5*m))>>>13;N+=i*m,N+=o*p,N+=a*(5*x),N+=s*(5*A),C=(N+=c*(5*E))>>>13,N&=8191,N+=u*(5*w),N+=l*(5*v),N+=f*(5*y),N+=d*(5*g),C+=(N+=h*(5*b))>>>13,N&=8191;var R=C;R+=i*b,R+=o*m,R+=a*p,R+=s*(5*x),C=(R+=c*(5*A))>>>13,R&=8191,R+=u*(5*E),R+=l*(5*w),R+=f*(5*v),R+=d*(5*y);var F=C+=(R+=h*(5*g))>>>13;F+=i*g,F+=o*b,F+=a*m,F+=s*p,C=(F+=c*(5*x))>>>13,F&=8191,F+=u*(5*A),F+=l*(5*E),F+=f*(5*w),F+=d*(5*v);var L=C+=(F+=h*(5*y))>>>13;L+=i*y,L+=o*g,L+=a*b,L+=s*m,C=(L+=c*p)>>>13,L&=8191,L+=u*(5*x),L+=l*(5*A),L+=f*(5*E),L+=d*(5*w);var j=C+=(L+=h*(5*v))>>>13;j+=i*v,j+=o*y,j+=a*g,j+=s*b,C=(j+=c*m)>>>13,j&=8191,j+=u*p,j+=l*(5*x),j+=f*(5*A),j+=d*(5*E);var U=C+=(j+=h*(5*w))>>>13;U+=i*w,U+=o*v,U+=a*y,U+=s*g,C=(U+=c*b)>>>13,U&=8191,U+=u*m,U+=l*p,U+=f*(5*x),U+=d*(5*A);var D=C+=(U+=h*(5*E))>>>13;D+=i*E,D+=o*w,D+=a*v,D+=s*y,C=(D+=c*g)>>>13,D&=8191,D+=u*b,D+=l*m,D+=f*p,D+=d*(5*x);var z=C+=(D+=h*(5*A))>>>13;z+=i*A,z+=o*E,z+=a*w,z+=s*v,C=(z+=c*y)>>>13,z&=8191,z+=u*g,z+=l*b,z+=f*m,z+=d*p;var $=C+=(z+=h*(5*x))>>>13;$+=i*x,$+=o*A,$+=a*E,$+=s*w,C=($+=c*v)>>>13,$&=8191,$+=u*y,$+=l*g,$+=f*b,$+=d*m,i=B=8191&(C=(C=((C+=($+=h*p)>>>13)<<2)+C|0)+(B&=8191)|0),o=N+=C>>>=13,a=R&=8191,s=F&=8191,c=L&=8191,u=j&=8191,l=U&=8191,f=D&=8191,d=z&=8191,h=$&=8191,t+=16,r-=16}this._h[0]=i,this._h[1]=o,this._h[2]=a,this._h[3]=s,this._h[4]=c,this._h[5]=u,this._h[6]=l,this._h[7]=f,this._h[8]=d,this._h[9]=h},t.prototype.finish=function(e,t){void 0===t&&(t=0);var r,n,i,o,a=new Uint16Array(10);if(this._leftover){for(o=this._leftover,this._buffer[o++]=1;o<16;o++)this._buffer[o]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(r=this._h[1]>>>13,this._h[1]&=8191,o=2;o<10;o++)this._h[o]+=r,r=this._h[o]>>>13,this._h[o]&=8191;for(this._h[0]+=5*r,r=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=r,r=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=r,a[0]=this._h[0]+5,r=a[0]>>>13,a[0]&=8191,o=1;o<10;o++)a[o]=this._h[o]+r,r=a[o]>>>13,a[o]&=8191;for(a[9]-=8192,n=(1^r)-1,o=0;o<10;o++)a[o]&=n;for(n=~n,o=0;o<10;o++)this._h[o]=this._h[o]&n|a[o];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),i=this._h[0]+this._pad[0],this._h[0]=65535&i,o=1;o<8;o++)i=(this._h[o]+this._pad[o]|0)+(i>>>16)|0,this._h[o]=65535&i;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var t,r=0,n=e.length;if(this._leftover){(t=16-this._leftover)>n&&(t=n);for(var i=0;i=16&&(t=n-n%16,this._blocks(e,r,t),r+=t,n-=t),n){for(i=0;i16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var a=new Uint8Array(16);a.set(e,a.length-e.length);var s=new Uint8Array(32);t.stream(this._key,a,s,4);var c,u=r.length+this.tagLength;if(o){if(o.length!==u)throw new Error("ChaCha20Poly1305: incorrect destination length");c=o}else c=new Uint8Array(u);return t.streamXOR(this._key,a,r,c,4),this._authenticate(c.subarray(c.length-this.tagLength,c.length),s,c.subarray(0,c.length-this.tagLength),i),n.wipe(a),c},s.prototype.open=function(e,r,i,a){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(r.length0&&c.update(a.subarray(s.length%16))),c.update(o),o.length%16>0&&c.update(a.subarray(o.length%16));var u=new Uint8Array(8);s&&i.writeUint64LE(s.length,u),c.update(u),i.writeUint64LE(o.length,u),c.update(u);for(var l=c.digest(),f=0;fthis.blockSize?this._inner.update(t).finish(r).clean():r.set(t);for(var n=0;n1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(e){for(var t=new Uint8Array(e),r=0;r256)throw new Error("randomString charset is too long");let s="";const c=r.length,u=256-256%c;for(;t>0;){const e=i(Math.ceil(256*t/u),a);for(let n=0;n0;n++){const i=e[n];i0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[r++],t--;this._bufferLength===this.blockSize&&(o(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(r=o(this._temp,this._state,e,r,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[r++],t--;return this},n.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,a=r<<3,s=r%64<56?64:128;this._buffer[n]=128;for(var c=n+1;c0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},n.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},n.prototype.cleanSavedState=function(e){r.wipe(e.state),e.buffer&&r.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},n}();e.SHA256=n;var i=new Int32Array([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]);function o(e,r,n,o,a){for(;a>=64;){for(var s=r[0],c=r[1],u=r[2],l=r[3],f=r[4],d=r[5],h=r[6],p=r[7],m=0;m<16;m++){var b=o+4*m;e[m]=t.readUint32BE(n,b)}for(m=16;m<64;m++){var g=e[m-2],y=(g>>>17|g<<15)^(g>>>19|g<<13)^g>>>10,v=((g=e[m-15])>>>7|g<<25)^(g>>>18|g<<14)^g>>>3;e[m]=(y+e[m-7]|0)+(v+e[m-16]|0)}for(m=0;m<64;m++){y=(((f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&d^~f&h)|0)+(p+(i[m]+e[m]|0)|0)|0,v=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&c^s&u^c&u)|0;p=h,h=d,d=f,f=l+y|0,l=u,u=c,c=s,s=y+v|0}r[0]+=s,r[1]+=c,r[2]+=u,r[3]+=l,r[4]+=f,r[5]+=d,r[6]+=h,r[7]+=p,o+=64,a-=64}return o}e.hash=function(e){var t=new n;t.update(e);var r=t.digest();return t.clean(),r}}({});!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sharedKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.scalarMultBase=e.scalarMult=e.SHARED_KEY_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=void 0;const t=i1,r=j0;function n(e){const t=new Float64Array(16);if(e)for(let r=0;r=0;--e){const t=r[e>>>3]>>>(7&e)&1;s(d,h,t),s(p,m,t),c(b,d,p),u(d,d,p),c(p,h,m),u(h,h,m),f(m,b),f(g,d),l(d,p,d),l(p,h,b),c(b,d,p),u(d,d,p),f(h,d),u(p,m,g),l(d,p,o),c(d,d,m),l(p,p,d),l(d,m,g),l(m,h,i),f(h,b),s(d,h,t),s(p,m,t)}for(let e=0;e<16;e++)i[e+16]=d[e],i[e+32]=p[e],i[e+48]=h[e],i[e+64]=m[e];const y=i.subarray(32),v=i.subarray(16);!function(e,t){const r=n();for(let e=0;e<16;e++)r[e]=t[e];for(let e=253;e>=0;e--)f(r,r),2!==e&&4!==e&&l(r,r,t);for(let t=0;t<16;t++)e[t]=r[t]}(y,y),l(v,v,y);const w=new Uint8Array(32);return function(e,t){const r=n(),i=n();for(let e=0;e<16;e++)i[e]=t[e];a(i),a(i),a(i);for(let e=0;e<2;e++){r[0]=i[0]-65517;for(let e=1;e<15;e++)r[e]=i[e]-65535-(r[e-1]>>16&1),r[e-1]&=65535;r[15]=i[15]-32767-(r[14]>>16&1);const e=r[15]>>16&1;r[14]&=65535,s(i,r,1-e)}for(let t=0;t<16;t++)e[2*t]=255&i[t],e[2*t+1]=i[t]>>8}(w,v),w}function h(e){return d(e,i)}function p(t){if(t.length!==e.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${e.SECRET_KEY_LENGTH} bytes`);const r=new Uint8Array(t);return{publicKey:h(r),secretKey:r}}e.scalarMult=d,e.scalarMultBase=h,e.generateKeyPairFromSeed=p,e.generateKeyPair=function(e){const n=(0,t.randomBytes)(32,e),i=p(n);return(0,r.wipe)(n),i},e.sharedKey=function(t,r,n=!1){if(t.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(r.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const i=d(t,r);if(n){let e=0;for(let t=0;t=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,a=new Uint8Array(o);e[t];){var l=r[e.charCodeAt(t)];if(255===l)return;for(var f=0,d=o-1;(0!==l||f>>0,a[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=f,t++}if(" "!==e[t]){for(var h=o-i;h!==o&&0===a[h];)h++;for(var p=new Uint8Array(n+(o-h)),m=n;h!==o;)p[m++]=a[h++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var a=(o-i)*l+1>>>0,u=new Uint8Array(a);i!==o;){for(var f=t[i],d=0,h=a-1;(0!==f||d>>0,u[h]=f%s>>>0,f=f/s>>>0;if(0!==f)throw new Error("Non-zero carry");n=d,i++}for(var p=a-n;p!==a&&0===u[p];)p++;for(var m=c.repeat(r);pnew m1({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class g1{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new h1(e,t,r),this.decoder=new p1(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const y1=({name:e,prefix:t,encode:r,decode:n})=>new g1(e,t,r,n),v1=({prefix:e,name:t,alphabet:r})=>{const{encode:n,decode:i}=d1(r,t);return y1({prefix:e,name:t,encode:n,decode:e=>(e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")})(i(e))})},w1=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>y1({prefix:t,name:e,encode:e=>((e,t,r)=>{const n="="===t[t.length-1],i=(1<r;)a-=r,o+=t[i&s>>a];if(a&&(o+=t[i&s<((e,t,r,n)=>{const i={};for(let e=0;e=8&&(s-=8,a[u++]=255&c>>s)}if(s>=r||255&c<<8-s)throw new SyntaxError("Unexpected end of data");return a})(t,n,r,e)});y1({prefix:"\0",name:"identity",encode:e=>{return t=e,(new TextDecoder).decode(t);var t},decode:e=>(e=>(new TextEncoder).encode(e))(e)}),w1({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),w1({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),v1({prefix:"9",name:"base10",alphabet:"0123456789"}),w1({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),w1({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),w1({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),w1({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),w1({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),w1({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),w1({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),w1({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),w1({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),w1({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),w1({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),v1({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),v1({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),v1({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),v1({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),w1({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),w1({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),w1({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),w1({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});const E1=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),A1=E1.reduce(((e,t,r)=>(e[r]=t,e)),[]),x1=E1.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);y1({prefix:"🚀",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=A1[t]),"")},decode:function(e){const t=[];for(const r of e){const e=x1[r.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}}),new TextEncoder,new TextDecoder;const _1=":";function k1(e){const[t,r]=e.split(_1);return{namespace:t,reference:r}}function S1(e){const[t,r,n]=e.split(_1);return{namespace:t,reference:r,address:n}}function P1(e){const{namespace:t,reference:r}=S1(e);return function(e){const{namespace:t,reference:r}=e;return[t,r].join(_1)}({namespace:t,reference:r})}function I1(e,t=[]){const r=[];return Object.keys(e).forEach((n=>{if(t.length&&!t.includes(n))return;const i=e[n];r.push(...i.accounts)})),r}function T1(e,t=[]){const r=[];return Object.keys(e).forEach((n=>{if(t.length&&!t.includes(n))return;const i=e[n];r.push(...function(e){return function(e,t){const r=[];return e.forEach((e=>{const n=t(e);r.includes(n)||r.push(n)})),r}(e,P1)}(i.accounts))})),r}var O1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof u<"u"?u:typeof self<"u"?self:{};var M1; /** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT */M1={exports:{}},function(){var e="input is invalid type",t="object"==typeof window,r=t?window:{};r.JS_SHA3_NO_WINDOW&&(t=!1);var n=!t&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof pr&&pr.versions&&pr.versions.node?r=O1:n&&(r=self);var i=!r.JS_SHA3_NO_COMMON_JS&&M1.exports,o=!r.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",a="0123456789abcdef".split(""),s=[4,1024,262144,67108864],c=[0,8,16,24],u=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],l=[224,256,384,512],f=[128,256],d=["hex","buffer","arrayBuffer","array","digest"],h={128:168,256:136};(r.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),o&&(r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var p=function(e,t,r){return function(n){return new T(e,t,e).update(n)[r]()}},m=function(e,t,r){return function(n,i){return new T(e,t,i).update(n)[r]()}},b=function(e,t,r){return function(t,n,i,o){return E["cshake"+e].update(t,n,i,o)[r]()}},g=function(e,t,r){return function(t,n,i,o){return E["kmac"+e].update(t,n,i,o)[r]()}},y=function(e,t,r,n){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function O(e,t,r){T.call(this,e,t,r)}T.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(o&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||o&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}for(var i,a,s=this.blocks,u=this.byteCount,l=t.length,f=this.blockCount,d=0,h=this.s;d>2]|=t[d]<>2]|=a<>2]|=(192|a>>6)<>2]|=(128|63&a)<=57344?(s[i>>2]|=(224|a>>12)<>2]|=(128|a>>6&63)<>2]|=(128|63&a)<>2]|=(240|a>>18)<>2]|=(128|a>>12&63)<>2]|=(128|a>>6&63)<>2]|=(128|63&a)<=u){for(this.start=i-u,this.block=s[f],i=0;i>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},T.prototype.encodeString=function(t){var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(o&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||o&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}var i=0,a=t.length;if(r)i=a;else for(var s=0;s=57344?i+=3:(c=65536+((1023&c)<<10|1023&t.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(t),i},T.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+a[15&e]+a[e>>12&15]+a[e>>8&15]+a[e>>20&15]+a[e>>16&15]+a[e>>28&15]+a[e>>24&15];s%t==0&&(M(r),o=0)}return i&&(e=r[o],c+=a[e>>4&15]+a[15&e],i>1&&(c+=a[e>>12&15]+a[e>>8&15]),i>2&&(c+=a[e>>20&15]+a[e>>16&15])),c},T.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var c=new Uint32Array(e);a>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;s%r==0&&M(n)}return o&&(e=s<<2,t=n[a],c[e]=255&t,o>1&&(c[e+1]=t>>8&255),o>2&&(c[e+2]=t>>16&255)),c},O.prototype=new T,O.prototype.finalize=function(){return this.encode(this.outputBits,!0),T.prototype.finalize.call(this)};var M=function(e){var t,r,n,i,o,a,s,c,l,f,d,h,p,m,b,g,y,v,w,E,A,x,_,k,S,P,I,T,O,M,C,B,N,R,F,L,j,U,D,z,$,H,G,q,K,V,W,J,Z,Y,X,Q,ee,te,re,ne,ie,oe,ae,se,ce,ue,le;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],l=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],d=e[7]^e[17]^e[27]^e[37]^e[47],t=(h=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),r=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(c<<1|l>>>31),r=o^(l<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=a^(f<<1|d>>>31),r=s^(d<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(h<<1|p>>>31),r=l^(p<<1|h>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(i<<1|o>>>31),r=d^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,m=e[0],b=e[1],V=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,T=e[20]<<3|e[21]>>>29,O=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,R=e[2]<<1|e[3]>>>31,F=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,y=e[12]<<12|e[13]>>>20,J=e[22]<<10|e[23]>>>22,Z=e[23]<<10|e[22]>>>22,M=e[33]<<13|e[32]>>>19,C=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,L=e[14]<<6|e[15]>>>26,j=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,Y=e[34]<<15|e[35]>>>17,X=e[35]<<15|e[34]>>>17,B=e[45]<<29|e[44]>>>3,N=e[44]<<29|e[45]>>>3,k=e[6]<<28|e[7]>>>4,S=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,D=e[27]<<25|e[26]>>>7,E=e[36]<<21|e[37]>>>11,A=e[37]<<21|e[36]>>>11,Q=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,q=e[8]<<27|e[9]>>>5,K=e[9]<<27|e[8]>>>5,P=e[18]<<20|e[19]>>>12,I=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ae=e[28]<<7|e[29]>>>25,z=e[38]<<8|e[39]>>>24,$=e[39]<<8|e[38]>>>24,x=e[48]<<14|e[49]>>>18,_=e[49]<<14|e[48]>>>18,e[0]=m^~g&v,e[1]=b^~y&w,e[10]=k^~P&T,e[11]=S^~I&O,e[20]=R^~L&U,e[21]=F^~j&D,e[30]=q^~V&J,e[31]=K^~W&Z,e[40]=te^~ne&oe,e[41]=re^~ie&ae,e[2]=g^~v&E,e[3]=y^~w&A,e[12]=P^~T&M,e[13]=I^~O&C,e[22]=L^~U&z,e[23]=j^~D&$,e[32]=V^~J&Y,e[33]=W^~Z&X,e[42]=ne^~oe&se,e[43]=ie^~ae&ce,e[4]=v^~E&x,e[5]=w^~A&_,e[14]=T^~M&B,e[15]=O^~C&N,e[24]=U^~z&H,e[25]=D^~$&G,e[34]=J^~Y&Q,e[35]=Z^~X&ee,e[44]=oe^~se&ue,e[45]=ae^~ce&le,e[6]=E^~x&m,e[7]=A^~_&b,e[16]=M^~B&k,e[17]=C^~N&S,e[26]=z^~H&R,e[27]=$^~G&F,e[36]=Y^~Q&q,e[37]=X^~ee&K,e[46]=se^~ue&te,e[47]=ce^~le&re,e[8]=x^~m&g,e[9]=_^~b&y,e[18]=B^~k&P,e[19]=N^~S&I,e[28]=H^~R&L,e[29]=G^~F&j,e[38]=Q^~q&V,e[39]=ee^~K&W,e[48]=ue^~te&ne,e[49]=le^~re&ie,e[0]^=u[n],e[1]^=u[n+1]};if(i)M1.exports=E;else for(x=0;x{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch{e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var j1,U1;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(j1||(j1={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(U1||(U1={}));const D1="0123456789abcdef";class z1{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==N1[r]&&this.throwArgumentError("invalid log level name","logLevel",e),!(R1>N1[r])&&console.log.apply(console,t)}debug(...e){this._log(z1.levels.DEBUG,e)}info(...e){this._log(z1.levels.INFO,e)}warn(...e){this._log(z1.levels.WARNING,e)}makeError(e,t,r){if(B1)return this.makeError("censored error",t,{});t||(t=z1.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((e=>{const t=r[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e>4],r+=D1[15&t[e]];n.push(e+"=Uint8Array(0x"+r+")")}else n.push(e+"="+JSON.stringify(t))}catch{n.push(e+"="+JSON.stringify(r[e].toString()))}})),n.push(`code=${t}`),n.push(`version=${this.version}`);const i=e;let o="";switch(t){case U1.NUMERIC_FAULT:{o="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":o+="-"+t;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case U1.CALL_EXCEPTION:case U1.INSUFFICIENT_FUNDS:case U1.MISSING_NEW:case U1.NONCE_EXPIRED:case U1.REPLACEMENT_UNDERPRICED:case U1.TRANSACTION_REPLACED:case U1.UNPREDICTABLE_GAS_LIMIT:o=t}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const a=new Error(e);return a.reason=i,a.code=t,Object.keys(r).forEach((function(e){a[e]=r[e]})),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,z1.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){L1&&this.throwError("platform missing String.prototype.normalize",z1.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:L1})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,z1.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,z1.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",et&&this.throwError("too many arguments"+r,z1.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||null==e)&&this.throwError("missing new",z1.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",z1.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||null==e)&&this.throwError("missing new",z1.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return F1||(F1=new z1("logger/5.7.0")),F1}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",z1.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),C1){if(!e)return;this.globalLogger().throwError("error censorship permanent",z1.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}B1=!!e,C1=!!t}static setLogLevel(e){const t=N1[e.toLowerCase()];null!=t?R1=t:z1.globalLogger().warn("invalid log level - "+e)}static from(e){return new z1(e)}}z1.errors=U1,z1.levels=j1;const $1=new z1("bytes/5.7.0");function H1(e){return!!e.toHexString}function G1(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return G1(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function q1(e){return"number"==typeof e&&e==e&&e%1==0}function K1(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e||!q1(e.length)||e.length<0)return!1;for(let t=0;t=256)return!1}return!0}function V1(e,t){if(t||(t={}),"number"==typeof e){$1.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),G1(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),H1(e)&&(e=e.toHexString()),W1(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":$1.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e>4]+J1[15&n]}return t}return $1.throwArgumentError("invalid hexlify value","value",e)}function Y1(e,t){for("string"!=typeof e?e=Z1(e):W1(e)||$1.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&$1.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}var X1={exports:{}},Q1=function(e){var t=e.default;if("function"==typeof t){var r=function(){return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}(Object.freeze({__proto__:null,default:{}}));!function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&(("le"===t||"be"===t)&&(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o=typeof window<"u"&&typeof window.Buffer<"u"?window.Buffer:Q1.Buffer}catch{}function a(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function s(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function c(e,t,n,i){for(var o=0,a=0,s=Math.min(e.length,n),c=t;c=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=s(e,t,n)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,l=r;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},typeof Symbol<"u"&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch{i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),n=0!==o||a!==this.length-1?f[6-c.length]+c+n:c+n}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=d[e],l=h[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(e);n=(p=p.idivn(l)).isZero()?m+n:f[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function p(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u>>26,f=67108863&c,d=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=d;h++){var p=u-h|0;l+=(a=(i=0|e.words[p])*(o=0|t.words[h])+f)/67108864|0,f=67108863&a}r.words[u]=0|f,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r._strip()}i.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r=0&&(e[r--]=a>>8&255),r>=0&&(e[r--]=a>>16&255),6===o?(r>=0&&(e[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,m=h>>>13,b=0|a[2],g=8191&b,y=b>>>13,v=0|a[3],w=8191&v,E=v>>>13,A=0|a[4],x=8191&A,_=A>>>13,k=0|a[5],S=8191&k,P=k>>>13,I=0|a[6],T=8191&I,O=I>>>13,M=0|a[7],C=8191&M,B=M>>>13,N=0|a[8],R=8191&N,F=N>>>13,L=0|a[9],j=8191&L,U=L>>>13,D=0|s[0],z=8191&D,$=D>>>13,H=0|s[1],G=8191&H,q=H>>>13,K=0|s[2],V=8191&K,W=K>>>13,J=0|s[3],Z=8191&J,Y=J>>>13,X=0|s[4],Q=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],fe=8191&le,de=le>>>13,he=0|s[9],pe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(u+(n=Math.imul(f,z))|0)+((8191&(i=(i=Math.imul(f,$))+Math.imul(d,z)|0))<<13)|0;u=((o=Math.imul(d,$))+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,$))+Math.imul(m,z)|0,o=Math.imul(m,$);var ge=(u+(n=n+Math.imul(f,G)|0)|0)+((8191&(i=(i=i+Math.imul(f,q)|0)+Math.imul(d,G)|0))<<13)|0;u=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,z),i=(i=Math.imul(g,$))+Math.imul(y,z)|0,o=Math.imul(y,$),n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,q)|0;var ye=(u+(n=n+Math.imul(f,V)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,W)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(w,z),i=(i=Math.imul(w,$))+Math.imul(E,z)|0,o=Math.imul(E,$),n=n+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var ve=(u+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(x,z),i=(i=Math.imul(x,$))+Math.imul(_,z)|0,o=Math.imul(_,$),n=n+Math.imul(w,G)|0,i=(i=i+Math.imul(w,q)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,q)|0,n=n+Math.imul(g,V)|0,i=(i=i+Math.imul(g,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,Y)|0;var we=(u+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,ee)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(S,z),i=(i=Math.imul(S,$))+Math.imul(P,z)|0,o=Math.imul(P,$),n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,q)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,Y)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0;var Ee=(u+(n=n+Math.imul(f,re)|0)|0)+((8191&(i=(i=i+Math.imul(f,ne)|0)+Math.imul(d,re)|0))<<13)|0;u=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(T,z),i=(i=Math.imul(T,$))+Math.imul(O,z)|0,o=Math.imul(O,$),n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,Y)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0;var Ae=(u+(n=n+Math.imul(f,oe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ae)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(C,z),i=(i=Math.imul(C,$))+Math.imul(B,z)|0,o=Math.imul(B,$),n=n+Math.imul(T,G)|0,i=(i=i+Math.imul(T,q)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,q)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,W)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,ee)|0,n=n+Math.imul(g,re)|0,i=(i=i+Math.imul(g,ne)|0)+Math.imul(y,re)|0,o=o+Math.imul(y,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var xe=(u+(n=n+Math.imul(f,ce)|0)|0)+((8191&(i=(i=i+Math.imul(f,ue)|0)+Math.imul(d,ce)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(R,z),i=(i=Math.imul(R,$))+Math.imul(F,z)|0,o=Math.imul(F,$),n=n+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,q)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,W)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,Y)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(E,re)|0,o=o+Math.imul(E,ne)|0,n=n+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,ue)|0;var _e=(u+(n=n+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,de)|0)+Math.imul(d,fe)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(j,z),i=(i=Math.imul(j,$))+Math.imul(U,z)|0,o=Math.imul(U,$),n=n+Math.imul(R,G)|0,i=(i=i+Math.imul(R,q)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,q)|0,n=n+Math.imul(C,V)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,W)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,Y)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,ae)|0,n=n+Math.imul(g,ce)|0,i=(i=i+Math.imul(g,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,n=n+Math.imul(p,fe)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(m,fe)|0,o=o+Math.imul(m,de)|0;var ke=(u+(n=n+Math.imul(f,pe)|0)|0)+((8191&(i=(i=i+Math.imul(f,me)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(j,G),i=(i=Math.imul(j,q))+Math.imul(U,G)|0,o=Math.imul(U,q),n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(F,V)|0,o=o+Math.imul(F,W)|0,n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,Y)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,ee)|0,n=n+Math.imul(S,re)|0,i=(i=i+Math.imul(S,ne)|0)+Math.imul(P,re)|0,o=o+Math.imul(P,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,n=n+Math.imul(g,fe)|0,i=(i=i+Math.imul(g,de)|0)+Math.imul(y,fe)|0,o=o+Math.imul(y,de)|0;var Se=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(j,V),i=(i=Math.imul(j,W))+Math.imul(U,V)|0,o=Math.imul(U,W),n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(F,Z)|0,o=o+Math.imul(F,Y)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ne)|0,n=n+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,ae)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,ae)|0,n=n+Math.imul(x,ce)|0,i=(i=i+Math.imul(x,ue)|0)+Math.imul(_,ce)|0,o=o+Math.imul(_,ue)|0,n=n+Math.imul(w,fe)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(E,fe)|0,o=o+Math.imul(E,de)|0;var Pe=(u+(n=n+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,me)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(j,Z),i=(i=Math.imul(j,Y))+Math.imul(U,Z)|0,o=Math.imul(U,Y),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ne)|0,n=n+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,n=n+Math.imul(S,ce)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(P,ce)|0,o=o+Math.imul(P,ue)|0,n=n+Math.imul(x,fe)|0,i=(i=i+Math.imul(x,de)|0)+Math.imul(_,fe)|0,o=o+Math.imul(_,de)|0;var Ie=(u+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(j,Q),i=(i=Math.imul(j,ee))+Math.imul(U,Q)|0,o=Math.imul(U,ee),n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(F,re)|0,o=o+Math.imul(F,ne)|0,n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,ae)|0,n=n+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(O,ce)|0,o=o+Math.imul(O,ue)|0,n=n+Math.imul(S,fe)|0,i=(i=i+Math.imul(S,de)|0)+Math.imul(P,fe)|0,o=o+Math.imul(P,de)|0;var Te=(u+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,me)|0)+Math.imul(_,pe)|0))<<13)|0;u=((o=o+Math.imul(_,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(j,re),i=(i=Math.imul(j,ne))+Math.imul(U,re)|0,o=Math.imul(U,ne),n=n+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,ae)|0)+Math.imul(F,oe)|0,o=o+Math.imul(F,ae)|0,n=n+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(B,ce)|0,o=o+Math.imul(B,ue)|0,n=n+Math.imul(T,fe)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(O,fe)|0,o=o+Math.imul(O,de)|0;var Oe=(u+(n=n+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,me)|0)+Math.imul(P,pe)|0))<<13)|0;u=((o=o+Math.imul(P,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(j,oe),i=(i=Math.imul(j,ae))+Math.imul(U,oe)|0,o=Math.imul(U,ae),n=n+Math.imul(R,ce)|0,i=(i=i+Math.imul(R,ue)|0)+Math.imul(F,ce)|0,o=o+Math.imul(F,ue)|0,n=n+Math.imul(C,fe)|0,i=(i=i+Math.imul(C,de)|0)+Math.imul(B,fe)|0,o=o+Math.imul(B,de)|0;var Me=(u+(n=n+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(j,ce),i=(i=Math.imul(j,ue))+Math.imul(U,ce)|0,o=Math.imul(U,ue),n=n+Math.imul(R,fe)|0,i=(i=i+Math.imul(R,de)|0)+Math.imul(F,fe)|0,o=o+Math.imul(F,de)|0;var Ce=(u+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,me)|0)+Math.imul(B,pe)|0))<<13)|0;u=((o=o+Math.imul(B,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(j,fe),i=(i=Math.imul(j,de))+Math.imul(U,fe)|0,o=Math.imul(U,de);var Be=(u+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,me)|0)+Math.imul(F,pe)|0))<<13)|0;u=((o=o+Math.imul(F,me)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863;var Ne=(u+(n=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(U,pe)|0))<<13)|0;return u=((o=Math.imul(U,me))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=be,c[1]=ge,c[2]=ye,c[3]=ve,c[4]=we,c[5]=Ee,c[6]=Ae,c[7]=xe,c[8]=_e,c[9]=ke,c[10]=Se,c[11]=Pe,c[12]=Ie,c[13]=Te,c[14]=Oe,c[15]=Me,c[16]=Ce,c[17]=Be,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function b(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function g(e,t,r){return b(e,t,r)}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?p(this,e,t):r<1024?b(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),r("number"==typeof e),r(e<67108864);for(var n=0,i=0;i>=26,n+=o/67108864|0,n+=a>>>26,this.words[i]=67108863&a}return 0!==n&&(this.words[i]=n,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i&1}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,u=0;u=0&&(0!==l||u>=i);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+n]=67108863&a}for(;i>26,this.words[i+n]=67108863&a;if(0===s)return this._strip();for(r(-1===s),s=0,i=0;i>26,this.words[i]=67108863&a;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),o=e,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,c=n.length-o.length;if("mod"!==t){(s=new i(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u=0;f--){var d=67108864*(0|n.words[o.length+f])+(0|n.words[o.length+f-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(o,d,f);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(o,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=d)}return s&&s._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var o,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),c=new i(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),f=t.clone();!t.isZero();){for(var d=0,h=1;!(t.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(f)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;!(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(f)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(s),a.isub(c)):(n.isub(t),s.isub(o),c.isub(a))}return{a:s,b:c,gcd:n.iushln(u)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t,n=this,o=e.clone();n=0!==n.negative?n.umod(e):n.clone();for(var a=new i(1),s=new i(0),c=o.clone();n.cmpn(1)>0&&o.cmpn(1)>0;){for(var u=0,l=1;!(n.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(n.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var f=0,d=1;!(o.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(o.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);n.cmp(o)>=0?(n.isub(o),a.isub(s)):(o.isub(n),s.isub(a))}return(t=0===n.cmpn(1)?a:s).cmpn(0)<0&&t.iadd(e),t},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return!(1&this.words[0])},i.prototype.isOdd=function(){return!(1&~this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new _(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function x(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function k(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},n(w,v),w.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new E;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new x}return y[e]=t,t},_.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},_.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new i(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var f=this.pow(l,o),d=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b=0;n--){for(var u=t.words[n],l=c-1;l>=0;l--){var f=u>>l&1;(o!==r[0]&&(o=this.sqr(o)),0!==f||0!==a)?(a<<=1,a|=f,(4===++s||0===n&&0===l)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}c=26}return o},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new k(e)},n(k,_),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,O1)}(X1);var e2=X1.exports;const t2="bignumber/5.7.0";var r2=e2.BN;const n2=new z1(t2),i2={},o2=9007199254740991;let a2=!1;class s2{constructor(e,t){e!==i2&&n2.throwError("cannot call constructor directly; use BigNumber.from",z1.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return u2(l2(this).fromTwos(e))}toTwos(e){return u2(l2(this).toTwos(e))}abs(){return"-"===this._hex[0]?s2.from(this._hex.substring(1)):this}add(e){return u2(l2(this).add(l2(e)))}sub(e){return u2(l2(this).sub(l2(e)))}div(e){return s2.from(e).isZero()&&f2("division-by-zero","div"),u2(l2(this).div(l2(e)))}mul(e){return u2(l2(this).mul(l2(e)))}mod(e){const t=l2(e);return t.isNeg()&&f2("division-by-zero","mod"),u2(l2(this).umod(t))}pow(e){const t=l2(e);return t.isNeg()&&f2("negative-power","pow"),u2(l2(this).pow(t))}and(e){const t=l2(e);return(this.isNegative()||t.isNeg())&&f2("unbound-bitwise-result","and"),u2(l2(this).and(t))}or(e){const t=l2(e);return(this.isNegative()||t.isNeg())&&f2("unbound-bitwise-result","or"),u2(l2(this).or(t))}xor(e){const t=l2(e);return(this.isNegative()||t.isNeg())&&f2("unbound-bitwise-result","xor"),u2(l2(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&f2("negative-width","mask"),u2(l2(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&f2("negative-width","shl"),u2(l2(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&f2("negative-width","shr"),u2(l2(this).shrn(e))}eq(e){return l2(this).eq(l2(e))}lt(e){return l2(this).lt(l2(e))}lte(e){return l2(this).lte(l2(e))}gt(e){return l2(this).gt(l2(e))}gte(e){return l2(this).gte(l2(e))}isNegative(){return"-"===this._hex[0]}isZero(){return l2(this).isZero()}toNumber(){try{return l2(this).toNumber()}catch{f2("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return n2.throwError("this platform does not support BigInt",z1.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?a2||(a2=!0,n2.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?n2.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",z1.errors.UNEXPECTED_ARGUMENT,{}):n2.throwError("BigNumber.toString does not accept parameters",z1.errors.UNEXPECTED_ARGUMENT,{})),l2(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof s2)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new s2(i2,c2(e)):e.match(/^-?[0-9]+$/)?new s2(i2,c2(new r2(e))):n2.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&f2("underflow","BigNumber.from",e),(e>=o2||e<=-o2)&&f2("overflow","BigNumber.from",e),s2.from(String(e));const t=e;if("bigint"==typeof t)return s2.from(t.toString());if(K1(t))return s2.from(Z1(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return s2.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(W1(e)||"-"===e[0]&&W1(e.substring(1))))return s2.from(e)}return n2.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function c2(e){if("string"!=typeof e)return c2(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&n2.throwArgumentError("invalid hex","value",e),"0x00"===(e=c2(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function u2(e){return s2.from(c2(e))}function l2(e){const t=s2.from(e).toHexString();return"-"===t[0]?new r2("-"+t.substring(3),16):new r2(t.substring(2),16)}function f2(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),n2.throwError(e,z1.errors.NUMERIC_FAULT,n)}const d2=new z1(t2),h2={},p2=s2.from(0),m2=s2.from(-1);function b2(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),d2.throwError(e,z1.errors.NUMERIC_FAULT,i)}let g2="0";for(;g2.length<256;)g2+=g2;function y2(e){if("number"!=typeof e)try{e=s2.from(e).toNumber()}catch{}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+g2.substring(0,e):d2.throwArgumentError("invalid decimal size","decimals",e)}function v2(e,t){null==t&&(t=0);const r=y2(t),n=(e=s2.from(e)).lt(p2);n&&(e=e.mul(m2));let i=e.mod(r).toString();for(;i.length2&&d2.throwArgumentError("too many decimal points","value",e);let o=i[0],a=i[1];for(o||(o="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>r.length-1&&b2("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.lengthnull==e[t]?n:(typeof e[t]!==r&&d2.throwArgumentError("invalid fixed format ("+t+" not "+r+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&d2.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&d2.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new E2(h2,t,r,n)}}class A2{constructor(e,t,r,n){e!==h2&&d2.throwError("cannot use FixedNumber constructor; use FixedNumber.from",z1.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&d2.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=w2(this._value,this.format.decimals),r=w2(e._value,e.format.decimals);return A2.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=w2(this._value,this.format.decimals),r=w2(e._value,e.format.decimals);return A2.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=w2(this._value,this.format.decimals),r=w2(e._value,e.format.decimals);return A2.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=w2(this._value,this.format.decimals),r=w2(e._value,e.format.decimals);return A2.fromValue(t.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=A2.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(x2.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=A2.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(x2.toFormat(t.format))),t}round(e){null==e&&(e=0);const t=this.toString().split(".");if(1===t.length&&t.push("0"),(e<0||e>80||e%1)&&d2.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=A2.from("1"+g2.substring(0,e),this.format),n=_2.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(e){if(null==e)return this._hex;e%8&&d2.throwArgumentError("invalid byte width","width",e);return Y1(s2.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return A2.fromString(this._value,e)}static fromValue(e,t,r){return null==r&&null!=t&&!function(e){return null!=e&&(s2.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||W1(e)||"bigint"==typeof e||K1(e))}(t)&&(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),A2.fromString(v2(e,t),E2.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=E2.from(t),n=w2(e,r.decimals);!r.signed&&n.lt(p2)&&b2("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=Y1(i,r.width/8));const o=v2(n,r.decimals);return new A2(h2,i,o,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=E2.from(t);if(V1(e).length>r.width/8)throw new Error("overflow");let n=s2.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),o=v2(n,r.decimals);return new A2(h2,i,o,r)}static from(e,t){if("string"==typeof e)return A2.fromString(e,t);if(K1(e))return A2.fromBytes(e,t);try{return A2.fromValue(e,0,t)}catch(e){if(e.code!==z1.errors.INVALID_ARGUMENT)throw e}return d2.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const x2=A2.from(1),_2=A2.from("0.5");var k2,S2;function P2(e,t){t||(t=function(e){return[parseInt(e,16)]});let r=0,n={};return e.split(",").forEach((e=>{let i=e.split(":");r+=parseInt(i[0],16),n[r]=t(i[1])})),n}function I2(e){let t=0;return e.split(",").map((e=>{let r=e.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=t+parseInt(r[0],16);return t=parseInt(r[1],16),{l:n,h:t}}))}function T2(e,t){null==t&&(t=1);const r=[],n=r.forEach,i=function(e,t){n.call(e,(function(e){t>0&&Array.isArray(e)?i(e,t-1):r.push(e)}))};return i(e,t),r}function O2(e){return function(e){let t=0;return()=>e[t++]}(function(e){let t=0;function r(){return e[t++]<<8|e[t++]}let n=r(),i=1,o=[0,1];for(let e=1;e>--c&1}const f=Math.pow(2,31),d=f>>>1,h=d>>1,p=f-1;let m=0;for(let e=0;e<31;e++)m=m<<1|l();let b=[],g=0,y=f;for(;;){let e=Math.floor(((m-g+1)*i-1)/y),t=0,r=n;for(;r-t>1;){let n=t+r>>>1;e>>1|l(),a=a<<1^d,s=(s^d)<<1|d|1;g=a,y=1+s-a}let v=n-4;return b.map((t=>{switch(t-v){case 3:return v+65792+(e[s++]<<16|e[s++]<<8|e[s++]);case 2:return v+256+(e[s++]<<8|e[s++]);case 1:return v+e[s++];default:return t-1}}))}(e))}function M2(e){return 1&e?~e>>1:e>>1}function C2(e,t){let r=Array(e);for(let n=0,i=-1;nt[e])):r}function R2(e,t,r){let n=Array(e).fill(void 0).map((()=>[]));for(let i=0;in[t].push(e)));return n}function F2(e,t){let r=1+t(),n=t(),i=function(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(r)}return t}(t);return T2(R2(i.length,1+e,t).map(((e,t)=>{const o=e[0],a=e.slice(1);return Array(i[t]).fill(void 0).map(((e,t)=>{let i=t*n;return[o+t*r,a.map((e=>e+i))]}))})))}function L2(e,t){return R2(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(k2||(k2={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(S2||(S2={})),I2("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((e=>parseInt(e,16))),P2("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),P2("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),P2("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(e){if(e.length%4!=0)throw new Error("bad data");let t=[];for(let r=0;re-t));(function r(){let n=[];for(;;){let i=N2(e,t);if(0==i.length)break;n.push({set:new Set(i),node:r()})}n.sort(((e,t)=>t.set.size-e.set.size));let i=e(),o=i%3;i=i/3|0;let a=!!(1&i);return i>>=1,{branches:n,valid:o,fe0f:a,save:1==i,check:2==i}})()}(j2);new Uint8Array(32).fill(0);new Uint8Array(32).fill(0),s2.from(-1);const U2=s2.from(0),D2=s2.from(1);s2.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Y1(D2.toHexString(),32),Y1(U2.toHexString(),32);var z2={},$2={},H2=G2;function G2(e,t){if(!e)throw new Error(t||"Assertion failed")}G2.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var q2={exports:{}};"function"==typeof Object.create?q2.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:q2.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}};var K2=H2,V2=q2.exports;function W2(e,t){return!(55296!=(64512&e.charCodeAt(t))||t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1))}function J2(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function Z2(e){return 1===e.length?"0"+e:e}function Y2(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}$2.inherits=V2,$2.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i>6|192,r[n++]=63&o|128):W2(e,i)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i>>0}return o},$2.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},$2.rotr32=function(e,t){return e>>>t|e<<32-t},$2.rotl32=function(e,t){return e<>>32-t},$2.sum32=function(e,t){return e+t>>>0},$2.sum32_3=function(e,t,r){return e+t+r>>>0},$2.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},$2.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},$2.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,a=(o>>0,e[t+1]=o},$2.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},$2.sum64_lo=function(e,t,r,n){return t+n>>>0},$2.sum64_4_hi=function(e,t,r,n,i,o,a,s){var c=0,u=t;return c+=(u=u+n>>>0)>>0)>>0)>>0},$2.sum64_4_lo=function(e,t,r,n,i,o,a,s){return t+n+o+s>>>0},$2.sum64_5_hi=function(e,t,r,n,i,o,a,s,c,u){var l=0,f=t;return l+=(f=f+n>>>0)>>0)>>0)>>0)>>0},$2.sum64_5_lo=function(e,t,r,n,i,o,a,s,c,u){return t+n+o+s+u>>>0},$2.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},$2.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},$2.shr64_hi=function(e,t,r){return e>>>r},$2.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0};var X2={},Q2=$2,e6=H2;function t6(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}X2.BlockHash=t6,t6.prototype.update=function(e,t){if(e=Q2.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=Q2.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o>>3},n6.g1_256=function(e){return i6(e,17)^i6(e,19)^e>>>10};var c6=$2,u6=X2,l6=n6,f6=c6.rotl32,d6=c6.sum32,h6=c6.sum32_5,p6=l6.ft_1,m6=u6.BlockHash,b6=[1518500249,1859775393,2400959708,3395469782];function g6(){if(!(this instanceof g6))return new g6;m6.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}c6.inherits(g6,m6);var y6=g6;g6.blockSize=512,g6.outSize=160,g6.hmacStrength=80,g6.padLength=64,g6.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;nthis.blockSize&&(e=(new this.Hash).update(e).digest()),L5(e.length<=this.blockSize);for(var t=e.length;t>8,a=255&i;o?r.push(o,a):r.push(a)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}})),G5=D5((function(e,t){var r=t;r.assert=z5,r.toArray=H5.toArray,r.zero2=H5.zero2,r.toHex=H5.toHex,r.encode=H5.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-c:c,o.isubn(s)):s=0,n[a]=s,o.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),1&c?a=3!==(n=e.andln(7)+i&7)&&5!==n||2!==u?c:-c:a=0,r[0].push(a),1&u?s=3!==(n=t.andln(7)+o&7)&&5!==n||2!==c?u:-u:s=0,r[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new e2(e,"hex","le")}})),q5=G5.getNAF,K5=G5.getJSF,V5=G5.assert;function W5(e,t){this.type=e,this.p=new e2(t.p,16),this.red=t.prime?e2.red(t.prime):e2.mont(this.p),this.zero=new e2(0).toRed(this.red),this.one=new e2(1).toRed(this.red),this.two=new e2(2).toRed(this.red),this.n=t.n&&new e2(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var J5=W5;function Z5(e,t){this.curve=e,this.type=t,this.precomputed=null}W5.prototype.point=function(){throw new Error("Not implemented")},W5.prototype.validate=function(){throw new Error("Not implemented")},W5.prototype._fixedNafMul=function(e,t){V5(e.precomputed);var r=e._getDoubles(),n=q5(t,1,this._bitLength),i=(1<=o;c--)a=(a<<1)+n[c];s.push(a)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),f=i;f>0;f--){for(o=0;o=0;s--){for(var c=0;s>=0&&0===o[s];s--)c++;if(s>=0&&c++,a=a.dblp(c),s<0)break;var u=o[s];V5(0!==u),a="affine"===e.type?u>0?a.mixedAdd(i[u-1>>1]):a.mixedAdd(i[-u-1>>1].neg()):u>0?a.add(i[u-1>>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},W5.prototype._wnafMulAdd=function(e,t,r,n,i){var o,a,s,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,f=0;for(o=0;o=1;o-=2){var h=o-1,p=o;if(1===c[h]&&1===c[p]){var m=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(m[1]=t[h].add(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].add(t[p].neg())):(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],g=K5(r[h],r[p]);for(f=Math.max(g[0].length,f),l[h]=new Array(f),l[p]=new Array(f),a=0;a=0;o--){for(var A=0;o>=0;){var x=!0;for(a=0;a=0&&A++,w=w.dblp(A),o<0)break;for(a=0;a0?s=u[a][_-1>>1]:_<0&&(s=u[a][-_-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(o=0;o=Math.ceil((e.bitLength()+1)/t.step)},Z5.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(o=t,a=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:i},{a:o,b:a}]},Q5.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),c=i.mul(r.b),u=o.mul(n.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},Q5.prototype.pointFromX=function(e,t){(e=new e2(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},Q5.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},Q5.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},t3.prototype.isInfinity=function(){return this.inf},t3.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},t3.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},t3.prototype.getX=function(){return this.x.fromRed()},t3.prototype.getY=function(){return this.y.fromRed()},t3.prototype.mul=function(e){return e=new e2(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},t3.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},t3.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},t3.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},t3.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},t3.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Y5(r3,J5.BasePoint),Q5.prototype.jpoint=function(e,t,r){return new r3(this,e,t,r)},r3.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},r3.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},r3.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(i),c=o.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),f=n.redMul(u),d=c.redSqr().redIAdd(l).redISub(f).redISub(f),h=c.redMul(f.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(d,h,p)},r3.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),l=r.redMul(c),f=s.redSqr().redIAdd(u).redISub(l).redISub(l),d=s.redMul(l.redISub(f)).redISub(i.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(f,d,h)},r3.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},r3.prototype.inspect=function(){return this.isInfinity()?"":""},r3.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var n3=D5((function(e,t){var r=t;r.base=J5,r.short=e3,r.mont=null,r.edwards=null})),i3=D5((function(e,t){var r,n=t,i=G5.assert;function o(e){"short"===e.type?this.curve=new n3.short(e):"edwards"===e.type?this.curve=new n3.edwards(e):this.curve=new n3.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new o(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=o,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:z2.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:z2.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:z2.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:z2.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:z2.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:z2.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:z2.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch{r=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:z2.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function o3(e){if(!(this instanceof o3))return new o3(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=H5.toArray(e.entropy,e.entropyEnc||"hex"),r=H5.toArray(e.nonce,e.nonceEnc||"hex"),n=H5.toArray(e.pers,e.persEnc||"hex");z5(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var a3=o3;o3.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},o3.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=H5.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var l3=G5.assert;function f3(e,t){if(e instanceof f3)return e;this._importDER(e,t)||(l3(e.r&&e.s,"Signature without r or s"),this.r=new e2(e.r,16),this.s=new e2(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var d3=f3;function h3(){this.place=0}function p3(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,a=t.place;o>>=0;return!(i<=127)&&(t.place=a,i)}function m3(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}f3.prototype._importDER=function(e,t){e=G5.toArray(e,t);var r=new h3;if(48!==e[r.place++])return!1;var n=p3(e,r);if(!1===n||n+r.place!==e.length||2!==e[r.place++])return!1;var i=p3(e,r);if(!1===i)return!1;var o=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var a=p3(e,r);if(!1===a||e.length!==a+r.place)return!1;var s=e.slice(r.place,a+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new e2(o),this.s=new e2(s),this.recoveryParam=null,!0},f3.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=m3(t),r=m3(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];b3(n,t.length),(n=n.concat(t)).push(2),b3(n,r.length);var i=n.concat(r),o=[48];return b3(o,i.length),o=o.concat(i),G5.encode(o,e)};var g3=function(){throw new Error("unsupported")},y3=G5.assert;function v3(e){if(!(this instanceof v3))return new v3(e);"string"==typeof e&&(y3(Object.prototype.hasOwnProperty.call(i3,e),"Unknown curve "+e),e=i3[e]),e instanceof i3.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var w3=v3;v3.prototype.keyPair=function(e){return new u3(this,e)},v3.prototype.keyFromPrivate=function(e,t){return u3.fromPrivate(this,e,t)},v3.prototype.keyFromPublic=function(e,t){return u3.fromPublic(this,e,t)},v3.prototype.genKeyPair=function(e){e||(e={});for(var t=new a3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||g3(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new e2(2));;){var i=new e2(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},v3.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},v3.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new e2(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),a=e.toArray("be",i),s=new a3({hash:this.hash,entropy:o,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new e2(1)),u=0;;u++){var l=n.k?n.k(u):new e2(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(c)>=0)){var f=this.g.mul(l);if(!f.isInfinity()){var d=f.getX(),h=d.umod(this.n);if(0!==h.cmpn(0)){var p=l.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(f.getY().isOdd()?1:0)|(0!==d.cmp(h)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new d3({r:h,s:p,recoveryParam:m})}}}}}},v3.prototype.verify=function(e,t,r,n){e=this._truncateToN(new e2(e,16)),r=this.keyFromPublic(r,n);var i=(t=new d3(t,"hex")).r,o=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),c=s.mul(e).umod(this.n),u=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,r.getPublic(),u)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(c,r.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},v3.prototype.recoverPubKey=function(e,t,r,n){y3((3&r)===r,"The recovery param is more than two bits"),t=new d3(t,n);var i=this.n,o=new e2(e),a=t.r,s=t.s,c=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var l=t.r.invm(i),f=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(f,a,d)},v3.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new d3(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch{continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var E3,A3=D5((function(e,t){var r=t;r.version="6.5.4",r.utils=G5,r.rand=function(){throw new Error("unsupported")},r.curve=n3,r.curves=i3,r.ec=w3,r.eddsa=null}));function x3(e,t,r){if(r>e.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return e.slice(t,r)}function _3(e){if(0===e[0])throw new Error("invalid RLP: extra zeros");return I3(function(e){let t="";for(let r=0;re.length)throw new Error("invalid RLP: total length is larger than the data");for(i=x3(e,r,n);i.length;)o=S3(i),a.push(o.data),i=o.remainder;return{data:a,remainder:e.subarray(n)}}}A3.ec,function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(E3||(E3={}));const P3=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function I3(e){const t=Number.parseInt(e,16);if(Number.isNaN(t))throw new Error("Invalid byte sequence");return t}function T3(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const t=new Uint8Array(e.length/2);for(let r=0;re+t.length),0),r=new Uint8Array(t);for(let t=0,n=0;t=2&&"0"===e[0]&&"x"===e[1]}function B3(e){if(e instanceof Uint8Array)return e;if("string"==typeof e)return C3(e)?T3((r="string"!=typeof(n=e)?n:C3(n)?n.slice(2):n).length%2?`0${r}`:r):(t=e,(new TextEncoder).encode(t));var t,r,n;if("number"==typeof e||"bigint"==typeof e)return e?T3(M3(e)):Uint8Array.from([]);if(null==e)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof e)}const N3={encode:function e(t){if(Array.isArray(t)){const r=[];let n=0;for(let i=0;i{if("string"!=typeof e)throw new Error("[stripHexPrefix] input must be type 'string', received "+typeof e);return R3(e)?e.slice(2):e};function L3(e){let t=e;if("string"!=typeof t)throw new Error("[padToEven] value must be type 'string', received "+typeof t);return t.length%2&&(t=`0${t}`),t}function j3(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))}const U3=function(e){if(!(e instanceof Uint8Array)){throw new Error(`This method only supports Uint8Array but input was: ${e}`)}},D3=BigInt(0),z3={},$3={};for(let e=0;e<16;e++){const t=e,r=16*e,n=e.toString(16).toLowerCase();$3[n]=t,$3[n.toUpperCase()]=t,z3[n]=r,z3[n.toUpperCase()]=r}function H3(e){const t=e.length,r=new Uint8Array(t/2);for(let n=0;nt.toString(16).padStart(2,"0"))),q3=e=>{let t="0x";if(void 0===e||0===e.length)return t;for(const r of e)t+=G3[r];return t},K3=[];for(let e=0;e<=65535;e++)K3[e]=BigInt(e);const V3=(e,t=!1)=>{t&&e.reverse();const r=q3(e);return"0x"===r?D3:4===r.length?K3[e[0]]:6===r.length?K3[256*e[0]+e[1]]:BigInt(r)},W3=e=>{if("string"!=typeof e)throw new Error(`hex argument type ${typeof e} must be of type string`);if(!/^0x[0-9a-fA-F]*$/.test(e))throw new Error(`Input must be a 0x-prefixed hexadecimal string, got ${e}`);return(e=e.slice(2)).length%2!=0&&(e=L3(e)),H3(e)},J3=e=>{if(!Number.isSafeInteger(e)||e<0)throw new Error(`Received an invalid integer type: ${e}`);return`0x${e.toString(16)}`},Z3=e=>{const t=J3(e);return W3(t)},Y3=(e,t=!1)=>{const r=t8("0x"+L3(e.toString(16)));return t?r.reverse():r},X3=e=>new Uint8Array(e),Q3=(e,t)=>(U3(e),((e,t)=>e.length(U3(e),(e=>{let t=e[0];for(;e.length>0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e})(e)),t8=e=>{if(null==e)return new Uint8Array;if(Array.isArray(e)||e instanceof Uint8Array)return Uint8Array.from(e);if("string"==typeof e){if(!j3(e))throw new Error(`Cannot convert string to Uint8Array. toBytes only supports 0x-prefixed hex strings and this string was given: ${e}`);return W3(e)}if("number"==typeof e)return Z3(e);if("bigint"==typeof e){if(e{if("0x"===e.slice(0,2))throw new Error("hex string is prefixed with 0x, should be unprefixed");return H3(L3(e))})(t)}if(void 0!==e.toBytes)return e.toBytes();throw new Error("invalid type")},r8=e=>"string"!=typeof e||R3(e)?e:"0x"+e,n8=e=>{for(const[t,r]of Object.entries(e))if(void 0!==r&&r.length>0&&0===r[0])throw new Error(`${t} cannot have leading zeroes, received: ${q3(r)}`)},i8=e=>"0x"+e.toString(16),o8=e=>e8(Y3(e)),a8=(...e)=>{if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);for(let t=0,n=0;t=t&&e<=r}toString(){return q3(this.bytes)}toBytes(){return new Uint8Array(this.bytes)}};var w8,E8,A8;function x8(e,t){if(null===e)return null;if(void 0===e)return;if("string"==typeof e&&!j3(e))throw new Error(`A string must be provided with a 0x-prefix, given: ${e}`);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");const r=t8(e);switch(t){case A8.Uint8Array:return r;case A8.BigInt:return V3(r);case A8.Number:{const e=V3(r);if(e>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(e)}case A8.PrefixedHexString:return q3(r);default:throw new Error("unknown outputType")}}function _8(e,t,r){const n=tp.sign(e,t),i=n.toCompactRawBytes();return{r:i.slice(0,32),s:i.slice(32,64),v:void 0===r?BigInt(n.recovery+27):BigInt(n.recovery+35)+BigInt(r)*d8}}!function(e){e.String="string",e.Bytes="view",e.Number="number"}(w8||(w8={})),function(e){e.String="string",e.Bytes="view",e.JSON="json"}(E8||(E8={})),function(e){e[e.Number=0]="Number",e[e.BigInt=1]="BigInt",e[e.Uint8Array=2]="Uint8Array",e[e.PrefixedHexString=3]="PrefixedHexString"}(A8||(A8={}));const k8=function(e,t,r,n,i){const o=a8(Q3(r,32),Q3(n,32)),a=function(e,t){return e===l8||e===f8?e:void 0===t?e-p8:e-(t*d8+BigInt(35))}(t,i);if(!function(e){return e===l8||e===f8}(a))throw new Error("Invalid signature v value");return tp.Signature.fromCompact(o).addRecoveryBit(Number(a)).recoverPublicKey(e).toRawBytes(!1).slice(1)},S8=4096,P8=131072;function I8(e){const t=new Uint8Array(131072);for(let r=0;r{const t=Ks(e),r=t.byteLength;if(0===r)throw Error("invalid blob data");if(r>262143)throw Error("blob data is too large");const n=Math.ceil(r/P8),i=function(e,t){const r=new Uint8Array(t*P8).fill(0);return r.set(e),r[e.byteLength]=128,r}(t,n),o=[];for(let e=0;e{const r=new Uint8Array(32);return r.set([t],0),r.set(_p(e).subarray(1),1),r},M8={mainnet:{name:"mainnet",chainId:1,networkId:1,defaultHardfork:"shanghai",consensus:{type:"pow",algorithm:"ethash",ethash:{}},comment:"The Ethereum main chain",url:"https://ethstats.net/",genesis:{gasLimit:5e3,difficulty:17179869184,nonce:"0x0000000000000042",extraData:"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa"},hardforks:[{name:"chainstart",block:0,forkHash:"0xfc64ec04"},{name:"homestead",block:115e4,forkHash:"0x97c2c34c"},{name:"dao",block:192e4,forkHash:"0x91d1f948"},{name:"tangerineWhistle",block:2463e3,forkHash:"0x7a64da13"},{name:"spuriousDragon",block:2675e3,forkHash:"0x3edd5b10"},{name:"byzantium",block:437e4,forkHash:"0xa00bc324"},{name:"constantinople",block:728e4,forkHash:"0x668db0af"},{name:"petersburg",block:728e4,forkHash:"0x668db0af"},{name:"istanbul",block:9069e3,forkHash:"0x879d6e30"},{name:"muirGlacier",block:92e5,forkHash:"0xe029e991"},{name:"berlin",block:12244e3,forkHash:"0x0eb440f6"},{name:"london",block:12965e3,forkHash:"0xb715077d"},{name:"arrowGlacier",block:13773e3,forkHash:"0x20c327fc"},{name:"grayGlacier",block:1505e4,forkHash:"0xf0afd0e3"},{name:"paris",ttd:"58750000000000000000000",block:15537394,forkHash:"0xf0afd0e3"},{name:"mergeForkIdTransition",block:null,forkHash:null},{name:"shanghai",block:null,timestamp:"1681338455",forkHash:"0xdce96c2d"},{name:"cancun",block:null,timestamp:"1710338135",forkHash:"0x9f3d2254"}],bootstrapNodes:[{ip:"18.138.108.67",port:30303,id:"d860a01f9722d78051619d1e2351aba3f43f943f6f00718d1b9baa4101932a1f5011f16bb2b1bb35db20d6fe28fa0bf09636d26a87d31de9ec6203eeedb1f666",location:"ap-southeast-1-001",comment:"bootnode-aws-ap-southeast-1-001"},{ip:"3.209.45.79",port:30303,id:"22a8232c3abc76a16ae9d6c3b164f98775fe226f0917b0ca871128a74a8e9630b458460865bab457221f1d448dd9791d24c4e5d88786180ac185df813a68d4de",location:"us-east-1-001",comment:"bootnode-aws-us-east-1-001"},{ip:"65.108.70.101",port:30303,id:"2b252ab6a1d0f971d9722cb839a42cb81db019ba44c08754628ab4a823487071b5695317c8ccd085219c3a03af063495b2f1da8d18218da2d6a82981b45e6ffc",location:"eu-west-1-001",comment:"bootnode-hetzner-hel"},{ip:"157.90.35.166",port:30303,id:"4aeb4ab6c14b23e2c4cfdce879c04b0748a20d8e9b59e25ded2a08143e265c6c25936e74cbc8e641e3312ca288673d91f2f93f8e277de3cfa444ecdaaf982052",location:"eu-central-1-001",comment:"bootnode-hetzner-fsn"}],dnsNetworks:["enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.mainnet.ethdisco.net"]},goerli:{name:"goerli",chainId:5,networkId:5,defaultHardfork:"shanghai",consensus:{type:"poa",algorithm:"clique",clique:{period:15,epoch:3e4}},comment:"Cross-client PoA test network",url:"https://github.com/goerli/testnet",genesis:{timestamp:"0x5c51a607",gasLimit:10485760,difficulty:1,nonce:"0x0000000000000000",extraData:"0x22466c6578692069732061207468696e6722202d204166726900000000000000e0a2bd4258d2768837baa26a28fe71dc079f84c70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"},hardforks:[{name:"chainstart",block:0,forkHash:"0xa3f5ab08"},{name:"homestead",block:0,forkHash:"0xa3f5ab08"},{name:"tangerineWhistle",block:0,forkHash:"0xa3f5ab08"},{name:"spuriousDragon",block:0,forkHash:"0xa3f5ab08"},{name:"byzantium",block:0,forkHash:"0xa3f5ab08"},{name:"constantinople",block:0,forkHash:"0xa3f5ab08"},{name:"petersburg",block:0,forkHash:"0xa3f5ab08"},{name:"istanbul",block:1561651,forkHash:"0xc25efa5c"},{name:"berlin",block:4460644,forkHash:"0x757a1c47"},{name:"london",block:5062605,forkHash:"0xb8c6299d"},{name:"paris",ttd:"10790000",block:7382819,forkHash:"0xb8c6299d"},{name:"mergeForkIdTransition",block:null,forkHash:null},{name:"shanghai",block:null,timestamp:"1678832736",forkHash:"0xf9843abf"},{name:"cancun",block:null,timestamp:"1705473120",forkHash:"0x70cc14e2"}],bootstrapNodes:[{ip:"51.141.78.53",port:30303,id:"011f758e6552d105183b1761c5e2dea0111bc20fd5f6422bc7f91e0fabbec9a6595caf6239b37feb773dddd3f87240d99d859431891e4a642cf2a0a9e6cbb98a",location:"",comment:"Upstream bootnode 1"},{ip:"13.93.54.137",port:30303,id:"176b9417f511d05b6b2cf3e34b756cf0a7096b3094572a8f6ef4cdcb9d1f9d00683bf0f83347eebdf3b81c3521c2332086d9592802230bf528eaf606a1d9677b",location:"",comment:"Upstream bootnode 2"},{ip:"94.237.54.114",port:30313,id:"46add44b9f13965f7b9875ac6b85f016f341012d84f975377573800a863526f4da19ae2c620ec73d11591fa9510e992ecc03ad0751f53cc02f7c7ed6d55c7291",location:"",comment:"Upstream bootnode 3"},{ip:"18.218.250.66",port:30313,id:"b5948a2d3e9d486c4d75bf32713221c2bd6cf86463302339299bd227dc2e276cd5a1c7ca4f43a0e9122fe9af884efed563bd2a1fd28661f3b5f5ad7bf1de5949",location:"",comment:"Upstream bootnode 4"},{ip:"3.11.147.67",port:30303,id:"a61215641fb8714a373c80edbfa0ea8878243193f57c96eeb44d0bc019ef295abd4e044fd619bfc4c59731a73fb79afe84e9ab6da0c743ceb479cbb6d263fa91",location:"",comment:"Ethereum Foundation bootnode"},{ip:"51.15.116.226",port:30303,id:"a869b02cec167211fb4815a82941db2e7ed2936fd90e78619c53eb17753fcf0207463e3419c264e2a1dd8786de0df7e68cf99571ab8aeb7c4e51367ef186b1dd",location:"",comment:"Goerli Initiative bootnode"},{ip:"51.15.119.157",port:30303,id:"807b37ee4816ecf407e9112224494b74dd5933625f655962d892f2f0f02d7fbbb3e2a94cf87a96609526f30c998fd71e93e2f53015c558ffc8b03eceaf30ee33",location:"",comment:"Goerli Initiative bootnode"},{ip:"51.15.119.157",port:40303,id:"a59e33ccd2b3e52d578f1fbd70c6f9babda2650f0760d6ff3b37742fdcdfdb3defba5d56d315b40c46b70198c7621e63ffa3f987389c7118634b0fefbbdfa7fd",location:"",comment:"Goerli Initiative bootnode"}],dnsNetworks:["enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.goerli.ethdisco.net"]},sepolia:{name:"sepolia",chainId:11155111,networkId:11155111,defaultHardfork:"shanghai",consensus:{type:"pow",algorithm:"ethash",ethash:{}},comment:"PoW test network to replace Ropsten",url:"https://github.com/ethereum/go-ethereum/pull/23730",genesis:{timestamp:"0x6159af19",gasLimit:3e7,difficulty:131072,nonce:"0x0000000000000000",extraData:"0x5365706f6c69612c20417468656e732c204174746963612c2047726565636521"},hardforks:[{name:"chainstart",block:0,forkHash:"0xfe3366e7"},{name:"homestead",block:0,forkHash:"0xfe3366e7"},{name:"tangerineWhistle",block:0,forkHash:"0xfe3366e7"},{name:"spuriousDragon",block:0,forkHash:"0xfe3366e7"},{name:"byzantium",block:0,forkHash:"0xfe3366e7"},{name:"constantinople",block:0,forkHash:"0xfe3366e7"},{name:"petersburg",block:0,forkHash:"0xfe3366e7"},{name:"istanbul",block:0,forkHash:"0xfe3366e7"},{name:"muirGlacier",block:0,forkHash:"0xfe3366e7"},{name:"berlin",block:0,forkHash:"0xfe3366e7"},{name:"london",block:0,forkHash:"0xfe3366e7"},{name:"paris",ttd:"17000000000000000",block:1450409,forkHash:"0xfe3366e7"},{name:"mergeForkIdTransition",block:1735371,forkHash:"0xb96cbd13"},{name:"shanghai",block:null,timestamp:"1677557088",forkHash:"0xf7f9bc08"},{name:"cancun",block:null,timestamp:"1706655072",forkHash:"0x88cf81d9"}],bootstrapNodes:[{ip:"18.168.182.86",port:30303,id:"9246d00bc8fd1742e5ad2428b80fc4dc45d786283e05ef6edbd9002cbc335d40998444732fbe921cb88e1d2c73d1b1de53bae6a2237996e9bfe14f871baf7066",location:"",comment:"geth"},{ip:"52.14.151.177",port:30303,id:"ec66ddcf1a974950bd4c782789a7e04f8aa7110a72569b6e65fcd51e937e74eed303b1ea734e4d19cfaec9fbff9b6ee65bf31dcb50ba79acce9dd63a6aca61c7",location:"",comment:"besu"},{ip:"165.22.196.173",port:30303,id:"ce970ad2e9daa9e14593de84a8b49da3d54ccfdf83cbc4fe519cb8b36b5918ed4eab087dedd4a62479b8d50756b492d5f762367c8d20329a7854ec01547568a6",location:"",comment:"EF"},{ip:"65.108.95.67",port:30303,id:"075503b13ed736244896efcde2a992ec0b451357d46cb7a8132c0384721742597fc8f0d91bbb40bb52e7d6e66728d36a1fda09176294e4a30cfac55dcce26bc6",location:"",comment:"lodestar"}],dnsNetworks:["enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.sepolia.ethdisco.net"]},holesky:{name:"holesky",chainId:17e3,networkId:17e3,defaultHardfork:"paris",consensus:{type:"pos",algorithm:"casper"},comment:"PoS test network to replace Goerli",url:"https://github.com/eth-clients/holesky/",genesis:{baseFeePerGas:"0x3B9ACA00",difficulty:"0x01",extraData:"0x",gasLimit:"0x17D7840",nonce:"0x0000000000001234",timestamp:"0x65156994"},hardforks:[{name:"chainstart",block:0,forkHash:"0xc61a6098"},{name:"homestead",block:0,forkHash:"0xc61a6098"},{name:"tangerineWhistle",block:0,forkHash:"0xc61a6098"},{name:"spuriousDragon",block:0,forkHash:"0xc61a6098"},{name:"byzantium",block:0,forkHash:"0xc61a6098"},{name:"constantinople",block:0,forkHash:"0xc61a6098"},{name:"petersburg",block:0,forkHash:"0xc61a6098"},{name:"istanbul",block:0,forkHash:"0xc61a6098"},{name:"muirGlacier",block:0,forkHash:"0xc61a6098"},{name:"berlin",block:0,forkHash:"0xc61a6098"},{name:"london",block:0,forkHash:"0xc61a6098"},{name:"paris",ttd:"0",block:0,forkHash:"0xc61a6098"},{name:"mergeForkIdTransition",block:0,forkHash:"0xc61a6098"},{name:"shanghai",block:null,timestamp:"1696000704",forkHash:"0xfd4f016b"},{name:"cancun",block:null,timestamp:"1707305664",forkHash:"0x9b192ad0"}],bootstrapNodes:[{ip:"146.190.13.128",port:30303,id:"ac906289e4b7f12df423d654c5a962b6ebe5b3a74cc9e06292a85221f9a64a6f1cfdd6b714ed6dacef51578f92b34c60ee91e9ede9c7f8fadc4d347326d95e2b",location:"",comment:"bootnode 1"},{ip:"178.128.136.233",port:30303,id:"a3435a0155a3e837c02f5e7f5662a2f1fbc25b48e4dc232016e1c51b544cb5b4510ef633ea3278c0e970fa8ad8141e2d4d0f9f95456c537ff05fdf9b31c15072",location:"",comment:"bootnode 2"}],dnsNetworks:["enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.holesky.ethdisco.net"]},kaustinen:{name:"kaustinen",chainId:69420,networkId:69420,defaultHardfork:"prague",consensus:{type:"pos",algorithm:"casper"},comment:"Verkle kaustinen testnet 2 (likely temporary, do not hard-wire into production code)",url:"https://github.com/eth-clients/kaustinen/",genesis:{difficulty:"0x01",extraData:"0x",gasLimit:"0x17D7840",nonce:"0x0000000000001234",timestamp:"0x65608a64"},hardforks:[{name:"chainstart",block:0},{name:"homestead",block:0},{name:"tangerineWhistle",block:0},{name:"spuriousDragon",block:0},{name:"byzantium",block:0},{name:"constantinople",block:0},{name:"petersburg",block:0},{name:"istanbul",block:0},{name:"berlin",block:0},{name:"london",block:0},{name:"paris",ttd:"0",block:0},{name:"mergeForkIdTransition",block:0},{name:"shanghai",block:null,timestamp:"0"},{name:"prague",block:null,timestamp:"1700825700"}],bootstrapNodes:[],dnsNetworks:[]}};let C8=[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];"undefined"!=typeof Int32Array&&(C8=new Int32Array(C8));const B8=(e,t)=>((e,t)=>{let r=~t;for(let t=0;t>>8;return~r})(e,t)>>>0;var N8,R8,F8,L8,j8,U8;!function(e){e[e.Mainnet=1]="Mainnet",e[e.Goerli=5]="Goerli",e[e.Sepolia=11155111]="Sepolia",e[e.Holesky=17e3]="Holesky",e[e.Kaustinen=69420]="Kaustinen"}(N8||(N8={})),N8.Mainnet,W3("0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544"),N8.Goerli,W3("0x5d6cded585e73c4e322c30c2f782a336316f17dd85a4863b9d838d2d4b8b3008"),N8.Sepolia,W3("0x5eb6e371a698b8d68f665192350ffcecbbbf322916f4b51bd79bb6887da3f494"),N8.Holesky,W3("0x69d8c9d72f6fa4ad42d4702b433707212f90db395eb54dc20bc85de253788783"),N8.Kaustinen,W3("0x5e8519756841faf0b2c28951c451b61a4b407b70a5ce5b57992f4bec973173ff"),function(e){e.Chainstart="chainstart",e.Homestead="homestead",e.Dao="dao",e.TangerineWhistle="tangerineWhistle",e.SpuriousDragon="spuriousDragon",e.Byzantium="byzantium",e.Constantinople="constantinople",e.Petersburg="petersburg",e.Istanbul="istanbul",e.MuirGlacier="muirGlacier",e.Berlin="berlin",e.London="london",e.ArrowGlacier="arrowGlacier",e.GrayGlacier="grayGlacier",e.MergeForkIdTransition="mergeForkIdTransition",e.Paris="paris",e.Shanghai="shanghai",e.Cancun="cancun",e.Prague="prague"}(R8||(R8={})),function(e){e.ProofOfStake="pos",e.ProofOfWork="pow",e.ProofOfAuthority="poa"}(F8||(F8={})),function(e){e.Ethash="ethash",e.Clique="clique",e.Casper="casper"}(L8||(L8={})),function(e){e.PolygonMainnet="polygon-mainnet",e.PolygonMumbai="polygon-mumbai",e.ArbitrumOne="arbitrum-one",e.xDaiChain="x-dai-chain",e.OptimisticKovan="optimistic-kovan",e.OptimisticEthereum="optimistic-ethereum"}(j8||(j8={})),function(e){e.Stagnant="stagnant",e.Draft="draft",e.Review="review",e.Final="final"}(U8||(U8={}));const D8={1153:{comment:"Transient storage opcodes",url:"https://eips.ethereum.org/EIPS/eip-1153",status:U8.Review,minimumHardfork:R8.Chainstart,requiredEIPs:[],gasPrices:{tstore:{v:100,d:"Base fee of the TSTORE opcode"},tload:{v:100,d:"Base fee of the TLOAD opcode"}}},1559:{comment:"Fee market change for ETH 1.0 chain",url:"https://eips.ethereum.org/EIPS/eip-1559",status:U8.Final,minimumHardfork:R8.Berlin,requiredEIPs:[2930],gasConfig:{baseFeeMaxChangeDenominator:{v:8,d:"Maximum base fee change denominator"},elasticityMultiplier:{v:2,d:"Maximum block gas target elasticity"},initialBaseFee:{v:1e9,d:"Initial base fee on first EIP1559 block"}}},2315:{comment:"Simple subroutines for the EVM",url:"https://eips.ethereum.org/EIPS/eip-2315",status:U8.Draft,minimumHardfork:R8.Istanbul,requiredEIPs:[],gasPrices:{beginsub:{v:2,d:"Base fee of the BEGINSUB opcode"},returnsub:{v:5,d:"Base fee of the RETURNSUB opcode"},jumpsub:{v:10,d:"Base fee of the JUMPSUB opcode"}}},2565:{comment:"ModExp gas cost",url:"https://eips.ethereum.org/EIPS/eip-2565",status:U8.Final,minimumHardfork:R8.Byzantium,requiredEIPs:[],gasPrices:{modexpGquaddivisor:{v:3,d:"Gquaddivisor from modexp precompile for gas calculation"}}},2718:{comment:"Typed Transaction Envelope",url:"https://eips.ethereum.org/EIPS/eip-2718",status:U8.Final,minimumHardfork:R8.Chainstart,requiredEIPs:[]},2929:{comment:"Gas cost increases for state access opcodes",url:"https://eips.ethereum.org/EIPS/eip-2929",status:U8.Final,minimumHardfork:R8.Chainstart,requiredEIPs:[],gasPrices:{coldsload:{v:2100,d:"Gas cost of the first read of storage from a given location (per transaction)"},coldaccountaccess:{v:2600,d:"Gas cost of the first read of a given address (per transaction)"},warmstorageread:{v:100,d:"Gas cost of reading storage locations which have already loaded 'cold'"},sstoreCleanGasEIP2200:{v:2900,d:"Once per SSTORE operation from clean non-zero to something else"},sstoreNoopGasEIP2200:{v:100,d:"Once per SSTORE operation if the value doesn't change"},sstoreDirtyGasEIP2200:{v:100,d:"Once per SSTORE operation if a dirty value is changed"},sstoreInitRefundEIP2200:{v:19900,d:"Once per SSTORE operation for resetting to the original zero value"},sstoreCleanRefundEIP2200:{v:4900,d:"Once per SSTORE operation for resetting to the original non-zero value"},call:{v:0,d:"Base fee of the CALL opcode"},callcode:{v:0,d:"Base fee of the CALLCODE opcode"},delegatecall:{v:0,d:"Base fee of the DELEGATECALL opcode"},staticcall:{v:0,d:"Base fee of the STATICCALL opcode"},balance:{v:0,d:"Base fee of the BALANCE opcode"},extcodesize:{v:0,d:"Base fee of the EXTCODESIZE opcode"},extcodecopy:{v:0,d:"Base fee of the EXTCODECOPY opcode"},extcodehash:{v:0,d:"Base fee of the EXTCODEHASH opcode"},sload:{v:0,d:"Base fee of the SLOAD opcode"},sstore:{v:0,d:"Base fee of the SSTORE opcode"}}},2930:{comment:"Optional access lists",url:"https://eips.ethereum.org/EIPS/eip-2930",status:U8.Final,minimumHardfork:R8.Istanbul,requiredEIPs:[2718,2929],gasPrices:{accessListStorageKeyCost:{v:1900,d:"Gas cost per storage key in an Access List transaction"},accessListAddressCost:{v:2400,d:"Gas cost per storage key in an Access List transaction"}}},2935:{comment:"Save historical block hashes in state (Verkle related usage, UNSTABLE)",url:"https://github.com/gballet/EIPs/pull/3/commits/2e9ac09a142b0d9fb4db0b8d4609f92e5d9990c5",status:U8.Draft,minimumHardfork:R8.Chainstart,requiredEIPs:[],vm:{historyStorageAddress:{v:BigInt("0xfffffffffffffffffffffffffffffffffffffffe"),d:"The address where the historical blockhashes are stored"},historyServeWindow:{v:BigInt(256),d:"The amount of blocks to be served by the historical blockhash contract"}}},3074:{comment:"AUTH and AUTHCALL opcodes",url:"https://eips.ethereum.org/EIPS/eip-3074",status:U8.Review,minimumHardfork:R8.London,requiredEIPs:[],gasPrices:{auth:{v:3100,d:"Gas cost of the AUTH opcode"},authcall:{v:0,d:"Gas cost of the AUTHCALL opcode"},authcallValueTransfer:{v:6700,d:"Paid for CALL when the value transfer is non-zero"}}},3198:{comment:"BASEFEE opcode",url:"https://eips.ethereum.org/EIPS/eip-3198",status:U8.Final,minimumHardfork:R8.London,requiredEIPs:[],gasPrices:{basefee:{v:2,d:"Gas cost of the BASEFEE opcode"}}},3529:{comment:"Reduction in refunds",url:"https://eips.ethereum.org/EIPS/eip-3529",status:U8.Final,minimumHardfork:R8.Berlin,requiredEIPs:[2929],gasConfig:{maxRefundQuotient:{v:5,d:"Maximum refund quotient; max tx refund is min(tx.gasUsed/maxRefundQuotient, tx.gasRefund)"}},gasPrices:{selfdestructRefund:{v:0,d:"Refunded following a selfdestruct operation"},sstoreClearRefundEIP2200:{v:4800,d:"Once per SSTORE operation for clearing an originally existing storage slot"}}},3540:{comment:"EVM Object Format (EOF) v1",url:"https://eips.ethereum.org/EIPS/eip-3540",status:U8.Review,minimumHardfork:R8.London,requiredEIPs:[3541]},3541:{comment:"Reject new contracts starting with the 0xEF byte",url:"https://eips.ethereum.org/EIPS/eip-3541",status:U8.Final,minimumHardfork:R8.Berlin,requiredEIPs:[]},3554:{comment:"Difficulty Bomb Delay to December 1st 2021",url:"https://eips.ethereum.org/EIPS/eip-3554",status:U8.Final,minimumHardfork:R8.MuirGlacier,requiredEIPs:[],pow:{difficultyBombDelay:{v:95e5,d:"the amount of blocks to delay the difficulty bomb with"}}},3607:{comment:"Reject transactions from senders with deployed code",url:"https://eips.ethereum.org/EIPS/eip-3607",status:U8.Final,minimumHardfork:R8.Chainstart,requiredEIPs:[]},3651:{comment:"Warm COINBASE",url:"https://eips.ethereum.org/EIPS/eip-3651",status:U8.Review,minimumHardfork:R8.London,requiredEIPs:[2929]},3670:{comment:"EOF - Code Validation",url:"https://eips.ethereum.org/EIPS/eip-3670",status:"Review",minimumHardfork:R8.London,requiredEIPs:[3540],gasConfig:{},gasPrices:{},vm:{},pow:{}},3675:{comment:"Upgrade consensus to Proof-of-Stake",url:"https://eips.ethereum.org/EIPS/eip-3675",status:U8.Final,minimumHardfork:R8.London,requiredEIPs:[]},3855:{comment:"PUSH0 instruction",url:"https://eips.ethereum.org/EIPS/eip-3855",status:U8.Review,minimumHardfork:R8.Chainstart,requiredEIPs:[],gasPrices:{push0:{v:2,d:"Base fee of the PUSH0 opcode"}}},3860:{comment:"Limit and meter initcode",url:"https://eips.ethereum.org/EIPS/eip-3860",status:U8.Review,minimumHardfork:R8.SpuriousDragon,requiredEIPs:[],gasPrices:{initCodeWordCost:{v:2,d:"Gas to pay for each word (32 bytes) of initcode when creating a contract"}},vm:{maxInitCodeSize:{v:49152,d:"Maximum length of initialization code when creating a contract"}}},4345:{comment:"Difficulty Bomb Delay to June 2022",url:"https://eips.ethereum.org/EIPS/eip-4345",status:U8.Final,minimumHardfork:R8.London,requiredEIPs:[],pow:{difficultyBombDelay:{v:107e5,d:"the amount of blocks to delay the difficulty bomb with"}}},4399:{comment:"Supplant DIFFICULTY opcode with PREVRANDAO",url:"https://eips.ethereum.org/EIPS/eip-4399",status:U8.Review,minimumHardfork:R8.London,requiredEIPs:[],gasPrices:{prevrandao:{v:2,d:"Base fee of the PREVRANDAO opcode (previously DIFFICULTY)"}}},4788:{comment:"Beacon block root in the EVM",url:"https://eips.ethereum.org/EIPS/eip-4788",status:U8.Draft,minimumHardfork:R8.Cancun,requiredEIPs:[],gasPrices:{},vm:{historicalRootsLength:{v:8191,d:"The modulo parameter of the beaconroot ring buffer in the beaconroot statefull precompile"}}},4844:{comment:"Shard Blob Transactions",url:"https://eips.ethereum.org/EIPS/eip-4844",status:U8.Draft,minimumHardfork:R8.Paris,requiredEIPs:[1559,2718,2930,4895],gasConfig:{blobGasPerBlob:{v:131072,d:"The base fee for blob gas per blob"},targetBlobGasPerBlock:{v:393216,d:"The target blob gas consumed per block"},maxblobGasPerBlock:{v:786432,d:"The max blob gas allowable per block"},blobGasPriceUpdateFraction:{v:3338477,d:"The denominator used in the exponential when calculating a blob gas price"}},gasPrices:{simpleGasPerBlob:{v:12e3,d:"The basic gas fee for each blob"},minBlobGasPrice:{v:1,d:"The minimum fee per blob gas"},kzgPointEvaluationGasPrecompilePrice:{v:5e4,d:"The fee associated with the point evaluation precompile"},blobhash:{v:3,d:"Base fee of the BLOBHASH opcode"}},sharding:{blobCommitmentVersionKzg:{v:1,d:"The number indicated a versioned hash is a KZG commitment"},fieldElementsPerBlob:{v:4096,d:"The number of field elements allowed per blob"}}},4895:{comment:"Beacon chain push withdrawals as operations",url:"https://eips.ethereum.org/EIPS/eip-4895",status:U8.Review,minimumHardfork:R8.Paris,requiredEIPs:[]},5133:{comment:"Delaying Difficulty Bomb to mid-September 2022",url:"https://eips.ethereum.org/EIPS/eip-5133",status:U8.Draft,minimumHardfork:R8.GrayGlacier,requiredEIPs:[],pow:{difficultyBombDelay:{v:114e5,d:"the amount of blocks to delay the difficulty bomb with"}}},5656:{comment:"MCOPY - Memory copying instruction",url:"https://eips.ethereum.org/EIPS/eip-5656",status:U8.Draft,minimumHardfork:R8.Shanghai,requiredEIPs:[],gasPrices:{mcopy:{v:3,d:"Base fee of the MCOPY opcode"}}},6780:{comment:"SELFDESTRUCT only in same transaction",url:"https://eips.ethereum.org/EIPS/eip-6780",status:U8.Draft,minimumHardfork:R8.London,requiredEIPs:[]},6800:{comment:"Ethereum state using a unified verkle tree (experimental)",url:"https://github.com/ethereum/EIPs/pull/6800",status:U8.Draft,minimumHardfork:R8.London,requiredEIPs:[]},7516:{comment:"BLOBBASEFEE opcode",url:"https://eips.ethereum.org/EIPS/eip-7516",status:U8.Draft,minimumHardfork:R8.Paris,requiredEIPs:[4844],gasPrices:{blobbasefee:{v:2,d:"Gas cost of the BLOBBASEFEE opcode"}}}};var z8;!function(e){e.Draft="draft",e.Review="review",e.Final="final"}(z8||(z8={}));const $8={chainstart:{name:"chainstart",comment:"Start of the Ethereum main chain",url:"",status:z8.Final,gasConfig:{minGasLimit:{v:5e3,d:"Minimum the gas limit may ever be"},gasLimitBoundDivisor:{v:1024,d:"The bound divisor of the gas limit, used in update calculations"},maxRefundQuotient:{v:2,d:"Maximum refund quotient; max tx refund is min(tx.gasUsed/maxRefundQuotient, tx.gasRefund)"}},gasPrices:{base:{v:2,d:"Gas base cost, used e.g. for ChainID opcode (Istanbul)"},exp:{v:10,d:"Base fee of the EXP opcode"},expByte:{v:10,d:"Times ceil(log256(exponent)) for the EXP instruction"},keccak256:{v:30,d:"Base fee of the SHA3 opcode"},keccak256Word:{v:6,d:"Once per word of the SHA3 operation's data"},sload:{v:50,d:"Base fee of the SLOAD opcode"},sstoreSet:{v:2e4,d:"Once per SSTORE operation if the zeroness changes from zero"},sstoreReset:{v:5e3,d:"Once per SSTORE operation if the zeroness does not change from zero"},sstoreRefund:{v:15e3,d:"Once per SSTORE operation if the zeroness changes to zero"},jumpdest:{v:1,d:"Base fee of the JUMPDEST opcode"},log:{v:375,d:"Base fee of the LOG opcode"},logData:{v:8,d:"Per byte in a LOG* operation's data"},logTopic:{v:375,d:"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas"},create:{v:32e3,d:"Base fee of the CREATE opcode"},call:{v:40,d:"Base fee of the CALL opcode"},callStipend:{v:2300,d:"Free gas given at beginning of call"},callValueTransfer:{v:9e3,d:"Paid for CALL when the value transfor is non-zero"},callNewAccount:{v:25e3,d:"Paid for CALL when the destination address didn't exist prior"},selfdestructRefund:{v:24e3,d:"Refunded following a selfdestruct operation"},memory:{v:3,d:"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL"},quadCoeffDiv:{v:512,d:"Divisor for the quadratic particle of the memory cost equation"},createData:{v:200,d:""},tx:{v:21e3,d:"Per transaction. NOTE: Not payable on data of calls between transactions"},txCreation:{v:32e3,d:"The cost of creating a contract via tx"},txDataZero:{v:4,d:"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions"},txDataNonZero:{v:68,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions"},copy:{v:3,d:"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added"},ecRecover:{v:3e3,d:""},sha256:{v:60,d:""},sha256Word:{v:12,d:""},ripemd160:{v:600,d:""},ripemd160Word:{v:120,d:""},identity:{v:15,d:""},identityWord:{v:3,d:""},stop:{v:0,d:"Base fee of the STOP opcode"},add:{v:3,d:"Base fee of the ADD opcode"},mul:{v:5,d:"Base fee of the MUL opcode"},sub:{v:3,d:"Base fee of the SUB opcode"},div:{v:5,d:"Base fee of the DIV opcode"},sdiv:{v:5,d:"Base fee of the SDIV opcode"},mod:{v:5,d:"Base fee of the MOD opcode"},smod:{v:5,d:"Base fee of the SMOD opcode"},addmod:{v:8,d:"Base fee of the ADDMOD opcode"},mulmod:{v:8,d:"Base fee of the MULMOD opcode"},signextend:{v:5,d:"Base fee of the SIGNEXTEND opcode"},lt:{v:3,d:"Base fee of the LT opcode"},gt:{v:3,d:"Base fee of the GT opcode"},slt:{v:3,d:"Base fee of the SLT opcode"},sgt:{v:3,d:"Base fee of the SGT opcode"},eq:{v:3,d:"Base fee of the EQ opcode"},iszero:{v:3,d:"Base fee of the ISZERO opcode"},and:{v:3,d:"Base fee of the AND opcode"},or:{v:3,d:"Base fee of the OR opcode"},xor:{v:3,d:"Base fee of the XOR opcode"},not:{v:3,d:"Base fee of the NOT opcode"},byte:{v:3,d:"Base fee of the BYTE opcode"},address:{v:2,d:"Base fee of the ADDRESS opcode"},balance:{v:20,d:"Base fee of the BALANCE opcode"},origin:{v:2,d:"Base fee of the ORIGIN opcode"},caller:{v:2,d:"Base fee of the CALLER opcode"},callvalue:{v:2,d:"Base fee of the CALLVALUE opcode"},calldataload:{v:3,d:"Base fee of the CALLDATALOAD opcode"},calldatasize:{v:2,d:"Base fee of the CALLDATASIZE opcode"},calldatacopy:{v:3,d:"Base fee of the CALLDATACOPY opcode"},codesize:{v:2,d:"Base fee of the CODESIZE opcode"},codecopy:{v:3,d:"Base fee of the CODECOPY opcode"},gasprice:{v:2,d:"Base fee of the GASPRICE opcode"},extcodesize:{v:20,d:"Base fee of the EXTCODESIZE opcode"},extcodecopy:{v:20,d:"Base fee of the EXTCODECOPY opcode"},blockhash:{v:20,d:"Base fee of the BLOCKHASH opcode"},coinbase:{v:2,d:"Base fee of the COINBASE opcode"},timestamp:{v:2,d:"Base fee of the TIMESTAMP opcode"},number:{v:2,d:"Base fee of the NUMBER opcode"},difficulty:{v:2,d:"Base fee of the DIFFICULTY opcode"},gaslimit:{v:2,d:"Base fee of the GASLIMIT opcode"},pop:{v:2,d:"Base fee of the POP opcode"},mload:{v:3,d:"Base fee of the MLOAD opcode"},mstore:{v:3,d:"Base fee of the MSTORE opcode"},mstore8:{v:3,d:"Base fee of the MSTORE8 opcode"},sstore:{v:0,d:"Base fee of the SSTORE opcode"},jump:{v:8,d:"Base fee of the JUMP opcode"},jumpi:{v:10,d:"Base fee of the JUMPI opcode"},pc:{v:2,d:"Base fee of the PC opcode"},msize:{v:2,d:"Base fee of the MSIZE opcode"},gas:{v:2,d:"Base fee of the GAS opcode"},push:{v:3,d:"Base fee of the PUSH opcode"},dup:{v:3,d:"Base fee of the DUP opcode"},swap:{v:3,d:"Base fee of the SWAP opcode"},callcode:{v:40,d:"Base fee of the CALLCODE opcode"},return:{v:0,d:"Base fee of the RETURN opcode"},invalid:{v:0,d:"Base fee of the INVALID opcode"},selfdestruct:{v:0,d:"Base fee of the SELFDESTRUCT opcode"}},vm:{stackLimit:{v:1024,d:"Maximum size of VM stack allowed"},callCreateDepth:{v:1024,d:"Maximum depth of call/create stack"},maxExtraDataSize:{v:32,d:"Maximum size extra data may be after Genesis"}},pow:{minimumDifficulty:{v:131072,d:"The minimum that the difficulty may ever be"},difficultyBoundDivisor:{v:2048,d:"The bound divisor of the difficulty, used in the update calculations"},durationLimit:{v:13,d:"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not"},epochDuration:{v:3e4,d:"Duration between proof-of-work epochs"},timebombPeriod:{v:1e5,d:"Exponential difficulty timebomb period"},minerReward:{v:BigInt("5000000000000000000"),d:"the amount a miner get rewarded for mining a block"},difficultyBombDelay:{v:0,d:"the amount of blocks to delay the difficulty bomb with"}}},homestead:{name:"homestead",comment:"Homestead hardfork with protocol and network changes",url:"https://eips.ethereum.org/EIPS/eip-606",status:z8.Final,gasPrices:{delegatecall:{v:40,d:"Base fee of the DELEGATECALL opcode"}}},dao:{name:"dao",comment:"DAO rescue hardfork",url:"https://eips.ethereum.org/EIPS/eip-779",status:z8.Final},tangerineWhistle:{name:"tangerineWhistle",comment:"Hardfork with gas cost changes for IO-heavy operations",url:"https://eips.ethereum.org/EIPS/eip-608",status:z8.Final,gasPrices:{sload:{v:200,d:"Once per SLOAD operation"},call:{v:700,d:"Once per CALL operation & message call transaction"},extcodesize:{v:700,d:"Base fee of the EXTCODESIZE opcode"},extcodecopy:{v:700,d:"Base fee of the EXTCODECOPY opcode"},balance:{v:400,d:"Base fee of the BALANCE opcode"},delegatecall:{v:700,d:"Base fee of the DELEGATECALL opcode"},callcode:{v:700,d:"Base fee of the CALLCODE opcode"},selfdestruct:{v:5e3,d:"Base fee of the SELFDESTRUCT opcode"}}},spuriousDragon:{name:"spuriousDragon",comment:"HF with EIPs for simple replay attack protection, EXP cost increase, state trie clearing, contract code size limit",url:"https://eips.ethereum.org/EIPS/eip-607",status:z8.Final,gasPrices:{expByte:{v:50,d:"Times ceil(log256(exponent)) for the EXP instruction"}},vm:{maxCodeSize:{v:24576,d:"Maximum length of contract code"}}},byzantium:{name:"byzantium",comment:"Hardfork with new precompiles, instructions and other protocol changes",url:"https://eips.ethereum.org/EIPS/eip-609",status:z8.Final,gasPrices:{modexpGquaddivisor:{v:20,d:"Gquaddivisor from modexp precompile for gas calculation"},ecAdd:{v:500,d:"Gas costs for curve addition precompile"},ecMul:{v:4e4,d:"Gas costs for curve multiplication precompile"},ecPairing:{v:1e5,d:"Base gas costs for curve pairing precompile"},ecPairingWord:{v:8e4,d:"Gas costs regarding curve pairing precompile input length"},revert:{v:0,d:"Base fee of the REVERT opcode"},staticcall:{v:700,d:"Base fee of the STATICCALL opcode"},returndatasize:{v:2,d:"Base fee of the RETURNDATASIZE opcode"},returndatacopy:{v:3,d:"Base fee of the RETURNDATACOPY opcode"}},pow:{minerReward:{v:BigInt("3000000000000000000"),d:"the amount a miner get rewarded for mining a block"},difficultyBombDelay:{v:3e6,d:"the amount of blocks to delay the difficulty bomb with"}}},constantinople:{name:"constantinople",comment:"Postponed hardfork including EIP-1283 (SSTORE gas metering changes)",url:"https://eips.ethereum.org/EIPS/eip-1013",status:z8.Final,gasPrices:{netSstoreNoopGas:{v:200,d:"Once per SSTORE operation if the value doesn't change"},netSstoreInitGas:{v:2e4,d:"Once per SSTORE operation from clean zero"},netSstoreCleanGas:{v:5e3,d:"Once per SSTORE operation from clean non-zero"},netSstoreDirtyGas:{v:200,d:"Once per SSTORE operation from dirty"},netSstoreClearRefund:{v:15e3,d:"Once per SSTORE operation for clearing an originally existing storage slot"},netSstoreResetRefund:{v:4800,d:"Once per SSTORE operation for resetting to the original non-zero value"},netSstoreResetClearRefund:{v:19800,d:"Once per SSTORE operation for resetting to the original zero value"},shl:{v:3,d:"Base fee of the SHL opcode"},shr:{v:3,d:"Base fee of the SHR opcode"},sar:{v:3,d:"Base fee of the SAR opcode"},extcodehash:{v:400,d:"Base fee of the EXTCODEHASH opcode"},create2:{v:32e3,d:"Base fee of the CREATE2 opcode"}},pow:{minerReward:{v:BigInt("2000000000000000000"),d:"The amount a miner gets rewarded for mining a block"},difficultyBombDelay:{v:5e6,d:"the amount of blocks to delay the difficulty bomb with"}}},petersburg:{name:"petersburg",comment:"Aka constantinopleFix, removes EIP-1283, activate together with or after constantinople",url:"https://eips.ethereum.org/EIPS/eip-1716",status:z8.Final,gasPrices:{netSstoreNoopGas:{v:null,d:"Removed along EIP-1283"},netSstoreInitGas:{v:null,d:"Removed along EIP-1283"},netSstoreCleanGas:{v:null,d:"Removed along EIP-1283"},netSstoreDirtyGas:{v:null,d:"Removed along EIP-1283"},netSstoreClearRefund:{v:null,d:"Removed along EIP-1283"},netSstoreResetRefund:{v:null,d:"Removed along EIP-1283"},netSstoreResetClearRefund:{v:null,d:"Removed along EIP-1283"}}},istanbul:{name:"istanbul",comment:"HF targeted for December 2019 following the Constantinople/Petersburg HF",url:"https://eips.ethereum.org/EIPS/eip-1679",status:z8.Final,gasConfig:{},gasPrices:{blake2Round:{v:1,d:"Gas cost per round for the Blake2 F precompile"},ecAdd:{v:150,d:"Gas costs for curve addition precompile"},ecMul:{v:6e3,d:"Gas costs for curve multiplication precompile"},ecPairing:{v:45e3,d:"Base gas costs for curve pairing precompile"},ecPairingWord:{v:34e3,d:"Gas costs regarding curve pairing precompile input length"},txDataNonZero:{v:16,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions"},sstoreSentryGasEIP2200:{v:2300,d:"Minimum gas required to be present for an SSTORE call, not consumed"},sstoreNoopGasEIP2200:{v:800,d:"Once per SSTORE operation if the value doesn't change"},sstoreDirtyGasEIP2200:{v:800,d:"Once per SSTORE operation if a dirty value is changed"},sstoreInitGasEIP2200:{v:2e4,d:"Once per SSTORE operation from clean zero to non-zero"},sstoreInitRefundEIP2200:{v:19200,d:"Once per SSTORE operation for resetting to the original zero value"},sstoreCleanGasEIP2200:{v:5e3,d:"Once per SSTORE operation from clean non-zero to something else"},sstoreCleanRefundEIP2200:{v:4200,d:"Once per SSTORE operation for resetting to the original non-zero value"},sstoreClearRefundEIP2200:{v:15e3,d:"Once per SSTORE operation for clearing an originally existing storage slot"},balance:{v:700,d:"Base fee of the BALANCE opcode"},extcodehash:{v:700,d:"Base fee of the EXTCODEHASH opcode"},chainid:{v:2,d:"Base fee of the CHAINID opcode"},selfbalance:{v:5,d:"Base fee of the SELFBALANCE opcode"},sload:{v:800,d:"Base fee of the SLOAD opcode"}}},muirGlacier:{name:"muirGlacier",comment:"HF to delay the difficulty bomb",url:"https://eips.ethereum.org/EIPS/eip-2384",status:z8.Final,pow:{difficultyBombDelay:{v:9e6,d:"the amount of blocks to delay the difficulty bomb with"}}},berlin:{name:"berlin",comment:"HF targeted for July 2020 following the Muir Glacier HF",url:"https://eips.ethereum.org/EIPS/eip-2070",status:z8.Final,eips:[2565,2929,2718,2930]},london:{name:"london",comment:"HF targeted for July 2021 following the Berlin fork",url:"https://github.com/ethereum/eth1.0-specs/blob/master/network-upgrades/mainnet-upgrades/london.md",status:z8.Final,eips:[1559,3198,3529,3541]},arrowGlacier:{name:"arrowGlacier",comment:"HF to delay the difficulty bomb",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/arrow-glacier.md",status:z8.Final,eips:[4345]},grayGlacier:{name:"grayGlacier",comment:"Delaying the difficulty bomb to Mid September 2022",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/gray-glacier.md",status:z8.Final,eips:[5133]},paris:{name:"paris",comment:"Hardfork to upgrade the consensus mechanism to Proof-of-Stake",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/merge.md",status:z8.Final,consensus:{type:"pos",algorithm:"casper",casper:{}},eips:[3675,4399]},mergeForkIdTransition:{name:"mergeForkIdTransition",comment:"Pre-merge hardfork to fork off non-upgraded clients",url:"https://eips.ethereum.org/EIPS/eip-3675",status:z8.Final,eips:[]},shanghai:{name:"shanghai",comment:"Next feature hardfork after the merge hardfork having withdrawals, warm coinbase, push0, limit/meter initcode",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/shanghai.md",status:z8.Final,eips:[3651,3855,3860,4895]},cancun:{name:"cancun",comment:"Next feature hardfork after shanghai, includes proto-danksharding EIP 4844 blobs (still WIP hence not for production use), transient storage opcodes, parent beacon block root availability in EVM, selfdestruct only in same transaction, and blob base fee opcode",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/cancun.md",status:z8.Final,eips:[1153,4844,4788,5656,6780,7516]},prague:{name:"prague",comment:"Next feature hardfork after cancun, internally used for verkle testing/implementation (incomplete/experimental)",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/prague.md",status:z8.Draft,eips:[6800]}};function H8(e,t=!0){const{name:r,config:n,difficulty:i,mixHash:o,gasLimit:a,coinbase:s,baseFeePerGas:c,excessBlobGas:u}=e;let{extraData:l,timestamp:f,nonce:d}=e;const h=Number(f),{chainId:p}=n;if(""===l&&(l="0x"),R3(f)||(f=J3(parseInt(f))),18!==d.length&&(d=function(e){return e&&"0x0"!==e?R3(e)?"0x"+F3(e).padStart(16,"0"):"0x"+e.padStart(16,"0"):"0x0000000000000000"}(d)),n.eip155Block!==n.eip158Block)throw new Error("EIP155 block number must equal EIP 158 block number since both are part of SpuriousDragon hardfork and the client only supports activating the full hardfork");const m={name:r,chainId:p,networkId:p,genesis:{timestamp:f,gasLimit:a,difficulty:i,nonce:d,extraData:l,mixHash:o,coinbase:s,baseFeePerGas:c,excessBlobGas:u},hardfork:void 0,hardforks:[],bootstrapNodes:[],consensus:void 0!==n.clique?{type:"poa",algorithm:"clique",clique:{period:n.clique.period??n.clique.blockperiodseconds,epoch:n.clique.epoch??n.clique.epochlength}}:{type:"pow",algorithm:"ethash",ethash:{}}},b={[R8.Homestead]:{name:"homesteadBlock"},[R8.Dao]:{name:"daoForkBlock"},[R8.TangerineWhistle]:{name:"eip150Block"},[R8.SpuriousDragon]:{name:"eip155Block"},[R8.Byzantium]:{name:"byzantiumBlock"},[R8.Constantinople]:{name:"constantinopleBlock"},[R8.Petersburg]:{name:"petersburgBlock"},[R8.Istanbul]:{name:"istanbulBlock"},[R8.MuirGlacier]:{name:"muirGlacierBlock"},[R8.Berlin]:{name:"berlinBlock"},[R8.London]:{name:"londonBlock"},[R8.MergeForkIdTransition]:{name:"mergeForkBlock",postMerge:t},[R8.Shanghai]:{name:"shanghaiTime",postMerge:!0,isTimestamp:!0},[R8.Cancun]:{name:"cancunTime",postMerge:!0,isTimestamp:!0},[R8.Prague]:{name:"pragueTime",postMerge:!0,isTimestamp:!0}},g=Object.keys(b).reduce(((e,t)=>(e[b[t].name]=t,e)),{}),y=Object.keys(n).filter((e=>void 0!==g[e]&&void 0!==n[e]&&null!==n[e]));m.hardforks=y.map((e=>({name:g[e],block:!0===b[g[e]].isTimestamp||"number"!=typeof n[e]?null:n[e],timestamp:!0===b[g[e]].isTimestamp&&"number"==typeof n[e]?n[e]:void 0}))).filter((e=>null!==e.block||void 0!==e.timestamp)),m.hardforks.sort((function(e,t){return(e.block??1/0)-(t.block??1/0)})),m.hardforks.sort((function(e,t){return(e.timestamp??0)-(t.timestamp??0)}));for(const e of m.hardforks)e.timestamp===h&&(e.timestamp=0);if(void 0!==n.terminalTotalDifficulty){const e={name:R8.Paris,ttd:n.terminalTotalDifficulty,block:null},t=m.hardforks.findIndex((e=>!0===b[e.name]?.postMerge));-1!==t?m.hardforks.splice(t,0,e):m.hardforks.push(e)}const v=m.hardforks.length>0?m.hardforks.slice(-1)[0]:void 0;return m.hardfork=v?.name,m.hardforks.unshift({name:R8.Chainstart,block:0}),m}class G8{constructor(e){this._eips=[],this._paramsCache={},this._activatedEIPsCache=[],this.events=new ge,this._customChains=e.customChains??[],this._chainParams=this.setChain(e.chain),this.DEFAULT_HARDFORK=this._chainParams.defaultHardfork??R8.Shanghai,this.HARDFORK_CHANGES=this.hardforks().map((e=>[e.name,$8[e.name]??(this._chainParams.customHardforks&&this._chainParams.customHardforks[e.name])])),this._hardfork=this.DEFAULT_HARDFORK,void 0!==e.hardfork&&this.setHardfork(e.hardfork),e.eips&&this.setEIPs(e.eips),this.customCrypto=e.customCrypto??{},0===Object.keys(this._paramsCache).length&&(this._buildParamsCache(),this._buildActivatedEIPsCache())}static custom(e,t={}){const r=t.baseChain??"mainnet",n={...G8._getChainParams(r)};if(n.name="custom-chain","string"!=typeof e)return new G8({chain:{...n,...e},...t});if(e===j8.PolygonMainnet)return G8.custom({name:j8.PolygonMainnet,chainId:137,networkId:137},t);if(e===j8.PolygonMumbai)return G8.custom({name:j8.PolygonMumbai,chainId:80001,networkId:80001},t);if(e===j8.ArbitrumOne)return G8.custom({name:j8.ArbitrumOne,chainId:42161,networkId:42161},t);if(e===j8.xDaiChain)return G8.custom({name:j8.xDaiChain,chainId:100,networkId:100},t);if(e===j8.OptimisticKovan)return G8.custom({name:j8.OptimisticKovan,chainId:69,networkId:69},{hardfork:R8.Berlin,...t});if(e===j8.OptimisticEthereum)return G8.custom({name:j8.OptimisticEthereum,chainId:10,networkId:10},{hardfork:R8.Berlin,...t});throw new Error(`Custom chain ${e} not supported`)}static fromGethGenesis(e,{chain:t,eips:r,genesisHash:n,hardfork:i,mergeForkIdPostMerge:o,customCrypto:a}){const s=function(e,t,r){try{const n=["config","difficulty","gasLimit","nonce","alloc"];if(n.some((t=>!(t in e)))){const t=n.filter((t=>!(t in e)));throw new Error(`Invalid format, expected geth genesis field "${t}" missing`)}return void 0!==t&&(e.name=t),H8(e,r)}catch(e){throw new Error(`Error parsing parameters file: ${e.message}`)}}(e,t,o),c=new G8({chain:s.name??"custom",customChains:[s],eips:r,hardfork:i??s.hardfork,customCrypto:a});return void 0!==n&&c.setForkHashes(n),c}static isSupportedChainId(e){const t=this.getInitializedChains();return Boolean(t.names[e.toString()])}static _getChainParams(e,t){const r=this.getInitializedChains(t);if("number"==typeof e||"bigint"==typeof e){if(e=e.toString(),r.names[e]){return r[r.names[e]]}throw new Error(`Chain with ID ${e} not supported`)}if(void 0!==r[e])return r[e];throw new Error(`Chain with name ${e} not supported`)}setChain(e){if("number"==typeof e||"bigint"==typeof e||"string"==typeof e)this._chainParams=G8._getChainParams(e,this._customChains);else{if("object"!=typeof e)throw new Error("Wrong input format");{if(this._customChains.length>0)throw new Error("Chain must be a string, number, or bigint when initialized with customChains passed in");const t=["networkId","genesis","hardforks","bootstrapNodes"];for(const r of t)if(!(r in e))throw new Error(`Missing required chain parameter: ${r}`);this._chainParams=e}}for(const e of this.hardforks())if(void 0===e.block)throw new Error("Hardfork cannot have undefined block number");return this._chainParams}setHardfork(e){let t=!1;for(const r of this.HARDFORK_CHANGES)r[0]===e&&(this._hardfork!==e&&(this._hardfork=e,this._buildParamsCache(),this._buildActivatedEIPsCache(),this.events.emit("hardforkChanged",e)),t=!0);if(!t)throw new Error(`Hardfork with name ${e} not supported`)}getHardforkBy(e){const t=x8(e.blockNumber,A8.BigInt),r=x8(e.td,A8.BigInt),n=x8(e.timestamp,A8.BigInt),i=this.hardforks().filter((e=>null!==e.block||null!==e.ttd&&void 0!==e.ttd||void 0!==e.timestamp)),o=i.findIndex((e=>null!==e.ttd&&void 0!==e.ttd)),a=i.slice(o+1).findIndex((e=>null!==e.ttd&&void 0!==e.ttd));if(a>=0)throw Error("More than one merge hardforks found with ttd specified");let s=i.findIndex((e=>void 0!==t&&null!==e.block&&BigInt(e.block)>t||void 0!==n&&void 0!==e.timestamp&&BigInt(e.timestamp)>n));if(-1===s)s=i.length;else if(0===s)throw Error("Must have at least one hardfork at block 0");if(void 0===n){const e=i.slice(0,s).reverse().findIndex((e=>null!==e.block||void 0!==e.ttd));s-=e}if(s-=1,null===i[s].block&&void 0===i[s].timestamp)(null==r||BigInt(i[s].ttd)>r)&&(s-=1);else if(o>=0&&null!=r){if(s>=o&&BigInt(i[o].ttd)>r)throw Error("Maximum HF determined by total difficulty is lower than the block number HF");if(sMath.max(Number(t.timestamp??"0"),e)),0);if(e>n)throw Error("Maximum HF determined by timestamp is lower than the block number/ttd HF");const t=i.slice(s+1).reduce(((e,t)=>Math.min(Number(t.timestamp??n),e)),Number(n));if(t=r}activeOnBlock(e){return this.hardforkIsActiveOnBlock(null,e)}hardforkGteHardfork(e,t){e=e??this._hardfork;const r=this.hardforks();let n=-1,i=-1,o=0;for(const a of r)a.name===e&&(n=o),a.name===t&&(i=o),o+=1;return n>=i&&-1!==i}gteHardfork(e){return this.hardforkGteHardfork(null,e)}hardforkBlock(e){e=e??this._hardfork;const t=this._getHardfork(e)?.block;return null==t?null:BigInt(t)}hardforkTimestamp(e){e=e??this._hardfork;const t=this._getHardfork(e)?.timestamp;return null==t?null:BigInt(t)}eipBlock(e){for(const t of this.HARDFORK_CHANGES){const r=t[1];if("eips"in r&&r.eips.includes(e))return this.hardforkBlock(t[0])}return null}eipTimestamp(e){for(const t of this.HARDFORK_CHANGES){const r=t[1];if("eips"in r&&r.eips.includes(e))return this.hardforkTimestamp(t[0])}return null}hardforkTTD(e){e=e??this._hardfork;const t=this._getHardfork(e)?.ttd;return null==t?null:BigInt(t)}nextHardforkBlockOrTimestamp(e){e=e??this._hardfork;const t=this.hardforks();let r=t.findIndex((t=>t.name===e));if(e===R8.Paris&&(r-=1),r<0)return null;let n=t[r].timestamp??t[r].block;n=null!=n?Number(n):null;const i=t.slice(r+1).find((e=>{let t=e.timestamp??e.block;return t=null!=t?Number(t):null,e.name!==R8.Paris&&null!=t&&t!==n}));if(void 0===i)return null;const o=i.timestamp??i.block;return null==o?null:BigInt(o)}_calcForkHash(e,t){let r=new Uint8Array(0),n=0;for(const t of this.hardforks()){const{block:i,timestamp:o,name:a}=t;let s=o??i;if(s=null!==s?Number(s):null,"number"==typeof s&&0!==s&&s!==n&&a!==R8.Paris){const e=W3("0x"+s.toString(16).padStart(16,"0"));r=a8(r,e),n=s}if(t.name===e)break}const i=a8(t,r);return q3(Z3(B8(i)>>>0))}forkHash(e,t){e=e??this._hardfork;const r=this._getHardfork(e);if(null===r||null===r?.block&&void 0===r?.timestamp&&void 0===r?.ttd){throw new Error("No fork hash calculation possible for future hardfork")}if(null!=r?.forkHash)return r.forkHash;if(!t)throw new Error("genesisHash required for forkHash calculation");return this._calcForkHash(e,t)}hardforkForForkHash(e){const t=this.hardforks().filter((t=>t.forkHash===e));return t.length>=1?t[t.length-1]:null}setForkHashes(e){for(const t of this.hardforks()){const r=t.timestamp??t.block;null!==t.forkHash&&void 0!==t.forkHash||null==r&&void 0===t.ttd||(t.forkHash=this.forkHash(t.name,e))}}genesis(){return this._chainParams.genesis}hardforks(){const e=this._chainParams.hardforks;return void 0!==this._chainParams.customHardforks&&this._chainParams.customHardforks,e}bootstrapNodes(){return this._chainParams.bootstrapNodes}dnsNetworks(){return this._chainParams.dnsNetworks}hardfork(){return this._hardfork}chainId(){return BigInt(this._chainParams.chainId)}chainName(){return this._chainParams.name}networkId(){return BigInt(this._chainParams.networkId)}eips(){return this._eips}consensusType(){const e=this.hardfork();let t;for(const r of this.HARDFORK_CHANGES)if("consensus"in r[1]&&(t=r[1].consensus.type),r[0]===e)break;return t??this._chainParams.consensus.type}consensusAlgorithm(){const e=this.hardfork();let t;for(const r of this.HARDFORK_CHANGES)if("consensus"in r[1]&&(t=r[1].consensus.algorithm),r[0]===e)break;return t??this._chainParams.consensus.algorithm}consensusConfig(){const e=this.hardfork();let t;for(const r of this.HARDFORK_CHANGES){if("consensus"in r[1]){const e=r[1],n=e.consensus.algorithm;t=e.consensus[n]}if(r[0]===e)break}return t??this._chainParams.consensus[this.consensusAlgorithm()]??{}}copy(){const e=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return e.events=new ge,e}static getInitializedChains(e){const t={};for(const[e,r]of Object.entries(N8))t[r]=e.toLowerCase();const r={...M8};if(e)for(const n of e){const{name:e}=n;t[n.chainId.toString()]=e,r[e]=n}return r.names=t,r}}var q8,K8;function V8(e){return!function(e){if(0===e.length)return!0;const t=e[0];return!!Array.isArray(t)}(e)}!function(e){e[e.EIP155ReplayProtection=155]="EIP155ReplayProtection",e[e.EIP1559FeeMarket=1559]="EIP1559FeeMarket",e[e.EIP2718TypedTransaction=2718]="EIP2718TypedTransaction",e[e.EIP2930AccessLists=2930]="EIP2930AccessLists"}(q8||(q8={})),function(e){e[e.Legacy=0]="Legacy",e[e.AccessListEIP2930=1]="AccessListEIP2930",e[e.FeeMarketEIP1559=2]="FeeMarketEIP1559",e[e.BlobEIP4844=3]="BlobEIP4844"}(K8||(K8={}));class W8{static getAccessListData(e){let t,r;if(V8(e)){t=e;const n=[];for(let t=0;t0?new v8(f):void 0,this.value=V3(t8(""===o?"0x":o)),this.data=t8(""===a?"0x":a),this.v=d.length>0?V3(d):void 0,this.r=h.length>0?V3(h):void 0,this.s=p.length>0?V3(p):void 0,this._validateCannotExceedMaxInteger({value:this.value,r:this.r,s:this.s}),this._validateCannotExceedMaxInteger({gasLimit:this.gasLimit},64),this._validateCannotExceedMaxInteger({nonce:this.nonce},64,!0);const m=void 0===this.to||null===this.to,b=t.allowUnlimitedInitCodeSize??!1,g=t.common??this._getCommon();m&&g.isActivatedEIP(3860)&&!1===b&&function(e,t){const r=e.param("vm","maxInitCodeSize");if(r&&BigInt(t)>r)throw new Error(`the initcode size of this transaction is too large: it is ${t} while the max is ${e.param("vm","maxInitCodeSize")}`)}(g,this.data.length)}get type(){return this._type}supports(e){return this.activeCapabilities.includes(e)}getValidationErrors(){const e=[];return this.isSigned()&&!this.verifySignature()&&e.push("Invalid Signature"),this.getBaseFee()>this.gasLimit&&e.push(`gasLimit is too low. given ${this.gasLimit}, need at least ${this.getBaseFee()}`),e}isValid(){return 0===this.getValidationErrors().length}getBaseFee(){const e=this.common.param("gasPrices","tx");let t=this.getDataFee();if(e&&(t+=e),this.common.gteHardfork("homestead")&&this.toCreationAddress()){const e=this.common.param("gasPrices","txCreation");e&&(t+=e)}return t}getDataFee(){const e=this.common.param("gasPrices","txDataZero"),t=this.common.param("gasPrices","txDataNonZero");let r=l8;for(let n=0;n-1&&this.activeCapabilities.splice(e,1)}return s}toJSON(){return{type:i8(BigInt(this.type)),nonce:i8(this.nonce),gasLimit:i8(this.gasLimit),to:void 0!==this.to?this.to.toString():void 0,value:i8(this.value),data:q3(this.data),v:void 0!==this.v?i8(this.v):void 0,r:void 0!==this.r?i8(this.r):void 0,s:void 0!==this.s?i8(this.s):void 0}}_getCommon(e,t){if(void 0!==t){const r=V3(t8(t));if(e){if(e.chainId()!==r){const t=this._errorMsg(`The chain ID does not match the chain ID of Common. Got: ${r}, expected: ${e.chainId}`);throw new Error(t)}return e.copy()}return G8.isSupportedChainId(r)?new G8({chain:r}):G8.custom({name:"custom-chain",networkId:r,chainId:r},{baseChain:this.DEFAULT_CHAIN})}return e?.copy()??new G8({chain:this.DEFAULT_CHAIN})}_validateCannotExceedMaxInteger(e,t=256,r=!1){for(const[n,i]of Object.entries(e))switch(t){case 64:if(r){if(void 0!==i&&i>=s8){const e=this._errorMsg(`${n} cannot equal or exceed MAX_UINT64 (2^64-1), given ${i}`);throw new Error(e)}}else if(void 0!==i&&i>s8){const e=this._errorMsg(`${n} cannot exceed MAX_UINT64 (2^64-1), given ${i}`);throw new Error(e)}break;case 256:if(r){if(void 0!==i&&i>=c8){const e=this._errorMsg(`${n} cannot equal or exceed MAX_INTEGER (2^256-1), given ${i}`);throw new Error(e)}}else if(void 0!==i&&i>c8){const e=this._errorMsg(`${n} cannot exceed MAX_INTEGER (2^256-1), given ${i}`);throw new Error(e)}break;default:{const e=this._errorMsg("unimplemented bits value");throw new Error(e)}}}static _validateNotArray(e){const t=["nonce","gasPrice","gasLimit","to","value","data","v","r","s","type","baseFee","maxFeePerGas","chainId"];for(const[r,n]of Object.entries(e))if(t.includes(r)&&Array.isArray(n))throw new Error(`${r} cannot be an array`)}_getSharedErrorPostfix(){let e="";try{e=this.isSigned()?q3(this.hash()):"not available (unsigned)"}catch(t){e="error"}let t="";try{t=this.isSigned().toString()}catch(t){e="error"}let r="";try{r=this.common.hardfork()}catch(e){r="error"}let n=`tx type=${this.type} hash=${e} nonce=${this.nonce} value=${this.value} `;return n+=`signed=${t} hf=${r}`,n}}function Y8(e,t){const r=e.maxPriorityFeePerGas,n=e.maxFeePerGas-t,i=(re.maxFeePerGas)throw new Error("Tx cannot pay baseFee");const r=e.maxFeePerGas-t;return e.maxPriorityFeePerGasu8){const t=Q8(e,"Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");throw new Error(t)}}function n4(e){if(void 0!==e.cache.senderPubKey)return e.cache.senderPubKey;const t=e.getMessageToVerifySignature(),{v:r,r:n,s:i}=e;r4(e);try{const o=(e.common.customCrypto.ecrecover??k8)(t,r,o8(n),o8(i),e.supports(q8.EIP155ReplayProtection)?e.common.chainId():void 0);return Object.isFrozen(e)&&(e.cache.senderPubKey=o),o}catch(t){const r=Q8(e,"Invalid Signature");throw new Error(r)}}function i4(e,t){if(void 0!==t&&t>e)throw new Error("Tx cannot pay baseFee");return void 0===t?e:e-t}function o4(e){return(e.common.customCrypto.keccak256??wp)(e.getMessageToSign())}function a4(e,t){return a8(J8(e.type),N3.encode(t??e.raw()))}function s4(e){const{v:t}=e;if(void 0!==t&&t!==l8&&t!==f8){const t=Q8(e,"The y-parity of the transaction should either be 0 or 1");throw new Error(t)}}function c4(e){return e4(e,BigInt(W8.getDataFeeEIP2930(e.accessList,e.common)))}class u4 extends Z8{constructor(e,t={}){super({...e,type:K8.FeeMarketEIP1559},t);const{chainId:r,accessList:n,maxFeePerGas:i,maxPriorityFeePerGas:o}=e;if(this.common=this._getCommon(t.common,r),this.chainId=this.common.chainId(),!1===this.common.isActivatedEIP(1559))throw new Error("EIP-1559 not enabled on Common");this.activeCapabilities=this.activeCapabilities.concat([1559,2718,2930]);const a=W8.getAccessListData(n??[]);if(this.accessList=a.accessList,this.AccessListJSON=a.AccessListJSON,W8.verifyAccessList(this.accessList),this.maxFeePerGas=V3(t8(""===i?"0x":i)),this.maxPriorityFeePerGas=V3(t8(""===o?"0x":o)),this._validateCannotExceedMaxInteger({maxFeePerGas:this.maxFeePerGas,maxPriorityFeePerGas:this.maxPriorityFeePerGas}),Z8._validateNotArray(e),this.gasLimit*this.maxFeePerGas>c8){const e=this._errorMsg("gasLimit * maxFeePerGas cannot exceed MAX_INTEGER (2^256-1)");throw new Error(e)}if(this.maxFeePerGasc8){const e=this._errorMsg("gasLimit * gasPrice cannot exceed MAX_INTEGER");throw new Error(e)}s4(this),r4(this);(t?.freeze??!0)&&Object.freeze(this)}static fromTxData(e,t={}){return new l4(e,t)}static fromSerializedTx(e,t={}){if(!1===rp(e.subarray(0,1),J8(K8.AccessListEIP2930)))throw new Error(`Invalid serialized tx input: not an EIP-2930 transaction (wrong tx type, expected: ${K8.AccessListEIP2930}, received: ${q3(e.subarray(0,1))}`);const r=N3.decode(Uint8Array.from(e.subarray(1)));if(!Array.isArray(r))throw new Error("Invalid serialized tx input: must be array");return l4.fromValuesArray(r,t)}static fromValuesArray(e,t={}){if(8!==e.length&&11!==e.length)throw new Error("Invalid EIP-2930 transaction. Only expecting 8 values (for unsigned tx) or 11 values (for signed tx).");const[r,n,i,o,a,s,c,u,l,f,d]=e;this._validateNotArray({chainId:r,v:l}),n8({nonce:n,gasPrice:i,gasLimit:o,value:s,v:l,r:f,s:d});return new l4({chainId:V3(r),nonce:n,gasPrice:i,gasLimit:o,to:a,value:s,data:c,accessList:u??[],v:void 0!==l?V3(l):void 0,r:f,s:d},t)}getEffectivePriorityFee(e){return i4(this.gasPrice,e)}getDataFee(){return c4(this)}getUpfrontCost(){return this.gasLimit*this.gasPrice+this.value}raw(){return[o8(this.chainId),o8(this.nonce),o8(this.gasPrice),o8(this.gasLimit),void 0!==this.to?this.to.bytes:new Uint8Array(0),o8(this.value),this.data,this.accessList,void 0!==this.v?o8(this.v):new Uint8Array(0),void 0!==this.r?o8(this.r):new Uint8Array(0),void 0!==this.s?o8(this.s):new Uint8Array(0)]}serialize(){return a4(this)}getMessageToSign(){return a4(this,this.raw().slice(0,8))}getHashedMessageToSign(){return o4(this)}hash(){return t4(this)}getMessageToVerifySignature(){return this.getHashedMessageToSign()}getSenderPublicKey(){return n4(this)}addSignature(e,t,r,n=!1){t=t8(t),r=t8(r);const i={...this.txOptions,common:this.common};return l4.fromTxData({chainId:this.chainId,nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,accessList:this.accessList,v:n?e-p8:e,r:V3(t),s:V3(r)},i)}toJSON(){const e=W8.getAccessListJSON(this.accessList);return{...super.toJSON(),chainId:i8(this.chainId),gasPrice:i8(this.gasPrice),accessList:e}}errorStr(){let e=this._getSharedErrorPostfix();return e+=` gasPrice=${this.gasPrice} accessListCount=${this.accessList?.length??0}`,e}_errorMsg(e){return Q8(this,e)}}class f4 extends Z8{constructor(e,t={}){super({...e,type:K8.BlobEIP4844},t);const{chainId:r,accessList:n,maxFeePerGas:i,maxPriorityFeePerGas:o,maxFeePerBlobGas:a}=e;if(this.common=this._getCommon(t.common,r),this.chainId=this.common.chainId(),!1===this.common.isActivatedEIP(1559))throw new Error("EIP-1559 not enabled on Common");if(!1===this.common.isActivatedEIP(4844))throw new Error("EIP-4844 not enabled on Common");this.activeCapabilities=this.activeCapabilities.concat([1559,2718,2930]);const s=W8.getAccessListData(n??[]);if(this.accessList=s.accessList,this.AccessListJSON=s.AccessListJSON,W8.verifyAccessList(this.accessList),this.maxFeePerGas=V3(t8(""===i?"0x":i)),this.maxPriorityFeePerGas=V3(t8(""===o?"0x":o)),this._validateCannotExceedMaxInteger({maxFeePerGas:this.maxFeePerGas,maxPriorityFeePerGas:this.maxPriorityFeePerGas}),Z8._validateNotArray(e),this.gasLimit*this.maxFeePerGas>c8){const e=this._errorMsg("gasLimit * maxFeePerGas cannot exceed MAX_INTEGER (2^256-1)");throw new Error(e)}if(this.maxFeePerGast8(e))),s4(this),r4(this);for(const e of this.blobVersionedHashes){if(32!==e.length){const e=this._errorMsg("versioned hash is invalid length");throw new Error(e)}if(BigInt(e[0])!==this.common.param("sharding","blobCommitmentVersionKzg")){const e=this._errorMsg("versioned hash does not start with KZG commitment version");throw new Error(e)}}if(this.blobVersionedHashes.length>6){const e=this._errorMsg("tx can contain at most 6 blobs");throw new Error(e)}if(0===this.blobVersionedHashes.length){const e=this._errorMsg("tx should contain at least one blob");throw new Error(e)}if(void 0===this.to){const e=this._errorMsg('tx should have a "to" field and cannot be used to create contracts');throw new Error(e)}this.blobs=e.blobs?.map((e=>t8(e))),this.kzgCommitments=e.kzgCommitments?.map((e=>t8(e))),this.kzgProofs=e.kzgProofs?.map((e=>t8(e)));(t?.freeze??!0)&&Object.freeze(this)}static fromTxData(e,t){if(void 0===t?.common?.customCrypto?.kzg)throw new Error("A common object with customCrypto.kzg initialized required to instantiate a 4844 blob tx");const r=t.common.customCrypto.kzg;if(void 0!==e.blobsData){if(void 0!==e.blobs)throw new Error("cannot have both raw blobs data and encoded blobs in constructor");if(void 0!==e.kzgCommitments)throw new Error("cannot have both raw blobs data and KZG commitments in constructor");if(void 0!==e.blobVersionedHashes)throw new Error("cannot have both raw blobs data and versioned hashes in constructor");if(void 0!==e.kzgProofs)throw new Error("cannot have both raw blobs data and KZG proofs in constructor");e.blobs=T8(e.blobsData.reduce(((e,t)=>e+t))),e.kzgCommitments=((e,t)=>{const r=[];for(const n of t)r.push(e.blobToKzgCommitment(n));return r})(r,e.blobs),e.blobVersionedHashes=(e=>{const t=[];for(const r of e)t.push(O8(r,1));return t})(e.kzgCommitments),e.kzgProofs=((e,t,r)=>t.map(((t,n)=>e.computeBlobKzgProof(t,r[n]))))(r,e.blobs,e.kzgCommitments)}return new f4(e,t)}getEffectivePriorityFee(e){return X8(this,e)}static minimalFromNetworkWrapper(e,t){if(void 0===t?.common?.customCrypto?.kzg)throw new Error("A common object with customCrypto.kzg initialized required to instantiate a 4844 blob tx");return f4.fromTxData({...e,blobs:void 0,kzgCommitments:void 0,kzgProofs:void 0},t)}static fromSerializedTx(e,t={}){if(void 0===t.common?.customCrypto?.kzg)throw new Error("A common object with customCrypto.kzg initialized required to instantiate a 4844 blob tx");if(!1===rp(e.subarray(0,1),J8(K8.BlobEIP4844)))throw new Error(`Invalid serialized tx input: not an EIP-4844 transaction (wrong tx type, expected: ${K8.BlobEIP4844}, received: ${q3(e.subarray(0,1))}`);const r=N3.decode(e.subarray(1));if(!Array.isArray(r))throw new Error("Invalid serialized tx input: must be array");return f4.fromValuesArray(r,t)}static fromValuesArray(e,t={}){if(void 0===t.common?.customCrypto?.kzg)throw new Error("A common object with customCrypto.kzg initialized required to instantiate a 4844 blob tx");if(11!==e.length&&14!==e.length)throw new Error("Invalid EIP-4844 transaction. Only expecting 11 values (for unsigned tx) or 14 values (for signed tx).");const[r,n,i,o,a,s,c,u,l,f,d,h,p,m]=e;return this._validateNotArray({chainId:r,v:h}),n8({nonce:n,maxPriorityFeePerGas:i,maxFeePerGas:o,gasLimit:a,value:c,maxFeePerBlobGas:f,v:h,r:p,s:m}),new f4({chainId:V3(r),nonce:n,maxPriorityFeePerGas:i,maxFeePerGas:o,gasLimit:a,to:s,value:c,data:u,accessList:l??[],maxFeePerBlobGas:f,blobVersionedHashes:d,v:void 0!==h?V3(h):void 0,r:p,s:m},t)}static fromSerializedBlobTxNetworkWrapper(e,t){if(!t||!t.common)throw new Error("common instance required to validate versioned hashes");if(void 0===t.common?.customCrypto?.kzg)throw new Error("A common object with customCrypto.kzg initialized required to instantiate a 4844 blob tx");if(!1===rp(e.subarray(0,1),J8(K8.BlobEIP4844)))throw new Error(`Invalid serialized tx input: not an EIP-4844 transaction (wrong tx type, expected: ${K8.BlobEIP4844}, received: ${q3(e.subarray(0,1))}`);const r=N3.decode(e.subarray(1));if(4!==r.length)throw Error("Expected 4 values in the deserialized network transaction");const[n,i,o,a]=r,s=f4.fromValuesArray(n,{...t,freeze:!1});if(void 0===s.to)throw Error("BlobEIP4844Transaction can not be send without a valid `to`");const c=Number(t.common.param("sharding","blobCommitmentVersionKzg"));((e,t,r,n,i,o)=>{if(e.length!==t.length||t.length!==r.length)throw new Error("Number of blobVersionedHashes, blobs, and commitments not all equal");if(0===e.length)throw new Error("Invalid transaction with empty blobs");let a;try{a=o.verifyBlobKzgProofBatch(t,r,n)}catch(e){throw new Error(`KZG verification of blobs fail with error=${e}`)}if(!a)throw new Error("KZG proof cannot be verified from blobs/commitments");for(let t=0;tq3(e)))}}addSignature(e,t,r,n=!1){t=t8(t),r=t8(r);const i={...this.txOptions,common:this.common};return f4.fromTxData({chainId:this.chainId,nonce:this.nonce,maxPriorityFeePerGas:this.maxPriorityFeePerGas,maxFeePerGas:this.maxFeePerGas,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,accessList:this.accessList,v:n?e-p8:e,r:V3(t),s:V3(r),maxFeePerBlobGas:this.maxFeePerBlobGas,blobVersionedHashes:this.blobVersionedHashes,blobs:this.blobs,kzgCommitments:this.kzgCommitments,kzgProofs:this.kzgProofs},i)}errorStr(){let e=this._getSharedErrorPostfix();return e+=` maxFeePerGas=${this.maxFeePerGas} maxPriorityFeePerGas=${this.maxPriorityFeePerGas}`,e}_errorMsg(e){return Q8(this,e)}numBlobs(){return this.blobVersionedHashes.length}}function d4(e,t){const r=Number(e),n=2*Number(t);return r===n+35||r===n+36}class h4 extends Z8{constructor(e,t={}){if(super({...e,type:K8.Legacy},t),this.common=this._validateTxV(this.v,t.common),this.keccakFunction=this.common.customCrypto.keccak256??wp,this.gasPrice=V3(t8(""===e.gasPrice?"0x":e.gasPrice)),this.gasPrice*this.gasLimit>c8){const e=this._errorMsg("gas limit * gasPrice cannot exceed MAX_INTEGER (2^256-1)");throw new Error(e)}this._validateCannotExceedMaxInteger({gasPrice:this.gasPrice}),Z8._validateNotArray(e),this.common.gteHardfork("spuriousDragon")&&(this.isSigned()?d4(this.v,this.common.chainId())&&this.activeCapabilities.push(q8.EIP155ReplayProtection):this.activeCapabilities.push(q8.EIP155ReplayProtection));(t?.freeze??!0)&&Object.freeze(this)}static fromTxData(e,t={}){return new h4(e,t)}static fromSerializedTx(e,t={}){const r=N3.decode(e);if(!Array.isArray(r))throw new Error("Invalid serialized tx input. Must be array");return this.fromValuesArray(r,t)}static fromValuesArray(e,t={}){if(6!==e.length&&9!==e.length)throw new Error("Invalid transaction. Only expecting 6 values (for unsigned tx) or 9 values (for signed tx).");const[r,n,i,o,a,s,c,u,l]=e;return n8({nonce:r,gasPrice:n,gasLimit:i,value:a,v:c,r:u,s:l}),new h4({nonce:r,gasPrice:n,gasLimit:i,to:o,value:a,data:s,v:c,r:u,s:l},t)}getEffectivePriorityFee(e){return i4(this.gasPrice,e)}raw(){return[o8(this.nonce),o8(this.gasPrice),o8(this.gasLimit),void 0!==this.to?this.to.bytes:new Uint8Array(0),o8(this.value),this.data,void 0!==this.v?o8(this.v):new Uint8Array(0),void 0!==this.r?o8(this.r):new Uint8Array(0),void 0!==this.s?o8(this.s):new Uint8Array(0)]}serialize(){return N3.encode(this.raw())}getMessageToSign(){const e=[o8(this.nonce),o8(this.gasPrice),o8(this.gasLimit),void 0!==this.to?this.to.bytes:new Uint8Array(0),o8(this.value),this.data];return this.supports(q8.EIP155ReplayProtection)&&(e.push(o8(this.common.chainId())),e.push(e8(t8(0))),e.push(e8(t8(0)))),e}getHashedMessageToSign(){const e=this.getMessageToSign();return this.keccakFunction(N3.encode(e))}getDataFee(){return e4(this)}getUpfrontCost(){return this.gasLimit*this.gasPrice+this.value}hash(){return t4(this)}getMessageToVerifySignature(){if(!this.isSigned()){const e=this._errorMsg("This transaction is not signed");throw new Error(e)}return this.getHashedMessageToSign()}getSenderPublicKey(){return n4(this)}addSignature(e,t,r,n=!1){t=t8(t),r=t8(r),n&&this.supports(q8.EIP155ReplayProtection)&&(e+=this.common.chainId()*d8+h8);const i={...this.txOptions,common:this.common};return h4.fromTxData({nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,v:e,r:V3(t),s:V3(r)},i)}toJSON(){return{...super.toJSON(),gasPrice:i8(this.gasPrice)}}_validateTxV(e,t){let r;const n=void 0!==e?Number(e):void 0;if(void 0!==n&&n<37&&27!==n&&28!==n)throw new Error(`Legacy txs need either v = 27/28 or v >= 37 (EIP-155 replay protection), got v = ${n}`);if(void 0!==n&&0!==n&&(!t||t.gteHardfork("spuriousDragon"))&&27!==n&&28!==n)if(t){if(!d4(BigInt(n),t.chainId()))throw new Error(`Incompatible EIP155-based V ${n} and chain id ${t.chainId()}. See the Common parameter of the Transaction constructor to set the chain id.`)}else{let e;e=(n-35)%2==0?35:36,r=BigInt(n-e)/d8}return this._getCommon(t,r)}errorStr(){let e=this._getSharedErrorPostfix();return e+=` gasPrice=${this.gasPrice}`,e}_errorMsg(e){return Q8(this,e)}}class p4{constructor(){}static fromTxData(e,t={}){if("type"in e&&void 0!==e.type){if(function(e){return Number(V3(t8(e.type)))===K8.Legacy}(e))return h4.fromTxData(e,t);if(function(e){return Number(V3(t8(e.type)))===K8.AccessListEIP2930}(e))return l4.fromTxData(e,t);if(function(e){return Number(V3(t8(e.type)))===K8.FeeMarketEIP1559}(e))return u4.fromTxData(e,t);if(function(e){return Number(V3(t8(e.type)))===K8.BlobEIP4844}(e))return f4.fromTxData(e,t);throw new Error(`Tx instantiation with type ${e?.type} not supported`)}return h4.fromTxData(e,t)}static fromSerializedData(e,t={}){if(!(e[0]<=127))return h4.fromSerializedTx(e,t);switch(e[0]){case K8.AccessListEIP2930:return l4.fromSerializedTx(e,t);case K8.FeeMarketEIP1559:return u4.fromSerializedTx(e,t);case K8.BlobEIP4844:return f4.fromSerializedTx(e,t);default:throw new Error(`TypedTransaction with ID ${e[0]} unknown`)}}static fromBlockBodyData(e,t={}){if(e instanceof Uint8Array)return this.fromSerializedData(e,t);if(Array.isArray(e))return h4.fromValuesArray(e,t);throw new Error("Cannot decode transaction: unknown type input")}static async fromJsonRpcProvider(e,t,r){const n=(e=>{if("string"==typeof e)return e;if("object"==typeof e&&void 0!==e._getConnection)return e._getConnection().url;throw new Error("Must provide valid provider URL or Web3Provider")})(e),i=await(async(e,t)=>{const r=JSON.stringify({method:t.method,params:t.params,jsonrpc:"2.0",id:1}),n=await fetch(e,{headers:{"content-type":"application/json"},method:"POST",body:r});if(!n.ok)throw new Error(`JSONRpcError: ${JSON.stringify({method:t.method,status:n.status,message:await n.text().catch((()=>"Could not parse error message likely because of a network error"))},null,2)}`);return(await n.json()).result})(n,{method:"eth_getTransactionByHash",params:[t]});if(null===i)throw new Error("No data returned from provider");return p4.fromRPC(i,r)}static async fromRPC(e,t={}){return p4.fromTxData((e=>{const t=Object.assign({},e);return t.gasLimit=x8(t.gasLimit??t.gas,A8.BigInt),t.data=void 0===t.data?t.input:t.data,t.gasPrice=void 0!==t.gasPrice?BigInt(t.gasPrice):void 0,t.value=void 0!==t.value?BigInt(t.value):void 0,t.to=null!==t.to&&void 0!==t.to?Q3(t8(t.to),20):null,t.v="0x0"===t.v?"0x":t.v,t.r="0x0"===t.r?"0x":t.r,t.s="0x0"===t.s?"0x":t.s,"0x"===t.v&&"0x"===t.r&&"0x"===t.s||(t.v=x8(t.v,A8.BigInt)),t})(e),t)}}var m4={},b4={},g4={},y4={},v4={},w4={},E4={},A4={},x4={};function _4(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function k4(e){if("boolean"!=typeof e)throw new Error(`boolean expected, not ${e}`)}function S4(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function P4(e,...t){if(!S4(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function I4(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");_4(e.outputLen),_4(e.blockLen)}function T4(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function O4(e,t){P4(e);const r=t.outputLen;if(e.lengthnew Uint8Array(e.buffer,e.byteOffset,e.byteLength);e.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));e.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);e.rotr=(e,t)=>e<<32-t|e>>>t;e.rotl=(e,t)=>e<>>32-t>>>0,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];e.byteSwap=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,e.byteSwapIfBE=e.isLE?e=>e:t=>(0,e.byteSwap)(t),e.byteSwap32=function(t){for(let r=0;rt.toString(16).padStart(2,"0")));e.bytesToHex=function(e){(0,r.bytes)(e);let t="";for(let r=0;r=i._0&&e<=i._9?e-i._0:e>=i._A&&e<=i._F?e-(i._A-10):e>=i._a&&e<=i._f?e-(i._a-10):void 0}e.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t{},e.asyncLoop=async function(t,r,n){let i=Date.now();for(let o=0;o=0&&te().update(s(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},e.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(s(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},e.wrapXOFConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(s(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},e.randomBytes=function(e=32){if(t.crypto&&"function"==typeof t.crypto.getRandomValues)return t.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}}(C4),Object.defineProperty(A4,"__esModule",{value:!0}),A4.HashMD=A4.Maj=A4.Chi=void 0;const N4=x4,R4=C4;A4.Chi=(e,t,r)=>e&t^~e&r;A4.Maj=(e,t,r)=>e&t^e&r^t&r;A4.HashMD=class extends R4.Hash{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,R4.createView)(this.buffer)}update(e){(0,N4.exists)(this);const{view:t,buffer:r,blockLen:n}=this,i=(e=(0,R4.toBytes)(e)).length;for(let o=0;on-o&&(this.process(r,0),o=0);for(let e=o;e>i&o),s=Number(r&o),c=n?4:0,u=n?0:4;e.setUint32(t+c,a,n),e.setUint32(t+u,s,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const a=(0,R4.createView)(e),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=s/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e>>3,i=(0,L4.rotr)(r,17)^(0,L4.rotr)(r,19)^r>>>10;D4[e]=i+D4[e-7]+n+D4[e-16]|0}let{A:r,B:n,C:i,D:o,E:a,F:s,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+((0,L4.rotr)(a,6)^(0,L4.rotr)(a,11)^(0,L4.rotr)(a,25))+(0,F4.Chi)(a,s,c)+j4[e]+D4[e]|0,l=((0,L4.rotr)(r,2)^(0,L4.rotr)(r,13)^(0,L4.rotr)(r,22))+(0,F4.Maj)(r,n,i)|0;u=c,c=s,s=a,a=o+t|0,o=i,i=n,n=r,r=t+l|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,n,i,o,a,s,c,u)}roundClean(){D4.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class $4 extends z4{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}}E4.sha256=(0,L4.wrapConstructor)((()=>new z4)),E4.sha224=(0,L4.wrapConstructor)((()=>new $4));var H4={},G4={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const t=x4,r=C4;class n extends r.Hash{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,(0,t.hash)(e);const i=(0,r.toBytes)(n);if(this.iHash=e.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 o=this.blockLen,a=new Uint8Array(o);a.set(i.length>o?e.create().update(i).digest():i);for(let e=0;enew n(e,t).update(r).digest(),e.hmac.create=(e,t)=>new n(e,t)}(G4);var q4={},K4={},V4={},W4={};Object.defineProperty(W4,"__esModule",{value:!0}),W4.bitMask=void 0,W4.isBytes=X4,W4.abytes=Q4,W4.bytesToHex=t9,W4.numberToHexUnpadded=r9,W4.hexToNumber=n9,W4.hexToBytes=a9,W4.bytesToNumberBE=function(e){return n9(t9(e))},W4.bytesToNumberLE=function(e){return Q4(e),n9(t9(Uint8Array.from(e).reverse()))},W4.numberToBytesBE=s9,W4.numberToBytesLE=function(e,t){return s9(e,t).reverse()},W4.numberToVarBytesBE=function(e){return a9(r9(e))},W4.ensureBytes=function(e,t,r){let n;if("string"==typeof t)try{n=a9(t)}catch(r){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${r}`)}else{if(!X4(t))throw new Error(`${e} must be hex string or Uint8Array`);n=Uint8Array.from(t)}const i=n.length;if("number"==typeof r&&i!==r)throw new Error(`${e} expected ${r} bytes, got ${i}`);return n},W4.concatBytes=c9,W4.equalBytes=function(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;nJ4;e>>=Z4,t+=1);return t},W4.bitGet=function(e,t){return e>>BigInt(t)&Z4},W4.bitSet=function(e,t,r){return e|(r?Z4:J4)<{n.fill(1),i.fill(0),o=0},s=(...e)=>r(i,n,...e),c=(e=u9())=>{i=s(l9([0]),e),n=s(),0!==e.length&&(i=s(l9([1]),e),n=s())},u=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e{let r;for(a(),c(e);!(r=t(u()));)c();return a(),r}},W4.validateObject=function(e,t,r={}){const n=(t,r,n)=>{const i=f9[r];if("function"!=typeof i)throw new Error(`Invalid validator "${r}", expected function`);const o=e[t];if(!(n&&void 0===o||i(o,e)))throw new Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${r}`)};for(const[e,r]of Object.entries(t))n(e,r,!1);for(const[e,t]of Object.entries(r))n(e,t,!0);return e}; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const J4=BigInt(0),Z4=BigInt(1),Y4=BigInt(2);function X4(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function Q4(e){if(!X4(e))throw new Error("Uint8Array expected")}const e9=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function t9(e){Q4(e);let t="";for(let r=0;r=i9._0&&e<=i9._9?e-i9._0:e>=i9._A&&e<=i9._F?e-(i9._A-10):e>=i9._a&&e<=i9._f?e-(i9._a-10):void 0}function a9(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t(Y4<new Uint8Array(e),l9=e=>Uint8Array.from(e);const f9={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||X4(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};Object.defineProperty(V4,"__esModule",{value:!0}),V4.isNegativeLE=void 0,V4.mod=w9,V4.pow=E9,V4.pow2=function(e,t,r){let n=e;for(;t-- >h9;)n*=n,n%=r;return n},V4.invert=A9,V4.tonelliShanks=x9,V4.FpSqrt=_9,V4.validateField=function(e){const t=k9.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,d9.validateObject)(e,t)},V4.FpPow=S9,V4.FpInvertBatch=P9,V4.FpDiv=function(e,t,r){return e.mul(t,"bigint"==typeof r?A9(r,e.ORDER):e.inv(r))},V4.FpIsSquare=function(e){const t=(e.ORDER-p9)/m9;return r=>{const n=e.pow(r,t);return e.eql(n,e.ZERO)||e.eql(n,e.ONE)}},V4.nLength=I9,V4.Field=function(e,t,r=!1,n={}){if(e<=h9)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:o}=I9(e,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=_9(e),s=Object.freeze({ORDER:e,BITS:i,BYTES:o,MASK:(0,d9.bitMask)(i),ZERO:h9,ONE:p9,create:t=>w9(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return h9<=t&&te===h9,isOdd:e=>(e&p9)===p9,neg:t=>w9(-t,e),eql:(e,t)=>e===t,sqr:t=>w9(t*t,e),add:(t,r)=>w9(t+r,e),sub:(t,r)=>w9(t-r,e),mul:(t,r)=>w9(t*r,e),pow:(e,t)=>S9(s,e,t),div:(t,r)=>w9(t*A9(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>A9(t,e),sqrt:n.sqrt||(e=>a(s,e)),invertBatch:e=>P9(s,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?(0,d9.numberToBytesLE)(e,o):(0,d9.numberToBytesBE)(e,o),fromBytes:e=>{if(e.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return r?(0,d9.bytesToNumberLE)(e):(0,d9.bytesToNumberBE)(e)}});return Object.freeze(s)},V4.FpSqrtOdd=function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);return e.isOdd(r)?r:e.neg(r)},V4.FpSqrtEven=function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);return e.isOdd(r)?e.neg(r):r},V4.hashToPrivateScalar=function(e,t,r=!1){e=(0,d9.ensureBytes)("privateHash",e);const n=e.length,i=I9(t).nByteLength+8;if(i<24||n1024)throw new Error(`hashToPrivateScalar: expected ${i}-1024 bytes of input, got ${n}`);const o=r?(0,d9.bytesToNumberLE)(e):(0,d9.bytesToNumberBE)(e);return w9(o,t-p9)+p9},V4.getFieldBytesLength=T9,V4.getMinHashLength=O9,V4.mapHashToField=function(e,t,r=!1){const n=e.length,i=T9(t),o=O9(t);if(n<16||n1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);const a=r?(0,d9.bytesToNumberBE)(e):(0,d9.bytesToNumberLE)(e),s=w9(a,t-p9)+p9;return r?(0,d9.numberToBytesLE)(s,i):(0,d9.numberToBytesBE)(s,i)}; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const d9=W4,h9=BigInt(0),p9=BigInt(1),m9=BigInt(2),b9=BigInt(3),g9=BigInt(4),y9=BigInt(5),v9=BigInt(8);function w9(e,t){const r=e%t;return r>=h9?r:t+r}function E9(e,t,r){if(r<=h9||t 0");if(r===p9)return h9;let n=p9;for(;t>h9;)t&p9&&(n=n*e%r),e=e*e%r,t>>=p9;return n}function A9(e,t){if(e===h9||t<=h9)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=w9(e,t),n=t,i=h9,o=p9;for(;r!==h9;){const e=n%r,t=i-o*(n/r);n=r,r=e,i=o,o=t}if(n!==p9)throw new Error("invert: does not exist");return w9(i,t)}function x9(e){const t=(e-p9)/m9;let r,n,i;for(r=e-p9,n=0;r%m9===h9;r/=m9,n++);for(i=m9;i(w9(e,t)&p9)===p9;const k9=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function S9(e,t,r){if(r 0");if(r===h9)return e.ONE;if(r===p9)return t;let n=e.ONE,i=t;for(;r>h9;)r&p9&&(n=e.mul(n,i)),i=e.sqr(i),r>>=p9;return n}function P9(e,t){const r=new Array(t.length),n=t.reduce(((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n))),e.ONE),i=e.inv(n);return t.reduceRight(((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n))),i),r}function I9(e,t){const r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function T9(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function O9(e){const t=T9(e);return t+Math.ceil(t/2)}Object.defineProperty(K4,"__esModule",{value:!0}),K4.wNAF=function(e,t){const r=(e,t)=>{const r=t.negate();return e?r:t},n=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:r,unsafeLadder(t,r){let n=e.ZERO,i=t;for(;r>B9;)r&N9&&(n=n.add(i)),i=i.double(),r>>=N9;return n},precomputeWindow(e,t){const{windows:r,windowSize:i}=n(t),o=[];let a=e,s=a;for(let e=0;e>=d,n>s&&(n-=f,o+=N9);const a=t,h=t+Math.abs(n)-1,p=e%2!=0,m=n<0;0===n?u=u.add(r(p,i[a])):c=c.add(r(m,i[h]))}return{p:c,f:u}},wNAFCached(e,t,r,n){const i=e._WINDOW_SIZE||1;let o=t.get(e);return o||(o=this.precomputeWindow(e,i),1!==i&&t.set(e,n(o))),this.wNAF(i,o,r)}}},K4.validateBasic=function(e){return(0,M9.validateField)(e.Fp),(0,C9.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,M9.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const M9=V4,C9=W4,B9=BigInt(0),N9=BigInt(1);!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=void 0,e.weierstrassPoints=d,e.weierstrass=function(o){const a=function(e){const r=(0,t.validateBasic)(e);return n.validateObject(r,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...r})}(o),{Fp:u,n:l}=a,f=u.BYTES+1,h=2*u.BYTES+1;function p(e){return r.mod(e,l)}function m(e){return r.invert(e,l)}const{ProjectivePoint:b,normPrivateKeyToScalar:g,weierstrassEquation:y,isWithinCurveOrder:v}=d({...a,toBytes(e,t,r){const i=t.toAffine(),o=u.toBytes(i.x),a=n.concatBytes;return r?a(Uint8Array.from([t.hasEvenY()?2:3]),o):a(Uint8Array.from([4]),o,u.toBytes(i.y))},fromBytes(e){const t=e.length,r=e[0],i=e.subarray(1);if(t!==f||2!==r&&3!==r){if(t===h&&4===r){return{x:u.fromBytes(i.subarray(0,u.BYTES)),y:u.fromBytes(i.subarray(u.BYTES,2*u.BYTES))}}throw new Error(`Point of length ${t} was invalid. Expected ${f} compressed bytes or ${h} uncompressed bytes`)}{const e=n.bytesToNumberBE(i);if(!(s<(o=e)&&on.bytesToHex(n.numberToBytesBE(e,a.nByteLength));function E(e){return e>l>>c}const A=(e,t,r)=>n.bytesToNumberBE(e.slice(t,r));class x{constructor(e,t,r){this.r=e,this.s=t,this.recovery=r,this.assertValidity()}static fromCompact(e){const t=a.nByteLength;return e=(0,i.ensureBytes)("compactSignature",e,2*t),new x(A(e,0,t),A(e,t,2*t))}static fromDER(t){const{r:r,s:n}=e.DER.toSig((0,i.ensureBytes)("DER",t));return new x(r,n)}assertValidity(){if(!v(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!v(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(e){return new x(this.r,this.s,e)}recoverPublicKey(e){const{r:t,s:r,recovery:n}=this,o=T((0,i.ensureBytes)("msgHash",e));if(null==n||![0,1,2,3].includes(n))throw new Error("recovery id invalid");const s=2===n||3===n?t+a.n:t;if(s>=u.ORDER)throw new Error("recovery id 2 or 3 invalid");const c=1&n?"03":"02",l=b.fromHex(c+w(s)),f=m(s),d=p(-o*f),h=p(r*f),g=b.BASE.multiplyAndAddUnsafe(l,d,h);if(!g)throw new Error("point at infinify");return g.assertValidity(),g}hasHighS(){return E(this.s)}normalizeS(){return this.hasHighS()?new x(this.r,p(-this.s),this.recovery):this}toDERRawBytes(){return n.hexToBytes(this.toDERHex())}toDERHex(){return e.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return n.hexToBytes(this.toCompactHex())}toCompactHex(){return w(this.r)+w(this.s)}}const _={isValidPrivateKey(e){try{return g(e),!0}catch(e){return!1}},normPrivateKeyToScalar:g,randomPrivateKey:()=>{const e=r.getMinHashLength(a.n);return r.mapHashToField(a.randomBytes(e),a.n)},precompute:(e=8,t=b.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function k(e,t=!0){return b.fromPrivateKey(e).toRawBytes(t)}function S(e){const t=n.isBytes(e),r="string"==typeof e,i=(t||r)&&e.length;return t?i===f||i===h:r?i===2*f||i===2*h:e instanceof b}function P(e,t,r=!0){if(S(e))throw new Error("first arg must be private key");if(!S(t))throw new Error("second arg must be public key");return b.fromHex(t).multiply(g(e)).toRawBytes(r)}const I=a.bits2int||function(e){const t=n.bytesToNumberBE(e),r=8*e.length-a.nBitLength;return r>0?t>>BigInt(r):t},T=a.bits2int_modN||function(e){return p(I(e))},O=n.bitMask(a.nBitLength);function M(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(s<=e&&ee in r)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:l}=a;let{lowS:f,prehash:d,extraEntropy:h}=r;null==f&&(f=!0),e=(0,i.ensureBytes)("msgHash",e),d&&(e=(0,i.ensureBytes)("prehashed msgHash",o(e)));const y=T(e),w=g(t),A=[M(w),M(y)];if(null!=h&&!1!==h){const e=!0===h?l(u.BYTES):h;A.push((0,i.ensureBytes)("extraEntropy",e))}const _=n.concatBytes(...A),k=y;return{seed:_,k2sig:function(e){const t=I(e);if(!v(t))return;const r=m(t),n=b.BASE.multiply(t).toAffine(),i=p(n.x);if(i===s)return;const o=p(r*p(k+i*w));if(o===s)return;let a=(n.x===i?0:2)|Number(n.y&c),u=o;return f&&E(o)&&(u=function(e){return E(e)?p(-e):e}(o),a^=1),new x(i,u,a)}}}const B={lowS:a.lowS,prehash:!1},N={lowS:a.lowS,prehash:!1};function R(t,r,o,s=N){const c=t;if(r=(0,i.ensureBytes)("msgHash",r),o=(0,i.ensureBytes)("publicKey",o),"strict"in s)throw new Error("options.strict was renamed to lowS");const{lowS:u,prehash:l}=s;let f,d;try{if("string"==typeof c||n.isBytes(c))try{f=x.fromDER(c)}catch(t){if(!(t instanceof e.DER.Err))throw t;f=x.fromCompact(c)}else{if("object"!=typeof c||"bigint"!=typeof c.r||"bigint"!=typeof c.s)throw new Error("PARSE");{const{r:e,s:t}=c;f=new x(e,t)}}d=b.fromHex(o)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(u&&f.hasHighS())return!1;l&&(r=a.hash(r));const{r:h,s:g}=f,y=T(r),v=m(g),w=p(y*v),E=p(h*v),A=b.BASE.multiplyAndAddUnsafe(d,w,E)?.toAffine();if(!A)return!1;return p(A.x)===h}return b.BASE._setWindowSize(8),{CURVE:a,getPublicKey:k,getSharedSecret:P,sign:function(e,t,r=B){const{seed:i,k2sig:o}=C(e,t,r),s=a;return n.createHmacDrbg(s.hash.outputLen,s.nByteLength,s.hmac)(i,o)},verify:R,ProjectivePoint:b,Signature:x,utils:_}},e.SWUFpSqrtRatio=h,e.mapToCurveSimpleSWU=function(e,t){if(r.validateField(e),!e.isValid(t.A)||!e.isValid(t.B)||!e.isValid(t.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const n=h(e,t.Z);if(!e.isOdd)throw new Error("Fp.isOdd is not implemented!");return r=>{let i,o,a,s,c,u,l,f;i=e.sqr(r),i=e.mul(i,t.Z),o=e.sqr(i),o=e.add(o,i),a=e.add(o,e.ONE),a=e.mul(a,t.B),s=e.cmov(t.Z,e.neg(o),!e.eql(o,e.ZERO)),s=e.mul(s,t.A),o=e.sqr(a),u=e.sqr(s),c=e.mul(u,t.A),o=e.add(o,c),o=e.mul(o,a),u=e.mul(u,s),c=e.mul(u,t.B),o=e.add(o,c),l=e.mul(i,a);const{isValid:d,value:h}=n(o,u);f=e.mul(i,r),f=e.mul(f,h),l=e.cmov(l,a,d),f=e.cmov(f,h,d);const p=e.isOdd(r)===e.isOdd(f);return f=e.cmov(e.neg(f),f,p),l=e.div(l,s),{x:l,y:f}}}; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const t=K4,r=V4,n=W4,i=W4;const{bytesToNumberBE:o,hexToBytes:a}=n;e.DER={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:r}=e.DER;if(t.length<2||2!==t[0])throw new r("Invalid signature integer tag");const n=t[1],i=t.subarray(2,n+2);if(!n||i.length!==n)throw new r("Invalid signature integer: wrong length");if(128&i[0])throw new r("Invalid signature integer: negative");if(0===i[0]&&!(128&i[1]))throw new r("Invalid signature integer: unnecessary leading zero");return{d:o(i),l:t.subarray(n+2)}},toSig(t){const{Err:r}=e.DER,i="string"==typeof t?a(t):t;n.abytes(i);let o=i.length;if(o<2||48!=i[0])throw new r("Invalid signature tag");if(i[1]!==o-2)throw new r("Invalid signature: incorrect length");const{d:s,l:c}=e.DER._parseInt(i.subarray(2)),{d:u,l:l}=e.DER._parseInt(c);if(l.length)throw new r("Invalid signature: left bytes after parsing");return{r:s,s:u}},hexFromSig(e){const t=e=>8&Number.parseInt(e[0],16)?"00"+e:e,r=e=>{const t=e.toString(16);return 1&t.length?`0${t}`:t},n=t(r(e.s)),i=t(r(e.r)),o=n.length/2,a=i.length/2,s=r(o),c=r(a);return`30${r(a+o+4)}02${c}${i}02${s}${n}`}};const s=BigInt(0),c=BigInt(1),u=BigInt(2),l=BigInt(3),f=BigInt(4);function d(e){const o=function(e){const r=(0,t.validateBasic)(e);n.validateObject(r,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:i,Fp:o,a:a}=r;if(i){if(!o.eql(a,o.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof i||"bigint"!=typeof i.beta||"function"!=typeof i.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...r})}(e),{Fp:a}=o,u=o.toBytes||((e,t,r)=>{const i=t.toAffine();return n.concatBytes(Uint8Array.from([4]),a.toBytes(i.x),a.toBytes(i.y))}),f=o.fromBytes||(e=>{const t=e.subarray(1);return{x:a.fromBytes(t.subarray(0,a.BYTES)),y:a.fromBytes(t.subarray(a.BYTES,2*a.BYTES))}});function d(e){const{a:t,b:r}=o,n=a.sqr(e),i=a.mul(n,e);return a.add(a.add(i,a.mul(e,t)),r)}if(!a.eql(a.sqr(o.Gy),d(o.Gx)))throw new Error("bad generator point: equation left != right");function h(e){return"bigint"==typeof e&&sa.eql(e,a.ZERO);return n(t)&&n(r)?y.ZERO:new y(t,r,a.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=a.invertBatch(e.map((e=>e.pz)));return e.map(((e,r)=>e.toAffine(t[r]))).map(y.fromAffine)}static fromHex(e){const t=y.fromAffine(f((0,i.ensureBytes)("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return y.BASE.multiply(m(e))}_setWindowSize(e){this._WINDOW_SIZE=e,b.delete(this)}assertValidity(){if(this.is0()){if(o.allowInfinityPoint&&!a.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:e,y:t}=this.toAffine();if(!a.isValid(e)||!a.isValid(t))throw new Error("bad point: x or y not FE");const r=a.sqr(t),n=d(e);if(!a.eql(r,n))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(a.isOdd)return!a.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){g(e);const{px:t,py:r,pz:n}=this,{px:i,py:o,pz:s}=e,c=a.eql(a.mul(t,s),a.mul(i,n)),u=a.eql(a.mul(r,s),a.mul(o,n));return c&&u}negate(){return new y(this.px,a.neg(this.py),this.pz)}double(){const{a:e,b:t}=o,r=a.mul(t,l),{px:n,py:i,pz:s}=this;let c=a.ZERO,u=a.ZERO,f=a.ZERO,d=a.mul(n,n),h=a.mul(i,i),p=a.mul(s,s),m=a.mul(n,i);return m=a.add(m,m),f=a.mul(n,s),f=a.add(f,f),c=a.mul(e,f),u=a.mul(r,p),u=a.add(c,u),c=a.sub(h,u),u=a.add(h,u),u=a.mul(c,u),c=a.mul(m,c),f=a.mul(r,f),p=a.mul(e,p),m=a.sub(d,p),m=a.mul(e,m),m=a.add(m,f),f=a.add(d,d),d=a.add(f,d),d=a.add(d,p),d=a.mul(d,m),u=a.add(u,d),p=a.mul(i,s),p=a.add(p,p),d=a.mul(p,m),c=a.sub(c,d),f=a.mul(p,h),f=a.add(f,f),f=a.add(f,f),new y(c,u,f)}add(e){g(e);const{px:t,py:r,pz:n}=this,{px:i,py:s,pz:c}=e;let u=a.ZERO,f=a.ZERO,d=a.ZERO;const h=o.a,p=a.mul(o.b,l);let m=a.mul(t,i),b=a.mul(r,s),v=a.mul(n,c),w=a.add(t,r),E=a.add(i,s);w=a.mul(w,E),E=a.add(m,b),w=a.sub(w,E),E=a.add(t,n);let A=a.add(i,c);return E=a.mul(E,A),A=a.add(m,v),E=a.sub(E,A),A=a.add(r,n),u=a.add(s,c),A=a.mul(A,u),u=a.add(b,v),A=a.sub(A,u),d=a.mul(h,E),u=a.mul(p,v),d=a.add(u,d),u=a.sub(b,d),d=a.add(b,d),f=a.mul(u,d),b=a.add(m,m),b=a.add(b,m),v=a.mul(h,v),E=a.mul(p,E),b=a.add(b,v),v=a.sub(m,v),v=a.mul(h,v),E=a.add(E,v),m=a.mul(b,E),f=a.add(f,m),m=a.mul(A,E),u=a.mul(w,u),u=a.sub(u,m),m=a.mul(w,b),d=a.mul(A,d),d=a.add(d,m),new y(u,f,d)}subtract(e){return this.add(e.negate())}is0(){return this.equals(y.ZERO)}wNAF(e){return w.wNAFCached(this,b,e,(e=>{const t=a.invertBatch(e.map((e=>e.pz)));return e.map(((e,r)=>e.toAffine(t[r]))).map(y.fromAffine)}))}multiplyUnsafe(e){const t=y.ZERO;if(e===s)return t;if(p(e),e===c)return this;const{endo:r}=o;if(!r)return w.unsafeLadder(this,e);let{k1neg:n,k1:i,k2neg:u,k2:l}=r.splitScalar(e),f=t,d=t,h=this;for(;i>s||l>s;)i&c&&(f=f.add(h)),l&c&&(d=d.add(h)),h=h.double(),i>>=c,l>>=c;return n&&(f=f.negate()),u&&(d=d.negate()),d=new y(a.mul(d.px,r.beta),d.py,d.pz),f.add(d)}multiply(e){p(e);let t,r,n=e;const{endo:i}=o;if(i){const{k1neg:e,k1:o,k2neg:s,k2:c}=i.splitScalar(n);let{p:u,f:l}=this.wNAF(o),{p:f,f:d}=this.wNAF(c);u=w.constTimeNegate(e,u),f=w.constTimeNegate(s,f),f=new y(a.mul(f.px,i.beta),f.py,f.pz),t=u.add(f),r=l.add(d)}else{const{p:e,f:i}=this.wNAF(n);t=e,r=i}return y.normalizeZ([t,r])[0]}multiplyAndAddUnsafe(e,t,r){const n=y.BASE,i=(e,t)=>t!==s&&t!==c&&e.equals(n)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,r));return o.is0()?void 0:o}toAffine(e){const{px:t,py:r,pz:n}=this,i=this.is0();null==e&&(e=i?a.ONE:a.inv(n));const o=a.mul(t,e),s=a.mul(r,e),c=a.mul(n,e);if(i)return{x:a.ZERO,y:a.ZERO};if(!a.eql(c,a.ONE))throw new Error("invZ was invalid");return{x:o,y:s}}isTorsionFree(){const{h:e,isTorsionFree:t}=o;if(e===c)return!0;if(t)return t(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:t}=o;return e===c?this:t?t(y,this):this.multiplyUnsafe(o.h)}toRawBytes(e=!0){return this.assertValidity(),u(y,this,e)}toHex(e=!0){return n.bytesToHex(this.toRawBytes(e))}}y.BASE=new y(o.Gx,o.Gy,a.ONE),y.ZERO=new y(a.ZERO,a.ONE,a.ZERO);const v=o.nBitLength,w=(0,t.wNAF)(y,o.endo?Math.ceil(v/2):v);return{CURVE:o,ProjectivePoint:y,normPrivateKeyToScalar:m,weierstrassEquation:d,isWithinCurveOrder:h}}function h(e,t){const r=e.ORDER;let n=s;for(let e=r-c;e%u===s;e/=u)n+=c;const i=n,o=u<{let n=b,o=e.pow(r,p),a=e.sqr(o);a=e.mul(a,r);let s=e.mul(t,a);s=e.pow(s,h),s=e.mul(s,o),o=e.mul(s,r),a=e.mul(s,t);let l=e.mul(a,o);s=e.pow(l,m);let f=e.eql(s,e.ONE);o=e.mul(a,g),s=e.mul(l,n),a=e.cmov(o,a,f),l=e.cmov(s,l,f);for(let t=i;t>c;t--){let r=t-u;r=u<{let o=e.sqr(i);const a=e.mul(t,i);o=e.mul(o,a);let s=e.pow(o,r);s=e.mul(s,a);const c=e.mul(s,n),u=e.mul(e.sqr(s),i),l=e.eql(u,t);return{isValid:l,value:e.cmov(c,s,l)}}}return y}}(q4),Object.defineProperty(H4,"__esModule",{value:!0}),H4.getHash=j9,H4.createCurve=function(e,t){const r=t=>(0,L9.weierstrass)({...e,...j9(t)});return Object.freeze({...r(t),create:r})}; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const R9=G4,F9=C4,L9=q4;function j9(e){return{hash:e,hmac:(t,...r)=>(0,R9.hmac)(e,t,(0,F9.concatBytes)(...r)),randomBytes:F9.randomBytes}}var U9={};Object.defineProperty(U9,"__esModule",{value:!0}),U9.expand_message_xmd=K9,U9.expand_message_xof=V9,U9.hash_to_field=W9,U9.isogenyMap=function(e,t){const r=t.map((e=>Array.from(e).reverse()));return(t,n)=>{const[i,o,a,s]=r.map((r=>r.reduce(((r,n)=>e.add(e.mul(r,t),n)))));return t=e.div(i,o),n=e.mul(n,e.div(a,s)),{x:t,y:n}}},U9.createHasher=function(e,t,r){if("function"!=typeof t)throw new Error("mapToCurve() must be defined");return{hashToCurve(n,i){const o=W9(n,2,{...r,DST:r.DST,...i}),a=e.fromAffine(t(o[0])),s=e.fromAffine(t(o[1])),c=a.add(s).clearCofactor();return c.assertValidity(),c},encodeToCurve(n,i){const o=W9(n,1,{...r,DST:r.encodeDST,...i}),a=e.fromAffine(t(o[0])).clearCofactor();return a.assertValidity(),a},mapToCurve(r){if(!Array.isArray(r))throw new Error("mapToCurve: expected array of bigints");for(const e of r)if("bigint"!=typeof e)throw new Error(`mapToCurve: expected array of bigints, got ${e} in array`);const n=e.fromAffine(t(r)).clearCofactor();return n.assertValidity(),n}}};const D9=V4,z9=W4,$9=z9.bytesToNumberBE;function H9(e,t){if(e<0||e>=1<<8*t)throw new Error(`bad I2OSP call: value=${e} length=${t}`);const r=Array.from({length:t}).fill(0);for(let n=t-1;n>=0;n--)r[n]=255&e,e>>>=8;return new Uint8Array(r)}function G9(e,t){const r=new Uint8Array(e.length);for(let n=0;n255&&(t=n((0,z9.concatBytes)((0,z9.utf8ToBytes)("H2C-OVERSIZE-DST-"),t)));const{outputLen:i,blockLen:o}=n,a=Math.ceil(r/i);if(a>255)throw new Error("Invalid xmd length");const s=(0,z9.concatBytes)(t,H9(t.length,1)),c=H9(0,o),u=H9(r,2),l=new Array(a),f=n((0,z9.concatBytes)(c,e,u,H9(0,1),s));l[0]=n((0,z9.concatBytes)(f,H9(1,1),s));for(let e=1;e<=a;e++){const t=[G9(f,l[e-1]),H9(e+1,1),s];l[e]=n((0,z9.concatBytes)(...t))}return(0,z9.concatBytes)(...l).slice(0,r)}function V9(e,t,r,n,i){if((0,z9.abytes)(e),(0,z9.abytes)(t),q9(r),t.length>255){const e=Math.ceil(2*n/8);t=i.create({dkLen:e}).update((0,z9.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(t).digest()}if(r>65535||t.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:r}).update(e).update(H9(r,2)).update(t).update(H9(t.length,1)).digest()}function W9(e,t,r){(0,z9.validateObject)(r,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:n,k:i,m:o,hash:a,expand:s,DST:c}=r;(0,z9.abytes)(e),q9(t);const u="string"==typeof c?(0,z9.utf8ToBytes)(c):c,l=n.toString(2).length,f=Math.ceil((l+i)/8),d=t*o*f;let h;if("xmd"===s)h=K9(e,u,d,a);else if("xof"===s)h=V9(e,u,d,i,a);else{if("_internal_pass"!==s)throw new Error('expand must be "xmd" or "xof"');h=e}const p=new Array(t);for(let e=0;e(e+t/f)/t;function h(e){const t=c,r=BigInt(3),n=BigInt(6),i=BigInt(11),a=BigInt(22),s=BigInt(23),u=BigInt(44),l=BigInt(88),d=e*e*e%t,h=d*d*e%t,m=(0,o.pow2)(h,r,t)*h%t,b=(0,o.pow2)(m,r,t)*h%t,g=(0,o.pow2)(b,f,t)*d%t,y=(0,o.pow2)(g,i,t)*g%t,v=(0,o.pow2)(y,a,t)*y%t,w=(0,o.pow2)(v,u,t)*v%t,E=(0,o.pow2)(w,l,t)*w%t,A=(0,o.pow2)(E,u,t)*v%t,x=(0,o.pow2)(A,r,t)*h%t,_=(0,o.pow2)(x,s,t)*y%t,k=(0,o.pow2)(_,n,t)*d%t,S=(0,o.pow2)(k,f,t);if(!p.eql(p.sqr(S),e))throw new Error("Cannot find square root");return S}const p=(0,o.Field)(c,void 0,void 0,{sqrt:h});e.secp256k1=(0,n.createCurve)({a:BigInt(0),b:BigInt(7),Fp:p,n:u,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=u,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-l*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=r,s=BigInt("0x100000000000000000000000000000000"),c=d(a*e,t),f=d(-n*e,t);let h=(0,o.mod)(e-c*r-f*i,t),p=(0,o.mod)(-c*n-f*a,t);const m=h>s,b=p>s;if(m&&(h=t-h),b&&(p=t-p),h>s||p>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:m,k1:h,k2neg:b,k2:p}}}},t.sha256);const m=BigInt(0),b=e=>"bigint"==typeof e&&m"bigint"==typeof e&&me.charCodeAt(0))));n=(0,a.concatBytes)(r,r),y[e]=n}return(0,t.sha256)((0,a.concatBytes)(n,...r))}const w=e=>e.toRawBytes(!0).slice(1),E=e=>(0,a.numberToBytesBE)(e,32),A=e=>(0,o.mod)(e,c),x=e=>(0,o.mod)(e,u),_=e.secp256k1.ProjectivePoint,k=(e,t,r)=>_.BASE.multiplyAndAddUnsafe(e,t,r);function S(t){let r=e.secp256k1.utils.normPrivateKeyToScalar(t),n=_.fromPrivateKey(r);return{scalar:n.hasEvenY()?r:x(-r),bytes:w(n)}}function P(e){if(!b(e))throw new Error("bad x: need 0 < x < p");const t=A(e*e);let r=h(A(t*e+BigInt(7)));r%f!==m&&(r=A(-r));const n=new _(e,r,l);return n.assertValidity(),n}function I(...e){return x((0,a.bytesToNumberBE)(v("BIP0340/challenge",...e)))}function T(e){return S(e).bytes}function O(e,t,n=(0,r.randomBytes)(32)){const i=(0,a.ensureBytes)("message",e),{bytes:o,scalar:s}=S(t),c=(0,a.ensureBytes)("auxRand",n,32),u=E(s^(0,a.bytesToNumberBE)(v("BIP0340/aux",c))),l=v("BIP0340/nonce",u,o,i),f=x((0,a.bytesToNumberBE)(l));if(f===m)throw new Error("sign failed: k is zero");const{bytes:d,scalar:h}=S(f),p=I(d,o,i),b=new Uint8Array(64);if(b.set(d,0),b.set(E(x(h+p*s)),32),!M(b,i,o))throw new Error("sign: Invalid signature produced");return b}function M(e,t,r){const n=(0,a.ensureBytes)("signature",e,64),i=(0,a.ensureBytes)("message",t),o=(0,a.ensureBytes)("publicKey",r,32);try{const e=P((0,a.bytesToNumberBE)(o)),t=(0,a.bytesToNumberBE)(n.subarray(0,32));if(!b(t))return!1;const r=(0,a.bytesToNumberBE)(n.subarray(32,64));if(!g(r))return!1;const s=I(E(t),w(e),i),c=k(e,r,x(-s));return!(!c||!c.hasEvenY()||c.toAffine().x!==t)}catch(e){return!1}}e.schnorr={getPublicKey:T,sign:O,verify:M,utils:{randomPrivateKey:e.secp256k1.utils.randomPrivateKey,lift_x:P,pointToBytes:w,numberToBytesBE:a.numberToBytesBE,bytesToNumberBE:a.bytesToNumberBE,taggedHash:v,mod:o.mod}};const C=(()=>(0,i.isogenyMap)(p,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map((e=>e.map((e=>BigInt(e)))))))(),B=(()=>(0,s.mapToCurveSimpleSWU)(p,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:p.create(BigInt("-11"))}))(),N=(()=>(0,i.createHasher)(e.secp256k1.ProjectivePoint,(e=>{const{x:t,y:r}=B(p.create(e[0]));return C(t,r)}),{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:p.ORDER,m:1,k:128,expand:"xmd",hash:t.sha256}))();e.hashToCurve=N.hashToCurve,e.encodeToCurve=N.encodeToCurve}(w4),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.secp256k1=void 0;var t=w4;Object.defineProperty(e,"secp256k1",{enumerable:!0,get:function(){return t.secp256k1}})}(v4),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MAX_WITHDRAWALS_PER_PAYLOAD=e.RLP_EMPTY_STRING=e.KECCAK256_RLP=e.KECCAK256_RLP_S=e.KECCAK256_RLP_ARRAY=e.KECCAK256_RLP_ARRAY_S=e.KECCAK256_NULL=e.KECCAK256_NULL_S=e.TWO_POW256=e.SECP256K1_ORDER_DIV_2=e.SECP256K1_ORDER=e.MAX_INTEGER_BIGINT=e.MAX_INTEGER=e.MAX_UINT64=void 0;const t=fe,r=v4;e.MAX_UINT64=BigInt("0xffffffffffffffff"),e.MAX_INTEGER=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),e.MAX_INTEGER_BIGINT=BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),e.SECP256K1_ORDER=r.secp256k1.CURVE.n,e.SECP256K1_ORDER_DIV_2=r.secp256k1.CURVE.n/BigInt(2),e.TWO_POW256=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),e.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",e.KECCAK256_NULL=t.Buffer.from(e.KECCAK256_NULL_S,"hex"),e.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",e.KECCAK256_RLP_ARRAY=t.Buffer.from(e.KECCAK256_RLP_ARRAY_S,"hex"),e.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",e.KECCAK256_RLP=t.Buffer.from(e.KECCAK256_RLP_S,"hex"),e.RLP_EMPTY_STRING=t.Buffer.from([128]),e.MAX_WITHDRAWALS_PER_PAYLOAD=16}(y4);var J9={};Object.defineProperty(J9,"__esModule",{value:!0}),J9.GWEI_TO_WEI=void 0,J9.GWEI_TO_WEI=BigInt(1e9);var Z9={},Y9={};function X9(e){if(Array.isArray(e)){const t=[];let r=0;for(let n=0;ne.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return e.slice(t,r)}function e7(e){if(0===e[0])throw new Error("invalid RLP: extra zeros");return a7(o7(e))}function t7(e,t){if(e<56)return Uint8Array.from([e+t]);const r=l7(e),n=l7(t+55+r.length/2);return Uint8Array.from(s7(n+r))}function r7(e,t=!1){if(null==e||0===e.length)return Uint8Array.from([]);const r=n7(d7(e));if(t)return r;if(0!==r.remainder.length)throw new Error("invalid RLP: remainder must be zero");return r.data}function n7(e){let t,r,n,i,o;const a=[],s=e[0];if(s<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(s<=183){if(t=s-127,n=128===s?Uint8Array.from([]):Q9(e,1,t),2===t&&n[0]<128)throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed");return{data:n,remainder:e.slice(t)}}if(s<=191){if(r=s-182,e.length-1e.length)throw new Error("invalid RLP: total length is larger than the data");for(i=Q9(e,r,n);i.length;)o=n7(i),a.push(o.data),i=o.remainder;return{data:a,remainder:e.slice(n)}}}Object.defineProperty(Y9,"__esModule",{value:!0}),Y9.RLP=Y9.utils=Y9.decode=Y9.encode=void 0,Y9.encode=X9,Y9.decode=r7;const i7=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function o7(e){let t="";for(let r=0;re+t.length),0),r=new Uint8Array(t);for(let t=0,n=0;t=2&&"0"===e[0]&&"x"===e[1]}function d7(e){if(e instanceof Uint8Array)return e;if("string"==typeof e)return f7(e)?s7((t="string"!=typeof(r=e)?r:f7(r)?r.slice(2):r).length%2?`0${t}`:t):u7(e);var t,r;if("number"==typeof e||"bigint"==typeof e)return e?s7(l7(e)):Uint8Array.from([]);if(null==e)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof e)}Y9.utils={bytesToHex:o7,concatBytes:c7,hexToBytes:s7,utf8ToBytes:u7},Y9.RLP={encode:X9,decode:r7};var h7={},p7={},m7={};Object.defineProperty(m7,"__esModule",{value:!0}),m7.add5L=m7.add5H=m7.add4H=m7.add4L=m7.add3H=m7.add3L=m7.add=m7.rotlBL=m7.rotlBH=m7.rotlSL=m7.rotlSH=m7.rotr32L=m7.rotr32H=m7.rotrBL=m7.rotrBH=m7.rotrSL=m7.rotrSH=m7.shrSL=m7.shrSH=m7.toBig=m7.split=m7.fromBig=void 0;const b7=BigInt(2**32-1),g7=BigInt(32);function y7(e,t=!1){return t?{h:Number(e&b7),l:Number(e>>g7&b7)}:{h:0|Number(e>>g7&b7),l:0|Number(e&b7)}}function v7(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0);m7.toBig=w7;const E7=(e,t,r)=>e>>>r;m7.shrSH=E7;const A7=(e,t,r)=>e<<32-r|t>>>r;m7.shrSL=A7;const x7=(e,t,r)=>e>>>r|t<<32-r;m7.rotrSH=x7;const _7=(e,t,r)=>e<<32-r|t>>>r;m7.rotrSL=_7;const k7=(e,t,r)=>e<<64-r|t>>>r-32;m7.rotrBH=k7;const S7=(e,t,r)=>e>>>r-32|t<<64-r;m7.rotrBL=S7;const P7=(e,t)=>t;m7.rotr32H=P7;const I7=(e,t)=>e;m7.rotr32L=I7;const T7=(e,t,r)=>e<>>32-r;m7.rotlSH=T7;const O7=(e,t,r)=>t<>>32-r;m7.rotlSL=O7;const M7=(e,t,r)=>t<>>64-r;m7.rotlBH=M7;const C7=(e,t,r)=>e<>>64-r;function B7(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}}m7.rotlBL=C7,m7.add=B7;const N7=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);m7.add3L=N7;const R7=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;m7.add3H=R7;const F7=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);m7.add4L=F7;const L7=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;m7.add4H=L7;const j7=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);m7.add5L=j7;const U7=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0;m7.add5H=U7;const D7={fromBig:y7,split:v7,toBig:w7,shrSH:E7,shrSL:A7,rotrSH:x7,rotrSL:_7,rotrBH:k7,rotrBL:S7,rotr32H:P7,rotr32L:I7,rotlSH:T7,rotlSL:O7,rotlBH:M7,rotlBL:C7,add:B7,add3L:N7,add3H:R7,add4L:F7,add4H:L7,add5H:U7,add5L:j7};m7.default=D7,Object.defineProperty(p7,"__esModule",{value:!0}),p7.shake256=p7.shake128=p7.keccak_512=p7.keccak_384=p7.keccak_256=p7.keccak_224=p7.sha3_512=p7.sha3_384=p7.sha3_256=p7.sha3_224=p7.Keccak=p7.keccakP=void 0;const z7=x4,$7=m7,H7=C4,G7=[],q7=[],K7=[],V7=BigInt(0),W7=BigInt(1),J7=BigInt(2),Z7=BigInt(7),Y7=BigInt(256),X7=BigInt(113);for(let e=0,t=W7,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],G7.push(2*(5*n+r)),q7.push((e+1)*(e+2)/2%64);let i=V7;for(let e=0;e<7;e++)t=(t<>Z7)*X7)%Y7,t&J7&&(i^=W7<<(W7<r>32?(0,$7.rotlBH)(e,t,r):(0,$7.rotlSH)(e,t,r),ree=(e,t,r)=>r>32?(0,$7.rotlBL)(e,t,r):(0,$7.rotlSL)(e,t,r);function nee(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,o=r[i],a=r[i+1],s=tee(o,a,1)^r[n],c=ree(o,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=s,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=q7[r],o=tee(t,i,n),a=ree(t,i,n),s=G7[r];t=e[s],i=e[s+1],e[s]=o,e[s+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=Q7[n],e[1]^=eee[n]}r.fill(0)}p7.keccakP=nee;class iee extends H7.Hash{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,z7.number)(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,H7.u32)(this.state)}keccak(){H7.isLE||(0,H7.byteSwap32)(this.state32),nee(this.state32,this.rounds),H7.isLE||(0,H7.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(e){(0,z7.exists)(this);const{blockLen:t,state:r}=this,n=(e=(0,H7.toBytes)(e)).length;for(let i=0;i=r&&this.keccak();const o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,z7.number)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,z7.output)(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:o}=this;return e||(e=new iee(t,r,n,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=o,e.destroyed=this.destroyed,e}}p7.Keccak=iee;const oee=(e,t,r)=>(0,H7.wrapConstructor)((()=>new iee(t,e,r)));p7.sha3_224=oee(6,144,28),p7.sha3_256=oee(6,136,32),p7.sha3_384=oee(6,104,48),p7.sha3_512=oee(6,72,64),p7.keccak_224=oee(1,144,28),p7.keccak_256=oee(1,136,32),p7.keccak_384=oee(1,104,48),p7.keccak_512=oee(1,72,64);const aee=(e,t,r)=>(0,H7.wrapXOFConstructorWithOpts)(((n={})=>new iee(t,e,void 0===n.dkLen?r:n.dkLen,!0)));p7.shake128=aee(31,168,16),p7.shake256=aee(31,136,32);var see={exports:{}};!function(e,t){var r=o&&o.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=t.utf8ToBytes=t.createView=t.concatBytes=t.toHex=t.bytesToHex=t.assertBytes=t.assertBool=void 0,t.bytesToUtf8=function(e){if(!(e instanceof Uint8Array))throw new TypeError("bytesToUtf8 expected Uint8Array, got "+typeof e);return(new TextDecoder).decode(e)},t.hexToBytes=function(e){const t=e.startsWith("0x")?e.substring(2):e;return(0,i.hexToBytes)(t)},t.equalsBytes=function(e,t){if(e.length!==t.length)return!1;for(let r=0;r(n.default.bytes(t),e(t))};const n=r(x4),i=C4,a=n.default.bool;t.assertBool=a;const s=n.default.bytes;t.assertBytes=s;var c=C4;Object.defineProperty(t,"bytesToHex",{enumerable:!0,get:function(){return c.bytesToHex}}),Object.defineProperty(t,"toHex",{enumerable:!0,get:function(){return c.bytesToHex}}),Object.defineProperty(t,"concatBytes",{enumerable:!0,get:function(){return c.concatBytes}}),Object.defineProperty(t,"createView",{enumerable:!0,get:function(){return c.createView}}),Object.defineProperty(t,"utf8ToBytes",{enumerable:!0,get:function(){return c.utf8ToBytes}}),t.crypto=(()=>{const t="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,r=tW.bind(e);return{node:r&&!t?r("crypto"):void 0,web:t}})()}(see,see.exports);var cee=see.exports;Object.defineProperty(h7,"__esModule",{value:!0}),h7.keccak512=h7.keccak384=h7.keccak256=h7.keccak224=void 0;const uee=p7,lee=cee;h7.keccak224=(0,lee.wrapHash)(uee.keccak_224),h7.keccak256=(()=>{const e=(0,lee.wrapHash)(uee.keccak_256);return e.create=uee.keccak_256.create,e})(),h7.keccak384=(0,lee.wrapHash)(uee.keccak_384),h7.keccak512=(0,lee.wrapHash)(uee.keccak_512);var fee={},dee={},hee={};function pee(e){if("string"!=typeof e)throw new Error("[isHexPrefixed] input must be type 'string', received type "+typeof e);return"0"===e[0]&&"x"===e[1]}Object.defineProperty(hee,"__esModule",{value:!0}),hee.isHexString=hee.getKeys=hee.fromAscii=hee.fromUtf8=hee.toAscii=hee.arrayContainsArray=hee.getBinarySize=hee.padToEven=hee.stripHexPrefix=hee.isHexPrefixed=void 0,hee.isHexPrefixed=pee;function mee(e){let t=e;if("string"!=typeof t)throw new Error("[padToEven] value must be type 'string', received "+typeof t);return t.length%2&&(t=`0${t}`),t}hee.stripHexPrefix=e=>{if("string"!=typeof e)throw new Error("[stripHexPrefix] input must be type 'string', received "+typeof e);return pee(e)?e.slice(2):e},hee.padToEven=mee,hee.getBinarySize=function(e){if("string"!=typeof e)throw new Error("[getBinarySize] method requires input type 'string', received "+typeof e);return _.byteLength(e,"utf8")},hee.arrayContainsArray=function(e,t,r){if(!0!==Array.isArray(e))throw new Error(`[arrayContainsArray] method requires input 'superset' to be an array, got type '${typeof e}'`);if(!0!==Array.isArray(t))throw new Error(`[arrayContainsArray] method requires input 'subset' to be an array, got type '${typeof t}'`);return t[!0===r?"some":"every"]((t=>e.indexOf(t)>=0))},hee.toAscii=function(e){let t="",r=0;const n=e.length;for("0x"===e.substring(0,2)&&(r=2);r0&&e.length!==2+2*t)},Object.defineProperty(dee,"__esModule",{value:!0}),dee.assertIsString=dee.assertIsArray=dee.assertIsBuffer=dee.assertIsHexString=void 0;const bee=hee;dee.assertIsHexString=function(e){if(!(0,bee.isHexString)(e)){throw new Error(`This method only supports 0x-prefixed hex strings but input was: ${e}`)}};dee.assertIsBuffer=function(e){if(!_.isBuffer(e)){throw new Error(`This method only supports Buffer but input was: ${e}`)}};dee.assertIsArray=function(e){if(!Array.isArray(e)){throw new Error(`This method only supports number arrays but input was: ${e}`)}};dee.assertIsString=function(e){if("string"!=typeof e){throw new Error(`This method only supports strings but input was: ${e}`)}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.intToUnpaddedBuffer=e.bigIntToUnpaddedBuffer=e.bigIntToHex=e.bufArrToArr=e.arrToBufArr=e.validateNoLeadingZeroes=e.baToJSON=e.toUtf8=e.short=e.addHexPrefix=e.toUnsigned=e.fromSigned=e.bufferToInt=e.bigIntToBuffer=e.bufferToBigInt=e.bufferToHex=e.toBuffer=e.unpadHexString=e.unpadArray=e.unpadBuffer=e.setLengthRight=e.setLengthLeft=e.zeros=e.intToBuffer=e.intToHex=void 0;const t=dee,r=hee;e.intToHex=function(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Received an invalid integer type: ${e}`);return`0x${e.toString(16)}`};e.intToBuffer=function(t){const n=(0,e.intToHex)(t);return _.from((0,r.padToEven)(n.slice(2)),"hex")};e.zeros=function(e){return _.allocUnsafe(e).fill(0)};const n=function(t,r,n){const i=(0,e.zeros)(r);return n?t.length0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};e.unpadBuffer=function(e){return(0,t.assertIsBuffer)(e),i(e)};e.unpadArray=function(e){return(0,t.assertIsArray)(e),i(e)};e.unpadHexString=function(e){return(0,t.assertIsHexString)(e),e=(0,r.stripHexPrefix)(e),"0x"+i(e)};e.toBuffer=function(t){if(null==t)return _.allocUnsafe(0);if(_.isBuffer(t))return _.from(t);if(Array.isArray(t)||t instanceof Uint8Array)return _.from(t);if("string"==typeof t){if(!(0,r.isHexString)(t))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${t}`);return _.from((0,r.padToEven)((0,r.stripHexPrefix)(t)),"hex")}if("number"==typeof t)return(0,e.intToBuffer)(t);if("bigint"==typeof t){if(t0&&0===r[0])throw new Error(`${t} cannot have leading zeroes, received: ${r.toString("hex")}`)},e.arrToBufArr=function e(t){return Array.isArray(t)?t.map((t=>e(t))):_.from(t)},e.bufArrToArr=function e(t){return Array.isArray(t)?t.map((t=>e(t))):Uint8Array.from(t??[])};e.bigIntToHex=e=>"0x"+e.toString(16),e.bigIntToUnpaddedBuffer=function(t){return(0,e.unpadBuffer)(a(t))},e.intToUnpaddedBuffer=function(t){return(0,e.unpadBuffer)((0,e.intToBuffer)(t))}}(fee),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.accountBodyToRLP=e.accountBodyToSlim=e.accountBodyFromSlim=e.isZeroAddress=e.zeroAddress=e.importPublic=e.privateToAddress=e.privateToPublic=e.publicToAddress=e.pubToAddress=e.isValidPublic=e.isValidPrivate=e.generateAddress2=e.generateAddress=e.isValidChecksumAddress=e.toChecksumAddress=e.isValidAddress=e.Account=void 0;const t=Y9,r=h7,n=v4,i=cee,o=fee,a=y4,s=dee,c=hee,u=BigInt(0);class l{constructor(e=u,t=u,r=a.KECCAK256_RLP,n=a.KECCAK256_NULL){this.nonce=e,this.balance=t,this.storageRoot=r,this.codeHash=n,this._validate()}static fromAccountData(e){const{nonce:t,balance:r,storageRoot:n,codeHash:i}=e;return new l(void 0!==t?(0,o.bufferToBigInt)((0,o.toBuffer)(t)):void 0,void 0!==r?(0,o.bufferToBigInt)((0,o.toBuffer)(r)):void 0,void 0!==n?(0,o.toBuffer)(n):void 0,void 0!==i?(0,o.toBuffer)(i):void 0)}static fromRlpSerializedAccount(e){const r=(0,o.arrToBufArr)(t.RLP.decode(Uint8Array.from(e)));if(!Array.isArray(r))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(r)}static fromValuesArray(e){const[t,r,n,i]=e;return new l((0,o.bufferToBigInt)(t),(0,o.bufferToBigInt)(r),n,i)}_validate(){if(this.nonce=8?f+=n[e].toUpperCase():f+=n[e];return f};e.isValidChecksumAddress=function(t,r){return(0,e.isValidAddress)(t)&&(0,e.toChecksumAddress)(t,r)===t};e.generateAddress=function(e,n){return(0,s.assertIsBuffer)(e),(0,s.assertIsBuffer)(n),(0,o.bufferToBigInt)(n)===BigInt(0)?_.from((0,r.keccak256)(t.RLP.encode((0,o.bufArrToArr)([e,null])))).slice(-20):_.from((0,r.keccak256)(t.RLP.encode((0,o.bufArrToArr)([e,n])))).slice(-20)};e.generateAddress2=function(e,t,n){if((0,s.assertIsBuffer)(e),(0,s.assertIsBuffer)(t),(0,s.assertIsBuffer)(n),20!==e.length)throw new Error("Expected from to be of length 20");if(32!==t.length)throw new Error("Expected salt to be of length 32");const i=(0,r.keccak256)(_.concat([_.from("ff","hex"),e,t,(0,r.keccak256)(n)]));return(0,o.toBuffer)(i).slice(-20)};e.isValidPrivate=function(e){return n.secp256k1.utils.isValidPrivateKey(e)};e.isValidPublic=function(e,t=!1){if((0,s.assertIsBuffer)(e),64===e.length)try{return n.secp256k1.ProjectivePoint.fromHex(_.concat([_.from([4]),e])),!0}catch(e){return!1}if(!t)return!1;try{return n.secp256k1.ProjectivePoint.fromHex(e),!0}catch(e){return!1}};e.pubToAddress=function(e,t=!1){if((0,s.assertIsBuffer)(e),t&&64!==e.length&&(e=_.from(n.secp256k1.ProjectivePoint.fromHex(e).toRawBytes(!1).slice(1))),64!==e.length)throw new Error("Expected pubKey to be of length 64");return _.from((0,r.keccak256)(e)).slice(-20)},e.publicToAddress=e.pubToAddress;e.privateToPublic=function(e){return(0,s.assertIsBuffer)(e),_.from(n.secp256k1.ProjectivePoint.fromPrivateKey(e).toRawBytes(!1).slice(1))};e.privateToAddress=function(t){return(0,e.publicToAddress)((0,e.privateToPublic)(t))};e.importPublic=function(e){return(0,s.assertIsBuffer)(e),64!==e.length&&(e=_.from(n.secp256k1.ProjectivePoint.fromHex(e).toRawBytes(!1).slice(1))),e};e.zeroAddress=function(){const e=(0,o.zeros)(20);return(0,o.bufferToHex)(e)};function f(e){const[t,r,n,i]=e;return[t,r,0===(0,o.arrToBufArr)(n).length?a.KECCAK256_RLP:n,0===(0,o.arrToBufArr)(i).length?a.KECCAK256_NULL:i]}e.isZeroAddress=function(t){try{(0,s.assertIsString)(t)}catch(e){return!1}return(0,e.zeroAddress)()===t},e.accountBodyFromSlim=f;const d=new Uint8Array(0);e.accountBodyToSlim=function(e){const[t,r,n,i]=e;return[t,r,(0,o.arrToBufArr)(n).equals(a.KECCAK256_RLP)?d:n,(0,o.arrToBufArr)(i).equals(a.KECCAK256_NULL)?d:i]},e.accountBodyToRLP=function(e,r=!0){const n=r?f(e):e;return(0,o.arrToBufArr)(t.RLP.encode(n))}}(Z9);var gee={};Object.defineProperty(gee,"__esModule",{value:!0}),gee.Address=void 0;const yee=Z9,vee=fee;class wee{constructor(e){if(20!==e.length)throw new Error("Invalid address length");this.buf=e}static zero(){return new wee((0,vee.zeros)(20))}static fromString(e){if(!(0,yee.isValidAddress)(e))throw new Error("Invalid address");return new wee((0,vee.toBuffer)(e))}static fromPublicKey(e){if(!_.isBuffer(e))throw new Error("Public key should be Buffer");const t=(0,yee.pubToAddress)(e);return new wee(t)}static fromPrivateKey(e){if(!_.isBuffer(e))throw new Error("Private key should be Buffer");const t=(0,yee.privateToAddress)(e);return new wee(t)}static generate(e,t){if("bigint"!=typeof t)throw new Error("Expected nonce to be a bigint");return new wee((0,yee.generateAddress)(e.buf,(0,vee.bigIntToBuffer)(t)))}static generate2(e,t,r){if(!_.isBuffer(t))throw new Error("Expected salt to be a Buffer");if(!_.isBuffer(r))throw new Error("Expected initCode to be a Buffer");return new wee((0,yee.generateAddress2)(e.buf,t,r))}equals(e){return this.buf.equals(e.buf)}isZero(){return this.equals(wee.zero())}isPrecompileOrSystemAddress(){const e=(0,vee.bufferToBigInt)(this.buf),t=BigInt(0),r=BigInt("0xffff");return e>=t&&e<=r}toString(){return"0x"+this.buf.toString("hex")}toBuffer(){return _.from(this.buf)}}gee.Address=wee;var Eee={},Aee={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.toType=e.TypeOutput=void 0;const t=fee,r=hee;var n;!function(e){e[e.Number=0]="Number",e[e.BigInt=1]="BigInt",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(n=e.TypeOutput||(e.TypeOutput={})),e.toType=function(e,i){if(null===e)return null;if(void 0===e)return;if("string"==typeof e&&!(0,r.isHexString)(e))throw new Error(`A string must be provided with a 0x-prefix, given: ${e}`);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");const o=(0,t.toBuffer)(e);switch(i){case n.Buffer:return o;case n.BigInt:return(0,t.bufferToBigInt)(o);case n.Number:{const e=(0,t.bufferToBigInt)(o);if(e>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(e)}case n.PrefixedHexString:return(0,t.bufferToHex)(o);default:throw new Error("unknown outputType")}}}(Aee),Object.defineProperty(Eee,"__esModule",{value:!0}),Eee.Withdrawal=void 0;const xee=gee,_ee=fee,kee=Aee;class See{constructor(e,t,r,n){this.index=e,this.validatorIndex=t,this.address=r,this.amount=n}static fromWithdrawalData(e){const{index:t,validatorIndex:r,address:n,amount:i}=e,o=(0,kee.toType)(t,kee.TypeOutput.BigInt),a=(0,kee.toType)(r,kee.TypeOutput.BigInt),s=new xee.Address((0,kee.toType)(n,kee.TypeOutput.Buffer)),c=(0,kee.toType)(i,kee.TypeOutput.BigInt);return new See(o,a,s,c)}static fromValuesArray(e){if(4!==e.length)throw Error(`Invalid withdrawalArray length expected=4 actual=${e.length}`);const[t,r,n,i]=e;return See.fromWithdrawalData({index:t,validatorIndex:r,address:n,amount:i})}static toBufferArray(e){const{index:t,validatorIndex:r,address:n,amount:i}=e,o=(0,kee.toType)(t,kee.TypeOutput.BigInt)===BigInt(0)?_.alloc(0):(0,kee.toType)(t,kee.TypeOutput.Buffer),a=(0,kee.toType)(r,kee.TypeOutput.BigInt)===BigInt(0)?_.alloc(0):(0,kee.toType)(r,kee.TypeOutput.Buffer);let s;s=n instanceof xee.Address?n.buf:(0,kee.toType)(n,kee.TypeOutput.Buffer);return[o,a,s,(0,kee.toType)(i,kee.TypeOutput.BigInt)===BigInt(0)?_.alloc(0):(0,kee.toType)(i,kee.TypeOutput.Buffer)]}raw(){return See.toBufferArray(this)}toValue(){return{index:this.index,validatorIndex:this.validatorIndex,address:this.address.buf,amount:this.amount}}toJSON(){return{index:(0,_ee.bigIntToHex)(this.index),validatorIndex:(0,_ee.bigIntToHex)(this.validatorIndex),address:"0x"+this.address.buf.toString("hex"),amount:(0,_ee.bigIntToHex)(this.amount)}}}Eee.Withdrawal=See;var Pee={};Object.defineProperty(Pee,"__esModule",{value:!0}),Pee.hashPersonalMessage=Pee.isValidSignature=Pee.fromRpcSig=Pee.toCompactSig=Pee.toRpcSig=Pee.ecrecover=Pee.ecsign=void 0;const Iee=h7,Tee=v4,Oee=fee,Mee=y4,Cee=dee;function Bee(e,t){return e===BigInt(0)||e===BigInt(1)?e:void 0===t?e-BigInt(27):e-(t*BigInt(2)+BigInt(35))}function Nee(e){return e===BigInt(0)||e===BigInt(1)}Pee.ecsign=function(e,t,r){const n=Tee.secp256k1.sign(e,t),i=n.toCompactRawBytes();return{r:_.from(i.slice(0,32)),s:_.from(i.slice(32,64)),v:void 0===r?BigInt(n.recovery+27):BigInt(n.recovery+35)+BigInt(r)*BigInt(2)}};Pee.ecrecover=function(e,t,r,n,i){const o=_.concat([(0,Oee.setLengthLeft)(r,32),(0,Oee.setLengthLeft)(n,32)],64),a=Bee(t,i);if(!Nee(a))throw new Error("Invalid signature v value");const s=Tee.secp256k1.Signature.fromCompact(o).addRecoveryBit(Number(a)).recoverPublicKey(e);return _.from(s.toRawBytes(!1).slice(1))};Pee.toRpcSig=function(e,t,r,n){if(!Nee(Bee(e,n)))throw new Error("Invalid signature v value");return(0,Oee.bufferToHex)(_.concat([(0,Oee.setLengthLeft)(t,32),(0,Oee.setLengthLeft)(r,32),(0,Oee.toBuffer)(e)]))};Pee.toCompactSig=function(e,t,r,n){if(!Nee(Bee(e,n)))throw new Error("Invalid signature v value");let i=r;return(e>BigInt(28)&&e%BigInt(2)===BigInt(1)||e===BigInt(1)||e===BigInt(28))&&(i=_.from(r),i[0]|=128),(0,Oee.bufferToHex)(_.concat([(0,Oee.setLengthLeft)(t,32),(0,Oee.setLengthLeft)(i,32)]))};Pee.fromRpcSig=function(e){const t=(0,Oee.toBuffer)(e);let r,n,i;if(t.length>=65)r=t.slice(0,32),n=t.slice(32,64),i=(0,Oee.bufferToBigInt)(t.slice(64));else{if(64!==t.length)throw new Error("Invalid signature length");r=t.slice(0,32),n=t.slice(32,64),i=BigInt((0,Oee.bufferToInt)(t.slice(32,33))>>7),n[0]&=127}return i<27&&(i+=BigInt(27)),{v:i,r:r,s:n}};Pee.isValidSignature=function(e,t,r,n=!0,i){if(32!==t.length||32!==r.length)return!1;if(!Nee(Bee(e,i)))return!1;const o=(0,Oee.bufferToBigInt)(t),a=(0,Oee.bufferToBigInt)(r);return!(o===BigInt(0)||o>=Mee.SECP256K1_ORDER||a===BigInt(0)||a>=Mee.SECP256K1_ORDER)&&!(n&&a>=Mee.SECP256K1_ORDER_DIV_2)};Pee.hashPersonalMessage=function(e){(0,Cee.assertIsBuffer)(e);const t=_.from(`Ethereum Signed Message:\n${e.length}`,"utf-8");return _.from((0,Iee.keccak256)(_.concat([t,e])))};var Ree={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.compactBytesToNibbles=e.bytesToNibbles=e.nibblesToCompactBytes=e.nibblesToBytes=e.hasTerminator=void 0;e.hasTerminator=e=>e.length>0&&16===e[e.length-1];e.nibblesToBytes=(e,t)=>{for(let r=0,n=0;n{let r=0;(0,e.hasTerminator)(t)&&(r=1,t=t.subarray(0,t.length-1));const n=new Uint8Array(t.length/2+1);return n[0]=r<<5,1&~t.length||(n[0]|=16,n[0]|=t[0],t=t.subarray(1)),(0,e.nibblesToBytes)(t,n.subarray(1)),n};e.bytesToNibbles=e=>{const t=2*e.length+1,r=new Uint8Array(t);for(let t=0;t{if(0===t.length)return t;let r=(0,e.bytesToNibbles)(t);r[0]<2&&(r=r.subarray(0,r.length-1));const n=2-(1&r[0]);return r.subarray(n)}}(Ree);var Fee={};Object.defineProperty(Fee,"__esModule",{value:!0}),Fee.AsyncEventEmitter=void 0;const Lee=xe;class jee extends Lee.EventEmitter{emit(e,...t){let[r,n]=t;const i=this;let o=i._events[e]??[];return void 0===n&&"function"==typeof r&&(n=r,r=void 0),"newListener"!==e&&"removeListener"!==e||(r={event:r,fn:n},n=void 0),o=Array.isArray(o)?o:[o],async function(e,t,r){let n;for await(const i of t)try{i.length<2?i.call(e,r):await new Promise(((t,n)=>{i.call(e,r,(e=>{e?n(e):t()}))}))}catch(e){n=e}if(n)throw n}(i,o.slice(),r).then(n).catch(n),i.listenerCount(e)>0}once(e,t){const r=this;let n;if("function"!=typeof t)throw new TypeError("listener must be a function");return n=t.length>=2?function(i,o){r.removeListener(e,n),t(i,o)}:function(i){r.removeListener(e,n),t(i,n)},r.on(e,n),r}first(e,t){let r=this._events[e]??[];if("function"!=typeof t)throw new TypeError("listener must be a function");return Array.isArray(r)||(this._events[e]=r=[r]),r.unshift(t),this}before(e,t,r){return this.beforeOrAfter(e,t,r)}after(e,t,r){return this.beforeOrAfter(e,t,r,"after")}beforeOrAfter(e,t,r,n){let i,o,a=this._events[e]??[];const s="after"===n?1:0;if("function"!=typeof r)throw new TypeError("listener must be a function");if("function"!=typeof t)throw new TypeError("target must be a function");for(Array.isArray(a)||(this._events[e]=a=[a]),o=a.length,i=a.length;i--;)if(a[i]===t){o=i+s;break}return a.splice(o,0,r),this}on(e,t){return super.on(e,t)}addListener(e,t){return super.addListener(e,t)}prependListener(e,t){return super.prependListener(e,t)}prependOnceListener(e,t){return super.prependOnceListener(e,t)}removeAllListeners(e){return super.removeAllListeners(e)}removeListener(e,t){return super.removeListener(e,t)}eventNames(){return super.eventNames()}listeners(e){return super.listeners(e)}listenerCount(e){return super.listenerCount(e)}getMaxListeners(){return super.getMaxListeners()}setMaxListeners(e){return super.setMaxListeners(e)}}Fee.AsyncEventEmitter=jee;var Uee={};Object.defineProperty(Uee,"__esModule",{value:!0}),Uee.Lock=void 0;Uee.Lock=class{constructor(){this.permits=1,this.promiseResolverQueue=[]}async acquire(){return this.permits>0?(this.permits-=1,Promise.resolve(!0)):new Promise((e=>this.promiseResolverQueue.push(e)))}release(){if(this.permits+=1,this.permits>1&&this.promiseResolverQueue.length>0)console.warn("Lock.permits should never be > 0 when there is someone waiting.");else if(1===this.permits&&this.promiseResolverQueue.length>0){this.permits-=1;const e=this.promiseResolverQueue.shift();e&&e(!0)}}};var Dee,zee,$ee={},Hee={},Gee=ete(u.fetch)&&ete(u.ReadableStream);function qee(e){zee||(zee=new u.XMLHttpRequest).open("GET",u.location.host?"/":"https://example.com");try{return zee.responseType=e,zee.responseType===e}catch(e){return!1}}var Kee,Vee=void 0!==u.ArrayBuffer,Wee=Vee&&ete(u.ArrayBuffer.prototype.slice),Jee=Vee&&qee("arraybuffer"),Zee=!Gee&&Wee&&qee("ms-stream"),Yee=!Gee&&Vee&&qee("moz-chunked-arraybuffer"),Xee=ete(zee.overrideMimeType),Qee=ete(u.VBArray);function ete(e){return"function"==typeof e}zee=null,Kee="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e};var tte=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),a=n[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),mte(t)?r.showHidden=t:t&&Bte(r,t),Ete(r.showHidden)&&(r.showHidden=!1),Ete(r.depth)&&(r.depth=2),Ete(r.colors)&&(r.colors=!1),Ete(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=ute),fte(r,e,r.depth)}function ute(e,t){var r=cte.styles[t];return r?"["+cte.colors[r][0]+"m"+e+"["+cte.colors[r][1]+"m":e}function lte(e,t){return e}function fte(e,t,r){if(e.customInspect&&t&&Ste(t.inspect)&&t.inspect!==cte&&(!t.constructor||t.constructor.prototype!==t)){var n=t.inspect(r,e);return vte(n)||(n=fte(e,n,r)),n}var i=function(e,t){if(Ete(t))return e.stylize("undefined","undefined");if(vte(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(yte(t))return e.stylize(""+t,"number");if(mte(t))return e.stylize(""+t,"boolean");if(bte(t))return e.stylize("null","null")}(e,t);if(i)return i;var o=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),kte(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return dte(t);if(0===o.length){if(Ste(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(Ate(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(_te(t))return e.stylize(Date.prototype.toString.call(t),"date");if(kte(t))return dte(t)}var c,u="",l=!1,f=["{","}"];(pte(t)&&(l=!0,f=["[","]"]),Ste(t))&&(u=" [Function"+(t.name?": "+t.name:"")+"]");return Ate(t)&&(u=" "+RegExp.prototype.toString.call(t)),_te(t)&&(u=" "+Date.prototype.toUTCString.call(t)),kte(t)&&(u=" "+dte(t)),0!==o.length||l&&0!=t.length?r<0?Ate(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),c=l?function(e,t,r,n,i){for(var o=[],a=0,s=t.length;a60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(c,u,f)):f[0]+u+f[1]}function dte(e){return"["+Error.prototype.toString.call(e)+"]"}function hte(e,t,r,n,i,o){var a,s,c;if((c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(s=e.stylize("[Setter]","special")),Nte(n,i)||(a="["+i+"]"),s||(e.seen.indexOf(c.value)<0?(s=bte(r)?fte(e,c.value,null):fte(e,c.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),Ete(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function pte(e){return Array.isArray(e)}function mte(e){return"boolean"==typeof e}function bte(e){return null===e}function gte(e){return null==e}function yte(e){return"number"==typeof e}function vte(e){return"string"==typeof e}function wte(e){return"symbol"==typeof e}function Ete(e){return void 0===e}function Ate(e){return xte(e)&&"[object RegExp]"===Tte(e)}function xte(e){return"object"==typeof e&&null!==e}function _te(e){return xte(e)&&"[object Date]"===Tte(e)}function kte(e){return xte(e)&&("[object Error]"===Tte(e)||e instanceof Error)}function Ste(e){return"function"==typeof e}function Pte(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function Ite(e){return _.isBuffer(e)}function Tte(e){return Object.prototype.toString.call(e)}function Ote(e){return e<10?"0"+e.toString(10):e.toString(10)}cte.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},cte.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var Mte=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Cte(){console.log("%s - %s",function(){var e=new Date,t=[Ote(e.getHours()),Ote(e.getMinutes()),Ote(e.getSeconds())].join(":");return[e.getDate(),Mte[e.getMonth()],t].join(" ")}(),nte.apply(null,arguments))}function Bte(e,t){if(!t||!xte(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}function Nte(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Rte="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function Fte(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(Rte&&e[Rte]){var t;if("function"!=typeof(t=e[Rte]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,Rte,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise((function(e,n){t=e,r=n})),i=[],o=0;o0?this.tail.next=t:this.head=t,this.tail=t,++this.length},zte.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},zte.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},zte.prototype.clear=function(){this.head=this.tail=null,this.length=0},zte.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},zte.prototype.concat=function(e){if(0===this.length)return _.alloc(0);if(1===this.length)return this.head.data;for(var t=_.allocUnsafe(e>>>0),r=this.head,n=0;r;)r.data.copy(t,n),n+=r.data.length,r=r.next;return t},Gte.ReadableState=Hte;var $te=ste("stream");function Hte(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof yre&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var r=e.highWaterMark,n=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:n,this.highWaterMark=~~this.highWaterMark,this.buffer=new zte,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new di(e.encoding),this.encoding=e.encoding)}function Gte(e){if(!(this instanceof Gte))return new Gte(e);this._readableState=new Hte(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),ge.call(this)}function qte(e,t,r,n,i){var o=function(e,t){var r=null;_.isBuffer(t)||"string"==typeof t||null==t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));return r}(t,r);if(o)e.emit("error",o);else if(null===r)t.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,Wte(e)}(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var c;!t.decoder||i||n||(r=t.decoder.write(r),c=!t.objectMode&&0===r.length),i||(t.reading=!1),c||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&Wte(e))),function(e,t){t.readingMore||(t.readingMore=!0,zt(Zte,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=Kte?e=Kte:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function Wte(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||($te("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?zt(Jte,e):Jte(e))}function Jte(e){$te("emit readable"),e.emit("readable"),Qte(e)}function Zte(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;eo.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0===(e-=a)){a===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=_.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,a),0===(e-=a)){a===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function tre(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,zt(rre,t,e))}function rre(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function nre(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return $te("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?tre(this):Wte(this),null;if(0===(e=Vte(e,t))&&t.ended)return 0===t.length&&tre(this),null;var n,i=t.needReadable;return $te("need readable",i),(0===t.length||t.length-e0?ere(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&tre(this)),null!==n&&this.emit("data",n),n},Gte.prototype._read=function(e){this.emit("error",new Error("not implemented"))},Gte.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,$te("pipe count=%d opts=%j",n.pipesCount,t);var i=!t||!1!==t.end?a:u;function o(e){$te("onunpipe"),e===r&&u()}function a(){$te("onend"),e.end()}n.endEmitted?zt(i):r.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;$te("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,Qte(e))}}(r);e.on("drain",s);var c=!1;function u(){$te("cleanup"),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",d),e.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",u),r.removeListener("data",f),c=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var l=!1;function f(t){$te("ondata"),l=!1,!1!==e.write(t)||l||((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==nre(n.pipes,e))&&!c&&($te("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,l=!0),r.pause())}function d(t){$te("onerror",t),m(),e.removeListener("error",d),0===function(e,t){return e.listeners(t).length}(e,"error")&&e.emit("error",t)}function h(){e.removeListener("finish",p),m()}function p(){$te("onfinish"),e.removeListener("close",h),m()}function m(){$te("unpipe"),r.unpipe(e)}return r.on("data",f),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",d),e.once("close",h),e.once("finish",p),e.emit("pipe",r),n.flowing||($te("pipe resume"),r.resume()),e},Gte.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var r=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},sre.prototype._write=function(e,t,r){r(new Error("not implemented"))},sre.prototype._writev=null,sre.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,hre(e,t),r&&(t.finished?zt(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r)},Kee(yre,Gte);for(var mre=Object.keys(sre.prototype),bre=0;bree._pos){var n=r.substr(e._pos);if("x-user-defined"===e._charset){for(var i=new _(n.length),o=0;oe._pos&&(e.push(new _(new Uint8Array(a.result.slice(e._pos)))),e._pos=a.result.byteLength)},a.onload=function(){e.push(null)},a.readAsArrayBuffer(r)}e._xhr.readyState===Pre&&"ms-stream"!==e._mode&&e.push(null)},Kee(Tre,sre);var Ore=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];Tre.prototype.setHeader=function(e,t){var r=e.toLowerCase();-1===Ore.indexOf(r)&&(this._headers[r]={name:e,value:t})},Tre.prototype.getHeader=function(e){return this._headers[e.toLowerCase()].value},Tre.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},Tre.prototype._onFinish=function(){var e=this;if(!e._destroyed){var t,r=e._opts,n=e._headers;if("POST"!==r.method&&"PUT"!==r.method&&"PATCH"!==r.method||(t=function(){if(void 0!==Dee)return Dee;try{new u.Blob([new ArrayBuffer(1)]),Dee=!0}catch(e){Dee=!1}return Dee}()?new u.Blob(e._body.map((function(e){return function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(se(e)){for(var t=new Uint8Array(e.length),r=e.length,n=0;n= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Hre=Cre-Bre,Gre=Math.floor,qre=String.fromCharCode;function Kre(e){throw new RangeError($re[e])}function Vre(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function Wre(e,t,r){var n=0;for(e=r?Gre(e/Fre):e>>1,e+=Gre(e/t);e>Hre*Nre>>1;n+=Cre)e=Gre(e/Hre);return Gre(n+(Hre+1)*e/(e+Rre))}function Jre(e){return function(e,t){var r=e.split("@"),n="";r.length>1&&(n=r[0]+"@",e=r[1]);var i=function(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}((e=e.replace(zre,".")).split("."),t).join(".");return n+i}(e,(function(e){return Dre.test(e)?"xn--"+function(e){var t,r,n,i,o,a,s,c,u,l,f,d,h,p,m,b=[];for(e=function(e){for(var t,r,n=[],i=0,o=e.length;i=55296&&t<=56319&&i=t&&fGre((Mre-r)/(h=n+1))&&Kre("overflow"),r+=(s-t)*h,t=s,a=0;aMre&&Kre("overflow"),f==t){for(c=r,u=Cre;!(c<(l=u<=o?Bre:u>=o+Nre?Nre:u-o));u+=Cre)m=c-l,p=Cre-l,b.push(qre(Vre(l+m%p,0))),c=Gre(m/p);b.push(qre(Vre(c,0))),o=Wre(r,h,n==i),r=0,++n}++r,++t}return b.join("")}(e):e}))}function Zre(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Yre=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function Xre(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}function Qre(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n0&&s>a&&(s=a);for(var c=0;c=0?(u=h.substr(0,p),l=h.substr(p+1)):(u=h,l=""),f=decodeURIComponent(u),d=decodeURIComponent(l),Zre(i,f)?Yre(i[f])?i[f].push(d):i[f]=[i[f],d]:i[f]=d}return i}const rne=u.URL,nne=u.URLSearchParams;var ine={parse:vne,resolve:_ne,resolveObject:kne,fileURLToPath:Ene,format:Ane,Url:one,URL:rne,URLSearchParams:nne};function one(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var ane=/^([a-z0-9.+-]+:)/i,sne=/:[0-9]*$/,cne=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,une=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),lne=["'"].concat(une),fne=["%","/","?",";","#"].concat(lne),dne=["/","?","#"],hne=255,pne=/^[+a-z0-9A-Z_-]{0,63}$/,mne=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,bne={javascript:!0,"javascript:":!0},gne={javascript:!0,"javascript:":!0},yne={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function vne(e,t,r){if(e&&xte(e)&&e instanceof one)return e;var n=new one;return n.parse(e,t,r),n}function wne(e,t,r,n){if(!vte(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),o=-1!==i&&i127?A+="x":A+=E[x];if(!A.match(pne)){var k=w.slice(0,u),S=w.slice(u+1),P=E.match(mne);P&&(k.push(P[1]),S.unshift(P[2])),S.length&&(s="/"+S.join(".")+s),e.hostname=k.join(".");break}}}}e.hostname.length>hne?e.hostname="":e.hostname=e.hostname.toLowerCase(),v||(e.hostname=Jre(e.hostname)),d=e.port?":"+e.port:"";var I=e.hostname||"";e.host=I+d,e.href+=e.host,v&&(e.hostname=e.hostname.substr(1,e.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!bne[p])for(u=0,f=lne.length;u0)&&n.host.split("@"))&&(n.auth=m.shift(),n.host=n.hostname=m.shift())),n.search=e.search,n.query=e.query,bte(n.pathname)&&bte(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!w.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var A=w.slice(-1)[0],x=(n.host||e.host||w.length>1)&&("."===A||".."===A)||""===A,_=0,k=w.length;k>=0;k--)"."===(A=w[k])?w.splice(k,1):".."===A?(w.splice(k,1),_++):_&&(w.splice(k,1),_--);if(!y&&!v)for(;_--;_)w.unshift("..");!y||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),x&&"/"!==w.join("/").substr(-1)&&w.push("");var S=""===w[0]||w[0]&&"/"===w[0].charAt(0);return E&&(n.hostname=n.host=S?"":w.length?w.shift():"",(m=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=m.shift(),n.host=n.hostname=m.shift())),(y=y||n.host&&w.length)&&!S&&w.unshift(""),w.length?n.pathname=w.join("/"):(n.pathname=null,n.path=null),bte(n.pathname)&&bte(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},one.prototype.parseHost=function(){return Sne(this)};var Pne=Object.freeze({__proto__:null,URL:rne,URLSearchParams:nne,Url:one,default:ine,fileURLToPath:Ene,format:Ane,parse:vne,resolve:_ne,resolveObject:kne});function Ine(e,t){"string"==typeof e&&(e=vne(e));var r=-1===u.location.protocol.search(/^https?:$/)?"http:":"",n=e.protocol||r,i=e.hostname||e.host,o=e.port,a=e.path||"/";i&&-1!==i.indexOf(":")&&(i="["+i+"]"),e.url=(i?n+"//"+i:"")+(o?":"+o:"")+a,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var s=new Tre(e);return t&&s.on("response",t),s}function Tne(e,t){var r=Ine(e,t);return r.end(),r}function One(){}One.defaultMaxSockets=4;var Mne=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],Cne={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},Bne={request:Ine,get:Tne,Agent:One,METHODS:Mne,STATUS_CODES:Cne},Nne=s(Object.freeze({__proto__:null,Agent:One,METHODS:Mne,STATUS_CODES:Cne,default:Bne,get:Tne,request:Ine}));function Rne(e,t){"string"==typeof e&&(e=vne(e));var r=-1===u.location.protocol.search(/^https?:$/)?"http:":"",n=e.protocol||r,i=e.hostname||e.host,o=e.port,a=e.path||"/";i&&-1!==i.indexOf(":")&&(i="["+i+"]"),e.url=(i?n+"//"+i:"")+(o?":"+o:"")+a,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var s=new Tre(e);return t&&s.on("response",t),s}function Fne(e,t){var r=Rne(e,t);return r.end(),r}function Lne(){}Lne.defaultMaxSockets=4;var jne=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],Une={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},Dne={request:Rne,get:Fne,Agent:Lne,METHODS:jne,STATUS_CODES:Une},zne=s(Object.freeze({__proto__:null,Agent:Lne,METHODS:jne,STATUS_CODES:Une,default:Dne,get:Fne,request:Rne})),$ne={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};function Hne(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function Gne(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var o=0;o=0;)e[t]=0}var Qne=0,eie=1,tie=2,rie=29,nie=256,iie=nie+1+rie,oie=30,aie=19,sie=2*iie+1,cie=15,uie=16,lie=7,fie=256,die=16,hie=17,pie=18,mie=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],bie=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],gie=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],yie=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],vie=new Array(2*(iie+2));Xne(vie);var wie=new Array(2*oie);Xne(wie);var Eie=new Array(512);Xne(Eie);var Aie=new Array(256);Xne(Aie);var xie=new Array(rie);Xne(xie);var _ie,kie,Sie,Pie=new Array(oie);function Iie(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function Tie(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Oie(e){return e<256?Eie[e]:Eie[256+(e>>>7)]}function Mie(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function Cie(e,t,r){e.bi_valid>uie-r?(e.bi_buf|=t<>uie-e.bi_valid,e.bi_valid+=r-uie):(e.bi_buf|=t<>>=1,r<<=1}while(--t>0);return r>>>1}function Rie(e,t,r){var n,i,o=new Array(cie+1),a=0;for(n=1;n<=cie;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=Nie(o[s]++,s))}}function Fie(e){var t;for(t=0;t8?Mie(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function jie(e,t,r,n){var i=2*t,o=2*r;return e[i]>1;r>=1;r--)Uie(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Uie(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,Uie(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,o,a,s,c=t.dyn_tree,u=t.max_code,l=t.stat_desc.static_tree,f=t.stat_desc.has_stree,d=t.stat_desc.extra_bits,h=t.stat_desc.extra_base,p=t.stat_desc.max_length,m=0;for(o=0;o<=cie;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;rp&&(o=p,m++),c[2*n+1]=o,n>u||(e.bl_count[o]++,a=0,n>=h&&(a=d[n-h]),s=c[2*n],e.opt_len+=s*(o+a),f&&(e.static_len+=s*(l[2*n+1]+a)));if(0!==m){do{for(o=p-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[p]--,m-=2}while(m>0);for(o=p;0!==o;o--)for(n=e.bl_count[o];0!==n;)(i=e.heap[--r])>u||(c[2*i+1]!==o&&(e.opt_len+=(o-c[2*i+1])*c[2*i],c[2*i+1]=o),n--)}}(e,t),Rie(o,u,e.bl_count)}function $ie(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s>=7;n=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}function Wie(e,t,r,n){var i,o,a=0;e.level>0?(e.strm.data_type===Yne&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return Jne;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return Zne;for(t=32;t=3&&0===e.bl_tree[2*yie[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?Kie(e,t,r,n):e.strategy===Wne||o===i?(Cie(e,(eie<<1)+(n?1:0),3),Die(e,vie,wie)):(Cie(e,(tie<<1)+(n?1:0),3),function(e,t,r,n){var i;for(Cie(e,t-257,5),Cie(e,r-1,5),Cie(e,n-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(Aie[r]+nie+1)]++,e.dyn_dtree[2*Oie(t)]++),e.last_lit===e.lit_bufsize-1}function Zie(e,t,r,n){for(var i=65535&e,o=e>>>16&65535,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+t[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16}var Yie=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();function Xie(e,t,r,n){var i=Yie,o=n+r;e^=-1;for(var a=n;a>>8^i[255&(e^t[a])];return~e}var Qie,eoe=0,toe=4,roe=0,noe=-2,ioe=2,ooe=8,aoe=286,soe=30,coe=19,uoe=2*aoe+1,loe=15,foe=3,doe=258,hoe=doe+foe+1,poe=42,moe=103,boe=113,goe=666,yoe=1,voe=2,woe=3,Eoe=4;function Aoe(e,t){return e.msg=$ne[t],t}function xoe(e){return(e<<1)-(e>4?9:0)}function _oe(e){for(var t=e.length;--t>=0;)e[t]=0}function koe(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(Gne(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function Soe(e,t){Wie(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,koe(e.strm)}function Poe(e,t){e.pending_buf[e.pending++]=t}function Ioe(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function Toe(e,t,r,n){var i=e.avail_in;return i>n&&(i=n),0===i?0:(e.avail_in-=i,Gne(t,e.input,e.next_in,i,r),1===e.state.wrap?e.adler=Zie(e.adler,t,i,r):2===e.state.wrap&&(e.adler=Xie(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)}function Ooe(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-hoe?e.strstart-(e.w_size-hoe):0,u=e.window,l=e.w_mask,f=e.prev,d=e.strstart+doe,h=u[o+a-1],p=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(r=t)+a]===p&&u[r+a-1]===h&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&oa){if(e.match_start=t,a=n,n>=s)break;h=u[o+a-1],p=u[o+a]}}}while((t=f[t&l])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead}function Moe(e){var t,r,n,i,o,a=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=a+(a-hoe)){Gne(e.window,e.window,a,a,0),e.match_start-=a,e.strstart-=a,e.block_start-=a,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=a?n-a:0}while(--r);t=r=a;do{n=e.prev[--t],e.prev[t]=n>=a?n-a:0}while(--r);i+=a}if(0===e.strm.avail_in)break;if(r=Toe(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=r,e.lookahead+e.insert>=foe)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<=foe&&(e.ins_h=(e.ins_h<=foe)if(n=Jie(e,e.strstart-e.match_start,e.match_length-foe),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=foe){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=foe&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=foe-1)),e.prev_length>=foe&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-foe,n=Jie(e,e.strstart-1-e.prev_match,e.prev_length-foe),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<5||t<0)return e?Aoe(e,noe):noe;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===goe&&t!==toe)return Aoe(e,0===e.avail_out?-5:noe);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===poe)if(2===n.wrap)e.adler=0,Poe(n,31),Poe(n,139),Poe(n,8),n.gzhead?(Poe(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Poe(n,255&n.gzhead.time),Poe(n,n.gzhead.time>>8&255),Poe(n,n.gzhead.time>>16&255),Poe(n,n.gzhead.time>>24&255),Poe(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),Poe(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Poe(n,255&n.gzhead.extra.length),Poe(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Xie(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(Poe(n,0),Poe(n,0),Poe(n,0),Poe(n,0),Poe(n,0),Poe(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),Poe(n,3),n.status=boe);else{var a=ooe+(n.w_bits-8<<4)<<8;a|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=boe,Ioe(n,a),0!==n.strstart&&(Ioe(n,e.adler>>>16),Ioe(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=Xie(e.adler,n.pending_buf,n.pending-i,i)),koe(e),i=n.pending,n.pending!==n.pending_buf_size));)Poe(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=Xie(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Xie(e.adler,n.pending_buf,n.pending-i,i)),koe(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindexi&&(e.adler=Xie(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Xie(e.adler,n.pending_buf,n.pending-i,i)),koe(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindexi&&(e.adler=Xie(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=moe)}else n.status=moe;if(n.status===moe&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&koe(e),n.pending+2<=n.pending_buf_size&&(Poe(n,255&e.adler),Poe(n,e.adler>>8&255),e.adler=0,n.status=boe)):n.status=boe),0!==n.pending){if(koe(e),0===e.avail_out)return n.last_flush=-1,roe}else if(0===e.avail_in&&xoe(t)<=xoe(r)&&t!==toe)return Aoe(e,-5);if(n.status===goe&&0!==e.avail_in)return Aoe(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==eoe&&n.status!==goe){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(Moe(e),0===e.lookahead)){if(t===eoe)return yoe;break}if(e.match_length=0,r=Jie(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Soe(e,!1),0===e.strm.avail_out))return yoe}return e.insert=0,t===toe?(Soe(e,!0),0===e.strm.avail_out?woe:Eoe):e.last_lit&&(Soe(e,!1),0===e.strm.avail_out)?yoe:voe}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,a=e.window;;){if(e.lookahead<=doe){if(Moe(e),e.lookahead<=doe&&t===eoe)return yoe;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=foe&&e.strstart>0&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){o=e.strstart+doe;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=foe?(r=Jie(e,1,e.match_length-foe),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=Jie(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(Soe(e,!1),0===e.strm.avail_out))return yoe}return e.insert=0,t===toe?(Soe(e,!0),0===e.strm.avail_out?woe:Eoe):e.last_lit&&(Soe(e,!1),0===e.strm.avail_out)?yoe:voe}(n,t):Qie[n.level].func(n,t);if(s!==woe&&s!==Eoe||(n.status=goe),s===yoe||s===woe)return 0===e.avail_out&&(n.last_flush=-1),roe;if(s===voe&&(1===t?Vie(n):5!==t&&(Kie(n,0,0,!1),3===t&&(_oe(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),koe(e),0===e.avail_out))return n.last_flush=-1,roe}return t!==toe?roe:n.wrap<=0?1:(2===n.wrap?(Poe(n,255&e.adler),Poe(n,e.adler>>8&255),Poe(n,e.adler>>16&255),Poe(n,e.adler>>24&255),Poe(n,255&e.total_in),Poe(n,e.total_in>>8&255),Poe(n,e.total_in>>16&255),Poe(n,e.total_in>>24&255)):(Ioe(n,e.adler>>>16),Ioe(n,65535&e.adler)),koe(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?roe:1)}Qie=[new Noe(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Moe(e),0===e.lookahead&&t===eoe)return yoe;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,Soe(e,!1),0===e.strm.avail_out))return yoe;if(e.strstart-e.block_start>=e.w_size-hoe&&(Soe(e,!1),0===e.strm.avail_out))return yoe}return e.insert=0,t===toe?(Soe(e,!0),0===e.strm.avail_out?woe:Eoe):(e.strstart>e.block_start&&(Soe(e,!1),e.strm.avail_out),yoe)})),new Noe(4,4,8,4,Coe),new Noe(4,5,16,8,Coe),new Noe(4,6,32,32,Coe),new Noe(4,4,16,16,Boe),new Noe(8,16,32,32,Boe),new Noe(8,16,128,128,Boe),new Noe(8,32,128,256,Boe),new Noe(32,128,258,1024,Boe),new Noe(32,258,258,4096,Boe)];var joe=30,Uoe=12;function Doe(e,t){var r,n,i,o,a,s,c,u,l,f,d,h,p,m,b,g,y,v,w,E,A,x,_,k,S;r=e.state,n=e.next_in,k=e.input,i=n+(e.avail_in-5),o=e.next_out,S=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=r.dmax,u=r.wsize,l=r.whave,f=r.wnext,d=r.window,h=r.hold,p=r.bits,m=r.lencode,b=r.distcode,g=(1<>>=w=v>>>24,p-=w,0===(w=v>>>16&255))S[o++]=65535&v;else{if(!(16&w)){if(64&w){if(32&w){r.mode=Uoe;break e}e.msg="invalid literal/length code",r.mode=joe;break e}v=m[(65535&v)+(h&(1<>>=w,p-=w),p<15&&(h+=k[n++]<>>=w=v>>>24,p-=w,16&(w=v>>>16&255)){if(A=65535&v,p<(w&=15)&&(h+=k[n++]<c){e.msg="invalid distance too far back",r.mode=joe;break e}if(h>>>=w,p-=w,A>(w=o-a)){if((w=A-w)>l&&r.sane){e.msg="invalid distance too far back",r.mode=joe;break e}if(x=0,_=d,0===f){if(x+=u-w,w2;)S[o++]=_[x++],S[o++]=_[x++],S[o++]=_[x++],E-=3;E&&(S[o++]=_[x++],E>1&&(S[o++]=_[x++]))}else{x=o-A;do{S[o++]=S[x++],S[o++]=S[x++],S[o++]=S[x++],E-=3}while(E>2);E&&(S[o++]=S[x++],E>1&&(S[o++]=S[x++]))}break}if(64&w){e.msg="invalid distance code",r.mode=joe;break e}v=b[(65535&v)+(h&(1<>3,h&=(1<<(p-=E<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n=1&&0===O[E];E--);if(A>E&&(A=E),0===E)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(w=1;w0&&(e===Goe||1!==E))return-1;for(M[1]=0,y=1;y$oe||e===Koe&&S>Hoe)return 1;for(;;){p=y-_,a[v]h?(m=C[B+a[v]],b=I[T+a[v]]):(m=96,b=0),c=1<>_)+(u-=c)]=p<<24|m<<16|b}while(0!==u);for(c=1<>=1;if(0!==c?(P&=c-1,P+=c):P=0,v++,0==--O[y]){if(y===E)break;y=t[r+a[v]]}if(y>A&&(P&f)!==l){for(0===_&&(_=A),d+=w,k=1<<(x=y-_);x+_$oe||e===Koe&&S>Hoe)return 1;i[l=P&f]=A<<24|x<<16|d-o}}return 0!==P&&(i[d+P]=y-_<<24|64<<16),s.bits=A,0}var Xoe=1,Qoe=2,eae=0,tae=-2,rae=1,nae=12,iae=30,oae=852,aae=592;function sae(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function cae(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Kne(320),this.work=new Kne(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function uae(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,function(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=rae,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Vne(oae),t.distcode=t.distdyn=new Vne(aae),t.sane=1,t.back=-1,eae):tae}(e)):tae}function lae(e,t){var r,n;return e?(n=new cae,e.state=n,n.window=null,r=function(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?tae:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,uae(e))):tae}(e,t),r!==eae&&(e.state=null),r):tae}var fae,dae,hae=!0;function pae(e){if(hae){var t;for(fae=new Vne(512),dae=new Vne(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Yoe(Xoe,e.lens,0,288,fae,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Yoe(Qoe,e.lens,0,32,dae,0,e.work,{bits:5}),hae=!1}e.lencode=fae,e.lenbits=9,e.distcode=dae,e.distbits=5}function mae(e,t){var r,n,i,o,a,s,c,u,l,f,d,h,p,m,b,g,y,v,w,E,A,x,_,k,S=0,P=new qne(4),I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return tae;(r=e.state).mode===nae&&(r.mode=13),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,l=r.bits,f=s,d=c,x=eae;e:for(;;)switch(r.mode){case rae:if(0===r.wrap){r.mode=13;break}for(;l<16;){if(0===s)break e;s--,u+=n[o++]<>>8&255,r.check=Xie(r.check,P,2,0),u=0,l=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=iae;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=iae;break}if(l-=4,A=8+(15&(u>>>=4)),0===r.wbits)r.wbits=A;else if(A>r.wbits){e.msg="invalid window size",r.mode=iae;break}r.dmax=1<>8&1),512&r.flags&&(P[0]=255&u,P[1]=u>>>8&255,r.check=Xie(r.check,P,2,0)),u=0,l=0,r.mode=3;case 3:for(;l<32;){if(0===s)break e;s--,u+=n[o++]<>>8&255,P[2]=u>>>16&255,P[3]=u>>>24&255,r.check=Xie(r.check,P,4,0)),u=0,l=0,r.mode=4;case 4:for(;l<16;){if(0===s)break e;s--,u+=n[o++]<>8),512&r.flags&&(P[0]=255&u,P[1]=u>>>8&255,r.check=Xie(r.check,P,2,0)),u=0,l=0,r.mode=5;case 5:if(1024&r.flags){for(;l<16;){if(0===s)break e;s--,u+=n[o++]<>>8&255,r.check=Xie(r.check,P,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((h=r.length)>s&&(h=s),h&&(r.head&&(A=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),Gne(r.head.extra,n,o,h,A)),512&r.flags&&(r.check=Xie(r.check,n,h,o)),s-=h,o+=h,r.length-=h),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break e;h=0;do{A=n[o+h++],r.head&&A&&r.length<65536&&(r.head.name+=String.fromCharCode(A))}while(A&&h>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=nae;break;case 10:for(;l<32;){if(0===s)break e;s--,u+=n[o++]<>>=7&l,l-=7&l,r.mode=27;break}for(;l<3;){if(0===s)break e;s--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:if(pae(r),r.mode=20,6===t){u>>>=2,l-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=iae}u>>>=2,l-=2;break;case 14:for(u>>>=7&l,l-=7&l;l<32;){if(0===s)break e;s--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=iae;break}if(r.length=65535&u,u=0,l=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(h=r.length){if(h>s&&(h=s),h>c&&(h=c),0===h)break e;Gne(i,n,o,h,a),s-=h,o+=h,c-=h,a+=h,r.length-=h;break}r.mode=nae;break;case 17:for(;l<14;){if(0===s)break e;s--,u+=n[o++]<>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=iae;break}r.have=0,r.mode=18;case 18:for(;r.have>>=3,l-=3}for(;r.have<19;)r.lens[I[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,_={bits:r.lenbits},x=Yoe(0,r.lens,0,19,r.lencode,0,r.work,_),r.lenbits=_.bits,x){e.msg="invalid code lengths set",r.mode=iae;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,y=65535&S,!((b=S>>>24)<=l);){if(0===s)break e;s--,u+=n[o++]<>>=b,l-=b,r.lens[r.have++]=y;else{if(16===y){for(k=b+2;l>>=b,l-=b,0===r.have){e.msg="invalid bit length repeat",r.mode=iae;break}A=r.lens[r.have-1],h=3+(3&u),u>>>=2,l-=2}else if(17===y){for(k=b+3;l>>=b)),u>>>=3,l-=3}else{for(k=b+7;l>>=b)),u>>>=7,l-=7}if(r.have+h>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=iae;break}for(;h--;)r.lens[r.have++]=A}}if(r.mode===iae)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=iae;break}if(r.lenbits=9,_={bits:r.lenbits},x=Yoe(Xoe,r.lens,0,r.nlen,r.lencode,0,r.work,_),r.lenbits=_.bits,x){e.msg="invalid literal/lengths set",r.mode=iae;break}if(r.distbits=6,r.distcode=r.distdyn,_={bits:r.distbits},x=Yoe(Qoe,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,_),r.distbits=_.bits,x){e.msg="invalid distances set",r.mode=iae;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=l,Doe(e,d),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,l=r.bits,r.mode===nae&&(r.back=-1);break}for(r.back=0;g=(S=r.lencode[u&(1<>>16&255,y=65535&S,!((b=S>>>24)<=l);){if(0===s)break e;s--,u+=n[o++]<>v)])>>>16&255,y=65535&S,!(v+(b=S>>>24)<=l);){if(0===s)break e;s--,u+=n[o++]<>>=v,l-=v,r.back+=v}if(u>>>=b,l-=b,r.back+=b,r.length=y,0===g){r.mode=26;break}if(32&g){r.back=-1,r.mode=nae;break}if(64&g){e.msg="invalid literal/length code",r.mode=iae;break}r.extra=15&g,r.mode=22;case 22:if(r.extra){for(k=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;g=(S=r.distcode[u&(1<>>16&255,y=65535&S,!((b=S>>>24)<=l);){if(0===s)break e;s--,u+=n[o++]<>v)])>>>16&255,y=65535&S,!(v+(b=S>>>24)<=l);){if(0===s)break e;s--,u+=n[o++]<>>=v,l-=v,r.back+=v}if(u>>>=b,l-=b,r.back+=b,64&g){e.msg="invalid distance code",r.mode=iae;break}r.offset=y,r.extra=15&g,r.mode=24;case 24:if(r.extra){for(k=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=iae;break}r.mode=25;case 25:if(0===c)break e;if(h=d-c,r.offset>h){if((h=r.offset-h)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=iae;break}h>r.wnext?(h-=r.wnext,p=r.wsize-h):p=r.wnext-h,h>r.length&&(h=r.length),m=r.window}else m=i,p=a-r.offset,h=r.length;h>c&&(h=c),c-=h,r.length-=h;do{i[a++]=m[p++]}while(--h);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;i[a++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;l<32;){if(0===s)break e;s--,u|=n[o++]<=o.wsize?(Gne(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>n&&(i=n),Gne(o.window,t,r-n,i,o.wnext),(n-=i)?(Gne(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave7)throw new TypeError("Bad argument");this.mode=e,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}function yae(e,t){for(var r=0;r15&&(a=2,n-=16),i<1||i>9||r!==ooe||n<8||n>15||t<0||t>9||o<0||o>4)return Aoe(e,noe);8===n&&(n=9);var s=new Roe;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<wae.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitswae.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelwae.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelwae.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=wae.Z_FILTERED&&e.strategy!=wae.Z_HUFFMAN_ONLY&&e.strategy!=wae.Z_RLE&&e.strategy!=wae.Z_FIXED&&e.strategy!=wae.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!_.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._binding=new wae.Zlib(t);var r=this;this._hadError=!1,this._binding.onerror=function(e,t){r._binding=null,r._hadError=!0;var n=new Error(e);n.errno=t,n.code=Eae[t],r.emit("error",n)};var n=wae.Z_DEFAULT_COMPRESSION;"number"==typeof e.level&&(n=e.level);var i=wae.Z_DEFAULT_STRATEGY;"number"==typeof e.strategy&&(i=e.strategy),this._binding.init(e.windowBits||wae.Z_DEFAULT_WINDOWBITS,n,e.memLevel||wae.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=new _(this._chunkSize),this._offset=0,this._closed=!1,this._level=n,this._strategy=i,this.once("end",this.close)}Object.keys(Eae).forEach((function(e){Eae[Eae[e]]=e})),Kee(Xae,Are),Xae.prototype.params=function(e,t,r){if(ewae.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=wae.Z_FILTERED&&t!=wae.Z_HUFFMAN_ONLY&&t!=wae.Z_RLE&&t!=wae.Z_FIXED&&t!=wae.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);if(this._level!==e||this._strategy!==t){var n=this;this.flush(wae.Z_SYNC_FLUSH,(function(){n._binding.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}))}else pr.nextTick(r)},Xae.prototype.reset=function(){return this._binding.reset()},Xae.prototype._flush=function(e){this._transform(new _(0),"",e)},Xae.prototype.flush=function(e,t){var r=this._writableState;if(("function"==typeof e||void 0===e&&!t)&&(t=e,e=wae.Z_FULL_FLUSH),r.ended)t&&pr.nextTick(t);else if(r.ending)t&&this.once("end",t);else if(r.needDrain){var n=this;this.once("drain",(function(){n.flush(t)}))}else this._flushFlag=e,this.write(new _(0),"",t)},Xae.prototype.close=function(e){if(e&&pr.nextTick(e),!this._closed){this._closed=!0,this._binding.close();var t=this;pr.nextTick((function(){t.emit("close")}))}},Xae.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);if(null===!e&&!_.isBuffer(e))return r(new Error("invalid input"));o?n=wae.Z_FINISH:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||wae.Z_NO_FLUSH)),this._processChunk(e,n,r)},Xae.prototype._processChunk=function(e,t,r){var n=e&&e.length,i=this._chunkSize-this._offset,o=0,a=this,s="function"==typeof r;if(!s){var c,u=[],l=0;this.on("error",(function(e){c=e}));do{var f=this._binding.writeSync(t,e,o,n,this._buffer,this._offset,i)}while(!this._hadError&&p(f[0],f[1]));if(this._hadError)throw c;var d=_.concat(u,l);return this.close(),d}var h=this._binding.write(t,e,o,n,this._buffer,this._offset,i);function p(c,f){if(!a._hadError){var d=i-f;if(function(e,t){if(!e)throw new Error(t)}(d>=0,"have should not go down"),d>0){var h=a._buffer.slice(a._offset,a._offset+d);a._offset+=d,s?a.push(h):(u.push(h),l+=h.length)}if((0===f||a._offset>=a._chunkSize)&&(i=a._chunkSize,a._offset=0,a._buffer=new _(a._chunkSize)),0===f){if(o+=n-c,n=c,!s)return!0;var m=a._binding.write(t,e,o,n,a._buffer,a._offset,a._chunkSize);return m.callback=p,void(m.buffer=e)}if(!s)return!1;r()}}h.buffer=e,h.callback=p},Kee(qae,Xae),Kee(Kae,Xae),Kee(Vae,Xae),Kee(Wae,Xae),Kee(Jae,Xae),Kee(Zae,Xae),Kee(Yae,Xae);var Qae={codes:Eae,createDeflate:Aae,createInflate:xae,createDeflateRaw:_ae,createInflateRaw:kae,createGzip:Sae,createGunzip:Pae,createUnzip:Iae,deflate:Tae,deflateSync:Oae,gzip:Mae,gzipSync:Cae,deflateRaw:Bae,deflateRawSync:Nae,unzip:Rae,unzipSync:Fae,inflate:Lae,inflateSync:jae,gunzip:Uae,gunzipSync:Dae,inflateRaw:zae,inflateRawSync:$ae,Deflate:qae,Inflate:Kae,Gzip:Vae,Gunzip:Wae,DeflateRaw:Jae,InflateRaw:Zae,Unzip:Yae,Zlib:Xae},ese=s(Object.freeze({__proto__:null,Deflate:qae,DeflateRaw:Jae,Gunzip:Wae,Gzip:Vae,Inflate:Kae,InflateRaw:Zae,Unzip:Yae,Zlib:Xae,codes:Eae,createDeflate:Aae,createDeflateRaw:_ae,createGunzip:Pae,createGzip:Sae,createInflate:xae,createInflateRaw:kae,createUnzip:Iae,default:Qae,deflate:Tae,deflateRaw:Bae,deflateRawSync:Nae,deflateSync:Oae,gunzip:Uae,gunzipSync:Dae,gzip:Mae,gzipSync:Cae,inflate:Lae,inflateRaw:zae,inflateRawSync:$ae,inflateSync:jae,unzip:Rae,unzipSync:Fae})),tse=s(Dte),rse=s(Pne);Object.defineProperty(Hee,"__esModule",{value:!0}),Hee.InvalidStatusCodeError=Hee.InvalidCertError=void 0;const nse=Object.freeze({redirect:!0,expectStatusCode:200,headers:{},full:!1,keepAlive:!0,cors:!1,referrer:!1,sslAllowSelfSigned:!1,_redirectCount:0});class ise extends Error{constructor(e,t){super(e),this.fingerprint256=t}}Hee.InvalidCertError=ise;class ose extends Error{constructor(e){super(`Request Failed. Status Code: ${e}`),this.statusCode=e}}function ase(e,t){if(!t||"text"===t||"json"===t)try{let r=new TextDecoder("utf8",{fatal:!0}).decode(e);if("text"===t)return r;try{return JSON.parse(r)}catch(e){if("json"===t)throw e;return r}}catch(e){if("text"===t||"json"===t)throw e}return e}Hee.InvalidStatusCodeError=ose;let sse={};function cse(e,t){let r={...nse,...t};const n=Nne,i=zne,o=ese,{promisify:a}=tse,{resolve:s}=rse,c=!!/^https/.test(e);let u={method:r.method||"GET",headers:{"Accept-Encoding":"gzip, deflate, br"}};const l=e=>e.replace(/:| /g,"").toLowerCase();if(r.keepAlive){const e={keepAlive:!0,keepAliveMsecs:3e4,maxFreeSockets:1024,maxCachedSessions:1024},t=[c,c&&r.sslPinnedCertificates?.map((e=>l(e))).sort()].join();u.agent=sse[t]||(sse[t]=new(c?i:n).Agent(e))}"json"===r.type&&(u.headers["Content-Type"]="application/json"),r.data&&(r.method||(u.method="POST"),u.body="json"===r.type?JSON.stringify(r.data):r.data),u.headers={...u.headers,...r.headers},r.sslAllowSelfSigned&&(u.rejectUnauthorized=!1);return new Promise(((t,f)=>{const d=async t=>{if(t&&"DEPTH_ZERO_SELF_SIGNED_CERT"===t.code)try{await cse(e,{...r,sslAllowSelfSigned:!0,sslPinnedCertificates:[]})}catch(e){e&&e.fingerprint256&&(t=new ise(`Self-signed SSL certificate: ${e.fingerprint256}`,e.fingerprint256))}f(t)},h=(c?i:n).request(e,u,(n=>{n.on("error",d),(async()=>{try{t(await(async t=>{const n=t.statusCode;if(r.redirect&&300<=n&&n<400&&t.headers.location){if(10==r._redirectCount)throw new Error("Request failed. Too much redirects.");return r._redirectCount+=1,await cse(s(e,t.headers.location),r)}if(r.expectStatusCode&&n!==r.expectStatusCode)throw t.resume(),new ose(n);let i=[];for await(const e of t)i.push(e);let c=_.concat(i);const u=t.headers["content-encoding"];"br"===u&&(c=await a(o.brotliDecompress)(c)),"gzip"!==u&&"deflate"!==u||(c=await a(o.unzip)(c));const l=ase(c,r.type);return r.full?{headers:t.headers,status:n,body:l}:l})(n))}catch(e){f(e)}})()}));h.on("error",d);const p=r.sslPinnedCertificates?.map((e=>l(e))),m=e=>{const t=l(e.getPeerCertificate()?.fingerprint256||"");if((t||!e.isSessionReused())&&!p.includes(t))return h.emit("error",new ise(`Invalid SSL certificate: ${t} Expected: ${p}`,t)),h.abort()};r.sslPinnedCertificates&&h.on("socket",(e=>{const t=e.listeners("secureConnect").map((e=>(e.name||"").replace("bound ",""))).includes("mfetchSecureConnect");t||e.on("secureConnect",m.bind(null,e))})),r.keepAlive&&h.setNoDelay(!0),u.body&&h.write(u.body),h.end()}))}const use=new Set(["Accept","Accept-Language","Content-Language","Content-Type"].map((e=>e.toLowerCase()))),lse=new Set(["Accept-Charset","Accept-Encoding","Access-Control-Request-Headers","Access-Control-Request-Method","Connection","Content-Length","Cookie","Cookie2","Date","DNT","Expect","Host","Keep-Alive","Origin","Referer","TE","Trailer","Transfer-Encoding","Upgrade","Via"].map((e=>e.toLowerCase())));async function fse(e,t){let r={...nse,...t};const n=new Headers;"json"===r.type&&n.set("Content-Type","application/json");let i=new URL(e);if(i.username){const e=btoa(`${i.username}:${i.password}`);n.set("Authorization",`Basic ${e}`),i.username="",i.password=""}e=""+i;for(let e in r.headers){const t=e.toLowerCase();(use.has(t)||r.cors&&!lse.has(t))&&n.set(e,r.headers[e])}let o={headers:n,redirect:r.redirect?"follow":"manual"};r.referrer||(o.referrerPolicy="no-referrer"),r.cors&&(o.mode="cors"),r.data&&(r.method||(o.method="POST"),o.body="json"===r.type?JSON.stringify(r.data):r.data);const a=await fetch(e,o);if(r.expectStatusCode&&a.status!==r.expectStatusCode)throw new ose(a.status);const s=ase(new Uint8Array(await a.arrayBuffer()),r.type);return r.full?{headers:Object.fromEntries(a.headers.entries()),status:a.status,body:s}:s}const dse=!!("object"==typeof pr&&pr.versions&&pr.versions.node&&pr.versions.v8);Hee.default=function(e,t){return(dse?cse:fse)(e,t)},Object.defineProperty($ee,"__esModule",{value:!0}),$ee.getProvider=$ee.fetchFromProvider=void 0;const hse=Hee;$ee.fetchFromProvider=async(e,t)=>(await(0,hse.default)(e,{headers:{"content-type":"application/json"},type:"json",data:{method:t.method,params:t.params,jsonrpc:"2.0",id:1}})).result;$ee.getProvider=e=>{if("string"==typeof e)return e;if(void 0!==e?.connection?.url)return e.connection.url;throw new Error("Must provide valid provider URL or Web3Provider")},function(e){var t=o&&o.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=o&&o.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.toAscii=e.stripHexPrefix=e.padToEven=e.isHexString=e.isHexPrefixed=e.getKeys=e.getBinarySize=e.fromUtf8=e.fromAscii=e.arrayContainsArray=void 0,r(y4,e),r(J9,e),r(Z9,e),r(gee,e),r(Eee,e),r(Pee,e),r(fee,e),r(Aee,e),r(Ree,e),r(Fee,e);var n=hee;Object.defineProperty(e,"arrayContainsArray",{enumerable:!0,get:function(){return n.arrayContainsArray}}),Object.defineProperty(e,"fromAscii",{enumerable:!0,get:function(){return n.fromAscii}}),Object.defineProperty(e,"fromUtf8",{enumerable:!0,get:function(){return n.fromUtf8}}),Object.defineProperty(e,"getBinarySize",{enumerable:!0,get:function(){return n.getBinarySize}}),Object.defineProperty(e,"getKeys",{enumerable:!0,get:function(){return n.getKeys}}),Object.defineProperty(e,"isHexPrefixed",{enumerable:!0,get:function(){return n.isHexPrefixed}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return n.isHexString}}),Object.defineProperty(e,"padToEven",{enumerable:!0,get:function(){return n.padToEven}}),Object.defineProperty(e,"stripHexPrefix",{enumerable:!0,get:function(){return n.stripHexPrefix}}),Object.defineProperty(e,"toAscii",{enumerable:!0,get:function(){return n.toAscii}}),r(Uee,e),r($ee,e)}(g4);var pse={},mse={},bse={},gse={},yse={};Object.defineProperty(yse,"__esModule",{value:!0}),yse.StructError=void 0;class vse extends TypeError{constructor(e,t){let r;const{message:n,explanation:i,...o}=e,{path:a}=e,s=0===a.length?n:`At path: ${a.join(".")} -- ${n}`;super(i??s),null!=i&&(this.cause=s),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>r??(r=[e,...t()])}}yse.StructError=vse;var wse={},Ese={};function Ase(e){return"object"==typeof e&&null!==e}function xse(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function _se(e,t,r,n){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:i,branch:o}=t,{type:a}=r,{refinement:s,message:c=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${xse(n)}\``}=e;return{value:n,type:a,refinement:s,key:i[i.length-1],path:i,branch:o,...e,message:c}}Object.defineProperty(Ese,"__esModule",{value:!0}),Ese.run=Ese.toFailures=Ese.toFailure=Ese.shiftIterator=Ese.print=Ese.isPlainObject=Ese.isObject=void 0,Ese.isObject=Ase,Ese.isPlainObject=function(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},Ese.print=xse,Ese.shiftIterator=function(e){const{done:t,value:r}=e.next();return t?void 0:r},Ese.toFailure=_se,Ese.toFailures=function*(e,t,r,n){(function(e){return Ase(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const i of e){const e=_se(i,t,r,n);e&&(yield e)}},Ese.run=function*e(t,r,n={}){const{path:i=[],branch:o=[t],coerce:a=!1,mask:s=!1}=n,c={path:i,branch:o};if(a&&(t=r.coercer(t,c),s&&"type"!==r.type&&Ase(r.schema)&&Ase(t)&&!Array.isArray(t)))for(const e in t)void 0===r.schema[e]&&delete t[e];let u="valid";for(const e of r.validator(t,c))e.explanation=n.message,u="not_valid",yield[e,void 0];for(let[l,f,d]of r.entries(t,c)){const r=e(f,d,{path:void 0===l?i:[...i,l],branch:void 0===l?o:[...o,f],coerce:a,mask:s,message:n.message});for(const e of r)e[0]?(u=null===e[0].refinement||void 0===e[0].refinement?"not_valid":"not_refined",yield[e[0],void 0]):a&&(f=e[1],void 0===l?t=f:t instanceof Map?t.set(l,f):t instanceof Set?t.add(f):Ase(t)&&(void 0!==f||l in t)&&(t[l]=f))}if("not_valid"!==u)for(const e of r.refiner(t,c))e.explanation=n.message,u="not_refined",yield[e,void 0];"valid"===u&&(yield[void 0,t])},Object.defineProperty(wse,"__esModule",{value:!0}),wse.validate=wse.is=wse.mask=wse.create=wse.assert=wse.Struct=void 0;const kse=yse,Sse=Ese;function Pse(e,t,r){const n=Mse(e,t,{message:r});if(n[0])throw n[0]}function Ise(e,t,r){const n=Mse(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Tse(e,t,r){const n=Mse(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function Ose(e,t){return!Mse(e,t)[0]}function Mse(e,t,r={}){const n=(0,Sse.run)(e,t,r),i=(0,Sse.shiftIterator)(n);if(i[0]){return[new kse.StructError(i[0],(function*(){for(const e of n)e[0]&&(yield e[0])})),void 0]}return[void 0,i[1]]}wse.Struct=class{constructor(e){const{type:t,schema:r,validator:n,refiner:i,coercer:o=e=>e,entries:a=function*(){}}=e;this.type=t,this.schema=r,this.entries=a,this.coercer=o,this.validator=n?(e,t)=>{const r=n(e,t);return(0,Sse.toFailures)(r,t,this,e)}:()=>[],this.refiner=i?(e,t)=>{const r=i(e,t);return(0,Sse.toFailures)(r,t,this,e)}:()=>[]}assert(e,t){return Pse(e,this,t)}create(e,t){return Ise(e,this,t)}is(e){return Ose(e,this)}mask(e,t){return Tse(e,this,t)}validate(e,t={}){return Mse(e,this,t)}},wse.assert=Pse,wse.create=Ise,wse.mask=Tse,wse.is=Ose,wse.validate=Mse;var Cse,Bse,Nse={},Rse={},Fse={};function Lse(){if(Cse)return Fse;Cse=1,Object.defineProperty(Fse,"__esModule",{value:!0}),Fse.pick=Fse.partial=Fse.omit=Fse.lazy=Fse.dynamic=Fse.deprecated=Fse.define=Fse.assign=void 0;const e=wse,t=jse();return Fse.assign=function(...e){const r="type"===e[0]?.type,n=e.map((({schema:e})=>e)),i=Object.assign({},...n);return r?(0,t.type)(i):(0,t.object)(i)},Fse.define=function(t,r){return new e.Struct({type:t,schema:null,validator:r})},Fse.deprecated=function(t,r){return new e.Struct({...t,refiner:(e,r)=>void 0===e||t.refiner(e,r),validator:(e,n)=>void 0===e||(r(e,n),t.validator(e,n))})},Fse.dynamic=function(t){return new e.Struct({type:"dynamic",schema:null,*entries(e,r){const n=t(e,r);yield*n.entries(e,r)},validator:(e,r)=>t(e,r).validator(e,r),coercer:(e,r)=>t(e,r).coercer(e,r),refiner:(e,r)=>t(e,r).refiner(e,r)})},Fse.lazy=function(t){let r;return new e.Struct({type:"lazy",schema:null,*entries(e,n){r??(r=t()),yield*r.entries(e,n)},validator:(e,n)=>(r??(r=t()),r.validator(e,n)),coercer:(e,n)=>(r??(r=t()),r.coercer(e,n)),refiner:(e,n)=>(r??(r=t()),r.refiner(e,n))})},Fse.omit=function(e,r){const{schema:n}=e,i={...n};for(const e of r)delete i[e];return"type"===e.type?(0,t.type)(i):(0,t.object)(i)},Fse.partial=function(r){const n=r instanceof e.Struct,i=n?{...r.schema}:{...r};for(const e in i)i[e]=(0,t.optional)(i[e]);return n&&"type"===r.type?(0,t.type)(i):(0,t.object)(i)},Fse.pick=function(e,r){const{schema:n}=e,i={};for(const e of r)i[e]=n[e];return"type"===e.type?(0,t.type)(i):(0,t.object)(i)},Fse}function jse(){if(Bse)return Rse;Bse=1,Object.defineProperty(Rse,"__esModule",{value:!0}),Rse.unknown=Rse.union=Rse.type=Rse.tuple=Rse.string=Rse.set=Rse.regexp=Rse.record=Rse.optional=Rse.object=Rse.number=Rse.nullable=Rse.never=Rse.map=Rse.literal=Rse.intersection=Rse.integer=Rse.instance=Rse.func=Rse.enums=Rse.date=Rse.boolean=Rse.bigint=Rse.array=Rse.any=void 0;const e=wse,t=Ese,r=Lse();function n(){return(0,r.define)("never",(()=>!1))}return Rse.any=function(){return(0,r.define)("any",(()=>!0))},Rse.array=function(r){return new e.Struct({type:"array",schema:r,*entries(e){if(r&&Array.isArray(e))for(const[t,n]of e.entries())yield[t,n,r]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${(0,t.print)(e)}`})},Rse.bigint=function(){return(0,r.define)("bigint",(e=>"bigint"==typeof e))},Rse.boolean=function(){return(0,r.define)("boolean",(e=>"boolean"==typeof e))},Rse.date=function(){return(0,r.define)("date",(e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${(0,t.print)(e)}`))},Rse.enums=function(r){const n={},i=r.map((e=>(0,t.print)(e))).join();for(const e of r)n[e]=e;return new e.Struct({type:"enums",schema:n,validator:e=>r.includes(e)||`Expected one of \`${i}\`, but received: ${(0,t.print)(e)}`})},Rse.func=function(){return(0,r.define)("func",(e=>"function"==typeof e||`Expected a function, but received: ${(0,t.print)(e)}`))},Rse.instance=function(e){return(0,r.define)("instance",(r=>r instanceof e||`Expected a \`${e.name}\` instance, but received: ${(0,t.print)(r)}`))},Rse.integer=function(){return(0,r.define)("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${(0,t.print)(e)}`))},Rse.intersection=function(t){return new e.Struct({type:"intersection",schema:null,*entries(e,r){for(const{entries:n}of t)yield*n(e,r)},*validator(e,r){for(const{validator:n}of t)yield*n(e,r)},*refiner(e,r){for(const{refiner:n}of t)yield*n(e,r)}})},Rse.literal=function(r){const n=(0,t.print)(r),i=typeof r;return new e.Struct({type:"literal",schema:"string"===i||"number"===i||"boolean"===i?r:null,validator:e=>e===r||`Expected the literal \`${n}\`, but received: ${(0,t.print)(e)}`})},Rse.map=function(r,n){return new e.Struct({type:"map",schema:null,*entries(e){if(r&&n&&e instanceof Map)for(const[t,i]of e.entries())yield[t,t,r],yield[t,i,n]},coercer:e=>e instanceof Map?new Map(e):e,validator:e=>e instanceof Map||`Expected a \`Map\` object, but received: ${(0,t.print)(e)}`})},Rse.never=n,Rse.nullable=function(t){return new e.Struct({...t,validator:(e,r)=>null===e||t.validator(e,r),refiner:(e,r)=>null===e||t.refiner(e,r)})},Rse.number=function(){return(0,r.define)("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${(0,t.print)(e)}`))},Rse.object=function(r){const i=r?Object.keys(r):[],o=n();return new e.Struct({type:"object",schema:r??null,*entries(e){if(r&&(0,t.isObject)(e)){const t=new Set(Object.keys(e));for(const n of i)t.delete(n),yield[n,e[n],r[n]];for(const r of t)yield[r,e[r],o]}},validator:e=>(0,t.isObject)(e)||`Expected an object, but received: ${(0,t.print)(e)}`,coercer:e=>(0,t.isObject)(e)?{...e}:e})},Rse.optional=function(t){return new e.Struct({...t,validator:(e,r)=>void 0===e||t.validator(e,r),refiner:(e,r)=>void 0===e||t.refiner(e,r)})},Rse.record=function(r,n){return new e.Struct({type:"record",schema:null,*entries(e){if((0,t.isObject)(e))for(const t in e){const i=e[t];yield[t,t,r],yield[t,i,n]}},validator:e=>(0,t.isObject)(e)||`Expected an object, but received: ${(0,t.print)(e)}`})},Rse.regexp=function(){return(0,r.define)("regexp",(e=>e instanceof RegExp))},Rse.set=function(r){return new e.Struct({type:"set",schema:null,*entries(e){if(r&&e instanceof Set)for(const t of e)yield[t,t,r]},coercer:e=>e instanceof Set?new Set(e):e,validator:e=>e instanceof Set||`Expected a \`Set\` object, but received: ${(0,t.print)(e)}`})},Rse.string=function(){return(0,r.define)("string",(e=>"string"==typeof e||`Expected a string, but received: ${(0,t.print)(e)}`))},Rse.tuple=function(r){const i=n();return new e.Struct({type:"tuple",schema:null,*entries(e){if(Array.isArray(e)){const t=Math.max(r.length,e.length);for(let n=0;nArray.isArray(e)||`Expected an array, but received: ${(0,t.print)(e)}`})},Rse.type=function(r){const n=Object.keys(r);return new e.Struct({type:"type",schema:r,*entries(e){if((0,t.isObject)(e))for(const t of n)yield[t,e[t],r[t]]},validator:e=>(0,t.isObject)(e)||`Expected an object, but received: ${(0,t.print)(e)}`,coercer:e=>(0,t.isObject)(e)?{...e}:e})},Rse.union=function(r){const n=r.map((e=>e.type)).join(" | ");return new e.Struct({type:"union",schema:null,coercer(e){for(const t of r){const[r,n]=t.validate(e,{coerce:!0});if(!r)return n}return e},validator(e,i){const o=[];for(const n of r){const[...r]=(0,t.run)(e,n,i),[a]=r;if(!a?.[0])return[];for(const[e]of r)e&&o.push(e)}return[`Expected the value to satisfy a union of \`${n}\`, but received: ${(0,t.print)(e)}`,...o]}})},Rse.unknown=function(){return(0,r.define)("unknown",(()=>!0))},Rse}Object.defineProperty(Nse,"__esModule",{value:!0}),Nse.trimmed=Nse.defaulted=Nse.coerce=void 0;const Use=wse,Dse=Ese,zse=jse();function $se(e,t,r){return new Use.Struct({...e,coercer:(n,i)=>(0,Use.is)(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}Nse.coerce=$se,Nse.defaulted=function(e,t,r={}){return $se(e,(0,zse.unknown)(),(e=>{const n="function"==typeof t?t():t;if(void 0===e)return n;if(!r.strict&&(0,Dse.isPlainObject)(e)&&(0,Dse.isPlainObject)(n)){const t={...e};let r=!1;for(const e in n)void 0===t[e]&&(t[e]=n[e],r=!0);if(r)return t}return e}))},Nse.trimmed=function(e){return $se(e,(0,zse.string)(),(e=>e.trim()))};var Hse={};Object.defineProperty(Hse,"__esModule",{value:!0}),Hse.refine=Hse.size=Hse.pattern=Hse.nonempty=Hse.min=Hse.max=Hse.empty=void 0;const Gse=wse,qse=Ese;function Kse(e){return e instanceof Map||e instanceof Set?e.size:e.length}function Vse(e,t,r){return new Gse.Struct({...e,*refiner(n,i){yield*e.refiner(n,i);const o=r(n,i),a=(0,qse.toFailures)(o,i,e,n);for(const e of a)yield{...e,refinement:t}}})}Hse.empty=function(e){return Vse(e,"empty",(t=>{const r=Kse(t);return 0===r||`Expected an empty ${e.type} but received one with a size of \`${r}\``}))},Hse.max=function(e,t,r={}){const{exclusive:n}=r;return Vse(e,"max",(r=>n?rn?r>t:r>=t||`Expected a ${e.type} greater than ${n?"":"or equal to "}${t} but received \`${r}\``))},Hse.nonempty=function(e){return Vse(e,"nonempty",(t=>Kse(t)>0||`Expected a nonempty ${e.type} but received an empty one`))},Hse.pattern=function(e,t){return Vse(e,"pattern",(r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`))},Hse.size=function(e,t,r=t){const n=`Expected a ${e.type}`,i=t===r?`of \`${t}\``:`between \`${t}\` and \`${r}\``;return Vse(e,"size",(e=>{if("number"==typeof e||e instanceof Date)return t<=e&&e<=r||`${n} ${i} but received \`${e}\``;if(e instanceof Map||e instanceof Set){const{size:o}=e;return t<=o&&o<=r||`${n} with a size ${i} but received one with a size of \`${o}\``}const{length:o}=e;return t<=o&&o<=r||`${n} with a length ${i} but received one with a length of \`${o}\``}))},Hse.refine=Vse,function(e){var t=o&&o.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=o&&o.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(yse,e),r(wse,e),r(Nse,e),r(Hse,e),r(jse(),e),r(Lse(),e)}(gse);var Wse={},Jse=s(ws),Zse=s(_s);const{ErrorWithCause:Yse}=Jse,{findCauseByReference:Xse,getErrorCause:Qse,messageWithCauses:ece,stackWithCauses:tce}=Zse;var rce={ErrorWithCause:Yse,findCauseByReference:Xse,getErrorCause:Qse,stackWithCauses:tce,messageWithCauses:ece},nce={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateNumberSize=e.calculateStringSize=e.isASCII=e.isPlainObject=e.ESCAPE_CHARACTERS_REGEXP=e.JsonSize=e.getKnownPropertyNames=e.hasProperty=e.isObject=e.isNullOrUndefined=e.isNonEmptyArray=void 0,e.isNonEmptyArray=function(e){return Array.isArray(e)&&e.length>0},e.isNullOrUndefined=function(e){return null==e},e.isObject=function(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)};function t(e){return e.charCodeAt(0)<=127}e.hasProperty=(e,t)=>Object.hasOwnProperty.call(e,t),e.getKnownPropertyNames=function(e){return Object.getOwnPropertyNames(e)},function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(e.JsonSize||(e.JsonSize={})),e.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu,e.isPlainObject=function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}},e.isASCII=t,e.calculateStringSize=function(r){return r.split("").reduce(((e,r)=>t(r)?e+1:e+2),0)+(r.match(e.ESCAPE_CHARACTERS_REGEXP)??[]).length},e.calculateNumberSize=function(e){return e.toString().length}}(nce),Object.defineProperty(Wse,"__esModule",{value:!0}),Wse.wrapError=Wse.getErrorMessage=Wse.isErrorWithStack=Wse.isErrorWithMessage=Wse.isErrorWithCode=void 0;const ice=rce,oce=nce;function ace(e){return"object"==typeof e&&null!==e&&"code"in e}function sce(e){return"object"==typeof e&&null!==e&&"message"in e}Wse.isErrorWithCode=ace,Wse.isErrorWithMessage=sce,Wse.isErrorWithStack=function(e){return"object"==typeof e&&null!==e&&"stack"in e},Wse.getErrorMessage=function(e){return sce(e)&&"string"==typeof e.message?e.message:(0,oce.isNullOrUndefined)(e)?"":String(e)},Wse.wrapError=function(e,t){if(function(e){return e instanceof Error||(0,oce.isObject)(e)&&"Error"===e.constructor.name}(e)){let r;return r=2===Error.length?new Error(t,{cause:e}):new ice.ErrorWithCause(t,{cause:e}),ace(e)&&(r.code=e.code),r}return t.length>0?new Error(`${String(e)}: ${t}`):new Error(String(e))},Object.defineProperty(bse,"__esModule",{value:!0}),bse.assertExhaustive=bse.assertStruct=bse.assert=bse.AssertionError=void 0;const cce=gse,uce=Wse;function lce(e,t){return r=e,Boolean("string"==typeof r?.prototype?.constructor?.name)?new e({message:t}):e({message:t});var r}let fce=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}};bse.AssertionError=fce,bse.assert=function(e,t="Assertion failed.",r=fce){if(!e){if(t instanceof Error)throw t;throw lce(r,t)}},bse.assertStruct=function(e,t,r="Assertion failed",n=fce){try{(0,cce.assert)(e,t)}catch(e){throw lce(n,`${r}: ${function(e){return(0,uce.getErrorMessage)(e).replace(/\.$/u,"")}(e)}.`)}},bse.assertExhaustive=function(e){throw new Error("Invalid branch reached. Should be detected during compilation.")};var dce={};Object.defineProperty(dce,"__esModule",{value:!0}),dce.base64=void 0;const hce=gse,pce=bse;dce.base64=(e,t={})=>{const r=t.paddingRequired??!1,n=t.characterSet??"base64";let i,o;return"base64"===n?i=String.raw`[A-Za-z0-9+\/]`:((0,pce.assert)("base64url"===n),i=String.raw`[-_A-Za-z0-9]`),o=r?new RegExp(`^(?:${i}{4})*(?:${i}{3}=|${i}{2}==)?$`,"u"):new RegExp(`^(?:${i}{4})*(?:${i}{2,3}|${i}{3}=|${i}{2}==)?$`,"u"),(0,hce.pattern)(e,o)};var mce={},bce={};!function(e){function t(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function r(...e){const t=e=>e,r=(e,t)=>r=>e(t(r)),n=e.map((e=>e.encode)).reduceRight(r,t),i=e.map((e=>e.decode)).reduce(r,t);return{encode:n,decode:i}}function n(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map((t=>{if(t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]}))},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map((t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const r=e.indexOf(t);if(-1===r)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return r}))}}}function i(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function o(e,t="="){if("string"!=typeof t)throw new Error("padding chr should be string");return{encode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let e of r)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;r.length*e%8;)r.push(t);return r},decode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let e of r)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let n=r.length;if(n*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&r[n-1]===t;n--)if(!((n-1)*e%8))throw new Error("Invalid padding: string has too much padding");return r.slice(0,n)}}}function a(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function s(e,t,r){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(r<2)throw new Error(`convertRadix: wrong to=${r}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let n=0;const i=[],o=Array.from(e);for(o.forEach((e=>{if(e<0||e>=t)throw new Error(`Wrong integer: ${e}`)}));;){let e=0,a=!0;for(let i=n;it?c(t,e%t):e,u=(e,t)=>e+(t-c(e,t));function l(e,t,r,n){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(u(t,r)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${u(t,r)}`);let i=0,o=0;const a=2**r-1,s=[];for(const n of e){if(n>=2**t)throw new Error(`convertRadix2: invalid data word=${n} from=${t}`);if(i=i<32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${t}`);for(o+=t;o>=r;o-=r)s.push((i>>o-r&a)>>>0);i&=2**o-1}if(i=i<=t)throw new Error("Excess padding");if(!n&&i)throw new Error(`Non-zero padding: ${i}`);return n&&o>0&&s.push(i>>>0),s}function f(e){return{encode:r=>{if(!t(r))throw new Error("radix.encode input should be Uint8Array");return s(Array.from(r),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(s(t,e,256))}}}function d(e,r=!1){if(e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(u(8,e)>32||u(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!t(n))throw new Error("radix2.encode input should be Uint8Array");return l(Array.from(n),8,e,!r)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(l(t,e,8,r))}}}function h(e){if("function"!=typeof e)throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch(e){}}}function p(e,r){if("function"!=typeof r)throw new Error("checksum fn should be function");return{encode(n){if(!t(n))throw new Error("checksum.encode: input should be Uint8Array");const i=r(n).slice(0,e),o=new Uint8Array(n.length+e);return o.set(n),o.set(i,n.length),o},decode(n){if(!t(n))throw new Error("checksum.decode: input should be Uint8Array");const i=n.slice(0,-e),o=r(i).slice(0,e),a=n.slice(-e);for(let t=0;te.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),e.base64=r(d(6),n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),o(6),i("")),e.base64nopad=r(d(6),n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),i("")),e.base64url=r(d(6),n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),o(6),i("")),e.base64urlnopad=r(d(6),n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),i(""));const m=e=>r(f(58),n(e),i(""));e.base58=m("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),e.base58flickr=m("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),e.base58xrp=m("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const b=[0,2,3,5,6,7,9,10,11];e.base58xmr={encode(t){let r="";for(let n=0;nr(p(4,(e=>t(t(e)))),e.base58),e.base58check=e.createBase58check;const g=r(n("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),i("")),y=[996825010,642813549,513874426,1027748829,705979059];function v(e){const t=e>>25;let r=(33554431&e)<<5;for(let e=0;e>e&1)&&(r^=y[e]);return r}function w(e,t,r=1){const n=e.length;let i=1;for(let t=0;t126)throw new Error(`Invalid prefix (${e})`);i=v(i)^r>>5}i=v(i);for(let t=0;tr)throw new TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${r})`);const n=e.toLowerCase();if(e!==n&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const i=n.lastIndexOf("1");if(0===i||-1===i)throw new Error('Letter "1" must be present between prefix and data only');const o=n.slice(0,i),a=n.slice(i+1);if(a.length<6)throw new Error("Data must be at least 6 characters long");const s=g.decode(a).slice(0,-6),c=w(o,s,t);if(!a.endsWith(c))throw new Error(`Invalid checksum in ${e}: expected "${c}"`);return{prefix:o,words:s}}return{encode:function(e,r,n=90){if("string"!=typeof e)throw new Error("bech32.encode prefix should be string, not "+typeof e);if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof r);if(0===e.length)throw new TypeError(`Invalid prefix length ${e.length}`);const i=e.length+7+r.length;if(!1!==n&&i>n)throw new TypeError(`Length ${i} exceeds limit ${n}`);const o=e.toLowerCase(),a=w(o,r,t);return`${o}1${g.encode(r)}${a}`},decode:a,decodeToBytes:function(e){const{prefix:t,words:r}=a(e,!1);return{prefix:t,words:r,bytes:n(r)}},decodeUnsafe:h(a),fromWords:n,fromWordsUnsafe:o,toWords:i}}e.bech32=E("bech32"),e.bech32m=E("bech32m"),e.utf8={encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)},e.hex=r(d(4),n("0123456789abcdef"),i(""),a((e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})));const A={utf8:e.utf8,hex:e.hex,base16:e.base16,base32:e.base32,base64:e.base64,base64url:e.base64url,base58:e.base58,base58xmr:e.base58xmr},x="Invalid encoding type. Available types: utf8, hex, base16, base32, base64, base64url, base58, base58xmr";e.bytesToString=(e,r)=>{if("string"!=typeof e||!A.hasOwnProperty(e))throw new TypeError(x);if(!t(r))throw new TypeError("bytesToString() expects Uint8Array");return A[e].encode(r)},e.str=e.bytesToString;e.stringToBytes=(e,t)=>{if(!A.hasOwnProperty(e))throw new TypeError(x);if("string"!=typeof t)throw new TypeError("stringToBytes() expects string");return A[e].decode(t)},e.bytes=e.stringToBytes}(bce);var gce,yce,vce={};function wce(){return gce||(gce=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.remove0x=e.add0x=e.isValidChecksumAddress=e.getChecksumAddress=e.isValidHexAddress=e.assertIsStrictHexString=e.assertIsHexString=e.isStrictHexString=e.isHexString=e.HexChecksumAddressStruct=e.HexAddressStruct=e.StrictHexStruct=e.HexStruct=void 0;const t=gse,r=p7,n=bse,i=Ece();function o(r){return(0,t.is)(r,e.HexStruct)}function a(r){return(0,t.is)(r,e.StrictHexStruct)}function s(o){(0,n.assert)((0,t.is)(o,e.HexChecksumAddressStruct),"Invalid hex address.");const a=u(o.toLowerCase()),s=u((0,i.bytesToHex)((0,r.keccak_256)(a)));return`0x${a.split("").map(((e,r)=>{const i=s[r];return(0,n.assert)((0,t.is)(i,(0,t.string)()),"Hash shorter than address."),parseInt(i,16)>7?e.toUpperCase():e})).join("")}`}function c(r){return!!(0,t.is)(r,e.HexChecksumAddressStruct)&&s(r)===r}function u(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}e.HexStruct=(0,t.pattern)((0,t.string)(),/^(?:0x)?[0-9a-f]+$/iu),e.StrictHexStruct=(0,t.pattern)((0,t.string)(),/^0x[0-9a-f]+$/iu),e.HexAddressStruct=(0,t.pattern)((0,t.string)(),/^0x[0-9a-f]{40}$/u),e.HexChecksumAddressStruct=(0,t.pattern)((0,t.string)(),/^0x[0-9a-fA-F]{40}$/u),e.isHexString=o,e.isStrictHexString=a,e.assertIsHexString=function(e){(0,n.assert)(o(e),"Value must be a hexadecimal string.")},e.assertIsStrictHexString=function(e){(0,n.assert)(a(e),'Value must be a hexadecimal string, starting with "0x".')},e.isValidHexAddress=function(r){return(0,t.is)(r,e.HexAddressStruct)||c(r)},e.getChecksumAddress=s,e.isValidChecksumAddress=c,e.add0x=function(e){return e.startsWith("0x")?e:e.startsWith("0X")?`0x${e.substring(2)}`:`0x${e}`},e.remove0x=u}(vce)),vce}function Ece(){if(yce)return mce;yce=1,Object.defineProperty(mce,"__esModule",{value:!0}),mce.createDataView=mce.concatBytes=mce.valueToBytes=mce.base64ToBytes=mce.stringToBytes=mce.numberToBytes=mce.signedBigIntToBytes=mce.bigIntToBytes=mce.hexToBytes=mce.bytesToBase64=mce.bytesToString=mce.bytesToNumber=mce.bytesToSignedBigInt=mce.bytesToBigInt=mce.bytesToHex=mce.assertIsBytes=mce.isBytes=void 0;const e=bce,t=bse,r=wce(),n=48,i=58,o=87;const a=function(){const e=[];return()=>{if(0===e.length)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}();function s(e){return e instanceof Uint8Array}function c(e){(0,t.assert)(s(e),"Value must be a Uint8Array.")}function u(e){if(c(e),0===e.length)return"0x";const t=a(),n=new Array(e.length);for(let r=0;r=BigInt(0),"Value must be a non-negative bigint.");return f(e.toString(16))}function h(e){(0,t.assert)("number"==typeof e,"Value must be a number."),(0,t.assert)(e>=0,"Value must be a non-negative number."),(0,t.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");return f(e.toString(16))}function p(e){return(0,t.assert)("string"==typeof e,"Value must be a string."),(new TextEncoder).encode(e)}function m(e){if("bigint"==typeof e)return d(e);if("number"==typeof e)return h(e);if("string"==typeof e)return e.startsWith("0x")?f(e):p(e);if(s(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}return mce.isBytes=s,mce.assertIsBytes=c,mce.bytesToHex=u,mce.bytesToBigInt=l,mce.bytesToSignedBigInt=function(e){c(e);let t=BigInt(0);for(const r of e)t=(t<0,"Byte length must be greater than 0."),(0,t.assert)(function(e,r){(0,t.assert)(r>0);const n=e>>BigInt(31);return!((~e&n)+(e&~n)>>BigInt(8*r-1))}(e,r),"Byte length is too small to represent the given value.");let n=e;const i=new Uint8Array(r);for(let e=0;e>=BigInt(8);return i.reverse()},mce.numberToBytes=h,mce.stringToBytes=p,mce.base64ToBytes=function(r){return(0,t.assert)("string"==typeof r,"Value must be a string."),e.base64.decode(r)},mce.valueToBytes=m,mce.concatBytes=function(e){const t=new Array(e.length);let r=0;for(let n=0;n[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})$/u,e.CAIP_NAMESPACE_REGEX=/^[-a-z0-9]{3,8}$/u,e.CAIP_REFERENCE_REGEX=/^[-_a-zA-Z0-9]{1,32}$/u,e.CAIP_ACCOUNT_ID_REGEX=/^(?(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})):(?[-.%a-zA-Z0-9]{1,128})$/u,e.CAIP_ACCOUNT_ADDRESS_REGEX=/^[-.%a-zA-Z0-9]{1,128}$/u,e.CaipChainIdStruct=(0,t.pattern)((0,t.string)(),e.CAIP_CHAIN_ID_REGEX),e.CaipNamespaceStruct=(0,t.pattern)((0,t.string)(),e.CAIP_NAMESPACE_REGEX),e.CaipReferenceStruct=(0,t.pattern)((0,t.string)(),e.CAIP_REFERENCE_REGEX),e.CaipAccountIdStruct=(0,t.pattern)((0,t.string)(),e.CAIP_ACCOUNT_ID_REGEX),e.CaipAccountAddressStruct=(0,t.pattern)((0,t.string)(),e.CAIP_ACCOUNT_ADDRESS_REGEX),(e.KnownCaipNamespace||(e.KnownCaipNamespace={})).Eip155="eip155",e.isCaipChainId=function(r){return(0,t.is)(r,e.CaipChainIdStruct)},e.isCaipNamespace=r,e.isCaipReference=n,e.isCaipAccountId=function(r){return(0,t.is)(r,e.CaipAccountIdStruct)},e.isCaipAccountAddress=function(r){return(0,t.is)(r,e.CaipAccountAddressStruct)},e.parseCaipChainId=function(t){const r=e.CAIP_CHAIN_ID_REGEX.exec(t);if(!r?.groups)throw new Error("Invalid CAIP chain ID.");return{namespace:r.groups.namespace,reference:r.groups.reference}},e.parseCaipAccountId=function(t){const r=e.CAIP_ACCOUNT_ID_REGEX.exec(t);if(!r?.groups)throw new Error("Invalid CAIP account ID.");return{address:r.groups.accountAddress,chainId:r.groups.chainId,chain:{namespace:r.groups.namespace,reference:r.groups.reference}}},e.toCaipChainId=function(t,i){if(!r(t))throw new Error(`Invalid "namespace", must match: ${e.CAIP_NAMESPACE_REGEX.toString()}`);if(!n(i))throw new Error(`Invalid "reference", must match: ${e.CAIP_REFERENCE_REGEX.toString()}`);return`${t}:${i}`}}(Ace);var xce={};Object.defineProperty(xce,"__esModule",{value:!0}),xce.ChecksumStruct=void 0;const _ce=gse,kce=dce;xce.ChecksumStruct=(0,_ce.size)((0,kce.base64)((0,_ce.string)(),{paddingRequired:!0}),44,44);var Sce={};Object.defineProperty(Sce,"__esModule",{value:!0}),Sce.createHex=Sce.createBytes=Sce.createBigInt=Sce.createNumber=void 0;const Pce=gse,Ice=bse,Tce=Ece(),Oce=wce(),Mce=(0,Pce.union)([(0,Pce.number)(),(0,Pce.bigint)(),(0,Pce.string)(),Oce.StrictHexStruct]),Cce=(0,Pce.coerce)((0,Pce.number)(),Mce,Number),Bce=(0,Pce.coerce)((0,Pce.bigint)(),Mce,BigInt);(0,Pce.union)([Oce.StrictHexStruct,(0,Pce.instance)(Uint8Array)]);const Nce=(0,Pce.coerce)((0,Pce.instance)(Uint8Array),(0,Pce.union)([Oce.StrictHexStruct]),Tce.hexToBytes),Rce=(0,Pce.coerce)(Oce.StrictHexStruct,(0,Pce.instance)(Uint8Array),Tce.bytesToHex);Sce.createNumber=function(e){try{const t=(0,Pce.create)(e,Cce);return(0,Ice.assert)(Number.isFinite(t),`Expected a number-like value, got "${e}".`),t}catch(t){if(t instanceof Pce.StructError)throw new Error(`Expected a number-like value, got "${e}".`);throw t}},Sce.createBigInt=function(e){try{return(0,Pce.create)(e,Bce)}catch(e){if(e instanceof Pce.StructError)throw new Error(`Expected a number-like value, got "${String(e.value)}".`);throw e}},Sce.createBytes=function(e){if("string"==typeof e&&"0x"===e.toLowerCase())return new Uint8Array;try{return(0,Pce.create)(e,Nce)}catch(e){if(e instanceof Pce.StructError)throw new Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}},Sce.createHex=function(e){if(e instanceof Uint8Array&&0===e.length||"string"==typeof e&&"0x"===e.toLowerCase())return"0x";try{return(0,Pce.create)(e,Rce)}catch(e){if(e instanceof Pce.StructError)throw new Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}};var Fce,Lce,jce={},Uce=o&&o.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},Dce=o&&o.__classPrivateFieldSet||function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};Object.defineProperty(jce,"__esModule",{value:!0}),jce.FrozenSet=jce.FrozenMap=void 0;class zce{get size(){return Uce(this,Fce,"f").size}[(Fce=new WeakMap,Symbol.iterator)](){return Uce(this,Fce,"f")[Symbol.iterator]()}constructor(e){Fce.set(this,void 0),Dce(this,Fce,new Map(e),"f"),Object.freeze(this)}entries(){return Uce(this,Fce,"f").entries()}forEach(e,t){return Uce(this,Fce,"f").forEach(((r,n,i)=>e.call(t,r,n,this)))}get(e){return Uce(this,Fce,"f").get(e)}has(e){return Uce(this,Fce,"f").has(e)}keys(){return Uce(this,Fce,"f").keys()}values(){return Uce(this,Fce,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map((([e,t])=>`${String(e)} => ${String(t)}`)).join(", ")} `:""}}`}}jce.FrozenMap=zce;class $ce{get size(){return Uce(this,Lce,"f").size}[(Lce=new WeakMap,Symbol.iterator)](){return Uce(this,Lce,"f")[Symbol.iterator]()}constructor(e){Lce.set(this,void 0),Dce(this,Lce,new Set(e),"f"),Object.freeze(this)}entries(){return Uce(this,Lce,"f").entries()}forEach(e,t){return Uce(this,Lce,"f").forEach(((r,n,i)=>e.call(t,r,n,this)))}has(e){return Uce(this,Lce,"f").has(e)}keys(){return Uce(this,Lce,"f").keys()}values(){return Uce(this,Lce,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map((e=>String(e))).join(", ")} `:""}}`}}jce.FrozenSet=$ce,Object.freeze(zce),Object.freeze(zce.prototype),Object.freeze($ce),Object.freeze($ce.prototype);var Hce={};Object.defineProperty(Hce,"__esModule",{value:!0});var Gce={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getJsonRpcIdValidator=e.assertIsJsonRpcError=e.isJsonRpcError=e.assertIsJsonRpcFailure=e.isJsonRpcFailure=e.assertIsJsonRpcSuccess=e.isJsonRpcSuccess=e.assertIsJsonRpcResponse=e.isJsonRpcResponse=e.assertIsPendingJsonRpcResponse=e.isPendingJsonRpcResponse=e.JsonRpcResponseStruct=e.JsonRpcFailureStruct=e.JsonRpcSuccessStruct=e.PendingJsonRpcResponseStruct=e.assertIsJsonRpcRequest=e.isJsonRpcRequest=e.assertIsJsonRpcNotification=e.isJsonRpcNotification=e.JsonRpcNotificationStruct=e.JsonRpcRequestStruct=e.JsonRpcParamsStruct=e.JsonRpcErrorStruct=e.JsonRpcIdStruct=e.JsonRpcVersionStruct=e.jsonrpc2=e.getJsonSize=e.getSafeJson=e.isValidJson=e.JsonStruct=e.UnsafeJsonStruct=e.exactOptional=e.object=void 0;const t=gse,r=bse,n=nce;function i({path:e,branch:t}){const r=e[e.length-1];return(0,n.hasProperty)(t[t.length-2],r)}function o(e){return new t.Struct({...e,type:`optional ${e.type}`,validator:(t,r)=>!i(r)||e.validator(t,r),refiner:(t,r)=>!i(r)||e.refiner(t,r)})}e.object=e=>(0,t.object)(e),e.exactOptional=o;function a(r){return(0,t.create)(r,e.JsonStruct)}e.UnsafeJsonStruct=(0,t.union)([(0,t.literal)(null),(0,t.boolean)(),(0,t.define)("finite number",(e=>(0,t.is)(e,(0,t.number)())&&Number.isFinite(e))),(0,t.string)(),(0,t.array)((0,t.lazy)((()=>e.UnsafeJsonStruct))),(0,t.record)((0,t.string)(),(0,t.lazy)((()=>e.UnsafeJsonStruct)))]),e.JsonStruct=(0,t.coerce)(e.UnsafeJsonStruct,(0,t.any)(),(t=>((0,r.assertStruct)(t,e.UnsafeJsonStruct),JSON.parse(JSON.stringify(t,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))))),e.isValidJson=function(e){try{return a(e),!0}catch{return!1}},e.getSafeJson=a,e.getJsonSize=function(t){(0,r.assertStruct)(t,e.JsonStruct,"Invalid JSON value");const n=JSON.stringify(t);return(new TextEncoder).encode(n).byteLength},e.jsonrpc2="2.0",e.JsonRpcVersionStruct=(0,t.literal)(e.jsonrpc2),e.JsonRpcIdStruct=(0,t.nullable)((0,t.union)([(0,t.number)(),(0,t.string)()])),e.JsonRpcErrorStruct=(0,e.object)({code:(0,t.integer)(),message:(0,t.string)(),data:o(e.JsonStruct),stack:o((0,t.string)())}),e.JsonRpcParamsStruct=(0,t.union)([(0,t.record)((0,t.string)(),e.JsonStruct),(0,t.array)(e.JsonStruct)]),e.JsonRpcRequestStruct=(0,e.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,method:(0,t.string)(),params:o(e.JsonRpcParamsStruct)}),e.JsonRpcNotificationStruct=(0,e.object)({jsonrpc:e.JsonRpcVersionStruct,method:(0,t.string)(),params:o(e.JsonRpcParamsStruct)}),e.isJsonRpcNotification=function(r){return(0,t.is)(r,e.JsonRpcNotificationStruct)},e.assertIsJsonRpcNotification=function(t,n){(0,r.assertStruct)(t,e.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",n)},e.isJsonRpcRequest=function(r){return(0,t.is)(r,e.JsonRpcRequestStruct)},e.assertIsJsonRpcRequest=function(t,n){(0,r.assertStruct)(t,e.JsonRpcRequestStruct,"Invalid JSON-RPC request",n)},e.PendingJsonRpcResponseStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:(0,t.optional)((0,t.unknown)()),error:(0,t.optional)(e.JsonRpcErrorStruct)}),e.JsonRpcSuccessStruct=(0,e.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:e.JsonStruct}),e.JsonRpcFailureStruct=(0,e.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,error:e.JsonRpcErrorStruct}),e.JsonRpcResponseStruct=(0,t.union)([e.JsonRpcSuccessStruct,e.JsonRpcFailureStruct]),e.isPendingJsonRpcResponse=function(r){return(0,t.is)(r,e.PendingJsonRpcResponseStruct)},e.assertIsPendingJsonRpcResponse=function(t,n){(0,r.assertStruct)(t,e.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",n)},e.isJsonRpcResponse=function(r){return(0,t.is)(r,e.JsonRpcResponseStruct)},e.assertIsJsonRpcResponse=function(t,n){(0,r.assertStruct)(t,e.JsonRpcResponseStruct,"Invalid JSON-RPC response",n)},e.isJsonRpcSuccess=function(r){return(0,t.is)(r,e.JsonRpcSuccessStruct)},e.assertIsJsonRpcSuccess=function(t,n){(0,r.assertStruct)(t,e.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",n)},e.isJsonRpcFailure=function(r){return(0,t.is)(r,e.JsonRpcFailureStruct)},e.assertIsJsonRpcFailure=function(t,n){(0,r.assertStruct)(t,e.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",n)},e.isJsonRpcError=function(r){return(0,t.is)(r,e.JsonRpcErrorStruct)},e.assertIsJsonRpcError=function(t,n){(0,r.assertStruct)(t,e.JsonRpcErrorStruct,"Invalid JSON-RPC error",n)},e.getJsonRpcIdValidator=function(e){const{permitEmptyString:t,permitFractions:r,permitNull:n}={permitEmptyString:!0,permitFractions:!1,permitNull:!0,...e};return e=>Boolean("number"==typeof e&&(r||Number.isInteger(e))||"string"==typeof e&&(t||e.length>0)||n&&null===e)}}(Gce);var qce={};Object.defineProperty(qce,"__esModule",{value:!0});var Kce={},Vce=o&&o.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Kce,"__esModule",{value:!0}),Kce.createModuleLogger=Kce.createProjectLogger=void 0;const Wce=(0,Vce(Tc).default)("metamask");Kce.createProjectLogger=function(e){return Wce.extend(e)},Kce.createModuleLogger=function(e,t){return e.extend(t)};var Jce={};Object.defineProperty(Jce,"__esModule",{value:!0}),Jce.hexToBigInt=Jce.hexToNumber=Jce.bigIntToHex=Jce.numberToHex=void 0;const Zce=bse,Yce=wce();Jce.numberToHex=e=>((0,Zce.assert)("number"==typeof e,"Value must be a number."),(0,Zce.assert)(e>=0,"Value must be a non-negative number."),(0,Zce.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,Yce.add0x)(e.toString(16)));Jce.bigIntToHex=e=>((0,Zce.assert)("bigint"==typeof e,"Value must be a bigint."),(0,Zce.assert)(e>=0,"Value must be a non-negative bigint."),(0,Yce.add0x)(e.toString(16)));Jce.hexToNumber=e=>{(0,Yce.assertIsHexString)(e);const t=parseInt(e,16);return(0,Zce.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t};Jce.hexToBigInt=e=>((0,Yce.assertIsHexString)(e),BigInt((0,Yce.add0x)(e)));var Xce={};Object.defineProperty(Xce,"__esModule",{value:!0});var Qce={};Object.defineProperty(Qce,"__esModule",{value:!0}),Qce.createDeferredPromise=void 0,Qce.createDeferredPromise=function({suppressUnhandledRejection:e=!1}={}){let t,r;const n=new Promise(((e,n)=>{t=e,r=n}));return e&&n.catch((e=>{})),{promise:n,resolve:t,reject:r}};var eue={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.timeSince=e.inMilliseconds=e.Duration=void 0,(t=e.Duration||(e.Duration={}))[t.Millisecond=1]="Millisecond",t[t.Second=1e3]="Second",t[t.Minute=6e4]="Minute",t[t.Hour=36e5]="Hour",t[t.Day=864e5]="Day",t[t.Week=6048e5]="Week",t[t.Year=31536e6]="Year";const r=(e,t)=>{if(!(e=>Number.isInteger(e)&&e>=0)(e))throw new Error(`"${t}" must be a non-negative integer. Received: "${e}".`)};e.inMilliseconds=function(e,t){return r(e,"count"),e*t},e.timeSince=function(e){return r(e,"timestamp"),Date.now()-e}}(eue);var tue={};Object.defineProperty(tue,"__esModule",{value:!0});var rue={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.satisfiesVersionRange=e.gtRange=e.gtVersion=e.assertIsSemVerRange=e.assertIsSemVerVersion=e.isValidSemVerRange=e.isValidSemVerVersion=e.VersionRangeStruct=e.VersionStruct=void 0;const t=gse,r=Xl,n=bse;e.VersionStruct=(0,t.refine)((0,t.string)(),"Version",(e=>null!==(0,r.valid)(e)||`Expected SemVer version, got "${e}"`)),e.VersionRangeStruct=(0,t.refine)((0,t.string)(),"Version range",(e=>null!==(0,r.validRange)(e)||`Expected SemVer range, got "${e}"`)),e.isValidSemVerVersion=function(r){return(0,t.is)(r,e.VersionStruct)},e.isValidSemVerRange=function(r){return(0,t.is)(r,e.VersionRangeStruct)},e.assertIsSemVerVersion=function(t){(0,n.assertStruct)(t,e.VersionStruct)},e.assertIsSemVerRange=function(t){(0,n.assertStruct)(t,e.VersionRangeStruct)},e.gtVersion=function(e,t){return(0,r.gt)(e,t)},e.gtRange=function(e,t){return(0,r.gtr)(e,t)},e.satisfiesVersionRange=function(e,t){return(0,r.satisfies)(e,t,{includePrerelease:!0})}}(rue),function(e){var t=o&&o.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=o&&o.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(bse,e),r(dce,e),r(Ece(),e),r(Ace,e),r(xce,e),r(Sce,e),r(jce,e),r(Hce,e),r(Wse,e),r(wce(),e),r(Gce,e),r(qce,e),r(Kce,e),r(nce,e),r(Jce,e),r(Xce,e),r(Qce,e),r(eue,e),r(tue,e),r(rue,e)}(mse),Object.defineProperty(pse,"__esModule",{value:!0}),pse.normalize=pse.recoverPublicKey=pse.concatSig=pse.legacyToBuffer=pse.isNullish=pse.padWithZeroes=void 0;const nue=g4,iue=mse;function oue(e,t){if(""!==e&&!/^[a-f0-9]+$/iu.test(e))throw new Error(`Expected an unprefixed hex string. Received: ${e}`);if(t<0)throw new Error(`Expected a non-negative integer target length. Received: ${t}`);return String.prototype.padStart.call(e,t,"0")}function aue(e){return null==e}pse.padWithZeroes=oue,pse.isNullish=aue,pse.legacyToBuffer=function(e){return"string"!=typeof e||(0,nue.isHexString)(e)?(0,nue.toBuffer)(e):_.from(e)},pse.concatSig=function(e,t,r){const n=(0,nue.fromSigned)(t),i=(0,nue.fromSigned)(r),o=(0,nue.bufferToInt)(e),a=oue((0,nue.toUnsigned)(n).toString("hex"),64),s=oue((0,nue.toUnsigned)(i).toString("hex"),64),c=(0,iue.remove0x)((0,iue.numberToHex)(o));return(0,iue.add0x)(a.concat(s,c))},pse.recoverPublicKey=function(e,t){const r=(0,nue.fromRpcSig)(t);return(0,nue.ecrecover)(e,r.v,r.r,r.s)},pse.normalize=function(e){if(!aue(e)){if("number"==typeof e){if(e<0)return"0x";const t=(0,iue.numberToBytes)(e);e=(0,iue.bytesToHex)(t)}if("string"!=typeof e){let t="eth-sig-util.normalize() requires hex string or integer input.";throw t+=` received ${typeof e}: ${e}`,new Error(t)}return(0,iue.add0x)(e.toLowerCase())}},Object.defineProperty(b4,"__esModule",{value:!0}),b4.extractPublicKey=b4.recoverPersonalSignature=b4.personalSign=void 0;const sue=g4,cue=pse;function uue(e,t){const r=(0,sue.hashPersonalMessage)((0,cue.legacyToBuffer)(e));return(0,cue.recoverPublicKey)(r,t)}b4.personalSign=function({privateKey:e,data:t}){if((0,cue.isNullish)(t))throw new Error("Missing data parameter");if((0,cue.isNullish)(e))throw new Error("Missing privateKey parameter");const r=(0,cue.legacyToBuffer)(t),n=(0,sue.hashPersonalMessage)(r),i=(0,sue.ecsign)(n,e);return(0,cue.concatSig)((0,sue.toBuffer)(i.v),i.r,i.s)},b4.recoverPersonalSignature=function({data:e,signature:t}){if((0,cue.isNullish)(e))throw new Error("Missing data parameter");if((0,cue.isNullish)(t))throw new Error("Missing signature parameter");const r=uue(e,t),n=(0,sue.publicToAddress)(r);return(0,sue.bufferToHex)(n)},b4.extractPublicKey=function({data:e,signature:t}){if((0,cue.isNullish)(e))throw new Error("Missing data parameter");if((0,cue.isNullish)(t))throw new Error("Missing signature parameter");return`0x${uue(e,t).toString("hex")}`};var lue={},fue={},due={},hue={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ParserError=e.getErrorStack=e.getErrorMessage=void 0;const t=mse;e.getErrorMessage=e=>"string"==typeof e?e:e instanceof Error||(0,t.isObject)(e)&&(0,t.hasProperty)(e,"message")&&"string"==typeof e.message?e.message:"Unknown error.";e.getErrorStack=e=>{if(e instanceof Error)return e.stack};class r extends Error{constructor(t,r){super(t),this.name="ParserError";const n=(0,e.getErrorStack)(r);n&&(this.stack=n)}}e.ParserError=r}(hue);var pue={},mue={};Object.defineProperty(mue,"__esModule",{value:!0}),mue.iterate=void 0;const bue=mse;mue.iterate=function*(e,t=32){for(let r=0;r{(0,bue.assert)(e>=0,"Cannot skip a negative number of bytes."),(0,bue.assert)(e%t==0,"Length must be a multiple of the size."),r+=e},i=e.subarray(r);yield{skip:n,value:i}}return{skip:()=>{},value:new Uint8Array}};var gue={},yue={},vue={},wue={};Object.defineProperty(wue,"__esModule",{value:!0}),wue.padEnd=wue.padStart=wue.set=void 0;const Eue=mse;wue.set=(e,t,r)=>(0,Eue.concatBytes)([e.subarray(0,r),t,e.subarray(r+t.length)]);wue.padStart=(e,t=32)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,Eue.concatBytes)([r,e])};wue.padEnd=(e,t=32)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,Eue.concatBytes)([e,r])},function(e){var t=o&&o.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=o&&o.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(wue,e)}(vue),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.address=e.getAddress=void 0;const t=mse,r=hue,n=vue;e.getAddress=e=>{const i=(0,t.createBytes)(e);return(0,t.assert)(i.length<=20,new r.ParserError(`Invalid address value. Expected address to be 20 bytes long, but received ${i.length} bytes.`)),(0,n.padStart)(i,20)},e.address={isDynamic:!1,isType:e=>"address"===e,getByteLength:()=>32,encode({buffer:r,value:i,packed:o}){const a=(0,e.getAddress)(i);if(o)return(0,t.concatBytes)([r,a]);const s=(0,n.padStart)(a);return(0,t.concatBytes)([r,s])},decode:({value:e})=>(0,t.add0x)((0,t.bytesToHex)(e.slice(12,32)))}}(yue);var Aue={},xue={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fixedBytes=e.getByteLength=void 0;const t=mse,r=hue,n=vue,i=/^bytes([0-9]{1,2})$/u;e.getByteLength=e=>{const n=e.match(i)?.[1];(0,t.assert)(n,`Invalid byte length. Expected a number between 1 and 32, but received "${e}".`);const o=Number(n);return(0,t.assert)(o>0&&o<=32,new r.ParserError(`Invalid byte length. Expected a number between 1 and 32, but received "${e}".`)),o},e.fixedBytes={isDynamic:!1,isType:e=>i.test(e),getByteLength:()=>32,encode({type:i,buffer:o,value:a,packed:s}){const c=(0,e.getByteLength)(i),u=(0,t.createBytes)(a);return(0,t.assert)(u.length<=c,new r.ParserError(`Expected a value of length ${c}, but received a value of length ${u.length}.`)),s?(0,t.concatBytes)([o,(0,n.padEnd)(u,c)]):(0,t.concatBytes)([o,(0,n.padEnd)(u)])},decode({type:t,value:r}){const n=(0,e.getByteLength)(t);return r.slice(0,n)}}}(xue);var _ue,kue,Sue={};function Pue(){return _ue||(_ue=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.tuple=e.getTupleElements=void 0;const t=mse,r=hue,n=zue(),i=/^\((.+)\)$/u;e.getTupleElements=e=>{(0,t.assert)(e.startsWith("(")&&e.endsWith(")"),new r.ParserError(`Invalid tuple type. Expected tuple type, but received "${e}".`));const n=[];let i="",o=0;for(let t=1;t(0,e.getTupleElements)(t).some((e=>{const t=(0,n.getParser)(e);return(0,n.isDynamicParser)(t,e)})),isType:e=>(e=>i.test(e))(e),getByteLength(t){if((0,n.isDynamicParser)(this,t))return 32;return(0,e.getTupleElements)(t).reduce(((e,t)=>e+(0,n.getParser)(t).getByteLength(t)),0)},encode({type:t,buffer:r,value:i,packed:o,tight:a}){const s=(0,e.getTupleElements)(t);return(0,n.pack)({types:s,values:i,byteArray:r,packed:o,tight:a})},decode({type:t,value:r,skip:i}){const o=(0,e.getTupleElements)(t);return i(this.getByteLength(t)-32),(0,n.unpack)(o,r)}}}(Sue)),Sue}var Iue={},Tue={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.number=e.getBigInt=e.assertNumberLength=e.getLength=e.isSigned=void 0;const t=mse,r=hue,n=vue,i=/^u?int(?[0-9]*)?$/u;e.isSigned=e=>!e.startsWith("u");e.getLength=e=>{if("int"===e||"uint"===e)return 256;const n=e.match(i);(0,t.assert)(n?.groups?.length,new r.ParserError(`Invalid number type. Expected a number type, but received "${e}".`));const o=parseInt(n.groups.length,10);return(0,t.assert)(o>=8&&o<=256,new r.ParserError(`Invalid number length. Expected a number between 8 and 256, but received "${e}".`)),(0,t.assert)(o%8==0,new r.ParserError(`Invalid number length. Expected a multiple of 8, but received "${e}".`)),o};e.assertNumberLength=(n,i)=>{const o=(0,e.getLength)(i),a=BigInt(2)**BigInt(o-((0,e.isSigned)(i)?1:0))-BigInt(1);(0,e.isSigned)(i)?(0,t.assert)(n>=-(a+BigInt(1))&&n<=a,new r.ParserError(`Number "${n}" is out of range for type "${i}".`)):(0,t.assert)(n<=a,new r.ParserError(`Number "${n}" is out of range for type "${i}".`))};e.getBigInt=e=>{try{return(0,t.createBigInt)(e)}catch{throw new r.ParserError(`Invalid number. Expected a valid number value, but received "${e}".`)}},e.number={isDynamic:!1,isType:e=>i.test(e),getByteLength:()=>32,encode({type:r,buffer:i,value:o,packed:a}){const s=(0,e.getBigInt)(o);if((0,e.assertNumberLength)(s,r),(0,e.isSigned)(r)){if(a){const n=(0,e.getLength)(r)/8;return(0,t.concatBytes)([i,(0,t.signedBigIntToBytes)(s,n)])}return(0,t.concatBytes)([i,(0,n.padStart)((0,t.signedBigIntToBytes)(s,32))])}if(a){const o=(0,e.getLength)(r)/8;return(0,t.concatBytes)([i,(0,n.padStart)((0,t.bigIntToBytes)(s),o)])}return(0,t.concatBytes)([i,(0,n.padStart)((0,t.bigIntToBytes)(s))])},decode({type:r,value:n}){const i=n.subarray(0,32);if((0,e.isSigned)(r)){const n=(0,t.bytesToSignedBigInt)(i);return(0,e.assertNumberLength)(n,r),n}const o=(0,t.bytesToBigInt)(i);return(0,e.assertNumberLength)(o,r),o}}}(Tue),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.bool=e.getBooleanValue=void 0;const t=gse,r=mse,n=hue,i=Tue,o=(0,t.coerce)((0,t.boolean)(),(0,t.union)([(0,t.literal)("true"),(0,t.literal)("false")]),(e=>"true"===e));e.getBooleanValue=e=>{try{return(0,t.create)(e,o)?BigInt(1):BigInt(0)}catch{throw new n.ParserError(`Invalid boolean value. Expected a boolean literal, or the string "true" or "false", but received "${e}".`)}},e.bool={isDynamic:!1,isType:e=>"bool"===e,getByteLength:()=>32,encode({buffer:t,value:n,packed:o,tight:a}){const s=(0,e.getBooleanValue)(n);return o?(0,r.concatBytes)([t,(0,r.bigIntToBytes)(s)]):i.number.encode({type:"uint256",buffer:t,value:s,packed:o,tight:a})},decode:e=>i.number.decode({...e,type:"uint256"})===BigInt(1)}}(Iue);var Oue={};Object.defineProperty(Oue,"__esModule",{value:!0}),Oue.bytes=void 0;const Mue=mse,Cue=vue;Oue.bytes={isDynamic:!0,isType:e=>"bytes"===e,getByteLength:()=>32,encode({buffer:e,value:t,packed:r}){const n=(0,Mue.createBytes)(t);if(r)return(0,Mue.concatBytes)([e,n]);const i=32*Math.ceil(n.byteLength/32);return(0,Mue.concatBytes)([e,(0,Cue.padStart)((0,Mue.numberToBytes)(n.byteLength)),(0,Cue.padEnd)(n,i)])},decode({value:e}){const t=e.subarray(0,32),r=(0,Mue.bytesToNumber)(t);return e.slice(32,32+r)}};var Bue={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fn=e.getFunction=void 0;const t=gse,r=mse,n=hue,i=xue,o=(0,t.coerce)((0,t.object)({address:r.StrictHexStruct,selector:r.StrictHexStruct}),(0,t.union)([r.StrictHexStruct,(0,t.instance)(Uint8Array)]),(e=>{const t=(0,r.createBytes)(e);return(0,r.assert)(24===t.length,new n.ParserError(`Invalid Solidity function. Expected function to be 24 bytes long, but received ${t.length} bytes.`)),{address:(0,r.bytesToHex)(t.subarray(0,20)),selector:(0,r.bytesToHex)(t.subarray(20,24))}}));e.getFunction=e=>{const n=(0,t.create)(e,o);return(0,r.concatBytes)([(0,r.hexToBytes)(n.address),(0,r.hexToBytes)(n.selector)])},e.fn={isDynamic:!1,isType:e=>"function"===e,getByteLength:()=>32,encode({buffer:t,value:r,packed:n,tight:o}){const a=(0,e.getFunction)(r);return i.fixedBytes.encode({type:"bytes24",buffer:t,value:a,packed:n,tight:o})},decode:({value:e})=>({address:(0,r.bytesToHex)(e.slice(0,20)),selector:(0,r.bytesToHex)(e.slice(20,24))})}}(Bue);var Nue={};Object.defineProperty(Nue,"__esModule",{value:!0});var Rue={};Object.defineProperty(Rue,"__esModule",{value:!0}),Rue.string=void 0;const Fue=mse,Lue=Oue;var jue,Uue;function Due(){return jue||(jue=1,function(e){var t=o&&o.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=o&&o.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(yue,e),r((kue||(kue=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.array=e.getTupleType=e.getArrayType=e.isArrayType=void 0;const t=mse,r=hue,n=zue(),i=vue,o=xue,a=Pue(),s=/^(?.*)\[(?\d*?)\]$/u;e.isArrayType=e=>s.test(e),e.getArrayType=e=>{const n=e.match(s);return(0,t.assert)(n?.groups?.type,new r.ParserError(`Invalid array type. Expected an array type, but received "${e}".`)),[n.groups.type,n.groups.length?parseInt(n.groups.length,10):void 0]},e.getTupleType=(e,t)=>`(${new Array(t).fill(e).join(",")})`,e.array={isDynamic(t){const[r,i]=(0,e.getArrayType)(t);return void 0===i||(0,n.isDynamicParser)((0,n.getParser)(r),r)},isType:t=>(0,e.isArrayType)(t),getByteLength(i){(0,t.assert)((0,e.isArrayType)(i),new r.ParserError(`Expected an array type, but received "${i}".`));const[o,s]=(0,e.getArrayType)(i);return(0,n.isDynamicParser)(this,i)||void 0===s?32:a.tuple.getByteLength((0,e.getTupleType)(o,s))},encode({type:s,buffer:c,value:u,packed:l,tight:f}){const[d,h]=(0,e.getArrayType)(s);if((0,t.assert)(!l||!(0,e.isArrayType)(d),new r.ParserError("Cannot pack nested arrays.")),l&&(0,n.isDynamicParser)((0,n.getParser)(d),d))return(0,n.pack)({types:new Array(u.length).fill(d),values:u,byteArray:c,packed:l,arrayPacked:!0,tight:f});if(h)return(0,t.assert)(h===u.length,new r.ParserError(`Array length does not match type length. Expected a length of ${h}, but received ${u.length}.`)),a.tuple.encode({type:(0,e.getTupleType)(d,h),buffer:c,value:u,packed:o.fixedBytes.isType(d)&&f,tight:f});if(l)return(0,n.pack)({types:new Array(u.length).fill(d),values:u,byteArray:c,packed:o.fixedBytes.isType(d)&&f,arrayPacked:!0,tight:f});const p=(0,i.padStart)((0,t.numberToBytes)(u.length));return(0,n.pack)({types:new Array(u.length).fill(d),values:u,byteArray:(0,t.concatBytes)([c,p]),packed:l,tight:f})},decode({type:i,value:o,...s}){const[c,u]=(0,e.getArrayType)(i);if(u){const n=a.tuple.decode({type:(0,e.getTupleType)(c,u),value:o,...s});return(0,t.assert)(n.length===u,new r.ParserError(`Array length does not match type length. Expected a length of ${u}, but received ${n.length}.`)),n}const l=(0,t.bytesToNumber)(o.subarray(0,32));return(0,n.unpack)(new Array(l).fill(c),o.subarray(32))}}}(Aue)),Aue),e),r(Iue,e),r(Oue,e),r(xue,e),r(Bue,e),r(Tue,e),r(Nue,e),r(Rue,e),r(Pue(),e)}(gue)),gue}function zue(){return Uue||(Uue=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.unpack=e.pack=e.isDynamicParser=e.getParser=void 0;const t=mse,r=hue,n=mue,i=Due(),o=vue;e.getParser=e=>{const t={address:i.address,array:i.array,bool:i.bool,bytes:i.bytes,fixedBytes:i.fixedBytes,function:i.fn,number:i.number,string:i.string,tuple:i.tuple},n=t[e];if(n)return n;const o=Object.values(t).find((t=>t.isType(e)));if(o)return o;throw new r.ParserError(`The type "${e}" is not supported.`)};e.isDynamicParser=(e,t)=>{const{isDynamic:r}=e;return"function"==typeof r?r(t):r};e.pack=({types:n,values:i,packed:a=!1,tight:s=!1,arrayPacked:c=!1,byteArray:u=new Uint8Array})=>{(0,t.assert)(n.length===i.length,new r.ParserError(`The number of types (${n.length}) does not match the number of values (${i.length}).`));const{staticBuffer:l,dynamicBuffer:f,pointers:d}=n.reduce((({staticBuffer:r,dynamicBuffer:n,pointers:o},u,l)=>{const f=(0,e.getParser)(u),d=i[l];if(a||c||!(0,e.isDynamicParser)(f,u))return{staticBuffer:f.encode({buffer:r,value:d,type:u,packed:a,tight:s}),dynamicBuffer:n,pointers:o};return{staticBuffer:(0,t.concatBytes)([r,new Uint8Array(32)]),dynamicBuffer:f.encode({buffer:n,value:d,type:u,packed:a,tight:s}),pointers:[...o,{position:r.length,pointer:n.length}]}}),{staticBuffer:new Uint8Array,dynamicBuffer:new Uint8Array,pointers:[]});(0,t.assert)(!a&&!c||0===f.length,new r.ParserError("Invalid pack state."));const h=l.length,p=d.reduce(((e,{pointer:r,position:n})=>{const i=(0,o.padStart)((0,t.numberToBytes)(h+r));return(0,o.set)(e,i,n)}),l);return(0,t.concatBytes)([u,p,f])};e.unpack=(i,o)=>{const a=(0,n.iterate)(o);return i.map((n=>{const{value:{value:i,skip:s},done:c}=a.next();(0,t.assert)(!c,new r.ParserError(`The encoded value is invalid for the provided types. Reached end of buffer while attempting to parse "${n}".`));const u=(0,e.getParser)(n);if((0,e.isDynamicParser)(u,n)){const e=(0,t.bytesToNumber)(i.subarray(0,32)),r=o.subarray(e);return u.decode({type:n,value:r,skip:s})}return u.decode({type:n,value:i,skip:s})}))}}(pue)),pue}Rue.string={isDynamic:!0,isType:e=>"string"===e,getByteLength:()=>32,encode:({buffer:e,value:t,packed:r,tight:n})=>Lue.bytes.encode({type:"bytes",buffer:e,value:(0,Fue.stringToBytes)(t),packed:r,tight:n}),decode:e=>(0,Fue.bytesToString)(Lue.bytes.decode(e))},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeSingle=e.decode=e.encodePacked=e.encodeSingle=e.encode=void 0;const t=mse,r=hue,n=zue();e.encode=(e,t,i,o)=>{try{return(0,n.pack)({types:e,values:t,packed:i,tight:o})}catch(e){if(e instanceof r.ParserError)throw new r.ParserError(`Unable to encode value: ${e.message}`,e);throw new r.ParserError(`An unexpected error occurred: ${(0,r.getErrorMessage)(e)}`,e)}};e.encodeSingle=(t,r)=>(0,e.encode)([t],[r]);e.encodePacked=(t,r,n)=>(0,e.encode)(t,r,!0,n);e.decode=(e,i)=>{const o=(0,t.createBytes)(i);try{return(0,n.unpack)(e,o)}catch(e){if(e instanceof r.ParserError)throw new r.ParserError(`Unable to decode value: ${e.message}`,e);throw new r.ParserError(`An unexpected error occurred: ${(0,r.getErrorMessage)(e)}`,e)}};e.decodeSingle=(n,i)=>{const o=(0,e.decode)([n],i);return(0,t.assert)(1===o.length,new r.ParserError("Decoded value array has unexpected length.")),o[0]}}(due);var $ue={},Hue={};Object.defineProperty(Hue,"__esModule",{value:!0}),function(e){var t=o&&o.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=o&&o.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(Hue,e)}($ue),function(e){var t=o&&o.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=o&&o.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(due,e),r(hue,e),r($ue,e)}(fue),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.recoverTypedSignature=e.signTypedData=e.typedSignatureHash=e.TypedDataUtils=e.TYPED_MESSAGE_SCHEMA=e.SignTypedDataVersion=void 0;const t=g4,r=fue,n=Due(),i=vue,o=mse,a=h7,s=pse;var c;function u(e,t){if(!Object.keys(c).includes(e))throw new Error(`Invalid version: '${e}'`);if(t&&!t.includes(e))throw new Error(`SignTypedDataVersion not allowed: '${e}'. Allowed versions are: ${t.join(", ")}`)}function l(e,t){(0,o.assert)(null!==t,`Unable to encode value: Invalid number. Expected a valid number value, but received "${t}".`);const r=BigInt(t),i=(0,n.getLength)(e),a=BigInt(2)**BigInt(i)-BigInt(1);return(0,o.assert)(r>=-a&&r<=a,`Unable to encode value: Number "${t}" is out of range for type "${e}".`),r}function f(e){let t=BigInt(0);for(let r=0;r=49?n-BigInt(49)+BigInt(10):n>=17?n-BigInt(17)+BigInt(10):n}return(0,i.padStart)((0,o.bigIntToBytes)(t),20)}function d(e,n,s,p,m){if(u(m,[c.V3,c.V4]),void 0!==e[s])return["bytes32",m===c.V4&&null==p?"0x0000000000000000000000000000000000000000000000000000000000000000":(0,t.arrToBufArr)((0,a.keccak256)(h(s,p,e,m)))];if("function"===s)throw new Error('Unsupported or invalid type: "function"');if(void 0===p)throw new Error(`missing value for field ${n} of type ${s}`);if("address"===s){if("number"==typeof p)return["address",(0,i.padStart)((0,o.numberToBytes)(p),20)];if((0,o.isStrictHexString)(p))return["address",(0,o.add0x)(p)];if("string"==typeof p)return["address",f(p).subarray(0,20)]}if("bool"===s)return["bool",Boolean(p)];if("bytes"===s)return"number"==typeof p?p=(0,o.numberToBytes)(p):(0,o.isStrictHexString)(p)||"0x"===p?p=(0,o.hexToBytes)(p):"string"==typeof p&&(p=(0,o.stringToBytes)(p)),["bytes32",(0,t.arrToBufArr)((0,a.keccak256)(p))];if(s.startsWith("bytes")&&"bytes"!==s&&!s.includes("["))return"number"==typeof p?p<0?["bytes32",new Uint8Array(32)]:["bytes32",(0,o.bigIntToBytes)(BigInt(p))]:(0,o.isStrictHexString)(p)?["bytes32",(0,o.hexToBytes)(p)]:["bytes32",p];if(s.startsWith("int")&&!s.includes("[")){const e=l(s,p);return e>=BigInt(0)?["uint256",e]:["int256",e]}if("string"===s)return p="number"==typeof p?(0,o.numberToBytes)(p):(0,o.stringToBytes)(null!=p?p:""),["bytes32",(0,t.arrToBufArr)((0,a.keccak256)(p))];if(s.endsWith("]")){if(m===c.V3)throw new Error("Arrays are unimplemented in encodeData; use V4 extension");const i=s.slice(0,s.lastIndexOf("[")),o=p.map((t=>d(e,n,i,t,m)));return["bytes32",(0,t.arrToBufArr)((0,a.keccak256)((0,r.encode)(o.map((([e])=>e)),o.map((([,e])=>e)))))]}return[s,p]}function h(e,n,i,o){u(o,[c.V3,c.V4]);const a=["bytes32"],s=[g(e,i)];for(const t of i[e]){if(o===c.V3&&void 0===n[t.name])continue;const[e,r]=d(i,t.name,t.type,n[t.name],o);a.push(e),s.push(r)}return(0,t.arrToBufArr)((0,r.encode)(a,s))}function p(e,t){let r="";const n=m(e,t);n.delete(e);const i=[e,...Array.from(n).sort()];for(const e of i){if(!t[e])throw new Error(`No type definition specified: ${e}`);r+=`${e}(${t[e].map((({name:e,type:t})=>`${t} ${e}`)).join(",")})`}return r}function m(e,t,r=new Set){if("string"!=typeof e)throw new Error(`Invalid findTypeDependencies input ${JSON.stringify(e)}`);const n=e.match(/^\w*/u);if([e]=n,r.has(e)||void 0===t[e])return r;r.add(e);for(const n of t[e])m(n.type,t,r);return r}function b(e,r,n,i){u(i,[c.V3,c.V4]);const o=h(e,r,n,i),s=(0,a.keccak256)(o);return(0,t.arrToBufArr)(s)}function g(e,r){const n=(0,o.stringToBytes)(p(e,r));return(0,t.arrToBufArr)((0,a.keccak256)(n))}function y(t){const r={};for(const n in e.TYPED_MESSAGE_SCHEMA.properties)t[n]&&(r[n]=t[n]);return"types"in r&&(r.types=Object.assign({EIP712Domain:[]},r.types)),r}function v(e,t){u(t,[c.V3,c.V4]);const r=y(e),{domain:n}=r;return b("EIP712Domain",n,{EIP712Domain:r.types.EIP712Domain},t)}function w(e,t){if((0,n.isArrayType)(e)&&Array.isArray(t)){const[r]=(0,n.getArrayType)(e);return t.map((e=>w(r,e)))}if("address"===e){if("number"==typeof t)return(0,i.padStart)((0,o.numberToBytes)(t),20);if((0,o.isStrictHexString)(t))return(0,i.padStart)((0,o.hexToBytes)(t).subarray(0,20),20);if(t instanceof Uint8Array)return(0,i.padStart)(t.subarray(0,20),20)}if("bool"===e)return Boolean(t);if(e.startsWith("bytes")&&"bytes"!==e){const r=(0,n.getByteLength)(e);if("number"==typeof t)return t<0?new Uint8Array:(0,o.numberToBytes)(t).subarray(0,r);if((0,o.isStrictHexString)(t))return(0,o.hexToBytes)(t).subarray(0,r);if(t instanceof Uint8Array)return t.subarray(0,r)}if(e.startsWith("uint")&&"number"==typeof t)return Math.abs(t);if(e.startsWith("int")&&"number"==typeof t){const r=(0,n.getLength)(e);return BigInt.asIntN(r,BigInt(t))}return t}function E(e,t){return t.map((t=>{if("string"==typeof t||"number"==typeof t||"bigint"==typeof t){const r=l(e,t);if(r>=BigInt(0))return(0,i.padStart)((0,o.bigIntToBytes)(r),32);const a=(0,n.getLength)(e),s=BigInt.asIntN(a,r);return(0,o.signedBigIntToBytes)(s,32)}return t}))}function A(e){const c=new Error("Expect argument to be non-empty array");if("object"!=typeof e||!("length"in e)||!e.length)throw c;const u=e.map((({name:e,type:t,value:r})=>{if("address[]"===t)return{name:e,type:"bytes32[]",value:(a=r,a.map((e=>"number"==typeof e?(0,i.padStart)((0,o.numberToBytes)(e),32):(0,o.isStrictHexString)(e)?(0,i.padStart)((0,o.hexToBytes)(e).subarray(0,32),32):e instanceof Uint8Array?(0,i.padStart)(e.subarray(0,32),32):e)))};var a;if(t.startsWith("int")&&(0,n.isArrayType)(t)){const[i,o]=(0,n.getArrayType)(t);return{name:e,type:`bytes32[${null!=o?o:""}]`,value:E(i,r)}}return{name:e,type:t,value:w(t,r)}})),l=u.map((e=>"bytes"!==e.type?e.value:(0,s.legacyToBuffer)(e.value))),f=u.map((e=>{if("function"===e.type)throw new Error('Unsupported or invalid type: "function"');return e.type})),d=e.map((e=>{if(!e.name)throw c;return`${e.type} ${e.name}`}));return(0,t.arrToBufArr)((0,a.keccak256)((0,r.encodePacked)(["bytes32","bytes32"],[(0,a.keccak256)((0,r.encodePacked)(["string[]"],[d],!0)),(0,a.keccak256)((0,r.encodePacked)(f,l,!0))])))}!function(e){e.V1="V1",e.V3="V3",e.V4="V4"}(c=e.SignTypedDataVersion||(e.SignTypedDataVersion={})),e.TYPED_MESSAGE_SCHEMA={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},e.TypedDataUtils={encodeData:h,encodeType:p,findTypeDependencies:m,hashStruct:b,hashType:g,sanitizeData:y,eip712Hash:function(e,r){u(r,[c.V3,c.V4]);const n=y(e),i=[(0,o.hexToBytes)("1901")];return i.push(v(e,r)),"EIP712Domain"!==n.primaryType&&i.push(b(n.primaryType,n.message,n.types,r)),(0,t.arrToBufArr)((0,a.keccak256)((0,o.concatBytes)(i)))},eip712DomainHash:v},e.typedSignatureHash=function(e){const t=A(e);return(0,o.bytesToHex)(t)},e.signTypedData=function({privateKey:r,data:n,version:i}){if(u(i),(0,s.isNullish)(n))throw new Error("Missing data parameter");if((0,s.isNullish)(r))throw new Error("Missing private key parameter");const a=i===c.V1?A(n):e.TypedDataUtils.eip712Hash(n,i),l=(0,t.ecsign)(a,r);return(0,s.concatSig)((0,t.arrToBufArr)((0,o.bigIntToBytes)(l.v)),l.r,l.s)},e.recoverTypedSignature=function({data:r,signature:n,version:i}){if(u(i),(0,s.isNullish)(r))throw new Error("Missing data parameter");if((0,s.isNullish)(n))throw new Error("Missing signature parameter");const a=i===c.V1?A(r):e.TypedDataUtils.eip712Hash(r,i),l=(0,s.recoverPublicKey)(a,n),f=(0,t.publicToAddress)(l);return(0,o.bytesToHex)(f)}}(lue);var Gue={},que={exports:{}};!function(e){!function(e){var t=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=n>>24&255,e[t+5]=n>>16&255,e[t+6]=n>>8&255,e[t+7]=255&n}function p(e,t,r,n,i){var o,a=0;for(o=0;o>>8)-1}function m(e,t,r,n){return p(e,t,r,n,16)}function b(e,t,r,n){return p(e,t,r,n,32)}function g(e,t,r,n){!function(e,t,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,d=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,m=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,b=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,y=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,E=o,A=a,x=s,_=c,k=u,S=l,P=f,I=d,T=h,O=p,M=m,C=b,B=g,N=y,R=v,F=w,L=0;L<20;L+=2)E^=(i=(B^=(i=(T^=(i=(k^=(i=E+B|0)<<7|i>>>25)+E|0)<<9|i>>>23)+k|0)<<13|i>>>19)+T|0)<<18|i>>>14,S^=(i=(A^=(i=(N^=(i=(O^=(i=S+A|0)<<7|i>>>25)+S|0)<<9|i>>>23)+O|0)<<13|i>>>19)+N|0)<<18|i>>>14,M^=(i=(P^=(i=(x^=(i=(R^=(i=M+P|0)<<7|i>>>25)+M|0)<<9|i>>>23)+R|0)<<13|i>>>19)+x|0)<<18|i>>>14,F^=(i=(C^=(i=(I^=(i=(_^=(i=F+C|0)<<7|i>>>25)+F|0)<<9|i>>>23)+_|0)<<13|i>>>19)+I|0)<<18|i>>>14,E^=(i=(_^=(i=(x^=(i=(A^=(i=E+_|0)<<7|i>>>25)+E|0)<<9|i>>>23)+A|0)<<13|i>>>19)+x|0)<<18|i>>>14,S^=(i=(k^=(i=(I^=(i=(P^=(i=S+k|0)<<7|i>>>25)+S|0)<<9|i>>>23)+P|0)<<13|i>>>19)+I|0)<<18|i>>>14,M^=(i=(O^=(i=(T^=(i=(C^=(i=M+O|0)<<7|i>>>25)+M|0)<<9|i>>>23)+C|0)<<13|i>>>19)+T|0)<<18|i>>>14,F^=(i=(R^=(i=(N^=(i=(B^=(i=F+R|0)<<7|i>>>25)+F|0)<<9|i>>>23)+B|0)<<13|i>>>19)+N|0)<<18|i>>>14;E=E+o|0,A=A+a|0,x=x+s|0,_=_+c|0,k=k+u|0,S=S+l|0,P=P+f|0,I=I+d|0,T=T+h|0,O=O+p|0,M=M+m|0,C=C+b|0,B=B+g|0,N=N+y|0,R=R+v|0,F=F+w|0,e[0]=E>>>0&255,e[1]=E>>>8&255,e[2]=E>>>16&255,e[3]=E>>>24&255,e[4]=A>>>0&255,e[5]=A>>>8&255,e[6]=A>>>16&255,e[7]=A>>>24&255,e[8]=x>>>0&255,e[9]=x>>>8&255,e[10]=x>>>16&255,e[11]=x>>>24&255,e[12]=_>>>0&255,e[13]=_>>>8&255,e[14]=_>>>16&255,e[15]=_>>>24&255,e[16]=k>>>0&255,e[17]=k>>>8&255,e[18]=k>>>16&255,e[19]=k>>>24&255,e[20]=S>>>0&255,e[21]=S>>>8&255,e[22]=S>>>16&255,e[23]=S>>>24&255,e[24]=P>>>0&255,e[25]=P>>>8&255,e[26]=P>>>16&255,e[27]=P>>>24&255,e[28]=I>>>0&255,e[29]=I>>>8&255,e[30]=I>>>16&255,e[31]=I>>>24&255,e[32]=T>>>0&255,e[33]=T>>>8&255,e[34]=T>>>16&255,e[35]=T>>>24&255,e[36]=O>>>0&255,e[37]=O>>>8&255,e[38]=O>>>16&255,e[39]=O>>>24&255,e[40]=M>>>0&255,e[41]=M>>>8&255,e[42]=M>>>16&255,e[43]=M>>>24&255,e[44]=C>>>0&255,e[45]=C>>>8&255,e[46]=C>>>16&255,e[47]=C>>>24&255,e[48]=B>>>0&255,e[49]=B>>>8&255,e[50]=B>>>16&255,e[51]=B>>>24&255,e[52]=N>>>0&255,e[53]=N>>>8&255,e[54]=N>>>16&255,e[55]=N>>>24&255,e[56]=R>>>0&255,e[57]=R>>>8&255,e[58]=R>>>16&255,e[59]=R>>>24&255,e[60]=F>>>0&255,e[61]=F>>>8&255,e[62]=F>>>16&255,e[63]=F>>>24&255}(e,t,r,n)}function y(e,t,r,n){!function(e,t,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,d=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,m=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,b=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,y=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,E=0;E<20;E+=2)o^=(i=(g^=(i=(h^=(i=(u^=(i=o+g|0)<<7|i>>>25)+o|0)<<9|i>>>23)+u|0)<<13|i>>>19)+h|0)<<18|i>>>14,l^=(i=(a^=(i=(y^=(i=(p^=(i=l+a|0)<<7|i>>>25)+l|0)<<9|i>>>23)+p|0)<<13|i>>>19)+y|0)<<18|i>>>14,m^=(i=(f^=(i=(s^=(i=(v^=(i=m+f|0)<<7|i>>>25)+m|0)<<9|i>>>23)+v|0)<<13|i>>>19)+s|0)<<18|i>>>14,w^=(i=(b^=(i=(d^=(i=(c^=(i=w+b|0)<<7|i>>>25)+w|0)<<9|i>>>23)+c|0)<<13|i>>>19)+d|0)<<18|i>>>14,o^=(i=(c^=(i=(s^=(i=(a^=(i=o+c|0)<<7|i>>>25)+o|0)<<9|i>>>23)+a|0)<<13|i>>>19)+s|0)<<18|i>>>14,l^=(i=(u^=(i=(d^=(i=(f^=(i=l+u|0)<<7|i>>>25)+l|0)<<9|i>>>23)+f|0)<<13|i>>>19)+d|0)<<18|i>>>14,m^=(i=(p^=(i=(h^=(i=(b^=(i=m+p|0)<<7|i>>>25)+m|0)<<9|i>>>23)+b|0)<<13|i>>>19)+h|0)<<18|i>>>14,w^=(i=(v^=(i=(y^=(i=(g^=(i=w+v|0)<<7|i>>>25)+w|0)<<9|i>>>23)+g|0)<<13|i>>>19)+y|0)<<18|i>>>14;e[0]=o>>>0&255,e[1]=o>>>8&255,e[2]=o>>>16&255,e[3]=o>>>24&255,e[4]=l>>>0&255,e[5]=l>>>8&255,e[6]=l>>>16&255,e[7]=l>>>24&255,e[8]=m>>>0&255,e[9]=m>>>8&255,e[10]=m>>>16&255,e[11]=m>>>24&255,e[12]=w>>>0&255,e[13]=w>>>8&255,e[14]=w>>>16&255,e[15]=w>>>24&255,e[16]=f>>>0&255,e[17]=f>>>8&255,e[18]=f>>>16&255,e[19]=f>>>24&255,e[20]=d>>>0&255,e[21]=d>>>8&255,e[22]=d>>>16&255,e[23]=d>>>24&255,e[24]=h>>>0&255,e[25]=h>>>8&255,e[26]=h>>>16&255,e[27]=h>>>24&255,e[28]=p>>>0&255,e[29]=p>>>8&255,e[30]=p>>>16&255,e[31]=p>>>24&255}(e,t,r,n)}var v=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function w(e,t,r,n,i,o,a){var s,c,u=new Uint8Array(16),l=new Uint8Array(64);for(c=0;c<16;c++)u[c]=0;for(c=0;c<8;c++)u[c]=o[c];for(;i>=64;){for(g(l,u,a,v),c=0;c<64;c++)e[t+c]=r[n+c]^l[c];for(s=1,c=8;c<16;c++)s=s+(255&u[c])|0,u[c]=255&s,s>>>=8;i-=64,t+=64,n+=64}if(i>0)for(g(l,u,a,v),c=0;c=64;){for(g(c,s,i,v),a=0;a<64;a++)e[t+a]=c[a];for(o=1,a=8;a<16;a++)o=o+(255&s[a])|0,s[a]=255&o,o>>>=8;r-=64,t+=64}if(r>0)for(g(c,s,i,v),a=0;a>>13|r<<3),n=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|n<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(n>>>7|i<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,a=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|a<<2),s=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(a>>>11|s<<5),c=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(s>>>8|c<<8),this.r[9]=c>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function k(e,t,r,n,i,o){var a=new _(o);return a.update(r,n,i),a.finish(e,t),0}function S(e,t,r,n,i,o){var a=new Uint8Array(16);return k(a,0,r,n,i,o),m(e,t,a,0)}function P(e,t,r,n,i){var o;if(r<32)return-1;for(x(e,0,t,0,r,n,i),k(e,16,e,32,r-32,e),o=0;o<16;o++)e[o]=0;return 0}function I(e,t,r,n,i){var o,a=new Uint8Array(32);if(r<32)return-1;if(A(a,0,32,n,i),0!==S(t,16,t,32,r-32,a))return-1;for(x(e,0,t,0,r,n,i),o=0;o<32;o++)e[o]=0;return 0}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function O(e){var t,r,n=1;for(t=0;t<16;t++)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function M(e,t,r){for(var n,i=~(r-1),o=0;o<16;o++)n=i&(e[o]^t[o]),e[o]^=n,t[o]^=n}function C(e,r){var n,i,o,a=t(),s=t();for(n=0;n<16;n++)s[n]=r[n];for(O(s),O(s),O(s),i=0;i<2;i++){for(a[0]=s[0]-65517,n=1;n<15;n++)a[n]=s[n]-65535-(a[n-1]>>16&1),a[n-1]&=65535;a[15]=s[15]-32767-(a[14]>>16&1),o=a[15]>>16&1,a[14]&=65535,M(s,a,1-o)}for(n=0;n<16;n++)e[2*n]=255&s[n],e[2*n+1]=s[n]>>8}function B(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return C(r,e),C(n,t),b(r,0,n,0)}function N(e){var t=new Uint8Array(32);return C(t,e),1&t[0]}function R(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function F(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function L(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function j(e,t,r){var n,i,o=0,a=0,s=0,c=0,u=0,l=0,f=0,d=0,h=0,p=0,m=0,b=0,g=0,y=0,v=0,w=0,E=0,A=0,x=0,_=0,k=0,S=0,P=0,I=0,T=0,O=0,M=0,C=0,B=0,N=0,R=0,F=r[0],L=r[1],j=r[2],U=r[3],D=r[4],z=r[5],$=r[6],H=r[7],G=r[8],q=r[9],K=r[10],V=r[11],W=r[12],J=r[13],Z=r[14],Y=r[15];o+=(n=t[0])*F,a+=n*L,s+=n*j,c+=n*U,u+=n*D,l+=n*z,f+=n*$,d+=n*H,h+=n*G,p+=n*q,m+=n*K,b+=n*V,g+=n*W,y+=n*J,v+=n*Z,w+=n*Y,a+=(n=t[1])*F,s+=n*L,c+=n*j,u+=n*U,l+=n*D,f+=n*z,d+=n*$,h+=n*H,p+=n*G,m+=n*q,b+=n*K,g+=n*V,y+=n*W,v+=n*J,w+=n*Z,E+=n*Y,s+=(n=t[2])*F,c+=n*L,u+=n*j,l+=n*U,f+=n*D,d+=n*z,h+=n*$,p+=n*H,m+=n*G,b+=n*q,g+=n*K,y+=n*V,v+=n*W,w+=n*J,E+=n*Z,A+=n*Y,c+=(n=t[3])*F,u+=n*L,l+=n*j,f+=n*U,d+=n*D,h+=n*z,p+=n*$,m+=n*H,b+=n*G,g+=n*q,y+=n*K,v+=n*V,w+=n*W,E+=n*J,A+=n*Z,x+=n*Y,u+=(n=t[4])*F,l+=n*L,f+=n*j,d+=n*U,h+=n*D,p+=n*z,m+=n*$,b+=n*H,g+=n*G,y+=n*q,v+=n*K,w+=n*V,E+=n*W,A+=n*J,x+=n*Z,_+=n*Y,l+=(n=t[5])*F,f+=n*L,d+=n*j,h+=n*U,p+=n*D,m+=n*z,b+=n*$,g+=n*H,y+=n*G,v+=n*q,w+=n*K,E+=n*V,A+=n*W,x+=n*J,_+=n*Z,k+=n*Y,f+=(n=t[6])*F,d+=n*L,h+=n*j,p+=n*U,m+=n*D,b+=n*z,g+=n*$,y+=n*H,v+=n*G,w+=n*q,E+=n*K,A+=n*V,x+=n*W,_+=n*J,k+=n*Z,S+=n*Y,d+=(n=t[7])*F,h+=n*L,p+=n*j,m+=n*U,b+=n*D,g+=n*z,y+=n*$,v+=n*H,w+=n*G,E+=n*q,A+=n*K,x+=n*V,_+=n*W,k+=n*J,S+=n*Z,P+=n*Y,h+=(n=t[8])*F,p+=n*L,m+=n*j,b+=n*U,g+=n*D,y+=n*z,v+=n*$,w+=n*H,E+=n*G,A+=n*q,x+=n*K,_+=n*V,k+=n*W,S+=n*J,P+=n*Z,I+=n*Y,p+=(n=t[9])*F,m+=n*L,b+=n*j,g+=n*U,y+=n*D,v+=n*z,w+=n*$,E+=n*H,A+=n*G,x+=n*q,_+=n*K,k+=n*V,S+=n*W,P+=n*J,I+=n*Z,T+=n*Y,m+=(n=t[10])*F,b+=n*L,g+=n*j,y+=n*U,v+=n*D,w+=n*z,E+=n*$,A+=n*H,x+=n*G,_+=n*q,k+=n*K,S+=n*V,P+=n*W,I+=n*J,T+=n*Z,O+=n*Y,b+=(n=t[11])*F,g+=n*L,y+=n*j,v+=n*U,w+=n*D,E+=n*z,A+=n*$,x+=n*H,_+=n*G,k+=n*q,S+=n*K,P+=n*V,I+=n*W,T+=n*J,O+=n*Z,M+=n*Y,g+=(n=t[12])*F,y+=n*L,v+=n*j,w+=n*U,E+=n*D,A+=n*z,x+=n*$,_+=n*H,k+=n*G,S+=n*q,P+=n*K,I+=n*V,T+=n*W,O+=n*J,M+=n*Z,C+=n*Y,y+=(n=t[13])*F,v+=n*L,w+=n*j,E+=n*U,A+=n*D,x+=n*z,_+=n*$,k+=n*H,S+=n*G,P+=n*q,I+=n*K,T+=n*V,O+=n*W,M+=n*J,C+=n*Z,B+=n*Y,v+=(n=t[14])*F,w+=n*L,E+=n*j,A+=n*U,x+=n*D,_+=n*z,k+=n*$,S+=n*H,P+=n*G,I+=n*q,T+=n*K,O+=n*V,M+=n*W,C+=n*J,B+=n*Z,N+=n*Y,w+=(n=t[15])*F,a+=38*(A+=n*j),s+=38*(x+=n*U),c+=38*(_+=n*D),u+=38*(k+=n*z),l+=38*(S+=n*$),f+=38*(P+=n*H),d+=38*(I+=n*G),h+=38*(T+=n*q),p+=38*(O+=n*K),m+=38*(M+=n*V),b+=38*(C+=n*W),g+=38*(B+=n*J),y+=38*(N+=n*Z),v+=38*(R+=n*Y),o=(n=(o+=38*(E+=n*L))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=(o+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),o+=i-1+37*(i-1),e[0]=o,e[1]=a,e[2]=s,e[3]=c,e[4]=u,e[5]=l,e[6]=f,e[7]=d,e[8]=h,e[9]=p,e[10]=m,e[11]=b,e[12]=g,e[13]=y,e[14]=v,e[15]=w}function U(e,t){j(e,t,t)}function D(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=253;n>=0;n--)U(i,i),2!==n&&4!==n&&j(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function z(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=250;n>=0;n--)U(i,i),1!==n&&j(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function $(e,r,n){var i,o,a=new Uint8Array(32),c=new Float64Array(80),u=t(),l=t(),f=t(),d=t(),h=t(),p=t();for(o=0;o<31;o++)a[o]=r[o];for(a[31]=127&r[31]|64,a[0]&=248,R(c,n),o=0;o<16;o++)l[o]=c[o],d[o]=u[o]=f[o]=0;for(u[0]=d[0]=1,o=254;o>=0;--o)M(u,l,i=a[o>>>3]>>>(7&o)&1),M(f,d,i),F(h,u,f),L(u,u,f),F(f,l,d),L(l,l,d),U(d,h),U(p,u),j(u,f,u),j(f,l,h),F(h,u,f),L(u,u,f),U(l,u),L(f,d,p),j(u,f,s),F(u,u,d),j(f,f,u),j(u,d,p),j(d,l,c),U(l,h),M(u,l,i),M(f,d,i);for(o=0;o<16;o++)c[o+16]=u[o],c[o+32]=f[o],c[o+48]=l[o],c[o+64]=d[o];var m=c.subarray(32),b=c.subarray(16);return D(m,m),j(b,b,m),C(e,b),0}function H(e,t){return $(e,t,i)}function G(e,t){return r(t,32),H(e,t)}function q(e,t,r){var i=new Uint8Array(32);return $(i,r,t),y(e,n,i,v)}_.prototype.blocks=function(e,t,r){for(var n,i,o,a,s,c,u,l,f,d,h,p,m,b,g,y,v,w,E,A=this.fin?0:2048,x=this.h[0],_=this.h[1],k=this.h[2],S=this.h[3],P=this.h[4],I=this.h[5],T=this.h[6],O=this.h[7],M=this.h[8],C=this.h[9],B=this.r[0],N=this.r[1],R=this.r[2],F=this.r[3],L=this.r[4],j=this.r[5],U=this.r[6],D=this.r[7],z=this.r[8],$=this.r[9];r>=16;)d=f=0,d+=(x+=8191&(n=255&e[t+0]|(255&e[t+1])<<8))*B,d+=(_+=8191&(n>>>13|(i=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*$),d+=(k+=8191&(i>>>10|(o=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*z),d+=(S+=8191&(o>>>7|(a=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*D),f=(d+=(P+=8191&(a>>>4|(s=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*U))>>>13,d&=8191,d+=(I+=s>>>1&8191)*(5*j),d+=(T+=8191&(s>>>14|(c=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*L),d+=(O+=8191&(c>>>11|(u=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*F),d+=(M+=8191&(u>>>8|(l=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*R),h=f+=(d+=(C+=l>>>5|A)*(5*N))>>>13,h+=x*N,h+=_*B,h+=k*(5*$),h+=S*(5*z),f=(h+=P*(5*D))>>>13,h&=8191,h+=I*(5*U),h+=T*(5*j),h+=O*(5*L),h+=M*(5*F),f+=(h+=C*(5*R))>>>13,h&=8191,p=f,p+=x*R,p+=_*N,p+=k*B,p+=S*(5*$),f=(p+=P*(5*z))>>>13,p&=8191,p+=I*(5*D),p+=T*(5*U),p+=O*(5*j),p+=M*(5*L),m=f+=(p+=C*(5*F))>>>13,m+=x*F,m+=_*R,m+=k*N,m+=S*B,f=(m+=P*(5*$))>>>13,m&=8191,m+=I*(5*z),m+=T*(5*D),m+=O*(5*U),m+=M*(5*j),b=f+=(m+=C*(5*L))>>>13,b+=x*L,b+=_*F,b+=k*R,b+=S*N,f=(b+=P*B)>>>13,b&=8191,b+=I*(5*$),b+=T*(5*z),b+=O*(5*D),b+=M*(5*U),g=f+=(b+=C*(5*j))>>>13,g+=x*j,g+=_*L,g+=k*F,g+=S*R,f=(g+=P*N)>>>13,g&=8191,g+=I*B,g+=T*(5*$),g+=O*(5*z),g+=M*(5*D),y=f+=(g+=C*(5*U))>>>13,y+=x*U,y+=_*j,y+=k*L,y+=S*F,f=(y+=P*R)>>>13,y&=8191,y+=I*N,y+=T*B,y+=O*(5*$),y+=M*(5*z),v=f+=(y+=C*(5*D))>>>13,v+=x*D,v+=_*U,v+=k*j,v+=S*L,f=(v+=P*F)>>>13,v&=8191,v+=I*R,v+=T*N,v+=O*B,v+=M*(5*$),w=f+=(v+=C*(5*z))>>>13,w+=x*z,w+=_*D,w+=k*U,w+=S*j,f=(w+=P*L)>>>13,w&=8191,w+=I*F,w+=T*R,w+=O*N,w+=M*B,E=f+=(w+=C*(5*$))>>>13,E+=x*$,E+=_*z,E+=k*D,E+=S*U,f=(E+=P*j)>>>13,E&=8191,E+=I*L,E+=T*F,E+=O*R,E+=M*N,x=d=8191&(f=(f=((f+=(E+=C*B)>>>13)<<2)+f|0)+(d&=8191)|0),_=h+=f>>>=13,k=p&=8191,S=m&=8191,P=b&=8191,I=g&=8191,T=y&=8191,O=v&=8191,M=w&=8191,C=E&=8191,t+=16,r-=16;this.h[0]=x,this.h[1]=_,this.h[2]=k,this.h[3]=S,this.h[4]=P,this.h[5]=I,this.h[6]=T,this.h[7]=O,this.h[8]=M,this.h[9]=C},_.prototype.finish=function(e,t){var r,n,i,o,a=new Uint16Array(10);if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,a[0]=this.h[0]+5,r=a[0]>>>13,a[0]&=8191,o=1;o<10;o++)a[o]=this.h[o]+r,r=a[o]>>>13,a[o]&=8191;for(a[9]-=8192,n=(1^r)-1,o=0;o<10;o++)a[o]&=n;for(n=~n,o=0;o<10;o++)this.h[o]=this.h[o]&n|a[o];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),i=this.h[0]+this.pad[0],this.h[0]=65535&i,o=1;o<8;o++)i=(this.h[o]+this.pad[o]|0)+(i>>>16)|0,this.h[o]=65535&i;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},_.prototype.update=function(e,t,r){var n,i;if(this.leftover){for((i=16-this.leftover)>r&&(i=r),n=0;n=16&&(i=r-r%16,this.blocks(e,t,i),t+=i,r-=i),r){for(n=0;n=128;){for(A=0;A<16;A++)x=8*A+J,O[A]=r[x+0]<<24|r[x+1]<<16|r[x+2]<<8|r[x+3],M[A]=r[x+4]<<24|r[x+5]<<16|r[x+6]<<8|r[x+7];for(A=0;A<80;A++)if(i=C,o=B,a=N,s=R,c=F,u=L,l=j,U,d=D,h=z,p=$,m=H,b=G,g=q,y=K,V,S=65535&(k=V),P=k>>>16,I=65535&(_=U),T=_>>>16,S+=65535&(k=(G>>>14|F<<18)^(G>>>18|F<<14)^(F>>>9|G<<23)),P+=k>>>16,I+=65535&(_=(F>>>14|G<<18)^(F>>>18|G<<14)^(G>>>9|F<<23)),T+=_>>>16,S+=65535&(k=G&q^~G&K),P+=k>>>16,I+=65535&(_=F&L^~F&j),T+=_>>>16,_=W[2*A],S+=65535&(k=W[2*A+1]),P+=k>>>16,I+=65535&_,T+=_>>>16,_=O[A%16],P+=(k=M[A%16])>>>16,I+=65535&_,T+=_>>>16,I+=(P+=(S+=65535&k)>>>16)>>>16,S=65535&(k=E=65535&S|P<<16),P=k>>>16,I=65535&(_=w=65535&I|(T+=I>>>16)<<16),T=_>>>16,S+=65535&(k=(D>>>28|C<<4)^(C>>>2|D<<30)^(C>>>7|D<<25)),P+=k>>>16,I+=65535&(_=(C>>>28|D<<4)^(D>>>2|C<<30)^(D>>>7|C<<25)),T+=_>>>16,P+=(k=D&z^D&$^z&$)>>>16,I+=65535&(_=C&B^C&N^B&N),T+=_>>>16,f=65535&(I+=(P+=(S+=65535&k)>>>16)>>>16)|(T+=I>>>16)<<16,v=65535&S|P<<16,S=65535&(k=m),P=k>>>16,I=65535&(_=s),T=_>>>16,P+=(k=E)>>>16,I+=65535&(_=w),T+=_>>>16,B=i,N=o,R=a,F=s=65535&(I+=(P+=(S+=65535&k)>>>16)>>>16)|(T+=I>>>16)<<16,L=c,j=u,U=l,C=f,z=d,$=h,H=p,G=m=65535&S|P<<16,q=b,K=g,V=y,D=v,A%16==15)for(x=0;x<16;x++)_=O[x],S=65535&(k=M[x]),P=k>>>16,I=65535&_,T=_>>>16,_=O[(x+9)%16],S+=65535&(k=M[(x+9)%16]),P+=k>>>16,I+=65535&_,T+=_>>>16,w=O[(x+1)%16],S+=65535&(k=((E=M[(x+1)%16])>>>1|w<<31)^(E>>>8|w<<24)^(E>>>7|w<<25)),P+=k>>>16,I+=65535&(_=(w>>>1|E<<31)^(w>>>8|E<<24)^w>>>7),T+=_>>>16,w=O[(x+14)%16],P+=(k=((E=M[(x+14)%16])>>>19|w<<13)^(w>>>29|E<<3)^(E>>>6|w<<26))>>>16,I+=65535&(_=(w>>>19|E<<13)^(E>>>29|w<<3)^w>>>6),T+=_>>>16,T+=(I+=(P+=(S+=65535&k)>>>16)>>>16)>>>16,O[x]=65535&I|T<<16,M[x]=65535&S|P<<16;S=65535&(k=D),P=k>>>16,I=65535&(_=C),T=_>>>16,_=e[0],P+=(k=t[0])>>>16,I+=65535&_,T+=_>>>16,T+=(I+=(P+=(S+=65535&k)>>>16)>>>16)>>>16,e[0]=C=65535&I|T<<16,t[0]=D=65535&S|P<<16,S=65535&(k=z),P=k>>>16,I=65535&(_=B),T=_>>>16,_=e[1],P+=(k=t[1])>>>16,I+=65535&_,T+=_>>>16,T+=(I+=(P+=(S+=65535&k)>>>16)>>>16)>>>16,e[1]=B=65535&I|T<<16,t[1]=z=65535&S|P<<16,S=65535&(k=$),P=k>>>16,I=65535&(_=N),T=_>>>16,_=e[2],P+=(k=t[2])>>>16,I+=65535&_,T+=_>>>16,T+=(I+=(P+=(S+=65535&k)>>>16)>>>16)>>>16,e[2]=N=65535&I|T<<16,t[2]=$=65535&S|P<<16,S=65535&(k=H),P=k>>>16,I=65535&(_=R),T=_>>>16,_=e[3],P+=(k=t[3])>>>16,I+=65535&_,T+=_>>>16,T+=(I+=(P+=(S+=65535&k)>>>16)>>>16)>>>16,e[3]=R=65535&I|T<<16,t[3]=H=65535&S|P<<16,S=65535&(k=G),P=k>>>16,I=65535&(_=F),T=_>>>16,_=e[4],P+=(k=t[4])>>>16,I+=65535&_,T+=_>>>16,T+=(I+=(P+=(S+=65535&k)>>>16)>>>16)>>>16,e[4]=F=65535&I|T<<16,t[4]=G=65535&S|P<<16,S=65535&(k=q),P=k>>>16,I=65535&(_=L),T=_>>>16,_=e[5],P+=(k=t[5])>>>16,I+=65535&_,T+=_>>>16,T+=(I+=(P+=(S+=65535&k)>>>16)>>>16)>>>16,e[5]=L=65535&I|T<<16,t[5]=q=65535&S|P<<16,S=65535&(k=K),P=k>>>16,I=65535&(_=j),T=_>>>16,_=e[6],P+=(k=t[6])>>>16,I+=65535&_,T+=_>>>16,T+=(I+=(P+=(S+=65535&k)>>>16)>>>16)>>>16,e[6]=j=65535&I|T<<16,t[6]=K=65535&S|P<<16,S=65535&(k=V),P=k>>>16,I=65535&(_=U),T=_>>>16,_=e[7],P+=(k=t[7])>>>16,I+=65535&_,T+=_>>>16,T+=(I+=(P+=(S+=65535&k)>>>16)>>>16)>>>16,e[7]=U=65535&I|T<<16,t[7]=V=65535&S|P<<16,J+=128,n-=128}return n}function Z(e,t,r){var n,i=new Int32Array(8),o=new Int32Array(8),a=new Uint8Array(256),s=r;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,o[0]=4089235720,o[1]=2227873595,o[2]=4271175723,o[3]=1595750129,o[4]=2917565137,o[5]=725511199,o[6]=4215389547,o[7]=327033209,J(i,o,t,r),r%=128,n=0;n=0;--i)X(e,t,n=r[i/8|0]>>(7&i)&1),Y(t,e),Y(e,e),X(e,t,n)}function te(e,r){var n=[t(),t(),t(),t()];T(n[0],l),T(n[1],f),T(n[2],a),j(n[3],l,f),ee(e,n,r)}function re(e,n,i){var o,a=new Uint8Array(64),s=[t(),t(),t(),t()];for(i||r(n,32),Z(a,n,32),a[0]&=248,a[31]&=127,a[31]|=64,te(s,a),Q(e,s),o=0;o<32;o++)n[o+32]=e[o];return 0}var ne=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ie(e,t){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i>4)*ne[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*ne[i];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function oe(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;ie(e,r)}function ae(e,r,n,i){var o,a,s=new Uint8Array(64),c=new Uint8Array(64),u=new Uint8Array(64),l=new Float64Array(64),f=[t(),t(),t(),t()];Z(s,i,32),s[0]&=248,s[31]&=127,s[31]|=64;var d=n+64;for(o=0;o>7&&L(e[0],o,e[0]),j(e[3],e[0],e[1]),0)}(h,i))return-1;for(s=0;s=0},e.sign.keyPair=function(){var e=new Uint8Array(le),t=new Uint8Array(fe);return re(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(he(e),e.length!==fe)throw new Error("bad secret key size");for(var t=new Uint8Array(le),r=0;r0&&(o=2048-i-16),n.padding="0".repeat(o),Que({publicKey:e,data:JSON.stringify(n),version:r})},Gue.decrypt=ele,Gue.decryptSafely=function({encryptedData:e,privateKey:t}){if((0,Xue.isNullish)(e))throw new Error("Missing encryptedData parameter");if((0,Xue.isNullish)(t))throw new Error("Missing privateKey parameter");return JSON.parse(ele({encryptedData:e,privateKey:t})).data},Gue.getEncryptionPublicKey=function(e){const t=_.from(e,"hex"),r=Yue.box.keyPair.fromSecretKey(t).publicKey;return Zue.base64.encode(r)},function(e){var t=o&&o.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=o&&o.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.normalize=e.concatSig=void 0,r(b4,e),r(lue,e),r(Gue,e);var n=pse;Object.defineProperty(e,"concatSig",{enumerable:!0,get:function(){return n.concatSig}}),Object.defineProperty(e,"normalize",{enumerable:!0,get:function(){return n.normalize}})}(m4);var rle,nle=Object.prototype.hasOwnProperty,ile=Object.keys||function(e){var t=[];for(var r in e)nle.call(e,r)&&t.push(r);return t},ole=Array.prototype.slice;function ale(){return void 0!==rle?rle:rle="foo"===function(){}.name}function sle(e){return Object.prototype.toString.call(e)}function cle(e){return!se(e)&&("function"==typeof u.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}function ule(e,t){e||mle(e,!0,t,"==",ble)}var lle=/\s*function\s+([^\(\s]*)\s*/;function fle(e){if(Ste(e)){if(ale())return e.name;var t=e.toString().match(lle);return t&&t[1]}}function dle(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return hle(ple(e.actual),128)+" "+e.operator+" "+hle(ple(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||mle;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=fle(t),o=n.indexOf("\n"+i);if(o>=0){var a=n.indexOf("\n",o+1);n=n.substring(a+1)}this.stack=n}}}function hle(e,t){return"string"==typeof e?e.length=0;s--)if(c[s]!==u[s])return!1;for(s=c.length-1;s>=0;s--)if(!gle(e[a=c[s]],t[a],r,n))return!1;return!0}(e,t,r,n))}return r?e===t:e==t}function yle(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function vle(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function wle(e,t,r,n){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&mle(i,r,"Missing expected exception"+n);var o="string"==typeof n,a=!e&&i&&!r;if((!e&&kte(i)&&o&&vle(i,r)||a)&&mle(i,r,"Got unwanted exception"+n),e&&i&&r&&!vle(i,r)||!e&&i)throw i}ule.AssertionError=dle,Kee(dle,Error),ule.fail=mle,ule.ok=ble,ule.equal=function e(t,r,n){t!=r&&mle(t,r,n,"==",e)},ule.notEqual=function e(t,r,n){t==r&&mle(t,r,n,"!=",e)},ule.deepEqual=function e(t,r,n){gle(t,r,!1)||mle(t,r,n,"deepEqual",e)},ule.deepStrictEqual=function e(t,r,n){gle(t,r,!0)||mle(t,r,n,"deepStrictEqual",e)},ule.notDeepEqual=function e(t,r,n){gle(t,r,!1)&&mle(t,r,n,"notDeepEqual",e)},ule.notDeepStrictEqual=function e(t,r,n){gle(t,r,!0)&&mle(t,r,n,"notDeepStrictEqual",e)},ule.strictEqual=function e(t,r,n){t!==r&&mle(t,r,n,"===",e)},ule.notStrictEqual=function e(t,r,n){t===r&&mle(t,r,n,"!==",e)},ule.throws=function(e,t,r){wle(!0,e,t,r)},ule.doesNotThrow=function(e,t,r){wle(!1,e,t,r)},ule.ifError=function(e){if(e)throw e};var Ele={},Ale={},xle=rse,_le=Ale.ValidationError=function(e,t,r,n,i,o){if(Array.isArray(n)?(this.path=n,this.property=n.reduce((function(e,t){return e+Mle(t)}),"instance")):void 0!==n&&(this.property=n),e&&(this.message=e),r){var a=r.$id||r.id;this.schema=a||r}void 0!==t&&(this.instance=t),this.name=i,this.argument=o,this.stack=this.toString()};_le.prototype.toString=function(){return this.property+" "+this.message};var kle=Ale.ValidatorResult=function(e,t,r,n){this.instance=e,this.schema=t,this.options=r,this.path=n.path,this.propertyPath=n.propertyPath,this.errors=[],this.throwError=r&&r.throwError,this.throwFirst=r&&r.throwFirst,this.throwAll=r&&r.throwAll,this.disableFormat=r&&!0===r.disableFormat};function Sle(e,t){return t+": "+e.toString()+"\n"}function Ple(e){Error.captureStackTrace&&Error.captureStackTrace(this,Ple),this.instance=e.instance,this.schema=e.schema,this.options=e.options,this.errors=e.errors}kle.prototype.addError=function(e){var t;if("string"==typeof e)t=new _le(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");t=new _le(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(t),this.throwFirst)throw new Ple(this);if(this.throwError)throw t;return t},kle.prototype.importErrors=function(e){"string"==typeof e||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))},kle.prototype.toString=function(e){return this.errors.map(Sle).join("")},Object.defineProperty(kle.prototype,"valid",{get:function(){return!this.errors.length}}),Ale.ValidatorResultError=Ple,Ple.prototype=new Error,Ple.prototype.constructor=Ple,Ple.prototype.name="Validation Error";var Ile=Ale.SchemaError=function e(t,r){this.message=t,this.schema=r,Error.call(this,t),Error.captureStackTrace(this,e)};Ile.prototype=Object.create(Error.prototype,{constructor:{value:Ile,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var Tle=Ale.SchemaContext=function(e,t,r,n,i){this.schema=e,this.options=t,Array.isArray(r)?(this.path=r,this.propertyPath=r.reduce((function(e,t){return e+Mle(t)}),"instance")):this.propertyPath=r,this.base=n,this.schemas=i};Tle.prototype.resolve=function(e){return xle.resolve(this.base,e)},Tle.prototype.makeChild=function(e,t){var r=void 0===t?this.path:this.path.concat([t]),n=e.$id||e.id,i=xle.resolve(this.base,n||""),o=new Tle(e,this.options,r,i,Object.create(this.schemas));return n&&!o.schemas[i]&&(o.schemas[i]=e),o};var Ole=Ale.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(e){return"string"==typeof e&&parseFloat(e)===parseInt(e,10)&&!isNaN(e)},regex:function(e){var t=!0;try{new RegExp(e)}catch(e){t=!1}return t},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};Ole.regexp=Ole.regex,Ole.pattern=Ole.regex,Ole.ipv4=Ole["ip-address"],Ale.isFormat=function(e,t,r){if("string"==typeof e&&void 0!==Ole[t]){if(Ole[t]instanceof RegExp)return Ole[t].test(e);if("function"==typeof Ole[t])return Ole[t](e)}else if(r&&r.customFormats&&"function"==typeof r.customFormats[t])return r.customFormats[t](e);return!0};var Mle=Ale.makeSuffix=function(e){return(e=e.toString()).match(/[.\s\[\]]/)||e.match(/^[\d]/)?e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]":"."+e};function Cle(e,t,r,n){"object"==typeof r?t[n]=Rle(e[n],r):-1===e.indexOf(r)&&t.push(r)}function Ble(e,t,r){t[r]=e[r]}function Nle(e,t,r,n){"object"==typeof t[n]&&t[n]&&e[n]?r[n]=Rle(e[n],t[n]):r[n]=t[n]}function Rle(e,t){var r=Array.isArray(t),n=r&&[]||{};return r?(e=e||[],n=n.concat(e),t.forEach(Cle.bind(null,e,n))):(e&&"object"==typeof e&&Object.keys(e).forEach(Ble.bind(null,e,n)),Object.keys(t).forEach(Nle.bind(null,e,t,n))),n}function Fle(e){return"/"+encodeURIComponent(e).replace(/~/g,"%7E")}Ale.deepCompareStrict=function e(t,r){if(typeof t!=typeof r)return!1;if(Array.isArray(t))return!!Array.isArray(r)&&(t.length===r.length&&t.every((function(n,i){return e(t[i],r[i])})));if("object"==typeof t){if(!t||!r)return t===r;var n=Object.keys(t),i=Object.keys(r);return n.length===i.length&&n.every((function(n){return e(t[n],r[n])}))}return t===r},Ale.deepMerge=Rle,Ale.objectGetPath=function(e,t){for(var r,n=t.split("/").slice(1);"string"==typeof(r=n.shift());){var i=decodeURIComponent(r.replace(/~0/,"~").replace(/~1/g,"/"));if(!(i in e))return;e=e[i]}return e},Ale.encodePath=function(e){return e.map(Fle).join("")},Ale.getDecimalPlaces=function(e){var t=0;if(isNaN(e))return t;"number"!=typeof e&&(e=Number(e));var r=e.toString().split("e");if(2===r.length){if("-"!==r[1][0])return t;t=Number(r[1].slice(1))}var n=r[0].split(".");return 2===n.length&&(t+=n[1].length),t},Ale.isSchema=function(e){return"object"==typeof e&&e||"boolean"==typeof e};var Lle=Ale,jle=Lle.ValidatorResult,Ule=Lle.SchemaError,Dle={ignoreProperties:{id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0}},zle=Dle.validators={};function $le(e,t,r,n,i){var o=t.throwError,a=t.throwAll;t.throwError=!1,t.throwAll=!1;var s=this.validateSchema(e,i,t,r);return t.throwError=o,t.throwAll=a,!s.valid&&n instanceof Function&&n(s),s.valid}function Hle(e,t){if(Object.hasOwnProperty.call(e,t))return e[t];if(t in e)for(;e=Object.getPrototypeOf(e);)if(Object.propertyIsEnumerable.call(e,t))return e[t]}function Gle(e,t,r,n,i,o){if(this.types.object(e)&&(!t.properties||void 0===t.properties[i]))if(!1===t.additionalProperties)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var a=t.additionalProperties||{};"function"==typeof r.preValidateProperty&&r.preValidateProperty(e,i,a,r,n);var s=this.validateSchema(e[i],a,r,n.makeChild(a,i));s.instance!==o.instance[i]&&(o.instance[i]=s.instance),o.importErrors(s)}}zle.type=function(e,t,r,n){if(void 0===e)return null;var i=new jle(e,t,r,n),o=Array.isArray(t.type)?t.type:[t.type];if(!o.some(this.testType.bind(this,e,t,r,n))){var a=o.map((function(e){if(e){var t=e.$id||e.id;return t?"<"+t+">":e+""}}));i.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return i},zle.anyOf=function(e,t,r,n){if(void 0===e)return null;var i=new jle(e,t,r,n),o=new jle(e,t,r,n);if(!Array.isArray(t.anyOf))throw new Ule("anyOf must be an array");if(!t.anyOf.some($le.bind(this,e,r,n,(function(e){o.importErrors(e)})))){var a=t.anyOf.map((function(e,t){var r=e.$id||e.id;return r?"<"+r+">":e.title&&JSON.stringify(e.title)||e.$ref&&"<"+e.$ref+">"||"[subschema "+t+"]"}));r.nestedErrors&&i.importErrors(o),i.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return i},zle.allOf=function(e,t,r,n){if(void 0===e)return null;if(!Array.isArray(t.allOf))throw new Ule("allOf must be an array");var i=new jle(e,t,r,n),o=this;return t.allOf.forEach((function(t,a){var s=o.validateSchema(e,t,r,n);if(!s.valid){var c=t.$id||t.id||t.title&&JSON.stringify(t.title)||t.$ref&&"<"+t.$ref+">"||"[subschema "+a+"]";i.addError({name:"allOf",argument:{id:c,length:s.errors.length,valid:s},message:"does not match allOf schema "+c+" with "+s.errors.length+" error[s]:"}),i.importErrors(s)}})),i},zle.oneOf=function(e,t,r,n){if(void 0===e)return null;if(!Array.isArray(t.oneOf))throw new Ule("oneOf must be an array");var i=new jle(e,t,r,n),o=new jle(e,t,r,n),a=t.oneOf.filter($le.bind(this,e,r,n,(function(e){o.importErrors(e)}))).length,s=t.oneOf.map((function(e,t){return e.$id||e.id||e.title&&JSON.stringify(e.title)||e.$ref&&"<"+e.$ref+">"||"[subschema "+t+"]"}));return 1!==a&&(r.nestedErrors&&i.importErrors(o),i.addError({name:"oneOf",argument:s,message:"is not exactly one from "+s.join(",")})),i},zle.if=function(e,t,r,n){if(void 0===e)return null;if(!Lle.isSchema(t.if))throw new Error('Expected "if" keyword to be a schema');var i,o=$le.call(this,e,r,n,null,t.if),a=new jle(e,t,r,n);if(o){if(void 0===t.then)return;if(!Lle.isSchema(t.then))throw new Error('Expected "then" keyword to be a schema');i=this.validateSchema(e,t.then,r,n.makeChild(t.then)),a.importErrors(i)}else{if(void 0===t.else)return;if(!Lle.isSchema(t.else))throw new Error('Expected "else" keyword to be a schema');i=this.validateSchema(e,t.else,r,n.makeChild(t.else)),a.importErrors(i)}return a},zle.propertyNames=function(e,t,r,n){if(this.types.object(e)){var i=new jle(e,t,r,n),o=void 0!==t.propertyNames?t.propertyNames:{};if(!Lle.isSchema(o))throw new Ule('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(void 0!==Hle(e,a)){var s=this.validateSchema(a,o,r,n.makeChild(o));i.importErrors(s)}return i}},zle.properties=function(e,t,r,n){if(this.types.object(e)){var i=new jle(e,t,r,n),o=t.properties||{};for(var a in o){var s=o[a];if(void 0!==s){if(null===s)throw new Ule('Unexpected null, expected schema in "properties"');"function"==typeof r.preValidateProperty&&r.preValidateProperty(e,a,s,r,n);var c=Hle(e,a),u=this.validateSchema(c,s,r,n.makeChild(s,a));u.instance!==i.instance[a]&&(i.instance[a]=u.instance),i.importErrors(u)}}return i}},zle.patternProperties=function(e,t,r,n){if(this.types.object(e)){var i=new jle(e,t,r,n),o=t.patternProperties||{};for(var a in e){var s=!0;for(var c in o){var u=o[c];if(void 0!==u){if(null===u)throw new Ule('Unexpected null, expected schema in "patternProperties"');try{var l=new RegExp(c,"u")}catch(e){l=new RegExp(c)}if(l.test(a)){s=!1,"function"==typeof r.preValidateProperty&&r.preValidateProperty(e,a,u,r,n);var f=this.validateSchema(e[a],u,r,n.makeChild(u,a));f.instance!==i.instance[a]&&(i.instance[a]=f.instance),i.importErrors(f)}}}s&&Gle.call(this,e,t,r,n,a,i)}return i}},zle.additionalProperties=function(e,t,r,n){if(this.types.object(e)){if(t.patternProperties)return null;var i=new jle(e,t,r,n);for(var o in e)Gle.call(this,e,t,r,n,o,i);return i}},zle.minProperties=function(e,t,r,n){if(this.types.object(e)){var i=new jle(e,t,r,n);return Object.keys(e).length>=t.minProperties||i.addError({name:"minProperties",argument:t.minProperties,message:"does not meet minimum property length of "+t.minProperties}),i}},zle.maxProperties=function(e,t,r,n){if(this.types.object(e)){var i=new jle(e,t,r,n);return Object.keys(e).length<=t.maxProperties||i.addError({name:"maxProperties",argument:t.maxProperties,message:"does not meet maximum property length of "+t.maxProperties}),i}},zle.items=function(e,t,r,n){var i=this;if(this.types.array(e)&&void 0!==t.items){var o=new jle(e,t,r,n);return e.every((function(e,a){if(Array.isArray(t.items))var s=void 0===t.items[a]?t.additionalItems:t.items[a];else s=t.items;if(void 0===s)return!0;if(!1===s)return o.addError({name:"items",message:"additionalItems not permitted"}),!1;var c=i.validateSchema(e,s,r,n.makeChild(s,a));return c.instance!==o.instance[a]&&(o.instance[a]=c.instance),o.importErrors(c),!0})),o}},zle.contains=function(e,t,r,n){var i=this;if(this.types.array(e)&&void 0!==t.contains){if(!Lle.isSchema(t.contains))throw new Error('Expected "contains" keyword to be a schema');var o=new jle(e,t,r,n),a=e.some((function(e,o){return 0===i.validateSchema(e,t.contains,r,n.makeChild(t.contains,o)).errors.length}));return!1===a&&o.addError({name:"contains",argument:t.contains,message:"must contain an item matching given schema"}),o}},zle.minimum=function(e,t,r,n){if(this.types.number(e)){var i=new jle(e,t,r,n);return t.exclusiveMinimum&&!0===t.exclusiveMinimum?e>t.minimum||i.addError({name:"minimum",argument:t.minimum,message:"must be greater than "+t.minimum}):e>=t.minimum||i.addError({name:"minimum",argument:t.minimum,message:"must be greater than or equal to "+t.minimum}),i}},zle.maximum=function(e,t,r,n){if(this.types.number(e)){var i=new jle(e,t,r,n);return t.exclusiveMaximum&&!0===t.exclusiveMaximum?et.exclusiveMinimum||i.addError({name:"exclusiveMinimum",argument:t.exclusiveMinimum,message:"must be strictly greater than "+t.exclusiveMinimum}),i}},zle.exclusiveMaximum=function(e,t,r,n){if("boolean"!=typeof t.exclusiveMaximum&&this.types.number(e)){var i=new jle(e,t,r,n);return e=t.minLength||i.addError({name:"minLength",argument:t.minLength,message:"does not meet minimum length of "+t.minLength}),i}},zle.maxLength=function(e,t,r,n){if(this.types.string(e)){var i=new jle(e,t,r,n),o=e.match(/[\uDC00-\uDFFF]/g);return e.length-(o?o.length:0)<=t.maxLength||i.addError({name:"maxLength",argument:t.maxLength,message:"does not meet maximum length of "+t.maxLength}),i}},zle.minItems=function(e,t,r,n){if(this.types.array(e)){var i=new jle(e,t,r,n);return e.length>=t.minItems||i.addError({name:"minItems",argument:t.minItems,message:"does not meet minimum length of "+t.minItems}),i}},zle.maxItems=function(e,t,r,n){if(this.types.array(e)){var i=new jle(e,t,r,n);return e.length<=t.maxItems||i.addError({name:"maxItems",argument:t.maxItems,message:"does not meet maximum length of "+t.maxItems}),i}},zle.uniqueItems=function(e,t,r,n){if(!0===t.uniqueItems&&this.types.array(e)){var i=new jle(e,t,r,n);return e.every(Kle)||i.addError({name:"uniqueItems",message:"contains duplicate item"}),i}},zle.dependencies=function(e,t,r,n){if(this.types.object(e)){var i=new jle(e,t,r,n);for(var o in t.dependencies)if(void 0!==e[o]){var a=t.dependencies[o],s=n.makeChild(a,o);if("string"==typeof a&&(a=[a]),Array.isArray(a))a.forEach((function(t){void 0===e[t]&&i.addError({name:"dependencies",argument:s.propertyPath,message:"property "+t+" not found, required by "+s.propertyPath})}));else{var c=this.validateSchema(e,a,r,s);i.instance!==c.instance&&(i.instance=c.instance),c&&c.errors.length&&(i.addError({name:"dependencies",argument:s.propertyPath,message:"does not meet dependency required by "+s.propertyPath}),i.importErrors(c))}}return i}},zle.enum=function(e,t,r,n){if(void 0===e)return null;if(!Array.isArray(t.enum))throw new Ule("enum expects an array",t);var i=new jle(e,t,r,n);return t.enum.some(Lle.deepCompareStrict.bind(null,e))||i.addError({name:"enum",argument:t.enum,message:"is not one of enum values: "+t.enum.map(String).join(",")}),i},zle.const=function(e,t,r,n){if(void 0===e)return null;var i=new jle(e,t,r,n);return Lle.deepCompareStrict(t.const,e)||i.addError({name:"const",argument:t.const,message:"does not exactly match expected constant: "+t.const}),i},zle.not=zle.disallow=function(e,t,r,n){var i=this;if(void 0===e)return null;var o=new jle(e,t,r,n),a=t.not||t.disallow;return a?(Array.isArray(a)||(a=[a]),a.forEach((function(a){if(i.testType(e,t,r,n,a)){var s=a&&(a.$id||a.id)||a;o.addError({name:"not",argument:s,message:"is of prohibited type "+s})}})),o):null};var Vle=Dle,Wle={},Jle=rse,Zle=Ale;function Yle(e,t){this.id=e,this.ref=t}Wle.SchemaScanResult=Yle,Wle.scan=function(e,t){function r(e,t){if(t&&"object"==typeof t)if(t.$ref){var s=Jle.resolve(e,t.$ref);a[s]=a[s]?a[s]+1:0}else{var c=t.$id||t.id,u=c?Jle.resolve(e,c):e;if(u){if(u.indexOf("#")<0&&(u+="#"),o[u]){if(!Zle.deepCompareStrict(o[u],t))throw new Error("Schema <"+u+"> already exists with different definition");return o[u]}o[u]=t,"#"==u[u.length-1]&&(o[u.substring(0,u.length-1)]=t)}n(u+"/items",Array.isArray(t.items)?t.items:[t.items]),n(u+"/extends",Array.isArray(t.extends)?t.extends:[t.extends]),r(u+"/additionalItems",t.additionalItems),i(u+"/properties",t.properties),r(u+"/additionalProperties",t.additionalProperties),i(u+"/definitions",t.definitions),i(u+"/patternProperties",t.patternProperties),i(u+"/dependencies",t.dependencies),n(u+"/disallow",t.disallow),n(u+"/allOf",t.allOf),n(u+"/anyOf",t.anyOf),n(u+"/oneOf",t.oneOf),r(u+"/not",t.not)}}function n(e,t){if(Array.isArray(t))for(var n=0;n",e);var a=efe.objectGetPath(r.schemas[o],i.substr(1));if(void 0===a)throw new ife("no such schema "+i+" located in <"+o+">",e);return{subschema:a,switchSchema:t}},afe.prototype.testType=function(e,t,r,n,i){if(void 0!==i){if(null===i)throw new ife('Unexpected null in "type" keyword');if("function"==typeof this.types[i])return this.types[i].call(this,e);if(i&&"object"==typeof i){var o=this.validateSchema(e,i,r,n);return void 0===o||!(o&&o.errors.length)}return!0}};var cfe=afe.prototype.types={};cfe.string=function(e){return"string"==typeof e},cfe.number=function(e){return"number"==typeof e&&isFinite(e)},cfe.integer=function(e){return"number"==typeof e&&e%1==0},cfe.boolean=function(e){return"boolean"==typeof e},cfe.array=function(e){return Array.isArray(e)},cfe.null=function(e){return null===e},cfe.date=function(e){return e instanceof Date},cfe.any=function(e){return!0},cfe.object=function(e){return e&&"object"==typeof e&&!Array.isArray(e)&&!(e instanceof Date)};var ufe,lfe=afe,ffe=Ele.Validator=lfe;function dfe(e){return 42===e.length}function hfe(e){let{getAccounts:t,getPrivateKey:r,processDecryptMessage:n,processEncryptionPublicKey:o,processEthSignMessage:a,processPersonalMessage:s,processTransaction:c,processSignTransaction:u,processTypedMessage:l,processTypedMessageV3:f,processTypedMessageV4:d}=e;if(!t)throw new Error("opts.getAccounts is required");async function h(e,r){if("string"==typeof e&&e.length>0){const n=(await t(r)).map((e=>e.toLowerCase())),i=e.toLowerCase();if(n.includes(i))return i}throw ff.invalidParams({message:"Invalid parameters: must provide an Ethereum address."})}async function p(e,t){if(!r)throw ff.methodNotSupported();t.result=r(e)}return _f({eth_accounts:kf((async function(e,r){r.result=await t(e)})),eth_private_key:kf(p),private_key:kf(p),eth_coinbase:kf((async function(e,r){const n=await t(e);r.result=n[0]||null})),eth_sendTransaction:kf((async function(e,t){if(!c)throw ff.methodNotSupported();const r=e.params[0]||{from:""};r.from=await h(r.from,e),t.result=await c(r,e)})),eth_signTransaction:kf((async function(e,t){if(!u)throw ff.methodNotSupported();const r=e.params[0]||{from:""};r.from=await h(r.from,e),t.result=await u(r,e)})),eth_sign:kf((async function(e,t){if(!a)throw ff.methodNotSupported();const r=await h(e.params[0],e),n=e.params[1],o=i(i({},e.params[2]||{}),{},{from:r,data:n});t.result=await a(o,e)})),eth_signTypedData:kf((async function(e,t){if(!l)throw ff.methodNotSupported();const r=e.params[0],n=await h(e.params[1],e),o=i(i({},e.params[2]||{}),{},{from:n,data:r});t.result=await l(o,e,"V1")})),eth_signTypedData_v3:kf((async function(e,t){if(!f)throw ff.methodNotSupported();const r=await h(e.params[0],e),n={data:e.params[1],from:r,version:"V3"};t.result=await f(n,e,"V3")})),eth_signTypedData_v4:kf((async function(e,t){if(!d)throw ff.methodNotSupported();const r=await h(e.params[0],e),n={data:e.params[1],from:r,version:"V4"};t.result=await d(n,e,"V4")})),personal_sign:kf((async function(e,t){if(!s)throw ff.methodNotSupported();const r=e.params[0],n=e.params[1],o=e.params[2]||{};let a,c;if(dfe(r)&&!dfe(n)){let e="The eth_personalSign method requires params ordered ";e+="[message, address]. This was previously handled incorrectly, ",e+="and has been corrected automatically. ",e+="Please switch this param order for smooth behavior in the future.",t.warning=e,a=r,c=n}else c=r,a=n;a=await h(a,e);const u=i(i({},o),{},{from:a,data:c});t.result=await s(u,e)})),eth_getEncryptionPublicKey:kf((async function(e,t){if(!o)throw ff.methodNotSupported();const r=await h(e.params[0],e);t.result=await o(r,e)})),eth_decrypt:kf((async function(e,t){if(!n)throw ff.methodNotSupported();const r=e.params[0],o=await h(e.params[1],e),a=i(i({},e.params[2]||{}),{},{from:o,data:r});t.result=n(a,e)}))})}function pfe(e){const{getAccounts:t,getPrivateKey:r,processTransaction:n,processSignTransaction:i,processEthSignMessage:o,processTypedMessage:a,processTypedMessageV3:s,processTypedMessageV4:c,processPersonalMessage:u,processEncryptionPublicKey:l,processDecryptMessage:f}=e;return Pf([_f({eth_syncing:!1}),hfe({getAccounts:t,getPrivateKey:r,processTransaction:n,processEthSignMessage:o,processSignTransaction:i,processTypedMessage:a,processTypedMessageV3:s,processTypedMessageV4:c,processPersonalMessage:u,processEncryptionPublicKey:l,processDecryptMessage:f})])}function mfe(e){let{addChain:t,switchChain:r}=e;return _f({wallet_addEthereumChain:kf((async function(e,r){var n;const i=null!==(n=e.params)&&void 0!==n&&n.length?e.params[0]:void 0;if(!i)throw ff.invalidParams("Missing chain params");if(!i.chainId)throw ff.invalidParams("Missing chainId in chainParams");if(!i.rpcUrls||0===i.rpcUrls.length)throw ff.invalidParams("Missing rpcUrls in chainParams");if(!i.nativeCurrency)throw ff.invalidParams("Missing nativeCurrency in chainParams");r.result=await t(i)})),wallet_switchEthereumChain:kf((async function(e,t){var n;const i=null!==(n=e.params)&&void 0!==n&&n.length?e.params[0]:void 0;if(!i)throw ff.invalidParams("Missing chainId");t.result=await r(i)}))})}function bfe(e){return(t,r,n,i)=>"eth_chainId"===t.method?(r.result=e,i()):n()}function gfe(e){return(t,r,n,i)=>"eth_provider_config"===t.method?(r.result=e,i()):n()}function yfe(e){const{chainId:t,rpcTarget:r}=e,n=rE({rpcTarget:r});return{networkMiddleware:Pf([bfe(t),gfe(e),n]),fetchMiddleware:n}}async function vfe(e){if(e.session.length){const t=e.session.keys.length-1;return e.session.get(e.session.keys[t])}return null}async function wfe(e,t,r,n){const i=await vfe(e);if(!i)throw df.disconnected();return e.request({topic:i.topic,chainId:`eip155:${t}`,request:{method:r,params:n}})}async function Efe(e){const t=await vfe(e);if(!t)throw df.disconnected();const r=I1(t.namespaces);if(r&&r.length)return[...new Set(r.map((e=>S1(e).address)))];throw new Error("Failed to get accounts")}Ele.ValidatorResult=Ale.ValidatorResult,Ele.ValidatorResultError=Ale.ValidatorResultError,Ele.ValidationError=Ale.ValidationError,Ele.SchemaError=Ale.SchemaError,Ele.SchemaScanResult=Wle.SchemaScanResult,Ele.scan=Wle.scan,Ele.validate=function(e,t,r){return(new ffe).validate(e,t,r)};class Afe extends oE{constructor(e){let{config:t,state:n,connector:o}=e;super({config:{chainConfig:i(i({},t.chainConfig),{},{chainNamespace:Ed.EIP155}),skipLookupNetwork:!!t.skipLookupNetwork},state:i(i({},n||{}),{},{chainId:"loading",accounts:[]})}),r(this,"connector",null),this.connector=o||null}async enable(){if(!this.connector)throw df.custom({message:"Connector is not initialized, pass wallet connect connector in constructor",code:4902});return await this.setupProvider(this.connector),this._providerEngineProxy.request({method:"eth_accounts"})}async setupProvider(e){this.onConnectorStateUpdate(e),await this.setupEngine(e)}async switchChain(e){let{chainId:t}=e;if(!this.connector)throw df.custom({message:"Connector is not initialized, pass wallet connect connector in constructor",code:4902});const r=this.getChainConfig(t);this.configure({chainConfig:r}),await this.setupEngine(this.connector),this.lookupNetwork(this.connector)}async addChain(e){super.addChain(e)}async lookupNetwork(e){const t=this.config.chainConfig.chainId;return this.update({chainId:t}),this.emit("chainChanged",t),this.emit("connect",{chainId:t}),this.config.chainConfig.chainId}async setupEngine(e){const{chainId:t}=this.config.chainConfig,r=function(e){let{connector:t,chainId:r}=e;return{getPrivateKey:async()=>{throw ff.methodNotSupported()},getAccounts:async e=>Efe(t),processTransaction:async(e,n)=>await wfe(t,r,"eth_sendTransaction",[e]),processSignTransaction:async(e,n)=>await wfe(t,r,"eth_signTransaction",[e]),processEthSignMessage:async(e,n)=>await wfe(t,r,"eth_sign",[e.from,e.data]),processPersonalMessage:async(e,n)=>await wfe(t,r,"personal_sign",[e.from,e.data]),processTypedMessage:async(e,n)=>await wfe(t,r,"eth_signTypedData",[e.data,e.from]),processTypedMessageV3:async e=>await wfe(t,r,"eth_signTypedData_v3",[e.from,e.data]),processTypedMessageV4:async e=>await wfe(t,r,"eth_signTypedData_v4",[e.from,e.data]),processEncryptionPublicKey:async e=>{throw ff.methodNotSupported()},processDecryptMessage:e=>{throw ff.methodNotSupported()}}}({connector:e,chainId:parseInt(t,16)}),n=await Efe(e);this.update({accounts:n||[]});const i=pfe(r),o=this.getChainSwitchMiddleware(),a=new Sf,{networkMiddleware:s}=yfe(this.config.chainConfig);a.push(i),a.push(o),a.push(s);const c=If(a);this.updateProviderEngineProxy(c)}getChainSwitchMiddleware(){return mfe({addChain:async e=>{const{chainId:t,chainName:r,rpcUrls:n,blockExplorerUrls:i,nativeCurrency:o}=e;this.addChain({chainNamespace:Ed.EIP155,chainId:t,ticker:(null==o?void 0:o.symbol)||"ETH",tickerName:(null==o?void 0:o.name)||"Ether",displayName:r,rpcTarget:n[0],blockExplorer:(null==i?void 0:i[0])||"",decimals:(null==o?void 0:o.decimals)||18})},switchChain:async e=>{const{chainId:t}=e;await this.switchChain({chainId:t})}})}connectedTopic(){var e;if(!this.connector)throw Sd.notConnectedError("Wallet connect connector is not connected");if(null!==(e=this.connector)&&void 0!==e&&null!==(e=e.session)&&void 0!==e&&e.length){var t;const e=this.connector.session.keys.length-1;return null===(t=this.connector.session.get(this.connector.session.keys[e]))||void 0===t?void 0:t.topic}}checkIfChainIdAllowed(e){if(!this.connector||!this.connectedTopic())return!1;const t=T1(this.connector.session.get(this.connectedTopic()).namespaces);let r=!1;for(const n of t){const t=k1(n);if(Number.parseInt(t.reference,10)===Number.parseInt(e,10)){r=!0;break}}return r}checkIfAccountAllowed(e){if(!this.connector||!this.connectedTopic())return!1;const t=I1(this.connector.session.get(this.connectedTopic()).namespaces);let r=!1;for(const i of t){var n;if((null===(n=S1(i).address)||void 0===n?void 0:n.toLowerCase())===(null==e?void 0:e.toLowerCase())){r=!0;break}}return r}async onConnectorStateUpdate(e){e.events.on("session_event",(async t=>{if(Ld.debug("session_event data",t),!this.provider)throw Sd.notConnectedError("Wallet connect connector is not connected");const{event:r}=t.params,{name:n,data:o}=r||{};if("accountsChanged"===n&&null!=o&&o.length&&this.state.accounts[0]!==o[0]&&this.checkIfAccountAllowed(o[0])&&(this.update({accounts:o}),this.emit("accountsChanged",o)),"chainChanged"===r.name){const{chainId:t,rpcUrl:r}=o,n=`0x${t.toString(16)}`;if(!this.checkIfChainIdAllowed(n))return;if(n&&this.state.chainId!==n){const t=xd(Ed.EIP155,n)||{};this.configure({chainConfig:i(i({},t),{},{chainId:n,rpcTarget:r,chainNamespace:Ed.EIP155})}),await this.setupEngine(e)}}}))}}ufe=Afe,r(Afe,"getProviderInstance",(async e=>{const t=new ufe({config:{chainConfig:e.chainConfig,skipLookupNetwork:e.skipLookupNetwork}});return await t.setupProvider(e.connector),t}));const xfe=new Hp("1e18"),_fe=new Hp("1e9"),kfe=new Hp("1"),Sfe={hex:e=>new Hp("string"==typeof e?F3(e):e,16),dec:e=>new Hp(e,10)},Pfe={WEI:e=>e.div(xfe),GWEI:e=>e.div(_fe),ETH:e=>e.div(kfe)},Ife={WEI:e=>e.times(xfe).dp(0,Hp.ROUND_HALF_UP),GWEI:e=>e.times(_fe).dp(9,Hp.ROUND_HALF_UP),ETH:e=>e.times(kfe).dp(9,Hp.ROUND_HALF_UP)},Tfe={hex:e=>e.toString(16),dec:e=>new Hp(e).toString(10)},Ofe=(e,t)=>{let{fromNumericBase:r="hex",toNumericBase:n,fromDenomination:i,toDenomination:o,numberOfDecimals:a}=t;return(e=>{const{value:t,fromNumericBase:r,fromDenomination:n,toNumericBase:i,toDenomination:o,numberOfDecimals:a}=e;let s=Sfe[r](t);return n&&(s=Pfe[n](s)),o&&(s=Ife[o](s)),a&&(s=s.dp(a,Hp.ROUND_HALF_DOWN)),i&&(s=Tfe[i](s)),s})({fromNumericBase:r,toNumericBase:n,fromDenomination:i,toDenomination:o,numberOfDecimals:a,value:e||"0"})};function Mfe(e){return Ofe(e,{fromNumericBase:"dec",toNumericBase:"hex",fromDenomination:"GWEI",toDenomination:"WEI"})}function Cfe(e){return Ofe(e,{fromNumericBase:"hex",toNumericBase:"dec",fromDenomination:"WEI",toDenomination:"GWEI"})}function Bfe(e){return Cfe(Mfe(e)).toString()}const Nfe=(e,t)=>{try{ule.ok(e&&"object"==typeof e,"Params must be an object."),ule.ok("data"in e,'Params must include a "data" field.'),ule.ok("from"in e,'Params must include a "from" field.'),ule.ok("string"==typeof e.from&&m8(e.from),'"from" field must be a valid, lowercase, hexadecimal Ethereum address string.');let n=null,i=null;switch(e.version){case m4.SignTypedDataVersion.V1:"string"==typeof e.data?ule.doesNotThrow((()=>{n=JSON.parse(e.data)}),'"data" must be a valid JSON string.'):n=e.data,ule.ok(Array.isArray(n),"params.data must be an array."),ule.doesNotThrow((()=>{m4.typedSignatureHash(n)}),"Signing data must be valid EIP-712 typed data.");break;case m4.SignTypedDataVersion.V3:case m4.SignTypedDataVersion.V4:{var r;"string"==typeof e.data?ule.doesNotThrow((()=>{n=JSON.parse(e.data)}),'"data" must be a valid JSON string.'):n=e.data;const o=n;ule.ok(o.primaryType in o.types,`Primary type of "${o.primaryType}" has no type definition.`);const a=Ele.validate(o,m4.TYPED_MESSAGE_SCHEMA.properties);ule.strictEqual(a.errors.length,0,"Signing data must conform to EIP-712 schema. See https://git.io/fNtcx."),i=null===(r=o.domain)||void 0===r?void 0:r.chainId,i&&(ule.ok(!Number.isNaN(t),`Cannot sign messages for chainId "${i}", because Web3Auth is switching networks.`),"string"==typeof i&&(i=Number.parseInt(i,Ud(i)?16:10)),ule.strictEqual(i,t,`Provided chainId "${i}" must match the active chainId "${t}"`));break}default:ule.fail(`Unknown typed data version "${e.version}"`)}}catch(e){throw ff.invalidInput({message:null==e?void 0:e.message})}};async function Rfe(e,t,r){const n=await r.formatTransaction(e),i=await r.getCommonConfiguration(),o=p4.fromTxData(n,{common:i}).sign(_.from(t,"hex")).serialize();return _.from(o)}function Ffe(e){return r8(e.toString(16))}function Lfe(e){return hH.isBN(e)?e:new hH(F3(e),16)}const jfe="0x0",Ufe="0x2",Dfe="sentEther",zfe="contractInteraction",$fe="contractDeployment",Hfe="fee-market",Gfe="legacy",qfe="eth_gasPrice";class Kfe{constructor(e){let{getProviderEngineProxy:t}=e;r(this,"API_SUPPORTED_CHAINIDS",new Set(["0x1","0x5","0x13881","0xa4b1","0xa86a","0x2105","0x38","0xfa","0xa","0x89"])),r(this,"chainConfig",null),r(this,"getProviderEngineProxy",void 0),r(this,"isEIP1559Compatible",!1),this.getProviderEngineProxy=t}get providerProxy(){return this.getProviderEngineProxy()}async init(){this.chainConfig=await this.providerProxy.request({method:"eth_provider_config"}),this.isEIP1559Compatible=await this.getEIP1559Compatibility()}async getCommonConfiguration(){if(!this.chainConfig)throw new Error("Chain config not initialized");const{displayName:e,chainId:t}=this.chainConfig,r=this.isEIP1559Compatible?R8.Paris:R8.Berlin,n={name:e,chainId:"loading"===t?0:Number.parseInt(t,16),networkId:"loading"===t?0:Number.parseInt(t,16),defaultHardfork:r};return G8.custom(n)}async formatTransaction(e){if(!this.chainConfig)throw new Error("Chain config not initialized");const t=i({},e);if(void 0===t.nonce&&(t.nonce=await this.providerProxy.request({method:"eth_getTransactionCount",params:[e.from,"latest"]})),!this.isEIP1559Compatible&&t.gasPrice){if(t.maxFeePerGas&&delete t.maxFeePerGas,t.maxPriorityFeePerGas&&delete t.maxPriorityFeePerGas,!t.gasLimit)if(t.gas)t.gasLimit=t.gas;else{const e=await this.getDefaultGasLimit(t);e&&(t.gasLimit=e)}return t}if(!t.gasLimit)if(t.gas)t.gasLimit=t.gas;else{const e=await this.getDefaultGasLimit(t);e&&(t.gasLimit=e)}const{gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:o}=await this.getDefaultGasFees(t);var a,s;return this.isEIP1559Compatible?(!t.gasPrice||t.maxFeePerGas||t.maxPriorityFeePerGas?(n&&!t.maxFeePerGas&&(t.maxFeePerGas=n),o&&!t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=o),r&&!t.maxFeePerGas&&(t.maxFeePerGas=r),t.maxFeePerGas&&!t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=t.maxFeePerGas)):(t.maxFeePerGas=t.gasPrice,t.maxPriorityFeePerGas=(a="string"==typeof o?F3(o):o,s="string"==typeof t.gasPrice?F3(t.gasPrice):t.gasPrice,null!=a&&null!=s&&new Hp(a,10).lt(s,10)?o:t.gasPrice)),delete t.gasPrice):(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),!r||t.gasPrice||t.maxPriorityFeePerGas||t.maxFeePerGas||(t.gasPrice=r),t.type=this.isEIP1559Compatible?Ufe:jfe,t.chainId=this.chainConfig.chainId,t}async fetchEthGasPriceEstimate(){return{gasPrice:Cfe(await this.providerProxy.request({method:"eth_gasPrice",params:[]})).toString()}}async fetchGasEstimatesViaEthFeeHistory(){const e=await this.providerProxy.request({method:"eth_feeHistory",params:[10,"latest",[10,50,95]]}),t=e.baseFeePerGas[e.baseFeePerGas.length-1],r=e.reward.reduce(((e,t)=>({slow:e.slow.plus(new Hp(t[0],16)),average:e.average.plus(new Hp(t[1],16)),fast:e.fast.plus(new Hp(t[2],16))})),{slow:new Hp(0),average:new Hp(0),fast:new Hp(0)});return{estimatedBaseFee:Cfe(t).toString(),high:{maxWaitTimeEstimate:3e4,minWaitTimeEstimate:15e3,suggestedMaxFeePerGas:Cfe(r.fast.plus(t).toString(16)).toString(),suggestedMaxPriorityFeePerGas:Cfe(r.fast.toString(16)).toString()},medium:{maxWaitTimeEstimate:45e3,minWaitTimeEstimate:15e3,suggestedMaxFeePerGas:Cfe(r.average.plus(t).toString(16)).toString(),suggestedMaxPriorityFeePerGas:Cfe(r.average.toString(16)).toString()},low:{maxWaitTimeEstimate:6e4,minWaitTimeEstimate:15e3,suggestedMaxFeePerGas:Cfe(r.slow.plus(t).toString(16)).toString(),suggestedMaxPriorityFeePerGas:Cfe(r.slow.toString(16)).toString()}}}async getEIP1559Compatibility(){const e=await this.providerProxy.request({method:"eth_getBlockByNumber",params:["latest",!1]});return!!(e&&void 0!==e.baseFeePerGas)}async fetchGasFeeEstimateData(){if(!this.chainConfig)throw new Error("Chain config not initialized");const e="0x1"===this.chainConfig.chainId,t=Number.parseInt(this.chainConfig.chainId,16);let r;try{if(this.isEIP1559Compatible){let e;try{if(!this.API_SUPPORTED_CHAINIDS.has(this.chainConfig.chainId))throw new Error("Chain id not supported by api");e=await async function(e){const t=await yd(e);return i(i({},t),{},{estimatedBaseFee:Bfe(t.estimatedBaseFee),low:i(i({},t.low),{},{suggestedMaxPriorityFeePerGas:Bfe(t.low.suggestedMaxPriorityFeePerGas),suggestedMaxFeePerGas:Bfe(t.low.suggestedMaxFeePerGas)}),medium:i(i({},t.medium),{},{suggestedMaxPriorityFeePerGas:Bfe(t.medium.suggestedMaxPriorityFeePerGas),suggestedMaxFeePerGas:Bfe(t.medium.suggestedMaxFeePerGas)}),high:i(i({},t.high),{},{suggestedMaxPriorityFeePerGas:Bfe(t.high.suggestedMaxPriorityFeePerGas),suggestedMaxFeePerGas:Bfe(t.high.suggestedMaxFeePerGas)})})}("https://gas-api.metaswap.codefi.network/networks//suggestedGasFees".replace("",`${t}`))}catch(t){e=await this.fetchGasEstimatesViaEthFeeHistory()}r={gasFeeEstimates:e,gasEstimateType:Hfe}}else{if(!e)throw new Error("Main gas fee/price estimation failed. Use fallback");{const e=await async function(e){const t=await yd(e,{referrer:e,referrerPolicy:"no-referrer-when-downgrade",method:"GET",mode:"cors"});return{low:t.SafeGasPrice,medium:t.ProposeGasPrice,high:t.FastGasPrice}}("https://gas-api.metaswap.codefi.network/networks//gasPrices".replace("",`${t}`));r={gasFeeEstimates:e,gasEstimateType:Gfe}}}}catch(e){try{r={gasFeeEstimates:await this.fetchEthGasPriceEstimate(),gasEstimateType:qfe}}catch(e){throw new Error(`Gas fee/price estimation failed. Message: ${e.message}`)}}return r}async getDefaultGasFees(e){if(!this.isEIP1559Compatible&&e.gasPrice||this.isEIP1559Compatible&&e.maxFeePerGas&&e.maxPriorityFeePerGas)return{};try{const{gasFeeEstimates:e,gasEstimateType:t}=await this.fetchGasFeeEstimateData();if(this.isEIP1559Compatible&&t===Hfe){const{medium:{suggestedMaxPriorityFeePerGas:t,suggestedMaxFeePerGas:r}={}}=e;if(t&&r)return{maxFeePerGas:r8(Mfe(r)),maxPriorityFeePerGas:r8(Mfe(t))}}else{if(t===Gfe)return{gasPrice:r8(Mfe(e.medium))};if(t===qfe)return{gasPrice:r8(Mfe(e.gasPrice))}}}catch(e){Ld.error(e)}const{gasPrice:t}=await this.fetchEthGasPriceEstimate();return{gasPrice:r8(Mfe(t))}}async estimateTxGas(e){const t=i({},e);delete t.gasPrice,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas;return await this.providerProxy.request({method:"eth_estimateGas",params:[t]})}async analyzeGasUsage(e){const t=await this.providerProxy.request({method:"eth_getBlockByNumber",params:["latest",!1]});let r=Ffe(function(e,t,r){const n=new hH(t),i=new hH(r);return e.mul(n).div(i)}(Lfe(t.gasLimit),19,20));try{r=await this.estimateTxGas(e)}catch(e){Ld.warn(e)}return{blockGasLimit:t.gasLimit,estimatedGasHex:r}}addGasBuffer(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1.5;const n=Lfe(e),i=Lfe(t).muln(.9),o=n.muln(r);return n.gt(i)?Ffe(n):o.lt(i)?Ffe(o):Ffe(i)}async determineTransactionCategory(e){const{data:t,to:r}=e;let n,i="";if(t&&!r)n=$fe;else{try{i=await this.providerProxy.request({method:"eth_getCode",params:[r,"latest"]})}catch(e){Ld.warn(e)}n=!i||"0x"===i||"0x0"===i?Dfe:zfe}return{transactionCategory:n,code:i}}async getDefaultGasLimit(e){const{transactionCategory:t}=await this.determineTransactionCategory(i({},e));if(e.gas)return e.gas;if(e.to&&t===Dfe){if(e.data)throw Error("TxGasUtil - Trying to call a function on a non-contract address");return r8(21e3.toString(16))}const{blockGasLimit:r,estimatedGasHex:n}=await this.analyzeGasUsage(e);return this.addGasBuffer(r8(n),r)}}var Vfe;class Wfe extends oE{constructor(e){let{config:t,state:r}=e;super({config:{chainConfig:i(i({},t.chainConfig),{},{chainNamespace:Ed.EIP155})},state:r})}async enable(){if(!this.state.privateKey)throw df.custom({message:"Private key is not found in state, plz pass it in constructor state param",code:4902});return await this.setupProvider(this.state.privateKey),this._providerEngineProxy.request({method:"eth_accounts"})}async setupProvider(e){const t=new Kfe({getProviderEngineProxy:this.getProviderEngineProxy.bind(this)}),r=function(e){let{txFormatter:t,privKey:r,getProviderEngineProxy:n}=e;return{getAccounts:async e=>[`0x${_.from(y8(_.from(r,"hex"))).toString("hex")}`],getPrivateKey:async e=>r,processTransaction:async(e,i)=>{const o=n();if(!o)throw df.custom({message:"Provider is not initialized",code:4902});e.input&&!e.data&&(e.data=e.input);const a=await Rfe(e,r,t);return await o.request({method:"eth_sendRawTransaction",params:["0x".concat(a.toString("hex"))]})},processSignTransaction:async(e,i)=>{if(!n())throw df.custom({message:"Provider is not initialized",code:4902});return e.input&&!e.data&&(e.data=e.input),`0x${(await Rfe(e,r,t)).toString("hex")}`},processEthSignMessage:async(e,t)=>Yw(r,e.data),processPersonalMessage:async(e,t)=>{const n=_.from(r,"hex");return m4.personalSign({privateKey:n,data:e.data})},processTypedMessage:async(e,t)=>{Ld.debug("processTypedMessage",e);const o=_.from(r,"hex"),a=n();if(!a)throw df.custom({message:"Provider is not initialized",code:4902});const s=await a.request({method:"eth_chainId"}),c=Number.parseInt(s,Ud(s)?16:10),u=i(i({},e),{},{version:m4.SignTypedDataVersion.V1});Nfe(u,c);const l="string"==typeof u.data?JSON.parse(u.data):u.data;return m4.signTypedData({privateKey:o,data:l,version:m4.SignTypedDataVersion.V1})},processTypedMessageV3:async(e,t)=>{Ld.debug("processTypedMessageV3",e);const i=_.from(r,"hex"),o=n();if(!o)throw df.custom({message:"Provider is not initialized",code:4902});const a=await o.request({method:"eth_chainId"}),s=Number.parseInt(a,Ud(a)?16:10);Nfe(e,s);const c="string"==typeof e.data?JSON.parse(e.data):e.data;return m4.signTypedData({privateKey:i,data:c,version:m4.SignTypedDataVersion.V3})},processTypedMessageV4:async(e,t)=>{Ld.debug("processTypedMessageV4",e);const i=_.from(r,"hex"),o=n();if(!o)throw df.custom({message:"Provider is not initialized",code:4902});const a=await o.request({method:"eth_chainId"}),s=Number.parseInt(a,Ud(a)?16:10);Nfe(e,s);const c="string"==typeof e.data?JSON.parse(e.data):e.data;return m4.signTypedData({privateKey:i,data:c,version:m4.SignTypedDataVersion.V4})},processEncryptionPublicKey:async(e,t)=>(Ld.info("processEncryptionPublicKey",e),m4.getEncryptionPublicKey(r)),processDecryptMessage:(e,t)=>{Ld.info("processDecryptMessage",e);const n=F3(e.data),i=_.from(n,"hex");return m4.decrypt({encryptedData:JSON.parse(i.toString("utf8")),privateKey:r})}}}({txFormatter:t,privKey:e,getProviderEngineProxy:this.getProviderEngineProxy.bind(this)}),n=pfe(r),o=this.getChainSwitchMiddleware(),a=new Sf,{networkMiddleware:s}=yfe(this.config.chainConfig);a.push(n),a.push(o),a.push(this.getAccountMiddleware()),a.push(s);const c=If(a);this.updateProviderEngineProxy(c),await t.init(),await this.lookupNetwork()}async updateAccount(e){if(!this._providerEngineProxy)throw df.custom({message:"Provider is not initialized",code:4902});await this._providerEngineProxy.request({method:"eth_private_key"})!==e.privateKey&&(await this.setupProvider(e.privateKey),this.emit("accountsChanged",{accounts:await this._providerEngineProxy.request({method:"eth_accounts"})}))}async switchChain(e){if(!this._providerEngineProxy)throw df.custom({message:"Provider is not initialized",code:4902});const t=this.getChainConfig(e.chainId);this.update({chainId:"loading"}),this.configure({chainConfig:t});const r=await this._providerEngineProxy.request({method:"eth_private_key"});await this.setupProvider(r)}async lookupNetwork(){if(!this._providerEngineProxy)throw df.custom({message:"Provider is not initialized",code:4902});const{chainId:e}=this.config.chainConfig;if(!e)throw ff.invalidParams("chainId is required while lookupNetwork");const t=await this._providerEngineProxy.request({method:"net_version",params:[]});if(parseInt(e,16)!==parseInt(t,10))throw df.chainDisconnected(`Invalid network, net_version is: ${t}`);return this.state.chainId!==e&&(this.emit("chainChanged",e),this.emit("connect",{chainId:e})),this.update({chainId:e}),t}getChainSwitchMiddleware(){return mfe({addChain:async e=>{const{chainId:t,chainName:r,rpcUrls:n,blockExplorerUrls:i,nativeCurrency:o}=e;this.addChain({chainNamespace:Ed.EIP155,chainId:t,ticker:(null==o?void 0:o.symbol)||"ETH",tickerName:(null==o?void 0:o.name)||"Ether",displayName:r,rpcTarget:n[0],blockExplorer:(null==i?void 0:i[0])||"",decimals:(null==o?void 0:o.decimals)||18})},switchChain:async e=>{const{chainId:t}=e;await this.switchChain({chainId:t})}})}getAccountMiddleware(){return function(e){let{updatePrivatekey:t}=e;return _f({wallet_updateAccount:kf((async function(e,r){var n;const i=null!==(n=e.params)&&void 0!==n&&n.length?e.params[0]:void 0;if(null==i||!i.privateKey)throw ff.invalidParams("Missing privateKey");r.result=await t(i)}))})}({updatePrivatekey:async e=>{const{privateKey:t}=e;await this.updateAccount({privateKey:t})}})}}function Jfe(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}Vfe=Wfe,r(Wfe,"getProviderInstance",(async e=>{const t=new Vfe({config:{chainConfig:e.chainConfig}});return await t.setupProvider(e.privKey),t}));let Zfe=class e extends Error{constructor(t,r={}){super(),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ViemError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"viem@2.17.11"});const n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,i=r.cause instanceof e&&r.cause.docsPath||r.docsPath;this.message=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...i?[`Docs: ${r.docsBaseUrl??"https://viem.sh"}${i}${r.docsSlug?`#${r.docsSlug}`:""}`]:[],...n?[`Details: ${n}`]:[],`Version: ${this.version}`].join("\n"),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.shortMessage=t}walk(e){return Yfe(this,e)}};function Yfe(e,t){return t?.(e)?e:e&&"object"==typeof e&&"cause"in e?Yfe(e.cause,t):t?null:e}class Xfe extends Zfe{constructor({max:e,min:t,signed:r,size:n,value:i}){super(`Number "${i}" is not in safe ${n?`${8*n}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntegerOutOfRangeError"})}}class Qfe extends Zfe{constructor(e){super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidBytesBooleanError"})}}class ede extends Zfe{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeOverflowError"})}}function tde(e,{strict:t=!0}={}){return!!e&&("string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")))}function rde(e){return tde(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function nde(e,{dir:t="left"}={}){let r="string"==typeof e?e.replace("0x",""):e,n=0;for(let e=0;er)throw new ode({size:e.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;i2*r)throw new ode({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n["right"===t?"padEnd":"padStart"](2*r,"0")}`}const ude=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function lde(e,t={}){return"number"==typeof e||"bigint"==typeof e?hde(e,t):"string"==typeof e?mde(e,t):"boolean"==typeof e?fde(e,t):dde(e,t)}function fde(e,t={}){const r=`0x${Number(e)}`;return"number"==typeof t.size?(Ade(r,{size:t.size}),sde(r,{size:t.size})):r}function dde(e,t={}){let r="";for(let t=0;to||i=yde.zero&&e<=yde.nine?e-yde.zero:e>=yde.A&&e<=yde.F?e-(yde.A-10):e>=yde.a&&e<=yde.f?e-(yde.a-10):void 0}function wde(e,t={}){let r=e;t.size&&(Ade(r,{size:t.size}),r=sde(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,o=new Uint8Array(i);for(let e=0,t=0;et)throw new ede({givenSize:rde(e),maxSize:t})}function xde(e,t={}){const{signed:r}=t;t.size&&Ade(e,{size:t.size});const n=BigInt(e);if(!r)return n;const i=(e.length-2)/2;return n<=(1n<<8n*BigInt(i)-1n)-1n?n:n-BigInt(`0x${"f".padStart(2*i,"f")}`)-1n}function _de(e,t={}){return Number(xde(e,t))}const kde={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844"};function Sde(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?_de(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?_de(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?kde[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if("bigint"==typeof t.v){if(0n===t.v||27n===t.v)return 0;if(1n===t.v||28n===t.v)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),"legacy"===t.type&&(delete t.accessList,delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),"eip2930"===t.type&&(delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),"eip1559"===t.type&&delete t.maxFeePerBlobGas,t}function Pde(e){const t=e.transactions?.map((e=>"string"==typeof e?e:Sde(e)));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}function Ide(e,{args:t,eventName:r}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...r?{args:t,eventName:r}:{}}}const Tde={"0x0":"reverted","0x1":"success"};function Ode(e){const t={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map((e=>Ide(e))):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?_de(e.transactionIndex):null,status:e.status?Tde[e.status]:null,type:e.type?kde[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}class Mde extends Zfe{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAddressError"})}}class Cde extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}set(e,t){return super.set(e,t),this.maxSize&&this.size>this.maxSize&&this.delete(this.keys().next().value),this}}function Bde(e,t){const r=t||"hex",n=dc(tde(e,{strict:!1})?gde(e):e);return"bytes"===r?n:lde(n)}const Nde=new Cde(8192);function Rde(e,t){if(Nde.has(`${e}.${t}`))return Nde.get(`${e}.${t}`);const r=e.substring(2).toLowerCase(),n=Bde(Ede(r),"bytes"),i=r.split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(15&n[e>>1])>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());const o=`0x${i.join("")}`;return Nde.set(`${e}.${t}`,o),o}const Fde=/^0x[a-fA-F0-9]{40}$/,Lde=new Cde(8192);function jde(e,t){const{strict:r=!0}=t??{},n=`${e}.${r}`;if(Lde.has(n))return Lde.get(n);const i=!(!Fde.test(e)||e.toLowerCase()!==e&&r&&Rde(e)!==e);return Lde.set(n,i),i}function Ude(e){return"string"==typeof e[0]?Dde(e):function(e){let t=0;for(const r of e)t+=r.length;const r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}(e)}function Dde(e){return`0x${e.reduce(((e,t)=>e+t.replace("0x","")),"")}`}class zde extends Zfe{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NegativeOffsetError"})}}class $de extends Zfe{constructor({length:e,position:t}){super(`Position \`${t}\` is out of bounds (\`0 < position < ${e}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PositionOutOfBoundsError"})}}class Hde extends Zfe{constructor({count:e,limit:t}){super(`Recursive read limit of \`${t}\` exceeded (recursive read count: \`${e}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RecursiveReadLimitExceededError"})}}const Gde={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new Hde({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new $de({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new zde({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new zde({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const r=t??this.position;return this.assertPosition(r+e-1),this.bytes.subarray(r,r+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,255&e),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const r=this.inspectBytes(e);return this.position+=t??e,r},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function qde(e,{recursiveReadLimit:t=8192}={}){const r=Object.create(Gde);return r.bytes=e,r.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=t,r}const Kde={gwei:9,wei:18},Vde={ether:-9,wei:9};function Wde(e,t){let r=e.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(t,"0");let[i,o]=[r.slice(0,r.length-t),r.slice(r.length-t)];return o=o.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${o?`.${o}`:""}`}function Jde(e,t="wei"){return Wde(e,Kde[t])}function Zde(e,t="wei"){return Wde(e,Vde[t])}function Yde(e){const t=Object.entries(e).map((([e,t])=>void 0===t||!1===t?null:[e,t])).filter(Boolean),r=t.reduce(((e,[t])=>Math.max(e,t.length)),0);return t.map((([e,t])=>` ${`${e}:`.padEnd(r+1)} ${t}`)).join("\n")}class Xde extends Zfe{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeConflictError"})}}class Qde extends Zfe{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Yde(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- a Legacy Transaction with `gasPrice`"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSerializableTransactionError"})}}class ehe extends Zfe{constructor({blockHash:e,blockNumber:t,blockTag:r,hash:n,index:i}){let o="Transaction";r&&void 0!==i&&(o=`Transaction at block time "${r}" at index "${i}"`),e&&void 0!==i&&(o=`Transaction at block hash "${e}" at index "${i}"`),t&&void 0!==i&&(o=`Transaction at block number "${t}" at index "${i}"`),n&&(o=`Transaction with hash "${n}"`),super(`${o} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionNotFoundError"})}}class the extends Zfe{constructor({hash:e}){super(`Transaction receipt with hash "${e}" could not be found. The Transaction may not be processed on a block yet.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionReceiptNotFoundError"})}}class rhe extends Zfe{constructor({hash:e}){super(`Timed out while waiting for transaction with hash "${e}" to be confirmed.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WaitForTransactionReceiptTimeoutError"})}}function nhe(e){const{kzg:t}=e,r=e.to??("string"==typeof e.blobs[0]?"hex":"bytes"),n="string"==typeof e.blobs[0]?e.blobs.map((e=>wde(e))):e.blobs,i=[];for(const e of n)i.push(Uint8Array.from(t.blobToKzgCommitment(e)));return"bytes"===r?i:i.map((e=>dde(e)))}function ihe(e){const{kzg:t}=e,r=e.to??("string"==typeof e.blobs[0]?"hex":"bytes"),n="string"==typeof e.blobs[0]?e.blobs.map((e=>wde(e))):e.blobs,i="string"==typeof e.commitments[0]?e.commitments.map((e=>wde(e))):e.commitments,o=[];for(let e=0;edde(e)))}function ohe(e){const{commitment:t,version:r=1}=e,n=e.to??("string"==typeof t?"hex":"bytes"),i=function(e){return Vd(tde(e,{strict:!1})?gde(e):e)}(t);return i.set([r],0),"bytes"===n?i:dde(i)}const ahe=32,she=4096,che=ahe*she,uhe=6*che-1-1*she*6;class lhe extends Zfe{constructor({maxSize:e,size:t}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${t} bytes`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlobSizeTooLargeError"})}}class fhe extends Zfe{constructor(){super("Blob data must not be empty."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EmptyBlobError"})}}function dhe(e){const{data:t,kzg:r,to:n}=e,i=e.blobs??function(e){const t=e.to??("string"==typeof e.data?"hex":"bytes"),r="string"==typeof e.data?wde(e.data):e.data,n=rde(r);if(!n)throw new fhe;if(n>uhe)throw new lhe({maxSize:uhe,size:n});const i=[];let o=!0,a=0;for(;o;){const e=qde(new Uint8Array(che));let t=0;for(;te.bytes)):i.map((e=>dde(e.bytes)))}({data:t,to:n}),o=e.commitments??nhe({blobs:i,kzg:r,to:n}),a=e.proofs??ihe({blobs:i,commitments:o,kzg:r,to:n}),s=[];for(let e=0;ee?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${r.name}" configured.`]]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDoesNotSupportContract"})}}class phe extends Zfe{constructor(){super("No chain was provided to the Client."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ClientChainNotConfiguredError"})}}class mhe extends Zfe{constructor({cause:e,message:t}={}){const r=t?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ExecutionRevertedError"})}}Object.defineProperty(mhe,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(mhe,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class bhe extends Zfe{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${Zde(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooHigh"})}}Object.defineProperty(bhe,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class ghe extends Zfe{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${Zde(t)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooLow"})}}Object.defineProperty(ghe,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class yhe extends Zfe{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is higher than the next one expected.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooHighError"})}}Object.defineProperty(yhe,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class vhe extends Zfe{constructor({cause:e,nonce:t}={}){super([`Nonce provided for the transaction ${t?`(${t}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join("\n"),{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooLowError"})}}Object.defineProperty(vhe,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class whe extends Zfe{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}exceeds the maximum allowed nonce.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceMaxValueError"})}}Object.defineProperty(whe,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Ehe extends Zfe{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join("\n"),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InsufficientFundsError"})}}Object.defineProperty(Ehe,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds/});class Ahe extends Zfe{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooHighError"})}}Object.defineProperty(Ahe,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class xhe extends Zfe{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction is too low.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooLowError"})}}Object.defineProperty(xhe,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class _he extends Zfe{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionTypeNotSupportedError"})}}Object.defineProperty(_he,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class khe extends Zfe{constructor({cause:e,maxPriorityFeePerGas:t,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${Zde(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Zde(r)} gwei`:""}).`].join("\n"),{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TipAboveFeeCapError"})}}Object.defineProperty(khe,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class She extends Zfe{constructor({cause:e}){super(`An error occurred while executing: ${e?.shortMessage}`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownNodeError"})}}function Phe(e,t,r,{strict:n}={}){return tde(e,{strict:!1})?Mhe(e,t,r,{strict:n}):Ohe(e,t,r,{strict:n})}function Ihe(e,t){if("number"==typeof t&&t>0&&t>rde(e)-1)throw new ide({offset:t,position:"start",size:rde(e)})}function The(e,t,r){if("number"==typeof t&&"number"==typeof r&&rde(e)!==r-t)throw new ide({offset:r,position:"end",size:rde(e)})}function Ohe(e,t,r,{strict:n}={}){Ihe(e,t);const i=e.slice(t,r);return n&&The(i,t,r),i}function Mhe(e,t,r,{strict:n}={}){Ihe(e,t);const i=`0x${e.replace("0x","").slice(2*(t??0),2*(r??e.length))}`;return n&&The(i,t,r),i}const Che={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3"};function Bhe(e){const t={};return void 0!==e.accessList&&(t.accessList=e.accessList),void 0!==e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes),void 0!==e.blobs&&("string"!=typeof e.blobs[0]?t.blobs=e.blobs.map((e=>dde(e))):t.blobs=e.blobs),void 0!==e.data&&(t.data=e.data),void 0!==e.from&&(t.from=e.from),void 0!==e.gas&&(t.gas=hde(e.gas)),void 0!==e.gasPrice&&(t.gasPrice=hde(e.gasPrice)),void 0!==e.maxFeePerBlobGas&&(t.maxFeePerBlobGas=hde(e.maxFeePerBlobGas)),void 0!==e.maxFeePerGas&&(t.maxFeePerGas=hde(e.maxFeePerGas)),void 0!==e.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=hde(e.maxPriorityFeePerGas)),void 0!==e.nonce&&(t.nonce=hde(e.nonce)),void 0!==e.to&&(t.to=e.to),void 0!==e.type&&(t.type=Che[e.type]),void 0!==e.value&&(t.value=hde(e.value)),t}function Nhe({blockNumber:e,chain:t,contract:r}){const n=t?.contracts?.[r];if(!n)throw new hhe({chain:t,contract:{name:r}});if(e&&n.blockCreated&&n.blockCreated>e)throw new hhe({blockNumber:e,chain:t,contract:{name:r,blockCreated:n.blockCreated}});return n.address}const Rhe=Jfe({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),Fhe=Jfe({id:137,name:"Polygon",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}}),Lhe=Jfe({id:80002,name:"Polygon Amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://amoy.polygonscan.com",apiUrl:"https://api-amoy.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:3127388}},testnet:!0});class jhe{constructor(){r(this,"sessionId",void 0)}checkSessionParams(){if(!this.sessionId)throw new Error("Session id is required");this.sessionId=this.sessionId.padStart(64,"0")}request(e){let{method:t="GET",url:r,data:n={},headers:o={}}=e;const a={headers:o};switch(t){case"GET":return yd(r,a);case"POST":return vd(r,n,a);case"PUT":return async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};n.useAPIKey&&(o.headers=i(i({},o.headers),bd()));const a=ld(o,r,{method:"PUT"});n.isUrlEncodedData?(a.body=t,"application/json; charset=utf-8"===a.headers["Content-Type"]&&delete a.headers["Content-Type"]):a.body=JSON.stringify(t);const s=await md(e,a);if(s.ok){const e=s.headers.get("content-type");return null!=e&&e.includes("application/json")?s.json():s.text()}throw gd(s),s}(r,n,a);case"PATCH":return async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};n.useAPIKey&&(o.headers=i(i({},o.headers),bd()));const a=ld(o,r,{method:"PATCH"});n.isUrlEncodedData?(a.body=t,"application/json; charset=utf-8"===a.headers["Content-Type"]&&delete a.headers["Content-Type"]):a.body=JSON.stringify(t);const s=await md(e,a);if(s.ok){const e=s.headers.get("content-type");return null!=e&&e.includes("application/json")?s.json():s.text()}throw gd(s),s}(r,n,a)}throw new Error("Invalid method type")}}class Uhe extends jhe{constructor(){let{sessionServerBaseUrl:e,sessionNamespace:t,sessionTime:n,sessionId:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),r(this,"sessionServerBaseUrl","https://session.web3auth.io"),r(this,"sessionNamespace",void 0),r(this,"sessionTime",86400),r(this,"sessionId",""),e&&(this.sessionServerBaseUrl=e),t&&(this.sessionNamespace=t),n&&(this.sessionTime=n),i&&(this.sessionId=i.padStart(64,"0"))}static generateRandomSessionKey(){return function(){let e=Gy(32);for(;!Hy(e);)e=Gy(32);return e}().toString("hex").padStart(64,"0")}async createSession(e){super.checkSessionParams();const t=_.from(this.sessionId,"hex"),r=Zy(t).toString("hex"),n=await zw(this.sessionId,e),i={key:r,data:n,signature:(await Yy(t,Uw(_.from(n,"utf8")))).toString("hex"),namespace:this.sessionNamespace,timeout:this.sessionTime};return await super.request({method:"POST",url:`${this.sessionServerBaseUrl}/store/set`,data:i}),this.sessionId}async authorizeSession(){super.checkSessionParams();const e=Zy(_.from(this.sessionId,"hex")).toString("hex"),t=new URL(`${this.sessionServerBaseUrl}/store/get`);t.searchParams.append("key",e),this.sessionNamespace&&t.searchParams.append("namespace",this.sessionNamespace);const r=await super.request({url:t.toString()});if(!r.message)throw new Error("Session Expired or Invalid public key");const n=await $w(this.sessionId,r.message);if(n.error)throw new Error("There was an error decrypting data.");return n}async updateSession(e){super.checkSessionParams();const t=_.from(this.sessionId,"hex"),r=Zy(t).toString("hex"),n=await zw(this.sessionId,e),i={key:r,data:n,signature:(await Yy(t,Uw(_.from(n,"utf8")))).toString("hex"),namespace:this.sessionNamespace};await super.request({method:"PUT",url:`${this.sessionServerBaseUrl}/store/update`,data:i})}async invalidateSession(){super.checkSessionParams();const e=_.from(this.sessionId,"hex"),t=Zy(e).toString("hex"),r=await zw(this.sessionId,{}),n={key:t,data:r,signature:(await Yy(e,Uw(_.from(r,"utf8")))).toString("hex"),namespace:this.sessionNamespace,timeout:1};return await super.request({method:"POST",url:`${this.sessionServerBaseUrl}/store/set`,data:n}),this.sessionId="",!0}}const Dhe=hd.getLogger("http-helpers");Dhe.setLevel(dd.levels.INFO);const zhe=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};n.useAPIKey&&(o.headers=i(i({},o.headers),{"x-api-key":"torus-default"}));const a=ld(o,r,{method:"POST"});return n.isUrlEncodedData?(a.body=t,"application/json; charset=utf-8"===a.headers["Content-Type"]&&delete a.headers["Content-Type"]):a.body=JSON.stringify(t),((e,t)=>{const r=new Promise(((t,r)=>{const n=setTimeout((()=>{clearTimeout(n),r(new Error(`Timed out in ${e}ms`))}),e)}));return Promise.race([t,r])})(n.timeout||6e4,async function(e,t){let r=null;try{r=new URL(e)}catch(e){}return fetch(e,t)}(e,a).then((e=>{if(n.logTracingHeader&&function(e){Dhe.info(`Request tracing with traceID=${e.headers.get("x-web3-correlation-id")}`)}(e),e.ok){const t=e.headers.get("content-type");return null!=t&&t.includes("application/json")?e.json():e.text()}throw function(e){Dhe.info(`Response: ${e.status} ${e.statusText}`),Dhe.info(`Url: ${e.url}`)}(e),e})))},$he=Object.create(null);$he.open="0",$he.close="1",$he.ping="2",$he.pong="3",$he.message="4",$he.upgrade="5",$he.noop="6";const Hhe=Object.create(null);Object.keys($he).forEach((e=>{Hhe[$he[e]]=e}));const Ghe={type:"error",data:"parser error"},qhe="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),Khe="function"==typeof ArrayBuffer,Vhe=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Whe=({type:e,data:t},r,n)=>qhe&&t instanceof Blob?r?n(t):Jhe(t,n):Khe&&(t instanceof ArrayBuffer||Vhe(t))?r?n(t):Jhe(new Blob([t]),n):n($he[e]+(t||"")),Jhe=(e,t)=>{const r=new FileReader;return r.onload=function(){const e=r.result.split(",")[1];t("b"+(e||""))},r.readAsDataURL(e)};function Zhe(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Yhe;const Xhe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qhe="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)Qhe[Xhe.charCodeAt(e)]=e;const epe="function"==typeof ArrayBuffer,tpe=(e,t)=>{if("string"!=typeof e)return{type:"message",data:npe(e,t)};const r=e.charAt(0);if("b"===r)return{type:"message",data:rpe(e.substring(1),t)};return Hhe[r]?e.length>1?{type:Hhe[r],data:e.substring(1)}:{type:Hhe[r]}:Ghe},rpe=(e,t)=>{if(epe){const r=(e=>{let t,r,n,i,o,a=.75*e.length,s=e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);const u=new ArrayBuffer(a),l=new Uint8Array(u);for(t=0;t>4,l[c++]=(15&n)<<4|i>>2,l[c++]=(3&i)<<6|63&o;return u})(e);return npe(r,t)}return{base64:!0,data:e}},npe=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,ipe=String.fromCharCode(30);function ope(){return new TransformStream({transform(e,t){!function(e,t){qhe&&e.data instanceof Blob?e.data.arrayBuffer().then(Zhe).then(t):Khe&&(e.data instanceof ArrayBuffer||Vhe(e.data))?t(Zhe(e.data)):Whe(e,!1,(e=>{Yhe||(Yhe=new TextEncoder),t(Yhe.encode(e))}))}(e,(r=>{const n=r.length;let i;if(n<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,n);else if(n<65536){i=new Uint8Array(3);const e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,n)}else{i=new Uint8Array(9);const e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(n))}e.data&&"string"!=typeof e.data&&(i[0]|=128),t.enqueue(i),t.enqueue(r)}))}})}let ape;function spe(e){return e.reduce(((e,t)=>e+t.length),0)}function cpe(e,t){if(e[0].length===t)return e.shift();const r=new Uint8Array(t);let n=0;for(let i=0;i(e.hasOwnProperty(r)&&(t[r]=e[r]),t)),{})}const fpe=upe.setTimeout,dpe=upe.clearTimeout;function hpe(e,t){t.useNativeTimers?(e.setTimeoutFn=fpe.bind(upe),e.clearTimeoutFn=dpe.bind(upe)):(e.setTimeoutFn=upe.setTimeout.bind(upe),e.clearTimeoutFn=upe.clearTimeout.bind(upe))}class ppe extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}}class mpe extends Kp{constructor(e){super(),this.writable=!1,hpe(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,r){return super.emitReserved("error",new ppe(e,t,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=tpe(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t}(e);return t.length?"?"+t:""}}const bpe="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),gpe=64,ype={};let vpe,wpe=0,Epe=0;function Ape(e){let t="";do{t=bpe[e%gpe]+t,e=Math.floor(e/gpe)}while(e>0);return t}function xpe(){const e=Ape(+new Date);return e!==vpe?(wpe=0,vpe=e):e+"."+Ape(wpe++)}for(;Epe{var e;3===n.readyState&&(null===(e=this.opts.cookieJar)||void 0===e||e.parseCookies(n)),4===n.readyState&&(200===n.status||1223===n.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof n.status?n.status:0)}),0))},n.send(this.data)}catch(e){return void this.setTimeoutFn((()=>{this.onError(e)}),0)}"undefined"!=typeof document&&(this.index=e.requestsCount++,e.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=Ppe,t)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete e.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};if(Tpe.requestsCount=0,Tpe.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",Ope);else if("function"==typeof addEventListener){addEventListener("onpagehide"in upe?"pagehide":"unload",Ope,!1)}function Ope(){for(let e in Tpe.requests)Tpe.requests.hasOwnProperty(e)&&Tpe.requests[e].abort()}const Mpe="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Cpe=upe.WebSocket||upe.MozWebSocket,Bpe="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();const Npe={websocket:class extends mpe{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,r=Bpe?{}:lpe(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=Bpe?new Cpe(e,t,r):t?new Cpe(e,t):new Cpe(e)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t{try{this.ws.send(e)}catch(e){}n&&Mpe((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=xpe()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!Cpe}},webtransport:class extends mpe{get name(){return"webtransport"}doOpen(){"function"==typeof WebTransport&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then((()=>{this.onClose()})).catch((e=>{this.onError("webtransport error",e)})),this.transport.ready.then((()=>{this.transport.createBidirectionalStream().then((e=>{const t=function(e,t){ape||(ape=new TextDecoder);const r=[];let n=0,i=-1,o=!1;return new TransformStream({transform(a,s){for(r.push(a);;){if(0===n){if(spe(r)<1)break;const e=cpe(r,1);o=!(128&~e[0]),i=127&e[0],n=i<126?3:126===i?1:2}else if(1===n){if(spe(r)<2)break;const e=cpe(r,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),n=3}else if(2===n){if(spe(r)<8)break;const e=cpe(r,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){s.enqueue(Ghe);break}i=o*Math.pow(2,32)+t.getUint32(4),n=3}else{if(spe(r)e){s.enqueue(Ghe);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),n=ope();n.readable.pipeTo(e.writable),this.writer=n.writable.getWriter();const i=()=>{r.read().then((({done:e,value:t})=>{e||(this.onPacket(t),i())})).catch((e=>{}))};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then((()=>this.onOpen()))}))})))}write(e){this.writable=!1;for(let t=0;t{n&&Mpe((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var e;null===(e=this.transport)||void 0===e||e.close()}},polling:class extends mpe{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){const t="https:"===location.protocol;let r=location.port;r||(r=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||r!==e.port}const t=e&&e.forceBase64;this.supportsBinary=Ipe&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const r=e.split(ipe),n=[];for(let e=0;e{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const r=e.length,n=new Array(r);let i=0;e.forEach(((e,o)=>{Whe(e,!1,(e=>{n[o]=e,++i===r&&t(n.join(ipe))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=xpe()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Tpe(this.uri(),e)}doWrite(e,t){const r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}},Rpe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Fpe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Lpe(e){if(e.length>2e3)throw"URI too long";const t=e,r=e.indexOf("["),n=e.indexOf("]");-1!=r&&-1!=n&&(e=e.substring(0,r)+e.substring(r,n).replace(/:/g,";")+e.substring(n,e.length));let i=Rpe.exec(e||""),o={},a=14;for(;a--;)o[Fpe[a]]=i[a]||"";return-1!=r&&-1!=n&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const r=/\/{2,9}/g,n=t.replace(r,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||n.splice(0,1);"/"==t.slice(-1)&&n.splice(n.length-1,1);return n}(0,o.path),o.queryKey=function(e,t){const r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,n){t&&(r[t]=n)})),r}(0,o.query),o}let jpe=class e extends Kp{constructor(e,t={}){super(),this.binaryType="arraybuffer",this.writeBuffer=[],e&&"object"==typeof e&&(t=e,e=null),e?(e=Lpe(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=Lpe(t.host).host),hpe(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},r=e.split("&");for(let e=0,n=r.length;e{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const r=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new Npe[e](r)}open(){let t;if(this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(e){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(e=>this.onClose("transport close",e)))}probe(t){let r=this.createTransport(t),n=!1;e.priorWebsocketSuccess=!1;const i=()=>{n||(r.send([{type:"ping",data:"probe"}]),r.once("packet",(t=>{if(!n)if("pong"===t.type&&"probe"===t.data){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;e.priorWebsocketSuccess="websocket"===r.name,this.transport.pause((()=>{n||"closed"!==this.readyState&&(l(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=r.name,this.emitReserved("upgradeError",e)}})))};function o(){n||(n=!0,l(),r.close(),r=null)}const a=e=>{const t=new Error("probe error: "+e);t.transport=r.name,o(),this.emitReserved("upgradeError",t)};function s(){a("transport closed")}function c(){a("socket closed")}function u(e){r&&e.name!==r.name&&o()}const l=()=>{r.removeListener("open",i),r.removeListener("error",a),r.removeListener("close",s),this.off("close",c),this.off("upgrading",u)};r.once("open",i),r.once("error",a),r.once("close",s),this.once("close",c),this.once("upgrading",u),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==t?this.setTimeoutFn((()=>{n||r.open()}),200):r.open()}onOpen(){if(this.readyState="open",e.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let r=0;r=57344?r+=3:(n++,r+=4);return r}(t):Math.ceil(1.33*(t.byteLength||t.size))),r>0&&e>this.maxPayload)return this.writeBuffer.slice(0,r);e+=2}var t;return this.writeBuffer}write(e,t,r){return this.sendPacket("message",e,t,r),this}send(e,t,r){return this.sendPacket("message",e,t,r),this}sendPacket(e,t,r,n){if("function"==typeof t&&(n=t,t=void 0),"function"==typeof r&&(n=r,r=null),"closing"===this.readyState||"closed"===this.readyState)return;(r=r||{}).compress=!1!==r.compress;const i={type:e,data:t,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),n&&this.once("flush",n),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?r():e()})):this.upgrading?r():e()),this}onError(t){e.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let r=0;const n=e.length;for(;r"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,zpe=Object.prototype.toString,$pe="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===zpe.call(Blob),Hpe="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===zpe.call(File);function Gpe(e){return Upe&&(e instanceof ArrayBuffer||Dpe(e))||$pe&&e instanceof Blob||Hpe&&e instanceof File}function qpe(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,r=e.length;t=0&&e.num{delete this.acks[e];for(let t=0;t{this.io.clearTimeoutFn(i),t.apply(this,e)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise(((r,n)=>{const i=(e,t)=>e?n(e):r(t);i.withError=!0,t.push(i),this.emit(e,...t)}))}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push(((e,...n)=>{if(r!==this._queue[0])return;return null!==e?r.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...n)),r.pending=!1,this._drainQueue()})),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Ype.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach((e=>{if(!this.sendBuffer.some((t=>String(t.id)===e))){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}}))}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Ype.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ype.EVENT:case Ype.BINARY_EVENT:this.onevent(e);break;case Ype.ACK:case Ype.BINARY_ACK:this.onack(e);break;case Ype.DISCONNECT:this.ondisconnect();break;case Ype.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const r of t)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let r=!1;return function(...n){r||(r=!0,t.packet({type:Ype.ACK,id:e,data:n}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ype.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}ome.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+r:e-r}return 0|Math.min(e,this.max)},ome.prototype.reset=function(){this.attempts=0},ome.prototype.setMin=function(e){this.ms=e},ome.prototype.setMax=function(e){this.max=e},ome.prototype.setJitter=function(e){this.jitter=e};class ame extends Kp{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,hpe(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(r=t.randomizationFactor)&&void 0!==r?r:.5),this.backoff=new ome({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const n=t.parser||tme;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new jpe(this.uri,this.opts);const t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const n=rme(t,"open",(function(){r.onopen(),e&&e()})),i=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=rme(t,"error",i);if(!1!==this._timeout){const e=this._timeout,r=this.setTimeoutFn((()=>{n(),i(new Error("timeout")),t.close()}),e);this.opts.autoUnref&&r.unref(),this.subs.push((()=>{this.clearTimeoutFn(r)}))}return this.subs.push(n),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(rme(e,"ping",this.onping.bind(this)),rme(e,"data",this.ondata.bind(this)),rme(e,"error",this.onerror.bind(this)),rme(e,"close",this.onclose.bind(this)),rme(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){Mpe((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new ime(this,e,t),this.nsps[e]=r),r}_destroy(e){const t=Object.keys(this.nsps);for(const e of t){if(this.nsps[e].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let r=0;re())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&r.unref(),this.subs.push((()=>{this.clearTimeoutFn(r)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const sme={};function cme(e,t){"object"==typeof e&&(t=e,e=void 0);const r=function(e,t="",r){let n=e;r=r||"undefined"!=typeof location&&location,null==e&&(e=r.protocol+"//"+r.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?r.protocol+e:r.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==r?r.protocol+"//"+e:"https://"+e),n=Lpe(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const i=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+i+":"+n.port+t,n.href=n.protocol+"://"+i+(r&&r.port===n.port?"":":"+n.port),n}(e,(t=t||{}).path||"/socket.io"),n=r.source,i=r.id,o=r.path,a=sme[i]&&o in sme[i].nsps;let s;return t.forceNew||t["force new connection"]||!1===t.multiplex||a?s=new ame(n,t):(sme[i]||(sme[i]=new ame(n,t)),s=sme[i]),r.query&&!t.query&&(t.query=r.queryKey),s.socket(r.path,t)}Object.assign(cme,{Manager:ame,Socket:ime,io:cme,connect:cme});var ume=hd.getLogger("SecurePubSub");class lme{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,"options",void 0),r(this,"SOCKET_CONN",null),this.options=e,this.options.timeout=e.timeout||600,this.options.serverUrl=e.serverUrl||"https://broadcast-server.tor.us",this.options.enableLogging=e.enableLogging||!1,this.options.namespace=e.namespace||"",this.options.enableLogging?ume.enableAll():ume.disableAll()}static setLogLevel(e){ume.setLevel(e),function(e){Dhe.setLevel(e)}(e)}async publish(e,t){const r=Uw(_.from(e,"utf8")),n=await zw(r.toString("hex"),t),i=await Yy(r,Uw(_.from(n,"utf8"))),o={key:Zy(r).toString("hex"),data:n,signature:i.toString("hex"),timeout:this.options.timeout,namespace:this.options.namespace};return zhe(`${this.options.serverUrl}/channel/set`,o)}async subscribe(e){let t=!0;const r=Uw(_.from(e,"utf8")),n=Zy(r).toString("hex"),i=this.getSocketConnection();i.connected?(ume.debug("already connected with socket"),i.emit("check_auth_status",n,{namespace:this.options.namespace})):i.once("connect",(()=>{ume.debug("connected with socket"),i.emit("check_auth_status",n,{namespace:this.options.namespace})}));const o=()=>{i.once("connect",(async()=>{ume.debug("connected with socket using reconnect"),t&&i.emit("check_auth_status",n,{namespace:this.options.namespace})}))},a=()=>{t||document.removeEventListener("visibilitychange",a),i.connected||"visible"!==document.visibilityState||o()},s=()=>{ume.debug("socket disconnected",t),t?(ume.error("socket disconnected unexpectedly, reconnecting socket"),o()):i.removeListener("disconnect",s)};i.on("disconnect",s);const c=new Promise(((e,o)=>{ume.info("listening to",`${n}_success`),i.once(`${n}_success`,(async n=>{try{const t=await $w(r.toString("hex"),n);ume.info("got data",t),e(t)}catch(e){ume.error(e),o(e)}finally{t=!1,document.removeEventListener("visibilitychange",a)}}))}));return"undefined"!=typeof document&&document.addEventListener("visibilitychange",a),c}cleanup(){this.SOCKET_CONN&&(this.SOCKET_CONN.disconnect(),this.SOCKET_CONN=null)}getSocketConnection(){if(this.SOCKET_CONN)return this.SOCKET_CONN;const e=cme(this.options.serverUrl,{transports:["websocket","polling"],withCredentials:!0,reconnectionDelayMax:1e4,reconnectionAttempts:10});return e.on("connect_error",(t=>{e.io.opts.transports=["polling","websocket"],ume.error("connect error",t)})),e.on("connect",(async()=>{const{engine:t}=e.io;ume.debug("initially connected to",t.transport.name),t.once("upgrade",(()=>{ume.debug("upgraded",t.transport.name)})),t.once("close",(e=>{ume.debug("connection closed",e)}))})),e.on("error",(t=>{ume.error("socket errored",t),e.disconnect()})),this.SOCKET_CONN=e,this.SOCKET_CONN}}class fme extends cd{constructor(e,t){super(t),r(this,"code",void 0),r(this,"message",void 0),this.code=e,this.message=t||"",Object.defineProperty(this,"name",{value:"OpenloginError"})}toJSON(){return{name:this.name,code:this.code,message:this.message}}toString(){return JSON.stringify(this.toJSON())}}class dme extends fme{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{value:"InitializationError"})}static fromCode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new dme(e,`${dme.messages[e]}, ${t}`)}static invalidParams(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return dme.fromCode(5001,e)}static notInitialized(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return dme.fromCode(5002,e)}}r(dme,"messages",{5e3:"Custom",5001:"Invalid constructor params",5002:"SDK not initialized. please call init first"});class hme extends fme{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{value:"LoginError"})}static fromCode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new hme(e,`${hme.messages[e]}, ${t}`)}static invalidLoginParams(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return hme.fromCode(5111,e)}static userNotLoggedIn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return hme.fromCode(5112,e)}static popupClosed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return hme.fromCode(5113,e)}static loginFailed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return hme.fromCode(5114,e)}static popupBlocked(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return hme.fromCode(5115,e)}static mfaAlreadyEnabled(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return hme.fromCode(5116,e)}static mfaNotEnabled(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return hme.fromCode(5117,e)}}r(hme,"messages",{5e3:"Custom",5111:"Invalid login params",5112:"User not logged in.",5113:"login popup has been closed by the user",5114:"Login failed",5115:"Popup was blocked. Please call this function as soon as user clicks button or use redirect mode",5116:"MFA already enabled",5117:"MFA not yet enabled. Please call `enableMFA` first"});const pme=dd.getLogger("openlogin");pme.setLevel("error");function mme(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t={},r=new URL(window.location.href);r.searchParams.forEach(((e,r)=>{"result"!==r&&(t[r]=e)}));const n=r.searchParams.get("result");if(n)try{const e=JSON.parse(Df(n));Object.keys(e).forEach((r=>{t[r]=e[r]}))}catch(e){pme.error(e)}const o=r.hash.substring(1),a=new URL(`${window.location.origin}/?${o}`);a.searchParams.forEach(((e,r)=>{"result"!==r&&(t[r]=e)}));const s=a.searchParams.get("result");if(s)try{const e=JSON.parse(Df(s));Object.keys(e).forEach((r=>{t[r]=e[r]}))}catch(e){pme.error(e)}if(e){const e=new URL(window.location.origin+window.location.pathname);if(e.search=window.location.search,s){const t=JSON.parse(Df(s));delete t.sessionId,delete t.sessionNamespace,delete t.error,e.hash=(c=JSON.stringify(t),Uf.encode(c))}window.history.replaceState(i(i({},window.history.state),{},{as:e.href,url:e.href}),"",e.href)}var c;return t}function bme(e){const{baseURL:t,query:r,hash:n}=e,i=new URL(t);if(r&&Object.keys(r).forEach((e=>{i.searchParams.append(e,r[e])})),n){const e=new URL(bme({baseURL:t,query:n})).searchParams.toString();i.hash=e}return i.toString()}function gme(e){return e!==Zf&&e!==Yf||!function(){if("undefined"==typeof window)return!1;const e=qp.getParser(window.navigator.userAgent).getPlatform();return e.type===qp.PLATFORMS_MAP.tablet||e.type===qp.PLATFORMS_MAP.mobile}()?1e4:3e5}class yme extends ge{constructor(e){let{url:t,target:n,features:i,timeout:o=3e4}=e;super(),r(this,"url",void 0),r(this,"target",void 0),r(this,"features",void 0),r(this,"window",void 0),r(this,"windowTimer",void 0),r(this,"iClosedWindow",void 0),r(this,"timeout",void 0),this.url=t,this.target=n||"_blank",this.features=i||function(){if("undefined"==typeof window)return"";const e=void 0!==window.screenLeft?window.screenLeft:window.screenX,t=void 0!==window.screenTop?window.screenTop:window.screenY,r=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:window.screen.width,n=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:window.screen.height,i=Math.abs((r-1200)/2/1+e);return`titlebar=0,toolbar=0,status=0,location=0,menubar=0,height=700,width=1200,top=${Math.abs((n-700)/2/1+t)},left=${i}`}(),this.window=void 0,this.windowTimer=void 0,this.iClosedWindow=!1,this.timeout=o,this._setupTimer()}_setupTimer(){this.windowTimer=Number(setInterval((()=>{this.window&&this.window.closed&&(clearInterval(this.windowTimer),setTimeout((()=>{this.iClosedWindow||this.emit("close"),this.iClosedWindow=!1,this.window=void 0}),this.timeout)),void 0===this.window&&clearInterval(this.windowTimer)}),500))}open(){var e;if(this.window=window.open(this.url,this.target,this.features),!this.window)throw hme.popupBlocked();null!==(e=this.window)&&void 0!==e&&e.focus&&this.window.focus()}close(){this.iClosedWindow=!0,this.window&&this.window.close()}redirect(e){e?window.location.replace(this.url):window.location.href=this.url}async listenOnChannel(e){const t=new lme,r=await t.subscribe(e);this.close(),t.cleanup();const n=JSON.parse(r);return n.error?{error:n.error,state:n.state}:n.data}}class vme{constructor(e){if(r(this,"state",{}),r(this,"options",void 0),r(this,"sessionManager",void 0),r(this,"currentStorage",void 0),r(this,"_storageBaseKey","openlogin_store"),r(this,"dappState",void 0),r(this,"addVersionInUrls",!0),!e.clientId)throw dme.invalidParams("clientId is required");if(e.network||(e.network=Vf.SAPPHIRE_MAINNET),e.buildEnv||(e.buildEnv=rd),(e.buildEnv===nd||e.buildEnv===od||e.sdkUrl)&&(this.addVersionInUrls=!1),e.sdkUrl||e.useMpc||(e.buildEnv===nd?(e.sdkUrl="http://localhost:3000",e.dashboardUrl="http://localhost:5173/wallet/account"):e.buildEnv===id?(e.sdkUrl="https://staging-auth.web3auth.io",e.dashboardUrl="https://staging-account.web3auth.io/wallet/account"):e.buildEnv===od?(e.sdkUrl="https://develop-auth.web3auth.io",e.dashboardUrl="https://develop-account.web3auth.io/wallet/account"):(e.sdkUrl="https://auth.web3auth.io",e.dashboardUrl="https://account.web3auth.io/wallet/account")),e.useMpc&&!e.sdkUrl){if(Object.values(Lf).includes(e.network))throw new Error("MPC is not supported on legacy networks, please use sapphire_devnet or sapphire_mainnet.");e.buildEnv===nd?e.sdkUrl="http://localhost:3000":e.buildEnv===id?e.sdkUrl="https://staging-mpc-auth.web3auth.io":e.buildEnv===od?e.sdkUrl="https://develop-mpc-auth.web3auth.io":e.sdkUrl="https://mpc-auth.web3auth.io"}e.redirectUrl||"undefined"==typeof window||(e.redirectUrl=`${window.location.protocol}//${window.location.host}${window.location.pathname}`),e.uxMode||(e.uxMode=Kf),"boolean"!=typeof e.replaceUrlOnRedirect&&(e.replaceUrlOnRedirect=!0),e.originData||(e.originData={}),e.whiteLabel||(e.whiteLabel={}),e.loginConfig||(e.loginConfig={}),e.mfaSettings||(e.mfaSettings={}),e.storageServerUrl||(e.storageServerUrl="https://broadcast-server.tor.us"),e.storageKey||(e.storageKey="local"),e.webauthnTransports||(e.webauthnTransports=["internal"]),e.sessionTime||(e.sessionTime=86400),this.options=e}get privKey(){return this.options.useMpc?this.state.factorKey||"":this.state.privKey?this.state.privKey.padStart(64,"0"):""}get coreKitKey(){return this.state.coreKitKey?this.state.coreKitKey.padStart(64,"0"):""}get ed25519PrivKey(){return this.state.ed25519PrivKey?this.state.ed25519PrivKey.padStart(128,"0"):""}get coreKitEd25519Key(){return this.state.coreKitEd25519PrivKey?this.state.coreKitEd25519PrivKey.padStart(128,"0"):""}get sessionId(){return this.state.sessionId||""}get sessionNamespace(){return this.options.sessionNamespace||""}get appState(){return this.state.userInfo.appState||this.dappState||""}get baseUrl(){return this.addVersionInUrls?`${this.options.sdkUrl}/v${"6.2.11".split(".")[0]}`:`${this.options.sdkUrl}`}async init(){const e=mme(this.options.replaceUrlOnRedirect);e.sessionNamespace&&(this.options.sessionNamespace=e.sessionNamespace);const t=this.options.sessionNamespace?`${this._storageBaseKey}_${this.options.sessionNamespace}`:this._storageBaseKey;this.currentStorage=Gf.getInstance(t,this.options.storageKey);const r=this.currentStorage.get("sessionId");if(this.sessionManager=new Uhe({sessionServerBaseUrl:this.options.storageServerUrl,sessionNamespace:this.options.sessionNamespace,sessionTime:this.options.sessionTime,sessionId:r}),this.options.network!==Vf.TESTNET&&this.options.network!==Vf.SAPPHIRE_DEVNET||console.log(`%c WARNING! You are on ${this.options.network}. Please set network: 'mainnet' or 'sapphire_mainnet' in production`,"color: #FF0000"),this.options.buildEnv!==rd&&console.log(`%c WARNING! You are using build env ${this.options.buildEnv}. Please set buildEnv: 'production' in production`,"color: #FF0000"),e.error)throw this.dappState=e.state,hme.loginFailed(e.error);if(e.sessionId&&(this.currentStorage.set("sessionId",e.sessionId),this.sessionManager.sessionId=e.sessionId),this.sessionManager.sessionId){const e=await this._authorizeSession();this.updateState(e),0===Object.keys(e).length&&this.currentStorage.set("sessionId","")}}async login(e){if(!e.loginProvider)throw hme.invalidLoginParams("loginProvider is required");const t={redirectUrl:this.options.redirectUrl},r=i(i({loginProvider:e.loginProvider},t),e),n={actionType:Xf,options:this.options,params:r},o=await this.openloginHandler(`${this.baseUrl}/start`,n,gme(e.loginProvider));if(this.options.uxMode===Kf)return null;if(o.error)throw this.dappState=o.state,hme.loginFailed(o.error);return this.sessionManager.sessionId=o.sessionId,this.options.sessionNamespace=o.sessionNamespace,this.currentStorage.set("sessionId",o.sessionId),await this.rehydrateSession(),{privKey:this.privKey}}async logout(){if(!this.sessionManager.sessionId)throw hme.userNotLoggedIn();await this.sessionManager.invalidateSession(),this.updateState({privKey:"",coreKitKey:"",coreKitEd25519PrivKey:"",ed25519PrivKey:"",walletKey:"",oAuthPrivateKey:"",tKey:"",metadataNonce:"",keyMode:void 0,userInfo:{name:"",profileImage:"",dappShare:"",idToken:"",oAuthIdToken:"",oAuthAccessToken:"",appState:"",email:"",verifier:"",verifierId:"",aggregateVerifier:"",typeOfLogin:"",isMfaEnabled:!1},authToken:"",sessionId:"",factorKey:"",signatures:[],tssShareIndex:-1,tssPubKey:"",tssShare:"",tssNonce:-1}),this.currentStorage.set("sessionId","")}async enableMFA(e){var t;if(!this.sessionId)throw hme.userNotLoggedIn();if(this.state.userInfo.isMfaEnabled)throw hme.mfaAlreadyEnabled();const r={redirectUrl:this.options.redirectUrl},n={actionType:Qf,options:this.options,params:i(i(i({},r),e),{},{loginProvider:this.state.userInfo.typeOfLogin,extraLoginOptions:{login_hint:this.state.userInfo.verifierId},mfaLevel:"mandatory"}),sessionId:this.sessionId},o=await this.openloginHandler(`${this.baseUrl}/start`,n,gme(n.params.loginProvider));if(this.options.uxMode===Kf)return null;if(o.error)throw this.dappState=o.state,hme.loginFailed(o.error);return this.sessionManager.sessionId=o.sessionId,this.options.sessionNamespace=o.sessionNamespace,this.currentStorage.set("sessionId",o.sessionId),await this.rehydrateSession(),Boolean(null===(t=this.state.userInfo)||void 0===t?void 0:t.isMfaEnabled)}async manageMFA(e){if(!this.sessionId)throw hme.userNotLoggedIn();if(!this.state.userInfo.isMfaEnabled)throw hme.mfaNotEnabled();const t={redirectUrl:this.options.dashboardUrl,dappUrl:`${window.location.origin}${window.location.pathname}`},r={actionType:ed,options:this.options,params:i(i(i({},t),e),{},{loginProvider:this.state.userInfo.typeOfLogin,extraLoginOptions:{login_hint:this.state.userInfo.verifierId}})},n={loginId:await this.getLoginId(r),sessionNamespace:this.options.network,storageServerUrl:this.options.storageServerUrl},o=bme({baseURL:`${this.baseUrl}/start`,hash:{b64Params:zf(n)}});window.open(o,"_blank")}async changeSocialFactor(e){if(!this.sessionId)throw hme.userNotLoggedIn();const t={redirectUrl:this.options.redirectUrl},r={actionType:td,options:this.options,params:i(i({},t),e),sessionId:this.sessionId},n=await this.openloginHandler(`${this.baseUrl}/start`,r);if(this.options.uxMode!==Kf)return this.sessionManager.sessionId=n.sessionId,this.options.sessionNamespace=n.sessionNamespace,this.currentStorage.set("sessionId",n.sessionId),await this.rehydrateSession(),!0}getUserInfo(){if(!this.sessionManager.sessionId)throw hme.userNotLoggedIn();return this.state.userInfo}async getLoginId(e){if(!this.sessionManager)throw dme.notInitialized();const t=Uhe.generateRandomSessionKey(),r=new Uhe({sessionServerBaseUrl:this.options.storageServerUrl,sessionNamespace:this.options.sessionNamespace,sessionTime:600,sessionId:t});return await r.createSession(JSON.parse(JSON.stringify(e))),t}async _authorizeSession(){try{if(!this.sessionManager.sessionId)return{};return await this.sessionManager.authorizeSession()}catch(e){return pme.error("authorization failed",e),{}}}updateState(e){this.state=i(i({},this.state),e)}async rehydrateSession(){const e=await this._authorizeSession();this.updateState(e)}async openloginHandler(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e4;const n=await this.getLoginId(t),i={loginId:n,sessionNamespace:this.options.sessionNamespace,storageServerUrl:this.options.storageServerUrl};if(this.options.uxMode===Kf){const t=bme({baseURL:e,hash:{b64Params:zf(i)}});return void(window.location.href=t)}const o=bme({baseURL:e,hash:{b64Params:zf(i)}}),a=new yme({url:o,timeout:r});return new Promise(((e,t)=>{a.on("close",(()=>{t(hme.popupClosed())})),a.listenOnChannel(n).then(e).catch(t);try{a.open()}catch(e){t(e)}}))}}class wme extends Fd{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(e),r(this,"name",Cd.OPENLOGIN),r(this,"adapterNamespace",Ad),r(this,"type",Bd),r(this,"openloginInstance",null),r(this,"status",Nd.NOT_READY),r(this,"currentChainNamespace",Ed.EIP155),r(this,"privateKeyProvider",null),r(this,"openloginOptions",void 0),r(this,"loginSettings",{loginProvider:""}),this.setAdapterSettings(i(i({},e.adapterSettings),{},{chainConfig:e.chainConfig,clientId:e.clientId||"",sessionTime:e.sessionTime,web3AuthNetwork:e.web3AuthNetwork,useCoreKitKey:e.useCoreKitKey,privateKeyProvider:e.privateKeyProvider})),this.loginSettings=e.loginSettings||{loginProvider:""},this.privateKeyProvider=e.privateKeyProvider||null}get chainConfigProxy(){return this.chainConfig?i({},this.chainConfig):null}get provider(){return this.status!==Nd.NOT_READY&&this.privateKeyProvider?this.privateKeyProvider:null}set provider(e){throw new Error("Not implemented")}async init(e){if(super.checkInitializationRequirements(),!this.clientId)throw kd.invalidParams("clientId is required before openlogin's initialization");if(!this.openloginOptions)throw kd.invalidParams("openloginOptions is required before openlogin's initialization");const t=this.openloginOptions.uxMode===Kf;if(this.openloginOptions=i(i({},this.openloginOptions),{},{replaceUrlOnRedirect:t}),this.openloginInstance=new vme(i(i({},this.openloginOptions),{},{clientId:this.clientId,network:this.openloginOptions.network||this.web3AuthNetwork||Vf.SAPPHIRE_MAINNET})),Ld.debug("initializing openlogin adapter init"),await this.openloginInstance.init(),!this.chainConfig)throw kd.invalidParams("chainConfig is required before initialization");this.status=Nd.READY,this.emit(Rd.READY,Cd.OPENLOGIN);try{Ld.debug("initializing openlogin adapter");this._getFinalPrivKey()&&(e.autoConnect||t)&&(this.rehydrated=!0,await this.connect())}catch(e){Ld.error("Failed to connect with cached openlogin provider",e),this.emit("ERRORED",e)}}async connect(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{loginProvider:""};super.checkConnectionRequirements(),this.status=Nd.CONNECTING,this.emit(Rd.CONNECTING,i(i({},e),{},{adapter:Cd.OPENLOGIN}));try{return await this.connectWithProvider(e),this.provider}catch(e){if(Ld.error("Failed to connect with openlogin provider",e),this.status=Nd.READY,this.emit(Rd.ERRORED,e),null!=e&&e.message.includes("user closed popup"))throw Sd.popupClosed();if(e instanceof _d)throw e;throw Sd.connectionError("Failed to login with openlogin")}}async disconnect(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{cleanup:!1};if(this.status!==Nd.CONNECTED)throw Sd.notConnectedError("Not connected with wallet");if(!this.openloginInstance)throw kd.notReady("openloginInstance is not ready");await this.openloginInstance.logout(),e.cleanup?(this.status=Nd.NOT_READY,this.openloginInstance=null,this.privateKeyProvider=null):this.status=Nd.READY,this.rehydrated=!1,this.emit(Rd.DISCONNECTED)}async authenticateUser(){if(this.status!==Nd.CONNECTED)throw Sd.notConnectedError("Not connected with wallet, Please login/connect first");return{idToken:(await this.getUserInfo()).idToken}}async getUserInfo(){if(this.status!==Nd.CONNECTED)throw Sd.notConnectedError("Not connected with wallet");if(!this.openloginInstance)throw kd.notReady("openloginInstance is not ready");return this.openloginInstance.getUserInfo()}setAdapterSettings(e){super.setAdapterSettings(e);const t={adapterSettings:{network:Vf.SAPPHIRE_MAINNET,clientId:"",uxMode:qf},loginSettings:{},privateKeyProvider:void 0};Ld.info("setting adapter settings",e),this.openloginOptions=i(i(i({},t.adapterSettings),this.openloginOptions),e),e.web3AuthNetwork&&(this.openloginOptions.network=e.web3AuthNetwork),e.privateKeyProvider&&(this.privateKeyProvider=e.privateKeyProvider)}async addChain(e){var t;let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];super.checkAddChainRequirements(e,r),null===(t=this.privateKeyProvider)||void 0===t||t.addChain(e),this.addChainConfig(e)}async switchChain(e){var t;let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];super.checkSwitchChainRequirements(e,r),await(null===(t=this.privateKeyProvider)||void 0===t?void 0:t.switchChain(e)),this.setAdapterSettings({chainConfig:this.getChainConfig(e.chainId)})}_getFinalPrivKey(){if(!this.openloginInstance)return"";let e=this.openloginInstance.privKey;if(this.useCoreKitKey){if(this.openloginInstance.privKey&&!this.openloginInstance.coreKitKey)throw Sd.coreKitKeyNotFound();e=this.openloginInstance.coreKitKey}return e}_getFinalEd25519PrivKey(){if(!this.openloginInstance)return"";let e=this.openloginInstance.ed25519PrivKey;if(this.useCoreKitKey){if(this.openloginInstance.ed25519PrivKey&&!this.openloginInstance.coreKitEd25519Key)throw Sd.coreKitKeyNotFound();e=this.openloginInstance.coreKitEd25519Key}return e}async connectWithProvider(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{loginProvider:""};if(!this.privateKeyProvider)throw kd.invalidParams("PrivateKey Provider is required before initialization");if(!this.openloginInstance)throw kd.notReady("openloginInstance is not ready");if(!this._getFinalPrivKey()||null!==(e=t.extraLoginOptions)&&void 0!==e&&e.id_token){var r;if(this.loginSettings.curve||(this.loginSettings.curve=this.currentChainNamespace===Ed.SOLANA?Jf:Wf),!t.loginProvider&&!this.loginSettings.loginProvider)throw kd.invalidParams("loginProvider is required for login");await this.openloginInstance.login(ld(this.loginSettings,t,{extraLoginOptions:i(i({},t.extraLoginOptions||{}),{},{login_hint:t.login_hint||(null===(r=t.extraLoginOptions)||void 0===r?void 0:r.login_hint)})}))}let n=this._getFinalPrivKey();n&&(this.currentChainNamespace===Ed.SOLANA&&(n=this._getFinalEd25519PrivKey()),await this.privateKeyProvider.setupProvider(n),this.status=Nd.CONNECTED,this.emit(Rd.CONNECTED,{adapter:Cd.OPENLOGIN,reconnected:this.rehydrated}))}}let Eme=null,Ame=null;const xme={"0x13882":Lhe,"0x89":Fhe,"0x1":Rhe},_me={"0x13882":"90812738-dff4-49fd-a375-314d83e71beb","0x89":"e93be2e6-08fe-4f70-b20a-0a1707381029","0x1":"0b421b2d-d3ae-4a03-8bb1-126539276fcd"},kme="0x89";console.log("env","production");const Sme={chainNamespace:"eip155",chainId:"0x13882",rpcTarget:"https://polygon-amoy.g.alchemy.com/v2/yfPnDjn4YVGDpSBun0Y9jv9XvrRKq1Vs",displayName:"Polygon Amoy Testnet",blockExplorer:"https://www.oklink.com/amoy",ticker:"MATIC",tickerName:"Matic"};let Pme="",Ime="",Tme="";const Ome=async(e,t,r,n)=>{if(!Ame)return void console.log("web3auth not initialized yet");console.log("Setting in Login!",e,t,r);const i={mfaLevel:"default",loginProvider:e,redirectUrl:`${n}${r}`};console.log(t),t&&(i.extraLoginOptions={login_hint:t,domain:Tme,verifierIdField:"name"}),console.log(i);const o=await Ame.connectTo(Cd.OPENLOGIN,i),a=await UZ.init({projectId:_me[kme],owner:uQ(o),opts:{paymasterConfig:{policy:"VERIFYING_PAYMASTER"}}});Eme=a},Mme=async()=>{Ame?(await Ame.logout(),Eme=null):console.log("web3auth not initialized yet")},Cme=async e=>{try{const t=new hE({clientId:"BAPdzmJPQYTJV7zblzErbez6KFzOvRGzvA4k9pQZh7R-X0AwhZ4ZpQAWCWSTca8PS8MLGSqEY33ymiqxrfGAGbU",web3AuthNetwork:"sapphire_mainnet",chainConfig:Sme}),r=new Wfe({config:{chainConfig:Sme}});Pme=e.auth0.verifierID?e.auth0.verifierID:"layered-demo-email-passwordless_1705700808",Ime=e.auth0.clientID?e.auth0.clientID:"zEkEfeWPDgRgpvnwPc0xEK58NOV97T6W",Tme=e.auth0.domain?e.auth0.domain:"https://dev-wvj8ilnmab2m0q11.us.auth0.com";const n=new wme({adapterSettings:{uxMode:"redirect",whiteLabel:{appName:e.name?e.name:"Layered.xyz",appUrl:e.url?e.url:"https://layered.xyz",logoLight:e.logo?e.logo:"https://layered-brand-assets.s3.us-west-1.amazonaws.com/Logo+Only+Light.png",logoDark:e.logo?e.logo:"https://layered-brand-assets.s3.us-west-1.amazonaws.com/Logo+Only+Light.png",defaultLanguage:"en",mode:"dark",theme:{primary:e.primary?e.primary:"#00D1B2"},useLogoLoader:!0},loginConfig:{google:{verifier:"layered-demo-google-test_1705700808",typeOfLogin:"google",clientId:"672620586559-gd914s8o98oerjlu1dhd28qajn6hq1dq.apps.googleusercontent.com"},facebook:{verifier:"Facebook verifier name from web3auth dashboard",typeOfLogin:"facebook",clientId:"Facebook Client ID"},linkedin:{verifier:"verifier on web3auth dashboard",typeOfLogin:"linkedin",clientId:"CLient id from linkedin"},jwt:{verifier:Pme,typeOfLogin:"jwt",clientId:Ime}}},privateKeyProvider:r});if(t.configureAdapter(n),await t.init(),await t.addChain({chainNamespace:"eip155",chainId:"0x89",rpcTarget:"https://polygon-mainnet.g.alchemy.com/v2/26uv2UQi8g99zBpSFbpQ2hqNCYVzQLci",displayName:"Polygon Mainnet",blockExplorer:"https://polygonscan.com/",ticker:"MATIC",tickerName:"Matic"}),await t.addChain({chainNamespace:"eip155",chainId:"0x1",rpcTarget:"https://eth-mainnet.g.alchemy.com/v2/jmYwXxpmuvaarrxh3X2X-0Qu3rfhhxv7",displayName:"Ethereum Mainnet",blockExplorer:"https://etherscan.io/",ticker:"ETH",tickerName:"Ether"}),Ame=t,t.provider&&t.connected){console.log("setting zeroDev",_me[kme],t.provider);const e=await UZ.init({projectId:_me[kme],owner:uQ(t.provider),opts:{paymasterConfig:{policy:"VERIFYING_PAYMASTER"}}});console.log("new prov",e),Eme=e}console.log(Ame),console.log(Eme)}catch(e){console.error(e)}},Bme=async(e,t)=>{if(!Ame)return console.log("web3auth not initialized yet"),void await t(null);if(!xme[e]||!_me[e])return console.log("Unsupported chainId"),void await t(null);await Ame.switchChain({chainId:e});const r=await UZ.init({projectId:_me[e],owner:uQ(Ame.provider),opts:{paymasterConfig:{policy:"VERIFYING_PAYMASTER"}}});Eme=r,await t(Eme)},Nme=async()=>Ame?Eme:(console.log("web3auth not initialized yet"),null),Rme=async()=>{if(!Ame)return console.log("web3auth not initialized yet"),null;return await Ame.getUserInfo()};var Fme={},Lme={};const jme="abi/5.7.0",Ume=new S$(jme),Dme={};let zme={calldata:!0,memory:!0,storage:!0},$me={calldata:!0,memory:!0};function Hme(e,t){if("bytes"===e||"string"===e){if(zme[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&$me[t])return!0;return(zme[t]||"payable"===t)&&Ume.throwArgumentError("invalid modifier","name",t),!1}function Gme(e,t){for(let r in t)T$(e,r,t[r])}const qme=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Kme=new RegExp(/^(.*)\[([0-9]*)\]$/);class Vme{constructor(e,t){e!==Dme&&Ume.throwError("use fromString",S$.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Gme(this,t);let r=this.type.match(Kme);Gme(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:Vme.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=qme.sighash),qme[e]||Ume.throwArgumentError("invalid format type","format",e),e===qme.json){let t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((t=>JSON.parse(t.format(e))))),JSON.stringify(t)}let t="";return"array"===this.baseType?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==qme.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===qme.full?", ":",")+")"):t+=this.type,e!==qme.sighash&&(!0===this.indexed&&(t+=" indexed"),e===qme.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return"string"==typeof e?Vme.fromString(e,t):Vme.fromObject(e)}static fromObject(e){return Vme.isParamType(e)?e:new Vme(Dme,{name:e.name||null,type:ibe(e.type),indexed:null==e.indexed?null:!!e.indexed,components:e.components?e.components.map(Vme.fromObject):null})}static fromString(e,t){return function(e){return Vme.fromObject({name:e.name,type:e.type,indexed:e.indexed,components:e.components})}(function(e,t){let r=e;function n(t){Ume.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function i(e){let r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},a=o;for(let r=0;rVme.fromString(e,t)))}class Jme{constructor(e,t){e!==Dme&&Ume.throwError("use a static from method",S$.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Gme(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return Jme.isFragment(e)?e:"string"==typeof e?Jme.fromString(e):Jme.fromObject(e)}static fromObject(e){if(Jme.isFragment(e))return e;switch(e.type){case"function":return tbe.fromObject(e);case"event":return Zme.fromObject(e);case"constructor":return ebe.fromObject(e);case"error":return nbe.fromObject(e);case"fallback":case"receive":return null}return Ume.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return"event"===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?Zme.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?tbe.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?ebe.fromString(e.trim()):"error"===e.split(" ")[0]?nbe.fromString(e.substring(5).trim()):Ume.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}}class Zme extends Jme{format(e){if(e||(e=qme.sighash),qme[e]||Ume.throwArgumentError("invalid format type","format",e),e===qme.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==qme.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===qme.full?", ":",")+") ",e!==qme.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return"string"==typeof e?Zme.fromString(e):Zme.fromObject(e)}static fromObject(e){if(Zme.isEventFragment(e))return e;"event"!==e.type&&Ume.throwArgumentError("invalid event object","value",e);const t={name:abe(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(Vme.fromObject):[],type:"event"};return new Zme(Dme,t)}static fromString(e){let t=e.match(sbe);t||Ume.throwArgumentError("invalid event string","value",e);let r=!1;return t[3].split(" ").forEach((e=>{switch(e.trim()){case"anonymous":r=!0;break;case"":break;default:Ume.warn("unknown modifier: "+e)}})),Zme.fromObject({name:t[1].trim(),anonymous:r,inputs:Wme(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}}function Yme(e,t){t.gas=null;let r=e.split("@");return 1!==r.length?(r.length>2&&Ume.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||Ume.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=wH.from(r[1]),r[0]):e}function Xme(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((e=>{switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}}))}function Qme(e){let t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&Ume.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&Ume.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||Ume.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&Ume.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&Ume.throwArgumentError("unable to determine stateMutability","value",e),t}class ebe extends Jme{format(e){if(e||(e=qme.sighash),qme[e]||Ume.throwArgumentError("invalid format type","format",e),e===qme.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});e===qme.sighash&&Ume.throwError("cannot format a constructor for sighash",S$.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===qme.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}static from(e){return"string"==typeof e?ebe.fromString(e):ebe.fromObject(e)}static fromObject(e){if(ebe.isConstructorFragment(e))return e;"constructor"!==e.type&&Ume.throwArgumentError("invalid constructor object","value",e);let t=Qme(e);t.constant&&Ume.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(Vme.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?wH.from(e.gas):null};return new ebe(Dme,r)}static fromString(e){let t={type:"constructor"},r=(e=Yme(e,t)).match(sbe);return r&&"constructor"===r[1].trim()||Ume.throwArgumentError("invalid constructor string","value",e),t.inputs=Wme(r[2].trim(),!1),Xme(r[3].trim(),t),ebe.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}}class tbe extends ebe{format(e){if(e||(e=qme.sighash),qme[e]||Ume.throwArgumentError("invalid format type","format",e),e===qme.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e)))),outputs:this.outputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==qme.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===qme.full?", ":",")+") ",e!==qme.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((t=>t.format(e))).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(e){return"string"==typeof e?tbe.fromString(e):tbe.fromObject(e)}static fromObject(e){if(tbe.isFunctionFragment(e))return e;"function"!==e.type&&Ume.throwArgumentError("invalid function object","value",e);let t=Qme(e);const r={type:e.type,name:abe(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(Vme.fromObject):[],outputs:e.outputs?e.outputs.map(Vme.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?wH.from(e.gas):null};return new tbe(Dme,r)}static fromString(e){let t={type:"function"},r=(e=Yme(e,t)).split(" returns ");r.length>2&&Ume.throwArgumentError("invalid function string","value",e);let n=r[0].match(sbe);if(n||Ume.throwArgumentError("invalid function signature","value",e),t.name=n[1].trim(),t.name&&abe(t.name),t.inputs=Wme(n[2],!1),Xme(n[3].trim(),t),r.length>1){let n=r[1].match(sbe);""==n[1].trim()&&""==n[3].trim()||Ume.throwArgumentError("unexpected tokens","value",e),t.outputs=Wme(n[2],!1)}else t.outputs=[];return tbe.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}}function rbe(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||Ume.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}class nbe extends Jme{format(e){if(e||(e=qme.sighash),qme[e]||Ume.throwArgumentError("invalid format type","format",e),e===qme.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==qme.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===qme.full?", ":",")+") ",t.trim()}static from(e){return"string"==typeof e?nbe.fromString(e):nbe.fromObject(e)}static fromObject(e){if(nbe.isErrorFragment(e))return e;"error"!==e.type&&Ume.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:abe(e.name),inputs:e.inputs?e.inputs.map(Vme.fromObject):[]};return rbe(new nbe(Dme,t))}static fromString(e){let t={type:"error"},r=e.match(sbe);return r||Ume.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&abe(t.name),t.inputs=Wme(r[2],!1),rbe(nbe.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}}function ibe(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const obe=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function abe(e){return e&&e.match(obe)||Ume.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const sbe=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const cbe=new S$(jme);function ube(e){const t=[],r=function(e,n){if(Array.isArray(n))for(let i in n){const o=e.slice();o.push(i);try{r(o,n[i])}catch(e){t.push({path:o,error:e})}}};return r([],e),t}class lbe{constructor(e,t,r,n){this.name=e,this.type=t,this.localName=r,this.dynamic=n}_throwError(e,t){cbe.throwArgumentError(e,this.localName,t)}}class fbe{constructor(e){T$(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return aH(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(X$(e._data))}writeBytes(e){let t=Y$(e);const r=t.length%this.wordSize;return r&&(t=X$([t,this._padding.slice(r)])),this._writeData(t)}_getValue(e){let t=Y$(wH.from(e));return t.length>this.wordSize&&cbe.throwError("value out-of-bounds",S$.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=X$([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class dbe{constructor(e,t,r,n){T$(this,"_data",Y$(e)),T$(this,"wordSize",t||32),T$(this,"_coerceFunc",r),T$(this,"allowLoose",n),this._offset=0}get data(){return nH(this._data)}get consumed(){return this._offset}static coerce(e,t){let r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):dbe.coerce(e,t)}_peekBytes(e,t,r){let n=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?n=t:cbe.throwError("data out-of-bounds",S$.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(e){return new dbe(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}readValue(){return wH.from(this.readBytes(this.wordSize))}}class hbe extends lbe{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=tG(t)}catch(e){this._throwError(e.message,t)}return e.writeValue(t)}decode(e){return tG(uH(e.readValue().toHexString(),20))}}class pbe extends lbe{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}const mbe=new S$(jme);function bbe(e,t,r){let n=null;if(Array.isArray(r))n=r;else if(r&&"object"==typeof r){let e={};n=t.map((t=>{const n=t.localName;return n||mbe.throwError("cannot encode object for signature with missing names",S$.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:r}),e[n]&&mbe.throwError("cannot encode object for signature with duplicate names",S$.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:r}),e[n]=!0,r[n]}))}else mbe.throwArgumentError("invalid tuple value","tuple",r);t.length!==n.length&&mbe.throwArgumentError("types/value length mismatch","tuple",r);let i=new fbe(e.wordSize),o=new fbe(e.wordSize),a=[];t.forEach(((e,t)=>{let r=n[t];if(e.dynamic){let t=o.length;e.encode(o,r);let n=i.writeUpdatableValue();a.push((e=>{n(e+t)}))}else e.encode(i,r)})),a.forEach((e=>{e(i.length)}));let s=e.appendWriter(i);return s+=e.appendWriter(o),s}function gbe(e,t){let r=[],n=e.subReader(0);t.forEach((t=>{let i=null;if(t.dynamic){let r=e.readValue(),o=n.subReader(r.toNumber());try{i=t.decode(o)}catch(e){if(e.code===S$.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}}else try{i=t.decode(e)}catch(e){if(e.code===S$.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}null!=i&&r.push(i)}));const i=t.reduce(((e,t)=>{const r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e}),{});t.forEach(((e,t)=>{let n=e.localName;if(!n||1!==i[n])return;if("length"===n&&(n="_length"),null!=r[n])return;const o=r[t];o instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw o}}):r[n]=o}));for(let e=0;e{throw t}})}return Object.freeze(r)}class ybe extends lbe{constructor(e,t,r){super("array",e.type+"["+(t>=0?t:"")+"]",r,-1===t||e.dynamic),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let r=0;re._data.length&&mbe.throwError("insufficient data length",S$.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let r=[];for(let e=0;e{e.dynamic&&(r=!0),n.push(e.type)}));super("tuple","tuple("+n.join(",")+")",t,r),this.coders=e}defaultValue(){const e=[];this.coders.forEach((t=>{e.push(t.defaultValue())}));const t=this.coders.reduce(((e,t)=>{const r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e}),{});return this.coders.forEach(((r,n)=>{let i=r.localName;i&&1===t[i]&&("length"===i&&(i="_length"),null==e[i]&&(e[i]=e[n]))})),Object.freeze(e)}encode(e,t){return bbe(e,this.coders,t)}decode(e){return e.coerce(this.name,gbe(e,this.coders))}}const Pbe=new S$(jme),Ibe=new RegExp(/^bytes([0-9]*)$/),Tbe=new RegExp(/^(u?int)([0-9]*)$/);class Obe{constructor(e){T$(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new hbe(e.name);case"bool":return new vbe(e.name);case"string":return new kbe(e.name);case"bytes":return new Ebe(e.name);case"array":return new ybe(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Sbe((e.components||[]).map((e=>this._getCoder(e))),e.name);case"":return new xbe(e.name)}let t=e.type.match(Tbe);if(t){let r=parseInt(t[2]||"256");return(0===r||r>256||r%8!=0)&&Pbe.throwArgumentError("invalid "+t[1]+" bit length","param",e),new _be(r/8,"int"===t[1],e.name)}if(t=e.type.match(Ibe),t){let r=parseInt(t[1]);return(0===r||r>32)&&Pbe.throwArgumentError("invalid bytes length","param",e),new Abe(r,e.name)}return Pbe.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new dbe(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new fbe(this._getWordSize())}getDefaultValue(e){const t=e.map((e=>this._getCoder(Vme.from(e))));return new Sbe(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&Pbe.throwError("types/values length mismatch",S$.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map((e=>this._getCoder(Vme.from(e)))),n=new Sbe(r,"_"),i=this._getWriter();return n.encode(i,t),i.data}decode(e,t,r){const n=e.map((e=>this._getCoder(Vme.from(e))));return new Sbe(n,"_").decode(this._getReader(Y$(t),r))}}const Mbe=new Obe,Cbe=new S$(jme);class Bbe extends j${}class Nbe extends j${}class Rbe extends j${}class Fbe extends j${static isIndexed(e){return!(!e||!e._isIndexed)}}const Lbe={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function jbe(e,t){const r=new Error(`deferred error during ABI decoding triggered accessing ${e}`);return r.error=t,r}class Ube{constructor(e){let t=[];t="string"==typeof e?JSON.parse(e):e,T$(this,"fragments",t.map((e=>Jme.from(e))).filter((e=>null!=e))),T$(this,"_abiCoder",O$(new.target,"getAbiCoder")()),T$(this,"functions",{}),T$(this,"errors",{}),T$(this,"events",{}),T$(this,"structs",{}),this.fragments.forEach((e=>{let t=null;switch(e.type){case"constructor":return this.deploy?void Cbe.warn("duplicate definition - constructor"):void T$(this,"deploy",e);case"function":t=this.functions;break;case"event":t=this.events;break;case"error":t=this.errors;break;default:return}let r=e.format();t[r]?Cbe.warn("duplicate definition - "+r):t[r]=e})),this.deploy||T$(this,"deploy",ebe.from({payable:!1,type:"constructor"})),T$(this,"_isInterface",!0)}format(e){e||(e=qme.full),e===qme.sighash&&Cbe.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map((t=>t.format(e)));return e===qme.json?JSON.stringify(t.map((e=>JSON.parse(e)))):t}static getAbiCoder(){return Mbe}static getAddress(e){return tG(e)}static getSighash(e){return oH(UG(e.format()),0,4)}static getEventTopic(e){return UG(e.format())}getFunction(e){if(tH(e)){for(const t in this.functions)if(e===this.getSighash(t))return this.functions[t];Cbe.throwArgumentError("no matching function","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),r=Object.keys(this.functions).filter((e=>e.split("(")[0]===t));return 0===r.length?Cbe.throwArgumentError("no matching function","name",t):r.length>1&&Cbe.throwArgumentError("multiple matching functions","name",t),this.functions[r[0]]}const t=this.functions[tbe.fromString(e).format()];return t||Cbe.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(tH(e)){const t=e.toLowerCase();for(const e in this.events)if(t===this.getEventTopic(e))return this.events[e];Cbe.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){const t=e.trim(),r=Object.keys(this.events).filter((e=>e.split("(")[0]===t));return 0===r.length?Cbe.throwArgumentError("no matching event","name",t):r.length>1&&Cbe.throwArgumentError("multiple matching events","name",t),this.events[r[0]]}const t=this.events[Zme.fromString(e).format()];return t||Cbe.throwArgumentError("no matching event","signature",e),t}getError(e){if(tH(e)){const t=O$(this.constructor,"getSighash");for(const r in this.errors){if(e===t(this.errors[r]))return this.errors[r]}Cbe.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),r=Object.keys(this.errors).filter((e=>e.split("(")[0]===t));return 0===r.length?Cbe.throwArgumentError("no matching error","name",t):r.length>1&&Cbe.throwArgumentError("multiple matching errors","name",t),this.errors[r[0]]}const t=this.errors[tbe.fromString(e).format()];return t||Cbe.throwArgumentError("no matching error","signature",e),t}getSighash(e){if("string"==typeof e)try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch(e){throw t}}return O$(this.constructor,"getSighash")(e)}getEventTopic(e){return"string"==typeof e&&(e=this.getEvent(e)),O$(this.constructor,"getEventTopic")(e)}_decodeParams(e,t){return this._abiCoder.decode(e,t)}_encodeParams(e,t){return this._abiCoder.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){"string"==typeof e&&(e=this.getError(e));const r=Y$(t);return nH(r.slice(0,4))!==this.getSighash(e)&&Cbe.throwArgumentError(`data signature does not match error ${e.name}.`,"data",nH(r)),this._decodeParams(e.inputs,r.slice(4))}encodeErrorResult(e,t){return"string"==typeof e&&(e=this.getError(e)),nH(X$([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){"string"==typeof e&&(e=this.getFunction(e));const r=Y$(t);return nH(r.slice(0,4))!==this.getSighash(e)&&Cbe.throwArgumentError(`data signature does not match function ${e.name}.`,"data",nH(r)),this._decodeParams(e.inputs,r.slice(4))}encodeFunctionData(e,t){return"string"==typeof e&&(e=this.getFunction(e)),nH(X$([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){"string"==typeof e&&(e=this.getFunction(e));let r=Y$(t),n=null,i="",o=null,a=null,s=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch(e){}break;case 4:{const e=nH(r.slice(0,4)),t=Lbe[e];if(t)o=this._abiCoder.decode(t.inputs,r.slice(4)),a=t.name,s=t.signature,t.reason&&(n=o[0]),"Error"===a?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:"Panic"===a&&(i=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const t=this.getError(e);o=this._abiCoder.decode(t.inputs,r.slice(4)),a=t.name,s=t.format()}catch(e){}break}}return Cbe.throwError("call revert exception"+i,S$.errors.CALL_EXCEPTION,{method:e.format(),data:nH(t),errorArgs:o,errorName:a,errorSignature:s,reason:n})}encodeFunctionResult(e,t){return"string"==typeof e&&(e=this.getFunction(e)),nH(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){"string"==typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&Cbe.throwError("too many arguments for "+e.format(),S$.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const n=(e,t)=>"string"===e.type?UG(t):"bytes"===e.type?DH(nH(t)):("bool"===e.type&&"boolean"==typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=wH.from(t).toHexString()),"address"===e.type&&this._abiCoder.encode(["address"],[t]),uH(nH(t),32));for(t.forEach(((t,i)=>{let o=e.inputs[i];o.indexed?null==t?r.push(null):"array"===o.baseType||"tuple"===o.baseType?Cbe.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,t):Array.isArray(t)?r.push(t.map((e=>n(o,e)))):r.push(n(o,t)):null!=t&&Cbe.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,t)}));r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(e,t){"string"==typeof e&&(e=this.getEvent(e));const r=[],n=[],i=[];return e.anonymous||r.push(this.getEventTopic(e)),t.length!==e.inputs.length&&Cbe.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach(((e,o)=>{const a=t[o];if(e.indexed)if("string"===e.type)r.push(UG(a));else if("bytes"===e.type)r.push(DH(a));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([e.type],[a]))}else n.push(e),i.push(a)})),{data:this._abiCoder.encode(n,i),topics:r}}decodeEventLog(e,t,r){if("string"==typeof e&&(e=this.getEvent(e)),null!=r&&!e.anonymous){let t=this.getEventTopic(e);tH(r[0],32)&&r[0].toLowerCase()===t||Cbe.throwError("fragment/topic mismatch",S$.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:t,value:r[0]}),r=r.slice(1)}let n=[],i=[],o=[];e.inputs.forEach(((e,t)=>{e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(n.push(Vme.fromObject({type:"bytes32",name:e.name})),o.push(!0)):(n.push(e),o.push(!1)):(i.push(e),o.push(!1))}));let a=null!=r?this._abiCoder.decode(n,X$(r)):null,s=this._abiCoder.decode(i,t,!0),c=[],u=0,l=0;e.inputs.forEach(((e,t)=>{if(e.indexed)if(null==a)c[t]=new Fbe({_isIndexed:!0,hash:null});else if(o[t])c[t]=new Fbe({_isIndexed:!0,hash:a[l++]});else try{c[t]=a[l++]}catch(e){c[t]=e}else try{c[t]=s[u++]}catch(e){c[t]=e}if(e.name&&null==c[e.name]){const r=c[t];r instanceof Error?Object.defineProperty(c,e.name,{enumerable:!0,get:()=>{throw jbe(`property ${JSON.stringify(e.name)}`,r)}}):c[e.name]=r}}));for(let e=0;e{throw jbe(`index ${e}`,t)}})}return Object.freeze(c)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new Nbe({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:wH.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new Bbe({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=nH(e);let r=this.getError(t.substring(0,10).toLowerCase());return r?new Rbe({args:this._abiCoder.decode(r.inputs,"0x"+t.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(e){return!(!e||!e._isInterface)}}var Dbe=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const zbe=new S$("contracts/5.7.0"),$be={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0,customData:!0,ccipReadEnabled:!0};function Hbe(e,t){return Dbe(this,void 0,void 0,(function*(){const r=yield t;"string"!=typeof r&&zbe.throwArgumentError("invalid address or ENS name","name",r);try{return tG(r)}catch(e){}e||zbe.throwError("a provider or signer is needed to resolve ENS names",S$.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield e.resolveName(r);return null==n&&zbe.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n}))}function Gbe(e,t,r){return Dbe(this,void 0,void 0,(function*(){return Array.isArray(r)?yield Promise.all(r.map(((r,n)=>Gbe(e,Array.isArray(t)?t[n]:t[r.name],r)))):"address"===r.type?yield Hbe(e,t):"tuple"===r.type?yield Gbe(e,t,r.components):"array"===r.baseType?Array.isArray(t)?yield Promise.all(t.map((t=>Gbe(e,t,r.arrayChildren)))):Promise.reject(zbe.makeError("invalid value for array",S$.errors.INVALID_ARGUMENT,{argument:"value",value:t})):t}))}function qbe(e,t,r){return Dbe(this,void 0,void 0,(function*(){let n={};r.length===t.inputs.length+1&&"object"==typeof r[r.length-1]&&(n=B$(r.pop())),zbe.checkArgumentCount(r.length,t.inputs.length,"passed to contract"),e.signer?n.from?n.from=M$({override:Hbe(e.signer,n.from),signer:e.signer.getAddress()}).then((e=>Dbe(this,void 0,void 0,(function*(){return tG(e.signer)!==e.override&&zbe.throwError("Contract with a Signer cannot override from",S$.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),e.override})))):n.from=e.signer.getAddress():n.from&&(n.from=Hbe(e.provider,n.from));const i=yield M$({args:Gbe(e.signer||e.provider,r,t.inputs),address:e.resolvedAddress,overrides:M$(n)||{}}),o=e.interface.encodeFunctionData(t,i.args),a={data:o,to:i.address},s=i.overrides;if(null!=s.nonce&&(a.nonce=wH.from(s.nonce).toNumber()),null!=s.gasLimit&&(a.gasLimit=wH.from(s.gasLimit)),null!=s.gasPrice&&(a.gasPrice=wH.from(s.gasPrice)),null!=s.maxFeePerGas&&(a.maxFeePerGas=wH.from(s.maxFeePerGas)),null!=s.maxPriorityFeePerGas&&(a.maxPriorityFeePerGas=wH.from(s.maxPriorityFeePerGas)),null!=s.from&&(a.from=s.from),null!=s.type&&(a.type=s.type),null!=s.accessList&&(a.accessList=$K(s.accessList)),null==a.gasLimit&&null!=t.gas){let e=21e3;const r=Y$(o);for(let t=0;tnull!=n[e]));return c.length&&zbe.throwError(`cannot override ${c.map((e=>JSON.stringify(e))).join(",")}`,S$.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:c}),a}))}function Kbe(e,t){const r=t.wait.bind(t);t.wait=t=>r(t).then((t=>(t.events=t.logs.map((r=>{let n=L$(r),i=null;try{i=e.interface.parseLog(r)}catch(e){}return i&&(n.args=i.args,n.decode=(t,r)=>e.interface.decodeEventLog(i.eventFragment,t,r),n.event=i.name,n.eventSignature=i.signature),n.removeListener=()=>e.provider,n.getBlock=()=>e.provider.getBlock(t.blockHash),n.getTransaction=()=>e.provider.getTransaction(t.transactionHash),n.getTransactionReceipt=()=>Promise.resolve(t),n})),t)))}function Vbe(e,t,r){const n=e.signer||e.provider;return function(...i){return Dbe(this,void 0,void 0,(function*(){let o;if(i.length===t.inputs.length+1&&"object"==typeof i[i.length-1]){const e=B$(i.pop());null!=e.blockTag&&(o=yield e.blockTag),delete e.blockTag,i.push(e)}null!=e.deployTransaction&&(yield e._deployed(o));const a=yield qbe(e,t,i),s=yield n.call(a,o);try{let n=e.interface.decodeFunctionResult(t,s);return r&&1===t.outputs.length&&(n=n[0]),n}catch(t){throw t.code===S$.errors.CALL_EXCEPTION&&(t.address=e.address,t.args=i,t.transaction=a),t}}))}}function Wbe(e,t,r){return t.constant?Vbe(e,t,r):function(e,t){return function(...r){return Dbe(this,void 0,void 0,(function*(){e.signer||zbe.throwError("sending a transaction requires a signer",S$.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=e.deployTransaction&&(yield e._deployed());const n=yield qbe(e,t,r),i=yield e.signer.sendTransaction(n);return Kbe(e,i),i}))}}(e,t)}function Jbe(e){return!e.address||null!=e.topics&&0!==e.topics.length?(e.address||"*")+"@"+(e.topics?e.topics.map((e=>Array.isArray(e)?e.join("|"):e)).join(":"):""):"*"}class Zbe{constructor(e,t){T$(this,"tag",e),T$(this,"filter",t),this._listeners=[]}addListener(e,t){this._listeners.push({listener:e,once:t})}removeListener(e){let t=!1;this._listeners=this._listeners.filter((r=>!(!t&&r.listener===e)||(t=!0,!1)))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((e=>e.listener))}listenerCount(){return this._listeners.length}run(e){const t=this.listenerCount();return this._listeners=this._listeners.filter((t=>{const r=e.slice();return setTimeout((()=>{t.listener.apply(this,r)}),0),!t.once})),t}prepareEvent(e){}getEmit(e){return[e]}}class Ybe extends Zbe{constructor(){super("error",null)}}class Xbe extends Zbe{constructor(e,t,r,n){const i={address:e};let o=t.getEventTopic(r);n?(o!==n[0]&&zbe.throwArgumentError("topic mismatch","topics",n),i.topics=n.slice()):i.topics=[o],super(Jbe(i),i),T$(this,"address",e),T$(this,"interface",t),T$(this,"fragment",r)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(e,t)=>this.interface.decodeEventLog(this.fragment,e,t);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(t){e.args=null,e.decodeError=t}}getEmit(e){const t=ube(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class Qbe extends Zbe{constructor(e,t){super("*",{address:e}),T$(this,"address",e),T$(this,"interface",t)}prepareEvent(e){super.prepareEvent(e);try{const t=this.interface.parseLog(e);e.event=t.name,e.eventSignature=t.signature,e.decode=(e,r)=>this.interface.decodeEventLog(t.eventFragment,e,r),e.args=t.args}catch(e){}}}class ege{constructor(e,t,r){T$(this,"interface",O$(new.target,"getInterface")(t)),null==r?(T$(this,"provider",null),T$(this,"signer",null)):H$.isSigner(r)?(T$(this,"provider",r.provider||null),T$(this,"signer",r)):aG.isProvider(r)?(T$(this,"provider",r),T$(this,"signer",null)):zbe.throwArgumentError("invalid signer or provider","signerOrProvider",r),T$(this,"callStatic",{}),T$(this,"estimateGas",{}),T$(this,"functions",{}),T$(this,"populateTransaction",{}),T$(this,"filters",{});{const e={};Object.keys(this.interface.events).forEach((t=>{const r=this.interface.events[t];T$(this.filters,t,((...e)=>({address:this.address,topics:this.interface.encodeFilterTopics(r,e)}))),e[r.name]||(e[r.name]=[]),e[r.name].push(t)})),Object.keys(e).forEach((t=>{const r=e[t];1===r.length?T$(this.filters,t,this.filters[r[0]]):zbe.warn(`Duplicate definition of ${t} (${r.join(", ")})`)}))}if(T$(this,"_runningEvents",{}),T$(this,"_wrappedEmits",{}),null==e&&zbe.throwArgumentError("invalid contract address or ENS name","addressOrName",e),T$(this,"address",e),this.provider)T$(this,"resolvedAddress",Hbe(this.provider,e));else try{T$(this,"resolvedAddress",Promise.resolve(tG(e)))}catch(e){zbe.throwError("provider is required to use ENS name as contract address",S$.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((e=>{}));const n={},i={};Object.keys(this.interface.functions).forEach((e=>{const t=this.interface.functions[e];if(i[e])zbe.warn(`Duplicate ABI entry for ${JSON.stringify(e)}`);else{i[e]=!0;{const r=t.name;n[`%${r}`]||(n[`%${r}`]=[]),n[`%${r}`].push(e)}null==this[e]&&T$(this,e,Wbe(this,t,!0)),null==this.functions[e]&&T$(this.functions,e,Wbe(this,t,!1)),null==this.callStatic[e]&&T$(this.callStatic,e,Vbe(this,t,!0)),null==this.populateTransaction[e]&&T$(this.populateTransaction,e,function(e,t){return function(...r){return qbe(e,t,r)}}(this,t)),null==this.estimateGas[e]&&T$(this.estimateGas,e,function(e,t){const r=e.signer||e.provider;return function(...n){return Dbe(this,void 0,void 0,(function*(){r||zbe.throwError("estimate require a provider or signer",S$.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield qbe(e,t,n);return yield r.estimateGas(i)}))}}(this,t))}})),Object.keys(n).forEach((e=>{const t=n[e];if(t.length>1)return;e=e.substring(1);const r=t[0];try{null==this[e]&&T$(this,e,this[r])}catch(e){}null==this.functions[e]&&T$(this.functions,e,this.functions[r]),null==this.callStatic[e]&&T$(this.callStatic,e,this.callStatic[r]),null==this.populateTransaction[e]&&T$(this.populateTransaction,e,this.populateTransaction[r]),null==this.estimateGas[e]&&T$(this.estimateGas,e,this.estimateGas[r])}))}static getContractAddress(e){return rG(e)}static getInterface(e){return Ube.isInterface(e)?e:new Ube(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,e).then((e=>("0x"===e&&zbe.throwError("contract not deployed",S$.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(e){this.signer||zbe.throwError("sending a transactions require a signer",S$.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=B$(e||{});return["from","to"].forEach((function(e){null!=t[e]&&zbe.throwError("cannot override "+e,S$.errors.UNSUPPORTED_OPERATION,{operation:e})})),t.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(t)))}connect(e){"string"==typeof e&&(e=new G$(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&T$(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return Fbe.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if("string"==typeof e){if("error"===e)return this._normalizeRunningEvent(new Ybe);if("event"===e)return this._normalizeRunningEvent(new Zbe("event",null));if("*"===e)return this._normalizeRunningEvent(new Qbe(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new Xbe(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{const t=e.topics[0];if("string"!=typeof t)throw new Error("invalid topic");const r=this.interface.getEvent(t);return this._normalizeRunningEvent(new Xbe(this.address,this.interface,r,e.topics))}catch(e){}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new Zbe(Jbe(t),t))}return this._normalizeRunningEvent(new Qbe(this.address,this.interface))}_checkRunningEvents(e){if(0===e.listenerCount()){delete this._runningEvents[e.tag];const t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,t,r){const n=L$(t);return n.removeListener=()=>{r&&(e.removeListener(r),this._checkRunningEvents(e))},n.getBlock=()=>this.provider.getBlock(t.blockHash),n.getTransaction=()=>this.provider.getTransaction(t.transactionHash),n.getTransactionReceipt=()=>this.provider.getTransactionReceipt(t.transactionHash),e.prepareEvent(n),n}_addEventListener(e,t,r){if(this.provider||zbe.throwError("events require a provider or a signer with a provider",S$.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,r),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const r=r=>{let n=this._wrapEvent(e,r,t);if(null==n.decodeError)try{const t=e.getEmit(n);this.emit(e.filter,...t)}catch(e){n.decodeError=e.error}null!=e.filter&&this.emit("event",n),null!=n.decodeError&&this.emit("error",n.decodeError,n)};this._wrappedEmits[e.tag]=r,null!=e.filter&&this.provider.on(e.filter,r)}}queryFilter(e,t,r){const n=this._getRunningEvent(e),i=B$(n.filter);return"string"==typeof t&&tH(t,32)?(null!=r&&zbe.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),i.blockHash=t):(i.fromBlock=null!=t?t:0,i.toBlock=null!=r?r:"latest"),this.provider.getLogs(i).then((e=>e.map((e=>this._wrapEvent(n,e,null)))))}on(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}once(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}emit(e,...t){if(!this.provider)return!1;const r=this._getRunningEvent(e),n=r.run(t)>0;return this._checkRunningEvents(r),n}listenerCount(e){return this.provider?null==e?Object.keys(this._runningEvents).reduce(((e,t)=>e+this._runningEvents[t].listenerCount()),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(null==e){const e=[];for(let t in this._runningEvents)this._runningEvents[t].listeners().forEach((t=>{e.push(t)}));return e}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(null==e){for(const e in this._runningEvents){const t=this._runningEvents[e];t.removeAllListeners(),this._checkRunningEvents(t)}return this}const t=this._getRunningEvent(e);return t.removeAllListeners(),this._checkRunningEvents(t),this}off(e,t){if(!this.provider)return this;const r=this._getRunningEvent(e);return r.removeListener(t),this._checkRunningEvents(r),this}removeListener(e,t){return this.off(e,t)}}class tge extends ege{}class rge{constructor(e,t,r){let n=null;n="string"==typeof t?t:Z$(t)?nH(t):t&&"string"==typeof t.object?t.object:"!","0x"!==n.substring(0,2)&&(n="0x"+n),(!tH(n)||n.length%2)&&zbe.throwArgumentError("invalid bytecode","bytecode",t),r&&!H$.isSigner(r)&&zbe.throwArgumentError("invalid signer","signer",r),T$(this,"bytecode",n),T$(this,"interface",O$(new.target,"getInterface")(e)),T$(this,"signer",r||null)}getDeployTransaction(...e){let t={};if(e.length===this.interface.deploy.inputs.length+1&&"object"==typeof e[e.length-1]){t=B$(e.pop());for(const e in t)if(!$be[e])throw new Error("unknown transaction override "+e)}if(["data","from","to"].forEach((e=>{null!=t[e]&&zbe.throwError("cannot override "+e,S$.errors.UNSUPPORTED_OPERATION,{operation:e})})),t.value){wH.from(t.value).isZero()||this.interface.deploy.payable||zbe.throwError("non-payable constructor cannot override value",S$.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:t.value})}return zbe.checkArgumentCount(e.length,this.interface.deploy.inputs.length," in Contract constructor"),t.data=nH(X$([this.bytecode,this.interface.encodeDeploy(e)])),t}deploy(...e){return Dbe(this,void 0,void 0,(function*(){let t={};e.length===this.interface.deploy.inputs.length+1&&(t=e.pop()),zbe.checkArgumentCount(e.length,this.interface.deploy.inputs.length," in Contract constructor");const r=yield Gbe(this.signer,e,this.interface.deploy.inputs);r.push(t);const n=this.getDeployTransaction(...r),i=yield this.signer.sendTransaction(n),o=O$(this.constructor,"getContractAddress")(i),a=O$(this.constructor,"getContract")(o,this.interface,this.signer);return Kbe(a,i),T$(a,"deployTransaction",i),a}))}attach(e){return this.constructor.getContract(e,this.interface,this.signer)}connect(e){return new this.constructor(this.interface,this.bytecode,e)}static fromSolidity(e,t){null==e&&zbe.throwError("missing compiler output",S$.errors.MISSING_ARGUMENT,{argument:"compilerOutput"}),"string"==typeof e&&(e=JSON.parse(e));const r=e.abi;let n=null;return e.bytecode?n=e.bytecode:e.evm&&e.evm.bytecode&&(n=e.evm.bytecode),new this(r,n,t)}static getInterface(e){return tge.getInterface(e)}static getContractAddress(e){return rG(e)}static getContract(e,t,r){return new tge(e,t,r)}}const nge=new RegExp("^bytes([0-9]+)$"),ige=new RegExp("^(u?int)([0-9]*)$"),oge=new RegExp("^(.*)\\[([0-9]*)\\]$"),age="0000000000000000000000000000000000000000000000000000000000000000",sge=new S$("solidity/5.7.0");function cge(e,t,r){switch(e){case"address":return r?eH(t,32):Y$(t);case"string":return _G(t);case"bytes":return Y$(t);case"bool":return t=t?"0x01":"0x00",r?eH(t,32):Y$(t)}let n=e.match(ige);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!=0||0===i||i>256)&&sge.throwArgumentError("invalid number type","type",e),r&&(i=256),eH(t=wH.from(t).toTwos(i),i/8)}if(n=e.match(nge),n){const i=parseInt(n[1]);return(String(i)!==n[1]||0===i||i>32)&&sge.throwArgumentError("invalid bytes type","type",e),Y$(t).byteLength!==i&&sge.throwArgumentError(`invalid value for ${e}`,"value",t),r?Y$((t+age).substring(0,66)):t}if(n=e.match(oge),n&&Array.isArray(t)){const r=n[1];parseInt(n[2]||String(t.length))!=t.length&&sge.throwArgumentError(`invalid array length for ${e}`,"value",t);const i=[];return t.forEach((function(e){i.push(cge(r,e,!0))})),X$(i)}return sge.throwArgumentError("invalid type","type",e)}function uge(e,t){e.length!=t.length&&sge.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);const r=[];return e.forEach((function(e,n){r.push(cge(e,t[n]))})),nH(X$(r))}const lge=new S$("units/5.7.0"),fge=["wei","kwei","mwei","gwei","szabo","finney","ether"];function dge(e,t){if("string"==typeof t){const e=fge.indexOf(t);-1!==e&&(t=3*e)}return CH(e,null!=t?t:18)}function hge(e,t){if("string"!=typeof e&&lge.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=fge.indexOf(t);-1!==e&&(t=3*e)}return BH(e,null!=t?t:18)}var pge=Object.freeze({__proto__:null,AbiCoder:Obe,ConstructorFragment:ebe,ErrorFragment:nbe,EventFragment:Zme,FormatTypes:qme,Fragment:Jme,FunctionFragment:tbe,HDNode:fV,Indexed:Fbe,Interface:Ube,LogDescription:Bbe,Logger:S$,ParamType:Vme,RLP:JH,SigningKey:TK,get SupportedAlgorithm(){return Lq},TransactionDescription:Nbe,get TransactionTypes(){return BK},get UnicodeNormalizationForm(){return vG},Utf8ErrorFuncs:AG,get Utf8ErrorReason(){return wG},_TypedDataEncoder:Nq,_fetchData:tY,_toEscapedUtf8String:function(e,t){return'"'+xG(e,t).map((e=>{if(e<256){switch(e){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(e>=32&&e<127)return String.fromCharCode(e)}return e<=65535?kG(e):kG(55296+((e-=65536)>>10&1023))+kG(56320+(1023&e))})).join("")+'"'},accessListify:$K,arrayify:Y$,base58:Fq,base64:HG,checkProperties:C$,checkResultErrors:ube,commify:function(e){const t=String(e).split(".");(t.length>2||!t[0].match(/^-?[0-9]*$/)||t[1]&&!t[1].match(/^[0-9]*$/)||"."===e||"-."===e)&&lge.throwArgumentError("invalid value","value",e);let r=t[0],n="";for("-"===r.substring(0,1)&&(n="-",r=r.substring(1));"0"===r.substring(0,1);)r=r.substring(1);""===r&&(r="0");let i="";for(2===t.length&&(i="."+(t[1]||"0"));i.length>2&&"0"===i[i.length-1];)i=i.substring(0,i.length-1);const o=[];for(;r.length;){if(r.length<=3){o.unshift(r);break}{const e=r.length-3;o.unshift(r.substring(e)),r=r.substring(0,e)}}return n+o.join(",")+i},computeAddress:jK,computeHmac:zq,computePublicKey:MK,concat:X$,deepCopy:L$,defaultAbiCoder:Mbe,defaultPath:lV,defineReadOnly:T$,dnsEncode:bq,entropyToMnemonic:pV,fetchJson:rY,formatBytes32String:function(e){const t=_G(e);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return nH(X$([t,bG]).slice(0,32))},formatEther:function(e){return dge(e,18)},formatUnits:dge,getAccountPath:function(e){return("number"!=typeof e||e<0||e>=iV||e%1)&&tV.throwArgumentError("invalid account index","index",e),`m/44'/60'/${e}'/0/0`},getAddress:tG,getContractAddress:rG,getCreate2Address:function(e,t,r){return 32!==iH(t)&&ZH.throwArgumentError("salt must be 32 bytes","salt",t),32!==iH(r)&&ZH.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),tG(oH(DH(X$(["0xff",tG(e),t,r])),12))},getIcapAddress:function(e){let t=function(e){return new mH(e,16).toString(36)}(tG(e).substring(2)).toUpperCase();for(;t.length<30;)t="0"+t;return"XE"+eG("XE00"+t)+t},getJsonWalletAddress:function(e){if(MV(e))try{return tG(JSON.parse(e).ethaddr)}catch(e){return null}if(CV(e))try{return tG(JSON.parse(e).address)}catch(e){return null}return null},getStatic:O$,hashMessage:yq,hexConcat:aH,hexDataLength:iH,hexDataSlice:oH,hexStripZeros:cH,hexValue:sH,hexZeroPad:uH,hexlify:nH,id:UG,isAddress:function(e){try{return tG(e),!0}catch(e){}return!1},isBytes:Z$,isBytesLike:W$,isHexString:tH,isValidMnemonic:function(e,t){try{return hV(e,t),!0}catch(e){}return!1},isValidName:function(e){try{return 0!==pq(e).length}catch(e){}return!1},joinSignature:fH,keccak256:DH,mnemonicToEntropy:hV,mnemonicToSeed:dV,namehash:mq,nameprep:function(e){if(e.match(/^[a-z0-9-]*$/i)&&e.length<=59)return e.toLowerCase();let t=IG(e);var r;r=t.map((e=>{if(BG.indexOf(e)>=0)return[];if(e>=65024&&e<=65039)return[];let t=function(e){let t=MG(e,NG);if(t)return[e+t.s];let r=RG[e];if(r)return r;let n=FG[e];return n?[e+n[0]]:LG[e]||null}(e);return t||[e]})),t=r.reduce(((e,t)=>(t.forEach((t=>{e.push(t)})),e)),[]),t=IG(SG(t),vG.NFKC),t.forEach((e=>{if(MG(e,jG))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),t.forEach((e=>{if(MG(e,CG))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));let n=SG(t);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");return n},parseBytes32String:function(e){const t=Y$(e);if(32!==t.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==t[31])throw new Error("invalid bytes32 string - no null terminator");let r=31;for(;0===t[r-1];)r--;return PG(t.slice(0,r))},parseEther:function(e){return hge(e,18)},parseTransaction:WK,parseUnits:hge,poll:nY,randomBytes:yV,recoverAddress:UK,recoverPublicKey:OK,resolveProperties:M$,ripemd160:Uq,serializeTransaction:KK,sha256:Dq,sha512:function(e){return"0x"+zg.sha512().update(Y$(e)).digest("hex")},shallowCopy:B$,shuffled:vV,solidityKeccak256:function(e,t){return DH(uge(e,t))},solidityPack:uge,soliditySha256:function(e,t){return Dq(uge(e,t))},splitSignature:lH,stripZeros:Q$,toUtf8Bytes:_G,toUtf8CodePoints:IG,toUtf8String:PG,verifyMessage:function(e,t){return UK(yq(e),t)},verifyTypedData:function(e,t,r,n){return UK(Nq.hash(e,t,r),n)},zeroPad:eH});const mge="ethers/5.7.2",bge=new S$(mge);var gge=Object.freeze({__proto__:null,BaseContract:ege,BigNumber:wH,Contract:tge,ContractFactory:rge,FixedNumber:RH,Signer:H$,VoidSigner:G$,Wallet:VV,Wordlist:ZK,constants:gG,get errors(){return _$},getDefaultProvider:sQ,logger:bge,providers:cQ,utils:pge,version:mge,wordlists:eV});try{const e=window;null==e._ethers&&(e._ethers=gge)}catch(yse){}var yge=s(Object.freeze({__proto__:null,BaseContract:ege,BigNumber:wH,Contract:tge,ContractFactory:rge,FixedNumber:RH,Signer:H$,VoidSigner:G$,Wallet:VV,Wordlist:ZK,constants:gG,get errors(){return _$},ethers:gge,getDefaultProvider:sQ,logger:bge,providers:cQ,utils:pge,version:mge,wordlists:eV}));var vge=function(e,t){for(var r=-1,n=t.length,i=e.length;++r0&&n(c)?r>1?e(c,r-1,n,i,o):Qge(o,c):i||(o[o.length]=c)}return o};var rye=function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r-1},pye=aye;var mye=function(e,t){var r=this.__data__,n=pye(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},bye=nye,gye=uye,yye=fye,vye=hye,wye=mye;function Eye(e){var t=-1,r=null==e?0:e.length;for(this.clear();++ts))return!1;var u=o.get(e),l=o.get(t);if(u&&l)return u==t&&l==e;var f=-1,d=!0,h=2&r?new iwe:void 0;for(o.set(e,t),o.set(t,e);++f-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},Rwe=Fge,Fwe=Nwe,Lwe=Lge,jwe={};jwe["[object Float32Array]"]=jwe["[object Float64Array]"]=jwe["[object Int8Array]"]=jwe["[object Int16Array]"]=jwe["[object Int32Array]"]=jwe["[object Uint8Array]"]=jwe["[object Uint8ClampedArray]"]=jwe["[object Uint16Array]"]=jwe["[object Uint32Array]"]=!0,jwe["[object Arguments]"]=jwe["[object Array]"]=jwe["[object ArrayBuffer]"]=jwe["[object Boolean]"]=jwe["[object DataView]"]=jwe["[object Date]"]=jwe["[object Error]"]=jwe["[object Function]"]=jwe["[object Map]"]=jwe["[object Number]"]=jwe["[object Object]"]=jwe["[object RegExp]"]=jwe["[object Set]"]=jwe["[object String]"]=jwe["[object WeakMap]"]=!1;var Uwe=function(e){return Lwe(e)&&Fwe(e.length)&&!!jwe[Rwe(e)]};var Dwe=function(e){return function(t){return e(t)}},zwe={exports:{}};!function(e,t){var r=wge,n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n&&r.process,a=function(){try{var e=i&&i.require&&i.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=a}(zwe,zwe.exports);var $we=zwe.exports,Hwe=Uwe,Gwe=Dwe,qwe=$we&&$we.isTypedArray,Kwe=qwe?Gwe(qwe):Hwe,Vwe=Iwe,Wwe=Vge,Jwe=Wge,Zwe=Mwe,Ywe=Bwe,Xwe=Kwe,Qwe=Object.prototype.hasOwnProperty;var eEe=function(e,t){var r=Jwe(e),n=!r&&Wwe(e),i=!r&&!n&&Zwe(e),o=!r&&!n&&!i&&Xwe(e),a=r||n||i||o,s=a?Vwe(e.length,String):[],c=s.length;for(var u in e)!t&&!Qwe.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Ywe(u,c))||s.push(u);return s},tEe=Object.prototype;var rEe=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||tEe)};var nEe=function(e,t){return function(r){return e(t(r))}},iEe=nEe(Object.keys,Object),oEe=rEe,aEe=iEe,sEe=Object.prototype.hasOwnProperty;var cEe=function(e){if(!oEe(e))return aEe(e);var t=[];for(var r in Object(e))sEe.call(e,r)&&"constructor"!=r&&t.push(r);return t},uEe=Mye,lEe=Nwe;var fEe=function(e){return null!=e&&lEe(e.length)&&!uEe(e)},dEe=eEe,hEe=cEe,pEe=fEe;var mEe=function(e){return pEe(e)?dEe(e):hEe(e)},bEe=wwe,gEe=Pwe,yEe=mEe;var vEe=function(e){return bEe(e,yEe,gEe)},wEe=vEe,EEe=Object.prototype.hasOwnProperty;var AEe=function(e,t,r,n,i,o){var a=1&r,s=wEe(e),c=s.length;if(c!=wEe(t).length&&!a)return!1;for(var u=c;u--;){var l=s[u];if(!(a?l in t:EEe.call(t,l)))return!1}var f=o.get(e),d=o.get(t);if(f&&d)return f==t&&d==e;var h=!0;o.set(e,t),o.set(t,e);for(var p=a;++ue.type)),r=(0,Zxe.default)(t,(e=>["bytes32",Yxe.TYPE_TRANSFORMATIONS[e]??e])),n=["bytes32",...r],i=function(e){const t=Object.keys(Yxe.PARAMETER_SHORT_TYPES),r=e.reduce(((e,r)=>[...e,t.find((e=>Yxe.PARAMETER_SHORT_TYPES[e]===r))]),[]);return`${Xxe}${r.join("")}`}(t),o=Jxe.ethers.utils.formatBytes32String(i),a=function(e){return(0,Zxe.default)(e,(e=>{const{name:t,value:r,type:n}=e,i=Qxe[n],o=Jxe.ethers.utils.formatBytes32String(t);return i?[o,i(r)]:[o,r]}))}(e),s=[o,...a];return(new Jxe.ethers.utils.AbiCoder).encode(n,s)};var e_e={};var t_e=function(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++ne.toString(),uint256:e=>e.toString()};e_e.decode=function(e){if("0x"===e)return{};const t=C_e.ethers.utils.hexlify(C_e.ethers.utils.arrayify(e).slice(0,32)),r=C_e.ethers.utils.parseBytes32String(t),n=r.substring(0,1);if("1"!==n)throw new Error(`Unknown ABI schema version: ${n}`);const i=r.substring(1),o=Array.from(i).map((e=>N_e.PARAMETER_SHORT_TYPES[e])),a=o.reduce(((e,t)=>[...e,"bytes32",N_e.TYPE_TRANSFORMATIONS[t]??t]),["bytes32"]),s=C_e.ethers.utils.defaultAbiCoder.decode(a,e);if(C_e.ethers.utils.defaultAbiCoder.encode(a,s)!==e)throw new Error("Re-encoding mismatch");const[c,...u]=s;return function(e,t){return t.reduce(((t,r,n)=>{const[i,o]=r,a=C_e.ethers.utils.parseBytes32String(i),s=e[n],c=R_e[s];if(!c)return{...t,[a]:o};const u=c(o);return{...t,[a]:u}}),{})}(o,(0,B_e.default)(u,2))};var F_e={};Object.defineProperty(F_e,"__esModule",{value:!0}),function(e){var t=o&&o.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=o&&o.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.PARAMETER_SHORT_TYPES=e.decode=e.encode=void 0;var n=Lme;Object.defineProperty(e,"encode",{enumerable:!0,get:function(){return n.encode}});var i=e_e;Object.defineProperty(e,"decode",{enumerable:!0,get:function(){return i.decode}});var a=Vxe;Object.defineProperty(e,"PARAMETER_SHORT_TYPES",{enumerable:!0,get:function(){return a.PARAMETER_SHORT_TYPES}}),r(F_e,e)}(Fme);class L_e extends Error{constructor(e,t={}){const r=t.cause instanceof L_e?t.cause.details:t.cause?.message?t.cause.message:t.details,n=t.cause instanceof L_e&&t.cause.docsPath||t.docsPath;super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...n?[`Docs: https://abitype.dev${n}`]:[],...r?[`Details: ${r}`]:[],"Version: abitype@1.0.5"].join("\n")),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),t.cause&&(this.cause=t.cause),this.details=r,this.docsPath=n,this.metaMessages=t.metaMessages,this.shortMessage=e}}function j_e(e,t){const r=e.exec(t);return r?.groups}const U_e=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,D_e=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,z_e=/^\(.+?\).*?$/,$_e=/^tuple(?(\[(\d*)\])*)$/;function H_e(e){let t=e.type;if($_e.test(e.type)&&"components"in e){t="(";const r=e.components.length;for(let n=0;n[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;const K_e=/^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;const V_e=/^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\s?\((?.*?)\))?$/;const W_e=/^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function J_e(e){return W_e.test(e)}function Z_e(e){return j_e(W_e,e)}const Y_e=/^constructor\((?.*?)\)(?:\s(?payable{1}))?$/;const X_e=/^fallback\(\) external(?:\s(?payable{1}))?$/;const Q_e=/^receive\(\) external payable$/;const eke=new Set(["indexed"]),tke=new Set(["calldata","memory","storage"]);class rke extends L_e{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class nke extends L_e{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class ike extends L_e{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class oke extends L_e{constructor({param:e,name:t}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${t}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class ake extends L_e{constructor({param:e,type:t,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${t?` in "${t}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class ske extends L_e{constructor({param:e,type:t,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${t?` in "${t}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class cke extends L_e{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class uke extends L_e{constructor({signature:e,type:t}){super(`Invalid ${t} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class lke extends L_e{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class fke extends L_e{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class dke extends L_e{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class hke extends L_e{constructor({current:e,depth:t}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${t>0?"opening":"closing"} parentheses.`],details:`Depth "${t}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}const pke=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function mke(e,t={}){if(function(e){return V_e.test(e)}(e)){const r=function(e){return j_e(V_e,e)}(e);if(!r)throw new uke({signature:e,type:"function"});const n=wke(r.parameters),i=[],o=n.length;for(let e=0;e[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,gke=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,yke=/^u?int$/;function vke(e,t){const r=function(e,t){return t?`${t}:${e}`:e}(e,t?.type);if(pke.has(r))return pke.get(r);const n=z_e.test(e),i=j_e(n?gke:bke,e);if(!i)throw new ike({param:e});if(i.name&&function(e){return"address"===e||"bool"===e||"function"===e||"string"===e||"tuple"===e||U_e.test(e)||D_e.test(e)||Ake.test(e)}(i.name))throw new oke({param:e,name:i.name});const o=i.name?{name:i.name}:{},a="indexed"===i.modifier?{indexed:!0}:{},s=t?.structs??{};let c,u={};if(n){c="tuple";const e=wke(i.type),t=[],r=e.length;for(let n=0;n[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function _ke(e,t,r=new Set){const n=[],i=e.length;for(let o=0;ot(e,r)}function Pke(e,{includeName:t=!1}={}){if("function"!==e.type&&"event"!==e.type&&"error"!==e.type)throw new Jke(e.type);return`${e.name}(${Ike(e.inputs,{includeName:t})})`}function Ike(e,{includeName:t=!1}={}){return e?e.map((e=>function(e,{includeName:t}){if(e.type.startsWith("tuple"))return`(${Ike(e.components,{includeName:t})})${e.type.slice(5)}`;return e.type+(t&&e.name?` ${e.name}`:"")}(e,{includeName:t}))).join(t?", ":","):""}class Tke extends Zfe{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join("\n"),{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorNotFoundError"})}}class Oke extends Zfe{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join("\n"),{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorParamsNotFoundError"})}}class Mke extends Zfe{constructor({data:e,params:t,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join("\n"),{metaMessages:[`Params: (${Ike(t,{includeName:!0})})`,`Data: ${e} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=t,this.size=r}}class Cke extends Zfe{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingZeroDataError"})}}class Bke extends Zfe{constructor({expectedLength:e,givenLength:t,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${e}`,`Given length: ${t}`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingArrayLengthMismatchError"})}}class Nke extends Zfe{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${rde(t)}) does not match expected size (bytes${e}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingBytesSizeMismatchError"})}}class Rke extends Zfe{constructor({expectedLength:e,givenLength:t}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${t}`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingLengthMismatchError"})}}class Fke extends Zfe{constructor(e,{docsPath:t}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class Lke extends Zfe{constructor({docsPath:e}){super("Cannot extract event signature from empty topics.",{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureEmptyTopicsError"})}}class jke extends Zfe{constructor(e,{docsPath:t}){super([`Encoded event signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureNotFoundError"})}}class Uke extends Zfe{constructor(e,{docsPath:t}={}){super([`Event ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventNotFoundError"})}}class Dke extends Zfe{constructor(e,{docsPath:t}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionNotFoundError"})}}class zke extends Zfe{constructor(e,{docsPath:t}){super([`Function "${e}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionOutputsNotFoundError"})}}class $ke extends Zfe{constructor(e,t){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${Pke(e.abiItem)}\`, and`,`\`${t.type}\` in \`${Pke(t.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItemAmbiguityError"})}}class Hke extends Zfe{constructor({expectedSize:e,givenSize:t}){super(`Expected bytes${e}, got bytes${t}.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BytesSizeMismatchError"})}}class Gke extends Zfe{constructor({abiItem:e,data:t,params:r,size:n}){super([`Data size of ${n} bytes is too small for non-indexed event parameters.`].join("\n"),{metaMessages:[`Params: (${Ike(r,{includeName:!0})})`,`Data: ${t} (${n} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e,this.data=t,this.params=r,this.size=n}}class qke extends Zfe{constructor({abiItem:e,param:t}){super([`Expected a topic for indexed event parameter${t.name?` "${t.name}"`:""} on event "${Pke(e,{includeName:!0})}".`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e}}class Kke extends Zfe{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiEncodingType"})}}class Vke extends Zfe{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiDecodingType"})}}class Wke extends Zfe{constructor(e){super([`Value "${e}" is not a valid array.`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidArrayError"})}}class Jke extends Zfe{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidDefinitionTypeError"})}}class Zke extends Zfe{constructor(e){super(`Filter type "${e}" is not supported.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FilterTypeNotSupportedError"})}}const Yke=e=>Bde(gde(e));const Xke=e=>{var t;return function(e){let t=!0,r="",n=0,i="",o=!1;for(let a=0;a0?Ude([t,e]):t}}if(i)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:Ude(o.map((({encoded:e})=>e)))}}(t,{length:n,param:{...e,type:i}})}if("tuple"===e.type)return function(e,{param:t}){let r=!1;const n=[];for(let i=0;ie)))}}(t,{param:e});if("address"===e.type)return function(e){if(!jde(e))throw new Mde({address:e});return{dynamic:!1,encoded:cde(e.toLowerCase())}}(t);if("bool"===e.type)return function(e){if("boolean"!=typeof e)throw new Zfe(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:cde(fde(e))}}(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){return function(e,{signed:t}){return{dynamic:!1,encoded:hde(e,{size:32,signed:t})}}(t,{signed:e.type.startsWith("int")})}if(e.type.startsWith("bytes"))return function(e,{param:t}){const[,r]=t.type.split("bytes"),n=rde(e);if(!r){let t=e;return n%32!=0&&(t=cde(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:Ude([cde(hde(n,{size:32})),t])}}if(n!==Number.parseInt(r))throw new Nke({expectedSize:Number.parseInt(r),value:e});return{dynamic:!1,encoded:cde(e,{dir:"right"})}}(t,{param:e});if("string"===e.type)return function(e){const t=mde(e),r=Math.ceil(rde(t)/32),n=[];for(let e=0;ePhe(Qke(e),0,4);function aSe(e){const{abi:t,args:r=[],name:n}=e,i=tde(n,{strict:!1}),o=t.filter((e=>i?"function"===e.type?oSe(e)===n:"event"===e.type&&eSe(e)===n:"name"in e&&e.name===n));if(0===o.length)return;if(1===o.length)return o[0];let a;for(const e of o){if(!("inputs"in e))continue;if(!r||0===r.length){if(!e.inputs||0===e.inputs.length)return e;continue}if(!e.inputs)continue;if(0===e.inputs.length)continue;if(e.inputs.length!==r.length)continue;const t=r.every(((t,r)=>{const n="inputs"in e&&e.inputs[r];return!!n&&sSe(t,n)}));if(t){if(a&&"inputs"in a&&a.inputs){const t=cSe(e.inputs,a.inputs,r);if(t)throw new $ke({abiItem:e,type:t[0]},{abiItem:a,type:t[1]})}a=e}}return a||o[0]}function sSe(e,t){const r=typeof e,n=t.type;switch(n){case"address":return jde(e,{strict:!1});case"bool":return"boolean"===r;case"function":case"string":return"string"===r;default:return"tuple"===n&&"components"in t?Object.values(t.components).every(((t,r)=>sSe(Object.values(e)[r],t))):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?"number"===r||"bigint"===r:/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?"string"===r||e instanceof Uint8Array:!!/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)&&(Array.isArray(e)&&e.every((e=>sSe(e,{...t,type:n.replace(/(\[[0-9]{0,}\])$/,"")}))))}}function cSe(e,t,r){for(const n in e){const i=e[n],o=t[n];if("tuple"===i.type&&"tuple"===o.type&&"components"in i&&"components"in o)return cSe(i.components,o.components,r[n]);const a=[i.type,o.type];if(!(!a.includes("address")||!a.includes("bytes20"))||(a.includes("address")&&a.includes("string")||!(!a.includes("address")||!a.includes("bytes")))&&jde(r[n],{strict:!1}))return a}}const uSe="/docs/contract/encodeEventTopics";function lSe(e){const{abi:t,eventName:r,args:n}=e;let i=t[0];if(r){const e=aSe({abi:t,name:r});if(!e)throw new Uke(r,{docsPath:uSe});i=e}if("event"!==i.type)throw new Uke(void 0,{docsPath:uSe});const o=Pke(i),a=eSe(o);let s=[];if(n&&"inputs"in i){const e=i.inputs?.filter((e=>"indexed"in e&&e.indexed)),t=Array.isArray(n)?n:Object.values(n).length>0?e?.map((e=>n[e.name]))??[]:[];t.length>0&&(s=e?.map(((e,r)=>Array.isArray(t[r])?t[r].map(((n,i)=>fSe({param:e,value:t[r][i]}))):t[r]?fSe({param:e,value:t[r]}):null))??[])}return[a,...s]}function fSe({param:e,value:t}){if("string"===e.type||"bytes"===e.type)return Bde(gde(t));if("tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/))throw new Zke(e.type);return tSe([e],[t])}function dSe(e,{method:t}){const r={};return"fallback"===e.transport.type&&e.transport.onResponse?.((({method:e,response:n,status:i,transport:o})=>{"success"===i&&t===e&&(r[n]=o.request)})),t=>r[t]||e.request}async function hSe(e,t){const{address:r,abi:n,args:i,eventName:o,fromBlock:a,strict:s,toBlock:c}=t,u=dSe(e,{method:"eth_newFilter"}),l=o?lSe({abi:n,args:i,eventName:o}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:r,fromBlock:"bigint"==typeof a?hde(a):a,toBlock:"bigint"==typeof c?hde(c):c,topics:l}]});return{abi:n,args:i,eventName:o,id:f,request:u(f),strict:Boolean(s),type:"event"}}function pSe(e){return"string"==typeof e?{address:e,type:"json-rpc"}:e}const mSe="/docs/contract/encodeFunctionData";function bSe(e){const{args:t}=e,{abi:r,functionName:n}=1===e.abi.length&&e.functionName?.startsWith("0x")?e:function(e){const{abi:t,args:r,functionName:n}=e;let i=t[0];if(n){const e=aSe({abi:t,args:r,name:n});if(!e)throw new Dke(n,{docsPath:mSe});i=e}if("function"!==i.type)throw new Dke(void 0,{docsPath:mSe});return{abi:[i],functionName:oSe(Pke(i))}}(e),i=r[0];return Dde([n,("inputs"in i&&i.inputs?tSe(i.inputs,t??[]):void 0)??"0x"])}const gSe={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},ySe={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},vSe={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function wSe(e,t={}){void 0!==t.size&&Ade(e,{size:t.size});return xde(dde(e,t),t)}function ESe(e,t={}){let r=e;if(void 0!==t.size&&(Ade(r,{size:t.size}),r=nde(r)),r.length>1||r[0]>1)throw new Qfe(r);return Boolean(r[0])}function ASe(e,t={}){void 0!==t.size&&Ade(e,{size:t.size});return _de(dde(e,t),t)}function xSe(e,t){const r="string"==typeof t?wde(t):t,n=qde(r);if(0===rde(r)&&e.length>0)throw new Cke;if(rde(t)&&rde(t)<32)throw new Mke({data:"string"==typeof t?t:dde(t),params:e,size:rde(t)});let i=0;const o=[];for(let t=0;t!e)),i=n?[]:{};let o=0;if(PSe(t)){const a=r+ASe(e.readBytes(SSe));for(let r=0;r48?wSe(i,{signed:r}):ASe(i,{signed:r}),32]}(e,t);if("string"===t.type)return function(e,{staticPosition:t}){const r=ASe(e.readBytes(32)),n=t+r;e.setPosition(n);const i=ASe(e.readBytes(32));if(0===i)return e.setPosition(t+32),["",32];const o=e.readBytes(i,32),a=function(e,t={}){let r=e;return void 0!==t.size&&(Ade(r,{size:t.size}),r=nde(r,{dir:"right"})),(new TextDecoder).decode(r)}(nde(o));return e.setPosition(t+32),[a,32]}(e,{staticPosition:r});throw new Vke(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const kSe=32,SSe=32;function PSe(e){const{type:t}=e;if("string"===t)return!0;if("bytes"===t)return!0;if(t.endsWith("[]"))return!0;if("tuple"===t)return e.components?.some(PSe);const r=iSe(e.type);return!(!r||!PSe({...e,type:r[1]}))}function ISe(e){const{abi:t,data:r}=e,n=Phe(r,0,4);if("0x"===n)throw new Cke;const i=[...t||[],ySe,vSe].find((e=>"error"===e.type&&n===oSe(Pke(e))));if(!i)throw new Fke(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:i,args:"inputs"in i&&i.inputs&&i.inputs.length>0?xSe(i.inputs,Phe(r,4)):void 0,errorName:i.name}}const TSe=(e,t,r)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),r);function OSe({abiItem:e,args:t,includeFunctionName:r=!0,includeName:n=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${r?e.name:""}(${e.inputs.map(((e,r)=>`${n&&e.name?`${e.name}: `:""}${"object"==typeof t[r]?TSe(t[r]):t[r]}`)).join(", ")})`}class MSe extends Zfe{constructor({address:e}){super(`State for account "${e}" is set multiple times.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountStateConflictError"})}}class CSe extends Zfe{constructor(){super("state and stateDiff are set on the same account."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"StateAssignmentConflictError"})}}function BSe(e){return e.reduce(((e,{slot:t,value:r})=>`${e} ${t}: ${r}\n`),"")}class NSe extends Zfe{constructor(e,{account:t,docsPath:r,chain:n,data:i,gas:o,gasPrice:a,maxFeePerGas:s,maxPriorityFeePerGas:c,nonce:u,to:l,value:f,stateOverride:d}){const h=t?pSe(t):void 0;let p=Yde({from:h?.address,to:l,value:void 0!==f&&`${Jde(f)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:o,gasPrice:void 0!==a&&`${Zde(a)} gwei`,maxFeePerGas:void 0!==s&&`${Zde(s)} gwei`,maxPriorityFeePerGas:void 0!==c&&`${Zde(c)} gwei`,nonce:u});d&&(p+=`\n${function(e){return e.reduce(((e,{address:t,...r})=>{let n=`${e} ${t}:\n`;return r.nonce&&(n+=` nonce: ${r.nonce}\n`),r.balance&&(n+=` balance: ${r.balance}\n`),r.code&&(n+=` code: ${r.code}\n`),r.state&&(n+=" state:\n",n+=BSe(r.state)),r.stateDiff&&(n+=" stateDiff:\n",n+=BSe(r.stateDiff)),n})," State Override:\n").slice(0,-1)}(d)}`),super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Raw Call Arguments:",p].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CallExecutionError"}),this.cause=e}}class RSe extends Zfe{constructor(e,{abi:t,args:r,contractAddress:n,docsPath:i,functionName:o,sender:a}){const s=aSe({abi:t,args:r,name:o}),c=s?OSe({abiItem:s,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=Yde({address:n&&n,function:s?Pke(s,{includeName:!0}):void 0,args:c&&"()"!==c&&`${[...Array(o?.length??0).keys()].map((()=>" ")).join("")}${c}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:i,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Contract Call:",u].filter(Boolean)}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionExecutionError"}),this.abi=t,this.args=r,this.cause=e,this.contractAddress=n,this.functionName=o,this.sender=a}}class FSe extends Zfe{constructor({abi:e,data:t,functionName:r,message:n}){let i,o,a,s,c;if(t&&"0x"!==t)try{o=ISe({abi:e,data:t});const{abiItem:r,errorName:n,args:i}=o;if("Error"===n)s=i[0];else if("Panic"===n){const[e]=i;s=gSe[e]}else{const e=r?Pke(r,{includeName:!0}):void 0,t=r&&i?OSe({abiItem:r,args:i,includeFunctionName:!1,includeName:!1}):void 0;a=[e?`Error: ${e}`:"",t&&"()"!==t?` ${[...Array(n?.length??0).keys()].map((()=>" ")).join("")}${t}`:""]}}catch(e){i=e}else n&&(s=n);i instanceof Fke&&(c=i.signature,a=[`Unable to decode signature "${c}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${c}.`]),super(s&&"execution reverted"!==s||c?[`The contract function "${r}" reverted with the following ${c?"signature":"reason"}:`,s||c].join("\n"):`The contract function "${r}" reverted.`,{cause:i,metaMessages:a}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.reason=s,this.signature=c}}class LSe extends Zfe{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionZeroDataError"})}}class jSe extends Zfe{constructor({factory:e}){super("Deployment for counterfactual contract call failed"+(e?` for factory "${e}".`:""),{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CounterfactualDeploymentFailedError"})}}class USe extends Zfe{constructor({data:e,message:t}){super(t||""),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RawContractError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}class DSe extends Zfe{constructor({body:e,cause:t,details:r,headers:n,status:i,url:o}){super("HTTP request failed.",{cause:t,details:r,metaMessages:[i&&`Status: ${i}`,`URL: ${o}`,e&&`Request body: ${TSe(e)}`].filter(Boolean)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=n,this.status=i,this.url=o}}class zSe extends Zfe{constructor({body:e,error:t,url:r}){super("RPC Request failed.",{cause:t,details:t.message,metaMessages:[`URL: ${r}`,`Request body: ${TSe(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code}}class $Se extends Zfe{constructor({body:e,url:t}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${t}`,`Request body: ${TSe(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TimeoutError"})}}class HSe extends Zfe{constructor(e,{code:t,docsPath:r,metaMessages:n,shortMessage:i}){super(i,{cause:e,docsPath:r,metaMessages:n||e?.metaMessages}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.code=e instanceof zSe?e.code:t??-1}}class GSe extends HSe{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderRpcError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t.data}}class qSe extends HSe{constructor(e){super(e,{code:qSe.code,shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ParseRpcError"})}}Object.defineProperty(qSe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class KSe extends HSe{constructor(e){super(e,{code:KSe.code,shortMessage:"JSON is not a valid request object."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidRequestRpcError"})}}Object.defineProperty(KSe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class VSe extends HSe{constructor(e){super(e,{code:VSe.code,shortMessage:"The method does not exist / is not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotFoundRpcError"})}}Object.defineProperty(VSe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class WSe extends HSe{constructor(e){super(e,{code:WSe.code,shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join("\n")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParamsRpcError"})}}Object.defineProperty(WSe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class JSe extends HSe{constructor(e){super(e,{code:JSe.code,shortMessage:"An internal error was received."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InternalRpcError"})}}Object.defineProperty(JSe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class ZSe extends HSe{constructor(e){super(e,{code:ZSe.code,shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join("\n")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidInputRpcError"})}}Object.defineProperty(ZSe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class YSe extends HSe{constructor(e){super(e,{code:YSe.code,shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(YSe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class XSe extends HSe{constructor(e){super(e,{code:XSe.code,shortMessage:"Requested resource not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceUnavailableRpcError"})}}Object.defineProperty(XSe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class QSe extends HSe{constructor(e){super(e,{code:QSe.code,shortMessage:"Transaction creation failed."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionRejectedRpcError"})}}Object.defineProperty(QSe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class ePe extends HSe{constructor(e){super(e,{code:ePe.code,shortMessage:"Method is not implemented."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotSupportedRpcError"})}}Object.defineProperty(ePe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class tPe extends HSe{constructor(e){super(e,{code:tPe.code,shortMessage:"Request exceeds defined limit."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"LimitExceededRpcError"})}}Object.defineProperty(tPe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class rPe extends HSe{constructor(e){super(e,{code:rPe.code,shortMessage:"Version of JSON-RPC protocol is not supported."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"JsonRpcVersionUnsupportedError"})}}Object.defineProperty(rPe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class nPe extends GSe{constructor(e){super(e,{code:nPe.code,shortMessage:"User rejected the request."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UserRejectedRequestError"})}}Object.defineProperty(nPe,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class iPe extends GSe{constructor(e){super(e,{code:iPe.code,shortMessage:"The requested method and/or account has not been authorized by the user."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnauthorizedProviderError"})}}Object.defineProperty(iPe,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class oPe extends GSe{constructor(e){super(e,{code:oPe.code,shortMessage:"The Provider does not support the requested method."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedProviderMethodError"})}}Object.defineProperty(oPe,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class aPe extends GSe{constructor(e){super(e,{code:aPe.code,shortMessage:"The Provider is disconnected from all chains."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderDisconnectedError"})}}Object.defineProperty(aPe,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class sPe extends GSe{constructor(e){super(e,{code:sPe.code,shortMessage:"The Provider is not connected to the requested chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDisconnectedError"})}}Object.defineProperty(sPe,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class cPe extends GSe{constructor(e){super(e,{code:cPe.code,shortMessage:"An error occurred when attempting to switch chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainError"})}}Object.defineProperty(cPe,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class uPe extends HSe{constructor(e){super(e,{shortMessage:"An unknown RPC error occurred."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownRpcError"})}}const lPe=3;function fPe(e,{abi:t,address:r,args:n,docsPath:i,functionName:o,sender:a}){const{code:s,data:c,message:u,shortMessage:l}=e instanceof USe?e:e instanceof Zfe?e.walk((e=>"data"in e))||e.walk():{},f=e instanceof Cke?new LSe({functionName:o}):[lPe,JSe.code].includes(s)&&(c||u||l)?new FSe({abi:t,data:"object"==typeof c?c.data:c,functionName:o,message:l??u}):e;return new RSe(f,{abi:t,args:n,contractAddress:r,docsPath:i,functionName:o,sender:a})}class dPe extends Zfe{constructor(e,{account:t,docsPath:r,chain:n,data:i,gas:o,gasPrice:a,maxFeePerGas:s,maxPriorityFeePerGas:c,nonce:u,to:l,value:f}){const d=Yde({from:t?.address,to:l,value:void 0!==f&&`${Jde(f)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:o,gasPrice:void 0!==a&&`${Zde(a)} gwei`,maxFeePerGas:void 0!==s&&`${Zde(s)} gwei`,maxPriorityFeePerGas:void 0!==c&&`${Zde(c)} gwei`,nonce:u});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",d].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EstimateGasExecutionError"}),this.cause=e}}function hPe(e,t){const r=(e.details||"").toLowerCase(),n=e instanceof Zfe?e.walk((e=>e.code===mhe.code)):e;return n instanceof Zfe?new mhe({cause:e,message:n.details}):mhe.nodeMessage.test(r)?new mhe({cause:e,message:e.details}):bhe.nodeMessage.test(r)?new bhe({cause:e,maxFeePerGas:t?.maxFeePerGas}):ghe.nodeMessage.test(r)?new ghe({cause:e,maxFeePerGas:t?.maxFeePerGas}):yhe.nodeMessage.test(r)?new yhe({cause:e,nonce:t?.nonce}):vhe.nodeMessage.test(r)?new vhe({cause:e,nonce:t?.nonce}):whe.nodeMessage.test(r)?new whe({cause:e,nonce:t?.nonce}):Ehe.nodeMessage.test(r)?new Ehe({cause:e}):Ahe.nodeMessage.test(r)?new Ahe({cause:e,gas:t?.gas}):xhe.nodeMessage.test(r)?new xhe({cause:e,gas:t?.gas}):_he.nodeMessage.test(r)?new _he({cause:e}):khe.nodeMessage.test(r)?new khe({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new She({cause:e})}function pPe(e,{format:t}){if(!t)return{};const r={};return function t(n){const i=Object.keys(n);for(const o of i)o in e&&(r[o]=e[o]),n[o]&&"object"==typeof n[o]&&!Array.isArray(n[o])&&t(n[o])}(t(e||{})),r}function mPe(e){if(e&&0!==e.length)return e.reduce(((e,{slot:t,value:r})=>{if(66!==t.length)throw new ade({size:t.length,targetSize:66,type:"hex"});if(66!==r.length)throw new ade({size:r.length,targetSize:66,type:"hex"});return e[t]=r,e}),{})}function bPe(e){const{balance:t,nonce:r,state:n,stateDiff:i,code:o}=e,a={};if(void 0!==o&&(a.code=o),void 0!==t&&(a.balance=hde(t)),void 0!==r&&(a.nonce=hde(r)),void 0!==n&&(a.state=mPe(n)),void 0!==i){if(a.state)throw new CSe;a.stateDiff=mPe(i)}return a}function gPe(e){if(!e)return;const t={};for(const{address:r,...n}of e){if(!jde(r,{strict:!1}))throw new Mde({address:r});if(t[r])throw new MSe({address:r});t[r]=bPe(n)}return t}function yPe(e){const{account:t,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:o}=e,a=t?pSe(t):void 0;if(a&&!jde(a.address))throw new Mde({address:a.address});if(o&&!jde(o))throw new Mde({address:o});if(void 0!==r&&(void 0!==n||void 0!==i))throw new Xde;if(n&&n>2n**256n-1n)throw new bhe({maxFeePerGas:n});if(i&&n&&i>n)throw new khe({maxFeePerGas:n,maxPriorityFeePerGas:i})}class vPe extends Zfe{constructor(){super("`baseFeeMultiplier` must be greater than 1."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseFeeScalarError"})}}class wPe extends Zfe{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}}class EPe extends Zfe{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Zde(e)} gwei).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MaxFeePerGasTooLowError"})}}class APe extends Zfe{constructor({blockHash:e,blockNumber:t}){let r="Block";e&&(r=`Block at hash "${e}"`),t&&(r=`Block at number "${t}"`),super(`${r} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlockNotFoundError"})}}async function xPe(e,{blockHash:t,blockNumber:r,blockTag:n,includeTransactions:i}={}){const o=n??"latest",a=i??!1,s=void 0!==r?hde(r):void 0;let c=null;if(c=t?await e.request({method:"eth_getBlockByHash",params:[t,a]},{dedupe:!0}):await e.request({method:"eth_getBlockByNumber",params:[s||o,a]},{dedupe:Boolean(s)}),!c)throw new APe({blockHash:t,blockNumber:r});return(e.chain?.formatters?.block?.format||Pde)(c)}async function _Pe(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function kPe(e,t){const{block:r,chain:n=e.chain,request:i}=t||{};if("function"==typeof n?.fees?.defaultPriorityFee){const t=r||await Ske(e,xPe,"getBlock")({});return n.fees.defaultPriorityFee({block:t,client:e,request:i})}if(void 0!==n?.fees?.defaultPriorityFee)return n?.fees?.defaultPriorityFee;try{return xde(await e.request({method:"eth_maxPriorityFeePerGas"}))}catch{const[t,n]=await Promise.all([r?Promise.resolve(r):Ske(e,xPe,"getBlock")({}),Ske(e,_Pe,"getGasPrice")({})]);if("bigint"!=typeof t.baseFeePerGas)throw new wPe;const i=n-t.baseFeePerGas;return i<0n?0n:i}}async function SPe(e,t){const{block:r,chain:n=e.chain,request:i,type:o="eip1559"}=t||{},a=await(async()=>"function"==typeof n?.fees?.baseFeeMultiplier?n.fees.baseFeeMultiplier({block:r,client:e,request:i}):n?.fees?.baseFeeMultiplier??1.2)();if(a<1)throw new vPe;const s=10**(a.toString().split(".")[1]?.length??0),c=e=>e*BigInt(Math.ceil(a*s))/BigInt(s),u=r||await Ske(e,xPe,"getBlock")({});if("function"==typeof n?.fees?.estimateFeesPerGas){const t=await n.fees.estimateFeesPerGas({block:r,client:e,multiply:c,request:i,type:o});if(null!==t)return t}if("eip1559"===o){if("bigint"!=typeof u.baseFeePerGas)throw new wPe;const t="bigint"==typeof i?.maxPriorityFeePerGas?i.maxPriorityFeePerGas:await kPe(e,{block:u,chain:n,request:i}),r=c(u.baseFeePerGas);return{maxFeePerGas:i?.maxFeePerGas??r+t,maxPriorityFeePerGas:t}}return{gasPrice:i?.gasPrice??c(await Ske(e,_Pe,"getGasPrice")({}))}}async function PPe(e,{address:t,blockTag:r="latest",blockNumber:n}){return _de(await e.request({method:"eth_getTransactionCount",params:[t,n?hde(n):r]},{dedupe:Boolean(n)}))}async function IPe(e){return _de(await e.request({method:"eth_chainId"},{dedupe:!0}))}const TPe=["blobVersionedHashes","chainId","fees","gas","nonce","type"];async function OPe(e,t){const{account:r=e.account,blobs:n,chain:i,gas:o,kzg:a,nonce:s,parameters:c=TPe,type:u}=t,l=r?pSe(r):void 0,f={...t,...l?{from:l?.address}:{}};let d,h;async function p(){return d||(d=await Ske(e,xPe,"getBlock")({blockTag:"latest"}),d)}async function m(){if(h)return h;if(i)return i.id;if(void 0!==t.chainId)return t.chainId;const r=await Ske(e,IPe,"getChainId")({});return h=r,h}if((c.includes("blobVersionedHashes")||c.includes("sidecars"))&&n&&a){const e=nhe({blobs:n,kzg:a});if(c.includes("blobVersionedHashes")){const t=function(e){const{commitments:t,version:r}=e,n=e.to??("string"==typeof t[0]?"hex":"bytes"),i=[];for(const e of t)i.push(ohe({commitment:e,to:n,version:r}));return i}({commitments:e,to:"hex"});f.blobVersionedHashes=t}if(c.includes("sidecars")){const t=dhe({blobs:n,commitments:e,proofs:ihe({blobs:n,commitments:e,kzg:a}),to:"hex"});f.sidecars=t}}if(c.includes("chainId")&&(f.chainId=await m()),c.includes("nonce")&&void 0===s&&l)if(l.nonceManager){const t=await m();f.nonce=await l.nonceManager.consume({address:l.address,chainId:t,client:e})}else f.nonce=await Ske(e,PPe,"getTransactionCount")({address:l.address,blockTag:"pending"});if((c.includes("fees")||c.includes("type"))&&void 0===u)try{f.type=function(e){if(e.type)return e.type;if(void 0!==e.blobs||void 0!==e.blobVersionedHashes||void 0!==e.maxFeePerBlobGas||void 0!==e.sidecars)return"eip4844";if(void 0!==e.maxFeePerGas||void 0!==e.maxPriorityFeePerGas)return"eip1559";if(void 0!==e.gasPrice)return void 0!==e.accessList?"eip2930":"legacy";throw new Qde({transaction:e})}(f)}catch{const e=await p();f.type="bigint"==typeof e?.baseFeePerGas?"eip1559":"legacy"}if(c.includes("fees"))if("legacy"!==f.type&&"eip2930"!==f.type){if(void 0===f.maxFeePerGas||void 0===f.maxPriorityFeePerGas){const r=await p(),{maxFeePerGas:n,maxPriorityFeePerGas:o}=await SPe(e,{block:r,chain:i,request:f});if(void 0===t.maxPriorityFeePerGas&&t.maxFeePerGas&&t.maxFeePerGas{const t=hPe(e,r);return t instanceof She?e:t})();return new dPe(n,{docsPath:t,...r})}(r,{...t,account:n,chain:e.chain})}}const CPe="/docs/contract/decodeEventLog";function BPe(e){const{abi:t,data:r,strict:n,topics:i}=e,o=n??!0,[a,...s]=i;if(!a)throw new Lke({docsPath:CPe});const c=t.find((e=>"event"===e.type&&a===eSe(Pke(e))));if(!c||!("name"in c)||"event"!==c.type)throw new jke(a,{docsPath:CPe});const{name:u,inputs:l}=c,f=l?.some((e=>!("name"in e&&e.name)));let d=f?[]:{};const h=l.filter((e=>"indexed"in e&&e.indexed));for(let e=0;e!("indexed"in e&&e.indexed)));if(p.length>0)if(r&&"0x"!==r)try{const e=xSe(p,r);if(e)if(f)d=[...d,...e];else for(let t=0;t0?d:void 0}}function NPe({param:e,value:t}){if("string"===e.type||"bytes"===e.type||"tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/))return t;return(xSe([e],t)||[])[0]}function RPe({abi:e,eventName:t,logs:r,strict:n=!0}){return r.map((r=>{try{const i=BPe({...r,abi:e,strict:n});return t&&!t.includes(i.eventName)?null:{...i,...r}}catch(e){let t,i;if(e instanceof jke)return null;if(e instanceof Gke||e instanceof qke){if(n)return null;t=e.abiItem.name,i=e.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}return{...r,args:i?[]:{},eventName:t}}})).filter(Boolean)}async function FPe(e,{address:t,blockHash:r,fromBlock:n,toBlock:i,event:o,events:a,args:s,strict:c}={}){const u=c??!1,l=a??(o?[o]:void 0);let f,d=[];if(l){const e=l.flatMap((e=>lSe({abi:[e],eventName:e.name,args:s})));d=[e],o&&(d=d[0])}f=r?await e.request({method:"eth_getLogs",params:[{address:t,topics:d,blockHash:r}]}):await e.request({method:"eth_getLogs",params:[{address:t,topics:d,fromBlock:"bigint"==typeof n?hde(n):n,toBlock:"bigint"==typeof i?hde(i):i}]});const h=f.map((e=>Ide(e)));return l?RPe({abi:l,logs:h,strict:u}):h}async function LPe(e,t){const{abi:r,address:n,args:i,blockHash:o,eventName:a,fromBlock:s,toBlock:c,strict:u}=t,l=a?aSe({abi:r,name:a}):void 0,f=l?void 0:r.filter((e=>"event"===e.type));return Ske(e,FPe,"getLogs")({address:n,args:i,blockHash:o,event:l,events:f,fromBlock:s,toBlock:c,strict:u})}const jPe="/docs/contract/decodeFunctionResult";function UPe(e){const{abi:t,args:r,functionName:n,data:i}=e;let o=t[0];if(n){const e=aSe({abi:t,args:r,name:n});if(!e)throw new Dke(n,{docsPath:jPe});o=e}if("function"!==o.type)throw new Dke(void 0,{docsPath:jPe});if(!o.outputs)throw new zke(o.name,{docsPath:jPe});const a=xSe(o.outputs,i);return a&&a.length>1?a:a&&1===a.length?a[0]:void 0}const DPe=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],zPe=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],$Pe=[...zPe,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],HPe=[...zPe,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],GPe=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],qPe=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],KPe=[{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"}],VPe="0x82ad56cb",WPe="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",JPe="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",ZPe="0x60806040523480156200001157600080fd5b50604051620007003803806200070083398101604081905262000034916200056f565b6000620000438484846200004f565b9050806000526001601ff35b600080846001600160a01b0316803b806020016040519081016040528181526000908060200190933c90507f6492649264926492649264926492649264926492649264926492649264926492620000a68462000451565b036200021f57600060608085806020019051810190620000c79190620005ce565b8651929550909350915060000362000192576000836001600160a01b031683604051620000f5919062000643565b6000604051808303816000865af19150503d806000811462000134576040519150601f19603f3d011682016040523d82523d6000602084013e62000139565b606091505b5050905080620001905760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b505b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90620001c4908b90869060040162000661565b602060405180830381865afa158015620001e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020891906200069d565b6001600160e01b031916149450505050506200044a565b805115620002b157604051630b135d3f60e11b808252906001600160a01b03871690631626ba7e9062000259908890889060040162000661565b602060405180830381865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d91906200069d565b6001600160e01b031916149150506200044a565b8251604114620003195760405162461bcd60e51b815260206004820152603a6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e677468000000000000606482015260840162000187565b620003236200046b565b506020830151604080850151855186939260009185919081106200034b576200034b620006c9565b016020015160f81c9050601b81148015906200036b57508060ff16601c14155b15620003cf5760405162461bcd60e51b815260206004820152603b6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c75650000000000606482015260840162000187565b6040805160008152602081018083528a905260ff83169181019190915260608101849052608081018390526001600160a01b038a169060019060a0016020604051602081039080840390855afa1580156200042e573d6000803e3d6000fd5b505050602060405103516001600160a01b031614955050505050505b9392505050565b60006020825110156200046357600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b03811681146200049f57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004d5578181015183820152602001620004bb565b50506000910152565b600082601f830112620004f057600080fd5b81516001600160401b03808211156200050d576200050d620004a2565b604051601f8301601f19908116603f01168101908282118183101715620005385762000538620004a2565b816040528381528660208588010111156200055257600080fd5b62000565846020830160208901620004b8565b9695505050505050565b6000806000606084860312156200058557600080fd5b8351620005928162000489565b6020850151604086015191945092506001600160401b03811115620005b657600080fd5b620005c486828701620004de565b9150509250925092565b600080600060608486031215620005e457600080fd5b8351620005f18162000489565b60208501519093506001600160401b03808211156200060f57600080fd5b6200061d87838801620004de565b935060408601519150808211156200063457600080fd5b50620005c486828701620004de565b6000825162000657818460208701620004b8565b9190910192915050565b828152604060208201526000825180604084015262000688816060850160208701620004b8565b601f01601f1916919091016060019392505050565b600060208284031215620006b057600080fd5b81516001600160e01b0319811681146200044a57600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",YPe="/docs/contract/encodeDeployData";function XPe(e){const{abi:t,args:r,bytecode:n}=e;if(!r||0===r.length)return n;const i=t.find((e=>"type"in e&&"constructor"===e.type));if(!i)throw new Tke({docsPath:YPe});if(!("inputs"in i))throw new Oke({docsPath:YPe});if(!i.inputs||0===i.inputs.length)throw new Oke({docsPath:YPe});return Dde([n,tSe(i.inputs,r)])}const QPe=new Map;function eIe({fn:e,id:t,shouldSplitBatch:r,wait:n=0,sort:i}){const o=async()=>{const t=s();a();const r=t.map((({args:e})=>e));0!==r.length&&e(r).then((e=>{i&&Array.isArray(e)&&e.sort(i);for(let r=0;r{for(let r=0;rQPe.delete(t),s=()=>QPe.get(t)||[],c=e=>QPe.set(t,[...s(),e]);return{flush:a,async schedule(e){const t={},i=new Promise(((e,r)=>{t.resolve=e,t.reject=r})),a=r?.([...s().map((({args:e})=>e)),e]);a&&o();return s().length>0?(c({args:e,pendingPromise:t}),i):(c({args:e,pendingPromise:t}),setTimeout(o,n),i)}}}async function tIe(e,t){const{account:r=e.account,batch:n=Boolean(e.batch?.multicall),blockNumber:i,blockTag:o="latest",accessList:a,blobs:s,code:c,data:u,factory:l,factoryData:f,gas:d,gasPrice:h,maxFeePerBlobGas:p,maxFeePerGas:m,maxPriorityFeePerGas:b,nonce:g,to:y,value:v,stateOverride:w,...E}=t,A=r?pSe(r):void 0;if(c&&(l||f))throw new Zfe("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(c&&y)throw new Zfe("Cannot provide both `code` & `to` as parameters.");const x=c&&u,_=l&&f&&y&&u,k=x||_,S=x?function(e){const{code:t,data:r}=e;return XPe({abi:kke(["constructor(bytes, bytes)"]),bytecode:WPe,args:[t,r]})}({code:c,data:u}):_?function(e){const{data:t,factory:r,factoryData:n,to:i}=e;return XPe({abi:kke(["constructor(address, bytes, address, bytes)"]),bytecode:JPe,args:[i,t,r,n]})}({data:u,factory:l,factoryData:f,to:y}):u;try{yPe(t);const r=(i?hde(i):void 0)||o,c=gPe(w),u=e.chain?.formatters?.transactionRequest?.format,l=(u||Bhe)({...pPe(E,{format:u}),from:A?.address,accessList:a,blobs:s,data:S,gas:d,gasPrice:h,maxFeePerBlobGas:p,maxFeePerGas:m,maxPriorityFeePerGas:b,nonce:g,to:k?void 0:y,value:v});if(n&&function({request:e}){const{data:t,to:r,...n}=e;return!!t&&(!t.startsWith(VPe)&&(!!r&&!(Object.values(n).filter((e=>void 0!==e)).length>0)))}({request:l})&&!c)try{return await async function(e,t){const{batchSize:r=1024,wait:n=0}="object"==typeof e.batch?.multicall?e.batch.multicall:{},{blockNumber:i,blockTag:o="latest",data:a,multicallAddress:s,to:c}=t;let u=s;if(!u){if(!e.chain)throw new phe;u=Nhe({blockNumber:i,chain:e.chain,contract:"multicall3"})}const l=i?hde(i):void 0,f=l||o,{schedule:d}=eIe({id:`${e.uid}.${f}`,wait:n,shouldSplitBatch(e){const t=e.reduce(((e,{data:t})=>e+(t.length-2)),0);return t>2*r},fn:async t=>{const r=t.map((e=>({allowFailure:!0,callData:e.data,target:e.to}))),n=bSe({abi:DPe,args:[r],functionName:"aggregate3"}),i=await e.request({method:"eth_call",params:[{data:n,to:u},f]});return UPe({abi:DPe,args:[r],functionName:"aggregate3",data:i||"0x"})}}),[{returnData:h,success:p}]=await d({data:a,to:c});if(!p)throw new USe({data:h});return"0x"===h?{data:void 0}:{data:h}}(e,{...l,blockNumber:i,blockTag:o})}catch(e){if(!(e instanceof phe||e instanceof hhe))throw e}const f=await e.request({method:"eth_call",params:c?[l,r,c]:[l,r]});return"0x"===f?{data:void 0}:{data:f}}catch(r){const n=function(e){if(!(e instanceof Zfe))return;const t=e.walk();return"object"==typeof t?.data?t.data?.data:t.data}(r),{offchainLookup:i,offchainLookupSignature:o}=await Promise.resolve().then((function(){return aTe}));if(!1!==e.ccipRead&&n?.slice(0,10)===o&&y)return{data:await i(e,{data:n,to:y})};if(k&&"0x101bb98d"===n?.slice(0,10))throw new jSe({factory:l});throw function(e,{docsPath:t,...r}){const n=(()=>{const t=hPe(e,r);return t instanceof She?e:t})();return new NSe(n,{docsPath:t,...r})}(r,{...t,account:A,chain:e.chain})}}async function rIe(e,t){const{abi:r,address:n,args:i,functionName:o,...a}=t,s=bSe({abi:r,args:i,functionName:o});try{const{data:t}=await Ske(e,tIe,"call")({...a,data:s,to:n});return UPe({abi:r,args:i,functionName:o,data:t||"0x"})}catch(e){throw fPe(e,{abi:r,address:n,args:i,docsPath:"/docs/contract/readContract",functionName:o})}}const nIe=new Map,iIe=new Map;let oIe=0;function aIe(e,t,r){const n=++oIe,i=()=>nIe.get(e)||[],o=()=>{const t=iIe.get(e);1===i().length&&t&&t(),(()=>{const t=i();nIe.set(e,t.filter((e=>e.id!==n)))})()},a=i();if(nIe.set(e,[...a,{id:n,fns:t}]),a&&a.length>0)return o;const s={};for(const e in t)s[e]=(...t)=>{const r=i();if(0!==r.length)for(const n of r)n.fns[e]?.(...t)};const c=r(s);return"function"==typeof c&&iIe.set(e,c),o}async function sIe(e){return new Promise((t=>setTimeout(t,e)))}function cIe(e,{emitOnBegin:t,initialWaitTime:r,interval:n}){let i=!0;const o=()=>i=!1;return(async()=>{let a;t&&(a=await e({unpoll:o}));const s=await(r?.(a))??n;await sIe(s);const c=async()=>{i&&(await e({unpoll:o}),await sIe(n),c())};c()})(),o}const uIe=new Map,lIe=new Map;async function fIe(e,{cacheKey:t,cacheTime:r=Number.POSITIVE_INFINITY}){const n=function(e){const t=(e,t)=>({clear:()=>t.delete(e),get:()=>t.get(e),set:r=>t.set(e,r)}),r=t(e,uIe),n=t(e,lIe);return{clear:()=>{r.clear(),n.clear()},promise:r,response:n}}(t),i=n.response.get();if(i&&r>0){if((new Date).getTime()-i.created.getTime()`blockNumber.${e}`;async function hIe(e,{cacheTime:t=e.cacheTime}={}){const r=await fIe((()=>e.request({method:"eth_blockNumber"})),{cacheKey:dIe(e.uid),cacheTime:t});return BigInt(r)}async function pIe(e,{filter:t}){const r="strict"in t&&t.strict,n=await t.request({method:"eth_getFilterChanges",params:[t.id]});if("string"==typeof n[0])return n;const i=n.map((e=>Ide(e)));return"abi"in t&&t.abi?RPe({abi:t.abi,logs:i,strict:r}):i}async function mIe(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}class bIe extends Zfe{constructor({address:e}){super(`No EIP-712 domain found on contract "${e}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${e}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip712DomainNotFoundError"})}}const gIe=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}],yIe=256;let vIe,wIe=yIe;function EIe(e=11){if(!vIe||wIe+e>2*yIe){vIe="",wIe=0;for(let e=0;e!0}={}){return new Promise(((i,o)=>{const a=async({count:s=0}={})=>{try{const t=await e();i(t)}catch(e){if(s{const r="function"==typeof t?t({count:s,error:e}):t;r&&await sIe(r),a({count:s+1})})({error:e});o(e)}};a()}))}function _Ie(e,t={}){return async(r,n={})=>{const{dedupe:i=!1,retryDelay:o=150,retryCount:a=3,uid:s}={...t,...n};return function(e,{enabled:t=!0,id:r}){if(!t||!r)return e();if(AIe.get(r))return AIe.get(r);const n=e().finally((()=>AIe.delete(r)));return AIe.set(r,n),n}((()=>xIe((async()=>{try{return await e(r)}catch(e){const t=e;switch(t.code){case qSe.code:throw new qSe(t);case KSe.code:throw new KSe(t);case VSe.code:throw new VSe(t);case WSe.code:throw new WSe(t);case JSe.code:throw new JSe(t);case ZSe.code:throw new ZSe(t);case YSe.code:throw new YSe(t);case XSe.code:throw new XSe(t);case QSe.code:throw new QSe(t);case ePe.code:throw new ePe(t);case tPe.code:throw new tPe(t);case rPe.code:throw new rPe(t);case nPe.code:throw new nPe(t);case iPe.code:throw new iPe(t);case oPe.code:throw new oPe(t);case aPe.code:throw new aPe(t);case sPe.code:throw new sPe(t);case cPe.code:throw new cPe(t);case 5e3:throw new nPe(t);default:if(e instanceof Zfe)throw e;throw new uPe(t)}}}),{delay:({count:e,error:t})=>{if(t&&t instanceof DSe){const e=t?.headers?.get("Retry-After");if(e?.match(/\d/))return 1e3*Number.parseInt(e)}return(1<function(e){if("code"in e&&"number"==typeof e.code)return-1===e.code||(e.code===tPe.code||e.code===JSe.code);if(e instanceof DSe&&e.status)return 403===e.status||(408===e.status||(413===e.status||(429===e.status||(500===e.status||(502===e.status||(503===e.status||504===e.status))))));return!0}(e)})),{enabled:i,id:i?Bde(mde(`${s}.${TSe(r)}`)):void 0})}}class kIe extends Zfe{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro"})}}function SIe(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const PIe=SIe();function IIe(e,t={}){return{async request(r){const{body:n,onRequest:i=t.onRequest,onResponse:o=t.onResponse,timeout:a=t.timeout??1e4}=r,s={...t.fetchOptions??{},...r.fetchOptions??{}},{headers:c,method:u,signal:l}=s;try{const t=await function(e,{errorInstance:t=new Error("timed out"),timeout:r,signal:n}){return new Promise(((i,o)=>{(async()=>{let a;try{const s=new AbortController;r>0&&(a=setTimeout((()=>{n?s.abort():o(t)}),r)),i(await e({signal:s?.signal||null}))}catch(e){"AbortError"===e?.name&&o(t),o(e)}finally{clearTimeout(a)}})()}))}((async({signal:t})=>{const r={...s,body:Array.isArray(n)?TSe(n.map((e=>({jsonrpc:"2.0",id:e.id??PIe.take(),...e})))):TSe({jsonrpc:"2.0",id:n.id??PIe.take(),...n}),headers:{"Content-Type":"application/json",...c},method:u||"POST",signal:l||(a>0?t:null)},o=new Request(e,r);i&&await i(o);return await fetch(e,r)}),{errorInstance:new $Se({body:n,url:e}),timeout:a,signal:!0});let r;if(o&&await o(t),t.headers.get("Content-Type")?.startsWith("application/json")?r=await t.json():(r=await t.text(),r=JSON.parse(r||"{}")),!t.ok)throw new DSe({body:n,details:TSe(r.error)||t.statusText,headers:t.headers,status:t.status,url:e});return r}catch(t){if(t instanceof DSe)throw t;if(t instanceof $Se)throw t;throw new DSe({body:n,cause:t,url:e})}}}}function TIe(e,t={}){const{batch:r,fetchOptions:n,key:i="http",name:o="HTTP JSON-RPC",onFetchRequest:a,onFetchResponse:s,retryDelay:c}=t;return({chain:u,retryCount:l,timeout:f})=>{const{batchSize:d=1e3,wait:h=0}="object"==typeof r?r:{},p=t.retryCount??l,m=f??t.timeout??1e4,b=e||u?.rpcUrls.default.http[0];if(!b)throw new kIe;const g=IIe(b,{fetchOptions:n,onRequest:a,onResponse:s,timeout:m});return function({key:e,name:t,request:r,retryCount:n=3,retryDelay:i=150,timeout:o,type:a},s){return{config:{key:e,name:t,request:r,retryCount:n,retryDelay:i,timeout:o,type:a},request:_Ie(r,{retryCount:n,retryDelay:i,uid:EIe()}),value:s}}({key:i,name:o,async request({method:e,params:t}){const n={method:e,params:t},{schedule:i}=eIe({id:b,wait:h,shouldSplitBatch:e=>e.length>d,fn:e=>g.request({body:e}),sort:(e,t)=>e.id-t.id}),[{error:o,result:a}]=await(async e=>r?i(e):[await g.request({body:e})])(n);if(o)throw new zSe({body:n,error:o,url:b});return a},retryCount:p,retryDelay:c,timeout:m,type:"http"},{fetchOptions:n,url:b})}}function OIe(e,t){if(!(e instanceof Zfe))return!1;const r=e.walk((e=>e instanceof FSe));return r instanceof FSe&&("ResolverNotFound"===r.data?.errorName||("ResolverWildcardNotSupported"===r.data?.errorName||("ResolverNotContract"===r.data?.errorName||("ResolverError"===r.data?.errorName||("HttpError"===r.data?.errorName||(!!r.reason?.includes("Wildcard on non-extended resolvers is not supported")||"reverse"===t&&r.reason===gSe[50]))))))}function MIe(e){if(66!==e.length)return null;if(0!==e.indexOf("["))return null;if(65!==e.indexOf("]"))return null;const t=`0x${e.slice(1,65)}`;return tde(t)?t:null}function CIe(e){let t=new Uint8Array(32).fill(0);if(!e)return dde(t);const r=e.split(".");for(let e=r.length-1;e>=0;e-=1){const n=MIe(r[e]),i=n?gde(n):Bde(Ede(r[e]),"bytes");t=Bde(Ude([t,i]),"bytes")}return dde(t)}function BIe(e){return`[${e.slice(2)}]`}function NIe(e){const t=new Uint8Array(32).fill(0);return e?MIe(e)||Bde(Ede(e)):dde(t)}function RIe(e){const t=e.replace(/^\.|\.$/gm,"");if(0===t.length)return new Uint8Array(1);const r=new Uint8Array(Ede(t).byteLength+2);let n=0;const i=t.split(".");for(let e=0;e255&&(t=Ede(BIe(NIe(i[e])))),r[n]=t.length,r.set(t,n+1),n+=t.length+1}return r.byteLength!==n+1?r.slice(0,n+1):r}class FIe extends Zfe{constructor({data:e}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidMetadataError"})}}class LIe extends Zfe{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidNftUriError"})}}class jIe extends Zfe{constructor({uri:e}){super(`Unable to resolve ENS avatar URI "${e}". The URI may be malformed, invalid, or does not respond with a valid image.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUriResolutionError"})}}class UIe extends Zfe{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUnsupportedNamespaceError"})}}const DIe=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,zIe=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,$Ie=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,HIe=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;function GIe(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function qIe({uri:e,gatewayUrls:t}){const r=$Ie.test(e);if(r)return{uri:e,isOnChain:!0,isEncoded:r};const n=GIe(t?.ipfs,"https://ipfs.io"),i=GIe(t?.arweave,"https://arweave.net"),o=e.match(DIe),{protocol:a,subpath:s,target:c,subtarget:u=""}=o?.groups||{},l="ipns:/"===a||"ipns/"===s,f="ipfs:/"===a||"ipfs/"===s||zIe.test(e);if(e.startsWith("http")&&!l&&!f){let r=e;return t?.arweave&&(r=e.replace(/https:\/\/arweave.net/g,t?.arweave)),{uri:r,isOnChain:!1,isEncoded:!1}}if((l||f)&&c)return{uri:`${n}/${l?"ipns":"ipfs"}/${c}${u}`,isOnChain:!1,isEncoded:!1};if("ar:/"===a&&c)return{uri:`${i}/${c}${u||""}`,isOnChain:!1,isEncoded:!1};let d=e.replace(HIe,"");if(d.startsWith("{const r=new Image;r.onload=()=>{t(!0)},r.onerror=()=>{t(!1)},r.src=e}))}}(r);if(i)return r;throw new jIe({uri:t})}async function WIe(e,{gatewayUrls:t,record:r}){return/eip155:/i.test(r)?async function(e,{gatewayUrls:t,record:r}){const n=function(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[r,n,i]=t.split("/"),[o,a]=r.split(":"),[s,c]=n.split(":");if(!o||"eip155"!==o.toLowerCase())throw new LIe({reason:"Only EIP-155 supported"});if(!a)throw new LIe({reason:"Chain ID not found"});if(!c)throw new LIe({reason:"Contract address not found"});if(!i)throw new LIe({reason:"Token ID not found"});if(!s)throw new LIe({reason:"ERC namespace not found"});return{chainID:Number.parseInt(a),namespace:s.toLowerCase(),contractAddress:c,tokenID:i}}(r),i=await async function(e,{nft:t}){if("erc721"===t.namespace)return rIe(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if("erc1155"===t.namespace)return rIe(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new UIe({namespace:t.namespace})}(e,{nft:n}),{uri:o,isOnChain:a,isEncoded:s}=qIe({uri:i,gatewayUrls:t});if(a&&(o.includes("data:application/json;base64,")||o.startsWith("{"))){const e=s?atob(o.replace("data:application/json;base64,","")):o;return VIe({uri:KIe(JSON.parse(e)),gatewayUrls:t})}let c=n.tokenID;"erc1155"===n.namespace&&(c=c.replace("0x","").padStart(64,"0"));return async function({gatewayUrls:e,uri:t}){try{const r=await fetch(t).then((e=>e.json()));return await VIe({gatewayUrls:e,uri:KIe(r)})}catch{throw new jIe({uri:t})}}({gatewayUrls:t,uri:o.replace(/(?:0x)?{id}/,c)})}(e,{gatewayUrls:t,record:r}):VIe({uri:r,gatewayUrls:t})}async function JIe(e,{blockNumber:t,blockTag:r,name:n,key:i,gatewayUrls:o,strict:a,universalResolverAddress:s}){let c=s;if(!c){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");c=Nhe({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{const a={address:c,abi:$Pe,functionName:"resolve",args:[lde(RIe(n)),bSe({abi:GPe,functionName:"text",args:[CIe(n),i]})],blockNumber:t,blockTag:r},s=Ske(e,rIe,"readContract"),u=o?await s({...a,args:[...a.args,o]}):await s(a);if("0x"===u[0])return null;const l=UPe({abi:GPe,functionName:"text",data:u[0]});return""===l?null:l}catch(e){if(a)throw e;if(OIe(e,"resolve"))return null;throw e}}async function ZIe(e,{address:t,args:r,event:n,events:i,fromBlock:o,strict:a,toBlock:s}={}){const c=i??(n?[n]:void 0),u=dSe(e,{method:"eth_newFilter"});let l=[];if(c){const e=c.flatMap((e=>lSe({abi:[e],eventName:e.name,args:r})));l=[e],n&&(l=l[0])}const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:"bigint"==typeof o?hde(o):o,toBlock:"bigint"==typeof s?hde(s):s,...l.length?{topics:l}:{}}]});return{abi:c,args:r,eventName:n?n.name:void 0,fromBlock:o,id:f,request:u(f),strict:Boolean(a),toBlock:s,type:"event"}}async function YIe(e){const t=dSe(e,{method:"eth_newPendingTransactionFilter"}),r=await e.request({method:"eth_newPendingTransactionFilter"});return{id:r,request:t(r),type:"transaction"}}async function XIe(e,{address:t,blockNumber:r,blockTag:n="latest"}){const i=void 0!==r?hde(r):void 0,o=await e.request({method:"eth_getCode",params:[t,i||n]},{dedupe:Boolean(i)});if("0x"!==o)return o}async function QIe(e,{blockCount:t,blockNumber:r,blockTag:n="latest",rewardPercentiles:i}){const o=r?hde(r):void 0;return function(e){return{baseFeePerGas:e.baseFeePerGas.map((e=>BigInt(e))),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:e.reward?.map((e=>e.map((e=>BigInt(e)))))}}(await e.request({method:"eth_feeHistory",params:[hde(t),o||n,i]},{dedupe:Boolean(o)}))}class eTe extends Zfe{constructor({callbackSelector:e,cause:t,data:r,extraData:n,sender:i,urls:o}){super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],t.metaMessages?.length?"":[],"Offchain Gateway Call:",o&&[" Gateway URL(s):",...o.map((e=>` ${e}`))],` Sender: ${i}`,` Data: ${r}`,` Callback selector: ${e}`,` Extra data: ${n}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}}class tTe extends Zfe{constructor({result:e,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${t}`,`Response: ${TSe(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}}class rTe extends Zfe{constructor({sender:e,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}}function nTe(e,t){if(!jde(e,{strict:!1}))throw new Mde({address:e});if(!jde(t,{strict:!1}))throw new Mde({address:t});return e.toLowerCase()===t.toLowerCase()}const iTe={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function oTe({data:e,sender:t,urls:r}){let n=new Error("An unknown error occurred.");for(let i=0;i{for(const r of e){const{name:e,type:n}=r,a=t[e],s=n.match(cTe);if(s&&("number"==typeof a||"bigint"==typeof a)){const[e,t,r]=s;hde(a,{signed:"int"===t,size:Number.parseInt(r)/8})}if("address"===n&&"string"==typeof a&&!jde(a))throw new Mde({address:a});const c=n.match(sTe);if(c){const[e,t]=c;if(t&&rde(a)!==Number.parseInt(t))throw new Hke({expectedSize:Number.parseInt(t),givenSize:rde(a)})}const u=i[n];u&&o(u,a)}};i.EIP712Domain&&t&&o(i.EIP712Domain,t);"EIP712Domain"!==n&&o(i[n],r)}({domain:t,message:r,primaryType:n,types:i});const o=["0x1901"];return t&&o.push(function({domain:e,types:t}){return lTe({data:e,primaryType:"EIP712Domain",types:t})}({domain:t,types:i})),"EIP712Domain"!==n&&o.push(lTe({data:r,primaryType:n,types:i})),Bde(Ude(o))}function lTe({data:e,primaryType:t,types:r}){return Bde(fTe({data:e,primaryType:t,types:r}))}function fTe({data:e,primaryType:t,types:r}){const n=[{type:"bytes32"}],i=[dTe({primaryType:t,types:r})];for(const o of r[t]){const[t,a]=pTe({types:r,name:o.name,type:o.type,value:e[o.name]});n.push(t),i.push(a)}return tSe(n,i)}function dTe({primaryType:e,types:t}){const r=lde(function({primaryType:e,types:t}){let r="";const n=hTe({primaryType:e,types:t});n.delete(e);const i=[e,...Array.from(n).sort()];for(const e of i)r+=`${e}(${t[e].map((({name:e,type:t})=>`${t} ${e}`)).join(",")})`;return r}({primaryType:e,types:t}));return Bde(r)}function hTe({primaryType:e,types:t},r=new Set){const n=e.match(/^\w*/u),i=n?.[0];if(r.has(i)||void 0===t[i])return r;r.add(i);for(const e of t[i])hTe({primaryType:e.type,types:t},r);return r}function pTe({types:e,name:t,type:r,value:n}){if(void 0!==e[r])return[{type:"bytes32"},Bde(fTe({data:n,primaryType:r,types:e}))];if("bytes"===r){return[{type:"bytes32"},Bde(n=`0x${(n.length%2?"0":"")+n.slice(2)}`)]}if("string"===r)return[{type:"bytes32"},Bde(lde(n))];if(r.lastIndexOf("]")===r.length-1){const i=r.slice(0,r.lastIndexOf("[")),o=n.map((r=>pTe({name:t,type:i,types:e,value:r})));return[{type:"bytes32"},Bde(tSe(o.map((([e])=>e)),o.map((([,e])=>e))))]}return[{type:r},n]}function mTe({domain:e}){return["string"==typeof e?.name&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},"number"==typeof e?.chainId&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}function bTe(e){if(0===e||1===e)return e;if(27===e)return 0;if(28===e)return 1;throw new Error("Invalid yParityOrV value")}async function gTe({hash:e,signature:t}){return r=await async function({hash:e,signature:t}){const r=tde(e)?e:lde(e),{secp256k1:n}=await Promise.resolve().then((function(){return MOe})),i=(()=>{if("object"==typeof t&&"r"in t&&"s"in t){const{r:e,s:r,v:i,yParity:o}=t,a=bTe(Number(o??i));return new n.Signature(xde(e),xde(r)).addRecoveryBit(a)}const e=tde(t)?t:lde(t),r=bTe(_de(`0x${e.slice(130)}`));return n.Signature.fromCompact(e.substring(2,130)).addRecoveryBit(r)})();return`0x${i.recoverPublicKey(r.substring(2)).toHex(!1)}`}({hash:e,signature:t}),Rde(`0x${Bde(`0x${r.substring(4)}`).substring(26)}`);var r}const yTe="Ethereum Signed Message:\n";function vTe(e,t){return Bde(function(e){const t="string"==typeof e?mde(e):"string"==typeof e.raw?e.raw:dde(e.raw);return Ude([mde(`${yTe}${rde(t)}`),t])}(e),t)}const wTe="0x6492649264926492649264926492649264926492649264926492649264926492";async function ETe(e,{address:t,blockNumber:r,blockTag:n,storageKeys:i}){const o=n??"latest",a=void 0!==r?hde(r):void 0;return function(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?_de(e.nonce):void 0,storageProof:e.storageProof?(t=e.storageProof,t.map((e=>({...e,value:BigInt(e.value)})))):void 0};var t}(await e.request({method:"eth_getProof",params:[t,i,a||o]}))}async function ATe(e,{blockHash:t,blockNumber:r,blockTag:n,hash:i,index:o}){const a=n||"latest",s=void 0!==r?hde(r):void 0;let c=null;if(i?c=await e.request({method:"eth_getTransactionByHash",params:[i]},{dedupe:!0}):t?c=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,hde(o)]},{dedupe:!0}):(s||a)&&(c=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[s||a,hde(o)]},{dedupe:Boolean(s)})),!c)throw new ehe({blockHash:t,blockNumber:r,blockTag:a,hash:i,index:o});return(e.chain?.formatters?.transaction?.format||Sde)(c)}async function xTe(e,{hash:t}){const r=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!r)throw new the({hash:t});return(e.chain?.formatters?.transactionReceipt?.format||Ode)(r)} /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const _Te=BigInt(0),kTe=BigInt(1),STe=BigInt(2);function PTe(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function ITe(e){if(!PTe(e))throw new Error("Uint8Array expected")}const TTe=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function OTe(e){ITe(e);let t="";for(let r=0;r=BTe._0&&e<=BTe._9?e-BTe._0:e>=BTe._A&&e<=BTe._F?e-(BTe._A-10):e>=BTe._a&&e<=BTe._f?e-(BTe._a-10):void 0}function RTe(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t(STe<new Uint8Array(e),qTe=e=>Uint8Array.from(e);function KTe(e,t,r){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let n=GTe(e),i=GTe(e),o=0;const a=()=>{n.fill(1),i.fill(0),o=0},s=(...e)=>r(i,n,...e),c=(e=GTe())=>{i=s(qTe([0]),e),n=s(),0!==e.length&&(i=s(qTe([1]),e),n=s())},u=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e{let r;for(a(),c(e);!(r=t(u()));)c();return a(),r}}const VTe={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||PTe(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function WTe(e,t,r={}){const n=(t,r,n)=>{const i=VTe[r];if("function"!=typeof i)throw new Error(`Invalid validator "${r}", expected function`);const o=e[t];if(!(n&&void 0===o||i(o,e)))throw new Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${r}`)};for(const[e,r]of Object.entries(t))n(e,r,!1);for(const[e,t]of Object.entries(r))n(e,t,!0);return e}var JTe=Object.freeze({__proto__:null,abytes:ITe,bitGet:function(e,t){return e>>BigInt(t)&kTe},bitLen:function(e){let t;for(t=0;e>_Te;e>>=kTe,t+=1);return t},bitMask:HTe,bitSet:function(e,t,r){return e|(r?kTe:_Te)<=ZTe?r:t+r}function iOe(e,t,r){if(r<=ZTe||t 0");if(r===YTe)return ZTe;let n=YTe;for(;t>ZTe;)t&YTe&&(n=n*e%r),e=e*e%r,t>>=YTe;return n}function oOe(e,t,r){let n=e;for(;t-- >ZTe;)n*=n,n%=r;return n}function aOe(e,t){if(e===ZTe||t<=ZTe)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=nOe(e,t),n=t,i=ZTe,o=YTe;for(;r!==ZTe;){const e=n%r,t=i-o*(n/r);n=r,r=e,i=o,o=t}if(n!==YTe)throw new Error("invert: does not exist");return nOe(i,t)}function sOe(e){if(e%eOe===QTe){const t=(e+YTe)/eOe;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}if(e%rOe===tOe){const t=(e-tOe)/rOe;return function(e,r){const n=e.mul(r,XTe),i=e.pow(n,t),o=e.mul(r,i),a=e.mul(e.mul(o,XTe),i),s=e.mul(o,e.sub(a,e.ONE));if(!e.eql(e.sqr(s),r))throw new Error("Cannot find square root");return s}}return function(e){const t=(e-YTe)/XTe;let r,n,i;for(r=e-YTe,n=0;r%XTe===ZTe;r/=XTe,n++);for(i=XTe;i(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});WTe(e,t)}(e.Fp),WTe(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...uOe(e.n,e.nBitLength),...e,p:e.Fp.ORDER})} /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const{bytesToNumberBE:mOe,hexToBytes:bOe}=JTe,gOe={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:t}=gOe;if(e.length<2||2!==e[0])throw new t("Invalid signature integer tag");const r=e[1],n=e.subarray(2,r+2);if(!r||n.length!==r)throw new t("Invalid signature integer: wrong length");if(128&n[0])throw new t("Invalid signature integer: negative");if(0===n[0]&&!(128&n[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:mOe(n),l:e.subarray(r+2)}},toSig(e){const{Err:t}=gOe,r="string"==typeof e?bOe(e):e;ITe(r);let n=r.length;if(n<2||48!=r[0])throw new t("Invalid signature tag");if(r[1]!==n-2)throw new t("Invalid signature: incorrect length");const{d:i,l:o}=gOe._parseInt(r.subarray(2)),{d:a,l:s}=gOe._parseInt(o);if(s.length)throw new t("Invalid signature: left bytes after parsing");return{r:i,s:a}},hexFromSig(e){const t=e=>8&Number.parseInt(e[0],16)?"00"+e:e,r=e=>{const t=e.toString(16);return 1&t.length?`0${t}`:t},n=t(r(e.s)),i=t(r(e.r)),o=n.length/2,a=i.length/2,s=r(o),c=r(a);return`30${r(a+o+4)}02${c}${i}02${s}${n}`}},yOe=BigInt(0),vOe=BigInt(1);BigInt(2);const wOe=BigInt(3);function EOe(e){const t=function(e){const t=pOe(e);WTe(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:i}=t;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:r}=t,n=t.toBytes||((e,t,n)=>{const i=t.toAffine();return zTe(Uint8Array.from([4]),r.toBytes(i.x),r.toBytes(i.y))}),i=t.fromBytes||(e=>{const t=e.subarray(1);return{x:r.fromBytes(t.subarray(0,r.BYTES)),y:r.fromBytes(t.subarray(r.BYTES,2*r.BYTES))}});function o(e){const{a:n,b:i}=t,o=r.sqr(e),a=r.mul(o,e);return r.add(r.add(a,r.mul(e,n)),i)}if(!r.eql(r.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function a(e){return"bigint"==typeof e&&yOer.eql(e,r.ZERO);return i(t)&&i(n)?f.ZERO:new f(t,n,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=r.invertBatch(e.map((e=>e.pz)));return e.map(((e,r)=>e.toAffine(t[r]))).map(f.fromAffine)}static fromHex(e){const t=f.fromAffine(i(DTe("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return f.BASE.multiply(c(e))}_setWindowSize(e){this._WINDOW_SIZE=e,u.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:e,y:n}=this.toAffine();if(!r.isValid(e)||!r.isValid(n))throw new Error("bad point: x or y not FE");const i=r.sqr(n),a=o(e);if(!r.eql(i,a))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(r.isOdd)return!r.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){l(e);const{px:t,py:n,pz:i}=this,{px:o,py:a,pz:s}=e,c=r.eql(r.mul(t,s),r.mul(o,i)),u=r.eql(r.mul(n,s),r.mul(a,i));return c&&u}negate(){return new f(this.px,r.neg(this.py),this.pz)}double(){const{a:e,b:n}=t,i=r.mul(n,wOe),{px:o,py:a,pz:s}=this;let c=r.ZERO,u=r.ZERO,l=r.ZERO,d=r.mul(o,o),h=r.mul(a,a),p=r.mul(s,s),m=r.mul(o,a);return m=r.add(m,m),l=r.mul(o,s),l=r.add(l,l),c=r.mul(e,l),u=r.mul(i,p),u=r.add(c,u),c=r.sub(h,u),u=r.add(h,u),u=r.mul(c,u),c=r.mul(m,c),l=r.mul(i,l),p=r.mul(e,p),m=r.sub(d,p),m=r.mul(e,m),m=r.add(m,l),l=r.add(d,d),d=r.add(l,d),d=r.add(d,p),d=r.mul(d,m),u=r.add(u,d),p=r.mul(a,s),p=r.add(p,p),d=r.mul(p,m),c=r.sub(c,d),l=r.mul(p,h),l=r.add(l,l),l=r.add(l,l),new f(c,u,l)}add(e){l(e);const{px:n,py:i,pz:o}=this,{px:a,py:s,pz:c}=e;let u=r.ZERO,d=r.ZERO,h=r.ZERO;const p=t.a,m=r.mul(t.b,wOe);let b=r.mul(n,a),g=r.mul(i,s),y=r.mul(o,c),v=r.add(n,i),w=r.add(a,s);v=r.mul(v,w),w=r.add(b,g),v=r.sub(v,w),w=r.add(n,o);let E=r.add(a,c);return w=r.mul(w,E),E=r.add(b,y),w=r.sub(w,E),E=r.add(i,o),u=r.add(s,c),E=r.mul(E,u),u=r.add(g,y),E=r.sub(E,u),h=r.mul(p,w),u=r.mul(m,y),h=r.add(u,h),u=r.sub(g,h),h=r.add(g,h),d=r.mul(u,h),g=r.add(b,b),g=r.add(g,b),y=r.mul(p,y),w=r.mul(m,w),g=r.add(g,y),y=r.sub(b,y),y=r.mul(p,y),w=r.add(w,y),b=r.mul(g,w),d=r.add(d,b),b=r.mul(E,w),u=r.mul(v,u),u=r.sub(u,b),b=r.mul(v,g),h=r.mul(E,h),h=r.add(h,b),new f(u,d,h)}subtract(e){return this.add(e.negate())}is0(){return this.equals(f.ZERO)}wNAF(e){return h.wNAFCached(this,u,e,(e=>{const t=r.invertBatch(e.map((e=>e.pz)));return e.map(((e,r)=>e.toAffine(t[r]))).map(f.fromAffine)}))}multiplyUnsafe(e){const n=f.ZERO;if(e===yOe)return n;if(s(e),e===vOe)return this;const{endo:i}=t;if(!i)return h.unsafeLadder(this,e);let{k1neg:o,k1:a,k2neg:c,k2:u}=i.splitScalar(e),l=n,d=n,p=this;for(;a>yOe||u>yOe;)a&vOe&&(l=l.add(p)),u&vOe&&(d=d.add(p)),p=p.double(),a>>=vOe,u>>=vOe;return o&&(l=l.negate()),c&&(d=d.negate()),d=new f(r.mul(d.px,i.beta),d.py,d.pz),l.add(d)}multiply(e){s(e);let n,i,o=e;const{endo:a}=t;if(a){const{k1neg:e,k1:t,k2neg:s,k2:c}=a.splitScalar(o);let{p:u,f:l}=this.wNAF(t),{p:d,f:p}=this.wNAF(c);u=h.constTimeNegate(e,u),d=h.constTimeNegate(s,d),d=new f(r.mul(d.px,a.beta),d.py,d.pz),n=u.add(d),i=l.add(p)}else{const{p:e,f:t}=this.wNAF(o);n=e,i=t}return f.normalizeZ([n,i])[0]}multiplyAndAddUnsafe(e,t,r){const n=f.BASE,i=(e,t)=>t!==yOe&&t!==vOe&&e.equals(n)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,r));return o.is0()?void 0:o}toAffine(e){const{px:t,py:n,pz:i}=this,o=this.is0();null==e&&(e=o?r.ONE:r.inv(i));const a=r.mul(t,e),s=r.mul(n,e),c=r.mul(i,e);if(o)return{x:r.ZERO,y:r.ZERO};if(!r.eql(c,r.ONE))throw new Error("invZ was invalid");return{x:a,y:s}}isTorsionFree(){const{h:e,isTorsionFree:r}=t;if(e===vOe)return!0;if(r)return r(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:r}=t;return e===vOe?this:r?r(f,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return this.assertValidity(),n(f,this,e)}toHex(e=!0){return OTe(this.toRawBytes(e))}}f.BASE=new f(t.Gx,t.Gy,r.ONE),f.ZERO=new f(r.ZERO,r.ONE,r.ZERO);const d=t.nBitLength,h=function(e,t){const r=(e,t)=>{const r=t.negate();return e?r:t},n=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:r,unsafeLadder(t,r){let n=e.ZERO,i=t;for(;r>dOe;)r&hOe&&(n=n.add(i)),i=i.double(),r>>=hOe;return n},precomputeWindow(e,t){const{windows:r,windowSize:i}=n(t),o=[];let a=e,s=a;for(let e=0;e>=d,n>s&&(n-=f,o+=hOe);const a=t,h=t+Math.abs(n)-1,p=e%2!=0,m=n<0;0===n?u=u.add(r(p,i[a])):c=c.add(r(m,i[h]))}return{p:c,f:u}},wNAFCached(e,t,r,n){const i=e._WINDOW_SIZE||1;let o=t.get(e);return o||(o=this.precomputeWindow(e,i),1!==i&&t.set(e,n(o))),this.wNAF(i,o,r)}}}(f,t.endo?Math.ceil(d/2):d);return{CURVE:t,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:a}}function AOe(e){const t=function(e){const t=pOe(e);return WTe(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:r,n:n}=t,i=r.BYTES+1,o=2*r.BYTES+1;function a(e){return nOe(e,n)}function s(e){return aOe(e,n)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:f}=EOe({...t,toBytes(e,t,n){const i=t.toAffine(),o=r.toBytes(i.x),a=zTe;return n?a(Uint8Array.from([t.hasEvenY()?2:3]),o):a(Uint8Array.from([4]),o,r.toBytes(i.y))},fromBytes(e){const t=e.length,n=e[0],a=e.subarray(1);if(t!==i||2!==n&&3!==n){if(t===o&&4===n){return{x:r.fromBytes(a.subarray(0,r.BYTES)),y:r.fromBytes(a.subarray(r.BYTES,2*r.BYTES))}}throw new Error(`Point of length ${t} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const e=FTe(a);if(!(yOe<(s=e)&&sOTe(jTe(e,t.nByteLength));function h(e){return e>n>>vOe}const p=(e,t,r)=>FTe(e.slice(t,r));class m{constructor(e,t,r){this.r=e,this.s=t,this.recovery=r,this.assertValidity()}static fromCompact(e){const r=t.nByteLength;return e=DTe("compactSignature",e,2*r),new m(p(e,0,r),p(e,r,2*r))}static fromDER(e){const{r:t,s:r}=gOe.toSig(DTe("DER",e));return new m(t,r)}assertValidity(){if(!f(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!f(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(e){return new m(this.r,this.s,e)}recoverPublicKey(e){const{r:n,s:i,recovery:o}=this,u=v(DTe("msgHash",e));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const l=2===o||3===o?n+t.n:n;if(l>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const f=1&o?"03":"02",h=c.fromHex(f+d(l)),p=s(l),m=a(-u*p),b=a(i*p),g=c.BASE.multiplyAndAddUnsafe(h,m,b);if(!g)throw new Error("point at infinify");return g.assertValidity(),g}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return RTe(this.toDERHex())}toDERHex(){return gOe.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return RTe(this.toCompactHex())}toCompactHex(){return d(this.r)+d(this.s)}}const b={isValidPrivateKey(e){try{return u(e),!0}catch(e){return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const e=fOe(t.n);return function(e,t,r=!1){const n=e.length,i=lOe(t),o=fOe(t);if(n<16||n1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);const a=nOe(r?FTe(e):LTe(e),t-YTe)+YTe;return r?UTe(a,i):jTe(a,i)}(t.randomBytes(e),t.n)},precompute:(e=8,t=c.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function g(e){const t=PTe(e),r="string"==typeof e,n=(t||r)&&e.length;return t?n===i||n===o:r?n===2*i||n===2*o:e instanceof c}const y=t.bits2int||function(e){const r=FTe(e),n=8*e.length-t.nBitLength;return n>0?r>>BigInt(n):r},v=t.bits2int_modN||function(e){return a(y(e))},w=HTe(t.nBitLength);function E(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(yOe<=e&&ee in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:l}=t;let{lowS:d,prehash:p,extraEntropy:b}=i;null==d&&(d=!0),e=DTe("msgHash",e),p&&(e=DTe("prehashed msgHash",o(e)));const g=v(e),w=u(n),A=[E(w),E(g)];if(null!=b&&!1!==b){const e=!0===b?l(r.BYTES):b;A.push(DTe("extraEntropy",e))}const _=zTe(...A),k=g;return{seed:_,k2sig:function(e){const t=y(e);if(!f(t))return;const r=s(t),n=c.BASE.multiply(t).toAffine(),i=a(n.x);if(i===yOe)return;const o=a(r*a(k+i*w));if(o===yOe)return;let u=(n.x===i?0:2)|Number(n.y&vOe),l=o;return d&&h(o)&&(l=function(e){return h(e)?a(-e):e}(o),u^=1),new m(i,l,u)}}}const x={lowS:t.lowS,prehash:!1},_={lowS:t.lowS,prehash:!1};return c.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return c.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,r=!0){if(g(e))throw new Error("first arg must be private key");if(!g(t))throw new Error("second arg must be public key");return c.fromHex(t).multiply(u(e)).toRawBytes(r)},sign:function(e,r,n=x){const{seed:i,k2sig:o}=A(e,r,n),a=t;return KTe(a.hash.outputLen,a.nByteLength,a.hmac)(i,o)},verify:function(e,r,n,i=_){const o=e;if(r=DTe("msgHash",r),n=DTe("publicKey",n),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:u,prehash:l}=i;let f,d;try{if("string"==typeof o||PTe(o))try{f=m.fromDER(o)}catch(e){if(!(e instanceof gOe.Err))throw e;f=m.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:e,s:t}=o;f=new m(e,t)}}d=c.fromHex(n)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(u&&f.hasHighS())return!1;l&&(r=t.hash(r));const{r:h,s:p}=f,b=v(r),g=s(p),y=a(b*g),w=a(h*g),E=c.BASE.multiplyAndAddUnsafe(d,y,w)?.toAffine();return!!E&&a(E.x)===h},ProjectivePoint:c,Signature:m,utils:b}} /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function xOe(e){return{hash:e,hmac:(t,...r)=>Jd(e,t,Ws(...r)),randomBytes:Ys}}BigInt(4); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const _Oe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),kOe=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),SOe=BigInt(1),POe=BigInt(2),IOe=(e,t)=>(e+t/POe)/t;const TOe=function(e,t,r=!1,n={}){if(e<=ZTe)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:o}=uOe(e,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=sOe(e),s=Object.freeze({ORDER:e,BITS:i,BYTES:o,MASK:HTe(i),ZERO:ZTe,ONE:YTe,create:t=>nOe(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return ZTe<=t&&te===ZTe,isOdd:e=>(e&YTe)===YTe,neg:t=>nOe(-t,e),eql:(e,t)=>e===t,sqr:t=>nOe(t*t,e),add:(t,r)=>nOe(t+r,e),sub:(t,r)=>nOe(t-r,e),mul:(t,r)=>nOe(t*r,e),pow:(e,t)=>function(e,t,r){if(r 0");if(r===ZTe)return e.ONE;if(r===YTe)return t;let n=e.ONE,i=t;for(;r>ZTe;)r&YTe&&(n=e.mul(n,i)),i=e.sqr(i),r>>=YTe;return n}(s,e,t),div:(t,r)=>nOe(t*aOe(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>aOe(t,e),sqrt:n.sqrt||(e=>a(s,e)),invertBatch:e=>function(e,t){const r=new Array(t.length),n=t.reduce(((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n))),e.ONE),i=e.inv(n);return t.reduceRight(((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n))),i),r}(s,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?UTe(e,o):jTe(e,o),fromBytes:e=>{if(e.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return r?LTe(e):FTe(e)}});return Object.freeze(s)}(_Oe,void 0,void 0,{sqrt:function(e){const t=_Oe,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),a=BigInt(23),s=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,f=oOe(l,r,t)*l%t,d=oOe(f,r,t)*l%t,h=oOe(d,POe,t)*u%t,p=oOe(h,i,t)*h%t,m=oOe(p,o,t)*p%t,b=oOe(m,s,t)*m%t,g=oOe(b,c,t)*b%t,y=oOe(g,s,t)*m%t,v=oOe(y,r,t)*l%t,w=oOe(v,a,t)*p%t,E=oOe(w,n,t)*u%t,A=oOe(E,POe,t);if(!TOe.eql(TOe.sqr(A),e))throw new Error("Cannot find square root");return A}}),OOe=function(e,t){const r=t=>AOe({...e,...xOe(t)});return Object.freeze({...r(t),create:r})}({a:BigInt(0),b:BigInt(7),Fp:TOe,n:kOe,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=kOe,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-SOe*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,a=BigInt("0x100000000000000000000000000000000"),s=IOe(o*e,t),c=IOe(-n*e,t);let u=nOe(e-s*r-c*i,t),l=nOe(-s*n-c*o,t);const f=u>a,d=l>a;if(f&&(u=t-u),d&&(l=t-l),u>a||l>a)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:u,k2neg:d,k2:l}}}},Vd);BigInt(0),OOe.ProjectivePoint;var MOe=Object.freeze({__proto__:null,secp256k1:OOe});async function COe(e,t){const{address:r,factory:n,factoryData:i,hash:o,signature:a,...s}=t,c=tde(a)?a:"object"==typeof a&&"r"in a&&"s"in a?function({r:e,s:t,v:r,yParity:n}){const i=(()=>{if(0===n||1===n)return n;if(r&&(27n===r||28n===r||r>=35n))return r%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})();return`0x${new OOe.Signature(xde(e),xde(t)).toCompactHex()}${0===i?"1b":"1c"}`}(a):dde(a),u=await(async()=>{if(!n&&!i)return c;if(function(e){return Mhe(e,-32)===wTe}(c))return c;return await Ske(e,XIe,"getCode")({address:r})?c:function(e){const{address:t,data:r,signature:n}=e;return Dde([tSe([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,r,n]),wTe])}({address:n,data:i,signature:c})})();try{const{data:t}=await Ske(e,tIe,"call")({data:XPe({abi:KPe,args:[r,o,u],bytecode:ZPe}),...s});return f="0x1",$Te(tde(l=t??"0x0")?gde(l):l,tde(f)?gde(f):f)}catch(e){try{const e=nTe(function(e,t){if(!jde(e,{strict:!1}))throw new Mde({address:e});return Rde(e,t)}(r),await gTe({hash:o,signature:a}));if(e)return!0}catch{}if(e instanceof NSe)return!1;throw e}var l,f}function BOe(e,{emitOnBegin:t=!1,emitMissed:r=!1,onBlockNumber:n,onError:i,poll:o,pollingInterval:a=e.pollingInterval}){let s;return(void 0!==o?o:"webSocket"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].config.type))?aIe(TSe(["watchBlockNumber",e.uid,t,r,a]),{onBlockNumber:n,onError:i},(n=>cIe((async()=>{try{const t=await Ske(e,hIe,"getBlockNumber")({cacheTime:0});if(s){if(t===s)return;if(t-s>1&&r)for(let e=s+1n;es)&&(n.onBlockNumber(t,s),s=t)}catch(e){n.onError?.(e)}}),{emitOnBegin:t,interval:a}))):aIe(TSe(["watchBlockNumber",e.uid,t,r]),{onBlockNumber:n,onError:i},(t=>{let r=!0,n=()=>r=!1;return(async()=>{try{const i=(()=>{if("fallback"===e.transport.type){const t=e.transport.transports.find((e=>"webSocket"===e.config.type));return t?t.value:e.transport}return e.transport})(),{unsubscribe:o}=await i.subscribe({params:["newHeads"],onData(e){if(!r)return;const n=xde(e.result?.number);t.onBlockNumber(n,s),s=n},onError(e){t.onError?.(e)}});n=o,r||n()}catch(e){i?.(e)}})(),()=>n()}))}const NOe=/^(?:(?[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?
0x[a-fA-F0-9]{40})\n\n(?:(?.*)\n\n)?/,ROe=/(?:URI: (?.+))\n(?:Version: (?.+))\n(?:Chain ID: (?\d+))\n(?:Nonce: (?[a-zA-Z0-9]+))\n(?:Issued At: (?.+))(?:\nExpiration Time: (?.+))?(?:\nNot Before: (?.+))?(?:\nRequest ID: (?.+))?/;async function FOe(e,t){const{address:r,domain:n,message:i,nonce:o,scheme:a,signature:s,time:c=new Date,...u}=t,l=function(e){const{scheme:t,statement:r,...n}=e.match(NOe)?.groups??{},{chainId:i,expirationTime:o,issuedAt:a,notBefore:s,requestId:c,...u}=e.match(ROe)?.groups??{},l=e.split("Resources:")[1]?.split("\n- ").slice(1);return{...n,...u,...i?{chainId:Number(i)}:{},...o?{expirationTime:new Date(o)}:{},...a?{issuedAt:new Date(a)}:{},...s?{notBefore:new Date(s)}:{},...c?{requestId:c}:{},...l?{resources:l}:{},...t?{scheme:t}:{},...r?{statement:r}:{}}}(i);if(!l.address)return!1;const f=function(e){const{address:t,domain:r,message:n,nonce:i,scheme:o,time:a=new Date}=e;if(r&&n.domain!==r)return!1;if(i&&n.nonce!==i)return!1;if(o&&n.scheme!==o)return!1;if(n.expirationTime&&a>=n.expirationTime)return!1;if(n.notBefore&&atIe(e,t),createBlockFilter:()=>async function(e){const t=dSe(e,{method:"eth_newBlockFilter"}),r=await e.request({method:"eth_newBlockFilter"});return{id:r,request:t(r),type:"block"}}(e),createContractEventFilter:t=>hSe(e,t),createEventFilter:t=>ZIe(e,t),createPendingTransactionFilter:()=>YIe(e),estimateContractGas:t=>async function(e,t){const{abi:r,address:n,args:i,functionName:o,...a}=t,s=bSe({abi:r,args:i,functionName:o});try{return await Ske(e,MPe,"estimateGas")({data:s,to:n,...a})}catch(e){const t=a.account?pSe(a.account):void 0;throw fPe(e,{abi:r,address:n,args:i,docsPath:"/docs/contract/estimateContractGas",functionName:o,sender:t?.address})}}(e,t),estimateGas:t=>MPe(e,t),getBalance:t=>async function(e,{address:t,blockNumber:r,blockTag:n="latest"}){const i=r?hde(r):void 0,o=await e.request({method:"eth_getBalance",params:[t,i||n]});return BigInt(o)}(e,t),getBlobBaseFee:()=>async function(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}(e),getBlock:t=>xPe(e,t),getBlockNumber:t=>hIe(e,t),getBlockTransactionCount:t=>async function(e,{blockHash:t,blockNumber:r,blockTag:n="latest"}={}){const i=void 0!==r?hde(r):void 0;let o;return o=t?await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):await e.request({method:"eth_getBlockTransactionCountByNumber",params:[i||n]},{dedupe:Boolean(i)}),_de(o)}(e,t),getBytecode:t=>XIe(e,t),getChainId:()=>IPe(e),getCode:t=>XIe(e,t),getContractEvents:t=>LPe(e,t),getEip712Domain:t=>async function(e,t){const{address:r,factory:n,factoryData:i}=t;try{const[t,o,a,s,c,u,l]=await Ske(e,rIe,"readContract")({abi:gIe,address:r,functionName:"eip712Domain",factory:n,factoryData:i});return{domain:{name:o,version:a,chainId:Number(s),verifyingContract:c,salt:u},extensions:l,fields:t}}catch(e){const t=e;if("ContractFunctionExecutionError"===t.name&&"ContractFunctionZeroDataError"===t.cause.name)throw new bIe({address:r});throw t}}(e,t),getEnsAddress:t=>async function(e,{blockNumber:t,blockTag:r,coinType:n,name:i,gatewayUrls:o,strict:a,universalResolverAddress:s}){let c=s;if(!c){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");c=Nhe({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{const a=bSe({abi:qPe,functionName:"addr",...null!=n?{args:[CIe(i),BigInt(n)]}:{args:[CIe(i)]}}),s={address:c,abi:$Pe,functionName:"resolve",args:[lde(RIe(i)),a],blockNumber:t,blockTag:r},u=Ske(e,rIe,"readContract"),l=o?await u({...s,args:[...s.args,o]}):await u(s);if("0x"===l[0])return null;const f=UPe({abi:qPe,args:null!=n?[CIe(i),BigInt(n)]:void 0,functionName:"addr",data:l[0]});return"0x"===f||"0x00"===nde(f)?null:f}catch(e){if(a)throw e;if(OIe(e,"resolve"))return null;throw e}}(e,t),getEnsAvatar:t=>async function(e,{blockNumber:t,blockTag:r,assetGatewayUrls:n,name:i,gatewayUrls:o,strict:a,universalResolverAddress:s}){const c=await Ske(e,JIe,"getEnsText")({blockNumber:t,blockTag:r,key:"avatar",name:i,universalResolverAddress:s,gatewayUrls:o,strict:a});if(!c)return null;try{return await WIe(e,{record:c,gatewayUrls:n})}catch{return null}}(e,t),getEnsName:t=>async function(e,{address:t,blockNumber:r,blockTag:n,gatewayUrls:i,strict:o,universalResolverAddress:a}){let s=a;if(!s){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");s=Nhe({blockNumber:r,chain:e.chain,contract:"ensUniversalResolver"})}const c=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const o={address:s,abi:HPe,functionName:"reverse",args:[lde(RIe(c))],blockNumber:r,blockTag:n},a=Ske(e,rIe,"readContract"),[u,l]=i?await a({...o,args:[...o.args,i]}):await a(o);return t.toLowerCase()!==l.toLowerCase()?null:u}catch(e){if(o)throw e;if(OIe(e,"reverse"))return null;throw e}}(e,t),getEnsResolver:t=>async function(e,{blockNumber:t,blockTag:r,name:n,universalResolverAddress:i}){let o=i;if(!o){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");o=Nhe({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}const[a]=await Ske(e,rIe,"readContract")({address:o,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[lde(RIe(n))],blockNumber:t,blockTag:r});return a}(e,t),getEnsText:t=>JIe(e,t),getFeeHistory:t=>QIe(e,t),estimateFeesPerGas:t=>async function(e,t){return SPe(e,t)}(e,t),getFilterChanges:e=>pIe(0,e),getFilterLogs:e=>async function(e,{filter:t}){const r=t.strict??!1,n=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map((e=>Ide(e)));return t.abi?RPe({abi:t.abi,logs:n,strict:r}):n}(0,e),getGasPrice:()=>_Pe(e),getLogs:t=>FPe(e,t),getProof:t=>ETe(e,t),estimateMaxPriorityFeePerGas:t=>async function(e,t){return kPe(e,t)}(e,t),getStorageAt:t=>async function(e,{address:t,blockNumber:r,blockTag:n="latest",slot:i}){const o=void 0!==r?hde(r):void 0;return await e.request({method:"eth_getStorageAt",params:[t,i,o||n]})}(e,t),getTransaction:t=>ATe(e,t),getTransactionConfirmations:t=>async function(e,{hash:t,transactionReceipt:r}){const[n,i]=await Promise.all([Ske(e,hIe,"getBlockNumber")({}),t?Ske(e,ATe,"getTransaction")({hash:t}):void 0]),o=r?.blockNumber||i?.blockNumber;return o?n-o+1n:0n}(e,t),getTransactionCount:t=>PPe(e,t),getTransactionReceipt:t=>xTe(e,t),multicall:t=>async function(e,t){const{allowFailure:r=!0,batchSize:n,blockNumber:i,blockTag:o,multicallAddress:a,stateOverride:s}=t,c=t.contracts,u=n??("object"==typeof e.batch?.multicall&&e.batch.multicall.batchSize||1024);let l=a;if(!l){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");l=Nhe({blockNumber:i,chain:e.chain,contract:"multicall3"})}const f=[[]];let d=0,h=0;for(let e=0;e0&&h>u&&f[d].length>0&&(d++,h=(e.length-2)/2,f[d]=[]),f[d]=[...f[d],{allowFailure:!0,callData:e,target:n}]}catch(e){const a=fPe(e,{abi:t,address:n,args:i,docsPath:"/docs/contract/multicall",functionName:o});if(!r)throw a;f[d]=[...f[d],{allowFailure:!0,callData:"0x",target:n}]}}const p=await Promise.allSettled(f.map((t=>Ske(e,rIe,"readContract")({abi:DPe,address:l,args:[t],blockNumber:i,blockTag:o,functionName:"aggregate3",stateOverride:s})))),m=[];for(let e=0;eOPe(e,t),readContract:t=>rIe(e,t),sendRawTransaction:t=>async function(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}(e,t),simulateContract:t=>async function(e,t){const{abi:r,address:n,args:i,dataSuffix:o,functionName:a,...s}=t,c=s.account?pSe(s.account):e.account,u=bSe({abi:r,args:i,functionName:a});try{const{data:l}=await Ske(e,tIe,"call")({batch:!1,data:`${u}${o?o.replace("0x",""):""}`,to:n,...s,account:c});return{result:UPe({abi:r,args:i,functionName:a,data:l||"0x"}),request:{abi:r.filter((e=>"name"in e&&e.name===t.functionName)),address:n,args:i,dataSuffix:o,functionName:a,...s,account:c}}}catch(e){throw fPe(e,{abi:r,address:n,args:i,docsPath:"/docs/contract/simulateContract",functionName:a,sender:c?.address})}}(e,t),verifyMessage:t=>async function(e,{address:t,message:r,factory:n,factoryData:i,signature:o,...a}){return COe(e,{address:t,factory:n,factoryData:i,hash:vTe(r),signature:o,...a})}(e,t),verifySiweMessage:t=>FOe(e,t),verifyTypedData:t=>async function(e,t){const{address:r,factory:n,factoryData:i,signature:o,message:a,primaryType:s,types:c,domain:u,...l}=t;return COe(e,{address:r,factory:n,factoryData:i,hash:uTe({message:a,primaryType:s,types:c,domain:u}),signature:o,...l})}(e,t),uninstallFilter:e=>mIe(0,e),waitForTransactionReceipt:t=>async function(e,{confirmations:t=1,hash:r,onReplaced:n,pollingInterval:i=e.pollingInterval,retryCount:o=6,retryDelay:a=({count:e})=>200*(1<{s&&setTimeout((()=>m(new rhe({hash:r}))),s);const b=aIe(c,{onReplaced:n,resolve:p,reject:m},(n=>{const s=Ske(e,BOe,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:i,async onBlockNumber(i){const c=e=>{s(),e(),b()};let p=i;if(!h){d>o&&c((()=>n.reject(new rhe({hash:r}))));try{if(f){if(t>1&&(!f.blockNumber||p-f.blockNumber+1nn.resolve(f)))}if(u||(h=!0,await xIe((async()=>{u=await Ske(e,ATe,"getTransaction")({hash:r}),u.blockNumber&&(p=u.blockNumber)}),{delay:a,retryCount:o}),h=!1),f=await Ske(e,xTe,"getTransactionReceipt")({hash:r}),t>1&&(!f.blockNumber||p-f.blockNumber+1nn.resolve(f)))}catch(r){if(r instanceof ehe||r instanceof the){if(!u)return void(h=!1);try{l=u,h=!0;const r=await xIe((()=>Ske(e,xPe,"getBlock")({blockNumber:p,includeTransactions:!0})),{delay:a,retryCount:o,shouldRetry:({error:e})=>e instanceof APe});h=!1;const i=r.transactions.find((({from:e,nonce:t})=>e===l.from&&t===l.nonce));if(!i)return;if(f=await Ske(e,xTe,"getTransactionReceipt")({hash:i.hash}),t>1&&(!f.blockNumber||p-f.blockNumber+1n{n.onReplaced?.({reason:s,replacedTransaction:l,transaction:i,transactionReceipt:f}),n.resolve(f)}))}catch(e){c((()=>n.reject(e)))}}else c((()=>n.reject(r)))}finally{d++}}}})}))}))}(e,t),watchBlocks:t=>function(e,{blockTag:t="latest",emitMissed:r=!1,emitOnBegin:n=!1,onBlock:i,onError:o,includeTransactions:a,poll:s,pollingInterval:c=e.pollingInterval}){const u=void 0!==s?s:"webSocket"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].config.type),l=a??!1;let f;return u?aIe(TSe(["watchBlocks",e.uid,t,r,n,l,c]),{onBlock:i,onError:o},(i=>cIe((async()=>{try{const n=await Ske(e,xPe,"getBlock")({blockTag:t,includeTransactions:l});if(n.number&&f?.number){if(n.number===f.number)return;if(n.number-f.number>1&&r)for(let t=f?.number+1n;tf.number)&&(i.onBlock(n,f),f=n)}catch(e){i.onError?.(e)}}),{emitOnBegin:n,interval:c}))):(()=>{let t=!0,r=()=>t=!1;return(async()=>{try{const n=(()=>{if("fallback"===e.transport.type){const t=e.transport.transports.find((e=>"webSocket"===e.config.type));return t?t.value:e.transport}return e.transport})(),{unsubscribe:a}=await n.subscribe({params:["newHeads"],onData(r){if(!t)return;const n=(e.chain?.formatters?.block?.format||Pde)(r.result);i(n,f),f=n},onError(e){o?.(e)}});r=a,t||r()}catch(e){o?.(e)}})(),()=>r()})()}(e,t),watchBlockNumber:t=>BOe(e,t),watchContractEvent:t=>function(e,t){const{abi:r,address:n,args:i,batch:o=!0,eventName:a,fromBlock:s,onError:c,onLogs:u,poll:l,pollingInterval:f=e.pollingInterval,strict:d}=t;return(void 0!==l?l:"bigint"==typeof s||"webSocket"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].config.type))?(()=>{const t=d??!1;return aIe(TSe(["watchContractEvent",n,i,o,e.uid,a,f,t,s]),{onLogs:u,onError:c},(c=>{let u,l;void 0!==s&&(u=s-1n);let d=!1;const h=cIe((async()=>{if(d)try{let s;if(l)s=await Ske(e,pIe,"getFilterChanges")({filter:l});else{const o=await Ske(e,hIe,"getBlockNumber")({});s=u&&u{l&&await Ske(e,mIe,"uninstallFilter")({filter:l}),h()}}))})():(()=>{const t=d??!1,s=TSe(["watchContractEvent",n,i,o,e.uid,a,f,t]);let l=!0,h=()=>l=!1;return aIe(s,{onLogs:u,onError:c},(t=>((async()=>{try{const o=(()=>{if("fallback"===e.transport.type){const t=e.transport.transports.find((e=>"webSocket"===e.config.type));return t?t.value:e.transport}return e.transport})(),s=a?lSe({abi:r,eventName:a,args:i}):[],{unsubscribe:c}=await o.subscribe({params:["logs",{address:n,topics:s}],onData(e){if(!l)return;const n=e.result;try{const{eventName:e,args:i}=BPe({abi:r,data:n.data,topics:n.topics,strict:d}),o=Ide(n,{args:i,eventName:e});t.onLogs([o])}catch(e){let r,i;if(e instanceof Gke||e instanceof qke){if(d)return;r=e.abiItem.name,i=e.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}const o=Ide(n,{args:i?[]:{},eventName:r});t.onLogs([o])}},onError(e){t.onError?.(e)}});h=c,l||h()}catch(e){c?.(e)}})(),()=>h())))})()}(e,t),watchEvent:t=>function(e,{address:t,args:r,batch:n=!0,event:i,events:o,fromBlock:a,onError:s,onLogs:c,poll:u,pollingInterval:l=e.pollingInterval,strict:f}){const d=void 0!==u?u:"bigint"==typeof a||"webSocket"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].config.type),h=f??!1;return d?aIe(TSe(["watchEvent",t,r,n,e.uid,i,l,a]),{onLogs:c,onError:s},(s=>{let c,u;void 0!==a&&(c=a-1n);let f=!1;const d=cIe((async()=>{if(f)try{let a;if(u)a=await Ske(e,pIe,"getFilterChanges")({filter:u});else{const n=await Ske(e,hIe,"getBlockNumber")({});a=c&&c!==n?await Ske(e,FPe,"getLogs")({address:t,args:r,event:i,events:o,fromBlock:c+1n,toBlock:n}):[],c=n}if(0===a.length)return;if(n)s.onLogs(a);else for(const e of a)s.onLogs([e])}catch(e){u&&e instanceof ZSe&&(f=!1),s.onError?.(e)}else{try{u=await Ske(e,ZIe,"createEventFilter")({address:t,args:r,event:i,events:o,strict:h,fromBlock:a})}catch{}f=!0}}),{emitOnBegin:!0,interval:l});return async()=>{u&&await Ske(e,mIe,"uninstallFilter")({filter:u}),d()}})):(()=>{let n=!0,a=()=>n=!1;return(async()=>{try{const u=(()=>{if("fallback"===e.transport.type){const t=e.transport.transports.find((e=>"webSocket"===e.config.type));return t?t.value:e.transport}return e.transport})(),l=o??(i?[i]:void 0);let d=[];if(l){const e=l.flatMap((e=>lSe({abi:[e],eventName:e.name,args:r})));d=[e],i&&(d=d[0])}const{unsubscribe:p}=await u.subscribe({params:["logs",{address:t,topics:d}],onData(e){if(!n)return;const t=e.result;try{const{eventName:e,args:r}=BPe({abi:l??[],data:t.data,topics:t.topics,strict:h}),n=Ide(t,{args:r,eventName:e});c([n])}catch(e){let r,n;if(e instanceof Gke||e instanceof qke){if(f)return;r=e.abiItem.name,n=e.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}const i=Ide(t,{args:n?[]:{},eventName:r});c([i])}},onError(e){s?.(e)}});a=p,n||a()}catch(e){s?.(e)}})(),()=>a()})()}(e,t),watchPendingTransactions:t=>function(e,{batch:t=!0,onError:r,onTransactions:n,poll:i,pollingInterval:o=e.pollingInterval}){return(void 0!==i?i:"webSocket"!==e.transport.type)?aIe(TSe(["watchPendingTransactions",e.uid,t,o]),{onTransactions:n,onError:r},(r=>{let n;const i=cIe((async()=>{try{if(!n)try{return void(n=await Ske(e,YIe,"createPendingTransactionFilter")({}))}catch(e){throw i(),e}const o=await Ske(e,pIe,"getFilterChanges")({filter:n});if(0===o.length)return;if(t)r.onTransactions(o);else for(const e of o)r.onTransactions([e])}catch(e){r.onError?.(e)}}),{emitOnBegin:!0,interval:o});return async()=>{n&&await Ske(e,mIe,"uninstallFilter")({filter:n}),i()}})):(()=>{let t=!0,i=()=>t=!1;return(async()=>{try{const{unsubscribe:o}=await e.transport.subscribe({params:["newPendingTransactions"],onData(e){if(!t)return;const r=e.result;n([r])},onError(e){r?.(e)}});i=o,t||i()}catch(e){r?.(e)}})(),()=>i()})()}(e,t)}}function jOe(e){const{key:t="public",name:r="Public Client"}=e,n=function(e){const{batch:t,cacheTime:r=e.pollingInterval??4e3,ccipRead:n,key:i="base",name:o="Base Client",pollingInterval:a=4e3,type:s="base"}=e,c=e.chain,u=e.account?pSe(e.account):void 0,{config:l,request:f,value:d}=e.transport({chain:c,pollingInterval:a}),h={account:u,batch:t,cacheTime:r,ccipRead:n,chain:c,key:i,name:o,pollingInterval:a,request:f,transport:{...l,...d},type:s,uid:EIe()};return Object.assign(h,{extend:function e(t){return r=>{const n=r(t);for(const e in h)delete n[e];const i={...t,...n};return Object.assign(i,{extend:e(i)})}}(h)})}({...e,key:t,name:r,type:"publicClient"});return n.extend(LOe)}var UOe=[{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"allowance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientAllowance",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientBalance",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC20InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC20InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC20InvalidSender",type:"error"},{inputs:[{internalType:"address",name:"spender",type:"address"}],name:"ERC20InvalidSpender",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"getMiddleware",outputs:[{internalType:"address[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],DOe={_format:"hh-sol-artifact-1",contractName:"TokenDistributor",sourceName:"contracts/v1/TokenDistributor.sol",abi:[{inputs:[{internalType:"address",name:"deployer",type:"address"},{internalType:"address",name:"_rrpAddress",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"previousAdminRole",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"newAdminRole",type:"bytes32"}],name:"RoleAdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleGranted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleRevoked",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"earner",type:"address"},{indexed:!1,internalType:"bytes32",name:"actionId",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"payout",type:"uint256"}],name:"tokenActionEarned",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"earner",type:"address"},{indexed:!1,internalType:"bytes32",name:"actionId",type:"bytes32"},{indexed:!1,internalType:"string",name:"reason",type:"string"}],name:"tokenActionFailed",type:"event"},{inputs:[],name:"DEFAULT_ADMIN_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"DISTRIBUTOR_DEPLOYER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"airnodeRrp",outputs:[{internalType:"contract IAirnodeRrpV0",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"requestId",type:"bytes32"},{internalType:"bytes",name:"data",type:"bytes"}],name:"fulfill",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"actionId",type:"bytes32"},{internalType:"bytes32",name:"proofID",type:"bytes32"},{internalType:"string",name:"metadata",type:"string"},{internalType:"bytes",name:"parameters",type:"bytes"}],name:"fulfillAction",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"fulfilledData",outputs:[{internalType:"int256",name:"",type:"int256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"}],name:"getRoleAdmin",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"grantRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"hasRole",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"incomingFulfillments",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract AuthorizableVault",name:"_vault",type:"address"},{internalType:"contract IERC20",name:"_tok",type:"address"},{internalType:"contract TokenMapping",name:"_map",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"pendingRequests",outputs:[{internalType:"bytes32",name:"actionId",type:"bytes32"},{internalType:"bytes32",name:"proofID",type:"bytes32"},{internalType:"address",name:"sender",type:"address"},{internalType:"string",name:"metadata",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"renounceRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"revokeRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"airnode",type:"address"},{internalType:"address",name:"sponsorWallet",type:"address"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],bytecode:"0x60a06040523480156200001157600080fd5b5060405162001b8738038062001b87833981016040819052620000349162000217565b6001600160a01b0381166080819052604051632b77c09f60e21b81523060048201526001602482015282919063addf027c90604401600060405180830381600087803b1580156200008457600080fd5b505af115801562000099573d6000803e3d6000fd5b5050505050620000b8620000b26200010360201b60201c565b62000107565b620000e47f60d80c98cdf3bdd0ed315cc9b95e0688cb16e95fee20366fd3d59bfbf8c10ec08362000159565b50506007805463ffffffff60a01b191661249f60a51b1790556200024f565b3390565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620001f6576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001b53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b80516001600160a01b03811681146200021257600080fd5b919050565b600080604083850312156200022b57600080fd5b6200023683620001fa565b91506200024660208401620001fa565b90509250929050565b608051611907620002806000396000818161027d015281816105cc01528181610ab80152610d2301526119076000f3fe6080604052600436106100e85760003560e01c806301ffc9a714610134578063248a9ca3146101695780632795ad20146101975780632f2ff15d146101c757806331268369146101e757806336568abe14610209578063406c6d6c14610229578063715018a61461025657806371bab6661461026b5780637c1de7e1146102b75780637f0ce16c146102d75780638da5cb5b146102f757806391d148541461030c578063a217fddf1461032c578063c0c53b8b14610341578063d547741f14610361578063dd2ae83f14610381578063f2fde38b146103b1578063f940e385146103d157600080fd5b3661012f576100f56103f1565b6001600160a01b03166108fc479081150290604051600060405180830381858888f1935050505015801561012d573d6000803e3d6000fd5b005b600080fd5b34801561014057600080fd5b5061015461014f36600461117a565b610400565b60405190151581526020015b60405180910390f35b34801561017557600080fd5b506101896101843660046111a4565b610437565b604051908152602001610160565b3480156101a357600080fd5b506101b76101b23660046111a4565b61044c565b604051610160949392919061120d565b3480156101d357600080fd5b5061012d6101e2366004611259565b610509565b3480156101f357600080fd5b506101896000805160206118db83398151915281565b34801561021557600080fd5b5061012d610224366004611259565b61052a565b34801561023557600080fd5b506101896102443660046111a4565b60036020526000908152604090205481565b34801561026257600080fd5b5061012d6105ad565b34801561027757600080fd5b5061029f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610160565b3480156102c357600080fd5b5061012d6102d23660046112d1565b6105c1565b3480156102e357600080fd5b5061012d6102f2366004611362565b610a1e565b34801561030357600080fd5b5061029f6103f1565b34801561031857600080fd5b50610154610327366004611259565b610bde565b34801561033857600080fd5b50610189600081565b34801561034d57600080fd5b5061012d61035c366004611432565b610c07565b34801561036d57600080fd5b5061012d61037c366004611259565b610c5f565b34801561038d57600080fd5b5061015461039c3660046111a4565b60026020526000908152604090205460ff1681565b3480156103bd57600080fd5b5061012d6103cc36600461147d565b610c7b565b3480156103dd57600080fd5b5061012d6103ec36600461149a565b610cf4565b6001546001600160a01b031690565b60006001600160e01b03198216637965db0b60e01b148061043157506301ffc9a760e01b6001600160e01b03198316145b92915050565b60009081526020819052604090206001015490565b6004602052600090815260409020805460018201546002830154600384018054939492936001600160a01b039092169291610486906114c8565b80601f01602080910402602001604051908101604052809291908181526020018280546104b2906114c8565b80156104ff5780601f106104d4576101008083540402835291602001916104ff565b820191906000526020600020905b8154815290600101906020018083116104e257829003601f168201915b5050505050905084565b61051282610437565b61051b81610d7b565b6105258383610d85565b505050565b6001600160a01b038116331461059f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6105a98282610e09565b5050565b6105b5610e6e565b6105bf6000610ecd565b565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106325760405162461bcd60e51b8152602060048201526016602482015275043616c6c6572206e6f74204169726e6f6465205252560541b6044820152606401610596565b60008381526002602052604090205460ff166106875760405162461bcd60e51b81526020600482015260146024820152734e6f20737563682072657175657374206d61646560601b6044820152606401610596565b6000838152600260205260408120805460ff191690556106a9828401846111a4565b600085815260036020526040902081905590506001819003610933576006546000858152600460208190526040918290206002810154815460018301549451632b0144ab60e11b81526001600160a01b039687169663560289569661071a9691909416949293926003019101611502565b600060405180830381600087803b15801561073457600080fd5b505af1158015610748573d6000803e3d6000fd5b5050600554600754600088815260046020819052604091829020600281015460065491549351630dce9f0760e41b81526001600160a01b0396871698506301e336679750948616959081169491169263dce9f070926107ab920190815260200190565b60e060405180830381865afa1580156107c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ec91906115bb565b602001516040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b15801561083f57600080fd5b505af1158015610853573d6000803e3d6000fd5b505050600085815260046020819052604091829020600281015490546006549351630dce9f0760e41b81529283018190527fc6798876072215c3559fe195e58a6001906fc6c496ba9a550476ffdd208adc4b94506001600160a01b0391821693909291169063dce9f0709060240160e060405180830381865afa1580156108de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090291906115bb565b602090810151604080516001600160a01b0390951685529184019290925282015260600160405180910390a16109de565b600084815260046020526040908190206002810154905491517f376c6bb6f978e3c1dd36537193cb25d03e334edd66d9eeb20b546824fc3d0eee926109d5926001600160a01b0316916001600160a01b0392909216825260208201526060604082018190526022908201527f4f7261636c6520696e76616c696461746564206561726e696e672072657175656080820152611cdd60f21b60a082015260c00190565b60405180910390a15b6000848152600460205260408120818155600181018290556002810180546001600160a01b031916905590610a16600383018261112c565b505050505050565b600654604051630dce9f0760e41b8152600481018790526000916001600160a01b03169063dce9f0709060240160e060405180830381865afa158015610a68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8c91906115bb565b608081015160a082015160c0830151604051636e6be03f60e01b81529394506000936001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001693636e6be03f93610b00939192909130918290637c1de7e160e01b908d908d90600401611656565b6020604051808303816000875af1158015610b1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4391906116cd565b60008181526002602081815260408084208054600160ff19909116811790915581516080810183528d81528084018d815233828501908152606083018e815289895260049096529390962081518155955191860191909155905192840180546001600160a01b0319166001600160a01b039094169390931790925551929350916003820190610bd2908261172c565b50505050505050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206118db833981519152610c1f81610d7b565b50600580546001600160a01b039485166001600160a01b031991821617909155600780549385169382169390931790925560068054919093169116179055565b610c6882610437565b610c7181610d7b565b6105258383610e09565b610c83610e6e565b6001600160a01b038116610ce85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610596565b610cf181610ecd565b50565b610cfc610e6e565b604051631d414cbd60e01b81526001600160a01b03838116600483015282811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631d414cbd90604401600060405180830381600087803b158015610d6757600080fd5b505af1158015610a16573d6000803e3d6000fd5b610cf18133610f1f565b610d8f8282610bde565b6105a9576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610dc53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610e138282610bde565b156105a9576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b33610e776103f1565b6001600160a01b0316146105bf5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610596565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b610f298282610bde565b6105a957610f3681610f78565b610f41836020610f8a565b604051602001610f529291906117eb565b60408051601f198184030181529082905262461bcd60e51b82526105969160040161185a565b60606104316001600160a01b03831660145b60606000610f99836002611883565b610fa490600261189a565b6001600160401b03811115610fbb57610fbb61131c565b6040519080825280601f01601f191660200182016040528015610fe5576020820181803683370190505b509050600360fc1b81600081518110611000576110006118ad565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061102f5761102f6118ad565b60200101906001600160f81b031916908160001a9053506000611053846002611883565b61105e90600161189a565b90505b60018111156110d6576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611092576110926118ad565b1a60f81b8282815181106110a8576110a86118ad565b60200101906001600160f81b031916908160001a90535060049490941c936110cf816118c3565b9050611061565b5083156111255760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610596565b9392505050565b508054611138906114c8565b6000825580601f10611148575050565b601f016020900490600052602060002090810190610cf191905b808211156111765760008155600101611162565b5090565b60006020828403121561118c57600080fd5b81356001600160e01b03198116811461112557600080fd5b6000602082840312156111b657600080fd5b5035919050565b60005b838110156111d85781810151838201526020016111c0565b50506000910152565b600081518084526111f98160208601602086016111bd565b601f01601f19169290920160200192915050565b84815283602082015260018060a01b038316604082015260806060820152600061123a60808301846111e1565b9695505050505050565b6001600160a01b0381168114610cf157600080fd5b6000806040838503121561126c57600080fd5b82359150602083013561127e81611244565b809150509250929050565b60008083601f84011261129b57600080fd5b5081356001600160401b038111156112b257600080fd5b6020830191508360208285010111156112ca57600080fd5b9250929050565b6000806000604084860312156112e657600080fd5b8335925060208401356001600160401b0381111561130357600080fd5b61130f86828701611289565b9497909650939450505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561135a5761135a61131c565b604052919050565b60008060008060006080868803121561137a57600080fd5b85359450602080870135945060408701356001600160401b03808211156113a057600080fd5b818901915089601f8301126113b457600080fd5b8135818111156113c6576113c661131c565b6113d8601f8201601f19168501611332565b8181528b858386010111156113ec57600080fd5b81858501868301376000918101909401529194506060880135918083111561141357600080fd5b505061142188828901611289565b969995985093965092949392505050565b60008060006060848603121561144757600080fd5b833561145281611244565b9250602084013561146281611244565b9150604084013561147281611244565b809150509250925092565b60006020828403121561148f57600080fd5b813561112581611244565b600080604083850312156114ad57600080fd5b82356114b881611244565b9150602083013561127e81611244565b600181811c908216806114dc57607f821691505b6020821081036114fc57634e487b7160e01b600052602260045260246000fd5b50919050565b60018060a01b03851681526000602085818401528460408401526080606084015260008454611530816114c8565b80608087015260a0600180841660008114611552576001811461156c5761159a565b60ff1985168984015283151560051b89018301955061159a565b896000528660002060005b858110156115925781548b8201860152908301908801611577565b8a0184019650505b50939b9a5050505050505050505050565b80516115b681611244565b919050565b600060e082840312156115cd57600080fd5b60405160e081016001600160401b03811182821017156115ef576115ef61131c565b8060405250825181526020830151602082015260408301516003811061161457600080fd5b60408201526060838101519082015261162f608084016115ab565b608082015260a083015160a082015261164a60c084016115ab565b60c08201529392505050565b6001600160a01b0389811682526020820189905287811660408301528681166060830152851660808201526001600160e01b0319841660a082015260e060c08201819052810182905260006101008385828501376000838501820152601f909301601f191690910190910198975050505050505050565b6000602082840312156116df57600080fd5b5051919050565b601f82111561052557600081815260208120601f850160051c8101602086101561170d5750805b601f850160051c820191505b81811015610a1657828155600101611719565b81516001600160401b038111156117455761174561131c565b6117598161175384546114c8565b846116e6565b602080601f83116001811461178e57600084156117765750858301515b600019600386901b1c1916600185901b178555610a16565b600085815260208120601f198616915b828110156117bd5788860151825594840194600190910190840161179e565b50858210156117db5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b81526000835161181d8160178501602088016111bd565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161184e8160288401602088016111bd565b01602801949350505050565b60208152600061112560208301846111e1565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176104315761043161186d565b808201808211156104315761043161186d565b634e487b7160e01b600052603260045260246000fd5b6000816118d2576118d261186d565b50600019019056fe60d80c98cdf3bdd0ed315cc9b95e0688cb16e95fee20366fd3d59bfbf8c10ec0a164736f6c6343000811000a",deployedBytecode:"0x6080604052600436106100e85760003560e01c806301ffc9a714610134578063248a9ca3146101695780632795ad20146101975780632f2ff15d146101c757806331268369146101e757806336568abe14610209578063406c6d6c14610229578063715018a61461025657806371bab6661461026b5780637c1de7e1146102b75780637f0ce16c146102d75780638da5cb5b146102f757806391d148541461030c578063a217fddf1461032c578063c0c53b8b14610341578063d547741f14610361578063dd2ae83f14610381578063f2fde38b146103b1578063f940e385146103d157600080fd5b3661012f576100f56103f1565b6001600160a01b03166108fc479081150290604051600060405180830381858888f1935050505015801561012d573d6000803e3d6000fd5b005b600080fd5b34801561014057600080fd5b5061015461014f36600461117a565b610400565b60405190151581526020015b60405180910390f35b34801561017557600080fd5b506101896101843660046111a4565b610437565b604051908152602001610160565b3480156101a357600080fd5b506101b76101b23660046111a4565b61044c565b604051610160949392919061120d565b3480156101d357600080fd5b5061012d6101e2366004611259565b610509565b3480156101f357600080fd5b506101896000805160206118db83398151915281565b34801561021557600080fd5b5061012d610224366004611259565b61052a565b34801561023557600080fd5b506101896102443660046111a4565b60036020526000908152604090205481565b34801561026257600080fd5b5061012d6105ad565b34801561027757600080fd5b5061029f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610160565b3480156102c357600080fd5b5061012d6102d23660046112d1565b6105c1565b3480156102e357600080fd5b5061012d6102f2366004611362565b610a1e565b34801561030357600080fd5b5061029f6103f1565b34801561031857600080fd5b50610154610327366004611259565b610bde565b34801561033857600080fd5b50610189600081565b34801561034d57600080fd5b5061012d61035c366004611432565b610c07565b34801561036d57600080fd5b5061012d61037c366004611259565b610c5f565b34801561038d57600080fd5b5061015461039c3660046111a4565b60026020526000908152604090205460ff1681565b3480156103bd57600080fd5b5061012d6103cc36600461147d565b610c7b565b3480156103dd57600080fd5b5061012d6103ec36600461149a565b610cf4565b6001546001600160a01b031690565b60006001600160e01b03198216637965db0b60e01b148061043157506301ffc9a760e01b6001600160e01b03198316145b92915050565b60009081526020819052604090206001015490565b6004602052600090815260409020805460018201546002830154600384018054939492936001600160a01b039092169291610486906114c8565b80601f01602080910402602001604051908101604052809291908181526020018280546104b2906114c8565b80156104ff5780601f106104d4576101008083540402835291602001916104ff565b820191906000526020600020905b8154815290600101906020018083116104e257829003601f168201915b5050505050905084565b61051282610437565b61051b81610d7b565b6105258383610d85565b505050565b6001600160a01b038116331461059f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6105a98282610e09565b5050565b6105b5610e6e565b6105bf6000610ecd565b565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106325760405162461bcd60e51b8152602060048201526016602482015275043616c6c6572206e6f74204169726e6f6465205252560541b6044820152606401610596565b60008381526002602052604090205460ff166106875760405162461bcd60e51b81526020600482015260146024820152734e6f20737563682072657175657374206d61646560601b6044820152606401610596565b6000838152600260205260408120805460ff191690556106a9828401846111a4565b600085815260036020526040902081905590506001819003610933576006546000858152600460208190526040918290206002810154815460018301549451632b0144ab60e11b81526001600160a01b039687169663560289569661071a9691909416949293926003019101611502565b600060405180830381600087803b15801561073457600080fd5b505af1158015610748573d6000803e3d6000fd5b5050600554600754600088815260046020819052604091829020600281015460065491549351630dce9f0760e41b81526001600160a01b0396871698506301e336679750948616959081169491169263dce9f070926107ab920190815260200190565b60e060405180830381865afa1580156107c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ec91906115bb565b602001516040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b15801561083f57600080fd5b505af1158015610853573d6000803e3d6000fd5b505050600085815260046020819052604091829020600281015490546006549351630dce9f0760e41b81529283018190527fc6798876072215c3559fe195e58a6001906fc6c496ba9a550476ffdd208adc4b94506001600160a01b0391821693909291169063dce9f0709060240160e060405180830381865afa1580156108de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090291906115bb565b602090810151604080516001600160a01b0390951685529184019290925282015260600160405180910390a16109de565b600084815260046020526040908190206002810154905491517f376c6bb6f978e3c1dd36537193cb25d03e334edd66d9eeb20b546824fc3d0eee926109d5926001600160a01b0316916001600160a01b0392909216825260208201526060604082018190526022908201527f4f7261636c6520696e76616c696461746564206561726e696e672072657175656080820152611cdd60f21b60a082015260c00190565b60405180910390a15b6000848152600460205260408120818155600181018290556002810180546001600160a01b031916905590610a16600383018261112c565b505050505050565b600654604051630dce9f0760e41b8152600481018790526000916001600160a01b03169063dce9f0709060240160e060405180830381865afa158015610a68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8c91906115bb565b608081015160a082015160c0830151604051636e6be03f60e01b81529394506000936001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001693636e6be03f93610b00939192909130918290637c1de7e160e01b908d908d90600401611656565b6020604051808303816000875af1158015610b1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4391906116cd565b60008181526002602081815260408084208054600160ff19909116811790915581516080810183528d81528084018d815233828501908152606083018e815289895260049096529390962081518155955191860191909155905192840180546001600160a01b0319166001600160a01b039094169390931790925551929350916003820190610bd2908261172c565b50505050505050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206118db833981519152610c1f81610d7b565b50600580546001600160a01b039485166001600160a01b031991821617909155600780549385169382169390931790925560068054919093169116179055565b610c6882610437565b610c7181610d7b565b6105258383610e09565b610c83610e6e565b6001600160a01b038116610ce85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610596565b610cf181610ecd565b50565b610cfc610e6e565b604051631d414cbd60e01b81526001600160a01b03838116600483015282811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631d414cbd90604401600060405180830381600087803b158015610d6757600080fd5b505af1158015610a16573d6000803e3d6000fd5b610cf18133610f1f565b610d8f8282610bde565b6105a9576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610dc53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610e138282610bde565b156105a9576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b33610e776103f1565b6001600160a01b0316146105bf5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610596565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b610f298282610bde565b6105a957610f3681610f78565b610f41836020610f8a565b604051602001610f529291906117eb565b60408051601f198184030181529082905262461bcd60e51b82526105969160040161185a565b60606104316001600160a01b03831660145b60606000610f99836002611883565b610fa490600261189a565b6001600160401b03811115610fbb57610fbb61131c565b6040519080825280601f01601f191660200182016040528015610fe5576020820181803683370190505b509050600360fc1b81600081518110611000576110006118ad565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061102f5761102f6118ad565b60200101906001600160f81b031916908160001a9053506000611053846002611883565b61105e90600161189a565b90505b60018111156110d6576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611092576110926118ad565b1a60f81b8282815181106110a8576110a86118ad565b60200101906001600160f81b031916908160001a90535060049490941c936110cf816118c3565b9050611061565b5083156111255760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610596565b9392505050565b508054611138906114c8565b6000825580601f10611148575050565b601f016020900490600052602060002090810190610cf191905b808211156111765760008155600101611162565b5090565b60006020828403121561118c57600080fd5b81356001600160e01b03198116811461112557600080fd5b6000602082840312156111b657600080fd5b5035919050565b60005b838110156111d85781810151838201526020016111c0565b50506000910152565b600081518084526111f98160208601602086016111bd565b601f01601f19169290920160200192915050565b84815283602082015260018060a01b038316604082015260806060820152600061123a60808301846111e1565b9695505050505050565b6001600160a01b0381168114610cf157600080fd5b6000806040838503121561126c57600080fd5b82359150602083013561127e81611244565b809150509250929050565b60008083601f84011261129b57600080fd5b5081356001600160401b038111156112b257600080fd5b6020830191508360208285010111156112ca57600080fd5b9250929050565b6000806000604084860312156112e657600080fd5b8335925060208401356001600160401b0381111561130357600080fd5b61130f86828701611289565b9497909650939450505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561135a5761135a61131c565b604052919050565b60008060008060006080868803121561137a57600080fd5b85359450602080870135945060408701356001600160401b03808211156113a057600080fd5b818901915089601f8301126113b457600080fd5b8135818111156113c6576113c661131c565b6113d8601f8201601f19168501611332565b8181528b858386010111156113ec57600080fd5b81858501868301376000918101909401529194506060880135918083111561141357600080fd5b505061142188828901611289565b969995985093965092949392505050565b60008060006060848603121561144757600080fd5b833561145281611244565b9250602084013561146281611244565b9150604084013561147281611244565b809150509250925092565b60006020828403121561148f57600080fd5b813561112581611244565b600080604083850312156114ad57600080fd5b82356114b881611244565b9150602083013561127e81611244565b600181811c908216806114dc57607f821691505b6020821081036114fc57634e487b7160e01b600052602260045260246000fd5b50919050565b60018060a01b03851681526000602085818401528460408401526080606084015260008454611530816114c8565b80608087015260a0600180841660008114611552576001811461156c5761159a565b60ff1985168984015283151560051b89018301955061159a565b896000528660002060005b858110156115925781548b8201860152908301908801611577565b8a0184019650505b50939b9a5050505050505050505050565b80516115b681611244565b919050565b600060e082840312156115cd57600080fd5b60405160e081016001600160401b03811182821017156115ef576115ef61131c565b8060405250825181526020830151602082015260408301516003811061161457600080fd5b60408201526060838101519082015261162f608084016115ab565b608082015260a083015160a082015261164a60c084016115ab565b60c08201529392505050565b6001600160a01b0389811682526020820189905287811660408301528681166060830152851660808201526001600160e01b0319841660a082015260e060c08201819052810182905260006101008385828501376000838501820152601f909301601f191690910190910198975050505050505050565b6000602082840312156116df57600080fd5b5051919050565b601f82111561052557600081815260208120601f850160051c8101602086101561170d5750805b601f850160051c820191505b81811015610a1657828155600101611719565b81516001600160401b038111156117455761174561131c565b6117598161175384546114c8565b846116e6565b602080601f83116001811461178e57600084156117765750858301515b600019600386901b1c1916600185901b178555610a16565b600085815260208120601f198616915b828110156117bd5788860151825594840194600190910190840161179e565b50858210156117db5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b81526000835161181d8160178501602088016111bd565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161184e8160288401602088016111bd565b01602801949350505050565b60208152600061112560208301846111e1565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176104315761043161186d565b808201808211156104315761043161186d565b634e487b7160e01b600052603260045260246000fd5b6000816118d2576118d261186d565b50600019019056fe60d80c98cdf3bdd0ed315cc9b95e0688cb16e95fee20366fd3d59bfbf8c10ec0a164736f6c6343000811000a",linkReferences:{},deployedLinkReferences:{}};let zOe={"app_id":4,"tokenPathways":[{"name":"Earned on Login","description":"Earned once on Login","hex":"0x7bb9c57d5ff2e667d003e72d04dfa7ae172df81339b33b18525b28a498e442a3","earned_on_login":true,"earned_on_referral":false,"token_amount":2,"frequency":2,"frequency_amount":1,"token_distributor":"0x5a65800Beb6969C973eCf42FF42cfe8Dfd627084","chain_id":"0x89"},{"name":"Earn on Referral","description":"We are all about mingling, the more friends we invite the mor $MGLS we earn!","hex":"0xed24f9711bc187f942f1a38efd5c41513bac272481d44ed28a6d9930d3854649","earned_on_login":false,"earned_on_referral":true,"token_amount":3,"frequency":0,"frequency_amount":0,"token_distributor":"0x5a65800Beb6969C973eCf42FF42cfe8Dfd627084","chain_id":"0x89"}],"Title":"Mingles Waitlist","Primary":"#50C2B2","Logo":"","URL":"mingles.wtf","Auth0_settings":{"verifierID":"mingles-waitlist-email-passwordless","clientID":"RNFUwhX1M3Xi3MHw7UMSO91YYk2igA0T","domain":"https://dev-wvj8ilnmab2m0q11.us.auth0.com"},"socialLogins":{"facebook":true,"google":true,"linkedin":true,"slack":true,"discord":true,"walletconnect":true}},$Oe="https://staging.layered.xyz",HOe={name:zOe.Title,url:zOe.URL,primary:zOe.Primary,logo:zOe.Logo,auth0:zOe.Auth0_settings},GOe={},qOe={referred:0,joined:0},KOe={referred:0,joined:0};const VOe=(e,t)=>(e(),setInterval(e,t)),WOe=async()=>{YOe.initialized?YOe.provider?YOe.userSmartAccount||await YOe.provider.getAddress().then((async e=>{console.log(e),YOe.userSmartAccount=e,await Rme().then((async e=>{e&&(console.log(e),YOe.userName=e.name||null)})).catch((e=>console.log("error getting user: info")))})).catch((e=>console.log("error getting user smart account: ",e))):await Nme().then((async e=>{e&&(YOe.provider=e,await e.getAddress().then((async e=>{console.log(e),YOe.userSmartAccount=e,await Rme().then((async e=>{e&&(console.log(e),YOe.userName=e.name||null)})).catch((e=>console.log("error getting user: info")))})).catch((e=>console.log("error getting user smart account: ",e))))})).catch((e=>console.log("error getting provider: ",e))):await Cme(HOe).then((async()=>{YOe.initialized=!0,await Nme().then((async e=>{e&&(YOe.provider=e,await e.getAddress().then((async e=>{console.log(e),YOe.userSmartAccount=e,await Rme().then((async e=>{e&&(console.log(e),YOe.userName=e.name||null)})).catch((e=>console.log("error getting user: info")))})).catch((e=>console.log("error getting user smart account: ",e))))})).catch((e=>console.log("error getting provider: ",e)))})).catch((e=>console.log("Error while initializing: ",e)))},JOe=()=>{console.log("in the fade out"),ZOe((()=>{const e=document.querySelectorAll("#layered-preloader");console.log("preloader ",e),e.length>0&&(console.log("found some preloaders "),e.forEach(((e,t)=>{console.log("adding for ",e),e.style.display="none",e.className="layeredFadeOut"})))}))},ZOe=e=>{"complete"===document.readyState||"interactive"===document.readyState?setTimeout(e,1):document.addEventListener("DOMContentLoaded",e)},YOe={initialized:!1,provider:null,userSmartAccount:null,userName:null,requireAuthorization:e=>{let t=!1;(async()=>{YOe.initialized?YOe.provider||(t=!0,window.location.replace(e)):await WOe().then((async()=>{console.log("after init"),YOe.provider||(t=!0,window.location.replace(e))})).catch((e=>console.log("error initializing in requireAuthorization ",e)))})().then((()=>{t?console.log("Should redirect"):JOe()})).catch((e=>{console.log("error interacting with preloader",e)}))},redirectIfAuthorized:e=>{let t=!1;(async()=>{YOe.initialized?YOe.provider&&(console.log("initialized with a provider about to redirect"),t=!0,window.location.replace(e)):await WOe().then((async()=>{YOe.provider&&(console.log("and now in the provider about to redirect"),t=!0,window.location.replace(e))})).catch((e=>console.log("error initializing in redirectIfAuthorized ",e)))})().then((()=>{t?console.log("Should redirect"):JOe()})).catch((e=>{console.log("error interacting with preloader",e)}))}};return ZOe((async()=>{var e,t,r,n,i,o;await WOe();const a=zOe.tokenPathways.filter((e=>!0===e.earned_on_login)),s=zOe.tokenPathways.filter((e=>!0===e.earned_on_referral)),c=kke(["function fulfillAction(bytes32 actionId, bytes32 proofID, string memory metadata, bytes calldata parameters) public"]);if(YOe.provider){const e=await Rme();fetch(`${$Oe}/api/data/users/addUserToApp`,{method:"POST",body:JSON.stringify({smartAddress:YOe.userSmartAccount,app_id:zOe.app_id,user:e}),headers:{"Content-Type":"text/plain"}}).then((async t=>{const r=await t.json();console.log("Successfully added user to app ",r);let n=await fetch(`${$Oe}/api/data/earnedpathways`,{method:"POST",body:JSON.stringify({smartAddress:YOe.userSmartAccount,app_id:zOe.app_id,user:e}),headers:{"Content-Type":"text/plain"}}),i=await n.json();console.log("earnedPathways",i),console.log("New user triggering earned on first login action");try{if(YOe.provider)for(var o=0;oe.hex===a[o].hex));if(t[0]){if(2==a[o].frequency&&t.length>=a[o].frequency_amount){console.log("skipping pathway because we alreayd earned it");continue}a[o].frequency}const r=[{type:"string",name:"app_id",value:zOe.app_id.toString()},{type:"string",name:"userAddress",value:YOe.userSmartAccount},{type:"string",name:"_path",value:"status"},{type:"string",name:"_type",value:"int256"}],n=Fme.encode(r);await Bme(a[o].chain_id,(async t=>{if(t){const r=Bde(lde(`${YOe.userSmartAccount||""}+${Date.now()}`)),i=await t.sendUserOperation({target:a[o].token_distributor,data:bSe({abi:c,functionName:"fulfillAction",args:[a[o].hex,r,"",n]})}),s=await t.waitForUserOperationTransaction(i.hash);console.log("Tx for earning tokens upon login: ",s),s&&fetch(`${$Oe}/api/data/earnedpathways/new`,{method:"POST",body:JSON.stringify({smartAddress:YOe.userSmartAccount,app_id:zOe.app_id,proof:r,hex:a[o].hex,user:e}),headers:{"Content-Type":"text/plain"}}).then((e=>{console.log("successfully added earnedpathway",e)})).catch((e=>{console.log("error adding earnedpathway",e)}))}}))}}catch(e){console.log("error while earning first login action: ",e)}})).catch((e=>{console.log("Error adding user to app: ",e)})),s.length>0&&VOe((async()=>{fetch(`${$Oe}/api/data/referrals`,{method:"POST",body:JSON.stringify({smartAddress:YOe.userSmartAccount,app_id:zOe.app_id,user:e}),headers:{"Content-Type":"text/plain"}}).then((async t=>{let r=await fetch(`${$Oe}/api/data/earnedpathways`,{method:"POST",body:JSON.stringify({smartAddress:YOe.userSmartAccount,app_id:zOe.app_id,user:e}),headers:{"Content-Type":"text/plain"}}),n=await r.json();console.log("earnedPathways",n);const i=await t.json();console.log("we got refs!",i);const o=i.userReferrals,a=i.allReferrals;console.log("pathways earned on Ref",s),qOe.referred=o.length,qOe.joined=o.filter((e=>null!=e.referred_user_id)).length,KOe.referred=a.length,KOe.joined=a.filter((e=>null!=e.referred_user_id)).length,console.log("User Ref Counts & Total Ref Counts",qOe,KOe),M();try{if(YOe.provider)for(var u=0;ue.hex===s[u].hex));if(t.filter((e=>e.proof===o[l].proof)).length>0)console.log("we already confirmed this proof!");else{if(t[0]){if(2==s[u].frequency&&t.length>=s[u].frequency_amount){console.log("skipping pathway because we already earned it");continue}s[u].frequency}if(o[l].referred_user_id){const t=[{type:"string",name:"app_id",value:zOe.app_id.toString()},{type:"string",name:"proof",value:o[l].proof},{type:"string",name:"_path",value:"status"},{type:"string",name:"_type",value:"int256"}],r=Fme.encode(t);await Bme(s[u].chain_id,(async t=>{if(t){const n=await t.sendUserOperation({target:s[u].token_distributor,data:bSe({abi:c,functionName:"fulfillAction",args:[s[u].hex,o[l].proof,"",r]})}),i=await t.waitForUserOperationTransaction(n.hash);console.log("Tx for earning tokens upon referral: ",i),i&&fetch(`${$Oe}/api/data/earnedpathways/new`,{method:"POST",body:JSON.stringify({smartAddress:YOe.userSmartAccount,app_id:zOe.app_id,proof:o[l].proof,hex:s[u].hex,user:e}),headers:{"Content-Type":"text/plain"}}).then((e=>{console.log("successfully added earnedpathway",e)})).catch((e=>{console.log("error adding earnedpathway",e)}))}}))}}}}}catch(e){console.log("Error earning referral: ",e)}}))}),36e5)}const u="https://polygon-amoy.g.alchemy.com/v2/yfPnDjn4YVGDpSBun0Y9jv9XvrRKq1Vs",l="https://polygon-mainnet.g.alchemy.com/v2/26uv2UQi8g99zBpSFbpQ2hqNCYVzQLci",f="https://eth-mainnet.g.alchemy.com/v2/jmYwXxpmuvaarrxh3X2X-0Qu3rfhhxv7",d={"0x13882":"https://amoy.polygonscan.com/","0x89":"https://polygonscan.com/","0x1":"https://etherscan.io/"},h={"0x13882":await jOe({chain:Lhe,transport:TIe(u)}),"0x89":await jOe({chain:Fhe,transport:TIe(l)}),"0x1":await jOe({chain:Rhe,transport:TIe(f)})};console.log(window.location.protocol+"//"+window.location.hostname,zOe.app_id);const p=async(e,t,r)=>{await Ome(e,t,r,window.location.protocol+"//"+window.location.hostname+":"+window.location.port)},m=document.querySelectorAll("#layered-google-login");if(m.length>0){const t=null===(e=m[0].attributes.getNamedItem("lyr-redirectUrl"))||void 0===e?void 0:e.value;console.log("redirectUrl for google ",t),m[0].addEventListener("click",(()=>p("google",null,t||null)))}const b=document.querySelectorAll("#layered-linkedin-login");if(b.length>0){const e=null===(t=b[0].attributes.getNamedItem("lyr-redirectUrl"))||void 0===t?void 0:t.value;b[0].addEventListener("click",(()=>p("linkedin",null,e||null)))}const g=document.querySelectorAll("#layered-facebook-login");if(g.length>0){const e=null===(r=g[0].attributes.getNamedItem("lyr-redirectUrl"))||void 0===r?void 0:r.value;g[0].addEventListener("click",(()=>p("facebook",null,e||null)))}const y=document.querySelectorAll("#layered-email-login-submit"),v=document.querySelectorAll("#layered-email-login-data");if(console.log(v),y.length>0&&v.length>0){const e=null===(n=y[0].attributes.getNamedItem("lyr-redirectUrl"))||void 0===n?void 0:n.value;y[0].addEventListener("click",(()=>p("jwt",v[0].value,e||null)))}document.querySelectorAll("#layered-referral-submit");const w=document.querySelectorAll("#layered-referral-data"),E=document.querySelectorAll("#layered-referral-form");E.length>0&&E[0].addEventListener("submit",(async e=>{if(e.preventDefault(),YOe.provider){const e=await Rme();fetch(`${$Oe}/api/data/referrals/new`,{method:"POST",body:JSON.stringify({smartAddress:YOe.userSmartAccount,referral_email:w[0].value,app_id:zOe.app_id,user:e}),headers:{"Content-Type":"text/plain"}}).then((e=>{console.log(e),w[0].value="",console.log("Successfully recorded referral")})).catch((e=>{console.log(e),console.log("Error recording referral")}))}else console.log("Error: You are not logged in, you must be logged in to refer other users.")}));const A=document.querySelectorAll("#layered-login-form");if(A.length>0){const e=null===(i=A[0].attributes.getNamedItem("layered-submit-override"))||void 0===i?void 0:i.value,t=null===(o=A[0].attributes.getNamedItem("lyr-redirectUrl"))||void 0===o?void 0:o.value;"email-login"===e?(console.log("adding email event listener to ",A[0]),A[0].addEventListener("submit",(e=>(e.preventDefault(),p("jwt",v[0].value,t||null),!1)))):"google-login"===e?(console.log("adding google event listener to ",A[0]),A[0].addEventListener("submit",(e=>(e.preventDefault(),p("google",null,t||null),!1)))):(console.log("adding else event listener to ",A[0]),A[0].addEventListener("submit",(e=>(e.preventDefault(),p("jwt",v[0].value,t||null),!1))))}document.querySelectorAll("#layered-discord-login"),document.querySelectorAll("#layered-slack-login");const x=document.querySelectorAll("#layered-error-state"),_=document.querySelectorAll("#layered-success-state");console.log("Success States: ",_);const k=document.querySelectorAll("#layered-logout"),S=async()=>{try{await Mme(),(e=>{var t;let r;for(var n=0;n<_.length;n++)console.log("state: ",_[n]),(null===(t=_[n].attributes.getNamedItem("layeredComponent"))||void 0===t?void 0:t.value)===e&&(r=_[n],r.style.display="flex",setTimeout((()=>{r.style.display="none"}),5e3))})("layered-logout")}catch(e){console.log("Error in logout: ",e)}};k.length>0&&(console.log("Found log out button"),k.forEach(((e,t)=>{e.addEventListener("click",(()=>S()))})));const P=async(e,t,r,n,i)=>{const o=h[t],a=await o.readContract({address:e,abi:r,functionName:n,args:i}).catch((e=>{console.log("Error: ",e),(e=>{var t;let r;for(var n=0;n{r.style.display="none"}),5e3))})("layered-token-balance")}));return a||""},I=document.querySelectorAll("#layered-token-balance");I.length>0&&YOe.userSmartAccount&&(console.log("Balance component: ",I),I.forEach((async(e,t)=>{VOe((async()=>{var t,r;let n=null===(t=e.attributes.getNamedItem("layered-token-collection"))||void 0===t?void 0:t.value,i=(null===(r=e.attributes.getNamedItem("layered-token-chain-id"))||void 0===r?void 0:r.value)||"0x89";const o=await P(n,i,UOe,"balanceOf",[YOe.userSmartAccount||"0x"]);e.textContent=Jde(o)||"",GOe=Object.assign({},GOe)}),2e3)})));const T=document.querySelectorAll("#layered-explorer-link");T.length>0&&T.forEach((async(e,t)=>{var r,n,i;let o=null===(r=e.attributes.getNamedItem("layered-explorer-address"))||void 0===r?void 0:r.value,a=null===(n=e.attributes.getNamedItem("layered-explorer-type"))||void 0===n?void 0:n.value,s=null===(i=e.attributes.getNamedItem("layered-explorer-chain-id"))||void 0===i?void 0:i.value;s||(s="0x89"),o||(o=YOe.userSmartAccount?YOe.userSmartAccount:"0x"),["token","address"].includes(a)||(a="address");let c=`${d[s]}${a}/${o}`;e.setAttribute("href",c)}));const O=document.querySelectorAll("#layered-user-name");O.length>0&&YOe.userName&&O.forEach((async(e,t)=>{e.textContent=YOe.userName}));const M=()=>{const e=document.querySelectorAll("#layered-user-referral-joined-count");e.length>0&&e.forEach((async(e,t)=>{console.log("setting textContent of user referrals joined ",qOe.joined.toString()),e.textContent=qOe.joined.toString()}));const t=document.querySelectorAll("#layered-user-referral-referred-count");t.length>0&&t.forEach((async(e,t)=>{console.log("setting textContent of user referrals joined ",qOe.joined.toString()),e.textContent=qOe.referred.toString()}));const r=document.querySelectorAll("#layered-total-referral-joined-count");r.length>0&&r.forEach((async(e,t)=>{e.textContent=KOe.joined.toString()}));const n=document.querySelectorAll("#layered-total-referral-referred-count");n.length>0&&n.forEach((async(e,t)=>{e.textContent=KOe.referred.toString()}))};document.querySelectorAll("#layered-token-total-supply").forEach((async(e,t)=>{var r,n,i;let o=(null===(r=e.attributes.getNamedItem("layered-token-address"))||void 0===r?void 0:r.value)||"0x",a=(null===(n=e.attributes.getNamedItem("layered-token-chain-id"))||void 0===n?void 0:n.value)||"0x89",s=(null===(i=e.attributes.getNamedItem("layered-token-ignore-address"))||void 0===i?void 0:i.value)||void 0,c=await P(o,a,UOe,"totalSupply",[]),u=s?await P(o,a,UOe,"balanceOf",[s]):BigInt(0);console.log(c,u),c-=u,e.textContent=Jde(c)||""}));document.querySelectorAll("#layered-token-earned-count").forEach((async(e,t)=>{var r,n,i,o;let a,s=(null===(r=e.attributes.getNamedItem("layered-token-distributor-address"))||void 0===r?void 0:r.value)||"0x",c=(null===(n=e.attributes.getNamedItem("layered-token-chain-id"))||void 0===n?void 0:n.value)||"0x89",u=(null===(i=e.attributes.getNamedItem("layered-token-event-hex"))||void 0===i?void 0:i.value)||void 0,l=(null===(o=e.attributes.getNamedItem("layered-token-user-filter"))||void 0===o?void 0:o.value)||void 0,f=h[c],d=await f.getContractEvents({abi:DOe.abi,address:s,fromBlock:"earliest",toBlock:"latest",eventName:"tokenActionEarned"});a=u?l?"current-user"==l?d.filter((e=>e.args.actionId==u)).filter((e=>e.args.earner==YOe.userSmartAccount)).reduce(((e,t)=>e+t.args.payout),BigInt(0)):d.filter((e=>e.args.actionId==u)).filter((e=>e.args.earner==l)).reduce(((e,t)=>e+t.args.payout),BigInt(0)):d.filter((e=>e.args.actionId==u)).reduce(((e,t)=>e+t.args.payout),BigInt(0)):l?"current-user"==l?d.filter((e=>e.args.earner==YOe.userSmartAccount)).reduce(((e,t)=>e+t.args.payout),BigInt(0)):d.filter((e=>e.args.earner==l)).reduce(((e,t)=>e+t.args.payout),BigInt(0)):d.reduce(((e,t)=>e+t.args.payout),BigInt(0)),e.textContent=Jde(a)}))})),YOe}));