bitcoin-address-validation
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -16,2 +16,4 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}); | ||
***************************************************************************** */ | ||
var t=function(){return(t=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var i in r=arguments[e])Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i]);return t}).apply(this,arguments)};function r(t,r){return t(r={exports:{}},r.exports),r.exports}var e=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o=!1;function h(){o=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,i=t.length;r<i;++r)e[r]=t[r],n[t.charCodeAt(r)]=r;n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63}function s(t,r,n){for(var i,o,h=[],s=r;s<n;s+=3)i=(t[s]<<16)+(t[s+1]<<8)+t[s+2],h.push(e[(o=i)>>18&63]+e[o>>12&63]+e[o>>6&63]+e[63&o]);return h.join("")}function f(t){var r;o||h();for(var n=t.length,i=n%3,f="",u=[],a=16383,c=0,l=n-i;c<l;c+=a)u.push(s(t,c,c+a>l?l:c+a));return 1===i?(r=t[n-1],f+=e[r>>2],f+=e[r<<4&63],f+="=="):2===i&&(r=(t[n-2]<<8)+t[n-1],f+=e[r>>10],f+=e[r>>4&63],f+=e[r<<2&63],f+="="),u.push(f),u.join("")}function u(t,r,e,n,i){var o,h,s=8*i-n-1,f=(1<<s)-1,u=f>>1,a=-7,c=e?i-1:0,l=e?-1:1,p=t[r+c];for(c+=l,o=p&(1<<-a)-1,p>>=-a,a+=s;a>0;o=256*o+t[r+c],c+=l,a-=8);for(h=o&(1<<-a)-1,o>>=-a,a+=n;a>0;h=256*h+t[r+c],c+=l,a-=8);if(0===o)o=1-u;else{if(o===f)return h?NaN:1/0*(p?-1:1);h+=Math.pow(2,n),o-=u}return(p?-1:1)*h*Math.pow(2,o-n)}function a(t,r,e,n,i,o){var h,s,f,u=8*o-i-1,a=(1<<u)-1,c=a>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,_=n?1:-1,g=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(s=isNaN(r)?1:0,h=a):(h=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-h))<1&&(h--,f*=2),(r+=h+c>=1?l/f:l*Math.pow(2,1-c))*f>=2&&(h++,f/=2),h+c>=a?(s=0,h=a):h+c>=1?(s=(r*f-1)*Math.pow(2,i),h+=c):(s=r*Math.pow(2,c-1)*Math.pow(2,i),h=0));i>=8;t[e+p]=255&s,p+=_,s/=256,i-=8);for(h=h<<i|s,u+=i;u>0;t[e+p]=255&h,p+=_,h/=256,u-=8);t[e+p-_]|=128*g}var c={}.toString,l=Array.isArray||function(t){return"[object Array]"==c.call(t)};w.TYPED_ARRAY_SUPPORT=void 0===global.TYPED_ARRAY_SUPPORT||global.TYPED_ARRAY_SUPPORT;var p=_();function _(){return w.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function g(t,r){if(_()<r)throw new RangeError("Invalid typed array length");return w.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=w.prototype:(null===t&&(t=new w(r)),t.length=r),t}function w(t,r,e){if(!(w.TYPED_ARRAY_SUPPORT||this instanceof w))return new w(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return v(this,t)}return d(this,t,r,e)}function d(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n);w.TYPED_ARRAY_SUPPORT?(t=r).__proto__=w.prototype:t=b(t,r);return t}(t,r,e,n):"string"==typeof r?function(t,r,e){"string"==typeof e&&""!==e||(e="utf8");if(!w.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|m(r,e),i=(t=g(t,n)).write(r,e);i!==n&&(t=t.slice(0,i));return t}(t,r,e):function(t,r){if(A(r)){var e=0|E(r.length);return 0===(t=g(t,e)).length||r.copy(t,0,0,e),t}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(n=r.length)!=n?g(t,0):b(t,r);if("Buffer"===r.type&&l(r.data))return b(t,r.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function y(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function v(t,r){if(y(r),t=g(t,r<0?0:0|E(r)),!w.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function b(t,r){var e=r.length<0?0:0|E(r.length);t=g(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function E(t){if(t>=_())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_().toString(16)+" bytes");return 0|t}function A(t){return!(null==t||!t._isBuffer)}function m(t,r){if(A(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return H(t).length;default:if(n)return G(t).length;r=(""+r).toLowerCase(),n=!0}}function B(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return N(this,r,e);case"utf8":case"utf-8":return C(this,r,e);case"ascii":return M(this,r,e);case"latin1":case"binary":return L(this,r,e);case"base64":return O(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function I(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function R(t,r,e,n,i){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0){if(!i)return-1;e=0}if("string"==typeof r&&(r=w.from(r,n)),A(r))return 0===r.length?-1:U(t,r,e,n,i);if("number"==typeof r)return r&=255,w.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):U(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function U(t,r,e,n,i){var o,h=1,s=t.length,f=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;h=2,s/=2,f/=2,e/=2}function u(t,r){return 1===h?t[r]:t.readUInt16BE(r*h)}if(i){var a=-1;for(o=e;o<s;o++)if(u(t,o)===u(r,-1===a?0:o-a)){if(-1===a&&(a=o),o-a+1===f)return a*h}else-1!==a&&(o-=o-a),a=-1}else for(e+f>s&&(e=s-f),o=e;o>=0;o--){for(var c=!0,l=0;l<f;l++)if(u(t,o+l)!==u(r,l)){c=!1;break}if(c)return o}return-1}function T(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n))>i&&(n=i):n=i;var o=r.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var h=0;h<n;++h){var s=parseInt(r.substr(2*h,2),16);if(isNaN(s))return h;t[e+h]=s}return h}function P(t,r,e,n){return K(G(r,t.length-e),t,e,n)}function S(t,r,e,n){return K(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function k(t,r,e,n){return S(t,r,e,n)}function x(t,r,e,n){return K(H(r),t,e,n)}function Y(t,r,e,n){return K(function(t,r){for(var e,n,i,o=[],h=0;h<t.length&&!((r-=2)<0);++h)n=(e=t.charCodeAt(h))>>8,i=e%256,o.push(i),o.push(n);return o}(r,t.length-e),t,e,n)}function O(t,r,e){return 0===r&&e===t.length?f(t):f(t.slice(r,e))}function C(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o,h,s,f,u=t[i],a=null,c=u>239?4:u>223?3:u>191?2:1;if(i+c<=e)switch(c){case 1:u<128&&(a=u);break;case 2:128==(192&(o=t[i+1]))&&(f=(31&u)<<6|63&o)>127&&(a=f);break;case 3:o=t[i+1],h=t[i+2],128==(192&o)&&128==(192&h)&&(f=(15&u)<<12|(63&o)<<6|63&h)>2047&&(f<55296||f>57343)&&(a=f);break;case 4:o=t[i+1],h=t[i+2],s=t[i+3],128==(192&o)&&128==(192&h)&&128==(192&s)&&(f=(15&u)<<18|(63&o)<<12|(63&h)<<6|63&s)>65535&&f<1114112&&(a=f)}null===a?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=c}return function(t){var r=t.length;if(r<=4096)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return e}(n)}w.poolSize=8192,w._augment=function(t){return t.__proto__=w.prototype,t},w.from=function(t,r,e){return d(null,t,r,e)},w.TYPED_ARRAY_SUPPORT&&(w.prototype.__proto__=Uint8Array.prototype,w.__proto__=Uint8Array),w.alloc=function(t,r,e){return function(t,r,e,n){return y(r),r<=0?g(t,r):void 0!==e?"string"==typeof n?g(t,r).fill(e,n):g(t,r).fill(e):g(t,r)}(null,t,r,e)},w.allocUnsafe=function(t){return v(null,t)},w.allocUnsafeSlow=function(t){return v(null,t)},w.isBuffer=Q,w.compare=function(t,r){if(!A(t)||!A(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,i=0,o=Math.min(e,n);i<o;++i)if(t[i]!==r[i]){e=t[i],n=r[i];break}return e<n?-1:n<e?1:0},w.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},w.concat=function(t,r){if(!l(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return w.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=w.allocUnsafe(r),i=0;for(e=0;e<t.length;++e){var o=t[e];if(!A(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},w.byteLength=m,w.prototype._isBuffer=!0,w.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)I(this,r,r+1);return this},w.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)I(this,r,r+3),I(this,r+1,r+2);return this},w.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)I(this,r,r+7),I(this,r+1,r+6),I(this,r+2,r+5),I(this,r+3,r+4);return this},w.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?C(this,0,t):B.apply(this,arguments)},w.prototype.equals=function(t){if(!A(t))throw new TypeError("Argument must be a Buffer");return this===t||0===w.compare(this,t)},w.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},w.prototype.compare=function(t,r,e,n,i){if(!A(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),r<0||e>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&r>=e)return 0;if(n>=i)return-1;if(r>=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),h=(e>>>=0)-(r>>>=0),s=Math.min(o,h),f=this.slice(n,i),u=t.slice(r,e),a=0;a<s;++a)if(f[a]!==u[a]){o=f[a],h=u[a];break}return o<h?-1:h<o?1:0},w.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},w.prototype.indexOf=function(t,r,e){return R(this,t,r,e,!0)},w.prototype.lastIndexOf=function(t,r,e){return R(this,t,r,e,!1)},w.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return T(this,t,r,e);case"utf8":case"utf-8":return P(this,t,r,e);case"ascii":return S(this,t,r,e);case"latin1":case"binary":return k(this,t,r,e);case"base64":return x(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Y(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},w.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function M(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(127&t[i]);return n}function L(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function N(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=Z(t[o]);return i}function D(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function z(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function j(t,r,e,n,i,o){if(!A(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function F(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function q(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>8*(n?i:3-i)&255}function W(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function V(t,r,e,n,i){return i||W(t,0,e,4),a(t,r,e,n,23,4),e+4}function J(t,r,e,n,i){return i||W(t,0,e,8),a(t,r,e,n,52,8),e+8}w.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),w.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=w.prototype;else{var i=r-t;e=new w(i,void 0);for(var o=0;o<i;++o)e[o]=this[o+t]}return e},w.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||z(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},w.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||z(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},w.prototype.readUInt8=function(t,r){return r||z(t,1,this.length),this[t]},w.prototype.readUInt16LE=function(t,r){return r||z(t,2,this.length),this[t]|this[t+1]<<8},w.prototype.readUInt16BE=function(t,r){return r||z(t,2,this.length),this[t]<<8|this[t+1]},w.prototype.readUInt32LE=function(t,r){return r||z(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},w.prototype.readUInt32BE=function(t,r){return r||z(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},w.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||z(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*r)),n},w.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||z(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*r)),o},w.prototype.readInt8=function(t,r){return r||z(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},w.prototype.readInt16LE=function(t,r){r||z(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},w.prototype.readInt16BE=function(t,r){r||z(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},w.prototype.readInt32LE=function(t,r){return r||z(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},w.prototype.readInt32BE=function(t,r){return r||z(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},w.prototype.readFloatLE=function(t,r){return r||z(t,4,this.length),u(this,t,!0,23,4)},w.prototype.readFloatBE=function(t,r){return r||z(t,4,this.length),u(this,t,!1,23,4)},w.prototype.readDoubleLE=function(t,r){return r||z(t,8,this.length),u(this,t,!0,52,8)},w.prototype.readDoubleBE=function(t,r){return r||z(t,8,this.length),u(this,t,!1,52,8)},w.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||j(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o<e&&(i*=256);)this[r+o]=t/i&255;return r+e},w.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||j(this,t,r,e,Math.pow(2,8*e)-1,0);var i=e-1,o=1;for(this[r+i]=255&t;--i>=0&&(o*=256);)this[r+i]=t/o&255;return r+e},w.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,1,255,0),w.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},w.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,65535,0),w.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):F(this,t,r,!0),r+2},w.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,65535,0),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):F(this,t,r,!1),r+2},w.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,4294967295,0),w.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):q(this,t,r,!0),r+4},w.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,4294967295,0),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):q(this,t,r,!1),r+4},w.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);j(this,t,r,e,i-1,-i)}var o=0,h=1,s=0;for(this[r]=255&t;++o<e&&(h*=256);)t<0&&0===s&&0!==this[r+o-1]&&(s=1),this[r+o]=(t/h>>0)-s&255;return r+e},w.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);j(this,t,r,e,i-1,-i)}var o=e-1,h=1,s=0;for(this[r+o]=255&t;--o>=0&&(h*=256);)t<0&&0===s&&0!==this[r+o+1]&&(s=1),this[r+o]=(t/h>>0)-s&255;return r+e},w.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,1,127,-128),w.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},w.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,32767,-32768),w.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):F(this,t,r,!0),r+2},w.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,32767,-32768),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):F(this,t,r,!1),r+2},w.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,2147483647,-2147483648),w.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):q(this,t,r,!0),r+4},w.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):q(this,t,r,!1),r+4},w.prototype.writeFloatLE=function(t,r,e){return V(this,t,r,!0,e)},w.prototype.writeFloatBE=function(t,r,e){return V(this,t,r,!1,e)},w.prototype.writeDoubleLE=function(t,r,e){return J(this,t,r,!0,e)},w.prototype.writeDoubleBE=function(t,r,e){return J(this,t,r,!1,e)},w.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=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),t.length-r<n-e&&(n=t.length-r+e);var i,o=n-e;if(this===t&&e<r&&r<n)for(i=o-1;i>=0;--i)t[i+r]=this[i+e];else if(o<1e3||!w.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+r]=this[i+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+o),r);return o},w.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!w.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var o;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(o=r;o<e;++o)this[o]=t;else{var h=A(t)?t:G(new w(t,n).toString()),s=h.length;for(o=0;o<e-r;++o)this[o+r]=h[o%s]}return this};var X=/[^+\/0-9A-Za-z-_]/g;function Z(t){return t<16?"0"+t.toString(16):t.toString(16)}function G(t,r){var e;r=r||1/0;for(var n=t.length,i=null,o=[],h=0;h<n;++h){if((e=t.charCodeAt(h))>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(h+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function H(t){return function(t){var r,e,s,f,u,a;o||h();var c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");u="="===t[c-2]?2:"="===t[c-1]?1:0,a=new i(3*c/4-u),s=u>0?c-4:c;var l=0;for(r=0,e=0;r<s;r+=4,e+=3)f=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],a[l++]=f>>16&255,a[l++]=f>>8&255,a[l++]=255&f;return 2===u?(f=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,a[l++]=255&f):1===u&&(f=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,a[l++]=f>>8&255,a[l++]=255&f),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(X,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function K(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function Q(t){return null!=t&&(!!t._isBuffer||$(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&$(t.slice(0,0))}(t))}function $(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var tt=Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:p,Buffer:w,SlowBuffer:function(t){return+t!=t&&(t=0),w.alloc(+t)},isBuffer:Q}),rt=r((function(t,r){var e=tt.Buffer;function n(t,r){for(var e in t)r[e]=t[e]}function i(t,r,n){return e(t,r,n)}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?t.exports=tt:(n(tt,r),r.Buffer=i),i.prototype=Object.create(e.prototype),n(e,i),i.from=function(t,r,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return e(t,r,n)},i.alloc=function(t,r,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=e(t);return void 0!==r?"string"==typeof n?i.fill(r,n):i.fill(r):i.fill(0),i},i.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return e(t)},i.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return tt.SlowBuffer(t)}}));rt.Buffer;var et=rt.Buffer;var nt,it=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),e=0;e<r.length;e++)r[e]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),o=i.charCodeAt(0);if(255!==r[o])throw new TypeError(i+" is ambiguous");r[o]=n}var h=t.length,s=t.charAt(0),f=Math.log(h)/Math.log(256),u=Math.log(256)/Math.log(h);function a(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return et.alloc(0);var e=0;if(" "!==t[e]){for(var n=0,i=0;t[e]===s;)n++,e++;for(var o=(t.length-e)*f+1>>>0,u=new Uint8Array(o);t[e];){var a=r[t.charCodeAt(e)];if(255===a)return;for(var c=0,l=o-1;(0!==a||c<i)&&-1!==l;l--,c++)a+=h*u[l]>>>0,u[l]=a%256>>>0,a=a/256>>>0;if(0!==a)throw new Error("Non-zero carry");i=c,e++}if(" "!==t[e]){for(var p=o-i;p!==o&&0===u[p];)p++;var _=et.allocUnsafe(n+(o-p));_.fill(0,0,n);for(var g=n;p!==o;)_[g++]=u[p++];return _}}}return{encode:function(r){if((Array.isArray(r)||r instanceof Uint8Array)&&(r=et.from(r)),!et.isBuffer(r))throw new TypeError("Expected Buffer");if(0===r.length)return"";for(var e=0,n=0,i=0,o=r.length;i!==o&&0===r[i];)i++,e++;for(var f=(o-i)*u+1>>>0,a=new Uint8Array(f);i!==o;){for(var c=r[i],l=0,p=f-1;(0!==c||l<n)&&-1!==p;p--,l++)c+=256*a[p]>>>0,a[p]=c%h>>>0,c=c/h>>>0;if(0!==c)throw new Error("Non-zero carry");n=l,i++}for(var _=f-n;_!==f&&0===a[_];)_++;for(var g=s.repeat(e);_<f;++_)g+=t.charAt(a[_]);return g},decodeUnsafe:a,decode:function(t){var r=a(t);if(r)return r;throw new Error("Non-base"+h+" character")}}},ot=r((function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const e="qpzry9x8gf2tvdw0s3jn54khce6mua7l",n={};for(let t=0;t<e.length;t++){const r=e.charAt(t);n[r]=t}function i(t){const r=t>>25;return(33554431&t)<<5^996825010&-(r>>0&1)^642813549&-(r>>1&1)^513874426&-(r>>2&1)^1027748829&-(r>>3&1)^705979059&-(r>>4&1)}function o(t){let r=1;for(let e=0;e<t.length;++e){const n=t.charCodeAt(e);if(n<33||n>126)return"Invalid prefix ("+t+")";r=i(r)^n>>5}r=i(r);for(let e=0;e<t.length;++e){const n=t.charCodeAt(e);r=i(r)^31&n}return r}function h(t,r,e,n){let i=0,o=0;const h=(1<<e)-1,s=[];for(let n=0;n<t.length;++n)for(i=i<<r|t[n],o+=r;o>=e;)o-=e,s.push(i>>o&h);if(n)o>0&&s.push(i<<e-o&h);else{if(o>=r)return"Excess padding";if(i<<e-o&h)return"Non-zero padding"}return s}function s(t){return h(t,8,5,!0)}function f(t){const r=h(t,5,8,!1);if(Array.isArray(r))return r}function u(t){const r=h(t,5,8,!1);if(Array.isArray(r))return r;throw new Error(r)}function a(t){let r;function h(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";const h=t.toLowerCase(),s=t.toUpperCase();if(t!==h&&t!==s)return"Mixed-case string "+t;const f=(t=h).lastIndexOf("1");if(-1===f)return"No separator character for "+t;if(0===f)return"Missing prefix for "+t;const u=t.slice(0,f),a=t.slice(f+1);if(a.length<6)return"Data too short";let c=o(u);if("string"==typeof c)return c;const l=[];for(let t=0;t<a.length;++t){const r=a.charAt(t),e=n[r];if(void 0===e)return"Unknown character "+r;c=i(c)^e,t+6>=a.length||l.push(e)}return c!==r?"Invalid checksum for "+t:{prefix:u,words:l}}return r="bech32"===t?1:734539939,{decodeUnsafe:function(t,r){const e=h(t,r);if("object"==typeof e)return e},decode:function(t,r){const e=h(t,r);if("object"==typeof e)return e;throw new Error(e)},encode:function(t,n,h){if(h=h||90,t.length+7+n.length>h)throw new TypeError("Exceeds length limit");let s=o(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let f=t+"1";for(let t=0;t<n.length;++t){const r=n[t];if(r>>5!=0)throw new Error("Non 5-bit word");s=i(s)^r,f+=e.charAt(r)}for(let t=0;t<6;++t)s=i(s);s^=r;for(let t=0;t<6;++t){f+=e.charAt(s>>5*(5-t)&31)}return f},toWords:s,fromWordsUnsafe:f,fromWords:u}}r.bech32=a("bech32"),r.bech32m=a("bech32m")}));(nt=ot)&&nt.__esModule&&Object.prototype.hasOwnProperty.call(nt,"default")&&nt.default,ot.bech32m;var ht=ot.bech32,st=r((function(t){"function"==typeof Object.create?t.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,r){if(r){t.super_=r;var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t}}})),ft=rt.Buffer;function ut(t,r){this._block=ft.alloc(t),this._finalSize=r,this._blockSize=t,this._len=0}ut.prototype.update=function(t,r){"string"==typeof t&&(r=r||"utf8",t=ft.from(t,r));for(var e=this._block,n=this._blockSize,i=t.length,o=this._len,h=0;h<i;){for(var s=o%n,f=Math.min(i-h,n-s),u=0;u<f;u++)e[s+u]=t[h+u];h+=f,(o+=f)%n==0&&this._update(e)}return this._len+=i,this},ut.prototype.digest=function(t){var r=this._len%this._blockSize;this._block[r]=128,this._block.fill(0,r+1),r>=this._finalSize&&(this._update(this._block),this._block.fill(0));var e=8*this._len;if(e<=4294967295)this._block.writeUInt32BE(e,this._blockSize-4);else{var n=(4294967295&e)>>>0,i=(e-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},ut.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var at=ut,ct=rt.Buffer,lt=[1518500249,1859775393,-1894007588,-899497514],pt=new Array(80);function _t(){this.init(),this._w=pt,at.call(this,64,56)}function gt(t){return t<<30|t>>>2}function wt(t,r,e,n){return 0===t?r&e|~r&n:2===t?r&e|r&n|e&n:r^e^n}st(_t,at),_t.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},_t.prototype._update=function(t){for(var r,e=this._w,n=0|this._a,i=0|this._b,o=0|this._c,h=0|this._d,s=0|this._e,f=0;f<16;++f)e[f]=t.readInt32BE(4*f);for(;f<80;++f)e[f]=e[f-3]^e[f-8]^e[f-14]^e[f-16];for(var u=0;u<80;++u){var a=~~(u/20),c=0|((r=n)<<5|r>>>27)+wt(a,i,o,h)+s+e[u]+lt[a];s=h,h=o,o=gt(i),i=n,n=c}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=h+this._d|0,this._e=s+this._e|0},_t.prototype._hash=function(){var t=ct.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var dt=_t,yt=rt.Buffer,vt=[1518500249,1859775393,-1894007588,-899497514],bt=new Array(80);function Et(){this.init(),this._w=bt,at.call(this,64,56)}function At(t){return t<<5|t>>>27}function mt(t){return t<<30|t>>>2}function Bt(t,r,e,n){return 0===t?r&e|~r&n:2===t?r&e|r&n|e&n:r^e^n}st(Et,at),Et.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Et.prototype._update=function(t){for(var r,e=this._w,n=0|this._a,i=0|this._b,o=0|this._c,h=0|this._d,s=0|this._e,f=0;f<16;++f)e[f]=t.readInt32BE(4*f);for(;f<80;++f)e[f]=(r=e[f-3]^e[f-8]^e[f-14]^e[f-16])<<1|r>>>31;for(var u=0;u<80;++u){var a=~~(u/20),c=At(n)+Bt(a,i,o,h)+s+e[u]+vt[a]|0;s=h,h=o,o=mt(i),i=n,n=c}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=h+this._d|0,this._e=s+this._e|0},Et.prototype._hash=function(){var t=yt.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var It=Et,Rt=rt.Buffer,Ut=[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],Tt=new Array(64);function Pt(){this.init(),this._w=Tt,at.call(this,64,56)}function St(t,r,e){return e^t&(r^e)}function kt(t,r,e){return t&r|e&(t|r)}function xt(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function Yt(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function Ot(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function Ct(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}st(Pt,at),Pt.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},Pt.prototype._update=function(t){for(var r=this._w,e=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,h=0|this._e,s=0|this._f,f=0|this._g,u=0|this._h,a=0;a<16;++a)r[a]=t.readInt32BE(4*a);for(;a<64;++a)r[a]=Ct(r[a-2])+r[a-7]+Ot(r[a-15])+r[a-16]|0;for(var c=0;c<64;++c){var l=u+Yt(h)+St(h,s,f)+Ut[c]+r[c]|0,p=xt(e)+kt(e,n,i)|0;u=f,f=s,s=h,h=o+l|0,o=i,i=n,n=e,e=l+p|0}this._a=e+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=h+this._e|0,this._f=s+this._f|0,this._g=f+this._g|0,this._h=u+this._h|0},Pt.prototype._hash=function(){var t=Rt.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t};var Mt=Pt,Lt=rt.Buffer,Nt=new Array(64);function Dt(){this.init(),this._w=Nt,at.call(this,64,56)}st(Dt,Mt),Dt.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},Dt.prototype._hash=function(){var t=Lt.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t};var zt=Dt,jt=rt.Buffer,Ft=[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],qt=new Array(160);function Wt(){this.init(),this._w=qt,at.call(this,128,112)}function Vt(t,r,e){return e^t&(r^e)}function Jt(t,r,e){return t&r|e&(t|r)}function Xt(t,r){return(t>>>28|r<<4)^(r>>>2|t<<30)^(r>>>7|t<<25)}function Zt(t,r){return(t>>>14|r<<18)^(t>>>18|r<<14)^(r>>>9|t<<23)}function Gt(t,r){return(t>>>1|r<<31)^(t>>>8|r<<24)^t>>>7}function Ht(t,r){return(t>>>1|r<<31)^(t>>>8|r<<24)^(t>>>7|r<<25)}function Kt(t,r){return(t>>>19|r<<13)^(r>>>29|t<<3)^t>>>6}function Qt(t,r){return(t>>>19|r<<13)^(r>>>29|t<<3)^(t>>>6|r<<26)}function $t(t,r){return t>>>0<r>>>0?1:0}st(Wt,at),Wt.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},Wt.prototype._update=function(t){for(var r=this._w,e=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,h=0|this._eh,s=0|this._fh,f=0|this._gh,u=0|this._hh,a=0|this._al,c=0|this._bl,l=0|this._cl,p=0|this._dl,_=0|this._el,g=0|this._fl,w=0|this._gl,d=0|this._hl,y=0;y<32;y+=2)r[y]=t.readInt32BE(4*y),r[y+1]=t.readInt32BE(4*y+4);for(;y<160;y+=2){var v=r[y-30],b=r[y-30+1],E=Gt(v,b),A=Ht(b,v),m=Kt(v=r[y-4],b=r[y-4+1]),B=Qt(b,v),I=r[y-14],R=r[y-14+1],U=r[y-32],T=r[y-32+1],P=A+R|0,S=E+I+$t(P,A)|0;S=(S=S+m+$t(P=P+B|0,B)|0)+U+$t(P=P+T|0,T)|0,r[y]=S,r[y+1]=P}for(var k=0;k<160;k+=2){S=r[k],P=r[k+1];var x=Jt(e,n,i),Y=Jt(a,c,l),O=Xt(e,a),C=Xt(a,e),M=Zt(h,_),L=Zt(_,h),N=Ft[k],D=Ft[k+1],z=Vt(h,s,f),j=Vt(_,g,w),F=d+L|0,q=u+M+$t(F,d)|0;q=(q=(q=q+z+$t(F=F+j|0,j)|0)+N+$t(F=F+D|0,D)|0)+S+$t(F=F+P|0,P)|0;var W=C+Y|0,V=O+x+$t(W,C)|0;u=f,d=w,f=s,w=g,s=h,g=_,h=o+q+$t(_=p+F|0,p)|0,o=i,p=l,i=n,l=c,n=e,c=a,e=q+V+$t(a=F+W|0,F)|0}this._al=this._al+a|0,this._bl=this._bl+c|0,this._cl=this._cl+l|0,this._dl=this._dl+p|0,this._el=this._el+_|0,this._fl=this._fl+g|0,this._gl=this._gl+w|0,this._hl=this._hl+d|0,this._ah=this._ah+e+$t(this._al,a)|0,this._bh=this._bh+n+$t(this._bl,c)|0,this._ch=this._ch+i+$t(this._cl,l)|0,this._dh=this._dh+o+$t(this._dl,p)|0,this._eh=this._eh+h+$t(this._el,_)|0,this._fh=this._fh+s+$t(this._fl,g)|0,this._gh=this._gh+f+$t(this._gl,w)|0,this._hh=this._hh+u+$t(this._hl,d)|0},Wt.prototype._hash=function(){var t=jt.allocUnsafe(64);function r(r,e,n){t.writeInt32BE(r,n),t.writeInt32BE(e,n+4)}return r(this._ah,this._al,0),r(this._bh,this._bl,8),r(this._ch,this._cl,16),r(this._dh,this._dl,24),r(this._eh,this._el,32),r(this._fh,this._fl,40),r(this._gh,this._gl,48),r(this._hh,this._hl,56),t};var tr=Wt,rr=rt.Buffer,er=new Array(160);function nr(){this.init(),this._w=er,at.call(this,128,112)}st(nr,tr),nr.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},nr.prototype._hash=function(){var t=rr.allocUnsafe(48);function r(r,e,n){t.writeInt32BE(r,n),t.writeInt32BE(e,n+4)}return r(this._ah,this._al,0),r(this._bh,this._bl,8),r(this._ch,this._cl,16),r(this._dh,this._dl,24),r(this._eh,this._el,32),r(this._fh,this._fl,40),t};var ir,or,hr=nr,sr=r((function(t){var r=t.exports=function(t){t=t.toLowerCase();var e=r[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};r.sha=dt,r.sha1=It,r.sha224=zt,r.sha256=Mt,r.sha384=hr,r.sha512=tr})),fr=it("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),ur=function(t){return w.from(sr("sha256").update(t).digest())};exports.Network=void 0,(ir=exports.Network||(exports.Network={})).mainnet="mainnet",ir.testnet="testnet",ir.regtest="regtest",function(t){t.p2pkh="p2pkh",t.p2sh="p2sh",t.p2wpkh="p2wpkh",t.p2wsh="p2wsh"}(or||(or={}));var ar={0:{type:or.p2pkh,network:exports.Network.mainnet},111:{type:or.p2pkh,network:exports.Network.testnet},5:{type:or.p2sh,network:exports.Network.mainnet},196:{type:or.p2sh,network:exports.Network.testnet}},cr=function(r){var e,n=r.substr(0,2).toLowerCase();if("bc"===n||"tb"===n)return function(t){var r;try{r=ht.decode(t)}catch(t){throw new Error("Invalid address")}var e={bc:exports.Network.mainnet,tb:exports.Network.testnet,bcrt:exports.Network.regtest}[r.prefix];if(void 0===e)throw new Error("Invalid address");var n=r.words[0];if(n<0||n>16)throw new Error("Invalid address");return{bech32:!0,network:e,address:t,type:20===ht.fromWords(r.words.slice(1)).length?or.p2wpkh:or.p2wsh}}(r);try{e=fr.decode(r)}catch(t){throw new Error("Invalid address")}var i=e.length;if(25!==i)throw new Error("Invalid address");var o=e.readUInt8(0),h=e.slice(i-4,i),s=e.slice(0,i-4),f=ur(ur(s)).slice(0,4);if(!h.equals(f))throw new Error("Invalid address");if(!Object.keys(ar).map(Number).includes(o))throw new Error("Invalid address");return t(t({},ar[o]),{address:r,bech32:!1})},lr=function(t,r){try{var e=cr(t);return!r||r===e.network}catch(t){return!1}};exports.default=lr,exports.getAddressInfo=cr,exports.validate=lr; | ||
var t=function(){return t=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var i in r=arguments[e])Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i]);return t},t.apply(this,arguments)};function r(t,r){return t(r={exports:{}},r.exports),r.exports}var e=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o=!1;function h(){o=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,i=t.length;r<i;++r)e[r]=t[r],n[t.charCodeAt(r)]=r;n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63}function s(t,r,n){for(var i,o,h=[],s=r;s<n;s+=3)i=(t[s]<<16)+(t[s+1]<<8)+t[s+2],h.push(e[(o=i)>>18&63]+e[o>>12&63]+e[o>>6&63]+e[63&o]);return h.join("")}function f(t){var r;o||h();for(var n=t.length,i=n%3,f="",u=[],a=16383,c=0,l=n-i;c<l;c+=a)u.push(s(t,c,c+a>l?l:c+a));return 1===i?(r=t[n-1],f+=e[r>>2],f+=e[r<<4&63],f+="=="):2===i&&(r=(t[n-2]<<8)+t[n-1],f+=e[r>>10],f+=e[r>>4&63],f+=e[r<<2&63],f+="="),u.push(f),u.join("")}function u(t,r,e,n,i){var o,h,s=8*i-n-1,f=(1<<s)-1,u=f>>1,a=-7,c=e?i-1:0,l=e?-1:1,p=t[r+c];for(c+=l,o=p&(1<<-a)-1,p>>=-a,a+=s;a>0;o=256*o+t[r+c],c+=l,a-=8);for(h=o&(1<<-a)-1,o>>=-a,a+=n;a>0;h=256*h+t[r+c],c+=l,a-=8);if(0===o)o=1-u;else{if(o===f)return h?NaN:1/0*(p?-1:1);h+=Math.pow(2,n),o-=u}return(p?-1:1)*h*Math.pow(2,o-n)}function a(t,r,e,n,i,o){var h,s,f,u=8*o-i-1,a=(1<<u)-1,c=a>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,_=n?1:-1,g=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(s=isNaN(r)?1:0,h=a):(h=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-h))<1&&(h--,f*=2),(r+=h+c>=1?l/f:l*Math.pow(2,1-c))*f>=2&&(h++,f/=2),h+c>=a?(s=0,h=a):h+c>=1?(s=(r*f-1)*Math.pow(2,i),h+=c):(s=r*Math.pow(2,c-1)*Math.pow(2,i),h=0));i>=8;t[e+p]=255&s,p+=_,s/=256,i-=8);for(h=h<<i|s,u+=i;u>0;t[e+p]=255&h,p+=_,h/=256,u-=8);t[e+p-_]|=128*g}var c={}.toString,l=Array.isArray||function(t){return"[object Array]"==c.call(t)};w.TYPED_ARRAY_SUPPORT=void 0===global.TYPED_ARRAY_SUPPORT||global.TYPED_ARRAY_SUPPORT;var p=_();function _(){return w.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function g(t,r){if(_()<r)throw new RangeError("Invalid typed array length");return w.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=w.prototype:(null===t&&(t=new w(r)),t.length=r),t}function w(t,r,e){if(!(w.TYPED_ARRAY_SUPPORT||this instanceof w))return new w(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return v(this,t)}return d(this,t,r,e)}function d(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n);w.TYPED_ARRAY_SUPPORT?(t=r).__proto__=w.prototype:t=b(t,r);return t}(t,r,e,n):"string"==typeof r?function(t,r,e){"string"==typeof e&&""!==e||(e="utf8");if(!w.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|m(r,e),i=(t=g(t,n)).write(r,e);i!==n&&(t=t.slice(0,i));return t}(t,r,e):function(t,r){if(A(r)){var e=0|E(r.length);return 0===(t=g(t,e)).length||r.copy(t,0,0,e),t}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(n=r.length)!=n?g(t,0):b(t,r);if("Buffer"===r.type&&l(r.data))return b(t,r.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function y(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function v(t,r){if(y(r),t=g(t,r<0?0:0|E(r)),!w.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function b(t,r){var e=r.length<0?0:0|E(r.length);t=g(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function E(t){if(t>=_())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_().toString(16)+" bytes");return 0|t}function A(t){return!(null==t||!t._isBuffer)}function m(t,r){if(A(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return H(t).length;default:if(n)return G(t).length;r=(""+r).toLowerCase(),n=!0}}function B(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return N(this,r,e);case"utf8":case"utf-8":return C(this,r,e);case"ascii":return M(this,r,e);case"latin1":case"binary":return L(this,r,e);case"base64":return O(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function I(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function R(t,r,e,n,i){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0){if(!i)return-1;e=0}if("string"==typeof r&&(r=w.from(r,n)),A(r))return 0===r.length?-1:U(t,r,e,n,i);if("number"==typeof r)return r&=255,w.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):U(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function U(t,r,e,n,i){var o,h=1,s=t.length,f=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;h=2,s/=2,f/=2,e/=2}function u(t,r){return 1===h?t[r]:t.readUInt16BE(r*h)}if(i){var a=-1;for(o=e;o<s;o++)if(u(t,o)===u(r,-1===a?0:o-a)){if(-1===a&&(a=o),o-a+1===f)return a*h}else-1!==a&&(o-=o-a),a=-1}else for(e+f>s&&(e=s-f),o=e;o>=0;o--){for(var c=!0,l=0;l<f;l++)if(u(t,o+l)!==u(r,l)){c=!1;break}if(c)return o}return-1}function T(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n))>i&&(n=i):n=i;var o=r.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var h=0;h<n;++h){var s=parseInt(r.substr(2*h,2),16);if(isNaN(s))return h;t[e+h]=s}return h}function P(t,r,e,n){return K(G(r,t.length-e),t,e,n)}function S(t,r,e,n){return K(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function k(t,r,e,n){return S(t,r,e,n)}function x(t,r,e,n){return K(H(r),t,e,n)}function Y(t,r,e,n){return K(function(t,r){for(var e,n,i,o=[],h=0;h<t.length&&!((r-=2)<0);++h)n=(e=t.charCodeAt(h))>>8,i=e%256,o.push(i),o.push(n);return o}(r,t.length-e),t,e,n)}function O(t,r,e){return 0===r&&e===t.length?f(t):f(t.slice(r,e))}function C(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o,h,s,f,u=t[i],a=null,c=u>239?4:u>223?3:u>191?2:1;if(i+c<=e)switch(c){case 1:u<128&&(a=u);break;case 2:128==(192&(o=t[i+1]))&&(f=(31&u)<<6|63&o)>127&&(a=f);break;case 3:o=t[i+1],h=t[i+2],128==(192&o)&&128==(192&h)&&(f=(15&u)<<12|(63&o)<<6|63&h)>2047&&(f<55296||f>57343)&&(a=f);break;case 4:o=t[i+1],h=t[i+2],s=t[i+3],128==(192&o)&&128==(192&h)&&128==(192&s)&&(f=(15&u)<<18|(63&o)<<12|(63&h)<<6|63&s)>65535&&f<1114112&&(a=f)}null===a?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=c}return function(t){var r=t.length;if(r<=4096)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return e}(n)}w.poolSize=8192,w._augment=function(t){return t.__proto__=w.prototype,t},w.from=function(t,r,e){return d(null,t,r,e)},w.TYPED_ARRAY_SUPPORT&&(w.prototype.__proto__=Uint8Array.prototype,w.__proto__=Uint8Array),w.alloc=function(t,r,e){return function(t,r,e,n){return y(r),r<=0?g(t,r):void 0!==e?"string"==typeof n?g(t,r).fill(e,n):g(t,r).fill(e):g(t,r)}(null,t,r,e)},w.allocUnsafe=function(t){return v(null,t)},w.allocUnsafeSlow=function(t){return v(null,t)},w.isBuffer=Q,w.compare=function(t,r){if(!A(t)||!A(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,i=0,o=Math.min(e,n);i<o;++i)if(t[i]!==r[i]){e=t[i],n=r[i];break}return e<n?-1:n<e?1:0},w.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},w.concat=function(t,r){if(!l(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return w.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=w.allocUnsafe(r),i=0;for(e=0;e<t.length;++e){var o=t[e];if(!A(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},w.byteLength=m,w.prototype._isBuffer=!0,w.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)I(this,r,r+1);return this},w.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)I(this,r,r+3),I(this,r+1,r+2);return this},w.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)I(this,r,r+7),I(this,r+1,r+6),I(this,r+2,r+5),I(this,r+3,r+4);return this},w.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?C(this,0,t):B.apply(this,arguments)},w.prototype.equals=function(t){if(!A(t))throw new TypeError("Argument must be a Buffer");return this===t||0===w.compare(this,t)},w.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},w.prototype.compare=function(t,r,e,n,i){if(!A(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),r<0||e>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&r>=e)return 0;if(n>=i)return-1;if(r>=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),h=(e>>>=0)-(r>>>=0),s=Math.min(o,h),f=this.slice(n,i),u=t.slice(r,e),a=0;a<s;++a)if(f[a]!==u[a]){o=f[a],h=u[a];break}return o<h?-1:h<o?1:0},w.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},w.prototype.indexOf=function(t,r,e){return R(this,t,r,e,!0)},w.prototype.lastIndexOf=function(t,r,e){return R(this,t,r,e,!1)},w.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return T(this,t,r,e);case"utf8":case"utf-8":return P(this,t,r,e);case"ascii":return S(this,t,r,e);case"latin1":case"binary":return k(this,t,r,e);case"base64":return x(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Y(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},w.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function M(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(127&t[i]);return n}function L(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function N(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=Z(t[o]);return i}function D(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function z(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function j(t,r,e,n,i,o){if(!A(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function F(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function W(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>8*(n?i:3-i)&255}function q(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function V(t,r,e,n,i){return i||q(t,0,e,4),a(t,r,e,n,23,4),e+4}function J(t,r,e,n,i){return i||q(t,0,e,8),a(t,r,e,n,52,8),e+8}w.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),w.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=w.prototype;else{var i=r-t;e=new w(i,void 0);for(var o=0;o<i;++o)e[o]=this[o+t]}return e},w.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||z(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},w.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||z(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},w.prototype.readUInt8=function(t,r){return r||z(t,1,this.length),this[t]},w.prototype.readUInt16LE=function(t,r){return r||z(t,2,this.length),this[t]|this[t+1]<<8},w.prototype.readUInt16BE=function(t,r){return r||z(t,2,this.length),this[t]<<8|this[t+1]},w.prototype.readUInt32LE=function(t,r){return r||z(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},w.prototype.readUInt32BE=function(t,r){return r||z(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},w.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||z(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*r)),n},w.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||z(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*r)),o},w.prototype.readInt8=function(t,r){return r||z(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},w.prototype.readInt16LE=function(t,r){r||z(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},w.prototype.readInt16BE=function(t,r){r||z(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},w.prototype.readInt32LE=function(t,r){return r||z(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},w.prototype.readInt32BE=function(t,r){return r||z(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},w.prototype.readFloatLE=function(t,r){return r||z(t,4,this.length),u(this,t,!0,23,4)},w.prototype.readFloatBE=function(t,r){return r||z(t,4,this.length),u(this,t,!1,23,4)},w.prototype.readDoubleLE=function(t,r){return r||z(t,8,this.length),u(this,t,!0,52,8)},w.prototype.readDoubleBE=function(t,r){return r||z(t,8,this.length),u(this,t,!1,52,8)},w.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||j(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o<e&&(i*=256);)this[r+o]=t/i&255;return r+e},w.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||j(this,t,r,e,Math.pow(2,8*e)-1,0);var i=e-1,o=1;for(this[r+i]=255&t;--i>=0&&(o*=256);)this[r+i]=t/o&255;return r+e},w.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,1,255,0),w.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},w.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,65535,0),w.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):F(this,t,r,!0),r+2},w.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,65535,0),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):F(this,t,r,!1),r+2},w.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,4294967295,0),w.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):W(this,t,r,!0),r+4},w.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,4294967295,0),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):W(this,t,r,!1),r+4},w.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);j(this,t,r,e,i-1,-i)}var o=0,h=1,s=0;for(this[r]=255&t;++o<e&&(h*=256);)t<0&&0===s&&0!==this[r+o-1]&&(s=1),this[r+o]=(t/h>>0)-s&255;return r+e},w.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);j(this,t,r,e,i-1,-i)}var o=e-1,h=1,s=0;for(this[r+o]=255&t;--o>=0&&(h*=256);)t<0&&0===s&&0!==this[r+o+1]&&(s=1),this[r+o]=(t/h>>0)-s&255;return r+e},w.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,1,127,-128),w.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},w.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,32767,-32768),w.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):F(this,t,r,!0),r+2},w.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,32767,-32768),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):F(this,t,r,!1),r+2},w.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,2147483647,-2147483648),w.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):W(this,t,r,!0),r+4},w.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):W(this,t,r,!1),r+4},w.prototype.writeFloatLE=function(t,r,e){return V(this,t,r,!0,e)},w.prototype.writeFloatBE=function(t,r,e){return V(this,t,r,!1,e)},w.prototype.writeDoubleLE=function(t,r,e){return J(this,t,r,!0,e)},w.prototype.writeDoubleBE=function(t,r,e){return J(this,t,r,!1,e)},w.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=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),t.length-r<n-e&&(n=t.length-r+e);var i,o=n-e;if(this===t&&e<r&&r<n)for(i=o-1;i>=0;--i)t[i+r]=this[i+e];else if(o<1e3||!w.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+r]=this[i+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+o),r);return o},w.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!w.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var o;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(o=r;o<e;++o)this[o]=t;else{var h=A(t)?t:G(new w(t,n).toString()),s=h.length;for(o=0;o<e-r;++o)this[o+r]=h[o%s]}return this};var X=/[^+\/0-9A-Za-z-_]/g;function Z(t){return t<16?"0"+t.toString(16):t.toString(16)}function G(t,r){var e;r=r||1/0;for(var n=t.length,i=null,o=[],h=0;h<n;++h){if((e=t.charCodeAt(h))>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(h+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function H(t){return function(t){var r,e,s,f,u,a;o||h();var c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");u="="===t[c-2]?2:"="===t[c-1]?1:0,a=new i(3*c/4-u),s=u>0?c-4:c;var l=0;for(r=0,e=0;r<s;r+=4,e+=3)f=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],a[l++]=f>>16&255,a[l++]=f>>8&255,a[l++]=255&f;return 2===u?(f=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,a[l++]=255&f):1===u&&(f=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,a[l++]=f>>8&255,a[l++]=255&f),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(X,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function K(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function Q(t){return null!=t&&(!!t._isBuffer||$(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&$(t.slice(0,0))}(t))}function $(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var tt=Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:p,Buffer:w,SlowBuffer:function(t){return+t!=t&&(t=0),w.alloc(+t)},isBuffer:Q}),rt=r((function(t,r){ | ||
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ | ||
var e=tt.Buffer;function n(t,r){for(var e in t)r[e]=t[e]}function i(t,r,n){return e(t,r,n)}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?t.exports=tt:(n(tt,r),r.Buffer=i),i.prototype=Object.create(e.prototype),n(e,i),i.from=function(t,r,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return e(t,r,n)},i.alloc=function(t,r,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=e(t);return void 0!==r?"string"==typeof n?i.fill(r,n):i.fill(r):i.fill(0),i},i.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return e(t)},i.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return tt.SlowBuffer(t)}}));rt.Buffer;var et=rt.Buffer;var nt,it=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),e=0;e<r.length;e++)r[e]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),o=i.charCodeAt(0);if(255!==r[o])throw new TypeError(i+" is ambiguous");r[o]=n}var h=t.length,s=t.charAt(0),f=Math.log(h)/Math.log(256),u=Math.log(256)/Math.log(h);function a(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return et.alloc(0);for(var e=0,n=0,i=0;t[e]===s;)n++,e++;for(var o=(t.length-e)*f+1>>>0,u=new Uint8Array(o);t[e];){var a=r[t.charCodeAt(e)];if(255===a)return;for(var c=0,l=o-1;(0!==a||c<i)&&-1!==l;l--,c++)a+=h*u[l]>>>0,u[l]=a%256>>>0,a=a/256>>>0;if(0!==a)throw new Error("Non-zero carry");i=c,e++}for(var p=o-i;p!==o&&0===u[p];)p++;var _=et.allocUnsafe(n+(o-p));_.fill(0,0,n);for(var g=n;p!==o;)_[g++]=u[p++];return _}return{encode:function(r){if((Array.isArray(r)||r instanceof Uint8Array)&&(r=et.from(r)),!et.isBuffer(r))throw new TypeError("Expected Buffer");if(0===r.length)return"";for(var e=0,n=0,i=0,o=r.length;i!==o&&0===r[i];)i++,e++;for(var f=(o-i)*u+1>>>0,a=new Uint8Array(f);i!==o;){for(var c=r[i],l=0,p=f-1;(0!==c||l<n)&&-1!==p;p--,l++)c+=256*a[p]>>>0,a[p]=c%h>>>0,c=c/h>>>0;if(0!==c)throw new Error("Non-zero carry");n=l,i++}for(var _=f-n;_!==f&&0===a[_];)_++;for(var g=s.repeat(e);_<f;++_)g+=t.charAt(a[_]);return g},decodeUnsafe:a,decode:function(t){var r=a(t);if(r)return r;throw new Error("Non-base"+h+" character")}}},ot=r((function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const e="qpzry9x8gf2tvdw0s3jn54khce6mua7l",n={};for(let t=0;t<e.length;t++){const r=e.charAt(t);n[r]=t}function i(t){const r=t>>25;return(33554431&t)<<5^996825010&-(r>>0&1)^642813549&-(r>>1&1)^513874426&-(r>>2&1)^1027748829&-(r>>3&1)^705979059&-(r>>4&1)}function o(t){let r=1;for(let e=0;e<t.length;++e){const n=t.charCodeAt(e);if(n<33||n>126)return"Invalid prefix ("+t+")";r=i(r)^n>>5}r=i(r);for(let e=0;e<t.length;++e){const n=t.charCodeAt(e);r=i(r)^31&n}return r}function h(t,r,e,n){let i=0,o=0;const h=(1<<e)-1,s=[];for(let n=0;n<t.length;++n)for(i=i<<r|t[n],o+=r;o>=e;)o-=e,s.push(i>>o&h);if(n)o>0&&s.push(i<<e-o&h);else{if(o>=r)return"Excess padding";if(i<<e-o&h)return"Non-zero padding"}return s}function s(t){return h(t,8,5,!0)}function f(t){const r=h(t,5,8,!1);if(Array.isArray(r))return r}function u(t){const r=h(t,5,8,!1);if(Array.isArray(r))return r;throw new Error(r)}function a(t){let r;function h(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";const h=t.toLowerCase(),s=t.toUpperCase();if(t!==h&&t!==s)return"Mixed-case string "+t;const f=(t=h).lastIndexOf("1");if(-1===f)return"No separator character for "+t;if(0===f)return"Missing prefix for "+t;const u=t.slice(0,f),a=t.slice(f+1);if(a.length<6)return"Data too short";let c=o(u);if("string"==typeof c)return c;const l=[];for(let t=0;t<a.length;++t){const r=a.charAt(t),e=n[r];if(void 0===e)return"Unknown character "+r;c=i(c)^e,t+6>=a.length||l.push(e)}return c!==r?"Invalid checksum for "+t:{prefix:u,words:l}}return r="bech32"===t?1:734539939,{decodeUnsafe:function(t,r){const e=h(t,r);if("object"==typeof e)return e},decode:function(t,r){const e=h(t,r);if("object"==typeof e)return e;throw new Error(e)},encode:function(t,n,h){if(h=h||90,t.length+7+n.length>h)throw new TypeError("Exceeds length limit");let s=o(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let f=t+"1";for(let t=0;t<n.length;++t){const r=n[t];if(r>>5!=0)throw new Error("Non 5-bit word");s=i(s)^r,f+=e.charAt(r)}for(let t=0;t<6;++t)s=i(s);s^=r;for(let t=0;t<6;++t){f+=e.charAt(s>>5*(5-t)&31)}return f},toWords:s,fromWordsUnsafe:f,fromWords:u}}r.bech32=a("bech32"),r.bech32m=a("bech32m")}));(nt=ot)&&nt.__esModule&&Object.prototype.hasOwnProperty.call(nt,"default")&&nt.default;var ht=ot.bech32m,st=ot.bech32,ft=r((function(t){"function"==typeof Object.create?t.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,r){if(r){t.super_=r;var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t}}})),ut=rt.Buffer;function at(t,r){this._block=ut.alloc(t),this._finalSize=r,this._blockSize=t,this._len=0}at.prototype.update=function(t,r){"string"==typeof t&&(r=r||"utf8",t=ut.from(t,r));for(var e=this._block,n=this._blockSize,i=t.length,o=this._len,h=0;h<i;){for(var s=o%n,f=Math.min(i-h,n-s),u=0;u<f;u++)e[s+u]=t[h+u];h+=f,(o+=f)%n==0&&this._update(e)}return this._len+=i,this},at.prototype.digest=function(t){var r=this._len%this._blockSize;this._block[r]=128,this._block.fill(0,r+1),r>=this._finalSize&&(this._update(this._block),this._block.fill(0));var e=8*this._len;if(e<=4294967295)this._block.writeUInt32BE(e,this._blockSize-4);else{var n=(4294967295&e)>>>0,i=(e-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},at.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var ct=at,lt=rt.Buffer,pt=[1518500249,1859775393,-1894007588,-899497514],_t=new Array(80);function gt(){this.init(),this._w=_t,ct.call(this,64,56)}function wt(t){return t<<30|t>>>2}function dt(t,r,e,n){return 0===t?r&e|~r&n:2===t?r&e|r&n|e&n:r^e^n}ft(gt,ct),gt.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},gt.prototype._update=function(t){for(var r,e=this._w,n=0|this._a,i=0|this._b,o=0|this._c,h=0|this._d,s=0|this._e,f=0;f<16;++f)e[f]=t.readInt32BE(4*f);for(;f<80;++f)e[f]=e[f-3]^e[f-8]^e[f-14]^e[f-16];for(var u=0;u<80;++u){var a=~~(u/20),c=0|((r=n)<<5|r>>>27)+dt(a,i,o,h)+s+e[u]+pt[a];s=h,h=o,o=wt(i),i=n,n=c}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=h+this._d|0,this._e=s+this._e|0},gt.prototype._hash=function(){var t=lt.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var yt=gt,vt=rt.Buffer,bt=[1518500249,1859775393,-1894007588,-899497514],Et=new Array(80);function At(){this.init(),this._w=Et,ct.call(this,64,56)}function mt(t){return t<<5|t>>>27}function Bt(t){return t<<30|t>>>2}function It(t,r,e,n){return 0===t?r&e|~r&n:2===t?r&e|r&n|e&n:r^e^n}ft(At,ct),At.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},At.prototype._update=function(t){for(var r,e=this._w,n=0|this._a,i=0|this._b,o=0|this._c,h=0|this._d,s=0|this._e,f=0;f<16;++f)e[f]=t.readInt32BE(4*f);for(;f<80;++f)e[f]=(r=e[f-3]^e[f-8]^e[f-14]^e[f-16])<<1|r>>>31;for(var u=0;u<80;++u){var a=~~(u/20),c=mt(n)+It(a,i,o,h)+s+e[u]+bt[a]|0;s=h,h=o,o=Bt(i),i=n,n=c}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=h+this._d|0,this._e=s+this._e|0},At.prototype._hash=function(){var t=vt.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var Rt=At,Ut=rt.Buffer,Tt=[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],Pt=new Array(64);function St(){this.init(),this._w=Pt,ct.call(this,64,56)}function kt(t,r,e){return e^t&(r^e)}function xt(t,r,e){return t&r|e&(t|r)}function Yt(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function Ot(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function Ct(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function Mt(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}ft(St,ct),St.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},St.prototype._update=function(t){for(var r=this._w,e=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,h=0|this._e,s=0|this._f,f=0|this._g,u=0|this._h,a=0;a<16;++a)r[a]=t.readInt32BE(4*a);for(;a<64;++a)r[a]=Mt(r[a-2])+r[a-7]+Ct(r[a-15])+r[a-16]|0;for(var c=0;c<64;++c){var l=u+Ot(h)+kt(h,s,f)+Tt[c]+r[c]|0,p=Yt(e)+xt(e,n,i)|0;u=f,f=s,s=h,h=o+l|0,o=i,i=n,n=e,e=l+p|0}this._a=e+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=h+this._e|0,this._f=s+this._f|0,this._g=f+this._g|0,this._h=u+this._h|0},St.prototype._hash=function(){var t=Ut.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t};var Lt=St,Nt=rt.Buffer,Dt=new Array(64);function zt(){this.init(),this._w=Dt,ct.call(this,64,56)}ft(zt,Lt),zt.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},zt.prototype._hash=function(){var t=Nt.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t};var jt=zt,Ft=rt.Buffer,Wt=[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],qt=new Array(160);function Vt(){this.init(),this._w=qt,ct.call(this,128,112)}function Jt(t,r,e){return e^t&(r^e)}function Xt(t,r,e){return t&r|e&(t|r)}function Zt(t,r){return(t>>>28|r<<4)^(r>>>2|t<<30)^(r>>>7|t<<25)}function Gt(t,r){return(t>>>14|r<<18)^(t>>>18|r<<14)^(r>>>9|t<<23)}function Ht(t,r){return(t>>>1|r<<31)^(t>>>8|r<<24)^t>>>7}function Kt(t,r){return(t>>>1|r<<31)^(t>>>8|r<<24)^(t>>>7|r<<25)}function Qt(t,r){return(t>>>19|r<<13)^(r>>>29|t<<3)^t>>>6}function $t(t,r){return(t>>>19|r<<13)^(r>>>29|t<<3)^(t>>>6|r<<26)}function tr(t,r){return t>>>0<r>>>0?1:0}ft(Vt,ct),Vt.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},Vt.prototype._update=function(t){for(var r=this._w,e=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,h=0|this._eh,s=0|this._fh,f=0|this._gh,u=0|this._hh,a=0|this._al,c=0|this._bl,l=0|this._cl,p=0|this._dl,_=0|this._el,g=0|this._fl,w=0|this._gl,d=0|this._hl,y=0;y<32;y+=2)r[y]=t.readInt32BE(4*y),r[y+1]=t.readInt32BE(4*y+4);for(;y<160;y+=2){var v=r[y-30],b=r[y-30+1],E=Ht(v,b),A=Kt(b,v),m=Qt(v=r[y-4],b=r[y-4+1]),B=$t(b,v),I=r[y-14],R=r[y-14+1],U=r[y-32],T=r[y-32+1],P=A+R|0,S=E+I+tr(P,A)|0;S=(S=S+m+tr(P=P+B|0,B)|0)+U+tr(P=P+T|0,T)|0,r[y]=S,r[y+1]=P}for(var k=0;k<160;k+=2){S=r[k],P=r[k+1];var x=Xt(e,n,i),Y=Xt(a,c,l),O=Zt(e,a),C=Zt(a,e),M=Gt(h,_),L=Gt(_,h),N=Wt[k],D=Wt[k+1],z=Jt(h,s,f),j=Jt(_,g,w),F=d+L|0,W=u+M+tr(F,d)|0;W=(W=(W=W+z+tr(F=F+j|0,j)|0)+N+tr(F=F+D|0,D)|0)+S+tr(F=F+P|0,P)|0;var q=C+Y|0,V=O+x+tr(q,C)|0;u=f,d=w,f=s,w=g,s=h,g=_,h=o+W+tr(_=p+F|0,p)|0,o=i,p=l,i=n,l=c,n=e,c=a,e=W+V+tr(a=F+q|0,F)|0}this._al=this._al+a|0,this._bl=this._bl+c|0,this._cl=this._cl+l|0,this._dl=this._dl+p|0,this._el=this._el+_|0,this._fl=this._fl+g|0,this._gl=this._gl+w|0,this._hl=this._hl+d|0,this._ah=this._ah+e+tr(this._al,a)|0,this._bh=this._bh+n+tr(this._bl,c)|0,this._ch=this._ch+i+tr(this._cl,l)|0,this._dh=this._dh+o+tr(this._dl,p)|0,this._eh=this._eh+h+tr(this._el,_)|0,this._fh=this._fh+s+tr(this._fl,g)|0,this._gh=this._gh+f+tr(this._gl,w)|0,this._hh=this._hh+u+tr(this._hl,d)|0},Vt.prototype._hash=function(){var t=Ft.allocUnsafe(64);function r(r,e,n){t.writeInt32BE(r,n),t.writeInt32BE(e,n+4)}return r(this._ah,this._al,0),r(this._bh,this._bl,8),r(this._ch,this._cl,16),r(this._dh,this._dl,24),r(this._eh,this._el,32),r(this._fh,this._fl,40),r(this._gh,this._gl,48),r(this._hh,this._hl,56),t};var rr=Vt,er=rt.Buffer,nr=new Array(160);function ir(){this.init(),this._w=nr,ct.call(this,128,112)}ft(ir,rr),ir.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},ir.prototype._hash=function(){var t=er.allocUnsafe(48);function r(r,e,n){t.writeInt32BE(r,n),t.writeInt32BE(e,n+4)}return r(this._ah,this._al,0),r(this._bh,this._bl,8),r(this._ch,this._cl,16),r(this._dh,this._dl,24),r(this._eh,this._el,32),r(this._fh,this._fl,40),t};var or,hr,sr=ir,fr=r((function(t){var r=t.exports=function(t){t=t.toLowerCase();var e=r[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};r.sha=yt,r.sha1=Rt,r.sha224=jt,r.sha256=Lt,r.sha384=sr,r.sha512=rr})),ur=it("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),ar=function(t){return w.from(fr("sha256").update(t).digest())};exports.Network=void 0,(or=exports.Network||(exports.Network={})).mainnet="mainnet",or.testnet="testnet",or.regtest="regtest",function(t){t.p2pkh="p2pkh",t.p2sh="p2sh",t.p2wpkh="p2wpkh",t.p2wsh="p2wsh",t.p2tr="p2tr"}(hr||(hr={}));var cr={0:{type:hr.p2pkh,network:exports.Network.mainnet},111:{type:hr.p2pkh,network:exports.Network.testnet},5:{type:hr.p2sh,network:exports.Network.mainnet},196:{type:hr.p2sh,network:exports.Network.testnet}},lr=function(r){var e,n=r.substr(0,2).toLowerCase();if("bc"===n||"tb"===n)return function(t){var r;try{r=t.startsWith("bc1p")||t.startsWith("tb1p")||t.startsWith("bcrt1p")?ht.decode(t):st.decode(t)}catch(t){throw new Error("Invalid address")}var e={bc:exports.Network.mainnet,tb:exports.Network.testnet,bcrt:exports.Network.regtest}[r.prefix];if(void 0===e)throw new Error("Invalid address");var n=r.words[0];if(n<0||n>16)throw new Error("Invalid address");return{bech32:!0,network:e,address:t,type:20===st.fromWords(r.words.slice(1)).length?hr.p2wpkh:1===n?hr.p2tr:hr.p2wsh}}(r);try{e=ur.decode(r)}catch(t){throw new Error("Invalid address")}var i=e.length;if(25!==i)throw new Error("Invalid address");var o=e.readUInt8(0),h=e.slice(i-4,i),s=e.slice(0,i-4),f=ar(ar(s)).slice(0,4);if(!h.equals(f))throw new Error("Invalid address");if(!Object.keys(cr).map(Number).includes(o))throw new Error("Invalid address");return t(t({},cr[o]),{address:r,bech32:!1})},pr=function(t,r){try{var e=lr(t);return!r||r===e.network}catch(t){return!1}};exports.default=pr,exports.getAddressInfo=lr,exports.validate=pr; |
@@ -10,3 +10,4 @@ declare enum Network { | ||
p2wpkh = "p2wpkh", | ||
p2wsh = "p2wsh" | ||
p2wsh = "p2wsh", | ||
p2tr = "p2tr" | ||
} | ||
@@ -13,0 +14,0 @@ declare type AddressInfo = { |
@@ -15,2 +15,4 @@ /*! ***************************************************************************** | ||
***************************************************************************** */ | ||
var t=function(){return(t=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var i in r=arguments[e])Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i]);return t}).apply(this,arguments)};function r(t,r){return t(r={exports:{}},r.exports),r.exports}var e=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o=!1;function h(){o=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,i=t.length;r<i;++r)e[r]=t[r],n[t.charCodeAt(r)]=r;n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63}function s(t,r,n){for(var i,o,h=[],s=r;s<n;s+=3)i=(t[s]<<16)+(t[s+1]<<8)+t[s+2],h.push(e[(o=i)>>18&63]+e[o>>12&63]+e[o>>6&63]+e[63&o]);return h.join("")}function f(t){var r;o||h();for(var n=t.length,i=n%3,f="",u=[],a=16383,c=0,l=n-i;c<l;c+=a)u.push(s(t,c,c+a>l?l:c+a));return 1===i?(r=t[n-1],f+=e[r>>2],f+=e[r<<4&63],f+="=="):2===i&&(r=(t[n-2]<<8)+t[n-1],f+=e[r>>10],f+=e[r>>4&63],f+=e[r<<2&63],f+="="),u.push(f),u.join("")}function u(t,r,e,n,i){var o,h,s=8*i-n-1,f=(1<<s)-1,u=f>>1,a=-7,c=e?i-1:0,l=e?-1:1,p=t[r+c];for(c+=l,o=p&(1<<-a)-1,p>>=-a,a+=s;a>0;o=256*o+t[r+c],c+=l,a-=8);for(h=o&(1<<-a)-1,o>>=-a,a+=n;a>0;h=256*h+t[r+c],c+=l,a-=8);if(0===o)o=1-u;else{if(o===f)return h?NaN:1/0*(p?-1:1);h+=Math.pow(2,n),o-=u}return(p?-1:1)*h*Math.pow(2,o-n)}function a(t,r,e,n,i,o){var h,s,f,u=8*o-i-1,a=(1<<u)-1,c=a>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,_=n?1:-1,g=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(s=isNaN(r)?1:0,h=a):(h=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-h))<1&&(h--,f*=2),(r+=h+c>=1?l/f:l*Math.pow(2,1-c))*f>=2&&(h++,f/=2),h+c>=a?(s=0,h=a):h+c>=1?(s=(r*f-1)*Math.pow(2,i),h+=c):(s=r*Math.pow(2,c-1)*Math.pow(2,i),h=0));i>=8;t[e+p]=255&s,p+=_,s/=256,i-=8);for(h=h<<i|s,u+=i;u>0;t[e+p]=255&h,p+=_,h/=256,u-=8);t[e+p-_]|=128*g}var c={}.toString,l=Array.isArray||function(t){return"[object Array]"==c.call(t)};w.TYPED_ARRAY_SUPPORT=void 0===global.TYPED_ARRAY_SUPPORT||global.TYPED_ARRAY_SUPPORT;var p=_();function _(){return w.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function g(t,r){if(_()<r)throw new RangeError("Invalid typed array length");return w.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=w.prototype:(null===t&&(t=new w(r)),t.length=r),t}function w(t,r,e){if(!(w.TYPED_ARRAY_SUPPORT||this instanceof w))return new w(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return v(this,t)}return d(this,t,r,e)}function d(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n);w.TYPED_ARRAY_SUPPORT?(t=r).__proto__=w.prototype:t=b(t,r);return t}(t,r,e,n):"string"==typeof r?function(t,r,e){"string"==typeof e&&""!==e||(e="utf8");if(!w.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|m(r,e),i=(t=g(t,n)).write(r,e);i!==n&&(t=t.slice(0,i));return t}(t,r,e):function(t,r){if(A(r)){var e=0|E(r.length);return 0===(t=g(t,e)).length||r.copy(t,0,0,e),t}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(n=r.length)!=n?g(t,0):b(t,r);if("Buffer"===r.type&&l(r.data))return b(t,r.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function y(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function v(t,r){if(y(r),t=g(t,r<0?0:0|E(r)),!w.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function b(t,r){var e=r.length<0?0:0|E(r.length);t=g(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function E(t){if(t>=_())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_().toString(16)+" bytes");return 0|t}function A(t){return!(null==t||!t._isBuffer)}function m(t,r){if(A(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return H(t).length;default:if(n)return G(t).length;r=(""+r).toLowerCase(),n=!0}}function B(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return D(this,r,e);case"utf8":case"utf-8":return O(this,r,e);case"ascii":return M(this,r,e);case"latin1":case"binary":return L(this,r,e);case"base64":return C(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function I(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function R(t,r,e,n,i){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0){if(!i)return-1;e=0}if("string"==typeof r&&(r=w.from(r,n)),A(r))return 0===r.length?-1:U(t,r,e,n,i);if("number"==typeof r)return r&=255,w.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):U(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function U(t,r,e,n,i){var o,h=1,s=t.length,f=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;h=2,s/=2,f/=2,e/=2}function u(t,r){return 1===h?t[r]:t.readUInt16BE(r*h)}if(i){var a=-1;for(o=e;o<s;o++)if(u(t,o)===u(r,-1===a?0:o-a)){if(-1===a&&(a=o),o-a+1===f)return a*h}else-1!==a&&(o-=o-a),a=-1}else for(e+f>s&&(e=s-f),o=e;o>=0;o--){for(var c=!0,l=0;l<f;l++)if(u(t,o+l)!==u(r,l)){c=!1;break}if(c)return o}return-1}function T(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n))>i&&(n=i):n=i;var o=r.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var h=0;h<n;++h){var s=parseInt(r.substr(2*h,2),16);if(isNaN(s))return h;t[e+h]=s}return h}function P(t,r,e,n){return K(G(r,t.length-e),t,e,n)}function S(t,r,e,n){return K(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function k(t,r,e,n){return S(t,r,e,n)}function Y(t,r,e,n){return K(H(r),t,e,n)}function x(t,r,e,n){return K(function(t,r){for(var e,n,i,o=[],h=0;h<t.length&&!((r-=2)<0);++h)n=(e=t.charCodeAt(h))>>8,i=e%256,o.push(i),o.push(n);return o}(r,t.length-e),t,e,n)}function C(t,r,e){return 0===r&&e===t.length?f(t):f(t.slice(r,e))}function O(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o,h,s,f,u=t[i],a=null,c=u>239?4:u>223?3:u>191?2:1;if(i+c<=e)switch(c){case 1:u<128&&(a=u);break;case 2:128==(192&(o=t[i+1]))&&(f=(31&u)<<6|63&o)>127&&(a=f);break;case 3:o=t[i+1],h=t[i+2],128==(192&o)&&128==(192&h)&&(f=(15&u)<<12|(63&o)<<6|63&h)>2047&&(f<55296||f>57343)&&(a=f);break;case 4:o=t[i+1],h=t[i+2],s=t[i+3],128==(192&o)&&128==(192&h)&&128==(192&s)&&(f=(15&u)<<18|(63&o)<<12|(63&h)<<6|63&s)>65535&&f<1114112&&(a=f)}null===a?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=c}return function(t){var r=t.length;if(r<=4096)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return e}(n)}w.poolSize=8192,w._augment=function(t){return t.__proto__=w.prototype,t},w.from=function(t,r,e){return d(null,t,r,e)},w.TYPED_ARRAY_SUPPORT&&(w.prototype.__proto__=Uint8Array.prototype,w.__proto__=Uint8Array),w.alloc=function(t,r,e){return function(t,r,e,n){return y(r),r<=0?g(t,r):void 0!==e?"string"==typeof n?g(t,r).fill(e,n):g(t,r).fill(e):g(t,r)}(null,t,r,e)},w.allocUnsafe=function(t){return v(null,t)},w.allocUnsafeSlow=function(t){return v(null,t)},w.isBuffer=Q,w.compare=function(t,r){if(!A(t)||!A(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,i=0,o=Math.min(e,n);i<o;++i)if(t[i]!==r[i]){e=t[i],n=r[i];break}return e<n?-1:n<e?1:0},w.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},w.concat=function(t,r){if(!l(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return w.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=w.allocUnsafe(r),i=0;for(e=0;e<t.length;++e){var o=t[e];if(!A(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},w.byteLength=m,w.prototype._isBuffer=!0,w.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)I(this,r,r+1);return this},w.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)I(this,r,r+3),I(this,r+1,r+2);return this},w.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)I(this,r,r+7),I(this,r+1,r+6),I(this,r+2,r+5),I(this,r+3,r+4);return this},w.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?O(this,0,t):B.apply(this,arguments)},w.prototype.equals=function(t){if(!A(t))throw new TypeError("Argument must be a Buffer");return this===t||0===w.compare(this,t)},w.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},w.prototype.compare=function(t,r,e,n,i){if(!A(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),r<0||e>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&r>=e)return 0;if(n>=i)return-1;if(r>=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),h=(e>>>=0)-(r>>>=0),s=Math.min(o,h),f=this.slice(n,i),u=t.slice(r,e),a=0;a<s;++a)if(f[a]!==u[a]){o=f[a],h=u[a];break}return o<h?-1:h<o?1:0},w.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},w.prototype.indexOf=function(t,r,e){return R(this,t,r,e,!0)},w.prototype.lastIndexOf=function(t,r,e){return R(this,t,r,e,!1)},w.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return T(this,t,r,e);case"utf8":case"utf-8":return P(this,t,r,e);case"ascii":return S(this,t,r,e);case"latin1":case"binary":return k(this,t,r,e);case"base64":return Y(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},w.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function M(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(127&t[i]);return n}function L(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function D(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=Z(t[o]);return i}function N(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function z(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function j(t,r,e,n,i,o){if(!A(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function F(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function q(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>8*(n?i:3-i)&255}function W(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function V(t,r,e,n,i){return i||W(t,0,e,4),a(t,r,e,n,23,4),e+4}function J(t,r,e,n,i){return i||W(t,0,e,8),a(t,r,e,n,52,8),e+8}w.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),w.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=w.prototype;else{var i=r-t;e=new w(i,void 0);for(var o=0;o<i;++o)e[o]=this[o+t]}return e},w.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||z(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},w.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||z(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},w.prototype.readUInt8=function(t,r){return r||z(t,1,this.length),this[t]},w.prototype.readUInt16LE=function(t,r){return r||z(t,2,this.length),this[t]|this[t+1]<<8},w.prototype.readUInt16BE=function(t,r){return r||z(t,2,this.length),this[t]<<8|this[t+1]},w.prototype.readUInt32LE=function(t,r){return r||z(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},w.prototype.readUInt32BE=function(t,r){return r||z(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},w.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||z(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*r)),n},w.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||z(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*r)),o},w.prototype.readInt8=function(t,r){return r||z(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},w.prototype.readInt16LE=function(t,r){r||z(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},w.prototype.readInt16BE=function(t,r){r||z(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},w.prototype.readInt32LE=function(t,r){return r||z(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},w.prototype.readInt32BE=function(t,r){return r||z(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},w.prototype.readFloatLE=function(t,r){return r||z(t,4,this.length),u(this,t,!0,23,4)},w.prototype.readFloatBE=function(t,r){return r||z(t,4,this.length),u(this,t,!1,23,4)},w.prototype.readDoubleLE=function(t,r){return r||z(t,8,this.length),u(this,t,!0,52,8)},w.prototype.readDoubleBE=function(t,r){return r||z(t,8,this.length),u(this,t,!1,52,8)},w.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||j(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o<e&&(i*=256);)this[r+o]=t/i&255;return r+e},w.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||j(this,t,r,e,Math.pow(2,8*e)-1,0);var i=e-1,o=1;for(this[r+i]=255&t;--i>=0&&(o*=256);)this[r+i]=t/o&255;return r+e},w.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,1,255,0),w.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},w.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,65535,0),w.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):F(this,t,r,!0),r+2},w.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,65535,0),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):F(this,t,r,!1),r+2},w.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,4294967295,0),w.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):q(this,t,r,!0),r+4},w.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,4294967295,0),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):q(this,t,r,!1),r+4},w.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);j(this,t,r,e,i-1,-i)}var o=0,h=1,s=0;for(this[r]=255&t;++o<e&&(h*=256);)t<0&&0===s&&0!==this[r+o-1]&&(s=1),this[r+o]=(t/h>>0)-s&255;return r+e},w.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);j(this,t,r,e,i-1,-i)}var o=e-1,h=1,s=0;for(this[r+o]=255&t;--o>=0&&(h*=256);)t<0&&0===s&&0!==this[r+o+1]&&(s=1),this[r+o]=(t/h>>0)-s&255;return r+e},w.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,1,127,-128),w.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},w.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,32767,-32768),w.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):F(this,t,r,!0),r+2},w.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,32767,-32768),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):F(this,t,r,!1),r+2},w.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,2147483647,-2147483648),w.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):q(this,t,r,!0),r+4},w.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):q(this,t,r,!1),r+4},w.prototype.writeFloatLE=function(t,r,e){return V(this,t,r,!0,e)},w.prototype.writeFloatBE=function(t,r,e){return V(this,t,r,!1,e)},w.prototype.writeDoubleLE=function(t,r,e){return J(this,t,r,!0,e)},w.prototype.writeDoubleBE=function(t,r,e){return J(this,t,r,!1,e)},w.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=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),t.length-r<n-e&&(n=t.length-r+e);var i,o=n-e;if(this===t&&e<r&&r<n)for(i=o-1;i>=0;--i)t[i+r]=this[i+e];else if(o<1e3||!w.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+r]=this[i+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+o),r);return o},w.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!w.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var o;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(o=r;o<e;++o)this[o]=t;else{var h=A(t)?t:G(new w(t,n).toString()),s=h.length;for(o=0;o<e-r;++o)this[o+r]=h[o%s]}return this};var X=/[^+\/0-9A-Za-z-_]/g;function Z(t){return t<16?"0"+t.toString(16):t.toString(16)}function G(t,r){var e;r=r||1/0;for(var n=t.length,i=null,o=[],h=0;h<n;++h){if((e=t.charCodeAt(h))>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(h+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function H(t){return function(t){var r,e,s,f,u,a;o||h();var c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");u="="===t[c-2]?2:"="===t[c-1]?1:0,a=new i(3*c/4-u),s=u>0?c-4:c;var l=0;for(r=0,e=0;r<s;r+=4,e+=3)f=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],a[l++]=f>>16&255,a[l++]=f>>8&255,a[l++]=255&f;return 2===u?(f=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,a[l++]=255&f):1===u&&(f=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,a[l++]=f>>8&255,a[l++]=255&f),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(X,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function K(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function Q(t){return null!=t&&(!!t._isBuffer||$(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&$(t.slice(0,0))}(t))}function $(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var tt=Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:p,Buffer:w,SlowBuffer:function(t){return+t!=t&&(t=0),w.alloc(+t)},isBuffer:Q}),rt=r((function(t,r){var e=tt.Buffer;function n(t,r){for(var e in t)r[e]=t[e]}function i(t,r,n){return e(t,r,n)}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?t.exports=tt:(n(tt,r),r.Buffer=i),i.prototype=Object.create(e.prototype),n(e,i),i.from=function(t,r,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return e(t,r,n)},i.alloc=function(t,r,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=e(t);return void 0!==r?"string"==typeof n?i.fill(r,n):i.fill(r):i.fill(0),i},i.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return e(t)},i.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return tt.SlowBuffer(t)}}));rt.Buffer;var et=rt.Buffer;var nt,it=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),e=0;e<r.length;e++)r[e]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),o=i.charCodeAt(0);if(255!==r[o])throw new TypeError(i+" is ambiguous");r[o]=n}var h=t.length,s=t.charAt(0),f=Math.log(h)/Math.log(256),u=Math.log(256)/Math.log(h);function a(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return et.alloc(0);var e=0;if(" "!==t[e]){for(var n=0,i=0;t[e]===s;)n++,e++;for(var o=(t.length-e)*f+1>>>0,u=new Uint8Array(o);t[e];){var a=r[t.charCodeAt(e)];if(255===a)return;for(var c=0,l=o-1;(0!==a||c<i)&&-1!==l;l--,c++)a+=h*u[l]>>>0,u[l]=a%256>>>0,a=a/256>>>0;if(0!==a)throw new Error("Non-zero carry");i=c,e++}if(" "!==t[e]){for(var p=o-i;p!==o&&0===u[p];)p++;var _=et.allocUnsafe(n+(o-p));_.fill(0,0,n);for(var g=n;p!==o;)_[g++]=u[p++];return _}}}return{encode:function(r){if((Array.isArray(r)||r instanceof Uint8Array)&&(r=et.from(r)),!et.isBuffer(r))throw new TypeError("Expected Buffer");if(0===r.length)return"";for(var e=0,n=0,i=0,o=r.length;i!==o&&0===r[i];)i++,e++;for(var f=(o-i)*u+1>>>0,a=new Uint8Array(f);i!==o;){for(var c=r[i],l=0,p=f-1;(0!==c||l<n)&&-1!==p;p--,l++)c+=256*a[p]>>>0,a[p]=c%h>>>0,c=c/h>>>0;if(0!==c)throw new Error("Non-zero carry");n=l,i++}for(var _=f-n;_!==f&&0===a[_];)_++;for(var g=s.repeat(e);_<f;++_)g+=t.charAt(a[_]);return g},decodeUnsafe:a,decode:function(t){var r=a(t);if(r)return r;throw new Error("Non-base"+h+" character")}}},ot=r((function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const e="qpzry9x8gf2tvdw0s3jn54khce6mua7l",n={};for(let t=0;t<e.length;t++){const r=e.charAt(t);n[r]=t}function i(t){const r=t>>25;return(33554431&t)<<5^996825010&-(r>>0&1)^642813549&-(r>>1&1)^513874426&-(r>>2&1)^1027748829&-(r>>3&1)^705979059&-(r>>4&1)}function o(t){let r=1;for(let e=0;e<t.length;++e){const n=t.charCodeAt(e);if(n<33||n>126)return"Invalid prefix ("+t+")";r=i(r)^n>>5}r=i(r);for(let e=0;e<t.length;++e){const n=t.charCodeAt(e);r=i(r)^31&n}return r}function h(t,r,e,n){let i=0,o=0;const h=(1<<e)-1,s=[];for(let n=0;n<t.length;++n)for(i=i<<r|t[n],o+=r;o>=e;)o-=e,s.push(i>>o&h);if(n)o>0&&s.push(i<<e-o&h);else{if(o>=r)return"Excess padding";if(i<<e-o&h)return"Non-zero padding"}return s}function s(t){return h(t,8,5,!0)}function f(t){const r=h(t,5,8,!1);if(Array.isArray(r))return r}function u(t){const r=h(t,5,8,!1);if(Array.isArray(r))return r;throw new Error(r)}function a(t){let r;function h(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";const h=t.toLowerCase(),s=t.toUpperCase();if(t!==h&&t!==s)return"Mixed-case string "+t;const f=(t=h).lastIndexOf("1");if(-1===f)return"No separator character for "+t;if(0===f)return"Missing prefix for "+t;const u=t.slice(0,f),a=t.slice(f+1);if(a.length<6)return"Data too short";let c=o(u);if("string"==typeof c)return c;const l=[];for(let t=0;t<a.length;++t){const r=a.charAt(t),e=n[r];if(void 0===e)return"Unknown character "+r;c=i(c)^e,t+6>=a.length||l.push(e)}return c!==r?"Invalid checksum for "+t:{prefix:u,words:l}}return r="bech32"===t?1:734539939,{decodeUnsafe:function(t,r){const e=h(t,r);if("object"==typeof e)return e},decode:function(t,r){const e=h(t,r);if("object"==typeof e)return e;throw new Error(e)},encode:function(t,n,h){if(h=h||90,t.length+7+n.length>h)throw new TypeError("Exceeds length limit");let s=o(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let f=t+"1";for(let t=0;t<n.length;++t){const r=n[t];if(r>>5!=0)throw new Error("Non 5-bit word");s=i(s)^r,f+=e.charAt(r)}for(let t=0;t<6;++t)s=i(s);s^=r;for(let t=0;t<6;++t){f+=e.charAt(s>>5*(5-t)&31)}return f},toWords:s,fromWordsUnsafe:f,fromWords:u}}r.bech32=a("bech32"),r.bech32m=a("bech32m")}));(nt=ot)&&nt.__esModule&&Object.prototype.hasOwnProperty.call(nt,"default")&&nt.default,ot.bech32m;var ht=ot.bech32,st=r((function(t){"function"==typeof Object.create?t.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,r){if(r){t.super_=r;var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t}}})),ft=rt.Buffer;function ut(t,r){this._block=ft.alloc(t),this._finalSize=r,this._blockSize=t,this._len=0}ut.prototype.update=function(t,r){"string"==typeof t&&(r=r||"utf8",t=ft.from(t,r));for(var e=this._block,n=this._blockSize,i=t.length,o=this._len,h=0;h<i;){for(var s=o%n,f=Math.min(i-h,n-s),u=0;u<f;u++)e[s+u]=t[h+u];h+=f,(o+=f)%n==0&&this._update(e)}return this._len+=i,this},ut.prototype.digest=function(t){var r=this._len%this._blockSize;this._block[r]=128,this._block.fill(0,r+1),r>=this._finalSize&&(this._update(this._block),this._block.fill(0));var e=8*this._len;if(e<=4294967295)this._block.writeUInt32BE(e,this._blockSize-4);else{var n=(4294967295&e)>>>0,i=(e-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},ut.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var at=ut,ct=rt.Buffer,lt=[1518500249,1859775393,-1894007588,-899497514],pt=new Array(80);function _t(){this.init(),this._w=pt,at.call(this,64,56)}function gt(t){return t<<30|t>>>2}function wt(t,r,e,n){return 0===t?r&e|~r&n:2===t?r&e|r&n|e&n:r^e^n}st(_t,at),_t.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},_t.prototype._update=function(t){for(var r,e=this._w,n=0|this._a,i=0|this._b,o=0|this._c,h=0|this._d,s=0|this._e,f=0;f<16;++f)e[f]=t.readInt32BE(4*f);for(;f<80;++f)e[f]=e[f-3]^e[f-8]^e[f-14]^e[f-16];for(var u=0;u<80;++u){var a=~~(u/20),c=0|((r=n)<<5|r>>>27)+wt(a,i,o,h)+s+e[u]+lt[a];s=h,h=o,o=gt(i),i=n,n=c}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=h+this._d|0,this._e=s+this._e|0},_t.prototype._hash=function(){var t=ct.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var dt=_t,yt=rt.Buffer,vt=[1518500249,1859775393,-1894007588,-899497514],bt=new Array(80);function Et(){this.init(),this._w=bt,at.call(this,64,56)}function At(t){return t<<5|t>>>27}function mt(t){return t<<30|t>>>2}function Bt(t,r,e,n){return 0===t?r&e|~r&n:2===t?r&e|r&n|e&n:r^e^n}st(Et,at),Et.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Et.prototype._update=function(t){for(var r,e=this._w,n=0|this._a,i=0|this._b,o=0|this._c,h=0|this._d,s=0|this._e,f=0;f<16;++f)e[f]=t.readInt32BE(4*f);for(;f<80;++f)e[f]=(r=e[f-3]^e[f-8]^e[f-14]^e[f-16])<<1|r>>>31;for(var u=0;u<80;++u){var a=~~(u/20),c=At(n)+Bt(a,i,o,h)+s+e[u]+vt[a]|0;s=h,h=o,o=mt(i),i=n,n=c}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=h+this._d|0,this._e=s+this._e|0},Et.prototype._hash=function(){var t=yt.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var It=Et,Rt=rt.Buffer,Ut=[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],Tt=new Array(64);function Pt(){this.init(),this._w=Tt,at.call(this,64,56)}function St(t,r,e){return e^t&(r^e)}function kt(t,r,e){return t&r|e&(t|r)}function Yt(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function xt(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function Ct(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function Ot(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}st(Pt,at),Pt.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},Pt.prototype._update=function(t){for(var r=this._w,e=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,h=0|this._e,s=0|this._f,f=0|this._g,u=0|this._h,a=0;a<16;++a)r[a]=t.readInt32BE(4*a);for(;a<64;++a)r[a]=Ot(r[a-2])+r[a-7]+Ct(r[a-15])+r[a-16]|0;for(var c=0;c<64;++c){var l=u+xt(h)+St(h,s,f)+Ut[c]+r[c]|0,p=Yt(e)+kt(e,n,i)|0;u=f,f=s,s=h,h=o+l|0,o=i,i=n,n=e,e=l+p|0}this._a=e+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=h+this._e|0,this._f=s+this._f|0,this._g=f+this._g|0,this._h=u+this._h|0},Pt.prototype._hash=function(){var t=Rt.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t};var Mt=Pt,Lt=rt.Buffer,Dt=new Array(64);function Nt(){this.init(),this._w=Dt,at.call(this,64,56)}st(Nt,Mt),Nt.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},Nt.prototype._hash=function(){var t=Lt.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t};var zt=Nt,jt=rt.Buffer,Ft=[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],qt=new Array(160);function Wt(){this.init(),this._w=qt,at.call(this,128,112)}function Vt(t,r,e){return e^t&(r^e)}function Jt(t,r,e){return t&r|e&(t|r)}function Xt(t,r){return(t>>>28|r<<4)^(r>>>2|t<<30)^(r>>>7|t<<25)}function Zt(t,r){return(t>>>14|r<<18)^(t>>>18|r<<14)^(r>>>9|t<<23)}function Gt(t,r){return(t>>>1|r<<31)^(t>>>8|r<<24)^t>>>7}function Ht(t,r){return(t>>>1|r<<31)^(t>>>8|r<<24)^(t>>>7|r<<25)}function Kt(t,r){return(t>>>19|r<<13)^(r>>>29|t<<3)^t>>>6}function Qt(t,r){return(t>>>19|r<<13)^(r>>>29|t<<3)^(t>>>6|r<<26)}function $t(t,r){return t>>>0<r>>>0?1:0}st(Wt,at),Wt.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},Wt.prototype._update=function(t){for(var r=this._w,e=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,h=0|this._eh,s=0|this._fh,f=0|this._gh,u=0|this._hh,a=0|this._al,c=0|this._bl,l=0|this._cl,p=0|this._dl,_=0|this._el,g=0|this._fl,w=0|this._gl,d=0|this._hl,y=0;y<32;y+=2)r[y]=t.readInt32BE(4*y),r[y+1]=t.readInt32BE(4*y+4);for(;y<160;y+=2){var v=r[y-30],b=r[y-30+1],E=Gt(v,b),A=Ht(b,v),m=Kt(v=r[y-4],b=r[y-4+1]),B=Qt(b,v),I=r[y-14],R=r[y-14+1],U=r[y-32],T=r[y-32+1],P=A+R|0,S=E+I+$t(P,A)|0;S=(S=S+m+$t(P=P+B|0,B)|0)+U+$t(P=P+T|0,T)|0,r[y]=S,r[y+1]=P}for(var k=0;k<160;k+=2){S=r[k],P=r[k+1];var Y=Jt(e,n,i),x=Jt(a,c,l),C=Xt(e,a),O=Xt(a,e),M=Zt(h,_),L=Zt(_,h),D=Ft[k],N=Ft[k+1],z=Vt(h,s,f),j=Vt(_,g,w),F=d+L|0,q=u+M+$t(F,d)|0;q=(q=(q=q+z+$t(F=F+j|0,j)|0)+D+$t(F=F+N|0,N)|0)+S+$t(F=F+P|0,P)|0;var W=O+x|0,V=C+Y+$t(W,O)|0;u=f,d=w,f=s,w=g,s=h,g=_,h=o+q+$t(_=p+F|0,p)|0,o=i,p=l,i=n,l=c,n=e,c=a,e=q+V+$t(a=F+W|0,F)|0}this._al=this._al+a|0,this._bl=this._bl+c|0,this._cl=this._cl+l|0,this._dl=this._dl+p|0,this._el=this._el+_|0,this._fl=this._fl+g|0,this._gl=this._gl+w|0,this._hl=this._hl+d|0,this._ah=this._ah+e+$t(this._al,a)|0,this._bh=this._bh+n+$t(this._bl,c)|0,this._ch=this._ch+i+$t(this._cl,l)|0,this._dh=this._dh+o+$t(this._dl,p)|0,this._eh=this._eh+h+$t(this._el,_)|0,this._fh=this._fh+s+$t(this._fl,g)|0,this._gh=this._gh+f+$t(this._gl,w)|0,this._hh=this._hh+u+$t(this._hl,d)|0},Wt.prototype._hash=function(){var t=jt.allocUnsafe(64);function r(r,e,n){t.writeInt32BE(r,n),t.writeInt32BE(e,n+4)}return r(this._ah,this._al,0),r(this._bh,this._bl,8),r(this._ch,this._cl,16),r(this._dh,this._dl,24),r(this._eh,this._el,32),r(this._fh,this._fl,40),r(this._gh,this._gl,48),r(this._hh,this._hl,56),t};var tr=Wt,rr=rt.Buffer,er=new Array(160);function nr(){this.init(),this._w=er,at.call(this,128,112)}st(nr,tr),nr.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},nr.prototype._hash=function(){var t=rr.allocUnsafe(48);function r(r,e,n){t.writeInt32BE(r,n),t.writeInt32BE(e,n+4)}return r(this._ah,this._al,0),r(this._bh,this._bl,8),r(this._ch,this._cl,16),r(this._dh,this._dl,24),r(this._eh,this._el,32),r(this._fh,this._fl,40),t};var ir,or,hr=nr,sr=r((function(t){var r=t.exports=function(t){t=t.toLowerCase();var e=r[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};r.sha=dt,r.sha1=It,r.sha224=zt,r.sha256=Mt,r.sha384=hr,r.sha512=tr})),fr=it("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),ur=function(t){return w.from(sr("sha256").update(t).digest())};!function(t){t.mainnet="mainnet",t.testnet="testnet",t.regtest="regtest"}(ir||(ir={})),function(t){t.p2pkh="p2pkh",t.p2sh="p2sh",t.p2wpkh="p2wpkh",t.p2wsh="p2wsh"}(or||(or={}));var ar={0:{type:or.p2pkh,network:ir.mainnet},111:{type:or.p2pkh,network:ir.testnet},5:{type:or.p2sh,network:ir.mainnet},196:{type:or.p2sh,network:ir.testnet}},cr=function(r){var e,n=r.substr(0,2).toLowerCase();if("bc"===n||"tb"===n)return function(t){var r;try{r=ht.decode(t)}catch(t){throw new Error("Invalid address")}var e={bc:ir.mainnet,tb:ir.testnet,bcrt:ir.regtest}[r.prefix];if(void 0===e)throw new Error("Invalid address");var n=r.words[0];if(n<0||n>16)throw new Error("Invalid address");return{bech32:!0,network:e,address:t,type:20===ht.fromWords(r.words.slice(1)).length?or.p2wpkh:or.p2wsh}}(r);try{e=fr.decode(r)}catch(t){throw new Error("Invalid address")}var i=e.length;if(25!==i)throw new Error("Invalid address");var o=e.readUInt8(0),h=e.slice(i-4,i),s=e.slice(0,i-4),f=ur(ur(s)).slice(0,4);if(!h.equals(f))throw new Error("Invalid address");if(!Object.keys(ar).map(Number).includes(o))throw new Error("Invalid address");return t(t({},ar[o]),{address:r,bech32:!1})},lr=function(t,r){try{var e=cr(t);return!r||r===e.network}catch(t){return!1}};export default lr;export{ir as Network,cr as getAddressInfo,lr as validate}; | ||
var t=function(){return t=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var i in r=arguments[e])Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i]);return t},t.apply(this,arguments)};function r(t,r){return t(r={exports:{}},r.exports),r.exports}var e=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o=!1;function h(){o=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,i=t.length;r<i;++r)e[r]=t[r],n[t.charCodeAt(r)]=r;n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63}function s(t,r,n){for(var i,o,h=[],s=r;s<n;s+=3)i=(t[s]<<16)+(t[s+1]<<8)+t[s+2],h.push(e[(o=i)>>18&63]+e[o>>12&63]+e[o>>6&63]+e[63&o]);return h.join("")}function f(t){var r;o||h();for(var n=t.length,i=n%3,f="",u=[],a=16383,c=0,l=n-i;c<l;c+=a)u.push(s(t,c,c+a>l?l:c+a));return 1===i?(r=t[n-1],f+=e[r>>2],f+=e[r<<4&63],f+="=="):2===i&&(r=(t[n-2]<<8)+t[n-1],f+=e[r>>10],f+=e[r>>4&63],f+=e[r<<2&63],f+="="),u.push(f),u.join("")}function u(t,r,e,n,i){var o,h,s=8*i-n-1,f=(1<<s)-1,u=f>>1,a=-7,c=e?i-1:0,l=e?-1:1,p=t[r+c];for(c+=l,o=p&(1<<-a)-1,p>>=-a,a+=s;a>0;o=256*o+t[r+c],c+=l,a-=8);for(h=o&(1<<-a)-1,o>>=-a,a+=n;a>0;h=256*h+t[r+c],c+=l,a-=8);if(0===o)o=1-u;else{if(o===f)return h?NaN:1/0*(p?-1:1);h+=Math.pow(2,n),o-=u}return(p?-1:1)*h*Math.pow(2,o-n)}function a(t,r,e,n,i,o){var h,s,f,u=8*o-i-1,a=(1<<u)-1,c=a>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,_=n?1:-1,g=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(s=isNaN(r)?1:0,h=a):(h=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-h))<1&&(h--,f*=2),(r+=h+c>=1?l/f:l*Math.pow(2,1-c))*f>=2&&(h++,f/=2),h+c>=a?(s=0,h=a):h+c>=1?(s=(r*f-1)*Math.pow(2,i),h+=c):(s=r*Math.pow(2,c-1)*Math.pow(2,i),h=0));i>=8;t[e+p]=255&s,p+=_,s/=256,i-=8);for(h=h<<i|s,u+=i;u>0;t[e+p]=255&h,p+=_,h/=256,u-=8);t[e+p-_]|=128*g}var c={}.toString,l=Array.isArray||function(t){return"[object Array]"==c.call(t)};w.TYPED_ARRAY_SUPPORT=void 0===global.TYPED_ARRAY_SUPPORT||global.TYPED_ARRAY_SUPPORT;var p=_();function _(){return w.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function g(t,r){if(_()<r)throw new RangeError("Invalid typed array length");return w.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=w.prototype:(null===t&&(t=new w(r)),t.length=r),t}function w(t,r,e){if(!(w.TYPED_ARRAY_SUPPORT||this instanceof w))return new w(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return v(this,t)}return d(this,t,r,e)}function d(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n);w.TYPED_ARRAY_SUPPORT?(t=r).__proto__=w.prototype:t=b(t,r);return t}(t,r,e,n):"string"==typeof r?function(t,r,e){"string"==typeof e&&""!==e||(e="utf8");if(!w.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|m(r,e),i=(t=g(t,n)).write(r,e);i!==n&&(t=t.slice(0,i));return t}(t,r,e):function(t,r){if(A(r)){var e=0|E(r.length);return 0===(t=g(t,e)).length||r.copy(t,0,0,e),t}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(n=r.length)!=n?g(t,0):b(t,r);if("Buffer"===r.type&&l(r.data))return b(t,r.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function y(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function v(t,r){if(y(r),t=g(t,r<0?0:0|E(r)),!w.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function b(t,r){var e=r.length<0?0:0|E(r.length);t=g(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function E(t){if(t>=_())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_().toString(16)+" bytes");return 0|t}function A(t){return!(null==t||!t._isBuffer)}function m(t,r){if(A(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return H(t).length;default:if(n)return G(t).length;r=(""+r).toLowerCase(),n=!0}}function B(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return D(this,r,e);case"utf8":case"utf-8":return x(this,r,e);case"ascii":return M(this,r,e);case"latin1":case"binary":return L(this,r,e);case"base64":return O(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function I(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function R(t,r,e,n,i){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0){if(!i)return-1;e=0}if("string"==typeof r&&(r=w.from(r,n)),A(r))return 0===r.length?-1:U(t,r,e,n,i);if("number"==typeof r)return r&=255,w.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):U(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function U(t,r,e,n,i){var o,h=1,s=t.length,f=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;h=2,s/=2,f/=2,e/=2}function u(t,r){return 1===h?t[r]:t.readUInt16BE(r*h)}if(i){var a=-1;for(o=e;o<s;o++)if(u(t,o)===u(r,-1===a?0:o-a)){if(-1===a&&(a=o),o-a+1===f)return a*h}else-1!==a&&(o-=o-a),a=-1}else for(e+f>s&&(e=s-f),o=e;o>=0;o--){for(var c=!0,l=0;l<f;l++)if(u(t,o+l)!==u(r,l)){c=!1;break}if(c)return o}return-1}function T(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n))>i&&(n=i):n=i;var o=r.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var h=0;h<n;++h){var s=parseInt(r.substr(2*h,2),16);if(isNaN(s))return h;t[e+h]=s}return h}function P(t,r,e,n){return K(G(r,t.length-e),t,e,n)}function S(t,r,e,n){return K(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function k(t,r,e,n){return S(t,r,e,n)}function Y(t,r,e,n){return K(H(r),t,e,n)}function C(t,r,e,n){return K(function(t,r){for(var e,n,i,o=[],h=0;h<t.length&&!((r-=2)<0);++h)n=(e=t.charCodeAt(h))>>8,i=e%256,o.push(i),o.push(n);return o}(r,t.length-e),t,e,n)}function O(t,r,e){return 0===r&&e===t.length?f(t):f(t.slice(r,e))}function x(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o,h,s,f,u=t[i],a=null,c=u>239?4:u>223?3:u>191?2:1;if(i+c<=e)switch(c){case 1:u<128&&(a=u);break;case 2:128==(192&(o=t[i+1]))&&(f=(31&u)<<6|63&o)>127&&(a=f);break;case 3:o=t[i+1],h=t[i+2],128==(192&o)&&128==(192&h)&&(f=(15&u)<<12|(63&o)<<6|63&h)>2047&&(f<55296||f>57343)&&(a=f);break;case 4:o=t[i+1],h=t[i+2],s=t[i+3],128==(192&o)&&128==(192&h)&&128==(192&s)&&(f=(15&u)<<18|(63&o)<<12|(63&h)<<6|63&s)>65535&&f<1114112&&(a=f)}null===a?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=c}return function(t){var r=t.length;if(r<=4096)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return e}(n)}w.poolSize=8192,w._augment=function(t){return t.__proto__=w.prototype,t},w.from=function(t,r,e){return d(null,t,r,e)},w.TYPED_ARRAY_SUPPORT&&(w.prototype.__proto__=Uint8Array.prototype,w.__proto__=Uint8Array),w.alloc=function(t,r,e){return function(t,r,e,n){return y(r),r<=0?g(t,r):void 0!==e?"string"==typeof n?g(t,r).fill(e,n):g(t,r).fill(e):g(t,r)}(null,t,r,e)},w.allocUnsafe=function(t){return v(null,t)},w.allocUnsafeSlow=function(t){return v(null,t)},w.isBuffer=Q,w.compare=function(t,r){if(!A(t)||!A(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,i=0,o=Math.min(e,n);i<o;++i)if(t[i]!==r[i]){e=t[i],n=r[i];break}return e<n?-1:n<e?1:0},w.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},w.concat=function(t,r){if(!l(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return w.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=w.allocUnsafe(r),i=0;for(e=0;e<t.length;++e){var o=t[e];if(!A(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},w.byteLength=m,w.prototype._isBuffer=!0,w.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)I(this,r,r+1);return this},w.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)I(this,r,r+3),I(this,r+1,r+2);return this},w.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)I(this,r,r+7),I(this,r+1,r+6),I(this,r+2,r+5),I(this,r+3,r+4);return this},w.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?x(this,0,t):B.apply(this,arguments)},w.prototype.equals=function(t){if(!A(t))throw new TypeError("Argument must be a Buffer");return this===t||0===w.compare(this,t)},w.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},w.prototype.compare=function(t,r,e,n,i){if(!A(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),r<0||e>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&r>=e)return 0;if(n>=i)return-1;if(r>=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),h=(e>>>=0)-(r>>>=0),s=Math.min(o,h),f=this.slice(n,i),u=t.slice(r,e),a=0;a<s;++a)if(f[a]!==u[a]){o=f[a],h=u[a];break}return o<h?-1:h<o?1:0},w.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},w.prototype.indexOf=function(t,r,e){return R(this,t,r,e,!0)},w.prototype.lastIndexOf=function(t,r,e){return R(this,t,r,e,!1)},w.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return T(this,t,r,e);case"utf8":case"utf-8":return P(this,t,r,e);case"ascii":return S(this,t,r,e);case"latin1":case"binary":return k(this,t,r,e);case"base64":return Y(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},w.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function M(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(127&t[i]);return n}function L(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function D(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=Z(t[o]);return i}function N(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function z(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function j(t,r,e,n,i,o){if(!A(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function F(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function W(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>8*(n?i:3-i)&255}function q(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function V(t,r,e,n,i){return i||q(t,0,e,4),a(t,r,e,n,23,4),e+4}function J(t,r,e,n,i){return i||q(t,0,e,8),a(t,r,e,n,52,8),e+8}w.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),w.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=w.prototype;else{var i=r-t;e=new w(i,void 0);for(var o=0;o<i;++o)e[o]=this[o+t]}return e},w.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||z(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},w.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||z(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},w.prototype.readUInt8=function(t,r){return r||z(t,1,this.length),this[t]},w.prototype.readUInt16LE=function(t,r){return r||z(t,2,this.length),this[t]|this[t+1]<<8},w.prototype.readUInt16BE=function(t,r){return r||z(t,2,this.length),this[t]<<8|this[t+1]},w.prototype.readUInt32LE=function(t,r){return r||z(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},w.prototype.readUInt32BE=function(t,r){return r||z(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},w.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||z(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*r)),n},w.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||z(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*r)),o},w.prototype.readInt8=function(t,r){return r||z(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},w.prototype.readInt16LE=function(t,r){r||z(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},w.prototype.readInt16BE=function(t,r){r||z(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},w.prototype.readInt32LE=function(t,r){return r||z(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},w.prototype.readInt32BE=function(t,r){return r||z(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},w.prototype.readFloatLE=function(t,r){return r||z(t,4,this.length),u(this,t,!0,23,4)},w.prototype.readFloatBE=function(t,r){return r||z(t,4,this.length),u(this,t,!1,23,4)},w.prototype.readDoubleLE=function(t,r){return r||z(t,8,this.length),u(this,t,!0,52,8)},w.prototype.readDoubleBE=function(t,r){return r||z(t,8,this.length),u(this,t,!1,52,8)},w.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||j(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o<e&&(i*=256);)this[r+o]=t/i&255;return r+e},w.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||j(this,t,r,e,Math.pow(2,8*e)-1,0);var i=e-1,o=1;for(this[r+i]=255&t;--i>=0&&(o*=256);)this[r+i]=t/o&255;return r+e},w.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,1,255,0),w.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},w.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,65535,0),w.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):F(this,t,r,!0),r+2},w.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,65535,0),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):F(this,t,r,!1),r+2},w.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,4294967295,0),w.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):W(this,t,r,!0),r+4},w.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,4294967295,0),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):W(this,t,r,!1),r+4},w.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);j(this,t,r,e,i-1,-i)}var o=0,h=1,s=0;for(this[r]=255&t;++o<e&&(h*=256);)t<0&&0===s&&0!==this[r+o-1]&&(s=1),this[r+o]=(t/h>>0)-s&255;return r+e},w.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);j(this,t,r,e,i-1,-i)}var o=e-1,h=1,s=0;for(this[r+o]=255&t;--o>=0&&(h*=256);)t<0&&0===s&&0!==this[r+o+1]&&(s=1),this[r+o]=(t/h>>0)-s&255;return r+e},w.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,1,127,-128),w.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},w.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,32767,-32768),w.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):F(this,t,r,!0),r+2},w.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,32767,-32768),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):F(this,t,r,!1),r+2},w.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,2147483647,-2147483648),w.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):W(this,t,r,!0),r+4},w.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),w.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):W(this,t,r,!1),r+4},w.prototype.writeFloatLE=function(t,r,e){return V(this,t,r,!0,e)},w.prototype.writeFloatBE=function(t,r,e){return V(this,t,r,!1,e)},w.prototype.writeDoubleLE=function(t,r,e){return J(this,t,r,!0,e)},w.prototype.writeDoubleBE=function(t,r,e){return J(this,t,r,!1,e)},w.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=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),t.length-r<n-e&&(n=t.length-r+e);var i,o=n-e;if(this===t&&e<r&&r<n)for(i=o-1;i>=0;--i)t[i+r]=this[i+e];else if(o<1e3||!w.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+r]=this[i+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+o),r);return o},w.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!w.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var o;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(o=r;o<e;++o)this[o]=t;else{var h=A(t)?t:G(new w(t,n).toString()),s=h.length;for(o=0;o<e-r;++o)this[o+r]=h[o%s]}return this};var X=/[^+\/0-9A-Za-z-_]/g;function Z(t){return t<16?"0"+t.toString(16):t.toString(16)}function G(t,r){var e;r=r||1/0;for(var n=t.length,i=null,o=[],h=0;h<n;++h){if((e=t.charCodeAt(h))>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(h+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function H(t){return function(t){var r,e,s,f,u,a;o||h();var c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");u="="===t[c-2]?2:"="===t[c-1]?1:0,a=new i(3*c/4-u),s=u>0?c-4:c;var l=0;for(r=0,e=0;r<s;r+=4,e+=3)f=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],a[l++]=f>>16&255,a[l++]=f>>8&255,a[l++]=255&f;return 2===u?(f=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,a[l++]=255&f):1===u&&(f=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,a[l++]=f>>8&255,a[l++]=255&f),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(X,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function K(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function Q(t){return null!=t&&(!!t._isBuffer||$(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&$(t.slice(0,0))}(t))}function $(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var tt=Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:p,Buffer:w,SlowBuffer:function(t){return+t!=t&&(t=0),w.alloc(+t)},isBuffer:Q}),rt=r((function(t,r){ | ||
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ | ||
var e=tt.Buffer;function n(t,r){for(var e in t)r[e]=t[e]}function i(t,r,n){return e(t,r,n)}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?t.exports=tt:(n(tt,r),r.Buffer=i),i.prototype=Object.create(e.prototype),n(e,i),i.from=function(t,r,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return e(t,r,n)},i.alloc=function(t,r,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=e(t);return void 0!==r?"string"==typeof n?i.fill(r,n):i.fill(r):i.fill(0),i},i.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return e(t)},i.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return tt.SlowBuffer(t)}}));rt.Buffer;var et=rt.Buffer;var nt,it=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),e=0;e<r.length;e++)r[e]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),o=i.charCodeAt(0);if(255!==r[o])throw new TypeError(i+" is ambiguous");r[o]=n}var h=t.length,s=t.charAt(0),f=Math.log(h)/Math.log(256),u=Math.log(256)/Math.log(h);function a(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return et.alloc(0);for(var e=0,n=0,i=0;t[e]===s;)n++,e++;for(var o=(t.length-e)*f+1>>>0,u=new Uint8Array(o);t[e];){var a=r[t.charCodeAt(e)];if(255===a)return;for(var c=0,l=o-1;(0!==a||c<i)&&-1!==l;l--,c++)a+=h*u[l]>>>0,u[l]=a%256>>>0,a=a/256>>>0;if(0!==a)throw new Error("Non-zero carry");i=c,e++}for(var p=o-i;p!==o&&0===u[p];)p++;var _=et.allocUnsafe(n+(o-p));_.fill(0,0,n);for(var g=n;p!==o;)_[g++]=u[p++];return _}return{encode:function(r){if((Array.isArray(r)||r instanceof Uint8Array)&&(r=et.from(r)),!et.isBuffer(r))throw new TypeError("Expected Buffer");if(0===r.length)return"";for(var e=0,n=0,i=0,o=r.length;i!==o&&0===r[i];)i++,e++;for(var f=(o-i)*u+1>>>0,a=new Uint8Array(f);i!==o;){for(var c=r[i],l=0,p=f-1;(0!==c||l<n)&&-1!==p;p--,l++)c+=256*a[p]>>>0,a[p]=c%h>>>0,c=c/h>>>0;if(0!==c)throw new Error("Non-zero carry");n=l,i++}for(var _=f-n;_!==f&&0===a[_];)_++;for(var g=s.repeat(e);_<f;++_)g+=t.charAt(a[_]);return g},decodeUnsafe:a,decode:function(t){var r=a(t);if(r)return r;throw new Error("Non-base"+h+" character")}}},ot=r((function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const e="qpzry9x8gf2tvdw0s3jn54khce6mua7l",n={};for(let t=0;t<e.length;t++){const r=e.charAt(t);n[r]=t}function i(t){const r=t>>25;return(33554431&t)<<5^996825010&-(r>>0&1)^642813549&-(r>>1&1)^513874426&-(r>>2&1)^1027748829&-(r>>3&1)^705979059&-(r>>4&1)}function o(t){let r=1;for(let e=0;e<t.length;++e){const n=t.charCodeAt(e);if(n<33||n>126)return"Invalid prefix ("+t+")";r=i(r)^n>>5}r=i(r);for(let e=0;e<t.length;++e){const n=t.charCodeAt(e);r=i(r)^31&n}return r}function h(t,r,e,n){let i=0,o=0;const h=(1<<e)-1,s=[];for(let n=0;n<t.length;++n)for(i=i<<r|t[n],o+=r;o>=e;)o-=e,s.push(i>>o&h);if(n)o>0&&s.push(i<<e-o&h);else{if(o>=r)return"Excess padding";if(i<<e-o&h)return"Non-zero padding"}return s}function s(t){return h(t,8,5,!0)}function f(t){const r=h(t,5,8,!1);if(Array.isArray(r))return r}function u(t){const r=h(t,5,8,!1);if(Array.isArray(r))return r;throw new Error(r)}function a(t){let r;function h(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";const h=t.toLowerCase(),s=t.toUpperCase();if(t!==h&&t!==s)return"Mixed-case string "+t;const f=(t=h).lastIndexOf("1");if(-1===f)return"No separator character for "+t;if(0===f)return"Missing prefix for "+t;const u=t.slice(0,f),a=t.slice(f+1);if(a.length<6)return"Data too short";let c=o(u);if("string"==typeof c)return c;const l=[];for(let t=0;t<a.length;++t){const r=a.charAt(t),e=n[r];if(void 0===e)return"Unknown character "+r;c=i(c)^e,t+6>=a.length||l.push(e)}return c!==r?"Invalid checksum for "+t:{prefix:u,words:l}}return r="bech32"===t?1:734539939,{decodeUnsafe:function(t,r){const e=h(t,r);if("object"==typeof e)return e},decode:function(t,r){const e=h(t,r);if("object"==typeof e)return e;throw new Error(e)},encode:function(t,n,h){if(h=h||90,t.length+7+n.length>h)throw new TypeError("Exceeds length limit");let s=o(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let f=t+"1";for(let t=0;t<n.length;++t){const r=n[t];if(r>>5!=0)throw new Error("Non 5-bit word");s=i(s)^r,f+=e.charAt(r)}for(let t=0;t<6;++t)s=i(s);s^=r;for(let t=0;t<6;++t){f+=e.charAt(s>>5*(5-t)&31)}return f},toWords:s,fromWordsUnsafe:f,fromWords:u}}r.bech32=a("bech32"),r.bech32m=a("bech32m")}));(nt=ot)&&nt.__esModule&&Object.prototype.hasOwnProperty.call(nt,"default")&&nt.default;var ht=ot.bech32m,st=ot.bech32,ft=r((function(t){"function"==typeof Object.create?t.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,r){if(r){t.super_=r;var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t}}})),ut=rt.Buffer;function at(t,r){this._block=ut.alloc(t),this._finalSize=r,this._blockSize=t,this._len=0}at.prototype.update=function(t,r){"string"==typeof t&&(r=r||"utf8",t=ut.from(t,r));for(var e=this._block,n=this._blockSize,i=t.length,o=this._len,h=0;h<i;){for(var s=o%n,f=Math.min(i-h,n-s),u=0;u<f;u++)e[s+u]=t[h+u];h+=f,(o+=f)%n==0&&this._update(e)}return this._len+=i,this},at.prototype.digest=function(t){var r=this._len%this._blockSize;this._block[r]=128,this._block.fill(0,r+1),r>=this._finalSize&&(this._update(this._block),this._block.fill(0));var e=8*this._len;if(e<=4294967295)this._block.writeUInt32BE(e,this._blockSize-4);else{var n=(4294967295&e)>>>0,i=(e-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},at.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var ct=at,lt=rt.Buffer,pt=[1518500249,1859775393,-1894007588,-899497514],_t=new Array(80);function gt(){this.init(),this._w=_t,ct.call(this,64,56)}function wt(t){return t<<30|t>>>2}function dt(t,r,e,n){return 0===t?r&e|~r&n:2===t?r&e|r&n|e&n:r^e^n}ft(gt,ct),gt.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},gt.prototype._update=function(t){for(var r,e=this._w,n=0|this._a,i=0|this._b,o=0|this._c,h=0|this._d,s=0|this._e,f=0;f<16;++f)e[f]=t.readInt32BE(4*f);for(;f<80;++f)e[f]=e[f-3]^e[f-8]^e[f-14]^e[f-16];for(var u=0;u<80;++u){var a=~~(u/20),c=0|((r=n)<<5|r>>>27)+dt(a,i,o,h)+s+e[u]+pt[a];s=h,h=o,o=wt(i),i=n,n=c}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=h+this._d|0,this._e=s+this._e|0},gt.prototype._hash=function(){var t=lt.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var yt=gt,vt=rt.Buffer,bt=[1518500249,1859775393,-1894007588,-899497514],Et=new Array(80);function At(){this.init(),this._w=Et,ct.call(this,64,56)}function mt(t){return t<<5|t>>>27}function Bt(t){return t<<30|t>>>2}function It(t,r,e,n){return 0===t?r&e|~r&n:2===t?r&e|r&n|e&n:r^e^n}ft(At,ct),At.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},At.prototype._update=function(t){for(var r,e=this._w,n=0|this._a,i=0|this._b,o=0|this._c,h=0|this._d,s=0|this._e,f=0;f<16;++f)e[f]=t.readInt32BE(4*f);for(;f<80;++f)e[f]=(r=e[f-3]^e[f-8]^e[f-14]^e[f-16])<<1|r>>>31;for(var u=0;u<80;++u){var a=~~(u/20),c=mt(n)+It(a,i,o,h)+s+e[u]+bt[a]|0;s=h,h=o,o=Bt(i),i=n,n=c}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=h+this._d|0,this._e=s+this._e|0},At.prototype._hash=function(){var t=vt.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var Rt=At,Ut=rt.Buffer,Tt=[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],Pt=new Array(64);function St(){this.init(),this._w=Pt,ct.call(this,64,56)}function kt(t,r,e){return e^t&(r^e)}function Yt(t,r,e){return t&r|e&(t|r)}function Ct(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function Ot(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function xt(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function Mt(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}ft(St,ct),St.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},St.prototype._update=function(t){for(var r=this._w,e=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,h=0|this._e,s=0|this._f,f=0|this._g,u=0|this._h,a=0;a<16;++a)r[a]=t.readInt32BE(4*a);for(;a<64;++a)r[a]=Mt(r[a-2])+r[a-7]+xt(r[a-15])+r[a-16]|0;for(var c=0;c<64;++c){var l=u+Ot(h)+kt(h,s,f)+Tt[c]+r[c]|0,p=Ct(e)+Yt(e,n,i)|0;u=f,f=s,s=h,h=o+l|0,o=i,i=n,n=e,e=l+p|0}this._a=e+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=h+this._e|0,this._f=s+this._f|0,this._g=f+this._g|0,this._h=u+this._h|0},St.prototype._hash=function(){var t=Ut.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t};var Lt=St,Dt=rt.Buffer,Nt=new Array(64);function zt(){this.init(),this._w=Nt,ct.call(this,64,56)}ft(zt,Lt),zt.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},zt.prototype._hash=function(){var t=Dt.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t};var jt=zt,Ft=rt.Buffer,Wt=[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],qt=new Array(160);function Vt(){this.init(),this._w=qt,ct.call(this,128,112)}function Jt(t,r,e){return e^t&(r^e)}function Xt(t,r,e){return t&r|e&(t|r)}function Zt(t,r){return(t>>>28|r<<4)^(r>>>2|t<<30)^(r>>>7|t<<25)}function Gt(t,r){return(t>>>14|r<<18)^(t>>>18|r<<14)^(r>>>9|t<<23)}function Ht(t,r){return(t>>>1|r<<31)^(t>>>8|r<<24)^t>>>7}function Kt(t,r){return(t>>>1|r<<31)^(t>>>8|r<<24)^(t>>>7|r<<25)}function Qt(t,r){return(t>>>19|r<<13)^(r>>>29|t<<3)^t>>>6}function $t(t,r){return(t>>>19|r<<13)^(r>>>29|t<<3)^(t>>>6|r<<26)}function tr(t,r){return t>>>0<r>>>0?1:0}ft(Vt,ct),Vt.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},Vt.prototype._update=function(t){for(var r=this._w,e=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,h=0|this._eh,s=0|this._fh,f=0|this._gh,u=0|this._hh,a=0|this._al,c=0|this._bl,l=0|this._cl,p=0|this._dl,_=0|this._el,g=0|this._fl,w=0|this._gl,d=0|this._hl,y=0;y<32;y+=2)r[y]=t.readInt32BE(4*y),r[y+1]=t.readInt32BE(4*y+4);for(;y<160;y+=2){var v=r[y-30],b=r[y-30+1],E=Ht(v,b),A=Kt(b,v),m=Qt(v=r[y-4],b=r[y-4+1]),B=$t(b,v),I=r[y-14],R=r[y-14+1],U=r[y-32],T=r[y-32+1],P=A+R|0,S=E+I+tr(P,A)|0;S=(S=S+m+tr(P=P+B|0,B)|0)+U+tr(P=P+T|0,T)|0,r[y]=S,r[y+1]=P}for(var k=0;k<160;k+=2){S=r[k],P=r[k+1];var Y=Xt(e,n,i),C=Xt(a,c,l),O=Zt(e,a),x=Zt(a,e),M=Gt(h,_),L=Gt(_,h),D=Wt[k],N=Wt[k+1],z=Jt(h,s,f),j=Jt(_,g,w),F=d+L|0,W=u+M+tr(F,d)|0;W=(W=(W=W+z+tr(F=F+j|0,j)|0)+D+tr(F=F+N|0,N)|0)+S+tr(F=F+P|0,P)|0;var q=x+C|0,V=O+Y+tr(q,x)|0;u=f,d=w,f=s,w=g,s=h,g=_,h=o+W+tr(_=p+F|0,p)|0,o=i,p=l,i=n,l=c,n=e,c=a,e=W+V+tr(a=F+q|0,F)|0}this._al=this._al+a|0,this._bl=this._bl+c|0,this._cl=this._cl+l|0,this._dl=this._dl+p|0,this._el=this._el+_|0,this._fl=this._fl+g|0,this._gl=this._gl+w|0,this._hl=this._hl+d|0,this._ah=this._ah+e+tr(this._al,a)|0,this._bh=this._bh+n+tr(this._bl,c)|0,this._ch=this._ch+i+tr(this._cl,l)|0,this._dh=this._dh+o+tr(this._dl,p)|0,this._eh=this._eh+h+tr(this._el,_)|0,this._fh=this._fh+s+tr(this._fl,g)|0,this._gh=this._gh+f+tr(this._gl,w)|0,this._hh=this._hh+u+tr(this._hl,d)|0},Vt.prototype._hash=function(){var t=Ft.allocUnsafe(64);function r(r,e,n){t.writeInt32BE(r,n),t.writeInt32BE(e,n+4)}return r(this._ah,this._al,0),r(this._bh,this._bl,8),r(this._ch,this._cl,16),r(this._dh,this._dl,24),r(this._eh,this._el,32),r(this._fh,this._fl,40),r(this._gh,this._gl,48),r(this._hh,this._hl,56),t};var rr=Vt,er=rt.Buffer,nr=new Array(160);function ir(){this.init(),this._w=nr,ct.call(this,128,112)}ft(ir,rr),ir.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},ir.prototype._hash=function(){var t=er.allocUnsafe(48);function r(r,e,n){t.writeInt32BE(r,n),t.writeInt32BE(e,n+4)}return r(this._ah,this._al,0),r(this._bh,this._bl,8),r(this._ch,this._cl,16),r(this._dh,this._dl,24),r(this._eh,this._el,32),r(this._fh,this._fl,40),t};var or,hr,sr=ir,fr=r((function(t){var r=t.exports=function(t){t=t.toLowerCase();var e=r[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};r.sha=yt,r.sha1=Rt,r.sha224=jt,r.sha256=Lt,r.sha384=sr,r.sha512=rr})),ur=it("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),ar=function(t){return w.from(fr("sha256").update(t).digest())};!function(t){t.mainnet="mainnet",t.testnet="testnet",t.regtest="regtest"}(or||(or={})),function(t){t.p2pkh="p2pkh",t.p2sh="p2sh",t.p2wpkh="p2wpkh",t.p2wsh="p2wsh",t.p2tr="p2tr"}(hr||(hr={}));var cr={0:{type:hr.p2pkh,network:or.mainnet},111:{type:hr.p2pkh,network:or.testnet},5:{type:hr.p2sh,network:or.mainnet},196:{type:hr.p2sh,network:or.testnet}},lr=function(r){var e,n=r.substr(0,2).toLowerCase();if("bc"===n||"tb"===n)return function(t){var r;try{r=t.startsWith("bc1p")||t.startsWith("tb1p")||t.startsWith("bcrt1p")?ht.decode(t):st.decode(t)}catch(t){throw new Error("Invalid address")}var e={bc:or.mainnet,tb:or.testnet,bcrt:or.regtest}[r.prefix];if(void 0===e)throw new Error("Invalid address");var n=r.words[0];if(n<0||n>16)throw new Error("Invalid address");return{bech32:!0,network:e,address:t,type:20===st.fromWords(r.words.slice(1)).length?hr.p2wpkh:1===n?hr.p2tr:hr.p2wsh}}(r);try{e=ur.decode(r)}catch(t){throw new Error("Invalid address")}var i=e.length;if(25!==i)throw new Error("Invalid address");var o=e.readUInt8(0),h=e.slice(i-4,i),s=e.slice(0,i-4),f=ar(ar(s)).slice(0,4);if(!h.equals(f))throw new Error("Invalid address");if(!Object.keys(cr).map(Number).includes(o))throw new Error("Invalid address");return t(t({},cr[o]),{address:r,bech32:!1})},pr=function(t,r){try{var e=lr(t);return!r||r===e.network}catch(t){return!1}};export{or as Network,pr as default,lr as getAddressInfo,pr as validate}; |
@@ -15,2 +15,4 @@ !function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t="undefined"!=typeof globalThis?globalThis:t||self).AddressValidation={})}(this,(function(t){"use strict";const r=window; | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var e=function(){return(e=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var i in r=arguments[e])Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i]);return t}).apply(this,arguments)};function n(t,r){return t(r={exports:{}},r.exports),r.exports}var i=[],o=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,s=!1;function f(){s=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)i[r]=t[r],o[t.charCodeAt(r)]=r;o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63}function u(t,r,e){for(var n,o,h=[],s=r;s<e;s+=3)n=(t[s]<<16)+(t[s+1]<<8)+t[s+2],h.push(i[(o=n)>>18&63]+i[o>>12&63]+i[o>>6&63]+i[63&o]);return h.join("")}function a(t){var r;s||f();for(var e=t.length,n=e%3,o="",h=[],a=16383,c=0,l=e-n;c<l;c+=a)h.push(u(t,c,c+a>l?l:c+a));return 1===n?(r=t[e-1],o+=i[r>>2],o+=i[r<<4&63],o+="=="):2===n&&(r=(t[e-2]<<8)+t[e-1],o+=i[r>>10],o+=i[r>>4&63],o+=i[r<<2&63],o+="="),h.push(o),h.join("")}function c(t,r,e,n,i){var o,h,s=8*i-n-1,f=(1<<s)-1,u=f>>1,a=-7,c=e?i-1:0,l=e?-1:1,p=t[r+c];for(c+=l,o=p&(1<<-a)-1,p>>=-a,a+=s;a>0;o=256*o+t[r+c],c+=l,a-=8);for(h=o&(1<<-a)-1,o>>=-a,a+=n;a>0;h=256*h+t[r+c],c+=l,a-=8);if(0===o)o=1-u;else{if(o===f)return h?NaN:1/0*(p?-1:1);h+=Math.pow(2,n),o-=u}return(p?-1:1)*h*Math.pow(2,o-n)}function l(t,r,e,n,i,o){var h,s,f,u=8*o-i-1,a=(1<<u)-1,c=a>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,_=n?1:-1,g=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(s=isNaN(r)?1:0,h=a):(h=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-h))<1&&(h--,f*=2),(r+=h+c>=1?l/f:l*Math.pow(2,1-c))*f>=2&&(h++,f/=2),h+c>=a?(s=0,h=a):h+c>=1?(s=(r*f-1)*Math.pow(2,i),h+=c):(s=r*Math.pow(2,c-1)*Math.pow(2,i),h=0));i>=8;t[e+p]=255&s,p+=_,s/=256,i-=8);for(h=h<<i|s,u+=i;u>0;t[e+p]=255&h,p+=_,h/=256,u-=8);t[e+p-_]|=128*g}var p={}.toString,_=Array.isArray||function(t){return"[object Array]"==p.call(t)};y.TYPED_ARRAY_SUPPORT=void 0===r.TYPED_ARRAY_SUPPORT||r.TYPED_ARRAY_SUPPORT;var g=w();function w(){return y.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function d(t,r){if(w()<r)throw new RangeError("Invalid typed array length");return y.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=y.prototype:(null===t&&(t=new y(r)),t.length=r),t}function y(t,r,e){if(!(y.TYPED_ARRAY_SUPPORT||this instanceof y))return new y(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return E(this,t)}return v(this,t,r,e)}function v(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n);y.TYPED_ARRAY_SUPPORT?(t=r).__proto__=y.prototype:t=A(t,r);return t}(t,r,e,n):"string"==typeof r?function(t,r,e){"string"==typeof e&&""!==e||(e="utf8");if(!y.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|I(r,e),i=(t=d(t,n)).write(r,e);i!==n&&(t=t.slice(0,i));return t}(t,r,e):function(t,r){if(B(r)){var e=0|m(r.length);return 0===(t=d(t,e)).length||r.copy(t,0,0,e),t}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(n=r.length)!=n?d(t,0):A(t,r);if("Buffer"===r.type&&_(r.data))return A(t,r.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function b(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function E(t,r){if(b(r),t=d(t,r<0?0:0|m(r)),!y.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function A(t,r){var e=r.length<0?0:0|m(r.length);t=d(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function m(t){if(t>=w())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+w().toString(16)+" bytes");return 0|t}function B(t){return!(null==t||!t._isBuffer)}function I(t,r){if(B(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return Q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return $(t).length;default:if(n)return Q(t).length;r=(""+r).toLowerCase(),n=!0}}function R(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return j(this,r,e);case"utf8":case"utf-8":return L(this,r,e);case"ascii":return D(this,r,e);case"latin1":case"binary":return z(this,r,e);case"base64":return M(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function U(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function T(t,r,e,n,i){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0){if(!i)return-1;e=0}if("string"==typeof r&&(r=y.from(r,n)),B(r))return 0===r.length?-1:P(t,r,e,n,i);if("number"==typeof r)return r&=255,y.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):P(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function P(t,r,e,n,i){var o,h=1,s=t.length,f=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;h=2,s/=2,f/=2,e/=2}function u(t,r){return 1===h?t[r]:t.readUInt16BE(r*h)}if(i){var a=-1;for(o=e;o<s;o++)if(u(t,o)===u(r,-1===a?0:o-a)){if(-1===a&&(a=o),o-a+1===f)return a*h}else-1!==a&&(o-=o-a),a=-1}else for(e+f>s&&(e=s-f),o=e;o>=0;o--){for(var c=!0,l=0;l<f;l++)if(u(t,o+l)!==u(r,l)){c=!1;break}if(c)return o}return-1}function S(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n))>i&&(n=i):n=i;var o=r.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var h=0;h<n;++h){var s=parseInt(r.substr(2*h,2),16);if(isNaN(s))return h;t[e+h]=s}return h}function k(t,r,e,n){return tt(Q(r,t.length-e),t,e,n)}function Y(t,r,e,n){return tt(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function x(t,r,e,n){return Y(t,r,e,n)}function O(t,r,e,n){return tt($(r),t,e,n)}function C(t,r,e,n){return tt(function(t,r){for(var e,n,i,o=[],h=0;h<t.length&&!((r-=2)<0);++h)n=(e=t.charCodeAt(h))>>8,i=e%256,o.push(i),o.push(n);return o}(r,t.length-e),t,e,n)}function M(t,r,e){return 0===r&&e===t.length?a(t):a(t.slice(r,e))}function L(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o,h,s,f,u=t[i],a=null,c=u>239?4:u>223?3:u>191?2:1;if(i+c<=e)switch(c){case 1:u<128&&(a=u);break;case 2:128==(192&(o=t[i+1]))&&(f=(31&u)<<6|63&o)>127&&(a=f);break;case 3:o=t[i+1],h=t[i+2],128==(192&o)&&128==(192&h)&&(f=(15&u)<<12|(63&o)<<6|63&h)>2047&&(f<55296||f>57343)&&(a=f);break;case 4:o=t[i+1],h=t[i+2],s=t[i+3],128==(192&o)&&128==(192&h)&&128==(192&s)&&(f=(15&u)<<18|(63&o)<<12|(63&h)<<6|63&s)>65535&&f<1114112&&(a=f)}null===a?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=c}return function(t){var r=t.length;if(r<=N)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=N));return e}(n)}y.poolSize=8192,y._augment=function(t){return t.__proto__=y.prototype,t},y.from=function(t,r,e){return v(null,t,r,e)},y.TYPED_ARRAY_SUPPORT&&(y.prototype.__proto__=Uint8Array.prototype,y.__proto__=Uint8Array),y.alloc=function(t,r,e){return function(t,r,e,n){return b(r),r<=0?d(t,r):void 0!==e?"string"==typeof n?d(t,r).fill(e,n):d(t,r).fill(e):d(t,r)}(null,t,r,e)},y.allocUnsafe=function(t){return E(null,t)},y.allocUnsafeSlow=function(t){return E(null,t)},y.isBuffer=rt,y.compare=function(t,r){if(!B(t)||!B(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,i=0,o=Math.min(e,n);i<o;++i)if(t[i]!==r[i]){e=t[i],n=r[i];break}return e<n?-1:n<e?1:0},y.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},y.concat=function(t,r){if(!_(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return y.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=y.allocUnsafe(r),i=0;for(e=0;e<t.length;++e){var o=t[e];if(!B(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},y.byteLength=I,y.prototype._isBuffer=!0,y.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)U(this,r,r+1);return this},y.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)U(this,r,r+3),U(this,r+1,r+2);return this},y.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)U(this,r,r+7),U(this,r+1,r+6),U(this,r+2,r+5),U(this,r+3,r+4);return this},y.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?L(this,0,t):R.apply(this,arguments)},y.prototype.equals=function(t){if(!B(t))throw new TypeError("Argument must be a Buffer");return this===t||0===y.compare(this,t)},y.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},y.prototype.compare=function(t,r,e,n,i){if(!B(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),r<0||e>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&r>=e)return 0;if(n>=i)return-1;if(r>=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),h=(e>>>=0)-(r>>>=0),s=Math.min(o,h),f=this.slice(n,i),u=t.slice(r,e),a=0;a<s;++a)if(f[a]!==u[a]){o=f[a],h=u[a];break}return o<h?-1:h<o?1:0},y.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},y.prototype.indexOf=function(t,r,e){return T(this,t,r,e,!0)},y.prototype.lastIndexOf=function(t,r,e){return T(this,t,r,e,!1)},y.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return S(this,t,r,e);case"utf8":case"utf-8":return k(this,t,r,e);case"ascii":return Y(this,t,r,e);case"latin1":case"binary":return x(this,t,r,e);case"base64":return O(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},y.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var N=4096;function D(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(127&t[i]);return n}function z(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function j(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=K(t[o]);return i}function F(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function q(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function W(t,r,e,n,i,o){if(!B(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function V(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function J(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>8*(n?i:3-i)&255}function X(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Z(t,r,e,n,i){return i||X(t,0,e,4),l(t,r,e,n,23,4),e+4}function G(t,r,e,n,i){return i||X(t,0,e,8),l(t,r,e,n,52,8),e+8}y.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),y.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=y.prototype;else{var i=r-t;e=new y(i,void 0);for(var o=0;o<i;++o)e[o]=this[o+t]}return e},y.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||q(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},y.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||q(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},y.prototype.readUInt8=function(t,r){return r||q(t,1,this.length),this[t]},y.prototype.readUInt16LE=function(t,r){return r||q(t,2,this.length),this[t]|this[t+1]<<8},y.prototype.readUInt16BE=function(t,r){return r||q(t,2,this.length),this[t]<<8|this[t+1]},y.prototype.readUInt32LE=function(t,r){return r||q(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},y.prototype.readUInt32BE=function(t,r){return r||q(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},y.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||q(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*r)),n},y.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||q(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*r)),o},y.prototype.readInt8=function(t,r){return r||q(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},y.prototype.readInt16LE=function(t,r){r||q(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},y.prototype.readInt16BE=function(t,r){r||q(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},y.prototype.readInt32LE=function(t,r){return r||q(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},y.prototype.readInt32BE=function(t,r){return r||q(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},y.prototype.readFloatLE=function(t,r){return r||q(t,4,this.length),c(this,t,!0,23,4)},y.prototype.readFloatBE=function(t,r){return r||q(t,4,this.length),c(this,t,!1,23,4)},y.prototype.readDoubleLE=function(t,r){return r||q(t,8,this.length),c(this,t,!0,52,8)},y.prototype.readDoubleBE=function(t,r){return r||q(t,8,this.length),c(this,t,!1,52,8)},y.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||W(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o<e&&(i*=256);)this[r+o]=t/i&255;return r+e},y.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||W(this,t,r,e,Math.pow(2,8*e)-1,0);var i=e-1,o=1;for(this[r+i]=255&t;--i>=0&&(o*=256);)this[r+i]=t/o&255;return r+e},y.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||W(this,t,r,1,255,0),y.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},y.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||W(this,t,r,2,65535,0),y.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):V(this,t,r,!0),r+2},y.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||W(this,t,r,2,65535,0),y.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):V(this,t,r,!1),r+2},y.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||W(this,t,r,4,4294967295,0),y.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):J(this,t,r,!0),r+4},y.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||W(this,t,r,4,4294967295,0),y.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):J(this,t,r,!1),r+4},y.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);W(this,t,r,e,i-1,-i)}var o=0,h=1,s=0;for(this[r]=255&t;++o<e&&(h*=256);)t<0&&0===s&&0!==this[r+o-1]&&(s=1),this[r+o]=(t/h>>0)-s&255;return r+e},y.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);W(this,t,r,e,i-1,-i)}var o=e-1,h=1,s=0;for(this[r+o]=255&t;--o>=0&&(h*=256);)t<0&&0===s&&0!==this[r+o+1]&&(s=1),this[r+o]=(t/h>>0)-s&255;return r+e},y.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||W(this,t,r,1,127,-128),y.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},y.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||W(this,t,r,2,32767,-32768),y.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):V(this,t,r,!0),r+2},y.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||W(this,t,r,2,32767,-32768),y.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):V(this,t,r,!1),r+2},y.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||W(this,t,r,4,2147483647,-2147483648),y.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):J(this,t,r,!0),r+4},y.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||W(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),y.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):J(this,t,r,!1),r+4},y.prototype.writeFloatLE=function(t,r,e){return Z(this,t,r,!0,e)},y.prototype.writeFloatBE=function(t,r,e){return Z(this,t,r,!1,e)},y.prototype.writeDoubleLE=function(t,r,e){return G(this,t,r,!0,e)},y.prototype.writeDoubleBE=function(t,r,e){return G(this,t,r,!1,e)},y.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=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),t.length-r<n-e&&(n=t.length-r+e);var i,o=n-e;if(this===t&&e<r&&r<n)for(i=o-1;i>=0;--i)t[i+r]=this[i+e];else if(o<1e3||!y.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+r]=this[i+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+o),r);return o},y.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!y.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var o;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(o=r;o<e;++o)this[o]=t;else{var h=B(t)?t:Q(new y(t,n).toString()),s=h.length;for(o=0;o<e-r;++o)this[o+r]=h[o%s]}return this};var H=/[^+\/0-9A-Za-z-_]/g;function K(t){return t<16?"0"+t.toString(16):t.toString(16)}function Q(t,r){var e;r=r||1/0;for(var n=t.length,i=null,o=[],h=0;h<n;++h){if((e=t.charCodeAt(h))>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(h+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function $(t){return function(t){var r,e,n,i,u,a;s||f();var c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");u="="===t[c-2]?2:"="===t[c-1]?1:0,a=new h(3*c/4-u),n=u>0?c-4:c;var l=0;for(r=0,e=0;r<n;r+=4,e+=3)i=o[t.charCodeAt(r)]<<18|o[t.charCodeAt(r+1)]<<12|o[t.charCodeAt(r+2)]<<6|o[t.charCodeAt(r+3)],a[l++]=i>>16&255,a[l++]=i>>8&255,a[l++]=255&i;return 2===u?(i=o[t.charCodeAt(r)]<<2|o[t.charCodeAt(r+1)]>>4,a[l++]=255&i):1===u&&(i=o[t.charCodeAt(r)]<<10|o[t.charCodeAt(r+1)]<<4|o[t.charCodeAt(r+2)]>>2,a[l++]=i>>8&255,a[l++]=255&i),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function tt(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function rt(t){return null!=t&&(!!t._isBuffer||et(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&et(t.slice(0,0))}(t))}function et(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var nt=Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:g,Buffer:y,SlowBuffer:function(t){return+t!=t&&(t=0),y.alloc(+t)},isBuffer:rt}),it=n((function(t,r){var e=nt.Buffer;function n(t,r){for(var e in t)r[e]=t[e]}function i(t,r,n){return e(t,r,n)}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?t.exports=nt:(n(nt,r),r.Buffer=i),i.prototype=Object.create(e.prototype),n(e,i),i.from=function(t,r,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return e(t,r,n)},i.alloc=function(t,r,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=e(t);return void 0!==r?"string"==typeof n?i.fill(r,n):i.fill(r):i.fill(0),i},i.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return e(t)},i.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return nt.SlowBuffer(t)}}));it.Buffer;var ot=it.Buffer;var ht,st=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),e=0;e<r.length;e++)r[e]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),o=i.charCodeAt(0);if(255!==r[o])throw new TypeError(i+" is ambiguous");r[o]=n}var h=t.length,s=t.charAt(0),f=Math.log(h)/Math.log(256),u=Math.log(256)/Math.log(h);function a(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return ot.alloc(0);var e=0;if(" "!==t[e]){for(var n=0,i=0;t[e]===s;)n++,e++;for(var o=(t.length-e)*f+1>>>0,u=new Uint8Array(o);t[e];){var a=r[t.charCodeAt(e)];if(255===a)return;for(var c=0,l=o-1;(0!==a||c<i)&&-1!==l;l--,c++)a+=h*u[l]>>>0,u[l]=a%256>>>0,a=a/256>>>0;if(0!==a)throw new Error("Non-zero carry");i=c,e++}if(" "!==t[e]){for(var p=o-i;p!==o&&0===u[p];)p++;var _=ot.allocUnsafe(n+(o-p));_.fill(0,0,n);for(var g=n;p!==o;)_[g++]=u[p++];return _}}}return{encode:function(r){if((Array.isArray(r)||r instanceof Uint8Array)&&(r=ot.from(r)),!ot.isBuffer(r))throw new TypeError("Expected Buffer");if(0===r.length)return"";for(var e=0,n=0,i=0,o=r.length;i!==o&&0===r[i];)i++,e++;for(var f=(o-i)*u+1>>>0,a=new Uint8Array(f);i!==o;){for(var c=r[i],l=0,p=f-1;(0!==c||l<n)&&-1!==p;p--,l++)c+=256*a[p]>>>0,a[p]=c%h>>>0,c=c/h>>>0;if(0!==c)throw new Error("Non-zero carry");n=l,i++}for(var _=f-n;_!==f&&0===a[_];)_++;for(var g=s.repeat(e);_<f;++_)g+=t.charAt(a[_]);return g},decodeUnsafe:a,decode:function(t){var r=a(t);if(r)return r;throw new Error("Non-base"+h+" character")}}},ft=n((function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const e="qpzry9x8gf2tvdw0s3jn54khce6mua7l",n={};for(let t=0;t<e.length;t++){const r=e.charAt(t);n[r]=t}function i(t){const r=t>>25;return(33554431&t)<<5^996825010&-(r>>0&1)^642813549&-(r>>1&1)^513874426&-(r>>2&1)^1027748829&-(r>>3&1)^705979059&-(r>>4&1)}function o(t){let r=1;for(let e=0;e<t.length;++e){const n=t.charCodeAt(e);if(n<33||n>126)return"Invalid prefix ("+t+")";r=i(r)^n>>5}r=i(r);for(let e=0;e<t.length;++e){const n=t.charCodeAt(e);r=i(r)^31&n}return r}function h(t,r,e,n){let i=0,o=0;const h=(1<<e)-1,s=[];for(let n=0;n<t.length;++n)for(i=i<<r|t[n],o+=r;o>=e;)o-=e,s.push(i>>o&h);if(n)o>0&&s.push(i<<e-o&h);else{if(o>=r)return"Excess padding";if(i<<e-o&h)return"Non-zero padding"}return s}function s(t){return h(t,8,5,!0)}function f(t){const r=h(t,5,8,!1);if(Array.isArray(r))return r}function u(t){const r=h(t,5,8,!1);if(Array.isArray(r))return r;throw new Error(r)}function a(t){let r;function h(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";const h=t.toLowerCase(),s=t.toUpperCase();if(t!==h&&t!==s)return"Mixed-case string "+t;const f=(t=h).lastIndexOf("1");if(-1===f)return"No separator character for "+t;if(0===f)return"Missing prefix for "+t;const u=t.slice(0,f),a=t.slice(f+1);if(a.length<6)return"Data too short";let c=o(u);if("string"==typeof c)return c;const l=[];for(let t=0;t<a.length;++t){const r=a.charAt(t),e=n[r];if(void 0===e)return"Unknown character "+r;c=i(c)^e,t+6>=a.length||l.push(e)}return c!==r?"Invalid checksum for "+t:{prefix:u,words:l}}return r="bech32"===t?1:734539939,{decodeUnsafe:function(t,r){const e=h(t,r);if("object"==typeof e)return e},decode:function(t,r){const e=h(t,r);if("object"==typeof e)return e;throw new Error(e)},encode:function(t,n,h){if(h=h||90,t.length+7+n.length>h)throw new TypeError("Exceeds length limit");let s=o(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let f=t+"1";for(let t=0;t<n.length;++t){const r=n[t];if(r>>5!=0)throw new Error("Non 5-bit word");s=i(s)^r,f+=e.charAt(r)}for(let t=0;t<6;++t)s=i(s);s^=r;for(let t=0;t<6;++t){f+=e.charAt(s>>5*(5-t)&31)}return f},toWords:s,fromWordsUnsafe:f,fromWords:u}}r.bech32=a("bech32"),r.bech32m=a("bech32m")}));(ht=ft)&&ht.__esModule&&Object.prototype.hasOwnProperty.call(ht,"default")&&ht.default,ft.bech32m;var ut=ft.bech32,at=n((function(t){"function"==typeof Object.create?t.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,r){if(r){t.super_=r;var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t}}})),ct=it.Buffer;function lt(t,r){this._block=ct.alloc(t),this._finalSize=r,this._blockSize=t,this._len=0}lt.prototype.update=function(t,r){"string"==typeof t&&(r=r||"utf8",t=ct.from(t,r));for(var e=this._block,n=this._blockSize,i=t.length,o=this._len,h=0;h<i;){for(var s=o%n,f=Math.min(i-h,n-s),u=0;u<f;u++)e[s+u]=t[h+u];h+=f,(o+=f)%n==0&&this._update(e)}return this._len+=i,this},lt.prototype.digest=function(t){var r=this._len%this._blockSize;this._block[r]=128,this._block.fill(0,r+1),r>=this._finalSize&&(this._update(this._block),this._block.fill(0));var e=8*this._len;if(e<=4294967295)this._block.writeUInt32BE(e,this._blockSize-4);else{var n=(4294967295&e)>>>0,i=(e-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},lt.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var pt=lt,_t=it.Buffer,gt=[1518500249,1859775393,-1894007588,-899497514],wt=new Array(80);function dt(){this.init(),this._w=wt,pt.call(this,64,56)}function yt(t){return t<<30|t>>>2}function vt(t,r,e,n){return 0===t?r&e|~r&n:2===t?r&e|r&n|e&n:r^e^n}at(dt,pt),dt.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},dt.prototype._update=function(t){for(var r,e=this._w,n=0|this._a,i=0|this._b,o=0|this._c,h=0|this._d,s=0|this._e,f=0;f<16;++f)e[f]=t.readInt32BE(4*f);for(;f<80;++f)e[f]=e[f-3]^e[f-8]^e[f-14]^e[f-16];for(var u=0;u<80;++u){var a=~~(u/20),c=0|((r=n)<<5|r>>>27)+vt(a,i,o,h)+s+e[u]+gt[a];s=h,h=o,o=yt(i),i=n,n=c}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=h+this._d|0,this._e=s+this._e|0},dt.prototype._hash=function(){var t=_t.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var bt=dt,Et=it.Buffer,At=[1518500249,1859775393,-1894007588,-899497514],mt=new Array(80);function Bt(){this.init(),this._w=mt,pt.call(this,64,56)}function It(t){return t<<5|t>>>27}function Rt(t){return t<<30|t>>>2}function Ut(t,r,e,n){return 0===t?r&e|~r&n:2===t?r&e|r&n|e&n:r^e^n}at(Bt,pt),Bt.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Bt.prototype._update=function(t){for(var r,e=this._w,n=0|this._a,i=0|this._b,o=0|this._c,h=0|this._d,s=0|this._e,f=0;f<16;++f)e[f]=t.readInt32BE(4*f);for(;f<80;++f)e[f]=(r=e[f-3]^e[f-8]^e[f-14]^e[f-16])<<1|r>>>31;for(var u=0;u<80;++u){var a=~~(u/20),c=It(n)+Ut(a,i,o,h)+s+e[u]+At[a]|0;s=h,h=o,o=Rt(i),i=n,n=c}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=h+this._d|0,this._e=s+this._e|0},Bt.prototype._hash=function(){var t=Et.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var Tt=Bt,Pt=it.Buffer,St=[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],kt=new Array(64);function Yt(){this.init(),this._w=kt,pt.call(this,64,56)}function xt(t,r,e){return e^t&(r^e)}function Ot(t,r,e){return t&r|e&(t|r)}function Ct(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function Mt(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function Lt(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function Nt(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}at(Yt,pt),Yt.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},Yt.prototype._update=function(t){for(var r=this._w,e=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,h=0|this._e,s=0|this._f,f=0|this._g,u=0|this._h,a=0;a<16;++a)r[a]=t.readInt32BE(4*a);for(;a<64;++a)r[a]=Nt(r[a-2])+r[a-7]+Lt(r[a-15])+r[a-16]|0;for(var c=0;c<64;++c){var l=u+Mt(h)+xt(h,s,f)+St[c]+r[c]|0,p=Ct(e)+Ot(e,n,i)|0;u=f,f=s,s=h,h=o+l|0,o=i,i=n,n=e,e=l+p|0}this._a=e+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=h+this._e|0,this._f=s+this._f|0,this._g=f+this._g|0,this._h=u+this._h|0},Yt.prototype._hash=function(){var t=Pt.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t};var Dt=Yt,zt=it.Buffer,jt=new Array(64);function Ft(){this.init(),this._w=jt,pt.call(this,64,56)}at(Ft,Dt),Ft.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},Ft.prototype._hash=function(){var t=zt.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t};var qt=Ft,Wt=it.Buffer,Vt=[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],Jt=new Array(160);function Xt(){this.init(),this._w=Jt,pt.call(this,128,112)}function Zt(t,r,e){return e^t&(r^e)}function Gt(t,r,e){return t&r|e&(t|r)}function Ht(t,r){return(t>>>28|r<<4)^(r>>>2|t<<30)^(r>>>7|t<<25)}function Kt(t,r){return(t>>>14|r<<18)^(t>>>18|r<<14)^(r>>>9|t<<23)}function Qt(t,r){return(t>>>1|r<<31)^(t>>>8|r<<24)^t>>>7}function $t(t,r){return(t>>>1|r<<31)^(t>>>8|r<<24)^(t>>>7|r<<25)}function tr(t,r){return(t>>>19|r<<13)^(r>>>29|t<<3)^t>>>6}function rr(t,r){return(t>>>19|r<<13)^(r>>>29|t<<3)^(t>>>6|r<<26)}function er(t,r){return t>>>0<r>>>0?1:0}at(Xt,pt),Xt.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},Xt.prototype._update=function(t){for(var r=this._w,e=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,h=0|this._eh,s=0|this._fh,f=0|this._gh,u=0|this._hh,a=0|this._al,c=0|this._bl,l=0|this._cl,p=0|this._dl,_=0|this._el,g=0|this._fl,w=0|this._gl,d=0|this._hl,y=0;y<32;y+=2)r[y]=t.readInt32BE(4*y),r[y+1]=t.readInt32BE(4*y+4);for(;y<160;y+=2){var v=r[y-30],b=r[y-30+1],E=Qt(v,b),A=$t(b,v),m=tr(v=r[y-4],b=r[y-4+1]),B=rr(b,v),I=r[y-14],R=r[y-14+1],U=r[y-32],T=r[y-32+1],P=A+R|0,S=E+I+er(P,A)|0;S=(S=S+m+er(P=P+B|0,B)|0)+U+er(P=P+T|0,T)|0,r[y]=S,r[y+1]=P}for(var k=0;k<160;k+=2){S=r[k],P=r[k+1];var Y=Gt(e,n,i),x=Gt(a,c,l),O=Ht(e,a),C=Ht(a,e),M=Kt(h,_),L=Kt(_,h),N=Vt[k],D=Vt[k+1],z=Zt(h,s,f),j=Zt(_,g,w),F=d+L|0,q=u+M+er(F,d)|0;q=(q=(q=q+z+er(F=F+j|0,j)|0)+N+er(F=F+D|0,D)|0)+S+er(F=F+P|0,P)|0;var W=C+x|0,V=O+Y+er(W,C)|0;u=f,d=w,f=s,w=g,s=h,g=_,h=o+q+er(_=p+F|0,p)|0,o=i,p=l,i=n,l=c,n=e,c=a,e=q+V+er(a=F+W|0,F)|0}this._al=this._al+a|0,this._bl=this._bl+c|0,this._cl=this._cl+l|0,this._dl=this._dl+p|0,this._el=this._el+_|0,this._fl=this._fl+g|0,this._gl=this._gl+w|0,this._hl=this._hl+d|0,this._ah=this._ah+e+er(this._al,a)|0,this._bh=this._bh+n+er(this._bl,c)|0,this._ch=this._ch+i+er(this._cl,l)|0,this._dh=this._dh+o+er(this._dl,p)|0,this._eh=this._eh+h+er(this._el,_)|0,this._fh=this._fh+s+er(this._fl,g)|0,this._gh=this._gh+f+er(this._gl,w)|0,this._hh=this._hh+u+er(this._hl,d)|0},Xt.prototype._hash=function(){var t=Wt.allocUnsafe(64);function r(r,e,n){t.writeInt32BE(r,n),t.writeInt32BE(e,n+4)}return r(this._ah,this._al,0),r(this._bh,this._bl,8),r(this._ch,this._cl,16),r(this._dh,this._dl,24),r(this._eh,this._el,32),r(this._fh,this._fl,40),r(this._gh,this._gl,48),r(this._hh,this._hl,56),t};var nr=Xt,ir=it.Buffer,or=new Array(160);function hr(){this.init(),this._w=or,pt.call(this,128,112)}at(hr,nr),hr.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},hr.prototype._hash=function(){var t=ir.allocUnsafe(48);function r(r,e,n){t.writeInt32BE(r,n),t.writeInt32BE(e,n+4)}return r(this._ah,this._al,0),r(this._bh,this._bl,8),r(this._ch,this._cl,16),r(this._dh,this._dl,24),r(this._eh,this._el,32),r(this._fh,this._fl,40),t};var sr,fr,ur=hr,ar=n((function(t){var r=t.exports=function(t){t=t.toLowerCase();var e=r[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};r.sha=bt,r.sha1=Tt,r.sha224=qt,r.sha256=Dt,r.sha384=ur,r.sha512=nr})),cr=st("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),lr=function(t){return y.from(ar("sha256").update(t).digest())};t.Network=void 0,(sr=t.Network||(t.Network={})).mainnet="mainnet",sr.testnet="testnet",sr.regtest="regtest",function(t){t.p2pkh="p2pkh",t.p2sh="p2sh",t.p2wpkh="p2wpkh",t.p2wsh="p2wsh"}(fr||(fr={}));var pr={0:{type:fr.p2pkh,network:t.Network.mainnet},111:{type:fr.p2pkh,network:t.Network.testnet},5:{type:fr.p2sh,network:t.Network.mainnet},196:{type:fr.p2sh,network:t.Network.testnet}},_r=function(r){var n,i=r.substr(0,2).toLowerCase();if("bc"===i||"tb"===i)return function(r){var e;try{e=ut.decode(r)}catch(t){throw new Error("Invalid address")}var n={bc:t.Network.mainnet,tb:t.Network.testnet,bcrt:t.Network.regtest}[e.prefix];if(void 0===n)throw new Error("Invalid address");var i=e.words[0];if(i<0||i>16)throw new Error("Invalid address");return{bech32:!0,network:n,address:r,type:20===ut.fromWords(e.words.slice(1)).length?fr.p2wpkh:fr.p2wsh}}(r);try{n=cr.decode(r)}catch(t){throw new Error("Invalid address")}var o=n.length;if(25!==o)throw new Error("Invalid address");var h=n.readUInt8(0),s=n.slice(o-4,o),f=n.slice(0,o-4),u=lr(lr(f)).slice(0,4);if(!s.equals(u))throw new Error("Invalid address");if(!Object.keys(pr).map(Number).includes(h))throw new Error("Invalid address");return e(e({},pr[h]),{address:r,bech32:!1})},gr=function(t,r){try{var e=_r(t);return!r||r===e.network}catch(t){return!1}};t.default=gr,t.getAddressInfo=_r,t.validate=gr,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
***************************************************************************** */var e=function(){return e=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var i in r=arguments[e])Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i]);return t},e.apply(this,arguments)};function n(t,r){return t(r={exports:{}},r.exports),r.exports}var i=[],o=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,s=!1;function f(){s=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)i[r]=t[r],o[t.charCodeAt(r)]=r;o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63}function u(t,r,e){for(var n,o,h=[],s=r;s<e;s+=3)n=(t[s]<<16)+(t[s+1]<<8)+t[s+2],h.push(i[(o=n)>>18&63]+i[o>>12&63]+i[o>>6&63]+i[63&o]);return h.join("")}function a(t){var r;s||f();for(var e=t.length,n=e%3,o="",h=[],a=16383,c=0,l=e-n;c<l;c+=a)h.push(u(t,c,c+a>l?l:c+a));return 1===n?(r=t[e-1],o+=i[r>>2],o+=i[r<<4&63],o+="=="):2===n&&(r=(t[e-2]<<8)+t[e-1],o+=i[r>>10],o+=i[r>>4&63],o+=i[r<<2&63],o+="="),h.push(o),h.join("")}function c(t,r,e,n,i){var o,h,s=8*i-n-1,f=(1<<s)-1,u=f>>1,a=-7,c=e?i-1:0,l=e?-1:1,p=t[r+c];for(c+=l,o=p&(1<<-a)-1,p>>=-a,a+=s;a>0;o=256*o+t[r+c],c+=l,a-=8);for(h=o&(1<<-a)-1,o>>=-a,a+=n;a>0;h=256*h+t[r+c],c+=l,a-=8);if(0===o)o=1-u;else{if(o===f)return h?NaN:1/0*(p?-1:1);h+=Math.pow(2,n),o-=u}return(p?-1:1)*h*Math.pow(2,o-n)}function l(t,r,e,n,i,o){var h,s,f,u=8*o-i-1,a=(1<<u)-1,c=a>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,_=n?1:-1,g=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(s=isNaN(r)?1:0,h=a):(h=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-h))<1&&(h--,f*=2),(r+=h+c>=1?l/f:l*Math.pow(2,1-c))*f>=2&&(h++,f/=2),h+c>=a?(s=0,h=a):h+c>=1?(s=(r*f-1)*Math.pow(2,i),h+=c):(s=r*Math.pow(2,c-1)*Math.pow(2,i),h=0));i>=8;t[e+p]=255&s,p+=_,s/=256,i-=8);for(h=h<<i|s,u+=i;u>0;t[e+p]=255&h,p+=_,h/=256,u-=8);t[e+p-_]|=128*g}var p={}.toString,_=Array.isArray||function(t){return"[object Array]"==p.call(t)};y.TYPED_ARRAY_SUPPORT=void 0===r.TYPED_ARRAY_SUPPORT||r.TYPED_ARRAY_SUPPORT;var g=w();function w(){return y.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function d(t,r){if(w()<r)throw new RangeError("Invalid typed array length");return y.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=y.prototype:(null===t&&(t=new y(r)),t.length=r),t}function y(t,r,e){if(!(y.TYPED_ARRAY_SUPPORT||this instanceof y))return new y(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return E(this,t)}return v(this,t,r,e)}function v(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n);y.TYPED_ARRAY_SUPPORT?(t=r).__proto__=y.prototype:t=A(t,r);return t}(t,r,e,n):"string"==typeof r?function(t,r,e){"string"==typeof e&&""!==e||(e="utf8");if(!y.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|I(r,e),i=(t=d(t,n)).write(r,e);i!==n&&(t=t.slice(0,i));return t}(t,r,e):function(t,r){if(B(r)){var e=0|m(r.length);return 0===(t=d(t,e)).length||r.copy(t,0,0,e),t}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(n=r.length)!=n?d(t,0):A(t,r);if("Buffer"===r.type&&_(r.data))return A(t,r.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function b(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function E(t,r){if(b(r),t=d(t,r<0?0:0|m(r)),!y.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function A(t,r){var e=r.length<0?0:0|m(r.length);t=d(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function m(t){if(t>=w())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+w().toString(16)+" bytes");return 0|t}function B(t){return!(null==t||!t._isBuffer)}function I(t,r){if(B(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return Q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return $(t).length;default:if(n)return Q(t).length;r=(""+r).toLowerCase(),n=!0}}function R(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return j(this,r,e);case"utf8":case"utf-8":return L(this,r,e);case"ascii":return D(this,r,e);case"latin1":case"binary":return z(this,r,e);case"base64":return M(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function U(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function T(t,r,e,n,i){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0){if(!i)return-1;e=0}if("string"==typeof r&&(r=y.from(r,n)),B(r))return 0===r.length?-1:P(t,r,e,n,i);if("number"==typeof r)return r&=255,y.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):P(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function P(t,r,e,n,i){var o,h=1,s=t.length,f=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;h=2,s/=2,f/=2,e/=2}function u(t,r){return 1===h?t[r]:t.readUInt16BE(r*h)}if(i){var a=-1;for(o=e;o<s;o++)if(u(t,o)===u(r,-1===a?0:o-a)){if(-1===a&&(a=o),o-a+1===f)return a*h}else-1!==a&&(o-=o-a),a=-1}else for(e+f>s&&(e=s-f),o=e;o>=0;o--){for(var c=!0,l=0;l<f;l++)if(u(t,o+l)!==u(r,l)){c=!1;break}if(c)return o}return-1}function S(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n))>i&&(n=i):n=i;var o=r.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var h=0;h<n;++h){var s=parseInt(r.substr(2*h,2),16);if(isNaN(s))return h;t[e+h]=s}return h}function k(t,r,e,n){return tt(Q(r,t.length-e),t,e,n)}function Y(t,r,e,n){return tt(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function x(t,r,e,n){return Y(t,r,e,n)}function O(t,r,e,n){return tt($(r),t,e,n)}function C(t,r,e,n){return tt(function(t,r){for(var e,n,i,o=[],h=0;h<t.length&&!((r-=2)<0);++h)n=(e=t.charCodeAt(h))>>8,i=e%256,o.push(i),o.push(n);return o}(r,t.length-e),t,e,n)}function M(t,r,e){return 0===r&&e===t.length?a(t):a(t.slice(r,e))}function L(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o,h,s,f,u=t[i],a=null,c=u>239?4:u>223?3:u>191?2:1;if(i+c<=e)switch(c){case 1:u<128&&(a=u);break;case 2:128==(192&(o=t[i+1]))&&(f=(31&u)<<6|63&o)>127&&(a=f);break;case 3:o=t[i+1],h=t[i+2],128==(192&o)&&128==(192&h)&&(f=(15&u)<<12|(63&o)<<6|63&h)>2047&&(f<55296||f>57343)&&(a=f);break;case 4:o=t[i+1],h=t[i+2],s=t[i+3],128==(192&o)&&128==(192&h)&&128==(192&s)&&(f=(15&u)<<18|(63&o)<<12|(63&h)<<6|63&s)>65535&&f<1114112&&(a=f)}null===a?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=c}return function(t){var r=t.length;if(r<=N)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=N));return e}(n)}y.poolSize=8192,y._augment=function(t){return t.__proto__=y.prototype,t},y.from=function(t,r,e){return v(null,t,r,e)},y.TYPED_ARRAY_SUPPORT&&(y.prototype.__proto__=Uint8Array.prototype,y.__proto__=Uint8Array),y.alloc=function(t,r,e){return function(t,r,e,n){return b(r),r<=0?d(t,r):void 0!==e?"string"==typeof n?d(t,r).fill(e,n):d(t,r).fill(e):d(t,r)}(null,t,r,e)},y.allocUnsafe=function(t){return E(null,t)},y.allocUnsafeSlow=function(t){return E(null,t)},y.isBuffer=rt,y.compare=function(t,r){if(!B(t)||!B(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,i=0,o=Math.min(e,n);i<o;++i)if(t[i]!==r[i]){e=t[i],n=r[i];break}return e<n?-1:n<e?1:0},y.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},y.concat=function(t,r){if(!_(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return y.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=y.allocUnsafe(r),i=0;for(e=0;e<t.length;++e){var o=t[e];if(!B(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},y.byteLength=I,y.prototype._isBuffer=!0,y.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)U(this,r,r+1);return this},y.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)U(this,r,r+3),U(this,r+1,r+2);return this},y.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)U(this,r,r+7),U(this,r+1,r+6),U(this,r+2,r+5),U(this,r+3,r+4);return this},y.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?L(this,0,t):R.apply(this,arguments)},y.prototype.equals=function(t){if(!B(t))throw new TypeError("Argument must be a Buffer");return this===t||0===y.compare(this,t)},y.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},y.prototype.compare=function(t,r,e,n,i){if(!B(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),r<0||e>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&r>=e)return 0;if(n>=i)return-1;if(r>=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),h=(e>>>=0)-(r>>>=0),s=Math.min(o,h),f=this.slice(n,i),u=t.slice(r,e),a=0;a<s;++a)if(f[a]!==u[a]){o=f[a],h=u[a];break}return o<h?-1:h<o?1:0},y.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},y.prototype.indexOf=function(t,r,e){return T(this,t,r,e,!0)},y.prototype.lastIndexOf=function(t,r,e){return T(this,t,r,e,!1)},y.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return S(this,t,r,e);case"utf8":case"utf-8":return k(this,t,r,e);case"ascii":return Y(this,t,r,e);case"latin1":case"binary":return x(this,t,r,e);case"base64":return O(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},y.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var N=4096;function D(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(127&t[i]);return n}function z(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function j(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=K(t[o]);return i}function F(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function W(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function q(t,r,e,n,i,o){if(!B(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function V(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function J(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>8*(n?i:3-i)&255}function X(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Z(t,r,e,n,i){return i||X(t,0,e,4),l(t,r,e,n,23,4),e+4}function G(t,r,e,n,i){return i||X(t,0,e,8),l(t,r,e,n,52,8),e+8}y.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),y.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=y.prototype;else{var i=r-t;e=new y(i,void 0);for(var o=0;o<i;++o)e[o]=this[o+t]}return e},y.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||W(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},y.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||W(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},y.prototype.readUInt8=function(t,r){return r||W(t,1,this.length),this[t]},y.prototype.readUInt16LE=function(t,r){return r||W(t,2,this.length),this[t]|this[t+1]<<8},y.prototype.readUInt16BE=function(t,r){return r||W(t,2,this.length),this[t]<<8|this[t+1]},y.prototype.readUInt32LE=function(t,r){return r||W(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},y.prototype.readUInt32BE=function(t,r){return r||W(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},y.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||W(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*r)),n},y.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||W(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*r)),o},y.prototype.readInt8=function(t,r){return r||W(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},y.prototype.readInt16LE=function(t,r){r||W(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},y.prototype.readInt16BE=function(t,r){r||W(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},y.prototype.readInt32LE=function(t,r){return r||W(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},y.prototype.readInt32BE=function(t,r){return r||W(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},y.prototype.readFloatLE=function(t,r){return r||W(t,4,this.length),c(this,t,!0,23,4)},y.prototype.readFloatBE=function(t,r){return r||W(t,4,this.length),c(this,t,!1,23,4)},y.prototype.readDoubleLE=function(t,r){return r||W(t,8,this.length),c(this,t,!0,52,8)},y.prototype.readDoubleBE=function(t,r){return r||W(t,8,this.length),c(this,t,!1,52,8)},y.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||q(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o<e&&(i*=256);)this[r+o]=t/i&255;return r+e},y.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||q(this,t,r,e,Math.pow(2,8*e)-1,0);var i=e-1,o=1;for(this[r+i]=255&t;--i>=0&&(o*=256);)this[r+i]=t/o&255;return r+e},y.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,1,255,0),y.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},y.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,2,65535,0),y.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):V(this,t,r,!0),r+2},y.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,2,65535,0),y.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):V(this,t,r,!1),r+2},y.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,4,4294967295,0),y.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):J(this,t,r,!0),r+4},y.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,4,4294967295,0),y.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):J(this,t,r,!1),r+4},y.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);q(this,t,r,e,i-1,-i)}var o=0,h=1,s=0;for(this[r]=255&t;++o<e&&(h*=256);)t<0&&0===s&&0!==this[r+o-1]&&(s=1),this[r+o]=(t/h>>0)-s&255;return r+e},y.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);q(this,t,r,e,i-1,-i)}var o=e-1,h=1,s=0;for(this[r+o]=255&t;--o>=0&&(h*=256);)t<0&&0===s&&0!==this[r+o+1]&&(s=1),this[r+o]=(t/h>>0)-s&255;return r+e},y.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,1,127,-128),y.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},y.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,2,32767,-32768),y.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):V(this,t,r,!0),r+2},y.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,2,32767,-32768),y.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):V(this,t,r,!1),r+2},y.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,4,2147483647,-2147483648),y.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):J(this,t,r,!0),r+4},y.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),y.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):J(this,t,r,!1),r+4},y.prototype.writeFloatLE=function(t,r,e){return Z(this,t,r,!0,e)},y.prototype.writeFloatBE=function(t,r,e){return Z(this,t,r,!1,e)},y.prototype.writeDoubleLE=function(t,r,e){return G(this,t,r,!0,e)},y.prototype.writeDoubleBE=function(t,r,e){return G(this,t,r,!1,e)},y.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=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),t.length-r<n-e&&(n=t.length-r+e);var i,o=n-e;if(this===t&&e<r&&r<n)for(i=o-1;i>=0;--i)t[i+r]=this[i+e];else if(o<1e3||!y.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+r]=this[i+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+o),r);return o},y.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!y.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var o;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(o=r;o<e;++o)this[o]=t;else{var h=B(t)?t:Q(new y(t,n).toString()),s=h.length;for(o=0;o<e-r;++o)this[o+r]=h[o%s]}return this};var H=/[^+\/0-9A-Za-z-_]/g;function K(t){return t<16?"0"+t.toString(16):t.toString(16)}function Q(t,r){var e;r=r||1/0;for(var n=t.length,i=null,o=[],h=0;h<n;++h){if((e=t.charCodeAt(h))>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(h+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function $(t){return function(t){var r,e,n,i,u,a;s||f();var c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");u="="===t[c-2]?2:"="===t[c-1]?1:0,a=new h(3*c/4-u),n=u>0?c-4:c;var l=0;for(r=0,e=0;r<n;r+=4,e+=3)i=o[t.charCodeAt(r)]<<18|o[t.charCodeAt(r+1)]<<12|o[t.charCodeAt(r+2)]<<6|o[t.charCodeAt(r+3)],a[l++]=i>>16&255,a[l++]=i>>8&255,a[l++]=255&i;return 2===u?(i=o[t.charCodeAt(r)]<<2|o[t.charCodeAt(r+1)]>>4,a[l++]=255&i):1===u&&(i=o[t.charCodeAt(r)]<<10|o[t.charCodeAt(r+1)]<<4|o[t.charCodeAt(r+2)]>>2,a[l++]=i>>8&255,a[l++]=255&i),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function tt(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function rt(t){return null!=t&&(!!t._isBuffer||et(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&et(t.slice(0,0))}(t))}function et(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var nt=Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:g,Buffer:y,SlowBuffer:function(t){return+t!=t&&(t=0),y.alloc(+t)},isBuffer:rt}),it=n((function(t,r){ | ||
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ | ||
var e=nt.Buffer;function n(t,r){for(var e in t)r[e]=t[e]}function i(t,r,n){return e(t,r,n)}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?t.exports=nt:(n(nt,r),r.Buffer=i),i.prototype=Object.create(e.prototype),n(e,i),i.from=function(t,r,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return e(t,r,n)},i.alloc=function(t,r,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=e(t);return void 0!==r?"string"==typeof n?i.fill(r,n):i.fill(r):i.fill(0),i},i.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return e(t)},i.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return nt.SlowBuffer(t)}}));it.Buffer;var ot=it.Buffer;var ht,st=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),e=0;e<r.length;e++)r[e]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),o=i.charCodeAt(0);if(255!==r[o])throw new TypeError(i+" is ambiguous");r[o]=n}var h=t.length,s=t.charAt(0),f=Math.log(h)/Math.log(256),u=Math.log(256)/Math.log(h);function a(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return ot.alloc(0);for(var e=0,n=0,i=0;t[e]===s;)n++,e++;for(var o=(t.length-e)*f+1>>>0,u=new Uint8Array(o);t[e];){var a=r[t.charCodeAt(e)];if(255===a)return;for(var c=0,l=o-1;(0!==a||c<i)&&-1!==l;l--,c++)a+=h*u[l]>>>0,u[l]=a%256>>>0,a=a/256>>>0;if(0!==a)throw new Error("Non-zero carry");i=c,e++}for(var p=o-i;p!==o&&0===u[p];)p++;var _=ot.allocUnsafe(n+(o-p));_.fill(0,0,n);for(var g=n;p!==o;)_[g++]=u[p++];return _}return{encode:function(r){if((Array.isArray(r)||r instanceof Uint8Array)&&(r=ot.from(r)),!ot.isBuffer(r))throw new TypeError("Expected Buffer");if(0===r.length)return"";for(var e=0,n=0,i=0,o=r.length;i!==o&&0===r[i];)i++,e++;for(var f=(o-i)*u+1>>>0,a=new Uint8Array(f);i!==o;){for(var c=r[i],l=0,p=f-1;(0!==c||l<n)&&-1!==p;p--,l++)c+=256*a[p]>>>0,a[p]=c%h>>>0,c=c/h>>>0;if(0!==c)throw new Error("Non-zero carry");n=l,i++}for(var _=f-n;_!==f&&0===a[_];)_++;for(var g=s.repeat(e);_<f;++_)g+=t.charAt(a[_]);return g},decodeUnsafe:a,decode:function(t){var r=a(t);if(r)return r;throw new Error("Non-base"+h+" character")}}},ft=n((function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const e="qpzry9x8gf2tvdw0s3jn54khce6mua7l",n={};for(let t=0;t<e.length;t++){const r=e.charAt(t);n[r]=t}function i(t){const r=t>>25;return(33554431&t)<<5^996825010&-(r>>0&1)^642813549&-(r>>1&1)^513874426&-(r>>2&1)^1027748829&-(r>>3&1)^705979059&-(r>>4&1)}function o(t){let r=1;for(let e=0;e<t.length;++e){const n=t.charCodeAt(e);if(n<33||n>126)return"Invalid prefix ("+t+")";r=i(r)^n>>5}r=i(r);for(let e=0;e<t.length;++e){const n=t.charCodeAt(e);r=i(r)^31&n}return r}function h(t,r,e,n){let i=0,o=0;const h=(1<<e)-1,s=[];for(let n=0;n<t.length;++n)for(i=i<<r|t[n],o+=r;o>=e;)o-=e,s.push(i>>o&h);if(n)o>0&&s.push(i<<e-o&h);else{if(o>=r)return"Excess padding";if(i<<e-o&h)return"Non-zero padding"}return s}function s(t){return h(t,8,5,!0)}function f(t){const r=h(t,5,8,!1);if(Array.isArray(r))return r}function u(t){const r=h(t,5,8,!1);if(Array.isArray(r))return r;throw new Error(r)}function a(t){let r;function h(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";const h=t.toLowerCase(),s=t.toUpperCase();if(t!==h&&t!==s)return"Mixed-case string "+t;const f=(t=h).lastIndexOf("1");if(-1===f)return"No separator character for "+t;if(0===f)return"Missing prefix for "+t;const u=t.slice(0,f),a=t.slice(f+1);if(a.length<6)return"Data too short";let c=o(u);if("string"==typeof c)return c;const l=[];for(let t=0;t<a.length;++t){const r=a.charAt(t),e=n[r];if(void 0===e)return"Unknown character "+r;c=i(c)^e,t+6>=a.length||l.push(e)}return c!==r?"Invalid checksum for "+t:{prefix:u,words:l}}return r="bech32"===t?1:734539939,{decodeUnsafe:function(t,r){const e=h(t,r);if("object"==typeof e)return e},decode:function(t,r){const e=h(t,r);if("object"==typeof e)return e;throw new Error(e)},encode:function(t,n,h){if(h=h||90,t.length+7+n.length>h)throw new TypeError("Exceeds length limit");let s=o(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let f=t+"1";for(let t=0;t<n.length;++t){const r=n[t];if(r>>5!=0)throw new Error("Non 5-bit word");s=i(s)^r,f+=e.charAt(r)}for(let t=0;t<6;++t)s=i(s);s^=r;for(let t=0;t<6;++t){f+=e.charAt(s>>5*(5-t)&31)}return f},toWords:s,fromWordsUnsafe:f,fromWords:u}}r.bech32=a("bech32"),r.bech32m=a("bech32m")}));(ht=ft)&&ht.__esModule&&Object.prototype.hasOwnProperty.call(ht,"default")&&ht.default;var ut=ft.bech32m,at=ft.bech32,ct=n((function(t){"function"==typeof Object.create?t.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,r){if(r){t.super_=r;var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t}}})),lt=it.Buffer;function pt(t,r){this._block=lt.alloc(t),this._finalSize=r,this._blockSize=t,this._len=0}pt.prototype.update=function(t,r){"string"==typeof t&&(r=r||"utf8",t=lt.from(t,r));for(var e=this._block,n=this._blockSize,i=t.length,o=this._len,h=0;h<i;){for(var s=o%n,f=Math.min(i-h,n-s),u=0;u<f;u++)e[s+u]=t[h+u];h+=f,(o+=f)%n==0&&this._update(e)}return this._len+=i,this},pt.prototype.digest=function(t){var r=this._len%this._blockSize;this._block[r]=128,this._block.fill(0,r+1),r>=this._finalSize&&(this._update(this._block),this._block.fill(0));var e=8*this._len;if(e<=4294967295)this._block.writeUInt32BE(e,this._blockSize-4);else{var n=(4294967295&e)>>>0,i=(e-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},pt.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var _t=pt,gt=it.Buffer,wt=[1518500249,1859775393,-1894007588,-899497514],dt=new Array(80);function yt(){this.init(),this._w=dt,_t.call(this,64,56)}function vt(t){return t<<30|t>>>2}function bt(t,r,e,n){return 0===t?r&e|~r&n:2===t?r&e|r&n|e&n:r^e^n}ct(yt,_t),yt.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},yt.prototype._update=function(t){for(var r,e=this._w,n=0|this._a,i=0|this._b,o=0|this._c,h=0|this._d,s=0|this._e,f=0;f<16;++f)e[f]=t.readInt32BE(4*f);for(;f<80;++f)e[f]=e[f-3]^e[f-8]^e[f-14]^e[f-16];for(var u=0;u<80;++u){var a=~~(u/20),c=0|((r=n)<<5|r>>>27)+bt(a,i,o,h)+s+e[u]+wt[a];s=h,h=o,o=vt(i),i=n,n=c}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=h+this._d|0,this._e=s+this._e|0},yt.prototype._hash=function(){var t=gt.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var Et=yt,At=it.Buffer,mt=[1518500249,1859775393,-1894007588,-899497514],Bt=new Array(80);function It(){this.init(),this._w=Bt,_t.call(this,64,56)}function Rt(t){return t<<5|t>>>27}function Ut(t){return t<<30|t>>>2}function Tt(t,r,e,n){return 0===t?r&e|~r&n:2===t?r&e|r&n|e&n:r^e^n}ct(It,_t),It.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},It.prototype._update=function(t){for(var r,e=this._w,n=0|this._a,i=0|this._b,o=0|this._c,h=0|this._d,s=0|this._e,f=0;f<16;++f)e[f]=t.readInt32BE(4*f);for(;f<80;++f)e[f]=(r=e[f-3]^e[f-8]^e[f-14]^e[f-16])<<1|r>>>31;for(var u=0;u<80;++u){var a=~~(u/20),c=Rt(n)+Tt(a,i,o,h)+s+e[u]+mt[a]|0;s=h,h=o,o=Ut(i),i=n,n=c}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=h+this._d|0,this._e=s+this._e|0},It.prototype._hash=function(){var t=At.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var Pt=It,St=it.Buffer,kt=[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],Yt=new Array(64);function xt(){this.init(),this._w=Yt,_t.call(this,64,56)}function Ot(t,r,e){return e^t&(r^e)}function Ct(t,r,e){return t&r|e&(t|r)}function Mt(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function Lt(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function Nt(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function Dt(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}ct(xt,_t),xt.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},xt.prototype._update=function(t){for(var r=this._w,e=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,h=0|this._e,s=0|this._f,f=0|this._g,u=0|this._h,a=0;a<16;++a)r[a]=t.readInt32BE(4*a);for(;a<64;++a)r[a]=Dt(r[a-2])+r[a-7]+Nt(r[a-15])+r[a-16]|0;for(var c=0;c<64;++c){var l=u+Lt(h)+Ot(h,s,f)+kt[c]+r[c]|0,p=Mt(e)+Ct(e,n,i)|0;u=f,f=s,s=h,h=o+l|0,o=i,i=n,n=e,e=l+p|0}this._a=e+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=h+this._e|0,this._f=s+this._f|0,this._g=f+this._g|0,this._h=u+this._h|0},xt.prototype._hash=function(){var t=St.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t};var zt=xt,jt=it.Buffer,Ft=new Array(64);function Wt(){this.init(),this._w=Ft,_t.call(this,64,56)}ct(Wt,zt),Wt.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},Wt.prototype._hash=function(){var t=jt.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t};var qt=Wt,Vt=it.Buffer,Jt=[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],Xt=new Array(160);function Zt(){this.init(),this._w=Xt,_t.call(this,128,112)}function Gt(t,r,e){return e^t&(r^e)}function Ht(t,r,e){return t&r|e&(t|r)}function Kt(t,r){return(t>>>28|r<<4)^(r>>>2|t<<30)^(r>>>7|t<<25)}function Qt(t,r){return(t>>>14|r<<18)^(t>>>18|r<<14)^(r>>>9|t<<23)}function $t(t,r){return(t>>>1|r<<31)^(t>>>8|r<<24)^t>>>7}function tr(t,r){return(t>>>1|r<<31)^(t>>>8|r<<24)^(t>>>7|r<<25)}function rr(t,r){return(t>>>19|r<<13)^(r>>>29|t<<3)^t>>>6}function er(t,r){return(t>>>19|r<<13)^(r>>>29|t<<3)^(t>>>6|r<<26)}function nr(t,r){return t>>>0<r>>>0?1:0}ct(Zt,_t),Zt.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},Zt.prototype._update=function(t){for(var r=this._w,e=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,h=0|this._eh,s=0|this._fh,f=0|this._gh,u=0|this._hh,a=0|this._al,c=0|this._bl,l=0|this._cl,p=0|this._dl,_=0|this._el,g=0|this._fl,w=0|this._gl,d=0|this._hl,y=0;y<32;y+=2)r[y]=t.readInt32BE(4*y),r[y+1]=t.readInt32BE(4*y+4);for(;y<160;y+=2){var v=r[y-30],b=r[y-30+1],E=$t(v,b),A=tr(b,v),m=rr(v=r[y-4],b=r[y-4+1]),B=er(b,v),I=r[y-14],R=r[y-14+1],U=r[y-32],T=r[y-32+1],P=A+R|0,S=E+I+nr(P,A)|0;S=(S=S+m+nr(P=P+B|0,B)|0)+U+nr(P=P+T|0,T)|0,r[y]=S,r[y+1]=P}for(var k=0;k<160;k+=2){S=r[k],P=r[k+1];var Y=Ht(e,n,i),x=Ht(a,c,l),O=Kt(e,a),C=Kt(a,e),M=Qt(h,_),L=Qt(_,h),N=Jt[k],D=Jt[k+1],z=Gt(h,s,f),j=Gt(_,g,w),F=d+L|0,W=u+M+nr(F,d)|0;W=(W=(W=W+z+nr(F=F+j|0,j)|0)+N+nr(F=F+D|0,D)|0)+S+nr(F=F+P|0,P)|0;var q=C+x|0,V=O+Y+nr(q,C)|0;u=f,d=w,f=s,w=g,s=h,g=_,h=o+W+nr(_=p+F|0,p)|0,o=i,p=l,i=n,l=c,n=e,c=a,e=W+V+nr(a=F+q|0,F)|0}this._al=this._al+a|0,this._bl=this._bl+c|0,this._cl=this._cl+l|0,this._dl=this._dl+p|0,this._el=this._el+_|0,this._fl=this._fl+g|0,this._gl=this._gl+w|0,this._hl=this._hl+d|0,this._ah=this._ah+e+nr(this._al,a)|0,this._bh=this._bh+n+nr(this._bl,c)|0,this._ch=this._ch+i+nr(this._cl,l)|0,this._dh=this._dh+o+nr(this._dl,p)|0,this._eh=this._eh+h+nr(this._el,_)|0,this._fh=this._fh+s+nr(this._fl,g)|0,this._gh=this._gh+f+nr(this._gl,w)|0,this._hh=this._hh+u+nr(this._hl,d)|0},Zt.prototype._hash=function(){var t=Vt.allocUnsafe(64);function r(r,e,n){t.writeInt32BE(r,n),t.writeInt32BE(e,n+4)}return r(this._ah,this._al,0),r(this._bh,this._bl,8),r(this._ch,this._cl,16),r(this._dh,this._dl,24),r(this._eh,this._el,32),r(this._fh,this._fl,40),r(this._gh,this._gl,48),r(this._hh,this._hl,56),t};var ir=Zt,or=it.Buffer,hr=new Array(160);function sr(){this.init(),this._w=hr,_t.call(this,128,112)}ct(sr,ir),sr.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},sr.prototype._hash=function(){var t=or.allocUnsafe(48);function r(r,e,n){t.writeInt32BE(r,n),t.writeInt32BE(e,n+4)}return r(this._ah,this._al,0),r(this._bh,this._bl,8),r(this._ch,this._cl,16),r(this._dh,this._dl,24),r(this._eh,this._el,32),r(this._fh,this._fl,40),t};var fr,ur,ar=sr,cr=n((function(t){var r=t.exports=function(t){t=t.toLowerCase();var e=r[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};r.sha=Et,r.sha1=Pt,r.sha224=qt,r.sha256=zt,r.sha384=ar,r.sha512=ir})),lr=st("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),pr=function(t){return y.from(cr("sha256").update(t).digest())};t.Network=void 0,(fr=t.Network||(t.Network={})).mainnet="mainnet",fr.testnet="testnet",fr.regtest="regtest",function(t){t.p2pkh="p2pkh",t.p2sh="p2sh",t.p2wpkh="p2wpkh",t.p2wsh="p2wsh",t.p2tr="p2tr"}(ur||(ur={}));var _r={0:{type:ur.p2pkh,network:t.Network.mainnet},111:{type:ur.p2pkh,network:t.Network.testnet},5:{type:ur.p2sh,network:t.Network.mainnet},196:{type:ur.p2sh,network:t.Network.testnet}},gr=function(r){var n,i=r.substr(0,2).toLowerCase();if("bc"===i||"tb"===i)return function(r){var e;try{e=r.startsWith("bc1p")||r.startsWith("tb1p")||r.startsWith("bcrt1p")?ut.decode(r):at.decode(r)}catch(t){throw new Error("Invalid address")}var n={bc:t.Network.mainnet,tb:t.Network.testnet,bcrt:t.Network.regtest}[e.prefix];if(void 0===n)throw new Error("Invalid address");var i=e.words[0];if(i<0||i>16)throw new Error("Invalid address");return{bech32:!0,network:n,address:r,type:20===at.fromWords(e.words.slice(1)).length?ur.p2wpkh:1===i?ur.p2tr:ur.p2wsh}}(r);try{n=lr.decode(r)}catch(t){throw new Error("Invalid address")}var o=n.length;if(25!==o)throw new Error("Invalid address");var h=n.readUInt8(0),s=n.slice(o-4,o),f=n.slice(0,o-4),u=pr(pr(f)).slice(0,4);if(!s.equals(u))throw new Error("Invalid address");if(!Object.keys(_r).map(Number).includes(h))throw new Error("Invalid address");return e(e({},_r[h]),{address:r,bech32:!1})},wr=function(t,r){try{var e=gr(t);return!r||r===e.network}catch(t){return!1}};t.default=wr,t.getAddressInfo=gr,t.validate=wr,Object.defineProperty(t,"__esModule",{value:!0})})); |
{ | ||
"name": "bitcoin-address-validation", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Validate any Bitcoin address - P2WSH, P2WPKH, P2SH, P2PKH - Mainnet & Testnet", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/ruigomeseu/bitcoin-address-validation", |
@@ -9,3 +9,3 @@ # bitcoin-address-validation | ||
Validate Bitcoin addresses - P2WSH, P2WPKH, P2PKH and P2SH. | ||
Validate Bitcoin addresses - P2WSH, P2WPKH, P2PKH, P2SH and P2TR. | ||
@@ -12,0 +12,0 @@ ```js |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
128551
517