diff --git a/README.md b/README.md index 5afb38f3..ad18f1d8 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ npm install wallet-address-validator * Megacoin/MEC, `'megacoin'` or `'MEC'` * Namecoin/NMC, `'namecoin'` or `'NMC'` +* NEO/NEO, `'NEO'` or `'NEO'` * Peercoin/PPCoin/PPC, `'peercoin'` or `'PPC'` * Primecoin/XPM, `'primecoin'` or `'XPM'` diff --git a/dist/wallet-address-validator.js b/dist/wallet-address-validator.js index 2dfd76e7..16d9519c 100644 --- a/dist/wallet-address-validator.js +++ b/dist/wallet-address-validator.js @@ -3344,6 +3344,10 @@ var CURRENCIES = [{ name: 'dash', symbol: 'dash', addressTypes: {prod: ['4c', '10'], testnet: ['8c', '13']} +},{ + name: 'neo', + symbol: 'neo', + addressTypes: {prod: ['17'], testnet: []} }]; diff --git a/dist/wallet-address-validator.min.js b/dist/wallet-address-validator.min.js index 805811b0..83e8cada 100644 --- a/dist/wallet-address-validator.min.js +++ b/dist/wallet-address-validator.min.js @@ -1 +1 @@ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).WAValidator=t()}}(function(){return function i(s,u,f){function a(r,t){if(!u[r]){if(!s[r]){var e="function"==typeof require&&require;if(!t&&e)return e(r,!0);if(h)return h(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var o=u[r]={exports:{}};s[r][0].call(o.exports,function(t){return a(s[r][1][t]||t)},o,o.exports,i,s,u,f)}return u[r].exports}for(var h="function"==typeof require&&require,t=0;t>=8;for(;0>=8}for(var s=0;t[s]===h&&s>16&255,i[u++]=n>>8&255,i[u++]=255&n;2===o?(n=a[t.charCodeAt(r)]<<2|a[t.charCodeAt(r+1)]>>4,i[u++]=255&n):1===o&&(n=a[t.charCodeAt(r)]<<10|a[t.charCodeAt(r+1)]<<4|a[t.charCodeAt(r+2)]>>2,i[u++]=n>>8&255,i[u++]=255&n);return i},e.fromByteArray=function(t){for(var r,e=t.length,n=e%3,o="",i=[],s=0,u=e-n;s>2],o+=f[r<<4&63],o+="=="):2===n&&(r=(t[e-2]<<8)+t[e-1],o+=f[r>>10],o+=f[r>>4&63],o+=f[r<<2&63],o+="=");return i.push(o),i.join("")};for(var f=[],a=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,i=n.length;o>18&63]+f[o>>12&63]+f[o>>6&63]+f[63&o]);return i.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},{}],3:[function(t,r,e){"use strict";var n=t("base64-js"),i=t("ieee754");e.Buffer=c,e.SlowBuffer=function(t){+t!=t&&(t=0);return c.alloc(+t)},e.INSPECT_MAX_BYTES=50;var o=2147483647;function s(t){if(o>>1;case"base64":return H(t).length;default:if(n)return L(t).length;r=(""+r).toLowerCase(),n=!0}}function d(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function y(t,r,e,n,o){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):2147483647=t.length){if(o)return-1;e=t.length-1}else if(e<0){if(!o)return-1;e=0}if("string"==typeof r&&(r=c.from(r,n)),c.isBuffer(r))return 0===r.length?-1:g(t,r,e,n,o);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):g(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function g(t,r,e,n,o){var i,s=1,u=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;u/=s=2,f/=2,e/=2}function a(t,r){return 1===s?t[r]:t.readUInt16BE(r*s)}if(o){var h=-1;for(i=e;i>>10&1023|55296),h=56320|1023&h),n.push(h),o+=c}return function(t){var r=t.length;if(r<=A)return String.fromCharCode.apply(String,t);var e="",n=0;for(;nthis.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 _(this,r,e);case"utf8":case"utf-8":return m(this,r,e);case"ascii":return E(this,r,e);case"latin1":case"binary":return B(this,r,e);case"base64":return v(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return 0r&&(t+=" ... ")),""},c.prototype.compare=function(t,r,e,n,o){if(!c.isBuffer(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===o&&(o=this.length),r<0||e>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(o<=n&&e<=r)return 0;if(o<=n)return-1;if(e<=r)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(e>>>=0)-(r>>>=0),u=Math.min(i,s),f=this.slice(n,o),a=t.slice(r,e),h=0;h>>=0,isFinite(e)?(e>>>=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var o=this.length-r;if((void 0===e||othis.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i,s,u,f,a,h,c,l,p,d=!1;;)switch(n){case"hex":return b(this,t,r,e);case"utf8":case"utf-8":return l=r,p=e,F(L(t,(c=this).length-l),c,l,p);case"ascii":return w(this,t,r,e);case"latin1":case"binary":return w(this,t,r,e);case"base64":return f=this,a=r,h=e,F(H(t),f,a,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s=r,u=e,F(function(t,r){for(var e,n,o,i=[],s=0;s>8,o=e%256,i.push(o),i.push(n);return i}(t,(i=this).length-s),i,s,u);default:if(d)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),d=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function E(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;ot.length)throw new RangeError("Index out of range")}function S(t,r,e,n,o,i){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function x(t,r,e,n,o){return r=+r,e>>>=0,o||S(t,0,e,4),i.write(t,r,e,n,23,4),e+4}function C(t,r,e,n,o){return r=+r,e>>>=0,o||S(t,0,e,8),i.write(t,r,e,n,52,8),e+8}c.prototype.slice=function(t,r){var e=this.length;(t=~~t)<0?(t+=e)<0&&(t=0):e>>=0,r>>>=0,e||T(t,r,this.length);for(var n=this[t],o=1,i=0;++i>>=0,r>>>=0,e||T(t,r,this.length);for(var n=this[t+--r],o=1;0>>=0,r||T(t,1,this.length),this[t]},c.prototype.readUInt16LE=function(t,r){return t>>>=0,r||T(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function(t,r){return t>>>=0,r||T(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function(t,r){return t>>>=0,r||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function(t,r){return t>>>=0,r||T(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function(t,r,e){t>>>=0,r>>>=0,e||T(t,r,this.length);for(var n=this[t],o=1,i=0;++i>>=0,r>>>=0,e||T(t,r,this.length);for(var n=r,o=1,i=this[t+--n];0>>=0,r||T(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,r){t>>>=0,r||T(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},c.prototype.readInt16BE=function(t,r){t>>>=0,r||T(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},c.prototype.readInt32LE=function(t,r){return t>>>=0,r||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,r){return t>>>=0,r||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function(t,r){return t>>>=0,r||T(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,r){return t>>>=0,r||T(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,r){return t>>>=0,r||T(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,r){return t>>>=0,r||T(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r>>>=0,e>>>=0,n)||U(this,t,r,e,Math.pow(2,8*e)-1,0);var o=1,i=0;for(this[r]=255&t;++i>>=0,e>>>=0,n)||U(this,t,r,e,Math.pow(2,8*e)-1,0);var o=e-1,i=1;for(this[r+o]=255&t;0<=--o&&(i*=256);)this[r+o]=t/i&255;return r+e},c.prototype.writeUInt8=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,1,255,0),this[r]=255&t,r+1},c.prototype.writeUInt16LE=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,2,65535,0),this[r]=255&t,this[r+1]=t>>>8,r+2},c.prototype.writeUInt16BE=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=255&t,r+2},c.prototype.writeUInt32LE=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t,r+4},c.prototype.writeUInt32BE=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t,r+4},c.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r>>>=0,!n){var o=Math.pow(2,8*e-1);U(this,t,r,e,o-1,-o)}var i=0,s=1,u=0;for(this[r]=255&t;++i>0)-u&255;return r+e},c.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r>>>=0,!n){var o=Math.pow(2,8*e-1);U(this,t,r,e,o-1,-o)}var i=e-1,s=1,u=0;for(this[r+i]=255&t;0<=--i&&(s*=256);)t<0&&0===u&&0!==this[r+i+1]&&(u=1),this[r+i]=(t/s>>0)-u&255;return r+e},c.prototype.writeInt8=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=255&t,r+1},c.prototype.writeInt16LE=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,2,32767,-32768),this[r]=255&t,this[r+1]=t>>>8,r+2},c.prototype.writeInt16BE=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=255&t,r+2},c.prototype.writeInt32LE=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,4,2147483647,-2147483648),this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},c.prototype.writeInt32BE=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t,r+4},c.prototype.writeFloatLE=function(t,r,e){return x(this,t,r,!0,e)},c.prototype.writeFloatBE=function(t,r,e){return x(this,t,r,!1,e)},c.prototype.writeDoubleLE=function(t,r,e){return C(this,t,r,!0,e)},c.prototype.writeDoubleBE=function(t,r,e){return C(this,t,r,!1,e)},c.prototype.copy=function(t,r,e,n){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(i=r;i>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;i.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;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return i}function H(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(I,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,r,e,n){for(var o=0;o=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function O(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function M(t){return t!=t}},{"base64-js":2,ieee754:4}],4:[function(t,r,e){e.read=function(t,r,e,n,o){var i,s,u=8*o-n-1,f=(1<>1,h=-7,c=e?o-1:0,l=e?-1:1,p=t[r+c];for(c+=l,i=p&(1<<-h)-1,p>>=-h,h+=u;0>=-h,h+=n;0>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?1:-1,y=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(u=isNaN(r)?1:0,s=h):(s=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-s))<1&&(s--,f*=2),2<=(r+=1<=s+c?l/f:l*Math.pow(2,1-c))*f&&(s++,f/=2),h<=s+c?(u=0,s=h):1<=s+c?(u=(r*f-1)*Math.pow(2,o),s+=c):(u=r*Math.pow(2,c-1)*Math.pow(2,o),s=0));8<=o;t[e+p]=255&u,p+=d,u/=256,o-=8);for(s=s<= 1");if(0!==s.lastIndexOf("SHA-",0))throw Error("Chosen SHA variant is not supported");if(c=function(t,r){return M(t,r,s)},l=function(t,r,e,n){var o,i;if("SHA-224"!==s&&"SHA-256"!==s)throw Error("Unexpected error in SHA-2 implementation");for(o=15+(r+65>>>9<<4),i=16;t.length<=o;)t.push(0);for(t[r>>>5]|=128<<24-r%32,r+=e,t[o]=4294967295&r,t[o-1]=r/4294967296|0,e=t.length,r=0;r>>3)/4-1,n>>5;for(t=(r=f(t,g,b)).binLen,e=r.value,r=t>>>5,n=0;n>>5),b=t%h,m=!0},this.getHash=function(t,r){var e,n,o,i;if(!0===w)throw Error("Cannot call getHash after setting HMAC key");switch(o=k(r),t){case"HEX":e=function(t){return A(t,a,o)};break;case"B64":e=function(t){return E(t,a,o)};break;case"BYTES":e=function(t){return B(t,a)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}e=function(t){return _(t,a)};break;default:throw Error("format must be HEX, B64, BYTES, or ARRAYBUFFER")}for(i=l(g.slice(),b,y,p(u)),n=1;n>>2]>>>8*(3+n%4*-1),i+="0123456789abcdef".charAt(o>>>4&15)+"0123456789abcdef".charAt(15&o);return e.outputUpper?i.toUpperCase():i}function E(t,r,e){var n,o,i,s="",u=r/8;for(n=0;n>>2]:0,i=n+2>>2]:0,i=(t[n>>>2]>>>8*(3+n%4*-1)&255)<<16|(o>>>8*(3+(n+1)%4*-1)&255)<<8|i>>>8*(3+(n+2)%4*-1)&255,o=0;o<4;o+=1)s+=8*n+6*o<=r?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(i>>>6*(3-o)&63):e.b64Pad;return s}function B(t,r){var e,n,o="",i=r/8;for(e=0;e>>2]>>>8*(3+e%4*-1)&255,o+=String.fromCharCode(n);return o}function _(t,r){var e,n,o=r/8,i=new ArrayBuffer(o);for(n=new Uint8Array(i),e=0;e>>2]>>>8*(3+e%4*-1)&255;return i}function k(t){var r={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},r.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(r.b64Pad=t.b64Pad),"boolean"!=typeof r.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof r.b64Pad)throw Error("Invalid b64Pad formatting option");return r}function T(t,l){var r;switch(l){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":r=function(t,r,e){var n,o,i,s,u,f=t.length;if(0!=f%2)throw Error("String of HEX type must be in byte increments");for(r=r||[0],u=(e=e||0)>>>3,n=0;n>>1)+u)>>>2;r.length<=i;)r.push(0);r[i]|=o<<8*(3+s%4*-1)}return{value:r,binLen:4*f+e}};break;case"TEXT":r=function(t,r,e){var n,o,i,s,u,f,a,h,c=0;if(r=r||[0],u=(e=e||0)>>>3,"UTF8"===l)for(h=3,i=0;i>>6),o.push(128|63&n)):n<55296||57344<=n?o.push(224|n>>>12,128|n>>>6&63,128|63&n):(i+=1,n=65536+((1023&n)<<10|1023&t.charCodeAt(i)),o.push(240|n>>>18,128|n>>>12&63,128|n>>>6&63,128|63&n)),s=0;s>>2;r.length<=f;)r.push(0);r[f]|=o[s]<<8*(h+a%4*-1),c+=1}else if("UTF16BE"===l||"UTF16LE"===l)for(h=2,o="UTF16LE"===l||"UTF16LE"!==l&&!1,i=0;i>>8),f=(a=c+u)>>>2;r.length<=f;)r.push(0);r[f]|=n<<8*(h+a%4*-1),c+=2}return{value:r,binLen:8*c+e}};break;case"B64":r=function(t,r,e){var n,o,i,s,u,f,a,h=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(o=t.indexOf("="),t=t.replace(/\=/g,""),-1!==o&&o>=8;for(;0>=8}for(var s=0;t[s]===h&&s>16&255,i[u++]=n>>8&255,i[u++]=255&n;2===o?(n=a[t.charCodeAt(r)]<<2|a[t.charCodeAt(r+1)]>>4,i[u++]=255&n):1===o&&(n=a[t.charCodeAt(r)]<<10|a[t.charCodeAt(r+1)]<<4|a[t.charCodeAt(r+2)]>>2,i[u++]=n>>8&255,i[u++]=255&n);return i},e.fromByteArray=function(t){for(var r,e=t.length,n=e%3,o="",i=[],s=0,u=e-n;s>2],o+=f[r<<4&63],o+="=="):2===n&&(r=(t[e-2]<<8)+t[e-1],o+=f[r>>10],o+=f[r>>4&63],o+=f[r<<2&63],o+="=");return i.push(o),i.join("")};for(var f=[],a=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,i=n.length;o>18&63]+f[o>>12&63]+f[o>>6&63]+f[63&o]);return i.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},{}],3:[function(t,r,e){"use strict";var n=t("base64-js"),i=t("ieee754");e.Buffer=c,e.SlowBuffer=function(t){+t!=t&&(t=0);return c.alloc(+t)},e.INSPECT_MAX_BYTES=50;var o=2147483647;function s(t){if(o>>1;case"base64":return H(t).length;default:if(n)return L(t).length;r=(""+r).toLowerCase(),n=!0}}function d(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function y(t,r,e,n,o){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):2147483647=t.length){if(o)return-1;e=t.length-1}else if(e<0){if(!o)return-1;e=0}if("string"==typeof r&&(r=c.from(r,n)),c.isBuffer(r))return 0===r.length?-1:g(t,r,e,n,o);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):g(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function g(t,r,e,n,o){var i,s=1,u=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;u/=s=2,f/=2,e/=2}function a(t,r){return 1===s?t[r]:t.readUInt16BE(r*s)}if(o){var h=-1;for(i=e;i>>10&1023|55296),h=56320|1023&h),n.push(h),o+=c}return function(t){var r=t.length;if(r<=A)return String.fromCharCode.apply(String,t);var e="",n=0;for(;nthis.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 _(this,r,e);case"utf8":case"utf-8":return m(this,r,e);case"ascii":return E(this,r,e);case"latin1":case"binary":return B(this,r,e);case"base64":return v(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return 0r&&(t+=" ... ")),""},c.prototype.compare=function(t,r,e,n,o){if(!c.isBuffer(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===o&&(o=this.length),r<0||e>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(o<=n&&e<=r)return 0;if(o<=n)return-1;if(e<=r)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(e>>>=0)-(r>>>=0),u=Math.min(i,s),f=this.slice(n,o),a=t.slice(r,e),h=0;h>>=0,isFinite(e)?(e>>>=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var o=this.length-r;if((void 0===e||othis.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i,s,u,f,a,h,c,l,p,d=!1;;)switch(n){case"hex":return b(this,t,r,e);case"utf8":case"utf-8":return l=r,p=e,F(L(t,(c=this).length-l),c,l,p);case"ascii":return w(this,t,r,e);case"latin1":case"binary":return w(this,t,r,e);case"base64":return f=this,a=r,h=e,F(H(t),f,a,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s=r,u=e,F(function(t,r){for(var e,n,o,i=[],s=0;s>8,o=e%256,i.push(o),i.push(n);return i}(t,(i=this).length-s),i,s,u);default:if(d)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),d=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function E(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;ot.length)throw new RangeError("Index out of range")}function S(t,r,e,n,o,i){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function x(t,r,e,n,o){return r=+r,e>>>=0,o||S(t,0,e,4),i.write(t,r,e,n,23,4),e+4}function C(t,r,e,n,o){return r=+r,e>>>=0,o||S(t,0,e,8),i.write(t,r,e,n,52,8),e+8}c.prototype.slice=function(t,r){var e=this.length;(t=~~t)<0?(t+=e)<0&&(t=0):e>>=0,r>>>=0,e||T(t,r,this.length);for(var n=this[t],o=1,i=0;++i>>=0,r>>>=0,e||T(t,r,this.length);for(var n=this[t+--r],o=1;0>>=0,r||T(t,1,this.length),this[t]},c.prototype.readUInt16LE=function(t,r){return t>>>=0,r||T(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function(t,r){return t>>>=0,r||T(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function(t,r){return t>>>=0,r||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function(t,r){return t>>>=0,r||T(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function(t,r,e){t>>>=0,r>>>=0,e||T(t,r,this.length);for(var n=this[t],o=1,i=0;++i>>=0,r>>>=0,e||T(t,r,this.length);for(var n=r,o=1,i=this[t+--n];0>>=0,r||T(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,r){t>>>=0,r||T(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},c.prototype.readInt16BE=function(t,r){t>>>=0,r||T(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},c.prototype.readInt32LE=function(t,r){return t>>>=0,r||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,r){return t>>>=0,r||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function(t,r){return t>>>=0,r||T(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,r){return t>>>=0,r||T(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,r){return t>>>=0,r||T(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,r){return t>>>=0,r||T(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r>>>=0,e>>>=0,n)||U(this,t,r,e,Math.pow(2,8*e)-1,0);var o=1,i=0;for(this[r]=255&t;++i>>=0,e>>>=0,n)||U(this,t,r,e,Math.pow(2,8*e)-1,0);var o=e-1,i=1;for(this[r+o]=255&t;0<=--o&&(i*=256);)this[r+o]=t/i&255;return r+e},c.prototype.writeUInt8=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,1,255,0),this[r]=255&t,r+1},c.prototype.writeUInt16LE=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,2,65535,0),this[r]=255&t,this[r+1]=t>>>8,r+2},c.prototype.writeUInt16BE=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=255&t,r+2},c.prototype.writeUInt32LE=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t,r+4},c.prototype.writeUInt32BE=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t,r+4},c.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r>>>=0,!n){var o=Math.pow(2,8*e-1);U(this,t,r,e,o-1,-o)}var i=0,s=1,u=0;for(this[r]=255&t;++i>0)-u&255;return r+e},c.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r>>>=0,!n){var o=Math.pow(2,8*e-1);U(this,t,r,e,o-1,-o)}var i=e-1,s=1,u=0;for(this[r+i]=255&t;0<=--i&&(s*=256);)t<0&&0===u&&0!==this[r+i+1]&&(u=1),this[r+i]=(t/s>>0)-u&255;return r+e},c.prototype.writeInt8=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=255&t,r+1},c.prototype.writeInt16LE=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,2,32767,-32768),this[r]=255&t,this[r+1]=t>>>8,r+2},c.prototype.writeInt16BE=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=255&t,r+2},c.prototype.writeInt32LE=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,4,2147483647,-2147483648),this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},c.prototype.writeInt32BE=function(t,r,e){return t=+t,r>>>=0,e||U(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t,r+4},c.prototype.writeFloatLE=function(t,r,e){return x(this,t,r,!0,e)},c.prototype.writeFloatBE=function(t,r,e){return x(this,t,r,!1,e)},c.prototype.writeDoubleLE=function(t,r,e){return C(this,t,r,!0,e)},c.prototype.writeDoubleBE=function(t,r,e){return C(this,t,r,!1,e)},c.prototype.copy=function(t,r,e,n){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(i=r;i>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;i.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;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return i}function H(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(I,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,r,e,n){for(var o=0;o=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function O(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function M(t){return t!=t}},{"base64-js":2,ieee754:4}],4:[function(t,r,e){e.read=function(t,r,e,n,o){var i,s,u=8*o-n-1,f=(1<>1,h=-7,c=e?o-1:0,l=e?-1:1,p=t[r+c];for(c+=l,i=p&(1<<-h)-1,p>>=-h,h+=u;0>=-h,h+=n;0>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?1:-1,y=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(u=isNaN(r)?1:0,s=h):(s=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-s))<1&&(s--,f*=2),2<=(r+=1<=s+c?l/f:l*Math.pow(2,1-c))*f&&(s++,f/=2),h<=s+c?(u=0,s=h):1<=s+c?(u=(r*f-1)*Math.pow(2,o),s+=c):(u=r*Math.pow(2,c-1)*Math.pow(2,o),s=0));8<=o;t[e+p]=255&u,p+=d,u/=256,o-=8);for(s=s<= 1");if(0!==s.lastIndexOf("SHA-",0))throw Error("Chosen SHA variant is not supported");if(c=function(t,r){return M(t,r,s)},l=function(t,r,e,n){var o,i;if("SHA-224"!==s&&"SHA-256"!==s)throw Error("Unexpected error in SHA-2 implementation");for(o=15+(r+65>>>9<<4),i=16;t.length<=o;)t.push(0);for(t[r>>>5]|=128<<24-r%32,r+=e,t[o]=4294967295&r,t[o-1]=r/4294967296|0,e=t.length,r=0;r>>3)/4-1,n>>5;for(t=(r=f(t,g,b)).binLen,e=r.value,r=t>>>5,n=0;n>>5),b=t%h,m=!0},this.getHash=function(t,r){var e,n,o,i;if(!0===w)throw Error("Cannot call getHash after setting HMAC key");switch(o=k(r),t){case"HEX":e=function(t){return A(t,a,o)};break;case"B64":e=function(t){return E(t,a,o)};break;case"BYTES":e=function(t){return B(t,a)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}e=function(t){return _(t,a)};break;default:throw Error("format must be HEX, B64, BYTES, or ARRAYBUFFER")}for(i=l(g.slice(),b,y,p(u)),n=1;n>>2]>>>8*(3+n%4*-1),i+="0123456789abcdef".charAt(o>>>4&15)+"0123456789abcdef".charAt(15&o);return e.outputUpper?i.toUpperCase():i}function E(t,r,e){var n,o,i,s="",u=r/8;for(n=0;n>>2]:0,i=n+2>>2]:0,i=(t[n>>>2]>>>8*(3+n%4*-1)&255)<<16|(o>>>8*(3+(n+1)%4*-1)&255)<<8|i>>>8*(3+(n+2)%4*-1)&255,o=0;o<4;o+=1)s+=8*n+6*o<=r?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(i>>>6*(3-o)&63):e.b64Pad;return s}function B(t,r){var e,n,o="",i=r/8;for(e=0;e>>2]>>>8*(3+e%4*-1)&255,o+=String.fromCharCode(n);return o}function _(t,r){var e,n,o=r/8,i=new ArrayBuffer(o);for(n=new Uint8Array(i),e=0;e>>2]>>>8*(3+e%4*-1)&255;return i}function k(t){var r={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},r.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(r.b64Pad=t.b64Pad),"boolean"!=typeof r.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof r.b64Pad)throw Error("Invalid b64Pad formatting option");return r}function T(t,l){var r;switch(l){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":r=function(t,r,e){var n,o,i,s,u,f=t.length;if(0!=f%2)throw Error("String of HEX type must be in byte increments");for(r=r||[0],u=(e=e||0)>>>3,n=0;n>>1)+u)>>>2;r.length<=i;)r.push(0);r[i]|=o<<8*(3+s%4*-1)}return{value:r,binLen:4*f+e}};break;case"TEXT":r=function(t,r,e){var n,o,i,s,u,f,a,h,c=0;if(r=r||[0],u=(e=e||0)>>>3,"UTF8"===l)for(h=3,i=0;i>>6),o.push(128|63&n)):n<55296||57344<=n?o.push(224|n>>>12,128|n>>>6&63,128|63&n):(i+=1,n=65536+((1023&n)<<10|1023&t.charCodeAt(i)),o.push(240|n>>>18,128|n>>>12&63,128|n>>>6&63,128|63&n)),s=0;s>>2;r.length<=f;)r.push(0);r[f]|=o[s]<<8*(h+a%4*-1),c+=1}else if("UTF16BE"===l||"UTF16LE"===l)for(h=2,o="UTF16LE"===l||"UTF16LE"!==l&&!1,i=0;i>>8),f=(a=c+u)>>>2;r.length<=f;)r.push(0);r[f]|=n<<8*(h+a%4*-1),c+=2}return{value:r,binLen:8*c+e}};break;case"B64":r=function(t,r,e){var n,o,i,s,u,f,a,h=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(o=t.indexOf("="),t=t.replace(/\=/g,""),-1!==o&&o