!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.Multiaddr=r():t.Multiaddr=r()}(window,function(){return function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=5)}([function(t,r,e){"use strict";(function(t){var n=e(7),o=e(8),i=e(9);function u(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function f(t,r){if(u()=u())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u().toString(16)+" bytes");return 0|t}function d(t,r){if(a.isBuffer(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 F(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 F(t).length;r=(""+r).toLowerCase(),n=!0}}function g(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 x(this,r,e);case"utf8":case"utf-8":return _(this,r,e);case"ascii":return P(this,r,e);case"latin1":case"binary":return R(this,r,e);case"base64":return B(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function y(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function w(t,r,e,n,o){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=o?0:t.length-1),e<0&&(e=t.length+e),e>=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=a.from(r,n)),a.isBuffer(r))return 0===r.length?-1:v(t,r,e,n,o);if("number"==typeof r)return r&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):v(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function v(t,r,e,n,o){var i,u=1,f=t.length,a=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=2,f/=2,a/=2,e/=2}function s(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(o){var c=-1;for(i=e;if&&(e=f-a),i=e;i>=0;i--){for(var h=!0,l=0;lo&&(n=o):n=o;var i=r.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var u=0;u>8,o=e%256,i.push(o),i.push(n);return i}(r,t.length-e),t,e,n)}function B(t,r,e){return 0===r&&e===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(r,e))}function _(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o239?4:s>223?3:s>191?2:1;if(o+h<=e)switch(h){case 1:s<128&&(c=s);break;case 2:128==(192&(i=t[o+1]))&&(a=(31&s)<<6|63&i)>127&&(c=a);break;case 3:i=t[o+1],u=t[o+2],128==(192&i)&&128==(192&u)&&(a=(15&s)<<12|(63&i)<<6|63&u)>2047&&(a<55296||a>57343)&&(c=a);break;case 4:i=t[o+1],u=t[o+2],f=t[o+3],128==(192&i)&&128==(192&u)&&128==(192&f)&&(a=(15&s)<<18|(63&i)<<12|(63&u)<<6|63&f)>65535&&a<1114112&&(c=a)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=h}return function(t){var r=t.length;if(r<=C)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},a.prototype.compare=function(t,r,e,n,o){if(!a.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(n>=o&&r>=e)return 0;if(n>=o)return-1;if(r>=e)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),u=(e>>>=0)-(r>>>=0),f=Math.min(i,u),s=this.slice(n,o),c=t.slice(r,e),h=0;ho)&&(e=o),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return m(this,t,r,e);case"utf8":case"utf-8":return b(this,t,r,e);case"ascii":return A(this,t,r,e);case"latin1":case"binary":return E(this,t,r,e);case"base64":return S(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,r,e);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function P(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;on)&&(e=n);for(var o="",i=r;ie)throw new RangeError("Trying to access beyond buffer length")}function O(t,r,e,n,o,i){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||rt.length)throw new RangeError("Index out of range")}function M(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-e,2);o>>8*(n?o:1-o)}function L(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-e,4);o>>8*(n?o:3-o)&255}function Y(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 j(t,r,e,n,i){return i||Y(t,0,e,4),o.write(t,r,e,n,23,4),e+4}function N(t,r,e,n,i){return i||Y(t,0,e,8),o.write(t,r,e,n,52,8),e+8}a.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),r0&&(o*=256);)n+=this[t+--r]*o;return n},a.prototype.readUInt8=function(t,r){return r||I(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,r){return r||I(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,r){return r||I(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,r){return r||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,r){return r||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||I(t,r,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*r)),n},a.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||I(t,r,this.length);for(var n=r,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*r)),i},a.prototype.readInt8=function(t,r){return r||I(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,r){r||I(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},a.prototype.readInt16BE=function(t,r){r||I(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},a.prototype.readInt32LE=function(t,r){return r||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,r){return r||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,r){return r||I(t,4,this.length),o.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,r){return r||I(t,4,this.length),o.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,r){return r||I(t,8,this.length),o.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,r){return r||I(t,8,this.length),o.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||O(this,t,r,e,Math.pow(2,8*e)-1,0);var o=1,i=0;for(this[r]=255&t;++i=0&&(i*=256);)this[r+o]=t/i&255;return r+e},a.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},a.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):M(this,t,r,!0),r+2},a.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):M(this,t,r,!1),r+2},a.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):L(this,t,r,!0),r+4},a.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):L(this,t,r,!1),r+4},a.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);O(this,t,r,e,o-1,-o)}var i=0,u=1,f=0;for(this[r]=255&t;++i>0)-f&255;return r+e},a.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);O(this,t,r,e,o-1,-o)}var i=e-1,u=1,f=0;for(this[r+i]=255&t;--i>=0&&(u*=256);)t<0&&0===f&&0!==this[r+i+1]&&(f=1),this[r+i]=(t/u>>0)-f&255;return r+e},a.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},a.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):M(this,t,r,!0),r+2},a.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):M(this,t,r,!1),r+2},a.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):L(this,t,r,!0),r+4},a.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):L(this,t,r,!1),r+4},a.prototype.writeFloatLE=function(t,r,e){return j(this,t,r,!0,e)},a.prototype.writeFloatBE=function(t,r,e){return j(this,t,r,!1,e)},a.prototype.writeDoubleLE=function(t,r,e){return N(this,t,r,!0,e)},a.prototype.writeDoubleBE=function(t,r,e){return N(this,t,r,!1,e)},a.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=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=0;--o)t[o+r]=this[o+e];else if(i<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(i=r;i55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&i.push(239,191,189);continue}if(u+1===n){(r-=3)>-1&&i.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&i.push(239,191,189),o=e;continue}e=65536+(o-55296<<10|e-56320)}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;i.push(e)}else if(e<2048){if((r-=2)<0)break;i.push(e>>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 $(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(k,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,r,e,n){for(var o=0;o=r.length||o>=t.length);++o)r[o+e]=t[o];return o}}).call(this,e(3))},function(t,r,e){"use strict";function n(t){if("number"==typeof t){if(n.codes[t])return n.codes[t];throw new Error("no protocol with code: "+t)}if("string"==typeof t||t instanceof String){if(n.names[t])return n.names[t];throw new Error("no protocol with name: "+t)}throw new Error("invalid protocol id type: "+t)}var o=-1;function i(t,r,e,n,o){return{code:t,size:r,name:e,resolvable:Boolean(n),path:Boolean(o)}}n.lengthPrefixedVarSize=o,n.V=o,n.table=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,o,"ip6zone"],[53,o,"dns","resolvable"],[54,o,"dns4","resolvable"],[55,o,"dns6","resolvable"],[56,o,"dnsaddr","resolvable"],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,o,"unix",!1,"path"],[421,o,"p2p"],[421,o,"ipfs"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,o,"garlic64"],[460,0,"quic"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"]],n.names={},n.codes={},n.table.map(function(t){var r=i.apply(null,t);n.codes[r.code]=r,n.names[r.name]=r}),n.object=i,t.exports=n},function(t,r,e){"use strict";t.exports={encode:e(22),decode:e(23),encodingLength:e(24)}},function(t,r,e){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o;o=function(){return this}();try{o=o||new Function("return this")()}catch(i){"object"===("undefined"==typeof window?"undefined":n(window))&&(o=window)}t.exports=o},function(t,r,e){"use strict";var n=e(16);t.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},function(t,r,e){t.exports=e(6)},function(t,r,e){"use strict";(function(r){var n=e(10),o=e(1),i=e(2),u=e(4),f=e(25).proto(function(t){if(!(this instanceof f))return new f(t);if(null==t&&(t=""),t instanceof r)this.buffer=n.fromBuffer(t);else if("string"==typeof t||t instanceof String){if(t.length>0&&"/"!==t.charAt(0))throw new Error('multiaddr "'.concat(t,'" must start with a "/"'));this.buffer=n.fromString(t)}else{if(!(t.buffer&&t.protos&&t.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=n.fromBuffer(t.buffer)}},{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});f.prototype.toString=function(){return n.bufferToString(this.buffer)},f.prototype.toJSON=f.prototype.toString,f.prototype.toOptions=function(){var t={},r=this.toString().split("/");return t.family="ip4"===r[1]?"ipv4":"ipv6",t.host=r[2],t.transport=r[3],t.port=r[4],t},f.prototype.inspect=function(){return""},f.prototype.protos=function(){return this.protoCodes().map(function(t){return Object.assign({},o(t))})},f.prototype.protoCodes=function(){for(var t=[],r=this.buffer,e=0;e0?u-4:u;for(e=0;e>16&255,a[c++]=r>>8&255,a[c++]=255&r;2===f&&(r=o[t.charCodeAt(e)]<<2|o[t.charCodeAt(e+1)]>>4,a[c++]=255&r);1===f&&(r=o[t.charCodeAt(e)]<<10|o[t.charCodeAt(e+1)]<<4|o[t.charCodeAt(e+2)]>>2,a[c++]=r>>8&255,a[c++]=255&r);return a},r.fromByteArray=function(t){for(var r,e=t.length,o=e%3,i=[],u=0,f=e-o;uf?f:u+16383));1===o?(r=t[e-1],i.push(n[r>>2]+n[r<<4&63]+"==")):2===o&&(r=(t[e-2]<<8)+t[e-1],i.push(n[r>>10]+n[r>>4&63]+n[r<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,a=u.length;f0)throw new Error("Invalid string. Length must be a multiple of 4");var e=t.indexOf("=");return-1===e&&(e=r),[e,e===r?0:4-e%4]}function c(t,r,e){for(var o,i,u=[],f=r;f>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return u.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,r,e){"use strict";r.read=function(t,r,e,n,o){var i,u,f=8*o-n-1,a=(1<>1,c=-7,h=e?o-1:0,l=e?-1:1,p=t[r+h];for(h+=l,i=p&(1<<-c)-1,p>>=-c,c+=f;c>0;i=256*i+t[r+h],h+=l,c-=8);for(u=i&(1<<-c)-1,i>>=-c,c+=n;c>0;u=256*u+t[r+h],h+=l,c-=8);if(0===i)i=1-s;else{if(i===a)return u?NaN:1/0*(p?-1:1);u+=Math.pow(2,n),i-=s}return(p?-1:1)*u*Math.pow(2,i-n)},r.write=function(t,r,e,n,o,i){var u,f,a,s=8*i-o-1,c=(1<>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?1:-1,g=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,u=c):(u=Math.floor(Math.log(r)/Math.LN2),r*(a=Math.pow(2,-u))<1&&(u--,a*=2),(r+=u+h>=1?l/a:l*Math.pow(2,1-h))*a>=2&&(u++,a/=2),u+h>=c?(f=0,u=c):u+h>=1?(f=(r*a-1)*Math.pow(2,o),u+=h):(f=r*Math.pow(2,h-1)*Math.pow(2,o),u=0));o>=8;t[e+p]=255&f,p+=d,f/=256,o-=8);for(u=u<0;t[e+p]=255&u,p+=d,u/=256,s-=8);t[e+p-d]|=128*g}},function(t,r,e){"use strict";var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,r,e){"use strict";(function(r){var n=e(11),o=e(1),i=e(2);function u(t){var r=[],e=t.split("/").slice(1);if(1===e.length&&""===e[0])return[];for(var n=0;n=e.length)throw w("invalid address: "+t);if(u.path){r.push([i,y(e.slice(n).join("/"))]);break}r.push([i,e[n]])}else r.push([i])}return r}function f(t){var r=[];return t.map(function(t){var e=v(t);r.push(e.name),t.length>1&&r.push(t[1])}),y(r.join("/"))}function a(t){return t.map(function(t){Array.isArray(t)||(t=[t]);var r=v(t);return t.length>1?[r.code,n.toBuffer(r.code,t[1])]:[r.code]})}function s(t){return t.map(function(t){var r=v(t);return t.length>1?[r.code,n.toString(r.code,t[1])]:[r.code]})}function c(t){return d(r.concat(t.map(function(t){var e=v(t),n=r.from(i.encode(e.code));return t.length>1&&(n=r.concat([n,t[1]])),n})))}function h(t,r){return t.size>0?t.size/8:0===t.size?0:i.decode(r)+i.decode.bytes}function l(t){for(var r=[],e=0;et.length)throw w("Invalid address buffer: "+t.toString("hex"));r.push([n,a])}else r.push([n]),e+=u}return r}function p(t){return c(a(u(t=y(t))))}function d(t){var e=g(t);if(e)throw e;return r.from(t)}function g(t){try{l(t)}catch(r){return r}}function y(t){return"/"+t.trim().split("/").filter(function(t){return t}).join("/")}function w(t){return new Error("Error parsing address: "+t)}function v(t){return o(t[0])}t.exports={stringToStringTuples:u,stringTuplesToString:f,tuplesToStringTuples:s,stringTuplesToTuples:a,bufferToTuples:l,tuplesToBuffer:c,bufferToString:function(t){return f(s(l(t)))},stringToBuffer:p,fromString:function(t){return p(t)},fromBuffer:d,validateBuffer:g,isValidBuffer:function(t){return void 0===g(t)},cleanPath:y,ParseError:w,protoFromTuple:v,sizeForAddr:h}}).call(this,e(0).Buffer)},function(t,r,e){"use strict";(function(r){var n=e(12),o=e(14),i=e(1),u=e(4),f=e(18),a=e(2);function s(t,e){return e instanceof r?s.toString(t,e):s.toBuffer(t,e)}function c(t){if(!o(t))throw new Error("invalid ip address");return n.toBuffer(t)}function h(t){var e=r.alloc(2);return e.writeUInt16BE(t,0),e}function l(t){return t.readUInt16BE(0)}function p(t){var r=t.slice(0,t.length-2),e=t.slice(t.length-2);return f.encode(r).toString("ascii").toLowerCase()+":"+l(e)}t.exports=s,s.toString=function(t,r){switch((t=i(t)).code){case 4:case 41:return function(t){var r=n.toString(t);if(!o(r))throw new Error("invalid ip address");return r}(r);case 6:case 273:case 33:case 132:return l(r);case 53:case 54:case 55:case 56:case 400:return function(t){var r=a.decode(t);if((t=t.slice(a.decode.bytes)).length!==r)throw new Error("inconsistent lengths");return t.toString()}(r);case 421:return function(t){var r=a.decode(t),e=t.slice(a.decode.bytes);if(e.length!==r)throw new Error("inconsistent lengths");return u.encode(e)}(r);case 444:case 445:return p(r);default:return r.toString("hex")}},s.toBuffer=function(t,e){switch((t=i(t)).code){case 4:case 41:return c(e);case 6:case 273:case 33:case 132:return h(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:return function(t){var e=r.from(t),n=r.from(a.encode(e.length));return r.concat([n,e])}(e);case 421:return n=e,o=r.from(u.decode(n)),s=r.from(a.encode(o.length)),r.concat([s,o]);case 444:return function(t){var e=t.split(":");if(2!==e.length)throw new Error("failed to parse onion addr: "+e+" does not contain a port number");if(16!==e[0].length)throw new Error("failed to parse onion addr: "+e[0]+" not a Tor onion address.");var n=r.from(f.decode.asBytes(e[0].toUpperCase())),o=parseInt(e[1],10);if(o<1||o>65536)throw new Error("Port number is not in range(1, 65536)");var i=h(o);return r.concat([n,i])}(e);case 445:return function(t){var e=t.split(":");if(2!==e.length)throw new Error("failed to parse onion addr: "+e+" does not contain a port number");if(56!==e[0].length)throw new Error("failed to parse onion addr: "+e[0]+" not a Tor onion3 address.");var n=r.from(f.decode.asBytes(e[0].toUpperCase())),o=parseInt(e[1],10);if(o<1||o>65536)throw new Error("Port number is not in range(1, 65536)");var i=h(o);return r.concat([n,i])}(e);default:return r.from(e,"hex")}var n,o,s}}).call(this,e(0).Buffer)},function(t,r,e){"use strict";var n=r,o=e(0).Buffer,i=e(13);n.toBuffer=function(t,r,e){var n;if(e=~~e,this.isV4Format(t))n=r||new o(e+4),t.split(/\./g).map(function(t){n[e++]=255&parseInt(t,10)});else if(this.isV6Format(t)){var i,u=t.split(":",8);for(i=0;i0;i--)a.push("0");u.splice.apply(u,a)}for(n=r||new o(e+16),i=0;i>8&255,n[e++]=255&s}}if(!n)throw Error("Invalid ip address: "+t);return n},n.toString=function(t,r,e){r=~~r;var n=[];if(4===(e=e||t.length-r)){for(var o=0;o32?"ipv6":a(r))&&(e=16);for(var i=new o(e),u=0,f=i.length;u>s)}return n.toString(i)},n.mask=function(t,r){t=n.toBuffer(t),r=n.toBuffer(r);var e=new o(Math.max(t.length,r.length)),i=0;if(t.length===r.length)for(i=0;it.length&&(o=r,i=t);var u=o.length-i.length;for(e=u;e>>0},n.fromLong=function(t){return(t>>>24)+"."+(t>>16&255)+"."+(t>>8&255)+"."+(255&t)}},function(t,r,e){"use strict";r.endianness=function(){return"LE"},r.hostname=function(){return"undefined"!=typeof location?location.hostname:""},r.loadavg=function(){return[]},r.uptime=function(){return 0},r.freemem=function(){return Number.MAX_VALUE},r.totalmem=function(){return Number.MAX_VALUE},r.cpus=function(){return[]},r.type=function(){return"Browser"},r.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},r.networkInterfaces=r.getNetworkInterfaces=function(){return{}},r.arch=function(){return"javascript"},r.platform=function(){return"browser"},r.tmpdir=r.tmpDir=function(){return"/tmp"},r.EOL="\n",r.homedir=function(){return"/"}},function(t,r,e){"use strict";var n=e(15),o=t.exports=function(t){return n({exact:!0}).test(t)};o.v4=function(t){return n.v4({exact:!0}).test(t)},o.v6=function(t){return n.v6({exact:!0}).test(t)}},function(t,r,e){"use strict";var n="(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(?:\\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3}",o="[0-9a-fA-F]{1,4}",i="\n(\n(?:".concat(o,":){7}(?:").concat(o,"|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:").concat(o,":){6}(?:").concat(n,"|:").concat(o,"|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:").concat(o,":){5}(?::").concat(n,"|(:").concat(o,"){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:").concat(o,":){4}(?:(:").concat(o,"){0,1}:").concat(n,"|(:").concat(o,"){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:").concat(o,":){3}(?:(:").concat(o,"){0,2}:").concat(n,"|(:").concat(o,"){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:").concat(o,":){2}(?:(:").concat(o,"){0,3}:").concat(n,"|(:").concat(o,"){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:").concat(o,":){1}(?:(:").concat(o,"){0,4}:").concat(n,"|(:").concat(o,"){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::((?::").concat(o,"){0,5}:").concat(n,"|(?::").concat(o,"){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(%[0-9a-zA-Z]{1,})? // %eth0 %1\n").replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),u=t.exports=function(t){return t&&t.exact?new RegExp("(?:^".concat(n,"$)|(?:^").concat(i,"$)")):new RegExp("(?:".concat(n,")|(?:").concat(i,")"),"g")};u.v4=function(t){return t&&t.exact?new RegExp("^".concat(n,"$")):new RegExp(n,"g")},u.v6=function(t){return t&&t.exact?new RegExp("^".concat(i,"$")):new RegExp(i,"g")}},function(t,r,e){"use strict";var n=e(17).Buffer;t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");var r=new Uint8Array(256);r.fill(255);for(var e=0;e>>0,c=new Uint8Array(s);t[e];){var h=r[t.charCodeAt(e)];if(255===h)return;for(var l=0,p=s-1;(0!==h||l>>0,c[p]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");i=l,e++}if(" "!==t[e]){for(var d=s-i;d!==s&&0===c[d];)d++;var g=n.allocUnsafe(o+(s-d));g.fill(0,0,o);for(var y=o;d!==s;)g[y++]=c[d++];return g}}}return{encode:function(r){if(!n.isBuffer(r))throw new TypeError("Expected Buffer");if(0===r.length)return"";for(var e=0,o=0,i=0,a=r.length;i!==a&&0===r[i];)i++,e++;for(var c=(a-i)*s+1>>>0,h=new Uint8Array(c);i!==a;){for(var l=r[i],p=0,d=c-1;(0!==l||p>>0,h[d]=l%u>>>0,l=l/u>>>0;if(0!==l)throw new Error("Non-zero carry");o=p,i++}for(var g=c-o;g!==c&&0===h[g];)g++;for(var y=f.repeat(e);g10&&(r="..."+r.substr(-10));var e=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+t+" bytes: "+r+" <-");throw e.position=t,e},p=function(t){if(!/^[A-Z2-7=]+$/.test(t))throw new Error("Invalid base32 characters");for(var r,e,n,o,i,u,f,a,s=[],h=0,l=(t=t.replace(/=/g,"")).length,p=0,d=l>>3<<3;p>>2),s[h++]=255&(e<<6|n<<1|o>>>4),s[h++]=255&(o<<4|i>>>1),s[h++]=255&(i<<7|u<<2|f>>>3),s[h++]=255&(f<<5|a);var g=l-d;return 2===g?(r=c[t.charAt(p++)],e=c[t.charAt(p++)],s[h++]=255&(r<<3|e>>>2)):4===g?(r=c[t.charAt(p++)],e=c[t.charAt(p++)],n=c[t.charAt(p++)],o=c[t.charAt(p++)],s[h++]=255&(r<<3|e>>>2),s[h++]=255&(e<<6|n<<1|o>>>4)):5===g?(r=c[t.charAt(p++)],e=c[t.charAt(p++)],n=c[t.charAt(p++)],o=c[t.charAt(p++)],i=c[t.charAt(p++)],s[h++]=255&(r<<3|e>>>2),s[h++]=255&(e<<6|n<<1|o>>>4),s[h++]=255&(o<<4|i>>>1)):7===g&&(r=c[t.charAt(p++)],e=c[t.charAt(p++)],n=c[t.charAt(p++)],o=c[t.charAt(p++)],i=c[t.charAt(p++)],u=c[t.charAt(p++)],f=c[t.charAt(p++)],s[h++]=255&(r<<3|e>>>2),s[h++]=255&(e<<6|n<<1|o>>>4),s[h++]=255&(o<<4|i>>>1),s[h++]=255&(i<<7|u<<2|f>>>3)),s},d=function(t,r){if(!r)return function(t){for(var r,e,n="",o=t.length,i=0,u=0;i191&&r<=223?(e=31&r,u=1):r<=239?(e=15&r,u=2):r<=247?(e=7&r,u=3):l(i,n);for(var f=0;f191)&&l(i,n),e<<=6,e+=63&r;e>=55296&&e<=57343&&l(i,n),e>1114111&&l(i,n),e<=65535?n+=String.fromCharCode(e):(e-=65536,n+=String.fromCharCode(55296+(e>>10)),n+=String.fromCharCode(56320+(1023&e)))}return n}(p(t));if(!/^[A-Z2-7=]+$/.test(t))throw new Error("Invalid base32 characters");var e,n,o,i,u,f,a,s,h="",d=t.indexOf("=");-1===d&&(d=t.length);for(var g=0,y=d>>3<<3;g>>2))+String.fromCharCode(255&(n<<6|o<<1|i>>>4))+String.fromCharCode(255&(i<<4|u>>>1))+String.fromCharCode(255&(u<<7|f<<2|a>>>3))+String.fromCharCode(255&(a<<5|s));var w=d-y;return 2===w?(e=c[t.charAt(g++)],n=c[t.charAt(g++)],h+=String.fromCharCode(255&(e<<3|n>>>2))):4===w?(e=c[t.charAt(g++)],n=c[t.charAt(g++)],o=c[t.charAt(g++)],i=c[t.charAt(g++)],h+=String.fromCharCode(255&(e<<3|n>>>2))+String.fromCharCode(255&(n<<6|o<<1|i>>>4))):5===w?(e=c[t.charAt(g++)],n=c[t.charAt(g++)],o=c[t.charAt(g++)],i=c[t.charAt(g++)],u=c[t.charAt(g++)],h+=String.fromCharCode(255&(e<<3|n>>>2))+String.fromCharCode(255&(n<<6|o<<1|i>>>4))+String.fromCharCode(255&(i<<4|u>>>1))):7===w&&(e=c[t.charAt(g++)],n=c[t.charAt(g++)],o=c[t.charAt(g++)],i=c[t.charAt(g++)],u=c[t.charAt(g++)],f=c[t.charAt(g++)],a=c[t.charAt(g++)],h+=String.fromCharCode(255&(e<<3|n>>>2))+String.fromCharCode(255&(n<<6|o<<1|i>>>4))+String.fromCharCode(255&(i<<4|u>>>1))+String.fromCharCode(255&(u<<7|f<<2|a>>>3))),h},g={encode:function(t,r){var e="string"!=typeof t;return e&&t.constructor===ArrayBuffer&&(t=new Uint8Array(t)),e?function(t){for(var r,e,n,o,i,u="",f=t.length,a=0,c=5*parseInt(f/5);a>>3]+s[31&(r<<2|e>>>6)]+s[e>>>1&31]+s[31&(e<<4|n>>>4)]+s[31&(n<<1|o>>>7)]+s[o>>>2&31]+s[31&(o<<3|i>>>5)]+s[31&i];var h=f-c;return 1===h?(r=t[a],u+=s[r>>>3]+s[r<<2&31]+"======"):2===h?(r=t[a++],e=t[a],u+=s[r>>>3]+s[31&(r<<2|e>>>6)]+s[e>>>1&31]+s[e<<4&31]+"===="):3===h?(r=t[a++],e=t[a++],n=t[a],u+=s[r>>>3]+s[31&(r<<2|e>>>6)]+s[e>>>1&31]+s[31&(e<<4|n>>>4)]+s[n<<1&31]+"==="):4===h&&(r=t[a++],e=t[a++],n=t[a++],o=t[a],u+=s[r>>>3]+s[31&(r<<2|e>>>6)]+s[e>>>1&31]+s[31&(e<<4|n>>>4)]+s[31&(n<<1|o>>>7)]+s[o>>>2&31]+s[o<<3&31]+"="),u}(t):r?function(t){for(var r,e,n,o,i,u="",f=t.length,a=0,c=5*parseInt(f/5);a>>3]+s[31&(r<<2|e>>>6)]+s[e>>>1&31]+s[31&(e<<4|n>>>4)]+s[31&(n<<1|o>>>7)]+s[o>>>2&31]+s[31&(o<<3|i>>>5)]+s[31&i];var h=f-c;return 1===h?(r=t.charCodeAt(a),u+=s[r>>>3]+s[r<<2&31]+"======"):2===h?(r=t.charCodeAt(a++),e=t.charCodeAt(a),u+=s[r>>>3]+s[31&(r<<2|e>>>6)]+s[e>>>1&31]+s[e<<4&31]+"===="):3===h?(r=t.charCodeAt(a++),e=t.charCodeAt(a++),n=t.charCodeAt(a),u+=s[r>>>3]+s[31&(r<<2|e>>>6)]+s[e>>>1&31]+s[31&(e<<4|n>>>4)]+s[n<<1&31]+"==="):4===h&&(r=t.charCodeAt(a++),e=t.charCodeAt(a++),n=t.charCodeAt(a++),o=t.charCodeAt(a),u+=s[r>>>3]+s[31&(r<<2|e>>>6)]+s[e>>>1&31]+s[31&(e<<4|n>>>4)]+s[31&(n<<1|o>>>7)]+s[o>>>2&31]+s[o<<3&31]+"="),u}(t):function(t){var r,e,n,o,i,u,f,a=!1,c="",l=0,p=0,d=t.length;do{for(h[0]=h[5],h[1]=h[6],h[2]=h[7],f=p;l>6,h[f++]=128|63&u):u<55296||u>=57344?(h[f++]=224|u>>12,h[f++]=128|u>>6&63,h[f++]=128|63&u):(u=65536+((1023&u)<<10|1023&t.charCodeAt(++l)),h[f++]=240|u>>18,h[f++]=128|u>>12&63,h[f++]=128|u>>6&63,h[f++]=128|63&u);f-p,p=f-5,l===d&&++l,l>d&&f<6&&(a=!0),r=h[0],f>4?(e=h[1],n=h[2],o=h[3],i=h[4],c+=s[r>>>3]+s[31&(r<<2|e>>>6)]+s[e>>>1&31]+s[31&(e<<4|n>>>4)]+s[31&(n<<1|o>>>7)]+s[o>>>2&31]+s[31&(o<<3|i>>>5)]+s[31&i]):1===f?c+=s[r>>>3]+s[r<<2&31]+"======":2===f?(e=h[1],c+=s[r>>>3]+s[31&(r<<2|e>>>6)]+s[e>>>1&31]+s[e<<4&31]+"===="):3===f?(e=h[1],n=h[2],c+=s[r>>>3]+s[31&(r<<2|e>>>6)]+s[e>>>1&31]+s[31&(e<<4|n>>>4)]+s[n<<1&31]+"==="):(e=h[1],n=h[2],o=h[3],c+=s[r>>>3]+s[31&(r<<2|e>>>6)]+s[e>>>1&31]+s[31&(e<<4|n>>>4)]+s[31&(n<<1|o>>>7)]+s[o>>>2&31]+s[o<<3&31]+"=")}while(!a);return c}(t)},decode:d};d.asBytes=p,f?n.exports=g:(u.base32=g,a&&(void 0===(o=function(){return g}.call(g,e,g,n))||(n.exports=o)))}()}).call(this,e(19),e(3),e(20)(t))},function(t,r,e){"use strict";var n,o,i=t.exports={};function u(){throw new Error("setTimeout has not been defined")}function f(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===u||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(r){try{return n.call(null,t,0)}catch(r){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:u}catch(t){n=u}try{o="function"==typeof clearTimeout?clearTimeout:f}catch(t){o=f}}();var s,c=[],h=!1,l=-1;function p(){h&&s&&(h=!1,s.length?c=s.concat(c):l=-1,c.length&&d())}function d(){if(!h){var t=a(p);h=!0;for(var r=c.length;r;){for(s=c,c=[];++l1)for(var e=1;e=i;)e[u++]=255&r|n,r/=128;for(;r&o;)e[u++]=255&r|n,r>>>=7;e[u]=0|r;t.bytes=u-f+1;return e};var n=128,o=-128,i=Math.pow(2,31)},function(t,r,e){"use strict";t.exports=function t(r,e){var i,u=0,f=(e=e||0,0),a=e,s=r.length;do{if(a>=s)throw t.bytes=0,new RangeError("Could not decode varint");i=r[a++],u+=f<28?(i&o)<=n);t.bytes=a-e;return u};var n=128,o=127},function(t,r,e){"use strict";var n=Math.pow(2,7),o=Math.pow(2,14),i=Math.pow(2,21),u=Math.pow(2,28),f=Math.pow(2,35),a=Math.pow(2,42),s=Math.pow(2,49),c=Math.pow(2,56),h=Math.pow(2,63);t.exports=function(t){return t