@imtbl/sdk 0.2.3-alpha.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,32 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).immutable={})}(this,(function(e){"use strict";var t;e.Environment=void 0,(t=e.Environment||(e.Environment={})).PRODUCTION="production",t.SANDBOX="sandbox";var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function i(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){if(this instanceof e){var r=[null];return r.push.apply(r,arguments),new(Function.bind.apply(t,r))}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}var s={exports:{}},o="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},a=[],u=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,f=!1;function l(){f=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)a[t]=e[t],u[e.charCodeAt(t)]=t;u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63}function d(e,t,r){for(var n,i,s=[],o=t;o<r;o+=3)n=(e[o]<<16)+(e[o+1]<<8)+e[o+2],s.push(a[(i=n)>>18&63]+a[i>>12&63]+a[i>>6&63]+a[63&i]);return s.join("")}function h(e){var t;f||l();for(var r=e.length,n=r%3,i="",s=[],o=16383,u=0,c=r-n;u<c;u+=o)s.push(d(e,u,u+o>c?c:u+o));return 1===n?(t=e[r-1],i+=a[t>>2],i+=a[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=a[t>>10],i+=a[t>>4&63],i+=a[t<<2&63],i+="="),s.push(i),s.join("")}function p(e,t,r,n,i){var s,o,a=8*i-n-1,u=(1<<a)-1,c=u>>1,f=-7,l=r?i-1:0,d=r?-1:1,h=e[t+l];for(l+=d,s=h&(1<<-f)-1,h>>=-f,f+=a;f>0;s=256*s+e[t+l],l+=d,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===s)s=1-c;else{if(s===u)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),s-=c}return(h?-1:1)*o*Math.pow(2,s-n)}function g(e,t,r,n,i,s){var o,a,u,c=8*s-i-1,f=(1<<c)-1,l=f>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:s-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+l>=1?d/u:d*Math.pow(2,1-l))*u>=2&&(o++,u/=2),o+l>=f?(a=0,o=f):o+l>=1?(a=(t*u-1)*Math.pow(2,i),o+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),o=0));i>=8;e[r+h]=255&a,h+=p,a/=256,i-=8);for(o=o<<i|a,c+=i;c>0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}var m={}.toString,y=Array.isArray||function(e){return"[object Array]"==m.call(e)};_.TYPED_ARRAY_SUPPORT=void 0===o.TYPED_ARRAY_SUPPORT||o.TYPED_ARRAY_SUPPORT;var b=v();function v(){return _.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function w(e,t){if(v()<t)throw new RangeError("Invalid typed array length");return _.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=_.prototype:(null===e&&(e=new _(t)),e.length=t),e}function _(e,t,r){if(!(_.TYPED_ARRAY_SUPPORT||this instanceof _))return new _(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return S(this,e)}return E(this,e,t,r)}function E(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);_.TYPED_ARRAY_SUPPORT?(e=t).__proto__=_.prototype:e=k(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!_.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|R(t,r);e=w(e,n);var i=e.write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(T(t)){var r=0|x(t.length);return 0===(e=w(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?w(e,0):k(e,t);if("Buffer"===t.type&&y(t.data))return k(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function A(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function S(e,t){if(A(t),e=w(e,t<0?0:0|x(t)),!_.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function k(e,t){var r=t.length<0?0:0|x(t.length);e=w(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function x(e){if(e>=v())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+v().toString(16)+" bytes");return 0|e}function T(e){return!(null==e||!e._isBuffer)}function R(e,t){if(T(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 te(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return re(e).length;default:if(n)return te(e).length;t=(""+t).toLowerCase(),n=!0}}function O(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 H(this,t,r);case"utf8":case"utf-8":return F(this,t,r);case"ascii":return z(this,t,r);case"latin1":case"binary":return K(this,t,r);case"base64":return D(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function I(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function M(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)),T(t))return 0===t.length?-1:P(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):P(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function P(e,t,r,n,i){var s,o=1,a=e.length,u=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;o=2,a/=2,u/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var f=-1;for(s=r;s<a;s++)if(c(e,s)===c(t,-1===f?0:s-f)){if(-1===f&&(f=s),s-f+1===u)return f*o}else-1!==f&&(s-=s-f),f=-1}else for(r+u>a&&(r=a-u),s=r;s>=0;s--){for(var l=!0,d=0;d<u;d++)if(c(e,s+d)!==c(t,d)){l=!1;break}if(l)return s}return-1}function N(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var o=0;o<n;++o){var a=parseInt(t.substr(2*o,2),16);if(isNaN(a))return o;e[r+o]=a}return o}function C(e,t,r,n){return ne(te(t,e.length-r),e,r,n)}function B(e,t,r,n){return ne(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function U(e,t,r,n){return B(e,t,r,n)}function L(e,t,r,n){return ne(re(t),e,r,n)}function j(e,t,r,n){return ne(function(e,t){for(var r,n,i,s=[],o=0;o<e.length&&!((t-=2)<0);++o)n=(r=e.charCodeAt(o))>>8,i=r%256,s.push(i),s.push(n);return s}(t,e.length-r),e,r,n)}function D(e,t,r){return 0===t&&r===e.length?h(e):h(e.slice(t,r))}function F(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var s,o,a,u,c=e[i],f=null,l=c>239?4:c>223?3:c>191?2:1;if(i+l<=r)switch(l){case 1:c<128&&(f=c);break;case 2:128==(192&(s=e[i+1]))&&(u=(31&c)<<6|63&s)>127&&(f=u);break;case 3:s=e[i+1],o=e[i+2],128==(192&s)&&128==(192&o)&&(u=(15&c)<<12|(63&s)<<6|63&o)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:s=e[i+1],o=e[i+2],a=e[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(u=(15&c)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&u<1114112&&(f=u)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=l}return function(e){var t=e.length;if(t<=q)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=q));return r}(n)}_.poolSize=8192,_._augment=function(e){return e.__proto__=_.prototype,e},_.from=function(e,t,r){return E(null,e,t,r)},_.TYPED_ARRAY_SUPPORT&&(_.prototype.__proto__=Uint8Array.prototype,_.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&_[Symbol.species]),_.alloc=function(e,t,r){return function(e,t,r,n){return A(t),t<=0?w(e,t):void 0!==r?"string"==typeof n?w(e,t).fill(r,n):w(e,t).fill(r):w(e,t)}(null,e,t,r)},_.allocUnsafe=function(e){return S(null,e)},_.allocUnsafeSlow=function(e){return S(null,e)},_.isBuffer=ie,_.compare=function(e,t){if(!T(e)||!T(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},_.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},_.concat=function(e,t){if(!y(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return _.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=_.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(!T(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},_.byteLength=R,_.prototype._isBuffer=!0,_.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)I(this,t,t+1);return this},_.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)I(this,t,t+3),I(this,t+1,t+2);return this},_.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)I(this,t,t+7),I(this,t+1,t+6),I(this,t+2,t+5),I(this,t+3,t+4);return this},_.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?F(this,0,e):O.apply(this,arguments)},_.prototype.equals=function(e){if(!T(e))throw new TypeError("Argument must be a Buffer");return this===e||0===_.compare(this,e)},_.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},_.prototype.compare=function(e,t,r,n,i){if(!T(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 s=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),a=Math.min(s,o),u=this.slice(n,i),c=e.slice(t,r),f=0;f<a;++f)if(u[f]!==c[f]){s=u[f],o=c[f];break}return s<o?-1:o<s?1:0},_.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},_.prototype.indexOf=function(e,t,r){return M(this,e,t,r,!0)},_.prototype.lastIndexOf=function(e,t,r){return M(this,e,t,r,!1)},_.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(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 s=!1;;)switch(n){case"hex":return N(this,e,t,r);case"utf8":case"utf-8":return C(this,e,t,r);case"ascii":return B(this,e,t,r);case"latin1":case"binary":return U(this,e,t,r);case"base64":return L(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},_.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var q=4096;function z(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function K(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function H(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",s=t;s<r;++s)i+=ee(e[s]);return i}function G(e,t,r){for(var n=e.slice(t,r),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}function W(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function V(e,t,r,n,i,s){if(!T(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function X(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-r,2);i<s;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function J(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-r,4);i<s;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function $(e,t,r,n,i,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Y(e,t,r,n,i){return i||$(e,0,r,4),g(e,t,r,n,23,4),r+4}function Q(e,t,r,n,i){return i||$(e,0,r,8),g(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),t<e&&(t=e),_.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=_.prototype;else{var i=t-e;r=new _(i,void 0);for(var s=0;s<i;++s)r[s]=this[s+e]}return r},_.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||W(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n},_.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||W(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},_.prototype.readUInt8=function(e,t){return t||W(e,1,this.length),this[e]},_.prototype.readUInt16LE=function(e,t){return t||W(e,2,this.length),this[e]|this[e+1]<<8},_.prototype.readUInt16BE=function(e,t){return t||W(e,2,this.length),this[e]<<8|this[e+1]},_.prototype.readUInt32LE=function(e,t){return t||W(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||W(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||W(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},_.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||W(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},_.prototype.readInt8=function(e,t){return t||W(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},_.prototype.readInt16LE=function(e,t){t||W(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},_.prototype.readInt16BE=function(e,t){t||W(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||W(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||W(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||W(e,4,this.length),p(this,e,!0,23,4)},_.prototype.readFloatBE=function(e,t){return t||W(e,4,this.length),p(this,e,!1,23,4)},_.prototype.readDoubleLE=function(e,t){return t||W(e,8,this.length),p(this,e,!0,52,8)},_.prototype.readDoubleBE=function(e,t){return t||W(e,8,this.length),p(this,e,!1,52,8)},_.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||V(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,s=0;for(this[t]=255&e;++s<r&&(i*=256);)this[t+s]=e/i&255;return t+r},_.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||V(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},_.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||V(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||V(this,e,t,2,65535,0),_.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):X(this,e,t,!0),t+2},_.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||V(this,e,t,2,65535,0),_.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):X(this,e,t,!1),t+2},_.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||V(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):J(this,e,t,!0),t+4},_.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||V(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):J(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);V(this,e,t,r,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s<r&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+r},_.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);V(this,e,t,r,i-1,-i)}var s=r-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+r},_.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||V(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||V(this,e,t,2,32767,-32768),_.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):X(this,e,t,!0),t+2},_.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||V(this,e,t,2,32767,-32768),_.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):X(this,e,t,!1),t+2},_.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||V(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):J(this,e,t,!0),t+4},_.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||V(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):J(this,e,t,!1),t+4},_.prototype.writeFloatLE=function(e,t,r){return Y(this,e,t,!0,r)},_.prototype.writeFloatBE=function(e,t,r){return Y(this,e,t,!1,r)},_.prototype.writeDoubleLE=function(e,t,r){return Q(this,e,t,!0,r)},_.prototype.writeDoubleBE=function(e,t,r){return Q(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<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=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<n-r&&(n=e.length-t+r);var i,s=n-r;if(this===e&&r<t&&t<n)for(i=s-1;i>=0;--i)e[i+t]=this[i+r];else if(s<1e3||!_.TYPED_ARRAY_SUPPORT)for(i=0;i<s;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+s),t);return s},_.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!_.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var s;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s<r;++s)this[s]=e;else{var o=T(e)?e:te(new _(e,n).toString()),a=o.length;for(s=0;s<r-t;++s)this[s+t]=o[s%a]}return this};var Z=/[^+\/0-9A-Za-z-_]/g;function ee(e){return e<16?"0"+e.toString(16):e.toString(16)}function te(e,t){var r;t=t||1/0;for(var n=e.length,i=null,s=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.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;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function re(e){return function(e){var t,r,n,i,s,o;f||l();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s="="===e[a-2]?2:"="===e[a-1]?1:0,o=new c(3*a/4-s),n=s>0?a-4:a;var d=0;for(t=0,r=0;t<n;t+=4,r+=3)i=u[e.charCodeAt(t)]<<18|u[e.charCodeAt(t+1)]<<12|u[e.charCodeAt(t+2)]<<6|u[e.charCodeAt(t+3)],o[d++]=i>>16&255,o[d++]=i>>8&255,o[d++]=255&i;return 2===s?(i=u[e.charCodeAt(t)]<<2|u[e.charCodeAt(t+1)]>>4,o[d++]=255&i):1===s&&(i=u[e.charCodeAt(t)]<<10|u[e.charCodeAt(t+1)]<<4|u[e.charCodeAt(t+2)]>>2,o[d++]=i>>8&255,o[d++]=255&i),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ne(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function ie(e){return null!=e&&(!!e._isBuffer||se(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&se(e.slice(0,0))}(e))}function se(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var oe=i(Object.freeze({__proto__:null,Buffer:_,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),_.alloc(+e)},isBuffer:ie,kMaxLength:b}));!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 s;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:oe.Buffer}catch(e){}function o(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 a(e,t,r){var n=o(e,r);return r-1>=t&&(n|=o(e,r-1)<<4),n}function u(e,t,n,i){for(var s=0,o=0,a=Math.min(e.length,n),u=t;u<a;u++){var c=e.charCodeAt(u)-48;s*=i,o=c>=49?c-49+10:c>=17?c-17+10:c,r(c>=0&&o<i,"Invalid character"),s+=o}return s}function c(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(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<e.length&&(16===t?this._parseHex(e,i,n):(this._parseBase(e,t,i),"le"===n&&this._initArray(this.toArray(),t,n)))},i.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},i.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var s,o,a=0;if("be"===n)for(i=e.length-1,s=0;i>=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===n)for(i=0,s=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);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<this.length;n++)this.words[n]=0;var i,s=0,o=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)i=a(e,t,n)<<s,this.words[o]|=67108863&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=a(e,t,n)<<s,this.words[o]|=67108863&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=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 s=e.length-r,o=s%n,a=Math.min(s,s-o)+r,c=0,f=r;f<a;f+=n)c=u(e,f,f+n,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==o){var l=1;for(c=u(e,f,e.length,t),f=0;f<o;f++)l*=t;this.imuln(l),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){c(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&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")]=f}catch(e){i.prototype.inspect=f}else i.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var l=["","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,s=0,o=0;o<this.length;o++){var a=this.words[o],u=(16777215&(a<<i|s)).toString(16);s=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,o--),n=0!==s||o!==this.length-1?l[6-u.length]+u+n:u+n}for(0!==s&&(n=s.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 c=d[e],f=h[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modrn(f).toString(e);n=(p=p.idivn(f)).isZero()?g+n:l[c-g.length]+g+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)},s&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(s,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],s=0|t.words[0],o=i*s,a=67108863&o,u=o/67108864|0;r.words[0]=a;for(var c=1;c<n;c++){for(var f=u>>>26,l=67108863&u,d=Math.min(c,t.length-1),h=Math.max(0,c-e.length+1);h<=d;h++){var p=c-h|0;f+=(o=(i=0|e.words[p])*(s=0|t.words[h])+l)/67108864|0,l=67108863&o}r.words[c]=0|l,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r._strip()}i.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),s=n||Math.max(1,i);r(i<=s,"byte array longer than desired length"),r(s>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,s);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,i),o},i.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,s=0;i<this.length;i++){var o=this.words[i]<<s|n;e[r++]=255&o,r<e.length&&(e[r++]=o>>8&255),r<e.length&&(e[r++]=o>>16&255),6===s?(r<e.length&&(e[r++]=o>>24&255),n=0,s=0):(n=o>>>24,s+=2)}if(r<e.length)for(e[r++]=n;r<e.length;)e[r++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,n=0,i=0,s=0;i<this.length;i++){var o=this.words[i]<<s|n;e[r--]=255&o,r>=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===s?(r>=0&&(e[r--]=o>>24&255),n=0,s=0):(n=o>>>24,s+=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 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(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;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.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;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.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;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.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;i<t;i++)this.words[i]=67108863&~this.words[i];return n>0&&(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<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var i=0,s=0;s<n.length;s++)t=(0|r.words[s])+(0|n.words[s])+i,this.words[s]=67108863&t,i=t>>>26;for(;0!==i&&s<r.length;s++)t=(0|r.words[s])+i,this.words[s]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.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 s=0,o=0;o<n.length;o++)s=(t=(0|r.words[o])-(0|n.words[o])+s)>>26,this.words[o]=67108863&t;for(;0!==s&&o<r.length;o++)s=(t=(0|r.words[o])+s)>>26,this.words[o]=67108863&t;if(0===s&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var g=function(e,t,r){var n,i,s,o=e.words,a=t.words,u=r.words,c=0,f=0|o[0],l=8191&f,d=f>>>13,h=0|o[1],p=8191&h,g=h>>>13,m=0|o[2],y=8191&m,b=m>>>13,v=0|o[3],w=8191&v,_=v>>>13,E=0|o[4],A=8191&E,S=E>>>13,k=0|o[5],x=8191&k,T=k>>>13,R=0|o[6],O=8191&R,I=R>>>13,M=0|o[7],P=8191&M,N=M>>>13,C=0|o[8],B=8191&C,U=C>>>13,L=0|o[9],j=8191&L,D=L>>>13,F=0|a[0],q=8191&F,z=F>>>13,K=0|a[1],H=8191&K,G=K>>>13,W=0|a[2],V=8191&W,X=W>>>13,J=0|a[3],$=8191&J,Y=J>>>13,Q=0|a[4],Z=8191&Q,ee=Q>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],se=8191&ie,oe=ie>>>13,ae=0|a[7],ue=8191&ae,ce=ae>>>13,fe=0|a[8],le=8191&fe,de=fe>>>13,he=0|a[9],pe=8191&he,ge=he>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(c+(n=Math.imul(l,q))|0)+((8191&(i=(i=Math.imul(l,z))+Math.imul(d,q)|0))<<13)|0;c=((s=Math.imul(d,z))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(g,q)|0,s=Math.imul(g,z);var ye=(c+(n=n+Math.imul(l,H)|0)|0)+((8191&(i=(i=i+Math.imul(l,G)|0)+Math.imul(d,H)|0))<<13)|0;c=((s=s+Math.imul(d,G)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,q),i=(i=Math.imul(y,z))+Math.imul(b,q)|0,s=Math.imul(b,z),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(g,H)|0,s=s+Math.imul(g,G)|0;var be=(c+(n=n+Math.imul(l,V)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(d,V)|0))<<13)|0;c=((s=s+Math.imul(d,X)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(_,q)|0,s=Math.imul(_,z),n=n+Math.imul(y,H)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(b,H)|0,s=s+Math.imul(b,G)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(g,V)|0,s=s+Math.imul(g,X)|0;var ve=(c+(n=n+Math.imul(l,$)|0)|0)+((8191&(i=(i=i+Math.imul(l,Y)|0)+Math.imul(d,$)|0))<<13)|0;c=((s=s+Math.imul(d,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(A,q),i=(i=Math.imul(A,z))+Math.imul(S,q)|0,s=Math.imul(S,z),n=n+Math.imul(w,H)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,H)|0,s=s+Math.imul(_,G)|0,n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,X)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(g,$)|0,s=s+Math.imul(g,Y)|0;var we=(c+(n=n+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,ee)|0)+Math.imul(d,Z)|0))<<13)|0;c=((s=s+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(x,q),i=(i=Math.imul(x,z))+Math.imul(T,q)|0,s=Math.imul(T,z),n=n+Math.imul(A,H)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(S,H)|0,s=s+Math.imul(S,G)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,X)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,Y)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,Z)|0,s=s+Math.imul(g,ee)|0;var _e=(c+(n=n+Math.imul(l,re)|0)|0)+((8191&(i=(i=i+Math.imul(l,ne)|0)+Math.imul(d,re)|0))<<13)|0;c=((s=s+Math.imul(d,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(O,q),i=(i=Math.imul(O,z))+Math.imul(I,q)|0,s=Math.imul(I,z),n=n+Math.imul(x,H)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(T,H)|0,s=s+Math.imul(T,G)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(S,V)|0,s=s+Math.imul(S,X)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,Y)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(b,Z)|0,s=s+Math.imul(b,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(g,re)|0,s=s+Math.imul(g,ne)|0;var Ee=(c+(n=n+Math.imul(l,se)|0)|0)+((8191&(i=(i=i+Math.imul(l,oe)|0)+Math.imul(d,se)|0))<<13)|0;c=((s=s+Math.imul(d,oe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(N,q)|0,s=Math.imul(N,z),n=n+Math.imul(O,H)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(I,H)|0,s=s+Math.imul(I,G)|0,n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(T,V)|0,s=s+Math.imul(T,X)|0,n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(S,$)|0,s=s+Math.imul(S,Y)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Z)|0,s=s+Math.imul(_,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(b,re)|0,s=s+Math.imul(b,ne)|0,n=n+Math.imul(p,se)|0,i=(i=i+Math.imul(p,oe)|0)+Math.imul(g,se)|0,s=s+Math.imul(g,oe)|0;var Ae=(c+(n=n+Math.imul(l,ue)|0)|0)+((8191&(i=(i=i+Math.imul(l,ce)|0)+Math.imul(d,ue)|0))<<13)|0;c=((s=s+Math.imul(d,ce)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(B,q),i=(i=Math.imul(B,z))+Math.imul(U,q)|0,s=Math.imul(U,z),n=n+Math.imul(P,H)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(N,H)|0,s=s+Math.imul(N,G)|0,n=n+Math.imul(O,V)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(I,V)|0,s=s+Math.imul(I,X)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(T,$)|0,s=s+Math.imul(T,Y)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(S,Z)|0,s=s+Math.imul(S,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,s=s+Math.imul(_,ne)|0,n=n+Math.imul(y,se)|0,i=(i=i+Math.imul(y,oe)|0)+Math.imul(b,se)|0,s=s+Math.imul(b,oe)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(g,ue)|0,s=s+Math.imul(g,ce)|0;var Se=(c+(n=n+Math.imul(l,le)|0)|0)+((8191&(i=(i=i+Math.imul(l,de)|0)+Math.imul(d,le)|0))<<13)|0;c=((s=s+Math.imul(d,de)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(j,q),i=(i=Math.imul(j,z))+Math.imul(D,q)|0,s=Math.imul(D,z),n=n+Math.imul(B,H)|0,i=(i=i+Math.imul(B,G)|0)+Math.imul(U,H)|0,s=s+Math.imul(U,G)|0,n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,X)|0,n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(I,$)|0,s=s+Math.imul(I,Y)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(T,Z)|0,s=s+Math.imul(T,ee)|0,n=n+Math.imul(A,re)|0,i=(i=i+Math.imul(A,ne)|0)+Math.imul(S,re)|0,s=s+Math.imul(S,ne)|0,n=n+Math.imul(w,se)|0,i=(i=i+Math.imul(w,oe)|0)+Math.imul(_,se)|0,s=s+Math.imul(_,oe)|0,n=n+Math.imul(y,ue)|0,i=(i=i+Math.imul(y,ce)|0)+Math.imul(b,ue)|0,s=s+Math.imul(b,ce)|0,n=n+Math.imul(p,le)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(g,le)|0,s=s+Math.imul(g,de)|0;var ke=(c+(n=n+Math.imul(l,pe)|0)|0)+((8191&(i=(i=i+Math.imul(l,ge)|0)+Math.imul(d,pe)|0))<<13)|0;c=((s=s+Math.imul(d,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(j,H),i=(i=Math.imul(j,G))+Math.imul(D,H)|0,s=Math.imul(D,G),n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,X)|0)+Math.imul(U,V)|0,s=s+Math.imul(U,X)|0,n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,Y)|0,n=n+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(I,Z)|0,s=s+Math.imul(I,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(T,re)|0,s=s+Math.imul(T,ne)|0,n=n+Math.imul(A,se)|0,i=(i=i+Math.imul(A,oe)|0)+Math.imul(S,se)|0,s=s+Math.imul(S,oe)|0,n=n+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(_,ue)|0,s=s+Math.imul(_,ce)|0,n=n+Math.imul(y,le)|0,i=(i=i+Math.imul(y,de)|0)+Math.imul(b,le)|0,s=s+Math.imul(b,de)|0;var xe=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;c=((s=s+Math.imul(g,ge)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(j,V),i=(i=Math.imul(j,X))+Math.imul(D,V)|0,s=Math.imul(D,X),n=n+Math.imul(B,$)|0,i=(i=i+Math.imul(B,Y)|0)+Math.imul(U,$)|0,s=s+Math.imul(U,Y)|0,n=n+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(N,Z)|0,s=s+Math.imul(N,ee)|0,n=n+Math.imul(O,re)|0,i=(i=i+Math.imul(O,ne)|0)+Math.imul(I,re)|0,s=s+Math.imul(I,ne)|0,n=n+Math.imul(x,se)|0,i=(i=i+Math.imul(x,oe)|0)+Math.imul(T,se)|0,s=s+Math.imul(T,oe)|0,n=n+Math.imul(A,ue)|0,i=(i=i+Math.imul(A,ce)|0)+Math.imul(S,ue)|0,s=s+Math.imul(S,ce)|0,n=n+Math.imul(w,le)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(_,le)|0,s=s+Math.imul(_,de)|0;var Te=(c+(n=n+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,ge)|0)+Math.imul(b,pe)|0))<<13)|0;c=((s=s+Math.imul(b,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(j,$),i=(i=Math.imul(j,Y))+Math.imul(D,$)|0,s=Math.imul(D,Y),n=n+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(U,Z)|0,s=s+Math.imul(U,ee)|0,n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(N,re)|0,s=s+Math.imul(N,ne)|0,n=n+Math.imul(O,se)|0,i=(i=i+Math.imul(O,oe)|0)+Math.imul(I,se)|0,s=s+Math.imul(I,oe)|0,n=n+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(T,ue)|0,s=s+Math.imul(T,ce)|0,n=n+Math.imul(A,le)|0,i=(i=i+Math.imul(A,de)|0)+Math.imul(S,le)|0,s=s+Math.imul(S,de)|0;var Re=(c+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ge)|0)+Math.imul(_,pe)|0))<<13)|0;c=((s=s+Math.imul(_,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(j,Z),i=(i=Math.imul(j,ee))+Math.imul(D,Z)|0,s=Math.imul(D,ee),n=n+Math.imul(B,re)|0,i=(i=i+Math.imul(B,ne)|0)+Math.imul(U,re)|0,s=s+Math.imul(U,ne)|0,n=n+Math.imul(P,se)|0,i=(i=i+Math.imul(P,oe)|0)+Math.imul(N,se)|0,s=s+Math.imul(N,oe)|0,n=n+Math.imul(O,ue)|0,i=(i=i+Math.imul(O,ce)|0)+Math.imul(I,ue)|0,s=s+Math.imul(I,ce)|0,n=n+Math.imul(x,le)|0,i=(i=i+Math.imul(x,de)|0)+Math.imul(T,le)|0,s=s+Math.imul(T,de)|0;var Oe=(c+(n=n+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,ge)|0)+Math.imul(S,pe)|0))<<13)|0;c=((s=s+Math.imul(S,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(j,re),i=(i=Math.imul(j,ne))+Math.imul(D,re)|0,s=Math.imul(D,ne),n=n+Math.imul(B,se)|0,i=(i=i+Math.imul(B,oe)|0)+Math.imul(U,se)|0,s=s+Math.imul(U,oe)|0,n=n+Math.imul(P,ue)|0,i=(i=i+Math.imul(P,ce)|0)+Math.imul(N,ue)|0,s=s+Math.imul(N,ce)|0,n=n+Math.imul(O,le)|0,i=(i=i+Math.imul(O,de)|0)+Math.imul(I,le)|0,s=s+Math.imul(I,de)|0;var Ie=(c+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,ge)|0)+Math.imul(T,pe)|0))<<13)|0;c=((s=s+Math.imul(T,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(j,se),i=(i=Math.imul(j,oe))+Math.imul(D,se)|0,s=Math.imul(D,oe),n=n+Math.imul(B,ue)|0,i=(i=i+Math.imul(B,ce)|0)+Math.imul(U,ue)|0,s=s+Math.imul(U,ce)|0,n=n+Math.imul(P,le)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(N,le)|0,s=s+Math.imul(N,de)|0;var Me=(c+(n=n+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(I,pe)|0))<<13)|0;c=((s=s+Math.imul(I,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(j,ue),i=(i=Math.imul(j,ce))+Math.imul(D,ue)|0,s=Math.imul(D,ce),n=n+Math.imul(B,le)|0,i=(i=i+Math.imul(B,de)|0)+Math.imul(U,le)|0,s=s+Math.imul(U,de)|0;var Pe=(c+(n=n+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,ge)|0)+Math.imul(N,pe)|0))<<13)|0;c=((s=s+Math.imul(N,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(j,le),i=(i=Math.imul(j,de))+Math.imul(D,le)|0,s=Math.imul(D,de);var Ne=(c+(n=n+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,ge)|0)+Math.imul(U,pe)|0))<<13)|0;c=((s=s+Math.imul(U,ge)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Ce=(c+(n=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,ge))+Math.imul(D,pe)|0))<<13)|0;return c=((s=Math.imul(D,ge))+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,u[0]=me,u[1]=ye,u[2]=be,u[3]=ve,u[4]=we,u[5]=_e,u[6]=Ee,u[7]=Ae,u[8]=Se,u[9]=ke,u[10]=xe,u[11]=Te,u[12]=Re,u[13]=Oe,u[14]=Ie,u[15]=Me,u[16]=Pe,u[17]=Ne,u[18]=Ce,0!==c&&(u[19]=c,r.length++),r};function m(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,s=0;s<r.length-1;s++){var o=i;i=0;for(var a=67108863&n,u=Math.min(s,t.length-1),c=Math.max(0,s-e.length+1);c<=u;c++){var f=s-c,l=(0|e.words[f])*(0|t.words[c]),d=67108863&l;a=67108863&(d=d+a|0),i+=(o=(o=o+(l/67108864|0)|0)+(d>>>26)|0)>>>26,o&=67108863}r.words[s]=a,n=o,o=i}return 0!==n?r.words[s]=n:r.length--,r._strip()}function y(e,t,r){return m(e,t,r)}Math.imul||(g=p),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?g(this,e,t):r<63?p(this,e,t):r<1024?m(this,e,t):y(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),y(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<this.length;i++){var s=(0|this.words[i])*e,o=(67108863&s)+(67108863&n);n>>=26,n+=s/67108864|0,n+=o>>>26,this.words[i]=67108863&o}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<t.length;r++){var n=r/26|0,i=r%26;t[r]=e.words[n]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var s=r.sqr();n<t.length;n++,s=s.sqr())0!==t[n]&&(r=r.mul(s));return r},i.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,s=67108863>>>26-n<<26-n;if(0!==n){var o=0;for(t=0;t<this.length;t++){var a=this.words[t]&s,u=(0|this.words[t])-a<<n;this.words[t]=u|o,o=a>>>26-n}o&&(this.words[t]=o,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var s=e%26,o=Math.min((e-s)/26,this.length),a=67108863^67108863>>>s<<s,u=n;if(i-=o,i=Math.max(0,i),u){for(var c=0;c<o;c++)u.words[c]=this.words[c];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,c=0;c<this.length;c++)this.words[c]=this.words[c+o];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(0!==f||c>=i);c--){var l=0|this.words[c];this.words[c]=f<<26-s|l>>>s,f=l&a}return u&&0!==f&&(u.words[u.length++]=f),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<<t;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(e){r("number"==typeof e&&e>=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<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[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<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,n){var i,s,o=e.length+n;this._expand(o);var a=0;for(i=0;i<e.length;i++){s=(0|this.words[i+n])+a;var u=(0|e.words[i])*t;a=((s-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&s}for(;i<this.length-n;i++)a=(s=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&s;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(s=-(0|this.words[i])+a)>>26,this.words[i]=67108863&s;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),s=e,o=0|s.words[s.length-1];0!==(r=26-this._countBits(o))&&(s=s.ushln(r),n.iushln(r),o=0|s.words[s.length-1]);var a,u=n.length-s.length;if("mod"!==t){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var f=n.clone()._ishlnsubmul(s,1,u);0===f.negative&&(n=f,a&&(a.words[u]=1));for(var l=u-1;l>=0;l--){var d=67108864*(0|n.words[s.length+l])+(0|n.words[s.length+l-1]);for(d=Math.min(d/o|0,67108863),n._ishlnsubmul(s,d,l);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(s,1,l),n.isZero()||(n.negative^=1);a&&(a.words[l]=d)}return a&&a._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||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?(a=this.neg().divmod(e,t),"mod"!==t&&(s=a.div.neg()),"div"!==t&&(o=a.mod.neg(),n&&0!==o.negative&&o.iadd(e)),{div:s,mod:o}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(s=a.div.neg()),{div:s,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(o=a.mod.neg(),n&&0!==o.negative&&o.isub(e)),{div:a.div,mod:o}):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 s,o,a},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),s=r.cmp(n);return s<0||1===i&&0===s?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,s=this.length-1;s>=0;s--)i=(n*i+(0|this.words[s]))%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 s=(0|this.words[i])+67108864*n;this.words[i]=s/e|0,n=s%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 s=new i(1),o=new i(0),a=new i(0),u=new i(1),c=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++c;for(var f=n.clone(),l=t.clone();!t.isZero();){for(var d=0,h=1;0==(t.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(s.isOdd()||o.isOdd())&&(s.iadd(f),o.isub(l)),s.iushrn(1),o.iushrn(1);for(var p=0,g=1;0==(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(f),u.isub(l)),a.iushrn(1),u.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a),o.isub(u)):(n.isub(t),a.isub(s),u.isub(o))}return{a:a,b:u,gcd:n.iushln(c)}},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 s,o=new i(1),a=new i(0),u=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,f=1;0==(t.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(t.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var l=0,d=1;0==(n.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(n.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(a)):(n.isub(t),a.isub(o))}return(s=0===t.cmpn(1)?o:a).cmpn(0)<0&&s.iadd(e),s},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 s=t;t=r,r=s}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 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(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<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var s=i,o=n;0!==s&&o<this.length;o++){var a=0|this.words[o];s=(a+=s)>>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,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:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>i&&(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 S(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 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 _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(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){S.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=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?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<n;i++)t.words[i]=e.words[i];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var s=e.words[9];for(t.words[t.length++]=s&r,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&r)<<4|s>>>22,s=o}s>>>=22,e.words[i-10]=s,0===s&&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<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(_,v),n(E,v),n(A,v),A.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=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 w;else if("p224"===e)t=new _;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return b[e]=t,t},S.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(c(e,e.umod(this.m)._forceRed(this)),e)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.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)},S.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},S.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)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.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 s=this.m.subn(1),o=0;!s.isZero()&&0===s.andln(1);)o++,s.iushrn(1);r(!s.isZero());var a=new i(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var l=this.pow(f,s),d=this.pow(e,s.addn(1).iushrn(1)),h=this.pow(e,s),p=o;0!==h.cmp(a);){for(var g=h,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m<p);var y=this.pow(l,new i(1).iushln(p-m-1));d=d.redMul(y),l=y.redSqr(),h=h.redMul(l),p=m}return d},S.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},S.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var s=r[0],o=0,a=0,u=t.bitLength()%26;for(0===u&&(u=26),n=t.length-1;n>=0;n--){for(var c=t.words[n],f=u-1;f>=0;f--){var l=c>>f&1;s!==r[0]&&(s=this.sqr(s)),0!==l||0!==o?(o<<=1,o|=l,(4===++a||0===n&&0===f)&&(s=this.mul(s,r[o]),a=0,o=0)):a=0}u=26}return s},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new k(e)},n(k,S),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),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._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),s=r.isub(n).iushrn(this.shift),o=s;return s.cmp(this.m)>=0?o=s.isub(this.m):s.cmpn(0)<0&&(o=s.iadd(this.m)),o._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,r)}(s);var ae=s.exports,ue=n(ae);let ce=!1,fe=!1;const le={debug:1,default:2,info:2,warning:3,error:4,off:5};let de=le.default,he=null;const pe=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 ge,me;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(ge||(ge={})),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"}(me||(me={}));const ye="0123456789abcdef";let be=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==le[r]&&this.throwArgumentError("invalid log level name","logLevel",e),de>le[r]||console.log.apply(console,t)}debug(...t){this._log(e.levels.DEBUG,t)}info(...t){this._log(e.levels.INFO,t)}warn(...t){this._log(e.levels.WARNING,t)}makeError(t,r,n){if(fe)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=ye[t[e]>>4],r+=ye[15&t[e]];i.push(e+"=Uint8Array(0x"+r+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(n[e].toString()))}})),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=t;let o="";switch(r){case me.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case me.CALL_EXCEPTION:case me.INSUFFICIENT_FUNDS:case me.MISSING_NEW:case me.NONCE_EXPIRED:case me.REPLACEMENT_UNDERPRICED:case me.TRANSACTION_REPLACED:case me.UNPREDICTABLE_GAS_LIMIT:o=r}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const a=new Error(t);return a.reason=s,a.code=r,Object.keys(n).forEach((function(e){a[e]=n[e]})),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(t){pe&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:pe})}checkSafeUint53(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return he||(he=new e("logger/5.7.0")),he}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),ce){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}fe=!!t,ce=!!r}static setLogLevel(t){const r=le[t.toLowerCase()];null!=r?de=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};be.errors=me,be.levels=ge;const ve=new be("bytes/5.7.0");function we(e){return!!e.toHexString}function _e(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return _e(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function Ee(e){return Oe(e)&&!(e.length%2)||Se(e)}function Ae(e){return"number"==typeof e&&e==e&&e%1==0}function Se(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!Ae(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!Ae(r)||r<0||r>=256)return!1}return!0}function ke(e,t){if(t||(t={}),"number"==typeof e){ve.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),_e(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),we(e)&&(e=e.toHexString()),Oe(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":ve.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return _e(new Uint8Array(n))}return Se(e)?_e(new Uint8Array(e)):ve.throwArgumentError("invalid arrayify value","value",e)}function xe(e){const t=e.map((e=>ke(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),_e(n)}function Te(e){let t=ke(e);if(0===t.length)return t;let r=0;for(;r<t.length&&0===t[r];)r++;return r&&(t=t.slice(r)),t}function Re(e,t){(e=ke(e)).length>t&&ve.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),_e(r)}function Oe(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const Ie="0123456789abcdef";function Me(e,t){if(t||(t={}),"number"==typeof e){ve.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=Ie[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),we(e))return e.toHexString();if(Oe(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":ve.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(Se(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=Ie[(240&n)>>4]+Ie[15&n]}return t}return ve.throwArgumentError("invalid hexlify value","value",e)}function Pe(e){if("string"!=typeof e)e=Me(e);else if(!Oe(e)||e.length%2)return null;return(e.length-2)/2}function Ne(e,t,r){return"string"!=typeof e?e=Me(e):(!Oe(e)||e.length%2)&&ve.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function Ce(e){let t="0x";return e.forEach((e=>{t+=Me(e).substring(2)})),t}function Be(e){const t=function(e){"string"!=typeof e&&(e=Me(e));Oe(e)||ve.throwArgumentError("invalid hex string","value",e);e=e.substring(2);let t=0;for(;t<e.length&&"0"===e[t];)t++;return"0x"+e.substring(t)}(Me(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function Ue(e,t){for("string"!=typeof e?e=Me(e):Oe(e)||ve.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&ve.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function Le(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Ee(e)){let r=ke(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=Me(r.slice(0,32)),t.s=Me(r.slice(32,64))):65===r.length?(t.r=Me(r.slice(0,32)),t.s=Me(r.slice(32,64)),t.v=r[64]):ve.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:ve.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=Me(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=Re(ke(t._vs),32);t._vs=Me(r);const n=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=n:t.recoveryParam!==n&&ve.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const i=Me(r);null==t.s?t.s=i:t.s!==i&&ve.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?ve.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&&ve.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&Oe(t.r)?t.r=Ue(t.r,32):ve.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&Oe(t.s)?t.s=Ue(t.s,32):ve.throwArgumentError("signature missing or invalid s","signature",e);const r=ke(t.s);r[0]>=128&&ve.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=Me(r);t._vs&&(Oe(t._vs)||ve.throwArgumentError("signature invalid _vs","signature",e),t._vs=Ue(t._vs,32)),null==t._vs?t._vs=n:t._vs!==n&&ve.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}const je="bignumber/5.7.0";var De=ue.BN;const Fe=new be(je),qe={},ze=9007199254740991;let Ke=!1;class He{constructor(e,t){e!==qe&&Fe.throwError("cannot call constructor directly; use BigNumber.from",be.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return We(Ve(this).fromTwos(e))}toTwos(e){return We(Ve(this).toTwos(e))}abs(){return"-"===this._hex[0]?He.from(this._hex.substring(1)):this}add(e){return We(Ve(this).add(Ve(e)))}sub(e){return We(Ve(this).sub(Ve(e)))}div(e){return He.from(e).isZero()&&Xe("division-by-zero","div"),We(Ve(this).div(Ve(e)))}mul(e){return We(Ve(this).mul(Ve(e)))}mod(e){const t=Ve(e);return t.isNeg()&&Xe("division-by-zero","mod"),We(Ve(this).umod(t))}pow(e){const t=Ve(e);return t.isNeg()&&Xe("negative-power","pow"),We(Ve(this).pow(t))}and(e){const t=Ve(e);return(this.isNegative()||t.isNeg())&&Xe("unbound-bitwise-result","and"),We(Ve(this).and(t))}or(e){const t=Ve(e);return(this.isNegative()||t.isNeg())&&Xe("unbound-bitwise-result","or"),We(Ve(this).or(t))}xor(e){const t=Ve(e);return(this.isNegative()||t.isNeg())&&Xe("unbound-bitwise-result","xor"),We(Ve(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Xe("negative-width","mask"),We(Ve(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Xe("negative-width","shl"),We(Ve(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Xe("negative-width","shr"),We(Ve(this).shrn(e))}eq(e){return Ve(this).eq(Ve(e))}lt(e){return Ve(this).lt(Ve(e))}lte(e){return Ve(this).lte(Ve(e))}gt(e){return Ve(this).gt(Ve(e))}gte(e){return Ve(this).gte(Ve(e))}isNegative(){return"-"===this._hex[0]}isZero(){return Ve(this).isZero()}toNumber(){try{return Ve(this).toNumber()}catch(e){Xe("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Fe.throwError("this platform does not support BigInt",be.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Ke||(Ke=!0,Fe.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Fe.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",be.errors.UNEXPECTED_ARGUMENT,{}):Fe.throwError("BigNumber.toString does not accept parameters",be.errors.UNEXPECTED_ARGUMENT,{})),Ve(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof He)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new He(qe,Ge(e)):e.match(/^-?[0-9]+$/)?new He(qe,Ge(new De(e))):Fe.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&Xe("underflow","BigNumber.from",e),(e>=ze||e<=-ze)&&Xe("overflow","BigNumber.from",e),He.from(String(e));const t=e;if("bigint"==typeof t)return He.from(t.toString());if(Se(t))return He.from(Me(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return He.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(Oe(e)||"-"===e[0]&&Oe(e.substring(1))))return He.from(e)}return Fe.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function Ge(e){if("string"!=typeof e)return Ge(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Fe.throwArgumentError("invalid hex","value",e),"0x00"===(e=Ge(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 We(e){return He.from(Ge(e))}function Ve(e){const t=He.from(e).toHexString();return"-"===t[0]?new De("-"+t.substring(3),16):new De(t.substring(2),16)}function Xe(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),Fe.throwError(e,be.errors.NUMERIC_FAULT,n)}const Je=new be(je),$e={},Ye=He.from(0),Qe=He.from(-1);function Ze(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),Je.throwError(e,be.errors.NUMERIC_FAULT,i)}let et="0";for(;et.length<256;)et+=et;function tt(e){if("number"!=typeof e)try{e=He.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+et.substring(0,e):Je.throwArgumentError("invalid decimal size","decimals",e)}function rt(e,t){null==t&&(t=0);const r=tt(t),n=(e=He.from(e)).lt(Ye);n&&(e=e.mul(Qe));let i=e.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=e.div(r).toString();return e=1===r.length?s:s+"."+i,n&&(e="-"+e),e}function nt(e,t){null==t&&(t=0);const r=tt(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||Je.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&Je.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&Je.throwArgumentError("too many decimal points","value",e);let s=i[0],o=i[1];for(s||(s="0"),o||(o="0");"0"===o[o.length-1];)o=o.substring(0,o.length-1);for(o.length>r.length-1&&Ze("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const a=He.from(s),u=He.from(o);let c=a.mul(r).add(u);return n&&(c=c.mul(Qe)),c}class it{constructor(e,t,r,n){e!==$e&&Je.throwError("cannot use FixedFormat constructor; use FixedFormat.from",be.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=r,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=tt(n),Object.freeze(this)}static from(e){if(e instanceof it)return e;"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,r=128,n=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const i=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||Je.throwArgumentError("invalid fixed format","format",e),t="u"!==i[1],r=parseInt(i[2]),n=parseInt(i[3])}else if(e){const i=(t,r,n)=>null==e[t]?n:(typeof e[t]!==r&&Je.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&&Je.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&Je.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new it($e,t,r,n)}}class st{constructor(e,t,r,n){e!==$e&&Je.throwError("cannot use FixedNumber constructor; use FixedNumber.from",be.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&&Je.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=nt(this._value,this.format.decimals),r=nt(e._value,e.format.decimals);return st.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=nt(this._value,this.format.decimals),r=nt(e._value,e.format.decimals);return st.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=nt(this._value,this.format.decimals),r=nt(e._value,e.format.decimals);return st.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=nt(this._value,this.format.decimals),r=nt(e._value,e.format.decimals);return st.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=st.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(ot.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=st.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(ot.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)&&Je.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=st.from("1"+et.substring(0,e),this.format),n=at.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&&Je.throwArgumentError("invalid byte width","width",e);return Ue(He.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return st.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||function(e){return null!=e&&(He.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Oe(e)||"bigint"==typeof e||Se(e))}(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),st.fromString(rt(e,t),it.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=it.from(t),n=nt(e,r.decimals);!r.signed&&n.lt(Ye)&&Ze("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=Ue(i,r.width/8));const s=rt(n,r.decimals);return new st($e,i,s,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=it.from(t);if(ke(e).length>r.width/8)throw new Error("overflow");let n=He.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),s=rt(n,r.decimals);return new st($e,i,s,r)}static from(e,t){if("string"==typeof e)return st.fromString(e,t);if(Se(e))return st.fromBytes(e,t);try{return st.fromValue(e,0,t)}catch(e){if(e.code!==be.errors.INVALID_ARGUMENT)throw e}return Je.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const ot=st.from(1),at=st.from("0.5");var ut=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))};const ct=new be("properties/5.7.0");function ft(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function lt(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 dt(e){return ut(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 ht(e){const t={};for(const r in e)t[r]=e[r];return t}const pt={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function gt(e){if(null==e||pt[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;r<t.length;r++){let n=null;try{n=e[t[r]]}catch(e){continue}if(!gt(n))return!1}return!0}return ct.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function mt(e){if(gt(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>yt(e))));if("object"==typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&ft(t,r,yt(n))}return t}return ct.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function yt(e){return mt(e)}class bt{constructor(e){for(const t in e)this[t]=yt(e[t])}}const vt="abi/5.7.0",wt=new be(vt),_t={};let Et={calldata:!0,memory:!0,storage:!0},At={calldata:!0,memory:!0};function St(e,t){if("bytes"===e||"string"===e){if(Et[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&At[t])return!0;return(Et[t]||"payable"===t)&&wt.throwArgumentError("invalid modifier","name",t),!1}function kt(e,t){for(let r in t)ft(e,r,t[r])}const xt=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Tt=new RegExp(/^(.*)\[([0-9]*)\]$/);class Rt{constructor(e,t){e!==_t&&wt.throwError("use fromString",be.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),kt(this,t);let r=this.type.match(Tt);kt(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:Rt.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=xt.sighash),xt[e]||wt.throwArgumentError("invalid format type","format",e),e===xt.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!==xt.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===xt.full?", ":",")+")"):t+=this.type,e!==xt.sighash&&(!0===this.indexed&&(t+=" indexed"),e===xt.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return"string"==typeof e?Rt.fromString(e,t):Rt.fromObject(e)}static fromObject(e){return Rt.isParamType(e)?e:new Rt(_t,{name:e.name||null,type:Dt(e.type),indexed:null==e.indexed?null:!!e.indexed,components:e.components?e.components.map(Rt.fromObject):null})}static fromString(e,t){return r=function(e,t){let r=e;function n(t){wt.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 s={type:"",name:"",state:{allowType:!0}},o=s;for(let r=0;r<e.length;r++){let s=e[r];switch(s){case"(":o.state.allowType&&""===o.type?o.type="tuple":o.state.allowParams||n(r),o.state.allowType=!1,o.type=Dt(o.type),o.components=[i(o)],o=o.components[0];break;case")":delete o.state,"indexed"===o.name&&(t||n(r),o.indexed=!0,o.name=""),St(o.type,o.name)&&(o.name=""),o.type=Dt(o.type);let e=o;o=o.parent,o||n(r),delete e.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,"indexed"===o.name&&(t||n(r),o.indexed=!0,o.name=""),St(o.type,o.name)&&(o.name=""),o.type=Dt(o.type);let a=i(o.parent);o.parent.components.push(a),delete o.parent,o=a;break;case" ":o.state.allowType&&""!==o.type&&(o.type=Dt(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&("indexed"===o.name?(t||n(r),o.indexed&&n(r),o.indexed=!0,o.name=""):St(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||n(r),o.type+=s,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||n(r),o.type+=s,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=s,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=s,delete o.state.allowArray):o.state.readArray?o.type+=s:n(r)}}return o.parent&&wt.throwArgumentError("unexpected eof","param",e),delete s.state,"indexed"===o.name?(t||n(r.length-7),o.indexed&&n(r.length-7),o.indexed=!0,o.name=""):St(o.type,o.name)&&(o.name=""),s.type=Dt(s.type),s}(e,!!t),Rt.fromObject({name:r.name,type:r.type,indexed:r.indexed,components:r.components});var r}static isParamType(e){return!(null==e||!e._isParamType)}}function Ot(e,t){return function(e){e=e.trim();let t=[],r="",n=0;for(let i=0;i<e.length;i++){let s=e[i];","===s&&0===n?(t.push(r),r=""):(r+=s,"("===s?n++:")"===s&&(n--,-1===n&&wt.throwArgumentError("unbalanced parenthesis","value",e)))}r&&t.push(r);return t}(e).map((e=>Rt.fromString(e,t)))}class It{constructor(e,t){e!==_t&&wt.throwError("use a static from method",be.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),kt(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return It.isFragment(e)?e:"string"==typeof e?It.fromString(e):It.fromObject(e)}static fromObject(e){if(It.isFragment(e))return e;switch(e.type){case"function":return Ut.fromObject(e);case"event":return Mt.fromObject(e);case"constructor":return Bt.fromObject(e);case"error":return jt.fromObject(e);case"fallback":case"receive":return null}return wt.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]?Mt.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Ut.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?Bt.fromString(e.trim()):"error"===e.split(" ")[0]?jt.fromString(e.substring(5).trim()):wt.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}}class Mt extends It{format(e){if(e||(e=xt.sighash),xt[e]||wt.throwArgumentError("invalid format type","format",e),e===xt.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!==xt.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===xt.full?", ":",")+") ",e!==xt.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return"string"==typeof e?Mt.fromString(e):Mt.fromObject(e)}static fromObject(e){if(Mt.isEventFragment(e))return e;"event"!==e.type&&wt.throwArgumentError("invalid event object","value",e);const t={name:qt(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(Rt.fromObject):[],type:"event"};return new Mt(_t,t)}static fromString(e){let t=e.match(zt);t||wt.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:wt.warn("unknown modifier: "+e)}})),Mt.fromObject({name:t[1].trim(),anonymous:r,inputs:Ot(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}}function Pt(e,t){t.gas=null;let r=e.split("@");return 1!==r.length?(r.length>2&&wt.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||wt.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=He.from(r[1]),r[0]):e}function Nt(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 Ct(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&&wt.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&wt.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||wt.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&&wt.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&&wt.throwArgumentError("unable to determine stateMutability","value",e),t}class Bt extends It{format(e){if(e||(e=xt.sighash),xt[e]||wt.throwArgumentError("invalid format type","format",e),e===xt.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===xt.sighash&&wt.throwError("cannot format a constructor for sighash",be.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===xt.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}static from(e){return"string"==typeof e?Bt.fromString(e):Bt.fromObject(e)}static fromObject(e){if(Bt.isConstructorFragment(e))return e;"constructor"!==e.type&&wt.throwArgumentError("invalid constructor object","value",e);let t=Ct(e);t.constant&&wt.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(Rt.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?He.from(e.gas):null};return new Bt(_t,r)}static fromString(e){let t={type:"constructor"},r=(e=Pt(e,t)).match(zt);return r&&"constructor"===r[1].trim()||wt.throwArgumentError("invalid constructor string","value",e),t.inputs=Ot(r[2].trim(),!1),Nt(r[3].trim(),t),Bt.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}}class Ut extends Bt{format(e){if(e||(e=xt.sighash),xt[e]||wt.throwArgumentError("invalid format type","format",e),e===xt.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!==xt.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===xt.full?", ":",")+") ",e!==xt.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?Ut.fromString(e):Ut.fromObject(e)}static fromObject(e){if(Ut.isFunctionFragment(e))return e;"function"!==e.type&&wt.throwArgumentError("invalid function object","value",e);let t=Ct(e);const r={type:e.type,name:qt(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(Rt.fromObject):[],outputs:e.outputs?e.outputs.map(Rt.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?He.from(e.gas):null};return new Ut(_t,r)}static fromString(e){let t={type:"function"},r=(e=Pt(e,t)).split(" returns ");r.length>2&&wt.throwArgumentError("invalid function string","value",e);let n=r[0].match(zt);if(n||wt.throwArgumentError("invalid function signature","value",e),t.name=n[1].trim(),t.name&&qt(t.name),t.inputs=Ot(n[2],!1),Nt(n[3].trim(),t),r.length>1){let n=r[1].match(zt);""==n[1].trim()&&""==n[3].trim()||wt.throwArgumentError("unexpected tokens","value",e),t.outputs=Ot(n[2],!1)}else t.outputs=[];return Ut.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}}function Lt(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||wt.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}class jt extends It{format(e){if(e||(e=xt.sighash),xt[e]||wt.throwArgumentError("invalid format type","format",e),e===xt.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==xt.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===xt.full?", ":",")+") ",t.trim()}static from(e){return"string"==typeof e?jt.fromString(e):jt.fromObject(e)}static fromObject(e){if(jt.isErrorFragment(e))return e;"error"!==e.type&&wt.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:qt(e.name),inputs:e.inputs?e.inputs.map(Rt.fromObject):[]};return Lt(new jt(_t,t))}static fromString(e){let t={type:"error"},r=e.match(zt);return r||wt.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&qt(t.name),t.inputs=Ot(r[2],!1),Lt(jt.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}}function Dt(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const Ft=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function qt(e){return e&&e.match(Ft)||wt.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const zt=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Kt=new be(vt);class Ht{constructor(e,t,r,n){this.name=e,this.type=t,this.localName=r,this.dynamic=n}_throwError(e,t){Kt.throwArgumentError(e,this.localName,t)}}class Gt{constructor(e){ft(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return Ce(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(xe(e._data))}writeBytes(e){let t=ke(e);const r=t.length%this.wordSize;return r&&(t=xe([t,this._padding.slice(r)])),this._writeData(t)}_getValue(e){let t=ke(He.from(e));return t.length>this.wordSize&&Kt.throwError("value out-of-bounds",be.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=xe([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 Wt{constructor(e,t,r,n){ft(this,"_data",ke(e)),ft(this,"wordSize",t||32),ft(this,"_coerceFunc",r),ft(this,"allowLoose",n),this._offset=0}get data(){return Me(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):Wt.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:Kt.throwError("data out-of-bounds",be.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(e){return new Wt(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 He.from(this.readBytes(this.wordSize))}}var Vt={exports:{}};
2
+ /**
3
+ * [js-sha3]{@link https://github.com/emn178/js-sha3}
4
+ *
5
+ * @version 0.8.0
6
+ * @author Chen, Yi-Cyuan [emn178@gmail.com]
7
+ * @copyright Chen, Yi-Cyuan 2015-2018
8
+ * @license MIT
9
+ */!function(e){!function(){var t="input is invalid type",n="object"==typeof window,i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&"object"==typeof self;!i.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?i=r:s&&(i=self);var o=!i.JS_SHA3_NO_COMMON_JS&&e.exports,a=!i.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,u="0123456789abcdef".split(""),c=[4,1024,262144,67108864],f=[0,8,16,24],l=[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"],g={128:168,256:136};!i.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!a||!i.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 m=function(e,t,r){return function(n){return new M(e,t,e).update(n)[r]()}},y=function(e,t,r){return function(n,i){return new M(e,t,i).update(n)[r]()}},b=function(e,t,r){return function(t,n,i,s){return A["cshake"+e].update(t,n,i,s)[r]()}},v=function(e,t,r){return function(t,n,i,s){return A["kmac"+e].update(t,n,i,s)[r]()}},w=function(e,t,r,n){for(var i=0;i<p.length;++i){var s=p[i];e[s]=t(r,n,s)}return e},_=function(e,t){var r=m(e,t,"hex");return r.create=function(){return new M(e,t,e)},r.update=function(e){return r.create().update(e)},w(r,m,e,t)},E=[{name:"keccak",padding:[1,256,65536,16777216],bits:d,createMethod:_},{name:"sha3",padding:[6,1536,393216,100663296],bits:d,createMethod:_},{name:"shake",padding:[31,7936,2031616,520093696],bits:h,createMethod:function(e,t){var r=y(e,t,"hex");return r.create=function(r){return new M(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},w(r,y,e,t)}},{name:"cshake",padding:c,bits:h,createMethod:function(e,t){var r=g[e],n=b(e,0,"hex");return n.create=function(n,i,s){return i||s?new M(e,t,n).bytepad([i,s],r):A["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},w(n,b,e,t)}},{name:"kmac",padding:c,bits:h,createMethod:function(e,t){var r=g[e],n=v(e,0,"hex");return n.create=function(n,i,s){return new P(e,t,i).bytepad(["KMAC",s],r).bytepad([n],r)},n.update=function(e,t,r,i){return n.create(e,r,i).update(t)},w(n,v,e,t)}}],A={},S=[],k=0;k<E.length;++k)for(var x=E[k],T=x.bits,R=0;R<T.length;++R){var O=x.name+"_"+T[R];if(S.push(O),A[O]=x.createMethod(T[R],x.padding),"sha3"!==x.name){var I=x.name+T[R];S.push(I),A[I]=A[O]}}function M(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>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 P(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(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);r=!0}for(var i,s,o=this.blocks,u=this.byteCount,c=e.length,l=this.blockCount,d=0,h=this.s;d<c;){if(this.reset)for(this.reset=!1,o[0]=this.block,i=1;i<l+1;++i)o[i]=0;if(r)for(i=this.start;d<c&&i<u;++d)o[i>>2]|=e[d]<<f[3&i++];else for(i=this.start;d<c&&i<u;++d)(s=e.charCodeAt(d))<128?o[i>>2]|=s<<f[3&i++]:s<2048?(o[i>>2]|=(192|s>>6)<<f[3&i++],o[i>>2]|=(128|63&s)<<f[3&i++]):s<55296||s>=57344?(o[i>>2]|=(224|s>>12)<<f[3&i++],o[i>>2]|=(128|s>>6&63)<<f[3&i++],o[i>>2]|=(128|63&s)<<f[3&i++]):(s=65536+((1023&s)<<10|1023&e.charCodeAt(++d)),o[i>>2]|=(240|s>>18)<<f[3&i++],o[i>>2]|=(128|s>>12&63)<<f[3&i++],o[i>>2]|=(128|s>>6&63)<<f[3&i++],o[i>>2]|=(128|63&s)<<f[3&i++]);if(this.lastByteIndex=i,i>=u){for(this.start=i-u,this.block=o[l],i=0;i<l;++i)h[i]^=o[i];N(h),this.reset=!0}else this.start=i}return this},M.prototype.encode=function(e,t){var r=255&e,n=1,i=[r];for(r=255&(e>>=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(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);r=!0}var i=0,s=e.length;if(r)i=s;else for(var o=0;o<e.length;++o){var u=e.charCodeAt(o);u<128?i+=1:u<2048?i+=2:u<55296||u>=57344?i+=3:(u=65536+((1023&u)<<10|1023&e.charCodeAt(++o)),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<e.length;++n)r+=this.encodeString(e[n]);var i=t-r%t,s=[];return s.length=i,this.update(s),this},M.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];N(n)}},M.prototype.toString=M.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,s=0,o=0,a="";o<n;){for(s=0;s<t&&o<n;++s,++o)e=r[s],a+=u[e>>4&15]+u[15&e]+u[e>>12&15]+u[e>>8&15]+u[e>>20&15]+u[e>>16&15]+u[e>>28&15]+u[e>>24&15];o%t==0&&(N(r),s=0)}return i&&(e=r[s],a+=u[e>>4&15]+u[15&e],i>1&&(a+=u[e>>12&15]+u[e>>8&15]),i>2&&(a+=u[e>>20&15]+u[e>>16&15])),a},M.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,s=0,o=0,a=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var u=new Uint32Array(e);o<n;){for(s=0;s<t&&o<n;++s,++o)u[o]=r[s];o%t==0&&N(r)}return i&&(u[s]=r[s],e=e.slice(0,a)),e},M.prototype.buffer=M.prototype.arrayBuffer,M.prototype.digest=M.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,s=this.extraBytes,o=0,a=0,u=[];a<i;){for(o=0;o<r&&a<i;++o,++a)e=a<<2,t=n[o],u[e]=255&t,u[e+1]=t>>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;a%r==0&&N(n)}return s&&(e=a<<2,t=n[o],u[e]=255&t,s>1&&(u[e+1]=t>>8&255),s>2&&(u[e+2]=t>>16&255)),u},P.prototype=new M,P.prototype.finalize=function(){return this.encode(this.outputBits,!0),M.prototype.finalize.call(this)};var N=function(e){var t,r,n,i,s,o,a,u,c,f,d,h,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O,I,M,P,N,C,B,U,L,j,D,F,q,z,K,H,G,W,V,X,J,$,Y,Q,Z,ee,te,re,ne,ie,se,oe,ae,ue,ce,fe;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],s=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],c=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])^(o<<1|a>>>31),r=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|o>>>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^(u<<1|c>>>31),r=s^(c<<1|u>>>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=o^(f<<1|d>>>31),r=a^(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=u^(h<<1|p>>>31),r=c^(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|s>>>31),r=d^(s<<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,g=e[0],m=e[1],V=e[11]<<4|e[10]>>>28,X=e[10]<<4|e[11]>>>28,O=e[20]<<3|e[21]>>>29,I=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ue=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,H=e[41]<<18|e[40]>>>14,B=e[2]<<1|e[3]>>>31,U=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,b=e[12]<<12|e[13]>>>20,J=e[22]<<10|e[23]>>>22,$=e[23]<<10|e[22]>>>22,M=e[33]<<13|e[32]>>>19,P=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,fe=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,Q=e[35]<<15|e[34]>>>17,N=e[45]<<29|e[44]>>>3,C=e[44]<<29|e[45]>>>3,k=e[6]<<28|e[7]>>>4,x=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,D=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,_=e[36]<<21|e[37]>>>11,E=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,G=e[8]<<27|e[9]>>>5,W=e[9]<<27|e[8]>>>5,T=e[18]<<20|e[19]>>>12,R=e[19]<<20|e[18]>>>12,se=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,q=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,A=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=g^~y&v,e[1]=m^~b&w,e[10]=k^~T&O,e[11]=x^~R&I,e[20]=B^~L&D,e[21]=U^~j&F,e[30]=G^~V&J,e[31]=W^~X&$,e[40]=te^~ne&se,e[41]=re^~ie&oe,e[2]=y^~v&_,e[3]=b^~w&E,e[12]=T^~O&M,e[13]=R^~I&P,e[22]=L^~D&q,e[23]=j^~F&z,e[32]=V^~J&Y,e[33]=X^~$&Q,e[42]=ne^~se&ae,e[43]=ie^~oe&ue,e[4]=v^~_&A,e[5]=w^~E&S,e[14]=O^~M&N,e[15]=I^~P&C,e[24]=D^~q&K,e[25]=F^~z&H,e[34]=J^~Y&Z,e[35]=$^~Q&ee,e[44]=se^~ae&ce,e[45]=oe^~ue&fe,e[6]=_^~A&g,e[7]=E^~S&m,e[16]=M^~N&k,e[17]=P^~C&x,e[26]=q^~K&B,e[27]=z^~H&U,e[36]=Y^~Z&G,e[37]=Q^~ee&W,e[46]=ae^~ce&te,e[47]=ue^~fe&re,e[8]=A^~g&y,e[9]=S^~m&b,e[18]=N^~k&T,e[19]=C^~x&R,e[28]=K^~B&L,e[29]=H^~U&j,e[38]=Z^~G&V,e[39]=ee^~W&X,e[48]=ce^~te&ne,e[49]=fe^~re&ie,e[0]^=l[n],e[1]^=l[n+1]};if(o)e.exports=A;else for(k=0;k<S.length;++k)i[S[k]]=A[S[k]]}()}(Vt);var Xt=n(Vt.exports);function Jt(e){return"0x"+Xt.keccak_256(ke(e))}const $t=new be("rlp/5.7.0");function Yt(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function Qt(e,t,r){let n=0;for(let i=0;i<r;i++)n=256*n+e[t+i];return n}function Zt(e){if(Array.isArray(e)){let t=[];if(e.forEach((function(e){t=t.concat(Zt(e))})),t.length<=55)return t.unshift(192+t.length),t;const r=Yt(t.length);return r.unshift(247+r.length),r.concat(t)}Ee(e)||$t.throwArgumentError("RLP object must be BytesLike","object",e);const t=Array.prototype.slice.call(ke(e));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const r=Yt(t.length);return r.unshift(183+r.length),r.concat(t)}function er(e){return Me(Zt(e))}function tr(e,t,r,n){const i=[];for(;r<t+1+n;){const s=rr(e,r);i.push(s.result),(r+=s.consumed)>t+1+n&&$t.throwError("child data too short",be.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function rr(e,t){if(0===e.length&&$t.throwError("data too short",be.errors.BUFFER_OVERRUN,{}),e[t]>=248){const r=e[t]-247;t+1+r>e.length&&$t.throwError("data short segment too short",be.errors.BUFFER_OVERRUN,{});const n=Qt(e,t+1,r);return t+1+r+n>e.length&&$t.throwError("data long segment too short",be.errors.BUFFER_OVERRUN,{}),tr(e,t,t+1+r,r+n)}if(e[t]>=192){const r=e[t]-192;return t+1+r>e.length&&$t.throwError("data array too short",be.errors.BUFFER_OVERRUN,{}),tr(e,t,t+1,r)}if(e[t]>=184){const r=e[t]-183;t+1+r>e.length&&$t.throwError("data array too short",be.errors.BUFFER_OVERRUN,{});const n=Qt(e,t+1,r);t+1+r+n>e.length&&$t.throwError("data array too short",be.errors.BUFFER_OVERRUN,{});return{consumed:1+r+n,result:Me(e.slice(t+1+r,t+1+r+n))}}if(e[t]>=128){const r=e[t]-128;t+1+r>e.length&&$t.throwError("data too short",be.errors.BUFFER_OVERRUN,{});return{consumed:1+r,result:Me(e.slice(t+1,t+1+r))}}return{consumed:1,result:Me(e[t])}}function nr(e){const t=ke(e),r=rr(t,0);return r.consumed!==t.length&&$t.throwArgumentError("invalid rlp data","data",e),r.result}const ir=new be("address/5.7.0");function sr(e){Oe(e,20)||ir.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=ke(Jt(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 or={};for(let e=0;e<10;e++)or[String(e)]=String(e);for(let e=0;e<26;e++)or[String.fromCharCode(65+e)]=String(10+e);const ar=Math.floor(function(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}(9007199254740991));function ur(e){let t=null;if("string"!=typeof e&&ir.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=sr(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&ir.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)!==function(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((e=>or[e])).join("");for(;t.length>=ar;){let e=t.substring(0,ar);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}(e)&&ir.throwArgumentError("bad icap checksum","address",e),r=e.substring(4),t=new De(r,36).toString(16);t.length<40;)t="0"+t;t=sr("0x"+t)}else ir.throwArgumentError("invalid address","address",e);var r;return t}function cr(e){let t=null;try{t=ur(e.from)}catch(t){ir.throwArgumentError("missing from address","transaction",e)}return ur(Ne(Jt(er([t,Te(ke(He.from(e.nonce).toHexString()))])),12))}class fr extends Ht{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=ur(t)}catch(e){this._throwError(e.message,t)}return e.writeValue(t)}decode(e){return ur(Ue(e.readValue().toHexString(),20))}}class lr extends Ht{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 dr=new be(vt);function hr(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||dr.throwError("cannot encode object for signature with missing names",be.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:r}),e[n]&&dr.throwError("cannot encode object for signature with duplicate names",be.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:r}),e[n]=!0,r[n]}))}else dr.throwArgumentError("invalid tuple value","tuple",r);t.length!==n.length&&dr.throwArgumentError("types/value length mismatch","tuple",r);let i=new Gt(e.wordSize),s=new Gt(e.wordSize),o=[];t.forEach(((e,t)=>{let r=n[t];if(e.dynamic){let t=s.length;e.encode(s,r);let n=i.writeUpdatableValue();o.push((e=>{n(e+t)}))}else e.encode(i,r)})),o.forEach((e=>{e(i.length)}));let a=e.appendWriter(i);return a+=e.appendWriter(s),a}function pr(e,t){let r=[],n=e.subReader(0);t.forEach((t=>{let i=null;if(t.dynamic){let r=e.readValue(),s=n.subReader(r.toNumber());try{i=t.decode(s)}catch(e){if(e.code===be.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===be.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 s=r[t];s instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw s}}):r[n]=s}));for(let e=0;e<r.length;e++){const t=r[e];t instanceof Error&&Object.defineProperty(r,e,{enumerable:!0,get:()=>{throw t}})}return Object.freeze(r)}class gr extends Ht{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;r<this.length;r++)t.push(e);return t}encode(e,t){Array.isArray(t)||this._throwError("expected array value",t);let r=this.length;-1===r&&(r=t.length,e.writeValue(t.length)),dr.checkArgumentCount(t.length,r,"coder array"+(this.localName?" "+this.localName:""));let n=[];for(let e=0;e<t.length;e++)n.push(this.coder);return hr(e,n,t)}decode(e){let t=this.length;-1===t&&(t=e.readValue().toNumber(),32*t>e._data.length&&dr.throwError("insufficient data length",be.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let r=[];for(let e=0;e<t;e++)r.push(new lr(this.coder));return e.coerce(this.name,pr(e,r))}}class mr extends Ht{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){return e.writeValue(t?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}}class yr extends Ht{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=ke(t);let r=e.writeValue(t.length);return r+=e.writeBytes(t),r}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}}class br extends yr{constructor(e){super("bytes",e)}decode(e){return e.coerce(this.name,Me(super.decode(e)))}}class vr extends Ht{constructor(e,t){let r="bytes"+String(e);super(r,r,t,!1),this.size=e}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(e,t){let r=ke(t);return r.length!==this.size&&this._throwError("incorrect data length",t),e.writeBytes(r)}decode(e){return e.coerce(this.name,Me(e.readBytes(this.size)))}}class wr extends Ht{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return null!=t&&this._throwError("not null",t),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}}const _r="0x0000000000000000000000000000000000000000",Er=He.from(-1),Ar=He.from(0),Sr=He.from(1),kr=He.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class xr extends Ht{constructor(e,t,r){const n=(t?"int":"uint")+8*e;super(n,n,r,!1),this.size=e,this.signed=t}defaultValue(){return 0}encode(e,t){let r=He.from(t),n=kr.mask(8*e.wordSize);if(this.signed){let e=n.mask(8*this.size-1);(r.gt(e)||r.lt(e.add(Sr).mul(Er)))&&this._throwError("value out-of-bounds",t)}else(r.lt(Ar)||r.gt(n.mask(8*this.size)))&&this._throwError("value out-of-bounds",t);return r=r.toTwos(8*this.size).mask(8*this.size),this.signed&&(r=r.fromTwos(8*this.size).toTwos(8*e.wordSize)),e.writeValue(r)}decode(e){let t=e.readValue().mask(8*this.size);return this.signed&&(t=t.fromTwos(8*this.size)),e.coerce(this.name,t)}}const Tr=new be("strings/5.7.0");var Rr,Or;function Ir(e,t,r,n,i){if(e===Or.BAD_PREFIX||e===Or.UNEXPECTED_CONTINUE){let e=0;for(let n=t+1;n<r.length&&r[n]>>6==2;n++)e++;return e}return e===Or.OVERRUN?r.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(Rr||(Rr={})),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"}(Or||(Or={}));const Mr=Object.freeze({error:function(e,t,r,n,i){return Tr.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",r)},ignore:Ir,replace:function(e,t,r,n,i){return e===Or.OVERLONG?(n.push(i),0):(n.push(65533),Ir(e,t,r))}});function Pr(e,t){null==t&&(t=Mr.error),e=ke(e);const r=[];let n=0;for(;n<e.length;){const i=e[n++];if(i>>7==0){r.push(i);continue}let s=null,o=null;if(192==(224&i))s=1,o=127;else if(224==(240&i))s=2,o=2047;else{if(240!=(248&i)){n+=t(128==(192&i)?Or.UNEXPECTED_CONTINUE:Or.BAD_PREFIX,n-1,e,r);continue}s=3,o=65535}if(n-1+s>=e.length){n+=t(Or.OVERRUN,n-1,e,r);continue}let a=i&(1<<8-s-1)-1;for(let i=0;i<s;i++){let i=e[n];if(128!=(192&i)){n+=t(Or.MISSING_CONTINUE,n,e,r),a=null;break}a=a<<6|63&i,n++}null!==a&&(a>1114111?n+=t(Or.OUT_OF_RANGE,n-1-s,e,r,a):a>=55296&&a<=57343?n+=t(Or.UTF16_SURROGATE,n-1-s,e,r,a):a<=o?n+=t(Or.OVERLONG,n-1-s,e,r,a):r.push(a))}return r}function Nr(e,t=Rr.current){t!=Rr.current&&(Tr.checkNormalize(),e=e.normalize(t));let r=[];for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<128)r.push(n);else if(n<2048)r.push(n>>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 s=65536+((1023&n)<<10)+(1023&i);r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(63&s|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return ke(r)}function Cr(e,t){return Pr(e,t).map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("")}class Br extends yr{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,Nr(t))}decode(e){return Cr(super.decode(e))}}class Ur extends Ht{constructor(e,t){let r=!1;const n=[];e.forEach((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 hr(e,this.coders,t)}decode(e){return e.coerce(this.name,pr(e,this.coders))}}const Lr=new be(vt),jr=new RegExp(/^bytes([0-9]*)$/),Dr=new RegExp(/^(u?int)([0-9]*)$/);const Fr=new class{constructor(e){ft(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new fr(e.name);case"bool":return new mr(e.name);case"string":return new Br(e.name);case"bytes":return new br(e.name);case"array":return new gr(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Ur((e.components||[]).map((e=>this._getCoder(e))),e.name);case"":return new wr(e.name)}let t=e.type.match(Dr);if(t){let r=parseInt(t[2]||"256");return(0===r||r>256||r%8!=0)&&Lr.throwArgumentError("invalid "+t[1]+" bit length","param",e),new xr(r/8,"int"===t[1],e.name)}if(t=e.type.match(jr),t){let r=parseInt(t[1]);return(0===r||r>32)&&Lr.throwArgumentError("invalid bytes length","param",e),new vr(r,e.name)}return Lr.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new Wt(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new Gt(this._getWordSize())}getDefaultValue(e){const t=e.map((e=>this._getCoder(Rt.from(e))));return new Ur(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&Lr.throwError("types/values length mismatch",be.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map((e=>this._getCoder(Rt.from(e)))),n=new Ur(r,"_"),i=this._getWriter();return n.encode(i,t),i.data}decode(e,t,r){const n=e.map((e=>this._getCoder(Rt.from(e))));return new Ur(n,"_").decode(this._getReader(ke(t),r))}};function qr(e){return Jt(Nr(e))}const zr="hash/5.7.0";function Kr(e){e=atob(e);const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return ke(t)}function Hr(e){e=ke(e);let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Gr(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 Wr(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,s=[0,1];for(let e=1;e<n;e++)s.push(i+=r());let o=r(),a=t;t+=o;let u=0,c=0;function f(){return 0==u&&(c=c<<8|e[t++],u=8),c>>--u&1}const l=Math.pow(2,31),d=l>>>1,h=d>>1,p=l-1;let g=0;for(let e=0;e<31;e++)g=g<<1|f();let m=[],y=0,b=l;for(;;){let e=Math.floor(((g-y+1)*i-1)/b),t=0,r=n;for(;r-t>1;){let n=t+r>>>1;e<s[n]?r=n:t=n}if(0==t)break;m.push(t);let o=y+Math.floor(b*s[t]/i),a=y+Math.floor(b*s[t+1]/i)-1;for(;0==((o^a)&d);)g=g<<1&p|f(),o=o<<1&p,a=a<<1&p|1;for(;o&~a&h;)g=g&d|g<<1&p>>>1|f(),o=o<<1^d,a=(a^d)<<1|d|1;y=o,b=1+a-o}let v=n-4;return m.map((t=>{switch(t-v){case 3:return v+65792+(e[a++]<<16|e[a++]<<8|e[a++]);case 2:return v+256+(e[a++]<<8|e[a++]);case 1:return v+e[a++];default:return t-1}}))}(e))}function Vr(e){return 1&e?~e>>1:e>>1}function Xr(e,t){let r=Array(e);for(let n=0,i=-1;n<e;n++)r[n]=i+=1+t();return r}function Jr(e,t){let r=Array(e);for(let n=0,i=0;n<e;n++)r[n]=i+=Vr(t());return r}function $r(e,t){let r=Xr(e(),e),n=e(),i=Xr(n,e),s=function(e,t){let r=Array(e);for(let n=0;n<e;n++)r[n]=1+t();return r}(n,e);for(let e=0;e<n;e++)for(let t=0;t<s[e];t++)r.push(i[e]+t);return t?r.map((e=>t[e])):r}function Yr(e,t,r){let n=Array(e).fill(void 0).map((()=>[]));for(let i=0;i<t;i++)Jr(e,r).forEach(((e,t)=>n[t].push(e)));return n}function Qr(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 Gr(Yr(i.length,1+e,t).map(((e,t)=>{const s=e[0],o=e.slice(1);return Array(i[t]).fill(void 0).map(((e,t)=>{let i=t*n;return[s+t*r,o.map((e=>e+i))]}))})))}function Zr(e,t){return Yr(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}const en=Wr(Kr("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==")),tn=new Set($r(en)),rn=new Set($r(en)),nn=function(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(Qr(r,e))}for(;;){let r=e()-1;if(r<0)break;t.push(Zr(r,e))}return function(e){const t={};for(let r=0;r<e.length;r++){const n=e[r];t[n[0]]=n[1]}return t}(Gr(t))}(en),sn=function(e){let t=$r(e).sort(((e,t)=>e-t));return function r(){let n=[];for(;;){let i=$r(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(),s=i%3;i=i/3|0;let o=!!(1&i);return i>>=1,{branches:n,valid:s,fe0f:o,save:1==i,check:2==i}}()}(en),on=45,an=95;function un(e){return function(e,t=Rr.current){return Pr(Nr(e,t))}(e)}function cn(e){return e.filter((e=>65039!=e))}function fn(e){for(let t of e.split(".")){let e=un(t);try{for(let t=e.lastIndexOf(an)-1;t>=0;t--)if(e[t]!==an)throw new Error("underscore only allowed at start");if(e.length>=4&&e.every((e=>e<128))&&e[2]===on&&e[3]===on)throw new Error("invalid label extension")}catch(e){throw new Error(`Invalid label "${t}": ${e.message}`)}}return e}function ln(e){return fn(function(e,t){let r=un(e).reverse(),n=[];for(;r.length;){let e=dn(r);if(e){n.push(...t(e));continue}let i=r.pop();if(tn.has(i)){n.push(i);continue}if(rn.has(i))continue;let s=nn[i];if(!s)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);n.push(...s)}return fn(function(e){return e.normalize("NFC")}(String.fromCodePoint(...n)))}(e,cn))}function dn(e,t){var r;let n,i,s=sn,o=[],a=e.length;for(t&&(t.length=0);a;){let u=e[--a];if(s=null===(r=s.branches.find((e=>e.set.has(u))))||void 0===r?void 0:r.node,!s)break;if(s.save)i=u;else if(s.check&&u===i)break;o.push(u),s.fe0f&&(o.push(65039),a>0&&65039==e[a-1]&&a--),s.valid&&(n=o.slice(),2==s.valid&&n.splice(1,1),t&&t.push(...e.slice(a).reverse()),e.length=a)}return n}const hn=new be(zr),pn=new Uint8Array(32);function gn(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function mn(e){const t=Nr(ln(e)),r=[];if(0===e.length)return r;let n=0;for(let e=0;e<t.length;e++){46===t[e]&&(r.push(gn(t.slice(n,e))),n=e+1)}if(n>=t.length)throw new Error("invalid ENS name; empty component");return r.push(gn(t.slice(n))),r}function yn(e){"string"!=typeof e&&hn.throwArgumentError("invalid ENS name; not a string","name",e);let t=pn;const r=mn(e);for(;r.length;)t=Jt(xe([t,Jt(r.pop())]));return Me(t)}function bn(e){return Me(xe(mn(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"}pn.fill(0);var vn=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))};const wn=new be(zr),_n=new Uint8Array(32);_n.fill(0);const En=He.from(-1),An=He.from(0),Sn=He.from(1),kn=He.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const xn=Ue(Sn.toHexString(),32),Tn=Ue(An.toHexString(),32),Rn={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},On=["name","version","chainId","verifyingContract","salt"];function In(e){return function(t){return"string"!=typeof t&&wn.throwArgumentError(`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const Mn={name:In("name"),version:In("version"),chainId:function(e){try{return He.from(e).toString()}catch(e){}return wn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return ur(e).toLowerCase()}catch(e){}return wn.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{const t=ke(e);if(32!==t.length)throw new Error("bad length");return Me(t)}catch(e){}return wn.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function Pn(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))&&wn.throwArgumentError("invalid numeric width","type",e);const i=kn.mask(r?n-1:n),s=r?i.add(Sn).mul(En):An;return function(t){const r=He.from(t);return(r.lt(s)||r.gt(i))&&wn.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),Ue(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))&&wn.throwArgumentError("invalid bytes width","type",e),function(t){return ke(t).length!==r&&wn.throwArgumentError(`invalid length for ${e}`,"value",t),function(e){const t=ke(e),r=t.length%32;return r?Ce([t,_n.slice(r)]):Me(t)}(t)}}}switch(e){case"address":return function(e){return Ue(ur(e),32)};case"bool":return function(e){return e?xn:Tn};case"bytes":return function(e){return Jt(e)};case"string":return function(e){return qr(e)}}return null}function Nn(e,t){return`${e}(${t.map((({name:e,type:t})=>t+" "+e)).join(",")})`}class Cn{constructor(e){ft(this,"types",Object.freeze(yt(e))),ft(this,"_encoderCache",{}),ft(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((s=>{i[s.name]&&wn.throwArgumentError(`duplicate variable name ${JSON.stringify(s.name)} in ${JSON.stringify(n)}`,"types",e),i[s.name]=!0;const o=s.type.match(/^([^\x5b]*)(\x5b|$)/)[1];o===n&&wn.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",e);Pn(o)||(r[o]||wn.throwArgumentError(`unknown type ${JSON.stringify(o)}`,"types",e),r[o].push(n),t[n][o]=!0)}))}const i=Object.keys(r).filter((e=>0===r[e].length));0===i.length?wn.throwArgumentError("missing primary type","types",e):i.length>1&&wn.throwArgumentError(`ambiguous primary types or unused types: ${i.map((e=>JSON.stringify(e))).join(", ")}`,"types",e),ft(this,"primaryType",i[0]),function i(s,o){o[s]&&wn.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",e),o[s]=!0,Object.keys(t[s]).forEach((e=>{r[e]&&(i(e,o),Object.keys(o).forEach((t=>{n[t][e]=!0})))})),delete o[s]}(this.primaryType,{});for(const t in n){const r=Object.keys(n[t]);r.sort(),this._types[t]=Nn(t,e[t])+r.map((t=>Nn(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=Pn(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&&wn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t);let i=t.map(r);return this._types[e]&&(i=i.map(Jt)),Jt(Ce(i))}}const r=this.types[e];if(r){const t=qr(this._types[e]);return e=>{const n=r.map((({name:t,type:r})=>{const n=this.getEncoder(r)(e[t]);return this._types[r]?Jt(n):n}));return n.unshift(t),Ce(n)}}return wn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||wn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return Jt(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(Pn(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&&wn.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)),{}):wn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new Cn(e)}static getPrimaryType(e){return Cn.from(e).primaryType}static hashStruct(e,t,r){return Cn.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const n=Rn[r];n||wn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:n})}return t.sort(((e,t)=>On.indexOf(e.name)-On.indexOf(t.name))),Cn.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return Ce(["0x1901",Cn.hashDomain(e),Cn.from(t).hash(r)])}static hash(e,t,r){return Jt(Cn.encode(e,t,r))}static resolveNames(e,t,r,n){return vn(this,void 0,void 0,(function*(){e=ht(e);const i={};e.verifyingContract&&!Oe(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const s=Cn.from(t);s.visit(r,((e,t)=>("address"!==e||Oe(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=s.visit(r,((e,t)=>"address"===e&&i[t]?i[t]:t)),{domain:e,value:r}}))}static getPayload(e,t,r){Cn.hashDomain(e);const n={},i=[];On.forEach((t=>{const r=e[t];null!=r&&(n[t]=Mn[t](r),i.push({name:t,type:Rn[t]}))}));const s=Cn.from(t),o=ht(t);return o.EIP712Domain?wn.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):o.EIP712Domain=i,s.encode(r),{types:o,domain:n,primaryType:s.primaryType,message:s.visit(r,((e,t)=>{if(e.match(/^bytes(\d*)/))return Me(ke(t));if(e.match(/^u?int/))return He.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!=typeof t&&wn.throwArgumentError("invalid string","value",t),t}return wn.throwArgumentError("unsupported type","type",e)}))}}}const Bn=new be(vt);class Un extends bt{}class Ln extends bt{}class jn extends bt{}class Dn extends bt{static isIndexed(e){return!(!e||!e._isIndexed)}}const Fn={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function qn(e,t){const r=new Error(`deferred error during ABI decoding triggered accessing ${e}`);return r.error=t,r}class zn{constructor(e){let t=[];t="string"==typeof e?JSON.parse(e):e,ft(this,"fragments",t.map((e=>It.from(e))).filter((e=>null!=e))),ft(this,"_abiCoder",lt(new.target,"getAbiCoder")()),ft(this,"functions",{}),ft(this,"errors",{}),ft(this,"events",{}),ft(this,"structs",{}),this.fragments.forEach((e=>{let t=null;switch(e.type){case"constructor":return this.deploy?void Bn.warn("duplicate definition - constructor"):void ft(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]?Bn.warn("duplicate definition - "+r):t[r]=e})),this.deploy||ft(this,"deploy",Bt.from({payable:!1,type:"constructor"})),ft(this,"_isInterface",!0)}format(e){e||(e=xt.full),e===xt.sighash&&Bn.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map((t=>t.format(e)));return e===xt.json?JSON.stringify(t.map((e=>JSON.parse(e)))):t}static getAbiCoder(){return Fr}static getAddress(e){return ur(e)}static getSighash(e){return Ne(qr(e.format()),0,4)}static getEventTopic(e){return qr(e.format())}getFunction(e){if(Oe(e)){for(const t in this.functions)if(e===this.getSighash(t))return this.functions[t];Bn.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?Bn.throwArgumentError("no matching function","name",t):r.length>1&&Bn.throwArgumentError("multiple matching functions","name",t),this.functions[r[0]]}const t=this.functions[Ut.fromString(e).format()];return t||Bn.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(Oe(e)){const t=e.toLowerCase();for(const e in this.events)if(t===this.getEventTopic(e))return this.events[e];Bn.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?Bn.throwArgumentError("no matching event","name",t):r.length>1&&Bn.throwArgumentError("multiple matching events","name",t),this.events[r[0]]}const t=this.events[Mt.fromString(e).format()];return t||Bn.throwArgumentError("no matching event","signature",e),t}getError(e){if(Oe(e)){const t=lt(this.constructor,"getSighash");for(const r in this.errors){if(e===t(this.errors[r]))return this.errors[r]}Bn.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?Bn.throwArgumentError("no matching error","name",t):r.length>1&&Bn.throwArgumentError("multiple matching errors","name",t),this.errors[r[0]]}const t=this.errors[Ut.fromString(e).format()];return t||Bn.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 lt(this.constructor,"getSighash")(e)}getEventTopic(e){return"string"==typeof e&&(e=this.getEvent(e)),lt(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=ke(t);return Me(r.slice(0,4))!==this.getSighash(e)&&Bn.throwArgumentError(`data signature does not match error ${e.name}.`,"data",Me(r)),this._decodeParams(e.inputs,r.slice(4))}encodeErrorResult(e,t){return"string"==typeof e&&(e=this.getError(e)),Me(xe([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){"string"==typeof e&&(e=this.getFunction(e));const r=ke(t);return Me(r.slice(0,4))!==this.getSighash(e)&&Bn.throwArgumentError(`data signature does not match function ${e.name}.`,"data",Me(r)),this._decodeParams(e.inputs,r.slice(4))}encodeFunctionData(e,t){return"string"==typeof e&&(e=this.getFunction(e)),Me(xe([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){"string"==typeof e&&(e=this.getFunction(e));let r=ke(t),n=null,i="",s=null,o=null,a=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch(e){}break;case 4:{const e=Me(r.slice(0,4)),t=Fn[e];if(t)s=this._abiCoder.decode(t.inputs,r.slice(4)),o=t.name,a=t.signature,t.reason&&(n=s[0]),"Error"===o?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(s[0])}`:"Panic"===o&&(i=`; VM Exception while processing transaction: reverted with panic code ${s[0]}`);else try{const t=this.getError(e);s=this._abiCoder.decode(t.inputs,r.slice(4)),o=t.name,a=t.format()}catch(e){}break}}return Bn.throwError("call revert exception"+i,be.errors.CALL_EXCEPTION,{method:e.format(),data:Me(t),errorArgs:s,errorName:o,errorSignature:a,reason:n})}encodeFunctionResult(e,t){return"string"==typeof e&&(e=this.getFunction(e)),Me(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){"string"==typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&Bn.throwError("too many arguments for "+e.format(),be.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const n=(e,t)=>"string"===e.type?qr(t):"bytes"===e.type?Jt(Me(t)):("bool"===e.type&&"boolean"==typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=He.from(t).toHexString()),"address"===e.type&&this._abiCoder.encode(["address"],[t]),Ue(Me(t),32));for(t.forEach(((t,i)=>{let s=e.inputs[i];s.indexed?null==t?r.push(null):"array"===s.baseType||"tuple"===s.baseType?Bn.throwArgumentError("filtering with tuples or arrays not supported","contract."+s.name,t):Array.isArray(t)?r.push(t.map((e=>n(s,e)))):r.push(n(s,t)):null!=t&&Bn.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+s.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&&Bn.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach(((e,s)=>{const o=t[s];if(e.indexed)if("string"===e.type)r.push(qr(o));else if("bytes"===e.type)r.push(Jt(o));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([e.type],[o]))}else n.push(e),i.push(o)})),{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);Oe(r[0],32)&&r[0].toLowerCase()===t||Bn.throwError("fragment/topic mismatch",be.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:t,value:r[0]}),r=r.slice(1)}let n=[],i=[],s=[];e.inputs.forEach(((e,t)=>{e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(n.push(Rt.fromObject({type:"bytes32",name:e.name})),s.push(!0)):(n.push(e),s.push(!1)):(i.push(e),s.push(!1))}));let o=null!=r?this._abiCoder.decode(n,xe(r)):null,a=this._abiCoder.decode(i,t,!0),u=[],c=0,f=0;e.inputs.forEach(((e,t)=>{if(e.indexed)if(null==o)u[t]=new Dn({_isIndexed:!0,hash:null});else if(s[t])u[t]=new Dn({_isIndexed:!0,hash:o[f++]});else try{u[t]=o[f++]}catch(e){u[t]=e}else try{u[t]=a[c++]}catch(e){u[t]=e}if(e.name&&null==u[e.name]){const r=u[t];r instanceof Error?Object.defineProperty(u,e.name,{enumerable:!0,get:()=>{throw qn(`property ${JSON.stringify(e.name)}`,r)}}):u[e.name]=r}}));for(let e=0;e<u.length;e++){const t=u[e];t instanceof Error&&Object.defineProperty(u,e,{enumerable:!0,get:()=>{throw qn(`index ${e}`,t)}})}return Object.freeze(u)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new Ln({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:He.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new Un({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=Me(e);let r=this.getError(t.substring(0,10).toLowerCase());return r?new jn({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 Kn=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))};const Hn=new be("abstract-provider/5.7.0");class Gn extends bt{static isForkEvent(e){return!(!e||!e._isForkEvent)}}class Wn{constructor(){Hn.checkAbstract(new.target,Wn),ft(this,"_isProvider",!0)}getFeeData(){return Kn(this,void 0,void 0,(function*(){const{block:e,gasPrice:t}=yield dt({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=He.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)}}var Vn=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))};const Xn=new be("abstract-signer/5.7.0"),Jn=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],$n=[be.errors.INSUFFICIENT_FUNDS,be.errors.NONCE_EXPIRED,be.errors.REPLACEMENT_UNDERPRICED];class Yn{constructor(){Xn.checkAbstract(new.target,Yn),ft(this,"_isSigner",!0)}getBalance(e){return Vn(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)}))}getTransactionCount(e){return Vn(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)}))}estimateGas(e){return Vn(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const t=yield dt(this.checkTransaction(e));return yield this.provider.estimateGas(t)}))}call(e,t){return Vn(this,void 0,void 0,(function*(){this._checkProvider("call");const r=yield dt(this.checkTransaction(e));return yield this.provider.call(r,t)}))}sendTransaction(e){return Vn(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 Vn(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return Vn(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return Vn(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(e){return Vn(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)}))}checkTransaction(e){for(const t in e)-1===Jn.indexOf(t)&&Xn.throwArgumentError("invalid transaction key: "+t,"transaction",e);const t=ht(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()&&Xn.throwArgumentError("from address mismatch","transaction",e),t[0]))),t}populateTransaction(e){return Vn(this,void 0,void 0,(function*(){const t=yield dt(this.checkTransaction(e));null!=t.to&&(t.to=Promise.resolve(t.to).then((e=>Vn(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.resolveName(e);return null==t&&Xn.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||Xn.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e):Xn.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&&Xn.throwError("network does not support EIP-1559",be.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):Xn.throwError("failed to get consistent fee data",be.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($n.indexOf(e.code)>=0)throw e;return Xn.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",be.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]&&Xn.throwArgumentError("chainId address mismatch","transaction",e),t[0]))),yield dt(t)}))}_checkProvider(e){this.provider||Xn.throwError("missing provider",be.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!(!e||!e._isSigner)}}class Qn extends Yn{constructor(e,t){super(),ft(this,"address",e),ft(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then((()=>{Xn.throwError(e,be.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 Qn(this.address,e)}}var Zn={},ei={},ti=ri;function ri(e,t){if(!e)throw new Error(t||"Assertion failed")}ri.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var ni="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},ii=i(Object.freeze({__proto__:null,default:ni})),si=ti,oi=ii;function ai(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function ui(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function ci(e){return 1===e.length?"0"+e:e}function fi(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}ei.inherits=oi,ei.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<e.length;i+=2)r.push(parseInt(e[i]+e[i+1],16))}else for(var n=0,i=0;i<e.length;i++){var s=e.charCodeAt(i);s<128?r[n++]=s:s<2048?(r[n++]=s>>6|192,r[n++]=63&s|128):ai(e,i)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}else for(i=0;i<e.length;i++)r[i]=0|e[i];return r},ei.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=ci(e[r].toString(16));return t},ei.htonl=ui,ei.toHex32=function(e,t){for(var r="",n=0;n<e.length;n++){var i=e[n];"little"===t&&(i=ui(i)),r+=fi(i.toString(16))}return r},ei.zero2=ci,ei.zero8=fi,ei.join32=function(e,t,r,n){var i=r-t;si(i%4==0);for(var s=new Array(i/4),o=0,a=t;o<s.length;o++,a+=4){var u;u="big"===n?e[a]<<24|e[a+1]<<16|e[a+2]<<8|e[a+3]:e[a+3]<<24|e[a+2]<<16|e[a+1]<<8|e[a],s[o]=u>>>0}return s},ei.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n<e.length;n++,i+=4){var s=e[n];"big"===t?(r[i]=s>>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=255&s):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=255&s)}return r},ei.rotr32=function(e,t){return e>>>t|e<<32-t},ei.rotl32=function(e,t){return e<<t|e>>>32-t},ei.sum32=function(e,t){return e+t>>>0},ei.sum32_3=function(e,t,r){return e+t+r>>>0},ei.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},ei.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},ei.sum64=function(e,t,r,n){var i=e[t],s=n+e[t+1]>>>0,o=(s<n?1:0)+r+i;e[t]=o>>>0,e[t+1]=s},ei.sum64_hi=function(e,t,r,n){return(t+n>>>0<t?1:0)+e+r>>>0},ei.sum64_lo=function(e,t,r,n){return t+n>>>0},ei.sum64_4_hi=function(e,t,r,n,i,s,o,a){var u=0,c=t;return u+=(c=c+n>>>0)<t?1:0,u+=(c=c+s>>>0)<s?1:0,e+r+i+o+(u+=(c=c+a>>>0)<a?1:0)>>>0},ei.sum64_4_lo=function(e,t,r,n,i,s,o,a){return t+n+s+a>>>0},ei.sum64_5_hi=function(e,t,r,n,i,s,o,a,u,c){var f=0,l=t;return f+=(l=l+n>>>0)<t?1:0,f+=(l=l+s>>>0)<s?1:0,f+=(l=l+a>>>0)<a?1:0,e+r+i+o+u+(f+=(l=l+c>>>0)<c?1:0)>>>0},ei.sum64_5_lo=function(e,t,r,n,i,s,o,a,u,c){return t+n+s+a+c>>>0},ei.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},ei.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},ei.shr64_hi=function(e,t,r){return e>>>r},ei.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0};var li={},di=ei,hi=ti;function pi(){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}li.BlockHash=pi,pi.prototype.update=function(e,t){if(e=di.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=di.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},pi.prototype.digest=function(e){return this.update(this._pad()),hi(null===this.pending),this._digest(e)},pi.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(e<<=3,"big"===this.endian){for(var s=8;s<this.padLength;s++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=e>>>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,s=8;s<this.padLength;s++)n[i++]=0;return n};var gi={},mi={},yi=ei.rotr32;function bi(e,t,r){return e&t^~e&r}function vi(e,t,r){return e&t^e&r^t&r}function wi(e,t,r){return e^t^r}mi.ft_1=function(e,t,r,n){return 0===e?bi(t,r,n):1===e||3===e?wi(t,r,n):2===e?vi(t,r,n):void 0},mi.ch32=bi,mi.maj32=vi,mi.p32=wi,mi.s0_256=function(e){return yi(e,2)^yi(e,13)^yi(e,22)},mi.s1_256=function(e){return yi(e,6)^yi(e,11)^yi(e,25)},mi.g0_256=function(e){return yi(e,7)^yi(e,18)^e>>>3},mi.g1_256=function(e){return yi(e,17)^yi(e,19)^e>>>10};var _i=ei,Ei=li,Ai=mi,Si=_i.rotl32,ki=_i.sum32,xi=_i.sum32_5,Ti=Ai.ft_1,Ri=Ei.BlockHash,Oi=[1518500249,1859775393,2400959708,3395469782];function Ii(){if(!(this instanceof Ii))return new Ii;Ri.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}_i.inherits(Ii,Ri);var Mi=Ii;Ii.blockSize=512,Ii.outSize=160,Ii.hmacStrength=80,Ii.padLength=64,Ii.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=Si(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],s=this.h[1],o=this.h[2],a=this.h[3],u=this.h[4];for(n=0;n<r.length;n++){var c=~~(n/20),f=xi(Si(i,5),Ti(c,s,o,a),u,r[n],Oi[c]);u=a,a=o,o=Si(s,30),s=i,i=f}this.h[0]=ki(this.h[0],i),this.h[1]=ki(this.h[1],s),this.h[2]=ki(this.h[2],o),this.h[3]=ki(this.h[3],a),this.h[4]=ki(this.h[4],u)},Ii.prototype._digest=function(e){return"hex"===e?_i.toHex32(this.h,"big"):_i.split32(this.h,"big")};var Pi=ei,Ni=li,Ci=mi,Bi=ti,Ui=Pi.sum32,Li=Pi.sum32_4,ji=Pi.sum32_5,Di=Ci.ch32,Fi=Ci.maj32,qi=Ci.s0_256,zi=Ci.s1_256,Ki=Ci.g0_256,Hi=Ci.g1_256,Gi=Ni.BlockHash,Wi=[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 Vi(){if(!(this instanceof Vi))return new Vi;Gi.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Wi,this.W=new Array(64)}Pi.inherits(Vi,Gi);var Xi=Vi;Vi.blockSize=512,Vi.outSize=256,Vi.hmacStrength=192,Vi.padLength=64,Vi.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=Li(Hi(r[n-2]),r[n-7],Ki(r[n-15]),r[n-16]);var i=this.h[0],s=this.h[1],o=this.h[2],a=this.h[3],u=this.h[4],c=this.h[5],f=this.h[6],l=this.h[7];for(Bi(this.k.length===r.length),n=0;n<r.length;n++){var d=ji(l,zi(u),Di(u,c,f),this.k[n],r[n]),h=Ui(qi(i),Fi(i,s,o));l=f,f=c,c=u,u=Ui(a,d),a=o,o=s,s=i,i=Ui(d,h)}this.h[0]=Ui(this.h[0],i),this.h[1]=Ui(this.h[1],s),this.h[2]=Ui(this.h[2],o),this.h[3]=Ui(this.h[3],a),this.h[4]=Ui(this.h[4],u),this.h[5]=Ui(this.h[5],c),this.h[6]=Ui(this.h[6],f),this.h[7]=Ui(this.h[7],l)},Vi.prototype._digest=function(e){return"hex"===e?Pi.toHex32(this.h,"big"):Pi.split32(this.h,"big")};var Ji=ei,$i=Xi;function Yi(){if(!(this instanceof Yi))return new Yi;$i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Ji.inherits(Yi,$i);var Qi=Yi;Yi.blockSize=512,Yi.outSize=224,Yi.hmacStrength=192,Yi.padLength=64,Yi.prototype._digest=function(e){return"hex"===e?Ji.toHex32(this.h.slice(0,7),"big"):Ji.split32(this.h.slice(0,7),"big")};var Zi=ei,es=li,ts=ti,rs=Zi.rotr64_hi,ns=Zi.rotr64_lo,is=Zi.shr64_hi,ss=Zi.shr64_lo,os=Zi.sum64,as=Zi.sum64_hi,us=Zi.sum64_lo,cs=Zi.sum64_4_hi,fs=Zi.sum64_4_lo,ls=Zi.sum64_5_hi,ds=Zi.sum64_5_lo,hs=es.BlockHash,ps=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function gs(){if(!(this instanceof gs))return new gs;hs.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=ps,this.W=new Array(160)}Zi.inherits(gs,hs);var ms=gs;function ys(e,t,r,n,i){var s=e&r^~e&i;return s<0&&(s+=4294967296),s}function bs(e,t,r,n,i,s){var o=t&n^~t&s;return o<0&&(o+=4294967296),o}function vs(e,t,r,n,i){var s=e&r^e&i^r&i;return s<0&&(s+=4294967296),s}function ws(e,t,r,n,i,s){var o=t&n^t&s^n&s;return o<0&&(o+=4294967296),o}function _s(e,t){var r=rs(e,t,28)^rs(t,e,2)^rs(t,e,7);return r<0&&(r+=4294967296),r}function Es(e,t){var r=ns(e,t,28)^ns(t,e,2)^ns(t,e,7);return r<0&&(r+=4294967296),r}function As(e,t){var r=rs(e,t,14)^rs(e,t,18)^rs(t,e,9);return r<0&&(r+=4294967296),r}function Ss(e,t){var r=ns(e,t,14)^ns(e,t,18)^ns(t,e,9);return r<0&&(r+=4294967296),r}function ks(e,t){var r=rs(e,t,1)^rs(e,t,8)^is(e,t,7);return r<0&&(r+=4294967296),r}function xs(e,t){var r=ns(e,t,1)^ns(e,t,8)^ss(e,t,7);return r<0&&(r+=4294967296),r}function Ts(e,t){var r=rs(e,t,19)^rs(t,e,29)^is(e,t,6);return r<0&&(r+=4294967296),r}function Rs(e,t){var r=ns(e,t,19)^ns(t,e,29)^ss(e,t,6);return r<0&&(r+=4294967296),r}gs.blockSize=1024,gs.outSize=512,gs.hmacStrength=192,gs.padLength=128,gs.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var i=Ts(r[n-4],r[n-3]),s=Rs(r[n-4],r[n-3]),o=r[n-14],a=r[n-13],u=ks(r[n-30],r[n-29]),c=xs(r[n-30],r[n-29]),f=r[n-32],l=r[n-31];r[n]=cs(i,s,o,a,u,c,f,l),r[n+1]=fs(i,s,o,a,u,c,f,l)}},gs.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],i=this.h[1],s=this.h[2],o=this.h[3],a=this.h[4],u=this.h[5],c=this.h[6],f=this.h[7],l=this.h[8],d=this.h[9],h=this.h[10],p=this.h[11],g=this.h[12],m=this.h[13],y=this.h[14],b=this.h[15];ts(this.k.length===r.length);for(var v=0;v<r.length;v+=2){var w=y,_=b,E=As(l,d),A=Ss(l,d),S=ys(l,d,h,p,g),k=bs(l,d,h,p,g,m),x=this.k[v],T=this.k[v+1],R=r[v],O=r[v+1],I=ls(w,_,E,A,S,k,x,T,R,O),M=ds(w,_,E,A,S,k,x,T,R,O);w=_s(n,i),_=Es(n,i),E=vs(n,i,s,o,a),A=ws(n,i,s,o,a,u);var P=as(w,_,E,A),N=us(w,_,E,A);y=g,b=m,g=h,m=p,h=l,p=d,l=as(c,f,I,M),d=us(f,f,I,M),c=a,f=u,a=s,u=o,s=n,o=i,n=as(I,M,P,N),i=us(I,M,P,N)}os(this.h,0,n,i),os(this.h,2,s,o),os(this.h,4,a,u),os(this.h,6,c,f),os(this.h,8,l,d),os(this.h,10,h,p),os(this.h,12,g,m),os(this.h,14,y,b)},gs.prototype._digest=function(e){return"hex"===e?Zi.toHex32(this.h,"big"):Zi.split32(this.h,"big")};var Os=ei,Is=ms;function Ms(){if(!(this instanceof Ms))return new Ms;Is.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Os.inherits(Ms,Is);var Ps=Ms;Ms.blockSize=1024,Ms.outSize=384,Ms.hmacStrength=192,Ms.padLength=128,Ms.prototype._digest=function(e){return"hex"===e?Os.toHex32(this.h.slice(0,12),"big"):Os.split32(this.h.slice(0,12),"big")},gi.sha1=Mi,gi.sha224=Qi,gi.sha256=Xi,gi.sha384=Ps,gi.sha512=ms;var Ns={},Cs=ei,Bs=li,Us=Cs.rotl32,Ls=Cs.sum32,js=Cs.sum32_3,Ds=Cs.sum32_4,Fs=Bs.BlockHash;function qs(){if(!(this instanceof qs))return new qs;Fs.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function zs(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function Ks(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function Hs(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}Cs.inherits(qs,Fs),Ns.ripemd160=qs,qs.blockSize=512,qs.outSize=160,qs.hmacStrength=192,qs.padLength=64,qs.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],i=this.h[2],s=this.h[3],o=this.h[4],a=r,u=n,c=i,f=s,l=o,d=0;d<80;d++){var h=Ls(Us(Ds(r,zs(d,n,i,s),e[Gs[d]+t],Ks(d)),Vs[d]),o);r=o,o=s,s=Us(i,10),i=n,n=h,h=Ls(Us(Ds(a,zs(79-d,u,c,f),e[Ws[d]+t],Hs(d)),Xs[d]),l),a=l,l=f,f=Us(c,10),c=u,u=h}h=js(this.h[1],i,f),this.h[1]=js(this.h[2],s,l),this.h[2]=js(this.h[3],o,a),this.h[3]=js(this.h[4],r,u),this.h[4]=js(this.h[0],n,c),this.h[0]=h},qs.prototype._digest=function(e){return"hex"===e?Cs.toHex32(this.h,"little"):Cs.split32(this.h,"little")};var Gs=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Ws=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Vs=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Xs=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Js=ei,$s=ti;function Ys(e,t,r){if(!(this instanceof Ys))return new Ys(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(Js.toArray(t,r))}var Qs=Ys;Ys.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),$s(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},Ys.prototype.update=function(e,t){return this.inner.update(e,t),this},Ys.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(e){var t=e;t.utils=ei,t.common=li,t.sha=gi,t.ripemd=Ns,t.hmac=Qs,t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160}(Zn);var Zs=n(Zn);function eo(e,t,r){return r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},e(r,r.exports),r.exports}var to=ro;function ro(e,t){if(!e)throw new Error(t||"Assertion failed")}ro.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var no=eo((function(e,t){var r=t;function n(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(n=0;n<e.length;n++){var i=e.charCodeAt(n),s=i>>8,o=255&i;s?r.push(s,o):r.push(o)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}})),io=eo((function(e,t){var r=t;r.assert=to,r.toArray=no.toArray,r.zero2=no.zero2,r.toHex=no.toHex,r.encode=no.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<<t+1,s=e.clone(),o=0;o<n.length;o++){var a,u=s.andln(i-1);s.isOdd()?(a=u>(i>>1)-1?(i>>1)-u:u,s.isubn(a)):a=0,n[o]=a,s.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,s=0;e.cmpn(-i)>0||t.cmpn(-s)>0;){var o,a,u=e.andln(3)+i&3,c=t.andln(3)+s&3;3===u&&(u=-1),3===c&&(c=-1),o=0==(1&u)?0:3!==(n=e.andln(7)+i&7)&&5!==n||2!==c?u:-u,r[0].push(o),a=0==(1&c)?0:3!==(n=t.andln(7)+s&7)&&5!==n||2!==u?c:-c,r[1].push(a),2*i===o+1&&(i=1-i),2*s===a+1&&(s=1-s),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 ue(e,"hex","le")}})),so=io.getNAF,oo=io.getJSF,ao=io.assert;function uo(e,t){this.type=e,this.p=new ue(t.p,16),this.red=t.prime?ue.red(t.prime):ue.mont(this.p),this.zero=new ue(0).toRed(this.red),this.one=new ue(1).toRed(this.red),this.two=new ue(2).toRed(this.red),this.n=t.n&&new ue(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 co=uo;function fo(e,t){this.curve=e,this.type=t,this.precomputed=null}uo.prototype.point=function(){throw new Error("Not implemented")},uo.prototype.validate=function(){throw new Error("Not implemented")},uo.prototype._fixedNafMul=function(e,t){ao(e.precomputed);var r=e._getDoubles(),n=so(t,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var s,o,a=[];for(s=0;s<n.length;s+=r.step){o=0;for(var u=s+r.step-1;u>=s;u--)o=(o<<1)+n[u];a.push(o)}for(var c=this.jpoint(null,null,null),f=this.jpoint(null,null,null),l=i;l>0;l--){for(s=0;s<a.length;s++)(o=a[s])===l?f=f.mixedAdd(r.points[s]):o===-l&&(f=f.mixedAdd(r.points[s].neg()));c=c.add(f)}return c.toP()},uo.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var i=n.points,s=so(t,r,this._bitLength),o=this.jpoint(null,null,null),a=s.length-1;a>=0;a--){for(var u=0;a>=0&&0===s[a];a--)u++;if(a>=0&&u++,o=o.dblp(u),a<0)break;var c=s[a];ao(0!==c),o="affine"===e.type?c>0?o.mixedAdd(i[c-1>>1]):o.mixedAdd(i[-c-1>>1].neg()):c>0?o.add(i[c-1>>1]):o.add(i[-c-1>>1].neg())}return"affine"===e.type?o.toP():o},uo.prototype._wnafMulAdd=function(e,t,r,n,i){var s,o,a,u=this._wnafT1,c=this._wnafT2,f=this._wnafT3,l=0;for(s=0;s<n;s++){var d=(a=t[s])._getNAFPoints(e);u[s]=d.wnd,c[s]=d.points}for(s=n-1;s>=1;s-=2){var h=s-1,p=s;if(1===u[h]&&1===u[p]){var g=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(g[1]=t[h].add(t[p]),g[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(g[1]=t[h].toJ().mixedAdd(t[p]),g[2]=t[h].add(t[p].neg())):(g[1]=t[h].toJ().mixedAdd(t[p]),g[2]=t[h].toJ().mixedAdd(t[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],y=oo(r[h],r[p]);for(l=Math.max(y[0].length,l),f[h]=new Array(l),f[p]=new Array(l),o=0;o<l;o++){var b=0|y[0][o],v=0|y[1][o];f[h][o]=m[3*(b+1)+(v+1)],f[p][o]=0,c[h]=g}}else f[h]=so(r[h],u[h],this._bitLength),f[p]=so(r[p],u[p],this._bitLength),l=Math.max(f[h].length,l),l=Math.max(f[p].length,l)}var w=this.jpoint(null,null,null),_=this._wnafT4;for(s=l;s>=0;s--){for(var E=0;s>=0;){var A=!0;for(o=0;o<n;o++)_[o]=0|f[o][s],0!==_[o]&&(A=!1);if(!A)break;E++,s--}if(s>=0&&E++,w=w.dblp(E),s<0)break;for(o=0;o<n;o++){var S=_[o];0!==S&&(S>0?a=c[o][S-1>>1]:S<0&&(a=c[o][-S-1>>1].neg()),w="affine"===a.type?w.mixedAdd(a):w.add(a))}}for(s=0;s<n;s++)c[s]=null;return i?w:w.toP()},uo.BasePoint=fo,fo.prototype.eq=function(){throw new Error("Not implemented")},fo.prototype.validate=function(){return this.curve.validate(this)},uo.prototype.decodePoint=function(e,t){e=io.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?ao(e[e.length-1]%2==0):7===e[0]&&ao(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},fo.prototype.encodeCompressed=function(e){return this.encode(e,!0)},fo.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},fo.prototype.encode=function(e,t){return io.encode(this._encode(t),e)},fo.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},fo.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},fo.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<t;i+=e){for(var s=0;s<e;s++)n=n.dbl();r.push(n)}return{step:e,points:r}},fo.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)t[i]=t[i-1].add(n);return{wnd:e,points:t}},fo.prototype._getBeta=function(){return null},fo.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var lo=eo((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}})),ho=io.assert;function po(e){co.call(this,"short",e),this.a=new ue(e.a,16).toRed(this.red),this.b=new ue(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}lo(po,co);var go=po;function mo(e,t,r,n){co.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new ue(t,16),this.y=new ue(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function yo(e,t,r,n){co.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new ue(0)):(this.x=new ue(t,16),this.y=new ue(r,16),this.z=new ue(n,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.zOne=this.z===this.curve.one}po.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new ue(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new ue(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?r=i[0]:(r=i[1],ho(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new ue(e.a,16),b:new ue(e.b,16)}})):this._getEndoBasis(r)}}},po.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:ue.mont(e),r=new ue(2).toRed(t).redInvm(),n=r.redNeg(),i=new ue(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},po.prototype._getEndoBasis=function(e){for(var t,r,n,i,s,o,a,u,c,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=e,d=this.n.clone(),h=new ue(1),p=new ue(0),g=new ue(0),m=new ue(1),y=0;0!==l.cmpn(0);){var b=d.div(l);u=d.sub(b.mul(l)),c=g.sub(b.mul(h));var v=m.sub(b.mul(p));if(!n&&u.cmp(f)<0)t=a.neg(),r=h,n=u.neg(),i=c;else if(n&&2==++y)break;a=u,d=l,l=u,g=h,h=c,m=p,p=v}s=u.neg(),o=c;var w=n.sqr().add(i.sqr());return s.sqr().add(o.sqr()).cmp(w)>=0&&(s=t,o=r),n.negative&&(n=n.neg(),i=i.neg()),s.negative&&(s=s.neg(),o=o.neg()),[{a:n,b:i},{a:s,b:o}]},po.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),s=r.b.neg().mul(e).divRound(this.n),o=i.mul(r.a),a=s.mul(n.a),u=i.mul(r.b),c=s.mul(n.b);return{k1:e.sub(o).sub(a),k2:u.add(c).neg()}},po.prototype.pointFromX=function(e,t){(e=new ue(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)},po.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)},po.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s<e.length;s++){var o=this._endoSplit(t[s]),a=e[s],u=a._getBeta();o.k1.negative&&(o.k1.ineg(),a=a.neg(!0)),o.k2.negative&&(o.k2.ineg(),u=u.neg(!0)),n[2*s]=a,n[2*s+1]=u,i[2*s]=o.k1,i[2*s+1]=o.k2}for(var c=this._wnafMulAdd(1,n,i,2*s,r),f=0;f<2*s;f++)n[f]=null,i[f]=null;return c},lo(mo,co.BasePoint),po.prototype.point=function(e,t,r){return new mo(this,e,t,r)},po.prototype.pointFromJSON=function(e,t){return mo.fromJSON(this,e,t)},mo.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},mo.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},mo.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function i(t){return e.point(t[0],t[1],r)}var s=t[2];return n.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[n].concat(s.doubles.points.map(i))},naf:s.naf&&{wnd:s.naf.wnd,points:[n].concat(s.naf.points.map(i))}},n},mo.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},mo.prototype.isInfinity=function(){return this.inf},mo.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)},mo.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),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},mo.prototype.getX=function(){return this.x.fromRed()},mo.prototype.getY=function(){return this.y.fromRed()},mo.prototype.mul=function(e){return e=new ue(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)},mo.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)},mo.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)},mo.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))},mo.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},mo.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},lo(yo,co.BasePoint),po.prototype.jpoint=function(e,t,r){return new yo(this,e,t,r)},yo.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)},yo.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},yo.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),s=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=s.redSub(o);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),f=c.redMul(a),l=n.redMul(c),d=u.redSqr().redIAdd(f).redISub(l).redISub(l),h=u.redMul(l.redISub(d)).redISub(s.redMul(f)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(d,h,p)},yo.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,s=e.y.redMul(t).redMul(this.z),o=r.redSub(n),a=i.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=o.redSqr(),c=u.redMul(o),f=r.redMul(u),l=a.redSqr().redIAdd(c).redISub(f).redISub(f),d=a.redMul(f.redISub(l)).redISub(i.redMul(c)),h=this.z.redMul(o);return this.curve.jpoint(l,d,h)},yo.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<e;t++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,s=this.x,o=this.y,a=this.z,u=a.redSqr().redSqr(),c=o.redAdd(o);for(t=0;t<e;t++){var f=s.redSqr(),l=c.redSqr(),d=l.redSqr(),h=f.redAdd(f).redIAdd(f).redIAdd(n.redMul(u)),p=s.redMul(l),g=h.redSqr().redISub(p.redAdd(p)),m=p.redISub(g),y=h.redMul(m);y=y.redIAdd(y).redISub(d);var b=c.redMul(a);t+1<e&&(u=u.redMul(d)),s=g,a=b,c=y}return this.curve.jpoint(s,c.redMul(i),a)},yo.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},yo.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(n).redISub(s);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n),u=a.redSqr().redISub(o).redISub(o),c=s.redIAdd(s);c=(c=c.redIAdd(c)).redIAdd(c),e=u,t=a.redMul(o.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var f=this.x.redSqr(),l=this.y.redSqr(),d=l.redSqr(),h=this.x.redAdd(l).redSqr().redISub(f).redISub(d);h=h.redIAdd(h);var p=f.redAdd(f).redIAdd(f),g=p.redSqr(),m=d.redIAdd(d);m=(m=m.redIAdd(m)).redIAdd(m),e=g.redISub(h).redISub(h),t=p.redMul(h.redISub(e)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},yo.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(n).redISub(s);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=a.redSqr().redISub(o).redISub(o);e=u;var c=s.redIAdd(s);c=(c=c.redIAdd(c)).redIAdd(c),t=a.redMul(o.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var f=this.z.redSqr(),l=this.y.redSqr(),d=this.x.redMul(l),h=this.x.redSub(f).redMul(this.x.redAdd(f));h=h.redAdd(h).redIAdd(h);var p=d.redIAdd(d),g=(p=p.redIAdd(p)).redAdd(p);e=h.redSqr().redISub(g),r=this.y.redAdd(this.z).redSqr().redISub(l).redISub(f);var m=l.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),t=h.redMul(p.redISub(e)).redISub(m)}return this.curve.jpoint(e,t,r)},yo.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),s=t.redSqr(),o=r.redSqr(),a=s.redAdd(s).redIAdd(s).redIAdd(e.redMul(i)),u=t.redAdd(t),c=(u=u.redIAdd(u)).redMul(o),f=a.redSqr().redISub(c.redAdd(c)),l=c.redISub(f),d=o.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var h=a.redMul(l).redISub(d),p=r.redAdd(r).redMul(n);return this.curve.jpoint(f,h,p)},yo.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),i=e.redAdd(e).redIAdd(e),s=i.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(n),a=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(s)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(o).redSqr().redISub(s).redISub(a).redISub(u),f=t.redMul(c);f=(f=f.redIAdd(f)).redIAdd(f);var l=this.x.redMul(a).redISub(f);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.y.redMul(c.redMul(u.redISub(c)).redISub(o.redMul(a)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var h=this.z.redAdd(o).redSqr().redISub(r).redISub(a);return this.curve.jpoint(l,d,h)},yo.prototype.mul=function(e,t){return e=new ue(e,t),this.curve._wnafMul(this,e)},yo.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),i=r.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(n)).cmpn(0)},yo.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),i=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},yo.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},yo.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var bo=eo((function(e,t){var r=t;r.base=co,r.short=go,r.mont=null,r.edwards=null})),vo=eo((function(e,t){var r,n=t,i=io.assert;function s(e){"short"===e.type?this.curve=new bo.short(e):"edwards"===e.type?this.curve=new bo.edwards(e):this.curve=new bo.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 o(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new s(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=s,o("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:Zs.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("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:Zs.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("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:Zs.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("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:Zs.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"]}),o("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:Zs.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"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Zs.sha256,gRed:!1,g:["9"]}),o("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:Zs.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(e){r=void 0}o("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:Zs.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function wo(e){if(!(this instanceof wo))return new wo(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=no.toArray(e.entropy,e.entropyEnc||"hex"),r=no.toArray(e.nonce,e.nonceEnc||"hex"),n=no.toArray(e.pers,e.persEnc||"hex");to(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var _o=wo;wo.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.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},wo.prototype._hmac=function(){return new Zs.hmac(this.hash,this.K)},wo.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},wo.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=no.toArray(e,t),r=no.toArray(r,n),to(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},wo.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=no.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var s=i.slice(0,e);return this._update(r),this._reseed++,no.encode(s,t)};var Eo=io.assert;function Ao(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var So=Ao;Ao.fromPublic=function(e,t,r){return t instanceof Ao?t:new Ao(e,{pub:t,pubEnc:r})},Ao.fromPrivate=function(e,t,r){return t instanceof Ao?t:new Ao(e,{priv:t,privEnc:r})},Ao.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Ao.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},Ao.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},Ao.prototype._importPrivate=function(e,t){this.priv=new ue(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},Ao.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?Eo(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||Eo(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},Ao.prototype.derive=function(e){return e.validate()||Eo(e.validate(),"public point not validated"),e.mul(this.priv).getX()},Ao.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},Ao.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},Ao.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var ko=io.assert;function xo(e,t){if(e instanceof xo)return e;this._importDER(e,t)||(ko(e.r&&e.s,"Signature without r or s"),this.r=new ue(e.r,16),this.s=new ue(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var To=xo;function Ro(){this.place=0}function Oo(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,s=0,o=t.place;s<n;s++,o++)i<<=8,i|=e[o],i>>>=0;return!(i<=127)&&(t.place=o,i)}function Io(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function Mo(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}xo.prototype._importDER=function(e,t){e=io.toArray(e,t);var r=new Ro;if(48!==e[r.place++])return!1;var n=Oo(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=Oo(e,r);if(!1===i)return!1;var s=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var o=Oo(e,r);if(!1===o)return!1;if(e.length!==o+r.place)return!1;var a=e.slice(r.place,o+r.place);if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new ue(s),this.s=new ue(a),this.recoveryParam=null,!0},xo.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=Io(t),r=Io(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];Mo(n,t.length),(n=n.concat(t)).push(2),Mo(n,r.length);var i=n.concat(r),s=[48];return Mo(s,i.length),s=s.concat(i),io.encode(s,e)};var Po=function(){throw new Error("unsupported")},No=io.assert;function Co(e){if(!(this instanceof Co))return new Co(e);"string"==typeof e&&(No(Object.prototype.hasOwnProperty.call(vo,e),"Unknown curve "+e),e=vo[e]),e instanceof vo.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 Bo=Co;Co.prototype.keyPair=function(e){return new So(this,e)},Co.prototype.keyFromPrivate=function(e,t){return So.fromPrivate(this,e,t)},Co.prototype.keyFromPublic=function(e,t){return So.fromPublic(this,e,t)},Co.prototype.genKeyPair=function(e){e||(e={});for(var t=new _o({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Po(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new ue(2));;){var i=new ue(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Co.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},Co.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 ue(e,16));for(var i=this.n.byteLength(),s=t.getPrivate().toArray("be",i),o=e.toArray("be",i),a=new _o({hash:this.hash,entropy:s,nonce:o,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new ue(1)),c=0;;c++){var f=n.k?n.k(c):new ue(a.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(u)>=0)){var l=this.g.mul(f);if(!l.isInfinity()){var d=l.getX(),h=d.umod(this.n);if(0!==h.cmpn(0)){var p=f.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var g=(l.getY().isOdd()?1:0)|(0!==d.cmp(h)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),g^=1),new To({r:h,s:p,recoveryParam:g})}}}}}},Co.prototype.verify=function(e,t,r,n){e=this._truncateToN(new ue(e,16)),r=this.keyFromPublic(r,n);var i=(t=new To(t,"hex")).r,s=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var o,a=s.invm(this.n),u=a.mul(e).umod(this.n),c=a.mul(i).umod(this.n);return this.curve._maxwellTrick?!(o=this.g.jmulAdd(u,r.getPublic(),c)).isInfinity()&&o.eqXToP(i):!(o=this.g.mulAdd(u,r.getPublic(),c)).isInfinity()&&0===o.getX().umod(this.n).cmp(i)},Co.prototype.recoverPubKey=function(e,t,r,n){No((3&r)===r,"The recovery param is more than two bits"),t=new To(t,n);var i=this.n,s=new ue(e),o=t.r,a=t.s,u=1&r,c=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");o=c?this.curve.pointFromX(o.add(this.curve.n),u):this.curve.pointFromX(o,u);var f=t.r.invm(i),l=i.sub(s).mul(f).umod(i),d=a.mul(f).umod(i);return this.g.mulAdd(l,o,d)},Co.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new To(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(e,t,i)}catch(e){continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var Uo=eo((function(e,t){var r=t;r.version="6.5.4",r.utils=io,r.rand=function(){throw new Error("unsupported")},r.curve=bo,r.curves=vo,r.ec=Bo,r.eddsa=null})),Lo=Uo.ec;const jo=new be("signing-key/5.7.0");let Do=null;function Fo(){return Do||(Do=new Lo("secp256k1")),Do}class qo{constructor(e){ft(this,"curve","secp256k1"),ft(this,"privateKey",Me(e)),32!==Pe(this.privateKey)&&jo.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Fo().keyFromPrivate(ke(this.privateKey));ft(this,"publicKey","0x"+t.getPublic(!1,"hex")),ft(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),ft(this,"_isSigningKey",!0)}_addPoint(e){const t=Fo().keyFromPublic(ke(this.publicKey)),r=Fo().keyFromPublic(ke(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=Fo().keyFromPrivate(ke(this.privateKey)),r=ke(e);32!==r.length&&jo.throwArgumentError("bad digest length","digest",e);const n=t.sign(r,{canonical:!0});return Le({recoveryParam:n.recoveryParam,r:Ue("0x"+n.r.toString(16),32),s:Ue("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=Fo().keyFromPrivate(ke(this.privateKey)),r=Fo().keyFromPublic(ke(zo(e)));return Ue("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function zo(e,t){const r=ke(e);if(32===r.length){const e=new qo(r);return t?"0x"+Fo().keyFromPrivate(r).getPublic(!0,"hex"):e.publicKey}return 33===r.length?t?Me(r):"0x"+Fo().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?t?"0x"+Fo().keyFromPublic(r).getPublic(!0,"hex"):Me(r):jo.throwArgumentError("invalid public or private key","key","[REDACTED]")}const Ko=new be("transactions/5.7.0");var Ho;function Go(e){return"0x"===e?null:ur(e)}function Wo(e){return"0x"===e?Ar:He.from(e)}function Vo(e,t){return function(e){return ur(Ne(Jt(Ne(zo(e),1)),12))}(function(e,t){const r=Le(t),n={r:ke(r.r),s:ke(r.s)};return"0x"+Fo().recoverPubKey(ke(e),n,r.recoveryParam).encode("hex",!1)}(ke(e),t))}function Xo(e,t){const r=Te(He.from(e).toHexString());return r.length>32&&Ko.throwArgumentError("invalid length for "+t,"transaction:"+t,e),r}function Jo(e,t){return{address:ur(e),storageKeys:(t||[]).map(((t,r)=>(32!==Pe(t)&&Ko.throwArgumentError("invalid access list storageKey",`accessList[${e}:${r}]`,t),t.toLowerCase())))}}function $o(e){if(Array.isArray(e))return e.map(((e,t)=>Array.isArray(e)?(e.length>2&&Ko.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${t}]`,e),Jo(e[0],e[1])):Jo(e.address,e.storageKeys)));const t=Object.keys(e).map((t=>{const r=e[t].reduce(((e,t)=>(e[t]=!0,e)),{});return Jo(t,Object.keys(r).sort())}));return t.sort(((e,t)=>e.address.localeCompare(t.address))),t}function Yo(e){return $o(e).map((e=>[e.address,e.storageKeys]))}function Qo(e,t){if(null!=e.gasPrice){const t=He.from(e.gasPrice),r=He.from(e.maxFeePerGas||0);t.eq(r)||Ko.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:t,maxFeePerGas:r})}const r=[Xo(e.chainId||0,"chainId"),Xo(e.nonce||0,"nonce"),Xo(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Xo(e.maxFeePerGas||0,"maxFeePerGas"),Xo(e.gasLimit||0,"gasLimit"),null!=e.to?ur(e.to):"0x",Xo(e.value||0,"value"),e.data||"0x",Yo(e.accessList||[])];if(t){const e=Le(t);r.push(Xo(e.recoveryParam,"recoveryParam")),r.push(Te(e.r)),r.push(Te(e.s))}return Ce(["0x02",er(r)])}function Zo(e,t){const r=[Xo(e.chainId||0,"chainId"),Xo(e.nonce||0,"nonce"),Xo(e.gasPrice||0,"gasPrice"),Xo(e.gasLimit||0,"gasLimit"),null!=e.to?ur(e.to):"0x",Xo(e.value||0,"value"),e.data||"0x",Yo(e.accessList||[])];if(t){const e=Le(t);r.push(Xo(e.recoveryParam,"recoveryParam")),r.push(Te(e.r)),r.push(Te(e.s))}return Ce(["0x01",er(r)])}function ea(e,t,r){try{const r=Wo(t[0]).toNumber();if(0!==r&&1!==r)throw new Error("bad recid");e.v=r}catch(e){Ko.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=Ue(t[1],32),e.s=Ue(t[2],32);try{const t=Jt(r(e));e.from=Vo(t,{r:e.r,s:e.s,recoveryParam:e.v})}catch(e){}}function ta(e){const t=ke(e);if(t[0]>127)return function(e){const t=nr(e);9!==t.length&&6!==t.length&&Ko.throwArgumentError("invalid raw transaction","rawTransaction",e);const r={nonce:Wo(t[0]).toNumber(),gasPrice:Wo(t[1]),gasLimit:Wo(t[2]),to:Go(t[3]),value:Wo(t[4]),data:t[5],chainId:0};if(6===t.length)return r;try{r.v=He.from(t[6]).toNumber()}catch(e){return r}if(r.r=Ue(t[7],32),r.s=Ue(t[8],32),He.from(r.r).isZero()&&He.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(Me(r.chainId)),i.push("0x"),i.push("0x"),n-=2*r.chainId+8);const s=Jt(er(i));try{r.from=Vo(s,{r:Me(r.r),s:Me(r.s),recoveryParam:n})}catch(e){}r.hash=Jt(e)}return r.type=null,r}(t);switch(t[0]){case 1:return function(e){const t=nr(e.slice(1));8!==t.length&&11!==t.length&&Ko.throwArgumentError("invalid component count for transaction type: 1","payload",Me(e));const r={type:1,chainId:Wo(t[0]).toNumber(),nonce:Wo(t[1]).toNumber(),gasPrice:Wo(t[2]),gasLimit:Wo(t[3]),to:Go(t[4]),value:Wo(t[5]),data:t[6],accessList:$o(t[7])};return 8===t.length||(r.hash=Jt(e),ea(r,t.slice(8),Zo)),r}(t);case 2:return function(e){const t=nr(e.slice(1));9!==t.length&&12!==t.length&&Ko.throwArgumentError("invalid component count for transaction type: 2","payload",Me(e));const r=Wo(t[2]),n=Wo(t[3]),i={type:2,chainId:Wo(t[0]).toNumber(),nonce:Wo(t[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:Wo(t[4]),to:Go(t[5]),value:Wo(t[6]),data:t[7],accessList:$o(t[8])};return 9===t.length||(i.hash=Jt(e),ea(i,t.slice(9),Qo)),i}(t)}return Ko.throwError(`unsupported transaction type: ${t[0]}`,be.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(Ho||(Ho={}));var ra=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))};const na=new be("contracts/5.7.0"),ia={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 sa(e,t){return ra(this,void 0,void 0,(function*(){const r=yield t;"string"!=typeof r&&na.throwArgumentError("invalid address or ENS name","name",r);try{return ur(r)}catch(e){}e||na.throwError("a provider or signer is needed to resolve ENS names",be.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield e.resolveName(r);return null==n&&na.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n}))}function oa(e,t,r){return ra(this,void 0,void 0,(function*(){return Array.isArray(r)?yield Promise.all(r.map(((r,n)=>oa(e,Array.isArray(t)?t[n]:t[r.name],r)))):"address"===r.type?yield sa(e,t):"tuple"===r.type?yield oa(e,t,r.components):"array"===r.baseType?Array.isArray(t)?yield Promise.all(t.map((t=>oa(e,t,r.arrayChildren)))):Promise.reject(na.makeError("invalid value for array",be.errors.INVALID_ARGUMENT,{argument:"value",value:t})):t}))}function aa(e,t,r){return ra(this,void 0,void 0,(function*(){let n={};r.length===t.inputs.length+1&&"object"==typeof r[r.length-1]&&(n=ht(r.pop())),na.checkArgumentCount(r.length,t.inputs.length,"passed to contract"),e.signer?n.from?n.from=dt({override:sa(e.signer,n.from),signer:e.signer.getAddress()}).then((e=>ra(this,void 0,void 0,(function*(){return ur(e.signer)!==e.override&&na.throwError("Contract with a Signer cannot override from",be.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),e.override})))):n.from=e.signer.getAddress():n.from&&(n.from=sa(e.provider,n.from));const i=yield dt({args:oa(e.signer||e.provider,r,t.inputs),address:e.resolvedAddress,overrides:dt(n)||{}}),s=e.interface.encodeFunctionData(t,i.args),o={data:s,to:i.address},a=i.overrides;if(null!=a.nonce&&(o.nonce=He.from(a.nonce).toNumber()),null!=a.gasLimit&&(o.gasLimit=He.from(a.gasLimit)),null!=a.gasPrice&&(o.gasPrice=He.from(a.gasPrice)),null!=a.maxFeePerGas&&(o.maxFeePerGas=He.from(a.maxFeePerGas)),null!=a.maxPriorityFeePerGas&&(o.maxPriorityFeePerGas=He.from(a.maxPriorityFeePerGas)),null!=a.from&&(o.from=a.from),null!=a.type&&(o.type=a.type),null!=a.accessList&&(o.accessList=$o(a.accessList)),null==o.gasLimit&&null!=t.gas){let e=21e3;const r=ke(s);for(let t=0;t<r.length;t++)e+=4,r[t]&&(e+=64);o.gasLimit=He.from(t.gas).add(e)}if(a.value){const e=He.from(a.value);e.isZero()||t.payable||na.throwError("non-payable method cannot override value",be.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:n.value}),o.value=e}a.customData&&(o.customData=ht(a.customData)),a.ccipReadEnabled&&(o.ccipReadEnabled=!!a.ccipReadEnabled),delete n.nonce,delete n.gasLimit,delete n.gasPrice,delete n.from,delete n.value,delete n.type,delete n.accessList,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.customData,delete n.ccipReadEnabled;const u=Object.keys(n).filter((e=>null!=n[e]));return u.length&&na.throwError(`cannot override ${u.map((e=>JSON.stringify(e))).join(",")}`,be.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:u}),o}))}function ua(e,t){const r=t.wait.bind(t);t.wait=t=>r(t).then((t=>(t.events=t.logs.map((r=>{let n=yt(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 ca(e,t,r){const n=e.signer||e.provider;return function(...i){return ra(this,void 0,void 0,(function*(){let s;if(i.length===t.inputs.length+1&&"object"==typeof i[i.length-1]){const e=ht(i.pop());null!=e.blockTag&&(s=yield e.blockTag),delete e.blockTag,i.push(e)}null!=e.deployTransaction&&(yield e._deployed(s));const o=yield aa(e,t,i),a=yield n.call(o,s);try{let n=e.interface.decodeFunctionResult(t,a);return r&&1===t.outputs.length&&(n=n[0]),n}catch(t){throw t.code===be.errors.CALL_EXCEPTION&&(t.address=e.address,t.args=i,t.transaction=o),t}}))}}function fa(e,t,r){return t.constant?ca(e,t,r):function(e,t){return function(...r){return ra(this,void 0,void 0,(function*(){e.signer||na.throwError("sending a transaction requires a signer",be.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=e.deployTransaction&&(yield e._deployed());const n=yield aa(e,t,r),i=yield e.signer.sendTransaction(n);return ua(e,i),i}))}}(e,t)}function la(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 da{constructor(e,t){ft(this,"tag",e),ft(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 ha extends da{constructor(){super("error",null)}}class pa extends da{constructor(e,t,r,n){const i={address:e};let s=t.getEventTopic(r);n?(s!==n[0]&&na.throwArgumentError("topic mismatch","topics",n),i.topics=n.slice()):i.topics=[s],super(la(i),i),ft(this,"address",e),ft(this,"interface",t),ft(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=function(e){const t=[],r=function(e,n){if(Array.isArray(n))for(let i in n){const s=e.slice();s.push(i);try{r(s,n[i])}catch(e){t.push({path:s,error:e})}}};return r([],e),t}(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class ga extends da{constructor(e,t){super("*",{address:e}),ft(this,"address",e),ft(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 ma{constructor(e,t,r){ft(this,"interface",lt(new.target,"getInterface")(t)),null==r?(ft(this,"provider",null),ft(this,"signer",null)):Yn.isSigner(r)?(ft(this,"provider",r.provider||null),ft(this,"signer",r)):Wn.isProvider(r)?(ft(this,"provider",r),ft(this,"signer",null)):na.throwArgumentError("invalid signer or provider","signerOrProvider",r),ft(this,"callStatic",{}),ft(this,"estimateGas",{}),ft(this,"functions",{}),ft(this,"populateTransaction",{}),ft(this,"filters",{});{const e={};Object.keys(this.interface.events).forEach((t=>{const r=this.interface.events[t];ft(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?ft(this.filters,t,this.filters[r[0]]):na.warn(`Duplicate definition of ${t} (${r.join(", ")})`)}))}if(ft(this,"_runningEvents",{}),ft(this,"_wrappedEmits",{}),null==e&&na.throwArgumentError("invalid contract address or ENS name","addressOrName",e),ft(this,"address",e),this.provider)ft(this,"resolvedAddress",sa(this.provider,e));else try{ft(this,"resolvedAddress",Promise.resolve(ur(e)))}catch(e){na.throwError("provider is required to use ENS name as contract address",be.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])na.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]&&ft(this,e,fa(this,t,!0)),null==this.functions[e]&&ft(this.functions,e,fa(this,t,!1)),null==this.callStatic[e]&&ft(this.callStatic,e,ca(this,t,!0)),null==this.populateTransaction[e]&&ft(this.populateTransaction,e,function(e,t){return function(...r){return aa(e,t,r)}}(this,t)),null==this.estimateGas[e]&&ft(this.estimateGas,e,function(e,t){const r=e.signer||e.provider;return function(...n){return ra(this,void 0,void 0,(function*(){r||na.throwError("estimate require a provider or signer",be.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield aa(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]&&ft(this,e,this[r])}catch(e){}null==this.functions[e]&&ft(this.functions,e,this.functions[r]),null==this.callStatic[e]&&ft(this.callStatic,e,this.callStatic[r]),null==this.populateTransaction[e]&&ft(this.populateTransaction,e,this.populateTransaction[r]),null==this.estimateGas[e]&&ft(this.estimateGas,e,this.estimateGas[r])}))}static getContractAddress(e){return cr(e)}static getInterface(e){return zn.isInterface(e)?e:new zn(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&&na.throwError("contract not deployed",be.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(e){this.signer||na.throwError("sending a transactions require a signer",be.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=ht(e||{});return["from","to"].forEach((function(e){null!=t[e]&&na.throwError("cannot override "+e,be.errors.UNSUPPORTED_OPERATION,{operation:e})})),t.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(t)))}connect(e){"string"==typeof e&&(e=new Qn(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&ft(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return Dn.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 ha);if("event"===e)return this._normalizeRunningEvent(new da("event",null));if("*"===e)return this._normalizeRunningEvent(new ga(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new pa(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 pa(this.address,this.interface,r,e.topics))}catch(e){}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new da(la(t),t))}return this._normalizeRunningEvent(new ga(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=yt(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||na.throwError("events require a provider or a signer with a provider",be.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=ht(n.filter);return"string"==typeof t&&Oe(t,32)?(null!=r&&na.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 ya extends ma{}class ba{constructor(e,t,r){let n=null;n="string"==typeof t?t:Se(t)?Me(t):t&&"string"==typeof t.object?t.object:"!","0x"!==n.substring(0,2)&&(n="0x"+n),(!Oe(n)||n.length%2)&&na.throwArgumentError("invalid bytecode","bytecode",t),r&&!Yn.isSigner(r)&&na.throwArgumentError("invalid signer","signer",r),ft(this,"bytecode",n),ft(this,"interface",lt(new.target,"getInterface")(e)),ft(this,"signer",r||null)}getDeployTransaction(...e){let t={};if(e.length===this.interface.deploy.inputs.length+1&&"object"==typeof e[e.length-1]){t=ht(e.pop());for(const e in t)if(!ia[e])throw new Error("unknown transaction override "+e)}if(["data","from","to"].forEach((e=>{null!=t[e]&&na.throwError("cannot override "+e,be.errors.UNSUPPORTED_OPERATION,{operation:e})})),t.value){He.from(t.value).isZero()||this.interface.deploy.payable||na.throwError("non-payable constructor cannot override value",be.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:t.value})}return na.checkArgumentCount(e.length,this.interface.deploy.inputs.length," in Contract constructor"),t.data=Me(xe([this.bytecode,this.interface.encodeDeploy(e)])),t}deploy(...e){return ra(this,void 0,void 0,(function*(){let t={};e.length===this.interface.deploy.inputs.length+1&&(t=e.pop()),na.checkArgumentCount(e.length,this.interface.deploy.inputs.length," in Contract constructor");const r=yield oa(this.signer,e,this.interface.deploy.inputs);r.push(t);const n=this.getDeployTransaction(...r),i=yield this.signer.sendTransaction(n),s=lt(this.constructor,"getContractAddress")(i),o=lt(this.constructor,"getContract")(s,this.interface,this.signer);return ua(o,i),ft(o,"deployTransaction",i),o}))}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&&na.throwError("missing compiler output",be.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 ya.getInterface(e)}static getContractAddress(e){return cr(e)}static getContract(e,t,r){return new ya(e,t,r)}}class va{constructor(e){ft(this,"alphabet",e),ft(this,"base",e.length),ft(this,"_alphabetMap",{}),ft(this,"_leader",e.charAt(0));for(let t=0;t<e.length;t++)this._alphabetMap[e.charAt(t)]=t}encode(e){let t=ke(e);if(0===t.length)return"";let r=[0];for(let e=0;e<t.length;++e){let n=t[e];for(let e=0;e<r.length;++e)n+=r[e]<<8,r[e]=n%this.base,n=n/this.base|0;for(;n>0;)r.push(n%this.base),n=n/this.base|0}let n="";for(let e=0;0===t[e]&&e<t.length-1;++e)n+=this._leader;for(let e=r.length-1;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<e.length;r++){let n=this._alphabetMap[e[r]];if(void 0===n)throw new Error("Non-base"+this.base+" character");let i=n;for(let e=0;e<t.length;++e)i+=t[e]*this.base,t[e]=255&i,i>>=8;for(;i>0;)t.push(255&i),i>>=8}for(let r=0;e[r]===this._leader&&r<e.length-1;++r)t.push(0);return ke(new Uint8Array(t.reverse()))}}new va("abcdefghijklmnopqrstuvwxyz234567");const wa=new va("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function _a(e){return"0x"+Zs.sha256().update(ke(e)).digest("hex")}var Ea={exports:{}};!function(e,t){!function(t){const r=2147483647;function n(e){const t=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]);let r=1779033703,n=3144134277,i=1013904242,s=2773480762,o=1359893119,a=2600822924,u=528734635,c=1541459225;const f=new Uint32Array(64);function l(e){let l=0,d=e.length;for(;d>=64;){let h,p,g,m,y,b=r,v=n,w=i,_=s,E=o,A=a,S=u,k=c;for(p=0;p<16;p++)g=l+4*p,f[p]=(255&e[g])<<24|(255&e[g+1])<<16|(255&e[g+2])<<8|255&e[g+3];for(p=16;p<64;p++)h=f[p-2],m=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10,h=f[p-15],y=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3,f[p]=(m+f[p-7]|0)+(y+f[p-16]|0)|0;for(p=0;p<64;p++)m=(((E>>>6|E<<26)^(E>>>11|E<<21)^(E>>>25|E<<7))+(E&A^~E&S)|0)+(k+(t[p]+f[p]|0)|0)|0,y=((b>>>2|b<<30)^(b>>>13|b<<19)^(b>>>22|b<<10))+(b&v^b&w^v&w)|0,k=S,S=A,A=E,E=_+m|0,_=w,w=v,v=b,b=m+y|0;r=r+b|0,n=n+v|0,i=i+w|0,s=s+_|0,o=o+E|0,a=a+A|0,u=u+S|0,c=c+k|0,l+=64,d-=64}}l(e);let d,h=e.length%64,p=e.length/536870912|0,g=e.length<<3,m=h<56?56:120,y=e.slice(e.length-h,e.length);for(y.push(128),d=h+1;d<m;d++)y.push(0);return y.push(p>>>24&255),y.push(p>>>16&255),y.push(p>>>8&255),y.push(p>>>0&255),y.push(g>>>24&255),y.push(g>>>16&255),y.push(g>>>8&255),y.push(g>>>0&255),l(y),[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,s>>>24&255,s>>>16&255,s>>>8&255,s>>>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,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255,c>>>24&255,c>>>16&255,c>>>8&255,c>>>0&255]}function i(e,t,r){e=e.length<=64?e:n(e);const i=64+t.length+4,s=new Array(i),o=new Array(64);let a,u=[];for(a=0;a<64;a++)s[a]=54;for(a=0;a<e.length;a++)s[a]^=e[a];for(a=0;a<t.length;a++)s[64+a]=t[a];for(a=i-4;a<i;a++)s[a]=0;for(a=0;a<64;a++)o[a]=92;for(a=0;a<e.length;a++)o[a]^=e[a];function c(){for(let e=i-1;e>=i-4;e--){if(s[e]++,s[e]<=255)return;s[e]=0}}for(;r>=32;)c(),u=u.concat(n(o.concat(n(s)))),r-=32;return r>0&&(c(),u=u.concat(n(o.concat(n(s))).slice(0,r))),u}function s(e,t,r,n,i){let s;for(c(e,16*(2*r-1),i,0,16),s=0;s<2*r;s++)u(e,16*s,i,16),a(i,n),c(i,0,e,t+16*s,16);for(s=0;s<r;s++)c(e,t+2*s*16,e,16*s,16);for(s=0;s<r;s++)c(e,t+16*(2*s+1),e,16*(s+r),16)}function o(e,t){return e<<t|e>>>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 u(e,t,r,n){for(let i=0;i<n;i++)r[i]^=e[t+i]}function c(e,t,r,n,i){for(;i--;)r[n++]=e[t++]}function f(e){if(!e||"number"!=typeof e.length)return!1;for(let t=0;t<e.length;t++){const r=e[t];if("number"!=typeof r||r%1||r<0||r>=256)return!1}return!0}function l(e,t){if("number"!=typeof e||e%1)throw new Error("invalid "+t);return e}function d(e,t,n,o,a,d,h){if(n=l(n,"N"),o=l(o,"r"),a=l(a,"p"),d=l(d,"dkLen"),0===n||0!=(n&n-1))throw new Error("N must be power of 2");if(n>r/128/o)throw new Error("N too large");if(o>r/128/a)throw new Error("r too large");if(!f(e))throw new Error("password must be an array or buffer");if(e=Array.prototype.slice.call(e),!f(t))throw new Error("salt must be an array or buffer");t=Array.prototype.slice.call(t);let p=i(e,t,128*a*o);const g=new Uint32Array(32*a*o);for(let e=0;e<g.length;e++){const t=4*e;g[e]=(255&p[t+3])<<24|(255&p[t+2])<<16|(255&p[t+1])<<8|(255&p[t+0])<<0}const m=new Uint32Array(64*o),y=new Uint32Array(32*o*n),b=32*o,v=new Uint32Array(16),w=new Uint32Array(16),_=a*n*2;let E,A,S=0,k=null,x=!1,T=0,R=0;const O=h?parseInt(1e3/o):4294967295,I="undefined"!=typeof setImmediate?setImmediate:setTimeout,M=function(){if(x)return h(new Error("cancelled"),S/_);let t;switch(T){case 0:A=32*R*o,c(g,A,m,0,b),T=1,E=0;case 1:t=n-E,t>O&&(t=O);for(let e=0;e<t;e++)c(m,0,y,(E+e)*b,b),s(m,b,o,v,w);if(E+=t,S+=t,h){const e=parseInt(1e3*S/_);if(e!==k){if(x=h(null,S/_),x)break;k=e}}if(E<n)break;E=0,T=2;case 2:t=n-E,t>O&&(t=O);for(let e=0;e<t;e++){const e=m[16*(2*o-1)]&n-1;u(y,e*b,m,b),s(m,b,o,v,w)}if(E+=t,S+=t,h){const e=parseInt(1e3*S/_);if(e!==k){if(x=h(null,S/_),x)break;k=e}}if(E<n)break;if(c(m,0,g,A,b),R++,R<a){T=0;break}p=[];for(let e=0;e<g.length;e++)p.push(g[e]>>0&255),p.push(g[e]>>8&255),p.push(g[e]>>16&255),p.push(g[e]>>24&255);const r=i(e,p,d);return h&&h(null,1,r),r}h&&I(M)};if(!h)for(;;){const e=M();if(null!=e)return e}M()}const h={scrypt:function(e,t,r,n,i,s,o){return new Promise((function(a,u){let c=0;o&&o(0),d(e,t,r,n,i,s,(function(e,t,r){if(e)u(e);else if(r)o&&1!==c&&o(1),a(new Uint8Array(r));else if(o&&t!==c)return c=t,o(t)}))}))},syncScrypt:function(e,t,r,n,i,s){return new Uint8Array(d(e,t,r,n,i,s))}};e.exports=h}()}(Ea);var Aa=Ea.exports;const Sa=new be("networks/5.7.1");function ka(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 s=new t.PocketProvider(e,r.pocket);s.network&&-1===i.indexOf(s.network.name)&&n.push(s)}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"],s=new t.AnkrProvider(e,r.ankr);s.network&&-1===i.indexOf(s.network.name)&&n.push(s)}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 ka(e)},t}function xa(e,t){const r=function(r,n){return r.JsonRpcProvider?new r.JsonRpcProvider(e,t):null};return r.renetwork=function(t){return xa(e,t)},r}const Ta={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:ka("homestead")},Ra={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:ka("ropsten")},Oa={chainId:63,name:"classicMordor",_defaultProvider:xa("https://www.ethercluster.com/mordor","classicMordor")},Ia={unspecified:{chainId:0,name:"unspecified"},homestead:Ta,mainnet:Ta,morden:{chainId:2,name:"morden"},ropsten:Ra,testnet:Ra,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:ka("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:ka("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:ka("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:ka("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:xa("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:Oa,classicTestnet:Oa,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:xa("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:ka("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:ka("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"}};var Ma=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))};function Pa(e,t){return Ma(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(),s={};return n.headers.forEach?n.headers.forEach(((e,t)=>{s[t.toLowerCase()]=e})):n.headers.keys().forEach((e=>{s[e.toLowerCase()]=n.headers.get(e)})),{headers:s,statusCode:n.status,statusMessage:n.statusText,body:ke(new Uint8Array(i))}}))}var Na=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))};const Ca=new be("web/5.7.1");function Ba(e){return new Promise((t=>{setTimeout(t,e)}))}function Ua(e,t){if(null==e)return null;if("string"==typeof e)return e;if(Ee(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return Cr(e)}catch(e){}return Me(e)}return e}function La(e,t,r){let n=null;if(null!=t){n=Nr(t);const r="string"==typeof e?{url:e}:ht(e);if(r.headers){const e=0!==Object.keys(r.headers).filter((e=>"content-type"===e.toLowerCase())).length;e||(r.headers=ht(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};e=r}return function(e,t,r){const n="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;Ca.assertArgument(n>0&&n%1==0,"invalid connection throttle limit","connection.throttleLimit",n);const i="object"==typeof e?e.throttleCallback:null,s="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;Ca.assertArgument(s>0&&s%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",s);const o="object"==typeof e&&!!e.errorPassThrough,a={};let u=null;const c={method:"GET"};let f=!1,l=12e4;if("string"==typeof e)u=e;else if("object"==typeof e){if(null!=e&&null!=e.url||Ca.throwArgumentError("missing URL","connection.url",e),u=e.url,"number"==typeof e.timeout&&e.timeout>0&&(l=e.timeout),e.headers)for(const t in e.headers)a[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(f=!0);if(c.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==u.substring(0,6)&&!0!==e.allowInsecureAuthentication&&Ca.throwError("basic authentication requires a secure https url",be.errors.INVALID_ARGUMENT,{argument:"url",url:u,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;a.authorization={key:"Authorization",value:"Basic "+Hr(Nr(t))}}null!=e.skipFetchSetup&&(c.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(c.fetchOptions=ht(e.fetchOptions))}const d=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),h=u?u.match(d):null;if(h)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":h[1]||"text/plain"},body:h[2]?Kr(h[3]):(p=h[3],Nr(p.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))))};let t=e.body;return r&&(t=r(e.body,e)),Promise.resolve(t)}catch(e){Ca.throwError("processing response error",be.errors.SERVER_ERROR,{body:Ua(h[1],h[2]),error:e,requestBody:null,requestMethod:"GET",url:u})}var p;t&&(c.method="POST",c.body=t,null==a["content-type"]&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==a["content-length"]&&(a["content-length"]={key:"Content-Length",value:String(t.length)}));const g={};Object.keys(a).forEach((e=>{const t=a[e];g[t.key]=t.value})),c.headers=g;const m=function(){let e=null;return{promise:new Promise((function(t,r){l&&(e=setTimeout((()=>{null!=e&&(e=null,r(Ca.makeError("timeout",be.errors.TIMEOUT,{requestBody:Ua(c.body,g["content-type"]),requestMethod:c.method,timeout:l,url:u})))}),l))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),y=function(){return Na(this,void 0,void 0,(function*(){for(let e=0;e<n;e++){let t=null;try{if(t=yield Pa(u,c),e<n)if(301===t.statusCode||302===t.statusCode){const e=t.headers.location||"";if("GET"===c.method&&e.match(/^https:/)){u=t.headers.location;continue}}else if(429===t.statusCode){let r=!0;if(i&&(r=yield i(e,u)),r){let r=0;const n=t.headers["retry-after"];r="string"==typeof n&&n.match(/^[1-9][0-9]*$/)?1e3*parseInt(n):s*parseInt(String(Math.random()*Math.pow(2,e))),yield Ba(r);continue}}}catch(e){t=e.response,null==t&&(m.cancel(),Ca.throwError("missing response",be.errors.SERVER_ERROR,{requestBody:Ua(c.body,g["content-type"]),requestMethod:c.method,serverError:e,url:u}))}let a=t.body;if(f&&304===t.statusCode?a=null:!o&&(t.statusCode<200||t.statusCode>=300)&&(m.cancel(),Ca.throwError("bad response",be.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:Ua(a,t.headers?t.headers["content-type"]:null),requestBody:Ua(c.body,g["content-type"]),requestMethod:c.method,url:u})),r)try{const e=yield r(a,t);return m.cancel(),e}catch(r){if(r.throttleRetry&&e<n){let t=!0;if(i&&(t=yield i(e,u)),t){const t=s*parseInt(String(Math.random()*Math.pow(2,e)));yield Ba(t);continue}}m.cancel(),Ca.throwError("processing response error",be.errors.SERVER_ERROR,{body:Ua(a,t.headers?t.headers["content-type"]:null),error:r,requestBody:Ua(c.body,g["content-type"]),requestMethod:c.method,url:u})}return m.cancel(),a}return Ca.throwError("failed response",be.errors.SERVER_ERROR,{requestBody:Ua(c.body,g["content-type"]),requestMethod:c.method,url:u})}))}();return Promise.race([m.promise,y])}(e,n,((e,t)=>{let n=null;if(null!=e)try{n=JSON.parse(Cr(e))}catch(t){Ca.throwError("invalid JSON",be.errors.SERVER_ERROR,{body:e,error:t})}return r&&(n=r(n,t)),n}))}function ja(e,t){return t||(t={}),null==(t=ht(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,s=!1;const o=()=>!s&&(s=!0,i&&clearTimeout(i),!0);t.timeout&&(i=setTimeout((()=>{o()&&n(new Error("timeout"))}),t.timeout));const a=t.retryLimit;let u=0;!function i(){return e().then((function(e){if(void 0!==e)o()&&r(e);else if(t.oncePoll)t.oncePoll.once("poll",i);else if(t.onceBlock)t.onceBlock.once("block",i);else if(!s){if(u++,u>a)return void(o()&&n(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,u)));e<t.floor&&(e=t.floor),e>t.ceiling&&(e=t.ceiling),setTimeout(i,e)}return null}),(function(e){o()&&n(e)}))}()}))}for(var Da="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Fa={},qa=0;qa<32;qa++){var za=Da.charAt(qa);if(void 0!==Fa[za])throw new TypeError(za+" is ambiguous");Fa[za]=qa}function Ka(e){var t=e>>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function Ha(e){for(var t=1,r=0;r<e.length;++r){var n=e.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+e+")";t=Ka(t)^n>>5}for(t=Ka(t),r=0;r<e.length;++r){var i=e.charCodeAt(r);t=Ka(t)^31&i}return t}function Ga(e,t){if(t=t||90,e.length<8)return e+" too short";if(e.length>t)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 s=e.slice(0,i),o=e.slice(i+1);if(o.length<6)return"Data too short";var a=Ha(s);if("string"==typeof a)return a;for(var u=[],c=0;c<o.length;++c){var f=o.charAt(c),l=Fa[f];if(void 0===l)return"Unknown character "+f;a=Ka(a)^l,c+6>=o.length||u.push(l)}return 1!==a?"Invalid checksum for "+e:{prefix:s,words:u}}function Wa(e,t,r,n){for(var i=0,s=0,o=(1<<r)-1,a=[],u=0;u<e.length;++u)for(i=i<<t|e[u],s+=t;s>=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<<r-s&o);else{if(s>=t)return"Excess padding";if(i<<r-s&o)return"Non-zero padding"}return a}var Va={decodeUnsafe:function(){var e=Ga.apply(null,arguments);if("object"==typeof e)return e},decode:function(e){var t=Ga.apply(null,arguments);if("object"==typeof t)return t;throw new Error(t)},encode:function(e,t,r){if(r=r||90,e.length+7+t.length>r)throw new TypeError("Exceeds length limit");var n=Ha(e=e.toLowerCase());if("string"==typeof n)throw new Error(n);for(var i=e+"1",s=0;s<t.length;++s){var o=t[s];if(o>>5!=0)throw new Error("Non 5-bit word");n=Ka(n)^o,i+=Da.charAt(o)}for(s=0;s<6;++s)n=Ka(n);for(n^=1,s=0;s<6;++s){i+=Da.charAt(n>>5*(5-s)&31)}return i},toWordsUnsafe:function(e){var t=Wa(e,8,5,!0);if(Array.isArray(t))return t},toWords:function(e){var t=Wa(e,8,5,!0);if(Array.isArray(t))return t;throw new Error(t)},fromWordsUnsafe:function(e){var t=Wa(e,5,8,!1);if(Array.isArray(t))return t},fromWords:function(e){var t=Wa(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}},Xa=n(Va);const Ja="providers/5.7.2",$a=new be(Ja);class Ya{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),s=this.hash.bind(this),o=this.hex.bind(this),a=this.number.bind(this),u=this.type.bind(this);return e.transaction={hash:s,type:u,accessList:Ya.allowNull(this.accessList.bind(this),null),blockHash:Ya.allowNull(s,null),blockNumber:Ya.allowNull(a,null),transactionIndex:Ya.allowNull(a,null),confirmations:Ya.allowNull(a,null),from:t,gasPrice:Ya.allowNull(r),maxPriorityFeePerGas:Ya.allowNull(r),maxFeePerGas:Ya.allowNull(r),gasLimit:r,to:Ya.allowNull(t,null),value:r,nonce:a,data:i,r:Ya.allowNull(this.uint256),s:Ya.allowNull(this.uint256),v:Ya.allowNull(a),creates:Ya.allowNull(t,null),raw:Ya.allowNull(i)},e.transactionRequest={from:Ya.allowNull(t),nonce:Ya.allowNull(a),gasLimit:Ya.allowNull(r),gasPrice:Ya.allowNull(r),maxPriorityFeePerGas:Ya.allowNull(r),maxFeePerGas:Ya.allowNull(r),to:Ya.allowNull(t),value:Ya.allowNull(r),data:Ya.allowNull((e=>this.data(e,!0))),type:Ya.allowNull(a),accessList:Ya.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:s,address:t,topics:Ya.arrayOf(s),data:i,logIndex:a,blockHash:s},e.receipt={to:Ya.allowNull(this.address,null),from:Ya.allowNull(this.address,null),contractAddress:Ya.allowNull(t,null),transactionIndex:a,root:Ya.allowNull(o),gasUsed:r,logsBloom:Ya.allowNull(i),blockHash:s,transactionHash:s,logs:Ya.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:Ya.allowNull(a,null),cumulativeGasUsed:r,effectiveGasPrice:Ya.allowNull(r),status:Ya.allowNull(a),type:u},e.block={hash:Ya.allowNull(s),parentHash:s,number:a,timestamp:a,nonce:Ya.allowNull(o),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:Ya.allowNull(t),extraData:i,transactions:Ya.allowNull(Ya.arrayOf(s)),baseFeePerGas:Ya.allowNull(r)},e.blockWithTransactions=ht(e.block),e.blockWithTransactions.transactions=Ya.allowNull(Ya.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:Ya.allowNull(n,void 0),toBlock:Ya.allowNull(n,void 0),blockHash:Ya.allowNull(s,void 0),address:Ya.allowNull(t,void 0),topics:Ya.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:Ya.allowNull(a),blockHash:Ya.allowNull(s),transactionIndex:a,removed:Ya.allowNull(this.boolean.bind(this)),address:t,data:Ya.allowFalsish(i,"0x"),topics:Ya.arrayOf(s),transactionHash:s,logIndex:a},e}accessList(e){return $o(e||[])}number(e){return"0x"===e?0:He.from(e).toNumber()}type(e){return"0x"===e||null==e?0:He.from(e).toNumber()}bigNumber(e){return He.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),Oe(e))?e.toLowerCase():$a.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 ur(e)}callAddress(e){if(!Oe(e,32))return null;const t=ur(Ne(e,12));return t===_r?null:t}contractAddress(e){return cr(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||Oe(e))return Be(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return 32!==Pe(r)?$a.throwArgumentError("invalid hash","value",e):r}difficulty(e){if(null==e)return null;const t=He.from(e);try{return t.toNumber()}catch(e){}return null}uint256(e){if(!Oe(e))throw new Error("invalid uint256");return Ue(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=Ya.check(t,e);return n._difficulty=null==r?null:He.from(r),n}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return Ya.check(this.formats.transactionRequest,e)}transactionResponse(e){null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&He.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=Ya.check(this.formats.transaction,e);if(null!=e.chainId){let r=e.chainId;Oe(r)&&(r=He.from(r).toNumber()),t.chainId=r}else{let r=e.networkId;null==r&&null==t.v&&(r=e.chainId),Oe(r)&&(r=He.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 ta(e)}receiptLog(e){return Ya.check(this.formats.receiptLog,e)}receipt(e){const t=Ya.check(this.formats.receipt,e);if(null!=t.root)if(t.root.length<=4){const e=He.from(t.root).toNumber();0===e||1===e?(null!=t.status&&t.status!==e&&$a.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=e,delete t.root):$a.throwArgumentError("invalid alt-root-status","value.root",t.root)}else 66!==t.root.length&&$a.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 Ya.check(this.formats.filter,e)}filterLog(e){return Ya.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}}}var Qa=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))};const Za=new be(Ja);function eu(e){return null==e?"null":(32!==Pe(e)&&Za.throwArgumentError("invalid topic","topic",e),e.toLowerCase())}function tu(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[eu(e)]=!0}));const r=Object.keys(t);return r.sort(),r.join("|")}return eu(e)})).join("&")}function ru(e){if("string"==typeof e){if(32===Pe(e=e.toLowerCase()))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+tu(e);if(Gn.isForkEvent(e))throw Za.warn("not implemented"),new Error("not implemented");if(e&&"object"==typeof e)return"filter:"+(e.address||"*")+":"+tu(e.topics||[])}throw new Error("invalid event - "+e)}function nu(){return(new Date).getTime()}function iu(e){return new Promise((t=>{setTimeout(t,e)}))}const su=["block","network","pending","poll"];const ou={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 au(e){return Ue(He.from(e).toHexString(),32)}function uu(e){return wa.encode(xe([e,Ne(_a(_a(e)),0,4)]))}const cu=new RegExp("^(ipfs)://(.*)$","i"),fu=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),cu,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function lu(e,t){try{return Cr(du(e,t))}catch(e){}return null}function du(e,t){if("0x"===e)return null;const r=He.from(Ne(e,t,t+32)).toNumber(),n=He.from(Ne(e,r,r+32)).toNumber();return Ne(e,r+32,r+32+n)}function hu(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):Za.throwArgumentError("unsupported IPFS format","link",e),`https://gateway.ipfs.io/ipfs/${e}`}function pu(e){const t=ke(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 gu(e){if(e.length%32==0)return e;const t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function mu(e){const t=[];let r=0;for(let n=0;n<e.length;n++)t.push(null),r+=32;for(let n=0;n<e.length;n++){const i=ke(e[n]);t[n]=pu(r),t.push(pu(i.length)),t.push(gu(i)),r+=32+32*Math.ceil(i.length/32)}return Ce(t)}class yu{constructor(e,t,r,n){ft(this,"provider",e),ft(this,"name",r),ft(this,"address",e.formatter.address(t)),ft(this,"_resolvedAddress",n)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then((e=>He.from(e).eq(1))).catch((e=>{if(e.code===be.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e}))),this._supportsEip2544}_fetch(e,t){return Qa(this,void 0,void 0,(function*(){const r={to:this.address,ccipReadEnabled:!0,data:Ce([e,yn(this.name),t||"0x"])};let n=!1;(yield this.supportsWildcard())&&(n=!0,r.data=Ce(["0x9061b923",mu([bn(this.name),r.data])]));try{let e=yield this.provider.call(r);return ke(e).length%32==4&&Za.throwError("resolver threw error",be.errors.CALL_EXCEPTION,{transaction:r,data:e}),n&&(e=du(e,0)),e}catch(e){if(e.code===be.errors.CALL_EXCEPTION)return null;throw e}}))}_fetchBytes(e,t){return Qa(this,void 0,void 0,(function*(){const r=yield this._fetch(e,t);return null!=r?du(r,0):null}))}_getAddress(e,t){const r=ou[String(e)];if(null==r&&Za.throwError(`unsupported coin type: ${e}`,be.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),"eth"===r.ilk)return this.provider.formatter.address(t);const n=ke(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 uu(xe([[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 uu(xe([[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=Xa.toWords(n.slice(2));return e.unshift(t),Xa.encode(r.prefix,e)}}return null}getAddress(e){return Qa(this,void 0,void 0,(function*(){if(null==e&&(e=60),60===e)try{const e=yield this._fetch("0x3b3b57de");return"0x"===e||"0x0000000000000000000000000000000000000000000000000000000000000000"===e?null:this.provider.formatter.callAddress(e)}catch(e){if(e.code===be.errors.CALL_EXCEPTION)return null;throw e}const t=yield this._fetchBytes("0xf1cb7e06",au(e));if(null==t||"0x"===t)return null;const r=this._getAddress(e,t);return null==r&&Za.throwError("invalid or unsupported coin data",be.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r}))}getAvatar(){return Qa(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;r<fu.length;r++){const n=t.match(fu[r]);if(null==n)continue;const i=n[1].toLowerCase();switch(i){case"https":return e.push({type:"url",content:t}),{linkage:e,url:t};case"data":return e.push({type:"data",content:t}),{linkage:e,url:t};case"ipfs":return e.push({type:"ipfs",content:t}),{linkage:e,url:hu(t)};case"erc721":case"erc1155":{const r="erc721"===i?"0xc87b56dd":"0x0e89341c";e.push({type:i,content:t});const s=this._resolvedAddress||(yield this.getAddress()),o=(n[2]||"").split("/");if(2!==o.length)return null;const a=yield this.provider.formatter.address(o[0]),u=Ue(He.from(o[1]).toHexString(),32);if("erc721"===i){const t=this.provider.formatter.callAddress(yield this.provider.call({to:a,data:Ce(["0x6352211e",u])}));if(s!==t)return null;e.push({type:"owner",content:t})}else if("erc1155"===i){const t=He.from(yield this.provider.call({to:a,data:Ce(["0x00fdd58e",Ue(s,32),u])}));if(t.isZero())return null;e.push({type:"balance",content:t.toString()})}const c={to:this.provider.formatter.address(o[0]),data:Ce([r,u])};let f=lu(yield this.provider.call(c),0);if(null==f)return null;e.push({type:"metadata-url-base",content:f}),"erc1155"===i&&(f=f.replace("{id}",u.substring(2)),e.push({type:"metadata-url-expanded",content:f})),f.match(/^ipfs:/i)&&(f=hu(f)),e.push({type:"metadata-url",content:f});const l=yield La(f);if(!l)return null;e.push({type:"metadata",content:JSON.stringify(l)});let d=l.image;if("string"!=typeof d)return null;if(d.match(/^(https:\/\/|data:)/i));else{if(null==d.match(cu))return null;e.push({type:"url-ipfs",content:d}),d=hu(d)}return e.push({type:"url",content:d}),{linkage:e,url:d}}}}}catch(e){}return null}))}getContentHash(){return Qa(this,void 0,void 0,(function*(){const e=yield this._fetchBytes("0xbc1c58d1");if(null==e||"0x"===e)return null;const t=e.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const e=parseInt(t[3],16);if(t[4].length===2*e)return"ipfs://"+wa.encode("0x"+t[1])}const r=e.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){const e=parseInt(r[3],16);if(r[4].length===2*e)return"ipns://"+wa.encode("0x"+r[1])}const n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&64===n[1].length)return"bzz://"+n[1];const i=e.match(/^0x90b2c605([0-9a-f]*)$/);if(i&&68===i[1].length){const e={"=":"","+":"-","/":"_"},t=Hr("0x"+i[1]).replace(/[=+\/]/g,(t=>e[t]));return"sia://"+t}return Za.throwError("invalid or unsupported content hash data",be.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})}))}getText(e){return Qa(this,void 0,void 0,(function*(){let t=Nr(e);t=xe([au(64),au(t.length),t]),t.length%32!=0&&(t=xe([t,Ue("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",Me(t));return null==r||"0x"===r?null:Cr(r)}))}}let bu=null,vu=1;class wu extends Wn{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),ft(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=lt(new.target,"getNetwork")(e);t?(ft(this,"_network",t),this.emit("network",t,null)):Za.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return Qa(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||Za.throwError("no network detected",be.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=e:ft(this,"_network",e),this.emit("network",e,null))}return this._network}))}get ready(){return ja((()=>this._ready().then((e=>e),(e=>{if(e.code!==be.errors.NETWORK_ERROR||"noNetwork"!==e.event)throw e}))))}static getFormatter(){return null==bu&&(bu=new Ya),bu}static getNetwork(e){return function(e){if(null==e)return null;if("number"==typeof e){for(const t in Ia){const r=Ia[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=Ia[e];return null==t?null:{name:t.name,chainId:t.chainId,ensAddress:t.ensAddress,_defaultProvider:t._defaultProvider||null}}const t=Ia[e.name];if(!t)return"number"!=typeof e.chainId&&Sa.throwArgumentError("invalid network chainId","network",e),e;0!==e.chainId&&e.chainId!==t.chainId&&Sa.throwArgumentError("network chainId mismatch","network",e);let r=e._defaultProvider||null;var n;return null==r&&t._defaultProvider&&(r=(n=t._defaultProvider)&&"function"==typeof n.renetwork?t._defaultProvider.renetwork(e):t._defaultProvider),{name:e.name,chainId:t.chainId,ensAddress:e.ensAddress||t.ensAddress||null,_defaultProvider:r}}(null==e?"homestead":e)}ccipReadFetch(e,t,r){return Qa(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===r.length)return null;const n=e.to.toLowerCase(),i=t.toLowerCase(),s=[];for(let e=0;e<r.length;e++){const t=r[e],o=t.replace("{sender}",n).replace("{data}",i),a=t.indexOf("{data}")>=0?null:JSON.stringify({data:i,sender:n}),u=yield La({url:o,errorPassThrough:!0},a,((e,t)=>(e.status=t.statusCode,e)));if(u.data)return u.data;const c=u.message||"unknown error";if(u.status>=400&&u.status<500)return Za.throwError(`response not found during CCIP fetch: ${c}`,be.errors.SERVER_ERROR,{url:t,errorMessage:c});s.push(c)}return Za.throwError(`error encountered during CCIP fetch: ${s.map((e=>JSON.stringify(e))).join(", ")}`,be.errors.SERVER_ERROR,{urls:r,errorMessages:s})}))}_getInternalBlockNumber(e){return Qa(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(nu()-r.respTime<=e)return r.blockNumber;break}catch(e){if(this._internalBlockNumber===t)break}}const t=nu(),r=dt({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=nu();return(e=He.from(e).toNumber())<this._maxInternalBlockNumber&&(e=this._maxInternalBlockNumber),this._maxInternalBlockNumber=e,this._setFastBlockNumber(e),{blockNumber:e,reqTime:t,respTime:i}}));return this._internalBlockNumber=r,r.catch((e=>{this._internalBlockNumber===r&&(this._internalBlockNumber=null)})),(yield r).blockNumber}))}poll(){return Qa(this,void 0,void 0,(function*(){const e=vu++,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)Za.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",Za.makeError("network block skew detected",be.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 s=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(s)}}})),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 Qa(this,void 0,void 0,(function*(){return Za.throwError("provider does not support network detection",be.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return Qa(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 iu(0),this._network;const r=Za.makeError("underlying network changed",be.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=nu();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&&e<this._fastBlockNumber||(this._fastQueryDate=nu(),(null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,r){return Qa(this,void 0,void 0,(function*(){return this._waitForTransaction(e,null==t?1:t,r||0,null)}))}_waitForTransaction(e,t,r,n){return Qa(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(e);return(i?i.confirmations:0)>=t?i:new Promise(((i,s)=>{const o=[];let a=!1;const u=function(){return!!a||(a=!0,o.forEach((e=>{e()})),!1)},c=e=>{e.confirmations<t||u()||i(e)};if(this.on(e,c),o.push((()=>{this.removeListener(e,c)})),n){let r=n.startBlock,i=null;const c=o=>Qa(this,void 0,void 0,(function*(){a||(yield iu(1e3),this.getTransactionCount(n.from).then((f=>Qa(this,void 0,void 0,(function*(){if(!a){if(f<=n.nonce)r=o;else{{const t=yield this.getTransaction(e);if(t&&null!=t.blockNumber)return}for(null==i&&(i=r-3,i<n.startBlock&&(i=n.startBlock));i<=o;){if(a)return;const r=yield this.getBlockWithTransactions(i);for(let i=0;i<r.transactions.length;i++){const o=r.transactions[i];if(o.hash===e)return;if(o.from===n.from&&o.nonce===n.nonce){if(a)return;const r=yield this.waitForTransaction(o.hash,t);if(u())return;let i="replaced";return o.data===n.data&&o.to===n.to&&o.value.eq(n.value)?i="repriced":"0x"===o.data&&o.from===o.to&&o.value.isZero()&&(i="cancelled"),void s(Za.makeError("transaction was replaced",be.errors.TRANSACTION_REPLACED,{cancelled:"replaced"===i||"cancelled"===i,reason:i,replacement:this._wrapTransaction(o),hash:e,receipt:r}))}}i++}}a||this.once("block",c)}}))),(e=>{a||this.once("block",c)})))}));if(a)return;this.once("block",c),o.push((()=>{this.removeListener("block",c)}))}if("number"==typeof r&&r>0){const e=setTimeout((()=>{u()||s(Za.makeError("timeout exceeded",be.errors.TIMEOUT,{timeout:r}))}),r);e.unref&&e.unref(),o.push((()=>{clearTimeout(e)}))}}))}))}getBlockNumber(){return Qa(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return Qa(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return He.from(e)}catch(t){return Za.throwError("bad result from backend",be.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}}))}getBalance(e,t){return Qa(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield dt({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getBalance",r);try{return He.from(n)}catch(e){return Za.throwError("bad result from backend",be.errors.SERVER_ERROR,{method:"getBalance",params:r,result:n,error:e})}}))}getTransactionCount(e,t){return Qa(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield dt({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getTransactionCount",r);try{return He.from(n).toNumber()}catch(e){return Za.throwError("bad result from backend",be.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:n,error:e})}}))}getCode(e,t){return Qa(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield dt({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getCode",r);try{return Me(n)}catch(e){return Za.throwError("bad result from backend",be.errors.SERVER_ERROR,{method:"getCode",params:r,result:n,error:e})}}))}getStorageAt(e,t,r){return Qa(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield dt({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then((e=>Be(e)))}),i=yield this.perform("getStorageAt",n);try{return Me(i)}catch(e){return Za.throwError("bad result from backend",be.errors.SERVER_ERROR,{method:"getStorageAt",params:n,result:i,error:e})}}))}_wrapTransaction(e,t,r){if(null!=t&&32!==Pe(t))throw new Error("invalid response - sendTransaction");const n=e;return null!=t&&e.hash!==t&&Za.throwError("Transaction hash mismatch from Provider.sendTransaction.",be.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),n.wait=(t,n)=>Qa(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 s=yield this._waitForTransaction(e.hash,t,n,i);return null==s&&0===t?null:(this._emitted["t:"+e.hash]=s.blockNumber,0===s.status&&Za.throwError("transaction failed",be.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:s}),s)})),n}sendTransaction(e){return Qa(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then((e=>Me(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 Qa(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?He.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?Me(e):null)))})),this.formatter.transactionRequest(yield dt(r))}))}_getFilter(e){return Qa(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 dt(t))}))}_call(e,t,r){return Qa(this,void 0,void 0,(function*(){r>=10&&Za.throwError("CCIP read exceeded maximum redirections",be.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)&&Pe(i)%32==4)try{const s=Ne(i,4),o=Ne(s,0,32);He.from(o).eq(n)||Za.throwError("CCIP Read sender did not match",be.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const a=[],u=He.from(Ne(s,32,64)).toNumber(),c=He.from(Ne(s,u,u+32)).toNumber(),f=Ne(s,u+32);for(let t=0;t<c;t++){const r=lu(f,32*t);null==r&&Za.throwError("CCIP Read contained corrupt URL string",be.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i}),a.push(r)}const l=du(s,64);He.from(Ne(s,100,128)).isZero()||Za.throwError("CCIP Read callback selector included junk",be.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const d=Ne(s,96,100),h=du(s,128),p=yield this.ccipReadFetch(e,l,a);null==p&&Za.throwError("CCIP Read disabled or provided no URLs",be.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const g={to:n,data:Ce([d,mu([p,h])])};return this._call(g,t,r+1)}catch(e){if(e.code===be.errors.SERVER_ERROR)throw e}try{return Me(i)}catch(r){return Za.throwError("bad result from backend",be.errors.SERVER_ERROR,{method:"call",params:{transaction:e,blockTag:t},result:i,error:r})}}))}call(e,t){return Qa(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield dt({transaction:this._getTransactionRequest(e),blockTag:this._getBlockTag(t),ccipReadEnabled:Promise.resolve(e.ccipReadEnabled)});return this._call(r.transaction,r.blockTag,r.ccipReadEnabled?0:-1)}))}estimateGas(e){return Qa(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield dt({transaction:this._getTransactionRequest(e)}),r=yield this.perform("estimateGas",t);try{return He.from(r)}catch(e){return Za.throwError("bad result from backend",be.errors.SERVER_ERROR,{method:"estimateGas",params:t,result:r,error:e})}}))}_getAddress(e){return Qa(this,void 0,void 0,(function*(){"string"!=typeof(e=yield e)&&Za.throwArgumentError("invalid address or ENS name","name",e);const t=yield this.resolveName(e);return null==t&&Za.throwError("ENS name not configured",be.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(e)})`}),t}))}_getBlock(e,t){return Qa(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;let r=-128;const n={includeTransactions:!!t};if(Oe(e,32))n.blockHash=e;else try{n.blockTag=yield this._getBlockTag(e),Oe(n.blockTag)&&(r=parseInt(n.blockTag.substring(2),16))}catch(t){Za.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",e)}return ja((()=>Qa(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;r<e.transactions.length;r++){const n=e.transactions[r];if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){null==t&&(t=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let e=t-n.blockNumber+1;e<=0&&(e=1),n.confirmations=e}}const r=this.formatter.blockWithTransactions(e);return r.transactions=r.transactions.map((e=>this._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 Qa(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return ja((()=>Qa(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 Qa(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return ja((()=>Qa(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 Qa(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield dt({filter:this._getFilter(e)}),r=yield this.perform("getLogs",t);return r.forEach((e=>{null==e.removed&&(e.removed=!1)})),Ya.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)}))}getEtherPrice(){return Qa(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(e){return Qa(this,void 0,void 0,(function*(){if("number"==typeof(e=yield e)&&e<0){e%1&&Za.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 Qa(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 yu(this,r,e);return t===e||(yield n.supportsWildcard())?n:null}t=t.split(".").slice(1).join(".")}}))}_getResolver(e,t){return Qa(this,void 0,void 0,(function*(){null==t&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||Za.throwError("network does not support ENS",be.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const t=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+yn(e).substring(2)});return this.formatter.callAddress(t)}catch(e){}return null}))}resolveName(e){return Qa(this,void 0,void 0,(function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(t){if(Oe(e))throw t}"string"!=typeof e&&Za.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null}))}lookupAddress(e){return Qa(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=lu(yield this.call({to:r,data:"0x691f3431"+yn(t).substring(2)}),0);return(yield this.resolveName(n))!=e?null:n}))}getAvatar(e){return Qa(this,void 0,void 0,(function*(){let t=null;if(Oe(e)){const r=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"getAvatar");if(!n)return null;t=new yu(this,n,r);try{const e=yield t.getAvatar();if(e)return e.url}catch(e){if(e.code!==be.errors.CALL_EXCEPTION)throw e}try{const e=lu(yield this.call({to:n,data:"0x691f3431"+yn(r).substring(2)}),0);t=yield this.getResolver(e)}catch(e){if(e.code!==be.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 Za.throwError(e+" not implemented",be.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 class{constructor(e,t,r){ft(this,"tag",e),ft(this,"listener",t),ft(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||su.indexOf(this.tag)>=0}}(ru(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=ru(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=ru(e);return this._events.filter((e=>e.tag===t)).length}listeners(e){if(null==e)return this._events.map((e=>e.listener));let t=ru(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=ru(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=ru(e);this._events=this._events.filter((e=>e.tag!==r||(t.push(e),!1)))}return t.forEach((e=>{this._stopEvent(e)})),this}}var _u=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))};const Eu=new be(Ja),Au=["call","estimateGas"];function Su(e,t){if(null==e)return null;if("string"==typeof e.message&&e.message.match("reverted")){const r=Oe(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=Su(e[r],t);if(n)return n}return null}if("string"==typeof e)try{return Su(JSON.parse(e),t)}catch(e){}return null}function ku(e,t,r){const n=r.transaction||r.signedTransaction;if("call"===e){const e=Su(t,!0);if(e)return e.data;Eu.throwError("missing revert data in call exception; Transaction reverted without a reason string",be.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:t})}if("estimateGas"===e){let r=Su(t.body,!1);null==r&&(r=Su(t,!1)),r&&Eu.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",be.errors.UNPREDICTABLE_GAS_LIMIT,{reason:r.message,method:e,transaction:n,error:t})}let i=t.message;throw t.code===be.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)&&Eu.throwError("insufficient funds for intrinsic transaction cost",be.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:n}),i.match(/nonce (is )?too low/i)&&Eu.throwError("nonce has already been used",be.errors.NONCE_EXPIRED,{error:t,method:e,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&Eu.throwError("replacement fee too low",be.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:n}),i.match(/only replay-protected/i)&&Eu.throwError("legacy pre-eip-155 transactions not supported",be.errors.UNSUPPORTED_OPERATION,{error:t,method:e,transaction:n}),Au.indexOf(e)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&Eu.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",be.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:n}),t}function xu(e){return new Promise((function(t){setTimeout(t,e)}))}function Tu(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 Ru(e){return e?e.toLowerCase():e}const Ou={};class Iu extends Yn{constructor(e,t,r){if(super(),e!==Ou)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");ft(this,"provider",t),null==r&&(r=0),"string"==typeof r?(ft(this,"_address",this.provider.formatter.address(r)),ft(this,"_index",null)):"number"==typeof r?(ft(this,"_index",r),ft(this,"_address",null)):Eu.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return Eu.throwError("cannot alter JSON-RPC Signer connection",be.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new Mu(Ou,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&&Eu.throwError("unknown account #"+this._index,be.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index]))))}sendUncheckedTransaction(e){e=ht(e);const t=this.getAddress().then((e=>(e&&(e=e.toLowerCase()),e)));if(null==e.gasLimit){const r=ht(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return null!=e.to&&(e.to=Promise.resolve(e.to).then((e=>_u(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.provider.resolveName(e);return null==t&&Eu.throwArgumentError("provided ENS name resolves to null","tx.to",e),t}))))),dt({tx:dt(e),sender:t}).then((({tx:t,sender:r})=>{null!=t.from?t.from.toLowerCase()!==r&&Eu.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)&&Eu.throwError("user rejected transaction",be.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:t}),ku("sendTransaction",e,n))))}))}signTransaction(e){return Eu.throwError("signing transactions is unsupported",be.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return _u(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 ja((()=>_u(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 _u(this,void 0,void 0,(function*(){const t="string"==typeof e?Nr(e):e,r=yield this.getAddress();try{return yield this.provider.send("personal_sign",[Me(t),r.toLowerCase()])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&Eu.throwError("user rejected signing",be.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),t}}))}_legacySignMessage(e){return _u(this,void 0,void 0,(function*(){const t="string"==typeof e?Nr(e):e,r=yield this.getAddress();try{return yield this.provider.send("eth_sign",[r.toLowerCase(),Me(t)])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&Eu.throwError("user rejected signing",be.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),t}}))}_signTypedData(e,t,r){return _u(this,void 0,void 0,(function*(){const n=yield Cn.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(Cn.getPayload(n.domain,t,n.value))])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&Eu.throwError("user rejected signing",be.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:n.domain,types:t,value:n.value}}),e}}))}unlock(e){return _u(this,void 0,void 0,(function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])}))}}class Mu extends Iu{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 Pu={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};let Nu=class extends wu{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=lt(this.constructor,"defaultUrl")()),ft(this,"connection","string"==typeof e?Object.freeze({url:e}):Object.freeze(ht(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 _u(this,void 0,void 0,(function*(){yield xu(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=lt(this.constructor,"getNetwork");try{return t(He.from(e).toNumber())}catch(t){return Eu.throwError("could not detect network",be.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:t})}}return Eu.throwError("could not detect network",be.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(e){return new Iu(Ou,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:yt(r),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(n&&this._cache[e])return this._cache[e];const i=La(this.connection,JSON.stringify(r),Tu).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",[Ru(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[Ru(t.address),t.blockTag]];case"getCode":return["eth_getCode",[Ru(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[Ru(t.address),Ue(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",[lt(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[lt(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=Ru(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return _u(this,void 0,void 0,(function*(){if("call"===e||"estimateGas"===e){const e=t.transaction;if(e&&null!=e.type&&He.from(e.type).isZero()&&null==e.maxFeePerGas&&null==e.maxPriorityFeePerGas){const r=yield this.getFeeData();null==r.maxFeePerGas&&null==r.maxPriorityFeePerGas&&((t=ht(t)).transaction=ht(e),delete t.transaction.type)}}const r=this.prepareRequest(e,t);null==r&&Eu.throwError(e+" not implemented",be.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(r){return ku(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 xu(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=ht(Pu);if(t)for(const e in t)t[e]&&(r[e]=!0);!function(e,t){e&&"object"==typeof e||ct.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((r=>{t[r]||ct.throwArgumentError("invalid object key - "+r,"transaction:"+r,e)}))}(e,r);const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(t){if(null==e[t])return;const r=Be(He.from(e[t]));"gasLimit"===t&&(t="gas"),n[t]=r})),["from","to","data"].forEach((function(t){null!=e[t]&&(n[t]=Me(e[t]))})),e.accessList&&(n.accessList=$o(e.accessList)),n}};const Cu=new be(Ja);let Bu=1;function Uu(e,t){const r="Web3LegacyFetcher";return function(e,n){const i={method:e,params:n,id:Bu++,jsonrpc:"2.0"};return new Promise(((e,n)=>{this.emit("debug",{action:"request",fetcher:r,request:yt(i),provider:this}),t(i,((t,s)=>{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:s,provider:this}),s.error){const e=new Error(s.error.message);return e.code=s.error.code,e.data=s.error.data,n(e)}e(s.result)}))}))}}class Lu extends Nu{constructor(e,t){null==e&&Cu.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:yt(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=Uu(0,e.sendAsync.bind(e)):e.send?n=Uu(0,e.send.bind(e)):Cu.throwArgumentError("unsupported provider","provider",e),r||(r="unknown:")),super(r,t),ft(this,"jsonRpcFetchFunc",n),ft(this,"provider",i)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}const ju=new RegExp("^bytes([0-9]+)$"),Du=new RegExp("^(u?int)([0-9]*)$"),Fu=new RegExp("^(.*)\\[([0-9]*)\\]$"),qu="0000000000000000000000000000000000000000000000000000000000000000",zu=new be("solidity/5.7.0");function Ku(e,t,r){switch(e){case"address":return r?Re(t,32):ke(t);case"string":return Nr(t);case"bytes":return ke(t);case"bool":return t=t?"0x01":"0x00",r?Re(t,32):ke(t)}let n=e.match(Du);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!=0||0===i||i>256)&&zu.throwArgumentError("invalid number type","type",e),r&&(i=256),Re(t=He.from(t).toTwos(i),i/8)}if(n=e.match(ju),n){const i=parseInt(n[1]);return(String(i)!==n[1]||0===i||i>32)&&zu.throwArgumentError("invalid bytes type","type",e),ke(t).byteLength!==i&&zu.throwArgumentError(`invalid value for ${e}`,"value",t),r?ke((t+qu).substring(0,66)):t}if(n=e.match(Fu),n&&Array.isArray(t)){const r=n[1];parseInt(n[2]||String(t.length))!=t.length&&zu.throwArgumentError(`invalid array length for ${e}`,"value",t);const i=[];return t.forEach((function(e){i.push(Ku(r,e,!0))})),xe(i)}return zu.throwArgumentError("invalid type","type",e)}function Hu(e,t){e.length!=t.length&&zu.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);const r=[];return e.forEach((function(e,n){r.push(Ku(e,t[n]))})),Me(xe(r))}const Gu=new be("units/5.7.0"),Wu=["wei","kwei","mwei","gwei","szabo","finney","ether"];function Vu(e,t){if("string"!=typeof e&&Gu.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=Wu.indexOf(t);-1!==e&&(t=3*e)}return nt(e,null!=t?t:18)}var Xu={},Ju=Qu;Qu.strict=Zu,Qu.loose=ec;var $u=Object.prototype.toString,Yu={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function Qu(e){return Zu(e)||ec(e)}function Zu(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function ec(e){return Yu[$u.call(e)]}var tc=Ju.strict,rc=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Xu,"__esModule",{value:!0});const nc=rc(Ju),ic=rc((function(e){if(tc(e)){var t=Buffer.from(e.buffer);return e.byteLength!==e.buffer.byteLength&&(t=t.slice(e.byteOffset,e.byteOffset+e.byteLength)),t}return Buffer.from(e)})),sc="hex",oc="utf8",ac="0";function uc(e){return new Uint8Array(e)}function cc(e,t=!1){const r=e.toString(sc);return t?Gc(r):r}function fc(e){return e.toString(oc)}function lc(e){return e.readUIntBE(0,e.length)}function dc(e){return ic.default(e)}function hc(e,t=!1){return cc(dc(e),t)}function pc(e){return fc(dc(e))}function gc(e){return lc(dc(e))}function mc(e){return Array.from(e).map(xc).join("")}function yc(e){return Buffer.from(Kc(e),sc)}Xu.bufferToArray=uc,Xu.bufferToHex=cc,Xu.bufferToUtf8=fc,Xu.bufferToNumber=lc,Xu.bufferToBinary=function(e){return mc(uc(e))},Xu.arrayToBuffer=dc,Xu.arrayToHex=hc,Xu.arrayToUtf8=pc,Xu.arrayToNumber=gc,Xu.arrayToBinary=mc;var bc=Xu.hexToBuffer=yc;function vc(e){return uc(yc(e))}function wc(e){return mc(vc(e))}Xu.hexToArray=vc,Xu.hexToUtf8=function(e){return fc(yc(e))},Xu.hexToNumber=function(e){return gc(vc(e))};var _c=Xu.hexToBinary=wc;function Ec(e){return Buffer.from(e,oc)}function Ac(e){return uc(Ec(e))}Xu.utf8ToBuffer=Ec,Xu.utf8ToArray=Ac;var Sc=Xu.utf8ToHex=function(e,t=!1){return cc(Ec(e),t)};Xu.utf8ToNumber=function(e){const t=parseInt(e,10);return function(e,t){if(!e)throw new Error(t)}(!function(e){return void 0===e}(t),"Number can only safely store up to 53 bits"),t},Xu.utf8ToBinary=function(e){return mc(Ac(e))},Xu.numberToBuffer=function(e){return Tc(xc(e))},Xu.numberToArray=function(e){return Rc(xc(e))};var kc=Xu.numberToHex=function(e,t){return Oc(xc(e),t)};function xc(e){return Dc((e>>>0).toString(2))}function Tc(e){return dc(Rc(e))}function Rc(e){return new Uint8Array(Lc(e).map((e=>parseInt(e,2))))}function Oc(e,t){return hc(Rc(e),t)}Xu.numberToUtf8=function(e){return`${e}`},Xu.numberToBinary=xc,Xu.binaryToBuffer=Tc,Xu.binaryToArray=Rc,Xu.binaryToHex=Oc,Xu.binaryToUtf8=function(e){return pc(Rc(e))};var Ic=Xu.binaryToNumber=function(e){return gc(Rc(e))};function Mc(e){return!("string"!=typeof e||!new RegExp(/^[01]+$/).test(e))&&e.length%8==0}function Pc(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}function Nc(e){return Buffer.isBuffer(e)}function Cc(e){return nc.default.strict(e)&&!Nc(e)}function Bc(e){return!Cc(e)&&!Nc(e)&&void 0!==e.byteLength}function Uc(e,t=8){const r=e%t;return r?(e-r)/t*t+t:e}function Lc(e,t=8){const r=Dc(e).match(new RegExp(`.{${t}}`,"gi"));return Array.from(r||[])}function jc(e){return Lc(e).map(Xc).join("")}function Dc(e,t=8,r=ac){return qc(e,Uc(e.length,t),r)}Xu.isBinaryString=Mc,Xu.isHexString=Pc,Xu.isBuffer=Nc,Xu.isTypedArray=Cc,Xu.isArrayBuffer=Bc,Xu.getType=function(e){return Nc(e)?"buffer":Cc(e)?"typed-array":Bc(e)?"array-buffer":Array.isArray(e)?"array":typeof e},Xu.getEncoding=function(e){return Mc(e)?"binary":Pc(e)?sc:oc},Xu.concatBuffers=function(...e){return Buffer.concat(e)},Xu.concatArrays=function(...e){let t=[];return e.forEach((e=>t=t.concat(Array.from(e)))),new Uint8Array([...t])},Xu.trimLeft=function(e,t){const r=e.length-t;return r>0&&(e=e.slice(r)),e},Xu.trimRight=function(e,t){return e.slice(0,t)},Xu.calcByteLength=Uc,Xu.splitBytes=Lc,Xu.swapBytes=jc,Xu.swapHex=function(e){return Oc(jc(wc(e)))};var Fc=Xu.sanitizeBytes=Dc;function qc(e,t,r=ac){return Jc(e,t,!0,r)}var zc=Xu.padLeft=qc;function Kc(e){return e.replace(/^0x/,"")}Xu.padRight=function(e,t,r=ac){return Jc(e,t,!1,r)};var Hc=Xu.removeHexPrefix=Kc;function Gc(e){return e.startsWith("0x")?e:`0x${e}`}var Wc=Xu.addHexPrefix=Gc;var Vc=Xu.sanitizeHex=function(e){return(e=Dc(e=Kc(e),2))&&(e=Gc(e)),e};function Xc(e){return e.split("").reverse().join("")}function Jc(e,t,r,n=ac){const i=t-e.length;let s=e;if(i>0){const t=n.repeat(i);s=r?t+e:e+t}return s}Xu.removeHexLeadingZeros=function(e){const t=e.startsWith("0x");return e=(e=Kc(e)).startsWith(ac)?e.substring(1):e,t?Gc(e):e};var $c={},Yc="6.5.4",Qc={},Zc={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 s;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:oe.Buffer}catch(e){}function o(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(e,t,r){var n=o(e,r);return r-1>=t&&(n|=o(e,r-1)<<4),n}function u(e,t,r,n){for(var i=0,s=Math.min(e.length,r),o=t;o<s;o++){var a=e.charCodeAt(o)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}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<e.length&&(16===t?this._parseHex(e,i,n):(this._parseBase(e,t,i),"le"===n&&this._initArray(this.toArray(),t,n)))},i.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},i.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var s,o,a=0;if("be"===n)for(i=e.length-1,s=0;i>=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===n)for(i=0,s=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);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<this.length;n++)this.words[n]=0;var i,s=0,o=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)i=a(e,t,n)<<s,this.words[o]|=67108863&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=a(e,t,n)<<s,this.words[o]|=67108863&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=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 s=e.length-r,o=s%n,a=Math.min(s,s-o)+r,c=0,f=r;f<a;f+=n)c=u(e,f,f+n,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==o){var l=1;for(c=u(e,f,e.length,t),f=0;f<o;f++)l*=t;this.imuln(l),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&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?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","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"],f=[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],l=[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],s=0|t.words[0],o=i*s,a=67108863&o,u=o/67108864|0;r.words[0]=a;for(var c=1;c<n;c++){for(var f=u>>>26,l=67108863&u,d=Math.min(c,t.length-1),h=Math.max(0,c-e.length+1);h<=d;h++){var p=c-h|0;f+=(o=(i=0|e.words[p])*(s=0|t.words[h])+l)/67108864|0,l=67108863&o}r.words[c]=0|l,u=0|f}return 0!==u?r.words[c]=0|u: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,s=0,o=0;o<this.length;o++){var a=this.words[o],u=(16777215&(a<<i|s)).toString(16);n=0!==(s=a>>>24-i&16777215)||o!==this.length-1?c[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,o--)}for(0!==s&&(n=s.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=f[e],h=l[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(h).toString(e);n=(p=p.idivn(h)).isZero()?g+n:c[d-g.length]+g+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!==s),this.toArrayLike(s,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(),s=n||Math.max(1,i);r(i<=s,"byte array longer than desired length"),r(s>0,"Requested array length <= 0"),this.strip();var o,a,u="le"===t,c=new e(s),f=this.clone();if(u){for(a=0;!f.isZero();a++)o=f.andln(255),f.iushrn(8),c[a]=o;for(;a<s;a++)c[a]=0}else{for(a=0;a<s-i;a++)c[a]=0;for(a=0;!f.isZero();a++)o=f.andln(255),f.iushrn(8),c[s-a-1]=o}return c},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 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(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;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},i.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.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;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},i.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.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;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},i.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.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;i<t;i++)this.words[i]=67108863&~this.words[i];return n>0&&(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<<i:this.words[n]&~(1<<i),this.strip()},i.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var i=0,s=0;s<n.length;s++)t=(0|r.words[s])+(0|n.words[s])+i,this.words[s]=67108863&t,i=t>>>26;for(;0!==i&&s<r.length;s++)t=(0|r.words[s])+i,this.words[s]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.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 s=0,o=0;o<n.length;o++)s=(t=(0|r.words[o])-(0|n.words[o])+s)>>26,this.words[o]=67108863&t;for(;0!==s&&o<r.length;o++)s=(t=(0|r.words[o])+s)>>26,this.words[o]=67108863&t;if(0===s&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var n,i,s,o=e.words,a=t.words,u=r.words,c=0,f=0|o[0],l=8191&f,d=f>>>13,h=0|o[1],p=8191&h,g=h>>>13,m=0|o[2],y=8191&m,b=m>>>13,v=0|o[3],w=8191&v,_=v>>>13,E=0|o[4],A=8191&E,S=E>>>13,k=0|o[5],x=8191&k,T=k>>>13,R=0|o[6],O=8191&R,I=R>>>13,M=0|o[7],P=8191&M,N=M>>>13,C=0|o[8],B=8191&C,U=C>>>13,L=0|o[9],j=8191&L,D=L>>>13,F=0|a[0],q=8191&F,z=F>>>13,K=0|a[1],H=8191&K,G=K>>>13,W=0|a[2],V=8191&W,X=W>>>13,J=0|a[3],$=8191&J,Y=J>>>13,Q=0|a[4],Z=8191&Q,ee=Q>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],se=8191&ie,oe=ie>>>13,ae=0|a[7],ue=8191&ae,ce=ae>>>13,fe=0|a[8],le=8191&fe,de=fe>>>13,he=0|a[9],pe=8191&he,ge=he>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(c+(n=Math.imul(l,q))|0)+((8191&(i=(i=Math.imul(l,z))+Math.imul(d,q)|0))<<13)|0;c=((s=Math.imul(d,z))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(g,q)|0,s=Math.imul(g,z);var ye=(c+(n=n+Math.imul(l,H)|0)|0)+((8191&(i=(i=i+Math.imul(l,G)|0)+Math.imul(d,H)|0))<<13)|0;c=((s=s+Math.imul(d,G)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,q),i=(i=Math.imul(y,z))+Math.imul(b,q)|0,s=Math.imul(b,z),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(g,H)|0,s=s+Math.imul(g,G)|0;var be=(c+(n=n+Math.imul(l,V)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(d,V)|0))<<13)|0;c=((s=s+Math.imul(d,X)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(_,q)|0,s=Math.imul(_,z),n=n+Math.imul(y,H)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(b,H)|0,s=s+Math.imul(b,G)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(g,V)|0,s=s+Math.imul(g,X)|0;var ve=(c+(n=n+Math.imul(l,$)|0)|0)+((8191&(i=(i=i+Math.imul(l,Y)|0)+Math.imul(d,$)|0))<<13)|0;c=((s=s+Math.imul(d,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(A,q),i=(i=Math.imul(A,z))+Math.imul(S,q)|0,s=Math.imul(S,z),n=n+Math.imul(w,H)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,H)|0,s=s+Math.imul(_,G)|0,n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,V)|0,s=s+Math.imul(b,X)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(g,$)|0,s=s+Math.imul(g,Y)|0;var we=(c+(n=n+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,ee)|0)+Math.imul(d,Z)|0))<<13)|0;c=((s=s+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(x,q),i=(i=Math.imul(x,z))+Math.imul(T,q)|0,s=Math.imul(T,z),n=n+Math.imul(A,H)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(S,H)|0,s=s+Math.imul(S,G)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,V)|0,s=s+Math.imul(_,X)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,Y)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,Z)|0,s=s+Math.imul(g,ee)|0;var _e=(c+(n=n+Math.imul(l,re)|0)|0)+((8191&(i=(i=i+Math.imul(l,ne)|0)+Math.imul(d,re)|0))<<13)|0;c=((s=s+Math.imul(d,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(O,q),i=(i=Math.imul(O,z))+Math.imul(I,q)|0,s=Math.imul(I,z),n=n+Math.imul(x,H)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(T,H)|0,s=s+Math.imul(T,G)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(S,V)|0,s=s+Math.imul(S,X)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(_,$)|0,s=s+Math.imul(_,Y)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(b,Z)|0,s=s+Math.imul(b,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(g,re)|0,s=s+Math.imul(g,ne)|0;var Ee=(c+(n=n+Math.imul(l,se)|0)|0)+((8191&(i=(i=i+Math.imul(l,oe)|0)+Math.imul(d,se)|0))<<13)|0;c=((s=s+Math.imul(d,oe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(N,q)|0,s=Math.imul(N,z),n=n+Math.imul(O,H)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(I,H)|0,s=s+Math.imul(I,G)|0,n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(T,V)|0,s=s+Math.imul(T,X)|0,n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(S,$)|0,s=s+Math.imul(S,Y)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Z)|0,s=s+Math.imul(_,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(b,re)|0,s=s+Math.imul(b,ne)|0,n=n+Math.imul(p,se)|0,i=(i=i+Math.imul(p,oe)|0)+Math.imul(g,se)|0,s=s+Math.imul(g,oe)|0;var Ae=(c+(n=n+Math.imul(l,ue)|0)|0)+((8191&(i=(i=i+Math.imul(l,ce)|0)+Math.imul(d,ue)|0))<<13)|0;c=((s=s+Math.imul(d,ce)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(B,q),i=(i=Math.imul(B,z))+Math.imul(U,q)|0,s=Math.imul(U,z),n=n+Math.imul(P,H)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(N,H)|0,s=s+Math.imul(N,G)|0,n=n+Math.imul(O,V)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(I,V)|0,s=s+Math.imul(I,X)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(T,$)|0,s=s+Math.imul(T,Y)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(S,Z)|0,s=s+Math.imul(S,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,s=s+Math.imul(_,ne)|0,n=n+Math.imul(y,se)|0,i=(i=i+Math.imul(y,oe)|0)+Math.imul(b,se)|0,s=s+Math.imul(b,oe)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(g,ue)|0,s=s+Math.imul(g,ce)|0;var Se=(c+(n=n+Math.imul(l,le)|0)|0)+((8191&(i=(i=i+Math.imul(l,de)|0)+Math.imul(d,le)|0))<<13)|0;c=((s=s+Math.imul(d,de)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(j,q),i=(i=Math.imul(j,z))+Math.imul(D,q)|0,s=Math.imul(D,z),n=n+Math.imul(B,H)|0,i=(i=i+Math.imul(B,G)|0)+Math.imul(U,H)|0,s=s+Math.imul(U,G)|0,n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,X)|0,n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(I,$)|0,s=s+Math.imul(I,Y)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(T,Z)|0,s=s+Math.imul(T,ee)|0,n=n+Math.imul(A,re)|0,i=(i=i+Math.imul(A,ne)|0)+Math.imul(S,re)|0,s=s+Math.imul(S,ne)|0,n=n+Math.imul(w,se)|0,i=(i=i+Math.imul(w,oe)|0)+Math.imul(_,se)|0,s=s+Math.imul(_,oe)|0,n=n+Math.imul(y,ue)|0,i=(i=i+Math.imul(y,ce)|0)+Math.imul(b,ue)|0,s=s+Math.imul(b,ce)|0,n=n+Math.imul(p,le)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(g,le)|0,s=s+Math.imul(g,de)|0;var ke=(c+(n=n+Math.imul(l,pe)|0)|0)+((8191&(i=(i=i+Math.imul(l,ge)|0)+Math.imul(d,pe)|0))<<13)|0;c=((s=s+Math.imul(d,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(j,H),i=(i=Math.imul(j,G))+Math.imul(D,H)|0,s=Math.imul(D,G),n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,X)|0)+Math.imul(U,V)|0,s=s+Math.imul(U,X)|0,n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,Y)|0,n=n+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(I,Z)|0,s=s+Math.imul(I,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(T,re)|0,s=s+Math.imul(T,ne)|0,n=n+Math.imul(A,se)|0,i=(i=i+Math.imul(A,oe)|0)+Math.imul(S,se)|0,s=s+Math.imul(S,oe)|0,n=n+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(_,ue)|0,s=s+Math.imul(_,ce)|0,n=n+Math.imul(y,le)|0,i=(i=i+Math.imul(y,de)|0)+Math.imul(b,le)|0,s=s+Math.imul(b,de)|0;var xe=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;c=((s=s+Math.imul(g,ge)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(j,V),i=(i=Math.imul(j,X))+Math.imul(D,V)|0,s=Math.imul(D,X),n=n+Math.imul(B,$)|0,i=(i=i+Math.imul(B,Y)|0)+Math.imul(U,$)|0,s=s+Math.imul(U,Y)|0,n=n+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(N,Z)|0,s=s+Math.imul(N,ee)|0,n=n+Math.imul(O,re)|0,i=(i=i+Math.imul(O,ne)|0)+Math.imul(I,re)|0,s=s+Math.imul(I,ne)|0,n=n+Math.imul(x,se)|0,i=(i=i+Math.imul(x,oe)|0)+Math.imul(T,se)|0,s=s+Math.imul(T,oe)|0,n=n+Math.imul(A,ue)|0,i=(i=i+Math.imul(A,ce)|0)+Math.imul(S,ue)|0,s=s+Math.imul(S,ce)|0,n=n+Math.imul(w,le)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(_,le)|0,s=s+Math.imul(_,de)|0;var Te=(c+(n=n+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,ge)|0)+Math.imul(b,pe)|0))<<13)|0;c=((s=s+Math.imul(b,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(j,$),i=(i=Math.imul(j,Y))+Math.imul(D,$)|0,s=Math.imul(D,Y),n=n+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(U,Z)|0,s=s+Math.imul(U,ee)|0,n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(N,re)|0,s=s+Math.imul(N,ne)|0,n=n+Math.imul(O,se)|0,i=(i=i+Math.imul(O,oe)|0)+Math.imul(I,se)|0,s=s+Math.imul(I,oe)|0,n=n+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(T,ue)|0,s=s+Math.imul(T,ce)|0,n=n+Math.imul(A,le)|0,i=(i=i+Math.imul(A,de)|0)+Math.imul(S,le)|0,s=s+Math.imul(S,de)|0;var Re=(c+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ge)|0)+Math.imul(_,pe)|0))<<13)|0;c=((s=s+Math.imul(_,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(j,Z),i=(i=Math.imul(j,ee))+Math.imul(D,Z)|0,s=Math.imul(D,ee),n=n+Math.imul(B,re)|0,i=(i=i+Math.imul(B,ne)|0)+Math.imul(U,re)|0,s=s+Math.imul(U,ne)|0,n=n+Math.imul(P,se)|0,i=(i=i+Math.imul(P,oe)|0)+Math.imul(N,se)|0,s=s+Math.imul(N,oe)|0,n=n+Math.imul(O,ue)|0,i=(i=i+Math.imul(O,ce)|0)+Math.imul(I,ue)|0,s=s+Math.imul(I,ce)|0,n=n+Math.imul(x,le)|0,i=(i=i+Math.imul(x,de)|0)+Math.imul(T,le)|0,s=s+Math.imul(T,de)|0;var Oe=(c+(n=n+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,ge)|0)+Math.imul(S,pe)|0))<<13)|0;c=((s=s+Math.imul(S,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(j,re),i=(i=Math.imul(j,ne))+Math.imul(D,re)|0,s=Math.imul(D,ne),n=n+Math.imul(B,se)|0,i=(i=i+Math.imul(B,oe)|0)+Math.imul(U,se)|0,s=s+Math.imul(U,oe)|0,n=n+Math.imul(P,ue)|0,i=(i=i+Math.imul(P,ce)|0)+Math.imul(N,ue)|0,s=s+Math.imul(N,ce)|0,n=n+Math.imul(O,le)|0,i=(i=i+Math.imul(O,de)|0)+Math.imul(I,le)|0,s=s+Math.imul(I,de)|0;var Ie=(c+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,ge)|0)+Math.imul(T,pe)|0))<<13)|0;c=((s=s+Math.imul(T,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(j,se),i=(i=Math.imul(j,oe))+Math.imul(D,se)|0,s=Math.imul(D,oe),n=n+Math.imul(B,ue)|0,i=(i=i+Math.imul(B,ce)|0)+Math.imul(U,ue)|0,s=s+Math.imul(U,ce)|0,n=n+Math.imul(P,le)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(N,le)|0,s=s+Math.imul(N,de)|0;var Me=(c+(n=n+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(I,pe)|0))<<13)|0;c=((s=s+Math.imul(I,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(j,ue),i=(i=Math.imul(j,ce))+Math.imul(D,ue)|0,s=Math.imul(D,ce),n=n+Math.imul(B,le)|0,i=(i=i+Math.imul(B,de)|0)+Math.imul(U,le)|0,s=s+Math.imul(U,de)|0;var Pe=(c+(n=n+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,ge)|0)+Math.imul(N,pe)|0))<<13)|0;c=((s=s+Math.imul(N,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(j,le),i=(i=Math.imul(j,de))+Math.imul(D,le)|0,s=Math.imul(D,de);var Ne=(c+(n=n+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,ge)|0)+Math.imul(U,pe)|0))<<13)|0;c=((s=s+Math.imul(U,ge)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Ce=(c+(n=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,ge))+Math.imul(D,pe)|0))<<13)|0;return c=((s=Math.imul(D,ge))+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,u[0]=me,u[1]=ye,u[2]=be,u[3]=ve,u[4]=we,u[5]=_e,u[6]=Ee,u[7]=Ae,u[8]=Se,u[9]=ke,u[10]=xe,u[11]=Te,u[12]=Re,u[13]=Oe,u[14]=Ie,u[15]=Me,u[16]=Pe,u[17]=Ne,u[18]=Ce,0!==c&&(u[19]=c,r.length++),r};function p(e,t,r){return(new g).mulp(e,t,r)}function g(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,s=0;s<r.length-1;s++){var o=i;i=0;for(var a=67108863&n,u=Math.min(s,t.length-1),c=Math.max(0,s-e.length+1);c<=u;c++){var f=s-c,l=(0|e.words[f])*(0|t.words[c]),d=67108863&l;a=67108863&(d=d+a|0),i+=(o=(o=o+(l/67108864|0)|0)+(d>>>26)|0)>>>26,o&=67108863}r.words[s]=a,n=o,o=i}return 0!==n?r.words[s]=n:r.length--,r.strip()}(this,e,t):p(this,e,t),r},g.prototype.makeRBT=function(e){for(var t=new Array(e),r=i.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},g.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,i=0;i<t;i++)n|=(1&e)<<t-i-1,e>>=1;return n},g.prototype.permute=function(e,t,r,n,i,s){for(var o=0;o<s;o++)n[o]=t[e[o]],i[o]=r[e[o]]},g.prototype.transform=function(e,t,r,n,i,s){this.permute(s,e,t,r,n,i);for(var o=1;o<i;o<<=1)for(var a=o<<1,u=Math.cos(2*Math.PI/a),c=Math.sin(2*Math.PI/a),f=0;f<i;f+=a)for(var l=u,d=c,h=0;h<o;h++){var p=r[f+h],g=n[f+h],m=r[f+h+o],y=n[f+h+o],b=l*m-d*y;y=l*y+d*m,m=b,r[f+h]=p+m,n[f+h]=g+y,r[f+h+o]=p-m,n[f+h+o]=g-y,h!==a&&(b=u*l-c*d,d=u*d+c*l,l=b)}},g.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},g.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=e[n];e[n]=e[r-n-1],e[r-n-1]=i,i=t[n],t[n]=-t[r-n-1],t[r-n-1]=-i}},g.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var i=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&i,r=i<67108864?0:i/67108864|0}return e},g.prototype.convert13b=function(e,t,n,i){for(var s=0,o=0;o<t;o++)s+=0|e[o],n[2*o]=8191&s,s>>>=13,n[2*o+1]=8191&s,s>>>=13;for(o=2*t;o<i;++o)n[o]=0;r(0===s),r(0==(-8192&s))},g.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},g.prototype.mulp=function(e,t,r){var n=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(n),s=this.stub(n),o=new Array(n),a=new Array(n),u=new Array(n),c=new Array(n),f=new Array(n),l=new Array(n),d=r.words;d.length=n,this.convert13b(e.words,e.length,o,n),this.convert13b(t.words,t.length,c,n),this.transform(o,s,a,u,n,i),this.transform(c,s,f,l,n,i);for(var h=0;h<n;h++){var p=a[h]*f[h]-u[h]*l[h];u[h]=a[h]*l[h]+u[h]*f[h],a[h]=p}return this.conjugate(a,u,n),this.transform(a,u,d,s,n,i),this.conjugate(d,s,n),this.normalize13b(d,n),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},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),p(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,s=(67108863&i)+(67108863&t);t>>=26,t+=i/67108864|0,t+=s>>>26,this.words[n]=67108863&s}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<t.length;r++){var n=r/26|0,i=r%26;t[r]=(e.words[n]&1<<i)>>>i}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var s=r.sqr();n<t.length;n++,s=s.sqr())0!==t[n]&&(r=r.mul(s));return r},i.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,s=67108863>>>26-n<<26-n;if(0!==n){var o=0;for(t=0;t<this.length;t++){var a=this.words[t]&s,u=(0|this.words[t])-a<<n;this.words[t]=u|o,o=a>>>26-n}o&&(this.words[t]=o,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},i.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var s=e%26,o=Math.min((e-s)/26,this.length),a=67108863^67108863>>>s<<s,u=n;if(i-=o,i=Math.max(0,i),u){for(var c=0;c<o;c++)u.words[c]=this.words[c];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,c=0;c<this.length;c++)this.words[c]=this.words[c+o];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(0!==f||c>=i);c--){var l=0|this.words[c];this.words[c]=f<<26-s|l>>>s,f=l&a}return u&&0!==f&&(u.words[u.length++]=f),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<<t;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(e){r("number"==typeof e&&e>=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<<t;this.words[this.length-1]&=i}return this.strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[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<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,n){var i,s,o=e.length+n;this._expand(o);var a=0;for(i=0;i<e.length;i++){s=(0|this.words[i+n])+a;var u=(0|e.words[i])*t;a=((s-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&s}for(;i<this.length-n;i++)a=(s=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&s;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(s=-(0|this.words[i])+a)>>26,this.words[i]=67108863&s;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),s=e,o=0|s.words[s.length-1];0!==(r=26-this._countBits(o))&&(s=s.ushln(r),n.iushln(r),o=0|s.words[s.length-1]);var a,u=n.length-s.length;if("mod"!==t){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var f=n.clone()._ishlnsubmul(s,1,u);0===f.negative&&(n=f,a&&(a.words[u]=1));for(var l=u-1;l>=0;l--){var d=67108864*(0|n.words[s.length+l])+(0|n.words[s.length+l-1]);for(d=Math.min(d/o|0,67108863),n._ishlnsubmul(s,d,l);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(s,1,l),n.isZero()||(n.negative^=1);a&&(a.words[l]=d)}return a&&a.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||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?(a=this.neg().divmod(e,t),"mod"!==t&&(s=a.div.neg()),"div"!==t&&(o=a.mod.neg(),n&&0!==o.negative&&o.iadd(e)),{div:s,mod:o}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(s=a.div.neg()),{div:s,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(o=a.mod.neg(),n&&0!==o.negative&&o.isub(e)),{div:a.div,mod:o}):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 s,o,a},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),s=r.cmp(n);return s<0||1===i&&0===s?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 s=new i(1),o=new i(0),a=new i(0),u=new i(1),c=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++c;for(var f=n.clone(),l=t.clone();!t.isZero();){for(var d=0,h=1;0==(t.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(s.isOdd()||o.isOdd())&&(s.iadd(f),o.isub(l)),s.iushrn(1),o.iushrn(1);for(var p=0,g=1;0==(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(f),u.isub(l)),a.iushrn(1),u.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a),o.isub(u)):(n.isub(t),a.isub(s),u.isub(o))}return{a:a,b:u,gcd:n.iushln(c)}},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 s,o=new i(1),a=new i(0),u=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,f=1;0==(t.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(t.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var l=0,d=1;0==(n.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(n.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(a)):(n.isub(t),a.isub(o))}return(s=0===t.cmpn(1)?o:a).cmpn(0)<0&&s.iadd(e),s},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 s=t;t=r,r=s}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 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(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<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var s=i,o=n;0!==s&&o<this.length;o++){var a=0|this.words[o];s=(a+=s)>>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,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:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>i&&(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(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 m={k256:null,p224:null,p192:null,p25519:null};function y(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 b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(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 A(e){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)}y.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},y.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=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)},n(b,y),b.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i<n;i++)t.words[i]=e.words[i];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var s=e.words[9];for(t.words[t.length++]=s&r,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&r)<<4|s>>>22,s=o}s>>>=22,e.words[i-10]=s,0===s&&e.length>10?e.length-=10:e.length-=9},b.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<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(v,y),n(w,y),n(_,y),_.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(m[e])return m[e];var t;if("k256"===e)t=new b;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 _}return m[e]=t,t},E.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},E.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},E.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},E.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},E.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)},E.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},E.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)},E.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},E.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},E.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},E.prototype.isqr=function(e){return this.imul(e,e.clone())},E.prototype.sqr=function(e){return this.mul(e,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 s=this.m.subn(1),o=0;!s.isZero()&&0===s.andln(1);)o++,s.iushrn(1);r(!s.isZero());var a=new i(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var l=this.pow(f,s),d=this.pow(e,s.addn(1).iushrn(1)),h=this.pow(e,s),p=o;0!==h.cmp(a);){for(var g=h,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m<p);var y=this.pow(l,new i(1).iushln(p-m-1));d=d.redMul(y),l=y.redSqr(),h=h.redMul(l),p=m}return d},E.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},E.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var s=r[0],o=0,a=0,u=t.bitLength()%26;for(0===u&&(u=26),n=t.length-1;n>=0;n--){for(var c=t.words[n],f=u-1;f>=0;f--){var l=c>>f&1;s!==r[0]&&(s=this.sqr(s)),0!==l||0!==o?(o<<=1,o|=l,(4===++a||0===n&&0===f)&&(s=this.mul(s,r[o]),a=0,o=0)):a=0}u=26}return s},E.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},E.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new A(e)},n(A,E),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.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),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.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),s=r.isub(n).iushrn(this.shift),o=s;return s.cmp(this.m)>=0?o=s.isub(this.m):s.cmpn(0)<0&&(o=s.iadd(this.m)),o._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,r)}(Zc);var ef=Zc.exports,tf={};!function(e){var t=e;function r(e){return 1===e.length?"0"+e:e}function n(e){for(var t="",n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(n=0;n<e.length;n++){var i=e.charCodeAt(n),s=i>>8,o=255&i;s?r.push(s,o):r.push(o)}return r},t.zero2=r,t.toHex=n,t.encode=function(e,t){return"hex"===t?n(e):e}}(tf),function(e){var t=e,r=ef,n=ti,i=tf;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=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<<t+1,s=e.clone(),o=0;o<n.length;o++){var a,u=s.andln(i-1);s.isOdd()?(a=u>(i>>1)-1?(i>>1)-u:u,s.isubn(a)):a=0,n[o]=a,s.iushrn(1)}return n},t.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,s=0;e.cmpn(-i)>0||t.cmpn(-s)>0;){var o,a,u=e.andln(3)+i&3,c=t.andln(3)+s&3;3===u&&(u=-1),3===c&&(c=-1),o=0==(1&u)?0:3!==(n=e.andln(7)+i&7)&&5!==n||2!==c?u:-u,r[0].push(o),a=0==(1&c)?0:3!==(n=t.andln(7)+s&7)&&5!==n||2!==u?c:-c,r[1].push(a),2*i===o+1&&(i=1-i),2*s===a+1&&(s=1-s),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")}}(Qc);var rf,nf={exports:{}},sf=i(Object.freeze({__proto__:null,default:{}}));function of(e){this.rand=e}if(nf.exports=function(e){return rf||(rf=new of(null)),rf.generate(e)},nf.exports.Rand=of,of.prototype.generate=function(e){return this._rand(e)},of.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?of.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?of.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(of.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var af=sf;if("function"!=typeof af.randomBytes)throw new Error("Not supported");of.prototype._rand=function(e){return af.randomBytes(e)}}catch(vI){}var uf=nf.exports,cf={},ff=ef,lf=Qc,df=lf.getNAF,hf=lf.getJSF,pf=lf.assert;function gf(e,t){this.type=e,this.p=new ff(t.p,16),this.red=t.prime?ff.red(t.prime):ff.mont(this.p),this.zero=new ff(0).toRed(this.red),this.one=new ff(1).toRed(this.red),this.two=new ff(2).toRed(this.red),this.n=t.n&&new ff(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 mf=gf;function yf(e,t){this.curve=e,this.type=t,this.precomputed=null}gf.prototype.point=function(){throw new Error("Not implemented")},gf.prototype.validate=function(){throw new Error("Not implemented")},gf.prototype._fixedNafMul=function(e,t){pf(e.precomputed);var r=e._getDoubles(),n=df(t,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var s,o,a=[];for(s=0;s<n.length;s+=r.step){o=0;for(var u=s+r.step-1;u>=s;u--)o=(o<<1)+n[u];a.push(o)}for(var c=this.jpoint(null,null,null),f=this.jpoint(null,null,null),l=i;l>0;l--){for(s=0;s<a.length;s++)(o=a[s])===l?f=f.mixedAdd(r.points[s]):o===-l&&(f=f.mixedAdd(r.points[s].neg()));c=c.add(f)}return c.toP()},gf.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var i=n.points,s=df(t,r,this._bitLength),o=this.jpoint(null,null,null),a=s.length-1;a>=0;a--){for(var u=0;a>=0&&0===s[a];a--)u++;if(a>=0&&u++,o=o.dblp(u),a<0)break;var c=s[a];pf(0!==c),o="affine"===e.type?c>0?o.mixedAdd(i[c-1>>1]):o.mixedAdd(i[-c-1>>1].neg()):c>0?o.add(i[c-1>>1]):o.add(i[-c-1>>1].neg())}return"affine"===e.type?o.toP():o},gf.prototype._wnafMulAdd=function(e,t,r,n,i){var s,o,a,u=this._wnafT1,c=this._wnafT2,f=this._wnafT3,l=0;for(s=0;s<n;s++){var d=(a=t[s])._getNAFPoints(e);u[s]=d.wnd,c[s]=d.points}for(s=n-1;s>=1;s-=2){var h=s-1,p=s;if(1===u[h]&&1===u[p]){var g=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(g[1]=t[h].add(t[p]),g[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(g[1]=t[h].toJ().mixedAdd(t[p]),g[2]=t[h].add(t[p].neg())):(g[1]=t[h].toJ().mixedAdd(t[p]),g[2]=t[h].toJ().mixedAdd(t[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],y=hf(r[h],r[p]);for(l=Math.max(y[0].length,l),f[h]=new Array(l),f[p]=new Array(l),o=0;o<l;o++){var b=0|y[0][o],v=0|y[1][o];f[h][o]=m[3*(b+1)+(v+1)],f[p][o]=0,c[h]=g}}else f[h]=df(r[h],u[h],this._bitLength),f[p]=df(r[p],u[p],this._bitLength),l=Math.max(f[h].length,l),l=Math.max(f[p].length,l)}var w=this.jpoint(null,null,null),_=this._wnafT4;for(s=l;s>=0;s--){for(var E=0;s>=0;){var A=!0;for(o=0;o<n;o++)_[o]=0|f[o][s],0!==_[o]&&(A=!1);if(!A)break;E++,s--}if(s>=0&&E++,w=w.dblp(E),s<0)break;for(o=0;o<n;o++){var S=_[o];0!==S&&(S>0?a=c[o][S-1>>1]:S<0&&(a=c[o][-S-1>>1].neg()),w="affine"===a.type?w.mixedAdd(a):w.add(a))}}for(s=0;s<n;s++)c[s]=null;return i?w:w.toP()},gf.BasePoint=yf,yf.prototype.eq=function(){throw new Error("Not implemented")},yf.prototype.validate=function(){return this.curve.validate(this)},gf.prototype.decodePoint=function(e,t){e=lf.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?pf(e[e.length-1]%2==0):7===e[0]&&pf(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},yf.prototype.encodeCompressed=function(e){return this.encode(e,!0)},yf.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},yf.prototype.encode=function(e,t){return lf.encode(this._encode(t),e)},yf.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},yf.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},yf.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<t;i+=e){for(var s=0;s<e;s++)n=n.dbl();r.push(n)}return{step:e,points:r}},yf.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)t[i]=t[i-1].add(n);return{wnd:e,points:t}},yf.prototype._getBeta=function(){return null},yf.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var bf=ef,vf=ii,wf=mf,_f=Qc.assert;function Ef(e){wf.call(this,"short",e),this.a=new bf(e.a,16).toRed(this.red),this.b=new bf(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}vf(Ef,wf);var Af=Ef;function Sf(e,t,r,n){wf.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new bf(t,16),this.y=new bf(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function kf(e,t,r,n){wf.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new bf(0)):(this.x=new bf(t,16),this.y=new bf(r,16),this.z=new bf(n,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.zOne=this.z===this.curve.one}Ef.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new bf(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new bf(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?r=i[0]:(r=i[1],_f(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new bf(e.a,16),b:new bf(e.b,16)}})):this._getEndoBasis(r)}}},Ef.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:bf.mont(e),r=new bf(2).toRed(t).redInvm(),n=r.redNeg(),i=new bf(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},Ef.prototype._getEndoBasis=function(e){for(var t,r,n,i,s,o,a,u,c,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=e,d=this.n.clone(),h=new bf(1),p=new bf(0),g=new bf(0),m=new bf(1),y=0;0!==l.cmpn(0);){var b=d.div(l);u=d.sub(b.mul(l)),c=g.sub(b.mul(h));var v=m.sub(b.mul(p));if(!n&&u.cmp(f)<0)t=a.neg(),r=h,n=u.neg(),i=c;else if(n&&2==++y)break;a=u,d=l,l=u,g=h,h=c,m=p,p=v}s=u.neg(),o=c;var w=n.sqr().add(i.sqr());return s.sqr().add(o.sqr()).cmp(w)>=0&&(s=t,o=r),n.negative&&(n=n.neg(),i=i.neg()),s.negative&&(s=s.neg(),o=o.neg()),[{a:n,b:i},{a:s,b:o}]},Ef.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),s=r.b.neg().mul(e).divRound(this.n),o=i.mul(r.a),a=s.mul(n.a),u=i.mul(r.b),c=s.mul(n.b);return{k1:e.sub(o).sub(a),k2:u.add(c).neg()}},Ef.prototype.pointFromX=function(e,t){(e=new bf(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)},Ef.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)},Ef.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s<e.length;s++){var o=this._endoSplit(t[s]),a=e[s],u=a._getBeta();o.k1.negative&&(o.k1.ineg(),a=a.neg(!0)),o.k2.negative&&(o.k2.ineg(),u=u.neg(!0)),n[2*s]=a,n[2*s+1]=u,i[2*s]=o.k1,i[2*s+1]=o.k2}for(var c=this._wnafMulAdd(1,n,i,2*s,r),f=0;f<2*s;f++)n[f]=null,i[f]=null;return c},vf(Sf,wf.BasePoint),Ef.prototype.point=function(e,t,r){return new Sf(this,e,t,r)},Ef.prototype.pointFromJSON=function(e,t){return Sf.fromJSON(this,e,t)},Sf.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Sf.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Sf.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function i(t){return e.point(t[0],t[1],r)}var s=t[2];return n.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[n].concat(s.doubles.points.map(i))},naf:s.naf&&{wnd:s.naf.wnd,points:[n].concat(s.naf.points.map(i))}},n},Sf.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Sf.prototype.isInfinity=function(){return this.inf},Sf.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)},Sf.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),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},Sf.prototype.getX=function(){return this.x.fromRed()},Sf.prototype.getY=function(){return this.y.fromRed()},Sf.prototype.mul=function(e){return e=new bf(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)},Sf.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)},Sf.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)},Sf.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))},Sf.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},Sf.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},vf(kf,wf.BasePoint),Ef.prototype.jpoint=function(e,t,r){return new kf(this,e,t,r)},kf.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)},kf.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},kf.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),s=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=s.redSub(o);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),f=c.redMul(a),l=n.redMul(c),d=u.redSqr().redIAdd(f).redISub(l).redISub(l),h=u.redMul(l.redISub(d)).redISub(s.redMul(f)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(d,h,p)},kf.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,s=e.y.redMul(t).redMul(this.z),o=r.redSub(n),a=i.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=o.redSqr(),c=u.redMul(o),f=r.redMul(u),l=a.redSqr().redIAdd(c).redISub(f).redISub(f),d=a.redMul(f.redISub(l)).redISub(i.redMul(c)),h=this.z.redMul(o);return this.curve.jpoint(l,d,h)},kf.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<e;t++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,s=this.x,o=this.y,a=this.z,u=a.redSqr().redSqr(),c=o.redAdd(o);for(t=0;t<e;t++){var f=s.redSqr(),l=c.redSqr(),d=l.redSqr(),h=f.redAdd(f).redIAdd(f).redIAdd(n.redMul(u)),p=s.redMul(l),g=h.redSqr().redISub(p.redAdd(p)),m=p.redISub(g),y=h.redMul(m);y=y.redIAdd(y).redISub(d);var b=c.redMul(a);t+1<e&&(u=u.redMul(d)),s=g,a=b,c=y}return this.curve.jpoint(s,c.redMul(i),a)},kf.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},kf.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(n).redISub(s);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n),u=a.redSqr().redISub(o).redISub(o),c=s.redIAdd(s);c=(c=c.redIAdd(c)).redIAdd(c),e=u,t=a.redMul(o.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var f=this.x.redSqr(),l=this.y.redSqr(),d=l.redSqr(),h=this.x.redAdd(l).redSqr().redISub(f).redISub(d);h=h.redIAdd(h);var p=f.redAdd(f).redIAdd(f),g=p.redSqr(),m=d.redIAdd(d);m=(m=m.redIAdd(m)).redIAdd(m),e=g.redISub(h).redISub(h),t=p.redMul(h.redISub(e)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},kf.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(n).redISub(s);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=a.redSqr().redISub(o).redISub(o);e=u;var c=s.redIAdd(s);c=(c=c.redIAdd(c)).redIAdd(c),t=a.redMul(o.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var f=this.z.redSqr(),l=this.y.redSqr(),d=this.x.redMul(l),h=this.x.redSub(f).redMul(this.x.redAdd(f));h=h.redAdd(h).redIAdd(h);var p=d.redIAdd(d),g=(p=p.redIAdd(p)).redAdd(p);e=h.redSqr().redISub(g),r=this.y.redAdd(this.z).redSqr().redISub(l).redISub(f);var m=l.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),t=h.redMul(p.redISub(e)).redISub(m)}return this.curve.jpoint(e,t,r)},kf.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),s=t.redSqr(),o=r.redSqr(),a=s.redAdd(s).redIAdd(s).redIAdd(e.redMul(i)),u=t.redAdd(t),c=(u=u.redIAdd(u)).redMul(o),f=a.redSqr().redISub(c.redAdd(c)),l=c.redISub(f),d=o.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var h=a.redMul(l).redISub(d),p=r.redAdd(r).redMul(n);return this.curve.jpoint(f,h,p)},kf.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),i=e.redAdd(e).redIAdd(e),s=i.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(n),a=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(s)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(o).redSqr().redISub(s).redISub(a).redISub(u),f=t.redMul(c);f=(f=f.redIAdd(f)).redIAdd(f);var l=this.x.redMul(a).redISub(f);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.y.redMul(c.redMul(u.redISub(c)).redISub(o.redMul(a)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var h=this.z.redAdd(o).redSqr().redISub(r).redISub(a);return this.curve.jpoint(l,d,h)},kf.prototype.mul=function(e,t){return e=new bf(e,t),this.curve._wnafMul(this,e)},kf.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),i=r.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(n)).cmpn(0)},kf.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),i=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},kf.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},kf.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var xf=ef,Tf=ii,Rf=mf,Of=Qc;function If(e){Rf.call(this,"mont",e),this.a=new xf(e.a,16).toRed(this.red),this.b=new xf(e.b,16).toRed(this.red),this.i4=new xf(4).toRed(this.red).redInvm(),this.two=new xf(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}Tf(If,Rf);var Mf=If;function Pf(e,t,r){Rf.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new xf(t,16),this.z=new xf(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}If.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)},Tf(Pf,Rf.BasePoint),If.prototype.decodePoint=function(e,t){return this.point(Of.toArray(e,t),1)},If.prototype.point=function(e,t){return new Pf(this,e,t)},If.prototype.pointFromJSON=function(e){return Pf.fromJSON(this,e)},Pf.prototype.precompute=function(){},Pf.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Pf.fromJSON=function(e,t){return new Pf(e,t[0],t[1]||e.one)},Pf.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Pf.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Pf.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)},Pf.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Pf.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),s=e.x.redSub(e.z).redMul(r),o=i.redMul(n),a=t.z.redMul(s.redAdd(o).redSqr()),u=t.x.redMul(s.redISub(o).redSqr());return this.curve.point(a,u)},Pf.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 s=i.length-1;s>=0;s--)0===i[s]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},Pf.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Pf.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Pf.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},Pf.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Pf.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var Nf=ef,Cf=ii,Bf=mf,Uf=Qc.assert;function Lf(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,Bf.call(this,"edwards",e),this.a=new Nf(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Nf(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Nf(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Uf(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}Cf(Lf,Bf);var jf=Lf;function Df(e,t,r,n,i){Bf.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 Nf(t,16),this.y=new Nf(r,16),this.z=n?new Nf(n,16):this.curve.one,this.t=i&&new Nf(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()))))}Lf.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},Lf.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},Lf.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},Lf.prototype.pointFromX=function(e,t){(e=new Nf(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)),s=n.redMul(i.redInvm()),o=s.redSqrt();if(0!==o.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");var a=o.fromRed().isOdd();return(t&&!a||!t&&a)&&(o=o.redNeg()),this.point(e,o)},Lf.prototype.pointFromY=function(e,t){(e=new Nf(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),s=n.redMul(i.redInvm());if(0===s.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var o=s.redSqrt();if(0!==o.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");return o.fromRed().isOdd()!==t&&(o=o.redNeg()),this.point(o,e)},Lf.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)},Cf(Df,Bf.BasePoint),Lf.prototype.pointFromJSON=function(e){return Df.fromJSON(this,e)},Lf.prototype.point=function(e,t,r,n){return new Df(this,e,t,r,n)},Df.fromJSON=function(e,t){return new Df(e,t[0],t[1],t[2])},Df.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Df.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},Df.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),s=n.redAdd(t),o=s.redSub(r),a=n.redSub(t),u=i.redMul(o),c=s.redMul(a),f=i.redMul(a),l=o.redMul(s);return this.curve.point(u,c,l,f)},Df.prototype._projDbl=function(){var e,t,r,n,i,s,o=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var c=(n=this.curve._mulA(a)).redAdd(u);this.zOne?(e=o.redSub(a).redSub(u).redMul(c.redSub(this.curve.two)),t=c.redMul(n.redSub(u)),r=c.redSqr().redSub(c).redSub(c)):(i=this.z.redSqr(),s=c.redSub(i).redISub(i),e=o.redSub(a).redISub(u).redMul(s),t=c.redMul(n.redSub(u)),r=c.redMul(s))}else n=a.redAdd(u),i=this.curve._mulC(this.z).redSqr(),s=n.redSub(i).redSub(i),e=this.curve._mulC(o.redISub(n)).redMul(s),t=this.curve._mulC(n).redMul(a.redISub(u)),r=n.redMul(s);return this.curve.point(e,t,r)},Df.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Df.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)),s=r.redSub(t),o=i.redSub(n),a=i.redAdd(n),u=r.redAdd(t),c=s.redMul(o),f=a.redMul(u),l=s.redMul(u),d=o.redMul(a);return this.curve.point(c,f,d,l)},Df.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),s=this.x.redMul(e.x),o=this.y.redMul(e.y),a=this.curve.d.redMul(s).redMul(o),u=i.redSub(a),c=i.redAdd(a),f=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(s).redISub(o),l=n.redMul(u).redMul(f);return this.curve.twisted?(t=n.redMul(c).redMul(o.redSub(this.curve._mulA(s))),r=u.redMul(c)):(t=n.redMul(c).redMul(o.redSub(s)),r=this.curve._mulC(u).redMul(c)),this.curve.point(l,t,r)},Df.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Df.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Df.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},Df.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},Df.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},Df.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Df.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Df.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Df.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},Df.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}},Df.prototype.toP=Df.prototype.normalize,Df.prototype.mixedAdd=Df.prototype.add,function(e){var t=e;t.base=mf,t.short=Af,t.mont=Mf,t.edwards=jf}(cf);var Ff,qf,zf={};!function(e){var t,r=e,n=Zn,i=cf,s=Qc.assert;function o(e){"short"===e.type?this.curve=new i.short(e):"edwards"===e.type?this.curve=new i.edwards(e):this.curve=new i.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var n=new o(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:n}),n}})}r.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:n.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:n.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:n.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:n.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:n.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:n.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:n.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{t=qf?Ff:(qf=1,Ff={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}})}catch(e){t=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:n.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",t]})}(zf);var Kf=Zn,Hf=tf,Gf=ti;function Wf(e){if(!(this instanceof Wf))return new Wf(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=Hf.toArray(e.entropy,e.entropyEnc||"hex"),r=Hf.toArray(e.nonce,e.nonceEnc||"hex"),n=Hf.toArray(e.pers,e.persEnc||"hex");Gf(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var Vf=Wf;Wf.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.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},Wf.prototype._hmac=function(){return new Kf.hmac(this.hash,this.K)},Wf.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},Wf.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=Hf.toArray(e,t),r=Hf.toArray(r,n),Gf(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},Wf.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=Hf.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var s=i.slice(0,e);return this._update(r),this._reseed++,Hf.encode(s,t)};var Xf=ef,Jf=Qc.assert;function $f(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var Yf=$f;$f.fromPublic=function(e,t,r){return t instanceof $f?t:new $f(e,{pub:t,pubEnc:r})},$f.fromPrivate=function(e,t,r){return t instanceof $f?t:new $f(e,{priv:t,privEnc:r})},$f.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},$f.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},$f.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},$f.prototype._importPrivate=function(e,t){this.priv=new Xf(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},$f.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?Jf(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||Jf(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},$f.prototype.derive=function(e){return e.validate()||Jf(e.validate(),"public point not validated"),e.mul(this.priv).getX()},$f.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},$f.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},$f.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Qf=ef,Zf=Qc,el=Zf.assert;function tl(e,t){if(e instanceof tl)return e;this._importDER(e,t)||(el(e.r&&e.s,"Signature without r or s"),this.r=new Qf(e.r,16),this.s=new Qf(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var rl=tl;function nl(){this.place=0}function il(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,s=0,o=t.place;s<n;s++,o++)i<<=8,i|=e[o],i>>>=0;return!(i<=127)&&(t.place=o,i)}function sl(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function ol(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}tl.prototype._importDER=function(e,t){e=Zf.toArray(e,t);var r=new nl;if(48!==e[r.place++])return!1;var n=il(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=il(e,r);if(!1===i)return!1;var s=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var o=il(e,r);if(!1===o)return!1;if(e.length!==o+r.place)return!1;var a=e.slice(r.place,o+r.place);if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new Qf(s),this.s=new Qf(a),this.recoveryParam=null,!0},tl.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=sl(t),r=sl(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];ol(n,t.length),(n=n.concat(t)).push(2),ol(n,r.length);var i=n.concat(r),s=[48];return ol(s,i.length),s=s.concat(i),Zf.encode(s,e)};var al=ef,ul=Vf,cl=zf,fl=uf,ll=Qc.assert,dl=Yf,hl=rl;function pl(e){if(!(this instanceof pl))return new pl(e);"string"==typeof e&&(ll(Object.prototype.hasOwnProperty.call(cl,e),"Unknown curve "+e),e=cl[e]),e instanceof cl.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 gl=pl;pl.prototype.keyPair=function(e){return new dl(this,e)},pl.prototype.keyFromPrivate=function(e,t){return dl.fromPrivate(this,e,t)},pl.prototype.keyFromPublic=function(e,t){return dl.fromPublic(this,e,t)},pl.prototype.genKeyPair=function(e){e||(e={});for(var t=new ul({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||fl(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new al(2));;){var i=new al(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},pl.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},pl.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 al(e,16));for(var i=this.n.byteLength(),s=t.getPrivate().toArray("be",i),o=e.toArray("be",i),a=new ul({hash:this.hash,entropy:s,nonce:o,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new al(1)),c=0;;c++){var f=n.k?n.k(c):new al(a.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(u)>=0)){var l=this.g.mul(f);if(!l.isInfinity()){var d=l.getX(),h=d.umod(this.n);if(0!==h.cmpn(0)){var p=f.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var g=(l.getY().isOdd()?1:0)|(0!==d.cmp(h)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),g^=1),new hl({r:h,s:p,recoveryParam:g})}}}}}},pl.prototype.verify=function(e,t,r,n){e=this._truncateToN(new al(e,16)),r=this.keyFromPublic(r,n);var i=(t=new hl(t,"hex")).r,s=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var o,a=s.invm(this.n),u=a.mul(e).umod(this.n),c=a.mul(i).umod(this.n);return this.curve._maxwellTrick?!(o=this.g.jmulAdd(u,r.getPublic(),c)).isInfinity()&&o.eqXToP(i):!(o=this.g.mulAdd(u,r.getPublic(),c)).isInfinity()&&0===o.getX().umod(this.n).cmp(i)},pl.prototype.recoverPubKey=function(e,t,r,n){ll((3&r)===r,"The recovery param is more than two bits"),t=new hl(t,n);var i=this.n,s=new al(e),o=t.r,a=t.s,u=1&r,c=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");o=c?this.curve.pointFromX(o.add(this.curve.n),u):this.curve.pointFromX(o,u);var f=t.r.invm(i),l=i.sub(s).mul(f).umod(i),d=a.mul(f).umod(i);return this.g.mulAdd(l,o,d)},pl.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new hl(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(e,t,i)}catch(e){continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var ml=Qc,yl=ml.assert,bl=ml.parseBytes,vl=ml.cachedProperty;function wl(e,t){this.eddsa=e,this._secret=bl(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=bl(t.pub)}wl.fromPublic=function(e,t){return t instanceof wl?t:new wl(e,{pub:t})},wl.fromSecret=function(e,t){return t instanceof wl?t:new wl(e,{secret:t})},wl.prototype.secret=function(){return this._secret},vl(wl,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),vl(wl,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),vl(wl,"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})),vl(wl,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),vl(wl,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),vl(wl,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),wl.prototype.sign=function(e){return yl(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},wl.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},wl.prototype.getSecret=function(e){return yl(this._secret,"KeyPair is public only"),ml.encode(this.secret(),e)},wl.prototype.getPublic=function(e){return ml.encode(this.pubBytes(),e)};var _l=wl,El=ef,Al=Qc,Sl=Al.assert,kl=Al.cachedProperty,xl=Al.parseBytes;function Tl(e,t){this.eddsa=e,"object"!=typeof t&&(t=xl(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),Sl(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof El&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}kl(Tl,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),kl(Tl,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),kl(Tl,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),kl(Tl,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),Tl.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Tl.prototype.toHex=function(){return Al.encode(this.toBytes(),"hex").toUpperCase()};var Rl=Tl,Ol=Zn,Il=zf,Ml=Qc,Pl=Ml.assert,Nl=Ml.parseBytes,Cl=_l,Bl=Rl;function Ul(e){if(Pl("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof Ul))return new Ul(e);e=Il[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=Ol.sha512}var Ll=Ul;Ul.prototype.sign=function(e,t){e=Nl(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),s=this.encodePoint(i),o=this.hashInt(s,r.pubBytes(),e).mul(r.priv()),a=n.add(o).umod(this.curve.n);return this.makeSignature({R:i,S:a,Rencoded:s})},Ul.prototype.verify=function(e,t,r){e=Nl(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),s=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(s)},Ul.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return Ml.intFromLE(e.digest()).umod(this.curve.n)},Ul.prototype.keyFromPublic=function(e){return Cl.fromPublic(this,e)},Ul.prototype.keyFromSecret=function(e){return Cl.fromSecret(this,e)},Ul.prototype.makeSignature=function(e){return e instanceof Bl?e:new Bl(this,e)},Ul.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},Ul.prototype.decodePoint=function(e){var t=(e=Ml.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),n=0!=(128&e[t]),i=Ml.intFromLE(r);return this.curve.pointFromY(i,n)},Ul.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},Ul.prototype.decodeInt=function(e){return Ml.intFromLE(e)},Ul.prototype.isPoint=function(e){return e instanceof this.pointClass},function(e){var t=e;t.version=Yc,t.utils=Qc,t.rand=uf,t.curve=cf,t.curves=zf,t.ec=gl,t.eddsa=Ll}($c);var jl={},Dl={},Fl={},ql={},zl={},Kl=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(zl,"__esModule",{value:!0}),zl.getLength=zl.decode=zl.encode=void 0;var Hl=Kl(ae);function Gl(e,t){if("0"===e[0]&&"0"===e[1])throw new Error("invalid RLP: extra zeros");return parseInt(e,t)}function Wl(e,t){if(e<56)return Buffer.from([e+t]);var r=Jl(e),n=Jl(t+55+r.length/2);return Buffer.from(n+r,"hex")}function Vl(e){var t,r,n,i,s,o=[],a=e[0];if(a<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(a<=183){if(t=a-127,n=128===a?Buffer.from([]):e.slice(1,t),2===t&&n[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:n,remainder:e.slice(t)}}if(a<=191){if(r=a-182,e.length-1<r)throw new Error("invalid RLP: not enough bytes for string length");if((t=Gl(e.slice(1,r).toString("hex"),16))<=55)throw new Error("invalid RLP: expected string length to be greater than 55");if((n=e.slice(r,t+r)).length<t)throw new Error("invalid RLP: not enough bytes for string");return{data:n,remainder:e.slice(t+r)}}if(a<=247){for(t=a-191,i=e.slice(1,t);i.length;)s=Vl(i),o.push(s.data),i=s.remainder;return{data:o,remainder:e.slice(t)}}var u=(r=a-246)+(t=Gl(e.slice(1,r).toString("hex"),16));if(u>e.length)throw new Error("invalid rlp: total length is larger than the data");if(0===(i=e.slice(r,u)).length)throw new Error("invalid rlp, List has a invalid length");for(;i.length;)s=Vl(i),o.push(s.data),i=s.remainder;return{data:o,remainder:e.slice(u)}}function Xl(e){return"0x"===e.slice(0,2)}function Jl(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");var t=e.toString(16);return t.length%2?"0"+t:t}function $l(e){if(!Buffer.isBuffer(e)){if("string"==typeof e)return Xl(e)?Buffer.from(function(e){return e.length%2?"0"+e:e}("string"!=typeof(r=e)?r:Xl(r)?r.slice(2):r),"hex"):Buffer.from(e);if("number"==typeof e||"bigint"==typeof e)return e?(t=Jl(e),Buffer.from(t,"hex")):Buffer.from([]);if(null==e)return Buffer.from([]);if(e instanceof Uint8Array)return Buffer.from(e);if(Hl.default.isBN(e))return Buffer.from(e.toArray());throw new Error("invalid type")}var t,r;return e}zl.encode=function e(t){if(Array.isArray(t)){for(var r=[],n=0;n<t.length;n++)r.push(e(t[n]));var i=Buffer.concat(r);return Buffer.concat([Wl(i.length,192),i])}var s=$l(t);return 1===s.length&&s[0]<128?s:Buffer.concat([Wl(s.length,128),s])},zl.decode=function(e,t){if(void 0===t&&(t=!1),!e||0===e.length)return Buffer.from([]);var r=Vl($l(e));if(t)return r;if(0!==r.remainder.length)throw new Error("invalid remainder");return r.data},zl.getLength=function(e){if(!e||0===e.length)return Buffer.from([]);var t=$l(e),r=t[0];if(r<=127)return t.length;if(r<=183)return r-127;if(r<=191)return r-182;if(r<=247)return r-191;var n=r-246;return n+Gl(t.slice(1,n).toString("hex"),16)};var Yl=r&&r.__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]}),Ql=r&&r.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Zl=r&&r.__importStar||function(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)&&Yl(t,e,r);return Ql(t,e),t},ed=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ql,"__esModule",{value:!0}),ql.rlp=ql.BN=void 0;var td=ed(ae);ql.BN=td.default;var rd=Zl(zl);ql.rlp=rd,function(e){Object.defineProperty(e,"__esModule",{value:!0}),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.MAX_INTEGER=e.MAX_UINT64=void 0;var t=oe,r=ql;e.MAX_UINT64=new r.BN("ffffffffffffffff",16),e.MAX_INTEGER=new r.BN("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),e.TWO_POW256=new r.BN("10000000000000000000000000000000000000000000000000000000000000000",16),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")}(Fl);var nd={};function id(){throw new Error("setTimeout has not been defined")}function sd(){throw new Error("clearTimeout has not been defined")}var od=id,ad=sd;function ud(e){if(od===setTimeout)return setTimeout(e,0);if((od===id||!od)&&setTimeout)return od=setTimeout,setTimeout(e,0);try{return od(e,0)}catch(t){try{return od.call(null,e,0)}catch(t){return od.call(this,e,0)}}}"function"==typeof o.setTimeout&&(od=setTimeout),"function"==typeof o.clearTimeout&&(ad=clearTimeout);var cd,fd=[],ld=!1,dd=-1;function hd(){ld&&cd&&(ld=!1,cd.length?fd=cd.concat(fd):dd=-1,fd.length&&pd())}function pd(){if(!ld){var e=ud(hd);ld=!0;for(var t=fd.length;t;){for(cd=fd,fd=[];++dd<t;)cd&&cd[dd].run();dd=-1,t=fd.length}cd=null,ld=!1,function(e){if(ad===clearTimeout)return clearTimeout(e);if((ad===sd||!ad)&&clearTimeout)return ad=clearTimeout,clearTimeout(e);try{return ad(e)}catch(t){try{return ad.call(null,e)}catch(t){return ad.call(this,e)}}}(e)}}function gd(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];fd.push(new md(e,t)),1!==fd.length||ld||ud(pd)}function md(e,t){this.fun=e,this.array=t}md.prototype.run=function(){this.fun.apply(null,this.array)};function yd(){}var bd=yd,vd=yd,wd=yd,_d=yd,Ed=yd,Ad=yd,Sd=yd;var kd=o.performance||{},xd=kd.now||kd.mozNow||kd.msNow||kd.oNow||kd.webkitNow||function(){return(new Date).getTime()};var Td=new Date;var Rd={nextTick:gd,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:bd,addListener:vd,once:wd,off:_d,removeListener:Ed,removeAllListeners:Ad,emit:Sd,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*xd.call(kd),r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-Td)/1e3}},Od="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},Id=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++)r[t[n]]=Object.getOwnPropertyDescriptor(e,t[n]);return r},Md=/%[sdj%]/g;function Pd(e){if(!Xd(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(Ld(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,i=n.length,s=String(e).replace(Md,(function(e){if("%%"===e)return"%";if(r>=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}})),o=n[r];r<i;o=n[++r])Gd(o)||!Qd(o)?s+=" "+o:s+=" "+Ld(o);return s}function Nd(e,t){if($d(o.process))return function(){return Nd(e,t).apply(this,arguments)};if(!0===Rd.noDeprecation)return e;var r=!1;return function(){if(!r){if(Rd.throwDeprecation)throw new Error(t);Rd.traceDeprecation?console.trace(t):console.error(t),r=!0}return e.apply(this,arguments)}}var Cd,Bd={};function Ud(e){if($d(Cd)&&(Cd=Rd.env.NODE_DEBUG||""),e=e.toUpperCase(),!Bd[e])if(new RegExp("\\b"+e+"\\b","i").test(Cd)){Bd[e]=function(){var t=Pd.apply(null,arguments);console.error("%s %d: %s",e,0,t)}}else Bd[e]=function(){};return Bd[e]}function Ld(e,t){var r={seen:[],stylize:Dd};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),Hd(t)?r.showHidden=t:t&&uh(r,t),$d(r.showHidden)&&(r.showHidden=!1),$d(r.depth)&&(r.depth=2),$d(r.colors)&&(r.colors=!1),$d(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=jd),Fd(r,e,r.depth)}function jd(e,t){var r=Ld.styles[t];return r?"["+Ld.colors[r][0]+"m"+e+"["+Ld.colors[r][1]+"m":e}function Dd(e,t){return e}function Fd(e,t,r){if(e.customInspect&&t&&th(t.inspect)&&t.inspect!==Ld&&(!t.constructor||t.constructor.prototype!==t)){var n=t.inspect(r,e);return Xd(n)||(n=Fd(e,n,r)),n}var i=function(e,t){if($d(t))return e.stylize("undefined","undefined");if(Xd(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(Vd(t))return e.stylize(""+t,"number");if(Hd(t))return e.stylize(""+t,"boolean");if(Gd(t))return e.stylize("null","null")}(e,t);if(i)return i;var s=Object.keys(t),o=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),eh(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return qd(t);if(0===s.length){if(th(t)){var a=t.name?": "+t.name:"";return e.stylize("[Function"+a+"]","special")}if(Yd(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(Zd(t))return e.stylize(Date.prototype.toString.call(t),"date");if(eh(t))return qd(t)}var u,c="",f=!1,l=["{","}"];(Kd(t)&&(f=!0,l=["[","]"]),th(t))&&(c=" [Function"+(t.name?": "+t.name:"")+"]");return Yd(t)&&(c=" "+RegExp.prototype.toString.call(t)),Zd(t)&&(c=" "+Date.prototype.toUTCString.call(t)),eh(t)&&(c=" "+qd(t)),0!==s.length||f&&0!=t.length?r<0?Yd(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=f?function(e,t,r,n,i){for(var s=[],o=0,a=t.length;o<a;++o)ch(t,String(o))?s.push(zd(e,t,r,n,String(o),!0)):s.push("");return i.forEach((function(i){i.match(/^\d+$/)||s.push(zd(e,t,r,n,i,!0))})),s}(e,t,r,o,s):s.map((function(n){return zd(e,t,r,o,n,f)})),e.seen.pop(),function(e,t,r){var n=e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(n>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(u,c,l)):l[0]+c+l[1]}function qd(e){return"["+Error.prototype.toString.call(e)+"]"}function zd(e,t,r,n,i,s){var o,a,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),ch(n,i)||(o="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=Gd(r)?Fd(e,u.value,null):Fd(e,u.value,r-1)).indexOf("\n")>-1&&(a=s?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),$d(o)){if(s&&i.match(/^\d+$/))return a;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function Kd(e){return Array.isArray(e)}function Hd(e){return"boolean"==typeof e}function Gd(e){return null===e}function Wd(e){return null==e}function Vd(e){return"number"==typeof e}function Xd(e){return"string"==typeof e}function Jd(e){return"symbol"==typeof e}function $d(e){return void 0===e}function Yd(e){return Qd(e)&&"[object RegExp]"===ih(e)}function Qd(e){return"object"==typeof e&&null!==e}function Zd(e){return Qd(e)&&"[object Date]"===ih(e)}function eh(e){return Qd(e)&&("[object Error]"===ih(e)||e instanceof Error)}function th(e){return"function"==typeof e}function rh(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function nh(e){return _.isBuffer(e)}function ih(e){return Object.prototype.toString.call(e)}function sh(e){return e<10?"0"+e.toString(10):e.toString(10)}Ld.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]},Ld.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var oh=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ah(){console.log("%s - %s",function(){var e=new Date,t=[sh(e.getHours()),sh(e.getMinutes()),sh(e.getSeconds())].join(":");return[e.getDate(),oh[e.getMonth()],t].join(" ")}(),Pd.apply(null,arguments))}function uh(e,t){if(!t||!Qd(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}function ch(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var fh="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function lh(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(fh&&e[fh]){var t;if("function"!=typeof(t=e[fh]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,fh,{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=[],s=0;s<arguments.length;s++)i.push(arguments[s]);i.push((function(e,n){e?r(e):t(n)}));try{e.apply(this,i)}catch(e){r(e)}return n}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),fh&&Object.defineProperty(t,fh,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,Id(e))}function dh(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}function hh(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function t(){for(var t=[],r=0;r<arguments.length;r++)t.push(arguments[r]);var n=t.pop();if("function"!=typeof n)throw new TypeError("The last argument must be of type Function");var i=this,s=function(){return n.apply(i,arguments)};e.apply(this,t).then((function(e){Rd.nextTick(s.bind(null,null,e))}),(function(e){Rd.nextTick(dh.bind(null,e,s))}))}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,Id(e)),t}lh.custom=fh;var ph={inherits:Od,_extend:uh,log:ah,isBuffer:nh,isPrimitive:rh,isFunction:th,isError:eh,isDate:Zd,isObject:Qd,isRegExp:Yd,isUndefined:$d,isSymbol:Jd,isString:Xd,isNumber:Vd,isNullOrUndefined:Wd,isNull:Gd,isBoolean:Hd,isArray:Kd,inspect:Ld,deprecate:Nd,format:Pd,debuglog:Ud,promisify:lh,callbackify:hh},gh=Object.freeze({__proto__:null,_extend:uh,callbackify:hh,debuglog:Ud,default:ph,deprecate:Nd,format:Pd,inherits:Od,inspect:Ld,isArray:Kd,isBoolean:Hd,isBuffer:nh,isDate:Zd,isError:eh,isFunction:th,isNull:Gd,isNullOrUndefined:Wd,isNumber:Vd,isObject:Qd,isPrimitive:rh,isRegExp:Yd,isString:Xd,isSymbol:Jd,isUndefined:$d,log:ah,promisify:lh});function mh(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0}var yh,bh=Object.prototype.hasOwnProperty,vh=Object.keys||function(e){var t=[];for(var r in e)bh.call(e,r)&&t.push(r);return t},wh=Array.prototype.slice;function _h(){return void 0!==yh?yh:yh="foo"===function(){}.name}function Eh(e){return Object.prototype.toString.call(e)}function Ah(e){return!ie(e)&&("function"==typeof o.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}function Sh(e,t){e||Ih(e,!0,t,"==",Mh)}var kh=/\s*function\s+([^\(\s]*)\s*/;function xh(e){if(th(e)){if(_h())return e.name;var t=e.toString().match(kh);return t&&t[1]}}function Th(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 Rh(Oh(e.actual),128)+" "+e.operator+" "+Rh(Oh(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||Ih;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=xh(t),s=n.indexOf("\n"+i);if(s>=0){var o=n.indexOf("\n",s+1);n=n.substring(o+1)}this.stack=n}}}function Rh(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function Oh(e){if(_h()||!th(e))return Ld(e);var t=xh(e);return"[Function"+(t?": "+t:"")+"]"}function Ih(e,t,r,n,i){throw new Th({message:r,actual:e,expected:t,operator:n,stackStartFunction:i})}function Mh(e,t){e||Ih(e,!0,t,"==",Mh)}function Ph(e,t,r){e!=t&&Ih(e,t,r,"==",Ph)}function Nh(e,t,r){e==t&&Ih(e,t,r,"!=",Nh)}function Ch(e,t,r){Uh(e,t,!1)||Ih(e,t,r,"deepEqual",Ch)}function Bh(e,t,r){Uh(e,t,!0)||Ih(e,t,r,"deepStrictEqual",Bh)}function Uh(e,t,r,n){if(e===t)return!0;if(ie(e)&&ie(t))return 0===mh(e,t);if(Zd(e)&&Zd(t))return e.getTime()===t.getTime();if(Yd(e)&&Yd(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(Ah(e)&&Ah(t)&&Eh(e)===Eh(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===mh(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(ie(e)!==ie(t))return!1;var i=(n=n||{actual:[],expected:[]}).actual.indexOf(e);return-1!==i&&i===n.expected.indexOf(t)||(n.actual.push(e),n.expected.push(t),function(e,t,r,n){if(null==e||null==t)return!1;if(rh(e)||rh(t))return e===t;if(r&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=Lh(e),s=Lh(t);if(i&&!s||!i&&s)return!1;if(i)return Uh(e=wh.call(e),t=wh.call(t),r);var o,a,u=vh(e),c=vh(t);if(u.length!==c.length)return!1;for(u.sort(),c.sort(),a=u.length-1;a>=0;a--)if(u[a]!==c[a])return!1;for(a=u.length-1;a>=0;a--)if(!Uh(e[o=u[a]],t[o],r,n))return!1;return!0}(e,t,r,n))}return r?e===t:e==t}function Lh(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function jh(e,t,r){Uh(e,t,!1)&&Ih(e,t,r,"notDeepEqual",jh)}function Dh(e,t,r){Uh(e,t,!0)&&Ih(e,t,r,"notDeepStrictEqual",Dh)}function Fh(e,t,r){e!==t&&Ih(e,t,r,"===",Fh)}function qh(e,t,r){e===t&&Ih(e,t,r,"!==",qh)}function zh(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 Kh(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&&Ih(i,r,"Missing expected exception"+n);var s="string"==typeof n,o=!e&&i&&!r;if((!e&&eh(i)&&s&&zh(i,r)||o)&&Ih(i,r,"Got unwanted exception"+n),e&&i&&r&&!zh(i,r)||!e&&i)throw i}function Hh(e,t,r){Kh(!0,e,t,r)}function Gh(e,t,r){Kh(!1,e,t,r)}function Wh(e){if(e)throw e}Sh.AssertionError=Th,Od(Th,Error),Sh.fail=Ih,Sh.ok=Mh,Sh.equal=Ph,Sh.notEqual=Nh,Sh.deepEqual=Ch,Sh.deepStrictEqual=Bh,Sh.notDeepEqual=jh,Sh.notDeepStrictEqual=Dh,Sh.strictEqual=Fh,Sh.notStrictEqual=qh,Sh.throws=Hh,Sh.doesNotThrow=Gh,Sh.ifError=Wh;var Vh=i(Object.freeze({__proto__:null,AssertionError:Th,assert:Mh,deepEqual:Ch,deepStrictEqual:Bh,default:Sh,doesNotThrow:Gh,equal:Ph,fail:Ih,ifError:Wh,notDeepEqual:jh,notDeepStrictEqual:Dh,notEqual:Nh,notStrictEqual:qh,ok:Mh,strictEqual:Fh,throws:Hh})),Xh={};const Jh="Impossible case. Please create issue.",$h="The tweak was out of range or the resulted private key is invalid",Yh="The tweak was out of range or equal to zero",Qh="Unknow error on context randomization",Zh="Private Key is invalid",ep="Public Key could not be parsed",tp="Public Key serialization error",rp="The sum of the public keys is not valid",np="Signature could not be parsed",ip="The nonce generation function failed, or the private key was invalid",sp="Public key could not be recover",op="Scalar was invalid (zero or overflow)";function ap(e,t){if(!e)throw new Error(t)}function up(e,t,r){if(ap(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==r)if(Array.isArray(r)){const n=`Expected ${e} to be an Uint8Array with length [${r.join(", ")}]`;ap(r.includes(t.length),n)}else{const n=`Expected ${e} to be an Uint8Array with length ${r}`;ap(t.length===r,n)}}function cp(e){ap("Boolean"===lp(e),"Expected compressed to be a Boolean")}function fp(e=(e=>new Uint8Array(e)),t){return"function"==typeof e&&(e=e(t)),up("output",e,t),e}function lp(e){return Object.prototype.toString.call(e).slice(8,-1)}const dp=new(0,$c.ec)("secp256k1"),hp=dp.curve,pp=hp.n.constructor;function gp(e){const t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){let r=new pp(t);if(r.cmp(hp.p)>=0)return null;r=r.toRed(hp.red);let n=r.redSqr().redIMul(r).redIAdd(hp.b).redSqrt();return 3===e!==n.isOdd()&&(n=n.redNeg()),dp.keyPair({pub:{x:r,y:n}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,r){let n=new pp(t),i=new pp(r);if(n.cmp(hp.p)>=0||i.cmp(hp.p)>=0)return null;if(n=n.toRed(hp.red),i=i.toRed(hp.red),(6===e||7===e)&&i.isOdd()!==(7===e))return null;const s=n.redSqr().redIMul(n);return i.redSqr().redISub(s.redIAdd(hp.b)).isZero()?dp.keyPair({pub:{x:n,y:i}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function mp(e,t){const r=t.encode(null,33===e.length);for(let t=0;t<e.length;++t)e[t]=r[t]}var yp={contextRandomize:()=>0,privateKeyVerify(e){const t=new pp(e);return t.cmp(hp.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new pp(e),r=hp.n.sub(t).umod(hp.n).toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakAdd(e,t){const r=new pp(t);if(r.cmp(hp.n)>=0)return 1;if(r.iadd(new pp(e)),r.cmp(hp.n)>=0&&r.isub(hp.n),r.isZero())return 1;const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},privateKeyTweakMul(e,t){let r=new pp(t);if(r.cmp(hp.n)>=0||r.isZero())return 1;r.imul(new pp(e)),r.cmp(hp.n)>=0&&(r=r.umod(hp.n));const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},publicKeyVerify:e=>null===gp(e)?1:0,publicKeyCreate(e,t){const r=new pp(t);if(r.cmp(hp.n)>=0||r.isZero())return 1;return mp(e,dp.keyFromPrivate(t).getPublic()),0},publicKeyConvert(e,t){const r=gp(t);if(null===r)return 1;return mp(e,r.getPublic()),0},publicKeyNegate(e,t){const r=gp(t);if(null===r)return 1;const n=r.getPublic();return n.y=n.y.redNeg(),mp(e,n),0},publicKeyCombine(e,t){const r=new Array(t.length);for(let e=0;e<t.length;++e)if(r[e]=gp(t[e]),null===r[e])return 1;let n=r[0].getPublic();for(let e=1;e<r.length;++e)n=n.add(r[e].pub);return n.isInfinity()?2:(mp(e,n),0)},publicKeyTweakAdd(e,t,r){const n=gp(t);if(null===n)return 1;if((r=new pp(r)).cmp(hp.n)>=0)return 2;const i=n.getPublic().add(hp.g.mul(r));return i.isInfinity()?2:(mp(e,i),0)},publicKeyTweakMul(e,t,r){const n=gp(t);if(null===n)return 1;if((r=new pp(r)).cmp(hp.n)>=0||r.isZero())return 2;return mp(e,n.getPublic().mul(r)),0},signatureNormalize(e){const t=new pp(e.subarray(0,32)),r=new pp(e.subarray(32,64));return t.cmp(hp.n)>=0||r.cmp(hp.n)>=0?1:(1===r.cmp(dp.nh)&&e.set(hp.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const r=t.subarray(0,32),n=t.subarray(32,64);if(new pp(r).cmp(hp.n)>=0)return 1;if(new pp(n).cmp(hp.n)>=0)return 1;const{output:i}=e;let s=i.subarray(4,37);s[0]=0,s.set(r,1);let o=33,a=0;for(;o>1&&0===s[a]&&!(128&s[a+1]);--o,++a);if(s=s.subarray(a),128&s[0])return 1;if(o>1&&0===s[0]&&!(128&s[1]))return 1;let u=i.subarray(39,72);u[0]=0,u.set(n,1);let c=33,f=0;for(;c>1&&0===u[f]&&!(128&u[f+1]);--c,++f);return u=u.subarray(f),128&u[0]||c>1&&0===u[0]&&!(128&u[1])?1:(e.outputlen=6+o+c,i[0]=48,i[1]=e.outputlen-2,i[2]=2,i[3]=s.length,i.set(s,4),i[4+o]=2,i[5+o]=u.length,i.set(u,6+o),0)},signatureImport(e,t){if(t.length<8)return 1;if(t.length>72)return 1;if(48!==t[0])return 1;if(t[1]!==t.length-2)return 1;if(2!==t[2])return 1;const r=t[3];if(0===r)return 1;if(5+r>=t.length)return 1;if(2!==t[4+r])return 1;const n=t[5+r];if(0===n)return 1;if(6+r+n!==t.length)return 1;if(128&t[4])return 1;if(r>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[r+6])return 1;if(n>1&&0===t[r+6]&&!(128&t[r+7]))return 1;let i=t.subarray(4,4+r);if(33===i.length&&0===i[0]&&(i=i.subarray(1)),i.length>32)return 1;let s=t.subarray(6+r);if(33===s.length&&0===s[0]&&(s=s.slice(1)),s.length>32)throw new Error("S length is too long");let o=new pp(i);o.cmp(hp.n)>=0&&(o=new pp(0));let a=new pp(t.subarray(6+r));return a.cmp(hp.n)>=0&&(a=new pp(0)),e.set(o.toArrayLike(Uint8Array,"be",32),0),e.set(a.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,r,n,i){if(i){const e=i;i=i=>{const s=e(t,r,null,n,i);if(!(s instanceof Uint8Array&&32===s.length))throw new Error("This is the way");return new pp(s)}}const s=new pp(r);if(s.cmp(hp.n)>=0||s.isZero())return 1;let o;try{o=dp.sign(t,r,{canonical:!0,k:i,pers:n})}catch(e){return 1}return e.signature.set(o.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(o.s.toArrayLike(Uint8Array,"be",32),32),e.recid=o.recoveryParam,0},ecdsaVerify(e,t,r){const n={r:e.subarray(0,32),s:e.subarray(32,64)},i=new pp(n.r),s=new pp(n.s);if(i.cmp(hp.n)>=0||s.cmp(hp.n)>=0)return 1;if(1===s.cmp(dp.nh)||i.isZero()||s.isZero())return 3;const o=gp(r);if(null===o)return 2;const a=o.getPublic();return dp.verify(t,n,a)?0:3},ecdsaRecover(e,t,r,n){const i={r:t.slice(0,32),s:t.slice(32,64)},s=new pp(i.r),o=new pp(i.s);if(s.cmp(hp.n)>=0||o.cmp(hp.n)>=0)return 1;if(s.isZero()||o.isZero())return 2;let a;try{a=dp.recoverPubKey(n,i,r)}catch(e){return 2}return mp(e,a),0},ecdh(e,t,r,n,i,s,o){const a=gp(t);if(null===a)return 1;const u=new pp(r);if(u.cmp(hp.n)>=0||u.isZero())return 2;const c=a.getPublic().mul(u);if(void 0===i){const t=c.encode(null,!0),r=dp.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=r[t]}else{s||(s=new Uint8Array(32));const t=c.getX().toArray("be",32);for(let e=0;e<32;++e)s[e]=t[e];o||(o=new Uint8Array(32));const r=c.getY().toArray("be",32);for(let e=0;e<32;++e)o[e]=r[e];const a=i(s,o,n);if(!(a instanceof Uint8Array&&a.length===e.length))return 2;e.set(a)}return 0}},bp=(e=>({contextRandomize(t){if(ap(null===t||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==t&&up("seed",t,32),1===e.contextRandomize(t))throw new Error(Qh)},privateKeyVerify:t=>(up("private key",t,32),0===e.privateKeyVerify(t)),privateKeyNegate(t){switch(up("private key",t,32),e.privateKeyNegate(t)){case 0:return t;case 1:throw new Error(Jh)}},privateKeyTweakAdd(t,r){switch(up("private key",t,32),up("tweak",r,32),e.privateKeyTweakAdd(t,r)){case 0:return t;case 1:throw new Error($h)}},privateKeyTweakMul(t,r){switch(up("private key",t,32),up("tweak",r,32),e.privateKeyTweakMul(t,r)){case 0:return t;case 1:throw new Error(Yh)}},publicKeyVerify:t=>(up("public key",t,[33,65]),0===e.publicKeyVerify(t)),publicKeyCreate(t,r=!0,n){switch(up("private key",t,32),cp(r),n=fp(n,r?33:65),e.publicKeyCreate(n,t)){case 0:return n;case 1:throw new Error(Zh);case 2:throw new Error(tp)}},publicKeyConvert(t,r=!0,n){switch(up("public key",t,[33,65]),cp(r),n=fp(n,r?33:65),e.publicKeyConvert(n,t)){case 0:return n;case 1:throw new Error(ep);case 2:throw new Error(tp)}},publicKeyNegate(t,r=!0,n){switch(up("public key",t,[33,65]),cp(r),n=fp(n,r?33:65),e.publicKeyNegate(n,t)){case 0:return n;case 1:throw new Error(ep);case 2:throw new Error(Jh);case 3:throw new Error(tp)}},publicKeyCombine(t,r=!0,n){ap(Array.isArray(t),"Expected public keys to be an Array"),ap(t.length>0,"Expected public keys array will have more than zero items");for(const e of t)up("public key",e,[33,65]);switch(cp(r),n=fp(n,r?33:65),e.publicKeyCombine(n,t)){case 0:return n;case 1:throw new Error(ep);case 2:throw new Error(rp);case 3:throw new Error(tp)}},publicKeyTweakAdd(t,r,n=!0,i){switch(up("public key",t,[33,65]),up("tweak",r,32),cp(n),i=fp(i,n?33:65),e.publicKeyTweakAdd(i,t,r)){case 0:return i;case 1:throw new Error(ep);case 2:throw new Error($h)}},publicKeyTweakMul(t,r,n=!0,i){switch(up("public key",t,[33,65]),up("tweak",r,32),cp(n),i=fp(i,n?33:65),e.publicKeyTweakMul(i,t,r)){case 0:return i;case 1:throw new Error(ep);case 2:throw new Error(Yh)}},signatureNormalize(t){switch(up("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(np)}},signatureExport(t,r){up("signature",t,64);const n={output:r=fp(r,72),outputlen:72};switch(e.signatureExport(n,t)){case 0:return r.slice(0,n.outputlen);case 1:throw new Error(np);case 2:throw new Error(Jh)}},signatureImport(t,r){switch(up("signature",t),r=fp(r,64),e.signatureImport(r,t)){case 0:return r;case 1:throw new Error(np);case 2:throw new Error(Jh)}},ecdsaSign(t,r,n={},i){up("message",t,32),up("private key",r,32),ap("Object"===lp(n),"Expected options to be an Object"),void 0!==n.data&&up("options.data",n.data),void 0!==n.noncefn&&ap("Function"===lp(n.noncefn),"Expected options.noncefn to be a Function");const s={signature:i=fp(i,64),recid:null};switch(e.ecdsaSign(s,t,r,n.data,n.noncefn)){case 0:return s;case 1:throw new Error(ip);case 2:throw new Error(Jh)}},ecdsaVerify(t,r,n){switch(up("signature",t,64),up("message",r,32),up("public key",n,[33,65]),e.ecdsaVerify(t,r,n)){case 0:return!0;case 3:return!1;case 1:throw new Error(np);case 2:throw new Error(ep)}},ecdsaRecover(t,r,n,i=!0,s){switch(up("signature",t,64),ap("Number"===lp(r)&&r>=0&&r<=3,"Expected recovery id to be a Number within interval [0, 3]"),up("message",n,32),cp(i),s=fp(s,i?33:65),e.ecdsaRecover(s,t,r,n)){case 0:return s;case 1:throw new Error(np);case 2:throw new Error(sp);case 3:throw new Error(Jh)}},ecdh(t,r,n={},i){switch(up("public key",t,[33,65]),up("private key",r,32),ap("Object"===lp(n),"Expected options to be an Object"),void 0!==n.data&&up("options.data",n.data),void 0!==n.hashfn?(ap("Function"===lp(n.hashfn),"Expected options.hashfn to be a Function"),void 0!==n.xbuf&&up("options.xbuf",n.xbuf,32),void 0!==n.ybuf&&up("options.ybuf",n.ybuf,32),up("output",i)):i=fp(i,32),e.ecdh(i,t,r,n.data,n.hashfn,n.xbuf,n.ybuf)){case 0:return i;case 1:throw new Error(ep);case 2:throw new Error(op)}}}))(yp),vp={},wp={exports:{}},_p={exports:{}};
10
+ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
11
+ !function(e,t){var r=oe,n=r.Buffer;function i(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s),s.prototype=Object.create(n.prototype),i(n,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}}(_p,_p.exports);var Ep=_p.exports,Ap=65536,Sp=4294967295;var kp=Ep.Buffer,xp=r.crypto||r.msCrypto;xp&&xp.getRandomValues?wp.exports=function(e,t){if(e>Sp)throw new RangeError("requested too many random bytes");var r=kp.allocUnsafe(e);if(e>0)if(e>Ap)for(var n=0;n<e;n+=Ap)xp.getRandomValues(r.slice(n,n+Ap));else xp.getRandomValues(r);if("function"==typeof t)return process.nextTick((function(){t(null,r)}));return r}:wp.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")};var Tp=wp.exports;Object.defineProperty(vp,"__esModule",{value:!0});var Rp=Tp;vp.getRandomBytes=function(e){return new Promise((function(t,r){Rp(e,(function(e,n){e?r(e):t(n)}))}))},vp.getRandomBytesSync=function(e){return Rp(e)},function(e){var t=r&&r.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))},n=r&&r.__generator||function(e,t){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o;)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 o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};Object.defineProperty(e,"__esModule",{value:!0});var i=bp,s=vp;e.createPrivateKey=function(){return t(this,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:return[4,s.getRandomBytes(32)];case 1:return e=t.sent(),i.privateKeyVerify(e)?[2,e]:[3,0];case 2:return[2]}}))}))},e.createPrivateKeySync=function(){for(;;){var e=s.getRandomBytesSync(32);if(i.privateKeyVerify(e))return e}},function(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}(bp)}(Xh);var Op={};function Ip(e){if("string"!=typeof e)throw new Error("[isHexPrefixed] input must be type 'string', received type ".concat(typeof e));return"0"===e[0]&&"x"===e[1]}Object.defineProperty(Op,"__esModule",{value:!0}),Op.isHexString=Op.getKeys=Op.fromAscii=Op.fromUtf8=Op.toAscii=Op.arrayContainsArray=Op.getBinarySize=Op.padToEven=Op.stripHexPrefix=Op.isHexPrefixed=void 0,Op.isHexPrefixed=Ip;function Mp(e){var t=e;if("string"!=typeof t)throw new Error("[padToEven] value must be type 'string', received ".concat(typeof t));return t.length%2&&(t="0".concat(t)),t}Op.stripHexPrefix=function(e){if("string"!=typeof e)throw new Error("[stripHexPrefix] input must be type 'string', received ".concat(typeof e));return Ip(e)?e.slice(2):e},Op.padToEven=Mp,Op.getBinarySize=function(e){if("string"!=typeof e)throw new Error("[getBinarySize] method requires input type 'string', recieved ".concat(typeof e));return Buffer.byteLength(e,"utf8")},Op.arrayContainsArray=function(e,t,r){if(!0!==Array.isArray(e))throw new Error("[arrayContainsArray] method requires input 'superset' to be an array, got type '".concat(typeof e,"'"));if(!0!==Array.isArray(t))throw new Error("[arrayContainsArray] method requires input 'subset' to be an array, got type '".concat(typeof t,"'"));return t[r?"some":"every"]((function(t){return e.indexOf(t)>=0}))},Op.toAscii=function(e){var t="",r=0,n=e.length;for("0x"===e.substring(0,2)&&(r=2);r<n;r+=2){var i=parseInt(e.substr(r,2),16);t+=String.fromCharCode(i)}return t},Op.fromUtf8=function(e){var t=Buffer.from(e,"utf8");return"0x".concat(Mp(t.toString("hex")).replace(/^0+|0+$/g,""))},Op.fromAscii=function(e){for(var t="",r=0;r<e.length;r++){var n=e.charCodeAt(r).toString(16);t+=n.length<2?"0".concat(n):n}return"0x".concat(t)},Op.getKeys=function(e,t,r){if(!Array.isArray(e))throw new Error("[getKeys] method expects input 'params' to be an array, got ".concat(typeof e));if("string"!=typeof t)throw new Error("[getKeys] method expects input 'key' to be type 'string', got ".concat(typeof e));for(var n=[],i=0;i<e.length;i++){var s=e[i][t];if(r&&!s)s="";else if("string"!=typeof s)throw new Error("invalid abi - expected type 'string', received ".concat(typeof s));n.push(s)}return n},Op.isHexString=function(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)};var Pp={},Np={};Object.defineProperty(Np,"__esModule",{value:!0}),Np.assertIsString=Np.assertIsArray=Np.assertIsBuffer=Np.assertIsHexString=void 0;var Cp=Op;Np.assertIsHexString=function(e){if(!(0,Cp.isHexString)(e)){var t="This method only supports 0x-prefixed hex strings but input was: ".concat(e);throw new Error(t)}};Np.assertIsBuffer=function(e){if(!Buffer.isBuffer(e)){var t="This method only supports Buffer but input was: ".concat(e);throw new Error(t)}};Np.assertIsArray=function(e){if(!Array.isArray(e)){var t="This method only supports number arrays but input was: ".concat(e);throw new Error(t)}};Np.assertIsString=function(e){if("string"!=typeof e){var t="This method only supports strings but input was: ".concat(e);throw new Error(t)}},function(e){var t=r&&r.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},n=r&&r.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o};Object.defineProperty(e,"__esModule",{value:!0}),e.bufArrToArr=e.arrToBufArr=e.validateNoLeadingZeroes=e.baToJSON=e.toUtf8=e.addHexPrefix=e.toUnsigned=e.fromSigned=e.bufferToHex=e.bufferToInt=e.toBuffer=e.unpadHexString=e.unpadArray=e.unpadBuffer=e.setLengthRight=e.setLengthLeft=e.zeros=e.intToBuffer=e.intToHex=void 0;var i=ql,s=Op,o=Np;e.intToHex=function(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("Received an invalid integer type: ".concat(e));return"0x".concat(e.toString(16))};e.intToBuffer=function(t){var r=(0,e.intToHex)(t);return Buffer.from((0,s.padToEven)(r.slice(2)),"hex")};e.zeros=function(e){return Buffer.allocUnsafe(e).fill(0)};var a=function(t,r,n){var i=(0,e.zeros)(r);return n?t.length<r?(t.copy(i),i):t.slice(0,r):t.length<r?(t.copy(i,r-t.length),i):t.slice(-r)};e.setLengthLeft=function(e,t){return(0,o.assertIsBuffer)(e),a(e,t,!1)};e.setLengthRight=function(e,t){return(0,o.assertIsBuffer)(e),a(e,t,!0)};var u=function(e){for(var t=e[0];e.length>0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};e.unpadBuffer=function(e){return(0,o.assertIsBuffer)(e),u(e)};e.unpadArray=function(e){return(0,o.assertIsArray)(e),u(e)};e.unpadHexString=function(e){return(0,o.assertIsHexString)(e),e=(0,s.stripHexPrefix)(e),u(e)};e.toBuffer=function(t){if(null==t)return Buffer.allocUnsafe(0);if(Buffer.isBuffer(t))return Buffer.from(t);if(Array.isArray(t)||t instanceof Uint8Array)return Buffer.from(t);if("string"==typeof t){if(!(0,s.isHexString)(t))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ".concat(t));return Buffer.from((0,s.padToEven)((0,s.stripHexPrefix)(t)),"hex")}if("number"==typeof t)return(0,e.intToBuffer)(t);if(i.BN.isBN(t)){if(t.isNeg())throw new Error("Cannot convert negative BN to buffer. Given: ".concat(t));return t.toArrayLike(Buffer)}if(t.toArray)return Buffer.from(t.toArray());if(t.toBuffer)return Buffer.from(t.toBuffer());throw new Error("invalid type")};e.bufferToInt=function(t){return new i.BN((0,e.toBuffer)(t)).toNumber()};e.bufferToHex=function(t){return"0x"+(t=(0,e.toBuffer)(t)).toString("hex")};e.fromSigned=function(e){return new i.BN(e).fromTwos(256)};e.toUnsigned=function(e){return Buffer.from(e.toTwos(256).toArray())};e.addHexPrefix=function(e){return"string"!=typeof e||(0,s.isHexPrefixed)(e)?e:"0x"+e};e.toUtf8=function(e){if((e=(0,s.stripHexPrefix)(e)).length%2!=0)throw new Error("Invalid non-even hex string input for toUtf8() provided");return Buffer.from(e.replace(/^(00)+|(00)+$/g,""),"hex").toString("utf8")};e.baToJSON=function(t){if(Buffer.isBuffer(t))return"0x".concat(t.toString("hex"));if(t instanceof Array){for(var r=[],n=0;n<t.length;n++)r.push((0,e.baToJSON)(t[n]));return r}};e.validateNoLeadingZeroes=function(e){var r,i;try{for(var s=t(Object.entries(e)),o=s.next();!o.done;o=s.next()){var a=n(o.value,2),u=a[0],c=a[1];if(void 0!==c&&c.length>0&&0===c[0])throw new Error("".concat(u," cannot have leading zeroes, received: ").concat(c.toString("hex")))}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}},e.arrToBufArr=function e(t){return Array.isArray(t)?t.map((function(t){return e(t)})):Buffer.from(t)},e.bufArrToArr=function e(t){return Array.isArray(t)?t.map((function(t){return e(t)})):Uint8Array.from(null!=t?t:[])}}(Pp);var Bp={},Up={},Lp={};Object.defineProperty(Lp,"__esModule",{value:!0}),Lp.createHashFunction=function(e){return function(t){var r=e();return r.update(t),Buffer.from(r.digest())}};var jp={exports:{}};function Dp(){}function Fp(){Fp.init.call(this)}function qp(e){return void 0===e._maxListeners?Fp.defaultMaxListeners:e._maxListeners}function zp(e,t,r,n){var i,s,o;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((s=e._events)?(s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]):(s=e._events=new Dp,e._eventsCount=0),o){if("function"==typeof o?o=s[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),!o.warned&&(i=qp(e))&&i>0&&o.length>i){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,function(e){"function"==typeof console.warn?console.warn(e):console.log(e)}(a)}}else o=s[t]=r,++e._eventsCount;return e}function Kp(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 Hp(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 Gp(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}Dp.prototype=Object.create(null),Fp.EventEmitter=Fp,Fp.usingDomains=!1,Fp.prototype.domain=void 0,Fp.prototype._events=void 0,Fp.prototype._maxListeners=void 0,Fp.defaultMaxListeners=10,Fp.init=function(){this.domain=null,Fp.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Dp,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Fp.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},Fp.prototype.getMaxListeners=function(){return qp(this)},Fp.prototype.emit=function(e){var t,r,n,i,s,o,a,u="error"===e;if(o=this._events)u=u&&null==o.error;else if(!u)return!1;if(a=this.domain,u){if(t=arguments[1],!a){if(t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(r=o[e]))return!1;var f="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=Gp(e,n),s=0;s<n;++s)i[s].call(r)}(r,f,this);break;case 2:!function(e,t,r,n){if(t)e.call(r,n);else for(var i=e.length,s=Gp(e,i),o=0;o<i;++o)s[o].call(r,n)}(r,f,this,arguments[1]);break;case 3:!function(e,t,r,n,i){if(t)e.call(r,n,i);else for(var s=e.length,o=Gp(e,s),a=0;a<s;++a)o[a].call(r,n,i)}(r,f,this,arguments[1],arguments[2]);break;case 4:!function(e,t,r,n,i,s){if(t)e.call(r,n,i,s);else for(var o=e.length,a=Gp(e,o),u=0;u<o;++u)a[u].call(r,n,i,s)}(r,f,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),s=1;s<n;s++)i[s-1]=arguments[s];!function(e,t,r,n){if(t)e.apply(r,n);else for(var i=e.length,s=Gp(e,i),o=0;o<i;++o)s[o].apply(r,n)}(r,f,this,i)}return!0},Fp.prototype.addListener=function(e,t){return zp(this,e,t,!1)},Fp.prototype.on=Fp.prototype.addListener,Fp.prototype.prependListener=function(e,t){return zp(this,e,t,!0)},Fp.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,Kp(this,e,t)),this},Fp.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,Kp(this,e,t)),this},Fp.prototype.removeListener=function(e,t){var r,n,i,s,o;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[e]))return this;if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new Dp:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,s=r.length;s-- >0;)if(r[s]===t||r[s].listener&&r[s].listener===t){o=r[s].listener,i=s;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new Dp,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,i=e.length;n<i;r+=1,n+=1)e[r]=e[n];e.pop()}(r,i);n.removeListener&&this.emit("removeListener",e,o||t)}return this},Fp.prototype.off=function(e,t){return this.removeListener(e,t)},Fp.prototype.removeAllListeners=function(e){var t,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new Dp,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new Dp:delete r[e]),this;if(0===arguments.length){for(var n,i=Object.keys(r),s=0;s<i.length;++s)"removeListener"!==(n=i[s])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=new Dp,this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},Fp.prototype.listeners=function(e){var t,r,n=this._events;return r=n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(t):[],r},Fp.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Hp.call(e,t)},Fp.prototype.listenerCount=Hp,Fp.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var Wp,Vp,Xp=i(Object.freeze({__proto__:null,EventEmitter:Fp,default:Fp}));function Jp(){return Vp?Wp:(Vp=1,Wp=Xp.EventEmitter)}var $p,Yp,Qp,Zp,eg=i(gh);function tg(){if(Yp)return $p;function e(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 t(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach((function(e){r(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function r(e,t,r){return(t=i(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}Yp=1;var s=oe.Buffer,o=eg.inspect,a=o&&o.custom||"inspect";function u(e,t,r){s.prototype.copy.call(e,t,r)}return $p=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var r,i,c;return r=e,i=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value: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}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return s.alloc(0);for(var t=s.allocUnsafe(e>>>0),r=this.head,n=0;r;)u(r.data,t,n),n+=r.data.length,r=r.next;return t}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,s=e>i.length?i.length:e;if(s===i.length?n+=i:n+=i.slice(0,e),0==(e-=s)){s===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(s));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=s.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:a,value:function(e,r){return o(this,t(t({},r),{},{depth:0,customInspect:!1}))}}],i&&n(r.prototype,i),c&&n(r,c),Object.defineProperty(r,"prototype",{writable:!1}),e}(),$p}function rg(){if(Zp)return Qp;function e(e,n){r(e,n),t(e)}function t(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function r(e,t){e.emit("error",t)}return Zp=1,Qp={destroy:function(n,i){var s=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(i?i(n):n&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(r,this,n)):process.nextTick(r,this,n)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(n||null,(function(r){!i&&r?s._writableState?s._writableState.errorEmitted?process.nextTick(t,s):(s._writableState.errorEmitted=!0,process.nextTick(e,s,r)):process.nextTick(e,s,r):i?(process.nextTick(t,s),i(r)):process.nextTick(t,s)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}var ng={};var ig,sg,og,ag,ug,cg,fg,lg,dg={};function hg(e,t,r){r||(r=Error);var n=function(e){var r,n;function i(r,n,i){return e.call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,n,i))||this}return n=e,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);n.prototype.name=r.name,n.prototype.code=e,dg[e]=n}function pg(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}function gg(){if(sg)return ig;sg=1;var e=ng.codes.ERR_INVALID_OPT_VALUE;return ig={getHighWaterMark:function(t,r,n,i){var s=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(r,i,n);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0)throw new e(i?n:"highWaterMark",s);return Math.floor(s)}return t.objectMode?16:16384}}}function mg(){if(ag)return og;function e(e){try{if(!r.localStorage)return!1}catch(e){return!1}var t=r.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}return ag=1,og=function(t,r){if(e("noDeprecation"))return t;var n=!1;return function(){if(!n){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),n=!0}return t.apply(this,arguments)}},og}function yg(){if(cg)return ug;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}var t;cg=1,ug=E,E.WritableState=_;var n={deprecate:mg()},i=Jp(),s=oe.Buffer,o=(void 0!==r?r:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var a,u=rg(),c=gg().getHighWaterMark,f=ng.codes,l=f.ERR_INVALID_ARG_TYPE,d=f.ERR_METHOD_NOT_IMPLEMENTED,h=f.ERR_MULTIPLE_CALLBACK,p=f.ERR_STREAM_CANNOT_PIPE,g=f.ERR_STREAM_DESTROYED,m=f.ERR_STREAM_NULL_VALUES,y=f.ERR_STREAM_WRITE_AFTER_END,b=f.ERR_UNKNOWN_ENCODING,v=u.errorOrDestroy;function w(){}function _(r,n,i){t=t||bg(),r=r||{},"boolean"!=typeof i&&(i=n instanceof t),this.objectMode=!!r.objectMode,i&&(this.objectMode=this.objectMode||!!r.writableObjectMode),this.highWaterMark=c(this,r,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===r.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=r.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if("function"!=typeof i)throw new h;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?(process.nextTick(i,n),process.nextTick(R,e,t),e._writableState.errorEmitted=!0,v(e,n)):(i(n),e._writableState.errorEmitted=!0,v(e,n),R(e,t))}(e,r,n,t,i);else{var s=x(r)||e.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||k(e,r),n?process.nextTick(S,e,r,s,i):S(e,r,s,i)}}(n,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==r.emitClose,this.autoDestroy=!!r.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function E(e){var r=this instanceof(t=t||bg());if(!r&&!a.call(E,this))return new E(e);this._writableState=new _(e,this,r),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),i.call(this)}function A(e,t,r,n,i,s,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new g("write")):r?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}function S(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),R(e,t)}function k(t,r){r.bufferProcessing=!0;var n=r.bufferedRequest;if(t._writev&&n&&n.next){var i=r.bufferedRequestCount,s=new Array(i),o=r.corkedRequestsFree;o.entry=n;for(var a=0,u=!0;n;)s[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;s.allBuffers=u,A(t,r,!0,r.length,s,"",o.finish),r.pendingcb++,r.lastBufferedRequest=null,o.next?(r.corkedRequestsFree=o.next,o.next=null):r.corkedRequestsFree=new e(r),r.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,f=n.encoding,l=n.callback;if(A(t,r,!1,r.objectMode?1:c.length,c,f,l),n=n.next,r.bufferedRequestCount--,r.writing)break}null===n&&(r.lastBufferedRequest=null)}r.bufferedRequest=n,r.bufferProcessing=!1}function x(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function T(e,t){e._final((function(r){t.pendingcb--,r&&v(e,r),t.prefinished=!0,e.emit("prefinish"),R(e,t)}))}function R(e,t){var r=x(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(T,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}return ii(E,i),_.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(_.prototype,"buffer",{get:n.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty(E,Symbol.hasInstance,{value:function(e){return!!a.call(this,e)||this===E&&(e&&e._writableState instanceof _)}})):a=function(e){return e instanceof this},E.prototype.pipe=function(){v(this,new p)},E.prototype.write=function(e,t,r){var n,i=this._writableState,a=!1,u=!i.objectMode&&(n=e,s.isBuffer(n)||n instanceof o);return u&&!s.isBuffer(e)&&(e=function(e){return s.from(e)}(e)),"function"==typeof t&&(r=t,t=null),u?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=w),i.ending?function(e,t){var r=new y;v(e,r),process.nextTick(t,r)}(this,r):(u||function(e,t,r,n){var i;return null===r?i=new m:"string"==typeof r||t.objectMode||(i=new l("chunk",["string","Buffer"],r)),!i||(v(e,i),process.nextTick(n,i),!1)}(this,i,e,r))&&(i.pendingcb++,a=function(e,t,r,n,i,o){if(!r){var a=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=s.from(t,r));return t}(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var u=t.objectMode?1:n.length;t.length+=u;var c=t.length<t.highWaterMark;c||(t.needDrain=!0);if(t.writing||t.corked){var f=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},f?f.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else A(e,t,!1,u,n,i,o);return c}(this,i,u,e,t,r)),a},E.prototype.cork=function(){this._writableState.corked++},E.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||k(this,e))},E.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new b(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(E.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(E.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),E.prototype._write=function(e,t,r){r(new d("_write()"))},E.prototype._writev=null,E.prototype.end=function(e,t,r){var n=this._writableState;return"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||function(e,t,r){t.ending=!0,R(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(E.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),E.prototype.destroy=u.destroy,E.prototype._undestroy=u.undestroy,E.prototype._destroy=function(e,t){t(e)},ug}function bg(){if(lg)return fg;lg=1;var e=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};fg=o;var t=Bg(),r=yg();ii(o,t);for(var n=e(r.prototype),i=0;i<n.length;i++){var s=n[i];o.prototype[s]||(o.prototype[s]=r.prototype[s])}function o(e){if(!(this instanceof o))return new o(e);t.call(this,e),r.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",a)))}function a(){this._writableState.ended||process.nextTick(u,this)}function u(e){e.end()}return Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),fg}hg("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),hg("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,i,s,o;if("string"==typeof t&&(i="not ",t.substr(!s||s<0?0:+s,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))o="The ".concat(e," ").concat(n," ").concat(pg(t,"type"));else{var a=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";o='The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(pg(t,"type"))}return o+=". Received type ".concat(typeof r)}),TypeError),hg("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),hg("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),hg("ERR_STREAM_PREMATURE_CLOSE","Premature close"),hg("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),hg("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),hg("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),hg("ERR_STREAM_WRITE_AFTER_END","write after end"),hg("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),hg("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),hg("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),ng.codes=dg;var vg=_.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 wg(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!vg(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=Eg;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=Ag;break;default:return void(this.write=_g)}this.charBuffer=new _(6),this.charReceived=0,this.charLength=0}function _g(e){return e.toString(this.encoding)}function Eg(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function Ag(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}wg.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<this.charLength)return"";if(e=e.slice(r,e.length),!((i=(t=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(t.length-1))>=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 s=this.surrogateSize;return this.charLength+=s,this.charReceived+=s,this.charBuffer.copy(this.charBuffer,s,0,s),e.copy(this.charBuffer,0,0,s),t.substring(0,n)}return t},wg.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},wg.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 Sg=i(Object.freeze({__proto__:null,StringDecoder:wg})),kg=ng.codes.ERR_STREAM_PREMATURE_CLOSE;function xg(){}var Tg,Rg,Og,Ig,Mg,Pg,Ng=function e(t,r,n){if("function"==typeof r)return e(t,null,r);r||(r={}),n=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}(n||xg);var i=r.readable||!1!==r.readable&&t.readable,s=r.writable||!1!==r.writable&&t.writable,o=function(){t.writable||u()},a=t._writableState&&t._writableState.finished,u=function(){s=!1,a=!0,i||n.call(t)},c=t._readableState&&t._readableState.endEmitted,f=function(){i=!1,c=!0,s||n.call(t)},l=function(e){n.call(t,e)},d=function(){var e;return i&&!c?(t._readableState&&t._readableState.ended||(e=new kg),n.call(t,e)):s&&!a?(t._writableState&&t._writableState.ended||(e=new kg),n.call(t,e)):void 0},h=function(){t.req.on("finish",u)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?s&&!t._writableState&&(t.on("end",o),t.on("close",o)):(t.on("complete",u),t.on("abort",d),t.req?h():t.on("request",h)),t.on("end",f),t.on("finish",u),!1!==r.error&&t.on("error",l),t.on("close",d),function(){t.removeListener("complete",u),t.removeListener("abort",d),t.removeListener("request",h),t.req&&t.req.removeListener("finish",u),t.removeListener("end",o),t.removeListener("close",o),t.removeListener("finish",u),t.removeListener("end",f),t.removeListener("error",l),t.removeListener("close",d)}};function Cg(){if(Rg)return Tg;var e;function t(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Rg=1;var r=Ng,n=Symbol("lastResolve"),i=Symbol("lastReject"),s=Symbol("error"),o=Symbol("ended"),a=Symbol("lastPromise"),u=Symbol("handlePromise"),c=Symbol("stream");function f(e,t){return{value:e,done:t}}function l(e){var t=e[n];if(null!==t){var r=e[c].read();null!==r&&(e[a]=null,e[n]=null,e[i]=null,t(f(r,!1)))}}function d(e){process.nextTick(l,e)}var h=Object.getPrototypeOf((function(){})),p=Object.setPrototypeOf((e={get stream(){return this[c]},next:function(){var e=this,t=this[s];if(null!==t)return Promise.reject(t);if(this[o])return Promise.resolve(f(void 0,!0));if(this[c].destroyed)return new Promise((function(t,r){process.nextTick((function(){e[s]?r(e[s]):t(f(void 0,!0))}))}));var r,n=this[a];if(n)r=new Promise(function(e,t){return function(r,n){e.then((function(){t[o]?r(f(void 0,!0)):t[u](r,n)}),n)}}(n,this));else{var i=this[c].read();if(null!==i)return Promise.resolve(f(i,!1));r=new Promise(this[u])}return this[a]=r,r}},t(e,Symbol.asyncIterator,(function(){return this})),t(e,"return",(function(){var e=this;return new Promise((function(t,r){e[c].destroy(null,(function(e){e?r(e):t(f(void 0,!0))}))}))})),e),h);return Tg=function(e){var l,h=Object.create(p,(t(l={},c,{value:e,writable:!0}),t(l,n,{value:null,writable:!0}),t(l,i,{value:null,writable:!0}),t(l,s,{value:null,writable:!0}),t(l,o,{value:e._readableState.endEmitted,writable:!0}),t(l,u,{value:function(e,t){var r=h[c].read();r?(h[a]=null,h[n]=null,h[i]=null,e(f(r,!1))):(h[n]=e,h[i]=t)},writable:!0}),l));return h[a]=null,r(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=h[i];return null!==t&&(h[a]=null,h[n]=null,h[i]=null,t(e)),void(h[s]=e)}var r=h[n];null!==r&&(h[a]=null,h[n]=null,h[i]=null,r(f(void 0,!0))),h[o]=!0})),e.on("readable",d.bind(null,h)),h},Tg}function Bg(){if(Pg)return Mg;var e;Pg=1,Mg=E,E.ReadableState=_,Xp.EventEmitter;var t=function(e,t){return e.listeners(t).length},n=Jp(),i=oe.Buffer,s=(void 0!==r?r:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var o,a=eg;o=a&&a.debuglog?a.debuglog("stream"):function(){};var u,c,f,l=tg(),d=rg(),h=gg().getHighWaterMark,p=ng.codes,g=p.ERR_INVALID_ARG_TYPE,m=p.ERR_STREAM_PUSH_AFTER_EOF,y=p.ERR_METHOD_NOT_IMPLEMENTED,b=p.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;ii(E,n);var v=d.errorOrDestroy,w=["error","close","destroy","pause","resume"];function _(t,r,n){e=e||bg(),t=t||{},"boolean"!=typeof n&&(n=r instanceof e),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=h(this,t,"readableHighWaterMark",n),this.buffer=new l,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.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(u||(u=Sg.StringDecoder),this.decoder=new u(t.encoding),this.encoding=t.encoding)}function E(t){if(e=e||bg(),!(this instanceof E))return new E(t);var r=this instanceof e;this._readableState=new _(t,this,r),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),n.call(this)}function A(e,t,r,n,a){o("readableAddChunk",t);var u,c=e._readableState;if(null===t)c.reading=!1,function(e,t){if(o("onEofChunk"),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,t.sync?T(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,R(e)))}(e,c);else if(a||(u=function(e,t){var r;n=t,i.isBuffer(n)||n instanceof s||"string"==typeof t||void 0===t||e.objectMode||(r=new g("chunk",["string","Buffer","Uint8Array"],t));var n;return r}(c,t)),u)v(e,u);else if(c.objectMode||t&&t.length>0)if("string"==typeof t||c.objectMode||Object.getPrototypeOf(t)===i.prototype||(t=function(e){return i.from(e)}(t)),n)c.endEmitted?v(e,new b):S(e,c,t,!0);else if(c.ended)v(e,new m);else{if(c.destroyed)return!1;c.reading=!1,c.decoder&&!r?(t=c.decoder.write(t),c.objectMode||0!==t.length?S(e,c,t,!1):O(e,c)):S(e,c,t,!1)}else n||(c.reading=!1,O(e,c));return!c.ended&&(c.length<c.highWaterMark||0===c.length)}function S(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&T(e)),O(e,t)}Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),E.prototype.destroy=d.destroy,E.prototype._undestroy=d.undestroy,E.prototype._destroy=function(e,t){t(e)},E.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=i.from(e,t),t=""),r=!0),A(this,e,t,!1,r)},E.prototype.unshift=function(e){return A(this,e,null,!0,!1)},E.prototype.isPaused=function(){return!1===this._readableState.flowing},E.prototype.setEncoding=function(e){u||(u=Sg.StringDecoder);var t=new u(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";null!==r;)n+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var k=1073741824;function x(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=k?e=k:(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 T(e){var t=e._readableState;o("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(o("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(R,e))}function R(e){var t=e._readableState;o("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,C(e)}function O(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(I,e,t))}function I(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(o("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function M(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function P(e){o("readable nexttick read 0"),e.read(0)}function N(e,t){o("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),C(e),t.flowing&&!t.reading&&e.read(0)}function C(e){var t=e._readableState;for(o("flow",t.flowing);t.flowing&&null!==e.read(););}function B(e,t){return 0===t.length?null:(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);var r}function U(e){var t=e._readableState;o("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(L,t,e))}function L(e,t){if(o("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function j(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}return E.prototype.read=function(e){o("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return o("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?U(this):T(this),null;if(0===(e=x(e,t))&&t.ended)return 0===t.length&&U(this),null;var n,i=t.needReadable;return o("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&o("length less than watermark",i=!0),t.ended||t.reading?o("reading or ended",i=!1):i&&(o("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=x(r,t))),null===(n=e>0?B(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&U(this)),null!==n&&this.emit("data",n),n},E.prototype._read=function(e){v(this,new y("_read()"))},E.prototype.pipe=function(e,r){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,o("pipe count=%d opts=%j",i.pipesCount,r);var s=(!r||!1!==r.end)&&e!==process.stdout&&e!==process.stderr?u:g;function a(t,r){o("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,o("cleanup"),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("drain",c),e.removeListener("error",d),e.removeListener("unpipe",a),n.removeListener("end",u),n.removeListener("end",g),n.removeListener("data",l),f=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}function u(){o("onend"),e.end()}i.endEmitted?process.nextTick(s):n.once("end",s),e.on("unpipe",a);var c=function(e){return function(){var r=e._readableState;o("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&t(e,"data")&&(r.flowing=!0,C(e))}}(n);e.on("drain",c);var f=!1;function l(t){o("ondata");var r=e.write(t);o("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==j(i.pipes,e))&&!f&&(o("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function d(r){o("onerror",r),g(),e.removeListener("error",d),0===t(e,"error")&&v(e,r)}function h(){e.removeListener("finish",p),g()}function p(){o("onfinish"),e.removeListener("close",h),g()}function g(){o("unpipe"),n.unpipe(e)}return n.on("data",l),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",n),i.flowing||(o("pipe resume"),n.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};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,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<i;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=j(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},E.prototype.on=function(e,t){var r=n.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,o("on readable",i.length,i.reading),i.length?T(this):i.reading||process.nextTick(P,this))),r},E.prototype.addListener=E.prototype.on,E.prototype.removeListener=function(e,t){var r=n.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(M,this),r},E.prototype.removeAllListeners=function(e){var t=n.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(M,this),t},E.prototype.resume=function(){var e=this._readableState;return e.flowing||(o("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(N,e,t))}(this,e)),e.paused=!1,this},E.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},E.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(o("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(o("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var s=0;s<w.length;s++)e.on(w[s],this.emit.bind(this,w[s]));return this._read=function(t){o("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(E.prototype[Symbol.asyncIterator]=function(){return void 0===c&&(c=Cg()),c(this)}),Object.defineProperty(E.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(E.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(E.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),E._fromList=B,Object.defineProperty(E.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(E.from=function(e,t){return void 0===f&&(f=Ig?Og:(Ig=1,Og=function(){throw new Error("Readable.from is not available in the browser")})),f(E,e,t)}),Mg}var Ug=Hg,Lg=ng.codes,jg=Lg.ERR_METHOD_NOT_IMPLEMENTED,Dg=Lg.ERR_MULTIPLE_CALLBACK,Fg=Lg.ERR_TRANSFORM_ALREADY_TRANSFORMING,qg=Lg.ERR_TRANSFORM_WITH_LENGTH_0,zg=bg();function Kg(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new Dg);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Hg(e){if(!(this instanceof Hg))return new Hg(e);zg.call(this,e),this._transformState={afterTransform:Kg.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",Gg)}function Gg(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?Wg(this,null,null):this._flush((function(t,r){Wg(e,t,r)}))}function Wg(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new qg;if(e._transformState.transforming)throw new Fg;return e.push(null)}ii(Hg,zg),Hg.prototype.push=function(e,t){return this._transformState.needTransform=!1,zg.prototype.push.call(this,e,t)},Hg.prototype._transform=function(e,t,r){r(new jg("_transform()"))},Hg.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Hg.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},Hg.prototype._destroy=function(e,t){zg.prototype._destroy.call(this,e,(function(e){t(e)}))};var Vg,Xg=$g,Jg=Ug;function $g(e){if(!(this instanceof $g))return new $g(e);Jg.call(this,e)}ii($g,Jg),$g.prototype._transform=function(e,t,r){r(null,e)};var Yg=ng.codes,Qg=Yg.ERR_MISSING_ARGS,Zg=Yg.ERR_STREAM_DESTROYED;function em(e){if(e)throw e}function tm(e){e()}function rm(e,t){return e.pipe(t)}var nm=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n,i=function(e){return e.length?"function"!=typeof e[e.length-1]?em:e.pop():em}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Qg("streams");var s=t.map((function(e,r){var o=r<t.length-1;return function(e,t,r,n){n=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(n);var i=!1;e.on("close",(function(){i=!0})),void 0===Vg&&(Vg=Ng),Vg(e,{readable:t,writable:r},(function(e){if(e)return n(e);i=!0,n()}));var s=!1;return function(t){if(!i&&!s)return s=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void n(t||new Zg("pipe"))}}(e,o,r>0,(function(e){n||(n=e),e&&s.forEach(tm),o||(s.forEach(tm),i(n))}))}));return t.reduce(rm)};!function(e,t){(t=e.exports=Bg()).Stream=t,t.Readable=t,t.Writable=yg(),t.Duplex=bg(),t.Transform=Ug,t.PassThrough=Xg,t.finished=Ng,t.pipeline=nm}(jp,jp.exports);var im=jp.exports;const{Transform:sm}=im;const{Transform:om}=im;const am=e=>class t extends sm{constructor(t,r,n,i,s){super(s),this._rate=t,this._capacity=r,this._delimitedSuffix=n,this._hashBitLength=i,this._options=s,this._state=new e,this._state.initialize(t,r),this._finalized=!1}_transform(e,t,r){let n=null;try{this.update(e,t)}catch(e){n=e}r(n)}_flush(e){let t=null;try{this.push(this.digest())}catch(e){t=e}e(t)}update(e,t){if(!Buffer.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer.isBuffer(e)||(e=Buffer.from(e,t)),this._state.absorb(e),this}digest(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let t=this._state.squeeze(this._hashBitLength/8);return void 0!==e&&(t=t.toString(e)),this._resetState(),t}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new t(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}},um=e=>class t extends om{constructor(t,r,n,i){super(i),this._rate=t,this._capacity=r,this._delimitedSuffix=n,this._options=i,this._state=new e,this._state.initialize(t,r),this._finalized=!1}_transform(e,t,r){let n=null;try{this.update(e,t)}catch(e){n=e}r(n)}_flush(){}_read(e){this.push(this.squeeze(e))}update(e,t){if(!Buffer.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer.isBuffer(e)||(e=Buffer.from(e,t)),this._state.absorb(e),this}squeeze(e,t){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let r=this._state.squeeze(e);return void 0!==t&&(r=r.toString(t)),r}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new t(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}};var cm={};const fm=[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];cm.p1600=function(e){for(let t=0;t<24;++t){const r=e[0]^e[10]^e[20]^e[30]^e[40],n=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],o=e[4]^e[14]^e[24]^e[34]^e[44],a=e[5]^e[15]^e[25]^e[35]^e[45],u=e[6]^e[16]^e[26]^e[36]^e[46],c=e[7]^e[17]^e[27]^e[37]^e[47],f=e[8]^e[18]^e[28]^e[38]^e[48],l=e[9]^e[19]^e[29]^e[39]^e[49];let d=f^(i<<1|s>>>31),h=l^(s<<1|i>>>31);const p=e[0]^d,g=e[1]^h,m=e[10]^d,y=e[11]^h,b=e[20]^d,v=e[21]^h,w=e[30]^d,_=e[31]^h,E=e[40]^d,A=e[41]^h;d=r^(o<<1|a>>>31),h=n^(a<<1|o>>>31);const S=e[2]^d,k=e[3]^h,x=e[12]^d,T=e[13]^h,R=e[22]^d,O=e[23]^h,I=e[32]^d,M=e[33]^h,P=e[42]^d,N=e[43]^h;d=i^(u<<1|c>>>31),h=s^(c<<1|u>>>31);const C=e[4]^d,B=e[5]^h,U=e[14]^d,L=e[15]^h,j=e[24]^d,D=e[25]^h,F=e[34]^d,q=e[35]^h,z=e[44]^d,K=e[45]^h;d=o^(f<<1|l>>>31),h=a^(l<<1|f>>>31);const H=e[6]^d,G=e[7]^h,W=e[16]^d,V=e[17]^h,X=e[26]^d,J=e[27]^h,$=e[36]^d,Y=e[37]^h,Q=e[46]^d,Z=e[47]^h;d=u^(r<<1|n>>>31),h=c^(n<<1|r>>>31);const ee=e[8]^d,te=e[9]^h,re=e[18]^d,ne=e[19]^h,ie=e[28]^d,se=e[29]^h,oe=e[38]^d,ae=e[39]^h,ue=e[48]^d,ce=e[49]^h,fe=p,le=g,de=y<<4|m>>>28,he=m<<4|y>>>28,pe=b<<3|v>>>29,ge=v<<3|b>>>29,me=_<<9|w>>>23,ye=w<<9|_>>>23,be=E<<18|A>>>14,ve=A<<18|E>>>14,we=S<<1|k>>>31,_e=k<<1|S>>>31,Ee=T<<12|x>>>20,Ae=x<<12|T>>>20,Se=R<<10|O>>>22,ke=O<<10|R>>>22,xe=M<<13|I>>>19,Te=I<<13|M>>>19,Re=P<<2|N>>>30,Oe=N<<2|P>>>30,Ie=B<<30|C>>>2,Me=C<<30|B>>>2,Pe=U<<6|L>>>26,Ne=L<<6|U>>>26,Ce=D<<11|j>>>21,Be=j<<11|D>>>21,Ue=F<<15|q>>>17,Le=q<<15|F>>>17,je=K<<29|z>>>3,De=z<<29|K>>>3,Fe=H<<28|G>>>4,qe=G<<28|H>>>4,ze=V<<23|W>>>9,Ke=W<<23|V>>>9,He=X<<25|J>>>7,Ge=J<<25|X>>>7,We=$<<21|Y>>>11,Ve=Y<<21|$>>>11,Xe=Z<<24|Q>>>8,Je=Q<<24|Z>>>8,$e=ee<<27|te>>>5,Ye=te<<27|ee>>>5,Qe=re<<20|ne>>>12,Ze=ne<<20|re>>>12,et=se<<7|ie>>>25,tt=ie<<7|se>>>25,rt=oe<<8|ae>>>24,nt=ae<<8|oe>>>24,it=ue<<14|ce>>>18,st=ce<<14|ue>>>18;e[0]=fe^~Ee&Ce,e[1]=le^~Ae&Be,e[10]=Fe^~Qe&pe,e[11]=qe^~Ze&ge,e[20]=we^~Pe&He,e[21]=_e^~Ne&Ge,e[30]=$e^~de&Se,e[31]=Ye^~he&ke,e[40]=Ie^~ze&et,e[41]=Me^~Ke&tt,e[2]=Ee^~Ce&We,e[3]=Ae^~Be&Ve,e[12]=Qe^~pe&xe,e[13]=Ze^~ge&Te,e[22]=Pe^~He&rt,e[23]=Ne^~Ge&nt,e[32]=de^~Se&Ue,e[33]=he^~ke&Le,e[42]=ze^~et&me,e[43]=Ke^~tt&ye,e[4]=Ce^~We&it,e[5]=Be^~Ve&st,e[14]=pe^~xe&je,e[15]=ge^~Te&De,e[24]=He^~rt&be,e[25]=Ge^~nt&ve,e[34]=Se^~Ue&Xe,e[35]=ke^~Le&Je,e[44]=et^~me&Re,e[45]=tt^~ye&Oe,e[6]=We^~it&fe,e[7]=Ve^~st&le,e[16]=xe^~je&Fe,e[17]=Te^~De&qe,e[26]=rt^~be&we,e[27]=nt^~ve&_e,e[36]=Ue^~Xe&$e,e[37]=Le^~Je&Ye,e[46]=me^~Re&Ie,e[47]=ye^~Oe&Me,e[8]=it^~fe&Ee,e[9]=st^~le&Ae,e[18]=je^~Fe&Qe,e[19]=De^~qe&Ze,e[28]=be^~we&Pe,e[29]=ve^~_e&Ne,e[38]=Xe^~$e&de,e[39]=Je^~Ye&he,e[48]=Re^~Ie&ze,e[49]=Oe^~Me&Ke,e[0]^=fm[2*t],e[1]^=fm[2*t+1]}};const lm=cm;function dm(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}dm.prototype.initialize=function(e,t){for(let e=0;e<50;++e)this.state[e]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1},dm.prototype.absorb=function(e){for(let t=0;t<e.length;++t)this.state[~~(this.count/4)]^=e[t]<<this.count%4*8,this.count+=1,this.count===this.blockSize&&(lm.p1600(this.state),this.count=0)},dm.prototype.absorbLastFewBits=function(e){this.state[~~(this.count/4)]^=e<<this.count%4*8,0!=(128&e)&&this.count===this.blockSize-1&&lm.p1600(this.state),this.state[~~((this.blockSize-1)/4)]^=128<<(this.blockSize-1)%4*8,lm.p1600(this.state),this.count=0,this.squeezing=!0},dm.prototype.squeeze=function(e){this.squeezing||this.absorbLastFewBits(1);const t=Buffer.alloc(e);for(let r=0;r<e;++r)t[r]=this.state[~~(this.count/4)]>>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(lm.p1600(this.state),this.count=0);return t},dm.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing};var hm=function(e){const t=am(e),r=um(e);return function(e,n){switch("string"==typeof e?e.toLowerCase():e){case"keccak224":return new t(1152,448,null,224,n);case"keccak256":return new t(1088,512,null,256,n);case"keccak384":return new t(832,768,null,384,n);case"keccak512":return new t(576,1024,null,512,n);case"sha3-224":return new t(1152,448,6,224,n);case"sha3-256":return new t(1088,512,6,256,n);case"sha3-384":return new t(832,768,6,384,n);case"sha3-512":return new t(576,1024,6,512,n);case"shake128":return new r(1344,256,31,n);case"shake256":return new r(1088,512,31,n);default:throw new Error("Invald algorithm: "+e)}}}(dm);Object.defineProperty(Up,"__esModule",{value:!0});var pm=Lp,gm=hm;Up.keccak224=pm.createHashFunction((function(){return gm("keccak224")})),Up.keccak256=pm.createHashFunction((function(){return gm("keccak256")})),Up.keccak384=pm.createHashFunction((function(){return gm("keccak384")})),Up.keccak512=pm.createHashFunction((function(){return gm("keccak512")}));var mm=Ep.Buffer,ym=im.Transform;function bm(e){ym.call(this),this._block=mm.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}ii(bm,ym),bm.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},bm.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},bm.prototype.update=function(e,t){if(function(e,t){if(!mm.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");mm.isBuffer(e)||(e=mm.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)r[i++]=e[n++];this._update(),this._blockOffset=0}for(;n<e.length;)r[this._blockOffset++]=e[n++];for(var s=0,o=8*e.length;o>0;++s)this._length[s]+=o,(o=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*o);return this},bm.prototype._update=function(){throw new Error("_update is not implemented")},bm.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},bm.prototype._digest=function(){throw new Error("_digest is not implemented")};var vm=bm,wm=ii,_m=vm,Em=Ep.Buffer,Am=new Array(16);function Sm(){_m.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function km(e,t){return e<<t|e>>>32-t}function xm(e,t,r,n,i,s,o){return km(e+(t&r|~t&n)+i+s|0,o)+t|0}function Tm(e,t,r,n,i,s,o){return km(e+(t&n|r&~n)+i+s|0,o)+t|0}function Rm(e,t,r,n,i,s,o){return km(e+(t^r^n)+i+s|0,o)+t|0}function Om(e,t,r,n,i,s,o){return km(e+(r^(t|~n))+i+s|0,o)+t|0}wm(Sm,_m),Sm.prototype._update=function(){for(var e=Am,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,s=this._d;r=xm(r,n,i,s,e[0],3614090360,7),s=xm(s,r,n,i,e[1],3905402710,12),i=xm(i,s,r,n,e[2],606105819,17),n=xm(n,i,s,r,e[3],3250441966,22),r=xm(r,n,i,s,e[4],4118548399,7),s=xm(s,r,n,i,e[5],1200080426,12),i=xm(i,s,r,n,e[6],2821735955,17),n=xm(n,i,s,r,e[7],4249261313,22),r=xm(r,n,i,s,e[8],1770035416,7),s=xm(s,r,n,i,e[9],2336552879,12),i=xm(i,s,r,n,e[10],4294925233,17),n=xm(n,i,s,r,e[11],2304563134,22),r=xm(r,n,i,s,e[12],1804603682,7),s=xm(s,r,n,i,e[13],4254626195,12),i=xm(i,s,r,n,e[14],2792965006,17),r=Tm(r,n=xm(n,i,s,r,e[15],1236535329,22),i,s,e[1],4129170786,5),s=Tm(s,r,n,i,e[6],3225465664,9),i=Tm(i,s,r,n,e[11],643717713,14),n=Tm(n,i,s,r,e[0],3921069994,20),r=Tm(r,n,i,s,e[5],3593408605,5),s=Tm(s,r,n,i,e[10],38016083,9),i=Tm(i,s,r,n,e[15],3634488961,14),n=Tm(n,i,s,r,e[4],3889429448,20),r=Tm(r,n,i,s,e[9],568446438,5),s=Tm(s,r,n,i,e[14],3275163606,9),i=Tm(i,s,r,n,e[3],4107603335,14),n=Tm(n,i,s,r,e[8],1163531501,20),r=Tm(r,n,i,s,e[13],2850285829,5),s=Tm(s,r,n,i,e[2],4243563512,9),i=Tm(i,s,r,n,e[7],1735328473,14),r=Rm(r,n=Tm(n,i,s,r,e[12],2368359562,20),i,s,e[5],4294588738,4),s=Rm(s,r,n,i,e[8],2272392833,11),i=Rm(i,s,r,n,e[11],1839030562,16),n=Rm(n,i,s,r,e[14],4259657740,23),r=Rm(r,n,i,s,e[1],2763975236,4),s=Rm(s,r,n,i,e[4],1272893353,11),i=Rm(i,s,r,n,e[7],4139469664,16),n=Rm(n,i,s,r,e[10],3200236656,23),r=Rm(r,n,i,s,e[13],681279174,4),s=Rm(s,r,n,i,e[0],3936430074,11),i=Rm(i,s,r,n,e[3],3572445317,16),n=Rm(n,i,s,r,e[6],76029189,23),r=Rm(r,n,i,s,e[9],3654602809,4),s=Rm(s,r,n,i,e[12],3873151461,11),i=Rm(i,s,r,n,e[15],530742520,16),r=Om(r,n=Rm(n,i,s,r,e[2],3299628645,23),i,s,e[0],4096336452,6),s=Om(s,r,n,i,e[7],1126891415,10),i=Om(i,s,r,n,e[14],2878612391,15),n=Om(n,i,s,r,e[5],4237533241,21),r=Om(r,n,i,s,e[12],1700485571,6),s=Om(s,r,n,i,e[3],2399980690,10),i=Om(i,s,r,n,e[10],4293915773,15),n=Om(n,i,s,r,e[1],2240044497,21),r=Om(r,n,i,s,e[8],1873313359,6),s=Om(s,r,n,i,e[15],4264355552,10),i=Om(i,s,r,n,e[6],2734768916,15),n=Om(n,i,s,r,e[13],1309151649,21),r=Om(r,n,i,s,e[4],4149444226,6),s=Om(s,r,n,i,e[11],3174756917,10),i=Om(i,s,r,n,e[2],718787259,15),n=Om(n,i,s,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+s|0},Sm.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=Em.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};var Im=Sm,Mm=oe.Buffer,Pm=ii,Nm=vm,Cm=new Array(16),Bm=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Um=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Lm=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],jm=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Dm=[0,1518500249,1859775393,2400959708,2840853838],Fm=[1352829926,1548603684,1836072691,2053994217,0];function qm(){Nm.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function zm(e,t){return e<<t|e>>>32-t}function Km(e,t,r,n,i,s,o,a){return zm(e+(t^r^n)+s+o|0,a)+i|0}function Hm(e,t,r,n,i,s,o,a){return zm(e+(t&r|~t&n)+s+o|0,a)+i|0}function Gm(e,t,r,n,i,s,o,a){return zm(e+((t|~r)^n)+s+o|0,a)+i|0}function Wm(e,t,r,n,i,s,o,a){return zm(e+(t&n|r&~n)+s+o|0,a)+i|0}function Vm(e,t,r,n,i,s,o,a){return zm(e+(t^(r|~n))+s+o|0,a)+i|0}Pm(qm,Nm),qm.prototype._update=function(){for(var e=Cm,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,n=0|this._b,i=0|this._c,s=0|this._d,o=0|this._e,a=0|this._a,u=0|this._b,c=0|this._c,f=0|this._d,l=0|this._e,d=0;d<80;d+=1){var h,p;d<16?(h=Km(r,n,i,s,o,e[Bm[d]],Dm[0],Lm[d]),p=Vm(a,u,c,f,l,e[Um[d]],Fm[0],jm[d])):d<32?(h=Hm(r,n,i,s,o,e[Bm[d]],Dm[1],Lm[d]),p=Wm(a,u,c,f,l,e[Um[d]],Fm[1],jm[d])):d<48?(h=Gm(r,n,i,s,o,e[Bm[d]],Dm[2],Lm[d]),p=Gm(a,u,c,f,l,e[Um[d]],Fm[2],jm[d])):d<64?(h=Wm(r,n,i,s,o,e[Bm[d]],Dm[3],Lm[d]),p=Hm(a,u,c,f,l,e[Um[d]],Fm[3],jm[d])):(h=Vm(r,n,i,s,o,e[Bm[d]],Dm[4],Lm[d]),p=Km(a,u,c,f,l,e[Um[d]],Fm[4],jm[d])),r=o,o=s,s=zm(i,10),i=n,n=h,a=l,l=f,f=zm(c,10),c=u,u=p}var g=this._b+i+f|0;this._b=this._c+s+l|0,this._c=this._d+o+a|0,this._d=this._e+r+u|0,this._e=this._a+n+c|0,this._a=g},qm.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=Mm.alloc?Mm.alloc(20):new Mm(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};var Xm=qm,Jm={exports:{}},$m=Ep.Buffer;function Ym(e,t){this._block=$m.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Ym.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=$m.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,s=this._len,o=0;o<i;){for(var a=s%n,u=Math.min(i-o,n-a),c=0;c<u;c++)r[a+c]=e[o+c];o+=u,(s+=u)%n==0&&this._update(r)}return this._len+=i,this},Ym.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return e?s.toString(e):s},Ym.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Qm=Ym,Zm=ii,ey=Qm,ty=Ep.Buffer,ry=[1518500249,1859775393,-1894007588,-899497514],ny=new Array(80);function iy(){this.init(),this._w=ny,ey.call(this,64,56)}function sy(e){return e<<30|e>>>2}function oy(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}Zm(iy,ey),iy.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},iy.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,s=0|this._c,o=0|this._d,a=0|this._e,u=0;u<16;++u)r[u]=e.readInt32BE(4*u);for(;u<80;++u)r[u]=r[u-3]^r[u-8]^r[u-14]^r[u-16];for(var c=0;c<80;++c){var f=~~(c/20),l=0|((t=n)<<5|t>>>27)+oy(f,i,s,o)+a+r[c]+ry[f];a=o,o=s,s=sy(i),i=n,n=l}this._a=n+this._a|0,this._b=i+this._b|0,this._c=s+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},iy.prototype._hash=function(){var e=ty.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var ay=iy,uy=ii,cy=Qm,fy=Ep.Buffer,ly=[1518500249,1859775393,-1894007588,-899497514],dy=new Array(80);function hy(){this.init(),this._w=dy,cy.call(this,64,56)}function py(e){return e<<5|e>>>27}function gy(e){return e<<30|e>>>2}function my(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}uy(hy,cy),hy.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},hy.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,s=0|this._c,o=0|this._d,a=0|this._e,u=0;u<16;++u)r[u]=e.readInt32BE(4*u);for(;u<80;++u)r[u]=(t=r[u-3]^r[u-8]^r[u-14]^r[u-16])<<1|t>>>31;for(var c=0;c<80;++c){var f=~~(c/20),l=py(n)+my(f,i,s,o)+a+r[c]+ly[f]|0;a=o,o=s,s=gy(i),i=n,n=l}this._a=n+this._a|0,this._b=i+this._b|0,this._c=s+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},hy.prototype._hash=function(){var e=fy.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var yy=hy,by=ii,vy=Qm,wy=Ep.Buffer,_y=[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],Ey=new Array(64);function Ay(){this.init(),this._w=Ey,vy.call(this,64,56)}function Sy(e,t,r){return r^e&(t^r)}function ky(e,t,r){return e&t|r&(e|t)}function xy(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function Ty(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function Ry(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function Oy(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}by(Ay,vy),Ay.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},Ay.prototype._update=function(e){for(var t=this._w,r=0|this._a,n=0|this._b,i=0|this._c,s=0|this._d,o=0|this._e,a=0|this._f,u=0|this._g,c=0|this._h,f=0;f<16;++f)t[f]=e.readInt32BE(4*f);for(;f<64;++f)t[f]=Oy(t[f-2])+t[f-7]+Ry(t[f-15])+t[f-16]|0;for(var l=0;l<64;++l){var d=c+Ty(o)+Sy(o,a,u)+_y[l]+t[l]|0,h=xy(r)+ky(r,n,i)|0;c=u,u=a,a=o,o=s+d|0,s=i,i=n,n=r,r=d+h|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0,this._f=a+this._f|0,this._g=u+this._g|0,this._h=c+this._h|0},Ay.prototype._hash=function(){var e=wy.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var Iy=Ay,My=ii,Py=Iy,Ny=Qm,Cy=Ep.Buffer,By=new Array(64);function Uy(){this.init(),this._w=By,Ny.call(this,64,56)}My(Uy,Py),Uy.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},Uy.prototype._hash=function(){var e=Cy.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var Ly=Uy,jy=ii,Dy=Qm,Fy=Ep.Buffer,qy=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],zy=new Array(160);function Ky(){this.init(),this._w=zy,Dy.call(this,128,112)}function Hy(e,t,r){return r^e&(t^r)}function Gy(e,t,r){return e&t|r&(e|t)}function Wy(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function Vy(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Xy(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Jy(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function $y(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Yy(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function Qy(e,t){return e>>>0<t>>>0?1:0}jy(Ky,Dy),Ky.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},Ky.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,s=0|this._dh,o=0|this._eh,a=0|this._fh,u=0|this._gh,c=0|this._hh,f=0|this._al,l=0|this._bl,d=0|this._cl,h=0|this._dl,p=0|this._el,g=0|this._fl,m=0|this._gl,y=0|this._hl,b=0;b<32;b+=2)t[b]=e.readInt32BE(4*b),t[b+1]=e.readInt32BE(4*b+4);for(;b<160;b+=2){var v=t[b-30],w=t[b-30+1],_=Xy(v,w),E=Jy(w,v),A=$y(v=t[b-4],w=t[b-4+1]),S=Yy(w,v),k=t[b-14],x=t[b-14+1],T=t[b-32],R=t[b-32+1],O=E+x|0,I=_+k+Qy(O,E)|0;I=(I=I+A+Qy(O=O+S|0,S)|0)+T+Qy(O=O+R|0,R)|0,t[b]=I,t[b+1]=O}for(var M=0;M<160;M+=2){I=t[M],O=t[M+1];var P=Gy(r,n,i),N=Gy(f,l,d),C=Wy(r,f),B=Wy(f,r),U=Vy(o,p),L=Vy(p,o),j=qy[M],D=qy[M+1],F=Hy(o,a,u),q=Hy(p,g,m),z=y+L|0,K=c+U+Qy(z,y)|0;K=(K=(K=K+F+Qy(z=z+q|0,q)|0)+j+Qy(z=z+D|0,D)|0)+I+Qy(z=z+O|0,O)|0;var H=B+N|0,G=C+P+Qy(H,B)|0;c=u,y=m,u=a,m=g,a=o,g=p,o=s+K+Qy(p=h+z|0,h)|0,s=i,h=d,i=n,d=l,n=r,l=f,r=K+G+Qy(f=z+H|0,z)|0}this._al=this._al+f|0,this._bl=this._bl+l|0,this._cl=this._cl+d|0,this._dl=this._dl+h|0,this._el=this._el+p|0,this._fl=this._fl+g|0,this._gl=this._gl+m|0,this._hl=this._hl+y|0,this._ah=this._ah+r+Qy(this._al,f)|0,this._bh=this._bh+n+Qy(this._bl,l)|0,this._ch=this._ch+i+Qy(this._cl,d)|0,this._dh=this._dh+s+Qy(this._dl,h)|0,this._eh=this._eh+o+Qy(this._el,p)|0,this._fh=this._fh+a+Qy(this._fl,g)|0,this._gh=this._gh+u+Qy(this._gl,m)|0,this._hh=this._hh+c+Qy(this._hl,y)|0},Ky.prototype._hash=function(){var e=Fy.allocUnsafe(64);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Zy=Ky,eb=ii,tb=Zy,rb=Qm,nb=Ep.Buffer,ib=new Array(160);function sb(){this.init(),this._w=ib,rb.call(this,128,112)}eb(sb,tb),sb.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},sb.prototype._hash=function(){var e=nb.allocUnsafe(48);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var ob=sb,ab=Jm.exports=function(e){e=e.toLowerCase();var t=ab[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};ab.sha=ay,ab.sha1=yy,ab.sha224=Ly,ab.sha256=Iy,ab.sha384=ob,ab.sha512=Zy;var ub=Jm.exports;function cb(){this.head=null,this.tail=null,this.length=0}cb.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},cb.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},cb.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}},cb.prototype.clear=function(){this.head=this.tail=null,this.length=0},cb.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},cb.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},db.ReadableState=lb;var fb=Ud("stream");function lb(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof Fb&&(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 cb,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 wg(e.encoding),this.encoding=e.encoding)}function db(e){if(!(this instanceof db))return new db(e);this._readableState=new lb(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),Fp.call(this)}function hb(e,t,r,n,i){var s=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(s)e.emit("error",s);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,mb(e)}(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!i){var o=new Error("stream.push() after EOF");e.emit("error",o)}else if(t.endEmitted&&i){var a=new Error("stream.unshift() after end event");e.emit("error",a)}else{var u;!t.decoder||i||n||(r=t.decoder.write(r),u=!t.objectMode&&0===r.length),i||(t.reading=!1),u||(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&&mb(e))),function(e,t){t.readingMore||(t.readingMore=!0,gd(bb,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(t)}Od(db,Fp),db.prototype.push=function(e,t){var r=this._readableState;return r.objectMode||"string"!=typeof e||(t=t||r.defaultEncoding)!==r.encoding&&(e=_.from(e,t),t=""),hb(this,r,e,t,!1)},db.prototype.unshift=function(e){return hb(this,this._readableState,e,"",!0)},db.prototype.isPaused=function(){return!1===this._readableState.flowing},db.prototype.setEncoding=function(e){return this._readableState.decoder=new wg(e),this._readableState.encoding=e,this};var pb=8388608;function gb(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=pb?e=pb:(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 mb(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(fb("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?gd(yb,e):yb(e))}function yb(e){fb("emit readable"),e.emit("readable"),_b(e)}function bb(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(fb("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function vb(e){fb("readable nexttick read 0"),e.read(0)}function wb(e,t){t.reading||(fb("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),_b(e),t.flowing&&!t.reading&&e.read(0)}function _b(e){var t=e._readableState;for(fb("flow",t.flowing);t.flowing&&null!==e.read(););}function Eb(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=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;e<t.head.data.length?(n=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):n=e===t.head.data.length?t.shift():r?function(e,t){var r=t.head,n=1,i=r.data;e-=i.length;for(;r=r.next;){var s=r.data,o=e>s.length?s.length:e;if(o===s.length?i+=s:i+=s.slice(0,e),0===(e-=o)){o===s.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=s.slice(o));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 s=n.data,o=e>s.length?s.length:e;if(s.copy(r,r.length-e,0,o),0===(e-=o)){o===s.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=s.slice(o));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function Ab(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,gd(Sb,t,e))}function Sb(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function kb(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}function xb(){}function Tb(e,t,r){this.chunk=e,this.encoding=t,this.callback=r,this.next=null}function Rb(e,t){Object.defineProperty(this,"buffer",{get:Nd((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")}),e=e||{},this.objectMode=!!e.objectMode,t instanceof Fb&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var r=e.highWaterMark,n=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:n,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=!1===e.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?gd(i,n):i(n);e._writableState.errorEmitted=!0,e.emit("error",n)}(e,r,n,t,i);else{var s=Nb(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||Pb(e,r),n?gd(Mb,e,r,s,i):Mb(e,r,s,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new Ub(this)}function Ob(e){if(!(this instanceof Ob||this instanceof Fb))return new Ob(e);this._writableState=new Rb(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev)),Fp.call(this)}function Ib(e,t,r,n,i,s,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}function Mb(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),Bb(e,t)}function Pb(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var o=0;r;)i[o]=r,r=r.next,o+=1;Ib(e,t,!0,t.length,i,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new Ub(t)}else{for(;r;){var a=r.chunk,u=r.encoding,c=r.callback;if(Ib(e,t,!1,t.objectMode?1:a.length,a,u,c),r=r.next,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequestCount=0,t.bufferedRequest=r,t.bufferProcessing=!1}function Nb(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function Cb(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}function Bb(e,t){var r=Nb(t);return r&&(0===t.pendingcb?(Cb(e,t),t.finished=!0,e.emit("finish")):Cb(e,t)),r}function Ub(e){var t=this;this.next=null,this.entry=null,this.finish=function(r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}}db.prototype.read=function(e){fb("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return fb("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Ab(this):mb(this),null;if(0===(e=gb(e,t))&&t.ended)return 0===t.length&&Ab(this),null;var n,i=t.needReadable;return fb("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&fb("length less than watermark",i=!0),t.ended||t.reading?fb("reading or ended",i=!1):i&&(fb("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=gb(r,t))),null===(n=e>0?Eb(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&Ab(this)),null!==n&&this.emit("data",n),n},db.prototype._read=function(e){this.emit("error",new Error("not implemented"))},db.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,fb("pipe count=%d opts=%j",n.pipesCount,t);var i=!t||!1!==t.end?o:c;function s(e){fb("onunpipe"),e===r&&c()}function o(){fb("onend"),e.end()}n.endEmitted?gd(i):r.once("end",i),e.on("unpipe",s);var a=function(e){return function(){var t=e._readableState;fb("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,_b(e))}}(r);e.on("drain",a);var u=!1;function c(){fb("cleanup"),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("drain",a),e.removeListener("error",d),e.removeListener("unpipe",s),r.removeListener("end",o),r.removeListener("end",c),r.removeListener("data",l),u=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||a()}var f=!1;function l(t){fb("ondata"),f=!1,!1!==e.write(t)||f||((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==kb(n.pipes,e))&&!u&&(fb("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,f=!0),r.pause())}function d(t){var r;fb("onerror",t),g(),e.removeListener("error",d),0===(r="error",e.listeners(r).length)&&e.emit("error",t)}function h(){e.removeListener("finish",p),g()}function p(){fb("onfinish"),e.removeListener("close",h),g()}function g(){fb("unpipe"),r.unpipe(e)}return r.on("data",l),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||(fb("pipe resume"),r.resume()),e},db.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<n;i++)r[i].emit("unpipe",this);return this}var s=kb(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this)),this},db.prototype.on=function(e,t){var r=Fp.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var n=this._readableState;n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&mb(this):gd(vb,this))}return r},db.prototype.addListener=db.prototype.on,db.prototype.resume=function(){var e=this._readableState;return e.flowing||(fb("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,gd(wb,e,t))}(this,e)),this},db.prototype.pause=function(){return fb("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(fb("pause"),this._readableState.flowing=!1,this.emit("pause")),this},db.prototype.wrap=function(e){var t=this._readableState,r=!1,n=this;for(var i in e.on("end",(function(){if(fb("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&n.push(e)}n.push(null)})),e.on("data",(function(i){(fb("wrapped data"),t.decoder&&(i=t.decoder.write(i)),t.objectMode&&null==i)||(t.objectMode||i&&i.length)&&(n.push(i)||(r=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));return function(e,t){for(var r=0,n=e.length;r<n;r++)t(e[r],r)}(["error","close","destroy","pause","resume"],(function(t){e.on(t,n.emit.bind(n,t))})),n._read=function(t){fb("wrapped _read",t),r&&(r=!1,e.resume())},n},db._fromList=Eb,Ob.WritableState=Rb,Od(Ob,Fp),Rb.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},Ob.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},Ob.prototype.write=function(e,t,r){var n=this._writableState,i=!1;return"function"==typeof t&&(r=t,t=null),_.isBuffer(e)?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=xb),n.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),gd(t,r)}(this,r):function(e,t,r,n){var i=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):_.isBuffer(r)||"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),gd(n,s),i=!1),i}(this,n,e,r)&&(n.pendingcb++,i=function(e,t,r,n,i){r=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=_.from(t,r));return t}(t,r,n),_.isBuffer(r)&&(n="buffer");var s=t.objectMode?1:r.length;t.length+=s;var o=t.length<t.highWaterMark;o||(t.needDrain=!0);if(t.writing||t.corked){var a=t.lastBufferedRequest;t.lastBufferedRequest=new Tb(r,n,i),a?a.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else Ib(e,t,!1,s,r,n,i);return o}(this,n,e,t,r)),i},Ob.prototype.cork=function(){this._writableState.corked++},Ob.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||Pb(this,e))},Ob.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Ob.prototype._write=function(e,t,r){r(new Error("not implemented"))},Ob.prototype._writev=null,Ob.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,Bb(e,t),r&&(t.finished?gd(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r)},Od(Fb,db);for(var Lb=Object.keys(Ob.prototype),jb=0;jb<Lb.length;jb++){var Db=Lb[jb];Fb.prototype[Db]||(Fb.prototype[Db]=Ob.prototype[Db])}function Fb(e){if(!(this instanceof Fb))return new Fb(e);db.call(this,e),Ob.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",qb)}function qb(){this.allowHalfOpen||this._writableState.ended||gd(zb,this)}function zb(e){e.end()}function Kb(e){this.afterTransform=function(t,r){return function(e,t,r){var n=e._transformState;n.transforming=!1;var i=n.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));n.writechunk=null,n.writecb=null,null!=r&&e.push(r);i(t);var s=e._readableState;s.reading=!1,(s.needReadable||s.length<s.highWaterMark)&&e._read(s.highWaterMark)}(e,t,r)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function Hb(e){if(!(this instanceof Hb))return new Hb(e);Fb.call(this,e),this._transformState=new Kb(this);var t=this;this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.once("prefinish",(function(){"function"==typeof this._flush?this._flush((function(e){Gb(t,e)})):Gb(t)}))}function Gb(e,t){if(t)return e.emit("error",t);var r=e._writableState,n=e._transformState;if(r.length)throw new Error("Calling transform done when ws.length != 0");if(n.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}function Wb(e){if(!(this instanceof Wb))return new Wb(e);Hb.call(this,e)}function Vb(){Fp.call(this)}Od(Hb,Fb),Hb.prototype.push=function(e,t){return this._transformState.needTransform=!1,Fb.prototype.push.call(this,e,t)},Hb.prototype._transform=function(e,t,r){throw new Error("Not implemented")},Hb.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Hb.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},Od(Wb,Hb),Wb.prototype._transform=function(e,t,r){r(null,e)},Od(Vb,Fp),Vb.Readable=db,Vb.Writable=Ob,Vb.Duplex=Fb,Vb.Transform=Hb,Vb.PassThrough=Wb,Vb.Stream=Vb,Vb.prototype.pipe=function(e,t){var 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",o),r.on("close",a));var s=!1;function o(){s||(s=!0,e.end())}function a(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){if(c(),0===Fp.listenerCount(this,"error"))throw e}function c(){r.removeListener("data",n),e.removeListener("drain",i),r.removeListener("end",o),r.removeListener("close",a),r.removeListener("error",u),e.removeListener("error",u),r.removeListener("end",c),r.removeListener("close",c),e.removeListener("close",c)}return r.on("error",u),e.on("error",u),r.on("end",c),r.on("close",c),e.on("close",c),e.emit("pipe",r),e};var Xb=i(Object.freeze({__proto__:null,Duplex:Fb,PassThrough:Wb,Readable:db,Stream:Vb,Transform:Hb,Writable:Ob,default:Vb})),Jb=Ep.Buffer,$b=Xb.Transform,Yb=Sg.StringDecoder;function Qb(e){$b.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}ii(Qb,$b),Qb.prototype.update=function(e,t,r){"string"==typeof e&&(e=Jb.from(e,t));var n=this._update(e);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},Qb.prototype.setAutoPadding=function(){},Qb.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},Qb.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},Qb.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},Qb.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){n=e}finally{r(n)}},Qb.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},Qb.prototype._finalOrDigest=function(e){var t=this.__final()||Jb.alloc(0);return e&&(t=this._toString(t,e,!0)),t},Qb.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new Yb(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n};var Zb=Qb,ev=Im,tv=Xm,rv=ub,nv=Zb;function iv(e){nv.call(this,"digest"),this._hash=e}ii(iv,nv),iv.prototype._update=function(e){this._hash.update(e)},iv.prototype._final=function(){return this._hash.digest()};var sv=function(e){return"md5"===(e=e.toLowerCase())?new ev:"rmd160"===e||"ripemd160"===e?new tv:new iv(rv(e))};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.rlphash=e.ripemd160FromArray=e.ripemd160FromString=e.ripemd160=e.sha256FromArray=e.sha256FromString=e.sha256=e.keccakFromArray=e.keccakFromHexString=e.keccakFromString=e.keccak256=e.keccak=void 0;var t=Up,r=sv,n=ql,i=Pp,s=Np;e.keccak=function(e,r){switch(void 0===r&&(r=256),(0,s.assertIsBuffer)(e),r){case 224:return(0,t.keccak224)(e);case 256:return(0,t.keccak256)(e);case 384:return(0,t.keccak384)(e);case 512:return(0,t.keccak512)(e);default:throw new Error("Invald algorithm: keccak".concat(r))}};e.keccak256=function(t){return(0,e.keccak)(t)};e.keccakFromString=function(t,r){void 0===r&&(r=256),(0,s.assertIsString)(t);var n=Buffer.from(t,"utf8");return(0,e.keccak)(n,r)};e.keccakFromHexString=function(t,r){return void 0===r&&(r=256),(0,s.assertIsHexString)(t),(0,e.keccak)((0,i.toBuffer)(t),r)};e.keccakFromArray=function(t,r){return void 0===r&&(r=256),(0,s.assertIsArray)(t),(0,e.keccak)((0,i.toBuffer)(t),r)};var o=function(e){return e=(0,i.toBuffer)(e),r("sha256").update(e).digest()};e.sha256=function(e){return(0,s.assertIsBuffer)(e),o(e)};e.sha256FromString=function(e){return(0,s.assertIsString)(e),o(e)};e.sha256FromArray=function(e){return(0,s.assertIsArray)(e),o(e)};var a=function(e,t){e=(0,i.toBuffer)(e);var n=r("rmd160").update(e).digest();return!0===t?(0,i.setLengthLeft)(n,32):n};e.ripemd160=function(e,t){return(0,s.assertIsBuffer)(e),a(e,t)};e.ripemd160FromString=function(e,t){return(0,s.assertIsString)(e),a(e,t)};e.ripemd160FromArray=function(e,t){return(0,s.assertIsArray)(e),a(e,t)};e.rlphash=function(t){return(0,e.keccak)(n.rlp.encode(t))}}(Bp);var ov={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.toType=e.TypeOutput=e.bnToRlp=e.bnToUnpaddedBuffer=e.bnToHex=void 0;var t,r=ql,n=Op,i=Pp;function s(e){return(0,i.unpadBuffer)(e.toArrayLike(Buffer))}e.bnToHex=function(e){return"0x".concat(e.toString(16))},e.bnToUnpaddedBuffer=s,e.bnToRlp=function(e){return s(e)},function(e){e[e.Number=0]="Number",e[e.BN=1]="BN",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(t=e.TypeOutput||(e.TypeOutput={})),e.toType=function(e,s){if(null===e)return null;if(void 0!==e){if("string"==typeof e&&!(0,n.isHexString)(e))throw new Error("A string must be provided with a 0x-prefix, given: ".concat(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)");var o=(0,i.toBuffer)(e);if(s===t.Buffer)return o;if(s===t.BN)return new r.BN(o);if(s===t.Number){var a=new r.BN(o),u=new r.BN(Number.MAX_SAFE_INTEGER.toString());if(a.gt(u))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return a.toNumber()}return"0x".concat(o.toString("hex"))}}}(ov),function(e){var t=r&&r.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o},n=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),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;var i=n(Vh),s=ql,o=Xh,a=Op,u=Fl,c=Pp,f=Bp,l=Np,d=ov,h=function(){function e(e,t,r,n){void 0===e&&(e=new s.BN(0)),void 0===t&&(t=new s.BN(0)),void 0===r&&(r=u.KECCAK256_RLP),void 0===n&&(n=u.KECCAK256_NULL),this.nonce=e,this.balance=t,this.stateRoot=r,this.codeHash=n,this._validate()}return e.fromAccountData=function(t){var r=t.nonce,n=t.balance,i=t.stateRoot,o=t.codeHash;return new e(r?new s.BN((0,c.toBuffer)(r)):void 0,n?new s.BN((0,c.toBuffer)(n)):void 0,i?(0,c.toBuffer)(i):void 0,o?(0,c.toBuffer)(o):void 0)},e.fromRlpSerializedAccount=function(e){var t=s.rlp.decode(e);if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)},e.fromValuesArray=function(r){var n=t(r,4),i=n[0],o=n[1],a=n[2],u=n[3];return new e(new s.BN(i),new s.BN(o),a,u)},e.prototype._validate=function(){if(this.nonce.lt(new s.BN(0)))throw new Error("nonce must be greater than zero");if(this.balance.lt(new s.BN(0)))throw new Error("balance must be greater than zero");if(32!==this.stateRoot.length)throw new Error("stateRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")},e.prototype.raw=function(){return[(0,d.bnToUnpaddedBuffer)(this.nonce),(0,d.bnToUnpaddedBuffer)(this.balance),this.stateRoot,this.codeHash]},e.prototype.serialize=function(){return s.rlp.encode(this.raw())},e.prototype.isContract=function(){return!this.codeHash.equals(u.KECCAK256_NULL)},e.prototype.isEmpty=function(){return this.balance.isZero()&&this.nonce.isZero()&&this.codeHash.equals(u.KECCAK256_NULL)},e}();e.Account=h;e.isValidAddress=function(e){try{(0,l.assertIsString)(e)}catch(e){return!1}return/^0x[0-9a-fA-F]{40}$/.test(e)};e.toChecksumAddress=function(e,t){(0,l.assertIsHexString)(e);var r=(0,a.stripHexPrefix)(e).toLowerCase(),n="";t&&(n=(0,d.toType)(t,d.TypeOutput.BN).toString()+"0x");for(var i=(0,f.keccakFromString)(n+r).toString("hex"),s="0x",o=0;o<r.length;o++)parseInt(i[o],16)>=8?s+=r[o].toUpperCase():s+=r[o];return s};e.isValidChecksumAddress=function(t,r){return(0,e.isValidAddress)(t)&&(0,e.toChecksumAddress)(t,r)===t};e.generateAddress=function(e,t){(0,l.assertIsBuffer)(e),(0,l.assertIsBuffer)(t);var r=new s.BN(t);return r.isZero()?(0,f.rlphash)([e,null]).slice(-20):(0,f.rlphash)([e,Buffer.from(r.toArray())]).slice(-20)};e.generateAddress2=function(e,t,r){return(0,l.assertIsBuffer)(e),(0,l.assertIsBuffer)(t),(0,l.assertIsBuffer)(r),(0,i.default)(20===e.length),(0,i.default)(32===t.length),(0,f.keccak256)(Buffer.concat([Buffer.from("ff","hex"),e,t,(0,f.keccak256)(r)])).slice(-20)};e.isValidPrivate=function(e){return(0,o.privateKeyVerify)(e)};e.isValidPublic=function(e,t){return void 0===t&&(t=!1),(0,l.assertIsBuffer)(e),64===e.length?(0,o.publicKeyVerify)(Buffer.concat([Buffer.from([4]),e])):!!t&&(0,o.publicKeyVerify)(e)};e.pubToAddress=function(e,t){return void 0===t&&(t=!1),(0,l.assertIsBuffer)(e),t&&64!==e.length&&(e=Buffer.from((0,o.publicKeyConvert)(e,!1).slice(1))),(0,i.default)(64===e.length),(0,f.keccak)(e).slice(-20)},e.publicToAddress=e.pubToAddress;e.privateToPublic=function(e){return(0,l.assertIsBuffer)(e),Buffer.from((0,o.publicKeyCreate)(e,!1)).slice(1)};e.privateToAddress=function(t){return(0,e.publicToAddress)((0,e.privateToPublic)(t))};e.importPublic=function(e){return(0,l.assertIsBuffer)(e),64!==e.length&&(e=Buffer.from((0,o.publicKeyConvert)(e,!1).slice(1))),e};e.zeroAddress=function(){var e=(0,c.zeros)(20);return(0,c.bufferToHex)(e)};e.isZeroAddress=function(t){try{(0,l.assertIsString)(t)}catch(e){return!1}return(0,e.zeroAddress)()===t}}(nd);var av={},uv=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(av,"__esModule",{value:!0}),av.Address=void 0;var cv=uv(Vh),fv=ql,lv=Pp,dv=nd,hv=function(){function e(e){(0,cv.default)(20===e.length,"Invalid address length"),this.buf=e}return e.zero=function(){return new e((0,lv.zeros)(20))},e.fromString=function(t){return(0,cv.default)((0,dv.isValidAddress)(t),"Invalid address"),new e((0,lv.toBuffer)(t))},e.fromPublicKey=function(t){return(0,cv.default)(Buffer.isBuffer(t),"Public key should be Buffer"),new e((0,dv.pubToAddress)(t))},e.fromPrivateKey=function(t){return(0,cv.default)(Buffer.isBuffer(t),"Private key should be Buffer"),new e((0,dv.privateToAddress)(t))},e.generate=function(t,r){return(0,cv.default)(fv.BN.isBN(r)),new e((0,dv.generateAddress)(t.buf,r.toArrayLike(Buffer)))},e.generate2=function(t,r,n){return(0,cv.default)(Buffer.isBuffer(r)),(0,cv.default)(Buffer.isBuffer(n)),new e((0,dv.generateAddress2)(t.buf,r,n))},e.prototype.equals=function(e){return this.buf.equals(e.buf)},e.prototype.isZero=function(){return this.equals(e.zero())},e.prototype.isPrecompileOrSystemAddress=function(){var e=new fv.BN(this.buf),t=new fv.BN(0),r=new fv.BN("ffff","hex");return e.gte(t)&&e.lte(r)},e.prototype.toString=function(){return"0x"+this.buf.toString("hex")},e.prototype.toBuffer=function(){return Buffer.from(this.buf)},e}();av.Address=hv;var pv={};Object.defineProperty(pv,"__esModule",{value:!0}),pv.hashPersonalMessage=pv.isValidSignature=pv.fromRpcSig=pv.toCompactSig=pv.toRpcSig=pv.ecrecover=pv.ecsign=void 0;var gv=Xh,mv=ql,yv=Pp,bv=Bp,vv=Np,wv=ov;function _v(e,t){var r=(0,wv.toType)(e,wv.TypeOutput.BN);if(r.eqn(0)||r.eqn(1))return(0,wv.toType)(e,wv.TypeOutput.BN);if(!t)return r.subn(27);var n=(0,wv.toType)(t,wv.TypeOutput.BN);return r.sub(n.muln(2).addn(35))}function Ev(e){var t=new mv.BN(e);return t.eqn(0)||t.eqn(1)}pv.ecsign=function(e,t,r){var n=(0,gv.ecdsaSign)(e,t),i=n.signature,s=n.recid,o=Buffer.from(i.slice(0,32)),a=Buffer.from(i.slice(32,64));if(!r||"number"==typeof r){if(r&&!Number.isSafeInteger(r))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");return{r:o,s:a,v:r?s+(2*r+35):s+27}}return{r:o,s:a,v:(0,wv.toType)(r,wv.TypeOutput.BN).muln(2).addn(35).addn(s).toArrayLike(Buffer)}};pv.ecrecover=function(e,t,r,n,i){var s=Buffer.concat([(0,yv.setLengthLeft)(r,32),(0,yv.setLengthLeft)(n,32)],64),o=_v(t,i);if(!Ev(o))throw new Error("Invalid signature v value");var a=(0,gv.ecdsaRecover)(s,o.toNumber(),e);return Buffer.from((0,gv.publicKeyConvert)(a,!1).slice(1))};pv.toRpcSig=function(e,t,r,n){if(!Ev(_v(e,n)))throw new Error("Invalid signature v value");return(0,yv.bufferToHex)(Buffer.concat([(0,yv.setLengthLeft)(t,32),(0,yv.setLengthLeft)(r,32),(0,yv.toBuffer)(e)]))};pv.toCompactSig=function(e,t,r,n){if(!Ev(_v(e,n)))throw new Error("Invalid signature v value");var i=(0,wv.toType)(e,wv.TypeOutput.Number),s=r;return(i>28&&i%2==1||1===i||28===i)&&((s=Buffer.from(r))[0]|=128),(0,yv.bufferToHex)(Buffer.concat([(0,yv.setLengthLeft)(t,32),(0,yv.setLengthLeft)(s,32)]))};pv.fromRpcSig=function(e){var t,r,n,i=(0,yv.toBuffer)(e);if(i.length>=65)t=i.slice(0,32),r=i.slice(32,64),n=(0,yv.bufferToInt)(i.slice(64));else{if(64!==i.length)throw new Error("Invalid signature length");t=i.slice(0,32),r=i.slice(32,64),n=(0,yv.bufferToInt)(i.slice(32,33))>>7,r[0]&=127}return n<27&&(n+=27),{v:n,r:t,s:r}};pv.isValidSignature=function(e,t,r,n,i){void 0===n&&(n=!0);var s=new mv.BN("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),o=new mv.BN("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==t.length||32!==r.length)return!1;if(!Ev(_v(e,i)))return!1;var a=new mv.BN(t),u=new mv.BN(r);return!(a.isZero()||a.gt(o)||u.isZero()||u.gt(o))&&(!n||1!==u.cmp(s))};pv.hashPersonalMessage=function(e){(0,vv.assertIsBuffer)(e);var t=Buffer.from("Ethereum Signed Message:\n".concat(e.length),"utf-8");return(0,bv.keccak)(Buffer.concat([t,e]))};var Av={},Sv=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Av,"__esModule",{value:!0}),Av.defineProperties=void 0;var kv=Sv(Vh),xv=Op,Tv=ql,Rv=Pp;Av.defineProperties=function(e,t,r){if(e.raw=[],e._fields=[],e.toJSON=function(t){if(void 0===t&&(t=!1),t){var r={};return e._fields.forEach((function(t){r[t]="0x".concat(e[t].toString("hex"))})),r}return(0,Rv.baToJSON)(e.raw)},e.serialize=function(){return Tv.rlp.encode(e.raw)},t.forEach((function(t,r){function n(){return e.raw[r]}function i(n){"00"!==(n=(0,Rv.toBuffer)(n)).toString("hex")||t.allowZero||(n=Buffer.allocUnsafe(0)),t.allowLess&&t.length?(n=(0,Rv.unpadBuffer)(n),(0,kv.default)(t.length>=n.length,"The field ".concat(t.name," must not have more ").concat(t.length," bytes"))):t.allowZero&&0===n.length||!t.length||(0,kv.default)(t.length===n.length,"The field ".concat(t.name," must have byte length of ").concat(t.length)),e.raw[r]=n}e._fields.push(t.name),Object.defineProperty(e,t.name,{enumerable:!0,configurable:!0,get:n,set:i}),t.default&&(e[t.name]=t.default),t.alias&&Object.defineProperty(e,t.alias,{enumerable:!1,configurable:!0,set:i,get:n})})),r)if("string"==typeof r&&(r=Buffer.from((0,xv.stripHexPrefix)(r),"hex")),Buffer.isBuffer(r)&&(r=Tv.rlp.decode(r)),Array.isArray(r)){if(r.length>e._fields.length)throw new Error("wrong number of fields in data");r.forEach((function(t,r){e[e._fields[r]]=(0,Rv.toBuffer)(t)}))}else{if("object"!=typeof r)throw new Error("invalid data");var n=Object.keys(r);t.forEach((function(t){-1!==n.indexOf(t.name)&&(e[t.name]=r[t.name]),-1!==n.indexOf(t.alias)&&(e[t.alias]=r[t.alias])}))}},function(e){var t=r&&r.__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]}),n=r&&r.__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.isHexString=e.getKeys=e.fromAscii=e.fromUtf8=e.toAscii=e.arrayContainsArray=e.getBinarySize=e.padToEven=e.stripHexPrefix=e.isHexPrefixed=void 0,n(Fl,e),n(nd,e),n(av,e),n(Bp,e),n(pv,e),n(Pp,e),n(Av,e),n(ql,e),n(ov,e);var i=Op;Object.defineProperty(e,"isHexPrefixed",{enumerable:!0,get:function(){return i.isHexPrefixed}}),Object.defineProperty(e,"stripHexPrefix",{enumerable:!0,get:function(){return i.stripHexPrefix}}),Object.defineProperty(e,"padToEven",{enumerable:!0,get:function(){return i.padToEven}}),Object.defineProperty(e,"getBinarySize",{enumerable:!0,get:function(){return i.getBinarySize}}),Object.defineProperty(e,"arrayContainsArray",{enumerable:!0,get:function(){return i.arrayContainsArray}}),Object.defineProperty(e,"toAscii",{enumerable:!0,get:function(){return i.toAscii}}),Object.defineProperty(e,"fromUtf8",{enumerable:!0,get:function(){return i.fromUtf8}}),Object.defineProperty(e,"fromAscii",{enumerable:!0,get:function(){return i.fromAscii}}),Object.defineProperty(e,"getKeys",{enumerable:!0,get:function(){return i.getKeys}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return i.isHexString}})}(Dl);var Ov={},Iv={},Mv=Ep.Buffer;var Pv=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var i=e.charAt(n),s=i.charCodeAt(0);if(255!==t[s])throw new TypeError(i+" is ambiguous");t[s]=n}var o=e.length,a=e.charAt(0),u=Math.log(o)/Math.log(256),c=Math.log(256)/Math.log(o);function f(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return Mv.alloc(0);for(var r=0,n=0,i=0;e[r]===a;)n++,r++;for(var s=(e.length-r)*u+1>>>0,c=new Uint8Array(s);e[r];){var f=t[e.charCodeAt(r)];if(255===f)return;for(var l=0,d=s-1;(0!==f||l<i)&&-1!==d;d--,l++)f+=o*c[d]>>>0,c[d]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");i=l,r++}for(var h=s-i;h!==s&&0===c[h];)h++;var p=Mv.allocUnsafe(n+(s-h));p.fill(0,0,n);for(var g=n;h!==s;)p[g++]=c[h++];return p}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=Mv.from(t)),!Mv.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,n=0,i=0,s=t.length;i!==s&&0===t[i];)i++,r++;for(var u=(s-i)*c+1>>>0,f=new Uint8Array(u);i!==s;){for(var l=t[i],d=0,h=u-1;(0!==l||d<n)&&-1!==h;h--,d++)l+=256*f[h]>>>0,f[h]=l%o>>>0,l=l/o>>>0;if(0!==l)throw new Error("Non-zero carry");n=d,i++}for(var p=u-n;p!==u&&0===f[p];)p++;for(var g=a.repeat(r);p<u;++p)g+=e.charAt(f[p]);return g},decodeUnsafe:f,decode:function(e){var t=f(e);if(t)return t;throw new Error("Non-base"+o+" character")}}},Nv=Pv("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),Cv=Ep.Buffer,Bv=sv;var Uv=function(e){function t(t){var r=t.slice(0,-4),n=t.slice(-4),i=e(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(t){var r=e(t);return Nv.encode(Cv.concat([t,r],t.length+4))},decode:function(e){var r=t(Nv.decode(e));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(e){var r=Nv.decodeUnsafe(e);if(r)return t(r)}}}((function(e){var t=Bv("sha256").update(e).digest();return Bv("sha256").update(t).digest()})),Lv={},jv={};Object.defineProperty(jv,"__esModule",{value:!0});var Dv=Ns.ripemd160,Fv=Lp;jv.ripemd160=Fv.createHashFunction((function(){return new Dv}));var qv={};Object.defineProperty(qv,"__esModule",{value:!0});var zv=Xi,Kv=Lp;qv.sha256=Kv.createHashFunction((function(){return new zv}));var Hv=ii,Gv=Ep.Buffer,Wv=Zb,Vv=Gv.alloc(128),Xv=64;function Jv(e,t){Wv.call(this,"digest"),"string"==typeof t&&(t=Gv.from(t)),this._alg=e,this._key=t,t.length>Xv?t=e(t):t.length<Xv&&(t=Gv.concat([t,Vv],Xv));for(var r=this._ipad=Gv.allocUnsafe(Xv),n=this._opad=Gv.allocUnsafe(Xv),i=0;i<Xv;i++)r[i]=54^t[i],n[i]=92^t[i];this._hash=[r]}Hv(Jv,Wv),Jv.prototype._update=function(e){this._hash.push(e)},Jv.prototype._final=function(){var e=this._alg(Gv.concat(this._hash));return this._alg(Gv.concat([this._opad,e]))};var $v=Im,Yv=ii,Qv=Jv,Zv=Zb,ew=Ep.Buffer,tw=function(e){return(new $v).update(e).digest()},rw=Xm,nw=ub,iw=ew.alloc(128);function sw(e,t){Zv.call(this,"digest"),"string"==typeof t&&(t=ew.from(t));var r="sha512"===e||"sha384"===e?128:64;(this._alg=e,this._key=t,t.length>r)?t=("rmd160"===e?new rw:nw(e)).update(t).digest():t.length<r&&(t=ew.concat([t,iw],r));for(var n=this._ipad=ew.allocUnsafe(r),i=this._opad=ew.allocUnsafe(r),s=0;s<r;s++)n[s]=54^t[s],i[s]=92^t[s];this._hash="rmd160"===e?new rw:nw(e),this._hash.update(n)}Yv(sw,Zv),sw.prototype._update=function(e){this._hash.update(e)},sw.prototype._final=function(){var e=this._hash.digest();return("rmd160"===this._alg?new rw:nw(this._alg)).update(this._opad).update(e).digest()};Object.defineProperty(Lv,"__esModule",{value:!0});var ow=jv,aw=qv;Lv.createHmac=function(e,t){return"rmd160"===(e=e.toLowerCase())||"ripemd160"===e?new sw("rmd160",t):"md5"===e?new Qv(tw,t):new sw(e,t)},Lv.randomBytes=Tp;var uw=function(){function e(e){this.hashFunction=e,this.buffers=[]}return e.prototype.update=function(e){if(!Buffer.isBuffer(e))throw new Error("hdkey-crypto shim is outdated");return this.buffers.push(e),this},e.prototype.digest=function(e){if(e)throw new Error("hdkey-crypto shim is outdated");return this.hashFunction(Buffer.concat(this.buffers))},e}();Lv.createHash=function(e){if("ripemd160"===e)return new uw(ow.ripemd160);if("sha256"===e)return new uw(aw.sha256);throw new Error("hdkey-crypto shim is outdated")};var cw={},fw={},lw=r&&r.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(fw,"__esModule",{value:!0});var dw=lw(bp);function hw(e){return e&&"object"==typeof e&&"default"in e?e.default:e}fw.privateKeyVerify=function(e){return dw.privateKeyVerify(e)},fw.publicKeyCreate=function(e,t){return void 0===t&&(t=!0),Buffer.from(dw.publicKeyCreate(e,t))},fw.publicKeyVerify=function(e){return dw.publicKeyVerify(e)},fw.publicKeyConvert=function(e,t){return void 0===t&&(t=!0),Buffer.from(dw.publicKeyConvert(e,t))},fw.privateKeyTweakAdd=function(e,t){return Buffer.from(dw.privateKeyTweakAdd(Buffer.from(e),t))},fw.publicKeyTweakAdd=function(e,t,r){return void 0===r&&(r=!0),Buffer.from(dw.publicKeyTweakAdd(Buffer.from(e),t,r))},fw.sign=function(e,t){var r=dw.ecdsaSign(e,t);return{signature:Buffer.from(r.signature),recovery:r.recid}},fw.verify=function(e,t,r){return dw.ecdsaVerify(t,e,r)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}(fw)}(cw);var pw=hw(Vh),gw=hw(Ep),mw=hw(Uv),yw=Lv,bw=cw,vw=gw.Buffer,ww=vw.from("Bitcoin seed","utf8"),_w=2147483648,Ew={private:76066276,public:76067358};function Aw(e){this.versions=e||Ew,this.depth=0,this.index=0,this._privateKey=null,this._publicKey=null,this.chainCode=null,this._fingerprint=0,this.parentFingerprint=0}function Sw(e,t,r){var n=vw.allocUnsafe(78);n.writeUInt32BE(t,0),n.writeUInt8(e.depth,4);var i=e.depth?e.parentFingerprint:0;return n.writeUInt32BE(i,5),n.writeUInt32BE(e.index,9),e.chainCode.copy(n,13),r.copy(n,45),n}function kw(e){var t=yw.createHash("sha256").update(e).digest();return yw.createHash("ripemd160").update(t).digest()}Object.defineProperty(Aw.prototype,"fingerprint",{get:function(){return this._fingerprint}}),Object.defineProperty(Aw.prototype,"identifier",{get:function(){return this._identifier}}),Object.defineProperty(Aw.prototype,"pubKeyHash",{get:function(){return this.identifier}}),Object.defineProperty(Aw.prototype,"privateKey",{get:function(){return this._privateKey},set:function(e){pw.equal(e.length,32,"Private key must be 32 bytes."),pw(!0===bw.privateKeyVerify(e),"Invalid private key"),this._privateKey=e,this._publicKey=bw.publicKeyCreate(e,!0),this._identifier=kw(this.publicKey),this._fingerprint=this._identifier.slice(0,4).readUInt32BE(0)}}),Object.defineProperty(Aw.prototype,"publicKey",{get:function(){return this._publicKey},set:function(e){pw(33===e.length||65===e.length,"Public key must be 33 or 65 bytes."),pw(!0===bw.publicKeyVerify(e),"Invalid public key"),this._publicKey=bw.publicKeyConvert(e,!0),this._identifier=kw(this.publicKey),this._fingerprint=this._identifier.slice(0,4).readUInt32BE(0),this._privateKey=null}}),Object.defineProperty(Aw.prototype,"privateExtendedKey",{get:function(){return this._privateKey?mw.encode(Sw(this,this.versions.private,vw.concat([vw.alloc(1,0),this.privateKey]))):null}}),Object.defineProperty(Aw.prototype,"publicExtendedKey",{get:function(){return mw.encode(Sw(this,this.versions.public,this.publicKey))}}),Aw.prototype.derive=function(e){if("m"===e||"M"===e||"m'"===e||"M'"===e)return this;var t=e.split("/"),r=this;return t.forEach((function(e,t){if(0!==t){var n=e.length>1&&"'"===e[e.length-1],i=parseInt(e,10);pw(i<_w,"Invalid index"),n&&(i+=_w),r=r.deriveChild(i)}else pw(/^[mM]{1}/.test(e),'Path must start with "m" or "M"')})),r},Aw.prototype.deriveChild=function(e){var t,r=e>=_w,n=vw.allocUnsafe(4);if(n.writeUInt32BE(e,0),r){pw(this.privateKey,"Could not derive hardened child key");var i=this.privateKey,s=vw.alloc(1,0);i=vw.concat([s,i]),t=vw.concat([i,n])}else t=vw.concat([this.publicKey,n]);var o=yw.createHmac("sha512",this.chainCode).update(t).digest(),a=o.slice(0,32),u=o.slice(32),c=new Aw(this.versions);if(this.privateKey)try{c.privateKey=bw.privateKeyTweakAdd(this.privateKey,a)}catch(t){return this.deriveChild(e+1)}else try{c.publicKey=bw.publicKeyTweakAdd(this.publicKey,a,!0)}catch(t){return this.deriveChild(e+1)}return c.chainCode=u,c.depth=this.depth+1,c.parentFingerprint=this.fingerprint,c.index=e,c},Aw.prototype.sign=function(e){return bw.sign(e,this.privateKey).signature},Aw.prototype.verify=function(e,t){return bw.verify(e,t,this.publicKey)},Aw.prototype.wipePrivateData=function(){return this._privateKey&&yw.randomBytes(this._privateKey.length).copy(this._privateKey),this._privateKey=null,this},Aw.prototype.toJSON=function(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}},Aw.fromMasterSeed=function(e,t){var r=yw.createHmac("sha512",ww).update(e).digest(),n=r.slice(0,32),i=r.slice(32),s=new Aw(t);return s.chainCode=i,s.privateKey=n,s},Aw.fromExtendedKey=function(e,t){var r=new Aw(t=t||Ew),n=mw.decode(e),i=n.readUInt32BE(0);pw(i===t.private||i===t.public,"Version mismatch: does not match private or public"),r.depth=n.readUInt8(4),r.parentFingerprint=n.readUInt32BE(5),r.index=n.readUInt32BE(9),r.chainCode=n.slice(13,45);var s=n.slice(45);return 0===s.readUInt8(0)?(pw(i===t.private,"Version mismatch: version does not match private"),r.privateKey=s.slice(1)):(pw(i===t.public,"Version mismatch: version does not match public"),r.publicKey=s),r},Aw.fromJSON=function(e){return Aw.fromExtendedKey(e.xpriv)},Aw.HARDENED_OFFSET=_w;var xw=Aw;Object.defineProperty(Iv,"__esModule",{value:!0});var Tw,Rw=xw;Iv.HDKey=Rw;var Ow={},Iw={};
12
+ /*! https://mths.be/utf8js v3.0.0 by @mathias */
13
+ !function(e){!function(e){var t,r,n,i=String.fromCharCode;function s(e){for(var t,r,n=[],i=0,s=e.length;i<s;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<s?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}function o(e){if(e>=55296&&e<=57343)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value")}function a(e,t){return i(e>>t&63|128)}function u(e){if(0==(4294967168&e))return i(e);var t="";return 0==(4294965248&e)?t=i(e>>6&31|192):0==(4294901760&e)?(o(e),t=i(e>>12&15|224),t+=a(e,6)):0==(4292870144&e)&&(t=i(e>>18&7|240),t+=a(e,12),t+=a(e,6)),t+=i(63&e|128)}function c(){if(n>=r)throw Error("Invalid byte index");var e=255&t[n];if(n++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function f(){var e,i;if(n>r)throw Error("Invalid byte index");if(n==r)return!1;if(e=255&t[n],n++,0==(128&e))return e;if(192==(224&e)){if((i=(31&e)<<6|c())>=128)return i;throw Error("Invalid continuation byte")}if(224==(240&e)){if((i=(15&e)<<12|c()<<6|c())>=2048)return o(i),i;throw Error("Invalid continuation byte")}if(240==(248&e)&&(i=(7&e)<<18|c()<<12|c()<<6|c())>=65536&&i<=1114111)return i;throw Error("Invalid UTF-8 detected")}e.version="3.0.0",e.encode=function(e){for(var t=s(e),r=t.length,n=-1,i="";++n<r;)i+=u(t[n]);return i},e.decode=function(e){t=s(e),r=t.length,n=0;for(var o,a=[];!1!==(o=f());)a.push(o);return function(e){for(var t,r=e.length,n=-1,s="";++n<r;)(t=e[n])>65535&&(s+=i((t-=65536)>>>10&1023|55296),t=56320|1023&t),s+=i(t);return s}(a)}}(e)}(Iw);var Mw={exports:{}};
14
+ /*! MIT License. Copyright 2015-2018 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */!function(e,t){!function(t){function r(e){return parseInt(e)===e}function n(e){if(!r(e.length))return!1;for(var t=0;t<e.length;t++)if(!r(e[t])||e[t]<0||e[t]>255)return!1;return!0}function i(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!n(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(r(e.length)&&n(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function s(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,u={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r<e.length;){var n=e.charCodeAt(r++);37===n?(t.push(parseInt(e.substr(r,2),16)),r+=2):t.push(n)}return i(t)},fromBytes:function(e){for(var t=[],r=0;r<e.length;){var n=e[r];n<128?(t.push(String.fromCharCode(n)),r++):n>191&&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<e.length;r+=2)t.push(parseInt(e.substr(r,2),16));return t},fromBytes:function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];t.push(a[(240&n)>>4]+a[15&n])}return t.join("")}}),f={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],d=[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],h=[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],p=[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],g=[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],y=[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],b=[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],v=[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],w=[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],_=[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],S=[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],k=[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 x(e){for(var t=[],r=0;r<e.length;r+=4)t.push(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]);return t}var T=function(e){if(!(this instanceof T))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:i(e,!0)}),this._prepare()};T.prototype._prepare=function(){var e=f[this.key.length];if(null==e)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var t=0;t<=e;t++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var r,n=4*(e+1),i=this.key.length/4,s=x(this.key);for(t=0;t<i;t++)r=t>>2,this._Ke[r][t%4]=s[t],this._Kd[e-r][t%4]=s[t];for(var o,a=0,u=i;u<n;){if(o=s[i-1],s[0]^=d[o>>16&255]<<24^d[o>>8&255]<<16^d[255&o]<<8^d[o>>24&255]^l[a]<<24,a+=1,8!=i)for(t=1;t<i;t++)s[t]^=s[t-1];else{for(t=1;t<i/2;t++)s[t]^=s[t-1];o=s[i/2-1],s[i/2]^=d[255&o]^d[o>>8&255]<<8^d[o>>16&255]<<16^d[o>>24&255]<<24;for(t=i/2+1;t<i;t++)s[t]^=s[t-1]}for(t=0;t<i&&u<n;)c=u>>2,h=u%4,this._Ke[c][h]=s[t],this._Kd[e-c][h]=s[t++],u++}for(var c=1;c<e;c++)for(var h=0;h<4;h++)o=this._Kd[c][h],this._Kd[c][h]=E[o>>24&255]^A[o>>16&255]^S[o>>8&255]^k[255&o]},T.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=x(e),i=0;i<4;i++)n[i]^=this._Ke[0][i];for(var o=1;o<t;o++){for(i=0;i<4;i++)r[i]=p[n[i]>>24&255]^g[n[(i+1)%4]>>16&255]^m[n[(i+2)%4]>>8&255]^y[255&n[(i+3)%4]]^this._Ke[o][i];n=r.slice()}var a,u=s(16);for(i=0;i<4;i++)a=this._Ke[t][i],u[4*i]=255&(d[n[i]>>24&255]^a>>24),u[4*i+1]=255&(d[n[(i+1)%4]>>16&255]^a>>16),u[4*i+2]=255&(d[n[(i+2)%4]>>8&255]^a>>8),u[4*i+3]=255&(d[255&n[(i+3)%4]]^a);return u},T.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=x(e),i=0;i<4;i++)n[i]^=this._Kd[0][i];for(var o=1;o<t;o++){for(i=0;i<4;i++)r[i]=b[n[i]>>24&255]^v[n[(i+3)%4]>>16&255]^w[n[(i+2)%4]>>8&255]^_[255&n[(i+1)%4]]^this._Kd[o][i];n=r.slice()}var a,u=s(16);for(i=0;i<4;i++)a=this._Kd[t][i],u[4*i]=255&(h[n[i]>>24&255]^a>>24),u[4*i+1]=255&(h[n[(i+3)%4]>>16&255]^a>>16),u[4*i+2]=255&(h[n[(i+2)%4]>>8&255]^a>>8),u[4*i+3]=255&(h[255&n[(i+1)%4]]^a);return u};var R=function(e){if(!(this instanceof R))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new T(e)};R.prototype.encrypt=function(e){if((e=i(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=s(e.length),r=s(16),n=0;n<e.length;n+=16)o(e,r,0,n,n+16),o(r=this._aes.encrypt(r),t,n);return t},R.prototype.decrypt=function(e){if((e=i(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=s(e.length),r=s(16),n=0;n<e.length;n+=16)o(e,r,0,n,n+16),o(r=this._aes.decrypt(r),t,n);return t};var O=function(e,t){if(!(this instanceof O))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=s(16);this._lastCipherblock=i(t,!0),this._aes=new T(e)};O.prototype.encrypt=function(e){if((e=i(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=s(e.length),r=s(16),n=0;n<e.length;n+=16){o(e,r,0,n,n+16);for(var a=0;a<16;a++)r[a]^=this._lastCipherblock[a];this._lastCipherblock=this._aes.encrypt(r),o(this._lastCipherblock,t,n)}return t},O.prototype.decrypt=function(e){if((e=i(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=s(e.length),r=s(16),n=0;n<e.length;n+=16){o(e,r,0,n,n+16),r=this._aes.decrypt(r);for(var a=0;a<16;a++)t[n+a]=r[a]^this._lastCipherblock[a];o(e,this._lastCipherblock,0,n,n+16)}return t};var I=function(e,t,r){if(!(this instanceof I))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 size)")}else t=s(16);r||(r=1),this.segmentSize=r,this._shiftRegister=i(t,!0),this._aes=new T(e)};I.prototype.encrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var t,r=i(e,!0),n=0;n<r.length;n+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var s=0;s<this.segmentSize;s++)r[n+s]^=t[s];o(this._shiftRegister,this._shiftRegister,0,this.segmentSize),o(r,this._shiftRegister,16-this.segmentSize,n,n+this.segmentSize)}return r},I.prototype.decrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var t,r=i(e,!0),n=0;n<r.length;n+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var s=0;s<this.segmentSize;s++)r[n+s]^=t[s];o(this._shiftRegister,this._shiftRegister,0,this.segmentSize),o(e,this._shiftRegister,16-this.segmentSize,n,n+this.segmentSize)}return r};var M=function(e,t){if(!(this instanceof M))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=s(16);this._lastPrecipher=i(t,!0),this._lastPrecipherIndex=16,this._aes=new T(e)};M.prototype.encrypt=function(e){for(var t=i(e,!0),r=0;r<t.length;r++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),t[r]^=this._lastPrecipher[this._lastPrecipherIndex++];return t},M.prototype.decrypt=M.prototype.encrypt;var P=function(e){if(!(this instanceof P))throw Error("Counter must be instanitated with `new`");0===e||e||(e=1),"number"==typeof e?(this._counter=s(16),this.setValue(e)):this.setBytes(e)};P.prototype.setValue=function(e){if("number"!=typeof e||parseInt(e)!=e)throw new Error("invalid counter value (must be an integer)");if(e>Number.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},P.prototype.setBytes=function(e){if(16!=(e=i(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},P.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var N=function(e,t){if(!(this instanceof N))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof P||(t=new P(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new T(e)};N.prototype.encrypt=function(e){for(var t=i(e,!0),r=0;r<t.length;r++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),t[r]^=this._remainingCounter[this._remainingCounterIndex++];return t},N.prototype.decrypt=N.prototype.encrypt;var C={AES:T,Counter:P,ModeOfOperation:{ecb:R,cbc:O,cfb:I,ofb:M,ctr:N},utils:{hex:c,utf8:u},padding:{pkcs7:{pad:function(e){var t=16-(e=i(e,!0)).length%16,r=s(e.length+t);o(e,r);for(var n=e.length;n<r.length;n++)r[n]=t;return r},strip:function(e){if((e=i(e,!0)).length<16)throw new Error("PKCS#7 invalid length");var t=e[e.length-1];if(t>16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,n=0;n<t;n++)if(e[r+n]!==t)throw new Error("PKCS#7 invalid padding byte");var a=s(r);return o(e,a,0,0,r),a}}},_arrayTest:{coerceArray:i,createArray:s,copyArray:o}};e.exports=C}()}(Mw);var Pw,Nw,Cw=Mw.exports;function Bw(){if(Pw)return Ow;Pw=1;var e=r&&r.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),t=r&&r.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=r&&r.__importStar||function(r){if(r&&r.__esModule)return r;var n={};if(null!=r)for(var i in r)"default"!==i&&Object.prototype.hasOwnProperty.call(r,i)&&e(n,r,i);return t(n,r),n},i=r&&r.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))},s=r&&r.__generator||function(e,t){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o;)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 o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},o=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ow,"__esModule",{value:!0}),Ow.fromQuorumWallet=Ow.fromKryptoKit=Ow.fromEtherCamp=Ow.fromEtherWallet=void 0;var a=n(sf),u=Dl,c=Aa,f=o(l_()),l=Iw,d=Cw;var h={count:1,keysize:16,ivsize:16,digest:"md5"};function p(e,t,r){var n=function(e){return e?{count:e.count||h.count,keysize:e.keysize||h.keysize,ivsize:e.ivsize||h.ivsize,digest:e.digest||h.digest}:h}(r);function i(r){var i=a.createHash(n.digest);i.update(r),i.update(e),i.update(t),r=i.digest();for(var s=1,o=n.count;s<o;s++)(i=a.createHash(n.digest)).update(r),r=i.digest();return r}for(var s=[],o=0;Buffer.concat(s).length<n.keysize+n.ivsize;)s[o]=i(0===o?Buffer.alloc(0):s[o-1]),o++;var u=Buffer.concat(s);return{key:u.slice(0,n.keysize),iv:u.slice(n.keysize,n.keysize+n.ivsize)}}function g(e,t){var r,n="object"==typeof e?e:JSON.parse(e);if(n.locked){if("string"!=typeof t)throw new Error("Password required");if(t.length<7)throw new Error("Password must be at least 7 characters");var i=function(e){var t=Buffer.from(e,"base64");return"Salted__"===t.slice(0,8).toString()?{salt:t.slice(8,16),ciphertext:t.slice(16)}:{ciphertext:t}}(n.encrypted?n.private.slice(0,128):n.private);if(!i.salt)throw new Error("Unsupported EtherWallet key format");var s=p(Buffer.from(t),i.salt,{keysize:32,ivsize:16});r=function(e,t){return Buffer.concat([e.update(t),e.final()])}(a.createDecipheriv("aes-256-cbc",s.key,s.iv),Buffer.from(i.ciphertext)),r=Buffer.from(l.decode(r.toString()),"hex")}else{if(64!==n.private.length)throw new Error("Invalid private key length");r=Buffer.from(n.private,"hex")}var o=new f.default(r);if(o.getAddressString()!==n.address)throw new Error("Invalid private key or address");return o}function m(e){return new f.default((0,u.keccak256)(Buffer.from(e)))}function y(e,t){return i(this,void 0,void 0,(function(){var r,n,i,o,a,l,h;return s(this,(function(s){switch(s.label){case 0:return"#"===e[0]&&(e=e.slice(1)),r=e[0],e=e.slice(1),"d"!==r?[3,1]:(n=(0,u.sha256)((0,u.toBuffer)(e)),[3,4]);case 1:if("q"!==r)return[3,3];if("string"!=typeof t)throw new Error("Password required");return i=(0,u.sha256)(Buffer.from(e.slice(0,30))),o=e.slice(30,46),a=function(e){function t(e){try{return decodeURIComponent(e)}catch(e){return String.fromCharCode(65533)}}for(var r="",n="",i=0;i<e.length;i++)e[i]<=127?(r+=t(n)+String.fromCharCode(e[i]),n=""):n+="%"+e[i].toString(16);return Buffer.from(r+t(n))}(i),[4,(0,c.scrypt)(Buffer.from(t,"utf8"),a,16384,8,1,32)];case 2:if(l=s.sent(),h=new d.ModeOfOperation.ecb(l),n=Buffer.concat([Buffer.from(h.decrypt(i.slice(0,16))),Buffer.from(h.decrypt(i.slice(16,32)))]),o.length>0&&o!==(0,u.sha256)((0,u.sha256)(n)).slice(0,8).toString("hex"))throw new Error("Failed to decrypt input - possibly invalid passphrase");return[3,4];case 3:throw new Error("Unsupported or invalid entropy type");case 4:return[2,new f.default(n)]}}))}))}function b(e,t){if(e.length<10)throw new Error("Passphrase must be at least 10 characters");if(t.length<10)throw new Error("User id must be at least 10 characters");var r=e+t,n=a.pbkdf2Sync(r,r,2e3,32,"sha256");return new f.default(n)}Ow.fromEtherWallet=g,Ow.fromEtherCamp=m,Ow.fromKryptoKit=y,Ow.fromQuorumWallet=b;var v={fromEtherWallet:g,fromEtherCamp:m,fromKryptoKit:y,fromQuorumWallet:b};return Ow.default=v,Ow}var Uw=new Uint8Array(16);function Lw(){if(!Nw&&!(Nw="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Nw(Uw)}var jw=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Dw(e){return"string"==typeof e&&jw.test(e)}for(var Fw,qw,zw=[],Kw=0;Kw<256;++Kw)zw.push((Kw+256).toString(16).substr(1));function Hw(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(zw[e[t+0]]+zw[e[t+1]]+zw[e[t+2]]+zw[e[t+3]]+"-"+zw[e[t+4]]+zw[e[t+5]]+"-"+zw[e[t+6]]+zw[e[t+7]]+"-"+zw[e[t+8]]+zw[e[t+9]]+"-"+zw[e[t+10]]+zw[e[t+11]]+zw[e[t+12]]+zw[e[t+13]]+zw[e[t+14]]+zw[e[t+15]]).toLowerCase();if(!Dw(r))throw TypeError("Stringified UUID is invalid");return r}var Gw=0,Ww=0;function Vw(e){if(!Dw(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r}function Xw(e,t,r){function n(e,n,i,s){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}(e)),"string"==typeof n&&(n=Vw(n)),16!==n.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var o=new Uint8Array(16+e.length);if(o.set(n),o.set(e,n.length),(o=r(o))[6]=15&o[6]|t,o[8]=63&o[8]|128,i){s=s||0;for(var a=0;a<16;++a)i[s+a]=o[a];return i}return Hw(o)}try{n.name=e}catch(e){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}function Jw(e){return 14+(e+64>>>9<<4)+1}function $w(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function Yw(e,t,r,n,i,s){return $w((o=$w($w(t,e),$w(n,s)))<<(a=i)|o>>>32-a,r);var o,a}function Qw(e,t,r,n,i,s,o){return Yw(t&r|~t&n,e,t,i,s,o)}function Zw(e,t,r,n,i,s,o){return Yw(t&n|r&~n,e,t,i,s,o)}function e_(e,t,r,n,i,s,o){return Yw(t^r^n,e,t,i,s,o)}function t_(e,t,r,n,i,s,o){return Yw(r^(t|~n),e,t,i,s,o)}var r_=Xw("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var r=0;r<t.length;++r)e[r]=t.charCodeAt(r)}return function(e){for(var t=[],r=32*e.length,n="0123456789abcdef",i=0;i<r;i+=8){var s=e[i>>5]>>>i%32&255,o=parseInt(n.charAt(s>>>4&15)+n.charAt(15&s),16);t.push(o)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[Jw(t)-1]=t;for(var r=1732584193,n=-271733879,i=-1732584194,s=271733878,o=0;o<e.length;o+=16){var a=r,u=n,c=i,f=s;r=Qw(r,n,i,s,e[o],7,-680876936),s=Qw(s,r,n,i,e[o+1],12,-389564586),i=Qw(i,s,r,n,e[o+2],17,606105819),n=Qw(n,i,s,r,e[o+3],22,-1044525330),r=Qw(r,n,i,s,e[o+4],7,-176418897),s=Qw(s,r,n,i,e[o+5],12,1200080426),i=Qw(i,s,r,n,e[o+6],17,-1473231341),n=Qw(n,i,s,r,e[o+7],22,-45705983),r=Qw(r,n,i,s,e[o+8],7,1770035416),s=Qw(s,r,n,i,e[o+9],12,-1958414417),i=Qw(i,s,r,n,e[o+10],17,-42063),n=Qw(n,i,s,r,e[o+11],22,-1990404162),r=Qw(r,n,i,s,e[o+12],7,1804603682),s=Qw(s,r,n,i,e[o+13],12,-40341101),i=Qw(i,s,r,n,e[o+14],17,-1502002290),r=Zw(r,n=Qw(n,i,s,r,e[o+15],22,1236535329),i,s,e[o+1],5,-165796510),s=Zw(s,r,n,i,e[o+6],9,-1069501632),i=Zw(i,s,r,n,e[o+11],14,643717713),n=Zw(n,i,s,r,e[o],20,-373897302),r=Zw(r,n,i,s,e[o+5],5,-701558691),s=Zw(s,r,n,i,e[o+10],9,38016083),i=Zw(i,s,r,n,e[o+15],14,-660478335),n=Zw(n,i,s,r,e[o+4],20,-405537848),r=Zw(r,n,i,s,e[o+9],5,568446438),s=Zw(s,r,n,i,e[o+14],9,-1019803690),i=Zw(i,s,r,n,e[o+3],14,-187363961),n=Zw(n,i,s,r,e[o+8],20,1163531501),r=Zw(r,n,i,s,e[o+13],5,-1444681467),s=Zw(s,r,n,i,e[o+2],9,-51403784),i=Zw(i,s,r,n,e[o+7],14,1735328473),r=e_(r,n=Zw(n,i,s,r,e[o+12],20,-1926607734),i,s,e[o+5],4,-378558),s=e_(s,r,n,i,e[o+8],11,-2022574463),i=e_(i,s,r,n,e[o+11],16,1839030562),n=e_(n,i,s,r,e[o+14],23,-35309556),r=e_(r,n,i,s,e[o+1],4,-1530992060),s=e_(s,r,n,i,e[o+4],11,1272893353),i=e_(i,s,r,n,e[o+7],16,-155497632),n=e_(n,i,s,r,e[o+10],23,-1094730640),r=e_(r,n,i,s,e[o+13],4,681279174),s=e_(s,r,n,i,e[o],11,-358537222),i=e_(i,s,r,n,e[o+3],16,-722521979),n=e_(n,i,s,r,e[o+6],23,76029189),r=e_(r,n,i,s,e[o+9],4,-640364487),s=e_(s,r,n,i,e[o+12],11,-421815835),i=e_(i,s,r,n,e[o+15],16,530742520),r=t_(r,n=e_(n,i,s,r,e[o+2],23,-995338651),i,s,e[o],6,-198630844),s=t_(s,r,n,i,e[o+7],10,1126891415),i=t_(i,s,r,n,e[o+14],15,-1416354905),n=t_(n,i,s,r,e[o+5],21,-57434055),r=t_(r,n,i,s,e[o+12],6,1700485571),s=t_(s,r,n,i,e[o+3],10,-1894986606),i=t_(i,s,r,n,e[o+10],15,-1051523),n=t_(n,i,s,r,e[o+1],21,-2054922799),r=t_(r,n,i,s,e[o+8],6,1873313359),s=t_(s,r,n,i,e[o+15],10,-30611744),i=t_(i,s,r,n,e[o+6],15,-1560198380),n=t_(n,i,s,r,e[o+13],21,1309151649),r=t_(r,n,i,s,e[o+4],6,-145523070),s=t_(s,r,n,i,e[o+11],10,-1120210379),i=t_(i,s,r,n,e[o+2],15,718787259),n=t_(n,i,s,r,e[o+9],21,-343485551),r=$w(r,a),n=$w(n,u),i=$w(i,c),s=$w(s,f)}return[r,n,i,s]}(function(e){if(0===e.length)return[];for(var t=8*e.length,r=new Uint32Array(Jw(t)),n=0;n<t;n+=8)r[n>>5]|=(255&e[n/8])<<n%32;return r}(e),8*e.length))})),n_=r_;function i_(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function s_(e,t){return e<<t|e>>>32-t}var o_=Xw("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=[];for(var i=0;i<n.length;++i)e.push(n.charCodeAt(i))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var s=e.length/4+2,o=Math.ceil(s/16),a=new Array(o),u=0;u<o;++u){for(var c=new Uint32Array(16),f=0;f<16;++f)c[f]=e[64*u+4*f]<<24|e[64*u+4*f+1]<<16|e[64*u+4*f+2]<<8|e[64*u+4*f+3];a[u]=c}a[o-1][14]=8*(e.length-1)/Math.pow(2,32),a[o-1][14]=Math.floor(a[o-1][14]),a[o-1][15]=8*(e.length-1)&4294967295;for(var l=0;l<o;++l){for(var d=new Uint32Array(80),h=0;h<16;++h)d[h]=a[l][h];for(var p=16;p<80;++p)d[p]=s_(d[p-3]^d[p-8]^d[p-14]^d[p-16],1);for(var g=r[0],m=r[1],y=r[2],b=r[3],v=r[4],w=0;w<80;++w){var _=Math.floor(w/20),E=s_(g,5)+i_(_,m,y,b)+v+t[_]+d[w]>>>0;v=b,b=y,y=s_(m,30)>>>0,m=g,g=E}r[0]=r[0]+g>>>0,r[1]=r[1]+m>>>0,r[2]=r[2]+y>>>0,r[3]=r[3]+b>>>0,r[4]=r[4]+v>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]})),a_=o_;var u_,c_=Object.freeze({__proto__:null,NIL:"00000000-0000-0000-0000-000000000000",parse:Vw,stringify:Hw,v1:function(e,t,r){var n=t&&r||0,i=t||new Array(16),s=(e=e||{}).node||Fw,o=void 0!==e.clockseq?e.clockseq:qw;if(null==s||null==o){var a=e.random||(e.rng||Lw)();null==s&&(s=Fw=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==o&&(o=qw=16383&(a[6]<<8|a[7]))}var u=void 0!==e.msecs?e.msecs:Date.now(),c=void 0!==e.nsecs?e.nsecs:Ww+1,f=u-Gw+(c-Ww)/1e4;if(f<0&&void 0===e.clockseq&&(o=o+1&16383),(f<0||u>Gw)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Gw=u,Ww=c,qw=o;var l=(1e4*(268435455&(u+=122192928e5))+c)%4294967296;i[n++]=l>>>24&255,i[n++]=l>>>16&255,i[n++]=l>>>8&255,i[n++]=255&l;var d=u/4294967296*1e4&268435455;i[n++]=d>>>8&255,i[n++]=255&d,i[n++]=d>>>24&15|16,i[n++]=d>>>16&255,i[n++]=o>>>8|128,i[n++]=255&o;for(var h=0;h<6;++h)i[n+h]=s[h];return t||Hw(i)},v3:n_,v4:function(e,t,r){var n=(e=e||{}).random||(e.rng||Lw)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return Hw(n)},v5:a_,validate:Dw,version:function(e){if(!Dw(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}}),f_=i(c_);function l_(){return u_||(u_=1,function(e){var t=r&&r.__assign||function(){return t=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)},n=r&&r.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=r&&r.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=r&&r.__importStar||function(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)&&n(t,e,r);return i(t,e),t},o=r&&r.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))},a=r&&r.__generator||function(e,t){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o;)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 o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},u=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.thirdparty=e.hdkey=void 0;var c=s(sf),f=Dl,l=Aa,d=function(){if(Tw)return Ov;Tw=1;var e=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ov,"__esModule",{value:!0});var t=e(l_()),n=Iv,i=function(){function e(e){this._hdkey=e}return e.fromMasterSeed=function(t){return new e(n.HDKey.fromMasterSeed(t))},e.fromExtendedKey=function(t){return new e(n.HDKey.fromExtendedKey(t))},e.prototype.privateExtendedKey=function(){if(!this._hdkey.privateExtendedKey)throw new Error("This is a public key only wallet");return this._hdkey.privateExtendedKey},e.prototype.publicExtendedKey=function(){return this._hdkey.publicExtendedKey},e.prototype.derivePath=function(t){return new e(this._hdkey.derive(t))},e.prototype.deriveChild=function(t){return new e(this._hdkey.deriveChild(t))},e.prototype.getWallet=function(){return this._hdkey._privateKey?t.default.fromPrivateKey(this._hdkey._privateKey):t.default.fromPublicKey(this._hdkey._publicKey,!0)},e}();return Ov.default=i,Ov}();Object.defineProperty(e,"hdkey",{enumerable:!0,get:function(){return u(d).default}});var h=Bw();Object.defineProperty(e,"thirdparty",{enumerable:!0,get:function(){return u(h).default}});var p=Uv,g=Tp,m=f_.v4;function y(e,t,r){if(t.toLowerCase().startsWith("0x")&&(t=t.slice(2)),!t&&!r)return t;if(r%2)throw new Error("Invalid length argument, must be an even number");if("number"==typeof r&&t.length!==r)throw new Error("Invalid "+e+", string must be "+r+" hex characters");if(!/^([0-9a-f]{2})+$/i.test(t))throw new Error("Invalid "+e+", string must be "+("number"==typeof r?r:"empty or a non-zero even number of")+" hex characters");return t}function b(e,t,r){if(!Buffer.isBuffer(t))throw new Error("Invalid "+e+", must be a string ("+("number"==typeof r?""+2*r:"empty or a non-zero even number of")+" hex characters) or buffer"+("number"==typeof r?" ("+r+" bytes)":""));if("number"==typeof r&&t.length!==r)throw new Error("Invalid "+e+", buffer must be "+r+" bytes");return t}var v=function(){function e(e,t){if(void 0===t&&(t=void 0),this.privateKey=e,this.publicKey=t,e&&t)throw new Error("Cannot supply both a private and a public key to the constructor");if(e&&!(0,f.isValidPrivate)(e))throw new Error("Private key does not satisfy the curve requirements (ie. it is invalid)");if(t&&!(0,f.isValidPublic)(t))throw new Error("Invalid public key")}return e.generate=function(t){if(void 0===t&&(t=!1),!t)return new e(g(32));for(var r=new f.BN("088f924eeceeda7fe92e1f5b0fffffffffffffff",16);;){var n=g(32);if(new f.BN((0,f.privateToAddress)(n)).lte(r))return new e(n)}},e.generateVanityAddress=function(t){for(t instanceof RegExp||(t=new RegExp(t));;){var r=g(32),n=(0,f.privateToAddress)(r);if(t.test(n.toString("hex")))return new e(r)}},e.fromPublicKey=function(t,r){return void 0===r&&(r=!1),r&&(t=(0,f.importPublic)(t)),new e(void 0,t)},e.fromExtendedPublicKey=function(t){if("xpub"!==t.slice(0,4))throw new Error("Not an extended public key");var r=p.decode(t).slice(45);return e.fromPublicKey(r,!0)},e.fromPrivateKey=function(t){return new e(t)},e.fromExtendedPrivateKey=function(t){if("xprv"!==t.slice(0,4))throw new Error("Not an extended private key");var r=p.decode(t);if(0!==r[45])throw new Error("Invalid extended private key");return e.fromPrivateKey(r.slice(46))},e.fromV1=function(t,r){return o(this,void 0,void 0,(function(){var n,i,s,o,u;return a(this,(function(a){switch(a.label){case 0:if("1"!==(n="object"==typeof t?t:JSON.parse(t)).Version)throw new Error("Not a V1 Wallet");if("scrypt"!==n.Crypto.KeyHeader.Kdf)throw new Error("Unsupported key derivation scheme");return i=n.Crypto.KeyHeader.KdfParams,[4,(0,l.scrypt)(Buffer.from(r),Buffer.from(n.Crypto.Salt,"hex"),i.N,i.R,i.P,i.DkLen)];case 1:if(s=a.sent(),o=Buffer.from(n.Crypto.CipherText,"hex"),(0,f.keccak256)(Buffer.concat([s.slice(16,32),o])).toString("hex")!==n.Crypto.MAC)throw new Error("Key derivation failed - possibly wrong passphrase");return u=c.createDecipheriv("aes-128-cbc",(0,f.keccak256)(s.slice(0,16)).slice(0,16),Buffer.from(n.Crypto.IV,"hex")),[2,new e(w(u,o))]}}))}))},e.fromV3=function(t,r,n){return void 0===n&&(n=!1),o(this,void 0,void 0,(function(){var i,s,o,u,d;return a(this,(function(a){switch(a.label){case 0:if(3!==(i="object"==typeof t?t:JSON.parse(n?t.toLowerCase():t)).version)throw new Error("Not a V3 wallet");return"scrypt"!==i.crypto.kdf?[3,2]:(o=i.crypto.kdfparams,[4,(0,l.scrypt)(Buffer.from(r),Buffer.from(o.salt,"hex"),o.n,o.r,o.p,o.dklen)]);case 1:return s=a.sent(),[3,3];case 2:if("pbkdf2"!==i.crypto.kdf)throw new Error("Unsupported key derivation scheme");if("hmac-sha256"!==(o=i.crypto.kdfparams).prf)throw new Error("Unsupported parameters to PBKDF2");s=c.pbkdf2Sync(Buffer.from(r),Buffer.from(o.salt,"hex"),o.c,o.dklen,"sha256"),a.label=3;case 3:if(u=Buffer.from(i.crypto.ciphertext,"hex"),(0,f.keccak256)(Buffer.concat([Buffer.from(s.slice(16,32)),u])).toString("hex")!==i.crypto.mac)throw new Error("Key derivation failed - possibly wrong passphrase");return d=c.createDecipheriv(i.crypto.cipher,s.slice(0,16),Buffer.from(i.crypto.cipherparams.iv,"hex")),[2,new e(w(d,u))]}}))}))},e.fromEthSale=function(t,r){var n="object"==typeof t?t:JSON.parse(t),i=Buffer.from(n.encseed,"hex"),s=c.pbkdf2Sync(r,r,2e3,32,"sha256").slice(0,16),o=w(c.createDecipheriv("aes-128-cbc",s,i.slice(0,16)),i.slice(16)),a=new e((0,f.keccak256)(o));if(a.getAddress().toString("hex")!==n.ethaddr)throw new Error("Decoded key mismatch - possibly wrong passphrase");return a},Object.defineProperty(e.prototype,"pubKey",{get:function(){return _(this.publicKey)||(this.publicKey=(0,f.privateToPublic)(this.privateKey)),this.publicKey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"privKey",{get:function(){if(!_(this.privateKey))throw new Error("This is a public key only wallet");return this.privateKey},enumerable:!1,configurable:!0}),e.prototype.getPrivateKey=function(){return this.privKey},e.prototype.getPrivateKeyString=function(){return(0,f.bufferToHex)(this.privKey)},e.prototype.getPublicKey=function(){return this.pubKey},e.prototype.getPublicKeyString=function(){return(0,f.bufferToHex)(this.getPublicKey())},e.prototype.getAddress=function(){return(0,f.publicToAddress)(this.pubKey)},e.prototype.getAddressString=function(){return(0,f.bufferToHex)(this.getAddress())},e.prototype.getChecksumAddressString=function(){return(0,f.toChecksumAddress)(this.getAddressString())},e.prototype.toV3=function(e,r){return o(this,void 0,void 0,(function(){var n,i,s,o,u,d;return a(this,(function(a){switch(a.label){case 0:if(!_(this.privateKey))throw new Error("This is a public key only wallet");switch(h=r,p={cipher:"aes-128-ctr",kdf:"scrypt",salt:g(32),iv:g(16),uuid:g(16),dklen:32,c:262144,n:262144,r:8,p:1},n=h?("string"==typeof h.salt&&(h.salt=Buffer.from(y("salt",h.salt),"hex")),"string"==typeof h.iv&&(h.iv=Buffer.from(y("iv",h.iv,32),"hex")),"string"==typeof h.uuid&&(h.uuid=Buffer.from(y("uuid",h.uuid,32),"hex")),h.salt&&b("salt",h.salt),h.iv&&b("iv",h.iv,16),h.uuid&&b("uuid",h.uuid,16),t(t({},p),h)):p,n.kdf){case"pbkdf2":return[3,1];case"scrypt":return[3,2]}return[3,4];case 1:return i=function(e){return{dklen:e.dklen,salt:e.salt,c:e.c,prf:"hmac-sha256"}}(n),s=c.pbkdf2Sync(Buffer.from(e),i.salt,i.c,i.dklen,"sha256"),[3,5];case 2:return i=function(e){return{dklen:e.dklen,salt:e.salt,n:e.n,r:e.r,p:e.p}}(n),[4,(0,l.scrypt)(Buffer.from(e),i.salt,i.n,i.r,i.p,i.dklen)];case 3:return s=a.sent(),[3,5];case 4:throw new Error("Unsupported kdf");case 5:if(!(o=c.createCipheriv(n.cipher,s.slice(0,16),n.iv)))throw new Error("Unsupported cipher");return u=w(o,this.privKey),d=(0,f.keccak256)(Buffer.concat([Buffer.from(s.slice(16,32)),Buffer.from(u)])),[2,{version:3,id:m({random:n.uuid}),address:this.getAddress().toString("hex"),crypto:{ciphertext:u.toString("hex"),cipherparams:{iv:n.iv.toString("hex")},cipher:n.cipher,kdf:n.kdf,kdfparams:t(t({},i),{salt:i.salt.toString("hex")}),mac:d.toString("hex")}}]}var h,p}))}))},e.prototype.getV3Filename=function(e){return["UTC--",(e?new Date(e):new Date).toJSON().replace(/:/g,"-"),"--",this.getAddress().toString("hex")].join("")},e.prototype.toV3String=function(e,t){return o(this,void 0,void 0,(function(){var r,n;return a(this,(function(i){switch(i.label){case 0:return n=(r=JSON).stringify,[4,this.toV3(e,t)];case 1:return[2,n.apply(r,[i.sent()])]}}))}))},e}();function w(e,t){return Buffer.concat([e.update(t),e.final()])}function _(e){return null!=e}e.default=v}(jl)),jl}var d_=l_(),h_={exports:{}},p_=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}},g_=p_,m_=Object.prototype.toString;function y_(e){return Array.isArray(e)}function b_(e){return void 0===e}function v_(e){return"[object ArrayBuffer]"===m_.call(e)}function w_(e){return null!==e&&"object"==typeof e}function __(e){if("[object Object]"!==m_.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function E_(e){return"[object Function]"===m_.call(e)}function A_(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),y_(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}var S_={isArray:y_,isArrayBuffer:v_,isBuffer:function(e){return null!==e&&!b_(e)&&null!==e.constructor&&!b_(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"[object FormData]"===m_.call(e)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&v_(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:w_,isPlainObject:__,isUndefined:b_,isDate:function(e){return"[object Date]"===m_.call(e)},isFile:function(e){return"[object File]"===m_.call(e)},isBlob:function(e){return"[object Blob]"===m_.call(e)},isFunction:E_,isStream:function(e){return w_(e)&&E_(e.pipe)},isURLSearchParams:function(e){return"[object URLSearchParams]"===m_.call(e)},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:A_,merge:function e(){var t={};function r(r,n){__(t[n])&&__(r)?t[n]=e(t[n],r):__(r)?t[n]=e({},r):y_(r)?t[n]=r.slice():t[n]=r}for(var n=0,i=arguments.length;n<i;n++)A_(arguments[n],r);return t},extend:function(e,t,r){return A_(t,(function(t,n){e[n]=r&&"function"==typeof t?g_(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}},k_=S_;function x_(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var T_=function(e,t,r){if(!t)return e;var n;if(r)n=r(t);else if(k_.isURLSearchParams(t))n=t.toString();else{var i=[];k_.forEach(t,(function(e,t){null!=e&&(k_.isArray(e)?t+="[]":e=[e],k_.forEach(e,(function(e){k_.isDate(e)?e=e.toISOString():k_.isObject(e)&&(e=JSON.stringify(e)),i.push(x_(t)+"="+x_(e))})))})),n=i.join("&")}if(n){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e},R_=S_;function O_(){this.handlers=[]}O_.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},O_.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},O_.prototype.forEach=function(e){R_.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var I_,M_,P_,N_,C_,B_,U_,L_,j_,D_,F_,q_,z_,K_,H_,G_,W_,V_,X_,J_,$_=O_,Y_=S_,Q_=function(e,t,r,n,i){return e.config=t,r&&(e.code=r),e.request=n,e.response=i,e.isAxiosError=!0,e.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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e},Z_={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};function eE(){if(M_)return I_;M_=1;var e=Q_;return I_=function(t,r,n,i,s){var o=new Error(t);return e(o,r,n,i,s)},I_}function tE(){if(q_)return F_;q_=1;var e=L_?U_:(L_=1,U_=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}),t=D_?j_:(D_=1,j_=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e});return F_=function(r,n){return r&&!e(n)?t(r,n):n}}function rE(){if(V_)return W_;function e(e){this.message=e}return V_=1,e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},e.prototype.__CANCEL__=!0,W_=e}function nE(){if(J_)return X_;J_=1;var e=S_,t=function(){if(N_)return P_;N_=1;var e=eE();return P_=function(t,r,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?r(e("Request failed with status code "+n.status,n.config,null,n.request,n)):t(n)}}(),r=function(){if(B_)return C_;B_=1;var e=S_;return C_=e.isStandardBrowserEnv()?{write:function(t,r,n,i,s,o){var a=[];a.push(t+"="+encodeURIComponent(r)),e.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),e.isString(i)&&a.push("path="+i),e.isString(s)&&a.push("domain="+s),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},C_}(),n=T_,i=tE(),s=function(){if(K_)return z_;K_=1;var e=S_,t=["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"];return z_=function(r){var n,i,s,o={};return r?(e.forEach(r.split("\n"),(function(r){if(s=r.indexOf(":"),n=e.trim(r.substr(0,s)).toLowerCase(),i=e.trim(r.substr(s+1)),n){if(o[n]&&t.indexOf(n)>=0)return;o[n]="set-cookie"===n?(o[n]?o[n]:[]).concat([i]):o[n]?o[n]+", "+i:i}})),o):o},z_}(),o=function(){if(G_)return H_;G_=1;var e=S_;return H_=e.isStandardBrowserEnv()?function(){var t,r=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var t=e;return r&&(n.setAttribute("href",t),t=n.href),n.setAttribute("href",t),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=i(window.location.href),function(r){var n=e.isString(r)?i(r):r;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0}}(),a=eE(),u=Z_,c=rE();return X_=function(f){return new Promise((function(l,d){var h,p=f.data,g=f.headers,m=f.responseType;function y(){f.cancelToken&&f.cancelToken.unsubscribe(h),f.signal&&f.signal.removeEventListener("abort",h)}e.isFormData(p)&&delete g["Content-Type"];var b=new XMLHttpRequest;if(f.auth){var v=f.auth.username||"",w=f.auth.password?unescape(encodeURIComponent(f.auth.password)):"";g.Authorization="Basic "+btoa(v+":"+w)}var _=i(f.baseURL,f.url);function E(){if(b){var e="getAllResponseHeaders"in b?s(b.getAllResponseHeaders()):null,r={data:m&&"text"!==m&&"json"!==m?b.response:b.responseText,status:b.status,statusText:b.statusText,headers:e,config:f,request:b};t((function(e){l(e),y()}),(function(e){d(e),y()}),r),b=null}}if(b.open(f.method.toUpperCase(),n(_,f.params,f.paramsSerializer),!0),b.timeout=f.timeout,"onloadend"in b?b.onloadend=E:b.onreadystatechange=function(){b&&4===b.readyState&&(0!==b.status||b.responseURL&&0===b.responseURL.indexOf("file:"))&&setTimeout(E)},b.onabort=function(){b&&(d(a("Request aborted",f,"ECONNABORTED",b)),b=null)},b.onerror=function(){d(a("Network Error",f,null,b)),b=null},b.ontimeout=function(){var e=f.timeout?"timeout of "+f.timeout+"ms exceeded":"timeout exceeded",t=f.transitional||u;f.timeoutErrorMessage&&(e=f.timeoutErrorMessage),d(a(e,f,t.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",b)),b=null},e.isStandardBrowserEnv()){var A=(f.withCredentials||o(_))&&f.xsrfCookieName?r.read(f.xsrfCookieName):void 0;A&&(g[f.xsrfHeaderName]=A)}"setRequestHeader"in b&&e.forEach(g,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete g[t]:b.setRequestHeader(t,e)})),e.isUndefined(f.withCredentials)||(b.withCredentials=!!f.withCredentials),m&&"json"!==m&&(b.responseType=f.responseType),"function"==typeof f.onDownloadProgress&&b.addEventListener("progress",f.onDownloadProgress),"function"==typeof f.onUploadProgress&&b.upload&&b.upload.addEventListener("progress",f.onUploadProgress),(f.cancelToken||f.signal)&&(h=function(e){b&&(d(!e||e&&e.type?new c("canceled"):e),b.abort(),b=null)},f.cancelToken&&f.cancelToken.subscribe(h),f.signal&&(f.signal.aborted?h():f.signal.addEventListener("abort",h))),p||(p=null),b.send(p)}))},X_}var iE=S_,sE=function(e,t){Y_.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))},oE=Q_,aE={"Content-Type":"application/x-www-form-urlencoded"};function uE(e,t){!iE.isUndefined(e)&&iE.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var cE,fE={transitional:Z_,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(cE=nE()),cE),transformRequest:[function(e,t){return sE(t,"Accept"),sE(t,"Content-Type"),iE.isFormData(e)||iE.isArrayBuffer(e)||iE.isBuffer(e)||iE.isStream(e)||iE.isFile(e)||iE.isBlob(e)?e:iE.isArrayBufferView(e)?e.buffer:iE.isURLSearchParams(e)?(uE(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):iE.isObject(e)||t&&"application/json"===t["Content-Type"]?(uE(t,"application/json"),function(e,t,r){if(iE.isString(e))try{return(t||JSON.parse)(e),iE.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||fE.transitional,r=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,i=!r&&"json"===this.responseType;if(i||n&&iE.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw oE(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};iE.forEach(["delete","get","head"],(function(e){fE.headers[e]={}})),iE.forEach(["post","put","patch"],(function(e){fE.headers[e]=iE.merge(aE)}));var lE,dE,hE=fE,pE=S_,gE=hE;function mE(){return dE?lE:(dE=1,lE=function(e){return!(!e||!e.__CANCEL__)})}var yE=S_,bE=function(e,t,r){var n=this||gE;return pE.forEach(r,(function(r){e=r.call(n,e,t)})),e},vE=mE(),wE=hE,_E=rE();function EE(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new _E("canceled")}var AE,SE,kE=S_,xE=function(e,t){t=t||{};var r={};function n(e,t){return kE.isPlainObject(e)&&kE.isPlainObject(t)?kE.merge(e,t):kE.isPlainObject(t)?kE.merge({},t):kE.isArray(t)?t.slice():t}function i(r){return kE.isUndefined(t[r])?kE.isUndefined(e[r])?void 0:n(void 0,e[r]):n(e[r],t[r])}function s(e){if(!kE.isUndefined(t[e]))return n(void 0,t[e])}function o(r){return kE.isUndefined(t[r])?kE.isUndefined(e[r])?void 0:n(void 0,e[r]):n(void 0,t[r])}function a(r){return r in t?n(e[r],t[r]):r in e?n(void 0,e[r]):void 0}var u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a};return kE.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=u[e]||i,n=t(e);kE.isUndefined(n)&&t!==a||(r[e]=n)})),r};function TE(){return SE?AE:(SE=1,AE={version:"0.26.1"})}var RE=TE().version,OE={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){OE[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var IE={};OE.transitional=function(e,t,r){function n(e,t){return"[Axios v"+RE+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,i,s){if(!1===e)throw new Error(n(i," has been removed"+(t?" in "+t:"")));return t&&!IE[i]&&(IE[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,s)}};var ME,PE,NE,CE,BE,UE,LE={assertOptions:function(e,t,r){if("object"!=typeof e)throw new TypeError("options must be an object");for(var n=Object.keys(e),i=n.length;i-- >0;){var s=n[i],o=t[s];if(o){var a=e[s],u=void 0===a||o(a,s,e);if(!0!==u)throw new TypeError("option "+s+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+s)}},validators:OE},jE=S_,DE=T_,FE=$_,qE=function(e){return EE(e),e.headers=e.headers||{},e.data=bE.call(e,e.data,e.headers,e.transformRequest),e.headers=yE.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),yE.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||wE.adapter)(e).then((function(t){return EE(e),t.data=bE.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return vE(t)||(EE(e),t&&t.response&&(t.response.data=bE.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},zE=xE,KE=LE,HE=KE.validators;function GE(e){this.defaults=e,this.interceptors={request:new FE,response:new FE}}GE.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=zE(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;void 0!==r&&KE.assertOptions(r,{silentJSONParsing:HE.transitional(HE.boolean),forcedJSONParsing:HE.transitional(HE.boolean),clarifyTimeoutError:HE.transitional(HE.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,n.unshift(e.fulfilled,e.rejected))}));var s,o=[];if(this.interceptors.response.forEach((function(e){o.push(e.fulfilled,e.rejected)})),!i){var a=[qE,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(o),s=Promise.resolve(t);a.length;)s=s.then(a.shift(),a.shift());return s}for(var u=t;n.length;){var c=n.shift(),f=n.shift();try{u=c(u)}catch(e){f(e);break}}try{s=qE(u)}catch(e){return Promise.reject(e)}for(;o.length;)s=s.then(o.shift(),o.shift());return s},GE.prototype.getUri=function(e){return e=zE(this.defaults,e),DE(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},jE.forEach(["delete","get","head","options"],(function(e){GE.prototype[e]=function(t,r){return this.request(zE(r||{},{method:e,url:t,data:(r||{}).data}))}})),jE.forEach(["post","put","patch"],(function(e){GE.prototype[e]=function(t,r,n){return this.request(zE(n||{},{method:e,url:t,data:r}))}}));var WE=S_,VE=p_,XE=GE,JE=xE;var $E=function e(t){var r=new XE(t),n=VE(XE.prototype.request,r);return WE.extend(n,XE.prototype,r),WE.extend(n,r),n.create=function(r){return e(JE(t,r))},n}(hE);$E.Axios=XE,$E.Cancel=rE(),$E.CancelToken=function(){if(PE)return ME;PE=1;var e=rE();function t(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var r;this.promise=new Promise((function(e){r=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t<r;t++)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},t((function(t){n.reason||(n.reason=new e(t),r(n.reason))}))}return t.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},t.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},t.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},t.source=function(){var e,r=new t((function(t){e=t}));return{token:r,cancel:e}},ME=t}(),$E.isCancel=mE(),$E.VERSION=TE().version,$E.all=function(e){return Promise.all(e)},$E.spread=CE?NE:(CE=1,NE=function(e){return function(t){return e.apply(null,t)}}),$E.isAxiosError=function(){if(UE)return BE;UE=1;var e=S_;return BE=function(t){return e.isObject(t)&&!0===t.isAxiosError}}(),h_.exports=$E,h_.exports.default=$E;var YE=n(h_.exports);
15
+ /**
16
+ * @license
17
+ * author: Immutable
18
+ * core-sdk.js v1.1.0
19
+ * Released under the Apache-2.0 license.
20
+ */
21
+ function QE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ZE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function eA(e,t,r){return t&&ZE(e.prototype,t),r&&ZE(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function tA(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var rA=[{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:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",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:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],nA=function(){function e(){QE(this,e)}return eA(e,null,[{key:"createInterface",value:function(){return new zn(rA)}},{key:"connect",value:function(e,t){return new ya(e,rA,t)}}]),e}();tA(nA,"abi",rA);var iA=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"operator",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"owner",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"_approved",type:"bool"}],name:"setApprovalForAll",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:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"}],sA=function(){function e(){QE(this,e)}return eA(e,null,[{key:"createInterface",value:function(){return new zn(iA)}},{key:"connect",value:function(e,t){return new ya(e,iA,t)}}]),e}();tA(sA,"abi",iA);var oA=[{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"}];tA(function(){function e(){QE(this,e)}return eA(e,null,[{key:"createInterface",value:function(){return new zn(oA)}},{key:"connect",value:function(e,t){return new ya(e,oA,t)}}]),e}(),"abi",oA);var aA=[{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"depositorEthKey",type:"address"},{indexed:!1,internalType:"uint256",name:"starkKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"vaultId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetType",type:"uint256"},{indexed:!1,internalType:"uint256",name:"nonQuantizedAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"quantizedAmount",type:"uint256"}],name:"LogDeposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"starkKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"vaultId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetId",type:"uint256"}],name:"LogDepositCancel",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"starkKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"vaultId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetType",type:"uint256"},{indexed:!1,internalType:"uint256",name:"nonQuantizedAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"quantizedAmount",type:"uint256"}],name:"LogDepositCancelReclaimed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"starkKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"vaultId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetType",type:"uint256"},{indexed:!1,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetId",type:"uint256"}],name:"LogDepositNftCancelReclaimed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"starkKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"vaultId",type:"uint256"}],name:"LogFullWithdrawalRequest",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"ownerKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetType",type:"uint256"},{indexed:!1,internalType:"uint256",name:"nonQuantizedAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"quantizedAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetId",type:"uint256"}],name:"LogMintWithdrawalPerformed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"ownerKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"quantizedAmount",type:"uint256"}],name:"LogMintableWithdrawalAllowed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"depositorEthKey",type:"address"},{indexed:!1,internalType:"uint256",name:"starkKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"vaultId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetType",type:"uint256"},{indexed:!1,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetId",type:"uint256"}],name:"LogNftDeposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"ownerKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetId",type:"uint256"}],name:"LogNftWithdrawalAllowed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"ownerKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetType",type:"uint256"},{indexed:!1,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetId",type:"uint256"},{indexed:!1,internalType:"address",name:"recipient",type:"address"}],name:"LogNftWithdrawalPerformed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"sequenceNumber",type:"uint256"},{indexed:!1,internalType:"uint256",name:"batchId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"vaultRoot",type:"uint256"},{indexed:!1,internalType:"uint256",name:"orderRoot",type:"uint256"}],name:"LogRootUpdate",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"stateTransitionFact",type:"bytes32"}],name:"LogStateTransitionFact",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"ethKey",type:"address"},{indexed:!1,internalType:"uint256",name:"assetId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"vaultId",type:"uint256"},{indexed:!1,internalType:"int256",name:"quantizedAmountChange",type:"int256"}],name:"LogVaultBalanceChangeApplied",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"ownerKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetType",type:"uint256"},{indexed:!1,internalType:"uint256",name:"nonQuantizedAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"quantizedAmount",type:"uint256"}],name:"LogWithdrawalAllowed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"ownerKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetType",type:"uint256"},{indexed:!1,internalType:"uint256",name:"nonQuantizedAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"quantizedAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"recipient",type:"address"}],name:"LogWithdrawalPerformed",type:"event"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"announceAvailabilityVerifierRemovalIntent",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"announceVerifierRemovalIntent",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"},{internalType:"uint256",name:"quantizedAmount",type:"uint256"}],name:"deposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetId",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"depositCancel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"},{internalType:"uint256",name:"quantizedAmount",type:"uint256"}],name:"depositERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"depositEth",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"depositNft",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"depositNftReclaim",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetId",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"depositReclaim",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"},{internalType:"uint256",name:"assetId",type:"uint256"},{internalType:"uint256",name:"quantizedAmount",type:"uint256"}],name:"escape",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"freezeRequest",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"fullWithdrawalRequest",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"assetType",type:"uint256"}],name:"getAssetInfo",outputs:[{internalType:"bytes",name:"assetInfo",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetId",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"getCancellationRequest",outputs:[{internalType:"uint256",name:"request",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetId",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"getDepositBalance",outputs:[{internalType:"uint256",name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"}],name:"getEthKey",outputs:[{internalType:"address",name:"ethKey",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"getFullWithdrawalRequest",outputs:[{internalType:"uint256",name:"res",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastBatchId",outputs:[{internalType:"uint256",name:"batchId",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getOrderRoot",outputs:[{internalType:"uint256",name:"root",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getOrderTreeHeight",outputs:[{internalType:"uint256",name:"height",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetId",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"getQuantizedDepositBalance",outputs:[{internalType:"uint256",name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"presumedAssetType",type:"uint256"}],name:"getQuantum",outputs:[{internalType:"uint256",name:"quantum",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getRegisteredAvailabilityVerifiers",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"getRegisteredVerifiers",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"getSequenceNumber",outputs:[{internalType:"uint256",name:"seq",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getVaultRoot",outputs:[{internalType:"uint256",name:"root",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getVaultTreeHeight",outputs:[{internalType:"uint256",name:"height",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"ownerKey",type:"uint256"},{internalType:"uint256",name:"assetId",type:"uint256"}],name:"getWithdrawalBalance",outputs:[{internalType:"uint256",name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"isAvailabilityVerifier",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"isFrozen",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"isOperator",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"isTokenAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"isUserAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"isVerifier",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"mainAcceptGovernance",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"mainCancelNomination",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"mainIsGovernor",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"mainNominateNewGovernor",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"mainRemoveGovernor",outputs:[],stateMutability:"nonpayable",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:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ethKey",type:"address"},{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"},{internalType:"uint256",name:"quantizedAmount",type:"uint256"}],name:"registerAndDepositERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ethKey",type:"address"},{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"registerAndDepositEth",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"string",name:"",type:"string"}],name:"registerAvailabilityVerifier",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"registerOperator",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],name:"registerToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"registerTokenAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],name:"registerUser",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"registerUserAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"string",name:"",type:"string"}],name:"registerVerifier",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"removeAvailabilityVerifier",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"removeVerifier",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unFreeze",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"unregisterOperator",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"unregisterTokenAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"unregisterUserAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256[]",name:"publicInput",type:"uint256[]"},{internalType:"uint256[]",name:"applicationData",type:"uint256[]"}],name:"updateState",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"ownerKey",type:"uint256"},{internalType:"uint256",name:"assetType",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"ownerKey",type:"uint256"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"bytes",name:"mintingBlob",type:"bytes"}],name:"withdrawAndMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"ownerKey",type:"uint256"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawNft",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"address",name:"",type:"address"}],name:"withdrawNftTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"address",name:"",type:"address"}],name:"withdrawTo",outputs:[],stateMutability:"nonpayable",type:"function"}],uA=function(){function e(){QE(this,e)}return eA(e,null,[{key:"createInterface",value:function(){return new zn(aA)}},{key:"connect",value:function(e,t){return new ya(e,aA,t)}}]),e}();function cA(e){return cA=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},cA(e)}function fA(){return fA="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=cA(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},fA.apply(this,arguments)}function lA(e,t){return lA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},lA(e,t)}function dA(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&lA(e,t)}function hA(e){return hA="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},hA(e)}function pA(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gA(e,t){if(t&&("object"===hA(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return pA(e)}tA(uA,"abi",aA);var mA=[{inputs:[{internalType:"contract Core",name:"_imx",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"imx",outputs:[{internalType:"contract Core",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"}],name:"isRegistered",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"ethKey",type:"address"},{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"registerAndDepositNft",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ethKey",type:"address"},{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"uint256",name:"assetType",type:"uint256"}],name:"registerAndWithdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ethKey",type:"address"},{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"registerAndWithdrawNft",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ethKey",type:"address"},{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"recipient",type:"address"}],name:"registerAndWithdrawNftTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ethKey",type:"address"},{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"address",name:"recipient",type:"address"}],name:"registerAndWithdrawTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ethKey",type:"address"},{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"bytes",name:"mintingBlob",type:"bytes"}],name:"regsiterAndWithdrawAndMint",outputs:[],stateMutability:"nonpayable",type:"function"}],yA="0x60806040523480156200001157600080fd5b5060405162001313380380620013138339818101604052810190620000379190620000fc565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506200012e565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620000b08262000083565b9050919050565b6000620000c482620000a3565b9050919050565b620000d681620000b7565b8114620000e257600080fd5b50565b600081519050620000f681620000cb565b92915050565b6000602082840312156200011557620001146200007e565b5b60006200012584828501620000e5565b91505092915050565b6111d5806200013e6000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80634280d50a1161005b5780634280d50a146100ff5780634627d5981461011b578063579a698814610137578063ea864adf1461016757610088565b80630a9c3beb1461008d5780630f08025f146100a95780631259cc6c146100c7578063352eb84c146100e3575b600080fd5b6100a760048036038101906100a29190610a72565b610183565b005b6100b16102ae565b6040516100be9190610b8d565b60405180910390f35b6100e160048036038101906100dc9190610ba8565b6102d2565b005b6100fd60048036038101906100f89190610c57565b6103fd565b005b61011960048036038101906101149190610cf1565b610525565b005b61013560048036038101906101309190610da0565b610650565b005b610151600480360381019061014c9190610e3a565b610778565b60405161015e9190610e82565b60405180910390f35b610181600480360381019061017c9190610e9d565b61084a565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd2414d4888888886040518563ffffffff1660e01b81526004016101e29493929190610fa1565b600060405180830381600087803b1580156101fc57600080fd5b505af1158015610210573d6000803e3d6000fd5b5050505060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d91443b7878585856040518563ffffffff1660e01b81526004016102739493929190610fe1565b600060405180830381600087803b15801561028d57600080fd5b505af11580156102a1573d6000803e3d6000fd5b5050505050505050505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd2414d4888888886040518563ffffffff1660e01b81526004016103319493929190610fa1565b600060405180830381600087803b15801561034b57600080fd5b505af115801561035f573d6000803e3d6000fd5b5050505060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ebef0fd0878585856040518563ffffffff1660e01b81526004016103c29493929190611021565b600060405180830381600087803b1580156103dc57600080fd5b505af11580156103f0573d6000803e3d6000fd5b5050505050505050505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd2414d4878787876040518563ffffffff1660e01b815260040161045c9493929190610fa1565b600060405180830381600087803b15801561047657600080fd5b505af115801561048a573d6000803e3d6000fd5b5050505060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663019b417a8684846040518463ffffffff1660e01b81526004016104eb93929190611066565b600060405180830381600087803b15801561050557600080fd5b505af1158015610519573d6000803e3d6000fd5b50505050505050505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd2414d4888888886040518563ffffffff1660e01b81526004016105849493929190610fa1565b600060405180830381600087803b15801561059e57600080fd5b505af11580156105b2573d6000803e3d6000fd5b5050505060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ae1cdde6878585856040518563ffffffff1660e01b8152600401610615949392919061109d565b600060405180830381600087803b15801561062f57600080fd5b505af1158015610643573d6000803e3d6000fd5b5050505050505050505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd2414d4878787876040518563ffffffff1660e01b81526004016106af9493929190610fa1565b600060405180830381600087803b1580156106c957600080fd5b505af11580156106dd573d6000803e3d6000fd5b5050505060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166314cd70e48684846040518463ffffffff1660e01b815260040161073e939291906110e2565b600060405180830381600087803b15801561075857600080fd5b505af115801561076c573d6000803e3d6000fd5b50505050505050505050565b60008073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631dbd1da7846040518263ffffffff1660e01b81526004016107ea9190611119565b602060405180830381865afa158015610807573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082b9190611149565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd2414d4868686866040518563ffffffff1660e01b81526004016108a99493929190610fa1565b600060405180830381600087803b1580156108c357600080fd5b505af11580156108d7573d6000803e3d6000fd5b5050505060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663441a3e7085836040518363ffffffff1660e01b8152600401610936929190611176565b600060405180830381600087803b15801561095057600080fd5b505af1158015610964573d6000803e3d6000fd5b505050505050505050565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006109a482610979565b9050919050565b6109b481610999565b81146109bf57600080fd5b50565b6000813590506109d1816109ab565b92915050565b6000819050919050565b6109ea816109d7565b81146109f557600080fd5b50565b600081359050610a07816109e1565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112610a3257610a31610a0d565b5b8235905067ffffffffffffffff811115610a4f57610a4e610a12565b5b602083019150836001820283011115610a6b57610a6a610a17565b5b9250929050565b600080600080600080600060a0888a031215610a9157610a9061096f565b5b6000610a9f8a828b016109c2565b9750506020610ab08a828b016109f8565b965050604088013567ffffffffffffffff811115610ad157610ad0610974565b5b610add8a828b01610a1c565b95509550506060610af08a828b016109f8565b935050608088013567ffffffffffffffff811115610b1157610b10610974565b5b610b1d8a828b01610a1c565b925092505092959891949750929550565b6000819050919050565b6000610b53610b4e610b4984610979565b610b2e565b610979565b9050919050565b6000610b6582610b38565b9050919050565b6000610b7782610b5a565b9050919050565b610b8781610b6c565b82525050565b6000602082019050610ba26000830184610b7e565b92915050565b600080600080600080600060c0888a031215610bc757610bc661096f565b5b6000610bd58a828b016109c2565b9750506020610be68a828b016109f8565b965050604088013567ffffffffffffffff811115610c0757610c06610974565b5b610c138a828b01610a1c565b95509550506060610c268a828b016109f8565b9350506080610c378a828b016109f8565b92505060a0610c488a828b016109c2565b91505092959891949750929550565b60008060008060008060a08789031215610c7457610c7361096f565b5b6000610c8289828a016109c2565b9650506020610c9389828a016109f8565b955050604087013567ffffffffffffffff811115610cb457610cb3610974565b5b610cc089828a01610a1c565b94509450506060610cd389828a016109f8565b9250506080610ce489828a016109f8565b9150509295509295509295565b600080600080600080600060c0888a031215610d1057610d0f61096f565b5b6000610d1e8a828b016109c2565b9750506020610d2f8a828b016109f8565b965050604088013567ffffffffffffffff811115610d5057610d4f610974565b5b610d5c8a828b01610a1c565b95509550506060610d6f8a828b016109f8565b9350506080610d808a828b016109f8565b92505060a0610d918a828b016109f8565b91505092959891949750929550565b60008060008060008060a08789031215610dbd57610dbc61096f565b5b6000610dcb89828a016109c2565b9650506020610ddc89828a016109f8565b955050604087013567ffffffffffffffff811115610dfd57610dfc610974565b5b610e0989828a01610a1c565b94509450506060610e1c89828a016109f8565b9250506080610e2d89828a016109c2565b9150509295509295509295565b600060208284031215610e5057610e4f61096f565b5b6000610e5e848285016109f8565b91505092915050565b60008115159050919050565b610e7c81610e67565b82525050565b6000602082019050610e976000830184610e73565b92915050565b600080600080600060808688031215610eb957610eb861096f565b5b6000610ec7888289016109c2565b9550506020610ed8888289016109f8565b945050604086013567ffffffffffffffff811115610ef957610ef8610974565b5b610f0588828901610a1c565b93509350506060610f18888289016109f8565b9150509295509295909350565b610f2e81610999565b82525050565b610f3d816109d7565b82525050565b600082825260208201905092915050565b82818337600083830152505050565b6000601f19601f8301169050919050565b6000610f808385610f43565b9350610f8d838584610f54565b610f9683610f63565b840190509392505050565b6000606082019050610fb66000830187610f25565b610fc36020830186610f34565b8181036040830152610fd6818486610f74565b905095945050505050565b6000606082019050610ff66000830187610f34565b6110036020830186610f34565b8181036040830152611016818486610f74565b905095945050505050565b60006080820190506110366000830187610f34565b6110436020830186610f34565b6110506040830185610f34565b61105d6060830184610f25565b95945050505050565b600060608201905061107b6000830186610f34565b6110886020830185610f34565b6110956040830184610f34565b949350505050565b60006080820190506110b26000830187610f34565b6110bf6020830186610f34565b6110cc6040830185610f34565b6110d96060830184610f34565b95945050505050565b60006060820190506110f76000830186610f34565b6111046020830185610f34565b6111116040830184610f25565b949350505050565b600060208201905061112e6000830184610f34565b92915050565b600081519050611143816109ab565b92915050565b60006020828403121561115f5761115e61096f565b5b600061116d84828501611134565b91505092915050565b600060408201905061118b6000830185610f34565b6111986020830184610f34565b939250505056fea264697066735822122032218b31f9c0e88bb1991ae2275255c3d0cb01b4bf63a689bcaeccdcc791192c64736f6c634300080b0033",bA=function(e){dA(r,ba);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(){QE(this,r);for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return gA(function(e){return e.length>1}(n)?t.call.apply(t,[this].concat(n)):t.call(this,mA,yA,n[0]))}return eA(r,[{key:"deploy",value:function(e,t){return fA(cA(r.prototype),"deploy",this).call(this,e,t||{})}},{key:"getDeployTransaction",value:function(e,t){return fA(cA(r.prototype),"getDeployTransaction",this).call(this,e,t||{})}},{key:"attach",value:function(e){return fA(cA(r.prototype),"attach",this).call(this,e)}},{key:"connect",value:function(e){return fA(cA(r.prototype),"connect",this).call(this,e)}}],[{key:"createInterface",value:function(){return new zn(mA)}},{key:"connect",value:function(e,t){return new ya(e,mA,t)}}]),r}();tA(bA,"bytecode",yA),tA(bA,"abi",mA);var vA=Object.freeze({__proto__:null,Core:uA,Registration:bA,IERC20:nA,IERC721:sA});function wA(e,t,r,n,i,s,o){try{var a=e[s](o),u=a.value}catch(e){return void r(e)}a.done?t(u):Promise.resolve(u).then(n,i)}function _A(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var s=e.apply(t,r);function o(e){wA(s,n,i,o,a,"next",e)}function a(e){wA(s,n,i,o,a,"throw",e)}o(void 0)}))}}var EA="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},AA={exports:{}},SA={exports:{}};!function(e){function t(r){return e.exports=t="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.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(SA),function(e){var t=SA.exports.default;function r(){
22
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
23
+ e.exports=r=function(){return n},e.exports.__esModule=!0,e.exports.default=e.exports;var n={},i=Object.prototype,s=i.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var i=t&&t.prototype instanceof p?t:p,s=Object.create(i.prototype),o=new x(n||[]);return s._invoke=function(e,t,r){var n="suspendedStart";return function(i,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw s;return{value:void 0,done:!0}}for(r.method=i,r.arg=s;;){var o=r.delegate;if(o){var a=A(o,r);if(a){if(a===h)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=d(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,o),s}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}n.wrap=l;var h={};function p(){}function g(){}function m(){}var y={};f(y,a,(function(){return this}));var b=Object.getPrototypeOf,v=b&&b(b(T([])));v&&v!==i&&s.call(v,a)&&(y=v);var w=m.prototype=p.prototype=Object.create(y);function _(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,r){function n(i,o,a,u){var c=d(e[i],e,o);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==t(l)&&s.call(l,"__await")?r.resolve(l.__await).then((function(e){n("next",e,a,u)}),(function(e){n("throw",e,a,u)})):r.resolve(l).then((function(e){f.value=e,a(f)}),(function(e){return n("throw",e,a,u)}))}u(c.arg)}var i;this._invoke=function(e,t){function s(){return new r((function(r,i){n(e,t,r,i)}))}return i=i?i.then(s,s):s()}}function A(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,A(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=d(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,h;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function T(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(s.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return n.next=n}}return{next:R}}function R(){return{value:void 0,done:!0}}return g.prototype=m,f(w,"constructor",m),f(m,"constructor",g),g.displayName=f(m,c,"GeneratorFunction"),n.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},n.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,f(e,c,"GeneratorFunction")),e.prototype=Object.create(w),e},n.awrap=function(e){return{__await:e}},_(E.prototype),f(E.prototype,u,(function(){return this})),n.AsyncIterator=E,n.async=function(e,t,r,i,s){void 0===s&&(s=Promise);var o=new E(l(e,t,r,i),s);return n.isGeneratorFunction(t)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},_(w),f(w,c,"Generator"),f(w,a,(function(){return this})),f(w,"toString",(function(){return"[object Generator]"})),n.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},n.values=T,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&s.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],o=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var a=s.call(i,"catchLoc"),u=s.call(i,"finallyLoc");if(a&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&s.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),k(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;k(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},n}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(AA);var kA=AA.exports(),xA=kA;try{regeneratorRuntime=kA}catch(vI){"object"==typeof globalThis?globalThis.regeneratorRuntime=kA:Function("r","regeneratorRuntime = r")(kA)}function TA(e){var t;return Wc(zc(e.r.toString(16),64)+zc(e.s.toString(16),64)+zc((null===(t=e.recoveryParam)||void 0===t?void 0:t.toString(16))||"",2))}function RA(e){return e.trim()?-1!==new ue(e,16).cmp(new ue(27))?new ue(e,16).sub(new ue(27)).toNumber():new ue(e,16).toNumber():void 0}function OA(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64;return e=Hc(e),{r:new ue(e.substring(0,t),"hex"),s:new ue(e.substring(t,2*t),"hex"),recoveryParam:RA(e.substring(2*t,2*t+2))}}function IA(e,t){return MA.apply(this,arguments)}function MA(){return(MA=_A(xA.mark((function e(t,r){var n;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=OA,e.next=3,r.signMessage(t);case 3:return e.t1=e.sent,n=(0,e.t0)(e.t1),e.abrupt("return",TA(n));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function PA(e){return NA.apply(this,arguments)}function NA(){return(NA=_A(xA.mark((function e(t){var r,n;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Math.floor(Date.now()/1e3).toString(),e.next=3,IA(r,t);case 3:return n=e.sent,e.abrupt("return",{timestamp:r,signature:n});case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function CA(e,t){return BA.apply(this,arguments)}function BA(){return(BA=_A(xA.mark((function e(t,r){var n,i;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.getAddress();case 2:return n=e.sent,e.next=5,IA(t,r);case 5:return i=e.sent,e.abrupt("return",{message:t,ethAddress:n,ethSignature:i});case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var UA,LA=new ue("08000000 00000010 ffffffff ffffffff b781126d cae7b232 1e66a241 adc64d2f",16),jA=new $c.ec(new $c.curves.PresetCurve({type:"short",prime:null,p:"08000000 00000011 00000000 00000000 00000000 00000000 00000000 00000001",a:"00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001",b:"06f21413 efbe40de 150e596d 72f7a8c5 609ad26c 15c915c1 f4cdfcb9 9cee9e89",n:LA.toString("hex"),hash:Zs.sha256,gRed:!1,g:["1ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca","5668060aa49730b7be4801df46ec62de53ecd11abe43a32873000c36e8dc1f"]}));function DA(e,t){return new ue(Zs.sha256().update(bc(Hc(e)+Fc(kc(t),2))).digest("hex"),16)}function FA(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,n=_c(e).slice(t,r);return Ic(n)}function qA(e,t,r,n){var i=Zs.sha256().update(e).digest("hex"),s=Zs.sha256().update(t).digest("hex"),o=FA(i,-31),a=FA(s,-31),u=FA(r,-31),c=FA(r,-62,-31);return"m/2645'/".concat(o,"'/").concat(a,"'/").concat(u,"'/").concat(c,"'/").concat(n)}function zA(e,t){var r=d_.hdkey.fromMasterSeed(Buffer.from(e.slice(2),"hex")).derivePath(t).getWallet().getPrivateKey();return function(e,t){for(var r=new ue("1 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000",16),n=r.sub(r.mod(t)),i=DA(e.toString("hex",64),0),s=1;i.gte(n);s++)i=DA(i.toString("hex"),s);return i.umod(t).toString("hex")}(new ue(r),LA)}function KA(e){return HA.apply(this,arguments)}function HA(){return(HA=_A(xA.mark((function e(t){var r,n,i,s,o;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return r=e.sent.toLowerCase(),e.next=5,t.signMessage("Only sign this request if you’ve initiated an action with Immutable X.");case 5:return n=e.sent,i=Le(n).s,s=qA("starkex","immutablex",r,"1"),o=zA(i,s),e.abrupt("return",o.padStart(64,"0"));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(e){e.StarkCurveInvalidMessageLength="invalid message length"}(UA||(UA={}));var GA=function(){function e(t){QE(this,e),this.privateKey=t,this.keyPair=jA.keyFromPrivate(t,"hex")}return eA(e,[{key:"getAddress",value:function(){var e=this.keyPair.getPublic().getX().toString("hex");return Vc(e)}},{key:"signMessage",value:function(){var e=_A(xA.mark((function e(t){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.serialize(this.keyPair.sign(this.fixMsgHashLen(t))));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"serialize",value:function(e){return Wc(zc(e.r.toString("hex"),64)+zc(e.s.toString("hex"),64))}},{key:"fixMsgHashLen",value:function(e){if(e=Hc(e),(e=new ue(e,"hex").toString("hex")).length<=62)return e;if(63!==e.length)throw new Error(UA.StarkCurveInvalidMessageLength);return"".concat(e,"0")}}]),e}();function WA(e){return new GA(e)}function VA(e,t,r){return VA=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&lA(i,r.prototype),i},VA.apply(null,arguments)}function XA(e){var t="function"==typeof Map?new Map:void 0;return XA=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return VA(e,arguments,cA(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),lA(n,e)},XA(e)}var JA="https://api.sandbox.x.immutable.com".replace(/\/+$/,""),$A=eA((function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:JA,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:YE;QE(this,e),this.basePath=r,this.axios=n,t&&(this.configuration=t,this.basePath=t.basePath||this.basePath)})),YA=function(e){dA(r,XA(Error));var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(e,n){var i;return QE(this,r),tA(pA(i=t.call(this,n)),"name","RequiredError"),i.field=e,i}return eA(r)}();function QA(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 ZA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?QA(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):QA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var eS="https://example.com",tS=function(e,t,r){if(null==r)throw new YA(t,"Required parameter ".concat(t," was null or undefined when calling ").concat(e,"."))};function rS(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";"object"===hA(t)?Array.isArray(t)?t.forEach((function(t){return rS(e,t,r)})):Object.keys(t).forEach((function(n){return rS(e,t[n],"".concat(r).concat(""!==r?".":"").concat(n))})):e.has(r)?e.append(r,t):e.set(r,t)}var nS=function(e){for(var t=new URLSearchParams(e.search),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];rS(t,n),e.search=t.toString()},iS=function(e,t,r){var n="string"!=typeof e;return(n&&r&&r.isJsonMime?r.isJsonMime(t.headers["Content-Type"]):n)?JSON.stringify(void 0!==e?e:{}):e||""},sS=function(e){return e.pathname+e.search+e.hash},oS=function(e,t,r,n){return function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,o=ZA(ZA({},e.options),{},{url:((null==n?void 0:n.basePath)||s)+e.url});return i.request(o)}};function aS(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 uS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?aS(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):aS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var cS=function(e){var t=function(e){return{getAsset:(r=_A(xA.mark((function t(r,n,i){var s,o,a,u,c,f,l,d,h=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=h.length>3&&void 0!==h[3]?h[3]:{},tS("getAsset","tokenAddress",r),tS("getAsset","tokenId",n),o="/v1/assets/{token_address}/{token_id}".replace("{".concat("token_address","}"),encodeURIComponent(String(r))).replace("{".concat("token_id","}"),encodeURIComponent(String(n))),a=new URL(o,eS),e&&(u=e.baseOptions),c=uS(uS({method:"GET"},u),s),f={},l={},void 0!==i&&(l.include_fees=i),nS(a,l),d=u&&u.headers?u.headers:{},c.headers=uS(uS(uS({},f),d),s.headers),t.abrupt("return",{url:sS(a),options:c});case 14:case"end":return t.stop()}}),t)}))),function(e,t,n){return r.apply(this,arguments)}),listAssets:(t=_A(xA.mark((function t(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y){var b,v,w,_,E,A,S,k=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return b=k.length>16&&void 0!==k[16]?k[16]:{},v=new URL("/v1/assets",eS),e&&(w=e.baseOptions),_=uS(uS({method:"GET"},w),b),E={},A={},void 0!==r&&(A.page_size=r),void 0!==n&&(A.cursor=n),void 0!==i&&(A.order_by=i),void 0!==s&&(A.direction=s),void 0!==o&&(A.user=o),void 0!==a&&(A.status=a),void 0!==u&&(A.name=u),void 0!==c&&(A.metadata=c),void 0!==f&&(A.sell_orders=f),void 0!==l&&(A.buy_orders=l),void 0!==d&&(A.include_fees=d),void 0!==h&&(A.collection=h),void 0!==p&&(A.updated_min_timestamp=p),void 0!==g&&(A.updated_max_timestamp=g),void 0!==m&&(A.auxiliary_fee_percentages=m),void 0!==y&&(A.auxiliary_fee_recipients=y),nS(v,A),S=w&&w.headers?w.headers:{},_.headers=uS(uS(uS({},E),S),b.headers),t.abrupt("return",{url:sS(v),options:_});case 27:case"end":return t.stop()}}),t)}))),function(e,r,n,i,s,o,a,u,c,f,l,d,h,p,g,m){return t.apply(this,arguments)})};var t,r}(e);return{getAsset:function(r,n,i,s){return _A(xA.mark((function o(){var a;return xA.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,t.getAsset(r,n,i,s);case 2:return a=o.sent,o.abrupt("return",oS(a,YE,JA,e));case 4:case"end":return o.stop()}}),o)})))()},listAssets:function(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b){return _A(xA.mark((function v(){var w;return xA.wrap((function(v){for(;;)switch(v.prev=v.next){case 0:return v.next=2,t.listAssets(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b);case 2:return w=v.sent,v.abrupt("return",oS(w,YE,JA,e));case 4:case"end":return v.stop()}}),v)})))()}}},fS=function(e){dA(r,$A);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(){return QE(this,r),t.apply(this,arguments)}return eA(r,[{key:"getAsset",value:function(e,t){var r=this;return cS(this.configuration).getAsset(e.tokenAddress,e.tokenId,e.includeFees,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listAssets",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return cS(this.configuration).listAssets(t.pageSize,t.cursor,t.orderBy,t.direction,t.user,t.status,t.name,t.metadata,t.sellOrders,t.buyOrders,t.includeFees,t.collection,t.updatedMinTimestamp,t.updatedMaxTimestamp,t.auxiliaryFeePercentages,t.auxiliaryFeeRecipients,r).then((function(t){return t(e.axios,e.basePath)}))}}]),r}();function lS(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 dS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?lS(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var hS=function(e){var t=function(e){return{getBalance:(r=_A(xA.mark((function t(r,n){var i,s,o,a,u,c,f,l=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=l.length>2&&void 0!==l[2]?l[2]:{},tS("getBalance","owner",r),tS("getBalance","address",n),s="/v2/balances/{owner}/{address}".replace("{".concat("owner","}"),encodeURIComponent(String(r))).replace("{".concat("address","}"),encodeURIComponent(String(n))),o=new URL(s,eS),e&&(a=e.baseOptions),u=dS(dS({method:"GET"},a),i),c={},nS(o,{}),f=a&&a.headers?a.headers:{},u.headers=dS(dS(dS({},c),f),i.headers),t.abrupt("return",{url:sS(o),options:u});case 13:case"end":return t.stop()}}),t)}))),function(e,t){return r.apply(this,arguments)}),listBalances:(t=_A(xA.mark((function t(r,n,i,s,o){var a,u,c,f,l,d,h,p,g=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=g.length>5&&void 0!==g[5]?g[5]:{},tS("listBalances","owner",r),u="/v2/balances/{owner}".replace("{".concat("owner","}"),encodeURIComponent(String(r))),c=new URL(u,eS),e&&(f=e.baseOptions),l=dS(dS({method:"GET"},f),a),d={},h={},void 0!==n&&(h.page_size=n),void 0!==i&&(h.cursor=i),void 0!==s&&(h.order_by=s),void 0!==o&&(h.direction=o),nS(c,h),p=f&&f.headers?f.headers:{},l.headers=dS(dS(dS({},d),p),a.headers),t.abrupt("return",{url:sS(c),options:l});case 16:case"end":return t.stop()}}),t)}))),function(e,r,n,i,s){return t.apply(this,arguments)})};var t,r}(e);return{getBalance:function(r,n,i){return _A(xA.mark((function s(){var o;return xA.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,t.getBalance(r,n,i);case 2:return o=s.sent,s.abrupt("return",oS(o,YE,JA,e));case 4:case"end":return s.stop()}}),s)})))()},listBalances:function(r,n,i,s,o,a){return _A(xA.mark((function u(){var c;return xA.wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,t.listBalances(r,n,i,s,o,a);case 2:return c=u.sent,u.abrupt("return",oS(c,YE,JA,e));case 4:case"end":return u.stop()}}),u)})))()}}},pS=function(e){dA(r,$A);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(){return QE(this,r),t.apply(this,arguments)}return eA(r,[{key:"getBalance",value:function(e,t){var r=this;return hS(this.configuration).getBalance(e.owner,e.address,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listBalances",value:function(e,t){var r=this;return hS(this.configuration).listBalances(e.owner,e.pageSize,e.cursor,e.orderBy,e.direction,t).then((function(e){return e(r.axios,r.basePath)}))}}]),r}();function gS(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 mS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?gS(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var yS=function(e){var t=function(e){return{createCollection:(s=_A(xA.mark((function t(r,n,i){var s,o,a,u,c,f,l,d=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=d.length>3&&void 0!==d[3]?d[3]:{},tS("createCollection","iMXSignature",r),tS("createCollection","iMXTimestamp",n),tS("createCollection","createCollectionRequest",i),o=new URL("/v1/collections",eS),e&&(a=e.baseOptions),u=mS(mS({method:"POST"},a),s),c={},f={},null!=r&&(c["IMX-Signature"]=String(r)),null!=n&&(c["IMX-Timestamp"]=String(n)),c["Content-Type"]="application/json",nS(o,f),l=a&&a.headers?a.headers:{},u.headers=mS(mS(mS({},c),l),s.headers),u.data=iS(i,u,e),t.abrupt("return",{url:sS(o),options:u});case 18:case"end":return t.stop()}}),t)}))),function(e,t,r){return s.apply(this,arguments)}),getCollection:(i=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getCollection","address",r),i="/v1/collections/{address}".replace("{".concat("address","}"),encodeURIComponent(String(r))),s=new URL(i,eS),e&&(o=e.baseOptions),a=mS(mS({method:"GET"},o),n),u={},nS(s,{}),c=o&&o.headers?o.headers:{},a.headers=mS(mS(mS({},u),c),n.headers),t.abrupt("return",{url:sS(s),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return i.apply(this,arguments)}),listCollectionFilters:(n=_A(xA.mark((function t(r,n,i){var s,o,a,u,c,f,l,d,h=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=h.length>3&&void 0!==h[3]?h[3]:{},tS("listCollectionFilters","address",r),o="/v1/collections/{address}/filters".replace("{".concat("address","}"),encodeURIComponent(String(r))),a=new URL(o,eS),e&&(u=e.baseOptions),c=mS(mS({method:"GET"},u),s),f={},l={},void 0!==n&&(l.page_size=n),void 0!==i&&(l.next_page_token=i),nS(a,l),d=u&&u.headers?u.headers:{},c.headers=mS(mS(mS({},f),d),s.headers),t.abrupt("return",{url:sS(a),options:c});case 14:case"end":return t.stop()}}),t)}))),function(e,t,r){return n.apply(this,arguments)}),listCollections:(r=_A(xA.mark((function t(r,n,i,s,o,a,u){var c,f,l,d,h,p,g,m=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return c=m.length>7&&void 0!==m[7]?m[7]:{},f=new URL("/v1/collections",eS),e&&(l=e.baseOptions),d=mS(mS({method:"GET"},l),c),h={},p={},void 0!==r&&(p.page_size=r),void 0!==n&&(p.cursor=n),void 0!==i&&(p.order_by=i),void 0!==s&&(p.direction=s),void 0!==o&&(p.blacklist=o),void 0!==a&&(p.whitelist=a),void 0!==u&&(p.keyword=u),nS(f,p),g=l&&l.headers?l.headers:{},d.headers=mS(mS(mS({},h),g),c.headers),t.abrupt("return",{url:sS(f),options:d});case 18:case"end":return t.stop()}}),t)}))),function(e,t,n,i,s,o,a){return r.apply(this,arguments)}),updateCollection:(t=_A(xA.mark((function t(r,n,i,s){var o,a,u,c,f,l,d,h,p=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=p.length>4&&void 0!==p[4]?p[4]:{},tS("updateCollection","address",r),tS("updateCollection","iMXSignature",n),tS("updateCollection","iMXTimestamp",i),tS("updateCollection","updateCollectionRequest",s),a="/v1/collections/{address}".replace("{".concat("address","}"),encodeURIComponent(String(r))),u=new URL(a,eS),e&&(c=e.baseOptions),f=mS(mS({method:"PATCH"},c),o),l={},d={},null!=n&&(l["IMX-Signature"]=String(n)),null!=i&&(l["IMX-Timestamp"]=String(i)),l["Content-Type"]="application/json",nS(u,d),h=c&&c.headers?c.headers:{},f.headers=mS(mS(mS({},l),h),o.headers),f.data=iS(s,f,e),t.abrupt("return",{url:sS(u),options:f});case 19:case"end":return t.stop()}}),t)}))),function(e,r,n,i){return t.apply(this,arguments)})};var t,r,n,i,s}(e);return{createCollection:function(r,n,i,s){return _A(xA.mark((function o(){var a;return xA.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,t.createCollection(r,n,i,s);case 2:return a=o.sent,o.abrupt("return",oS(a,YE,JA,e));case 4:case"end":return o.stop()}}),o)})))()},getCollection:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getCollection(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},listCollectionFilters:function(r,n,i,s){return _A(xA.mark((function o(){var a;return xA.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,t.listCollectionFilters(r,n,i,s);case 2:return a=o.sent,o.abrupt("return",oS(a,YE,JA,e));case 4:case"end":return o.stop()}}),o)})))()},listCollections:function(r,n,i,s,o,a,u,c){return _A(xA.mark((function f(){var l;return xA.wrap((function(f){for(;;)switch(f.prev=f.next){case 0:return f.next=2,t.listCollections(r,n,i,s,o,a,u,c);case 2:return l=f.sent,f.abrupt("return",oS(l,YE,JA,e));case 4:case"end":return f.stop()}}),f)})))()},updateCollection:function(r,n,i,s,o){return _A(xA.mark((function a(){var u;return xA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.updateCollection(r,n,i,s,o);case 2:return u=a.sent,a.abrupt("return",oS(u,YE,JA,e));case 4:case"end":return a.stop()}}),a)})))()}}},bS=function(e){dA(r,$A);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(){return QE(this,r),t.apply(this,arguments)}return eA(r,[{key:"createCollection",value:function(e,t){var r=this;return yS(this.configuration).createCollection(e.iMXSignature,e.iMXTimestamp,e.createCollectionRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getCollection",value:function(e,t){var r=this;return yS(this.configuration).getCollection(e.address,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listCollectionFilters",value:function(e,t){var r=this;return yS(this.configuration).listCollectionFilters(e.address,e.pageSize,e.nextPageToken,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listCollections",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return yS(this.configuration).listCollections(t.pageSize,t.cursor,t.orderBy,t.direction,t.blacklist,t.whitelist,t.keyword,r).then((function(t){return t(e.axios,e.basePath)}))}},{key:"updateCollection",value:function(e,t){var r=this;return yS(this.configuration).updateCollection(e.address,e.iMXSignature,e.iMXTimestamp,e.updateCollectionRequest,t).then((function(e){return e(r.axios,r.basePath)}))}}]),r}();function vS(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 wS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vS(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var _S=function(e){var t=function(e){return{getDeposit:(n=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getDeposit","id",r),i="/v1/deposits/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),s=new URL(i,eS),e&&(o=e.baseOptions),a=wS(wS({method:"GET"},o),n),u={},nS(s,{}),c=o&&o.headers?o.headers:{},a.headers=wS(wS(wS({},u),c),n.headers),t.abrupt("return",{url:sS(s),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),getSignableDeposit:(r=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getSignableDeposit","getSignableDepositRequest",r),i=new URL("/v1/signable-deposit-details",eS),e&&(s=e.baseOptions),o=wS(wS({method:"POST"},s),n),u={},(a={})["Content-Type"]="application/json",nS(i,u),c=s&&s.headers?s.headers:{},o.headers=wS(wS(wS({},a),c),n.headers),o.data=iS(r,o,e),t.abrupt("return",{url:sS(i),options:o});case 14:case"end":return t.stop()}}),t)}))),function(e){return r.apply(this,arguments)}),listDeposits:(t=_A(xA.mark((function t(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y){var b,v,w,_,E,A,S,k=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return b=k.length>16&&void 0!==k[16]?k[16]:{},v=new URL("/v1/deposits",eS),e&&(w=e.baseOptions),_=wS(wS({method:"GET"},w),b),E={},A={},void 0!==r&&(A.page_size=r),void 0!==n&&(A.cursor=n),void 0!==i&&(A.order_by=i),void 0!==s&&(A.direction=s),void 0!==o&&(A.user=o),void 0!==a&&(A.status=a),void 0!==u&&(A.min_timestamp=u),void 0!==c&&(A.max_timestamp=c),void 0!==f&&(A.token_type=f),void 0!==l&&(A.token_id=l),void 0!==d&&(A.asset_id=d),void 0!==h&&(A.token_address=h),void 0!==p&&(A.token_name=p),void 0!==g&&(A.min_quantity=g),void 0!==m&&(A.max_quantity=m),void 0!==y&&(A.metadata=y),nS(v,A),S=w&&w.headers?w.headers:{},_.headers=wS(wS(wS({},E),S),b.headers),t.abrupt("return",{url:sS(v),options:_});case 27:case"end":return t.stop()}}),t)}))),function(e,r,n,i,s,o,a,u,c,f,l,d,h,p,g,m){return t.apply(this,arguments)})};var t,r,n}(e);return{getDeposit:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getDeposit(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},getSignableDeposit:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableDeposit(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},listDeposits:function(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b){return _A(xA.mark((function v(){var w;return xA.wrap((function(v){for(;;)switch(v.prev=v.next){case 0:return v.next=2,t.listDeposits(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b);case 2:return w=v.sent,v.abrupt("return",oS(w,YE,JA,e));case 4:case"end":return v.stop()}}),v)})))()}}},ES=function(e){dA(r,$A);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(){return QE(this,r),t.apply(this,arguments)}return eA(r,[{key:"getDeposit",value:function(e,t){var r=this;return _S(this.configuration).getDeposit(e.id,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getSignableDeposit",value:function(e,t){var r=this;return _S(this.configuration).getSignableDeposit(e.getSignableDepositRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listDeposits",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return _S(this.configuration).listDeposits(t.pageSize,t.cursor,t.orderBy,t.direction,t.user,t.status,t.minTimestamp,t.maxTimestamp,t.tokenType,t.tokenId,t.assetId,t.tokenAddress,t.tokenName,t.minQuantity,t.maxQuantity,t.metadata,r).then((function(t){return t(e.axios,e.basePath)}))}}]),r}();function AS(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 SS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?AS(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):AS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var kS=function(e){var t=function(e){return{encodeAsset:(t=_A(xA.mark((function t(r,n){var i,s,o,a,u,c,f,l,d=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=d.length>2&&void 0!==d[2]?d[2]:{},tS("encodeAsset","assetType",r),tS("encodeAsset","encodeAssetRequest",n),s="/v1/encode/{assetType}".replace("{".concat("assetType","}"),encodeURIComponent(String(r))),o=new URL(s,eS),e&&(a=e.baseOptions),u=SS(SS({method:"POST"},a),i),f={},(c={})["Content-Type"]="application/json",nS(o,f),l=a&&a.headers?a.headers:{},u.headers=SS(SS(SS({},c),l),i.headers),u.data=iS(n,u,e),t.abrupt("return",{url:sS(o),options:u});case 15:case"end":return t.stop()}}),t)}))),function(e,r){return t.apply(this,arguments)})};var t}(e);return{encodeAsset:function(r,n,i){return _A(xA.mark((function s(){var o;return xA.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,t.encodeAsset(r,n,i);case 2:return o=s.sent,s.abrupt("return",oS(o,YE,JA,e));case 4:case"end":return s.stop()}}),s)})))()}}},xS=function(e){dA(r,$A);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(){return QE(this,r),t.apply(this,arguments)}return eA(r,[{key:"encodeAsset",value:function(e,t){var r=this;return kS(this.configuration).encodeAsset(e.assetType,e.encodeAssetRequest,t).then((function(e){return e(r.axios,r.basePath)}))}}]),r}();function TS(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 RS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?TS(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):TS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var OS=function(e){var t=function(e){return{createExchange:(s=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("createExchange","createExchangeAPIRequest",r),i=new URL("/v3/exchanges",eS),e&&(s=e.baseOptions),o=RS(RS({method:"POST"},s),n),u={},(a={})["Content-Type"]="application/json",nS(i,u),c=s&&s.headers?s.headers:{},o.headers=RS(RS(RS({},a),c),n.headers),o.data=iS(r,o,e),t.abrupt("return",{url:sS(i),options:o});case 14:case"end":return t.stop()}}),t)}))),function(e){return s.apply(this,arguments)}),createExchangeTransfer:(i=_A(xA.mark((function t(r,n,i,s,o){var a,u,c,f,l,d,h,p,g=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=g.length>5&&void 0!==g[5]?g[5]:{},tS("createExchangeTransfer","id",r),tS("createExchangeTransfer","createTransferRequest",n),u="/v2/exchanges/{id}/transfers".replace("{".concat("id","}"),encodeURIComponent(String(r))),c=new URL(u,eS),e&&(f=e.baseOptions),l=RS(RS({method:"POST"},f),a),d={},h={},null!=i&&(d["x-imx-eth-address"]=String(i)),null!=s&&(d["x-imx-eth-signature"]=String(s)),null!=o&&(d.Authorization=String(o)),d["Content-Type"]="application/json",nS(c,h),p=f&&f.headers?f.headers:{},l.headers=RS(RS(RS({},d),p),a.headers),l.data=iS(n,l,e),t.abrupt("return",{url:sS(c),options:l});case 18:case"end":return t.stop()}}),t)}))),function(e,t,r,n,s){return i.apply(this,arguments)}),getExchange:(n=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getExchange","id",r),i="/v3/exchanges/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),s=new URL(i,eS),e&&(o=e.baseOptions),a=RS(RS({method:"GET"},o),n),u={},nS(s,{}),c=o&&o.headers?o.headers:{},a.headers=RS(RS(RS({},u),c),n.headers),t.abrupt("return",{url:sS(s),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),getExchangeSignableTransfer:(r=_A(xA.mark((function t(r,n){var i,s,o,a,u,c,f,l,d=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=d.length>2&&void 0!==d[2]?d[2]:{},tS("getExchangeSignableTransfer","id",r),tS("getExchangeSignableTransfer","getSignableTransferRequest",n),s="/v2/exchanges/{id}/signable-transfer-details".replace("{".concat("id","}"),encodeURIComponent(String(r))),o=new URL(s,eS),e&&(a=e.baseOptions),u=RS(RS({method:"POST"},a),i),f={},(c={})["Content-Type"]="application/json",nS(o,f),l=a&&a.headers?a.headers:{},u.headers=RS(RS(RS({},c),l),i.headers),u.data=iS(n,u,e),t.abrupt("return",{url:sS(o),options:u});case 15:case"end":return t.stop()}}),t)}))),function(e,t){return r.apply(this,arguments)}),getExchanges:(t=_A(xA.mark((function t(r,n,i,s,o,a,u,c,f){var l,d,h,p,g,m,y,b=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return l=b.length>9&&void 0!==b[9]?b[9]:{},d=new URL("/v3/exchanges",eS),e&&(h=e.baseOptions),p=RS(RS({method:"GET"},h),l),g={},m={},void 0!==r&&(m.page_size=r),void 0!==n&&(m.cursor=n),void 0!==i&&(m.order_by=i),void 0!==s&&(m.direction=s),void 0!==o&&(m.id=o),void 0!==a&&(m.wallet_address=a),void 0!==u&&(m.status=u),void 0!==c&&(m.provider=c),void 0!==f&&(m.transfer_id=f),nS(d,m),y=h&&h.headers?h.headers:{},p.headers=RS(RS(RS({},g),y),l.headers),t.abrupt("return",{url:sS(d),options:p});case 20:case"end":return t.stop()}}),t)}))),function(e,r,n,i,s,o,a,u,c){return t.apply(this,arguments)})};var t,r,n,i,s}(e);return{createExchange:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.createExchange(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},createExchangeTransfer:function(r,n,i,s,o,a){return _A(xA.mark((function u(){var c;return xA.wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,t.createExchangeTransfer(r,n,i,s,o,a);case 2:return c=u.sent,u.abrupt("return",oS(c,YE,JA,e));case 4:case"end":return u.stop()}}),u)})))()},getExchange:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getExchange(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},getExchangeSignableTransfer:function(r,n,i){return _A(xA.mark((function s(){var o;return xA.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,t.getExchangeSignableTransfer(r,n,i);case 2:return o=s.sent,s.abrupt("return",oS(o,YE,JA,e));case 4:case"end":return s.stop()}}),s)})))()},getExchanges:function(r,n,i,s,o,a,u,c,f,l){return _A(xA.mark((function d(){var h;return xA.wrap((function(d){for(;;)switch(d.prev=d.next){case 0:return d.next=2,t.getExchanges(r,n,i,s,o,a,u,c,f,l);case 2:return h=d.sent,d.abrupt("return",oS(h,YE,JA,e));case 4:case"end":return d.stop()}}),d)})))()}}},IS=function(e){dA(r,$A);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(){return QE(this,r),t.apply(this,arguments)}return eA(r,[{key:"createExchange",value:function(e,t){var r=this;return OS(this.configuration).createExchange(e.createExchangeAPIRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"createExchangeTransfer",value:function(e,t){var r=this;return OS(this.configuration).createExchangeTransfer(e.id,e.createTransferRequest,e.xImxEthAddress,e.xImxEthSignature,e.authorization,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getExchange",value:function(e,t){var r=this;return OS(this.configuration).getExchange(e.id,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getExchangeSignableTransfer",value:function(e,t){var r=this;return OS(this.configuration).getExchangeSignableTransfer(e.id,e.getSignableTransferRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getExchanges",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return OS(this.configuration).getExchanges(t.pageSize,t.cursor,t.orderBy,t.direction,t.id,t.walletAddress,t.status,t.provider,t.transferId,r).then((function(t){return t(e.axios,e.basePath)}))}}]),r}();function MS(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 PS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?MS(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):MS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var NS=function(e){var t=function(e){return{addMetadataSchemaToCollection:(n=_A(xA.mark((function t(r,n,i,s){var o,a,u,c,f,l,d,h,p=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=p.length>4&&void 0!==p[4]?p[4]:{},tS("addMetadataSchemaToCollection","address",r),tS("addMetadataSchemaToCollection","iMXSignature",n),tS("addMetadataSchemaToCollection","iMXTimestamp",i),tS("addMetadataSchemaToCollection","addMetadataSchemaToCollectionRequest",s),a="/v1/collections/{address}/metadata-schema".replace("{".concat("address","}"),encodeURIComponent(String(r))),u=new URL(a,eS),e&&(c=e.baseOptions),f=PS(PS({method:"POST"},c),o),l={},d={},null!=n&&(l["IMX-Signature"]=String(n)),null!=i&&(l["IMX-Timestamp"]=String(i)),l["Content-Type"]="application/json",nS(u,d),h=c&&c.headers?c.headers:{},f.headers=PS(PS(PS({},l),h),o.headers),f.data=iS(s,f,e),t.abrupt("return",{url:sS(u),options:f});case 19:case"end":return t.stop()}}),t)}))),function(e,t,r,i){return n.apply(this,arguments)}),getMetadataSchema:(r=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getMetadataSchema","address",r),i="/v1/collections/{address}/metadata-schema".replace("{".concat("address","}"),encodeURIComponent(String(r))),s=new URL(i,eS),e&&(o=e.baseOptions),a=PS(PS({method:"GET"},o),n),u={},nS(s,{}),c=o&&o.headers?o.headers:{},a.headers=PS(PS(PS({},u),c),n.headers),t.abrupt("return",{url:sS(s),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return r.apply(this,arguments)}),updateMetadataSchemaByName:(t=_A(xA.mark((function t(r,n,i,s,o){var a,u,c,f,l,d,h,p,g=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=g.length>5&&void 0!==g[5]?g[5]:{},tS("updateMetadataSchemaByName","address",r),tS("updateMetadataSchemaByName","name",n),tS("updateMetadataSchemaByName","iMXSignature",i),tS("updateMetadataSchemaByName","iMXTimestamp",s),tS("updateMetadataSchemaByName","metadataSchemaRequest",o),u="/v1/collections/{address}/metadata-schema/{name}".replace("{".concat("address","}"),encodeURIComponent(String(r))).replace("{".concat("name","}"),encodeURIComponent(String(n))),c=new URL(u,eS),e&&(f=e.baseOptions),l=PS(PS({method:"PATCH"},f),a),d={},h={},null!=i&&(d["IMX-Signature"]=String(i)),null!=s&&(d["IMX-Timestamp"]=String(s)),d["Content-Type"]="application/json",nS(c,h),p=f&&f.headers?f.headers:{},l.headers=PS(PS(PS({},d),p),a.headers),l.data=iS(o,l,e),t.abrupt("return",{url:sS(c),options:l});case 20:case"end":return t.stop()}}),t)}))),function(e,r,n,i,s){return t.apply(this,arguments)})};var t,r,n}(e);return{addMetadataSchemaToCollection:function(r,n,i,s,o){return _A(xA.mark((function a(){var u;return xA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.addMetadataSchemaToCollection(r,n,i,s,o);case 2:return u=a.sent,a.abrupt("return",oS(u,YE,JA,e));case 4:case"end":return a.stop()}}),a)})))()},getMetadataSchema:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getMetadataSchema(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},updateMetadataSchemaByName:function(r,n,i,s,o,a){return _A(xA.mark((function u(){var c;return xA.wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,t.updateMetadataSchemaByName(r,n,i,s,o,a);case 2:return c=u.sent,u.abrupt("return",oS(c,YE,JA,e));case 4:case"end":return u.stop()}}),u)})))()}}},CS=function(e){dA(r,$A);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(){return QE(this,r),t.apply(this,arguments)}return eA(r,[{key:"addMetadataSchemaToCollection",value:function(e,t){var r=this;return NS(this.configuration).addMetadataSchemaToCollection(e.address,e.iMXSignature,e.iMXTimestamp,e.addMetadataSchemaToCollectionRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getMetadataSchema",value:function(e,t){var r=this;return NS(this.configuration).getMetadataSchema(e.address,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"updateMetadataSchemaByName",value:function(e,t){var r=this;return NS(this.configuration).updateMetadataSchemaByName(e.address,e.name,e.iMXSignature,e.iMXTimestamp,e.metadataSchemaRequest,t).then((function(e){return e(r.axios,r.basePath)}))}}]),r}();function BS(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 US(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?BS(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):BS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var LS=function(e){var t=function(e){return{getAListOfMetadataRefreshes:(i=_A(xA.mark((function t(r,n,i,s,o,a){var u,c,f,l,d,h,p,g=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=g.length>6&&void 0!==g[6]?g[6]:{},tS("getAListOfMetadataRefreshes","xImxEthSignature",r),tS("getAListOfMetadataRefreshes","xImxEthTimestamp",n),tS("getAListOfMetadataRefreshes","xImxEthAddress",i),c=new URL("/v1/metadata-refreshes",eS),e&&(f=e.baseOptions),l=US(US({method:"GET"},f),u),d={},h={},void 0!==s&&(h.page_size=s),void 0!==o&&(h.cursor=o),void 0!==a&&(h.collection_address=a),null!=r&&(d["x-imx-eth-signature"]=String(r)),null!=n&&(d["x-imx-eth-timestamp"]=String(n)),null!=i&&(d["x-imx-eth-address"]=String(i)),nS(c,h),p=f&&f.headers?f.headers:{},l.headers=US(US(US({},d),p),u.headers),t.abrupt("return",{url:sS(c),options:l});case 20:case"end":return t.stop()}}),t)}))),function(e,t,r,n,s,o){return i.apply(this,arguments)}),getMetadataRefreshErrors:(n=_A(xA.mark((function t(r,n,i,s,o,a){var u,c,f,l,d,h,p,g,m=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=m.length>6&&void 0!==m[6]?m[6]:{},tS("getMetadataRefreshErrors","refreshId",r),tS("getMetadataRefreshErrors","xImxEthSignature",n),tS("getMetadataRefreshErrors","xImxEthTimestamp",i),tS("getMetadataRefreshErrors","xImxEthAddress",s),c="/v1/metadata-refreshes/{refresh_id}/errors".replace("{".concat("refresh_id","}"),encodeURIComponent(String(r))),f=new URL(c,eS),e&&(l=e.baseOptions),d=US(US({method:"GET"},l),u),h={},p={},void 0!==o&&(p.page_size=o),void 0!==a&&(p.cursor=a),null!=n&&(h["x-imx-eth-signature"]=String(n)),null!=i&&(h["x-imx-eth-timestamp"]=String(i)),null!=s&&(h["x-imx-eth-address"]=String(s)),nS(f,p),g=l&&l.headers?l.headers:{},d.headers=US(US(US({},h),g),u.headers),t.abrupt("return",{url:sS(f),options:d});case 20:case"end":return t.stop()}}),t)}))),function(e,t,r,i,s,o){return n.apply(this,arguments)}),getMetadataRefreshResults:(r=_A(xA.mark((function t(r,n,i,s){var o,a,u,c,f,l,d,h,p=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=p.length>4&&void 0!==p[4]?p[4]:{},tS("getMetadataRefreshResults","refreshId",r),tS("getMetadataRefreshResults","xImxEthSignature",n),tS("getMetadataRefreshResults","xImxEthTimestamp",i),tS("getMetadataRefreshResults","xImxEthAddress",s),a="/v1/metadata-refreshes/{refresh_id}".replace("{".concat("refresh_id","}"),encodeURIComponent(String(r))),u=new URL(a,eS),e&&(c=e.baseOptions),f=US(US({method:"GET"},c),o),l={},d={},null!=n&&(l["x-imx-eth-signature"]=String(n)),null!=i&&(l["x-imx-eth-timestamp"]=String(i)),null!=s&&(l["x-imx-eth-address"]=String(s)),nS(u,d),h=c&&c.headers?c.headers:{},f.headers=US(US(US({},l),h),o.headers),t.abrupt("return",{url:sS(u),options:f});case 18:case"end":return t.stop()}}),t)}))),function(e,t,n,i){return r.apply(this,arguments)}),requestAMetadataRefresh:(t=_A(xA.mark((function t(r,n,i,s){var o,a,u,c,f,l,d,h=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=h.length>4&&void 0!==h[4]?h[4]:{},tS("requestAMetadataRefresh","xImxEthSignature",r),tS("requestAMetadataRefresh","xImxEthTimestamp",n),tS("requestAMetadataRefresh","xImxEthAddress",i),tS("requestAMetadataRefresh","createMetadataRefreshRequest",s),a=new URL("/v1/metadata-refreshes",eS),e&&(u=e.baseOptions),c=US(US({method:"POST"},u),o),f={},l={},null!=r&&(f["x-imx-eth-signature"]=String(r)),null!=n&&(f["x-imx-eth-timestamp"]=String(n)),null!=i&&(f["x-imx-eth-address"]=String(i)),f["Content-Type"]="application/json",nS(a,l),d=u&&u.headers?u.headers:{},c.headers=US(US(US({},f),d),o.headers),c.data=iS(s,c,e),t.abrupt("return",{url:sS(a),options:c});case 20:case"end":return t.stop()}}),t)}))),function(e,r,n,i){return t.apply(this,arguments)})};var t,r,n,i}(e);return{getAListOfMetadataRefreshes:function(r,n,i,s,o,a,u){return _A(xA.mark((function c(){var f;return xA.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,t.getAListOfMetadataRefreshes(r,n,i,s,o,a,u);case 2:return f=c.sent,c.abrupt("return",oS(f,YE,JA,e));case 4:case"end":return c.stop()}}),c)})))()},getMetadataRefreshErrors:function(r,n,i,s,o,a,u){return _A(xA.mark((function c(){var f;return xA.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,t.getMetadataRefreshErrors(r,n,i,s,o,a,u);case 2:return f=c.sent,c.abrupt("return",oS(f,YE,JA,e));case 4:case"end":return c.stop()}}),c)})))()},getMetadataRefreshResults:function(r,n,i,s,o){return _A(xA.mark((function a(){var u;return xA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.getMetadataRefreshResults(r,n,i,s,o);case 2:return u=a.sent,a.abrupt("return",oS(u,YE,JA,e));case 4:case"end":return a.stop()}}),a)})))()},requestAMetadataRefresh:function(r,n,i,s,o){return _A(xA.mark((function a(){var u;return xA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.requestAMetadataRefresh(r,n,i,s,o);case 2:return u=a.sent,a.abrupt("return",oS(u,YE,JA,e));case 4:case"end":return a.stop()}}),a)})))()}}},jS=function(e){dA(r,$A);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(){return QE(this,r),t.apply(this,arguments)}return eA(r,[{key:"getAListOfMetadataRefreshes",value:function(e,t){var r=this;return LS(this.configuration).getAListOfMetadataRefreshes(e.xImxEthSignature,e.xImxEthTimestamp,e.xImxEthAddress,e.pageSize,e.cursor,e.collectionAddress,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getMetadataRefreshErrors",value:function(e,t){var r=this;return LS(this.configuration).getMetadataRefreshErrors(e.refreshId,e.xImxEthSignature,e.xImxEthTimestamp,e.xImxEthAddress,e.pageSize,e.cursor,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getMetadataRefreshResults",value:function(e,t){var r=this;return LS(this.configuration).getMetadataRefreshResults(e.refreshId,e.xImxEthSignature,e.xImxEthTimestamp,e.xImxEthAddress,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"requestAMetadataRefresh",value:function(e,t){var r=this;return LS(this.configuration).requestAMetadataRefresh(e.xImxEthSignature,e.xImxEthTimestamp,e.xImxEthAddress,e.createMetadataRefreshRequest,t).then((function(e){return e(r.axios,r.basePath)}))}}]),r}();function DS(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 FS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?DS(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):DS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var qS=function(e){var t=function(e){return{getMint:(i=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getMint","id",r),i="/v1/mints/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),s=new URL(i,eS),e&&(o=e.baseOptions),a=FS(FS({method:"GET"},o),n),u={},nS(s,{}),c=o&&o.headers?o.headers:{},a.headers=FS(FS(FS({},u),c),n.headers),t.abrupt("return",{url:sS(s),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return i.apply(this,arguments)}),getMintableTokenDetailsByClientTokenId:(n=_A(xA.mark((function t(r,n){var i,s,o,a,u,c,f,l=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=l.length>2&&void 0!==l[2]?l[2]:{},tS("getMintableTokenDetailsByClientTokenId","tokenAddress",r),tS("getMintableTokenDetailsByClientTokenId","tokenId",n),s="/v1/mintable-token/{token_address}/{token_id}".replace("{".concat("token_address","}"),encodeURIComponent(String(r))).replace("{".concat("token_id","}"),encodeURIComponent(String(n))),o=new URL(s,eS),e&&(a=e.baseOptions),u=FS(FS({method:"GET"},a),i),c={},nS(o,{}),f=a&&a.headers?a.headers:{},u.headers=FS(FS(FS({},c),f),i.headers),t.abrupt("return",{url:sS(o),options:u});case 13:case"end":return t.stop()}}),t)}))),function(e,t){return n.apply(this,arguments)}),listMints:(r=_A(xA.mark((function t(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m){var y,b,v,w,_,E,A,S=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return y=S.length>15&&void 0!==S[15]?S[15]:{},b=new URL("/v1/mints",eS),e&&(v=e.baseOptions),w=FS(FS({method:"GET"},v),y),_={},E={},void 0!==r&&(E.page_size=r),void 0!==n&&(E.cursor=n),void 0!==i&&(E.order_by=i),void 0!==s&&(E.direction=s),void 0!==o&&(E.user=o),void 0!==a&&(E.status=a),void 0!==u&&(E.min_timestamp=u),void 0!==c&&(E.max_timestamp=c),void 0!==f&&(E.token_type=f),void 0!==l&&(E.token_id=l),void 0!==d&&(E.token_name=d),void 0!==h&&(E.token_address=h),void 0!==p&&(E.min_quantity=p),void 0!==g&&(E.max_quantity=g),void 0!==m&&(E.metadata=m),nS(b,E),A=v&&v.headers?v.headers:{},w.headers=FS(FS(FS({},_),A),y.headers),t.abrupt("return",{url:sS(b),options:w});case 26:case"end":return t.stop()}}),t)}))),function(e,t,n,i,s,o,a,u,c,f,l,d,h,p,g){return r.apply(this,arguments)}),mintTokens:(t=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("mintTokens","mintTokensRequestV2",r),i=new URL("/v2/mints",eS),e&&(s=e.baseOptions),o=FS(FS({method:"POST"},s),n),u={},(a={})["Content-Type"]="application/json",nS(i,u),c=s&&s.headers?s.headers:{},o.headers=FS(FS(FS({},a),c),n.headers),o.data=iS(r,o,e),t.abrupt("return",{url:sS(i),options:o});case 14:case"end":return t.stop()}}),t)}))),function(e){return t.apply(this,arguments)})};var t,r,n,i}(e);return{getMint:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getMint(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},getMintableTokenDetailsByClientTokenId:function(r,n,i){return _A(xA.mark((function s(){var o;return xA.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,t.getMintableTokenDetailsByClientTokenId(r,n,i);case 2:return o=s.sent,s.abrupt("return",oS(o,YE,JA,e));case 4:case"end":return s.stop()}}),s)})))()},listMints:function(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y){return _A(xA.mark((function b(){var v;return xA.wrap((function(b){for(;;)switch(b.prev=b.next){case 0:return b.next=2,t.listMints(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y);case 2:return v=b.sent,b.abrupt("return",oS(v,YE,JA,e));case 4:case"end":return b.stop()}}),b)})))()},mintTokens:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.mintTokens(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()}}},zS=function(e){dA(r,$A);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(){return QE(this,r),t.apply(this,arguments)}return eA(r,[{key:"getMint",value:function(e,t){var r=this;return qS(this.configuration).getMint(e.id,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getMintableTokenDetailsByClientTokenId",value:function(e,t){var r=this;return qS(this.configuration).getMintableTokenDetailsByClientTokenId(e.tokenAddress,e.tokenId,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listMints",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return qS(this.configuration).listMints(t.pageSize,t.cursor,t.orderBy,t.direction,t.user,t.status,t.minTimestamp,t.maxTimestamp,t.tokenType,t.tokenId,t.tokenName,t.tokenAddress,t.minQuantity,t.maxQuantity,t.metadata,r).then((function(t){return t(e.axios,e.basePath)}))}},{key:"mintTokens",value:function(e,t){var r=this;return qS(this.configuration).mintTokens(e.mintTokensRequestV2,t).then((function(e){return e(r.axios,r.basePath)}))}}]),r}();function KS(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 HS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?KS(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):KS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var GS=function(e){var t=function(e){return{createNftPrimary:(s=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("createNftPrimary","createAPIRequest",r),i=new URL("/v2/nft/primary",eS),e&&(s=e.baseOptions),o=HS(HS({method:"POST"},s),n),u={},(a={})["Content-Type"]="application/json",nS(i,u),c=s&&s.headers?s.headers:{},o.headers=HS(HS(HS({},a),c),n.headers),o.data=iS(r,o,e),t.abrupt("return",{url:sS(i),options:o});case 14:case"end":return t.stop()}}),t)}))),function(e){return s.apply(this,arguments)}),getCurrenciesNFTCheckoutPrimary:(i=_A(xA.mark((function t(r,n){var i,s,o,a,u,c,f,l=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=l.length>2&&void 0!==l[2]?l[2]:{},s=new URL("/v2/nft/primary/currencies",eS),e&&(o=e.baseOptions),a=HS(HS({method:"GET"},o),i),u={},c={},void 0!==r&&(c.provider=r),void 0!==n&&(c.include_limits=n),nS(s,c),f=o&&o.headers?o.headers:{},a.headers=HS(HS(HS({},u),f),i.headers),t.abrupt("return",{url:sS(s),options:a});case 13:case"end":return t.stop()}}),t)}))),function(e,t){return i.apply(this,arguments)}),getNftPrimaryTransaction:(n=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getNftPrimaryTransaction","transactionId",r),i="/v2/nft/primary/{transaction_id}".replace("{".concat("transaction_id","}"),encodeURIComponent(String(r))),s=new URL(i,eS),e&&(o=e.baseOptions),a=HS(HS({method:"GET"},o),n),u={},nS(s,{}),c=o&&o.headers?o.headers:{},a.headers=HS(HS(HS({},u),c),n.headers),t.abrupt("return",{url:sS(s),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),getNftPrimaryTransactions:(r=_A(xA.mark((function t(r,n,i,s,o,a,u,c,f,l,d){var h,p,g,m,y,b,v,w=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return h=w.length>11&&void 0!==w[11]?w[11]:{},p=new URL("/v2/nft/primary",eS),e&&(g=e.baseOptions),m=HS(HS({method:"GET"},g),h),y={},b={},void 0!==r&&(b.page_size=r),void 0!==n&&(b.cursor=n),void 0!==i&&(b.order_by=i),void 0!==s&&(b.direction=s),void 0!==o&&(b.transaction_id=o),void 0!==a&&(b.contract_address=a),void 0!==u&&(b.seller_wallet_address=u),void 0!==c&&(b.user_wallet_address=c),void 0!==f&&(b.status=f),void 0!==l&&(b.provider=l),void 0!==d&&(b.mint_id=d),nS(p,b),v=g&&g.headers?g.headers:{},m.headers=HS(HS(HS({},y),v),h.headers),t.abrupt("return",{url:sS(p),options:m});case 22:case"end":return t.stop()}}),t)}))),function(e,t,n,i,s,o,a,u,c,f,l){return r.apply(this,arguments)}),registerNftPrimarySalesContract:(t=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("registerNftPrimarySalesContract","createAPIRequest",r),i=new URL("/v2/nft/primary/register",eS),e&&(s=e.baseOptions),o=HS(HS({method:"POST"},s),n),u={},(a={})["Content-Type"]="application/json",nS(i,u),c=s&&s.headers?s.headers:{},o.headers=HS(HS(HS({},a),c),n.headers),o.data=iS(r,o,e),t.abrupt("return",{url:sS(i),options:o});case 14:case"end":return t.stop()}}),t)}))),function(e){return t.apply(this,arguments)})};var t,r,n,i,s}(e);return{createNftPrimary:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.createNftPrimary(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},getCurrenciesNFTCheckoutPrimary:function(r,n,i){return _A(xA.mark((function s(){var o;return xA.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,t.getCurrenciesNFTCheckoutPrimary(r,n,i);case 2:return o=s.sent,s.abrupt("return",oS(o,YE,JA,e));case 4:case"end":return s.stop()}}),s)})))()},getNftPrimaryTransaction:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getNftPrimaryTransaction(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},getNftPrimaryTransactions:function(r,n,i,s,o,a,u,c,f,l,d,h){return _A(xA.mark((function p(){var g;return xA.wrap((function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,t.getNftPrimaryTransactions(r,n,i,s,o,a,u,c,f,l,d,h);case 2:return g=p.sent,p.abrupt("return",oS(g,YE,JA,e));case 4:case"end":return p.stop()}}),p)})))()},registerNftPrimarySalesContract:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.registerNftPrimarySalesContract(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()}}},WS=function(e){dA(r,$A);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(){return QE(this,r),t.apply(this,arguments)}return eA(r,[{key:"createNftPrimary",value:function(e,t){var r=this;return GS(this.configuration).createNftPrimary(e.createAPIRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getCurrenciesNFTCheckoutPrimary",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return GS(this.configuration).getCurrenciesNFTCheckoutPrimary(t.provider,t.includeLimits,r).then((function(t){return t(e.axios,e.basePath)}))}},{key:"getNftPrimaryTransaction",value:function(e,t){var r=this;return GS(this.configuration).getNftPrimaryTransaction(e.transactionId,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getNftPrimaryTransactions",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return GS(this.configuration).getNftPrimaryTransactions(t.pageSize,t.cursor,t.orderBy,t.direction,t.transactionId,t.contractAddress,t.sellerWalletAddress,t.userWalletAddress,t.status,t.provider,t.mintId,r).then((function(t){return t(e.axios,e.basePath)}))}},{key:"registerNftPrimarySalesContract",value:function(e,t){var r=this;return GS(this.configuration).registerNftPrimarySalesContract(e.createAPIRequest,t).then((function(e){return e(r.axios,r.basePath)}))}}]),r}();function VS(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 XS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?VS(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):VS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var JS=function(e){var t=function(e){return{cancelOrder:(l=_A(xA.mark((function t(r,n,i,s,o){var a,u,c,f,l,d,h,p,g=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=g.length>5&&void 0!==g[5]?g[5]:{},tS("cancelOrder","id",r),tS("cancelOrder","cancelOrderRequest",n),u="/v1/orders/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),c=new URL(u,eS),e&&(f=e.baseOptions),l=XS(XS({method:"DELETE"},f),a),d={},h={},null!=i&&(d["x-imx-eth-address"]=String(i)),null!=s&&(d["x-imx-eth-signature"]=String(s)),null!=o&&(d.Authorization=String(o)),d["Content-Type"]="application/json",nS(c,h),p=f&&f.headers?f.headers:{},l.headers=XS(XS(XS({},d),p),a.headers),l.data=iS(n,l,e),t.abrupt("return",{url:sS(c),options:l});case 18:case"end":return t.stop()}}),t)}))),function(e,t,r,n,i){return l.apply(this,arguments)}),cancelOrderV3:(f=_A(xA.mark((function t(r,n,i,s,o){var a,u,c,f,l,d,h,p,g=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=g.length>5&&void 0!==g[5]?g[5]:{},tS("cancelOrderV3","id",r),tS("cancelOrderV3","cancelOrderRequest",n),u="/v3/orders/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),c=new URL(u,eS),e&&(f=e.baseOptions),l=XS(XS({method:"DELETE"},f),a),d={},h={},null!=i&&(d["x-imx-eth-address"]=String(i)),null!=s&&(d["x-imx-eth-signature"]=String(s)),null!=o&&(d.Authorization=String(o)),d["Content-Type"]="application/json",nS(c,h),p=f&&f.headers?f.headers:{},l.headers=XS(XS(XS({},d),p),a.headers),l.data=iS(n,l,e),t.abrupt("return",{url:sS(c),options:l});case 18:case"end":return t.stop()}}),t)}))),function(e,t,r,n,i){return f.apply(this,arguments)}),createOrder:(c=_A(xA.mark((function t(r,n,i,s){var o,a,u,c,f,l,d,h=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=h.length>4&&void 0!==h[4]?h[4]:{},tS("createOrder","createOrderRequest",r),a=new URL("/v1/orders",eS),e&&(u=e.baseOptions),c=XS(XS({method:"POST"},u),o),f={},l={},null!=n&&(f["x-imx-eth-address"]=String(n)),null!=i&&(f["x-imx-eth-signature"]=String(i)),null!=s&&(f.Authorization=String(s)),f["Content-Type"]="application/json",nS(a,l),d=u&&u.headers?u.headers:{},c.headers=XS(XS(XS({},f),d),o.headers),c.data=iS(r,c,e),t.abrupt("return",{url:sS(a),options:c});case 17:case"end":return t.stop()}}),t)}))),function(e,t,r,n){return c.apply(this,arguments)}),createOrderV3:(u=_A(xA.mark((function t(r,n,i,s){var o,a,u,c,f,l,d,h=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=h.length>4&&void 0!==h[4]?h[4]:{},tS("createOrderV3","createOrderRequest",r),a=new URL("/v3/orders",eS),e&&(u=e.baseOptions),c=XS(XS({method:"POST"},u),o),f={},l={},null!=n&&(f["x-imx-eth-address"]=String(n)),null!=i&&(f["x-imx-eth-signature"]=String(i)),null!=s&&(f.Authorization=String(s)),f["Content-Type"]="application/json",nS(a,l),d=u&&u.headers?u.headers:{},c.headers=XS(XS(XS({},f),d),o.headers),c.data=iS(r,c,e),t.abrupt("return",{url:sS(a),options:c});case 17:case"end":return t.stop()}}),t)}))),function(e,t,r,n){return u.apply(this,arguments)}),getOrder:(a=_A(xA.mark((function t(r,n,i,s){var o,a,u,c,f,l,d,h,p=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=p.length>4&&void 0!==p[4]?p[4]:{},tS("getOrder","id",r),a="/v1/orders/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),u=new URL(a,eS),e&&(c=e.baseOptions),f=XS(XS({method:"GET"},c),o),l={},d={},void 0!==n&&(d.include_fees=n),void 0!==i&&(d.auxiliary_fee_percentages=i),void 0!==s&&(d.auxiliary_fee_recipients=s),nS(u,d),h=c&&c.headers?c.headers:{},f.headers=XS(XS(XS({},l),h),o.headers),t.abrupt("return",{url:sS(u),options:f});case 15:case"end":return t.stop()}}),t)}))),function(e,t,r,n){return a.apply(this,arguments)}),getOrderV3:(o=_A(xA.mark((function t(r,n,i,s){var o,a,u,c,f,l,d,h,p=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=p.length>4&&void 0!==p[4]?p[4]:{},tS("getOrderV3","id",r),a="/v3/orders/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),u=new URL(a,eS),e&&(c=e.baseOptions),f=XS(XS({method:"GET"},c),o),l={},d={},void 0!==n&&(d.include_fees=n),void 0!==i&&(d.auxiliary_fee_percentages=i),void 0!==s&&(d.auxiliary_fee_recipients=s),nS(u,d),h=c&&c.headers?c.headers:{},f.headers=XS(XS(XS({},l),h),o.headers),t.abrupt("return",{url:sS(u),options:f});case 15:case"end":return t.stop()}}),t)}))),function(e,t,r,n){return o.apply(this,arguments)}),getSignableCancelOrder:(s=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getSignableCancelOrder","getSignableCancelOrderRequest",r),i=new URL("/v1/signable-cancel-order-details",eS),e&&(s=e.baseOptions),o=XS(XS({method:"POST"},s),n),u={},(a={})["Content-Type"]="application/json",nS(i,u),c=s&&s.headers?s.headers:{},o.headers=XS(XS(XS({},a),c),n.headers),o.data=iS(r,o,e),t.abrupt("return",{url:sS(i),options:o});case 14:case"end":return t.stop()}}),t)}))),function(e){return s.apply(this,arguments)}),getSignableCancelOrderV3:(i=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getSignableCancelOrderV3","getSignableCancelOrderRequest",r),i=new URL("/v3/signable-cancel-order-details",eS),e&&(s=e.baseOptions),o=XS(XS({method:"POST"},s),n),u={},(a={})["Content-Type"]="application/json",nS(i,u),c=s&&s.headers?s.headers:{},o.headers=XS(XS(XS({},a),c),n.headers),o.data=iS(r,o,e),t.abrupt("return",{url:sS(i),options:o});case 14:case"end":return t.stop()}}),t)}))),function(e){return i.apply(this,arguments)}),getSignableOrder:(n=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getSignableOrder","getSignableOrderRequestV3",r),i=new URL("/v3/signable-order-details",eS),e&&(s=e.baseOptions),o=XS(XS({method:"POST"},s),n),u={},(a={})["Content-Type"]="application/json",nS(i,u),c=s&&s.headers?s.headers:{},o.headers=XS(XS(XS({},a),c),n.headers),o.data=iS(r,o,e),t.abrupt("return",{url:sS(i),options:o});case 14:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),listOrders:(r=_A(xA.mark((function t(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O,I){var M,P,N,C,B,U,L,j=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return M=j.length>29&&void 0!==j[29]?j[29]:{},P=new URL("/v1/orders",eS),e&&(N=e.baseOptions),C=XS(XS({method:"GET"},N),M),B={},U={},void 0!==r&&(U.page_size=r),void 0!==n&&(U.cursor=n),void 0!==i&&(U.order_by=i),void 0!==s&&(U.direction=s),void 0!==o&&(U.user=o),void 0!==a&&(U.status=a),void 0!==u&&(U.min_timestamp=u),void 0!==c&&(U.max_timestamp=c),void 0!==f&&(U.updated_min_timestamp=f),void 0!==l&&(U.updated_max_timestamp=l),void 0!==d&&(U.buy_token_type=d),void 0!==h&&(U.buy_token_id=h),void 0!==p&&(U.buy_asset_id=p),void 0!==g&&(U.buy_token_address=g),void 0!==m&&(U.buy_token_name=m),void 0!==y&&(U.buy_min_quantity=y),void 0!==b&&(U.buy_max_quantity=b),void 0!==v&&(U.buy_metadata=v),void 0!==w&&(U.sell_token_type=w),void 0!==_&&(U.sell_token_id=_),void 0!==E&&(U.sell_asset_id=E),void 0!==A&&(U.sell_token_address=A),void 0!==S&&(U.sell_token_name=S),void 0!==k&&(U.sell_min_quantity=k),void 0!==x&&(U.sell_max_quantity=x),void 0!==T&&(U.sell_metadata=T),void 0!==R&&(U.auxiliary_fee_percentages=R),void 0!==O&&(U.auxiliary_fee_recipients=O),void 0!==I&&(U.include_fees=I),nS(P,U),L=N&&N.headers?N.headers:{},C.headers=XS(XS(XS({},B),L),M.headers),t.abrupt("return",{url:sS(P),options:C});case 40:case"end":return t.stop()}}),t)}))),function(e,t,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O){return r.apply(this,arguments)}),listOrdersV3:(t=_A(xA.mark((function t(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O,I){var M,P,N,C,B,U,L,j=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return M=j.length>29&&void 0!==j[29]?j[29]:{},P=new URL("/v3/orders",eS),e&&(N=e.baseOptions),C=XS(XS({method:"GET"},N),M),B={},U={},void 0!==r&&(U.page_size=r),void 0!==n&&(U.cursor=n),void 0!==i&&(U.order_by=i),void 0!==s&&(U.direction=s),void 0!==o&&(U.user=o),void 0!==a&&(U.status=a),void 0!==u&&(U.min_timestamp=u),void 0!==c&&(U.max_timestamp=c),void 0!==f&&(U.updated_min_timestamp=f),void 0!==l&&(U.updated_max_timestamp=l),void 0!==d&&(U.buy_token_type=d),void 0!==h&&(U.buy_token_id=h),void 0!==p&&(U.buy_asset_id=p),void 0!==g&&(U.buy_token_address=g),void 0!==m&&(U.buy_token_name=m),void 0!==y&&(U.buy_min_quantity=y),void 0!==b&&(U.buy_max_quantity=b),void 0!==v&&(U.buy_metadata=v),void 0!==w&&(U.sell_token_type=w),void 0!==_&&(U.sell_token_id=_),void 0!==E&&(U.sell_asset_id=E),void 0!==A&&(U.sell_token_address=A),void 0!==S&&(U.sell_token_name=S),void 0!==k&&(U.sell_min_quantity=k),void 0!==x&&(U.sell_max_quantity=x),void 0!==T&&(U.sell_metadata=T),void 0!==R&&(U.auxiliary_fee_percentages=R),void 0!==O&&(U.auxiliary_fee_recipients=O),void 0!==I&&(U.include_fees=I),nS(P,U),L=N&&N.headers?N.headers:{},C.headers=XS(XS(XS({},B),L),M.headers),t.abrupt("return",{url:sS(P),options:C});case 40:case"end":return t.stop()}}),t)}))),function(e,r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O){return t.apply(this,arguments)})};var t,r,n,i,s,o,a,u,c,f,l}(e);return{cancelOrder:function(r,n,i,s,o,a){return _A(xA.mark((function u(){var c;return xA.wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,t.cancelOrder(r,n,i,s,o,a);case 2:return c=u.sent,u.abrupt("return",oS(c,YE,JA,e));case 4:case"end":return u.stop()}}),u)})))()},cancelOrderV3:function(r,n,i,s,o,a){return _A(xA.mark((function u(){var c;return xA.wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,t.cancelOrderV3(r,n,i,s,o,a);case 2:return c=u.sent,u.abrupt("return",oS(c,YE,JA,e));case 4:case"end":return u.stop()}}),u)})))()},createOrder:function(r,n,i,s,o){return _A(xA.mark((function a(){var u;return xA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.createOrder(r,n,i,s,o);case 2:return u=a.sent,a.abrupt("return",oS(u,YE,JA,e));case 4:case"end":return a.stop()}}),a)})))()},createOrderV3:function(r,n,i,s,o){return _A(xA.mark((function a(){var u;return xA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.createOrderV3(r,n,i,s,o);case 2:return u=a.sent,a.abrupt("return",oS(u,YE,JA,e));case 4:case"end":return a.stop()}}),a)})))()},getOrder:function(r,n,i,s,o){return _A(xA.mark((function a(){var u;return xA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.getOrder(r,n,i,s,o);case 2:return u=a.sent,a.abrupt("return",oS(u,YE,JA,e));case 4:case"end":return a.stop()}}),a)})))()},getOrderV3:function(r,n,i,s,o){return _A(xA.mark((function a(){var u;return xA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.getOrderV3(r,n,i,s,o);case 2:return u=a.sent,a.abrupt("return",oS(u,YE,JA,e));case 4:case"end":return a.stop()}}),a)})))()},getSignableCancelOrder:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableCancelOrder(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},getSignableCancelOrderV3:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableCancelOrderV3(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},getSignableOrder:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableOrder(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},listOrders:function(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O,I,M){return _A(xA.mark((function P(){var N;return xA.wrap((function(P){for(;;)switch(P.prev=P.next){case 0:return P.next=2,t.listOrders(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O,I,M);case 2:return N=P.sent,P.abrupt("return",oS(N,YE,JA,e));case 4:case"end":return P.stop()}}),P)})))()},listOrdersV3:function(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O,I,M){return _A(xA.mark((function P(){var N;return xA.wrap((function(P){for(;;)switch(P.prev=P.next){case 0:return P.next=2,t.listOrdersV3(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O,I,M);case 2:return N=P.sent,P.abrupt("return",oS(N,YE,JA,e));case 4:case"end":return P.stop()}}),P)})))()}}},$S=function(e){dA(r,$A);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(){return QE(this,r),t.apply(this,arguments)}return eA(r,[{key:"cancelOrder",value:function(e,t){var r=this;return JS(this.configuration).cancelOrder(e.id,e.cancelOrderRequest,e.xImxEthAddress,e.xImxEthSignature,e.authorization,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"cancelOrderV3",value:function(e,t){var r=this;return JS(this.configuration).cancelOrderV3(e.id,e.cancelOrderRequest,e.xImxEthAddress,e.xImxEthSignature,e.authorization,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"createOrder",value:function(e,t){var r=this;return JS(this.configuration).createOrder(e.createOrderRequest,e.xImxEthAddress,e.xImxEthSignature,e.authorization,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"createOrderV3",value:function(e,t){var r=this;return JS(this.configuration).createOrderV3(e.createOrderRequest,e.xImxEthAddress,e.xImxEthSignature,e.authorization,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getOrder",value:function(e,t){var r=this;return JS(this.configuration).getOrder(e.id,e.includeFees,e.auxiliaryFeePercentages,e.auxiliaryFeeRecipients,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getOrderV3",value:function(e,t){var r=this;return JS(this.configuration).getOrderV3(e.id,e.includeFees,e.auxiliaryFeePercentages,e.auxiliaryFeeRecipients,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getSignableCancelOrder",value:function(e,t){var r=this;return JS(this.configuration).getSignableCancelOrder(e.getSignableCancelOrderRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getSignableCancelOrderV3",value:function(e,t){var r=this;return JS(this.configuration).getSignableCancelOrderV3(e.getSignableCancelOrderRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getSignableOrder",value:function(e,t){var r=this;return JS(this.configuration).getSignableOrder(e.getSignableOrderRequestV3,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listOrders",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return JS(this.configuration).listOrders(t.pageSize,t.cursor,t.orderBy,t.direction,t.user,t.status,t.minTimestamp,t.maxTimestamp,t.updatedMinTimestamp,t.updatedMaxTimestamp,t.buyTokenType,t.buyTokenId,t.buyAssetId,t.buyTokenAddress,t.buyTokenName,t.buyMinQuantity,t.buyMaxQuantity,t.buyMetadata,t.sellTokenType,t.sellTokenId,t.sellAssetId,t.sellTokenAddress,t.sellTokenName,t.sellMinQuantity,t.sellMaxQuantity,t.sellMetadata,t.auxiliaryFeePercentages,t.auxiliaryFeeRecipients,t.includeFees,r).then((function(t){return t(e.axios,e.basePath)}))}},{key:"listOrdersV3",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return JS(this.configuration).listOrdersV3(t.pageSize,t.cursor,t.orderBy,t.direction,t.user,t.status,t.minTimestamp,t.maxTimestamp,t.updatedMinTimestamp,t.updatedMaxTimestamp,t.buyTokenType,t.buyTokenId,t.buyAssetId,t.buyTokenAddress,t.buyTokenName,t.buyMinQuantity,t.buyMaxQuantity,t.buyMetadata,t.sellTokenType,t.sellTokenId,t.sellAssetId,t.sellTokenAddress,t.sellTokenName,t.sellMinQuantity,t.sellMaxQuantity,t.sellMetadata,t.auxiliaryFeePercentages,t.auxiliaryFeeRecipients,t.includeFees,r).then((function(t){return t(e.axios,e.basePath)}))}}]),r}();function YS(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 QS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?YS(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):YS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ZS=function(e){var t=function(e){return{createProject:(n=_A(xA.mark((function t(r,n,i){var s,o,a,u,c,f,l,d=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=d.length>3&&void 0!==d[3]?d[3]:{},tS("createProject","iMXSignature",r),tS("createProject","iMXTimestamp",n),tS("createProject","createProjectRequest",i),o=new URL("/v1/projects",eS),e&&(a=e.baseOptions),u=QS(QS({method:"POST"},a),s),c={},f={},null!=r&&(c["IMX-Signature"]=String(r)),null!=n&&(c["IMX-Timestamp"]=String(n)),c["Content-Type"]="application/json",nS(o,f),l=a&&a.headers?a.headers:{},u.headers=QS(QS(QS({},c),l),s.headers),u.data=iS(i,u,e),t.abrupt("return",{url:sS(o),options:u});case 18:case"end":return t.stop()}}),t)}))),function(e,t,r){return n.apply(this,arguments)}),getProject:(r=_A(xA.mark((function t(r,n,i){var s,o,a,u,c,f,l,d,h=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=h.length>3&&void 0!==h[3]?h[3]:{},tS("getProject","id",r),tS("getProject","iMXSignature",n),tS("getProject","iMXTimestamp",i),o="/v1/projects/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),a=new URL(o,eS),e&&(u=e.baseOptions),c=QS(QS({method:"GET"},u),s),f={},l={},null!=n&&(f["IMX-Signature"]=String(n)),null!=i&&(f["IMX-Timestamp"]=String(i)),nS(a,l),d=u&&u.headers?u.headers:{},c.headers=QS(QS(QS({},f),d),s.headers),t.abrupt("return",{url:sS(a),options:c});case 16:case"end":return t.stop()}}),t)}))),function(e,t,n){return r.apply(this,arguments)}),getProjects:(t=_A(xA.mark((function t(r,n,i,s,o,a){var u,c,f,l,d,h,p,g=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=g.length>6&&void 0!==g[6]?g[6]:{},tS("getProjects","iMXSignature",r),tS("getProjects","iMXTimestamp",n),c=new URL("/v1/projects",eS),e&&(f=e.baseOptions),l=QS(QS({method:"GET"},f),u),d={},h={},void 0!==i&&(h.page_size=i),void 0!==s&&(h.cursor=s),void 0!==o&&(h.order_by=o),void 0!==a&&(h.direction=a),null!=r&&(d["IMX-Signature"]=String(r)),null!=n&&(d["IMX-Timestamp"]=String(n)),nS(c,h),p=f&&f.headers?f.headers:{},l.headers=QS(QS(QS({},d),p),u.headers),t.abrupt("return",{url:sS(c),options:l});case 19:case"end":return t.stop()}}),t)}))),function(e,r,n,i,s,o){return t.apply(this,arguments)})};var t,r,n}(e);return{createProject:function(r,n,i,s){return _A(xA.mark((function o(){var a;return xA.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,t.createProject(r,n,i,s);case 2:return a=o.sent,o.abrupt("return",oS(a,YE,JA,e));case 4:case"end":return o.stop()}}),o)})))()},getProject:function(r,n,i,s){return _A(xA.mark((function o(){var a;return xA.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,t.getProject(r,n,i,s);case 2:return a=o.sent,o.abrupt("return",oS(a,YE,JA,e));case 4:case"end":return o.stop()}}),o)})))()},getProjects:function(r,n,i,s,o,a,u){return _A(xA.mark((function c(){var f;return xA.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,t.getProjects(r,n,i,s,o,a,u);case 2:return f=c.sent,c.abrupt("return",oS(f,YE,JA,e));case 4:case"end":return c.stop()}}),c)})))()}}},ek=function(e){dA(r,$A);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(){return QE(this,r),t.apply(this,arguments)}return eA(r,[{key:"createProject",value:function(e,t){var r=this;return ZS(this.configuration).createProject(e.iMXSignature,e.iMXTimestamp,e.createProjectRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getProject",value:function(e,t){var r=this;return ZS(this.configuration).getProject(e.id,e.iMXSignature,e.iMXTimestamp,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getProjects",value:function(e,t){var r=this;return ZS(this.configuration).getProjects(e.iMXSignature,e.iMXTimestamp,e.pageSize,e.cursor,e.orderBy,e.direction,t).then((function(e){return e(r.axios,r.basePath)}))}}]),r}();function tk(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 rk(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?tk(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tk(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var nk=function(e){var t=function(e){return{getToken:(r=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getToken","address",r),i="/v1/tokens/{address}".replace("{".concat("address","}"),encodeURIComponent(String(r))),s=new URL(i,eS),e&&(o=e.baseOptions),a=rk(rk({method:"GET"},o),n),u={},nS(s,{}),c=o&&o.headers?o.headers:{},a.headers=rk(rk(rk({},u),c),n.headers),t.abrupt("return",{url:sS(s),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return r.apply(this,arguments)}),listTokens:(t=_A(xA.mark((function t(r,n,i,s,o,a){var u,c,f,l,d,h,p,g=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=g.length>6&&void 0!==g[6]?g[6]:{},c=new URL("/v1/tokens",eS),e&&(f=e.baseOptions),l=rk(rk({method:"GET"},f),u),d={},h={},void 0!==r&&(h.page_size=r),void 0!==n&&(h.cursor=n),void 0!==i&&(h.order_by=i),void 0!==s&&(h.direction=s),void 0!==o&&(h.address=o),void 0!==a&&(h.symbols=a),nS(c,h),p=f&&f.headers?f.headers:{},l.headers=rk(rk(rk({},d),p),u.headers),t.abrupt("return",{url:sS(c),options:l});case 17:case"end":return t.stop()}}),t)}))),function(e,r,n,i,s,o){return t.apply(this,arguments)})};var t,r}(e);return{getToken:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getToken(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},listTokens:function(r,n,i,s,o,a,u){return _A(xA.mark((function c(){var f;return xA.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,t.listTokens(r,n,i,s,o,a,u);case 2:return f=c.sent,c.abrupt("return",oS(f,YE,JA,e));case 4:case"end":return c.stop()}}),c)})))()}}},ik=function(e){dA(r,$A);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(){return QE(this,r),t.apply(this,arguments)}return eA(r,[{key:"getToken",value:function(e,t){var r=this;return nk(this.configuration).getToken(e.address,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listTokens",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return nk(this.configuration).listTokens(t.pageSize,t.cursor,t.orderBy,t.direction,t.address,t.symbols,r).then((function(t){return t(e.axios,e.basePath)}))}}]),r}();function sk(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 ok(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?sk(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sk(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ak=function(e){var t=function(e){return{createTrade:(o=_A(xA.mark((function t(r,n,i,s){var o,a,u,c,f,l,d,h=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=h.length>4&&void 0!==h[4]?h[4]:{},tS("createTrade","createTradeRequest",r),a=new URL("/v1/trades",eS),e&&(u=e.baseOptions),c=ok(ok({method:"POST"},u),o),f={},l={},null!=n&&(f["x-imx-eth-address"]=String(n)),null!=i&&(f["x-imx-eth-signature"]=String(i)),null!=s&&(f.Authorization=String(s)),f["Content-Type"]="application/json",nS(a,l),d=u&&u.headers?u.headers:{},c.headers=ok(ok(ok({},f),d),o.headers),c.data=iS(r,c,e),t.abrupt("return",{url:sS(a),options:c});case 17:case"end":return t.stop()}}),t)}))),function(e,t,r,n){return o.apply(this,arguments)}),createTradeV3:(s=_A(xA.mark((function t(r,n,i,s){var o,a,u,c,f,l,d,h=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=h.length>4&&void 0!==h[4]?h[4]:{},tS("createTradeV3","createTradeRequest",r),a=new URL("/v3/trades",eS),e&&(u=e.baseOptions),c=ok(ok({method:"POST"},u),o),f={},l={},null!=n&&(f["x-imx-eth-address"]=String(n)),null!=i&&(f["x-imx-eth-signature"]=String(i)),null!=s&&(f.Authorization=String(s)),f["Content-Type"]="application/json",nS(a,l),d=u&&u.headers?u.headers:{},c.headers=ok(ok(ok({},f),d),o.headers),c.data=iS(r,c,e),t.abrupt("return",{url:sS(a),options:c});case 17:case"end":return t.stop()}}),t)}))),function(e,t,r,n){return s.apply(this,arguments)}),getSignableTrade:(i=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getSignableTrade","getSignableTradeRequest",r),i=new URL("/v3/signable-trade-details",eS),e&&(s=e.baseOptions),o=ok(ok({method:"POST"},s),n),u={},(a={})["Content-Type"]="application/json",nS(i,u),c=s&&s.headers?s.headers:{},o.headers=ok(ok(ok({},a),c),n.headers),o.data=iS(r,o,e),t.abrupt("return",{url:sS(i),options:o});case 14:case"end":return t.stop()}}),t)}))),function(e){return i.apply(this,arguments)}),getTrade:(n=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getTrade","id",r),i="/v1/trades/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),s=new URL(i,eS),e&&(o=e.baseOptions),a=ok(ok({method:"GET"},o),n),u={},nS(s,{}),c=o&&o.headers?o.headers:{},a.headers=ok(ok(ok({},u),c),n.headers),t.abrupt("return",{url:sS(s),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),listTrades:(r=_A(xA.mark((function t(r,n,i,s,o,a,u,c,f,l,d){var h,p,g,m,y,b,v,w=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return h=w.length>11&&void 0!==w[11]?w[11]:{},p=new URL("/v1/trades",eS),e&&(g=e.baseOptions),m=ok(ok({method:"GET"},g),h),y={},b={},void 0!==r&&(b.party_a_token_type=r),void 0!==n&&(b.party_a_token_address=n),void 0!==i&&(b.party_b_token_type=i),void 0!==s&&(b.party_b_token_address=s),void 0!==o&&(b.party_b_token_id=o),void 0!==a&&(b.page_size=a),void 0!==u&&(b.cursor=u),void 0!==c&&(b.order_by=c),void 0!==f&&(b.direction=f),void 0!==l&&(b.min_timestamp=l),void 0!==d&&(b.max_timestamp=d),nS(p,b),v=g&&g.headers?g.headers:{},m.headers=ok(ok(ok({},y),v),h.headers),t.abrupt("return",{url:sS(p),options:m});case 22:case"end":return t.stop()}}),t)}))),function(e,t,n,i,s,o,a,u,c,f,l){return r.apply(this,arguments)}),listTradesV3:(t=_A(xA.mark((function t(r,n,i,s,o,a,u,c,f,l,d){var h,p,g,m,y,b,v,w=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return h=w.length>11&&void 0!==w[11]?w[11]:{},p=new URL("/v3/trades",eS),e&&(g=e.baseOptions),m=ok(ok({method:"GET"},g),h),y={},b={},void 0!==r&&(b.party_a_token_type=r),void 0!==n&&(b.party_a_token_address=n),void 0!==i&&(b.party_b_token_type=i),void 0!==s&&(b.party_b_token_address=s),void 0!==o&&(b.party_b_token_id=o),void 0!==a&&(b.page_size=a),void 0!==u&&(b.cursor=u),void 0!==c&&(b.order_by=c),void 0!==f&&(b.direction=f),void 0!==l&&(b.min_timestamp=l),void 0!==d&&(b.max_timestamp=d),nS(p,b),v=g&&g.headers?g.headers:{},m.headers=ok(ok(ok({},y),v),h.headers),t.abrupt("return",{url:sS(p),options:m});case 22:case"end":return t.stop()}}),t)}))),function(e,r,n,i,s,o,a,u,c,f,l){return t.apply(this,arguments)})};var t,r,n,i,s,o}(e);return{createTrade:function(r,n,i,s,o){return _A(xA.mark((function a(){var u;return xA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.createTrade(r,n,i,s,o);case 2:return u=a.sent,a.abrupt("return",oS(u,YE,JA,e));case 4:case"end":return a.stop()}}),a)})))()},createTradeV3:function(r,n,i,s,o){return _A(xA.mark((function a(){var u;return xA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.createTradeV3(r,n,i,s,o);case 2:return u=a.sent,a.abrupt("return",oS(u,YE,JA,e));case 4:case"end":return a.stop()}}),a)})))()},getSignableTrade:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableTrade(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},getTrade:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getTrade(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},listTrades:function(r,n,i,s,o,a,u,c,f,l,d,h){return _A(xA.mark((function p(){var g;return xA.wrap((function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,t.listTrades(r,n,i,s,o,a,u,c,f,l,d,h);case 2:return g=p.sent,p.abrupt("return",oS(g,YE,JA,e));case 4:case"end":return p.stop()}}),p)})))()},listTradesV3:function(r,n,i,s,o,a,u,c,f,l,d,h){return _A(xA.mark((function p(){var g;return xA.wrap((function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,t.listTradesV3(r,n,i,s,o,a,u,c,f,l,d,h);case 2:return g=p.sent,p.abrupt("return",oS(g,YE,JA,e));case 4:case"end":return p.stop()}}),p)})))()}}},uk=function(e){dA(r,$A);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(){return QE(this,r),t.apply(this,arguments)}return eA(r,[{key:"createTrade",value:function(e,t){var r=this;return ak(this.configuration).createTrade(e.createTradeRequest,e.xImxEthAddress,e.xImxEthSignature,e.authorization,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"createTradeV3",value:function(e,t){var r=this;return ak(this.configuration).createTradeV3(e.createTradeRequest,e.xImxEthAddress,e.xImxEthSignature,e.authorization,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getSignableTrade",value:function(e,t){var r=this;return ak(this.configuration).getSignableTrade(e.getSignableTradeRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getTrade",value:function(e,t){var r=this;return ak(this.configuration).getTrade(e.id,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listTrades",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return ak(this.configuration).listTrades(t.partyATokenType,t.partyATokenAddress,t.partyBTokenType,t.partyBTokenAddress,t.partyBTokenId,t.pageSize,t.cursor,t.orderBy,t.direction,t.minTimestamp,t.maxTimestamp,r).then((function(t){return t(e.axios,e.basePath)}))}},{key:"listTradesV3",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return ak(this.configuration).listTradesV3(t.partyATokenType,t.partyATokenAddress,t.partyBTokenType,t.partyBTokenAddress,t.partyBTokenId,t.pageSize,t.cursor,t.orderBy,t.direction,t.minTimestamp,t.maxTimestamp,r).then((function(t){return t(e.axios,e.basePath)}))}}]),r}();function ck(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 fk(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ck(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ck(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var lk=function(e){var t=function(e){return{createTransfer:(o=_A(xA.mark((function t(r,n,i,s){var o,a,u,c,f,l,d,h=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=h.length>4&&void 0!==h[4]?h[4]:{},tS("createTransfer","createTransferRequestV2",r),a=new URL("/v2/transfers",eS),e&&(u=e.baseOptions),c=fk(fk({method:"POST"},u),o),f={},l={},null!=n&&(f["x-imx-eth-address"]=String(n)),null!=i&&(f["x-imx-eth-signature"]=String(i)),null!=s&&(f.Authorization=String(s)),f["Content-Type"]="application/json",nS(a,l),d=u&&u.headers?u.headers:{},c.headers=fk(fk(fk({},f),d),o.headers),c.data=iS(r,c,e),t.abrupt("return",{url:sS(a),options:c});case 17:case"end":return t.stop()}}),t)}))),function(e,t,r,n){return o.apply(this,arguments)}),createTransferV1:(s=_A(xA.mark((function t(r,n,i,s){var o,a,u,c,f,l,d,h=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=h.length>4&&void 0!==h[4]?h[4]:{},tS("createTransferV1","createTransferRequest",r),a=new URL("/v1/transfers",eS),e&&(u=e.baseOptions),c=fk(fk({method:"POST"},u),o),f={},l={},null!=n&&(f["x-imx-eth-address"]=String(n)),null!=i&&(f["x-imx-eth-signature"]=String(i)),null!=s&&(f.Authorization=String(s)),f["Content-Type"]="application/json",nS(a,l),d=u&&u.headers?u.headers:{},c.headers=fk(fk(fk({},f),d),o.headers),c.data=iS(r,c,e),t.abrupt("return",{url:sS(a),options:c});case 17:case"end":return t.stop()}}),t)}))),function(e,t,r,n){return s.apply(this,arguments)}),getSignableTransfer:(i=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getSignableTransfer","getSignableTransferRequestV2",r),i=new URL("/v2/signable-transfer-details",eS),e&&(s=e.baseOptions),o=fk(fk({method:"POST"},s),n),u={},(a={})["Content-Type"]="application/json",nS(i,u),c=s&&s.headers?s.headers:{},o.headers=fk(fk(fk({},a),c),n.headers),o.data=iS(r,o,e),t.abrupt("return",{url:sS(i),options:o});case 14:case"end":return t.stop()}}),t)}))),function(e){return i.apply(this,arguments)}),getSignableTransferV1:(n=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getSignableTransferV1","getSignableTransferRequest",r),i=new URL("/v1/signable-transfer-details",eS),e&&(s=e.baseOptions),o=fk(fk({method:"POST"},s),n),u={},(a={})["Content-Type"]="application/json",nS(i,u),c=s&&s.headers?s.headers:{},o.headers=fk(fk(fk({},a),c),n.headers),o.data=iS(r,o,e),t.abrupt("return",{url:sS(i),options:o});case 14:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),getTransfer:(r=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getTransfer","id",r),i="/v1/transfers/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),s=new URL(i,eS),e&&(o=e.baseOptions),a=fk(fk({method:"GET"},o),n),u={},nS(s,{}),c=o&&o.headers?o.headers:{},a.headers=fk(fk(fk({},u),c),n.headers),t.abrupt("return",{url:sS(s),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return r.apply(this,arguments)}),listTransfers:(t=_A(xA.mark((function t(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b){var v,w,_,E,A,S,k,x=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return v=x.length>17&&void 0!==x[17]?x[17]:{},w=new URL("/v1/transfers",eS),e&&(_=e.baseOptions),E=fk(fk({method:"GET"},_),v),A={},S={},void 0!==r&&(S.page_size=r),void 0!==n&&(S.cursor=n),void 0!==i&&(S.order_by=i),void 0!==s&&(S.direction=s),void 0!==o&&(S.user=o),void 0!==a&&(S.receiver=a),void 0!==u&&(S.status=u),void 0!==c&&(S.min_timestamp=c),void 0!==f&&(S.max_timestamp=f),void 0!==l&&(S.token_type=l),void 0!==d&&(S.token_id=d),void 0!==h&&(S.asset_id=h),void 0!==p&&(S.token_address=p),void 0!==g&&(S.token_name=g),void 0!==m&&(S.min_quantity=m),void 0!==y&&(S.max_quantity=y),void 0!==b&&(S.metadata=b),nS(w,S),k=_&&_.headers?_.headers:{},E.headers=fk(fk(fk({},A),k),v.headers),t.abrupt("return",{url:sS(w),options:E});case 28:case"end":return t.stop()}}),t)}))),function(e,r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y){return t.apply(this,arguments)})};var t,r,n,i,s,o}(e);return{createTransfer:function(r,n,i,s,o){return _A(xA.mark((function a(){var u;return xA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.createTransfer(r,n,i,s,o);case 2:return u=a.sent,a.abrupt("return",oS(u,YE,JA,e));case 4:case"end":return a.stop()}}),a)})))()},createTransferV1:function(r,n,i,s,o){return _A(xA.mark((function a(){var u;return xA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.createTransferV1(r,n,i,s,o);case 2:return u=a.sent,a.abrupt("return",oS(u,YE,JA,e));case 4:case"end":return a.stop()}}),a)})))()},getSignableTransfer:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableTransfer(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},getSignableTransferV1:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableTransferV1(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},getTransfer:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getTransfer(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},listTransfers:function(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b,v){return _A(xA.mark((function w(){var _;return xA.wrap((function(w){for(;;)switch(w.prev=w.next){case 0:return w.next=2,t.listTransfers(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b,v);case 2:return _=w.sent,w.abrupt("return",oS(_,YE,JA,e));case 4:case"end":return w.stop()}}),w)})))()}}},dk=function(e){dA(r,$A);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(){return QE(this,r),t.apply(this,arguments)}return eA(r,[{key:"createTransfer",value:function(e,t){var r=this;return lk(this.configuration).createTransfer(e.createTransferRequestV2,e.xImxEthAddress,e.xImxEthSignature,e.authorization,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"createTransferV1",value:function(e,t){var r=this;return lk(this.configuration).createTransferV1(e.createTransferRequest,e.xImxEthAddress,e.xImxEthSignature,e.authorization,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getSignableTransfer",value:function(e,t){var r=this;return lk(this.configuration).getSignableTransfer(e.getSignableTransferRequestV2,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getSignableTransferV1",value:function(e,t){var r=this;return lk(this.configuration).getSignableTransferV1(e.getSignableTransferRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getTransfer",value:function(e,t){var r=this;return lk(this.configuration).getTransfer(e.id,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listTransfers",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return lk(this.configuration).listTransfers(t.pageSize,t.cursor,t.orderBy,t.direction,t.user,t.receiver,t.status,t.minTimestamp,t.maxTimestamp,t.tokenType,t.tokenId,t.assetId,t.tokenAddress,t.tokenName,t.minQuantity,t.maxQuantity,t.metadata,r).then((function(t){return t(e.axios,e.basePath)}))}}]),r}();function hk(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 pk(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?hk(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hk(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var gk=function(e){var t=function(e){return{getSignableRegistration:(s=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getSignableRegistration","getSignableRegistrationRequest",r),i=new URL("/v1/signable-registration",eS),e&&(s=e.baseOptions),o=pk(pk({method:"POST"},s),n),u={},(a={})["Content-Type"]="application/json",nS(i,u),c=s&&s.headers?s.headers:{},o.headers=pk(pk(pk({},a),c),n.headers),o.data=iS(r,o,e),t.abrupt("return",{url:sS(i),options:o});case 14:case"end":return t.stop()}}),t)}))),function(e){return s.apply(this,arguments)}),getSignableRegistrationOffchain:(i=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getSignableRegistrationOffchain","getSignableRegistrationRequest",r),i=new URL("/v1/signable-registration-offchain",eS),e&&(s=e.baseOptions),o=pk(pk({method:"POST"},s),n),u={},(a={})["Content-Type"]="application/json",nS(i,u),c=s&&s.headers?s.headers:{},o.headers=pk(pk(pk({},a),c),n.headers),o.data=iS(r,o,e),t.abrupt("return",{url:sS(i),options:o});case 14:case"end":return t.stop()}}),t)}))),function(e){return i.apply(this,arguments)}),getUsers:(n=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getUsers","user",r),i="/v1/users/{user}".replace("{".concat("user","}"),encodeURIComponent(String(r))),s=new URL(i,eS),e&&(o=e.baseOptions),a=pk(pk({method:"GET"},o),n),u={},nS(s,{}),c=o&&o.headers?o.headers:{},a.headers=pk(pk(pk({},u),c),n.headers),t.abrupt("return",{url:sS(s),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),registerPassportUser:(r=_A(xA.mark((function t(r,n){var i,s,o,a,u,c,f,l=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=l.length>2&&void 0!==l[2]?l[2]:{},tS("registerPassportUser","authorization",r),tS("registerPassportUser","registerPassportUserRequest",n),s=new URL("/v1/passport/users",eS),e&&(o=e.baseOptions),a=pk(pk({method:"POST"},o),i),u={},c={},null!=r&&(u.Authorization=String(r)),u["Content-Type"]="application/json",nS(s,c),f=o&&o.headers?o.headers:{},a.headers=pk(pk(pk({},u),f),i.headers),a.data=iS(n,a,e),t.abrupt("return",{url:sS(s),options:a});case 16:case"end":return t.stop()}}),t)}))),function(e,t){return r.apply(this,arguments)}),registerUser:(t=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("registerUser","registerUserRequest",r),i=new URL("/v1/users",eS),e&&(s=e.baseOptions),o=pk(pk({method:"POST"},s),n),u={},(a={})["Content-Type"]="application/json",nS(i,u),c=s&&s.headers?s.headers:{},o.headers=pk(pk(pk({},a),c),n.headers),o.data=iS(r,o,e),t.abrupt("return",{url:sS(i),options:o});case 14:case"end":return t.stop()}}),t)}))),function(e){return t.apply(this,arguments)})};var t,r,n,i,s}(e);return{getSignableRegistration:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableRegistration(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},getSignableRegistrationOffchain:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableRegistrationOffchain(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},getUsers:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getUsers(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},registerPassportUser:function(r,n,i){return _A(xA.mark((function s(){var o;return xA.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,t.registerPassportUser(r,n,i);case 2:return o=s.sent,s.abrupt("return",oS(o,YE,JA,e));case 4:case"end":return s.stop()}}),s)})))()},registerUser:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.registerUser(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()}}},mk=function(e){dA(r,$A);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(){return QE(this,r),t.apply(this,arguments)}return eA(r,[{key:"getSignableRegistration",value:function(e,t){var r=this;return gk(this.configuration).getSignableRegistration(e.getSignableRegistrationRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getSignableRegistrationOffchain",value:function(e,t){var r=this;return gk(this.configuration).getSignableRegistrationOffchain(e.getSignableRegistrationRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getUsers",value:function(e,t){var r=this;return gk(this.configuration).getUsers(e.user,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"registerPassportUser",value:function(e,t){var r=this;return gk(this.configuration).registerPassportUser(e.authorization,e.registerPassportUserRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"registerUser",value:function(e,t){var r=this;return gk(this.configuration).registerUser(e.registerUserRequest,t).then((function(e){return e(r.axios,r.basePath)}))}}]),r}();function yk(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 bk(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?yk(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yk(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var vk=function(e){var t=function(e){return{createWithdrawal:(i=_A(xA.mark((function t(r,n,i){var s,o,a,u,c,f,l,d=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=d.length>3&&void 0!==d[3]?d[3]:{},tS("createWithdrawal","xImxEthAddress",r),tS("createWithdrawal","xImxEthSignature",n),tS("createWithdrawal","createWithdrawalRequest",i),o=new URL("/v1/withdrawals",eS),e&&(a=e.baseOptions),u=bk(bk({method:"POST"},a),s),c={},f={},null!=r&&(c["x-imx-eth-address"]=String(r)),null!=n&&(c["x-imx-eth-signature"]=String(n)),c["Content-Type"]="application/json",nS(o,f),l=a&&a.headers?a.headers:{},u.headers=bk(bk(bk({},c),l),s.headers),u.data=iS(i,u,e),t.abrupt("return",{url:sS(o),options:u});case 18:case"end":return t.stop()}}),t)}))),function(e,t,r){return i.apply(this,arguments)}),getSignableWithdrawal:(n=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getSignableWithdrawal","getSignableWithdrawalRequest",r),i=new URL("/v1/signable-withdrawal-details",eS),e&&(s=e.baseOptions),o=bk(bk({method:"POST"},s),n),u={},(a={})["Content-Type"]="application/json",nS(i,u),c=s&&s.headers?s.headers:{},o.headers=bk(bk(bk({},a),c),n.headers),o.data=iS(r,o,e),t.abrupt("return",{url:sS(i),options:o});case 14:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),getWithdrawal:(r=_A(xA.mark((function t(r){var n,i,s,o,a,u,c,f=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},tS("getWithdrawal","id",r),i="/v1/withdrawals/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),s=new URL(i,eS),e&&(o=e.baseOptions),a=bk(bk({method:"GET"},o),n),u={},nS(s,{}),c=o&&o.headers?o.headers:{},a.headers=bk(bk(bk({},u),c),n.headers),t.abrupt("return",{url:sS(s),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return r.apply(this,arguments)}),listWithdrawals:(t=_A(xA.mark((function t(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b,v){var w,_,E,A,S,k,x,T=arguments;return xA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return w=T.length>18&&void 0!==T[18]?T[18]:{},_=new URL("/v1/withdrawals",eS),e&&(E=e.baseOptions),A=bk(bk({method:"GET"},E),w),S={},k={},void 0!==r&&(k.withdrawn_to_wallet=r),void 0!==n&&(k.rollup_status=n),void 0!==i&&(k.page_size=i),void 0!==s&&(k.cursor=s),void 0!==o&&(k.order_by=o),void 0!==a&&(k.direction=a),void 0!==u&&(k.user=u),void 0!==c&&(k.status=c),void 0!==f&&(k.min_timestamp=f),void 0!==l&&(k.max_timestamp=l),void 0!==d&&(k.token_type=d),void 0!==h&&(k.token_id=h),void 0!==p&&(k.asset_id=p),void 0!==g&&(k.token_address=g),void 0!==m&&(k.token_name=m),void 0!==y&&(k.min_quantity=y),void 0!==b&&(k.max_quantity=b),void 0!==v&&(k.metadata=v),nS(_,k),x=E&&E.headers?E.headers:{},A.headers=bk(bk(bk({},S),x),w.headers),t.abrupt("return",{url:sS(_),options:A});case 29:case"end":return t.stop()}}),t)}))),function(e,r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b){return t.apply(this,arguments)})};var t,r,n,i}(e);return{createWithdrawal:function(r,n,i,s){return _A(xA.mark((function o(){var a;return xA.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,t.createWithdrawal(r,n,i,s);case 2:return a=o.sent,o.abrupt("return",oS(a,YE,JA,e));case 4:case"end":return o.stop()}}),o)})))()},getSignableWithdrawal:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableWithdrawal(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},getWithdrawal:function(r,n){return _A(xA.mark((function i(){var s;return xA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getWithdrawal(r,n);case 2:return s=i.sent,i.abrupt("return",oS(s,YE,JA,e));case 4:case"end":return i.stop()}}),i)})))()},listWithdrawals:function(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b,v,w){return _A(xA.mark((function _(){var E;return xA.wrap((function(_){for(;;)switch(_.prev=_.next){case 0:return _.next=2,t.listWithdrawals(r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b,v,w);case 2:return E=_.sent,_.abrupt("return",oS(E,YE,JA,e));case 4:case"end":return _.stop()}}),_)})))()}}},wk=function(e){dA(r,$A);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(){return QE(this,r),t.apply(this,arguments)}return eA(r,[{key:"createWithdrawal",value:function(e,t){var r=this;return vk(this.configuration).createWithdrawal(e.xImxEthAddress,e.xImxEthSignature,e.createWithdrawalRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getSignableWithdrawal",value:function(e,t){var r=this;return vk(this.configuration).getSignableWithdrawal(e.getSignableWithdrawalRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getWithdrawal",value:function(e,t){var r=this;return vk(this.configuration).getWithdrawal(e.id,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listWithdrawals",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return vk(this.configuration).listWithdrawals(t.withdrawnToWallet,t.rollupStatus,t.pageSize,t.cursor,t.orderBy,t.direction,t.user,t.status,t.minTimestamp,t.maxTimestamp,t.tokenType,t.tokenId,t.assetId,t.tokenAddress,t.tokenName,t.minQuantity,t.maxQuantity,t.metadata,r).then((function(t){return t(e.axios,e.basePath)}))}}]),r}(),_k=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};QE(this,e),this.apiKey=t.apiKey,this.username=t.username,this.password=t.password,this.accessToken=t.accessToken,this.basePath=t.basePath,this.baseOptions=t.baseOptions,this.formDataCtor=t.formDataCtor}return eA(e,[{key:"isJsonMime",value:function(e){var t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}]),e}();let Ek=!1,Ak=!1;const Sk={debug:1,default:2,info:2,warning:3,error:4,off:5};let kk=Sk.default,xk=null;const Tk=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 Rk,Ok;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(Rk||(Rk={})),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"}(Ok||(Ok={}));const Ik="0123456789abcdef";class Mk{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==Sk[r]&&this.throwArgumentError("invalid log level name","logLevel",e),kk>Sk[r]||console.log.apply(console,t)}debug(...e){this._log(Mk.levels.DEBUG,e)}info(...e){this._log(Mk.levels.INFO,e)}warn(...e){this._log(Mk.levels.WARNING,e)}makeError(e,t,r){if(Ak)return this.makeError("censored error",t,{});t||(t=Mk.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<t.length;e++)r+=Ik[t[e]>>4],r+=Ik[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 s="";switch(t){case Ok.NUMERIC_FAULT:{s="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":s+="-"+t;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case Ok.CALL_EXCEPTION:case Ok.INSUFFICIENT_FUNDS:case Ok.MISSING_NEW:case Ok.NONCE_EXPIRED:case Ok.REPLACEMENT_UNDERPRICED:case Ok.TRANSACTION_REPLACED:case Ok.UNPREDICTABLE_GAS_LIMIT:s=t}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const o=new Error(e);return o.reason=i,o.code=t,Object.keys(r).forEach((function(e){o[e]=r[e]})),o}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,Mk.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){Tk&&this.throwError("platform missing String.prototype.normalize",Mk.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Tk})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,Mk.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,Mk.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",e<t&&this.throwError("missing argument"+r,Mk.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+r,Mk.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",Mk.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",Mk.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",Mk.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return xk||(xk=new Mk("logger/5.7.0")),xk}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",Mk.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Ek){if(!e)return;this.globalLogger().throwError("error censorship permanent",Mk.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Ak=!!e,Ek=!!t}static setLogLevel(e){const t=Sk[e.toLowerCase()];null!=t?kk=t:Mk.globalLogger().warn("invalid log level - "+e)}static from(e){return new Mk(e)}}Mk.errors=Ok,Mk.levels=Rk,Mk.errors.INSUFFICIENT_FUNDS,Mk.errors.NONCE_EXPIRED,Mk.errors.REPLACEMENT_UNDERPRICED;var Pk=function(e){dA(r,XA(Error));var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cA(e);if(t){var i=cA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gA(this,r)}}(r);function r(e){var n,i=e.code,s=e.details,o=e.message;return QE(this,r),(n=t.call(this,o)).code=i,n.details=s,n}return eA(r)}();function Nk(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 Ck(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Nk(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nk(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Bk={"x-sdk-version":"imx-core-sdk-ts-".concat("1.1.0")},Uk=function(e){var t=e.coreContractAddress,r=e.registrationContractAddress,n=e.chainID,i=e.basePath,s=e.headers,o=e.sdkVersion;if(!i.trim())throw Error("basePath can not be empty");return o&&(Bk["x-sdk-version"]=o),s=Ck(Ck({},s||{}),Bk),{apiConfiguration:new _k({basePath:i,baseOptions:{headers:s}}),ethConfiguration:{coreContractAddress:t,registrationContractAddress:r,chainID:n}}},Lk={get PRODUCTION(){return Uk({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"})},get SANDBOX(){return Uk({basePath:"https://api.sandbox.x.immutable.com",chainID:5,coreContractAddress:"0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623",registrationContractAddress:"0x1C97Ada273C9A52253f463042f29117090Cd7D83"})},createConfig:Uk};function jk(e){return Dk.apply(this,arguments)}function Dk(){return(Dk=_A(xA.mark((function e(t){var r,n,i,s,o,a,u,c,f,l,d,h;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.usersApi,e.next=3,r.getAddress();case 3:return s=e.sent,e.next=6,n.getAddress();case 6:return o=e.sent,e.next=9,i.getSignableRegistrationOffchain({getSignableRegistrationRequest:{ether_key:s,stark_key:o}});case 9:return a=e.sent,u=a.data,c=u.signable_message,f=u.payload_hash,e.next=13,IA(c,r);case 13:return l=e.sent,e.next=16,n.signMessage(f);case 16:return d=e.sent,e.next=19,i.registerUser({registerUserRequest:{eth_signature:l,ether_key:s,stark_signature:d,stark_key:o}});case 19:return h=e.sent,e.abrupt("return",h.data);case 21:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Fk(e,t){return qk.apply(this,arguments)}function qk(){return(qk=_A(xA.mark((function e(t,r){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.isRegistered(t);case 3:return e.abrupt("return",e.sent);case 6:if(e.prev=6,e.t0=e.catch(0),"USER_UNREGISTERED"!==e.t0.reason){e.next=10;break}return e.abrupt("return",!1);case 10:throw e.t0;case 11:case"end":return e.stop()}}),e,null,[[0,6]])})))).apply(this,arguments)}function zk(e,t,r){return Kk.apply(this,arguments)}function Kk(){return(Kk=_A(xA.mark((function e(t,r,n){var i;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.getSignableRegistration({getSignableRegistrationRequest:{ether_key:t,stark_key:r}});case 2:return i=e.sent,e.abrupt("return",{operator_signature:i.data.operator_signature,payload_hash:i.data.payload_hash});case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Hk,Gk={exports:{}};
24
+ /**
25
+ * [js-sha3]{@link https://github.com/emn178/js-sha3}
26
+ *
27
+ * @version 0.8.0
28
+ * @author Chen, Yi-Cyuan [emn178@gmail.com]
29
+ * @copyright Chen, Yi-Cyuan 2015-2018
30
+ * @license MIT
31
+ */Hk=Gk,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 process&&process.versions&&process.versions.node?r=EA:n&&(r=self);var i=!r.JS_SHA3_NO_COMMON_JS&&Hk.exports,s=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,o="0123456789abcdef".split(""),a=[4,1024,262144,67108864],u=[0,8,16,24],c=[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],f=[224,256,384,512],l=[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)}),!s||!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 O(e,t,e).update(n)[r]()}},g=function(e,t,r){return function(n,i){return new O(e,t,i).update(n)[r]()}},m=function(e,t,r){return function(t,n,i,s){return _["cshake"+e].update(t,n,i,s)[r]()}},y=function(e,t,r){return function(t,n,i,s){return _["kmac"+e].update(t,n,i,s)[r]()}},b=function(e,t,r,n){for(var i=0;i<d.length;++i){var s=d[i];e[s]=t(r,n,s)}return e},v=function(e,t){var r=p(e,t,"hex");return r.create=function(){return new O(e,t,e)},r.update=function(e){return r.create().update(e)},b(r,p,e,t)},w=[{name:"keccak",padding:[1,256,65536,16777216],bits:f,createMethod:v},{name:"sha3",padding:[6,1536,393216,100663296],bits:f,createMethod:v},{name:"shake",padding:[31,7936,2031616,520093696],bits:l,createMethod:function(e,t){var r=g(e,t,"hex");return r.create=function(r){return new O(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},b(r,g,e,t)}},{name:"cshake",padding:a,bits:l,createMethod:function(e,t){var r=h[e],n=m(e,0,"hex");return n.create=function(n,i,s){return i||s?new O(e,t,n).bytepad([i,s],r):_["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},b(n,m,e,t)}},{name:"kmac",padding:a,bits:l,createMethod:function(e,t){var r=h[e],n=y(e,0,"hex");return n.create=function(n,i,s){return new I(e,t,i).bytepad(["KMAC",s],r).bytepad([n],r)},n.update=function(e,t,r,i){return n.create(e,r,i).update(t)},b(n,y,e,t)}}],_={},E=[],A=0;A<w.length;++A)for(var S=w[A],k=S.bits,x=0;x<k.length;++x){var T=S.name+"_"+k[x];if(E.push(T),_[T]=S.createMethod(k[x],S.padding),"sha3"!==S.name){var R=S.name+k[x];E.push(R),_[R]=_[T]}}function O(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>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 I(e,t,r){O.call(this,e,t,r)}O.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(s&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||s&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}for(var i,o,a=this.blocks,c=this.byteCount,f=t.length,l=this.blockCount,d=0,h=this.s;d<f;){if(this.reset)for(this.reset=!1,a[0]=this.block,i=1;i<l+1;++i)a[i]=0;if(r)for(i=this.start;d<f&&i<c;++d)a[i>>2]|=t[d]<<u[3&i++];else for(i=this.start;d<f&&i<c;++d)(o=t.charCodeAt(d))<128?a[i>>2]|=o<<u[3&i++]:o<2048?(a[i>>2]|=(192|o>>6)<<u[3&i++],a[i>>2]|=(128|63&o)<<u[3&i++]):o<55296||o>=57344?(a[i>>2]|=(224|o>>12)<<u[3&i++],a[i>>2]|=(128|o>>6&63)<<u[3&i++],a[i>>2]|=(128|63&o)<<u[3&i++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++d)),a[i>>2]|=(240|o>>18)<<u[3&i++],a[i>>2]|=(128|o>>12&63)<<u[3&i++],a[i>>2]|=(128|o>>6&63)<<u[3&i++],a[i>>2]|=(128|63&o)<<u[3&i++]);if(this.lastByteIndex=i,i>=c){for(this.start=i-c,this.block=a[l],i=0;i<l;++i)h[i]^=a[i];M(h),this.reset=!0}else this.start=i}return this},O.prototype.encode=function(e,t){var r=255&e,n=1,i=[r];for(r=255&(e>>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},O.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(s&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||s&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}var i=0,o=t.length;if(r)i=o;else for(var a=0;a<t.length;++a){var u=t.charCodeAt(a);u<128?i+=1:u<2048?i+=2:u<55296||u>=57344?i+=3:(u=65536+((1023&u)<<10|1023&t.charCodeAt(++a)),i+=4)}return i+=this.encode(8*i),this.update(t),i},O.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n<e.length;++n)r+=this.encodeString(e[n]);var i=t-r%t,s=[];return s.length=i,this.update(s),this},O.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];M(n)}},O.prototype.toString=O.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,s=0,a=0,u="";a<n;){for(s=0;s<t&&a<n;++s,++a)e=r[s],u+=o[e>>4&15]+o[15&e]+o[e>>12&15]+o[e>>8&15]+o[e>>20&15]+o[e>>16&15]+o[e>>28&15]+o[e>>24&15];a%t==0&&(M(r),s=0)}return i&&(e=r[s],u+=o[e>>4&15]+o[15&e],i>1&&(u+=o[e>>12&15]+o[e>>8&15]),i>2&&(u+=o[e>>20&15]+o[e>>16&15])),u},O.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,s=0,o=0,a=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var u=new Uint32Array(e);o<n;){for(s=0;s<t&&o<n;++s,++o)u[o]=r[s];o%t==0&&M(r)}return i&&(u[s]=r[s],e=e.slice(0,a)),e},O.prototype.buffer=O.prototype.arrayBuffer,O.prototype.digest=O.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,s=this.extraBytes,o=0,a=0,u=[];a<i;){for(o=0;o<r&&a<i;++o,++a)e=a<<2,t=n[o],u[e]=255&t,u[e+1]=t>>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;a%r==0&&M(n)}return s&&(e=a<<2,t=n[o],u[e]=255&t,s>1&&(u[e+1]=t>>8&255),s>2&&(u[e+2]=t>>16&255)),u},I.prototype=new O,I.prototype.finalize=function(){return this.encode(this.outputBits,!0),O.prototype.finalize.call(this)};var M=function(e){var t,r,n,i,s,o,a,u,f,l,d,h,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O,I,M,P,N,C,B,U,L,j,D,F,q,z,K,H,G,W,V,X,J,$,Y,Q,Z,ee,te,re,ne,ie,se,oe,ae,ue,ce,fe;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],s=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],f=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])^(o<<1|a>>>31),r=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|o>>>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^(u<<1|f>>>31),r=s^(f<<1|u>>>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=o^(l<<1|d>>>31),r=a^(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=u^(h<<1|p>>>31),r=f^(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|s>>>31),r=d^(s<<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,g=e[0],m=e[1],V=e[11]<<4|e[10]>>>28,X=e[10]<<4|e[11]>>>28,O=e[20]<<3|e[21]>>>29,I=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ue=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,H=e[41]<<18|e[40]>>>14,B=e[2]<<1|e[3]>>>31,U=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,b=e[12]<<12|e[13]>>>20,J=e[22]<<10|e[23]>>>22,$=e[23]<<10|e[22]>>>22,M=e[33]<<13|e[32]>>>19,P=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,fe=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,Q=e[35]<<15|e[34]>>>17,N=e[45]<<29|e[44]>>>3,C=e[44]<<29|e[45]>>>3,k=e[6]<<28|e[7]>>>4,x=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,D=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,_=e[36]<<21|e[37]>>>11,E=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,G=e[8]<<27|e[9]>>>5,W=e[9]<<27|e[8]>>>5,T=e[18]<<20|e[19]>>>12,R=e[19]<<20|e[18]>>>12,se=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,q=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,A=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=g^~y&v,e[1]=m^~b&w,e[10]=k^~T&O,e[11]=x^~R&I,e[20]=B^~L&D,e[21]=U^~j&F,e[30]=G^~V&J,e[31]=W^~X&$,e[40]=te^~ne&se,e[41]=re^~ie&oe,e[2]=y^~v&_,e[3]=b^~w&E,e[12]=T^~O&M,e[13]=R^~I&P,e[22]=L^~D&q,e[23]=j^~F&z,e[32]=V^~J&Y,e[33]=X^~$&Q,e[42]=ne^~se&ae,e[43]=ie^~oe&ue,e[4]=v^~_&A,e[5]=w^~E&S,e[14]=O^~M&N,e[15]=I^~P&C,e[24]=D^~q&K,e[25]=F^~z&H,e[34]=J^~Y&Z,e[35]=$^~Q&ee,e[44]=se^~ae&ce,e[45]=oe^~ue&fe,e[6]=_^~A&g,e[7]=E^~S&m,e[16]=M^~N&k,e[17]=P^~C&x,e[26]=q^~K&B,e[27]=z^~H&U,e[36]=Y^~Z&G,e[37]=Q^~ee&W,e[46]=ae^~ce&te,e[47]=ue^~fe&re,e[8]=A^~g&y,e[9]=S^~m&b,e[18]=N^~k&T,e[19]=C^~x&R,e[28]=K^~B&L,e[29]=H^~U&j,e[38]=Z^~G&V,e[39]=ee^~W&X,e[48]=ce^~te&ne,e[49]=fe^~re&ie,e[0]^=c[n],e[1]^=c[n+1]};if(i)Hk.exports=_;else for(A=0;A<E.length;++A)r[E[A]]=_[E[A]]}();var Wk=Gk.exports;function Vk(e){return"0x"+Wk.keccak_256(ke(e))}var Xk=ue.BN;const Jk=new Mk("bignumber/5.7.0"),$k={};let Yk=!1;class Qk{constructor(e,t){e!==$k&&Jk.throwError("cannot call constructor directly; use BigNumber.from",Mk.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return ex(tx(this).fromTwos(e))}toTwos(e){return ex(tx(this).toTwos(e))}abs(){return"-"===this._hex[0]?Qk.from(this._hex.substring(1)):this}add(e){return ex(tx(this).add(tx(e)))}sub(e){return ex(tx(this).sub(tx(e)))}div(e){return Qk.from(e).isZero()&&rx("division-by-zero","div"),ex(tx(this).div(tx(e)))}mul(e){return ex(tx(this).mul(tx(e)))}mod(e){const t=tx(e);return t.isNeg()&&rx("division-by-zero","mod"),ex(tx(this).umod(t))}pow(e){const t=tx(e);return t.isNeg()&&rx("negative-power","pow"),ex(tx(this).pow(t))}and(e){const t=tx(e);return(this.isNegative()||t.isNeg())&&rx("unbound-bitwise-result","and"),ex(tx(this).and(t))}or(e){const t=tx(e);return(this.isNegative()||t.isNeg())&&rx("unbound-bitwise-result","or"),ex(tx(this).or(t))}xor(e){const t=tx(e);return(this.isNegative()||t.isNeg())&&rx("unbound-bitwise-result","xor"),ex(tx(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&rx("negative-width","mask"),ex(tx(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&rx("negative-width","shl"),ex(tx(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&rx("negative-width","shr"),ex(tx(this).shrn(e))}eq(e){return tx(this).eq(tx(e))}lt(e){return tx(this).lt(tx(e))}lte(e){return tx(this).lte(tx(e))}gt(e){return tx(this).gt(tx(e))}gte(e){return tx(this).gte(tx(e))}isNegative(){return"-"===this._hex[0]}isZero(){return tx(this).isZero()}toNumber(){try{return tx(this).toNumber()}catch(e){rx("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Jk.throwError("this platform does not support BigInt",Mk.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Yk||(Yk=!0,Jk.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Jk.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Mk.errors.UNEXPECTED_ARGUMENT,{}):Jk.throwError("BigNumber.toString does not accept parameters",Mk.errors.UNEXPECTED_ARGUMENT,{})),tx(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Qk)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new Qk($k,Zk(e)):e.match(/^-?[0-9]+$/)?new Qk($k,Zk(new Xk(e))):Jk.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&rx("underflow","BigNumber.from",e),(e>=9007199254740991||e<=-9007199254740991)&&rx("overflow","BigNumber.from",e),Qk.from(String(e));const t=e;if("bigint"==typeof t)return Qk.from(t.toString());if(Se(t))return Qk.from(Me(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return Qk.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(Oe(e)||"-"===e[0]&&Oe(e.substring(1))))return Qk.from(e)}return Jk.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function Zk(e){if("string"!=typeof e)return Zk(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Jk.throwArgumentError("invalid hex","value",e),"0x00"===(e=Zk(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 ex(e){return Qk.from(Zk(e))}function tx(e){const t=Qk.from(e).toHexString();return"-"===t[0]?new Xk("-"+t.substring(3),16):new Xk(t.substring(2),16)}function rx(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),Jk.throwError(e,Mk.errors.NUMERIC_FAULT,n)}const nx=new Mk("bignumber/5.7.0"),ix={},sx=Qk.from(0),ox=Qk.from(-1);function ax(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),nx.throwError(e,Mk.errors.NUMERIC_FAULT,i)}let ux="0";for(;ux.length<256;)ux+=ux;function cx(e){if("number"!=typeof e)try{e=Qk.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+ux.substring(0,e):nx.throwArgumentError("invalid decimal size","decimals",e)}function fx(e,t){null==t&&(t=0);const r=cx(t),n=(e=Qk.from(e)).lt(sx);n&&(e=e.mul(ox));let i=e.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=e.div(r).toString();return e=1===r.length?s:s+"."+i,n&&(e="-"+e),e}function lx(e,t){null==t&&(t=0);const r=cx(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||nx.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&nx.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&nx.throwArgumentError("too many decimal points","value",e);let s=i[0],o=i[1];for(s||(s="0"),o||(o="0");"0"===o[o.length-1];)o=o.substring(0,o.length-1);for(o.length>r.length-1&&ax("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const a=Qk.from(s),u=Qk.from(o);let c=a.mul(r).add(u);return n&&(c=c.mul(ox)),c}class dx{constructor(e,t,r,n){e!==ix&&nx.throwError("cannot use FixedFormat constructor; use FixedFormat.from",Mk.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=r,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=cx(n),Object.freeze(this)}static from(e){if(e instanceof dx)return e;"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,r=128,n=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const i=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||nx.throwArgumentError("invalid fixed format","format",e),t="u"!==i[1],r=parseInt(i[2]),n=parseInt(i[3])}else if(e){const i=(t,r,n)=>null==e[t]?n:(typeof e[t]!==r&&nx.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&&nx.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&nx.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new dx(ix,t,r,n)}}class hx{constructor(e,t,r,n){e!==ix&&nx.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Mk.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&&nx.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=lx(this._value,this.format.decimals),r=lx(e._value,e.format.decimals);return hx.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=lx(this._value,this.format.decimals),r=lx(e._value,e.format.decimals);return hx.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=lx(this._value,this.format.decimals),r=lx(e._value,e.format.decimals);return hx.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=lx(this._value,this.format.decimals),r=lx(e._value,e.format.decimals);return hx.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=hx.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(px.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=hx.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(px.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)&&nx.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=hx.from("1"+ux.substring(0,e),this.format),n=gx.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&&nx.throwArgumentError("invalid byte width","width",e);return Ue(Qk.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return hx.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||function(e){return null!=e&&(Qk.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Oe(e)||"bigint"==typeof e||Se(e))}(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),hx.fromString(fx(e,t),dx.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=dx.from(t),n=lx(e,r.decimals);!r.signed&&n.lt(sx)&&ax("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=Ue(i,r.width/8));const s=fx(n,r.decimals);return new hx(ix,i,s,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=dx.from(t);if(ke(e).length>r.width/8)throw new Error("overflow");let n=Qk.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),s=fx(n,r.decimals);return new hx(ix,i,s,r)}static from(e,t){if("string"==typeof e)return hx.fromString(e,t);if(Se(e))return hx.fromBytes(e,t);try{return hx.fromValue(e,0,t)}catch(e){if(e.code!==Mk.errors.INVALID_ARGUMENT)throw e}return nx.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const px=hx.from(1),gx=hx.from("0.5"),mx=new Mk("strings/5.7.0");var yx,bx;function vx(e,t=yx.current){t!=yx.current&&(mx.checkNormalize(),e=e.normalize(t));let r=[];for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<128)r.push(n);else if(n<2048)r.push(n>>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 s=65536+((1023&n)<<10)+(1023&i);r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(63&s|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return ke(r)}function wx(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 _x(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 Ex(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 Ax(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ex(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ex(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Sx(e,t,r){return kx.apply(this,arguments)}function kx(){return kx=_A(xA.mark((function e(t,r,n){var i,s,o,a,u,c,f,l;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r.users.map((function(e){return{ether_key:e.user,tokens:e.tokens.map((function(e){return Ax({id:e.id,blueprint:e.blueprint},e.royalties&&e.royalties.length>0&&{royalties:e.royalties.map((function(e){return{recipient:e.recipient,percentage:e.percentage}}))})}))}})),s=r.royalties,o=Ax(Ax({contract_address:r.contract_address},s&&s.length>0&&{royalties:s.map((function(e){return{recipient:e.recipient,percentage:e.percentage}}))}),{},{users:i,auth_signature:""}),a=Vk(vx(JSON.stringify(o))),e.next=6,IA(a,t);case 6:return u=e.sent,c=Ax(Ax({users:o.users.map((function(e){return{user:e.ether_key,tokens:e.tokens}}))},s&&s.length>0&&{royalties:s}),{},{contract_address:r.contract_address,auth_signature:u}),f={mintTokensRequestV2:[c]},e.next=11,n.mintTokens(f);case 11:return l=e.sent,e.abrupt("return",l.data);case 13:case"end":return e.stop()}}),e)}))),kx.apply(this,arguments)}function xx(e){switch(e.type){case"ERC721":return{type:"ERC721",data:{token_id:e.tokenId,token_address:e.tokenAddress}};case"ERC20":return{type:"ERC20",data:{token_address:e.tokenAddress}};case"ETH":return{type:"ETH",data:{decimals:18}}}}function Tx(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Rx(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Rx(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){a=!0,s=e},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw s}}}}function Rx(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ox(e){return Ix.apply(this,arguments)}function Ix(){return(Ix=_A(xA.mark((function e(t){var r,n,i,s,o,a,u,c,f,l,d,h,p,g,m;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.ethSigner,i=t.starkSigner,s=t.request,o=t.transfersApi,e.next=3,n.getAddress();case 3:return a=e.sent,u="ERC721"===s.type?"1":s.amount,e.next=7,o.getSignableTransferV1({getSignableTransferRequest:{sender:a,token:xx(s),amount:u,receiver:s.receiver}});case 7:return c=e.sent,f=c.data,l=f.signable_message,d=f.payload_hash,e.next=11,IA(l,n);case 11:return h=e.sent,e.next=14,i.signMessage(d);case 14:return p=e.sent,g={sender_stark_key:c.data.sender_stark_key,sender_vault_id:c.data.sender_vault_id,receiver_stark_key:c.data.receiver_stark_key,receiver_vault_id:c.data.receiver_vault_id,asset_id:c.data.asset_id,amount:c.data.amount,nonce:c.data.nonce,expiration_timestamp:c.data.expiration_timestamp,stark_signature:p},e.next=18,o.createTransferV1({createTransferRequest:g,xImxEthAddress:a,xImxEthSignature:h});case 18:return m=e.sent,e.abrupt("return",{sent_signature:null==m?void 0:m.data.sent_signature,status:null==m||null===(r=m.data.status)||void 0===r?void 0:r.toString(),time:null==m?void 0:m.data.time,transfer_id:null==m?void 0:m.data.transfer_id});case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Mx(e){return Px.apply(this,arguments)}function Px(){return(Px=_A(xA.mark((function e(t){var r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,s=t.transfersApi,e.next=3,r.getAddress();case 3:return o=e.sent,a=i.map((function(e){return{amount:"1",token:xx({type:"ERC721",tokenId:e.tokenId,tokenAddress:e.tokenAddress}),receiver:e.receiver}})),e.next=7,s.getSignableTransfer({getSignableTransferRequestV2:{sender_ether_key:o,signable_requests:a}});case 7:if(u=e.sent,void 0!==(c=u.data.signable_message)){e.next=11;break}throw new Error("Invalid response from Signable registration offchain");case 11:return e.next=13,IA(c,r);case 13:f=e.sent,l=[],d=Tx(u.data.signable_responses),e.prev=16,d.s();case 18:if((h=d.n()).done){e.next=27;break}return p=h.value,e.next=22,n.signMessage(p.payload_hash);case 22:g=e.sent,m={sender_vault_id:p.sender_vault_id,receiver_stark_key:p.receiver_stark_key,receiver_vault_id:p.receiver_vault_id,asset_id:p.asset_id,amount:p.amount,nonce:p.nonce,expiration_timestamp:p.expiration_timestamp,stark_signature:g},l.push(m);case 25:e.next=18;break;case 27:e.next=32;break;case 29:e.prev=29,e.t0=e.catch(16),d.e(e.t0);case 32:return e.prev=32,d.f(),e.finish(32);case 35:return y={sender_stark_key:u.data.sender_stark_key,requests:l},e.next=38,s.createTransfer({createTransferRequestV2:y,xImxEthAddress:o,xImxEthSignature:f});case 38:return b=e.sent,e.abrupt("return",{transfer_ids:null==b?void 0:b.data.transfer_ids});case 40:case"end":return e.stop()}}),e,null,[[16,29,32,35]])})))).apply(this,arguments)}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(yx||(yx={})),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"}(bx||(bx={})),_x("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))),wx("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"),wx("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"),wx("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;r<e.length;r+=4)t.push(parseInt(e.substring(r,r+4),16));return t})),_x("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");const Nx=new Mk("units/5.7.0"),Cx=["wei","kwei","mwei","gwei","szabo","finney","ether"];function Bx(e,t){if("string"!=typeof e&&Nx.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=Cx.indexOf(t);-1!==e&&(t=3*e)}return lx(e,null!=t?t:18)}function Ux(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 Lx(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ux(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ux(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function jx(e,t,r,n,i,s,o){return Dx.apply(this,arguments)}function Dx(){return(Dx=_A(xA.mark((function e(t,r,n,i,s,o,a){var u,c,f;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return u=e.sent,e.next=5,zk(u,i,a);case 5:return c=e.sent,e.next=8,o.populateTransaction.registerAndDepositEth(u,i,c.operator_signature,n,s);case 8:return f=e.sent,e.abrupt("return",t.sendTransaction(Lx(Lx({},f),{},{value:r})));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Fx(e,t,r,n,i,s){return qx.apply(this,arguments)}function qx(){return(qx=_A(xA.mark((function e(t,r,n,i,s,o){var a;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.populateTransaction["deposit(uint256,uint256,uint256)"](i,n,s);case 2:return a=e.sent,e.abrupt("return",t.sendTransaction(Lx(Lx({},a),{},{value:r})));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function zx(e,t,r,n,i,s){return Kx.apply(this,arguments)}function Kx(){return(Kx=_A(xA.mark((function e(t,r,n,i,s,o){var a,u,c,f,l,d,h,p,g,m,y;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return a=e.sent,u={decimals:18},c=Bx(r.amount,"wei"),f={user:a,token:{type:r.type,data:u},amount:c.toString()},e.next=8,n.getSignableDeposit({getSignableDepositRequest:f});case 8:return l=e.sent,e.next=11,s.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:r.type}}});case 11:return d=e.sent,h=d.data.asset_type,p=l.data.stark_key,g=l.data.vault_id,m=uA.connect(o.ethConfiguration.coreContractAddress,t),y=bA.connect(o.ethConfiguration.registrationContractAddress,t),e.next=19,Fk(p,y);case 19:if(e.sent){e.next=24;break}return e.abrupt("return",jx(t,c,h,p,g,m,i));case 24:return e.abrupt("return",Fx(t,c,h,p,g,m));case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Hx(e,t,r,n,i,s){return Gx.apply(this,arguments)}function Gx(){return(Gx=_A(xA.mark((function e(t,r,n,i,s,o){var a;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.populateTransaction.depositERC20(i,n,s,r);case 2:return a=e.sent,e.abrupt("return",t.sendTransaction(a));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Wx(e,t,r,n,i,s,o){return Vx.apply(this,arguments)}function Vx(){return(Vx=_A(xA.mark((function e(t,r,n,i,s,o,a){var u,c,f;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return u=e.sent,e.next=5,zk(u,i,a);case 5:return c=e.sent,e.next=8,o.populateTransaction.registerAndDepositERC20(u,i,c.operator_signature,n,s,r);case 8:return f=e.sent,e.abrupt("return",t.sendTransaction(f));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Xx(e,t,r,n,i,s,o){return Jx.apply(this,arguments)}function Jx(){return(Jx=_A(xA.mark((function e(t,r,n,i,s,o,a){var u,c,f,l,d,h,p,g,m,y,b,v,w,_,E,A;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return u=e.sent,e.next=5,s.getToken({address:r.tokenAddress});case 5:return c=e.sent,f=parseInt(c.data.decimals),l={decimals:f,token_address:r.tokenAddress},d=Bx(r.amount,0),h=nA.connect(r.tokenAddress,t),e.next=12,h.populateTransaction.approve(a.ethConfiguration.coreContractAddress,d);case 12:return p=e.sent,e.next=15,t.sendTransaction(p);case 15:return g={user:u,token:{type:r.type,data:l},amount:d.toString()},e.next=18,n.getSignableDeposit({getSignableDepositRequest:g});case 18:return m=e.sent,e.next=21,o.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:r.type,data:{token_address:r.tokenAddress}}}});case 21:return y=e.sent,b=y.data.asset_type,v=m.data.stark_key,w=m.data.vault_id,_=Qk.from(m.data.amount),E=uA.connect(a.ethConfiguration.coreContractAddress,t),A=bA.connect(a.ethConfiguration.registrationContractAddress,t),e.next=30,Fk(v,A);case 30:if(e.sent){e.next=35;break}return e.abrupt("return",Wx(t,_,b,v,w,E,i));case 35:return e.abrupt("return",Hx(t,_,b,v,w,E));case 36:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $x(e,t,r,n,i,s){return Yx.apply(this,arguments)}function Yx(){return(Yx=_A(xA.mark((function e(t,r,n,i,s,o){var a;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.populateTransaction.depositNft(i,n,s,r);case 2:return a=e.sent,e.abrupt("return",t.sendTransaction(a));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Qx(e,t,r,n,i,s){return Zx.apply(this,arguments)}function Zx(){return(Zx=_A(xA.mark((function e(t,r,n,i,s,o){var a,u,c,f,l,d,h,p,g,m,y,b,v,w;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return a=e.sent,u={token_address:r.tokenAddress,token_id:r.tokenId},c={user:a,token:{type:r.type,data:u},amount:"1".toString()},e.next=8,n.getSignableDeposit({getSignableDepositRequest:c});case 8:return f=e.sent,e.next=11,s.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:r.type,data:{token_address:r.tokenAddress,token_id:r.tokenId}}}});case 11:return l=e.sent,d=l.data.asset_type,h=f.data.stark_key,p=f.data.vault_id,g=uA.connect(o.ethConfiguration.coreContractAddress,t),m=bA.connect(o.ethConfiguration.registrationContractAddress,t),e.next=19,Fk(h,m);case 19:return y=e.sent,b=sA.connect(r.tokenAddress,t),v=o.ethConfiguration.coreContractAddress,e.next=24,b.isApprovedForAll(a,v);case 24:if(e.sent){e.next=28;break}return e.next=28,b.setApprovalForAll(v,!0);case 28:if(y){e.next=34;break}return e.next=31,zk(a,h,i);case 31:return w=e.sent,e.next=34,g.registerUser(a,h,w.operator_signature);case 34:return e.abrupt("return",$x(t,r.tokenId,d,h,p,g));case 35:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var eT=function(e){if(void 0!==e)return e;throw new Error("undefined field exception")};function tT(e){return rT.apply(this,arguments)}function rT(){return(rT=_A(xA.mark((function e(t){var r,n,i,s,o,a,u,c,f,l,d,h,p;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.withdrawalsApi,s="ERC721"===t.type?"1":t.amount,e.t0=i,e.next=5,r.getAddress();case 5:return e.t1=e.sent,e.t2=xx(t),e.t3=s,e.t4={user:e.t1,token:e.t2,amount:e.t3},e.t5={getSignableWithdrawalRequest:e.t4},e.next=12,e.t0.getSignableWithdrawal.call(e.t0,e.t5);case 12:return o=e.sent,a=o.data,u=a.signable_message,c=a.payload_hash,e.next=16,n.signMessage(c);case 16:return f=e.sent,e.next=19,CA(u,r);case 19:return l=e.sent,d=l.ethAddress,h=l.ethSignature,e.next=24,i.createWithdrawal({createWithdrawalRequest:{stark_key:eT(o.data.stark_key),amount:s,asset_id:eT(o.data.asset_id),vault_id:eT(o.data.vault_id),nonce:eT(o.data.nonce),stark_signature:f},xImxEthAddress:d,xImxEthSignature:h});case 24:return p=e.sent,e.abrupt("return",p.data);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function nT(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 iT(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?nT(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nT(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function sT(e,t,r,n){return oT.apply(this,arguments)}function oT(){return(oT=_A(xA.mark((function e(t,r,n,i){var s;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.encodeAsset({assetType:t,encodeAssetRequest:{token:iT({type:r},i&&{data:i})}});case 2:return s=e.sent,e.abrupt("return",s.data);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function aT(e,t,r,n,i){return uT.apply(this,arguments)}function uT(){return(uT=_A(xA.mark((function e(t,r,n,i,s){var o,a,u;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return o=e.sent,e.next=5,zk(o,n,s);case 5:return a=e.sent,e.next=8,i.populateTransaction.registerAndWithdraw(o,n,a.operator_signature,r);case 8:return u=e.sent,e.abrupt("return",t.sendTransaction(u));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function cT(e,t,r,n){return fT.apply(this,arguments)}function fT(){return(fT=_A(xA.mark((function e(t,r,n,i){var s;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.populateTransaction.withdraw(n,r);case 2:return s=e.sent,e.abrupt("return",t.sendTransaction(s));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function lT(e,t,r,n,i,s){return dT.apply(this,arguments)}function dT(){return(dT=_A(xA.mark((function e(t,r,n,i,s,o){var a,u,c;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,sT("asset","ERC20",i,{token_address:n.tokenAddress});case 2:return a=e.sent,u=uA.connect(o.ethConfiguration.coreContractAddress,t),c=bA.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,Fk(r,c);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",aT(t,a.asset_type,r,c,s));case 12:return e.abrupt("return",cT(t,a.asset_type,r,u));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function hT(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 pT(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?hT(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hT(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function gT(e,t,r,n,i){return mT.apply(this,arguments)}function mT(){return(mT=_A(xA.mark((function e(t,r,n,i,s){var o;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.populateTransaction.withdrawAndMint(n,r,i);case 2:return o=e.sent,e.abrupt("return",t.sendTransaction(o));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function yT(e,t,r,n,i,s){return bT.apply(this,arguments)}function bT(){return(bT=_A(xA.mark((function e(t,r,n,i,s,o){var a,u,c;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return a=e.sent,e.next=5,zk(a,n,o);case 5:return u=e.sent,e.next=8,s.populateTransaction.regsiterAndWithdrawAndMint(a,n,u.operator_signature,r,i);case 8:return c=e.sent,e.abrupt("return",t.sendTransaction(c));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function vT(e){var t=e.data.id,r=e.data.blueprint||"";return Vc(Sc("{".concat(t,"}:{").concat(r,"}")))}function wT(e,t,r,n,i,s){return _T.apply(this,arguments)}function _T(){return(_T=_A(xA.mark((function e(t,r,n,i,s,o){var a,u,c,f;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,sT("mintable-asset","ERC721",i,pT({id:n.data.id,token_address:n.data.tokenAddress},n.data.blueprint&&{blueprint:n.data.blueprint}));case 2:return a=e.sent,u=vT(n),c=uA.connect(o.ethConfiguration.coreContractAddress,t),f=bA.connect(o.ethConfiguration.registrationContractAddress,t),e.next=8,Fk(r,f);case 8:if(e.sent){e.next=13;break}return e.abrupt("return",yT(t,a.asset_type,r,u,f,s));case 13:return e.abrupt("return",gT(t,a.asset_type,r,u,c));case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ET(e,t,r,n,i,s){return AT.apply(this,arguments)}function AT(){return(AT=_A(xA.mark((function e(t,r,n,i,s,o){var a,u,c;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return a=e.sent,e.next=5,zk(a,n,o);case 5:return u=e.sent,e.next=8,s.populateTransaction.registerAndWithdrawNft(a,n,u.operator_signature,r,i);case 8:return c=e.sent,e.abrupt("return",t.sendTransaction(c));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ST(e,t,r,n,i){return kT.apply(this,arguments)}function kT(){return(kT=_A(xA.mark((function e(t,r,n,i,s){var o;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.populateTransaction.withdrawNft(n,r,i);case 2:return o=e.sent,e.abrupt("return",t.sendTransaction(o));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xT(e,t,r,n,i,s){return TT.apply(this,arguments)}function TT(){return(TT=_A(xA.mark((function e(t,r,n,i,s,o){var a,u,c;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,sT("asset","ERC721",i,{token_id:n.tokenId,token_address:n.tokenAddress});case 2:return a=e.sent,u=uA.connect(o.ethConfiguration.coreContractAddress,t),c=bA.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,Fk(r,c);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",ET(t,a.asset_type,r,n.tokenId,c,s));case 12:return e.abrupt("return",ST(t,a.asset_type,r,n.tokenId,u));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function RT(e,t,r,n,i,s,o){return OT.apply(this,arguments)}function OT(){return(OT=_A(xA.mark((function e(t,r,n,i,s,o,a){var u,c;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=n.tokenAddress,c=n.tokenId,e.next=4,s.getMintableTokenDetailsByClientTokenId({tokenAddress:u,tokenId:c}).then((function(e){return wT(t,r,{type:"ERC721",data:{id:c,tokenAddress:u,blueprint:e.data.blueprint}},i,o,a)})).catch((function(e){var s;if(404===(null===(s=e.response)||void 0===s?void 0:s.status))return xT(t,r,n,i,o,a);throw e}));case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function IT(e,t,r,n,i){return MT.apply(this,arguments)}function MT(){return(MT=_A(xA.mark((function e(t,r,n,i,s){var o,a,u;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return o=e.sent,e.next=5,zk(o,n,s);case 5:return a=e.sent,e.next=8,i.populateTransaction.registerAndWithdraw(o,n,a.operator_signature,r);case 8:return u=e.sent,e.abrupt("return",t.sendTransaction(u));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function PT(e,t,r,n){return NT.apply(this,arguments)}function NT(){return(NT=_A(xA.mark((function e(t,r,n,i){var s;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.populateTransaction.withdraw(n,r);case 2:return s=e.sent,e.abrupt("return",t.sendTransaction(s));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function CT(e,t,r,n,i){return BT.apply(this,arguments)}function BT(){return(BT=_A(xA.mark((function e(t,r,n,i,s){var o,a,u;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,sT("asset","ETH",n);case 2:return o=e.sent,a=uA.connect(s.ethConfiguration.coreContractAddress,t),u=bA.connect(s.ethConfiguration.registrationContractAddress,t),e.next=7,Fk(r,u);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",IT(t,o.asset_type,r,u,i));case 12:return e.abrupt("return",PT(t,o.asset_type,r,a));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function UT(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 LT(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?UT(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):UT(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function jT(e){return DT.apply(this,arguments)}function DT(){return(DT=_A(xA.mark((function e(t){var r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,s=t.ordersApi,e.next=3,r.getAddress();case 3:return o=e.sent,a="ERC721"===i.sell.type?"1":i.sell.amount,u="ERC721"===i.buy.type?"1":i.buy.amount,c={user:o,amount_buy:u,token_buy:xx(i.buy),amount_sell:a,token_sell:xx(i.sell),fees:i.fees,expiration_timestamp:i.expiration_timestamp,split_fees:!0},e.next=9,s.getSignableOrder({getSignableOrderRequestV3:c});case 9:return f=e.sent,l=f.data,d=l.signable_message,h=l.payload_hash,e.next=13,IA(d,r);case 13:return p=e.sent,e.next=16,n.signMessage(h);case 16:return g=e.sent,m=f.data,y={createOrderRequest:{amount_buy:m.amount_buy,amount_sell:m.amount_sell,asset_id_buy:m.asset_id_buy,asset_id_sell:m.asset_id_sell,expiration_timestamp:m.expiration_timestamp,include_fees:!0,fees:i.fees,nonce:m.nonce,stark_key:m.stark_key,stark_signature:g,vault_id_buy:m.vault_id_buy,vault_id_sell:m.vault_id_sell},xImxEthAddress:o,xImxEthSignature:p},e.next=21,s.createOrderV3(y);case 21:return b=e.sent,e.abrupt("return",LT({},b.data));case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function FT(e){return qT.apply(this,arguments)}function qT(){return(qT=_A(xA.mark((function e(t){var r,n,i,s,o,a,u,c,f,l,d,h;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,s=t.ordersApi,e.next=3,s.getSignableCancelOrderV3({getSignableCancelOrderRequest:{order_id:i.order_id}});case 3:return o=e.sent,a=o.data,u=a.signable_message,c=a.payload_hash,e.next=7,IA(u,r);case 7:return f=e.sent,e.next=10,n.signMessage(c);case 10:return l=e.sent,e.next=13,r.getAddress();case 13:return d=e.sent,e.next=16,s.cancelOrder({id:i.order_id.toString(),cancelOrderRequest:{order_id:i.order_id,stark_signature:l},xImxEthAddress:d,xImxEthSignature:f});case 16:return h=e.sent,e.abrupt("return",{order_id:h.data.order_id,status:h.data.status});case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function zT(e){return KT.apply(this,arguments)}function KT(){return(KT=_A(xA.mark((function e(t){var r,n,i,s,o,a,u,c,f,l,d,h;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,s=t.tradesApi,e.next=3,r.getAddress();case 3:return o=e.sent,e.next=6,s.getSignableTrade({getSignableTradeRequest:{user:o,order_id:i.order_id,fees:i.fees}});case 6:return a=e.sent,u=a.data,c=u.signable_message,f=u.payload_hash,e.next=10,IA(c,r);case 10:return l=e.sent,e.next=13,n.signMessage(f);case 13:return d=e.sent,e.next=16,s.createTradeV3({createTradeRequest:{amount_buy:a.data.amount_buy,amount_sell:a.data.amount_sell,asset_id_buy:a.data.asset_id_buy,asset_id_sell:a.data.asset_id_sell,expiration_timestamp:a.data.expiration_timestamp,fee_info:a.data.fee_info,fees:i.fees,include_fees:!0,nonce:a.data.nonce,order_id:i.order_id,stark_key:a.data.stark_key,vault_id_buy:a.data.vault_id_buy,vault_id_sell:a.data.vault_id_sell,stark_signature:d},xImxEthAddress:o,xImxEthSignature:l});case 16:return h=e.sent,e.abrupt("return",h.data);case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function HT(e){return GT.apply(this,arguments)}function GT(){return(GT=_A(xA.mark((function e(t){var r,n,i,s,o,a,u,c,f,l,d,h,p,g,m;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.ethSigner,i=t.starkSigner,s=t.request,o=t.exchangesApi,e.next=3,n.getAddress();case 3:return a=e.sent,u=s.amount,e.next=7,o.getExchangeSignableTransfer({id:s.transactionID,getSignableTransferRequest:{sender:a,token:xx(s),amount:u,receiver:s.receiver}});case 7:return c=e.sent,f=c.data,l=f.signable_message,d=f.payload_hash,e.next=11,IA(l,n);case 11:return h=e.sent,e.next=14,i.signMessage(d);case 14:return p=e.sent,g={sender_stark_key:c.data.sender_stark_key,sender_vault_id:c.data.sender_vault_id,receiver_stark_key:c.data.receiver_stark_key,receiver_vault_id:c.data.receiver_vault_id,asset_id:c.data.asset_id,amount:c.data.amount,nonce:c.data.nonce,expiration_timestamp:c.data.expiration_timestamp,stark_signature:p},e.next=18,o.createExchangeTransfer({id:s.transactionID,createTransferRequest:g,xImxEthAddress:a,xImxEthSignature:h});case 18:return m=e.sent,e.abrupt("return",{sent_signature:null==m?void 0:m.data.sent_signature,status:null==m||null===(r=m.data.status)||void 0===r?void 0:r.toString(),time:null==m?void 0:m.data.time,transfer_id:null==m?void 0:m.data.transfer_id});case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function WT(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 VT(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?WT(Object(r),!0).forEach((function(t){tA(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):WT(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var XT=function(){function e(t){QE(this,e),this.config=t;var r=t.apiConfiguration;this.config=t,this.depositsApi=new ES(r),this.encodingApi=new xS(r),this.mintsApi=new zS(r),this.ordersApi=new $S(r),this.tokensApi=new ik(r),this.tradesApi=new uk(r),this.transfersApi=new dk(r),this.usersApi=new mk(r),this.withdrawalsApi=new wk(r),this.projectsApi=new ek(r),this.collectionsApi=new bS(r),this.metadataApi=new CS(r),this.metadataRefreshesApi=new jS(r),this.exchangesApi=new IS(r)}var t,r,n,i,s,o,a,u,c,f,l,d,h,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R;return eA(e,[{key:"isChainValid",value:function(e){return e===this.config.ethConfiguration.chainID}},{key:"validateChain",value:(R=_A(xA.mark((function e(t){var r;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getChainId();case 2:if(r=e.sent,this.isChainValid(r)){e.next=5;break}throw new Error("The wallet used for this operation is not from the correct network.");case 5:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"registerOffchain",value:(T=_A(xA.mark((function e(t){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",jk(VT(VT({},t),{},{usersApi:this.usersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"isRegisteredOnchain",value:(x=_A(xA.mark((function e(t){var r,n;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return r=bA.connect(this.config.ethConfiguration.registrationContractAddress,t.ethSigner),e.next=5,t.starkSigner.getAddress();case 5:return n=e.sent,e.abrupt("return",Fk(n,r));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"mint",value:(k=_A(xA.mark((function e(t,r){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",Sx(t,r,this.mintsApi));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return k.apply(this,arguments)})},{key:"transfer",value:(S=_A(xA.mark((function e(t,r){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",Ox(VT(VT({},t),{},{request:r,transfersApi:this.transfersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"exchangeTransfer",value:(A=_A(xA.mark((function e(t,r){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",HT(VT(VT({},t),{},{request:r,exchangesApi:this.exchangesApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"batchNftTransfer",value:(E=_A(xA.mark((function e(t,r){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",Mx(VT(VT({},t),{},{request:r,transfersApi:this.transfersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return E.apply(this,arguments)})},{key:"deposit",value:(_=_A(xA.mark((function e(t,r){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=r.type,e.next="ETH"===e.t0?3:"ERC20"===e.t0?4:"ERC721"===e.t0?5:6;break;case 3:return e.abrupt("return",this.depositEth(t,r));case 4:return e.abrupt("return",this.depositERC20(t,r));case 5:return e.abrupt("return",this.depositERC721(t,r));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"depositEth",value:(w=_A(xA.mark((function e(t,r){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",zx(t,r,this.depositsApi,this.usersApi,this.encodingApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"depositERC20",value:(v=_A(xA.mark((function e(t,r){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",Xx(t,r,this.depositsApi,this.usersApi,this.tokensApi,this.encodingApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"depositERC721",value:(b=_A(xA.mark((function e(t,r){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",Qx(t,r,this.depositsApi,this.usersApi,this.encodingApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return b.apply(this,arguments)})},{key:"prepareWithdrawal",value:(y=_A(xA.mark((function e(t,r){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",tT(VT(VT(VT({},t),r),{},{withdrawalsApi:this.withdrawalsApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return y.apply(this,arguments)})},{key:"completeWithdrawal",value:function(e,t,r){switch(r.type){case"ETH":return this.completeEthWithdrawal(e,t);case"ERC20":return this.completeERC20Withdrawal(e,t,r);case"ERC721":return this.completeERC721Withdrawal(e,t,r)}}},{key:"completeEthWithdrawal",value:(m=_A(xA.mark((function e(t,r){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",CT(t,r,this.encodingApi,this.usersApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return m.apply(this,arguments)})},{key:"completeERC20Withdrawal",value:(g=_A(xA.mark((function e(t,r,n){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",lT(t,r,n,this.encodingApi,this.usersApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return g.apply(this,arguments)})},{key:"completeERC721Withdrawal",value:function(){var e=_A(xA.mark((function e(t,r,n){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",RT(t,r,n,this.encodingApi,this.mintsApi,this.usersApi,this.config));case 3:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}()},{key:"createOrder",value:(p=_A(xA.mark((function e(t,r){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",jT(VT(VT({},t),{},{request:r,ordersApi:this.ordersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"cancelOrder",value:(h=_A(xA.mark((function e(t,r){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",FT(VT(VT({},t),{},{request:r,ordersApi:this.ordersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"createTrade",value:(d=_A(xA.mark((function e(t,r){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",zT(VT(VT({},t),{},{request:r,tradesApi:this.tradesApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"createProject",value:(l=_A(xA.mark((function e(t,r){var n;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PA(t);case 2:return n=e.sent,e.abrupt("return",this.projectsApi.createProject({iMXSignature:n.signature,iMXTimestamp:n.timestamp,createProjectRequest:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"getProject",value:(f=_A(xA.mark((function e(t,r){var n;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PA(t);case 2:return n=e.sent,e.abrupt("return",this.projectsApi.getProject({id:r,iMXSignature:n.signature,iMXTimestamp:n.timestamp}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"getProjects",value:(c=_A(xA.mark((function e(t,r,n,i,s){var o;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PA(t);case 2:return o=e.sent,e.abrupt("return",this.projectsApi.getProjects({iMXSignature:o.signature,iMXTimestamp:o.timestamp,pageSize:r,cursor:n,orderBy:i,direction:s}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return c.apply(this,arguments)})},{key:"createCollection",value:(u=_A(xA.mark((function e(t,r){var n;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PA(t);case 2:return n=e.sent,e.abrupt("return",this.collectionsApi.createCollection({iMXSignature:n.signature,iMXTimestamp:n.timestamp,createCollectionRequest:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"updateCollection",value:(a=_A(xA.mark((function e(t,r,n){var i;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PA(t);case 2:return i=e.sent,e.abrupt("return",this.collectionsApi.updateCollection({iMXSignature:i.signature,iMXTimestamp:i.timestamp,address:r,updateCollectionRequest:n}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return a.apply(this,arguments)})},{key:"addMetadataSchemaToCollection",value:(o=_A(xA.mark((function e(t,r,n){var i;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PA(t);case 2:return i=e.sent,e.abrupt("return",this.metadataApi.addMetadataSchemaToCollection({iMXSignature:i.signature,iMXTimestamp:i.timestamp,addMetadataSchemaToCollectionRequest:n,address:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return o.apply(this,arguments)})},{key:"updateMetadataSchemaByName",value:(s=_A(xA.mark((function e(t,r,n,i){var s;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PA(t);case 2:return s=e.sent,e.abrupt("return",this.metadataApi.updateMetadataSchemaByName({iMXSignature:s.signature,iMXTimestamp:s.timestamp,address:r,name:n,metadataSchemaRequest:i}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return s.apply(this,arguments)})},{key:"listMetadataRefreshes",value:(i=_A(xA.mark((function e(t,r,n,i){var s,o;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PA(t);case 2:return s=e.sent,e.next=5,t.getAddress();case 5:return o=e.sent,e.abrupt("return",this.metadataRefreshesApi.getAListOfMetadataRefreshes({xImxEthSignature:s.signature,xImxEthTimestamp:s.timestamp,xImxEthAddress:o,collectionAddress:r,pageSize:n,cursor:i}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return i.apply(this,arguments)})},{key:"getMetadataRefreshErrors",value:(n=_A(xA.mark((function e(t,r,n,i){var s,o;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PA(t);case 2:return s=e.sent,e.next=5,t.getAddress();case 5:return o=e.sent,e.abrupt("return",this.metadataRefreshesApi.getMetadataRefreshErrors({xImxEthSignature:s.signature,xImxEthTimestamp:s.timestamp,xImxEthAddress:o,refreshId:r,pageSize:n,cursor:i}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i){return n.apply(this,arguments)})},{key:"getMetadataRefreshResults",value:(r=_A(xA.mark((function e(t,r){var n,i;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PA(t);case 2:return n=e.sent,e.next=5,t.getAddress();case 5:return i=e.sent,e.abrupt("return",this.metadataRefreshesApi.getMetadataRefreshResults({xImxEthSignature:n.signature,xImxEthTimestamp:n.timestamp,xImxEthAddress:i,refreshId:r}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"createMetadataRefresh",value:(t=_A(xA.mark((function e(t,r){var n,i;return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PA(t);case 2:return n=e.sent,e.next=5,t.getAddress();case 5:return i=e.sent,e.abrupt("return",this.metadataRefreshesApi.requestAMetadataRefresh({xImxEthSignature:n.signature,xImxEthTimestamp:n.timestamp,xImxEthAddress:i,createMetadataRefreshRequest:r}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),e}();function JT(e){if(YE.isAxiosError(e)&&e.response){var t,r,n,i=e.response.data;return i.code&&i.message?new Pk({code:i.code,details:i.details,message:i.message}):new Pk({code:null!==(t=null!==(r=e.code)&&void 0!==r?r:null===(n=e.response)||void 0===n?void 0:n.status.toString())&&void 0!==t?t:"unknown_error_code",message:String(e)})}return new Pk({code:"unknown_error_code",message:String(e)})}var $T=function(){function e(t){QE(this,e),this.depositsApi=new ES(t.apiConfiguration),this.mintsApi=new zS(t.apiConfiguration),this.ordersApi=new $S(t.apiConfiguration),this.tokensApi=new ik(t.apiConfiguration),this.tradesApi=new uk(t.apiConfiguration),this.transfersApi=new dk(t.apiConfiguration),this.exchangeApi=new IS(t.apiConfiguration),this.usersApi=new mk(t.apiConfiguration),this.withdrawalsApi=new wk(t.apiConfiguration),this.balanceApi=new pS(t.apiConfiguration),this.assetApi=new fS(t.apiConfiguration),this.collectionApi=new bS(t.apiConfiguration),this.metadataApi=new CS(t.apiConfiguration),this.metadataRefreshesApi=new jS(t.apiConfiguration),this.nftCheckoutPrimaryApi=new WS(t.apiConfiguration),this.projectsApi=new ek(t.apiConfiguration),this.workflows=new XT(t)}var t,r,n;return eA(e,[{key:"deposit",value:function(e,t){return this.workflows.deposit(e,t).catch((function(e){throw JT(e)}))}},{key:"getDeposit",value:function(e){return this.depositsApi.getDeposit(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"listDeposits",value:function(e){return this.depositsApi.listDeposits(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"registerOffchain",value:function(e){return this.workflows.registerOffchain(e).catch((function(e){throw JT(e)}))}},{key:"isRegisteredOnchain",value:function(e){return this.workflows.isRegisteredOnchain(e).catch((function(e){throw JT(e)}))}},{key:"getUser",value:function(e){return this.usersApi.getUsers({user:e}).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"getAsset",value:function(e){return this.assetApi.getAsset(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"listAssets",value:function(e){return this.assetApi.listAssets(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"createCollection",value:function(e,t){return this.workflows.createCollection(e,t).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"getCollection",value:function(e){return this.collectionApi.getCollection(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"listCollectionFilters",value:function(e){return this.collectionApi.listCollectionFilters(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"listCollections",value:function(e){return this.collectionApi.listCollections(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"updateCollection",value:function(e,t,r){return this.workflows.updateCollection(e,t,r).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"addMetadataSchemaToCollection",value:function(e,t,r){return this.workflows.addMetadataSchemaToCollection(e,t,r).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"getMetadataSchema",value:function(e){return this.metadataApi.getMetadataSchema(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"updateMetadataSchemaByName",value:function(e,t,r,n){return this.workflows.updateMetadataSchemaByName(e,t,r,n).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"listMetadataRefreshes",value:function(e,t,r,n){return this.workflows.listMetadataRefreshes(e,t,r,n).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"getMetadataRefreshErrors",value:function(e,t,r,n){return this.workflows.getMetadataRefreshErrors(e,t,r,n).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"getMetadataRefreshResults",value:function(e,t){return this.workflows.getMetadataRefreshResults(e,t).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"createMetadataRefresh",value:function(e,t){return this.workflows.createMetadataRefresh(e,t).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"createProject",value:(n=_A(xA.mark((function e(t,r){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.workflows.createProject(t,r).then((function(e){return e.data})).catch((function(e){throw JT(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"getProject",value:(r=_A(xA.mark((function e(t,r){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.workflows.getProject(t,r).then((function(e){return e.data})).catch((function(e){throw JT(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getProjects",value:(t=_A(xA.mark((function e(t,r,n,i,s){return xA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.workflows.getProjects(t,r,n,i,s).then((function(e){return e.data})).catch((function(e){throw JT(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,r,n,i,s){return t.apply(this,arguments)})},{key:"getBalance",value:function(e){return this.balanceApi.getBalance(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"listBalances",value:function(e){return this.balanceApi.listBalances(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"getMint",value:function(e){return this.mintsApi.getMint(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"listMints",value:function(e){return this.mintsApi.listMints(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"mint",value:function(e,t){return this.workflows.mint(e,t).catch((function(e){throw JT(e)}))}},{key:"listWithdrawals",value:function(e){return this.withdrawalsApi.listWithdrawals(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"getWithdrawal",value:function(e){return this.withdrawalsApi.getWithdrawal(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"prepareWithdrawal",value:function(e,t){return this.workflows.prepareWithdrawal(e,t).catch((function(e){throw JT(e)}))}},{key:"completeWithdrawal",value:function(e,t,r){return this.workflows.completeWithdrawal(e,t,r).catch((function(e){throw JT(e)}))}},{key:"getOrder",value:function(e){return this.ordersApi.getOrder(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"listOrders",value:function(e){return this.ordersApi.listOrders(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"createOrder",value:function(e,t){return this.workflows.createOrder(e,t).catch((function(e){throw JT(e)}))}},{key:"cancelOrder",value:function(e,t){return this.workflows.cancelOrder(e,t).catch((function(e){throw JT(e)}))}},{key:"getTrade",value:function(e){return this.tradesApi.getTrade(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"listTrades",value:function(e){return this.tradesApi.listTrades(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"createTrade",value:function(e,t){return this.workflows.createTrade(e,t).catch((function(e){throw JT(e)}))}},{key:"getToken",value:function(e){return this.tokensApi.getToken(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"listTokens",value:function(e){return this.tokensApi.listTokens(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"getTransfer",value:function(e){return this.transfersApi.getTransfer(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"listTransfers",value:function(e){return this.transfersApi.listTransfers(e).then((function(e){return e.data})).catch((function(e){throw JT(e)}))}},{key:"transfer",value:function(e,t){return this.workflows.transfer(e,t).catch((function(e){throw JT(e)}))}},{key:"batchNftTransfer",value:function(e,t){return this.workflows.batchNftTransfer(e,t).catch((function(e){throw JT(e)}))}},{key:"createExchange",value:function(e){return this.exchangeApi.createExchange(e).catch((function(e){throw JT(e)}))}},{key:"getExchange",value:function(e){return this.exchangeApi.getExchange(e).catch((function(e){throw JT(e)}))}},{key:"getExchanges",value:function(e){return this.exchangeApi.getExchanges(e).catch((function(e){throw JT(e)}))}},{key:"exchangeTransfer",value:function(e,t){return this.workflows.exchangeTransfer(e,t).catch((function(e){throw JT(e)}))}},{key:"createNftPrimary",value:function(e){return this.nftCheckoutPrimaryApi.createNftPrimary(e).catch((function(e){throw JT(e)}))}},{key:"getCurrenciesNFTCheckoutPrimary",value:function(e){return this.nftCheckoutPrimaryApi.getCurrenciesNFTCheckoutPrimary(e).catch((function(e){throw JT(e)}))}},{key:"getNftPrimaryTransaction",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransaction(e).catch((function(e){throw JT(e)}))}},{key:"getNftPrimaryTransactions",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransactions(e).catch((function(e){throw JT(e)}))}}]),e}();const YT=({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n})=>Lk.createConfig({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n,sdkVersion:"ts-immutable-sdk-0.0.0"}),QT=()=>YT({basePath:"https://api.sandbox.x.immutable.com",chainID:5,coreContractAddress:"0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623",registrationContractAddress:"0x1C97Ada273C9A52253f463042f29117090Cd7D83"});class ZT{immutableXConfig;baseConfig;constructor({baseConfig:t,overrides:r}){if(this.baseConfig=t,r)this.immutableXConfig=r.immutableXConfig;else switch(t.environment){case e.Environment.SANDBOX:this.immutableXConfig=QT();break;case e.Environment.PRODUCTION:this.immutableXConfig=YT({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"});break;default:this.immutableXConfig=QT()}}}class eR{immutableX;depositsApi;mintsApi;ordersApi;tokensApi;tradesApi;transfersApi;exchangeApi;nftCheckoutPrimaryApi;usersApi;withdrawalsApi;balanceApi;assetApi;collectionApi;metadataApi;metadataRefreshesApi;projectsApi;constructor(e){const t=new ZT(e);this.immutableX=new $T(t.immutableXConfig),this.depositsApi=this.immutableX.depositsApi,this.mintsApi=this.immutableX.mintsApi,this.ordersApi=this.immutableX.ordersApi,this.tokensApi=this.immutableX.tokensApi,this.tradesApi=this.immutableX.tradesApi,this.transfersApi=this.immutableX.transfersApi,this.exchangeApi=this.immutableX.exchangeApi,this.usersApi=this.immutableX.usersApi,this.withdrawalsApi=this.immutableX.withdrawalsApi,this.balanceApi=this.immutableX.balanceApi,this.assetApi=this.immutableX.assetApi,this.collectionApi=this.immutableX.collectionApi,this.metadataApi=this.immutableX.metadataApi,this.metadataRefreshesApi=this.immutableX.metadataRefreshesApi,this.nftCheckoutPrimaryApi=this.immutableX.nftCheckoutPrimaryApi,this.projectsApi=this.immutableX.projectsApi}getDeposit(e){return this.immutableX.getDeposit(e)}listDeposits(e){return this.immutableX.listDeposits(e)}getUser(e){return this.immutableX.getUser(e)}getAsset(e){return this.immutableX.getAsset(e)}listAssets(e){return this.immutableX.listAssets(e)}createCollection(e,t){return this.immutableX.createCollection(e,t)}getCollection(e){return this.immutableX.getCollection(e)}listCollectionFilters(e){return this.immutableX.listCollectionFilters(e)}listCollections(e){return this.collectionApi.listCollections(e).then((e=>e.data))}updateCollection(e,t,r){return this.immutableX.updateCollection(e,t,r)}addMetadataSchemaToCollection(e,t,r){return this.immutableX.addMetadataSchemaToCollection(e,t,r)}getMetadataSchema(e){return this.immutableX.getMetadataSchema(e)}updateMetadataSchemaByName(e,t,r,n){return this.immutableX.updateMetadataSchemaByName(e,t,r,n)}listMetadataRefreshes(e,t,r,n){return this.immutableX.listMetadataRefreshes(e,t,r,n)}getMetadataRefreshErrors(e,t,r,n){return this.immutableX.getMetadataRefreshErrors(e,t,r,n)}getMetadataRefreshResults(e,t){return this.immutableX.getMetadataRefreshResults(e,t)}createMetadataRefresh(e,t){return this.immutableX.createMetadataRefresh(e,t)}async createProject(e,t){return this.immutableX.createProject(e,t)}async getProject(e,t){return this.immutableX.getProject(e,t)}async getProjects(e,t,r,n,i){return this.immutableX.getProjects(e,t,r,n,i)}getBalance(e){return this.immutableX.getBalance(e)}listBalances(e){return this.immutableX.listBalances(e)}getMint(e){return this.immutableX.getMint(e)}listMints(e){return this.immutableX.listMints(e)}mint(e,t){return this.immutableX.mint(e,t)}listWithdrawals(e){return this.immutableX.listWithdrawals(e)}getWithdrawal(e){return this.immutableX.getWithdrawal(e)}getOrder(e){return this.immutableX.getOrder(e)}listOrders(e){return this.immutableX.listOrders(e)}getTrade(e){return this.immutableX.getTrade(e)}listTrades(e){return this.immutableX.listTrades(e)}getToken(e){return this.immutableX.getToken(e)}listTokens(e){return this.immutableX.listTokens(e)}getTransfer(e){return this.immutableX.getTransfer(e)}listTransfers(e){return this.immutableX.listTransfers(e)}createExchange(e){return this.immutableX.createExchange(e).then((e=>e.data))}getExchange(e){return this.immutableX.getExchange(e).then((e=>e.data))}getExchanges(e){return this.immutableX.getExchanges(e).then((e=>e.data))}exchangeTransfer(e,t){return this.immutableX.exchangeTransfer(e,t)}createNftPrimary(e){return this.immutableX.createNftPrimary(e).then((e=>e.data))}getCurrenciesNFTCheckoutPrimary(e){return this.immutableX.getCurrenciesNFTCheckoutPrimary(e).then((e=>e.data))}getNftPrimaryTransaction(e){return this.immutableX.getNftPrimaryTransaction(e).then((e=>e.data))}getNftPrimaryTransactions(e){return this.immutableX.getNftPrimaryTransactions(e).then((e=>e.data))}}function tR(e,t){return function(){return e.apply(t,arguments)}}const{toString:rR}=Object.prototype,{getPrototypeOf:nR}=Object,iR=(sR=Object.create(null),e=>{const t=rR.call(e);return sR[t]||(sR[t]=t.slice(8,-1).toLowerCase())});var sR;const oR=e=>(e=e.toLowerCase(),t=>iR(t)===e),aR=e=>t=>typeof t===e,{isArray:uR}=Array,cR=aR("undefined");const fR=oR("ArrayBuffer");const lR=aR("string"),dR=aR("function"),hR=aR("number"),pR=e=>null!==e&&"object"==typeof e,gR=e=>{if("object"!==iR(e))return!1;const t=nR(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},mR=oR("Date"),yR=oR("File"),bR=oR("Blob"),vR=oR("FileList"),wR=oR("URLSearchParams");function _R(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),uR(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),s=i.length;let o;for(n=0;n<s;n++)o=i[n],t.call(null,e[o],o,e)}}function ER(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const AR="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,SR=e=>!cR(e)&&e!==AR;const kR=(xR="undefined"!=typeof Uint8Array&&nR(Uint8Array),e=>xR&&e instanceof xR);var xR;const TR=oR("HTMLFormElement"),RR=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),OR=oR("RegExp"),IR=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};_R(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},MR="abcdefghijklmnopqrstuvwxyz",PR="0123456789",NR={DIGIT:PR,ALPHA:MR,ALPHA_DIGIT:MR+MR.toUpperCase()+PR};const CR=oR("AsyncFunction");var BR={isArray:uR,isArrayBuffer:fR,isBuffer:function(e){return null!==e&&!cR(e)&&null!==e.constructor&&!cR(e.constructor)&&dR(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||dR(e.append)&&("formdata"===(t=iR(e))||"object"===t&&dR(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&fR(e.buffer),t},isString:lR,isNumber:hR,isBoolean:e=>!0===e||!1===e,isObject:pR,isPlainObject:gR,isUndefined:cR,isDate:mR,isFile:yR,isBlob:bR,isRegExp:OR,isFunction:dR,isStream:e=>pR(e)&&dR(e.pipe),isURLSearchParams:wR,isTypedArray:kR,isFileList:vR,forEach:_R,merge:function e(){const{caseless:t}=SR(this)&&this||{},r={},n=(n,i)=>{const s=t&&ER(r,i)||i;gR(r[s])&&gR(n)?r[s]=e(r[s],n):gR(n)?r[s]=e({},n):uR(n)?r[s]=n.slice():r[s]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&_R(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(_R(t,((t,n)=>{r&&dR(t)?e[n]=tR(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,s,o;const a={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)o=i[s],n&&!n(o,e,t)||a[o]||(t[o]=e[o],a[o]=!0);e=!1!==r&&nR(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:iR,kindOfTest:oR,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(uR(e))return e;let t=e.length;if(!hR(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:TR,hasOwnProperty:RR,hasOwnProp:RR,reduceDescriptors:IR,freezeMethods:e=>{IR(e,((t,r)=>{if(dR(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];dR(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 uR(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)=>(e=+e,Number.isFinite(e)?e:t),findKey:ER,global:AR,isContextDefined:SR,ALPHABET:NR,generateString:(e=16,t=NR.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&dR(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(pR(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=uR(e)?[]:{};return _R(e,((e,t)=>{const s=r(e,n+1);!cR(s)&&(i[t]=s)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:CR,isThenable:e=>e&&(pR(e)||dR(e))&&dR(e.then)&&dR(e.catch)};function UR(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)}BR.inherits(UR,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:BR.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const LR=UR.prototype,jR={};["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=>{jR[e]={value:e}})),Object.defineProperties(UR,jR),Object.defineProperty(LR,"isAxiosError",{value:!0}),UR.from=(e,t,r,n,i,s)=>{const o=Object.create(LR);return BR.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),UR.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,s&&Object.assign(o,s),o};function DR(e){return BR.isPlainObject(e)||BR.isArray(e)}function FR(e){return BR.endsWith(e,"[]")?e.slice(0,-2):e}function qR(e,t,r){return e?e.concat(t).map((function(e,t){return e=FR(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const zR=BR.toFlatObject(BR,{},null,(function(e){return/^is[A-Z]/.test(e)}));function KR(e,t,r){if(!BR.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=BR.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!BR.isUndefined(t[e])}))).metaTokens,i=r.visitor||c,s=r.dots,o=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&BR.isSpecCompliantForm(t);if(!BR.isFunction(i))throw new TypeError("visitor must be a function");function u(e){if(null===e)return"";if(BR.isDate(e))return e.toISOString();if(!a&&BR.isBlob(e))throw new UR("Blob is not supported. Use a Buffer instead.");return BR.isArrayBuffer(e)||BR.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,r,i){let a=e;if(e&&!i&&"object"==typeof e)if(BR.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(BR.isArray(e)&&function(e){return BR.isArray(e)&&!e.some(DR)}(e)||(BR.isFileList(e)||BR.endsWith(r,"[]"))&&(a=BR.toArray(e)))return r=FR(r),a.forEach((function(e,n){!BR.isUndefined(e)&&null!==e&&t.append(!0===o?qR([r],n,s):null===o?r:r+"[]",u(e))})),!1;return!!DR(e)||(t.append(qR(i,r,s),u(e)),!1)}const f=[],l=Object.assign(zR,{defaultVisitor:c,convertValue:u,isVisitable:DR});if(!BR.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!BR.isUndefined(r)){if(-1!==f.indexOf(r))throw Error("Circular reference detected in "+n.join("."));f.push(r),BR.forEach(r,(function(r,s){!0===(!(BR.isUndefined(r)||null===r)&&i.call(t,r,BR.isString(s)?s.trim():s,n,l))&&e(r,n?n.concat(s):[s])})),f.pop()}}(e),t}function HR(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function GR(e,t){this._pairs=[],e&&KR(e,this,t)}const WR=GR.prototype;function VR(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function XR(e,t,r){if(!t)return e;const n=r&&r.encode||VR,i=r&&r.serialize;let s;if(s=i?i(t,r):BR.isURLSearchParams(t)?t.toString():new GR(t,r).toString(n),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}WR.append=function(e,t){this._pairs.push([e,t])},WR.toString=function(e){const t=e?function(t){return e.call(this,t,HR)}:HR;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var JR=class{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){BR.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},$R={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var YR={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:GR,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function QR(e){function t(e,r,n,i){let s=e[i++];const o=Number.isFinite(+s),a=i>=e.length;if(s=!s&&BR.isArray(n)?n.length:s,a)return BR.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!o;n[s]&&BR.isObject(n[s])||(n[s]=[]);return t(e,r,n[s],i)&&BR.isArray(n[s])&&(n[s]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let s;for(n=0;n<i;n++)s=r[n],t[s]=e[s];return t}(n[s])),!o}if(BR.isFormData(e)&&BR.isFunction(e.entries)){const r={};return BR.forEachEntry(e,((e,n)=>{t(function(e){return BR.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const ZR={"Content-Type":void 0};const eO={transitional:$R,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=BR.isObject(e);i&&BR.isHTMLForm(e)&&(e=new FormData(e));if(BR.isFormData(e))return n&&n?JSON.stringify(QR(e)):e;if(BR.isArrayBuffer(e)||BR.isBuffer(e)||BR.isStream(e)||BR.isFile(e)||BR.isBlob(e))return e;if(BR.isArrayBufferView(e))return e.buffer;if(BR.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return KR(e,new YR.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return YR.isNode&&BR.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((s=BR.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return KR(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(BR.isString(e))try{return(t||JSON.parse)(e),BR.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||eO.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&BR.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 UR.from(e,UR.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:YR.classes.FormData,Blob:YR.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};BR.forEach(["delete","get","head"],(function(e){eO.headers[e]={}})),BR.forEach(["post","put","patch"],(function(e){eO.headers[e]=BR.merge(ZR)}));var tO=eO;const rO=BR.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 nO=Symbol("internals");function iO(e){return e&&String(e).trim().toLowerCase()}function sO(e){return!1===e||null==e?e:BR.isArray(e)?e.map(sO):String(e)}function oO(e,t,r,n,i){return BR.isFunction(n)?n.call(this,t,r):(i&&(t=r),BR.isString(t)?BR.isString(n)?-1!==t.indexOf(n):BR.isRegExp(n)?n.test(t):void 0:void 0)}let aO=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=iO(t);if(!i)throw new Error("header name must be a non-empty string");const s=BR.findKey(n,i);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||t]=sO(e))}const s=(e,t)=>BR.forEach(e,((e,r)=>i(e,r,t)));return BR.isPlainObject(e)||e instanceof this.constructor?s(e,t):BR.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?s((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]&&rO[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&i(t,e,r),this}get(e,t){if(e=iO(e)){const r=BR.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(BR.isFunction(t))return t.call(this,e,r);if(BR.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=iO(e)){const r=BR.findKey(this,e);return!(!r||void 0===this[r]||t&&!oO(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=iO(e)){const i=BR.findKey(r,e);!i||t&&!oO(0,r[i],i,t)||(delete r[i],n=!0)}}return BR.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&&!oO(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return BR.forEach(this,((n,i)=>{const s=BR.findKey(r,i);if(s)return t[s]=sO(n),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();o!==i&&delete t[i],t[o]=sO(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return BR.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&BR.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[nO]=this[nO]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=iO(e);t[n]||(!function(e,t){const r=BR.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 BR.isArray(e)?e.forEach(n):n(e),this}};aO.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),BR.freezeMethods(aO.prototype),BR.freezeMethods(aO);var uO=aO;function cO(e,t){const r=this||tO,n=t||r,i=uO.from(n.headers);let s=n.data;return BR.forEach(e,(function(e){s=e.call(r,s,i.normalize(),t?t.status:void 0)})),i.normalize(),s}function fO(e){return!(!e||!e.__CANCEL__)}function lO(e,t,r){UR.call(this,null==e?"canceled":e,UR.ERR_CANCELED,t,r),this.name="CanceledError"}BR.inherits(lO,UR,{__CANCEL__:!0});var dO=YR.isStandardBrowserEnv?{write:function(e,t,r,n,i,s){const o=[];o.push(e+"="+encodeURIComponent(t)),BR.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),BR.isString(n)&&o.push("path="+n),BR.isString(i)&&o.push("domain="+i),!0===s&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function hO(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var pO=YR.isStandardBrowserEnv?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=BR.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function gO(e,t){let r=0;const n=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,s=0,o=0;return t=void 0!==t?t:1e3,function(a){const u=Date.now(),c=n[o];i||(i=u),r[s]=a,n[s]=u;let f=o,l=0;for(;f!==s;)l+=r[f++],f%=e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),u-i<t)return;const d=c&&u-c;return d?Math.round(1e3*l/d):void 0}}(50,250);return i=>{const s=i.loaded,o=i.lengthComputable?i.total:void 0,a=s-r,u=n(a);r=s;const c={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:u||void 0,estimated:u&&o&&s<=o?(o-s)/u:void 0,event:i};c[t?"download":"upload"]=!0,e(c)}}var mO="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=uO.from(e.headers).normalize(),s=e.responseType;let o;function a(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}BR.isFormData(n)&&(YR.isStandardBrowserEnv||YR.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let u=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+r))}const c=hO(e.baseURL,e.url);function f(){if(!u)return;const n=uO.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new UR("Request failed with status code "+r.status,[UR.ERR_BAD_REQUEST,UR.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),a()}),(function(e){r(e),a()}),{data:s&&"text"!==s&&"json"!==s?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:n,config:e,request:u}),u=null}if(u.open(e.method.toUpperCase(),XR(c,e.params,e.paramsSerializer),!0),u.timeout=e.timeout,"onloadend"in u?u.onloadend=f:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(f)},u.onabort=function(){u&&(r(new UR("Request aborted",UR.ECONNABORTED,e,u)),u=null)},u.onerror=function(){r(new UR("Network Error",UR.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||$R;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new UR(t,n.clarifyTimeoutError?UR.ETIMEDOUT:UR.ECONNABORTED,e,u)),u=null},YR.isStandardBrowserEnv){const t=(e.withCredentials||pO(c))&&e.xsrfCookieName&&dO.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in u&&BR.forEach(i.toJSON(),(function(e,t){u.setRequestHeader(t,e)})),BR.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),s&&"json"!==s&&(u.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&u.addEventListener("progress",gO(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",gO(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{u&&(r(!t||t.type?new lO(null,e,u):t),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const l=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(c);l&&-1===YR.protocols.indexOf(l)?r(new UR("Unsupported protocol "+l+":",UR.ERR_BAD_REQUEST,e)):u.send(n||null)}))};const yO={http:null,xhr:mO};BR.forEach(yO,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var bO=e=>{e=BR.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=BR.isString(r)?yO[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new UR(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(BR.hasOwnProp(yO,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!BR.isFunction(n))throw new TypeError("adapter is not a function");return n};function vO(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new lO(null,e)}function wO(e){vO(e),e.headers=uO.from(e.headers),e.data=cO.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return bO(e.adapter||tO.adapter)(e).then((function(t){return vO(e),t.data=cO.call(e,e.transformResponse,t),t.headers=uO.from(t.headers),t}),(function(t){return fO(t)||(vO(e),t&&t.response&&(t.response.data=cO.call(e,e.transformResponse,t.response),t.response.headers=uO.from(t.response.headers))),Promise.reject(t)}))}const _O=e=>e instanceof uO?e.toJSON():e;function EO(e,t){t=t||{};const r={};function n(e,t,r){return BR.isPlainObject(e)&&BR.isPlainObject(t)?BR.merge.call({caseless:r},e,t):BR.isPlainObject(t)?BR.merge({},t):BR.isArray(t)?t.slice():t}function i(e,t,r){return BR.isUndefined(t)?BR.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function s(e,t){if(!BR.isUndefined(t))return n(void 0,t)}function o(e,t){return BR.isUndefined(t)?BR.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,i,s){return s in t?n(r,i):s in e?n(void 0,r):void 0}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(e,t)=>i(_O(e),_O(t),!0)};return BR.forEach(Object.keys(Object.assign({},e,t)),(function(n){const s=u[n]||i,o=s(e[n],t[n],n);BR.isUndefined(o)&&s!==a||(r[n]=o)})),r}const AO="1.4.0",SO={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{SO[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const kO={};SO.transitional=function(e,t,r){function n(e,t){return"[Axios v1.4.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,s)=>{if(!1===e)throw new UR(n(i," has been removed"+(t?" in "+t:"")),UR.ERR_DEPRECATED);return t&&!kO[i]&&(kO[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,s)}};var xO={assertOptions:function(e,t,r){if("object"!=typeof e)throw new UR("options must be an object",UR.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const s=n[i],o=t[s];if(o){const t=e[s],r=void 0===t||o(t,s,e);if(!0!==r)throw new UR("option "+s+" must be "+r,UR.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new UR("Unknown option "+s,UR.ERR_BAD_OPTION)}},validators:SO};const TO=xO.validators;let RO=class{constructor(e){this.defaults=e,this.interceptors={request:new JR,response:new JR}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=EO(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let s;void 0!==r&&xO.assertOptions(r,{silentJSONParsing:TO.transitional(TO.boolean),forcedJSONParsing:TO.transitional(TO.boolean),clarifyTimeoutError:TO.transitional(TO.boolean)},!1),null!=n&&(BR.isFunction(n)?t.paramsSerializer={serialize:n}:xO.assertOptions(n,{encode:TO.function,serialize:TO.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),s=i&&BR.merge(i.common,i[t.method]),s&&BR.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=uO.concat(s,i);const o=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));const u=[];let c;this.interceptors.response.forEach((function(e){u.push(e.fulfilled,e.rejected)}));let f,l=0;if(!a){const e=[wO.bind(this),void 0];for(e.unshift.apply(e,o),e.push.apply(e,u),f=e.length,c=Promise.resolve(t);l<f;)c=c.then(e[l++],e[l++]);return c}f=o.length;let d=t;for(l=0;l<f;){const e=o[l++],t=o[l++];try{d=e(d)}catch(e){t.call(this,e);break}}try{c=wO.call(this,d)}catch(e){return Promise.reject(e)}for(l=0,f=u.length;l<f;)c=c.then(u[l++],u[l++]);return c}getUri(e){return XR(hO((e=EO(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}};BR.forEach(["delete","get","head","options"],(function(e){RO.prototype[e]=function(t,r){return this.request(EO(r||{},{method:e,url:t,data:(r||{}).data}))}})),BR.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(EO(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}RO.prototype[e]=t(),RO.prototype[e+"Form"]=t(!0)}));var OO=RO;var IO=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 lO(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;const r=new e((function(e){t=e}));return{token:r,cancel:t}}};const MO={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(MO).forEach((([e,t])=>{MO[t]=e}));var PO=MO;const NO=function e(t){const r=new OO(t),n=tR(OO.prototype.request,r);return BR.extend(n,OO.prototype,r,{allOwnKeys:!0}),BR.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(EO(t,r))},n}(tO);NO.Axios=OO,NO.CanceledError=lO,NO.CancelToken=IO,NO.isCancel=fO,NO.VERSION=AO,NO.toFormData=KR,NO.AxiosError=UR,NO.Cancel=NO.CanceledError,NO.all=function(e){return Promise.all(e)},NO.spread=function(e){return function(t){return e.apply(null,t)}},NO.isAxiosError=function(e){return BR.isObject(e)&&!0===e.isAxiosError},NO.mergeConfig=EO,NO.AxiosHeaders=uO,NO.formToJSON=e=>QR(BR.isHTMLForm(e)?new FormData(e):e),NO.HttpStatusCode=PO,NO.default=NO;var CO=NO;const BO="https://indexer-mr.sandbox.imtbl.com".replace(/\/+$/,"");let UO=class{basePath;axios;configuration;constructor(e,t=BO,r=CO){this.basePath=t,this.axios=r,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}},LO=class extends Error{field;name="RequiredError";constructor(e,t){super(t),this.field=e}};const jO="https://example.com",DO=function(e,t,r){if(null==r)throw new LO(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function FO(e,t,r=""){"object"==typeof t?Array.isArray(t)?t.forEach((t=>FO(e,t,r))):Object.keys(t).forEach((n=>FO(e,t[n],`${r}${""!==r?".":""}${n}`))):e.has(r)?e.append(r,t):e.set(r,t)}const qO=function(e,...t){const r=new URLSearchParams(e.search);FO(r,t),e.search=r.toString()},zO=function(e,t,r){const n="string"!=typeof e;return(n&&r&&r.isJsonMime?r.isJsonMime(t.headers["Content-Type"]):n)?JSON.stringify(void 0!==e?e:{}):e||""},KO=function(e){return e.pathname+e.search+e.hash},HO=function(e,t,r,n){return(i=t,s=r)=>{const o={...e.options,url:(n?.basePath||s)+e.url};return i.request(o)}},GO=function(e){const t=function(e){return{getActivity:async(t,r,n={})=>{DO("getActivity","chainName",t),DO("getActivity","activityId",r);const i="/v1/chains/{chain_name}/activities/{activity_id}".replace("{chain_name}",encodeURIComponent(String(t))).replace("{activity_id}",encodeURIComponent(String(r))),s=new URL(i,jO);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...n};qO(s,{});let u=o&&o.headers?o.headers:{};return a.headers={...u,...n.headers},{url:KO(s),options:a}},listActivities:async(t,r,n,i,s,o,a,u,c,f,l={})=>{DO("listActivities","chainName",t);const d="/v1/chains/{chain_name}/activities".replace("{chain_name}",encodeURIComponent(String(t))),h=new URL(d,jO);let p;e&&(p=e.baseOptions);const g={method:"GET",...p,...l},m={};void 0!==r&&(m.contract_address=r),void 0!==n&&(m.token_id=n),void 0!==i&&(m.account_address=i),void 0!==s&&(m.activity_type=s),void 0!==o&&(m.from_indexed_at=o instanceof Date?o.toISOString():o),void 0!==a&&(m.to_indexed_at=a instanceof Date?a.toISOString():a),void 0!==u&&(m.transaction_hash=u),void 0!==c&&(m.page_cursor=c),void 0!==f&&(m.page_size=f),qO(h,m);let y=p&&p.headers?p.headers:{};return g.headers={...y,...l.headers},{url:KO(h),options:g}}}}(e);return{async getActivity(r,n,i){const s=await t.getActivity(r,n,i);return HO(s,CO,BO,e)},async listActivities(r,n,i,s,o,a,u,c,f,l,d){const h=await t.listActivities(r,n,i,s,o,a,u,c,f,l,d);return HO(h,CO,BO,e)}}};class WO extends UO{getActivity(e,t){return GO(this.configuration).getActivity(e.chainName,e.activityId,t).then((e=>e(this.axios,this.basePath)))}listActivities(e,t){return GO(this.configuration).listActivities(e.chainName,e.contractAddress,e.tokenId,e.accountAddress,e.activityType,e.fromIndexedAt,e.toIndexedAt,e.transactionHash,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const VO=function(e){const t=function(e){return{listChains:async(t,r,n={})=>{const i=new URL("/v1/chains",jO);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...n},a={};void 0!==t&&(a.page_cursor=t),void 0!==r&&(a.page_size=r),qO(i,a);let u=s&&s.headers?s.headers:{};return o.headers={...u,...n.headers},{url:KO(i),options:o}}}}(e);return{async listChains(r,n,i){const s=await t.listChains(r,n,i);return HO(s,CO,BO,e)}}};class XO extends UO{listChains(e={},t){return VO(this.configuration).listChains(e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const JO=function(e){const t=function(e){return{getCollection:async(t,r,n={})=>{DO("getCollection","contractAddress",t),DO("getCollection","chainName",r);const i="/v1/chains/{chain_name}/collections/{contract_address}".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),s=new URL(i,jO);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...n};qO(s,{});let u=o&&o.headers?o.headers:{};return a.headers={...u,...n.headers},{url:KO(s),options:a}},listCollections:async(t,r,n,i={})=>{DO("listCollections","chainName",t);const s="/v1/chains/{chain_name}/collections".replace("{chain_name}",encodeURIComponent(String(t))),o=new URL(s,jO);let a;e&&(a=e.baseOptions);const u={method:"GET",...a,...i},c={};void 0!==r&&(c.page_cursor=r),void 0!==n&&(c.page_size=n),qO(o,c);let f=a&&a.headers?a.headers:{};return u.headers={...f,...i.headers},{url:KO(o),options:u}}}}(e);return{async getCollection(r,n,i){const s=await t.getCollection(r,n,i);return HO(s,CO,BO,e)},async listCollections(r,n,i,s){const o=await t.listCollections(r,n,i,s);return HO(o,CO,BO,e)}}};class $O extends UO{getCollection(e,t){return JO(this.configuration).getCollection(e.contractAddress,e.chainName,t).then((e=>e(this.axios,this.basePath)))}listCollections(e,t){return JO(this.configuration).listCollections(e.chainName,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const YO=function(e){const t=function(e){return{listNFTOwners:async(t,r,n,i,s,o={})=>{DO("listNFTOwners","contractAddress",t),DO("listNFTOwners","tokenId",r),DO("listNFTOwners","chainName",n);const a="/v1/chains/{chain_name}/collections/{contract_address}/nfts/{token_id}/owners".replace("{contract_address}",encodeURIComponent(String(t))).replace("{token_id}",encodeURIComponent(String(r))).replace("{chain_name}",encodeURIComponent(String(n))),u=new URL(a,jO);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...o},l={};void 0!==i&&(l.page_cursor=i),void 0!==s&&(l.page_size=s),qO(u,l);let d=c&&c.headers?c.headers:{};return f.headers={...d,...o.headers},{url:KO(u),options:f}}}}(e);return{async listNFTOwners(r,n,i,s,o,a){const u=await t.listNFTOwners(r,n,i,s,o,a);return HO(u,CO,BO,e)}}};class QO extends UO{listNFTOwners(e,t){return YO(this.configuration).listNFTOwners(e.contractAddress,e.tokenId,e.chainName,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const ZO=function(e){const t=function(e){return{getNFT:async(t,r,n,i={})=>{DO("getNFT","contractAddress",t),DO("getNFT","tokenId",r),DO("getNFT","chainName",n);const s="/v1/chains/{chain_name}/collections/{contract_address}/nfts/{token_id}".replace("{contract_address}",encodeURIComponent(String(t))).replace("{token_id}",encodeURIComponent(String(r))).replace("{chain_name}",encodeURIComponent(String(n))),o=new URL(s,jO);let a;e&&(a=e.baseOptions);const u={method:"GET",...a,...i};qO(o,{});let c=a&&a.headers?a.headers:{};return u.headers={...c,...i.headers},{url:KO(o),options:u}},listNFTs:async(t,r,n,i,s={})=>{DO("listNFTs","contractAddress",t),DO("listNFTs","chainName",r);const o="/v1/chains/{chain_name}/collections/{contract_address}/nfts".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),a=new URL(o,jO);let u;e&&(u=e.baseOptions);const c={method:"GET",...u,...s},f={};void 0!==n&&(f.page_cursor=n),void 0!==i&&(f.page_size=i),qO(a,f);let l=u&&u.headers?u.headers:{};return c.headers={...l,...s.headers},{url:KO(a),options:c}},listNFTsByAccountAddress:async(t,r,n,i,s,o={})=>{DO("listNFTsByAccountAddress","accountAddress",t),DO("listNFTsByAccountAddress","chainName",r);const a="/v1/chains/{chain_name}/accounts/{account_address}/nfts".replace("{account_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),u=new URL(a,jO);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...o},l={};void 0!==n&&(l.contract_address=n),void 0!==i&&(l.page_cursor=i),void 0!==s&&(l.page_size=s),qO(u,l);let d=c&&c.headers?c.headers:{};return f.headers={...d,...o.headers},{url:KO(u),options:f}}}}(e);return{async getNFT(r,n,i,s){const o=await t.getNFT(r,n,i,s);return HO(o,CO,BO,e)},async listNFTs(r,n,i,s,o){const a=await t.listNFTs(r,n,i,s,o);return HO(a,CO,BO,e)},async listNFTsByAccountAddress(r,n,i,s,o,a){const u=await t.listNFTsByAccountAddress(r,n,i,s,o,a);return HO(u,CO,BO,e)}}};class eI extends UO{getNFT(e,t){return ZO(this.configuration).getNFT(e.contractAddress,e.tokenId,e.chainName,t).then((e=>e(this.axios,this.basePath)))}listNFTs(e,t){return ZO(this.configuration).listNFTs(e.contractAddress,e.chainName,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}listNFTsByAccountAddress(e,t){return ZO(this.configuration).listNFTsByAccountAddress(e.accountAddress,e.chainName,e.contractAddress,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const tI=function(e){const t=function(e){return{createListing:async(t,r,n={})=>{DO("createListing","chainName",t),DO("createListing","createListingRequestBody",r);const i="/v1/chains/{chain_name}/orders/listings".replace("{chain_name}",encodeURIComponent(String(t))),s=new URL(i,jO);let o;e&&(o=e.baseOptions);const a={method:"POST",...o,...n},u={"Content-Type":"application/json"};qO(s,{});let c=o&&o.headers?o.headers:{};return a.headers={...u,...c,...n.headers},a.data=zO(r,a,e),{url:KO(s),options:a}},getListing:async(t,r,n={})=>{DO("getListing","chainName",t),DO("getListing","listingId",r);const i="/v1/chains/{chain_name}/orders/listings/{listing_id}".replace("{chain_name}",encodeURIComponent(String(t))).replace("{listing_id}",encodeURIComponent(String(r))),s=new URL(i,jO);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...n};qO(s,{});let u=o&&o.headers?o.headers:{};return a.headers={...u,...n.headers},{url:KO(s),options:a}},listListings:async(t,r,n,i,s,o,a,u,c,f={})=>{DO("listListings","chainName",t);const l="/v1/chains/{chain_name}/orders/listings".replace("{chain_name}",encodeURIComponent(String(t))),d=new URL(l,jO);let h;e&&(h=e.baseOptions);const p={method:"GET",...h,...f},g={};void 0!==r&&(g.status=r),void 0!==n&&(g.sell_item_contract_address=n),void 0!==i&&(g.buy_item_contract_address=i),void 0!==s&&(g.sell_item_token_id=s),void 0!==o&&(g.page_size=o),void 0!==a&&(g.sort_by=a),void 0!==u&&(g.sort_direction=u),void 0!==c&&(g.page_cursor=c),qO(d,g);let m=h&&h.headers?h.headers:{};return p.headers={...m,...f.headers},{url:KO(d),options:p}}}}(e);return{async createListing(r,n,i){const s=await t.createListing(r,n,i);return HO(s,CO,BO,e)},async getListing(r,n,i){const s=await t.getListing(r,n,i);return HO(s,CO,BO,e)},async listListings(r,n,i,s,o,a,u,c,f,l){const d=await t.listListings(r,n,i,s,o,a,u,c,f,l);return HO(d,CO,BO,e)}}};class rI extends UO{createListing(e,t){return tI(this.configuration).createListing(e.chainName,e.createListingRequestBody,t).then((e=>e(this.axios,this.basePath)))}getListing(e,t){return tI(this.configuration).getListing(e.chainName,e.listingId,t).then((e=>e(this.axios,this.basePath)))}listListings(e,t){return tI(this.configuration).listListings(e.chainName,e.status,e.sellItemContractAddress,e.buyItemContractAddress,e.sellItemTokenId,e.pageSize,e.sortBy,e.sortDirection,e.pageCursor,t).then((e=>e(this.axios,this.basePath)))}}const nI=function(e){const t=function(e){return{createCounterfactualAddress:async(t,r={})=>{DO("createCounterfactualAddress","createCounterfactualAddressRequest",t);const n=new URL("/passport-mr/v1/counterfactual-address",jO);let i;e&&(i=e.baseOptions);const s={method:"POST",...i,...r},o={};await async function(e,t){if(t&&t.accessToken){const r="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+r}}(o,e),o["Content-Type"]="application/json",qO(n,{});let a=i&&i.headers?i.headers:{};return s.headers={...o,...a,...r.headers},s.data=zO(t,s,e),{url:KO(n),options:s}}}}(e);return{async createCounterfactualAddress(r,n){const i=await t.createCounterfactualAddress(r,n);return HO(i,CO,BO,e)}}};class iI extends UO{createCounterfactualAddress(e,t){return nI(this.configuration).createCounterfactualAddress(e.createCounterfactualAddressRequest,t).then((e=>e(this.axios,this.basePath)))}}class sI{config;activitiesApi;chainsApi;collectionApi;nftOwnersApi;nftsApi;ordersApi;passportApi;constructor(e){this.config=e,this.activitiesApi=new WO(e.indexer),this.chainsApi=new XO(e.indexer),this.collectionApi=new $O(e.indexer),this.nftOwnersApi=new QO(e.indexer),this.nftsApi=new eI(e.indexer),this.ordersApi=new rI(e.orderBook),this.passportApi=new iI(e.passport)}}const oI={"x-sdk-version":"ts-immutable-sdk-0.0.0"},aI=({basePath:e,headers:t})=>{if(!e.trim())throw Error("basePath can not be empty");const r={basePath:e,baseOptions:{headers:{...oI,...t||{}}}};return new class{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}(r)},uI=()=>({indexer:aI({basePath:"https://indexer-mr.imtbl.com"}),orderBook:aI({basePath:"https://order-book-mr.imtbl.com"}),passport:aI({basePath:"https://api.immutable.com"})}),cI=()=>({indexer:aI({basePath:"https://indexer-mr.sandbox.imtbl.com"}),orderBook:aI({basePath:"https://order-book-mr.sandbox.imtbl.com"}),passport:aI({basePath:"https://api.sandbox.immutable.com"})});var fI={exports:{}};!function(e,t){e.exports=function(){var e=e||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==r&&r.crypto&&(n=r.crypto),!n)try{n=sf}catch(e){}var i=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),o={},a=o.lib={},u=a.Base={extend:function(e){var t=s(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)}},c=a.WordArray=u.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||l).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 s=0;s<i;s++){var o=r[s>>>2]>>>24-s%4*8&255;t[n+s>>>2]|=o<<24-(n+s)%4*8}else for(var a=0;a<i;a+=4)t[n+a>>>2]=r[a>>>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=u.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(i());return new c.init(t,e)}}),f=o.enc={},l=f.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var s=t[i>>>2]>>>24-i%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new c.init(r,t/2)}},d=f.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var s=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new c.init(r,t)}},h=f.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=a.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new c.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,s=n.sigBytes,o=this.blockSize,a=s/(4*o),u=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,f=e.min(4*u,s);if(u){for(var l=0;l<u;l+=o)this._doProcessBlock(i,l);r=i.splice(0,u),n.sigBytes-=f}return new c.init(r,f)},clone:function(){var e=u.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});a.Hasher=p.extend({cfg:u.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new g.HMAC.init(e,r).finalize(t)}}});var g=o.algo={};return o}(Math);return e}()}(fI);var lI=fI.exports,dI=n(lI),hI={exports:{}};!function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,s=n.Hasher,o=r.algo,a=[],u=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(a[i]=r(t.pow(n,.5))),u[i]=r(t.pow(n,1/3)),i++),n++}();var c=[],f=o.SHA256=s.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],o=r[3],a=r[4],f=r[5],l=r[6],d=r[7],h=0;h<64;h++){if(h<16)c[h]=0|e[t+h];else{var p=c[h-15],g=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,m=c[h-2],y=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;c[h]=g+c[h-7]+y+c[h-16]}var b=n&i^n&s^i&s,v=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=d+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&f^~a&l)+u[h]+c[h];d=l,l=f,f=a,a=o+w|0,o=s,s=i,i=n,n=w+(v+b)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+a|0,r[5]=r[5]+f|0,r[6]=r[6]+l|0,r[7]=r[7]+d|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=s._createHelper(f),r.HmacSHA256=s._createHmacHelper(f)}(Math),e.SHA256}(lI)}(hI);var pI=n(hI.exports),gI={exports:{}};!function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var i=[],s=0,o=0;o<t;o++)if(o%4){var a=n[e.charCodeAt(o-1)]<<o%4*2|n[e.charCodeAt(o)]>>>6-o%4*2;i[s>>>2]|=a<<24-s%4*8,s++}return r.create(i,s)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],s=0;s<r;s+=3)for(var o=(t[s>>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,a=0;a<4&&s+.75*a<r;a++)i.push(n.charAt(o>>>6*(3-a)&63));var u=n.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var s=0;s<r.length;s++)i[r.charCodeAt(s)]=s}var o=r.charAt(64);if(o){var a=e.indexOf(o);-1!==a&&(t=a)}return n(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(lI)}(gI);var mI=n(gI.exports),yI={exports:{}};!function(e,t){e.exports=function(e){return e.enc.Utf8}(lI)}(yI);var bI=n(yI.exports);function vI(e){this.message=e}vI.prototype=new Error,vI.prototype.name="InvalidCharacterError";var wI="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new vI("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,s=0,o="";n=t.charAt(s++);~n&&(r=i%4?64*r+n:n,i++%4)?o+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return o};function _I(e){this.message=e}function EI(e,t){if("string"!=typeof e)throw new _I("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(wI(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return wI(t)}}(e.split(".")[r]))}catch(e){throw new _I("Invalid token specified: "+e.message)}}_I.prototype=new Error,_I.prototype.name="InvalidTokenError";var AI,SI,kI,xI={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},TI=(e=>(e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(TI||{});(kI=TI||(TI={})).reset=function(){AI=3,SI=xI},kI.setLevel=function(e){if(!(0<=e&&e<=4))throw new Error("Invalid log level");AI=e},kI.setLogger=function(e){SI=e};var RI=class{constructor(e){this._name=e}debug(...e){AI>=4&&SI.debug(RI._format(this._name,this._method),...e)}info(...e){AI>=3&&SI.info(RI._format(this._name,this._method),...e)}warn(...e){AI>=2&&SI.warn(RI._format(this._name,this._method),...e)}error(...e){AI>=1&&SI.error(RI._format(this._name,this._method),...e)}throw(e){throw this.error(e),e}create(e){const t=Object.create(this);return t._method=e,t.debug("begin"),t}static createStatic(e,t){const r=new RI(`${e}.${t}`);return r.debug("begin"),r}static _format(e,t){const r=`[${e}]`;return t?`${r} ${t}:`:r}static debug(e,...t){AI>=4&&SI.debug(RI._format(e),...t)}static info(e,...t){AI>=3&&SI.info(RI._format(e),...t)}static warn(e,...t){AI>=2&&SI.warn(RI._format(e),...t)}static error(e,...t){AI>=1&&SI.error(RI._format(e),...t)}};TI.reset();var OI=class{static _randomWord(){return dI.lib.WordArray.random(1).words[0]}static generateUUIDv4(){const e="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(+e^OI._randomWord()&15>>+e/4).toString(16)));return e.replace(/-/g,"")}static generateCodeVerifier(){return OI.generateUUIDv4()+OI.generateUUIDv4()+OI.generateUUIDv4()}static generateCodeChallenge(e){try{const t=pI(e);return mI.stringify(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(e){throw RI.error("CryptoUtils.generateCodeChallenge",e),e}}static generateBasicAuth(e,t){const r=bI.parse([e,t].join(":"));return mI.stringify(r)}},II=class{constructor(e){this._name=e,this._logger=new RI(`Event('${this._name}')`),this._callbacks=[]}addHandler(e){return this._callbacks.push(e),()=>this.removeHandler(e)}removeHandler(e){const t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}raise(...e){this._logger.debug("raise:",...e);for(const t of this._callbacks)t(...e)}},MI=class{static decode(e){try{return EI(e)}catch(e){throw RI.error("JwtUtils.decode",e),e}}},PI=class{static center({...e}){var t;return null==e.width&&(e.width=null!=(t=[800,720,600,480].find((e=>e<=window.outerWidth/1.618)))?t:360),null!=e.left||(e.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-e.width)/2))),null!=e.height&&(null!=e.top||(e.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-e.height)/2)))),e}static serialize(e){return Object.entries(e).filter((([,e])=>null!=e)).map((([e,t])=>`${e}=${"boolean"!=typeof t?t:t?"yes":"no"}`)).join(",")}},NI=class extends II{constructor(){super(...arguments),this._logger=new RI(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const e=this._expiration-NI.getEpochTime();this._logger.debug("timer completes in",e),this._expiration<=NI.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(e){const t=this._logger.create("init");e=Math.max(Math.floor(e),1);const r=NI.getEpochTime()+e;if(this.expiration===r&&this._timerHandle)return void t.debug("skipping since already initialized for expiration at",this.expiration);this.cancel(),t.debug("using duration",e),this._expiration=r;const n=Math.min(e,5);this._timerHandle=setInterval(this._callback,1e3*n)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},CI=class{static readParams(e,t="query"){if(!e)throw new TypeError("Invalid URL");const r=new URL(e,"http://127.0.0.1")["fragment"===t?"hash":"search"];return new URLSearchParams(r.slice(1))}},BI=class extends Error{constructor(e,t){var r,n,i;if(super(e.error_description||e.error||""),this.form=t,this.name="ErrorResponse",!e.error)throw RI.error("ErrorResponse","No error passed"),new Error("No error passed");this.error=e.error,this.error_description=null!=(r=e.error_description)?r:null,this.error_uri=null!=(n=e.error_uri)?n:null,this.state=e.userState,this.session_state=null!=(i=e.session_state)?i:null}},UI=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},LI=class{constructor(e){this._logger=new RI("AccessTokenEvents"),this._expiringTimer=new NI("Access token expiring"),this._expiredTimer=new NI("Access token expired"),this._expiringNotificationTimeInSeconds=e.expiringNotificationTimeInSeconds}load(e){const t=this._logger.create("load");if(e.access_token&&void 0!==e.expires_in){const r=e.expires_in;if(t.debug("access token present, remaining duration:",r),r>0){let e=r-this._expiringNotificationTimeInSeconds;e<=0&&(e=1),t.debug("registering expiring timer, raising in",e,"seconds"),this._expiringTimer.init(e)}else t.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();const n=r+1;t.debug("registering expired timer, raising in",n,"seconds"),this._expiredTimer.init(n)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(e){return this._expiringTimer.addHandler(e)}removeAccessTokenExpiring(e){this._expiringTimer.removeHandler(e)}addAccessTokenExpired(e){return this._expiredTimer.addHandler(e)}removeAccessTokenExpired(e){this._expiredTimer.removeHandler(e)}},jI=class{constructor(){this._logger=new RI("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(e){return this._logger.create(`getItem('${e}')`),this._data[e]}setItem(e,t){this._logger.create(`setItem('${e}')`),this._data[e]=t}removeItem(e){this._logger.create(`removeItem('${e}')`),delete this._data[e]}get length(){return Object.getOwnPropertyNames(this._data).length}key(e){return Object.getOwnPropertyNames(this._data)[e]}},DI=class{constructor(e=[],t=null,r={}){this._jwtHandler=t,this._extraHeaders=r,this._logger=new RI("JsonService"),this._contentTypes=[],this._contentTypes.push(...e,"application/json"),t&&this._contentTypes.push("application/jwt")}async fetchWithTimeout(e,t={}){const{timeoutInSeconds:r,...n}=t;if(!r)return await fetch(e,n);const i=new AbortController,s=setTimeout((()=>i.abort()),1e3*r);try{return await fetch(e,{...t,signal:i.signal})}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)throw new UI("Network timed out");throw e}finally{clearTimeout(s)}}async getJson(e,{token:t,credentials:r}={}){const n=this._logger.create("getJson"),i={Accept:this._contentTypes.join(", ")};let s;t&&(n.debug("token passed, setting Authorization header"),i.Authorization="Bearer "+t),this.appendExtraHeaders(i);try{n.debug("url:",e),s=await this.fetchWithTimeout(e,{method:"GET",headers:i,credentials:r})}catch(e){throw n.error("Network Error"),e}n.debug("HTTP response received, status",s.status);const o=s.headers.get("Content-Type");if(o&&!this._contentTypes.find((e=>o.startsWith(e)))&&n.throw(new Error(`Invalid response Content-Type: ${null!=o?o:"undefined"}, from URL: ${e}`)),s.ok&&this._jwtHandler&&(null==o?void 0:o.startsWith("application/jwt")))return await this._jwtHandler(await s.text());let a;try{a=await s.json()}catch(e){if(n.error("Error parsing JSON response",e),s.ok)throw e;throw new Error(`${s.statusText} (${s.status})`)}if(!s.ok){if(n.error("Error from server:",a),a.error)throw new BI(a);throw new Error(`${s.statusText} (${s.status}): ${JSON.stringify(a)}`)}return a}async postForm(e,{body:t,basicAuth:r,timeoutInSeconds:n,initCredentials:i}){const s=this._logger.create("postForm"),o={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded"};let a;void 0!==r&&(o.Authorization="Basic "+r),this.appendExtraHeaders(o);try{s.debug("url:",e),a=await this.fetchWithTimeout(e,{method:"POST",headers:o,body:t,timeoutInSeconds:n,credentials:i})}catch(e){throw s.error("Network error"),e}s.debug("HTTP response received, status",a.status);const u=a.headers.get("Content-Type");if(u&&!this._contentTypes.find((e=>u.startsWith(e))))throw new Error(`Invalid response Content-Type: ${null!=u?u:"undefined"}, from URL: ${e}`);const c=await a.text();let f={};if(c)try{f=JSON.parse(c)}catch(e){if(s.error("Error parsing JSON response",e),a.ok)throw e;throw new Error(`${a.statusText} (${a.status})`)}if(!a.ok){if(s.error("Error from server:",f),f.error)throw new BI(f,t);throw new Error(`${a.statusText} (${a.status}): ${JSON.stringify(f)}`)}return f}appendExtraHeaders(e){const t=this._logger.create("appendExtraHeaders"),r=Object.keys(this._extraHeaders),n=["authorization","accept","content-type"];0!==r.length&&r.forEach((r=>{if(n.includes(r.toLocaleLowerCase()))return void t.warn("Protected header could not be overridden",r,n);const i="function"==typeof this._extraHeaders[r]?this._extraHeaders[r]():this._extraHeaders[r];i&&""!==i&&(e[r]=i)}))}},FI=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new RI("WebStorageStateStore"),this._store=t,this._prefix=e}async set(e,t){this._logger.create(`set('${e}')`),e=this._prefix+e,await this._store.setItem(e,t)}async get(e){this._logger.create(`get('${e}')`),e=this._prefix+e;return await this._store.getItem(e)}async remove(e){this._logger.create(`remove('${e}')`),e=this._prefix+e;const t=await this._store.getItem(e);return await this._store.removeItem(e),t}async getAllKeys(){this._logger.create("getAllKeys");const e=await this._store.length,t=[];for(let r=0;r<e;r++){const e=await this._store.key(r);e&&0===e.indexOf(this._prefix)&&t.push(e.substr(this._prefix.length))}return t}},qI=class{constructor({authority:e,metadataUrl:t,metadata:r,signingKeys:n,metadataSeed:i,client_id:s,client_secret:o,response_type:a="code",scope:u="openid",redirect_uri:c,post_logout_redirect_uri:f,client_authentication:l="client_secret_post",prompt:d,display:h,max_age:p,ui_locales:g,acr_values:m,resource:y,response_mode:b="query",filterProtocolClaims:v=!0,loadUserInfo:w=!1,staleStateAgeInSeconds:_=900,clockSkewInSeconds:E=300,userInfoJwtIssuer:A="OP",mergeClaims:S=!1,disablePKCE:k=!1,stateStore:x,refreshTokenCredentials:T,revokeTokenAdditionalContentTypes:R,fetchRequestCredentials:O,refreshTokenAllowedScope:I,extraQueryParams:M={},extraTokenParams:P={},extraHeaders:N={}}){if(this.authority=e,t?this.metadataUrl=t:(this.metadataUrl=e,e&&(this.metadataUrl.endsWith("/")||(this.metadataUrl+="/"),this.metadataUrl+=".well-known/openid-configuration")),this.metadata=r,this.metadataSeed=i,this.signingKeys=n,this.client_id=s,this.client_secret=o,this.response_type=a,this.scope=u,this.redirect_uri=c,this.post_logout_redirect_uri=f,this.client_authentication=l,this.prompt=d,this.display=h,this.max_age=p,this.ui_locales=g,this.acr_values=m,this.resource=y,this.response_mode=b,this.filterProtocolClaims=null==v||v,this.loadUserInfo=!!w,this.staleStateAgeInSeconds=_,this.clockSkewInSeconds=E,this.userInfoJwtIssuer=A,this.mergeClaims=!!S,this.disablePKCE=!!k,this.revokeTokenAdditionalContentTypes=R,O&&T&&console.warn("Both fetchRequestCredentials and refreshTokenCredentials is set. Only fetchRequestCredentials will be used."),this.fetchRequestCredentials=O||(T||"same-origin"),x)this.stateStore=x;else{const e="undefined"!=typeof window?window.localStorage:new jI;this.stateStore=new FI({store:e})}this.refreshTokenAllowedScope=I,this.extraQueryParams=M,this.extraTokenParams=P,this.extraHeaders=N}},zI=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new RI("TokenClient"),this._jsonService=new DI(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}async exchangeCode({grant_type:e="authorization_code",redirect_uri:t=this._settings.redirect_uri,client_id:r=this._settings.client_id,client_secret:n=this._settings.client_secret,...i}){const s=this._logger.create("exchangeCode");r||s.throw(new Error("A client_id is required")),t||s.throw(new Error("A redirect_uri is required")),i.code||s.throw(new Error("A code is required"));const o=new URLSearchParams({grant_type:e,redirect_uri:t});for(const[e,t]of Object.entries(i))null!=t&&o.set(e,t);let a;switch(this._settings.client_authentication){case"client_secret_basic":if(!n)throw s.throw(new Error("A client_secret is required")),null;a=OI.generateBasicAuth(r,n);break;case"client_secret_post":o.append("client_id",r),n&&o.append("client_secret",n)}const u=await this._metadataService.getTokenEndpoint(!1);s.debug("got token endpoint");const c=await this._jsonService.postForm(u,{body:o,basicAuth:a,initCredentials:this._settings.fetchRequestCredentials});return s.debug("got response"),c}async exchangeCredentials({grant_type:e="password",client_id:t=this._settings.client_id,client_secret:r=this._settings.client_secret,scope:n=this._settings.scope,...i}){const s=this._logger.create("exchangeCredentials");t||s.throw(new Error("A client_id is required"));const o=new URLSearchParams({grant_type:e,scope:n});for(const[e,t]of Object.entries(i))null!=t&&o.set(e,t);let a;switch(this._settings.client_authentication){case"client_secret_basic":if(!r)throw s.throw(new Error("A client_secret is required")),null;a=OI.generateBasicAuth(t,r);break;case"client_secret_post":o.append("client_id",t),r&&o.append("client_secret",r)}const u=await this._metadataService.getTokenEndpoint(!1);s.debug("got token endpoint");const c=await this._jsonService.postForm(u,{body:o,basicAuth:a,initCredentials:this._settings.fetchRequestCredentials});return s.debug("got response"),c}async exchangeRefreshToken({grant_type:e="refresh_token",client_id:t=this._settings.client_id,client_secret:r=this._settings.client_secret,timeoutInSeconds:n,...i}){const s=this._logger.create("exchangeRefreshToken");t||s.throw(new Error("A client_id is required")),i.refresh_token||s.throw(new Error("A refresh_token is required"));const o=new URLSearchParams({grant_type:e});for(const[e,t]of Object.entries(i))null!=t&&o.set(e,t);let a;switch(this._settings.client_authentication){case"client_secret_basic":if(!r)throw s.throw(new Error("A client_secret is required")),null;a=OI.generateBasicAuth(t,r);break;case"client_secret_post":o.append("client_id",t),r&&o.append("client_secret",r)}const u=await this._metadataService.getTokenEndpoint(!1);s.debug("got token endpoint");const c=await this._jsonService.postForm(u,{body:o,basicAuth:a,timeoutInSeconds:n,initCredentials:this._settings.fetchRequestCredentials});return s.debug("got response"),c}async revoke(e){var t;const r=this._logger.create("revoke");e.token||r.throw(new Error("A token is required"));const n=await this._metadataService.getRevocationEndpoint(!1);r.debug(`got revocation endpoint, revoking ${null!=(t=e.token_type_hint)?t:"default token type"}`);const i=new URLSearchParams;for(const[t,r]of Object.entries(e))null!=r&&i.set(t,r);i.set("client_id",this._settings.client_id),this._settings.client_secret&&i.set("client_secret",this._settings.client_secret),await this._jsonService.postForm(n,{body:i}),r.debug("got response")}},KI=class{constructor(e){this.id=e.id||OI.generateUUIDv4(),this.data=e.data,e.created&&e.created>0?this.created=e.created:this.created=NI.getEpochTime(),this.request_type=e.request_type}toStorageString(){return new RI("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})}static fromStorageString(e){return RI.createStatic("State","fromStorageString"),new KI(JSON.parse(e))}static async clearStaleState(e,t){const r=RI.createStatic("State","clearStaleState"),n=NI.getEpochTime()-t,i=await e.getAllKeys();r.debug("got keys",i);for(let t=0;t<i.length;t++){const s=i[t],o=await e.get(s);let a=!1;if(o)try{const e=KI.fromStorageString(o);r.debug("got item from key:",s,e.created),e.created<=n&&(a=!0)}catch(e){r.error("Error parsing state for key:",s,e),a=!0}else r.debug("no item in storage for key:",s),a=!0;a&&(r.debug("removed item for key:",s),e.remove(s))}}},HI=class extends KI{constructor(e){super(e),!0===e.code_verifier?this.code_verifier=OI.generateCodeVerifier():e.code_verifier&&(this.code_verifier=e.code_verifier),this.code_verifier&&(this.code_challenge=OI.generateCodeChallenge(this.code_verifier)),this.authority=e.authority,this.client_id=e.client_id,this.redirect_uri=e.redirect_uri,this.scope=e.scope,this.client_secret=e.client_secret,this.extraTokenParams=e.extraTokenParams,this.response_mode=e.response_mode,this.skipUserInfo=e.skipUserInfo}toStorageString(){return new RI("SigninState").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,code_verifier:this.code_verifier,authority:this.authority,client_id:this.client_id,redirect_uri:this.redirect_uri,scope:this.scope,client_secret:this.client_secret,extraTokenParams:this.extraTokenParams,response_mode:this.response_mode,skipUserInfo:this.skipUserInfo})}static fromStorageString(e){RI.createStatic("SigninState","fromStorageString");const t=JSON.parse(e);return new HI(t)}},GI=class{constructor(e){this.access_token="",this.token_type="",this.profile={},this.state=e.get("state"),this.session_state=e.get("session_state"),this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri"),this.code=e.get("code")}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-NI.getEpochTime()}set expires_in(e){"string"==typeof e&&(e=Number(e)),void 0!==e&&e>=0&&(this.expires_at=Math.floor(e)+NI.getEpochTime())}get isOpenId(){var e;return(null==(e=this.scope)?void 0:e.split(" ").includes("openid"))||!!this.id_token}},WI=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],VI=["sub","iss","aud","exp","iat"],XI=class{constructor(e){var t;this.id_token=e.id_token,this.session_state=null!=(t=e.session_state)?t:null,this.access_token=e.access_token,this.refresh_token=e.refresh_token,this.token_type=e.token_type,this.scope=e.scope,this.profile=e.profile,this.expires_at=e.expires_at,this.state=e.userState}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-NI.getEpochTime()}set expires_in(e){void 0!==e&&(this.expires_at=Math.floor(e)+NI.getEpochTime())}get expired(){const e=this.expires_in;if(void 0!==e)return e<=0}get scopes(){var e,t;return null!=(t=null==(e=this.scope)?void 0:e.split(" "))?t:[]}toStorageString(){return new RI("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(e){return RI.createStatic("User","fromStorageString"),new XI(JSON.parse(e))}},JI="oidc-client",$I=class{constructor(){this._abort=new II("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}async navigate(e){const t=this._logger.create("navigate");if(!this._window)throw new Error("Attempted to navigate on a disposed window");t.debug("setting URL in window"),this._window.location.replace(e.url);const{url:r,keepOpen:n}=await new Promise(((r,n)=>{const i=i=>{var s;const o=i.data,a=null!=(s=e.scriptOrigin)?s:window.location.origin;if(i.origin===a&&(null==o?void 0:o.source)===JI){try{const r=CI.readParams(o.url,e.response_mode).get("state");if(r||t.warn("no state found in response url"),i.source!==this._window&&r!==e.state)return}catch(e){this._dispose(),n(new Error("Invalid response from window"))}r(o)}};window.addEventListener("message",i,!1),this._disposeHandlers.add((()=>window.removeEventListener("message",i,!1))),this._disposeHandlers.add(this._abort.addHandler((e=>{this._dispose(),n(e)})))}));return t.debug("got response from window"),this._dispose(),n||this.close(),{url:r}}_dispose(){this._logger.create("_dispose");for(const e of this._disposeHandlers)e();this._disposeHandlers.clear()}static _notifyParent(e,t,r=!1,n=window.location.origin){e.postMessage({source:JI,url:t,keepOpen:r},n)}},YI={location:!1,toolbar:!1,height:640},QI="_blank",ZI=60,eM=2,tM=10,rM=class extends qI{constructor(e){const{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:r=e.post_logout_redirect_uri,popupWindowFeatures:n=YI,popupWindowTarget:i=QI,redirectMethod:s="assign",redirectTarget:o="self",iframeNotifyParentOrigin:a=e.iframeNotifyParentOrigin,iframeScriptOrigin:u=e.iframeScriptOrigin,silent_redirect_uri:c=e.redirect_uri,silentRequestTimeoutInSeconds:f=tM,automaticSilentRenew:l=!0,validateSubOnSilentRenew:d=!0,includeIdTokenInSilentRenew:h=!1,monitorSession:p=!1,monitorAnonymousSession:g=!1,checkSessionIntervalInSeconds:m=eM,query_status_response_type:y="code",stopCheckSessionOnError:b=!0,revokeTokenTypes:v=["access_token","refresh_token"],revokeTokensOnSignout:w=!1,includeIdTokenInSilentSignout:_=!1,accessTokenExpiringNotificationTimeInSeconds:E=ZI,userStore:A}=e;if(super(e),this.popup_redirect_uri=t,this.popup_post_logout_redirect_uri=r,this.popupWindowFeatures=n,this.popupWindowTarget=i,this.redirectMethod=s,this.redirectTarget=o,this.iframeNotifyParentOrigin=a,this.iframeScriptOrigin=u,this.silent_redirect_uri=c,this.silentRequestTimeoutInSeconds=f,this.automaticSilentRenew=l,this.validateSubOnSilentRenew=d,this.includeIdTokenInSilentRenew=h,this.monitorSession=p,this.monitorAnonymousSession=g,this.checkSessionIntervalInSeconds=m,this.stopCheckSessionOnError=b,this.query_status_response_type=y,this.revokeTokenTypes=v,this.revokeTokensOnSignout=w,this.includeIdTokenInSilentSignout=_,this.accessTokenExpiringNotificationTimeInSeconds=E,A)this.userStore=A;else{const e="undefined"!=typeof window?window.sessionStorage:new jI;this.userStore=new FI({store:e})}}},nM=class extends $I{constructor({silentRequestTimeoutInSeconds:e=tM}){super(),this._logger=new RI("IFrameWindow"),this._timeoutInSeconds=e,this._frame=nM.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){const e=window.document.createElement("iframe");return e.style.visibility="hidden",e.style.position="fixed",e.style.left="-1000px",e.style.top="0",e.width="0",e.height="0",e.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),window.document.body.appendChild(e),e}async navigate(e){this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds);const t=setTimeout((()=>this._abort.raise(new UI("IFrame timed out without a response"))),1e3*this._timeoutInSeconds);return this._disposeHandlers.add((()=>clearTimeout(t))),await super.navigate(e)}close(){var e;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",(e=>{var t;const r=e.target;null==(t=r.parentNode)||t.removeChild(r),this._abort.raise(new Error("IFrame removed from DOM"))}),!0),null==(e=this._frame.contentWindow)||e.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(e,t){return super._notifyParent(window.parent,e,!1,t)}},iM=class extends $I{constructor({popupWindowTarget:e=QI,popupWindowFeatures:t={}}){super(),this._logger=new RI("PopupWindow");const r=PI.center({...YI,...t});this._window=window.open(void 0,e,PI.serialize(r))}async navigate(e){var t;null==(t=this._window)||t.focus();const r=setInterval((()=>{this._window&&!this._window.closed||this._abort.raise(new Error("Popup closed by user"))}),500);return this._disposeHandlers.add((()=>clearInterval(r))),await super.navigate(e)}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(e,t){if(!window.opener)throw new Error("No window.opener. Can't complete notification.");return super._notifyParent(window.opener,e,t)}},sM=class extends LI{constructor(e){super({expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new RI("UserManagerEvents"),this._userLoaded=new II("User loaded"),this._userUnloaded=new II("User unloaded"),this._silentRenewError=new II("Silent renew error"),this._userSignedIn=new II("User signed in"),this._userSignedOut=new II("User signed out"),this._userSessionChanged=new II("User session changed")}load(e,t=!0){super.load(e),t&&this._userLoaded.raise(e)}unload(){super.unload(),this._userUnloaded.raise()}addUserLoaded(e){return this._userLoaded.addHandler(e)}removeUserLoaded(e){return this._userLoaded.removeHandler(e)}addUserUnloaded(e){return this._userUnloaded.addHandler(e)}removeUserUnloaded(e){return this._userUnloaded.removeHandler(e)}addSilentRenewError(e){return this._silentRenewError.addHandler(e)}removeSilentRenewError(e){return this._silentRenewError.removeHandler(e)}_raiseSilentRenewError(e){this._silentRenewError.raise(e)}addUserSignedIn(e){return this._userSignedIn.addHandler(e)}removeUserSignedIn(e){this._userSignedIn.removeHandler(e)}_raiseUserSignedIn(){this._userSignedIn.raise()}addUserSignedOut(e){return this._userSignedOut.addHandler(e)}removeUserSignedOut(e){this._userSignedOut.removeHandler(e)}_raiseUserSignedOut(){this._userSignedOut.raise()}addUserSessionChanged(e){return this._userSessionChanged.addHandler(e)}removeUserSessionChanged(e){this._userSessionChanged.removeHandler(e)}_raiseUserSessionChanged(){this._userSessionChanged.raise()}};function oM(e,t){return function(){return e.apply(t,arguments)}}const{toString:aM}=Object.prototype,{getPrototypeOf:uM}=Object,cM=(e=>t=>{const r=aM.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),fM=e=>(e=e.toLowerCase(),t=>cM(t)===e),lM=e=>t=>typeof t===e,{isArray:dM}=Array,hM=lM("undefined");const pM=fM("ArrayBuffer");const gM=lM("string"),mM=lM("function"),yM=lM("number"),bM=e=>null!==e&&"object"==typeof e,vM=e=>{if("object"!==cM(e))return!1;const t=uM(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},wM=fM("Date"),_M=fM("File"),EM=fM("Blob"),AM=fM("FileList"),SM=fM("URLSearchParams");function kM(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),dM(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),s=i.length;let o;for(n=0;n<s;n++)o=i[n],t.call(null,e[o],o,e)}}function xM(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const TM="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,RM=e=>!hM(e)&&e!==TM;const OM=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&uM(Uint8Array)),IM=fM("HTMLFormElement"),MM=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),PM=fM("RegExp"),NM=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};kM(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},CM="abcdefghijklmnopqrstuvwxyz",BM="0123456789",UM={DIGIT:BM,ALPHA:CM,ALPHA_DIGIT:CM+CM.toUpperCase()+BM};const LM=fM("AsyncFunction");var jM={isArray:dM,isArrayBuffer:pM,isBuffer:function(e){return null!==e&&!hM(e)&&null!==e.constructor&&!hM(e.constructor)&&mM(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||mM(e.append)&&("formdata"===(t=cM(e))||"object"===t&&mM(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&pM(e.buffer),t},isString:gM,isNumber:yM,isBoolean:e=>!0===e||!1===e,isObject:bM,isPlainObject:vM,isUndefined:hM,isDate:wM,isFile:_M,isBlob:EM,isRegExp:PM,isFunction:mM,isStream:e=>bM(e)&&mM(e.pipe),isURLSearchParams:SM,isTypedArray:OM,isFileList:AM,forEach:kM,merge:function e(){const{caseless:t}=RM(this)&&this||{},r={},n=(n,i)=>{const s=t&&xM(r,i)||i;vM(r[s])&&vM(n)?r[s]=e(r[s],n):vM(n)?r[s]=e({},n):dM(n)?r[s]=n.slice():r[s]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&kM(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(kM(t,((t,n)=>{r&&mM(t)?e[n]=oM(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,s,o;const a={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)o=i[s],n&&!n(o,e,t)||a[o]||(t[o]=e[o],a[o]=!0);e=!1!==r&&uM(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:cM,kindOfTest:fM,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(dM(e))return e;let t=e.length;if(!yM(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:IM,hasOwnProperty:MM,hasOwnProp:MM,reduceDescriptors:NM,freezeMethods:e=>{NM(e,((t,r)=>{if(mM(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];mM(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 dM(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)=>(e=+e,Number.isFinite(e)?e:t),findKey:xM,global:TM,isContextDefined:RM,ALPHABET:UM,generateString:(e=16,t=UM.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&mM(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(bM(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=dM(e)?[]:{};return kM(e,((e,t)=>{const s=r(e,n+1);!hM(s)&&(i[t]=s)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:LM,isThenable:e=>e&&(bM(e)||mM(e))&&mM(e.then)&&mM(e.catch)};function DM(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)}jM.inherits(DM,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:jM.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const FM=DM.prototype,qM={};["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=>{qM[e]={value:e}})),Object.defineProperties(DM,qM),Object.defineProperty(FM,"isAxiosError",{value:!0}),DM.from=(e,t,r,n,i,s)=>{const o=Object.create(FM);return jM.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),DM.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,s&&Object.assign(o,s),o};function zM(e){return jM.isPlainObject(e)||jM.isArray(e)}function KM(e){return jM.endsWith(e,"[]")?e.slice(0,-2):e}function HM(e,t,r){return e?e.concat(t).map((function(e,t){return e=KM(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const GM=jM.toFlatObject(jM,{},null,(function(e){return/^is[A-Z]/.test(e)}));function WM(e,t,r){if(!jM.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=jM.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!jM.isUndefined(t[e])}))).metaTokens,i=r.visitor||c,s=r.dots,o=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&jM.isSpecCompliantForm(t);if(!jM.isFunction(i))throw new TypeError("visitor must be a function");function u(e){if(null===e)return"";if(jM.isDate(e))return e.toISOString();if(!a&&jM.isBlob(e))throw new DM("Blob is not supported. Use a Buffer instead.");return jM.isArrayBuffer(e)||jM.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,r,i){let a=e;if(e&&!i&&"object"==typeof e)if(jM.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(jM.isArray(e)&&function(e){return jM.isArray(e)&&!e.some(zM)}(e)||(jM.isFileList(e)||jM.endsWith(r,"[]"))&&(a=jM.toArray(e)))return r=KM(r),a.forEach((function(e,n){!jM.isUndefined(e)&&null!==e&&t.append(!0===o?HM([r],n,s):null===o?r:r+"[]",u(e))})),!1;return!!zM(e)||(t.append(HM(i,r,s),u(e)),!1)}const f=[],l=Object.assign(GM,{defaultVisitor:c,convertValue:u,isVisitable:zM});if(!jM.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!jM.isUndefined(r)){if(-1!==f.indexOf(r))throw Error("Circular reference detected in "+n.join("."));f.push(r),jM.forEach(r,(function(r,s){!0===(!(jM.isUndefined(r)||null===r)&&i.call(t,r,jM.isString(s)?s.trim():s,n,l))&&e(r,n?n.concat(s):[s])})),f.pop()}}(e),t}function VM(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function XM(e,t){this._pairs=[],e&&WM(e,this,t)}const JM=XM.prototype;function $M(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function YM(e,t,r){if(!t)return e;const n=r&&r.encode||$M,i=r&&r.serialize;let s;if(s=i?i(t,r):jM.isURLSearchParams(t)?t.toString():new XM(t,r).toString(n),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}JM.append=function(e,t){this._pairs.push([e,t])},JM.toString=function(e){const t=e?function(t){return e.call(this,t,VM)}:VM;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var QM=class{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){jM.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},ZM={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var eP={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:XM,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function tP(e){function t(e,r,n,i){let s=e[i++];const o=Number.isFinite(+s),a=i>=e.length;if(s=!s&&jM.isArray(n)?n.length:s,a)return jM.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!o;n[s]&&jM.isObject(n[s])||(n[s]=[]);return t(e,r,n[s],i)&&jM.isArray(n[s])&&(n[s]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let s;for(n=0;n<i;n++)s=r[n],t[s]=e[s];return t}(n[s])),!o}if(jM.isFormData(e)&&jM.isFunction(e.entries)){const r={};return jM.forEachEntry(e,((e,n)=>{t(function(e){return jM.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const rP={"Content-Type":void 0};const nP={transitional:ZM,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=jM.isObject(e);i&&jM.isHTMLForm(e)&&(e=new FormData(e));if(jM.isFormData(e))return n&&n?JSON.stringify(tP(e)):e;if(jM.isArrayBuffer(e)||jM.isBuffer(e)||jM.isStream(e)||jM.isFile(e)||jM.isBlob(e))return e;if(jM.isArrayBufferView(e))return e.buffer;if(jM.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return WM(e,new eP.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return eP.isNode&&jM.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((s=jM.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return WM(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(jM.isString(e))try{return(t||JSON.parse)(e),jM.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||nP.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&jM.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 DM.from(e,DM.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:eP.classes.FormData,Blob:eP.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};jM.forEach(["delete","get","head"],(function(e){nP.headers[e]={}})),jM.forEach(["post","put","patch"],(function(e){nP.headers[e]=jM.merge(rP)}));var iP=nP;const sP=jM.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 oP=Symbol("internals");function aP(e){return e&&String(e).trim().toLowerCase()}function uP(e){return!1===e||null==e?e:jM.isArray(e)?e.map(uP):String(e)}function cP(e,t,r,n,i){return jM.isFunction(n)?n.call(this,t,r):(i&&(t=r),jM.isString(t)?jM.isString(n)?-1!==t.indexOf(n):jM.isRegExp(n)?n.test(t):void 0:void 0)}let fP=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=aP(t);if(!i)throw new Error("header name must be a non-empty string");const s=jM.findKey(n,i);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||t]=uP(e))}const s=(e,t)=>jM.forEach(e,((e,r)=>i(e,r,t)));return jM.isPlainObject(e)||e instanceof this.constructor?s(e,t):jM.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?s((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]&&sP[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&i(t,e,r),this}get(e,t){if(e=aP(e)){const r=jM.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(jM.isFunction(t))return t.call(this,e,r);if(jM.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=aP(e)){const r=jM.findKey(this,e);return!(!r||void 0===this[r]||t&&!cP(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=aP(e)){const i=jM.findKey(r,e);!i||t&&!cP(0,r[i],i,t)||(delete r[i],n=!0)}}return jM.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&&!cP(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return jM.forEach(this,((n,i)=>{const s=jM.findKey(r,i);if(s)return t[s]=uP(n),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();o!==i&&delete t[i],t[o]=uP(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return jM.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&jM.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[oP]=this[oP]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=aP(e);t[n]||(!function(e,t){const r=jM.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 jM.isArray(e)?e.forEach(n):n(e),this}};fP.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),jM.freezeMethods(fP.prototype),jM.freezeMethods(fP);var lP=fP;function dP(e,t){const r=this||iP,n=t||r,i=lP.from(n.headers);let s=n.data;return jM.forEach(e,(function(e){s=e.call(r,s,i.normalize(),t?t.status:void 0)})),i.normalize(),s}function hP(e){return!(!e||!e.__CANCEL__)}function pP(e,t,r){DM.call(this,null==e?"canceled":e,DM.ERR_CANCELED,t,r),this.name="CanceledError"}jM.inherits(pP,DM,{__CANCEL__:!0});var gP=eP.isStandardBrowserEnv?{write:function(e,t,r,n,i,s){const o=[];o.push(e+"="+encodeURIComponent(t)),jM.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),jM.isString(n)&&o.push("path="+n),jM.isString(i)&&o.push("domain="+i),!0===s&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function mP(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var yP=eP.isStandardBrowserEnv?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=jM.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function bP(e,t){let r=0;const n=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,s=0,o=0;return t=void 0!==t?t:1e3,function(a){const u=Date.now(),c=n[o];i||(i=u),r[s]=a,n[s]=u;let f=o,l=0;for(;f!==s;)l+=r[f++],f%=e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),u-i<t)return;const d=c&&u-c;return d?Math.round(1e3*l/d):void 0}}(50,250);return i=>{const s=i.loaded,o=i.lengthComputable?i.total:void 0,a=s-r,u=n(a);r=s;const c={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:u||void 0,estimated:u&&o&&s<=o?(o-s)/u:void 0,event:i};c[t?"download":"upload"]=!0,e(c)}}var vP="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=lP.from(e.headers).normalize(),s=e.responseType;let o;function a(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}jM.isFormData(n)&&(eP.isStandardBrowserEnv||eP.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let u=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+r))}const c=mP(e.baseURL,e.url);function f(){if(!u)return;const n=lP.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new DM("Request failed with status code "+r.status,[DM.ERR_BAD_REQUEST,DM.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),a()}),(function(e){r(e),a()}),{data:s&&"text"!==s&&"json"!==s?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:n,config:e,request:u}),u=null}if(u.open(e.method.toUpperCase(),YM(c,e.params,e.paramsSerializer),!0),u.timeout=e.timeout,"onloadend"in u?u.onloadend=f:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(f)},u.onabort=function(){u&&(r(new DM("Request aborted",DM.ECONNABORTED,e,u)),u=null)},u.onerror=function(){r(new DM("Network Error",DM.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||ZM;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new DM(t,n.clarifyTimeoutError?DM.ETIMEDOUT:DM.ECONNABORTED,e,u)),u=null},eP.isStandardBrowserEnv){const t=(e.withCredentials||yP(c))&&e.xsrfCookieName&&gP.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in u&&jM.forEach(i.toJSON(),(function(e,t){u.setRequestHeader(t,e)})),jM.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),s&&"json"!==s&&(u.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&u.addEventListener("progress",bP(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",bP(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{u&&(r(!t||t.type?new pP(null,e,u):t),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const l=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(c);l&&-1===eP.protocols.indexOf(l)?r(new DM("Unsupported protocol "+l+":",DM.ERR_BAD_REQUEST,e)):u.send(n||null)}))};const wP={http:null,xhr:vP};jM.forEach(wP,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var _P=e=>{e=jM.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=jM.isString(r)?wP[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new DM(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(jM.hasOwnProp(wP,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!jM.isFunction(n))throw new TypeError("adapter is not a function");return n};function EP(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new pP(null,e)}function AP(e){EP(e),e.headers=lP.from(e.headers),e.data=dP.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return _P(e.adapter||iP.adapter)(e).then((function(t){return EP(e),t.data=dP.call(e,e.transformResponse,t),t.headers=lP.from(t.headers),t}),(function(t){return hP(t)||(EP(e),t&&t.response&&(t.response.data=dP.call(e,e.transformResponse,t.response),t.response.headers=lP.from(t.response.headers))),Promise.reject(t)}))}const SP=e=>e instanceof lP?e.toJSON():e;function kP(e,t){t=t||{};const r={};function n(e,t,r){return jM.isPlainObject(e)&&jM.isPlainObject(t)?jM.merge.call({caseless:r},e,t):jM.isPlainObject(t)?jM.merge({},t):jM.isArray(t)?t.slice():t}function i(e,t,r){return jM.isUndefined(t)?jM.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function s(e,t){if(!jM.isUndefined(t))return n(void 0,t)}function o(e,t){return jM.isUndefined(t)?jM.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,i,s){return s in t?n(r,i):s in e?n(void 0,r):void 0}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(e,t)=>i(SP(e),SP(t),!0)};return jM.forEach(Object.keys(Object.assign({},e,t)),(function(n){const s=u[n]||i,o=s(e[n],t[n],n);jM.isUndefined(o)&&s!==a||(r[n]=o)})),r}const xP="1.4.0",TP={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{TP[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const RP={};TP.transitional=function(e,t,r){function n(e,t){return"[Axios v1.4.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,s)=>{if(!1===e)throw new DM(n(i," has been removed"+(t?" in "+t:"")),DM.ERR_DEPRECATED);return t&&!RP[i]&&(RP[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,s)}};var OP={assertOptions:function(e,t,r){if("object"!=typeof e)throw new DM("options must be an object",DM.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const s=n[i],o=t[s];if(o){const t=e[s],r=void 0===t||o(t,s,e);if(!0!==r)throw new DM("option "+s+" must be "+r,DM.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new DM("Unknown option "+s,DM.ERR_BAD_OPTION)}},validators:TP};const IP=OP.validators;let MP=class{constructor(e){this.defaults=e,this.interceptors={request:new QM,response:new QM}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=kP(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let s;void 0!==r&&OP.assertOptions(r,{silentJSONParsing:IP.transitional(IP.boolean),forcedJSONParsing:IP.transitional(IP.boolean),clarifyTimeoutError:IP.transitional(IP.boolean)},!1),null!=n&&(jM.isFunction(n)?t.paramsSerializer={serialize:n}:OP.assertOptions(n,{encode:IP.function,serialize:IP.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),s=i&&jM.merge(i.common,i[t.method]),s&&jM.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=lP.concat(s,i);const o=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));const u=[];let c;this.interceptors.response.forEach((function(e){u.push(e.fulfilled,e.rejected)}));let f,l=0;if(!a){const e=[AP.bind(this),void 0];for(e.unshift.apply(e,o),e.push.apply(e,u),f=e.length,c=Promise.resolve(t);l<f;)c=c.then(e[l++],e[l++]);return c}f=o.length;let d=t;for(l=0;l<f;){const e=o[l++],t=o[l++];try{d=e(d)}catch(e){t.call(this,e);break}}try{c=AP.call(this,d)}catch(e){return Promise.reject(e)}for(l=0,f=u.length;l<f;)c=c.then(u[l++],u[l++]);return c}getUri(e){return YM(mP((e=kP(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}};jM.forEach(["delete","get","head","options"],(function(e){MP.prototype[e]=function(t,r){return this.request(kP(r||{},{method:e,url:t,data:(r||{}).data}))}})),jM.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(kP(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}MP.prototype[e]=t(),MP.prototype[e+"Form"]=t(!0)}));var PP=MP;var NP=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 pP(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;const r=new e((function(e){t=e}));return{token:r,cancel:t}}};const CP={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(CP).forEach((([e,t])=>{CP[t]=e}));var BP=CP;const UP=function e(t){const r=new PP(t),n=oM(PP.prototype.request,r);return jM.extend(n,PP.prototype,r,{allOwnKeys:!0}),jM.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(kP(t,r))},n}(iP);UP.Axios=PP,UP.CanceledError=pP,UP.CancelToken=NP,UP.isCancel=hP,UP.VERSION=xP,UP.toFormData=WM,UP.AxiosError=DM,UP.Cancel=UP.CanceledError,UP.all=function(e){return Promise.all(e)},UP.spread=function(e){return function(t){return e.apply(null,t)}},UP.isAxiosError=function(e){return jM.isObject(e)&&!0===e.isAxiosError},UP.mergeConfig=kP,UP.AxiosHeaders=lP,UP.formToJSON=e=>tP(jM.isHTMLForm(e)?new FormData(e):e),UP.HttpStatusCode=BP,UP.default=UP;var LP=UP,jP=(e=>(e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",e))(jP||{}),DP=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e))(DP||{}),FP=(e=>(e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",e[e.UpdateEmailFailed=-10004]="UpdateEmailFailed",e[e.UserRequestEditEmail=-10005]="UserRequestEditEmail",e[e.InactiveRecipient=-10010]="InactiveRecipient",e[e.AccessDeniedToUser=-10011]="AccessDeniedToUser",e))(FP||{}),qP=(e=>(e.LoginWithSms="magic_auth_login_with_sms",e.LoginWithEmailOTP="magic_auth_login_with_email_otp",e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.LoginWithCredential="magic_auth_login_with_credential",e.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_auth_is_logged_in",e.Logout="magic_auth_logout",e.UpdateEmail="magic_auth_update_email",e.UserSettings="magic_auth_settings",e.UserSettingsTestMode="magic_auth_settings_testing_mode",e.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",e.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",e.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",e.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",e.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",e.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",e.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",e.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",e.LogoutTestMode="magic_auth_logout_testing_mode",e.UpdateEmailTestMode="magic_auth_update_email_testing_mode",e.IntermediaryEvent="magic_intermediary_event",e.RequestAccounts="eth_requestAccounts",e.GetInfo="mc_get_wallet_info",e.ShowUI="mc_wallet",e.NFTPurchase="magic_nft_purchase",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.UpdatePhoneNumber="magic_auth_update_phone_number",e.UpdatePhoneNumberTestMode="magic_auth_update_phone_number_testing_mode",e.RecoverAccount="magic_auth_recover_account",e.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",e))(qP||{}),zP=(e=>(e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",e.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",e))(zP||{}),KP=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e))(KP||{}),HP=(e=>(e.Harmony="HARMONY",e))(HP||{}),GP=Object.create,WP=Object.defineProperty,VP=Object.defineProperties,XP=Object.getOwnPropertyDescriptor,JP=Object.getOwnPropertyDescriptors,$P=Object.getOwnPropertyNames,YP=Object.getOwnPropertySymbols,QP=Object.getPrototypeOf,ZP=Object.prototype.hasOwnProperty,eN=Object.prototype.propertyIsEnumerable,tN=(e,t,r)=>t in e?WP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,rN=(e,t)=>{for(var r in t||(t={}))ZP.call(t,r)&&tN(e,r,t[r]);if(YP)for(var r of YP(t))eN.call(t,r)&&tN(e,r,t[r]);return e},nN=(e,t,r)=>new Promise(((n,i)=>{var s=e=>{try{a(r.next(e))}catch(e){i(e)}},o=e=>{try{a(r.throw(e))}catch(e){i(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(s,o);a((r=r.apply(e,t)).next())})),iN=((e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports))(((e,t)=>{var r=Object.prototype.hasOwnProperty,n="~";function i(){}function s(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,r,i,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new s(r,i||e,o),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],a]:e._events[u].push(a):(e._events[u]=a,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function u(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),u.prototype.eventNames=function(){var e,t,i=[];if(0===this._eventsCount)return i;for(t in e=this._events)r.call(e,t)&&i.push(n?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},u.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,s=r.length,o=new Array(s);i<s;i++)o[i]=r[i].fn;return o},u.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},u.prototype.emit=function(e,t,r,i,s,o){var a=n?n+e:e;if(!this._events[a])return!1;var u,c,f=this._events[a],l=arguments.length;if(f.fn){switch(f.once&&this.removeListener(e,f.fn,void 0,!0),l){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,t),!0;case 3:return f.fn.call(f.context,t,r),!0;case 4:return f.fn.call(f.context,t,r,i),!0;case 5:return f.fn.call(f.context,t,r,i,s),!0;case 6:return f.fn.call(f.context,t,r,i,s,o),!0}for(c=1,u=new Array(l-1);c<l;c++)u[c-1]=arguments[c];f.fn.apply(f.context,u)}else{var d,h=f.length;for(c=0;c<h;c++)switch(f[c].once&&this.removeListener(e,f[c].fn,void 0,!0),l){case 1:f[c].fn.call(f[c].context);break;case 2:f[c].fn.call(f[c].context,t);break;case 3:f[c].fn.call(f[c].context,t,r);break;case 4:f[c].fn.call(f[c].context,t,r,i);break;default:if(!u)for(d=1,u=new Array(l-1);d<l;d++)u[d-1]=arguments[d];f[c].fn.apply(f[c].context,u)}}return!0},u.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},u.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},u.prototype.removeListener=function(e,t,r,i){var s=n?n+e:e;if(!this._events[s])return this;if(!t)return a(this,s),this;var o=this._events[s];if(o.fn)o.fn===t&&(!i||o.once)&&(!r||o.context===r)&&a(this,s);else{for(var u=0,c=[],f=o.length;u<f;u++)(o[u].fn!==t||i&&!o[u].once||r&&o[u].context!==r)&&c.push(o[u]);c.length?this._events[s]=1===c.length?c[0]:c:a(this,s)}return this},u.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=n,u.EventEmitter=u,typeof t<"u"&&(t.exports=u)}));var sN={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH:16},oN="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},aN=oN,uN=function(e){let t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:r}=sN,n=(t=e.exports={}).re=[],i=t.src=[],s=t.t={},o=0,a=(e,t,r)=>{let a=o++;aN(a,t),s[e]=a,i[a]=t,n[a]=new RegExp(t,r?"g":void 0)};a("NUMERICIDENTIFIER","0|[1-9]\\d*"),a("NUMERICIDENTIFIERLOOSE","[0-9]+"),a("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),a("MAINVERSION",`(${i[s.NUMERICIDENTIFIER]})\\.(${i[s.NUMERICIDENTIFIER]})\\.(${i[s.NUMERICIDENTIFIER]})`),a("MAINVERSIONLOOSE",`(${i[s.NUMERICIDENTIFIERLOOSE]})\\.(${i[s.NUMERICIDENTIFIERLOOSE]})\\.(${i[s.NUMERICIDENTIFIERLOOSE]})`),a("PRERELEASEIDENTIFIER",`(?:${i[s.NUMERICIDENTIFIER]}|${i[s.NONNUMERICIDENTIFIER]})`),a("PRERELEASEIDENTIFIERLOOSE",`(?:${i[s.NUMERICIDENTIFIERLOOSE]}|${i[s.NONNUMERICIDENTIFIER]})`),a("PRERELEASE",`(?:-(${i[s.PRERELEASEIDENTIFIER]}(?:\\.${i[s.PRERELEASEIDENTIFIER]})*))`),a("PRERELEASELOOSE",`(?:-?(${i[s.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${i[s.PRERELEASEIDENTIFIERLOOSE]})*))`),a("BUILDIDENTIFIER","[0-9A-Za-z-]+"),a("BUILD",`(?:\\+(${i[s.BUILDIDENTIFIER]}(?:\\.${i[s.BUILDIDENTIFIER]})*))`),a("FULLPLAIN",`v?${i[s.MAINVERSION]}${i[s.PRERELEASE]}?${i[s.BUILD]}?`),a("FULL",`^${i[s.FULLPLAIN]}$`),a("LOOSEPLAIN",`[v=\\s]*${i[s.MAINVERSIONLOOSE]}${i[s.PRERELEASELOOSE]}?${i[s.BUILD]}?`),a("LOOSE",`^${i[s.LOOSEPLAIN]}$`),a("GTLT","((?:<|>)?=?)"),a("XRANGEIDENTIFIERLOOSE",`${i[s.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),a("XRANGEIDENTIFIER",`${i[s.NUMERICIDENTIFIER]}|x|X|\\*`),a("XRANGEPLAIN",`[v=\\s]*(${i[s.XRANGEIDENTIFIER]})(?:\\.(${i[s.XRANGEIDENTIFIER]})(?:\\.(${i[s.XRANGEIDENTIFIER]})(?:${i[s.PRERELEASE]})?${i[s.BUILD]}?)?)?`),a("XRANGEPLAINLOOSE",`[v=\\s]*(${i[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${i[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${i[s.XRANGEIDENTIFIERLOOSE]})(?:${i[s.PRERELEASELOOSE]})?${i[s.BUILD]}?)?)?`),a("XRANGE",`^${i[s.GTLT]}\\s*${i[s.XRANGEPLAIN]}$`),a("XRANGELOOSE",`^${i[s.GTLT]}\\s*${i[s.XRANGEPLAINLOOSE]}$`),a("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),a("COERCERTL",i[s.COERCE],!0),a("LONETILDE","(?:~>?)"),a("TILDETRIM",`(\\s*)${i[s.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",a("TILDE",`^${i[s.LONETILDE]}${i[s.XRANGEPLAIN]}$`),a("TILDELOOSE",`^${i[s.LONETILDE]}${i[s.XRANGEPLAINLOOSE]}$`),a("LONECARET","(?:\\^)"),a("CARETTRIM",`(\\s*)${i[s.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",a("CARET",`^${i[s.LONECARET]}${i[s.XRANGEPLAIN]}$`),a("CARETLOOSE",`^${i[s.LONECARET]}${i[s.XRANGEPLAINLOOSE]}$`),a("COMPARATORLOOSE",`^${i[s.GTLT]}\\s*(${i[s.LOOSEPLAIN]})$|^$`),a("COMPARATOR",`^${i[s.GTLT]}\\s*(${i[s.FULLPLAIN]})$|^$`),a("COMPARATORTRIM",`(\\s*)${i[s.GTLT]}\\s*(${i[s.LOOSEPLAIN]}|${i[s.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",a("HYPHENRANGE",`^\\s*(${i[s.XRANGEPLAIN]})\\s+-\\s+(${i[s.XRANGEPLAIN]})\\s*$`),a("HYPHENRANGELOOSE",`^\\s*(${i[s.XRANGEPLAINLOOSE]})\\s+-\\s+(${i[s.XRANGEPLAINLOOSE]})\\s*$`),a("STAR","(<|>)?=?\\s*\\*"),a("GTE0","^\\s*>=\\s*0.0.0\\s*$"),a("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")})),cN=/^[0-9]+$/,fN=(e,t)=>{let r=cN.test(e),n=cN.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},lN={compareIdentifiers:fN,rcompareIdentifiers:(e,t)=>fN(t,e)},{MAX_LENGTH:dN,MAX_SAFE_INTEGER:hN}=sN,{re:pN,t:gN}=uN,{compareIdentifiers:mN}=lN,yN=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof yN){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid Version: ${e}`);if(e.length>dN)throw new TypeError(`version is longer than ${dN} characters`);aN("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?pN[gN.LOOSE]:pN[gN.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>hN||this.major<0)throw new TypeError("Invalid major version");if(this.minor>hN||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>hN||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<hN)return t}return e})):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(aN("SemVer.compare",this.version,this.options,e),!(e instanceof yN)){if("string"==typeof e&&e===this.version)return 0;e=new yN(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof yN||(e=new yN(e,this.options)),mN(this.major,e.major)||mN(this.minor,e.minor)||mN(this.patch,e.patch)}comparePre(e){if(e instanceof yN||(e=new yN(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(aN("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(r!==n)return mN(r,n)}while(++t)}compareBuild(e){e instanceof yN||(e=new yN(e,this.options));let t=0;do{let r=this.build[t],n=e.build[t];if(aN("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(r!==n)return mN(r,n)}while(++t)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{let e=this.prerelease.length;for(;--e>=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}},bN=(e,t,r)=>new yN(e,r).compare(new yN(t,r)),vN=(e,t,r)=>0===bN(e,t,r),wN=(e,t,r)=>0!==bN(e,t,r),_N=(e,t,r)=>bN(e,t,r)>0,EN=(e,t,r)=>bN(e,t,r)>=0,AN=(e,t,r)=>bN(e,t,r)<0,SN=(e,t,r)=>bN(e,t,r)<=0,kN=(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 vN(e,r,n);case"!=":return wN(e,r,n);case">":return _N(e,r,n);case">=":return EN(e,r,n);case"<":return AN(e,r,n);case"<=":return SN(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}},xN=Symbol("SemVer ANY"),TN=class{static get ANY(){return xN}constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof TN){if(e.loose===!!t.loose)return e;e=e.value}aN("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===xN?this.value="":this.value=this.operator+this.semver.version,aN("comp",this)}parse(e){let t=this.options.loose?RN[ON.COMPARATORLOOSE]:RN[ON.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new yN(r[2],this.options.loose):this.semver=xN}toString(){return this.value}test(e){if(aN("Comparator.test",e,this.options.loose),this.semver===xN||e===xN)return!0;if("string"==typeof e)try{e=new yN(e,this.options)}catch(e){return!1}return kN(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof TN))throw new TypeError("a Comparator is required");if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||new IN(e.value,t).test(this.value);if(""===e.operator)return""===e.value||new IN(this.value,t).test(e.semver);let r=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),n=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),i=this.semver.version===e.semver.version,s=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),o=kN(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),a=kN(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return r||n||i&&s||o||a}},{re:RN,t:ON}=uN,IN=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof IN)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new IN(e.raw,t);if(e instanceof TN)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){let{loose:t}=this.options;e=e.trim();let r=t?MN[PN.HYPHENRANGELOOSE]:MN[PN.HYPHENRANGE];e=e.replace(r,VN(this.options.includePrerelease)),aN("hyphen replace",e),e=e.replace(MN[PN.COMPARATORTRIM],NN),aN("comparator trim",e,MN[PN.COMPARATORTRIM]),e=(e=(e=e.replace(MN[PN.TILDETRIM],CN)).replace(MN[PN.CARETTRIM],BN)).split(/\s+/).join(" ");let n=t?MN[PN.COMPARATORLOOSE]:MN[PN.COMPARATOR];return e.split(" ").map((e=>LN(e,this.options))).join(" ").split(/\s+/).map((e=>WN(e,this.options))).filter(this.options.loose?e=>!!e.match(n):()=>!0).map((e=>new TN(e,this.options)))}intersects(e,t){if(!(e instanceof IN))throw new TypeError("a Range is required");return this.set.some((r=>UN(r,t)&&e.set.some((e=>UN(e,t)&&r.every((r=>e.every((e=>r.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new yN(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(XN(this.set[t],e,this.options))return!0;return!1}},{re:MN,t:PN,comparatorTrimReplace:NN,tildeTrimReplace:CN,caretTrimReplace:BN}=uN,UN=(e,t)=>{let r=!0,n=e.slice(),i=n.pop();for(;r&&n.length;)r=n.every((e=>i.intersects(e,t))),i=n.pop();return r},LN=(e,t)=>(aN("comp",e,t),e=qN(e,t),aN("caret",e),e=DN(e,t),aN("tildes",e),e=KN(e,t),aN("xrange",e),e=GN(e,t),aN("stars",e),e),jN=e=>!e||"x"===e.toLowerCase()||"*"===e,DN=(e,t)=>e.trim().split(/\s+/).map((e=>FN(e,t))).join(" "),FN=(e,t)=>{let r=t.loose?MN[PN.TILDELOOSE]:MN[PN.TILDE];return e.replace(r,((t,r,n,i,s)=>{let o;return aN("tilde",e,t,r,n,i,s),jN(r)?o="":jN(n)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:jN(i)?o=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:s?(aN("replaceTilde pr",s),o=`>=${r}.${n}.${i}-${s} <${r}.${+n+1}.0-0`):o=`>=${r}.${n}.${i} <${r}.${+n+1}.0-0`,aN("tilde return",o),o}))},qN=(e,t)=>e.trim().split(/\s+/).map((e=>zN(e,t))).join(" "),zN=(e,t)=>{aN("caret",e,t);let r=t.loose?MN[PN.CARETLOOSE]:MN[PN.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,s,o)=>{let a;return aN("caret",e,t,r,i,s,o),jN(r)?a="":jN(i)?a=`>=${r}.0.0${n} <${+r+1}.0.0-0`:jN(s)?a="0"===r?`>=${r}.${i}.0${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${n} <${+r+1}.0.0-0`:o?(aN("replaceCaret pr",o),a="0"===r?"0"===i?`>=${r}.${i}.${s}-${o} <${r}.${i}.${+s+1}-0`:`>=${r}.${i}.${s}-${o} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${s}-${o} <${+r+1}.0.0-0`):(aN("no pr"),a="0"===r?"0"===i?`>=${r}.${i}.${s}${n} <${r}.${i}.${+s+1}-0`:`>=${r}.${i}.${s}${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${s} <${+r+1}.0.0-0`),aN("caret return",a),a}))},KN=(e,t)=>(aN("replaceXRanges",e,t),e.split(/\s+/).map((e=>HN(e,t))).join(" ")),HN=(e,t)=>{e=e.trim();let r=t.loose?MN[PN.XRANGELOOSE]:MN[PN.XRANGE];return e.replace(r,((r,n,i,s,o,a)=>{aN("xRange",e,r,n,i,s,o,a);let u=jN(i),c=u||jN(s),f=c||jN(o),l=f;return"="===n&&l&&(n=""),a=t.includePrerelease?"-0":"",u?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&l?(c&&(s=0),o=0,">"===n?(n=">=",c?(i=+i+1,s=0,o=0):(s=+s+1,o=0)):"<="===n&&(n="<",c?i=+i+1:s=+s+1),"<"===n&&(a="-0"),r=`${n+i}.${s}.${o}${a}`):c?r=`>=${i}.0.0${a} <${+i+1}.0.0-0`:f&&(r=`>=${i}.${s}.0${a} <${i}.${+s+1}.0-0`),aN("xRange return",r),r}))},GN=(e,t)=>(aN("replaceStars",e,t),e.trim().replace(MN[PN.STAR],"")),WN=(e,t)=>(aN("replaceGTE0",e,t),e.trim().replace(MN[t.includePrerelease?PN.GTE0PRE:PN.GTE0],"")),VN=e=>(t,r,n,i,s,o,a,u,c,f,l,d,h)=>`${r=jN(n)?"":jN(i)?`>=${n}.0.0${e?"-0":""}`:jN(s)?`>=${n}.${i}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${u=jN(c)?"":jN(f)?`<${+c+1}.0.0-0`:jN(l)?`<${c}.${+f+1}.0-0`:d?`<=${c}.${f}.${l}-${d}`:e?`<${c}.${f}.${+l+1}-0`:`<=${u}`}`.trim(),XN=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(aN(e[r].semver),e[r].semver!==TN.ANY&&e[r].semver.prerelease.length>0){let n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0},JN=(e,t,r)=>{try{t=new IN(t,r)}catch(e){return!1}return t.test(e)},{MAX_LENGTH:$N}=sN,{re:YN,t:QN}=uN,ZN=(e,t)=>{if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof yN)return e;if("string"!=typeof e||e.length>$N||!(t.loose?YN[QN.LOOSE]:YN[QN.FULL]).test(e))return null;try{return new yN(e,t)}catch(e){return null}},{re:eC,t:tC}=uN,rC=(e,t)=>{if(e instanceof yN)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let t;for(;(t=eC[tC.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),eC[tC.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;eC[tC.COERCERTL].lastIndex=-1}else r=e.match(eC[tC.COERCE]);return null===r?null:ZN(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function nC(e){return String.fromCharCode(parseInt(e.slice(1),16))}function iC(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function sC(e){return function(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,nC))}(JSON.stringify(e))}function oC(e){return JSON.parse(function(e){return decodeURIComponent(Array.from(atob(e),iC).join(""))}(e))}function aC(e){return void 0===e}function uC(e){return function(e){return null===e}(e)||aC(e)}function cC(e){if(!e)return!0;for(let t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var fC={};var lC={"magic-sdk":"magic-sdk","@magic-sdk/react-native":"magic-sdk-rn","@magic-sdk/react-native-bare":"magic-sdk-rn-bare","@magic-sdk/react-native-expo":"magic-sdk-rn-expo"},dC=class extends Error{constructor(e,t){super(`Magic SDK Error: [${e}] ${t}`),this.code=e,this.rawMessage=t,this.__proto__=Error,Object.setPrototypeOf(this,dC.prototype)}},hC=class extends Error{constructor(e){super(),this.__proto__=Error;let t=Number(null==e?void 0:e.code);this.rawMessage=(null==e?void 0:e.message)||"Internal error",this.code=function(e){return!uC(e)&&"number"==typeof e&&Object.values(FP).includes(e)}(t)?t:FP.InternalError,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=(null==e?void 0:e.data)||void 0,Object.setPrototypeOf(this,hC.prototype)}},pC=class{constructor(e,t){this.code=e,this.rawMessage=t,this.message=`Magic SDK Warning: [${e}] ${t}`}log(){console.warn(this.message)}},gC=class extends Error{constructor(e,t,r,n){super(`Magic Extension Error (${e.name}): [${t}] ${r}`),this.code=t,this.rawMessage=r,this.data=n,this.__proto__=Error,Object.setPrototypeOf(this,gC.prototype)}},mC=class{constructor(e,t,r){this.code=t,this.rawMessage=r,this.message=`Magic Extension Warning (${e.name}): [${t}] ${r}`}log(){console.warn(this.message)}};function yC(){return new dC(jP.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function bC(){return new dC(jP.MalformedResponse,"Response from the Magic iframe is malformed.")}function vC(e){return new dC(jP.ExtensionNotInitialized,`Extensions must be initialized with a Magic SDK instance before \`Extension.${e}\` can be accessed. Do not invoke \`Extension.${e}\` inside an extension constructor.`)}function wC(e){let t=`Some extensions are incompatible with \`${fC.sdkName}@${fC.version}\`:`;return e.filter((e=>void 0!==e.compat&&null!==e.compat)).forEach((e=>{let r=e.compat[fC.sdkName];"string"==typeof r?t+=`\n - Extension \`${e.name}\` supports version(s) \`${r}\``:r||(t+=`\n - Extension \`${e.name}\` does not support ${fC.platform} environments.`)})),new dC(jP.IncompatibleExtensions,t)}function _C(e){return new dC(jP.InvalidArgument,`Invalid ${(e=>{let t=e+1,r=t%10,n=t%100;return 1===r&&11!==n?`${t}st`:2===r&&12!==n?`${t}nd`:3===r&&13!==n?`${t}rd`:`${t}th`})(e.argument)} argument given to \`${e.procedure}\`.\n Expected: \`${e.expected}\`\n Received: \`${e.received}\``)}function EC(){return new pC(DP.ReactNativeEndpointConfiguration,`CUSTOM DOMAINS ARE NOT SUPPORTED WHEN USING MAGIC SDK WITH REACT NATIVE! The \`endpoint\` parameter SHOULD NOT be provided. The Magic \`<iframe>\` is automatically wrapped by a WebView pointed at \`${fC.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`)}var AC=function*(){let e=0;for(;;)e<Number.MAX_SAFE_INTEGER?yield++e:e=0}();function SC(){return AC.next().value}var kC=Symbol("Payload pre-processed by Magic SDK");function xC(e){return Object.defineProperty(e,kC,{value:!0,enumerable:!1}),e}function TC(e){var t,r,n;return function(e){return!!e[kC]}(e)||(e.jsonrpc=null!=(t=e.jsonrpc)?t:"2.0",e.id=SC(),e.method=null!=(r=e.method)?r:"noop",e.params=null!=(n=e.params)?n:[],xC(e)),e}function RC(e,t=[]){return xC({params:t,method:e,jsonrpc:"2.0",id:SC()})}var OC=class{constructor(e){e instanceof OC?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):function(e){return!uC(e)&&!(aC(e.jsonrpc)||aC(e.id)||aC(e.result)&&aC(e.error))}(e)?(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=e.result,this._error=e.error):(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=void 0,this._error=void 0)}applyError(e){return this._error=e,this}applyResult(e){return this._result=e,this}get hasError(){return void 0!==this._error&&null!==this._error}get hasResult(){return void 0!==this._result}get payload(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}}},IC=((e,t,r)=>(r=null!=e?GP(QP(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of $P(t))!ZP.call(e,i)&&i!==r&&WP(e,i,{get:()=>t[i],enumerable:!(n=XP(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:WP(r,"default",{value:e,enumerable:!0}),e)))(iN()),MC=class extends IC.default{};function PC(){let e=new MC;return{emitter:e,createChainingEmitterMethod:(t,r)=>(...n)=>(e[t].apply(e,n),r),createBoundEmitterMethod:t=>(...r)=>e[t].apply(e,r)}}var NC=Symbol("isPromiEvent");function CC(e){return!!e[NC]}function BC(e){let t=UC(e),{createBoundEmitterMethod:r,createChainingEmitterMethod:n}=PC(),i=Symbol("Promise.then"),s=Symbol("Promise.catch"),o=Symbol("Promise.finally"),a=(e,t)=>(...r)=>{let n=t[e].apply(t,r);return u(n)},u=e=>Object.assign(e,{[NC]:!0,[i]:e[i]||e.then,[s]:e[s]||e.catch,[o]:e[o]||e.finally,then:a(i,e),catch:a(s,e),finally:a(o,e),on:n("on",e),once:n("once",e),addListener:n("addListener",e),off:n("off",e),removeListener:n("removeListener",e),removeAllListeners:n("removeAllListeners",e),emit:r("emit"),eventNames:r("eventNames"),listeners:r("listeners"),listenerCount:r("listenerCount")}),c=u(t.then((e=>(c.emit("done",e),c.emit("settled"),e)),(e=>{throw c.emit("error",e),c.emit("settled"),e})));return c}function UC(e){return new Promise(((t,r)=>{let n=e(t,r);Promise.resolve(n).catch(r)}))}var LC,jC=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){let t=this.overlay.post(KP.MAGIC_HANDLE_REQUEST,TC(e)),r=BC(((e,r)=>{t.then((t=>{if(n(),t.hasError)r(new hC(t.payload.error));else{if(!t.hasResult)throw bC();e(t.payload.result)}})).catch((e=>{n(),r(e)}))})),n=this.overlay.on(zP.MAGIC_HANDLE_EVENT,(t=>{var n;let{response:i}=t.data;if(i.id===e.id&&(null==(n=i.result)?void 0:n.event)){let{event:e,params:t=[]}=i.result;r.emit(e,...t)}}));return r}createIntermediaryEvent(e,t){return r=>{let n=RC(qP.IntermediaryEvent,[{payloadId:t,eventType:e,args:r}]);this.request(n)}}},DC=class extends jC{loginWithMagicLink(e){let{email:t,showUI:r=!0,redirectURI:n}=e,i=RC(this.sdk.testMode?qP.LoginWithMagicLinkTestMode:qP.LoginWithMagicLink,[{email:t,showUI:r,redirectURI:n}]);return this.request(i)}loginWithSMS(e){let{phoneNumber:t}=e,r=RC(this.sdk.testMode?qP.LoginWithSmsTestMode:qP.LoginWithSms,[{phoneNumber:t,showUI:!0}]);return this.request(r)}loginWithEmailOTP(e){let{email:t,showUI:r}=e,n=RC(this.sdk.testMode?qP.LoginWithEmailOTPTestMode:qP.LoginWithEmailOTP,[{email:t,showUI:r}]);if(!r){let e=this.request(n);return e&&e.on("otp-input-sent",(e=>{this.createIntermediaryEvent("verify-email-otp",n.id)(e)})),e}return this.request(n)}loginWithCredential(e){let t=null!=e?e:"";if(!e&&"web"===fC.platform){t=window.location.search;let e=window.location.origin+window.location.pathname;window.history.replaceState(null,"",e)}let r=RC(this.sdk.testMode?qP.LoginWithCredentialTestMode:qP.LoginWithCredential,[t]);return this.request(r)}},FC={};function qC(e){return(...t)=>nN(this,null,(function*(){return LC||(LC=yield fC.configureStorage()),yield LC.ready(),LC[e](...t)}))}((e,t)=>{for(var r in t)WP(e,r,{get:t[r],enumerable:!0})})(FC,{clear:()=>GC,getItem:()=>zC,iterate:()=>JC,key:()=>VC,keys:()=>XC,length:()=>WC,removeItem:()=>HC,setItem:()=>KC});var zC=qC("getItem"),KC=qC("setItem"),HC=qC("removeItem"),GC=qC("clear"),WC=qC("length"),VC=qC("key"),XC=qC("keys"),JC=qC("iterate");function $C(){let e=window.crypto.getRandomValues(new Uint8Array(16));e[6]=15&e[6]|64,e[8]=191&e[8]|128;let t="";return t+=e[0].toString(16),t+=e[1].toString(16),t+=e[2].toString(16),t+=e[3].toString(16),t+="-",t+=e[4].toString(16),t+=e[5].toString(16),t+="-",t+=e[6].toString(16),t+=e[7].toString(16),t+="-",t+=e[8].toString(16),t+=e[9].toString(16),t+="-",t+=e[10].toString(16),t+=e[11].toString(16),t+=e[12].toString(16),t+=e[13].toString(16),t+=e[14].toString(16),t+=e[15].toString(16),t}var YC="STORE_KEY_PRIVATE_KEY",QC="STORE_KEY_PUBLIC_JWK",ZC="ECDSA",eB="P-256",tB={name:ZC,namedCurve:eB},rB={name:ZC,namedCurve:eB};function nB(){HC(QC),HC(YC)}function iB(){return nN(this,null,(function*(){let e=yield function(){return nN(this,null,(function*(){if(function(){let e="undefined"!=typeof window&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}())return(yield zC(QC))||(yield function(){return nN(this,null,(function*(){let e=null,{subtle:t}=window.crypto,r=yield t.generateKey(tB,!0,["sign"]),n=yield t.exportKey("jwk",r.privateKey);e=yield t.exportKey("jwk",r.publicKey);let i=yield t.importKey("jwk",n,rB,!1,["sign"]);yield KC(YC,i),yield KC(QC,e)}))}()),zC(QC);console.info("webcrypto is not supported")}))}();if(!e)return void console.info("unable to create public key or webcrypto is unsupported");let{subtle:t}=window.crypto,r=yield zC(YC);if(!r||!t)return void console.info("unable to find private key or webcrypto unsupported");let n={iat:Math.floor((new Date).getTime()/1e3),jti:$C()},i={typ:"dpop+jwt",alg:"ES256",jwk:e},s=sB(JSON.stringify(i)),o=sB(JSON.stringify(n)),a=function(e){return(new TextEncoder).encode(e)}(`${s}.${o}`),u={name:ZC,hash:{name:"SHA-256"}},c=function(e){let t="";return e.forEach((e=>{t+=String.fromCharCode(e)})),oB(t)}(new Uint8Array(yield t.sign(u,r,a)));return`${s}.${o}.${c}`}))}function sB(e){return oB(function(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))}(e))}function oB(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}var aB=class extends jC{getIdToken(e){let t=RC(this.sdk.testMode?qP.GetIdTokenTestMode:qP.GetIdToken,[e]);return this.request(t)}generateIdToken(e){let t=RC(this.sdk.testMode?qP.GenerateIdTokenTestMode:qP.GenerateIdToken,[e]);return this.request(t)}getMetadata(){let e=RC(this.sdk.testMode?qP.GetMetadataTestMode:qP.GetMetadata);return this.request(e)}updateEmail(e){let{email:t,showUI:r=!0}=e,n=RC(this.sdk.testMode?qP.UpdateEmailTestMode:qP.UpdateEmail,[{email:t,showUI:r}]);return this.request(n)}isLoggedIn(){let e=RC(this.sdk.testMode?qP.IsLoggedInTestMode:qP.IsLoggedIn);return this.request(e)}logout(){nB();let e=RC(this.sdk.testMode?qP.LogoutTestMode:qP.Logout);return this.request(e)}showSettings(){let e=RC(this.sdk.testMode?qP.UserSettingsTestMode:qP.UserSettings);return this.request(e)}updatePhoneNumber(){let e=RC(this.sdk.testMode?qP.UpdatePhoneNumberTestMode:qP.UpdatePhoneNumber);return this.request(e)}recoverAccount(e){let t=RC(this.sdk.testMode?qP.RecoverAccountTestMode:qP.RecoverAccount,[e]);return this.request(t)}},uB=class extends jC{connectWithUI(){let e=RC(qP.RequestAccounts);return this.request(e)}showUI(){let e=RC(qP.ShowUI);return this.request(e)}getInfo(){let e=RC(qP.GetInfo);return this.request(e)}requestUserInfoWithUI(e){let t=RC(qP.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}disconnect(){nB();let e=RC(qP.Disconnect);return this.request(e)}},{createBoundEmitterMethod:cB,createChainingEmitterMethod:fB}=PC(),lB=class extends jC{constructor(){super(...arguments),this.isMagic=!0,this.on=fB("on",this),this.once=fB("once",this),this.addListener=fB("addListener",this),this.off=fB("off",this),this.removeListener=fB("removeListener",this),this.removeAllListeners=fB("removeAllListeners",this),this.emit=cB("emit"),this.eventNames=cB("eventNames"),this.listeners=cB("listeners"),this.listenerCount=cB("listenerCount")}sendAsync(e,t){if(!t)throw _C({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:null===t?"null":typeof t});if(Array.isArray(e))this.overlay.post(KP.MAGIC_HANDLE_REQUEST,e.map((e=>{let t=TC(e);return this.prefixPayloadMethodForTestMode(t),t}))).then((e=>{t(null,e.map((e=>((e,t)=>VP(e,JP(t)))(rN({},e.payload),{error:e.hasError?new hC(e.payload.error):null}))))}));else{let r=TC(e);this.prefixPayloadMethodForTestMode(r),this.overlay.post(KP.MAGIC_HANDLE_REQUEST,r).then((e=>{t(e.hasError?new hC(e.payload.error):null,e.payload)}))}}send(e,t){if("string"==typeof e){let r=RC(e,Array.isArray(t)?t:[]);return this.request(r)}if(Array.isArray(e)||t)return void this.sendAsync(e,t);let r=new pC(DP.SyncWeb3Method,"Non-async web3 methods are deprecated in web3 > 1.0 and are not supported by the Magic web3 provider. Please use an async method instead.");return r.log(),new OC(e).applyError({code:-32603,message:r.rawMessage}).payload}enable(){let e=RC("eth_accounts");return this.request(e)}request(e){return this.prefixPayloadMethodForTestMode(e),super.request(e)}prefixPayloadMethodForTestMode(e){this.sdk.testMode&&(e.method=`testMode/eth/${e.method}`)}};function dB(e,t){return t?new URL(e,t):new URL(e)}var hB=["request","overlay","sdk"];function pB(e){let t=Object.getPrototypeOf(e),r=[t];for(;t!==jC.prototype;)t=Object.getPrototypeOf(t),r.push(t);return r}var gB=class extends jC{constructor(){super(void 0),this.__sdk_access_field_descriptors__=new Map,this.__is_initialized__=!1,this.utils={createPromiEvent:BC,isPromiEvent:CC,encodeJSON:sC,decodeJSON:oC,createJsonRpcRequestPayload:RC,standardizeJsonRpcRequestPayload:TC,storage:FC};let e=[this,...pB(this)];hB.forEach((t=>{let r=e.map((e=>Object.getOwnPropertyDescriptor(e,t))),n=r.findIndex((e=>!!e)),i=n>0,s=r[n];s&&(this.__sdk_access_field_descriptors__.set(t,{descriptor:s,isPrototypeField:i}),Object.defineProperty(this,t,{configurable:!0,get:()=>{throw vC(t)}}))}))}init(e){this.__is_initialized__||(hB.forEach((e=>{if(this.__sdk_access_field_descriptors__.has(e)){let{descriptor:t,isPrototypeField:r}=this.__sdk_access_field_descriptors__.get(e);r?delete this[e]:Object.defineProperty(this,e,t)}})),this.sdk=e,this.__is_initialized__=!0)}createDeprecationWarning(e){let{method:t,removalVersion:r,useInstead:n}=e;return new mC(this,"DEPRECATION_NOTICE",`\`${t}\` will be removed from this Extension in version \`${r}\`.${n?` Use \`${n}\` instead.`:""}`)}createWarning(e,t){return new mC(this,e,t)}createError(e,t,r){return new gC(this,e,t,r)}},mB=class extends gB{};mB.Internal=class extends gB{},mB.Anonymous="anonymous extension";var yB=class extends jC{purchase(e){let t=RC(qP.NFTPurchase,[e]);return this.request(t)}};function bB(e){return!e.compat||null==e.compat[fC.sdkName]||("string"==typeof e.compat[fC.sdkName]?JN(rC(fC.version),e.compat[fC.sdkName]):!!e.compat[fC.sdkName])}function vB(e){var t;let r=null!=(t=null==e?void 0:e.extensions)?t:[],n={},i=[];if(Array.isArray(r)?r.forEach((e=>{bB(e)?(e.init(this),(e.name||e.name!==mB.Anonymous)&&(this[e.name]=e),e instanceof mB.Internal&&(cC(e.config)||(n[e.name]=e.config))):i.push(e)})):Object.keys(r).forEach((e=>{if(bB(r[e])){r[e].init(this);let t=r[e];this[e]=t,t instanceof mB.Internal&&(cC(t.config)||(n[r[e].name]=t.config))}else i.push(r[e])})),i.length)throw wC(i);return n}var wB=class{constructor(e,t){var r;if(this.apiKey=e,!e)throw yC();"react-native"===fC.platform&&(null==t?void 0:t.endpoint)&&EC().log();let{defaultEndpoint:n,version:i}=fC;this.testMode=!(null==t||!t.testMode),this.endpoint=dB(null!=(r=null==t?void 0:t.endpoint)?r:n).origin,this.auth=new DC(this),this.user=new aB(this),this.wallet=new uB(this),this.nft=new yB(this),this.rpcProvider=new lB(this);let s=vB.call(this,t);this.parameters=sC(rN({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:null==t?void 0:t.network,host:dB(this.endpoint).host,sdk:lC[fC.sdkName],version:i,ext:cC(s)?void 0:s,locale:(null==t?void 0:t.locale)||"en_US"},fC.bundleId?{bundleId:fC.bundleId}:{}))}get overlay(){if(!wB.__overlays__.has(this.parameters)){let e=new fC.ViewController(this.endpoint,this.parameters);e.init(),wB.__overlays__.set(this.parameters,e)}return wB.__overlays__.get(this.parameters)}preload(){return nN(this,null,(function*(){yield this.overlay.ready}))}},_B=wB;function EB(e,t){var r;let n=null==(r=t.data.response)?void 0:r.id,i=function(e,t){return t&&Array.isArray(e)?e.find((e=>e.id===t)):e}(e,n);if(n&&i){return{id:n,response:new OC(i).applyResult(t.data.response.result).applyError(t.data.response.error)}}return{}}_B.__overlays__=new Map;var AB=class{constructor(e,t){this.endpoint=e,this.parameters=t,this.messageHandlers=new Set,this.ready=this.waitForReady(),this.listen()}post(e,t){return nN(this,null,(function*(){return UC((r=>nN(this,null,(function*(){yield this.ready;let n=[],i=Array.isArray(t)?t.map((e=>e.id)):[],s=yield function(e,t){return nN(this,null,(function*(){let r,n=yield zC("rt");if("web"===fC.platform)try{r=yield iB()}catch(e){console.error("webcrypto error",e)}return r?n?{msgType:e,payload:t,jwt:r,rt:n}:{msgType:e,payload:t,jwt:r}:{msgType:e,payload:t}}))}(`${e}-${this.parameters}`,t);yield this._post(s);let o=this.on(zP.MAGIC_HANDLE_RESPONSE,(e=>s=>{let{id:o,response:a}=EB(t,s);(function(e){nN(this,null,(function*(){!e.data.rt||(yield KC("rt",e.data.rt))}))})(s),o&&a&&Array.isArray(t)&&i.includes(o)?(n.push(a),n.length===t.length&&(e(),r(n))):o&&a&&!Array.isArray(t)&&o===t.id&&(e(),r(a))})((()=>o())))}))))}))}on(e,t){let r=t.bind(window),n=t=>{t.data.msgType===`${e}-${this.parameters}`&&r(t)};return this.messageHandlers.add(n),()=>this.messageHandlers.delete(n)}waitForReady(){return new Promise((e=>{this.on(zP.MAGIC_OVERLAY_READY,(()=>e()))}))}listen(){this.on(zP.MAGIC_HIDE_OVERLAY,(()=>{this.hideOverlay()})),this.on(zP.MAGIC_SHOW_OVERLAY,(()=>{this.showOverlay()}))}},SB=Object.create,kB=Object.defineProperty,xB=Object.getOwnPropertyDescriptor,TB=Object.getOwnPropertyNames,RB=Object.getPrototypeOf,OB=Object.prototype.hasOwnProperty,IB=(e=>"undefined"!=typeof require?require:"undefined"!=typeof Proxy?new Proxy(e,{get:(e,t)=>("undefined"!=typeof require?require:e)[t]}):e)((function(e){if("undefined"!=typeof require)return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')})),MB=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),PB=(e,t,r)=>(r=null!=e?SB(RB(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of TB(t))!OB.call(e,i)&&i!==r&&kB(e,i,{get:()=>t[i],enumerable:!(n=xB(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:kB(r,"default",{value:e,enumerable:!0}),e)),NB=(e,t,r)=>new Promise(((n,i)=>{var s=e=>{try{a(r.next(e))}catch(e){i(e)}},o=e=>{try{a(r.throw(e))}catch(e){i(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(s,o);a((r=r.apply(e,t)).next())})),CB=MB(((e,t)=>{!function(r){if("object"==typeof e&&typeof t<"u")t.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).localforage=r()}}((function(){return function e(t,r,n){function i(o,a){if(!r[o]){if(!t[o]){var u="function"==typeof IB&&IB;if(!a&&u)return u(o,!0);if(s)return s(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var f=r[o]={exports:{}};t[o][0].call(f.exports,(function(e){return i(t[o][1][e]||e)}),f,f.exports,e,t,r,n)}return r[o].exports}for(var s="function"==typeof IB&&IB,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,t,r){(function(e){var r,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var i=0,s=new n(f),o=e.document.createTextNode("");s.observe(o,{characterData:!0}),r=function(){o.data=i=++i%2}}else if(!e.setImmediate&&typeof e.MessageChannel<"u"){var a=new e.MessageChannel;a.port1.onmessage=f,r=function(){a.port2.postMessage(0)}}else r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)};var u,c=[];function f(){u=!0;for(var e,t,r=c.length;r;){for(t=c,c=[],e=-1;++e<r;)t[e]();r=c.length}u=!1}t.exports=function(e){1===c.push(e)&&!u&&r()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(e,t,r){var n=e(1);function i(){}var s={},o=["REJECTED"],a=["FULFILLED"],u=["PENDING"];function c(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,e!==i&&h(this,e)}function f(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function l(e,t,r){n((function(){var n;try{n=t(r)}catch(t){return s.reject(e,t)}n===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,n)}))}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function h(e,t){var r=!1;function n(t){r||(r=!0,s.reject(e,t))}function i(t){r||(r=!0,s.resolve(e,t))}var o=p((function(){t(i,n)}));"error"===o.status&&n(o.value)}function p(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}t.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var r=new this.constructor(i);this.state!==u?l(r,this.state===a?e:t,this.outcome):this.queue.push(new f(r,e,t));return r},f.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},f.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},f.prototype.callRejected=function(e){s.reject(this.promise,e)},f.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},s.resolve=function(e,t){var r=p(d,t);if("error"===r.status)return s.reject(e,r.value);var n=r.value;if(n)h(e,n);else{e.state=a,e.outcome=t;for(var i=-1,o=e.queue.length;++i<o;)e.queue[i].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},c.resolve=function(e){return e instanceof this?e:s.resolve(new this(i),e)},c.reject=function(e){var t=new this(i);return s.reject(t,e)},c.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var o=new Array(r),a=0,u=-1,c=new this(i);++u<r;)f(e[u],u);return c;function f(e,i){t.resolve(e).then((function(e){o[i]=e,++a===r&&!n&&(n=!0,s.resolve(c,o))}),(function(e){n||(n=!0,s.reject(c,e))}))}},c.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var o=-1,a=new this(i);++o<r;)u(e[o]);return a;function u(e){t.resolve(e).then((function(e){n||(n=!0,s.resolve(a,e))}),(function(e){n||(n=!0,s.reject(a,e))}))}}},{1:1}],3:[function(e,t,r){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(e,t,r){var n="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};var i=function(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}();function s(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var r=new(typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}typeof Promise>"u"&&e(3);var o=Promise;function a(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function u(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function c(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",d=void 0,h={},p=Object.prototype.toString,g="readonly",m="readwrite";function y(e){return"boolean"==typeof d?o.resolve(d):function(e){return new o((function(t){var r=e.transaction(l,m),n=s([""]);r.objectStore(l).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//);t(r||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}(e).then((function(e){return d=e}))}function b(e){var t=h[e.name],r={};r.promise=new o((function(e,t){r.resolve=e,r.reject=t})),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then((function(){return r.promise})):t.dbReady=r.promise}function v(e){var t=h[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function w(e,t){var r=h[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function _(e,t){return new o((function(r,n){if(h[e.name]=h[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return r(e.db);b(e),e.db.close()}var s=[e.name];t&&s.push(e.version);var o=i.open.apply(i,s);t&&(o.onupgradeneeded=function(t){var r=o.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(l)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),o.onerror=function(e){e.preventDefault(),n(o.error)},o.onsuccess=function(){var t=o.result;t.onversionchange=function(e){e.target.close()},r(t),v(e)}}))}function E(e){return _(e,!1)}function A(e){return _(e,!0)}function S(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version<e.db.version,i=e.version>e.db.version;if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||r){if(r){var s=e.db.version+1;s>e.version&&(e.version=s)}return!0}return!1}function k(e){var t=function(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),i=0;i<t;i++)n[i]=e.charCodeAt(i);return r}(atob(e.data));return s([t],{type:e.type})}function x(e){return e&&e.__local_forage_encoded_blob}function T(e){var t=this,r=t._initReady().then((function(){var e=h[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return u(r,e,e),r}function R(e,t,r,n){void 0===n&&(n=1);try{var i=e.db.transaction(e.storeName,t);r(null,i)}catch(i){if(n>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return o.resolve().then((function(){if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),A(e)})).then((function(){return function(e){b(e);for(var t=h[e.name],r=t.forages,n=0;n<r.length;n++){var i=r[n];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return e.db=null,E(e).then((function(t){return e.db=t,S(e)?A(e):t})).then((function(n){e.db=t.db=n;for(var i=0;i<r.length;i++)r[i]._dbInfo.db=n})).catch((function(t){throw w(e,t),t}))}(e).then((function(){R(e,t,r,n-1)}))})).catch(r);r(i)}}var O={_driver:"asyncStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]=e[n];var i=h[r.name];i||(i={forages:[],db:null,dbReady:null,deferredOperations:[]},h[r.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=T);var s=[];function a(){return o.resolve()}for(var u=0;u<i.forages.length;u++){var c=i.forages[u];c!==t&&s.push(c._initReady().catch(a))}var f=i.forages.slice(0);return o.all(s).then((function(){return r.db=i.db,E(r)})).then((function(e){return r.db=e,S(r,t._defaultConfig.version)?A(r):e})).then((function(e){r.db=i.db=e,t._dbInfo=r;for(var n=0;n<f.length;n++){var s=f[n];s!==t&&(s._dbInfo.db=r.db,s._dbInfo.version=r.version)}}))},_support:function(){try{if(!i||!i.open)return!1;var e=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}(),iterate:function(e,t){var r=this,n=new o((function(t,n){r.ready().then((function(){R(r._dbInfo,g,(function(i,s){if(i)return n(i);try{var o=s.objectStore(r._dbInfo.storeName).openCursor(),a=1;o.onsuccess=function(){var r=o.result;if(r){var n=r.value;x(n)&&(n=k(n));var i=e(n,r.key,a++);void 0!==i?t(i):r.continue()}else t()},o.onerror=function(){n(o.error)}}catch(e){n(e)}}))})).catch(n)}));return a(n,t),n},getItem:function(e,t){var r=this;e=c(e);var n=new o((function(t,n){r.ready().then((function(){R(r._dbInfo,g,(function(i,s){if(i)return n(i);try{var o=s.objectStore(r._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),x(e)&&(e=k(e)),t(e)},o.onerror=function(){n(o.error)}}catch(e){n(e)}}))})).catch(n)}));return a(n,t),n},setItem:function(e,t,r){var n=this;e=c(e);var i=new o((function(r,i){var s;n.ready().then((function(){return s=n._dbInfo,"[object Blob]"===p.call(t)?y(s.db).then((function(e){return e?t:function(e){return new o((function(t,r){var n=new FileReader;n.onerror=r,n.onloadend=function(r){var n=btoa(r.target.result||"");t({__local_forage_encoded_blob:!0,data:n,type:e.type})},n.readAsBinaryString(e)}))}(t)})):t})).then((function(t){R(n._dbInfo,m,(function(s,o){if(s)return i(s);try{var a=o.objectStore(n._dbInfo.storeName);null===t&&(t=void 0);var u=a.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),r(t)},o.onabort=o.onerror=function(){var e=u.error?u.error:u.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return a(i,r),i},removeItem:function(e,t){var r=this;e=c(e);var n=new o((function(t,n){r.ready().then((function(){R(r._dbInfo,m,(function(i,s){if(i)return n(i);try{var o=s.objectStore(r._dbInfo.storeName).delete(e);s.oncomplete=function(){t()},s.onerror=function(){n(o.error)},s.onabort=function(){var e=o.error?o.error:o.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return a(n,t),n},clear:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){R(t._dbInfo,m,(function(n,i){if(n)return r(n);try{var s=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=s.error?s.error:s.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return a(r,e),r},length:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){R(t._dbInfo,g,(function(n,i){if(n)return r(n);try{var s=i.objectStore(t._dbInfo.storeName).count();s.onsuccess=function(){e(s.result)},s.onerror=function(){r(s.error)}}catch(e){r(e)}}))})).catch(r)}));return a(r,e),r},key:function(e,t){var r=this,n=new o((function(t,n){e<0?t(null):r.ready().then((function(){R(r._dbInfo,g,(function(i,s){if(i)return n(i);try{var o=s.objectStore(r._dbInfo.storeName),a=!1,u=o.openKeyCursor();u.onsuccess=function(){var r=u.result;r?0===e||a?t(r.key):(a=!0,r.advance(e)):t(null)},u.onerror=function(){n(u.error)}}catch(e){n(e)}}))})).catch(n)}));return a(n,t),n},keys:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){R(t._dbInfo,g,(function(n,i){if(n)return r(n);try{var s=i.objectStore(t._dbInfo.storeName).openKeyCursor(),o=[];s.onsuccess=function(){var t=s.result;t?(o.push(t.key),t.continue()):e(o)},s.onerror=function(){r(s.error)}}catch(e){r(e)}}))})).catch(r)}));return a(r,e),r},dropInstance:function(e,t){t=f.apply(this,arguments);var r,n=this.config();if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName),e.name){var s=e.name===n.name&&this._dbInfo.db?o.resolve(this._dbInfo.db):E(e).then((function(t){var r=h[e.name],n=r.forages;r.db=t;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=t;return t}));r=e.storeName?s.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1;b(e);var n=h[e.name],s=n.forages;t.close();for(var a=0;a<s.length;a++){var u=s[a];u._dbInfo.db=null,u._dbInfo.version=r}var c=new o((function(t,n){var s=i.open(e.name,r);s.onerror=function(e){s.result.close(),n(e)},s.onupgradeneeded=function(){s.result.deleteObjectStore(e.storeName)},s.onsuccess=function(){var e=s.result;e.close(),t(e)}}));return c.then((function(e){n.db=e;for(var t=0;t<s.length;t++){var r=s[t];r._dbInfo.db=e,v(r._dbInfo)}})).catch((function(t){throw(w(e,t)||o.resolve()).catch((function(){})),t}))}})):s.then((function(t){b(e);var r=h[e.name],n=r.forages;t.close();for(var s=0;s<n.length;s++){n[s]._dbInfo.db=null}var a=new o((function(t,r){var n=i.deleteDatabase(e.name);n.onerror=function(){var e=n.result;e&&e.close(),r(n.error)},n.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},n.onsuccess=function(){var e=n.result;e&&e.close(),t(e)}}));return a.then((function(e){r.db=e;for(var t=0;t<n.length;t++){v(n[t]._dbInfo)}})).catch((function(t){throw(w(e,t)||o.resolve()).catch((function(){})),t}))}))}else r=o.reject("Invalid arguments");return a(r,t),r}};var I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M=/^~~local_forage_type~([^~]+)~/,P="__lfsc__:",N="arbf",C="blob",B="si08",U="ui08",L="uic8",j="si16",D="si32",F="ur16",q="ui32",z="fl32",K="fl64",H=Object.prototype.toString;function G(e){var t,r,n,i,s,o=.75*e.length,a=e.length,u=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var c=new ArrayBuffer(o),f=new Uint8Array(c);for(t=0;t<a;t+=4)r=I.indexOf(e[t]),n=I.indexOf(e[t+1]),i=I.indexOf(e[t+2]),s=I.indexOf(e[t+3]),f[u++]=r<<2|n>>4,f[u++]=(15&n)<<4|i>>2,f[u++]=(3&i)<<6|63&s;return c}function W(e){var t,r=new Uint8Array(e),n="";for(t=0;t<r.length;t+=3)n+=I[r[t]>>2],n+=I[(3&r[t])<<4|r[t+1]>>4],n+=I[(15&r[t+1])<<2|r[t+2]>>6],n+=I[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var V={serialize:function(e,t){var r="";if(e&&(r=H.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===H.call(e.buffer))){var n,i=P;e instanceof ArrayBuffer?(n=e,i+=N):(n=e.buffer,"[object Int8Array]"===r?i+=B:"[object Uint8Array]"===r?i+=U:"[object Uint8ClampedArray]"===r?i+=L:"[object Int16Array]"===r?i+=j:"[object Uint16Array]"===r?i+=F:"[object Int32Array]"===r?i+=D:"[object Uint32Array]"===r?i+=q:"[object Float32Array]"===r?i+=z:"[object Float64Array]"===r?i+=K:t(new Error("Failed to get type for BinaryArray"))),t(i+W(n))}else if("[object Blob]"===r){var s=new FileReader;s.onload=function(){var r="~~local_forage_type~"+e.type+"~"+W(this.result);t(P+C+r)},s.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,9)!==P)return JSON.parse(e);var t,r=e.substring(13),n=e.substring(9,13);if(n===C&&M.test(r)){var i=r.match(M);t=i[1],r=r.substring(i[0].length)}var o=G(r);switch(n){case N:return o;case C:return s([o],{type:t});case B:return new Int8Array(o);case U:return new Uint8Array(o);case L:return new Uint8ClampedArray(o);case j:return new Int16Array(o);case F:return new Uint16Array(o);case D:return new Int32Array(o);case q:return new Uint32Array(o);case z:return new Float32Array(o);case K:return new Float64Array(o);default:throw new Error("Unkown type: "+n)}},stringToBuffer:G,bufferToString:W};function X(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function J(e,t,r,n,i,s){e.executeSql(r,n,i,(function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,a){a.rows.length?s(e,o):X(e,t,(function(){e.executeSql(r,n,i,s)}),s)}),s):s(e,o)}),s)}function $(e,t,r,n){var i=this;e=c(e);var s=new o((function(s,o){i.ready().then((function(){void 0===t&&(t=null);var a=t,u=i._dbInfo;u.serializer.serialize(t,(function(t,c){c?o(c):u.db.transaction((function(r){J(r,u,"INSERT OR REPLACE INTO "+u.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){s(a)}),(function(e,t){o(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void s($.apply(i,[e,a,r,n-1]));o(t)}}))}))})).catch(o)}));return a(s,r),s}var Y={_driver:"webSQLStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var i=new o((function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction((function(i){X(i,r,(function(){t._dbInfo=r,e()}),(function(e,t){n(t)}))}),n)}));return r.serializer=V,i},_support:"function"==typeof openDatabase,iterate:function(e,t){var r=this,n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){J(r,i,"SELECT * FROM "+i.storeName,[],(function(r,n){for(var s=n.rows,o=s.length,a=0;a<o;a++){var u=s.item(a),c=u.value;if(c&&(c=i.serializer.deserialize(c)),void 0!==(c=e(c,u.key,a+1)))return void t(c)}t()}),(function(e,t){n(t)}))}))})).catch(n)}));return a(n,t),n},getItem:function(e,t){var r=this;e=c(e);var n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){J(r,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=i.serializer.deserialize(n)),t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return a(n,t),n},setItem:function(e,t,r){return $.apply(this,[e,t,r,1])},removeItem:function(e,t){var r=this;e=c(e);var n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){J(r,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){n(t)}))}))})).catch(n)}));return a(n,t),n},clear:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){J(t,n,"DELETE FROM "+n.storeName,[],(function(){e()}),(function(e,t){r(t)}))}))})).catch(r)}));return a(r,e),r},length:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){J(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],(function(t,r){var n=r.rows.item(0).c;e(n)}),(function(e,t){r(t)}))}))})).catch(r)}));return a(r,e),r},key:function(e,t){var r=this,n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){J(r,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,r){var n=r.rows.length?r.rows.item(0).key:null;t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return a(n,t),n},keys:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){J(t,n,"SELECT key FROM "+n.storeName,[],(function(t,r){for(var n=[],i=0;i<r.rows.length;i++)n.push(r.rows.item(i).key);e(n)}),(function(e,t){r(t)}))}))})).catch(r)}));return a(r,e),r},dropInstance:function(e,t){t=f.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,i=this;return n=e.name?new o((function(t){var n;n=e.name===r.name?i._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:n,storeNames:[e.storeName]}):t(function(e){return new o((function(t,r){e.transaction((function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(r,n){for(var i=[],s=0;s<n.rows.length;s++)i.push(n.rows.item(s).name);t({db:e,storeNames:i})}),(function(e,t){r(t)}))}),(function(e){r(e)}))}))}(n))})).then((function(e){return new o((function(t,r){e.db.transaction((function(n){function i(e){return new o((function(t,r){n.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){r(t)}))}))}for(var s=[],a=0,u=e.storeNames.length;a<u;a++)s.push(i(e.storeNames[a]));o.all(s).then((function(){t()})).catch((function(e){r(e)}))}),(function(e){r(e)}))}))})):o.reject("Invalid arguments"),a(n,t),n}};function Q(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}function Z(){return!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return!0}}()||localStorage.length>0}var ee={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=Q(e,this._defaultConfig),Z()?(this._dbInfo=t,t.serializer=V,o.resolve()):o.reject()},_support:function(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}(),iterate:function(e,t){var r=this,n=r.ready().then((function(){for(var t=r._dbInfo,n=t.keyPrefix,i=n.length,s=localStorage.length,o=1,a=0;a<s;a++){var u=localStorage.key(a);if(0===u.indexOf(n)){var c=localStorage.getItem(u);if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,u.substring(i),o++)))return c}}}));return a(n,t),n},getItem:function(e,t){var r=this;e=c(e);var n=r.ready().then((function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n}));return a(n,t),n},setItem:function(e,t,r){var n=this;e=c(e);var i=n.ready().then((function(){void 0===t&&(t=null);var r=t;return new o((function(i,s){var o=n._dbInfo;o.serializer.serialize(t,(function(t,n){if(n)s(n);else try{localStorage.setItem(o.keyPrefix+e,t),i(r)}catch(e){("QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)&&s(e),s(e)}}))}))}));return a(i,r),i},removeItem:function(e,t){var r=this;e=c(e);var n=r.ready().then((function(){var t=r._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return a(n,t),n},clear:function(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}}));return a(r,e),r},length:function(e){var t=this.keys().then((function(e){return e.length}));return a(t,e),t},key:function(e,t){var r=this,n=r.ready().then((function(){var t,n=r._dbInfo;try{t=localStorage.key(e)}catch{t=null}return t&&(t=t.substring(n.keyPrefix.length)),t}));return a(n,t),n},keys:function(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo,r=localStorage.length,n=[],i=0;i<r;i++){var s=localStorage.key(i);0===s.indexOf(e.keyPrefix)&&n.push(s.substring(e.keyPrefix.length))}return n}));return a(r,e),r},dropInstance:function(e,t){if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var n,i=this;return n=e.name?new o((function(t){e.storeName?t(Q(e,i._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}})):o.reject("Invalid arguments"),a(n,t),n}},te=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},re=function(e,t){for(var r=e.length,n=0;n<r;){if(te(e[n],t))return!0;n++}return!1},ne=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},se={},oe={INDEXEDDB:O,WEBSQL:Y,LOCALSTORAGE:ee},ae=[oe.INDEXEDDB._driver,oe.WEBSQL._driver,oe.LOCALSTORAGE._driver],ue=["dropInstance"],ce=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ue),fe={description:"",driver:ae.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function le(e,t){e[t]=function(){var r=arguments;return e.ready().then((function(){return e[t].apply(e,r)}))}}function de(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(ne(t[r])?arguments[0][r]=t[r].slice():arguments[0][r]=t[r])}return arguments[0]}var he=function(){function e(t){for(var r in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),oe)if(oe.hasOwnProperty(r)){var n=oe[r],i=n._driver;this[r]=i,ie[i]||this.defineDriver(n)}this._defaultConfig=de({},fe),this._config=de({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(typeof e>"u"?"undefined":n(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new o((function(t,r){try{var n=e._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void r(i);for(var s=ce.concat("_initStorage"),u=0,c=s.length;u<c;u++){var f=s[u];if((!re(ue,f)||e[f])&&"function"!=typeof e[f])return void r(i)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),r=o.reject(t);return a(r,arguments[arguments.length-1]),r}},r=0,n=ue.length;r<n;r++){var i=ue[r];e[i]||(e[i]=t(i))}}();var l=function(r){ie[n]&&console.info("Redefining LocalForage driver: "+n),ie[n]=e,se[n]=r,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(l,r):l(!!e._support):l(!0)}catch(e){r(e)}}));return u(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=ie[e]?o.resolve(ie[e]):o.reject(new Error("Driver not found."));return u(n,t,r),n},e.prototype.getSerializer=function(e){var t=o.resolve(V);return u(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return u(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this;ne(e)||(e=[e]);var i=this._getSupportedDrivers(e);function s(){n._config.driver=n.driver()}function a(e){return n._extend(e),s(),n._ready=n._initStorage(n._config),n._ready}var c=null!==this._driverSet?this._driverSet.catch((function(){return o.resolve()})):o.resolve();return this._driverSet=c.then((function(){var e=i[0];return n._dbInfo=null,n._ready=null,n.getDriver(e).then((function(e){n._driver=e._driver,s(),n._wrapLibraryMethodsWithReady(),n._initDriver=function(e){return function(){var t=0;return function r(){for(;t<e.length;){var i=e[t];return t++,n._dbInfo=null,n._ready=null,n.getDriver(i).then(a).catch(r)}s();var u=new Error("No available storage method found.");return n._driverSet=o.reject(u),n._driverSet}()}}(i)}))})).catch((function(){s();var e=new Error("No available storage method found.");return n._driverSet=o.reject(e),n._driverSet})),u(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!se[e]},e.prototype._extend=function(e){de(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];this.supports(i)&&t.push(i)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=ce.length;e<t;e++)le(this,ce[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),pe=new he;t.exports=pe},{3:3}]},{},[4])(4)}))})),BB=MB(((e,t)=>{!function(r,n){"object"==typeof e&&typeof t<"u"?n(e):"function"==typeof define&&define.amd?define("localforage-driver-memory",["exports"],n):n(r.LocalforageDriverMemory={})}(typeof self<"u"?self:e,(function(e){var t=/^~~local_forage_type~([^~]+)~/,r=Object.prototype.toString;function n(e){var t=.75*e.length,r=e.length;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);for(var n=new ArrayBuffer(t),i=new Uint8Array(n),s=0,o=0;s<r;s+=4){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[s]),u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[s+1]),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[s+2]),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[s+3]);i[o++]=a<<2|u>>4,i[o++]=(15&u)<<4|c>>2,i[o++]=(3&c)<<6|63&f}return n}function i(e){for(var t=new Uint8Array(e),r="",n=0;n<t.length;n+=3)r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t[n]>>2],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t[n])<<4|t[n+1]>>4],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t[n+1])<<2|t[n+2]>>6],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t[n+2]];return t.length%3==2?r=r.substring(0,r.length-1)+"=":t.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}function s(e){var t,r;if(null===e||"object"!=typeof e||"isActiveClone"in e)return e;var n=e instanceof Date?new Date(e):e.constructor();try{for(var i=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}(Object.keys(e)),o=i.next();!o.done;o=i.next()){var a=o.value;Object.prototype.hasOwnProperty.call(e,a)&&(e.isActiveClone=null,n[a]=s(e[a]),delete e.isActiveClone)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n}function o(e,t){return(e.name||t.name)+"/"+(e.storeName||t.storeName)+"/"}function a(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function u(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function c(e,t){var r,n=this;if(t=u.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var i=this.config();e.name=e.name||i.name,e.storeName=e.storeName||i.storeName}return r=e.name?new Promise((function(t){e.storeName?t(o(e,n._defaultConfig)):t(e.name+"/")})):Promise.reject("Invalid arguments"),{promise:r,callback:t}}function f(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var l={bufferToString:i,deserialize:function(e){if("__lfsc__:"!==e.substring(0,9))return JSON.parse(e);var r,i=e.substring(13),s=e.substring(9,13);if("blob"===s&&t.test(i)){var o=i.match(t);r=o[1],i=i.substring(o[0].length)}var a=n(i);switch(s){case"arbf":return a;case"blob":return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var r=new(typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}([a],{type:r});case"si08":return new Int8Array(a);case"ui08":return new Uint8Array(a);case"uic8":return new Uint8ClampedArray(a);case"si16":return new Int16Array(a);case"ur16":return new Uint16Array(a);case"si32":return new Int32Array(a);case"ui32":return new Uint32Array(a);case"fl32":return new Float32Array(a);case"fl64":return new Float64Array(a);default:throw new Error("Unkown type: "+s)}},serialize:function(e,t){var n="";if(e&&(n=r.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===r.call(e.buffer))){var s=void 0,o="__lfsc__:";e instanceof ArrayBuffer?(s=e,o+="arbf"):(s=e.buffer,"[object Int8Array]"===n?o+="si08":"[object Uint8Array]"===n?o+="ui08":"[object Uint8ClampedArray]"===n?o+="uic8":"[object Int16Array]"===n?o+="si16":"[object Uint16Array]"===n?o+="ur16":"[object Int32Array]"===n?o+="si32":"[object Uint32Array]"===n?o+="ui32":"[object Float32Array]"===n?o+="fl32":"[object Float64Array]"===n?o+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(o+i(s))}else if("[object Blob]"===n){var a=new FileReader;a.onload=function(){var r="~~local_forage_type~"+e.type+"~"+i(this.result);t("__lfsc__:blob"+r)},a.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},stringToBuffer:n},d={},h=function(){function e(e){this.kp=e,this.data={}}return e.resolve=function(t){return d[t]||(d[t]=new e(t)),d[t]},e.prototype.clear=function(){this.data={}},e.prototype.drop=function(){this.clear(),delete d[this.kp]},e.prototype.get=function(e){return this.data[e]},e.prototype.key=function(e){return this.keys()[e]},e.prototype.keys=function(){return Object.keys(this.data)},e.prototype.rm=function(e){delete this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e}();e._support=!0,e._driver="localforage-driver-memory",e._initStorage=function(e){var t=e?s(e):{},r=o(t,this._defaultConfig),n=h.resolve(r);return this._dbInfo=t,this._dbInfo.serializer=l,this._dbInfo.keyPrefix=r,this._dbInfo.mStore=n,Promise.resolve()},e.clear=function(e){var t=this,r=this.ready().then((function(){t._dbInfo.mStore.clear()}));return a(r,e),r},e.dropInstance=function(e,t){var r=c.apply(this,arguments),n=r.promise,i=r.callback,s=n.then((function(e){h.resolve(e).drop()}));return a(s,i),n},e.getItem=function(e,t){var r=this;e=f(e);var n=this.ready().then((function(){var t=r._dbInfo.mStore.get(e);return null==t?null:r._dbInfo.serializer.deserialize(t)}));return a(n,t),n},e.iterate=function(e,t){var r=this,n=this.ready().then((function(){for(var t=r._dbInfo.mStore,n=t.keys(),i=0;i<n.length;i++){var s=t.get(n[i]);if(s&&(s=r._dbInfo.serializer.deserialize(s)),void 0!==(s=e(s,n[i],i+1)))return s}}));return a(n,t),n},e.key=function(e,t){var r=this,n=this.ready().then((function(){var t;try{void 0===(t=r._dbInfo.mStore.key(e))&&(t=null)}catch{t=null}return t}));return a(n,t),n},e.keys=function(e){var t=this,r=this.ready().then((function(){return t._dbInfo.mStore.keys()}));return a(r,e),r},e.length=function(e){var t=this.keys().then((function(e){return e.length}));return a(t,e),t},e.removeItem=function(e,t){var r=this;e=f(e);var n=this.ready().then((function(){r._dbInfo.mStore.rm(e)}));return a(n,t),n},e.setItem=function(e,t,r){var n=this;e=f(e);var i=this.ready().then((function(){void 0===t&&(t=null);var r=t;return new Promise((function(i,s){n._dbInfo.serializer.serialize(t,(function(t,o){if(o)s(o);else try{n._dbInfo.mStore.set(e,t),i(r)}catch(e){s(e)}}))}))}));return a(i,r),i},Object.defineProperty(e,"__esModule",{value:!0})}))})),UB=PB(CB()),LB=PB(BB()),jB={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var DB=function(e,t){return Object.assign(fC,t),e}(_B,{platform:"web",sdkName:"magic-sdk",version:"13.6.2",defaultEndpoint:"https://auth.magic.link/",ViewController:class extends AB{constructor(){super(...arguments),this.activeElement=null}init(){this.test="hello",this.iframe=new Promise((e=>{let t=()=>{if(function(e){let t=[].slice.call(document.querySelectorAll(".magic-iframe"));return Boolean(t.find((t=>t.src.includes(e))))}(encodeURIComponent(this.parameters)))new pC(DP.DuplicateIframe,"Duplicate iframes found.").log();else{let t=document.createElement("iframe");t.classList.add("magic-iframe"),t.dataset.magicIframeLabel=dB(this.endpoint).host,t.title="Secure Modal",t.src=dB(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,function(e){for(let[t,r]of Object.entries(jB))e.style[t]=r}(t),document.body.appendChild(t),e(t)}};["loaded","interactive","complete"].includes(document.readyState)?t():window.addEventListener("load",t,!1)})),window.addEventListener("message",(e=>{var t;if(e.origin===this.endpoint&&e.data&&e.data.msgType&&this.messageHandlers.size){e.data.response=null!=(t=e.data.response)?t:{};for(let t of this.messageHandlers.values())t(e)}}))}showOverlay(){return NB(this,null,(function*(){let e=yield this.iframe;e.style.display="block",this.activeElement=document.activeElement,e.focus()}))}hideOverlay(){return NB(this,null,(function*(){var e;(yield this.iframe).style.display="none",null!=(e=this.activeElement)&&e.focus&&this.activeElement.focus(),this.activeElement=null}))}_post(e){return NB(this,null,(function*(){let t=yield this.iframe;if(!t||!t.contentWindow)throw new dC(jP.ModalNotReady,"Modal is not ready.");t.contentWindow.postMessage(e,this.endpoint)}))}},configureStorage:()=>NB(void 0,null,(function*(){let e=UB.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield e.defineDriver(LB),yield e.setDriver([UB.default.INDEXEDDB,UB.default.LOCALSTORAGE,LB._driver]),e}))}),FB=(e=>(e.LoginWithOIDC="magic_auth_login_with_oidc",e))(FB||{}),qB=class extends mB.Internal{constructor(){super(...arguments),this.name="openid",this.config={}}loginWithOIDC(e){let t=this.utils.createJsonRpcRequestPayload("magic_auth_login_with_oidc",[e]);return this.request(t)}};function zB(e,t){return function(){return e.apply(t,arguments)}}const{toString:KB}=Object.prototype,{getPrototypeOf:HB}=Object,GB=(e=>t=>{const r=KB.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),WB=e=>(e=e.toLowerCase(),t=>GB(t)===e),VB=e=>t=>typeof t===e,{isArray:XB}=Array,JB=VB("undefined");const $B=WB("ArrayBuffer");const YB=VB("string"),QB=VB("function"),ZB=VB("number"),eU=e=>null!==e&&"object"==typeof e,tU=e=>{if("object"!==GB(e))return!1;const t=HB(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},rU=WB("Date"),nU=WB("File"),iU=WB("Blob"),sU=WB("FileList"),oU=WB("URLSearchParams");function aU(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),XB(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),s=i.length;let o;for(n=0;n<s;n++)o=i[n],t.call(null,e[o],o,e)}}function uU(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const cU="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,fU=e=>!JB(e)&&e!==cU;const lU=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&HB(Uint8Array)),dU=WB("HTMLFormElement"),hU=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),pU=WB("RegExp"),gU=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};aU(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},mU="abcdefghijklmnopqrstuvwxyz",yU="0123456789",bU={DIGIT:yU,ALPHA:mU,ALPHA_DIGIT:mU+mU.toUpperCase()+yU};const vU=WB("AsyncFunction");var wU={isArray:XB,isArrayBuffer:$B,isBuffer:function(e){return null!==e&&!JB(e)&&null!==e.constructor&&!JB(e.constructor)&&QB(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||QB(e.append)&&("formdata"===(t=GB(e))||"object"===t&&QB(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&$B(e.buffer),t},isString:YB,isNumber:ZB,isBoolean:e=>!0===e||!1===e,isObject:eU,isPlainObject:tU,isUndefined:JB,isDate:rU,isFile:nU,isBlob:iU,isRegExp:pU,isFunction:QB,isStream:e=>eU(e)&&QB(e.pipe),isURLSearchParams:oU,isTypedArray:lU,isFileList:sU,forEach:aU,merge:function e(){const{caseless:t}=fU(this)&&this||{},r={},n=(n,i)=>{const s=t&&uU(r,i)||i;tU(r[s])&&tU(n)?r[s]=e(r[s],n):tU(n)?r[s]=e({},n):XB(n)?r[s]=n.slice():r[s]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&aU(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(aU(t,((t,n)=>{r&&QB(t)?e[n]=zB(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,s,o;const a={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)o=i[s],n&&!n(o,e,t)||a[o]||(t[o]=e[o],a[o]=!0);e=!1!==r&&HB(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:GB,kindOfTest:WB,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(XB(e))return e;let t=e.length;if(!ZB(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:dU,hasOwnProperty:hU,hasOwnProp:hU,reduceDescriptors:gU,freezeMethods:e=>{gU(e,((t,r)=>{if(QB(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];QB(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 XB(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)=>(e=+e,Number.isFinite(e)?e:t),findKey:uU,global:cU,isContextDefined:fU,ALPHABET:bU,generateString:(e=16,t=bU.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&QB(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(eU(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=XB(e)?[]:{};return aU(e,((e,t)=>{const s=r(e,n+1);!JB(s)&&(i[t]=s)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:vU,isThenable:e=>e&&(eU(e)||QB(e))&&QB(e.then)&&QB(e.catch)};function _U(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)}wU.inherits(_U,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:wU.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const EU=_U.prototype,AU={};["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=>{AU[e]={value:e}})),Object.defineProperties(_U,AU),Object.defineProperty(EU,"isAxiosError",{value:!0}),_U.from=(e,t,r,n,i,s)=>{const o=Object.create(EU);return wU.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),_U.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,s&&Object.assign(o,s),o};function SU(e){return wU.isPlainObject(e)||wU.isArray(e)}function kU(e){return wU.endsWith(e,"[]")?e.slice(0,-2):e}function xU(e,t,r){return e?e.concat(t).map((function(e,t){return e=kU(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const TU=wU.toFlatObject(wU,{},null,(function(e){return/^is[A-Z]/.test(e)}));function RU(e,t,r){if(!wU.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=wU.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!wU.isUndefined(t[e])}))).metaTokens,i=r.visitor||c,s=r.dots,o=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&wU.isSpecCompliantForm(t);if(!wU.isFunction(i))throw new TypeError("visitor must be a function");function u(e){if(null===e)return"";if(wU.isDate(e))return e.toISOString();if(!a&&wU.isBlob(e))throw new _U("Blob is not supported. Use a Buffer instead.");return wU.isArrayBuffer(e)||wU.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,r,i){let a=e;if(e&&!i&&"object"==typeof e)if(wU.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(wU.isArray(e)&&function(e){return wU.isArray(e)&&!e.some(SU)}(e)||(wU.isFileList(e)||wU.endsWith(r,"[]"))&&(a=wU.toArray(e)))return r=kU(r),a.forEach((function(e,n){!wU.isUndefined(e)&&null!==e&&t.append(!0===o?xU([r],n,s):null===o?r:r+"[]",u(e))})),!1;return!!SU(e)||(t.append(xU(i,r,s),u(e)),!1)}const f=[],l=Object.assign(TU,{defaultVisitor:c,convertValue:u,isVisitable:SU});if(!wU.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!wU.isUndefined(r)){if(-1!==f.indexOf(r))throw Error("Circular reference detected in "+n.join("."));f.push(r),wU.forEach(r,(function(r,s){!0===(!(wU.isUndefined(r)||null===r)&&i.call(t,r,wU.isString(s)?s.trim():s,n,l))&&e(r,n?n.concat(s):[s])})),f.pop()}}(e),t}function OU(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function IU(e,t){this._pairs=[],e&&RU(e,this,t)}const MU=IU.prototype;function PU(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function NU(e,t,r){if(!t)return e;const n=r&&r.encode||PU,i=r&&r.serialize;let s;if(s=i?i(t,r):wU.isURLSearchParams(t)?t.toString():new IU(t,r).toString(n),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}MU.append=function(e,t){this._pairs.push([e,t])},MU.toString=function(e){const t=e?function(t){return e.call(this,t,OU)}:OU;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var CU=class{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){wU.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},BU={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var UU={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:IU,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function LU(e){function t(e,r,n,i){let s=e[i++];const o=Number.isFinite(+s),a=i>=e.length;if(s=!s&&wU.isArray(n)?n.length:s,a)return wU.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!o;n[s]&&wU.isObject(n[s])||(n[s]=[]);return t(e,r,n[s],i)&&wU.isArray(n[s])&&(n[s]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let s;for(n=0;n<i;n++)s=r[n],t[s]=e[s];return t}(n[s])),!o}if(wU.isFormData(e)&&wU.isFunction(e.entries)){const r={};return wU.forEachEntry(e,((e,n)=>{t(function(e){return wU.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const jU={"Content-Type":void 0};const DU={transitional:BU,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=wU.isObject(e);i&&wU.isHTMLForm(e)&&(e=new FormData(e));if(wU.isFormData(e))return n&&n?JSON.stringify(LU(e)):e;if(wU.isArrayBuffer(e)||wU.isBuffer(e)||wU.isStream(e)||wU.isFile(e)||wU.isBlob(e))return e;if(wU.isArrayBufferView(e))return e.buffer;if(wU.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return RU(e,new UU.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return UU.isNode&&wU.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((s=wU.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return RU(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(wU.isString(e))try{return(t||JSON.parse)(e),wU.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||DU.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&wU.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 _U.from(e,_U.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:UU.classes.FormData,Blob:UU.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};wU.forEach(["delete","get","head"],(function(e){DU.headers[e]={}})),wU.forEach(["post","put","patch"],(function(e){DU.headers[e]=wU.merge(jU)}));var FU=DU;const qU=wU.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 zU=Symbol("internals");function KU(e){return e&&String(e).trim().toLowerCase()}function HU(e){return!1===e||null==e?e:wU.isArray(e)?e.map(HU):String(e)}function GU(e,t,r,n,i){return wU.isFunction(n)?n.call(this,t,r):(i&&(t=r),wU.isString(t)?wU.isString(n)?-1!==t.indexOf(n):wU.isRegExp(n)?n.test(t):void 0:void 0)}class WU{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=KU(t);if(!i)throw new Error("header name must be a non-empty string");const s=wU.findKey(n,i);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||t]=HU(e))}const s=(e,t)=>wU.forEach(e,((e,r)=>i(e,r,t)));return wU.isPlainObject(e)||e instanceof this.constructor?s(e,t):wU.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?s((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]&&qU[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&i(t,e,r),this}get(e,t){if(e=KU(e)){const r=wU.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(wU.isFunction(t))return t.call(this,e,r);if(wU.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=KU(e)){const r=wU.findKey(this,e);return!(!r||void 0===this[r]||t&&!GU(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=KU(e)){const i=wU.findKey(r,e);!i||t&&!GU(0,r[i],i,t)||(delete r[i],n=!0)}}return wU.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&&!GU(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return wU.forEach(this,((n,i)=>{const s=wU.findKey(r,i);if(s)return t[s]=HU(n),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();o!==i&&delete t[i],t[o]=HU(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return wU.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&wU.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[zU]=this[zU]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=KU(e);t[n]||(!function(e,t){const r=wU.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 wU.isArray(e)?e.forEach(n):n(e),this}}WU.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),wU.freezeMethods(WU.prototype),wU.freezeMethods(WU);var VU=WU;function XU(e,t){const r=this||FU,n=t||r,i=VU.from(n.headers);let s=n.data;return wU.forEach(e,(function(e){s=e.call(r,s,i.normalize(),t?t.status:void 0)})),i.normalize(),s}function JU(e){return!(!e||!e.__CANCEL__)}function $U(e,t,r){_U.call(this,null==e?"canceled":e,_U.ERR_CANCELED,t,r),this.name="CanceledError"}wU.inherits($U,_U,{__CANCEL__:!0});var YU=UU.isStandardBrowserEnv?{write:function(e,t,r,n,i,s){const o=[];o.push(e+"="+encodeURIComponent(t)),wU.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),wU.isString(n)&&o.push("path="+n),wU.isString(i)&&o.push("domain="+i),!0===s&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function QU(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var ZU=UU.isStandardBrowserEnv?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=wU.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function eL(e,t){let r=0;const n=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,s=0,o=0;return t=void 0!==t?t:1e3,function(a){const u=Date.now(),c=n[o];i||(i=u),r[s]=a,n[s]=u;let f=o,l=0;for(;f!==s;)l+=r[f++],f%=e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),u-i<t)return;const d=c&&u-c;return d?Math.round(1e3*l/d):void 0}}(50,250);return i=>{const s=i.loaded,o=i.lengthComputable?i.total:void 0,a=s-r,u=n(a);r=s;const c={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:u||void 0,estimated:u&&o&&s<=o?(o-s)/u:void 0,event:i};c[t?"download":"upload"]=!0,e(c)}}var tL="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=VU.from(e.headers).normalize(),s=e.responseType;let o;function a(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}wU.isFormData(n)&&(UU.isStandardBrowserEnv||UU.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let u=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+r))}const c=QU(e.baseURL,e.url);function f(){if(!u)return;const n=VU.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new _U("Request failed with status code "+r.status,[_U.ERR_BAD_REQUEST,_U.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),a()}),(function(e){r(e),a()}),{data:s&&"text"!==s&&"json"!==s?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:n,config:e,request:u}),u=null}if(u.open(e.method.toUpperCase(),NU(c,e.params,e.paramsSerializer),!0),u.timeout=e.timeout,"onloadend"in u?u.onloadend=f:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(f)},u.onabort=function(){u&&(r(new _U("Request aborted",_U.ECONNABORTED,e,u)),u=null)},u.onerror=function(){r(new _U("Network Error",_U.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||BU;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new _U(t,n.clarifyTimeoutError?_U.ETIMEDOUT:_U.ECONNABORTED,e,u)),u=null},UU.isStandardBrowserEnv){const t=(e.withCredentials||ZU(c))&&e.xsrfCookieName&&YU.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in u&&wU.forEach(i.toJSON(),(function(e,t){u.setRequestHeader(t,e)})),wU.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),s&&"json"!==s&&(u.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&u.addEventListener("progress",eL(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",eL(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{u&&(r(!t||t.type?new $U(null,e,u):t),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const l=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(c);l&&-1===UU.protocols.indexOf(l)?r(new _U("Unsupported protocol "+l+":",_U.ERR_BAD_REQUEST,e)):u.send(n||null)}))};const rL={http:null,xhr:tL};wU.forEach(rL,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var nL=e=>{e=wU.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=wU.isString(r)?rL[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new _U(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(wU.hasOwnProp(rL,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!wU.isFunction(n))throw new TypeError("adapter is not a function");return n};function iL(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new $U(null,e)}function sL(e){iL(e),e.headers=VU.from(e.headers),e.data=XU.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return nL(e.adapter||FU.adapter)(e).then((function(t){return iL(e),t.data=XU.call(e,e.transformResponse,t),t.headers=VU.from(t.headers),t}),(function(t){return JU(t)||(iL(e),t&&t.response&&(t.response.data=XU.call(e,e.transformResponse,t.response),t.response.headers=VU.from(t.response.headers))),Promise.reject(t)}))}const oL=e=>e instanceof VU?e.toJSON():e;function aL(e,t){t=t||{};const r={};function n(e,t,r){return wU.isPlainObject(e)&&wU.isPlainObject(t)?wU.merge.call({caseless:r},e,t):wU.isPlainObject(t)?wU.merge({},t):wU.isArray(t)?t.slice():t}function i(e,t,r){return wU.isUndefined(t)?wU.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function s(e,t){if(!wU.isUndefined(t))return n(void 0,t)}function o(e,t){return wU.isUndefined(t)?wU.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,i,s){return s in t?n(r,i):s in e?n(void 0,r):void 0}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(e,t)=>i(oL(e),oL(t),!0)};return wU.forEach(Object.keys(Object.assign({},e,t)),(function(n){const s=u[n]||i,o=s(e[n],t[n],n);wU.isUndefined(o)&&s!==a||(r[n]=o)})),r}const uL="1.4.0",cL={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{cL[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const fL={};cL.transitional=function(e,t,r){function n(e,t){return"[Axios v1.4.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,s)=>{if(!1===e)throw new _U(n(i," has been removed"+(t?" in "+t:"")),_U.ERR_DEPRECATED);return t&&!fL[i]&&(fL[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,s)}};var lL={assertOptions:function(e,t,r){if("object"!=typeof e)throw new _U("options must be an object",_U.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const s=n[i],o=t[s];if(o){const t=e[s],r=void 0===t||o(t,s,e);if(!0!==r)throw new _U("option "+s+" must be "+r,_U.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new _U("Unknown option "+s,_U.ERR_BAD_OPTION)}},validators:cL};const dL=lL.validators;class hL{constructor(e){this.defaults=e,this.interceptors={request:new CU,response:new CU}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=aL(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let s;void 0!==r&&lL.assertOptions(r,{silentJSONParsing:dL.transitional(dL.boolean),forcedJSONParsing:dL.transitional(dL.boolean),clarifyTimeoutError:dL.transitional(dL.boolean)},!1),null!=n&&(wU.isFunction(n)?t.paramsSerializer={serialize:n}:lL.assertOptions(n,{encode:dL.function,serialize:dL.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),s=i&&wU.merge(i.common,i[t.method]),s&&wU.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=VU.concat(s,i);const o=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));const u=[];let c;this.interceptors.response.forEach((function(e){u.push(e.fulfilled,e.rejected)}));let f,l=0;if(!a){const e=[sL.bind(this),void 0];for(e.unshift.apply(e,o),e.push.apply(e,u),f=e.length,c=Promise.resolve(t);l<f;)c=c.then(e[l++],e[l++]);return c}f=o.length;let d=t;for(l=0;l<f;){const e=o[l++],t=o[l++];try{d=e(d)}catch(e){t.call(this,e);break}}try{c=sL.call(this,d)}catch(e){return Promise.reject(e)}for(l=0,f=u.length;l<f;)c=c.then(u[l++],u[l++]);return c}getUri(e){return NU(QU((e=aL(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}wU.forEach(["delete","get","head","options"],(function(e){hL.prototype[e]=function(t,r){return this.request(aL(r||{},{method:e,url:t,data:(r||{}).data}))}})),wU.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(aL(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}hL.prototype[e]=t(),hL.prototype[e+"Form"]=t(!0)}));var pL=hL;class gL{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 $U(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 e;const t=new gL((function(t){e=t}));return{token:t,cancel:e}}}var mL=gL;const yL={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(yL).forEach((([e,t])=>{yL[t]=e}));var bL=yL;const vL=function e(t){const r=new pL(t),n=zB(pL.prototype.request,r);return wU.extend(n,pL.prototype,r,{allOwnKeys:!0}),wU.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(aL(t,r))},n}(FU);vL.Axios=pL,vL.CanceledError=$U,vL.CancelToken=mL,vL.isCancel=JU,vL.VERSION=uL,vL.toFormData=RU,vL.AxiosError=_U,vL.Cancel=vL.CanceledError,vL.all=function(e){return Promise.all(e)},vL.spread=function(e){return function(t){return e.apply(null,t)}},vL.isAxiosError=function(e){return wU.isObject(e)&&!0===e.isAxiosError},vL.mergeConfig=aL,vL.AxiosHeaders=VU,vL.formToJSON=e=>LU(wU.isHTMLForm(e)?new FormData(e):e),vL.HttpStatusCode=bL,vL.default=vL;var wL=vL;const _L="https://guardian.sandbox.imtbl.com".replace(/\/+$/,"");class EL{basePath;axios;configuration;constructor(e,t=_L,r=wL){this.basePath=t,this.axios=r,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class AL extends Error{field;constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const SL="https://example.com",kL=function(e,t,r){if(null==r)throw new AL(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},xL=async function(e,t){if(t&&t.accessToken){const r="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+r}};function TL(e,t,r=""){null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>TL(e,t,r))):Object.keys(t).forEach((n=>TL(e,t[n],`${r}${""!==r?".":""}${n}`))):e.has(r)?e.append(r,t):e.set(r,t))}const RL=function(e,...t){const r=new URLSearchParams(e.search);TL(r,t),e.search=r.toString()},OL=function(e,t,r){const n="string"!=typeof e;return(n&&r&&r.isJsonMime?r.isJsonMime(t.headers["Content-Type"]):n)?JSON.stringify(void 0!==e?e:{}):e||""},IL=function(e){return e.pathname+e.search+e.hash},ML=function(e,t,r,n){return(i=t,s=r)=>{const o={...e.options,url:(n?.basePath||s)+e.url};return i.request(o)}},PL=function(e){const t=function(e){return{approvePendingTransaction:async(t,r,n={})=>{kL("approvePendingTransaction","payloadHash",t),kL("approvePendingTransaction","transactionApprovalRequest",r);const i="/guardian/v1/transactions/{payloadHash}/approve".replace("{payloadHash}",encodeURIComponent(String(t))),s=new URL(i,SL);let o;e&&(o=e.baseOptions);const a={method:"POST",...o,...n},u={};await xL(u,e),u["Content-Type"]="application/json",RL(s,{});let c=o&&o.headers?o.headers:{};return a.headers={...u,...c,...n.headers},a.data=OL(r,a,e),{url:IL(s),options:a}},evaluateTransaction:async(t,r,n={})=>{kL("evaluateTransaction","id",t),kL("evaluateTransaction","transactionEvaluationRequest",r);const i="/guardian/v1/transactions/{id}/evaluate".replace("{id}",encodeURIComponent(String(t))),s=new URL(i,SL);let o;e&&(o=e.baseOptions);const a={method:"POST",...o,...n},u={};await xL(u,e),u["Content-Type"]="application/json",RL(s,{});let c=o&&o.headers?o.headers:{};return a.headers={...u,...c,...n.headers},a.data=OL(r,a,e),{url:IL(s),options:a}},getTransactionByID:async(t,r,n,i={})=>{kL("getTransactionByID","transactionID",t),kL("getTransactionByID","chainType",r);const s="/guardian/v1/transactions/{transactionID}".replace("{transactionID}",encodeURIComponent(String(t))),o=new URL(s,SL);let a;e&&(a=e.baseOptions);const u={method:"GET",...a,...i},c={},f={};await xL(c,e),void 0!==r&&(f.chainType=r),void 0!==n&&(f.chainID=n),RL(o,f);let l=a&&a.headers?a.headers:{};return u.headers={...c,...l,...i.headers},{url:IL(o),options:u}}}}(e);return{async approvePendingTransaction(r,n,i){const s=await t.approvePendingTransaction(r,n,i);return ML(s,wL,_L,e)},async evaluateTransaction(r,n,i){const s=await t.evaluateTransaction(r,n,i);return ML(s,wL,_L,e)},async getTransactionByID(r,n,i,s){const o=await t.getTransactionByID(r,n,i,s);return ML(o,wL,_L,e)}}};class NL extends EL{approvePendingTransaction(e,t){return PL(this.configuration).approvePendingTransaction(e.payloadHash,e.transactionApprovalRequest,t).then((e=>e(this.axios,this.basePath)))}evaluateTransaction(e,t){return PL(this.configuration).evaluateTransaction(e.id,e.transactionEvaluationRequest,t).then((e=>e(this.axios,this.basePath)))}getTransactionByID(e,t){return PL(this.configuration).getTransactionByID(e.transactionID,e.chainType,e.chainID,t).then((e=>e(this.axios,this.basePath)))}}class CL{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}function BL(e){const t=-1!==new ue(e,16).cmp(new ue(27))?new ue(e,16).sub(new ue(27)).toNumber():new ue(e,16).toNumber();return e.trim()?t:void 0}async function UL(e,t){const r=function(e,t=64){const r=Hc(e);return{r:new ue(r.substring(0,t),"hex"),s:new ue(r.substring(t,2*t),"hex"),recoveryParam:BL(r.substring(2*t,2*t+2))}}(await t.signMessage(e));return Wc(zc((n=r).r.toString(16),64)+zc(n.s.toString(16),64)+zc(n.recoveryParam?.toString(16)||"",2));var n}function LL(e){switch(e.type){case"ERC721":return{type:"ERC721",data:{token_id:e.tokenId,token_address:e.tokenAddress}};case"ERC20":return{type:"ERC20",data:{token_address:e.tokenAddress}};default:return{type:"ETH",data:{decimals:18}}}}const jL={erc1271:Object.freeze({__proto__:null,abi:[{type:"function",name:"isValidSignature",constant:!0,inputs:[{type:"bytes32"},{type:"bytes"}],outputs:[{type:"bytes4"}],payable:!1,stateMutability:"view"}],returns:{isValidSignatureBytes32:"0x1626ba7e"}}),factory:Object.freeze({__proto__:null,abi:[{type:"function",name:"deploy",constant:!1,inputs:[{type:"address"},{type:"bytes32"}],outputs:[],payable:!0,stateMutability:"payable"}]}),mainModule:Object.freeze({__proto__:null,abi:[{type:"function",name:"nonce",constant:!0,inputs:[],outputs:[{type:"uint256"}],payable:!1,stateMutability:"view"},{type:"function",name:"readNonce",constant:!0,inputs:[{type:"uint256"}],outputs:[{type:"uint256"}],payable:!1,stateMutability:"view"},{type:"function",name:"updateImplementation",constant:!1,inputs:[{type:"address"}],outputs:[],payable:!1,stateMutability:"nonpayable"},{type:"function",name:"selfExecute",constant:!1,inputs:[{components:[{type:"bool",name:"delegateCall"},{type:"bool",name:"revertOnError"},{type:"uint256",name:"gasLimit"},{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}],type:"tuple[]"}],outputs:[],payable:!1,stateMutability:"nonpayable"},{type:"function",name:"execute",constant:!1,inputs:[{components:[{type:"bool",name:"delegateCall"},{type:"bool",name:"revertOnError"},{type:"uint256",name:"gasLimit"},{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}],type:"tuple[]"},{type:"uint256"},{type:"bytes"}],outputs:[],payable:!1,stateMutability:"nonpayable"},{type:"function",name:"createContract",inputs:[{type:"bytes"}],payable:!0,stateMutability:"payable"}]}),mainModuleUpgradable:Object.freeze({__proto__:null,abi:[{type:"function",name:"updateImageHash",constant:!0,inputs:[{type:"bytes32"}],outputs:[],payable:!1,stateMutability:"view"},{type:"function",name:"imageHash",constant:!0,inputs:[],outputs:[{type:"bytes32"}],payable:!1,stateMutability:"view"}]}),sequenceUtils:Object.freeze({__proto__:null,abi:[{inputs:[{internalType:"address",name:"_factory",type:"address"},{internalType:"address",name:"_mainModule",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"_wallet",type:"address"},{indexed:!0,internalType:"bytes32",name:"_imageHash",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"_threshold",type:"uint256"},{indexed:!1,internalType:"bytes",name:"_signers",type:"bytes"}],name:"RequiredConfig",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"_wallet",type:"address"},{indexed:!0,internalType:"address",name:"_signer",type:"address"}],name:"RequiredSigner",type:"event"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callBalanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callBlockNumber",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_i",type:"uint256"}],name:"callBlockhash",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"callChainId",outputs:[{internalType:"uint256",name:"id",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callCode",outputs:[{internalType:"bytes",name:"code",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callCodeHash",outputs:[{internalType:"bytes32",name:"codeHash",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callCodeSize",outputs:[{internalType:"uint256",name:"size",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callCoinbase",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"callDifficulty",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callGasLeft",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callGasLimit",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callGasPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callOrigin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"callTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"knownImageHashes",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"lastImageHashUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lastSignerUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lastWalletUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"bool",name:"delegateCall",type:"bool"},{internalType:"bool",name:"revertOnError",type:"bool"},{internalType:"uint256",name:"gasLimit",type:"uint256"},{internalType:"address",name:"target",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],internalType:"struct IModuleCalls.Transaction[]",name:"_txs",type:"tuple[]"}],name:"multiCall",outputs:[{internalType:"bool[]",name:"_successes",type:"bool[]"},{internalType:"bytes[]",name:"_results",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"_wallet",type:"address"},{internalType:"uint256",name:"_threshold",type:"uint256"},{components:[{internalType:"uint256",name:"weight",type:"uint256"},{internalType:"address",name:"signer",type:"address"}],internalType:"struct RequireUtils.Member[]",name:"_members",type:"tuple[]"},{internalType:"bool",name:"_index",type:"bool"}],name:"publishConfig",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_wallet",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"uint256",name:"_sizeMembers",type:"uint256"},{internalType:"bytes",name:"_signature",type:"bytes"},{internalType:"bool",name:"_index",type:"bool"}],name:"publishInitialSigners",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_wallet",type:"address"},{internalType:"uint256",name:"_nonce",type:"uint256"}],name:"requireMinNonce",outputs:[],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_expiration",type:"uint256"}],name:"requireNonExpired",outputs:[],stateMutability:"view",type:"function"}]}),requireFreshSigner:Object.freeze({__proto__:null,abi:[{inputs:[{internalType:"address",name:"",type:"address"}],name:"requireFreshSigner",outputs:[],stateMutability:"nonpayable",type:"function"}]})};function DL(){return DL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},DL.apply(this,arguments)}var FL;!function(e){e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.DISABLED=5]="DISABLED"}(FL||(FL={}));function qL(){return qL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},qL.apply(this,arguments)}new class{constructor(e){this.config=e,this.logLevel=void 0,this.configure(e)}configure(e){switch(this.config=DL({},this.config,e),this.config.logLevel){case"DEBUG":this.logLevel=FL.DEBUG;break;case"INFO":default:this.logLevel=FL.INFO;break;case"WARN":this.logLevel=FL.WARN;break;case"ERROR":this.logLevel=FL.ERROR;break;case"DISABLED":this.logLevel=FL.DISABLED}void 0===this.config.silence&&(this.config.silence=!1)}debug(e,...t){!0!==this.config.silence&&this.logLevel===FL.DEBUG&&console.log(e,...t)}info(e,...t){!0!==this.config.silence&&this.logLevel<=FL.INFO&&console.log(e,...t)}warn(e,...t){!0!==this.config.silence&&this.logLevel<=FL.WARN&&(console.warn(e,...t),this.config.onwarn&&this.config.onwarn(e,t))}error(e,...t){!0!==this.config.silence&&this.logLevel<=FL.ERROR&&(console.error(e,...t),this.config.onerror&&this.config.onerror(e,t))}}({logLevel:"INFO",silence:!0});const zL=(e,t=!1)=>(((e,t=!1,r=!1)=>{if(!e)throw new Error("invalid network config: empty config");const n=[];if(Array.isArray(e)?n.push(...e):n.push(e),0===n.length){if(t)throw new Error("invalid network config: empty config");return!1}const i=n.map((e=>e.chainId)).sort(),s=i.filter(((e,t)=>i.indexOf(e)!==t));if(s.length>0){if(t)throw new Error(`invalid network config: duplicate chainIds ${s}`);return!1}n.forEach((e=>e.name=e.name.toLowerCase()));const o=n.map((e=>e.name)).sort(),a=o.filter(((e,t)=>o.indexOf(e)!==t));if(a.length>0){if(t)throw new Error(`invalid network config: duplicate network names ${a}`);return!1}let u=!1,c=!1;for(let e=0;e<n.length;e++){const i=n[e];if(!(i.rpcUrl&&""!==i.rpcUrl||i.provider)){if(t)throw new Error(`invalid network config for chainId ${i.chainId}: rpcUrl or provider must be provided`);return!1}if(!r&&!i.relayer){if(t)throw new Error(`invalid network config for chainId ${i.chainId}: relayer must be provided`);return!1}if(i.isDefaultChain){if(u){if(t)throw new Error(`invalid network config for chainId ${i.chainId}: DefaultChain is already set by another config`);return!1}u=!0}if(i.isAuthChain){if(c&&t)throw new Error(`invalid network config for chainId ${i.chainId}: AuthChain is already set by another config`);c=!0}}if(!u){if(t)throw new Error("invalid network config: DefaultChain must be set");return!1}if(!c){if(t)throw new Error("invalid network config: AuthChain must be set");return!1}})(e,!0,t),e),KL=e=>zL(HL(e)),HL=e=>{if(!e)return[];const t=e.sort(((e,t)=>e.chainId===t.chainId?0:e.chainId<t.chainId?-1:1)),r=t.findIndex((e=>e.isDefaultChain));r>0&&t.splice(0,0,t.splice(r,1)[0]);const n=t.findIndex((e=>e.isAuthChain&&!0!==e.isDefaultChain));return n>0&&t.splice(1,0,t.splice(n,1)[0]),t},GL=(e,t)=>"string"==typeof e?(t=t||{},e.replace(/\$\{\s*([$#@\-\d\w]+)\s*\}/gim,(function(e,r){let n=t[r];return n="function"==typeof n?n():null==n?"":"object"==typeof n||"symbol"==typeof n?n.toString():n.valueOf(),n}))):"";let WL;!function(e){e[e.MAINNET=1]="MAINNET",e[e.ROPSTEN=3]="ROPSTEN",e[e.RINKEBY=4]="RINKEBY",e[e.GOERLI=5]="GOERLI",e[e.KOVAN=42]="KOVAN",e[e.POLYGON=137]="POLYGON",e[e.POLYGON_MUMBAI=80001]="POLYGON_MUMBAI",e[e.POLYGON_ZKEVM=1101]="POLYGON_ZKEVM",e[e.BSC=56]="BSC",e[e.BSC_TESTNET=97]="BSC_TESTNET",e[e.OPTIMISM=10]="OPTIMISM",e[e.OPTIMISM_TESTNET=69]="OPTIMISM_TESTNET",e[e.ARBITRUM=42161]="ARBITRUM",e[e.ARBITRUM_GOERLI=421613]="ARBITRUM_GOERLI",e[e.ARBITRUM_NOVA=42170]="ARBITRUM_NOVA",e[e.AVALANCHE=43114]="AVALANCHE",e[e.AVALANCHE_TESTNET=43113]="AVALANCHE_TESTNET",e[e.FANTOM=250]="FANTOM",e[e.FANTOM_TESTNET=4002]="FANTOM_TESTNET",e[e.GNOSIS=100]="GNOSIS",e[e.AURORA=1313161554]="AURORA",e[e.AURORA_TESTNET=1313161556]="AURORA_TESTNET",e[e.BASE_GOERLI=84531]="BASE_GOERLI"}(WL||(WL={}));const VL=e=>GL("https://${network}-indexer.sequence.app",{network:e}),XL=e=>GL("https://${network}-relayer.sequence.app",{network:e}),JL=e=>GL("https://nodes.sequence.app/${network}",{network:e}),$L={[WL.MAINNET]:{chainId:WL.MAINNET,name:"mainnet",title:"Ethereum",blockExplorer:{name:"Etherscan",rootUrl:"https://etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[WL.ROPSTEN]:{chainId:WL.ROPSTEN,name:"ropsten",title:"Ropsten",testnet:!0,blockExplorer:{name:"Etherscan (Ropsten)",rootUrl:"https://ropsten.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[WL.RINKEBY]:{chainId:WL.RINKEBY,name:"rinkeby",title:"Rinkeby",testnet:!0,blockExplorer:{name:"Etherscan (Rinkeby)",rootUrl:"https://rinkeby.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",disabled:!0},[WL.GOERLI]:{chainId:WL.GOERLI,name:"goerli",title:"Goerli",testnet:!0,blockExplorer:{name:"Etherscan (Goerli)",rootUrl:"https://goerli.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[WL.KOVAN]:{chainId:WL.KOVAN,name:"kovan",title:"Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Kovan)",rootUrl:"https://kovan.etherscan.io/"}},[WL.POLYGON]:{chainId:WL.POLYGON,name:"polygon",title:"Polygon",blockExplorer:{name:"Polygonscan",rootUrl:"https://polygonscan.com/"}},[WL.POLYGON_MUMBAI]:{chainId:WL.POLYGON_MUMBAI,name:"mumbai",title:"Polygon Mumbai",testnet:!0,blockExplorer:{name:"Polygonscan (Mumbai)",rootUrl:"https://mumbai.polygonscan.com/"}},[WL.POLYGON_ZKEVM]:{chainId:WL.POLYGON_ZKEVM,name:"polygon-zkevm",title:"Polygon zkEVM",blockExplorer:{name:"Polygonscan (zkEVM)",rootUrl:"https://zkevm.polygonscan.com/"}},[WL.BSC]:{chainId:WL.BSC,name:"bsc",title:"BNB Smart Chain",blockExplorer:{name:"BSCScan",rootUrl:"https://bscscan.com/"}},[WL.BSC_TESTNET]:{chainId:WL.BSC_TESTNET,name:"bsc-testnet",title:"BNB Smart Chain Testnet",testnet:!0,blockExplorer:{name:"BSCScan (Testnet)",rootUrl:"https://testnet.bscscan.com/"}},[WL.OPTIMISM]:{chainId:WL.OPTIMISM,name:"optimism",title:"Optimism",blockExplorer:{name:"Etherscan (Optimism)",rootUrl:"https://optimistic.etherscan.io/"}},[WL.OPTIMISM_TESTNET]:{chainId:WL.OPTIMISM_TESTNET,name:"optimism-testnet",title:"Optimistic Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Optimism Testnet)",rootUrl:"https://kovan-optimistic.etherscan.io/"}},[WL.ARBITRUM]:{chainId:WL.ARBITRUM,name:"arbitrum",title:"Arbitrum One",blockExplorer:{name:"Arbiscan",rootUrl:"https://arbiscan.io/"}},[WL.ARBITRUM_GOERLI]:{chainId:WL.ARBITRUM_GOERLI,name:"arbitrum-goerli",title:"Arbitrum Goerli",testnet:!0,blockExplorer:{name:"Arbiscan (Testnet)",rootUrl:"https://testnet.arbiscan.io/"}},[WL.ARBITRUM_NOVA]:{chainId:WL.ARBITRUM_NOVA,name:"arbitrum-nova",title:"Arbitrum Nova",blockExplorer:{name:"Nova Explorer",rootUrl:"https://nova-explorer.arbitrum.io/"}},[WL.AVALANCHE]:{chainId:WL.AVALANCHE,name:"avalanche",title:"Avalanche",blockExplorer:{name:"Snowtrace",rootUrl:"https://snowtrace.io/"}},[WL.AVALANCHE_TESTNET]:{chainId:WL.AVALANCHE_TESTNET,name:"avalanche-testnet",title:"Avalanche Testnet",testnet:!0,blockExplorer:{name:"Snowtrace (Testnet)",rootUrl:"https://testnet.snowtrace.io/"}},[WL.FANTOM]:{chainId:WL.FANTOM,name:"fantom",title:"Fantom",blockExplorer:{name:"FTMScan",rootUrl:"https://ftmscan.com/"}},[WL.FANTOM_TESTNET]:{chainId:WL.FANTOM_TESTNET,name:"fantom-testnet",title:"Fantom Testnet",testnet:!0,blockExplorer:{name:"FTMScan (Testnet)",rootUrl:"https://testnet.ftmscan.com/"}},[WL.GNOSIS]:{chainId:WL.GNOSIS,name:"gnosis",title:"Gnosis Chain",blockExplorer:{name:"Gnosis Chain Explorer",rootUrl:"https://blockscout.com/xdai/mainnet/"}},[WL.AURORA]:{chainId:WL.AURORA,name:"aurora",title:"Aurora",blockExplorer:{name:"Aurora Explorer",rootUrl:"https://aurorascan.dev/"}},[WL.AURORA_TESTNET]:{chainId:WL.AURORA_TESTNET,name:"aurora-testnet",title:"Aurora Testnet",blockExplorer:{name:"Aurora Explorer (Testnet)",rootUrl:"https://testnet.aurorascan.dev/"}},[WL.BASE_GOERLI]:{chainId:WL.BASE_GOERLI,name:"base-goerli",title:"Base Goerli",blockExplorer:{name:"Base Goerli Explorer",rootUrl:"https://goerli.basescan.org/"}}};KL([qL({},$L[WL.MAINNET],{rpcUrl:JL("mainnet"),relayer:{url:XL("mainnet")},indexerUrl:VL("mainnet")}),qL({},$L[WL.POLYGON],{rpcUrl:JL("polygon"),relayer:{url:XL("polygon")},indexerUrl:VL("polygon"),isDefaultChain:!0,isAuthChain:!0}),qL({},$L[WL.BSC],{rpcUrl:JL("bsc"),indexerUrl:VL("bsc"),relayer:{url:XL("bsc")}}),qL({},$L[WL.AVALANCHE],{rpcUrl:JL("avalanche"),indexerUrl:VL("avalanche"),relayer:{url:XL("avalanche")}}),qL({},$L[WL.ARBITRUM],{rpcUrl:JL("arbitrum"),indexerUrl:VL("arbitrum"),relayer:{url:XL("arbitrum")}}),qL({},$L[WL.ARBITRUM_NOVA],{rpcUrl:JL("arbitrum-nova"),indexerUrl:VL("arbitrum-nova"),relayer:{url:XL("arbitrum-nova")}}),qL({},$L[WL.OPTIMISM],{rpcUrl:JL("optimism"),indexerUrl:VL("optimism"),relayer:{url:XL("optimism")}}),qL({},$L[WL.POLYGON_ZKEVM],{rpcUrl:JL("polygon-zkevm"),indexerUrl:VL("polygon-zkevm"),relayer:{url:XL("polygon-zkevm")}}),qL({},$L[WL.GNOSIS],{rpcUrl:JL("gnosis"),indexerUrl:VL("gnosis"),relayer:{url:XL("gnosis")}})]),KL([qL({},$L[WL.RINKEBY],{rpcUrl:JL("rinkeby"),relayer:{url:XL("rinkeby")},indexerUrl:VL("rinkeby")}),qL({},$L[WL.GOERLI],{rpcUrl:JL("goerli"),relayer:{url:XL("goerli")},indexerUrl:VL("goerli")}),qL({},$L[WL.POLYGON_MUMBAI],{rpcUrl:JL("mumbai"),relayer:{url:XL("mumbai")},indexerUrl:VL("mumbai"),isDefaultChain:!0,isAuthChain:!0}),qL({},$L[WL.BSC_TESTNET],{rpcUrl:JL("bsc-testnet"),relayer:{url:XL("bsc-testnet")},indexerUrl:VL("bsc-testnet")}),qL({},$L[WL.ARBITRUM_GOERLI],{rpcUrl:JL("arbitrum-goerli"),relayer:{url:XL("arbitrum-goerli")},indexerUrl:VL("arbitrum-goerli")}),qL({},$L[WL.BASE_GOERLI],{rpcUrl:JL("base-goerli"),relayer:{url:XL("base-goerli")},indexerUrl:VL("base-goerli")})]);function YL(){return YL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},YL.apply(this,arguments)}let QL;!function(e){e.ethCall="eth_call",e.ethGetBalance="eth_getBalance",e.ethGetCode="eth_getCode"}(QL||(QL={}));let ZL,ej;YL({},{batchSize:50,timeWindow:50,contract:"0xd130B43062D875a4B7aF3f8fc036Bc6e9D3E1B3E",verbose:!1});try{ZL=localStorage}catch(e){const t=new Map;ZL={getItem:e=>{var r;return null!=(r=t.get(e))?r:null},setItem:(e,r)=>t.set(e,r),removeItem:e=>t.delete(e)}}function tj(e){return void 0!==e.address&&!function(e){return rj(e)||nj(e)||ij(e)}(e)}function rj(e){const t=e;return void 0!==t.signature&&void 0===t.address}function nj(e){const t=e;return void 0!==t.r&&void 0!==t.s&&void 0!==t.v&&void 0!==t.t}function ij(e){const t=e;return void 0!==t.address&&void 0!==t.signature}!function(e){e[e.EOA=0]="EOA",e[e.Address=1]="Address",e[e.Full=2]="Full"}(ej||(ej={}));const sj=e=>{if("string"==typeof e)return sj((e=>{if("string"!=typeof e)return e;const t=e.replace("0x",""),r=He.from(`0x${t.slice(0,4)}`).toNumber(),n=[];for(let e=4;e<t.length;){const r=He.from(t.slice(e,e+2)).toNumber();e+=2;const i=He.from(`0x${t.slice(e,e+2)}`).toNumber();switch(e+=2,r){case ej.Address:const r=ur(t.slice(e,e+40));e+=40,n.push({weight:i,address:r});break;case ej.EOA:const s=ke(`0x${t.slice(e,e+132)}`);e+=132;const o=Le(s.slice(0,65)),a=o.r,u=o.s,c=o.v,f=He.from(s[s.length-1]).toNumber();n.push({weight:i,signature:s,r:a,s:u,v:c,t:f});break;case ej.Full:const l=ur(t.slice(e,e+40));e+=40;const d=He.from(`0x${t.slice(e,e+4)}`).mul(2).toNumber();e+=4;const h=ke(`0x${t.slice(e,e+d)}`);e+=d,n.push({weight:i,address:l,signature:h});break;default:throw Error("Signature type not supported")}}return{threshold:r,signers:n}})(e));const t=e.signers.map((e=>{if(tj(e))return Hu(["uint8","uint8","address"],[ej.Address,e.weight,e.address]);if(nj(e))return Hu(["uint8","uint8","bytes32","bytes32","uint8","uint8"],[ej.EOA,e.weight,e.r,e.s,e.v,e.t]);if(ij(e)){const t=ke(e.signature).length;return Hu(["uint8","uint8","address","uint16","bytes"],[ej.Full,e.weight,e.address,t,e.signature])}if(rj(e))return Hu(["uint8","uint8","bytes"],[ej.EOA,e.weight,e.signature]);throw Error("Unkwnown signature part type")}));return Hu(["uint16",...Array(t.length).fill("bytes")],[e.threshold,...t])};var oj;!function(e){e.AUTHENTICATION_ERROR="AUTHENTICATION_ERROR",e.INVALID_CONFIGURATION="INVALID_CONFIGURATION",e.WALLET_CONNECTION_ERROR="WALLET_CONNECTION_ERROR",e.NOT_LOGGED_IN_ERROR="NOT_LOGGED_IN_ERROR",e.SILENT_LOGIN_ERROR="SILENT_LOGIN_ERROR",e.REFRESH_TOKEN_ERROR="REFRESH_TOKEN_ERROR",e.USER_REGISTRATION_ERROR="USER_REGISTRATION_ERROR",e.LOGOUT_ERROR="LOGOUT_ERROR",e.TRANSFER_ERROR="TRANSFER_ERROR",e.CREATE_ORDER_ERROR="CREATE_ORDER_ERROR",e.CANCEL_ORDER_ERROR="CANCEL_ORDER_ERROR",e.EXCHANGE_TRANSFER_ERROR="EXCHANGE_TRANSFER_ERROR",e.CREATE_TRADE_ERROR="CREATE_TRADE_ERROR",e.OPERATION_NOT_SUPPORTED_ERROR="OPERATION_NOT_SUPPORTED_ERROR"}(oj||(oj={}));class aj extends Error{type;constructor(e,t){super(e),this.type=t}}const uj=async(e,t)=>{try{return await e()}catch(e){const r=`${t}: ${e.message}`||"UnknownError";throw new aj(r,t)}},cj="passport_credentials";class fj{saveCredentials(e){localStorage.setItem(cj,JSON.stringify(e))}getCredentials(){const e=localStorage.getItem(cj);return e?JSON.parse(e):null}areValid(e){if(e){const t=this.isTokenValid(e.access_token),r=this.isTokenValid(e.id_token);return t&&r}return!1}isTokenValid(e){return(EI(e).exp??0)>Date.now()/1e3+3600}clearCredentials(){localStorage.removeItem(cj)}}const lj={headers:{"Content-Type":"application/x-www-form-urlencoded"}};function dj(e){return new Promise((t=>{setTimeout(t,e)}))}class hj{userManager;config;deviceCredentialsManager;logoutMode;constructor(e){this.config=e,this.userManager=new class{constructor(e){this._logger=new RI("UserManager"),this.settings=new rM(e),this._client=new class{constructor(e){this._logger=new RI("OidcClient"),this.settings=new qI(e),this.metadataService=new class{constructor(e){this._settings=e,this._logger=new RI("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new DI(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}resetSigningKeys(){this._signingKeys=null}async getMetadata(){const e=this._logger.create("getMetadata");if(this._metadata)return e.debug("using cached values"),this._metadata;if(!this._metadataUrl)throw e.throw(new Error("No authority or metadataUrl configured on settings")),null;e.debug("getting metadata from",this._metadataUrl);const t=await this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials});return e.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},this._settings.metadataSeed,t),this._metadata}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(e=!0){return this._getMetadataProperty("token_endpoint",e)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(e=!0){return this._getMetadataProperty("revocation_endpoint",e)}getKeysEndpoint(e=!0){return this._getMetadataProperty("jwks_uri",e)}async _getMetadataProperty(e,t=!1){const r=this._logger.create(`_getMetadataProperty('${e}')`),n=await this.getMetadata();if(r.debug("resolved"),void 0===n[e]){if(!0===t)return void r.warn("Metadata does not contain optional property");r.throw(new Error("Metadata does not contain property "+e))}return n[e]}async getSigningKeys(){const e=this._logger.create("getSigningKeys");if(this._signingKeys)return e.debug("returning signingKeys from cache"),this._signingKeys;const t=await this.getKeysEndpoint(!1);e.debug("got jwks_uri",t);const r=await this._jsonService.getJson(t);if(e.debug("got key set",r),!Array.isArray(r.keys))throw e.throw(new Error("Missing keys on keyset")),null;return this._signingKeys=r.keys,this._signingKeys}}(this.settings),this._claimsService=new class{constructor(e){this._settings=e,this._logger=new RI("ClaimsService")}filterProtocolClaims(e){const t={...e};if(this._settings.filterProtocolClaims){let e;e=Array.isArray(this._settings.filterProtocolClaims)?this._settings.filterProtocolClaims:WI;for(const r of e)VI.includes(r)||delete t[r]}return t}mergeClaims(e,t){const r={...e};for(const[e,n]of Object.entries(t))for(const t of Array.isArray(n)?n:[n]){const n=r[e];n?Array.isArray(n)?n.includes(t)||n.push(t):r[e]!==t&&("object"==typeof t&&this._settings.mergeClaims?r[e]=this.mergeClaims(n,t):r[e]=[n,t]):r[e]=t}return r}}(this.settings),this._validator=new class{constructor(e,t,r){this._settings=e,this._metadataService=t,this._claimsService=r,this._logger=new RI("ResponseValidator"),this._userInfoService=new class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new RI("UserInfoService"),this._getClaimsFromJwt=async e=>{const t=this._logger.create("_getClaimsFromJwt");try{const r=MI.decode(e);return t.debug("JWT decoding successful"),r}catch(e){throw t.error("Error parsing JWT response"),e}},this._jsonService=new DI(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}async getClaims(e){const t=this._logger.create("getClaims");e||this._logger.throw(new Error("No token passed"));const r=await this._metadataService.getUserInfoEndpoint();t.debug("got userinfo url",r);const n=await this._jsonService.getJson(r,{token:e,credentials:this._settings.fetchRequestCredentials});return t.debug("got claims",n),n}}(this._settings,this._metadataService),this._tokenClient=new zI(this._settings,this._metadataService)}async validateSigninResponse(e,t){const r=this._logger.create("validateSigninResponse");this._processSigninState(e,t),r.debug("state processed"),await this._processCode(e,t),r.debug("code processed"),e.isOpenId&&this._validateIdTokenAttributes(e),r.debug("tokens validated"),await this._processClaims(e,null==t?void 0:t.skipUserInfo,e.isOpenId),r.debug("claims processed")}async validateCredentialsResponse(e,t){const r=this._logger.create("validateCredentialsResponse");e.isOpenId&&this._validateIdTokenAttributes(e),r.debug("tokens validated"),await this._processClaims(e,t,e.isOpenId),r.debug("claims processed")}async validateRefreshResponse(e,t){const r=this._logger.create("validateRefreshResponse");e.userState=t.data,null!=e.session_state||(e.session_state=t.session_state),null!=e.scope||(e.scope=t.scope),e.isOpenId&&e.id_token&&(this._validateIdTokenAttributes(e,t.id_token),r.debug("ID Token validated")),e.id_token||(e.id_token=t.id_token,e.profile=t.profile);const n=e.isOpenId&&!!e.id_token;await this._processClaims(e,!1,n),r.debug("claims processed")}validateSignoutResponse(e,t){const r=this._logger.create("validateSignoutResponse");if(t.id!==e.state&&r.throw(new Error("State does not match")),r.debug("state validated"),e.userState=t.data,e.error)throw r.warn("Response was error",e.error),new BI(e)}_processSigninState(e,t){const r=this._logger.create("_processSigninState");if(t.id!==e.state&&r.throw(new Error("State does not match")),t.client_id||r.throw(new Error("No client_id on state")),t.authority||r.throw(new Error("No authority on state")),this._settings.authority!==t.authority&&r.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==t.client_id&&r.throw(new Error("client_id mismatch on settings vs. signin state")),r.debug("state validated"),e.userState=t.data,null!=e.scope||(e.scope=t.scope),e.error)throw r.warn("Response was error",e.error),new BI(e);t.code_verifier&&!e.code&&r.throw(new Error("Expected code in response"))}async _processClaims(e,t=!1,r=!0){const n=this._logger.create("_processClaims");if(e.profile=this._claimsService.filterProtocolClaims(e.profile),t||!this._settings.loadUserInfo||!e.access_token)return void n.debug("not loading user info");n.debug("loading user info");const i=await this._userInfoService.getClaims(e.access_token);n.debug("user info claims received from user info endpoint"),r&&i.sub!==e.profile.sub&&n.throw(new Error("subject from UserInfo response does not match subject in ID Token")),e.profile=this._claimsService.mergeClaims(e.profile,this._claimsService.filterProtocolClaims(i)),n.debug("user info claims received, updated profile:",e.profile)}async _processCode(e,t){const r=this._logger.create("_processCode");if(e.code){r.debug("Validating code");const n=await this._tokenClient.exchangeCode({client_id:t.client_id,client_secret:t.client_secret,code:e.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier,...t.extraTokenParams});Object.assign(e,n)}else r.debug("No code to process")}_validateIdTokenAttributes(e,t){var r;const n=this._logger.create("_validateIdTokenAttributes");n.debug("decoding ID Token JWT");const i=MI.decode(null!=(r=e.id_token)?r:"");if(i.sub||n.throw(new Error("ID Token is missing a subject claim")),t){const e=MI.decode(t);i.sub!==e.sub&&n.throw(new Error("sub in id_token does not match current sub")),i.auth_time&&i.auth_time!==e.auth_time&&n.throw(new Error("auth_time in id_token does not match original auth_time")),i.azp&&i.azp!==e.azp&&n.throw(new Error("azp in id_token does not match original azp")),!i.azp&&e.azp&&n.throw(new Error("azp not in id_token, but present in original id_token"))}e.profile=i}}(this.settings,this.metadataService,this._claimsService),this._tokenClient=new zI(this.settings,this.metadataService)}async createSigninRequest({state:e,request:t,request_uri:r,request_type:n,id_token_hint:i,login_hint:s,skipUserInfo:o,nonce:a,response_type:u=this.settings.response_type,scope:c=this.settings.scope,redirect_uri:f=this.settings.redirect_uri,prompt:l=this.settings.prompt,display:d=this.settings.display,max_age:h=this.settings.max_age,ui_locales:p=this.settings.ui_locales,acr_values:g=this.settings.acr_values,resource:m=this.settings.resource,response_mode:y=this.settings.response_mode,extraQueryParams:b=this.settings.extraQueryParams,extraTokenParams:v=this.settings.extraTokenParams}){const w=this._logger.create("createSigninRequest");if("code"!==u)throw new Error("Only the Authorization Code flow (with PKCE) is supported");const _=await this.metadataService.getAuthorizationEndpoint();w.debug("Received authorization endpoint",_);const E=new class{constructor({url:e,authority:t,client_id:r,redirect_uri:n,response_type:i,scope:s,state_data:o,response_mode:a,request_type:u,client_secret:c,nonce:f,resource:l,skipUserInfo:d,extraQueryParams:h,extraTokenParams:p,disablePKCE:g,...m}){if(this._logger=new RI("SigninRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");if(!r)throw this._logger.error("ctor: No client_id passed"),new Error("client_id");if(!n)throw this._logger.error("ctor: No redirect_uri passed"),new Error("redirect_uri");if(!i)throw this._logger.error("ctor: No response_type passed"),new Error("response_type");if(!s)throw this._logger.error("ctor: No scope passed"),new Error("scope");if(!t)throw this._logger.error("ctor: No authority passed"),new Error("authority");this.state=new HI({data:o,request_type:u,code_verifier:!g,client_id:r,authority:t,redirect_uri:n,response_mode:a,client_secret:c,scope:s,extraTokenParams:p,skipUserInfo:d});const y=new URL(e);y.searchParams.append("client_id",r),y.searchParams.append("redirect_uri",n),y.searchParams.append("response_type",i),y.searchParams.append("scope",s),f&&y.searchParams.append("nonce",f),y.searchParams.append("state",this.state.id),this.state.code_challenge&&(y.searchParams.append("code_challenge",this.state.code_challenge),y.searchParams.append("code_challenge_method","S256")),l&&(Array.isArray(l)?l:[l]).forEach((e=>y.searchParams.append("resource",e)));for(const[e,t]of Object.entries({response_mode:a,...m,...h}))null!=t&&y.searchParams.append(e,t.toString());this.url=y.href}}({url:_,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:f,response_type:u,scope:c,state_data:e,prompt:l,display:d,max_age:h,ui_locales:p,id_token_hint:i,login_hint:s,acr_values:g,resource:m,request:t,request_uri:r,extraQueryParams:b,extraTokenParams:v,request_type:n,response_mode:y,client_secret:this.settings.client_secret,skipUserInfo:o,nonce:a,disablePKCE:this.settings.disablePKCE});await this.clearStaleState();const A=E.state;return await this.settings.stateStore.set(A.id,A.toStorageString()),E}async readSigninResponseState(e,t=!1){const r=this._logger.create("readSigninResponseState"),n=new GI(CI.readParams(e,this.settings.response_mode));if(!n.state)throw r.throw(new Error("No state in response")),null;const i=await this.settings.stateStore[t?"remove":"get"](n.state);if(!i)throw r.throw(new Error("No matching state found in storage")),null;return{state:HI.fromStorageString(i),response:n}}async processSigninResponse(e){const t=this._logger.create("processSigninResponse"),{state:r,response:n}=await this.readSigninResponseState(e,!0);return t.debug("received state from storage; validating response"),await this._validator.validateSigninResponse(n,r),n}async processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:r=!1,extraTokenParams:n={}}){const i=await this._tokenClient.exchangeCredentials({username:e,password:t,...n}),s=new GI(new URLSearchParams);return Object.assign(s,i),await this._validator.validateCredentialsResponse(s,r),s}async useRefreshToken({state:e,timeoutInSeconds:t}){var r;const n=this._logger.create("useRefreshToken");let i;if(void 0===this.settings.refreshTokenAllowedScope)i=e.scope;else{const t=this.settings.refreshTokenAllowedScope.split(" ");i=((null==(r=e.scope)?void 0:r.split(" "))||[]).filter((e=>t.includes(e))).join(" ")}const s=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:i,timeoutInSeconds:t}),o=new GI(new URLSearchParams);return Object.assign(o,s),n.debug("validating response",o),await this._validator.validateRefreshResponse(o,{...e,scope:i}),o}async createSignoutRequest({state:e,id_token_hint:t,request_type:r,post_logout_redirect_uri:n=this.settings.post_logout_redirect_uri,extraQueryParams:i=this.settings.extraQueryParams}={}){const s=this._logger.create("createSignoutRequest"),o=await this.metadataService.getEndSessionEndpoint();if(!o)throw s.throw(new Error("No end session endpoint")),null;s.debug("Received end session endpoint",o);const a=new class{constructor({url:e,state_data:t,id_token_hint:r,post_logout_redirect_uri:n,extraQueryParams:i,request_type:s}){if(this._logger=new RI("SignoutRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");const o=new URL(e);r&&o.searchParams.append("id_token_hint",r),n&&(o.searchParams.append("post_logout_redirect_uri",n),t&&(this.state=new KI({data:t,request_type:s}),o.searchParams.append("state",this.state.id)));for(const[e,t]of Object.entries({...i}))null!=t&&o.searchParams.append(e,t.toString());this.url=o.href}}({url:o,id_token_hint:t,post_logout_redirect_uri:n,state_data:e,extraQueryParams:i,request_type:r});await this.clearStaleState();const u=a.state;return u&&(s.debug("Signout request has state to persist"),await this.settings.stateStore.set(u.id,u.toStorageString())),a}async readSignoutResponseState(e,t=!1){const r=this._logger.create("readSignoutResponseState"),n=new class{constructor(e){this.state=e.get("state"),this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri")}}(CI.readParams(e,this.settings.response_mode));if(!n.state){if(r.debug("No state in response"),n.error)throw r.warn("Response was error:",n.error),new BI(n);return{state:void 0,response:n}}const i=await this.settings.stateStore[t?"remove":"get"](n.state);if(!i)throw r.throw(new Error("No matching state found in storage")),null;return{state:KI.fromStorageString(i),response:n}}async processSignoutResponse(e){const t=this._logger.create("processSignoutResponse"),{state:r,response:n}=await this.readSignoutResponseState(e,!0);return r?(t.debug("Received state from storage; validating response"),this._validator.validateSignoutResponse(n,r)):t.debug("No state from storage; skipping response validation"),n}clearStaleState(){return this._logger.create("clearStaleState"),KI.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}async revokeToken(e,t){return this._logger.create("revokeToken"),await this._tokenClient.revoke({token:e,token_type_hint:t})}}(e),this._redirectNavigator=new class{constructor(e){this._settings=e,this._logger=new RI("RedirectNavigator")}async prepare({redirectMethod:e=this._settings.redirectMethod,redirectTarget:t=this._settings.redirectTarget}){var r;this._logger.create("prepare");let n=window.self;"top"===t&&(n=null!=(r=window.top)?r:window.self);const i=n.location[e].bind(n.location);let s;return{navigate:async e=>{this._logger.create("navigate");const t=new Promise(((e,t)=>{s=t}));return i(e.url),await t},close:()=>{this._logger.create("close"),null==s||s(new Error("Redirect aborted")),n.stop()}}}}(this.settings),this._popupNavigator=new class{constructor(e){this._settings=e,this._logger=new RI("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget}){return new iM({popupWindowFeatures:e,popupWindowTarget:t})}async callback(e,t=!1){this._logger.create("callback"),iM.notifyOpener(e,t)}}(this.settings),this._iframeNavigator=new class{constructor(e){this._settings=e,this._logger=new RI("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new nM({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),nM.notifyParent(e,this._settings.iframeNotifyParentOrigin)}}(this.settings),this._events=new sM(this.settings),this._silentRenewService=new class{constructor(e){this._userManager=e,this._logger=new RI("SilentRenewService"),this._isStarted=!1,this._retryTimer=new NI("Retry Silent Renew"),this._tokenExpiring=async()=>{const e=this._logger.create("_tokenExpiring");try{await this._userManager.signinSilent(),e.debug("silent token renewal successful")}catch(t){if(t instanceof UI)return e.warn("ErrorTimeout from signinSilent:",t,"retry in 5s"),void this._retryTimer.init(5);e.error("Error from signinSilent:",t),this._userManager.events._raiseSilentRenewError(t)}}}async start(){const e=this._logger.create("start");if(!this._isStarted){this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring);try{await this._userManager.getUser()}catch(t){e.error("getUser error",t)}}}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}}(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new class{constructor(e){this._userManager=e,this._logger=new RI("SessionMonitor"),this._start=async e=>{const t=e.session_state;if(!t)return;const r=this._logger.create("_start");if(e.profile?(this._sub=e.profile.sub,this._sid=e.profile.sid,r.debug("session_state",t,", sub",this._sub)):(this._sub=void 0,this._sid=void 0,r.debug("session_state",t,", anonymous user")),this._checkSessionIFrame)this._checkSessionIFrame.start(t);else try{const e=await this._userManager.metadataService.getCheckSessionIframe();if(e){r.debug("initializing check session iframe");const n=this._userManager.settings.client_id,i=this._userManager.settings.checkSessionIntervalInSeconds,s=this._userManager.settings.stopCheckSessionOnError,o=new class{constructor(e,t,r,n,i){this._callback=e,this._client_id=t,this._intervalInSeconds=n,this._stopOnError=i,this._logger=new RI("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=e=>{e.origin===this._frame_origin&&e.source===this._frame.contentWindow&&("error"===e.data?(this._logger.error("error message from check session op iframe"),this._stopOnError&&this.stop()):"changed"===e.data?(this._logger.debug("changed message from check session op iframe"),this.stop(),this._callback()):this._logger.debug(e.data+" message from check session op iframe"))};const s=new URL(r);this._frame_origin=s.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=s.href}load(){return new Promise((e=>{this._frame.onload=()=>{e()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)}))}start(e){if(this._session_state===e)return;this._logger.create("start"),this.stop(),this._session_state=e;const t=()=>{this._frame.contentWindow&&this._session_state&&this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};t(),this._timer=setInterval(t,1e3*this._intervalInSeconds)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}}(this._callback,n,e,i,s);await o.load(),this._checkSessionIFrame=o,o.start(t)}else r.warn("no check session iframe found in the metadata")}catch(e){r.error("Error from getCheckSessionIframe:",e instanceof Error?e.message:e)}},this._stop=()=>{const e=this._logger.create("_stop");if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){const t=setInterval((async()=>{clearInterval(t);try{const e=await this._userManager.querySessionStatus();if(e){const t={session_state:e.session_state,profile:e.sub&&e.sid?{sub:e.sub,sid:e.sid}:null};this._start(t)}}catch(t){e.error("error from querySessionStatus",t instanceof Error?t.message:t)}}),1e3)}},this._callback=async()=>{const e=this._logger.create("_callback");try{const t=await this._userManager.querySessionStatus();let r=!0;t&&this._checkSessionIFrame?t.sub===this._sub?(r=!1,this._checkSessionIFrame.start(t.session_state),t.sid===this._sid?e.debug("same sub still logged in at OP, restarting check session iframe; session_state",t.session_state):(e.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",t.session_state),this._userManager.events._raiseUserSessionChanged())):e.debug("different subject signed into OP",t.sub):e.debug("subject no longer signed into OP"),r?this._sub?this._userManager.events._raiseUserSignedOut():this._userManager.events._raiseUserSignedIn():e.debug("no change in session detected, no event to raise")}catch(t){this._sub&&(e.debug("Error calling queryCurrentSigninSession; raising signed out event",t),this._userManager.events._raiseUserSignedOut())}},e||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch((e=>{this._logger.error(e)}))}async _init(){this._logger.create("_init");const e=await this._userManager.getUser();if(e)this._start(e);else if(this._userManager.settings.monitorAnonymousSession){const e=await this._userManager.querySessionStatus();if(e){const t={session_state:e.session_state,profile:e.sub&&e.sid?{sub:e.sub,sid:e.sid}:null};this._start(t)}}}}(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}async getUser(){const e=this._logger.create("getUser"),t=await this._loadUser();return t?(e.info("user loaded"),this._events.load(t,!1),t):(e.info("user not found in storage"),null)}async removeUser(){const e=this._logger.create("removeUser");await this.storeUser(null),e.info("user removed from storage"),this._events.unload()}async signinRedirect(e={}){this._logger.create("signinRedirect");const{redirectMethod:t,...r}=e,n=await this._redirectNavigator.prepare({redirectMethod:t});await this._signinStart({request_type:"si:r",...r},n)}async signinRedirectCallback(e=window.location.href){const t=this._logger.create("signinRedirectCallback"),r=await this._signinEnd(e);return r.profile&&r.profile.sub?t.info("success, signed in subject",r.profile.sub):t.info("no subject"),r}async signinResourceOwnerCredentials({username:e,password:t,skipUserInfo:r=!1}){const n=this._logger.create("signinResourceOwnerCredential"),i=await this._client.processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:r,extraTokenParams:this.settings.extraTokenParams});n.debug("got signin response");const s=await this._buildUser(i);return s.profile&&s.profile.sub?n.info("success, signed in subject",s.profile.sub):n.info("no subject"),s}async signinPopup(e={}){const t=this._logger.create("signinPopup"),{popupWindowFeatures:r,popupWindowTarget:n,...i}=e,s=this.settings.popup_redirect_uri;s||t.throw(new Error("No popup_redirect_uri configured"));const o=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:n}),a=await this._signin({request_type:"si:p",redirect_uri:s,display:"popup",...i},o);return a&&(a.profile&&a.profile.sub?t.info("success, signed in subject",a.profile.sub):t.info("no subject")),a}async signinPopupCallback(e=window.location.href,t=!1){const r=this._logger.create("signinPopupCallback");await this._popupNavigator.callback(e,t),r.info("success")}async signinSilent(e={}){var t;const r=this._logger.create("signinSilent"),{silentRequestTimeoutInSeconds:n,...i}=e;let s=await this._loadUser();if(null==s?void 0:s.refresh_token){r.debug("using refresh token");const e=new class{constructor(e){this.refresh_token=e.refresh_token,this.id_token=e.id_token,this.session_state=e.session_state,this.scope=e.scope,this.profile=e.profile,this.data=e.state}}(s);return await this._useRefreshToken(e)}const o=this.settings.silent_redirect_uri;let a;o||r.throw(new Error("No silent_redirect_uri configured")),s&&this.settings.validateSubOnSilentRenew&&(r.debug("subject prior to silent renew:",s.profile.sub),a=s.profile.sub);const u=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n});return s=await this._signin({request_type:"si:s",redirect_uri:o,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==s?void 0:s.id_token:void 0,...i},u,a),s&&((null==(t=s.profile)?void 0:t.sub)?r.info("success, signed in subject",s.profile.sub):r.info("no subject")),s}async _useRefreshToken(e){const t=await this._client.useRefreshToken({state:e,timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds}),r=new XI({...e,...t});return await this.storeUser(r),this._events.load(r),r}async signinSilentCallback(e=window.location.href){const t=this._logger.create("signinSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async signinCallback(e=window.location.href){const{state:t}=await this._client.readSigninResponseState(e);switch(t.request_type){case"si:r":return await this.signinRedirectCallback(e);case"si:p":return await this.signinPopupCallback(e);case"si:s":return await this.signinSilentCallback(e);default:throw new Error("invalid response_type in state")}}async signoutCallback(e=window.location.href,t=!1){const{state:r}=await this._client.readSignoutResponseState(e);if(r)switch(r.request_type){case"so:r":await this.signoutRedirectCallback(e);break;case"so:p":await this.signoutPopupCallback(e,t);break;case"so:s":await this.signoutSilentCallback(e);break;default:throw new Error("invalid response_type in state")}}async querySessionStatus(e={}){const t=this._logger.create("querySessionStatus"),{silentRequestTimeoutInSeconds:r,...n}=e,i=this.settings.silent_redirect_uri;i||t.throw(new Error("No silent_redirect_uri configured"));const s=await this._loadUser(),o=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:r}),a=await this._signinStart({request_type:"si:s",redirect_uri:i,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==s?void 0:s.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0,...n},o);try{const e=await this._client.processSigninResponse(a.url);return t.debug("got signin response"),e.session_state&&e.profile.sub?(t.info("success for subject",e.profile.sub),{session_state:e.session_state,sub:e.profile.sub,sid:e.profile.sid}):(t.info("success, user not authenticated"),null)}catch(e){if(this.settings.monitorAnonymousSession&&e instanceof BI)switch(e.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return t.info("success for anonymous user"),{session_state:e.session_state}}throw e}}async _signin(e,t,r){const n=await this._signinStart(e,t);return await this._signinEnd(n.url,r)}async _signinStart(e,t){const r=this._logger.create("_signinStart");try{const n=await this._client.createSigninRequest(e);return r.debug("got signin request"),await t.navigate({url:n.url,state:n.state.id,response_mode:n.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin})}catch(e){throw r.debug("error after preparing navigator, closing navigator window"),t.close(),e}}async _signinEnd(e,t){const r=this._logger.create("_signinEnd"),n=await this._client.processSigninResponse(e);return r.debug("got signin response"),await this._buildUser(n,t)}async _buildUser(e,t){const r=this._logger.create("_buildUser"),n=new XI(e);if(t){if(t!==n.profile.sub)throw r.debug("current user does not match user returned from signin. sub from signin:",n.profile.sub),new BI({...e,error:"login_required"});r.debug("current user matches user returned from signin")}return await this.storeUser(n),r.debug("user stored"),this._events.load(n),n}async signoutRedirect(e={}){const t=this._logger.create("signoutRedirect"),{redirectMethod:r,...n}=e,i=await this._redirectNavigator.prepare({redirectMethod:r});await this._signoutStart({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri,...n},i),t.info("success")}async signoutRedirectCallback(e=window.location.href){const t=this._logger.create("signoutRedirectCallback"),r=await this._signoutEnd(e);return t.info("success"),r}async signoutPopup(e={}){const t=this._logger.create("signoutPopup"),{popupWindowFeatures:r,popupWindowTarget:n,...i}=e,s=this.settings.popup_post_logout_redirect_uri,o=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:n});await this._signout({request_type:"so:p",post_logout_redirect_uri:s,state:null==s?void 0:{},...i},o),t.info("success")}async signoutPopupCallback(e=window.location.href,t=!1){const r=this._logger.create("signoutPopupCallback");await this._popupNavigator.callback(e,t),r.info("success")}async _signout(e,t){const r=await this._signoutStart(e,t);return await this._signoutEnd(r.url)}async _signoutStart(e={},t){var r;const n=this._logger.create("_signoutStart");try{const i=await this._loadUser();n.debug("loaded current user from storage"),this.settings.revokeTokensOnSignout&&await this._revokeInternal(i);const s=e.id_token_hint||i&&i.id_token;s&&(n.debug("setting id_token_hint in signout request"),e.id_token_hint=s),await this.removeUser(),n.debug("user removed, creating signout request");const o=await this._client.createSignoutRequest(e);return n.debug("got signout request"),await t.navigate({url:o.url,state:null==(r=o.state)?void 0:r.id})}catch(e){throw n.debug("error after preparing navigator, closing navigator window"),t.close(),e}}async _signoutEnd(e){const t=this._logger.create("_signoutEnd"),r=await this._client.processSignoutResponse(e);return t.debug("got signout response"),r}async signoutSilent(e={}){var t;const r=this._logger.create("signoutSilent"),{silentRequestTimeoutInSeconds:n,...i}=e,s=this.settings.includeIdTokenInSilentSignout?null==(t=await this._loadUser())?void 0:t.id_token:void 0,o=this.settings.popup_post_logout_redirect_uri,a=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n});await this._signout({request_type:"so:s",post_logout_redirect_uri:o,id_token_hint:s,...i},a),r.info("success")}async signoutSilentCallback(e=window.location.href){const t=this._logger.create("signoutSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async revokeTokens(e){const t=await this._loadUser();await this._revokeInternal(t,e)}async _revokeInternal(e,t=this.settings.revokeTokenTypes){const r=this._logger.create("_revokeInternal");if(!e)return;const n=t.filter((t=>"string"==typeof e[t]));if(n.length){for(const t of n)await this._client.revokeToken(e[t],t),r.info(`${t} revoked successfully`),"access_token"!==t&&(e[t]=null);await this.storeUser(e),r.debug("user stored"),this._events.load(e)}else r.debug("no need to revoke due to no token(s)")}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}async _loadUser(){const e=this._logger.create("_loadUser"),t=await this.settings.userStore.get(this._userStoreKey);return t?(e.debug("user storageString loaded"),XI.fromStorageString(t)):(e.debug("no user storageString"),null)}async storeUser(e){const t=this._logger.create("storeUser");if(e){t.debug("storing user");const r=e.toStorageString();await this.settings.userStore.set(this._userStoreKey,r)}else this._logger.debug("removing user"),await this.settings.userStore.remove(this._userStoreKey)}async clearStaleState(){await this._client.clearStaleState()}}((({oidcConfiguration:e,authenticationDomain:t})=>{const r={authority:t,redirect_uri:e.redirectUri,popup_redirect_uri:e.redirectUri,client_id:e.clientId,metadata:{authorization_endpoint:`${t}/authorize`,token_endpoint:`${t}/oauth/token`,userinfo_endpoint:`${t}/userinfo`,end_session_endpoint:`${t}/v2/logout?returnTo=${encodeURIComponent(e.logoutRedirectUri)}&client_id=${e.clientId}`},mergeClaims:!0,loadUserInfo:!0,scope:e.scope};return e.audience&&(r.extraQueryParams={audience:e.audience}),r})(e)),this.deviceCredentialsManager=new fj,this.logoutMode=e.oidcConfiguration.logoutMode||"redirect"}static mapOidcUserToDomainModel=e=>{const t=e.profile?.passport,r={expired:e.expired,idToken:e.id_token,accessToken:e.access_token,refreshToken:e.refresh_token,profile:{sub:e.profile.sub,email:e.profile.email,nickname:e.profile.nickname}};return t?.imx_eth_address&&(r.imx={ethAddress:t?.imx_eth_address,starkAddress:t?.imx_stark_address,userAdminAddress:t?.imx_user_admin_address}),t?.zkevm_eth_address&&(r.zkEvm={ethAddress:t?.zkevm_eth_address,userAdminAddress:t?.zkevm_user_admin_address}),r};static mapDeviceTokenResponseToDomainUserModel=e=>{const t=EI(e.id_token),r={idToken:e.id_token,accessToken:e.access_token,refreshToken:e.refresh_token,profile:{sub:t.sub,email:t.email,nickname:t.nickname}};return t?.passport?.imx_eth_address&&(r.imx={ethAddress:t?.passport?.imx_eth_address,starkAddress:t?.passport?.imx_stark_address,userAdminAddress:t?.passport?.imx_user_admin_address}),r};async login(){return uj((async()=>{const e=await this.userManager.signinPopup({popupWindowFeatures:{width:410,height:450}});return hj.mapOidcUserToDomainModel(e)}),oj.AUTHENTICATION_ERROR)}async loginCallback(){return uj((async()=>this.userManager.signinPopupCallback()),oj.AUTHENTICATION_ERROR)}async loginWithDeviceFlow(){return uj((async()=>{const e=await LP.post(`${this.config.authenticationDomain}/oauth/device/code`,{client_id:this.config.oidcConfiguration.clientId,scope:this.config.oidcConfiguration.scope,audience:this.config.oidcConfiguration.audience},lj);return{code:e.data.user_code,deviceCode:e.data.device_code,url:e.data.verification_uri_complete,interval:e.data.interval}}),oj.AUTHENTICATION_ERROR)}async connectImxDeviceFlow(e,t,r){return uj((async()=>{const n=Date.now();for(;;){if(null!=r&&Date.now()-n>r)throw new Error("Timed out");await dj(1e3*t);try{const t=await this.getDeviceFlowToken(e),r=hj.mapDeviceTokenResponseToDomainUserModel(t);return r.imx?.ethAddress&&r.imx?.starkAddress&&r.imx?.userAdminAddress&&this.deviceCredentialsManager.saveCredentials(t),r}catch(e){if(!LP.isAxiosError(e))throw e;{const t=e.response?.data;switch(t.error){case"authorization_pending":case"slow_down":break;case"expired_token":throw new Error("Token expired, please log in again");case"access_denied":throw new Error("User denied access");default:throw new Error("Error getting token")}}}}throw new Error("Failed to get credentials")}),oj.AUTHENTICATION_ERROR)}async getDeviceFlowToken(e){return(await LP.post(`${this.config.authenticationDomain}/oauth/token`,{client_id:this.config.oidcConfiguration.clientId,grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:e},lj)).data}async connectImxWithCredentials(e){return uj((async()=>{if(this.deviceCredentialsManager.areValid(e))return hj.mapDeviceTokenResponseToDomainUserModel(e);const t=e?.refresh_token??null;if(t){const e=await this.refreshToken(t);return hj.mapDeviceTokenResponseToDomainUserModel(e)}return null}),oj.AUTHENTICATION_ERROR)}async refreshToken(e){return(await LP.post(`${this.config.authenticationDomain}/oauth/token`,{client_id:this.config.oidcConfiguration.clientId,grant_type:"refresh_token",refresh_token:e},lj)).data}async logout(){return uj((async()=>"silent"===this.logoutMode?this.userManager.signoutSilent():this.userManager.signoutRedirect()),oj.LOGOUT_ERROR)}async logoutSilentCallback(e){return this.userManager.signoutSilentCallback(e)}async logoutDeviceFlow(){return uj((async()=>{this.deviceCredentialsManager.clearCredentials()}),oj.LOGOUT_ERROR)}async loginSilent(){return uj((async()=>{if(!await this.getUser())return null;const e=await this.userManager.signinSilent();return e?hj.mapOidcUserToDomainModel(e):null}),oj.SILENT_LOGIN_ERROR)}async getUser(){return uj((async()=>{const e=await this.userManager.getUser();if(e)return hj.mapOidcUserToDomainModel(e);const t=this.deviceCredentialsManager.getCredentials();return t?hj.mapDeviceTokenResponseToDomainUserModel(t):null}),oj.NOT_LOGGED_IN_ERROR)}async getUserDeviceFlow(){return uj((async()=>{const e=this.deviceCredentialsManager.getCredentials();return e?hj.mapDeviceTokenResponseToDomainUserModel(e):null}),oj.NOT_LOGGED_IN_ERROR)}checkStoredDeviceFlowCredentials(){return this.deviceCredentialsManager.getCredentials()}}class pj{config;constructor(e){this.config=e}async login(e,t){return uj((async()=>{const r=new DB(this.config.magicPublishableApiKey,{extensions:[new qB],network:t});return await r.openid.loginWithOIDC({jwt:e,providerId:this.config.magicProviderId}),r.rpcProvider}),oj.WALLET_CONNECTION_ERROR)}}const gj=1e3,mj=3,yj=async(e,t)=>{const{retries:r=mj,interval:n=gj,finalErr:i=Error("Retry failed"),finallyFn:s=(()=>{})}=t||{};try{return await e()}catch(t){return r<=0?Promise.reject(i):(await(o=n,new Promise((e=>{setTimeout((()=>e()),o)}))),yj(e,{retries:r-1,finalErr:i,finallyFn:s}))}finally{r<=0&&s()}var o};class bj{transactionAPI;confirmationScreen;imxEtherAddress;constructor({imxPublicApiDomain:e,accessToken:t,confirmationScreen:r,imxEtherAddress:n}){this.confirmationScreen=r,this.transactionAPI=new NL(new CL({accessToken:t,basePath:e})),this.imxEtherAddress=n}loading(e){this.confirmationScreen.loading(e)}async validate({payloadHash:e}){if(!(await yj((async()=>this.transactionAPI.getTransactionByID({transactionID:e,chainType:"starkex"})),{finallyFn:()=>{this.confirmationScreen.closeWindow()}})).data.id)throw new Error("Transaction doesn't exists");const t=await this.transactionAPI.evaluateTransaction({id:e,transactionEvaluationRequest:{chainType:"starkex"}}),{confirmationRequired:r}=t.data;if(r){if(!(await this.confirmationScreen.startGuardianTransaction(e,this.imxEtherAddress)).confirmed)throw new Error("Transaction rejected by user")}else this.confirmationScreen.closeWindow()}}const vj="ERC721";const wj="ERC721";class _j{user;starkSigner;immutableXClient;confirmationScreen;guardianClient;constructor({user:e,starkSigner:t,immutableXClient:r,imxPublicApiDomain:n,confirmationScreen:i}){this.user=e,this.starkSigner=t,this.immutableXClient=r,this.confirmationScreen=i,this.guardianClient=new bj({imxPublicApiDomain:n,accessToken:e.accessToken,confirmationScreen:i,imxEtherAddress:e.imx.ethAddress})}async transfer(e){return async function({request:e,transfersApi:t,starkSigner:r,user:n,guardianClient:i}){return uj((async()=>{i.loading();const s=e.type===wj?"1":e.amount,o={sender:n.imx.ethAddress,token:LL(e),amount:s,receiver:e.receiver},a={Authorization:`Bearer ${n.accessToken}`},u=await t.getSignableTransferV1({getSignableTransferRequest:o},{headers:a});await i.validate({payloadHash:u.data.payload_hash});const c=u.data,{payload_hash:f}=c,l=await r.signMessage(f),d=await r.getAddress(),h={createTransferRequest:{sender_stark_key:c.sender_stark_key||d,sender_vault_id:c.sender_vault_id,receiver_stark_key:c.receiver_stark_key,receiver_vault_id:c.receiver_vault_id,asset_id:c.asset_id,amount:c.amount,nonce:c.nonce,expiration_timestamp:c.expiration_timestamp,stark_signature:l}},{data:p}=await t.createTransferV1(h,{headers:a});return{sent_signature:p.sent_signature,status:p.status?.toString(),time:p.time,transfer_id:p.transfer_id}}),oj.TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,transfersApi:this.immutableXClient.transfersApi,guardianClient:this.guardianClient})}registerOffchain(){throw new aj("Operation not supported",oj.OPERATION_NOT_SUPPORTED_ERROR)}isRegisteredOnchain(){throw new aj("Operation not supported",oj.OPERATION_NOT_SUPPORTED_ERROR)}createOrder(e){return async function({starkSigner:e,user:t,request:r,ordersApi:n,guardianClient:i}){return uj((async()=>{i.loading();const{ethAddress:s}=t.imx,o=r.sell.type===vj?"1":r.sell.amount,a=r.buy.type===vj?"1":r.buy.amount,u={Authorization:`Bearer ${t.accessToken}`},c={user:s,amount_buy:a,token_buy:LL(r.buy),amount_sell:o,token_sell:LL(r.sell),fees:r.fees,expiration_timestamp:r.expiration_timestamp},f=await n.getSignableOrder({getSignableOrderRequestV3:c},{headers:u});await i.validate({payloadHash:f.data.payload_hash});const{payload_hash:l}=f.data,d=await e.signMessage(l),h=f.data,p={createOrderRequest:{include_fees:!0,fees:r.fees,stark_signature:d,amount_buy:h.amount_buy,amount_sell:h.amount_sell,asset_id_buy:h.asset_id_buy,asset_id_sell:h.asset_id_sell,expiration_timestamp:h.expiration_timestamp,nonce:h.nonce,stark_key:h.stark_key,vault_id_buy:h.vault_id_buy,vault_id_sell:h.vault_id_sell}};return{...(await n.createOrderV3(p,{headers:u})).data}}),oj.CREATE_ORDER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,ordersApi:this.immutableXClient.ordersApi,guardianClient:this.guardianClient})}cancelOrder(e){return async function({user:e,starkSigner:t,request:r,ordersApi:n,guardianClient:i}){return uj((async()=>{i.loading();const s={order_id:r.order_id},o={Authorization:`Bearer ${e.accessToken}`},a=await n.getSignableCancelOrderV3({getSignableCancelOrderRequest:s},{headers:o});await i.validate({payloadHash:a.data.payload_hash});const{payload_hash:u}=a.data,c=await t.signMessage(u),f=await n.cancelOrderV3({id:r.order_id.toString(),cancelOrderRequest:{order_id:r.order_id,stark_signature:c}},{headers:o});return{order_id:f.data.order_id,status:f.data.status}}),oj.CANCEL_ORDER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,ordersApi:this.immutableXClient.ordersApi,guardianClient:this.guardianClient})}createTrade(e){return async function({request:e,tradesApi:t,user:r,starkSigner:n,guardianClient:i}){return uj((async()=>{i.loading();const{ethAddress:s}=r.imx,o={expiration_timestamp:e.expiration_timestamp,fees:e.fees,order_id:e.order_id,user:s},a={Authorization:`Bearer ${r.accessToken}`},u=await t.getSignableTrade({getSignableTradeRequest:o},{headers:a});await i.validate({payloadHash:u.data.payload_hash});const{payload_hash:c}=u.data,f=await n.signMessage(c),{data:l}=u,d={createTradeRequest:{include_fees:!0,fees:e?.fees,stark_signature:f,order_id:e?.order_id,fee_info:l.fee_info,amount_buy:l.amount_buy,amount_sell:l.amount_sell,asset_id_buy:l.asset_id_buy,asset_id_sell:l.asset_id_sell,expiration_timestamp:l.expiration_timestamp,nonce:l.nonce,stark_key:l.stark_key,vault_id_buy:l.vault_id_buy,vault_id_sell:l.vault_id_sell}},{data:h}=await t.createTradeV3(d,{headers:a});return h}),oj.CREATE_TRADE_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,tradesApi:this.immutableXClient.tradesApi,guardianClient:this.guardianClient})}batchNftTransfer(e){return async function({user:e,starkSigner:t,request:r,transfersApi:n,guardianClient:i}){return uj((async()=>{i.loading({width:480,height:784});const{ethAddress:s}=e.imx,o={sender_ether_key:s,signable_requests:r.map((e=>({amount:"1",token:LL({type:wj,tokenId:e.tokenId,tokenAddress:e.tokenAddress}),receiver:e.receiver})))},a={Authorization:`Bearer ${e.accessToken}`},u=await n.getSignableTransfer({getSignableTransferRequestV2:o},{headers:a});await i.validate({payloadHash:u.data.signable_responses[0]?.payload_hash});const c=await Promise.all(u.data.signable_responses.map((async e=>{const r=await t.signMessage(e.payload_hash);return{sender_vault_id:e.sender_vault_id,receiver_stark_key:e.receiver_stark_key,receiver_vault_id:e.receiver_vault_id,asset_id:e.asset_id,amount:e.amount,nonce:e.nonce,expiration_timestamp:e.expiration_timestamp,stark_signature:r}}))),f={sender_stark_key:u.data.sender_stark_key,requests:c},l=await n.createTransfer({createTransferRequestV2:f},{headers:a});return{transfer_ids:l?.data.transfer_ids}}),oj.TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,transfersApi:this.immutableXClient.transfersApi,guardianClient:this.guardianClient})}exchangeTransfer(e){return async function({user:e,starkSigner:t,request:r,exchangesApi:n}){return uj((async()=>{const{ethAddress:i}=e.imx,s=r.amount,o=await n.getExchangeSignableTransfer({id:r.transactionID,getSignableTransferRequest:{sender:i,token:LL(r),amount:s,receiver:r.receiver}}),a=await t.getAddress(),{payload_hash:u}=o.data,c=await t.signMessage(u),f={sender_stark_key:o.data.sender_stark_key||a,sender_vault_id:o.data.sender_vault_id,receiver_stark_key:o.data.receiver_stark_key,receiver_vault_id:o.data.receiver_vault_id,asset_id:o.data.asset_id,amount:o.data.amount,nonce:o.data.nonce,expiration_timestamp:o.data.expiration_timestamp,stark_signature:c},l={Authorization:`Bearer ${e.accessToken}`},d=await n.createExchangeTransfer({id:r.transactionID,createTransferRequest:f},{headers:l});return{sent_signature:d?.data.sent_signature,status:d?.data.status?.toString(),time:d?.data.time,transfer_id:d?.data.transfer_id}}),oj.EXCHANGE_TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,exchangesApi:this.immutableXClient.exchangeApi})}deposit(e){throw new aj("Operation not supported",oj.OPERATION_NOT_SUPPORTED_ERROR)}prepareWithdrawal(e){throw new aj("Operation not supported",oj.OPERATION_NOT_SUPPORTED_ERROR)}completeWithdrawal(e,t){throw new aj("Operation not supported",oj.OPERATION_NOT_SUPPORTED_ERROR)}getAddress(){return Promise.resolve(this.user.imx.ethAddress)}}class Ej{authManager;config;confirmationScreen;immutableXClient;magicAdapter;constructor({authManager:e,config:t,confirmationScreen:r,immutableXClient:n,magicAdapter:i}){this.authManager=e,this.config=t,this.confirmationScreen=r,this.immutableXClient=n,this.magicAdapter=i}async getProvider(){const e=await this.authManager.login();return this.createProviderInstance(e)}async getProviderSilent(){const e=await this.authManager.loginSilent();return e?this.createProviderInstance(e):null}async getProviderWithDeviceFlow(e,t,r){const n=await this.authManager.connectImxDeviceFlow(e,t,r);return this.createProviderInstance(n)}async getProviderWithCredentials(e){const t=await this.authManager.connectImxWithCredentials(e);return t?this.createProviderInstance(t):null}async createProviderInstance(e){if(!e.idToken)throw new aj("Failed to initialise",oj.WALLET_CONNECTION_ERROR);const t=await this.magicAdapter.login(e.idToken,this.config.network),r=new Lu(t).getSigner(),n=await(async e=>uj((async()=>WA(await KA(e))),oj.WALLET_CONNECTION_ERROR))(r);if(!e.imx?.ethAddress){const t=await this.registerStarkEx(r,n,e.accessToken);return new _j({user:t,starkSigner:n,immutableXClient:this.immutableXClient,imxPublicApiDomain:this.config.imxPublicApiDomain,confirmationScreen:this.confirmationScreen})}return new _j({user:e,starkSigner:n,immutableXClient:this.immutableXClient,imxPublicApiDomain:this.config.imxPublicApiDomain,confirmationScreen:this.confirmationScreen})}async registerStarkEx(e,t,r){return uj((async()=>{await async function({ethSigner:e,starkSigner:t,usersApi:r},n){return uj((async()=>{const i=await e.getAddress(),s=await t.getAddress(),o=await r.getSignableRegistrationOffchain({getSignableRegistrationRequest:{ether_key:i,stark_key:s}}),{signable_message:a,payload_hash:u}=o.data,c=await UL(a,e),f=await t.signMessage(u);return(await r.registerPassportUser({authorization:`Bearer ${n}`,registerPassportUserRequest:{eth_signature:c,ether_key:i,stark_signature:f,stark_key:s}})).statusText}),oj.USER_REGISTRATION_ERROR)}({ethSigner:e,starkSigner:t,usersApi:this.immutableXClient.usersApi},r);return await yj((async()=>{const e=await this.authManager.loginSilent();return!!e?.imx?e:Promise.reject(new Error("user wallet addresses not exist"))}))}),oj.REFRESH_TOKEN_ERROR)}}var Aj;e.Networks=void 0,(Aj=e.Networks||(e.Networks={})).PRODUCTION="mainnet",Aj.SANDBOX="goerli";const Sj=(e,t,r)=>{const n=t.map((t=>!e[t]&&t)).filter((e=>e)).join(", ");if(""!==n){throw new aj(r?`${r} - ${n} cannot be null`:`${n} cannot be null`,oj.INVALID_CONFIGURATION)}};class kj{network;authenticationDomain;passportDomain;imxPublicApiDomain;magicPublishableApiKey;magicProviderId;oidcConfiguration;baseConfig;zkEvmChainId;zkEvmRpcUrl;relayerUrl;multiRollupConfig;constructor({baseConfig:t,overrides:r,...n}){if(Sj(n,["clientId","logoutRedirectUri","redirectUri"]),this.oidcConfiguration=n,this.baseConfig=t,r)Sj(r,["network","authenticationDomain","passportDomain","magicPublishableApiKey","magicProviderId","zkEvmRpcUrl","zkEvmChainId","relayerUrl","imxPublicApiDomain","indexerMrBasePath","orderBookMrBasePath","passportMrBasePath"],"overrides"),this.network=r.network,this.authenticationDomain=r.authenticationDomain,this.passportDomain=r.passportDomain,this.imxPublicApiDomain=r.imxPublicApiDomain,this.magicPublishableApiKey=r.magicPublishableApiKey,this.magicProviderId=r.magicProviderId,this.zkEvmRpcUrl=r.zkEvmRpcUrl,this.zkEvmChainId=r.zkEvmChainId,this.relayerUrl=r.relayerUrl,this.multiRollupConfig={indexer:aI({basePath:r.indexerMrBasePath}),orderBook:aI({basePath:r.orderBookMrBasePath}),passport:aI({basePath:r.passportMrBasePath})};else switch(t.environment){case e.Environment.PRODUCTION:this.network=e.Networks.PRODUCTION,this.authenticationDomain="https://auth.immutable.com",this.magicPublishableApiKey="pk_live_10F423798A540ED7",this.magicProviderId="fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=",this.passportDomain="https://passport.immutable.com",this.imxPublicApiDomain="https://api.immutable.com",this.zkEvmRpcUrl="",this.zkEvmChainId="",this.relayerUrl="https://relayer.immutable.com",this.multiRollupConfig=uI();break;case e.Environment.SANDBOX:default:this.network=e.Networks.SANDBOX,this.authenticationDomain="https://auth.immutable.com",this.magicPublishableApiKey="pk_live_10F423798A540ED7",this.magicProviderId="fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=",this.passportDomain="https://passport.sandbox.immutable.com",this.imxPublicApiDomain="https://api.sandbox.immutable.com",this.zkEvmRpcUrl="https://zkevm-rpc.sandbox.x.immutable.com",this.zkEvmChainId="eip155:13392",this.relayerUrl="https://evm-relayer.sandbox.imtbl.com",this.multiRollupConfig=cI()}}}var xj,Tj,Rj;!function(e){e.CONFIRMATION_WINDOW_READY="confirmation_window_ready",e.TRANSACTION_CONFIRMED="transaction_confirmed",e.TRANSACTION_ERROR="transaction_error"}(xj||(xj={})),function(e){e.TRANSACTION_START="transaction_start"}(Tj||(Tj={})),function(e){e.cancelOrder="delete:v1/orders",e.createOrder="post:v1/orders",e.createTrade="post:v1/trades",e.createTransfer="post:v1/transfers",e.createBatchTransfer="post:v2/transfers"}(Rj||(Rj={}));const Oj="imx_passport_confirmation",Ij=({url:e,title:t,width:r,height:n})=>{const i=Math.max(0,Math.round(window.screenX+(window.outerWidth-r)/2)),s=Math.max(0,Math.round(window.screenY+(window.outerHeight-n)/2)),o=window.open(e,t,`\n scrollbars=yes,\n width=${r}, \n height=${n}, \n top=${s}, \n left=${i}\n `);if(!o)throw new Error("Failed to open confirmation screen");return o.focus(),o},Mj="Confirm this transaction";class Pj{config;confirmationWindow;constructor(e){this.config=e}postMessage(e,t,r){e.postMessage({eventType:Oj,accessToken:t,...r},this.config.passportDomain)}startTransaction(e,t,r){return new Promise(((n,i)=>{const s=({data:r,origin:s})=>{if(s===this.config.passportDomain&&r.eventType===Oj)switch(r.messageType){case xj.CONFIRMATION_WINDOW_READY:this.postMessage(o,e,{messageType:Tj.TRANSACTION_START,messageData:t});break;case xj.TRANSACTION_CONFIRMED:n({confirmed:!0});break;case xj.TRANSACTION_ERROR:i(new Error("Transaction error"));break;default:i(new Error("Unsupported message type"))}};window.addEventListener("message",s);const o=Ij({url:`${this.config.passportDomain}/transaction-confirmation`,title:Mj,width:r?.width||480,height:r?.height||380}),a=setInterval((()=>{o.closed&&(clearInterval(a),window.removeEventListener("message",s),n({confirmed:!1}))}),1e3)}))}startGuardianTransaction(e,t){return new Promise(((r,n)=>{const i=({data:e,origin:t})=>{if(t===this.config.passportDomain&&e.eventType===Oj)switch(e.messageType){case xj.CONFIRMATION_WINDOW_READY:break;case xj.TRANSACTION_CONFIRMED:r({confirmed:!0});break;case xj.TRANSACTION_ERROR:n(new Error("Transaction error"));break;default:n(new Error("Unsupported message type"))}};if(window.addEventListener("message",i),!this.confirmationWindow)return void r({confirmed:!1});this.confirmationWindow.location.href=`${this.config.passportDomain}/transaction-confirmation/transaction.html?transactionId=${e}&imxEtherAddress=${t}&chainType=starkex`;const s=setInterval((()=>{this.confirmationWindow?.closed&&(clearInterval(s),window.removeEventListener("message",i),r({confirmed:!1}))}),1e3)}))}loading(e){this.confirmationWindow=Ij({url:`${this.config.passportDomain}/transaction-confirmation/loading.html`,title:Mj,width:e?.width||480,height:e?.height||380})}closeWindow(){this.confirmationWindow?.close()}}const Nj=async(e,t,r,n,i)=>{const s=e.map((e=>({delegateCall:!0===e.delegateCall,revertOnError:!0===e.revertOnError,gasLimit:e.gasLimit??Ar,target:e.to??_r,value:e.value??Ar,data:e.data??[]})));const o=function(e,t){return Jt(Fr.encode(["uint256","tuple(\n bool delegateCall,\n bool revertOnError,\n uint256 gasLimit,\n address target,\n uint256 value,\n bytes data\n)[]"],[e,t]))}(t,s),a=ke(Jt(Hu(["string","uint256","address","bytes32"],["",r,n,o]))),u=await i.signMessage(a),c=sj({threshold:1,signers:[{weight:1,signature:`${u}02`}]}),f=new zn(jL.mainModule.abi);return f.encodeFunctionData(f.getFunction("execute"),[s,t,c])};var Cj,Bj;!function(e){e.PENDING="PENDING",e.SUBMITTED="SUBMITTED",e.SUCCESSFUL="SUCCESSFUL",e.REVERTED="REVERTED",e.FAILED="FAILED"}(Cj||(Cj={})),function(e){e[e.RPC_SERVER_ERROR=-32e3]="RPC_SERVER_ERROR",e[e.INVALID_REQUEST=-32600]="INVALID_REQUEST",e[e.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",e[e.INVALID_PARAMS=-32602]="INVALID_PARAMS",e[e.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",e[e.UNAUTHORIZED=-32604]="UNAUTHORIZED",e[e.PARSE_ERROR=-32700]="PARSE_ERROR"}(Bj||(Bj={}));class Uj extends Error{message;code;constructor(e,t){super(t),this.message=t,this.code=e}}const Lj=async({params:e,magicProvider:t,jsonRpcProvider:r,relayerClient:n,config:i,user:s})=>{const o=e[0];if(!o.to)throw new Uj(Bj.INVALID_PARAMS,'eth_sendTransaction requires a "to" field');const a=(e=>{const t=e.split(":");if(2!==t.length)throw new Error("Invalid configuration, chain ID is not in CAIP-2 format");return He.from(t[1])})(i.zkEvmChainId),u=new Lu(t).getSigner(),c=await(async(e,t)=>{const r=await e.send("eth_getCode",[t]);if(r&&"0x"!==r)return new ya(t,jL.mainModule.abi,e).nonce();return 0})(r,s.zkEvm.ethAddress),f={to:o.to,data:o.data,nonce:c,value:o.value,revertOnError:!0},l=await Nj([f],c,a,s.zkEvm.ethAddress,u),d=(await n.imGetFeeOptions(s.zkEvm.ethAddress,l)).find((e=>"IMX"===e.tokenSymbol));if(!d)throw new Error("Failed to retrieve fees for IMX token");const h={nonce:c,to:d.recipientAddress,value:d.tokenPrice,revertOnError:!0},p=await Nj([f,h],c,a,s.zkEvm.ethAddress,u),g=await n.ethSendTransaction(s.zkEvm.ethAddress,p),m=await yj((async()=>{const e=await n.imGetTransactionByHash(g);if(e.status===Cj.PENDING)throw new Error;return e}),{retries:30,interval:1e3,finalErr:new Uj(Bj.RPC_SERVER_ERROR,"transaction hash not generated in time")});if(![Cj.SUBMITTED,Cj.SUCCESSFUL].includes(m.status))throw new Uj(Bj.RPC_SERVER_ERROR,`Transaction failed to submit with status ${m.status}`);return m.hash};class jj{config;constructor({config:e}){this.config=e}async postToRelayer(e){const t={id:1,jsonrpc:"2.0",...e},r=await fetch(`${this.config.relayerUrl}/v1/transactions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await r.json();if(n.error)throw n.error;return n}async ethSendTransaction(e,t){const r={method:"eth_sendTransaction",params:[{to:e,data:t,chainId:this.config.zkEvmChainId.toString()}]},{result:n}=await this.postToRelayer(r);return n}async imGetTransactionByHash(e){const t={method:"im_getTransactionByHash",params:[e]},{result:r}=await this.postToRelayer(t);return r}async imGetFeeOptions(e,t){const r={method:"im_getFeeOptions",params:[{userAddress:e,data:t,chainId:this.config.zkEvmChainId.toString()}]},{result:n}=await this.postToRelayer(r);return n}}const Dj=async({authManager:e,config:t,magicAdapter:r,multiRollupApiClients:n})=>{const i=await e.getUser()||await e.login();if(!i.idToken)throw new Error("User is missing idToken");const s=await r.login(i.idToken,t.network);if(!i.zkEvm){const t=await async function({authManager:e,magicProvider:t,multiRollupApiClients:r,accessToken:n}){const i=new Lu(t).getSigner(),s=await i.getAddress(),o=await UL("Only sign this message from Immutable Passport",i),a={Authorization:`Bearer ${n}`};try{await r.passportApi.createCounterfactualAddress({createCounterfactualAddressRequest:{ethereumAddress:s,ethereumSignature:o}},{headers:a})}catch(e){throw new Uj(Bj.INTERNAL_ERROR,`Failed to create counterfactual address: ${e}`)}const u=await e.loginSilent();if(!u?.zkEvm)throw new Uj(Bj.INTERNAL_ERROR,"Failed to refresh user details");return u}({authManager:e,magicProvider:s,multiRollupApiClients:n,accessToken:i.accessToken});return{user:t,magicProvider:s}}return{user:i,magicProvider:s}};class Fj{authManager;config;confirmationScreen;magicAdapter;relayerClient;multiRollupApiClients;jsonRpcProvider;magicProvider;user;constructor({authManager:e,magicAdapter:t,config:r,confirmationScreen:n,multiRollupApiClients:i}){this.authManager=e,this.magicAdapter=t,this.config=r,this.confirmationScreen=n,this.relayerClient=new jj({config:r}),this.jsonRpcProvider=new Nu(this.config.zkEvmRpcUrl),this.multiRollupApiClients=i}isLoggedIn(){return void 0!==this.magicProvider&&void 0!==this.user}async performRequest(e){const t=t=>{if(!this.isLoggedIn())throw new Uj(Bj.UNAUTHORIZED,"Unauthorised - call eth_requestAccounts first");return t({params:e.params||[],magicProvider:this.magicProvider,jsonRpcProvider:this.jsonRpcProvider,config:this.config,relayerClient:this.relayerClient,user:this.user})};switch(e.method){case"eth_requestAccounts":{if(this.isLoggedIn())return[this.user.zkEvm.ethAddress];const{magicProvider:e,user:t}=await Dj({authManager:this.authManager,config:this.config,magicAdapter:this.magicAdapter,multiRollupApiClients:this.multiRollupApiClients});return this.user=t,this.magicProvider=e,[this.user.zkEvm.ethAddress]}case"eth_sendTransaction":return t(Lj);case"eth_accounts":return this.isLoggedIn()?[this.user.zkEvm.ethAddress]:[];case"eth_gasPrice":case"eth_getBalance":case"eth_getStorageAt":case"eth_estimateGas":case"eth_call":case"eth_blockNumber":case"eth_chainId":case"eth_getBlockByHash":case"eth_getBlockByNumber":case"eth_getTransactionByHash":case"eth_getTransactionReceipt":case"eth_getTransactionCount":return this.jsonRpcProvider.send(e.method,e.params||[]);default:throw new Uj(Bj.METHOD_NOT_FOUND,"Method not supported")}}async performJsonRpcRequest(e){const{id:t,jsonrpc:r}=e;try{return{id:t,jsonrpc:r,result:await this.performRequest(e)}}catch(e){let n;return n=e instanceof Uj?e:e instanceof Error?new Uj(Bj.INTERNAL_ERROR,e.message):new Uj(Bj.INTERNAL_ERROR,"Internal error"),{id:t,jsonrpc:r,error:n}}}async request(e){try{return this.performRequest(e)}catch(e){if(e instanceof Uj)throw e;if(e instanceof Error)throw new Uj(Bj.INTERNAL_ERROR,e.message);throw new Uj(Bj.INTERNAL_ERROR,"Internal error")}}sendAsync(e,t){if(!t)throw new Error("No callback provided");Array.isArray(e)?Promise.all(e.map(this.performJsonRpcRequest)).then((e=>{t(null,e)})).catch((e=>{t(e,[])})):this.performJsonRpcRequest(e).then((e=>{t(null,e)})).catch((e=>{t(e,null)}))}async send(e,t,r){if("string"==typeof e)return"function"==typeof t?this.sendAsync({method:e,params:[]},t):r?this.sendAsync({method:e,params:Array.isArray(t)?t:[]},r):this.request({method:e,params:Array.isArray(t)?t:[]});if("function"==typeof t)return this.sendAsync(e,t);if(!Array.isArray(e)&&"object"==typeof e)return this.performJsonRpcRequest(e);throw new Uj(Bj.INVALID_REQUEST,"Invalid request")}}var qj=n((function({mustBeMetaMask:e=!1,silent:t=!1,timeout:r=3e3}={}){!function(){if("boolean"!=typeof e)throw new Error("@metamask/detect-provider: Expected option 'mustBeMetaMask' to be a boolean.");if("boolean"!=typeof t)throw new Error("@metamask/detect-provider: Expected option 'silent' to be a boolean.");if("number"!=typeof r)throw new Error("@metamask/detect-provider: Expected option 'timeout' to be a number.")}();let n=!1;return new Promise((i=>{function s(){if(n)return;n=!0,window.removeEventListener("ethereum#initialized",s);const{ethereum:r}=window;if(!r||e&&!r.isMetaMask){const n=e&&r?"Non-MetaMask window.ethereum detected.":"Unable to detect window.ethereum.";!t&&console.error("@metamask/detect-provider:",n),i(null)}else i(r)}window.ethereum?s():(window.addEventListener("ethereum#initialized",s,{once:!0}),setTimeout((()=>{s()}),r))}))}));async function zj(e,t){if(!function(e,t){return e===t.ethConfiguration.chainID}(await e.getChainId(),t))throw new Error("The wallet used for this operation is not connected to the correct network.")}async function Kj(e,t,r){await zj(t,r.immutableXConfig);const n=vA.Registration.connect(r.immutableXConfig.ethConfiguration.registrationContractAddress,t);try{return await n.isRegistered(e)}catch(e){if("USER_UNREGISTERED"===e.reason)return!1;throw e}}async function Hj(e,t,r){const n=await r.getSignableRegistration({getSignableRegistrationRequest:{ether_key:e,stark_key:t}});return{operator_signature:n.data.operator_signature,payload_hash:n.data.payload_hash}}const Gj=e=>{if(void 0!==e)return e;throw new Error("undefined field exception")};async function Wj(e){const{signers:{ethSigner:t,starkSigner:r},type:n,config:i}=e;await zj(t,e.config);const s=new wk(i.apiConfiguration),o="ERC721"===n?"1":e.amount,a=await s.getSignableWithdrawal({getSignableWithdrawalRequest:{user:await t.getAddress(),token:LL(e),amount:o}}),{signable_message:u,payload_hash:c}=a.data,f=await r.signMessage(c),{ethAddress:l,ethSignature:d}=await async function(e,t){return{message:e,ethAddress:await t.getAddress(),ethSignature:await UL(e,t)}}(u,t);return(await s.createWithdrawal({createWithdrawalRequest:{stark_key:Gj(a.data.stark_key),amount:o,asset_id:Gj(a.data.asset_id),vault_id:Gj(a.data.vault_id),nonce:Gj(a.data.nonce),stark_signature:f},xImxEthAddress:l,xImxEthSignature:d})).data}async function Vj(e,t,r,n){const i=new xS(r.apiConfiguration);return(await i.encodeAsset({assetType:e,encodeAssetRequest:{token:{type:t,...n&&{data:n}}}})).data}async function Xj({ethSigner:e,starkPublicKey:t,token:r,config:n}){await zj(e,n.immutableXConfig);const i=n.immutableXConfig,s=await Vj("asset","ERC20",i,{token_address:r.tokenAddress});return await Kj(t,e,n)?async function(e,t,r,n){const i=vA.Core.connect(n.ethConfiguration.coreContractAddress,e),s=await i.populateTransaction.withdraw(r,t);return e.sendTransaction(s)}(e,s.asset_type,t,i):async function({ethSigner:e,assetType:t,starkPublicKey:r,config:n}){const i=await e.getAddress(),s=n.immutableXConfig,o=new mk(s.apiConfiguration),a=await Hj(i,r,o),u=vA.Registration.connect(n.immutableXConfig.ethConfiguration.registrationContractAddress,e),c=await u.populateTransaction.registerAndWithdraw(i,r,a.operator_signature,t);return e.sendTransaction(c)}({ethSigner:e,assetType:s.asset_type,starkPublicKey:t,config:n})}async function Jj(e,t,r,n){const i=n.immutableXConfig,s=await Vj("mintable-asset","ERC721",i,{id:r.data.id,token_address:r.data.tokenAddress,...r.data.blueprint&&{blueprint:r.data.blueprint}}),o=function(e){const{id:t}=e.data,r=e.data.blueprint||"";return Vc(Sc(`{${t}}:{${r}}`))}(r);return await Kj(t,e,n)?async function(e,t,r,n,i){const s=vA.Core.connect(i.ethConfiguration.coreContractAddress,e),o=await s.populateTransaction.withdrawAndMint(r,t,n);return e.sendTransaction(o)}(e,s.asset_type,t,o,i):async function(e,t,r,n,i){const s=await e.getAddress(),o=new mk(i.apiConfiguration),a=await Hj(s,r,o),u=vA.Registration.connect(i.ethConfiguration.registrationContractAddress,e),c=await u.populateTransaction.regsiterAndWithdrawAndMint(s,r,a.operator_signature,t,n);return e.sendTransaction(c)}(e,s.asset_type,t,o,i)}async function $j(e,t,r,n){const i=n.immutableXConfig,s=await Vj("asset","ERC721",i,{token_id:r.tokenId,token_address:r.tokenAddress});return await Kj(t,e,n)?async function(e,t,r,n,i){const s=vA.Core.connect(i.ethConfiguration.coreContractAddress,e),o=await s.populateTransaction.withdrawNft(r,t,n);return e.sendTransaction(o)}(e,s.asset_type,t,r.tokenId,i):async function(e,t,r,n,i){const s=await e.getAddress(),o=new mk(i.apiConfiguration),a=await Hj(s,r,o),u=vA.Registration.connect(i.ethConfiguration.registrationContractAddress,e),c=await u.populateTransaction.registerAndWithdrawNft(s,r,a.operator_signature,t,n);return e.sendTransaction(c)}(e,s.asset_type,t,r.tokenId,i)}async function Yj({ethSigner:e,starkPublicKey:t,config:r}){await zj(e,r.immutableXConfig);const n=r.immutableXConfig,i=await Vj("asset","ETH",n);return await Kj(t,e,r)?async function(e,t,r,n){const i=vA.Core.connect(n.ethConfiguration.coreContractAddress,e),s=await i.populateTransaction.withdraw(r,t);return e.sendTransaction(s)}(e,i.asset_type,t,n):async function(e,t,r,n){const i=await e.getAddress(),s=new mk(n.apiConfiguration),o=await Hj(i,r,s),a=vA.Registration.connect(n.ethConfiguration.registrationContractAddress,e),u=await a.populateTransaction.registerAndWithdraw(i,r,o.operator_signature,t);return e.sendTransaction(u)}(e,i.asset_type,t,n)}async function Qj({signers:{ethSigner:e},starkPublicKey:t,token:r,config:n}){switch(r.type){case"ETH":return Yj({ethSigner:e,starkPublicKey:t,config:n});case"ERC20":return Xj({ethSigner:e,starkPublicKey:t,token:r,config:n});case"ERC721":return async function({ethSigner:e,starkPublicKey:t,token:r,config:n}){await zj(e,n.immutableXConfig);const{tokenAddress:i}=r,{tokenId:s}=r,o=n.immutableXConfig,a=new zS(o.apiConfiguration);return await a.getMintableTokenDetailsByClientTokenId({tokenAddress:i,tokenId:s}).then((r=>Jj(e,t,{type:"ERC721",data:{id:s,tokenAddress:i,blueprint:r.data.blueprint}},n))).catch((i=>{if(404===i.response?.status)return $j(e,t,r,n);throw i}))}({ethSigner:e,starkPublicKey:t,token:r,config:n})}}async function Zj({signers:{ethSigner:e},deposit:t,config:r}){await zj(e,r.immutableXConfig);const n=await e.getAddress(),i=Vu(t.amount,"wei"),s=r.immutableXConfig,o=new ES(s.apiConfiguration),a=new xS(s.apiConfiguration),u=new mk(s.apiConfiguration),c={user:n,token:{type:t.type,data:{decimals:18}},amount:i.toString()},f=await o.getSignableDeposit({getSignableDepositRequest:c}),l=(await a.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:t.type}}})).data.asset_type,d=f.data.stark_key,h=f.data.vault_id;return await Kj(d,e,r)?async function(e,t,r,n,i,s){const o=vA.Core.connect(s.ethConfiguration.coreContractAddress,e),a=await o.populateTransaction["deposit(uint256,uint256,uint256)"](n,r,i);return e.sendTransaction({...a,value:t})}(e,i,l,d,h,s):async function(e,t,r,n,i,s,o){const a=await e.getAddress(),u=vA.Core.connect(s.ethConfiguration.coreContractAddress,e),c=await Hj(a,n,o),f=await u.populateTransaction.registerAndDepositEth(a,n,c.operator_signature,r,i);return e.sendTransaction({...f,value:t})}(e,i,l,d,h,s,u)}async function eD({signers:{ethSigner:e},deposit:t,config:r}){await zj(e,r.immutableXConfig);const{apiConfiguration:n,ethConfiguration:i}=r.immutableXConfig,s=await e.getAddress(),o=new ik(n),a=new ES(n),u=new xS(n),c=new mk(n),f=await o.getToken({address:t.tokenAddress}),l={decimals:parseInt(f.data.decimals),token_address:t.tokenAddress},d=Vu(t.amount,0),h=vA.IERC20.connect(t.tokenAddress,e),p=await h.populateTransaction.approve(i.coreContractAddress,d);await e.sendTransaction(p);const g={user:s,token:{type:t.type,data:l},amount:d.toString()},m=await a.getSignableDeposit({getSignableDepositRequest:g}),y=(await u.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:t.type,data:{token_address:t.tokenAddress}}}})).data.asset_type,b=m.data.stark_key,v=m.data.vault_id,w=He.from(m.data.amount);return await Kj(b,e,r)?async function(e,t,r,n,i,s){const o=vA.Core.connect(s.coreContractAddress,e),a=await o.populateTransaction.depositERC20(n,r,i,t);return e.sendTransaction(a)}(e,w,y,b,v,i):async function(e,t,r,n,i,s,o){const a=await e.getAddress(),u=vA.Core.connect(s.coreContractAddress,e),c=await Hj(a,n,o),f=await u.populateTransaction.registerAndDepositERC20(a,n,c.operator_signature,r,i,t);return e.sendTransaction(f)}(e,w,y,b,v,i,c)}async function tD({signers:{ethSigner:e},deposit:t,config:r}){await zj(e,r.immutableXConfig);const n=await e.getAddress(),{immutableXConfig:i}=r,s=new ES(i.apiConfiguration),o=new xS(i.apiConfiguration),a=new mk(i.apiConfiguration),u={token_address:t.tokenAddress,token_id:t.tokenId},c={user:n,token:{type:t.type,data:u},amount:"1".toString()},f=await s.getSignableDeposit({getSignableDepositRequest:c}),l=(await o.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:t.type,data:{token_address:t.tokenAddress,token_id:t.tokenId}}}})).data.asset_type,d=f.data.stark_key,h=f.data.vault_id,p=await Kj(d,e,r),g=vA.IERC721.connect(t.tokenAddress,e),m=i.ethConfiguration.coreContractAddress;if(await g.isApprovedForAll(n,m)||await g.setApprovalForAll(m,!0),!p){const t=await Hj(n,d,a),r=vA.Core.connect(i.ethConfiguration.coreContractAddress,e);await r.registerUser(n,d,t.operator_signature)}return async function(e,t,r,n,i,s){const o=vA.Core.connect(s.ethConfiguration.coreContractAddress,e),a=await o.populateTransaction.depositNft(n,r,i,t);return e.sendTransaction(a)}(e,t.tokenId,l,d,h,i)}class rD{config;signers;constructor(e,t,r){this.config=e,this.signers={ethSigner:t,starkSigner:r}}async getAddress(){return await this.signers.ethSigner.getAddress()}registerOffchain(){return async function(e,t){await zj(e.ethSigner,t.immutableXConfig);const r=new mk(t.immutableXConfig.apiConfiguration),n=await e.ethSigner.getAddress(),i=await e.starkSigner.getAddress(),s=await r.getSignableRegistrationOffchain({getSignableRegistrationRequest:{ether_key:n,stark_key:i}}),{signable_message:o,payload_hash:a}=s.data,u=await UL(o,e.ethSigner),c=await e.starkSigner.signMessage(a);return(await r.registerUser({registerUserRequest:{eth_signature:u,ether_key:n,stark_signature:c,stark_key:i}})).data}(this.signers,this.config)}batchNftTransfer(e){return async function({signers:{ethSigner:e,starkSigner:t},request:r,config:n}){await zj(e,n.immutableXConfig);const i=await e.getAddress(),s=new dk(n.immutableXConfig.apiConfiguration),o=r.map((e=>({amount:"1",token:LL({type:"ERC721",tokenId:e.tokenId,tokenAddress:e.tokenAddress}),receiver:e.receiver}))),a=await s.getSignableTransfer({getSignableTransferRequestV2:{sender_ether_key:i,signable_requests:o}}),u=a.data.signable_message;if(void 0===u)throw new Error("Invalid response from Signable registration offchain");const c=await UL(u,e),f=[];for(const e of a.data.signable_responses){const r=await t.signMessage(e.payload_hash),n={sender_vault_id:e.sender_vault_id,receiver_stark_key:e.receiver_stark_key,receiver_vault_id:e.receiver_vault_id,asset_id:e.asset_id,amount:e.amount,nonce:e.nonce,expiration_timestamp:e.expiration_timestamp,stark_signature:r};f.push(n)}const l={sender_stark_key:a.data.sender_stark_key,requests:f},d=await s.createTransfer({createTransferRequestV2:l,xImxEthAddress:i,xImxEthSignature:c});return{transfer_ids:d?.data.transfer_ids}}({signers:this.signers,request:e,config:this.config})}cancelOrder(e){return async function({signers:e,request:t,config:r}){const n=new $S(r.immutableXConfig.apiConfiguration),i=await n.getSignableCancelOrder({getSignableCancelOrderRequest:{order_id:t.order_id}}),{signable_message:s,payload_hash:o}=i.data,a=await UL(s,e.ethSigner),u=await e.starkSigner.signMessage(o),c=await e.ethSigner.getAddress(),f=await n.cancelOrder({id:t.order_id.toString(),cancelOrderRequest:{order_id:t.order_id,stark_signature:u},xImxEthAddress:c,xImxEthSignature:a});return{order_id:f.data.order_id,status:f.data.status}}({signers:this.signers,request:e,config:this.config})}completeWithdrawal(e,t){return Qj({config:this.config,signers:this.signers,token:t,starkPublicKey:e})}createOrder(e){return async function({signers:e,request:t,config:r}){await zj(e.ethSigner,r.immutableXConfig);const n=await e.ethSigner.getAddress(),i=new $S(r.immutableXConfig.apiConfiguration),s="ERC721"===t.sell.type?"1":t.sell.amount,o={user:n,amount_buy:"ERC721"===t.buy.type?"1":t.buy.amount,token_buy:LL(t.buy),amount_sell:s,token_sell:LL(t.sell),fees:t.fees,expiration_timestamp:t.expiration_timestamp},a=await i.getSignableOrder({getSignableOrderRequestV3:o}),{signable_message:u,payload_hash:c}=a.data,f=await UL(u,e.ethSigner),l=await e.starkSigner.signMessage(c),d=a.data,h={createOrderRequest:{amount_buy:d.amount_buy,amount_sell:d.amount_sell,asset_id_buy:d.asset_id_buy,asset_id_sell:d.asset_id_sell,expiration_timestamp:d.expiration_timestamp,include_fees:!0,fees:t.fees,nonce:d.nonce,stark_key:d.stark_key,stark_signature:l,vault_id_buy:d.vault_id_buy,vault_id_sell:d.vault_id_sell},xImxEthAddress:n,xImxEthSignature:f};return{...(await i.createOrder(h)).data}}({signers:this.signers,request:e,config:this.config})}createTrade(e){return async function({signers:{ethSigner:e,starkSigner:t},request:r,config:n}){await zj(e,n.immutableXConfig);const i=await e.getAddress(),s=new uk(n.immutableXConfig.apiConfiguration),o=await s.getSignableTrade({getSignableTradeRequest:{user:i,order_id:r.order_id,fees:r.fees}}),{signable_message:a,payload_hash:u}=o.data,c=await UL(a,e),f=await t.signMessage(u);return(await s.createTrade({createTradeRequest:{amount_buy:o.data.amount_buy,amount_sell:o.data.amount_sell,asset_id_buy:o.data.asset_id_buy,asset_id_sell:o.data.asset_id_sell,expiration_timestamp:o.data.expiration_timestamp,fee_info:o.data.fee_info,fees:r.fees,include_fees:!0,nonce:o.data.nonce,order_id:r.order_id,stark_key:o.data.stark_key,vault_id_buy:o.data.vault_id_buy,vault_id_sell:o.data.vault_id_sell,stark_signature:f},xImxEthAddress:i,xImxEthSignature:c})).data}({signers:this.signers,request:e,config:this.config})}deposit(e){return async function({signers:e,deposit:t,config:r}){switch(t.type){case"ETH":return Zj({signers:e,deposit:t,config:r});case"ERC20":return eD({signers:e,deposit:t,config:r});case"ERC721":return tD({signers:e,deposit:t,config:r})}}({signers:this.signers,deposit:e,config:this.config})}exchangeTransfer(e){return async function({signers:e,request:t,config:r}){await zj(e.ethSigner,r.immutableXConfig);const n=new IS(r.immutableXConfig.apiConfiguration),i=await e.ethSigner.getAddress(),s=t.amount,o=await n.getExchangeSignableTransfer({id:t.transactionID,getSignableTransferRequest:{sender:i,token:LL(t),amount:s,receiver:t.receiver}}),{signable_message:a,payload_hash:u}=o.data,c=await UL(a,e.ethSigner),f=await e.starkSigner.signMessage(u),l={sender_stark_key:o.data.sender_stark_key,sender_vault_id:o.data.sender_vault_id,receiver_stark_key:o.data.receiver_stark_key,receiver_vault_id:o.data.receiver_vault_id,asset_id:o.data.asset_id,amount:o.data.amount,nonce:o.data.nonce,expiration_timestamp:o.data.expiration_timestamp,stark_signature:f},d=await n.createExchangeTransfer({id:t.transactionID,createTransferRequest:l,xImxEthAddress:i,xImxEthSignature:c});return{sent_signature:d?.data.sent_signature,status:d?.data.status?.toString(),time:d?.data.time,transfer_id:d?.data.transfer_id}}({signers:this.signers,request:e,config:this.config})}async isRegisteredOnchain(){return Kj(await this.signers.starkSigner.getAddress(),this.signers.ethSigner,this.config)}prepareWithdrawal(e){return async function({signers:e,withdrawal:t,config:r}){return Wj({signers:e,config:r.immutableXConfig,...t})}({signers:this.signers,withdrawal:e,config:this.config})}transfer(e){return async function({signers:{ethSigner:e,starkSigner:t},request:r,config:n}){await zj(e,n.immutableXConfig);const i=await e.getAddress(),s=new dk(n.immutableXConfig.apiConfiguration),o="ERC721"===r.type?"1":r.amount,a=await s.getSignableTransferV1({getSignableTransferRequest:{sender:i,token:LL(r),amount:o,receiver:r.receiver}}),{signable_message:u,payload_hash:c}=a.data,f=await UL(u,e),l=await t.signMessage(c),d={sender_stark_key:a.data.sender_stark_key,sender_vault_id:a.data.sender_vault_id,receiver_stark_key:a.data.receiver_stark_key,receiver_vault_id:a.data.receiver_vault_id,asset_id:a.data.asset_id,amount:a.data.amount,nonce:a.data.nonce,expiration_timestamp:a.data.expiration_timestamp,stark_signature:l},h=await s.createTransferV1({createTransferRequest:d,xImxEthAddress:i,xImxEthSignature:f});return{sent_signature:h?.data.sent_signature,status:h?.data.status?.toString(),time:h?.data.time,transfer_id:h?.data.transfer_id}}({signers:this.signers,request:e,config:this.config})}}const nD={SWITCH_CHAIN:"wallet_switchEthereumChain",CONNECT:"eth_requestAccounts"};const iD="The Metamask provider was not found";async function sD({chainID:e}){const t=await qj();if(!function(e){return!!e?.request}(t))throw new Error(iD);return await async function(e,t){await e.request({method:nD.CONNECT}),t&&await e.request({method:nD.SWITCH_CHAIN,params:[{chainId:`0x${t.toString(16)}`}]})}(t,e),new Lu(t)}const oD="message";var aD,uD;function cD(e,t){e&&e.contentWindow&&e.contentWindow.postMessage(t,new URL(e.src).origin)}function fD(e,t,r,n){if(e&&t.source!==e.contentWindow)return;const i=t.data;i.type===r&&n(i.details)}!function(e){e.GET_CONNECTION_REQUEST="GET_CONNECTION_REQUEST",e.CONNECT_WALLET_REQUEST="CONNECT_WALLET_REQUEST",e.SIGN_MESSAGE_REQUEST="SIGN_MESSAGE_REQUEST",e.DISCONNECT_WALLET_REQUEST="DISCONNECT_WALLET_REQUEST"}(aD||(aD={})),function(e){e.CONNECT_WALLET_RESPONSE="CONNECT_WALLET_RESPONSE",e.SIGN_MESSAGE_RESPONSE="SIGN_MESSAGE_RESPONSE",e.GET_CONNECTION_RESPONSE="GET_CONNECTION_RESPONSE",e.DISCONNECT_WALLET_RESPONSE="DISCONNECT_WALLET_RESPONSE"}(uD||(uD={}));class lD{publicAddress;iframe;constructor(e,t){this.publicAddress=e,this.iframe=t}getAddress(){return this.publicAddress}signMessage(e){return new Promise(((t,r)=>{const n=e=>{fD(this.iframe,e,uD.SIGN_MESSAGE_RESPONSE,(e=>{window.removeEventListener(oD,n),e.success||r(new Error(e.error?.message)),t(e.data.signedMessage)}))};window.addEventListener(oD,n),cD(this.iframe,{type:aD.SIGN_MESSAGE_REQUEST,details:{starkPublicKey:this.publicAddress,message:e}})}))}getIFrame(){return this.iframe}}const dD="imx-wallet-app",hD={[e.Environment.SANDBOX]:"https://wallets.sandbox.immutable.com",[e.Environment.PRODUCTION]:"https://wallets.immutable.com"},pD="display: none;";async function gD(e){const t=document.querySelector(`iframe#${dD}`);return t||await async function(e){return new Promise((t=>{const r=document.createElement("iframe");r.setAttribute("id",dD),r.setAttribute("src",hD[e]),r.setAttribute("style",pD),document.body.appendChild(r),r.onload=()=>t(r)}))}(e)}var mD;!function(e){e.PROVIDER_CONNECTION_ERROR="PROVIDER_CONNECTION_ERROR",e.WALLET_CONNECTION_ERROR="WALLET_CONNECTION_ERROR"}(mD||(mD={}));class yD extends Error{type;constructor(e,t){super(e),this.type=t}}const bD=async(e,t)=>{try{return await e()}catch(e){const r=t.message||`${e.message}`||"UnknownError";throw new yD(r,t.type)}};class vD extends rD{static imxSigner;static async connect(e){return await bD((async()=>{const t=await sD({chainID:e.immutableXConfig.ethConfiguration.chainID});return this.imxSigner=await async function(e,t){const r=e.getSigner(),n=await r.getAddress(),i=await r.signMessage("Only sign this request if you’ve initiated an action with Immutable X."),s=await gD(t);return new Promise(((e,t)=>{const r=n=>{fD(s,n,uD.CONNECT_WALLET_RESPONSE,(n=>{window.removeEventListener(oD,r),n.success||t(new Error("The L2 IMX Wallet connection has failed")),e(new lD(n.data.starkPublicKey,s))}))};window.addEventListener(oD,r),cD(s,{type:aD.CONNECT_WALLET_REQUEST,details:{ethAddress:n,signature:i}})}))}(t,e.baseConfig.environment),new vD(e,t.getSigner(),this.imxSigner)}),{type:mD.WALLET_CONNECTION_ERROR})}static async disconnect(){if(!this.imxSigner)throw new yD("Attempted to disconnect from the MetaMask IMX provider without an established connection",mD.PROVIDER_CONNECTION_ERROR);return bD((async()=>{await async function(e){const t=e.getIFrame();return new Promise(((r,n)=>{const i=e=>{fD(t,e,uD.DISCONNECT_WALLET_RESPONSE,(e=>{window.removeEventListener(oD,i),!e.success&&e.error&&n(e.error),t.remove(),r()}))};window.addEventListener(oD,i),cD(t,{type:aD.DISCONNECT_WALLET_REQUEST,details:{starkPublicKey:e.getAddress()}})}))}(this.imxSigner)}),{type:mD.PROVIDER_CONNECTION_ERROR})}static async signMessage(e){if(!this.imxSigner)throw new yD("Attempted to sign a message with the MetaMask IMX provider without an established connection",mD.PROVIDER_CONNECTION_ERROR);return bD((async()=>await this.imxSigner.signMessage(e)),{type:mD.PROVIDER_CONNECTION_ERROR})}}e.GenericIMXProvider=rD,e.ImmutableConfiguration=class{environment;apiKey;constructor(e){this.environment=e.environment,this.apiKey=e.apiKey}},e.ImmutableXClient=eR,e.MetaMaskIMXProvider=vD,e.Passport=class{authManager;config;confirmationScreen;immutableXClient;magicAdapter;passportImxProviderFactory;multiRollupApiClients;constructor(e){this.config=new kj(e),this.authManager=new hj(this.config),this.magicAdapter=new pj(this.config),this.confirmationScreen=new Pj(this.config),this.immutableXClient=e.overrides?.immutableXClient||new eR({baseConfig:e.baseConfig}),this.multiRollupApiClients=new sI(this.config.multiRollupConfig),this.passportImxProviderFactory=new Ej({authManager:this.authManager,config:this.config,confirmationScreen:this.confirmationScreen,immutableXClient:this.immutableXClient,magicAdapter:this.magicAdapter})}async connectImxSilent(){return this.passportImxProviderFactory.getProviderSilent()}async connectImx(){return this.passportImxProviderFactory.getProvider()}async loginWithDeviceFlow(){return this.authManager.loginWithDeviceFlow()}async connectImxDeviceFlow(e,t,r){return this.passportImxProviderFactory.getProviderWithDeviceFlow(e,t,r)}checkStoredDeviceFlowCredentials(){return this.authManager.checkStoredDeviceFlowCredentials()}async connectImxWithCredentials(e){return this.passportImxProviderFactory.getProviderWithCredentials(e)}connectEvm(){return new Fj({authManager:this.authManager,magicAdapter:this.magicAdapter,config:this.config,confirmationScreen:this.confirmationScreen,multiRollupApiClients:this.multiRollupApiClients})}async loginCallback(){return this.authManager.loginCallback()}async logout(){return this.authManager.logout()}async logoutSilentCallback(e){return this.authManager.logoutSilentCallback(e)}async logoutDeviceFlow(){return this.authManager.logoutDeviceFlow()}async getUserInfo(){const e=await this.authManager.getUser();return e?.profile}async getUserInfoDeviceFlow(){const e=await this.authManager.getUserDeviceFlow();return e?.profile}async getIdToken(){const e=await this.authManager.getUser();return e?.idToken}async getAccessToken(){const e=await this.authManager.getUser();return e?.accessToken}},e.PassportError=aj,e.ProviderConfiguration=class{immutableXConfig;baseConfig;constructor({baseConfig:t,overrides:r}){if(this.baseConfig=t,r)this.immutableXConfig=r.immutableXConfig;else switch(t.environment){case e.Environment.SANDBOX:this.immutableXConfig=Lk.SANDBOX;break;case e.Environment.PRODUCTION:this.immutableXConfig=Lk.PRODUCTION}}},e.imxClientCreateStarkSigner=WA,e.imxClientGenerateLegacyStarkPrivateKey=KA}));
32
+ //# sourceMappingURL=index.browser.js.map